@pie-element/explicit-constructed-response 11.1.2-next.7 → 11.1.2-next.8
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/author/defaults.js +1 -1
- package/dist/browser/author/index.js +2 -2
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +2 -2
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +2 -2
- package/dist/browser/{dist-HhpuchEj.js → dist-BWYkwJ9C.js} +3233 -3146
- package/dist/browser/dist-BWYkwJ9C.js.map +1 -0
- package/dist/browser/{main-CsLCZ3jN.js → main-D9vmd7wD.js} +2 -2
- package/dist/browser/{main-CsLCZ3jN.js.map → main-D9vmd7wD.js.map} +1 -1
- package/dist/browser/print/index.js +2 -2
- package/dist/controller/defaults.js +1 -1
- package/dist/controller/index.d.ts +1 -1
- package/dist/controller/index.js +1 -1
- package/dist/index.iife.js +26 -26
- package/package.json +4 -4
- package/dist/browser/dist-HhpuchEj.js.map +0 -1
package/dist/index.iife.js
CHANGED
|
@@ -310,29 +310,29 @@ ${n}`}}),s}function CB(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants
|
|
|
310
310
|
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
|
|
311
311
|
`),[i,a]=FU(r);if(i.length===0)return;let o=IU(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
|
|
312
312
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(RU,this.editor.getAttributes(zU)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=fB({find:BU,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=fB({find:BU,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(zU)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),HU=/^\s*(\[([( |x])?\])\s$/,UU=wB.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,PR(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>SB(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=FR(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[fB({find:HU,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),WU=wB.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,PR(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
313
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=xB(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=xB(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Zz.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(gU.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(yU.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(AU.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(VU.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(UU.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(WU.configure(this.options.taskList)),e}});var GU=` `,KU=`\xA0`,qU=wB.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,PR(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===GU||n[0].text===GU||n[0].raw===KU||n[0].text===KU)&&r.length===1&&r[0].type===`text`&&(r[0].text===GU||r[0].text===KU)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?GU:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),JU=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,YU=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,XU=Hz.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,PR(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[lB({find:JU,type:this.type})]},addPasteRules(){return[TB({find:YU,type:this.type})]}}),ZU=wB.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),QU=Hz.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,PR(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function $U(e={}){return new Db({view(t){return new eW(t,e)}})}var eW=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=By(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},tW=class e extends sb{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):sb.near(r)}content(){return H.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new nW(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!iW(e)||!aW(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!W.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};tW.prototype.visible=!1,tW.findFrom=tW.findGapCursorFrom,sb.jsonID(`gapcursor`,tW);var nW=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return tW.valid(t)?new tW(t):sb.near(t)}};function rW(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function iW(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||rW(e.type))return!0;if(e.inlineContent)return!1}}return!0}function aW(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||rW(e.type))return!0;if(e.inlineContent)return!1}}return!0}function oW(){return new Db({props:{decorations:dW,createSelectionBetween(e,t,n){return t.pos==n.pos&&tW.valid(n)?new tW(n):null},handleClick:lW,handleKeyDown:sW,handleDOMEvents:{beforeinput:uW}}})}var sW=OD({ArrowLeft:cW(`horiz`,-1),ArrowRight:cW(`horiz`,1),ArrowUp:cW(`vert`,-1),ArrowDown:cW(`vert`,1)});function cW(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof U){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=tW.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new tW(c))),!0):!1}}function lW(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!tW.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&W.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new tW(r))),!0)}function uW(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof tW))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=V.empty;for(let e=r.length-1;e>=0;e--)i=V.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new H(i,0,0));return a.setSelection(U.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function dW(e){if(!(e.selection instanceof tW))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,fI.create(e.doc,[lI.widget(e.selection.head,t,{key:`gapcursor`})])}var fW=200,pW=function(){};pW.prototype.append=function(e){return e.length?(e=pW.from(e),!this.length&&e||e.length<fW&&this.leafAppend(e)||this.length<fW&&e.leafPrepend(this)||this.appendInner(e)):this},pW.prototype.prepend=function(e){return e.length?pW.from(e).append(this):this},pW.prototype.appendInner=function(e){return new hW(this,e)},pW.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?pW.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},pW.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},pW.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},pW.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},pW.from=function(e){return e instanceof pW?e:e&&e.length?new mW(e):pW.empty};var mW=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=fW)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=fW)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(pW);pW.empty=new mW([]);var hW=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(pW),gW=500,_W=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new yW(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new yW(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new yW(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>xW&&(s=vW(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new iy;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new yW(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new yW(i,o,l))}else r.push(new yW(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new yW(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>gW&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new yW(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(pW.from(i.reverse()),a)}};_W.empty=new _W(pW.empty,0);function vW(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var yW=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},bW=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},xW=20;function SW(e,t,n,r){let i=n.getMeta(AW),a;if(i)return i.historyState;n.getMeta(jW)&&(e=new bW(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(AW))return o.getMeta(AW).redo?new bW(e.done.addTransform(n,void 0,r,kW(t)),e.undone,wW(n.mapping.maps),e.prevTime,e.prevComposition):new bW(e.done,e.undone.addTransform(n,void 0,r,kW(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!CW(n,e.prevRanges)),s=o?TW(e.prevRanges,n.mapping):wW(n.mapping.maps);return new bW(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,kW(t)),_W.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new bW(e.done.rebased(n,a),e.undone.rebased(n,a),TW(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new bW(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),TW(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function CW(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function wW(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function TW(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function EW(e,t,n){let r=kW(t),i=AW.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new bW(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(AW,{redo:n,historyState:c})}var DW=!1,OW=null;function kW(e){let t=e.plugins;if(OW!=t){DW=!1,OW=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){DW=!0;break}}return DW}var AW=new Ab(`history`),jW=new Ab(`closeHistory`);function MW(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Db({key:AW,state:{init(){return new bW(_W.empty,_W.empty,null,0,-1)},apply(t,n,r){return SW(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?PW:n==`historyRedo`?FW:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function NW(e,t){return(n,r)=>{let i=AW.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=EW(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var PW=NW(!1,!0),FW=NW(!0,!0);Zz.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Db({key:new Ab(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var IW=Zz.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[$U(this.options)]}});Zz.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Db({key:new Ab(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return fI.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(lI.node(t,t+e.nodeSize,{class:this.options.className}))}),fI.create(e,a)}}})]}});var LW=Zz.create({name:`gapCursor`,addProseMirrorPlugins(){return[oW()]},extendNodeSchema(e){return{allowGapCursor:OR(wR(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),RW=`placeholder`,zW=new Ab(`tiptap__placeholder`),BW=200;function VW(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),lI.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function HW({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty,c={emptyEditor:t.emptyEditorClass,emptyNode:t.emptyNodeClass};if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),l=i.depth>0?i.node(1):i.nodeAfter,u=i.depth>0?i.before(1):a;if(l&&l.type.isTextblock&&sz(l)){let r=a>=u&&a<=u+l.nodeSize;o.push(VW({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:c,node:l,pos:u}))}}else{let i=zW.getState(e.state),l=i?.topPos??0,u=i?.bottomPos??r.content.size;r.nodesBetween(l,u,(r,i)=>{let l=a>=i&&a<=i+r.nodeSize,u=!r.isLeaf&&sz(r);return r.type.isTextblock&&(l||!t.showOnlyCurrent)&&u&&o.push(VW({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:l,placeholder:t.placeholder,classes:c,node:r,pos:i})),t.includeChildren})}return fI.create(r,o)}function UW(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function WW(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function GW(e){let t=e;for(;t;){if(WW(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}return window}t=e}return window}function KW(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function qW({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?KW(n):{top:0,bottom:window.innerHeight},a=Math.max(r.top,i.top)-BW,o=Math.min(r.bottom,i.bottom)+BW;if(a>=o)return{top:0,bottom:e.content.size};let s=getComputedStyle(t.dom).direction===`rtl`?Math.max(r.right-2,r.left+2):r.left+2,c=t.posAtCoords({left:s,top:a+2}),l=t.posAtCoords({left:s,top:o-2});return{top:c?c.pos:0,bottom:l?l.pos:e.content.size}}var JW={init(){return{topPos:null,bottomPos:null}},apply(e,t){let n=e.getMeta(zW);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos===null?null:e.mapping.map(t.topPos),bottomPos:t.bottomPos===null?null:e.mapping.map(t.bottomPos)}:t}};function YW(e){let t=GW(e.dom),n=()=>{let n=qW({view:e,doc:e.state.doc,scrollContainer:t}),r=zW.getState(e.state);if(r?.topPos===n.top&&r?.bottomPos===n.bottom)return;let i=e.state.tr.setMeta(zW,{positions:n});e.dispatch(i)},r=null,i=0,a=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):a()}))};return t.addEventListener(`scroll`,a,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&a()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener(`scroll`,a)}}}function XW({editor:e,options:t}){let n=t.dataAttribute?`data-${UW(t.dataAttribute)}`:`data-${RW}`;return new Db({key:zW,state:JW,view:YW,props:{decorations:({doc:r,selection:i})=>HW({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}Zz.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:RW,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[XW({editor:this.editor,options:this.options})]}}),Zz.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new Db({key:new Ab(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||cz(n.selection)||e.view.dragging?null:fI.create(n.doc,[lI.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function ZW({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var QW=Zz.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new Ab(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new Db({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!ZW({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!ZW({node:r,types:n})}}})]}}),$W=Zz.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>PW(e,t),redo:()=>({state:e,dispatch:t})=>FW(e,t)}},addProseMirrorPlugins(){return[MW(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),eG=Zz.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(NB.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(OB.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(gU.configure(this.options.bulletList)),this.options.code!==!1&&e.push(IB.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(BB.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(VB.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(IW.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(LW.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(HB.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(UB.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push($W.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(WB.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(YB.configure(this.options.italic)),this.options.listItem!==!1&&e.push(yU.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(AU.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(uU.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(VU.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(qU.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(XU.configure(this.options.strike)),this.options.text!==!1&&e.push(ZU.configure(this.options.text)),this.options.underline!==!1&&e.push(QU.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(QW.configure(this.options?.trailingNode)),e}}),tG=20,nG=(e,t=0)=>{let n=[];return!e.children.length||t>tG||Array.from(e.children).forEach(e=>{e.tagName===`SPAN`?n.push(e):e.children.length&&n.push(...nG(e,t+1))}),n},rG=e=>{if(!e.children.length)return;let t=nG(e);t&&t.forEach(e=>{let t=e.getAttribute(`style`),n=(e.parentElement?.closest(`span`))?.getAttribute(`style`);e.setAttribute(`style`,`${n};${t}`)})},iG=hA.create({name:`textStyle`,priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:`span`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?(this.options.mergeNestedSpanStyles&&rG(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return[`span`,rk(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),aG=CA.create({name:`backgroundColor`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{let t=e.getAttribute(`style`);if(t){let e=t.split(`;`).map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;--t){let n=e[t].split(`:`);if(n.length>=2){let e=n[0].trim().toLowerCase(),t=n.slice(1).join(`:`).trim();if(e===`background-color`)return t.replace(/['"]+/g,``)}}}return e.style.backgroundColor?.replace(/['"]+/g,``)},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark(`textStyle`,{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark(`textStyle`,{backgroundColor:null}).removeEmptyTextStyle().run()}}}),oG=CA.create({name:`color`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{let t=e.getAttribute(`style`);if(t){let e=t.split(`;`).map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;--t){let n=e[t].split(`:`);if(n.length>=2){let e=n[0].trim().toLowerCase(),t=n.slice(1).join(`:`).trim();if(e===`color`)return t.replace(/['"]+/g,``)}}}return e.style.color?.replace(/['"]+/g,``)},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark(`textStyle`,{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark(`textStyle`,{color:null}).removeEmptyTextStyle().run()}}}),sG=CA.create({name:`fontFamily`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark(`textStyle`,{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark(`textStyle`,{fontFamily:null}).removeEmptyTextStyle().run()}}}),cG=CA.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark(`textStyle`,{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}}),lG=CA.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark(`textStyle`,{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark(`textStyle`,{lineHeight:null}).removeEmptyTextStyle().run()}}}),uG=CA.create({name:`textStyleKit`,addExtensions(){let e=[];return this.options.backgroundColor!==!1&&e.push(aG.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(oG.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(sG.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(cG.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(lG.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(iG.configure(this.options.textStyle)),e}}),dG=CA.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Db({key:new Ab(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});CA.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[$U(this.options)]}}),CA.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Db({key:new Ab(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return OE.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(TE.node(t,t+e.nodeSize,{class:this.options.className}))}),OE.create(e,a)}}})]}}),CA.create({name:`gapCursor`,addProseMirrorPlugins(){return[oW()]},extendNodeSchema(e){return{allowGapCursor:$O(YO(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}});var fG=`placeholder`,pG=new Ab(`tiptap__placeholder`),mG=200;function hG(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),TE.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function gG({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty,c={emptyEditor:t.emptyEditorClass,emptyNode:t.emptyNodeClass};if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),l=i.depth>0?i.node(1):i.nodeAfter,u=i.depth>0?i.before(1):a;if(l&&l.type.isTextblock&&jk(l)){let r=a>=u&&a<=u+l.nodeSize;o.push(hG({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:c,node:l,pos:u}))}}else{let i=pG.getState(e.state),l=i?.topPos??0,u=i?.bottomPos??r.content.size;r.nodesBetween(l,u,(r,i)=>{let l=a>=i&&a<=i+r.nodeSize,u=!r.isLeaf&&jk(r);return r.type.isTextblock&&(l||!t.showOnlyCurrent)&&u&&o.push(hG({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:l,placeholder:t.placeholder,classes:c,node:r,pos:i})),t.includeChildren})}return OE.create(r,o)}function _G(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function vG(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function yG(e){let t=e;for(;t;){if(vG(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}return window}t=e}return window}function bG(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function xG({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?bG(n):{top:0,bottom:window.innerHeight},a=Math.max(r.top,i.top)-mG,o=Math.min(r.bottom,i.bottom)+mG;if(a>=o)return{top:0,bottom:e.content.size};let s=getComputedStyle(t.dom).direction===`rtl`?Math.max(r.right-2,r.left+2):r.left+2,c=t.posAtCoords({left:s,top:a+2}),l=t.posAtCoords({left:s,top:o-2});return{top:c?c.pos:0,bottom:l?l.pos:e.content.size}}var SG={init(){return{topPos:null,bottomPos:null}},apply(e,t){let n=e.getMeta(pG);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos===null?null:e.mapping.map(t.topPos),bottomPos:t.bottomPos===null?null:e.mapping.map(t.bottomPos)}:t}};function CG(e){let t=yG(e.dom),n=()=>{let n=xG({view:e,doc:e.state.doc,scrollContainer:t}),r=pG.getState(e.state);if(r?.topPos===n.top&&r?.bottomPos===n.bottom)return;let i=e.state.tr.setMeta(pG,{positions:n});e.dispatch(i)},r=null,i=0,a=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):a()}))};return t.addEventListener(`scroll`,a,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&a()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener(`scroll`,a)}}}function wG({editor:e,options:t}){let n=t.dataAttribute?`data-${_G(t.dataAttribute)}`:`data-${fG}`;return new Db({key:pG,state:SG,view:CG,props:{decorations:({doc:r,selection:i})=>gG({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}var TG=CA.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:fG,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[wG({editor:this.editor,options:this.options})]}});CA.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new Db({key:new Ab(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||Mk(n.selection)||e.view.dragging?null:OE.create(n.doc,[TE.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function EG({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}CA.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new Ab(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new Db({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!EG({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!EG({node:r,types:n})}}})]}}),CA.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>PW(e,t),redo:()=>({state:e,dispatch:t})=>FW(e,t)}},addProseMirrorPlugins(){return[MW(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});var DG=hA.create({name:`superscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sup`},{style:`vertical-align`,getAttrs(e){return e===`super`&&null}}]},renderHTML({HTMLAttributes:e}){return[`sup`,rk(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),OG=hA.create({name:`subscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sub`},{style:`vertical-align`,getAttrs(e){return e===`sub`&&null}}]},renderHTML({HTMLAttributes:e}){return[`sub`,rk(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),kG=CA.create({name:`textAlign`,addOptions(){return{types:[],alignments:[`left`,`center`,`right`,`justify`],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign(`left`),"Mod-Shift-e":()=>this.editor.commands.setTextAlign(`center`),"Mod-Shift-r":()=>this.editor.commands.setTextAlign(`right`),"Mod-Shift-j":()=>this.editor.commands.setTextAlign(`justify`)}}}),AG=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,jG=$A.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,rk(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);Object.entries(o).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),c.src=o.src;let l=new HA({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),u=l.dom;return u.style.visibility=`hidden`,u.style.pointerEvents=`none`,c.onload=()=>{u.style.visibility=``,u.style.pointerEvents=``},l}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[zA({find:AG,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),MG=TG,NG=e=>String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),PG=e=>{let t=document.createElement(`div`);t.innerHTML=e;let n=Array.from(t.children);return n.length<2||!n.every(e=>e.tagName===`DIV`)||!n.every(e=>e.attributes.length===0)||!n.every(e=>Array.from(e.children).every(e=>{let t=e.tagName;return[`SPAN`,`B`,`I`,`EM`,`STRONG`,`U`,`SUB`,`SUP`,`A`,`CODE`,`BR`].includes(t)}))?e:`<p>${n.map(e=>e.innerHTML).join(`<br>`)}</p>`},FG=e=>{let t=String(e??``).trim();return t?/<[^>]+>/.test(t)?PG(t):`<div>${NG(t)}</div>`:`<div></div>`},IG,LG;if(typeof WeakMap<`u`){let e=new WeakMap;IG=t=>e.get(t),LG=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;IG=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},LG=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var RG=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return IG(e)||LG(e,zG(e))}};function zG(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=BG(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new RG(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&VG(s,o,e),s}function BG(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function VG(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=HG(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function HG(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function UG(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var WG=new Ab(`selectingCells`);function GG(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function KG(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function qG(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function JG(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=GG(t.$head)||YG(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function YG(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function XG(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function ZG(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function QG(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function $G(e,t,n){let r=e.node(-1),i=RG.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function eK(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function tK(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function nK(e,t,n){let r=UG(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var rK=class e extends sb{constructor(e,t=e){let n=e.node(-1),r=RG.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new cb(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(XG(r)&&XG(i)&&QG(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return U.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=RG.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=eK(e,0,l)),u>0&&(e=eK(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(V.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new H(V.from(o),1,1)}replace(e,t=H.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?H.empty:t)}let i=sb.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new H(V.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=RG.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=RG.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=RG.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=RG.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new iK(this.$anchorCell.pos,this.$headCell.pos)}};rK.prototype.visible=!1,sb.jsonID(`cell`,rK);var iK=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&QG(t,n)?new rK(t,n):sb.near(n,1)}};function aK(e){if(!(e.selection instanceof rK))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(lI.node(n,n+e.nodeSize,{class:`selectedCell`}))}),fI.create(e.doc,t)}function oK({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function sK({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function cK(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof W&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=rK.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=rK.rowSelection(e,e)}else if(!n){let e=RG.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=rK.create(i,t+1,n)}}else r instanceof U&&oK(r)?a=U.create(i,r.from):r instanceof U&&sK(r)&&(a=U.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var lK=new Ab(`fix-tables`);function uK(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?uK(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function dK(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=fK(e,t,r,n))};return t?t.doc!=e.doc&&uK(t.doc,e.doc,0,r):e.doc.descendants(r),n}function fK(e,t,n,r){let i=RG.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,eK(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=UG(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(lK,{fixTables:!0})}function pK(e){let t=e.selection,n=JG(e),r=n.node(-1),i=n.start(-1),a=RG.get(r);return{...t instanceof rK?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function mK(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;nK(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,tK(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?UG(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function hK(e,t){if(!qG(e))return!1;if(t){let n=pK(e);t(mK(e.tr,n,n.left))}return!0}function gK(e,t){if(!qG(e))return!1;if(t){let n=pK(e);t(mK(e.tr,n,n.right))}return!0}function _K(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,eK(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function vK(e,t){if(!qG(e))return!1;if(t){let n=pK(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;_K(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=RG.get(e)}t(r)}return!0}function yK(e,t,n){let r=UG(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function bK(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;yK(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?UG(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,UG(r.type.schema).row.create(null,o)),e}function xK(e,t){if(!qG(e))return!1;if(t){let n=pK(e);t(bK(e.tr,n,n.top))}return!0}function SK(e,t){if(!qG(e))return!1;if(t){let n=pK(e);t(bK(e.tr,n,n.bottom))}return!0}function CK(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function wK(e,t){if(!qG(e))return!1;if(t){let n=pK(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;CK(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=RG.get(n.table)}t(r)}return!0}function TK(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function EK({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function DK(e,t){let n=e.selection;if(!(n instanceof rK)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=pK(e),{map:i}=r;if(EK(i,r))return!1;if(t){let n=e.tr,a={},o=V.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{TK(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...tK(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=TK(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new rK(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function OK(e,t){let n=UG(e.schema);return kK(({node:e})=>n[e.type.spec.tableRole])(e,t)}function kK(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof rK){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=KG(r.$from),!i)return!1;a=GG(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=pK(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof rK&&u.setSelection(new rK(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function AK(e,t){return function(n,r){if(!qG(n))return!1;let i=JG(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof rK?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function jK(e){return function(t,n){if(!qG(t))return!1;if(n){let r=UG(t.schema),i=pK(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function MK(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function NK(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?jK(e):function(t,n){if(!qG(t))return!1;if(n){let r=UG(t.schema),i=pK(t),a=t.tr,o=MK(`row`,i,r),s=MK(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}NK(`row`,{useDeprecatedLogic:!0}),NK(`column`,{useDeprecatedLogic:!0});var PK=NK(`cell`,{useDeprecatedLogic:!0});function FK(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function IK(e){return function(t,n){if(!qG(t))return!1;let r=FK(JG(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(U.between(e,ZG(e))).scrollIntoView())}return!0}}function LK(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function RK(e,t){let n=e.selection;if(!(n instanceof rK))return!1;if(t){let r=e.tr,i=UG(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new H(i,0,0))}),r.docChanged&&t(r)}return!0}function zK(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=VK(UG(o).row,new H(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?VK(UG(o).row,new H(t,n,r)).content:t);else return null;return BK(o,s)}function BK(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(V.empty),n[i]<r){let a=UG(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(V.from(o))}return{height:t.length,width:r,rows:t}}function VK(e,t){let n=e.createAndFill();return new ab(n).replace(0,n.content.size,t).doc}function HK({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(eK(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(V.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(V.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function UK(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=UG(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,V.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function WK(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function GK(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,eK(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(eK(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function KK(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=RG.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=RG.get(a),f=d.mapping.maps.length}UK(d,o,a,n,l,u,f)&&p(),WK(d,o,a,n,c,l,s,f)&&p(),WK(d,o,a,n,c,l,u,f)&&p(),GK(d,o,a,n,s,u,c,f)&&p(),GK(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new H(i.rows[e-s],0,0))}p(),d.setSelection(new rK(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var qK=OD({ArrowLeft:YK(`horiz`,-1),ArrowRight:YK(`horiz`,1),ArrowUp:YK(`vert`,-1),ArrowDown:YK(`vert`,1),"Shift-ArrowLeft":XK(`horiz`,-1),"Shift-ArrowRight":XK(`horiz`,1),"Shift-ArrowUp":XK(`vert`,-1),"Shift-ArrowDown":XK(`vert`,1),Backspace:RK,"Mod-Backspace":RK,Delete:RK,"Mod-Delete":RK});function JK(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function YK(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof rK)return JK(n,r,sb.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=eq(i,e,t);if(o==null)return!1;if(e==`horiz`)return JK(n,r,sb.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=$G(i,e,t),s;return s=a?sb.near(a,1):t<0?sb.near(n.doc.resolve(i.before(-1)),-1):sb.near(n.doc.resolve(i.after(-1)),1),JK(n,r,s)}}}function XK(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof rK)o=a;else{let r=eq(i,e,t);if(r==null)return!1;o=new rK(n.doc.resolve(r))}let s=$G(o.$headCell,e,t);return s?JK(n,r,new rK(o.$anchorCell,s)):!1}}function ZK(e,t){let n=e.state.doc,r=GG(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new rK(r))),!0):!1}function QK(e,t,n){if(!qG(e.state))return!1;let r=zK(n),i=e.state.selection;if(i instanceof rK){r||={width:1,height:1,rows:[V.from(VK(UG(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=RG.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=HK(r,o.right-o.left,o.bottom-o.top),KK(e.state,e.dispatch,a,o,r),!0}else if(r){let t=JG(e.state),n=t.start(-1);return KK(e.state,e.dispatch,n,RG.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function $K(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=tq(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof rK)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=GG(e.state.selection.$anchor))!=null&&nq(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=nq(e,n),i=WG.getState(e.state)==null;if(!r||!QG(t,r))if(i)r=t;else return;let a=new rK(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(WG,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),WG.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(WG,-1))}function o(r){let o=r,s=WG.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(tq(e,o.target)!=n&&(c=nq(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function eq(e,t,n){if(!(e.state.selection instanceof U))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function tq(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function nq(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&GG(e.state.doc.resolve(r))||GG(e.state.doc.resolve(i))}var rq=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),iq(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,iq(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function iq(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var aq=new Ab(`tableColumnResizing`);function oq({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=rq,lastColumnResizable:i=!0}={}){let a=new Db({key:aq,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=UG(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new sq(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=aq.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{cq(t,n,e,i)},mouseleave:e=>{lq(e)},mousedown:(e,r)=>{uq(e,r,t,n)}},decorations:e=>{let t=aq.getState(e);if(t&&t.activeHandle>-1)return yq(e,t.activeHandle)},nodeViews:{}}});return a}var sq=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(aq);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return XG(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function cq(e,t,n,r){if(!e.editable)return;let i=aq.getState(e.state);if(i&&!i.dragging){let a=fq(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=pq(e,t,`left`,n):i-t.clientX<=n&&(o=pq(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=RG.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}hq(e,o)}}}function lq(e){if(!e.editable)return;let t=aq.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&hq(e,-1)}function uq(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=aq.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=dq(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(aq,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=aq.getState(e.state);r?.dragging&&(gq(e,r.activeHandle,mq(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(aq,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=aq.getState(e.state);if(i&&i.dragging){let a=mq(i.dragging,t,n);_q(e,i.activeHandle,a,r)}}return _q(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function dq(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function fq(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function pq(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=GG(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=RG.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function mq(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function hq(e,t){e.dispatch(e.state.tr.setMeta(aq,{setHandle:t}))}function gq(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=RG.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():vq(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function _q(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=RG.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&iq(a,c.firstChild,c,r,s,n)}function vq(e){return Array(e).fill(0)}function yq(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return fI.empty;let a=RG.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,aq.getState(e)?.dragging&&n.push(lI.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(lI.widget(s,c))}}return fI.create(e.doc,n)}function bq({allowTableNodeSelection:e=!1}={}){return new Db({key:WG,state:{init(){return null},apply(e,t){let n=e.getMeta(WG);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:aK,handleDOMEvents:{mousedown:$K},createSelectionBetween(e){return WG.getState(e.state)==null?null:e.state.selection},handleTripleClick:ZK,handleKeyDown:qK,handlePaste:QK},appendTransaction(t,n,r){return cK(r,dK(r,n),e)}})}var xq=$A.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`),n=t?t.split(`,`).map(e=>parseInt(e,10)):null;if(!n){let t=e.closest(`table`)?.querySelectorAll(`colgroup > col`),n=Array.from(e.parentElement?.children||[]).indexOf(e);if(n&&n>-1&&t&&t[n]){let e=t[n].getAttribute(`width`);return e?[parseInt(e,10)]:null}}return n}}}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,rk(this.options.HTMLAttributes,e),0]}}),Sq=$A.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}}}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,rk(this.options.HTMLAttributes,e),0]}}),Cq=$A.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,rk(this.options.HTMLAttributes,e),0]}});function wq(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function Tq(e,t,n,r,i,a){var o;let s=0,c=!0,l=t.firstChild,u=e.firstChild;if(u!==null)for(let e=0,n=0;e<u.childCount;e+=1){let{colspan:o,colwidth:d}=u.child(e).attrs;for(let e=0;e<o;e+=1,n+=1){let o=i===n?a:d&&d[e],u=o?`${o}px`:``;if(s+=o||r,o||(c=!1),l){if(l.style.width!==u){let[e,t]=wq(r,o);l.style.setProperty(e,t)}l=l.nextSibling}else{let e=document.createElement(`col`),[n,i]=wq(r,o);e.style.setProperty(n,i),t.appendChild(e)}}}for(;l;){let e=l.nextSibling;(o=l.parentNode)==null||o.removeChild(l),l=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);c&&!d?(n.style.width=`${s}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${s}px`)}var Eq=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),Tq(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,Tq(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function Dq(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=wq(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function Oq(e,t){return t?e.createChecked(null,t):e.createAndFill()}function kq(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function Aq(e,t,n,r,i){let a=kq(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=Oq(a.cell,i);if(e&&s.push(e),r){let e=Oq(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function jq(e){return e instanceof rK}var Mq=({editor:e})=>{let{selection:t}=e.state;if(!jq(t))return!1;let n=0;return qO(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1};function Nq(e){return(e||``).replace(/\s+/g,` `).trim()}function Pq(e,t,n={}){let r=n.cellLineSeparator??``;if(!e||!e.content||e.content.length===0)return``;let i=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{let i=``;i=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(r):e.content?t.renderChildren(e.content):``;let a=Nq(i),o=e.type===`tableHeader`;n.push({text:a,isHeader:o})}),i.push(n)});let a=i.reduce((e,t)=>Math.max(e,t.length),0);if(a===0)return``;let o=Array(a).fill(0);i.forEach(e=>{for(let t=0;t<a;t+=1){let n=(e[t]?.text||``).length;n>o[t]&&(o[t]=n),o[t]<3&&(o[t]=3)}});let s=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),c=i[0],l=c.some(e=>e.isHeader),u=`
|
|
313
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=xB(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=xB(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Zz.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(gU.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(yU.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(AU.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(VU.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(UU.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(WU.configure(this.options.taskList)),e}});var GU=` `,KU=`\xA0`,qU=wB.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,PR(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===GU||n[0].text===GU||n[0].raw===KU||n[0].text===KU)&&r.length===1&&r[0].type===`text`&&(r[0].text===GU||r[0].text===KU)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?GU:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),JU=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,YU=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,XU=Hz.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,PR(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[lB({find:JU,type:this.type})]},addPasteRules(){return[TB({find:YU,type:this.type})]}}),ZU=wB.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),QU=Hz.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,PR(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function $U(e={}){return new Db({view(t){return new eW(t,e)}})}var eW=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=By(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},tW=class e extends sb{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):sb.near(r)}content(){return H.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new nW(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!iW(e)||!aW(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!W.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};tW.prototype.visible=!1,tW.findFrom=tW.findGapCursorFrom,sb.jsonID(`gapcursor`,tW);var nW=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return tW.valid(t)?new tW(t):sb.near(t)}};function rW(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function iW(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||rW(e.type))return!0;if(e.inlineContent)return!1}}return!0}function aW(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||rW(e.type))return!0;if(e.inlineContent)return!1}}return!0}function oW(){return new Db({props:{decorations:dW,createSelectionBetween(e,t,n){return t.pos==n.pos&&tW.valid(n)?new tW(n):null},handleClick:lW,handleKeyDown:sW,handleDOMEvents:{beforeinput:uW}}})}var sW=OD({ArrowLeft:cW(`horiz`,-1),ArrowRight:cW(`horiz`,1),ArrowUp:cW(`vert`,-1),ArrowDown:cW(`vert`,1)});function cW(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof U){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=tW.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new tW(c))),!0):!1}}function lW(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!tW.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&W.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new tW(r))),!0)}function uW(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof tW))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=V.empty;for(let e=r.length-1;e>=0;e--)i=V.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new H(i,0,0));return a.setSelection(U.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function dW(e){if(!(e.selection instanceof tW))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,fI.create(e.doc,[lI.widget(e.selection.head,t,{key:`gapcursor`})])}var fW=200,pW=function(){};pW.prototype.append=function(e){return e.length?(e=pW.from(e),!this.length&&e||e.length<fW&&this.leafAppend(e)||this.length<fW&&e.leafPrepend(this)||this.appendInner(e)):this},pW.prototype.prepend=function(e){return e.length?pW.from(e).append(this):this},pW.prototype.appendInner=function(e){return new hW(this,e)},pW.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?pW.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},pW.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},pW.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},pW.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},pW.from=function(e){return e instanceof pW?e:e&&e.length?new mW(e):pW.empty};var mW=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=fW)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=fW)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(pW);pW.empty=new mW([]);var hW=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(pW),gW=500,_W=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new yW(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new yW(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new yW(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>xW&&(s=vW(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new iy;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new yW(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new yW(i,o,l))}else r.push(new yW(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new yW(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>gW&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new yW(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(pW.from(i.reverse()),a)}};_W.empty=new _W(pW.empty,0);function vW(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var yW=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},bW=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},xW=20;function SW(e,t,n,r){let i=n.getMeta(AW),a;if(i)return i.historyState;n.getMeta(jW)&&(e=new bW(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(AW))return o.getMeta(AW).redo?new bW(e.done.addTransform(n,void 0,r,kW(t)),e.undone,wW(n.mapping.maps),e.prevTime,e.prevComposition):new bW(e.done,e.undone.addTransform(n,void 0,r,kW(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!CW(n,e.prevRanges)),s=o?TW(e.prevRanges,n.mapping):wW(n.mapping.maps);return new bW(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,kW(t)),_W.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new bW(e.done.rebased(n,a),e.undone.rebased(n,a),TW(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new bW(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),TW(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function CW(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function wW(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function TW(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function EW(e,t,n){let r=kW(t),i=AW.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new bW(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(AW,{redo:n,historyState:c})}var DW=!1,OW=null;function kW(e){let t=e.plugins;if(OW!=t){DW=!1,OW=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){DW=!0;break}}return DW}var AW=new Ab(`history`),jW=new Ab(`closeHistory`);function MW(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Db({key:AW,state:{init(){return new bW(_W.empty,_W.empty,null,0,-1)},apply(t,n,r){return SW(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?PW:n==`historyRedo`?FW:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function NW(e,t){return(n,r)=>{let i=AW.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=EW(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var PW=NW(!1,!0),FW=NW(!0,!0);Zz.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Db({key:new Ab(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var IW=Zz.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[$U(this.options)]}});Zz.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Db({key:new Ab(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return fI.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(lI.node(t,t+e.nodeSize,{class:this.options.className}))}),fI.create(e,a)}}})]}});var LW=Zz.create({name:`gapCursor`,addProseMirrorPlugins(){return[oW()]},extendNodeSchema(e){return{allowGapCursor:OR(wR(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),RW=`placeholder`,zW=new Ab(`tiptap__placeholder`),BW=200;function VW(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),lI.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function HW({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty,c={emptyEditor:t.emptyEditorClass,emptyNode:t.emptyNodeClass};if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),l=i.depth>0?i.node(1):i.nodeAfter,u=i.depth>0?i.before(1):a;if(l&&l.type.isTextblock&&sz(l)){let r=a>=u&&a<=u+l.nodeSize;o.push(VW({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:c,node:l,pos:u}))}}else{let i=zW.getState(e.state),l=i?.topPos??0,u=i?.bottomPos??r.content.size;r.nodesBetween(l,u,(r,i)=>{let l=a>=i&&a<=i+r.nodeSize,u=!r.isLeaf&&sz(r);return r.type.isTextblock&&(l||!t.showOnlyCurrent)&&u&&o.push(VW({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:l,placeholder:t.placeholder,classes:c,node:r,pos:i})),t.includeChildren})}return fI.create(r,o)}function UW(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function WW(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function GW(e){let t=e;for(;t;){if(WW(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}return window}t=e}return window}function KW(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function qW({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?KW(n):{top:0,bottom:window.innerHeight},a=Math.max(r.top,i.top)-BW,o=Math.min(r.bottom,i.bottom)+BW;if(a>=o)return{top:0,bottom:e.content.size};let s=getComputedStyle(t.dom).direction===`rtl`?Math.max(r.right-2,r.left+2):r.left+2,c=t.posAtCoords({left:s,top:a+2}),l=t.posAtCoords({left:s,top:o-2});return{top:c?c.pos:0,bottom:l?l.pos:e.content.size}}var JW={init(){return{topPos:null,bottomPos:null}},apply(e,t){let n=e.getMeta(zW);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos===null?null:e.mapping.map(t.topPos),bottomPos:t.bottomPos===null?null:e.mapping.map(t.bottomPos)}:t}};function YW(e){let t=GW(e.dom),n=()=>{let n=qW({view:e,doc:e.state.doc,scrollContainer:t}),r=zW.getState(e.state);if(r?.topPos===n.top&&r?.bottomPos===n.bottom)return;let i=e.state.tr.setMeta(zW,{positions:n});e.dispatch(i)},r=null,i=0,a=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):a()}))};return t.addEventListener(`scroll`,a,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&a()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener(`scroll`,a)}}}function XW({editor:e,options:t}){let n=t.dataAttribute?`data-${UW(t.dataAttribute)}`:`data-${RW}`;return new Db({key:zW,state:JW,view:YW,props:{decorations:({doc:r,selection:i})=>HW({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}Zz.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:RW,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[XW({editor:this.editor,options:this.options})]}}),Zz.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new Db({key:new Ab(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||cz(n.selection)||e.view.dragging?null:fI.create(n.doc,[lI.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function ZW({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var QW=Zz.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new Ab(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new Db({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!ZW({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!ZW({node:r,types:n})}}})]}}),$W=Zz.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>PW(e,t),redo:()=>({state:e,dispatch:t})=>FW(e,t)}},addProseMirrorPlugins(){return[MW(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),eG=Zz.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(NB.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(OB.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(gU.configure(this.options.bulletList)),this.options.code!==!1&&e.push(IB.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(BB.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(VB.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(IW.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(LW.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(HB.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(UB.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push($W.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(WB.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(YB.configure(this.options.italic)),this.options.listItem!==!1&&e.push(yU.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(AU.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(uU.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(VU.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(qU.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(XU.configure(this.options.strike)),this.options.text!==!1&&e.push(ZU.configure(this.options.text)),this.options.underline!==!1&&e.push(QU.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(QW.configure(this.options?.trailingNode)),e}}),tG=20,nG=(e,t=0)=>{let n=[];return!e.children.length||t>tG||Array.from(e.children).forEach(e=>{e.tagName===`SPAN`?n.push(e):e.children.length&&n.push(...nG(e,t+1))}),n},rG=e=>{if(!e.children.length)return;let t=nG(e);t&&t.forEach(e=>{let t=e.getAttribute(`style`),n=(e.parentElement?.closest(`span`))?.getAttribute(`style`);e.setAttribute(`style`,`${n};${t}`)})},iG=hA.create({name:`textStyle`,priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:`span`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?(this.options.mergeNestedSpanStyles&&rG(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return[`span`,rk(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),aG=CA.create({name:`backgroundColor`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{let t=e.getAttribute(`style`);if(t){let e=t.split(`;`).map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;--t){let n=e[t].split(`:`);if(n.length>=2){let e=n[0].trim().toLowerCase(),t=n.slice(1).join(`:`).trim();if(e===`background-color`)return t.replace(/['"]+/g,``)}}}return e.style.backgroundColor?.replace(/['"]+/g,``)},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark(`textStyle`,{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark(`textStyle`,{backgroundColor:null}).removeEmptyTextStyle().run()}}}),oG=CA.create({name:`color`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{let t=e.getAttribute(`style`);if(t){let e=t.split(`;`).map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;--t){let n=e[t].split(`:`);if(n.length>=2){let e=n[0].trim().toLowerCase(),t=n.slice(1).join(`:`).trim();if(e===`color`)return t.replace(/['"]+/g,``)}}}return e.style.color?.replace(/['"]+/g,``)},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark(`textStyle`,{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark(`textStyle`,{color:null}).removeEmptyTextStyle().run()}}}),sG=CA.create({name:`fontFamily`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark(`textStyle`,{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark(`textStyle`,{fontFamily:null}).removeEmptyTextStyle().run()}}}),cG=CA.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark(`textStyle`,{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}}),lG=CA.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark(`textStyle`,{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark(`textStyle`,{lineHeight:null}).removeEmptyTextStyle().run()}}}),uG=CA.create({name:`textStyleKit`,addExtensions(){let e=[];return this.options.backgroundColor!==!1&&e.push(aG.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(oG.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(sG.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(cG.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(lG.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(iG.configure(this.options.textStyle)),e}}),dG=CA.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Db({key:new Ab(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});CA.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[$U(this.options)]}}),CA.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Db({key:new Ab(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return OE.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(TE.node(t,t+e.nodeSize,{class:this.options.className}))}),OE.create(e,a)}}})]}}),CA.create({name:`gapCursor`,addProseMirrorPlugins(){return[oW()]},extendNodeSchema(e){return{allowGapCursor:$O(YO(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}});var fG=`placeholder`,pG=new Ab(`tiptap__placeholder`);function mG(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),TE.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function hG(e,t){return typeof e==`function`?e(t):e}function gG({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&jk(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(mG({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:hG(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function _G({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&jk(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(mG({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:hG(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...gG({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return OE.create(r,o)}function vG(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function yG(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function bG(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function xG(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function SG(e,t){let n=bG(e,t.from,t.to);return n.push(yG(e,vG(e,t.from))),t.to>t.from?n.push(yG(e,vG(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(yG(e,vG(e,Math.min(t.from+1,e.content.size)))),n}function CG(e,t,n){let r=[];if(e.docChanged){let t=bk(e);for(let e of t)r.push(...SG(n.doc,e.newRange))}return e.selectionSet&&(r.push(yG(n.doc,vG(n.doc,e.mapping.map(t.selection.anchor)))),r.push(yG(n.doc,vG(n.doc,n.selection.anchor)))),xG(r)}function wG(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function TG({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=wG(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=gG({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function EG({editor:e,options:t,dataAttribute:n}){return{init(r,i){return _G({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??OE.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:TG({decorations:i.map(r.mapping,r.doc),ranges:CG(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function DG(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function OG({editor:e,options:t}){let n=t.dataAttribute?`data-${DG(t.dataAttribute)}`:`data-${fG}`,r=t.showOnlyCurrent&&!t.includeChildren;return new Db({key:pG,...r?{}:{state:EG({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>_G({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?OE.empty:pG.getState(n)??OE.empty}})}var kG=CA.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:fG,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[OG({editor:this.editor,options:this.options})]}});function AG(e,t){return!e.selection.empty&&!Mk(e.selection)&&t.isEditable}function jG(e,t){return AG(e,t)&&!t.isFocused&&!t.view.dragging}function MG(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function NG(e){e.focus()}CA.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new Db({key:new Ab(`selection`),props:{decorations(n){return jG(n,e)?OE.create(n.doc,[TE.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return AG(t.state,e)&&MG(),!1},focus(t){return AG(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&NG(t)}),!1}}}})]}});function PG({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}CA.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new Ab(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new Db({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!PG({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!PG({node:r,types:n})}}})]}}),CA.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>PW(e,t),redo:()=>({state:e,dispatch:t})=>FW(e,t)}},addProseMirrorPlugins(){return[MW(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});var FG=hA.create({name:`superscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sup`},{style:`vertical-align`,getAttrs(e){return e===`super`&&null}}]},renderHTML({HTMLAttributes:e}){return[`sup`,rk(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),IG=hA.create({name:`subscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sub`},{style:`vertical-align`,getAttrs(e){return e===`sub`&&null}}]},renderHTML({HTMLAttributes:e}){return[`sub`,rk(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),LG=CA.create({name:`textAlign`,addOptions(){return{types:[],alignments:[`left`,`center`,`right`,`justify`],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign(`left`),"Mod-Shift-e":()=>this.editor.commands.setTextAlign(`center`),"Mod-Shift-r":()=>this.editor.commands.setTextAlign(`right`),"Mod-Shift-j":()=>this.editor.commands.setTextAlign(`justify`)}}}),RG=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,zG=$A.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,rk(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);Object.entries(o).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),c.src=o.src;let l=new HA({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),u=l.dom;return u.style.visibility=`hidden`,u.style.pointerEvents=`none`,c.onload=()=>{u.style.visibility=``,u.style.pointerEvents=``},l}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[zA({find:RG,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),BG=kG,VG=e=>String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),HG=e=>{let t=document.createElement(`div`);t.innerHTML=e;let n=Array.from(t.children);return n.length<2||!n.every(e=>e.tagName===`DIV`)||!n.every(e=>e.attributes.length===0)||!n.every(e=>Array.from(e.children).every(e=>{let t=e.tagName;return[`SPAN`,`B`,`I`,`EM`,`STRONG`,`U`,`SUB`,`SUP`,`A`,`CODE`,`BR`].includes(t)}))?e:`<p>${n.map(e=>e.innerHTML).join(`<br>`)}</p>`},UG=e=>{let t=String(e??``).trim();return t?/<[^>]+>/.test(t)?HG(t):`<div>${VG(t)}</div>`:`<div></div>`},WG,GG;if(typeof WeakMap<`u`){let e=new WeakMap;WG=t=>e.get(t),GG=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;WG=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},GG=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var KG=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return WG(e)||GG(e,qG(e))}};function qG(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=JG(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new KG(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&YG(s,o,e),s}function JG(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function YG(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=XG(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function XG(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function ZG(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var QG=new Ab(`selectingCells`);function $G(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function eK(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function tK(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function nK(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=$G(t.$head)||rK(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function rK(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function iK(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function aK(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function oK(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function sK(e,t,n){let r=e.node(-1),i=KG.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function cK(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function lK(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function uK(e,t,n){let r=ZG(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var dK=class e extends sb{constructor(e,t=e){let n=e.node(-1),r=KG.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new cb(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(iK(r)&&iK(i)&&oK(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return U.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=KG.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=cK(e,0,l)),u>0&&(e=cK(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(V.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new H(V.from(o),1,1)}replace(e,t=H.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?H.empty:t)}let i=sb.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new H(V.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=KG.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=KG.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=KG.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=KG.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new fK(this.$anchorCell.pos,this.$headCell.pos)}};dK.prototype.visible=!1,sb.jsonID(`cell`,dK);var fK=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&oK(t,n)?new dK(t,n):sb.near(n,1)}};function pK(e){if(!(e.selection instanceof dK))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(lI.node(n,n+e.nodeSize,{class:`selectedCell`}))}),fI.create(e.doc,t)}function mK({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function hK({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function gK(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof W&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=dK.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=dK.rowSelection(e,e)}else if(!n){let e=KG.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=dK.create(i,t+1,n)}}else r instanceof U&&mK(r)?a=U.create(i,r.from):r instanceof U&&hK(r)&&(a=U.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var _K=new Ab(`fix-tables`);function vK(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?vK(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function yK(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=bK(e,t,r,n))};return t?t.doc!=e.doc&&vK(t.doc,e.doc,0,r):e.doc.descendants(r),n}function bK(e,t,n,r){let i=KG.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,cK(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=ZG(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(_K,{fixTables:!0})}function xK(e){let t=e.selection,n=nK(e),r=n.node(-1),i=n.start(-1),a=KG.get(r);return{...t instanceof dK?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function SK(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;uK(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,lK(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?ZG(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function CK(e,t){if(!tK(e))return!1;if(t){let n=xK(e);t(SK(e.tr,n,n.left))}return!0}function wK(e,t){if(!tK(e))return!1;if(t){let n=xK(e);t(SK(e.tr,n,n.right))}return!0}function TK(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,cK(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function EK(e,t){if(!tK(e))return!1;if(t){let n=xK(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;TK(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=KG.get(e)}t(r)}return!0}function DK(e,t,n){let r=ZG(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function OK(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;DK(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?ZG(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,ZG(r.type.schema).row.create(null,o)),e}function kK(e,t){if(!tK(e))return!1;if(t){let n=xK(e);t(OK(e.tr,n,n.top))}return!0}function AK(e,t){if(!tK(e))return!1;if(t){let n=xK(e);t(OK(e.tr,n,n.bottom))}return!0}function jK(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function MK(e,t){if(!tK(e))return!1;if(t){let n=xK(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;jK(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=KG.get(n.table)}t(r)}return!0}function NK(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function PK({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function FK(e,t){let n=e.selection;if(!(n instanceof dK)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=xK(e),{map:i}=r;if(PK(i,r))return!1;if(t){let n=e.tr,a={},o=V.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{NK(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...lK(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=NK(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new dK(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function IK(e,t){let n=ZG(e.schema);return LK(({node:e})=>n[e.type.spec.tableRole])(e,t)}function LK(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof dK){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=eK(r.$from),!i)return!1;a=$G(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=xK(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof dK&&u.setSelection(new dK(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function RK(e,t){return function(n,r){if(!tK(n))return!1;let i=nK(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof dK?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function zK(e){return function(t,n){if(!tK(t))return!1;if(n){let r=ZG(t.schema),i=xK(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function BK(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function VK(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?zK(e):function(t,n){if(!tK(t))return!1;if(n){let r=ZG(t.schema),i=xK(t),a=t.tr,o=BK(`row`,i,r),s=BK(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}VK(`row`,{useDeprecatedLogic:!0}),VK(`column`,{useDeprecatedLogic:!0});var HK=VK(`cell`,{useDeprecatedLogic:!0});function UK(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function WK(e){return function(t,n){if(!tK(t))return!1;let r=UK(nK(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(U.between(e,aK(e))).scrollIntoView())}return!0}}function GK(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function KK(e,t){let n=e.selection;if(!(n instanceof dK))return!1;if(t){let r=e.tr,i=ZG(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new H(i,0,0))}),r.docChanged&&t(r)}return!0}function qK(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=YK(ZG(o).row,new H(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?YK(ZG(o).row,new H(t,n,r)).content:t);else return null;return JK(o,s)}function JK(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(V.empty),n[i]<r){let a=ZG(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(V.from(o))}return{height:t.length,width:r,rows:t}}function YK(e,t){let n=e.createAndFill();return new ab(n).replace(0,n.content.size,t).doc}function XK({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(cK(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(V.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(V.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function ZK(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=ZG(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,V.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function QK(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function $K(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,cK(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(cK(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function eq(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=KG.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=KG.get(a),f=d.mapping.maps.length}ZK(d,o,a,n,l,u,f)&&p(),QK(d,o,a,n,c,l,s,f)&&p(),QK(d,o,a,n,c,l,u,f)&&p(),$K(d,o,a,n,s,u,c,f)&&p(),$K(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new H(i.rows[e-s],0,0))}p(),d.setSelection(new dK(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var tq=OD({ArrowLeft:rq(`horiz`,-1),ArrowRight:rq(`horiz`,1),ArrowUp:rq(`vert`,-1),ArrowDown:rq(`vert`,1),"Shift-ArrowLeft":iq(`horiz`,-1),"Shift-ArrowRight":iq(`horiz`,1),"Shift-ArrowUp":iq(`vert`,-1),"Shift-ArrowDown":iq(`vert`,1),Backspace:KK,"Mod-Backspace":KK,Delete:KK,"Mod-Delete":KK});function nq(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function rq(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof dK)return nq(n,r,sb.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=cq(i,e,t);if(o==null)return!1;if(e==`horiz`)return nq(n,r,sb.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=sK(i,e,t),s;return s=a?sb.near(a,1):t<0?sb.near(n.doc.resolve(i.before(-1)),-1):sb.near(n.doc.resolve(i.after(-1)),1),nq(n,r,s)}}}function iq(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof dK)o=a;else{let r=cq(i,e,t);if(r==null)return!1;o=new dK(n.doc.resolve(r))}let s=sK(o.$headCell,e,t);return s?nq(n,r,new dK(o.$anchorCell,s)):!1}}function aq(e,t){let n=e.state.doc,r=$G(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new dK(r))),!0):!1}function oq(e,t,n){if(!tK(e.state))return!1;let r=qK(n),i=e.state.selection;if(i instanceof dK){r||={width:1,height:1,rows:[V.from(YK(ZG(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=KG.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=XK(r,o.right-o.left,o.bottom-o.top),eq(e.state,e.dispatch,a,o,r),!0}else if(r){let t=nK(e.state),n=t.start(-1);return eq(e.state,e.dispatch,n,KG.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function sq(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=lq(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof dK)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=$G(e.state.selection.$anchor))!=null&&uq(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=uq(e,n),i=QG.getState(e.state)==null;if(!r||!oK(t,r))if(i)r=t;else return;let a=new dK(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(QG,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),QG.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(QG,-1))}function o(r){let o=r,s=QG.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(lq(e,o.target)!=n&&(c=uq(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function cq(e,t,n){if(!(e.state.selection instanceof U))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function lq(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function uq(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&$G(e.state.doc.resolve(r))||$G(e.state.doc.resolve(i))}var dq=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),fq(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,fq(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function fq(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var pq=new Ab(`tableColumnResizing`);function mq({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=dq,lastColumnResizable:i=!0}={}){let a=new Db({key:pq,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=ZG(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new hq(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=pq.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{gq(t,n,e,i)},mouseleave:e=>{_q(e)},mousedown:(e,r)=>{vq(e,r,t,n)}},decorations:e=>{let t=pq.getState(e);if(t&&t.activeHandle>-1)return Dq(e,t.activeHandle)},nodeViews:{}}});return a}var hq=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(pq);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return iK(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function gq(e,t,n,r){if(!e.editable)return;let i=pq.getState(e.state);if(i&&!i.dragging){let a=bq(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=xq(e,t,`left`,n):i-t.clientX<=n&&(o=xq(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=KG.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}Cq(e,o)}}}function _q(e){if(!e.editable)return;let t=pq.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Cq(e,-1)}function vq(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=pq.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=yq(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(pq,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=pq.getState(e.state);r?.dragging&&(wq(e,r.activeHandle,Sq(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(pq,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=pq.getState(e.state);if(i&&i.dragging){let a=Sq(i.dragging,t,n);Tq(e,i.activeHandle,a,r)}}return Tq(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function yq(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function bq(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function xq(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=$G(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=KG.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function Sq(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Cq(e,t){e.dispatch(e.state.tr.setMeta(pq,{setHandle:t}))}function wq(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=KG.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():Eq(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function Tq(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=KG.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&fq(a,c.firstChild,c,r,s,n)}function Eq(e){return Array(e).fill(0)}function Dq(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return fI.empty;let a=KG.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,pq.getState(e)?.dragging&&n.push(lI.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(lI.widget(s,c))}}return fI.create(e.doc,n)}function Oq({allowTableNodeSelection:e=!1}={}){return new Db({key:QG,state:{init(){return null},apply(e,t){let n=e.getMeta(QG);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:pK,handleDOMEvents:{mousedown:sq},createSelectionBetween(e){return QG.getState(e.state)==null?null:e.state.selection},handleTripleClick:aq,handleKeyDown:tq,handlePaste:oq},appendTransaction(t,n,r){return gK(r,yK(r,n),e)}})}var kq=$A.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`),n=t?t.split(`,`).map(e=>parseInt(e,10)):null;if(!n){let t=e.closest(`table`)?.querySelectorAll(`colgroup > col`),n=Array.from(e.parentElement?.children||[]).indexOf(e);if(n&&n>-1&&t&&t[n]){let e=t[n].getAttribute(`width`);return e?[parseInt(e,10)]:null}}return n}}}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,rk(this.options.HTMLAttributes,e),0]}}),Aq=$A.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}}}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,rk(this.options.HTMLAttributes,e),0]}}),jq=$A.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,rk(this.options.HTMLAttributes,e),0]}});function Mq(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function Nq(e,t,n,r,i,a){var o;let s=0,c=!0,l=t.firstChild,u=e.firstChild;if(u!==null)for(let e=0,n=0;e<u.childCount;e+=1){let{colspan:o,colwidth:d}=u.child(e).attrs;for(let e=0;e<o;e+=1,n+=1){let o=i===n?a:d&&d[e],u=o?`${o}px`:``;if(s+=o||r,o||(c=!1),l){if(l.style.width!==u){let[e,t]=Mq(r,o);l.style.setProperty(e,t)}l=l.nextSibling}else{let e=document.createElement(`col`),[n,i]=Mq(r,o);e.style.setProperty(n,i),t.appendChild(e)}}}for(;l;){let e=l.nextSibling;(o=l.parentNode)==null||o.removeChild(l),l=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);c&&!d?(n.style.width=`${s}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${s}px`)}var Pq=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),Nq(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,Nq(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function Fq(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=Mq(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function Iq(e,t){return t?e.createChecked(null,t):e.createAndFill()}function Lq(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function Rq(e,t,n,r,i){let a=Lq(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=Iq(a.cell,i);if(e&&s.push(e),r){let e=Iq(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function zq(e){return e instanceof dK}var Bq=({editor:e})=>{let{selection:t}=e.state;if(!zq(t))return!1;let n=0;return qO(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1};function Vq(e){return(e||``).replace(/\s+/g,` `).trim()}function Hq(e,t,n={}){let r=n.cellLineSeparator??``;if(!e||!e.content||e.content.length===0)return``;let i=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{let i=``;i=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(r):e.content?t.renderChildren(e.content):``;let a=Vq(i),o=e.type===`tableHeader`;n.push({text:a,isHeader:o})}),i.push(n)});let a=i.reduce((e,t)=>Math.max(e,t.length),0);if(a===0)return``;let o=Array(a).fill(0);i.forEach(e=>{for(let t=0;t<a;t+=1){let n=(e[t]?.text||``).length;n>o[t]&&(o[t]=n),o[t]<3&&(o[t]=3)}});let s=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),c=i[0],l=c.some(e=>e.isHeader),u=`
|
|
314
314
|
`,d=Array(a).fill(0).map((e,t)=>l&&c[t]&&c[t].text||``);return u+=`| ${d.map((e,t)=>s(e,o[t])).join(` | `)} |
|
|
315
315
|
`,u+=`| ${o.map(e=>`-`.repeat(Math.max(3,e))).join(` | `)} |
|
|
316
316
|
`,(l?i.slice(1):i).forEach(e=>{u+=`| ${Array(a).fill(0).map((t,n)=>s(e[n]&&e[n].text||``,o[n])).join(` | `)} |
|
|
317
|
-
`}),u}var
|
|
317
|
+
`}),u}var Uq=Hq,Wq=$A.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Pq,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=Fq(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,rk(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[];if(e.header){let r=[];e.header.forEach(e=>{r.push(t.createNode(`tableHeader`,{},[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},r))}return e.rows&&e.rows.forEach(e=>{let r=[];e.forEach(e=>{r.push(t.createNode(`tableCell`,{},[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},r))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>Uq(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=Rq(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(U.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>CK(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>wK(e,t),deleteColumn:()=>({state:e,dispatch:t})=>EK(e,t),addRowBefore:()=>({state:e,dispatch:t})=>kK(e,t),addRowAfter:()=>({state:e,dispatch:t})=>AK(e,t),deleteRow:()=>({state:e,dispatch:t})=>MK(e,t),deleteTable:()=>({state:e,dispatch:t})=>GK(e,t),mergeCells:()=>({state:e,dispatch:t})=>FK(e,t),splitCell:()=>({state:e,dispatch:t})=>IK(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>VK(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>VK(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>HK(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>FK(e,t)?!0:IK(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>RK(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>WK(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>WK(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&yK(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=dK.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Bq,"Mod-Backspace":Bq,Delete:Bq,"Mod-Delete":Bq}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[mq({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Oq({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){return{tableRole:$O(YO(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}});CA.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(Wq.configure(this.options.table)),this.options.tableCell!==!1&&e.push(kq.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(Aq.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(jq.configure(this.options.tableRow)),e}});var Gq=(e,t)=>{let n=t?.border!=null&&t.border!==``?t.border:`1`;e.setAttribute(`border`,n),e.style.setProperty(`color`,`var(--pie-text, black)`),e.style.setProperty(`background-color`,`var(--pie-background, rgba(255, 255, 255))`)},Kq=class extends Pq{constructor(e,t,n){super(e,t,n),Gq(this.table,e.attrs)}update(e){let t=super.update(e);return t&&Gq(this.table,e.attrs),t}},qq=Wq.extend({addOptions(){return{...this.parent?.(),resizable:!0,handleWidth:0,View:Kq}},addAttributes(){return{border:{default:`1`}}},renderHTML(e){let t=this.parent(e),{border:n}=e.HTMLAttributes,r=`${t[1].style}${t[1].style.match(/.*; */)?``:`;`}`;return t[1].style=`${r}
|
|
318
318
|
color: var(--pie-text, black);
|
|
319
|
-
background-color: var(--pie-background, rgba(255, 255, 255))`,t[1].border=n||`1`,t}}),Bq=`(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+`,Vq=xq.extend({content:Bq}),Hq=Sq.extend({content:Bq}),Uq=$A.create({name:`div`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`div`}]},renderHTML({HTMLAttributes:e}){return[`div`,e,0]},addKeyboardShortcuts(){let e=e=>{for(let t=e.depth;t>=0;--t)if(e.node(t).type.name===`listItem`)return!0;return!1};return{Enter:()=>{let{state:t}=this.editor,{$from:n}=t.selection;return n.parent.type.name!==`div`||e(n)?!1:this.editor.chain().focus().setNode(`paragraph`).splitBlock().run()},Backspace:()=>{let{state:e}=this.editor,{$from:t,empty:n}=e.selection;if(t.parent.type.name!==`div`||!n)return!1;let r=t.parent.textContent;if(r.length===0)return e.doc.childCount===1;if(r.length===1&&t.parentOffset===1){let{tr:n}=e;return n.delete(t.pos-1,t.pos),this.editor.view.dispatch(n),!0}return!1}}}}),Wq=CA.create({name:`ensureEmptyRootIsDiv`,addProseMirrorPlugins(){return[new Db({key:new Ab(this.name),appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let{doc:r}=n;if(r.childCount!==1)return null;let i=r.firstChild;if(i.type.name!==`paragraph`||i.content.size>0)return null;let a=n.schema.nodes.div;if(!a)return null;let o=i.nodeSize;return n.tr.replaceWith(0,o,a.create())}})]}}),Gq=CA.create({name:`ensureListItemContentIsDiv`,addProseMirrorPlugins(){return[new Db({key:new Ab(this.name),appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let{doc:r,schema:i}=n,a=i.nodes.div;if(!a)return null;let o=[];if(r.descendants((e,t)=>{if(e.type.name!==`listItem`)return;let n=1;e.forEach(e=>{e.type.name===`paragraph`&&o.push({pos:t+n,attrs:e.attrs}),n+=e.nodeSize})}),o.length===0)return null;let s=n.tr;return o.sort((e,t)=>t.pos-e.pos).forEach(({pos:e,attrs:t})=>s.setNodeMarkup(e,a,t)),s}})]}});function Kq(e){return F(`MuiIconButton`,e)}var qq=mi(`MuiIconButton`,[`root`,`disabled`,`colorInherit`,`colorPrimary`,`colorSecondary`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`,`edgeStart`,`edgeEnd`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`loading`,`loadingIndicator`,`loadingWrapper`]),Jq=e=>{let{classes:t,disabled:n,color:r,edge:i,size:a,loading:o}=e;return Fa({root:[`root`,o&&`loading`,n&&`disabled`,r!=="default"&&`color${z(r)}`,i&&`edge${z(i)}`,`size${z(a)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},Kq,t)},Yq=L(Zd,{name:`MuiIconButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!=="default"&&t[`color${z(n.color)}`],n.edge&&t[`edge${z(n.edge)}`],t[`size${z(n.size)}`]]}})(ol(({theme:e})=>({textAlign:`center`,flex:`0 0 auto`,fontSize:e.typography.pxToRem(24),padding:8,borderRadius:`50%`,color:(e.vars||e).palette.action.active,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:`var(--IconButton-hoverBg)`,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:{edge:`start`},style:{marginLeft:-12}},{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:{edge:`end`},style:{marginRight:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}}]})),ol(({theme:e})=>({variants:[{props:{color:`inherit`},style:{color:`inherit`}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:`small`},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${qq.disabled}`]:{backgroundColor:`transparent`,color:(e.vars||e).palette.action.disabled},[`&.${qq.loading}`]:{color:`transparent`}}))),Xq=L(`span`,{name:`MuiIconButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:`flex`}}]})),Zq=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiIconButton`}),{edge:r=!1,children:i,className:a,color:o=`default`,disabled:s=!1,disableFocusRipple:c=!1,size:l=`medium`,id:u,loading:d=null,loadingIndicator:f,...p}=n,m=Wl(u),h=f??(0,N.jsx)(mf,{"aria-labelledby":m,color:`inherit`,size:16}),g={...n,edge:r,color:o,disabled:s,disableFocusRipple:c,loading:d,loadingIndicator:h,size:l},_=Jq(g);return(0,N.jsxs)(Yq,{id:d?m:u,className:P(_.root,a),centerRipple:!0,focusRipple:!c,disabled:s||d,ref:t,...p,ownerState:g,children:[typeof d==`boolean`&&(0,N.jsx)(`span`,{className:_.loadingWrapper,style:{display:`contents`},children:(0,N.jsx)(Xq,{className:_.loadingIndicator,ownerState:g,children:d&&h})}),i]})}),Qq=Vl((0,N.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z`}),`Delete`),$q=`pie-toolbar`,eJ=Vl((0,N.jsx)(`path`,{d:`M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`}),`Check`),tJ=L(Zq)({verticalAlign:`top`,width:`28px`,height:`28px`,color:`var(--editable-html-toolbar-check, #00bb00)`,padding:`4px`}),nJ=({onClick:e,doneButtonRef:t})=>(0,N.jsx)(tJ,{"aria-label":`Done`,buttonRef:t,onClick:e,children:(0,N.jsx)(eJ,{})});nJ.propTypes={onClick:k.func,doneButtonRef:k.func};var rJ=nJ,iJ=L(`div`,{shouldForwardProp:e=>![`showDone`,`toolbarAlignment`,`isFocused`,`autoWidth`,`isHidden`].includes(e)})(({showDone:e,toolbarAlignment:t,isFocused:n,autoWidth:r,isHidden:i})=>({position:`absolute`,zIndex:10,cursor:`pointer`,justifyContent:`space-between`,background:`var(--editable-html-toolbar-bg, #efefef)`,minWidth:e?`280px`:`265px`,margin:`5px 0 0 0`,padding:`2px`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,boxSizing:`border-box`,display:`flex`,opacity:1,...t===`right`&&{right:0},...r?{width:`auto`}:{width:`100%`},...i&&{visibility:`hidden`}})),aJ=L(Zq)({width:`28px`,height:`28px`,padding:`4px`,verticalAlign:`top`}),oJ=L(`div`)({display:`flex`});function sJ(e){let{children:t,deletable:n,toolbarOpts:r,autoWidth:i,isFocused:a,doneButtonRef:o,onDelete:s,showDone:c,onDone:l,style:u}=e,d=r.minWidth===void 0?{}:{minWidth:r.minWidth};return(0,N.jsxs)(iJ,{className:$q,showDone:c,toolbarAlignment:r.alignment,isFocused:r.alwaysVisible||a,autoWidth:i,isHidden:r.isHidden===!0,style:{...d,...u},children:[t,(0,N.jsxs)(oJ,{children:[n&&(0,N.jsx)(aJ,{"aria-label":`Delete`,onMouseDown:e=>s?.(e),children:(0,N.jsx)(Qq,{})}),c&&(0,N.jsx)(rJ,{doneButtonRef:o,onClick:l})]})]})}var cJ=`toolbarOpenedChanged`,lJ=(e,t)=>{let n=!!t;e._toolbarOpened!==n&&(e._toolbarOpened=n,e?.view&&e?.state?.tr&&e.view.dispatch(e.state.tr.setMeta(cJ,!0)))},uJ=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{value:s}=o,{respAreaToolbar:c,error:l}=i,u=r(),[d,f]=(0,M.useState)(!1),p=c([n,u],t,()=>{}),m=(0,M.useRef)(null),h;if(l){let e=l(),t=parseInt(o.index,10);h=!!e?.[t]?.[0]}return(0,M.useEffect)(()=>{let{selection:e}=t.state,r=e.from+n.nodeSize===e.to;a?r&&f(a):f(a)},[t,n,a]),(0,M.useEffect)(()=>{let e=e=>{!(e.target.closest(`.insert-character-dialog`)||e.target.closest(`[data-toolbar-for]`))&&m.current&&!m.current.contains(e.target)&&!e.target.closest(`[data-inline-node]`)&&f(!1)};return d?document.addEventListener(`mousedown`,e):document.removeEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,N.jsxs)(vM,{className:`drag-in-the-blank`,"data-selected":a,style:{display:`inline-flex`,minHeight:`55px`,position:`relative`,cursor:`pointer`},children:[(0,N.jsx)(`div`,{...o,style:{display:`inline-flex`,width:`100%`,minHeight:`46px`,height:`46px`,backgroundColor:`#FFF`,border:`1px solid ${h?`red`:`#C0C3CF`}`,boxSizing:`border-box`,borderRadius:`4px`,overflow:`hidden`,padding:`12px 21px`,margin:`0 4px`,minWidth:`178px`,visibility:d?`hidden`:`visible`},onClick:()=>f(!0),dangerouslySetInnerHTML:{__html:s||`<div> </div>`}}),d&&(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`div`,{ref:m,className:`absolute z-50 bg-white shadow-lg rounded p-2`,style:{zIndex:1},children:(0,N.jsx)(p,{})}),t._tiptapContainerEl&&hs.createPortal((0,N.jsx)(sJ,{deletable:!0,toolbarOpts:{minWidth:`auto`},autoWidth:!0,style:{top:-40,left:0,right:0},onDelete:()=>{let{tr:e}=t.state;e.delete(u,u+n.nodeSize),lJ(t,!1),t.view.dispatch(e),f(!1),t.commands.focus()},showDone:!1}),t._tiptapContainerEl)]})]})};uJ.propTypes={attributes:k.object,error:k.any,value:k.string,isFocused:k.bool};var dJ=Vl((0,N.jsx)(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`ChevronRight`),fJ=Vl((0,N.jsx)(`path`,{d:`M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2`}),`MoreVert`),pJ=e=>{switch(e){case`down`:return 90;case`up`:return-90;case`left`:return 180;default:return 0}},mJ=e=>{let{direction:t,style:n}=e;return(0,N.jsx)(dJ,{style:{transform:`rotate(${pJ(t)}deg)`,...n}})};mJ.propTypes={direction:k.string,style:k.object};var hJ=({style:e})=>(0,N.jsxs)(`span`,{style:e,children:[(0,N.jsx)(fJ,{style:{margin:`0 -16px`}}),(0,N.jsx)(fJ,{})]});hJ.propTypes={style:k.object},L(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans !important`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,top:`7px`,width:`110px`,height:`28px`,whiteSpace:`nowrap`}));var gJ=L(`span`)(({theme:e})=>({border:`solid 0px ${e.palette.primary.main}`,"& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn":{fontSize:`120% !important`},"& mjx-frac":{fontSize:`120% !important`}}));function _J({n:e,children:t,isDragging:n,isOver:r,dragItem:i,value:a,selected:o}){let[s,c]=(0,M.useState)(null),l=(0,M.useRef)(null),u=e=>{l.current&&(l.current.contains(e.target)?l.current.classList.add(`selected`):l.current.classList.remove(`selected`))};(0,M.useEffect)(()=>(document.addEventListener(`click`,u),()=>{document.removeEventListener(`click`,u)}),[]),(0,M.useEffect)(()=>{l.current&&typeof O==`function`&&O(l.current)},[a?.value,r,i?.value?.value]),(0,M.useEffect)(()=>{if(r&&l.current&&!s){let e=l.current;c({width:e.offsetWidth,height:e.offsetHeight})}else!r&&s&&c(null)},[r,s]);let d=i&&r?i.value.value:a.value||`\xA0`,f=n?`\xA0`:d,p=f!==`\xA0`,m=i&&r,h=o?`2px solid ${Cu()}`:m?`1px solid ${B.BORDER_DARK}`:`1px solid ${B.BORDER_LIGHT}`;return(0,N.jsxs)(`div`,{ref:l,className:o?`selected`:void 0,style:{display:`inline-flex`,minWidth:`178px`,minHeight:`36px`,background:m?`${B.BORDER_LIGHT}`:`${B.WHITE}`,border:h,boxSizing:`border-box`,borderRadius:`3px`,overflow:`hidden`,position:`relative`,padding:`8px 8px 8px 35px`,width:s?s.width:void 0,height:s?s.height:void 0,touchAction:`none`},"data-key":e.index,contentEditable:!1,children:[p&&(0,N.jsx)(hJ,{style:{position:`absolute`,top:`6px`,left:`15px`,color:`#9B9B9B`},contentEditable:!1}),(0,N.jsx)(`span`,{dangerouslySetInnerHTML:{__html:f}}),t]})}_J.propTypes={n:k.object,children:k.node,isDragging:k.bool,isOver:k.bool,dragItem:k.object,value:k.object,selected:k.bool};function vJ({value:e,disabled:t,instanceId:n,children:r,n:i,onChange:a,removeResponse:o,duplicates:s,pos:c,selected:l}){let{attributes:u,listeners:d,setNodeRef:f,isDragging:p}=y_({id:`drag-${i.index}`,disabled:t||!e?.value,data:{id:`drag-${i.index}`,value:e,instanceId:n,n:i,pos:c,opts:{duplicates:s},type:`drag-in-the-blank-placed-choice`,fromChoice:!e,onRemove:e=>o(e),onDrop:(e,t)=>{t?.type===`drag-in-the-blank-drop-choice`&&(a(e),!s&&e.fromChoice&&o(e))}}}),{setNodeRef:m,isOver:h,active:g}=S_({id:`drop-${i.index}`,data:{type:`drag-in-the-blank-drop-choice`,accepts:[`drag-in-the-blank-choice`,`drag-in-the-blank-placed-choice`],instanceId:n,value:e,id:`drop-${i.index}`,pos:c,n:i,opts:{duplicates:s},onDrop:(e,t)=>{if(t?.type===`drag-in-the-blank-drop-choice`&&e.value.id!==t.value.id){if(e.type===`drag-in-the-blank-choice`){a(e),!s&&e.fromChoice&&o(e);return}e.type===`drag-in-the-blank-placed-choice`&&(o(t),a(e),setTimeout(()=>o(e),10))}}}}),_=e=>{f(e),m(e)},v=(0,N.jsx)(_J,{n:i,isDragging:p,isOver:h,dragItem:g?.data?.current,value:e,selected:l,children:r}),y=e?(0,N.jsx)(`span`,{ref:_,...u,...d,children:v}):(0,N.jsx)(`span`,{ref:m,children:v});return(0,N.jsx)(gJ,{className:P(h&&`over`),children:y})}vJ.propTypes={value:k.object,disabled:k.bool,instanceId:k.string,children:k.node,n:k.object.isRequired,onChange:k.func.isRequired,removeResponse:k.func.isRequired,duplicates:k.bool,selected:k.bool};var yJ=(e,t,n,r)=>{let{tr:i}=e.state;i.setNodeMarkup(n,void 0,{...t.attrs,...r.value}),i.isDone=!0,e.view.dispatch(i)},bJ=(e,t,n)=>{let{tr:r}=e.state;r.setNodeMarkup(n.pos,void 0,ue(t.attrs,[`value`,`id`])),r.isDone=!0,e.view.dispatch(r)},xJ=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{inTable:s}=o,c=r();return(0,N.jsx)(vM,{className:`drag-in-the-blank`,"data-selected":a,style:{display:`inline`,whiteSpace:`normal`},children:(0,N.jsx)(`span`,{...o,style:{display:`inline-flex`,minHeight:`50px`,minWidth:`178px`,position:`relative`,margin:s?`10px`:`0 10px`,cursor:`pointer`},children:(0,N.jsx)(vJ,{n:o,dragKey:o.id,targetId:`0`,pos:c,value:o,duplicates:i.duplicates,selected:a,onChange:e=>yJ(t,n,c,e),removeResponse:e=>bJ(t,n,e)})})})};xJ.propTypes={attributes:k.object,data:k.object,n:k.object,nodeProps:k.object,opts:k.object};var SJ=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{value:s,error:c}=o,l=s||`<div> </div>`,u=r(),d=(0,M.useRef)(null),f=(0,M.useRef)(null),p=(0,M.useRef)(!1),m=(0,M.useRef)(null),h=()=>t._holdInlineDropdownToolbarIndex!=null&&String(t._holdInlineDropdownToolbarIndex)===String(n.attrs.index),[g,_]=(0,M.useState)(!1),[v,y]=(0,M.useState)({top:0,left:0}),b=()=>{h()||(_(!1),i.onInlineDropdownToolbarClose?.(t))},x=i.respAreaToolbar([n,u],t,b),S=()=>{let{tr:e}=t.state,n=e.doc.nodeAt(u);if(!n)return;let{selection:r}=e;r.from===u&&r.to===u+n.nodeSize||(e.setSelection(W.create(e.doc,u)),t.view.dispatch(e))},C=()=>{p.current||(i.onToolbarCloseRequest?(p.current=!0,i.onToolbarCloseRequest([n,u],t,()=>{p.current=!1,delete t._holdInlineDropdownToolbarIndex,b()},()=>{p.current=!1,delete t._holdInlineDropdownToolbarIndex,_(!0),setTimeout(S,0)})):b())};(0,M.useEffect)(()=>{let{selection:e}=t.state,r=e.from+n.nodeSize===e.to;a?r&&_(!0):g&&C()},[t,n,a]);let w=e=>e.clientX>document.documentElement.clientWidth||e.clientY>document.documentElement.clientHeight||e.target===document.documentElement;return(0,M.useEffect)(()=>{m.current&&typeof O==`function`&&O(m.current)},[s]),(0,M.useEffect)(()=>{let e=document.body.getBoundingClientRect(),{from:n}=t.state.selection,r=t.view.coordsAtPos(n);y({top:r.top+Math.abs(e.top)+40,left:r.left});let i=e=>{if(w(e))return;let n=e.target.closest(`[data-toolbar-for]`);!e.target.closest(`[data-inline-dropdown-toolbar]`)&&(!n||n.dataset.toolbarFor!==f.current?.instanceId)&&!t._toolbarOpened&&d.current&&!d.current.contains(e.target)&&!e.target.closest(`[data-inline-node]`)&&C()};return g?document.addEventListener(`mousedown`,i):document.removeEventListener(`mousedown`,i),()=>document.removeEventListener(`mousedown`,i)},[g,n]),(0,N.jsxs)(vM,{className:`inline-dropdown`,"data-selected":a,style:{display:`inline-flex`,height:`50px`,cursor:`pointer`},children:[(0,N.jsxs)(`div`,{ref:m,style:{display:`inline-flex`,minWidth:`178px`,height:`36px`,background:`#FFF`,border:`1px solid #C0C3CF`,boxSizing:`border-box`,borderRadius:`3px`,margin:`0 2px`,position:`relative`,alignItems:`center`},onClick:()=>_(!0),children:[(0,N.jsx)(`div`,{style:{flex:1,overflow:`hidden`,padding:`0 25px 0 8px`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},children:(0,N.jsx)(`span`,{style:{display:`inline-block`,verticalAlign:`middle`},dangerouslySetInnerHTML:{__html:l}})}),(0,N.jsx)(mJ,{direction:`down`,style:{position:`absolute`,top:`5px`,right:`5px`}})]}),g&&(0,N.jsxs)(M.Fragment,{children:[hs.createPortal((0,N.jsx)(`div`,{ref:d,children:(0,N.jsx)(x,{editorCallback:e=>{f.current=e}})}),t?._tiptapContainerEl||document.body),t._tiptapContainerEl&&hs.createPortal((0,N.jsx)(sJ,{deletable:!0,toolbarOpts:{minWidth:`auto`},autoWidth:!0,style:{top:-40,left:0,right:0},onDelete:()=>{let{tr:e}=t.state;e.delete(u,u+n.nodeSize),lJ(t,!1),delete t._holdInlineDropdownToolbarIndex,t.view.dispatch(e),_(!1),t.commands.focus()},showDone:!1}),t._tiptapContainerEl)]})]})};SJ.propTypes={attributes:k.object,selectedItem:k.oneOfType([k.string,k.object])};var CJ=s({greaterThan:()=>EJ,greaterThanEqual:()=>OJ,lessThan:()=>TJ,lessThanEqual:()=>DJ}),wJ=e=>({...e,category:`comparison`}),TJ=wJ({name:`Less than`,latex:`<`,command:`\\lt`}),EJ=wJ({name:`Greater than`,latex:`>`,command:`\\gt`}),DJ=wJ({name:`Less than or equal`,latex:`\\le`,symbol:`<=`,command:`\\le`,ariaLabel:`less than or equal to`}),OJ=wJ({name:`Greater than or equal`,symbol:`>=`,command:`\\ge`,latex:`\\ge`}),kJ=e=>t=>({...t,category:e}),AJ=(e=[])=>{let t=[];de(5,()=>t.push([]));let n=e.length,r=0,i=0;for(;i<n;)t[r++].push(e[i++]),r===5&&(r=0);return t},jJ=e=>t=>{let n=ae(e),r=n.some(e=>e.latex===t.latex),i=n.some(e=>e.name===t.name);return!r&&!i},MJ=(e=[],t=[])=>{t=t.filter(jJ(e));let n=[];de(5-e.length,()=>e.push([])),de(5,()=>n.push([]));let r=AJ(t);for(let t=0;t<5;t++)n[t]=[...e[t],...r[t]];return n},NJ=s({theta:()=>LJ,x:()=>FJ,y:()=>IJ}),PJ=kJ(`vars`),FJ=PJ({name:`X`,latex:`x`,write:`x`}),IJ=PJ({name:`Y`,latex:`y`,write:`y`}),LJ=PJ({name:`Theta`,latex:`\\theta`,write:`\\theta`}),RJ=s({blankOverBlank:()=>BJ,xBlankBlank:()=>HJ,xOverBlank:()=>VJ}),zJ=kJ(`fractions`),BJ=zJ({name:`blank/blank`,latex:`\\frac{}{}`,command:`\\frac`,ariaLabel:`fraction`}),VJ=zJ({latex:`\\frac{x}{ }`,name:`X/blank`,label:`x/[]`,command:`/`,ariaLabel:`x over blank fraction`}),HJ=zJ({name:`X (blank/blank)`,latex:`x\\frac{}{}`,label:`x([]/[])`,command:`\\frac`,ariaLabel:`mixed number`}),UJ=s({nthRoot:()=>JJ,squareRoot:()=>qJ,squared:()=>GJ,xToPowerOfN:()=>KJ}),WJ=kJ(`exponent`),GJ=WJ({name:`Squared`,latex:`x^2`,write:`^2`}),KJ=WJ({name:`X to the power of n`,latex:`x^{}`,command:`^`,ariaLabel:`exponent`}),qJ=WJ({name:`Square root`,latex:`\\sqrt{}`,command:`\\sqrt`}),JJ=WJ({name:`Nth root`,latex:`\\sqrt[{}]{}`,command:`\\nthroot`}),YJ=s({absValue:()=>QJ,approx:()=>nY,brackets:()=>eY,nApprox:()=>rY,notEqual:()=>iY,notSimilar:()=>oY,parenthesis:()=>$J,percentage:()=>tY,plusMinus:()=>ZJ,similar:()=>aY}),XJ=kJ(`misc`),ZJ=XJ({name:`Plus or Minus`,latex:`\\pm`,write:`\\pm`}),QJ=XJ({name:`Absolute Value`,latex:`\\abs{}`,symbol:`| |`,command:`|`}),$J=XJ({name:`Parenthesis`,latex:`\\left(\\right)`,symbol:`( )`,command:`(`}),eY=XJ({name:`Brackets`,latex:`\\left[\\right]`,symbol:`[ ]`,command:`[`}),tY=XJ({name:`Percent`,latex:`%`,command:`%`}),nY=XJ({latex:`\\approx`,command:`\\approx`,ariaLabel:`Approximately equal to`}),rY=XJ({latex:`\\napprox`,command:`\\napprox`,ariaLabel:`Not pproximately equal to`}),iY=XJ({latex:`\\neq`,command:`\\neq`,ariaLabel:`Not equals`}),aY=XJ({latex:`\\sim`,command:`\\sim`,ariaLabel:`Similar`}),oY=XJ({latex:`\\nsim`,command:`\\nsim`,ariaLabel:`Not similar`}),sY=s({eulers:()=>uY,halfInfinity:()=>fY,infinity:()=>dY,pi:()=>lY}),cY=kJ(`constants`),lY=cY({name:`Pi`,label:`π`,latex:`\\pi`,command:`\\pi`,category:`constants`}),uY=cY({name:`Eulers`,label:`e`,latex:`e`,command:`e`,category:`constants`}),dY=cY({name:`Infinity`,label:`\\infty`,latex:`\\infty`,command:`\\infty`,category:`constants`}),fY=cY({name:`Half Infinity`,label:`\\propto`,latex:`\\propto`,command:`\\propto`,category:`constants`}),pY=s({cos:()=>gY,cot:()=>bY,csc:()=>yY,sec:()=>vY,sin:()=>hY,tan:()=>_Y}),mY=kJ(`trigonometry`),hY=mY({name:`sine`,label:`sin`,command:`\\sin`,latex:`\\sin`}),gY=mY({name:`cosine`,label:`cos`,command:`\\cos`,latex:`\\cos`}),_Y=mY({name:`tanget`,label:`tan`,command:`\\tan`,latex:`\\tan`}),vY=mY({name:`secant`,label:`sec`,command:`\\sec`,latex:`\\sec`}),yY=mY({name:`cosecant`,label:`csc`,command:`\\csc`,latex:`\\csc`}),bY=mY({name:`cotangent`,label:`cot`,command:`\\cot`,latex:`\\cot`}),xY=s({angle:()=>AY,circledDot:()=>IY,congruentTo:()=>zY,degree:()=>LY,doublePrimeArcSecond:()=>HY,leftArrow:()=>UY,leftrightArrow:()=>GY,measureOfAngle:()=>MY,notCongruentTo:()=>BY,notParallel:()=>OY,overArc:()=>jY,overLeftRightArrow:()=>TY,overRightArrow:()=>wY,overline:()=>CY,parallel:()=>DY,parallelogram:()=>FY,perpindicular:()=>kY,primeArcminute:()=>VY,rightArrow:()=>WY,segment:()=>EY,similarTo:()=>RY,square:()=>PY,triangle:()=>NY}),SY=e=>({...e,category:`geometry`}),CY=SY({name:`Line`,latex:`\\overline{}`,command:`\\overline`}),wY=SY({name:`Ray`,latex:`\\overrightarrow{}`,command:`\\overrightarrow`}),TY=SY({name:`Segment`,latex:`\\overleftrightarrow{\\overline{}}`,symbol:`AB`,command:`\\overleftrightarrow`}),EY=SY({name:`Segment`,latex:`\\overleftrightarrow{AB}`,write:`\\overleftrightarrow{AB}`,label:`AB`}),DY=SY({name:`Parallel`,latex:`\\parallel`,command:`\\parallel`}),OY=SY({name:`Not Parallel`,latex:`\\nparallel`,command:`\\nparallel`}),kY=SY({name:`Perpendicular`,latex:`\\perp`,command:`\\perpendicular`}),AY=SY({name:`Angle`,latex:`\\angle`,command:`\\angle`}),jY=SY({name:`Over arc`,latex:`\\overarc{\\overline{}}`,command:`\\overarc`}),MY=SY({name:`Measured Angle`,latex:`\\measuredangle`,command:[`m`,`\\angle`]}),NY=SY({name:`Triangle`,latex:`\\triangle`,command:`\\triangle`}),PY=SY({name:`Square`,latex:`\\square`,command:`\\square`}),FY=SY({name:`Parallelogram`,latex:`\\parallelogram`,command:`\\parallelogram`}),IY=SY({name:`Circled Dot`,latex:`\\odot`,command:`\\odot`}),LY=SY({name:`Degree`,latex:`\\degree`,command:`\\degree`}),RY=SY({name:`Similar`,command:`\\sim`,latex:`\\sim`}),zY=SY({name:`Congruent To`,command:`\\cong`,latex:`\\cong`}),BY=SY({name:`Not Congruent To`,command:`\\ncong`,latex:`\\ncong`}),VY=SY({name:`Prime`,label:`pam`,latex:`'`,write:`'`}),HY=SY({name:`Double Prime`,latex:`''`,write:`''`}),UY=SY({name:`Left Arrow`,latex:`\\leftarrow`,command:`\\leftarrow`}),WY=SY({name:`Right Arrow`,latex:`\\rightarrow`,command:`\\rightarrow`}),GY=SY({name:`Left and Right Arrow`,latex:`\\leftrightarrow`,command:`\\leftrightarrow`}),KY=s({circleDot:()=>qY}),qY=kJ(`operators`)({name:`CircleDot`,label:`⋅`,write:`\\cdot`,ariaLabel:`Dot multiplier`}),JY=s({ln:()=>QY,log:()=>XY,logSubscript:()=>ZY}),YY=kJ(`log`),XY=YY({name:`Log`,label:`log`,command:`\\log`,latex:`\\log`}),ZY=YY({name:`log base n`,label:`log s`,latex:`\\log_{}`,command:[`\\log`,`_`]}),QY=YY({name:`natural log`,label:`ln`,command:`\\ln`,latex:`\\ln`}),$Y=s({subscript:()=>nX,superscript:()=>tX}),eX=kJ(`sub-sup`),tX=eX({name:`Superscript`,latex:`x^{}`,command:`^`}),nX=eX({name:`Subscript`,latex:`x_{}`,command:`_`}),rX=s({mu:()=>sX,sigma:()=>cX,smallSigma:()=>lX,xBar:()=>aX,yBar:()=>oX}),iX=kJ(`statistics`),aX=iX({name:`X Bar`,label:`x̄`,latex:`\\overline{x}`,write:`\\overline{x}`}),oX=iX({name:`Y Bar`,latex:`\\overline{y}`,write:`\\overline{y}`}),sX=iX({name:`mu`,label:`mu`,latex:`\\mu`,write:`\\mu`}),cX=iX({name:`Sigma`,ariaLabel:`Uppercase Sigma`,label:`\\Sigma`,latex:`\\Sigma`,write:`\\Sigma`}),lX=iX({name:`sigma`,ariaLabel:`Lowercase Sigma`,label:`\\sigma`,latex:`\\sigma`,write:`\\sigma`}),uX=s({divide:()=>hX,equals:()=>fX,minus:()=>mX,multiply:()=>gX,plus:()=>pX}),dX=kJ(`operators`),fX=dX({write:`=`,label:`=`}),pX=dX({write:`+`,label:`+`}),mX=dX({write:`−`,label:`−`}),hX=dX({name:`divide`,label:`÷`,command:`\\divide`,otherNotation:`\\div`}),gX=dX({name:`multiply`,label:`×`,command:`\\times`}),_X=s({doubleCellMatrix:()=>bX,singleCellMatrix:()=>yX}),vX=kJ(`matrices`),yX=vX({name:`Single Cell Matrix`,label:`[ ]`,write:`\\begin{pmatrix}\\end{pmatrix}`}),bX=vX({name:`Double Cell Matrix`,label:`[ ] [ ] \\\\newline [ ] [ ]`,write:`\\begin{bmatrix}&\\\\&\\end{bmatrix}`}),xX={0:`zero`,1:`one`,2:`two`,3:`three`,4:`four`,5:`five`,6:`six`,7:`seven`,8:`eight`,9:`nine`},SX=de(10,String).map(e=>({name:xX[e],write:e,label:e,category:`digit`})).reduce((e,t)=>(e[t.name]=t,e),{comma:{name:`comma`,label:`,`,write:`,`,category:`digit`},decimalPoint:{name:`decimal-point`,label:`.`,write:`.`,category:`digit`}}),CX=kJ(`logic`),wX=CX({name:`Therefore`,label:`∴`,write:`∴`}),TX=CX({name:`Long division`,latex:`\\longdiv{}`,command:`\\longdiv`}),EX=kJ(`navigation`),DX=EX({label:`◀`,keystroke:`Left`,ariaLabel:`Move cursor left`}),OX=EX({label:`▶`,keystroke:`Right`,ariaLabel:`Move cursor right`}),kX={label:`⌫`,category:`edit`,keystroke:`Backspace`,ariaLabel:`Delete`},AX=[[BJ,tY,FJ,GJ,qJ],[qY,IJ,nX,KJ,JJ],[ZJ,TJ,EJ,DJ,OJ],[lY,LJ,$J,eY,QJ],[iY,hY,gY,_Y,LY]],jX=(()=>{let e=[...AX.map(e=>[...e])];return e[0].push({name:`i`,latex:`i`,write:`i`}),e[1].push(XY),e[2].push(ZY),e[3].push(QY),e[4].push(uY),e})(),MX=(()=>{let e=[...AX.map(e=>[...e])];return e[0].push(sX),e[1].push(aX),e[2].push(oX),e[3].push(cX),e[4].push(lX),e})(),NX=[{predicate:e=>e>=3&&e<=5,set:[[TJ,EJ],[VJ,HJ],[FJ,TX],[GJ,KJ]]},{predicate:e=>e>=6&&e<=7,set:[[LY,TJ,EJ],[qY,DJ,OJ],[FJ,IJ,GJ,KJ],[ZJ,VJ,HJ,qJ],[lY,$J,QJ,JJ]]},{predicate:e=>e>=8||e===`HS`,set:AX},{predicate:`non-negative-integers`,set:[[SX.seven,SX.eight,SX.nine],[SX.four,SX.five,SX.six],[SX.one,SX.two,SX.three],[SX.zero,{name:``,latex:``,write:``},{name:``,latex:``,write:``}],[DX,OX,kX]]},{predicate:`integers`,set:[[SX.seven,SX.eight,SX.nine],[SX.four,SX.five,SX.six],[SX.one,SX.two,SX.three],[SX.zero,{name:``,latex:``,write:``},mX],[DX,OX,kX]]},{predicate:`decimals`,set:[[SX.seven,SX.eight,SX.nine],[SX.four,SX.five,SX.six],[SX.one,SX.two,SX.three],[SX.zero,SX.decimalPoint,mX],[DX,OX,kX]]},{predicate:`fractions`,set:[[SX.seven,SX.eight,SX.nine],[SX.four,SX.five,SX.six],[SX.one,SX.two,SX.three],[SX.zero,BJ,mX],[DX,OX,kX]]},{predicate:`geometry`,set:[[BJ,LY,VY,HY,zY,RY],[qY,AY,MY,NY,BY,oY],[hY,gY,_Y,lY,qJ,JJ],[yY,vY,bY,LJ,nX,KJ],[CY,wY,TY,jY,kY,DY]]},{predicate:`advanced-algebra`,set:jX},{predicate:`statistics`,set:MX},{predicate:`item-authoring`,set:[[hX,BJ,TX,fY,GJ,qJ,CY,wY,TY,XY],[gX,qY,{name:``,latex:``,write:``},nX,KJ,JJ,kY,DY,jY,ZY],[ZJ,lY,LJ,LY,AY,UY,WY,NY,PY,QY],[iY,QJ,lX,sX,wX,cX,GY,hY,gY,_Y],[DJ,OJ,{name:``,latex:``,write:``},{name:``,latex:``,write:``},dY,{name:``,latex:``,write:``},{name:``,latex:``,write:``},yY,vY,bY]]},{predicate:e=>e>=1&&e<=2,set:[]}],PX=e=>{let t=parseInt(e,10);if(e=isNaN(t)?e:t,!e)return[];let n=NX.find(t=>typeof t.predicate==`string`?t.predicate===e:t.predicate(e));if(n)return n.set||[];if(e!==`language`)return NX[2].set},FX=[...Object.values(uX),...Object.values(CJ),...Object.values(sY),...Object.values(SX),...Object.values(UJ),...Object.values(RJ),...Object.values(xY),...Object.values(JY),...Object.values(_X),...Object.values(YJ),...Object.values(KY),...Object.values(rX),...Object.values($Y),...Object.values(pY),...Object.values(NJ)],IX=e=>(e||[]).map(e=>{let{latex:t}=e,n=(FX||[]).find(e=>t===e.latex||t===e.write||t===e.command||t===e.otherNotation);return t&&n||e}),LX=()=>{(Array.from(document.querySelectorAll(`span[mathquill-command-id]`))||[]).forEach(e=>{e&&e.innerText===`∥`&&e.className!==`mq-editable-field`&&(e.style.fontSize=`32px`),(e.innerText===`′`||e.innerText===`′′`)&&!e.hasAttribute(`data-prime`)&&e.setAttribute(`data-prime`,`true`)})},{one:RX,two:zX,three:BX,four:VX,five:HX,six:UX,seven:WX,eight:GX,nine:KX,zero:qX,comma:JX,decimalPoint:YX}=SX,XX=[[WX,GX,KX,hX],[VX,HX,UX,gX],[RX,zX,BX,mX],[qX,YX,JX,pX],[DX,OX,kX,fX]];function K(e){this.elements=Array.isArray(e)?e:[e].filter(Boolean),this.length=this.elements.length;for(var t=0;t<this.elements.length;t++)this[t]=this.elements[t]}K.prototype.addClass=function(e){var t=(e||``).split(/\s+/).filter(Boolean);return this.elements.forEach(function(e){t.forEach(function(t){e.classList.add(t)})}),this},K.prototype.removeClass=function(e){return this.elements.forEach(function(t){e?(e||``).split(/\s+/).filter(Boolean).forEach(function(e){t.classList.remove(e)}):t.className=``}),this},K.prototype.toggleClass=function(e,t){var n=(e||``).split(/\s+/).filter(Boolean),r=arguments.length>1?!!t:null;return this.elements.forEach(function(e){n.forEach(function(t){r===null?e.classList.toggle(t):e.classList.toggle(t,r)})}),this},K.prototype.attr=function(e,t){return t===tZ?this.elements[0]?this.elements[0].getAttribute(e):tZ:(this.elements.forEach(function(n){n.setAttribute(e,t)}),this)},K.prototype.html=function(e){return e===tZ?this.elements[0]?this.elements[0].innerHTML:``:(this.elements.forEach(function(t){t.innerHTML=e}),this)},K.prototype.append=function(e){var t=e instanceof K?e.elements[0]:e;return this.elements.forEach(function(e){e.appendChild(t)}),this},K.prototype.prepend=function(e){var t=e instanceof K?e.elements[0]:e;return this.elements.forEach(function(e,n){var r=n===0?t:t.cloneNode(!0);e.insertBefore(r,e.firstChild)}),this},K.prototype.wrapAll=function(e){if(!this.elements.length)return this;var t;if(typeof e==`string`&&e.trim().indexOf(`<`)===0){var n=document.createElement(`div`);n.innerHTML=e.trim(),t=n.firstChild}else if(e instanceof K)t=e.elements[0];else if(e&&e.nodeType)t=e;else return this;var r=this.elements[0],i=r.parentNode;return i&&(i.insertBefore(t,r),this.elements.forEach(function(e){t.appendChild(e)})),this},K.prototype.appendTo=function(e){var t=e instanceof K?e.elements[0]:e;return t&&this.elements.forEach(function(e){t.appendChild(e)}),this},K.prototype.prependTo=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.firstChild;return this.elements.forEach(function(e){t.insertBefore(e,n),n=e}),this},K.prototype.insertBefore=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.parentNode;return n&&this.elements.forEach(function(e){n.insertBefore(e,t)}),this},K.prototype.insertAfter=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.parentNode,r=t.nextSibling;return n&&this.elements.forEach(function(e){n.insertBefore(e,r),r=e}),this},K.prototype.replaceWith=function(e){var t=[];return e instanceof K?t=e.elements.slice():e&&typeof e.length==`number`&&!e.tagName?t=Array.from(e):e&&e.nodeType&&(t=[e]),this.elements.forEach(function(e){var n=e.parentNode;n&&(t.forEach(function(t){n.insertBefore(t,e)}),n.removeChild(e))}),this},K.prototype.insDirOf=function(e,t){return e===-1?this.insertBefore(t.first()):this.insertAfter(t.last())},K.prototype.insAtDirEnd=function(e,t){return e===-1?this.prependTo(t):this.appendTo(t)},K.prototype.children=function(e){var t=[];return this.elements.forEach(function(n){var r;if(!e)r=Array.from(n.children);else if(e===`:first`)r=n.firstElementChild?[n.firstElementChild]:[];else if(e===`:last`)r=n.lastElementChild?[n.lastElementChild]:[];else{var i=/^:eq\((\d+)\)$/.exec(e);if(i){var a=parseInt(i[1],10),o=Array.from(n.children);r=o[a]?[o[a]]:[]}else r=Array.from(n.querySelectorAll(`:scope > `+e))}t.push.apply(t,r)}),new K(t)},K.prototype.find=function(e){var t=[];return this.elements.forEach(function(n){var r=Array.from(n.querySelectorAll(e));t.push.apply(t,r)}),new K(t)},K.prototype.closest=function(e){return new K(this.elements.map(function(t){return t.closest(e)}).filter(Boolean))},K.prototype.contents=function(){var e=[];return this.elements.forEach(function(t){var n=Array.from(t.childNodes);e.push.apply(e,n)}),new K(e)},K.prototype.filter=function(e){return new K(this.elements.filter(function(t,n){return e(n,t)}))},K.prototype.detach=function(){return this.elements.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)}),this},K.prototype.remove=function(){return this.elements.forEach(function(e){e.remove()}),this},K.prototype.empty=function(){return this.elements.forEach(function(e){e.innerHTML=``}),this};function ZX(e){return(e||``).split(`.`)[0]}K.prototype.on=function(e,t){var n=ZX(e);return this.elements.forEach(function(e){e.addEventListener(n,t)}),this},K.prototype.bind=function(e,t,n){var r=this;if(typeof e==`object`){for(var i in e)e.hasOwnProperty(i)&&r.bind(i,e[i]);return this}var a=typeof t==`function`?t:n;return a===!1&&(a=function(e){e.preventDefault()}),(e||``).split(/\s+/).filter(Boolean).forEach(function(e){var t=ZX(e);r.elements.forEach(function(e){e.addEventListener(t,a)})}),this},K.prototype.off=function(e,t){var n=ZX(e);return this.elements.forEach(function(e){e.removeEventListener(n,t)}),this},K.prototype.unbind=function(e,t){if(e&&e.includes(`.`))this.elements.forEach(function(e){var t=e.cloneNode(!0);e.parentNode&&e.parentNode.replaceChild(t,e)});else if(e&&t){var n=ZX(e);this.elements.forEach(function(e){e.removeEventListener(n,t)})}return this},K.prototype.trigger=function(e){var t=new Event(ZX(e),{bubbles:!0,cancelable:!0});return this.elements.forEach(function(e){e.dispatchEvent(t)}),this},K.prototype.focus=function(e){return typeof e==`function`?this.on(`focus`,e):(this.elements.forEach(function(e){e.focus&&e.focus()}),this)},K.prototype.blur=function(e){return typeof e==`function`?this.on(`blur`,e):(this.elements.forEach(function(e){e.blur&&e.blur()}),this)},[`mousemove`,`mouseup`,`mousedown`,`mouseover`,`mouseout`,`click`,`keydown`,`keypress`,`keyup`,`focusout`,`paste`,`cut`,`copy`,`input`,`load`].forEach(function(e){K.prototype[e]=function(t){return this.on(e,t)}}),K.prototype.next=function(e){return new K(this.elements.map(function(e){return e.nextElementSibling}).filter(function(t){return!e||t&&t.matches(e)}))},K.prototype.prev=function(e){return new K(this.elements.map(function(e){return e.previousElementSibling}).filter(function(t){return!e||t&&t.matches(e)}))},K.prototype.parent=function(){return new K(this.elements.map(function(e){return e.parentElement}).filter(Boolean))},K.prototype.offset=function(){if(!this.elements[0])return{top:0,left:0};var e=this.elements[0].getBoundingClientRect();return{top:e.top+(window.pageYOffset||document.documentElement.scrollTop),left:e.left+(window.pageXOffset||document.documentElement.scrollLeft)}},K.prototype.width=function(){var e=this.elements[0];if(!e)return 0;var t=window.getComputedStyle(e);return parseFloat(t.width)||e.getBoundingClientRect().width},K.prototype.height=function(){var e=this.elements[0];if(!e)return 0;var t=window.getComputedStyle(e);return parseFloat(t.height)||e.getBoundingClientRect().height},K.prototype.outerWidth=function(){return this.elements[0]?this.elements[0].offsetWidth:0},K.prototype.outerHeight=function(){return this.elements[0]?this.elements[0].offsetHeight:0},K.prototype.innerWidth=function(){return this.elements[0]?this.elements[0].clientWidth:0},K.prototype.innerHeight=function(){return this.elements[0]?this.elements[0].clientHeight:0},K.prototype.css=function(e,t){if(t===tZ){if(typeof e==`string`){var n=this.elements[0];return n?window.getComputedStyle(n).getPropertyValue(e.replace(/([A-Z])/g,`-$1`).toLowerCase()):tZ}}else this.elements.forEach(function(n){n.style[e]=t});return this},K.prototype.scrollTop=function(e){var t=this.elements[0];return e===tZ?t?t===window?window.pageYOffset||document.documentElement.scrollTop:t.scrollTop:0:(t===window?window.scrollTo(window.pageXOffset||0,e):this.elements.forEach(function(t){t.scrollTop=e}),this)},K.prototype.scrollLeft=function(e){var t=this.elements[0];return e===tZ?t?t===window?window.pageXOffset||document.documentElement.scrollLeft:t.scrollLeft:0:(t===window?window.scrollTo(e,window.pageYOffset||0):this.elements.forEach(function(t){t.scrollLeft=e}),this)},K.prototype.each=function(e){return this.elements.forEach(function(t,n){e.call(t,n,t)}),this},K.prototype.eq=function(e){return new K([this.elements[e]])},K.prototype.get=function(e){return e===tZ?this.elements:e<0?this.elements[this.elements.length+e]:this.elements[e]},K.prototype.add=function(e){var t=this.elements.slice();return e instanceof K?t.push.apply(t,e.elements):Array.isArray(e)?t.push.apply(t,e):e&&e.nodeType&&t.push(e),new K(t)},K.prototype.first=function(){return new K([this.elements[0]])},K.prototype.last=function(){return new K([this.elements[this.elements.length-1]])},K.prototype.index=function(e){if(!e){var t=this.elements[0]&&this.elements[0].parentElement;return t?Array.from(t.children).indexOf(this.elements[0]):-1}var n=e instanceof K?e.elements[0]:e;return this.elements.indexOf(n)},K.prototype.is=function(e){return this.elements.some(function(t){return t.matches(e)})},K.prototype.text=function(e){return e===tZ?this.elements.map(function(e){return e.textContent}).join(``):(this.elements.forEach(function(t){t.textContent=e}),this)},K.prototype.val=function(e){var t=this.elements[0];return t?e===tZ?t.value===tZ?t.textContent:t.value:(this.elements.forEach(function(t){t.value===tZ?t.textContent=e:t.value=e}),this):tZ};function QX(e){var t=Array.isArray(e)?e:[e].filter(Boolean),n=Object.create(K.prototype);n.elements=t,n.length=t.length;for(var r=0;r<t.length;r++)n[r]=t[r];return n}var $X=function(e,t){var n;if(!e)n=[];else if(e===window||e===document)n=[e];else if(e.nodeType)n=[e];else if(e&&e.current&&e.current.nodeType)n=[e.current];else if(typeof e==`string`&&e[0]===`<`){var r=document.createElement(`div`);r.innerHTML=e.trim(),n=Array.from(r.children)}else if(typeof e==`string`){var i=t instanceof K?t.elements[0]:t||document;n=Array.from(i.querySelectorAll(e))}else n=e instanceof K?e.elements:e.length===tZ?[]:Array.from(e);return QX(n)};$X.contains=function(e,t){return e!==t&&e.contains(t)};var eZ=$X,tZ,nZ=`mathquill-command-id`,rZ=`mathquill-block-id`,iZ=Math.min,aZ=Math.max;function oZ(){}var sZ=[].slice;function cZ(e){var t=e.length-1;return function(){var n=sZ.call(arguments,0,t),r=sZ.call(arguments,t);return e.apply(this,n.concat([r]))}}var lZ=cZ(function(e,t){return cZ(function(n,r){if(e in n)return n[e].apply(n,t.concat(r))})});function uZ(e){return cZ(function(t,n){return typeof t!=`function`&&(t=lZ(t)),e.call(this,function(e){return t.apply(e,[e].concat(n))})})}function q(e){var t=sZ.call(arguments,1);return function(){return e.apply(this,t)}}function dZ(e,t){if(!t)throw Error(`prayer failed: `+e)}var J=(function(e,t,n){function r(e){return typeof e==`object`}function i(e){return typeof e==`function`}function a(){}return function o(s,c){c===n&&(c=s,s=Object);function l(){var e=new u;return i(e.init)&&e.init.apply(e,arguments),e}function u(){}l.Bare=u;var d=a[e]=s[e],f=u[e]=l[e]=l.p=new a,p;return f.constructor=l,l.extend=function(e){return o(l,e)},(l.open=function(e){if(p={},i(e)?p=e.call(l,f,d,l,s):r(e)&&(p=e),r(p))for(var n in p)t.call(p,n)&&(f[n]=p[n]);return i(f.init)||(f.init=s),l})(c)}})(`prototype`,{}.hasOwnProperty),Y=-1,X=1;function fZ(e){dZ(`a direction was passed`,e===Y||e===X)}var pZ=J(function(e){e.parent=0,e[Y]=0,e[X]=0,e.init=function(e,t,n){this.parent=e,this[Y]=t,this[X]=n},this.copy=function(e){return pZ(e.parent,e[Y],e[X])}}),mZ=J(function(e){e[Y]=0,e[X]=0,e.parent=0;var t=0;function n(){return t+=1}this.byId={},e.init=function(){this.id=n(),mZ.byId[this.id]=this,this.ends={},this.ends[Y]=0,this.ends[X]=0},e.dispose=function(){delete mZ.byId[this.id]},e.toString=function(){return`{{ MathQuill Node #`+this.id+` }}`},e.jQ=$X(),e.jQadd=function(e){return this.jQ=this.jQ.add(e)},e.jQize=function(e){var e=$X(e||this.html());function t(e){if(e.getAttribute){var n=e.getAttribute(`mathquill-command-id`),r=e.getAttribute(`mathquill-block-id`);n&&mZ.byId[n].jQadd(e),r&&mZ.byId[r].jQadd(e)}for(e=e.firstChild;e;e=e.nextSibling)t(e)}for(var n=0;n<e.length;n+=1)t(e[n]);return e},e.createDir=function(e,t){fZ(e);var n=this;return n.jQize(),n.jQ.insDirOf(e,t.jQ),t[e]=n.adopt(t.parent,t[Y],t[X]),n},e.createLeftOf=function(e){return this.createDir(Y,e)},e.selectChildren=function(e,t){return bZ(e,t)},e.bubble=uZ(function(e){for(var t=this;t&&e(t)!==!1;t=t.parent);return this}),e.postOrder=uZ(function(e){return(function t(n){n.eachChild(t),e(n)})(this),this}),e.isEmpty=function(){return this.ends[Y]===0&&this.ends[X]===0},e.isStyleBlock=function(){return!1},e.children=function(){return gZ(this.ends[Y],this.ends[X])},e.eachChild=function(){var e=this.children();return e.each.apply(e,arguments),this},e.foldChildren=function(e,t){return this.children().fold(e,t)},e.withDirAdopt=function(e,t,n,r){return gZ(this,this).withDirAdopt(e,t,n,r),this},e.adopt=function(e,t,n){return gZ(this,this).adopt(e,t,n),this},e.disown=function(){return gZ(this,this).disown(),this},e.remove=function(){return this.jQ.remove(),this.postOrder(`dispose`),this.disown()}});function hZ(e,t,n){dZ(`a parent is always present`,e),t&&(t[X]!==n&&(t[X]=n),t.parent!==e&&(t.parent=e)),n&&(n[Y]!==t&&(n[Y]=t),n.parent!==e&&(n.parent=e)),dZ(`leftward is properly set up`,(function(){return t?t[X]===n&&t.parent===e:e.ends[Y]===n})()),dZ(`rightward is properly set up`,(function(){return n?n[Y]===t&&n.parent===e:e.ends[X]===t})())}var gZ=J(function(e){e.init=function(e,t,n){if(n===tZ&&(n=Y),fZ(n),dZ(`no half-empty fragments`,!e==!t),this.ends={},e){dZ(`withDir is passed to Fragment`,e instanceof mZ),dZ(`oppDir is passed to Fragment`,t instanceof mZ),dZ(`withDir and oppDir have the same parent`,e.parent===t.parent),this.ends[n]=e,this.ends[-n]=t;var r=this.fold([],function(e,t){return e.push.apply(e,t.jQ.get()),e});this.jQ=this.jQ.add(r)}},e.jQ=$X(),e.withDirAdopt=function(e,t,n,r){return e===Y?this.adopt(t,n,r):this.adopt(t,r,n)},e.adopt=function(e,t,n){hZ(e,t,n);var r=this;r.disowned=!1;var i=r.ends[Y];if(!i)return this;var a=r.ends[X];return t||(e.ends[Y]=i),n?n[Y]=a:e.ends[X]=a,r.ends[X][X]=n,r.each(function(n){n[Y]=t,n.parent=e,t&&(t[X]=n),t=n}),r},e.disown=function(){var e=this,t=e.ends[Y];if(!t||e.disowned)return e;e.disowned=!0;var n=e.ends[X],r=t.parent;return hZ(r,t[Y],t),hZ(r,n,n[X]),t[Y]?t[Y][X]=n[X]:r.ends[Y]=n[X],n[X]?n[X][Y]=t[Y]:r.ends[X]=t[Y],e},e.remove=function(){return this.jQ.remove(),this.each(`postOrder`,`dispose`),this.disown()},e.each=uZ(function(e){var t=this,n=t.ends[Y];if(!n)return t;for(;n!==t.ends[X][X]&&e(n)!==!1;n=n[X]);return t}),e.fold=function(e,t){return this.each(function(n){e=t.call(this,e,n)}),e}}),Z={},_Z={},vZ={},yZ=J(pZ,function(e){e.init=function(e,t){this.parent=e,this.options=t;var n=this.jQ=this._jQ=$X(`<span class="mq-cursor">​</span>`);this.blink=function(){n.toggleClass(`mq-blink`)},this.upDownCache={}},e.show=function(){return this.jQ=this._jQ.removeClass(`mq-blink`),`intervalId`in this?clearInterval(this.intervalId):(this[X]?this.selection&&this.selection.ends[Y][Y]===this[Y]?this.jQ.insertBefore(this.selection.jQ):this.jQ.insertBefore(this[X].jQ.first()):this.jQ.appendTo(this.parent.jQ),this.parent.focus()),this.intervalId=setInterval(this.blink,500),this},e.hide=function(){return`intervalId`in this&&clearInterval(this.intervalId),delete this.intervalId,this.jQ.detach(),this.jQ=$X(),this},e.withDirInsertAt=function(e,t,n,r){var i=this.parent;this.parent=t,this[e]=n,this[-e]=r,i!==t&&i.blur&&i.blur(this)},e.insDirOf=function(e,t){return fZ(e),!t||!t.jQ?this:(this.jQ.insDirOf(e,t.jQ),this.withDirInsertAt(e,t.parent,t[e],t),this.parent.jQ.addClass(`mq-hasCursor`),this)},e.insLeftOf=function(e){return this.insDirOf(Y,e)},e.insRightOf=function(e){return this.insDirOf(X,e)},e.insAtDirEnd=function(e,t){return fZ(e),this.jQ.insAtDirEnd(e,t.jQ),this.withDirInsertAt(e,t,0,t.ends[e]),t.focus(),this},e.insAtLeftEnd=function(e){return this.insAtDirEnd(Y,e)},e.insAtRightEnd=function(e){return this.insAtDirEnd(X,e)},e.jumpUpDown=function(e,t){var n=this;n.upDownCache[e.id]=pZ.copy(n);var r=n.upDownCache[t.id];if(r)r[X]?n.insLeftOf(r[X]):n.insAtRightEnd(r.parent);else{var i=n.offset().left;t.seek(i,n)}},e.offset=function(){var e=this,t=e.jQ.removeClass(`mq-cursor`).offset();return e.jQ.addClass(`mq-cursor`),t},e.unwrapGramp=function(){var e=this.parent.parent,t=e.parent,n=e[X],r=this,i=e[Y];if(e.disown().eachChild(function(r){r.isEmpty()||(r.children().adopt(t,i,n).each(function(t){t.jQ.insertBefore(e.jQ.first())}),i=r.ends[X])}),!this[X])if(this[Y])this[X]=this[Y][X];else for(;!this[X];)if(this.parent=this.parent[X],this.parent)this[X]=this.parent.ends[Y];else{this[X]=e[X],this.parent=t;break}this[X]?this.insLeftOf(this[X]):this.insAtRightEnd(t),e.jQ.remove(),e[Y].siblingDeleted&&e[Y].siblingDeleted(r.options,X),e[X].siblingDeleted&&e[X].siblingDeleted(r.options,Y)},e.startSelection=function(){for(var e=this.anticursor=pZ.copy(this),t=e.ancestors={},n=e;n.parent;n=n.parent)t[n.parent.id]=n},e.endSelection=function(){delete this.anticursor},e.select=function(){var e=this.anticursor;if(!e||!e.ancestors||this[Y]===e[Y]&&this.parent===e.parent)return!1;for(var t,n=this;n.parent;n=n.parent)if(n.parent.id in e.ancestors){t=n.parent;break}if(!t)return!1;var r=e.ancestors[t.id],i,a,o=X;if(n[Y]!==r){for(var s=n;s;s=s[X])if(s[X]===r[X]){o=Y,i=n,a=r;break}}return o===X&&(i=r,a=n),i instanceof pZ&&(i=i[X]),a instanceof pZ&&(a=a[Y]),!i||!a?!1:(this.hide().selection=t.selectChildren(i,a),this.insDirOf(o,this.selection.ends[o]),this.selectionChanged(),!0)},e.clearSelection=function(){return this.selection&&(this.selection.clear(),delete this.selection,this.selectionChanged()),this},e.deleteSelection=function(){this.selection&&(this[Y]=this.selection.ends[Y][Y],this[X]=this.selection.ends[X][X],this.selection.remove(),this.selectionChanged(),delete this.selection)},e.replaceSelection=function(){var e=this.selection;return e&&(this[Y]=e.ends[Y][Y],this[X]=e.ends[X][X],delete this.selection),e},e.depth=function(){for(var e=this,t=0;e=e.parent;)t+=+(e instanceof VZ);return t},e.isTooDeep=function(e){if(this.options.maxDepth!==tZ)return this.depth()+(e||0)>this.options.maxDepth},e.howDeep=function(){for(var e=0,t=this;t=t.parent;)e++;return 1+Math.floor(e/2)},e.tooDeep=function(){var e=this.options.maxDepth;return e&&this.howDeep()>e}}),bZ=J(gZ,function(e,t){e.init=function(){t.init.apply(this,arguments),this.jQ=this.jQ.wrapAll(`<span class="mq-selection"></span>`).parent()},e.adopt=function(){return this.jQ.replaceWith(this.jQ=this.jQ.children()),t.adopt.apply(this,arguments)},e.clear=function(){var e=this.jQ[0];return e&&this.jQ.replaceWith(e.childNodes),this},e.join=function(e){return this.fold(``,function(t,n){return t+n[e]()})}}),xZ=J(function(e){e.init=function(e,t,n){this.id=e.id,this.data={},this.root=e,this.container=t,this.options=n,e.controller=this,this.cursor=e.cursor=yZ(e,n)},e.handle=function(e,t){var n=this.options.handlers;if(n&&n.fns[e]){var r=n.APIClasses[this.KIND_OF_MQ](this);t===Y||t===X?n.fns[e](t,r):n.fns[e](r)}};var t=[];this.onNotify=function(e){t.push(e)},e.notify=function(){for(var e=0;e<t.length;e+=1)t[e].apply(this.cursor,arguments);return this}}),SZ={},CZ=J(),wZ={},TZ=J(),EZ={};function DZ(){window.console&&console.warn(`You are using the MathQuill API without specifying an interface version, which will fail in v1.0.0. Easiest fix is to do the following before doing anything else:
|
|
319
|
+
background-color: var(--pie-background, rgba(255, 255, 255))`,t[1].border=n||`1`,t}}),Jq=`(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+`,Yq=kq.extend({content:Jq}),Xq=Aq.extend({content:Jq}),Zq=$A.create({name:`div`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`div`}]},renderHTML({HTMLAttributes:e}){return[`div`,e,0]},addKeyboardShortcuts(){let e=e=>{for(let t=e.depth;t>=0;--t)if(e.node(t).type.name===`listItem`)return!0;return!1};return{Enter:()=>{let{state:t}=this.editor,{$from:n}=t.selection;return n.parent.type.name!==`div`||e(n)?!1:this.editor.chain().focus().setNode(`paragraph`).splitBlock().run()},Backspace:()=>{let{state:e}=this.editor,{$from:t,empty:n}=e.selection;if(t.parent.type.name!==`div`||!n)return!1;let r=t.parent.textContent;if(r.length===0)return e.doc.childCount===1;if(r.length===1&&t.parentOffset===1){let{tr:n}=e;return n.delete(t.pos-1,t.pos),this.editor.view.dispatch(n),!0}return!1}}}}),Qq=CA.create({name:`ensureEmptyRootIsDiv`,addProseMirrorPlugins(){return[new Db({key:new Ab(this.name),appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let{doc:r}=n;if(r.childCount!==1)return null;let i=r.firstChild;if(i.type.name!==`paragraph`||i.content.size>0)return null;let a=n.schema.nodes.div;if(!a)return null;let o=i.nodeSize;return n.tr.replaceWith(0,o,a.create())}})]}}),$q=CA.create({name:`ensureListItemContentIsDiv`,addProseMirrorPlugins(){return[new Db({key:new Ab(this.name),appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let{doc:r,schema:i}=n,a=i.nodes.div;if(!a)return null;let o=[];if(r.descendants((e,t)=>{if(e.type.name!==`listItem`)return;let n=1;e.forEach(e=>{e.type.name===`paragraph`&&o.push({pos:t+n,attrs:e.attrs}),n+=e.nodeSize})}),o.length===0)return null;let s=n.tr;return o.sort((e,t)=>t.pos-e.pos).forEach(({pos:e,attrs:t})=>s.setNodeMarkup(e,a,t)),s}})]}});function eJ(e){return F(`MuiIconButton`,e)}var tJ=mi(`MuiIconButton`,[`root`,`disabled`,`colorInherit`,`colorPrimary`,`colorSecondary`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`,`edgeStart`,`edgeEnd`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`loading`,`loadingIndicator`,`loadingWrapper`]),nJ=e=>{let{classes:t,disabled:n,color:r,edge:i,size:a,loading:o}=e;return Fa({root:[`root`,o&&`loading`,n&&`disabled`,r!=="default"&&`color${z(r)}`,i&&`edge${z(i)}`,`size${z(a)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},eJ,t)},rJ=L(Zd,{name:`MuiIconButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!=="default"&&t[`color${z(n.color)}`],n.edge&&t[`edge${z(n.edge)}`],t[`size${z(n.size)}`]]}})(ol(({theme:e})=>({textAlign:`center`,flex:`0 0 auto`,fontSize:e.typography.pxToRem(24),padding:8,borderRadius:`50%`,color:(e.vars||e).palette.action.active,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:`var(--IconButton-hoverBg)`,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:{edge:`start`},style:{marginLeft:-12}},{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:{edge:`end`},style:{marginRight:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}}]})),ol(({theme:e})=>({variants:[{props:{color:`inherit`},style:{color:`inherit`}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:`small`},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${tJ.disabled}`]:{backgroundColor:`transparent`,color:(e.vars||e).palette.action.disabled},[`&.${tJ.loading}`]:{color:`transparent`}}))),iJ=L(`span`,{name:`MuiIconButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:`flex`}}]})),aJ=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiIconButton`}),{edge:r=!1,children:i,className:a,color:o=`default`,disabled:s=!1,disableFocusRipple:c=!1,size:l=`medium`,id:u,loading:d=null,loadingIndicator:f,...p}=n,m=Wl(u),h=f??(0,N.jsx)(mf,{"aria-labelledby":m,color:`inherit`,size:16}),g={...n,edge:r,color:o,disabled:s,disableFocusRipple:c,loading:d,loadingIndicator:h,size:l},_=nJ(g);return(0,N.jsxs)(rJ,{id:d?m:u,className:P(_.root,a),centerRipple:!0,focusRipple:!c,disabled:s||d,ref:t,...p,ownerState:g,children:[typeof d==`boolean`&&(0,N.jsx)(`span`,{className:_.loadingWrapper,style:{display:`contents`},children:(0,N.jsx)(iJ,{className:_.loadingIndicator,ownerState:g,children:d&&h})}),i]})}),oJ=Vl((0,N.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z`}),`Delete`),sJ=`pie-toolbar`,cJ=Vl((0,N.jsx)(`path`,{d:`M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`}),`Check`),lJ=L(aJ)({verticalAlign:`top`,width:`28px`,height:`28px`,color:`var(--editable-html-toolbar-check, #00bb00)`,padding:`4px`}),uJ=({onClick:e,doneButtonRef:t})=>(0,N.jsx)(lJ,{"aria-label":`Done`,buttonRef:t,onClick:e,children:(0,N.jsx)(cJ,{})});uJ.propTypes={onClick:k.func,doneButtonRef:k.func};var dJ=uJ,fJ=L(`div`,{shouldForwardProp:e=>![`showDone`,`toolbarAlignment`,`isFocused`,`autoWidth`,`isHidden`].includes(e)})(({showDone:e,toolbarAlignment:t,isFocused:n,autoWidth:r,isHidden:i})=>({position:`absolute`,zIndex:10,cursor:`pointer`,justifyContent:`space-between`,background:`var(--editable-html-toolbar-bg, #efefef)`,minWidth:e?`280px`:`265px`,margin:`5px 0 0 0`,padding:`2px`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,boxSizing:`border-box`,display:`flex`,opacity:1,...t===`right`&&{right:0},...r?{width:`auto`}:{width:`100%`},...i&&{visibility:`hidden`}})),pJ=L(aJ)({width:`28px`,height:`28px`,padding:`4px`,verticalAlign:`top`}),mJ=L(`div`)({display:`flex`});function hJ(e){let{children:t,deletable:n,toolbarOpts:r,autoWidth:i,isFocused:a,doneButtonRef:o,onDelete:s,showDone:c,onDone:l,style:u}=e,d=r.minWidth===void 0?{}:{minWidth:r.minWidth};return(0,N.jsxs)(fJ,{className:sJ,showDone:c,toolbarAlignment:r.alignment,isFocused:r.alwaysVisible||a,autoWidth:i,isHidden:r.isHidden===!0,style:{...d,...u},children:[t,(0,N.jsxs)(mJ,{children:[n&&(0,N.jsx)(pJ,{"aria-label":`Delete`,onMouseDown:e=>s?.(e),children:(0,N.jsx)(oJ,{})}),c&&(0,N.jsx)(dJ,{doneButtonRef:o,onClick:l})]})]})}var gJ=`toolbarOpenedChanged`,_J=(e,t)=>{let n=!!t;e._toolbarOpened!==n&&(e._toolbarOpened=n,e?.view&&e?.state?.tr&&e.view.dispatch(e.state.tr.setMeta(gJ,!0)))},vJ=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{value:s}=o,{respAreaToolbar:c,error:l}=i,u=r(),[d,f]=(0,M.useState)(!1),p=c([n,u],t,()=>{}),m=(0,M.useRef)(null),h;if(l){let e=l(),t=parseInt(o.index,10);h=!!e?.[t]?.[0]}return(0,M.useEffect)(()=>{let{selection:e}=t.state,r=e.from+n.nodeSize===e.to;a?r&&f(a):f(a)},[t,n,a]),(0,M.useEffect)(()=>{let e=e=>{!(e.target.closest(`.insert-character-dialog`)||e.target.closest(`[data-toolbar-for]`))&&m.current&&!m.current.contains(e.target)&&!e.target.closest(`[data-inline-node]`)&&f(!1)};return d?document.addEventListener(`mousedown`,e):document.removeEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,N.jsxs)(vM,{className:`drag-in-the-blank`,"data-selected":a,style:{display:`inline-flex`,minHeight:`55px`,position:`relative`,cursor:`pointer`},children:[(0,N.jsx)(`div`,{...o,style:{display:`inline-flex`,width:`100%`,minHeight:`46px`,height:`46px`,backgroundColor:`#FFF`,border:`1px solid ${h?`red`:`#C0C3CF`}`,boxSizing:`border-box`,borderRadius:`4px`,overflow:`hidden`,padding:`12px 21px`,margin:`0 4px`,minWidth:`178px`,visibility:d?`hidden`:`visible`},onClick:()=>f(!0),dangerouslySetInnerHTML:{__html:s||`<div> </div>`}}),d&&(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`div`,{ref:m,className:`absolute z-50 bg-white shadow-lg rounded p-2`,style:{zIndex:1},children:(0,N.jsx)(p,{})}),t._tiptapContainerEl&&hs.createPortal((0,N.jsx)(hJ,{deletable:!0,toolbarOpts:{minWidth:`auto`},autoWidth:!0,style:{top:-40,left:0,right:0},onDelete:()=>{let{tr:e}=t.state;e.delete(u,u+n.nodeSize),_J(t,!1),t.view.dispatch(e),f(!1),t.commands.focus()},showDone:!1}),t._tiptapContainerEl)]})]})};vJ.propTypes={attributes:k.object,error:k.any,value:k.string,isFocused:k.bool};var yJ=Vl((0,N.jsx)(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`ChevronRight`),bJ=Vl((0,N.jsx)(`path`,{d:`M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2`}),`MoreVert`),xJ=e=>{switch(e){case`down`:return 90;case`up`:return-90;case`left`:return 180;default:return 0}},SJ=e=>{let{direction:t,style:n}=e;return(0,N.jsx)(yJ,{style:{transform:`rotate(${xJ(t)}deg)`,...n}})};SJ.propTypes={direction:k.string,style:k.object};var CJ=({style:e})=>(0,N.jsxs)(`span`,{style:e,children:[(0,N.jsx)(bJ,{style:{margin:`0 -16px`}}),(0,N.jsx)(bJ,{})]});CJ.propTypes={style:k.object},L(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans !important`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,top:`7px`,width:`110px`,height:`28px`,whiteSpace:`nowrap`}));var wJ=L(`span`)(({theme:e})=>({border:`solid 0px ${e.palette.primary.main}`,"& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn":{fontSize:`120% !important`},"& mjx-frac":{fontSize:`120% !important`}}));function TJ({n:e,children:t,isDragging:n,isOver:r,dragItem:i,value:a,selected:o}){let[s,c]=(0,M.useState)(null),l=(0,M.useRef)(null),u=e=>{l.current&&(l.current.contains(e.target)?l.current.classList.add(`selected`):l.current.classList.remove(`selected`))};(0,M.useEffect)(()=>(document.addEventListener(`click`,u),()=>{document.removeEventListener(`click`,u)}),[]),(0,M.useEffect)(()=>{l.current&&typeof O==`function`&&O(l.current)},[a?.value,r,i?.value?.value]),(0,M.useEffect)(()=>{if(r&&l.current&&!s){let e=l.current;c({width:e.offsetWidth,height:e.offsetHeight})}else!r&&s&&c(null)},[r,s]);let d=i&&r?i.value.value:a.value||`\xA0`,f=n?`\xA0`:d,p=f!==`\xA0`,m=i&&r,h=o?`2px solid ${Cu()}`:m?`1px solid ${B.BORDER_DARK}`:`1px solid ${B.BORDER_LIGHT}`;return(0,N.jsxs)(`div`,{ref:l,className:o?`selected`:void 0,style:{display:`inline-flex`,minWidth:`178px`,minHeight:`36px`,background:m?`${B.BORDER_LIGHT}`:`${B.WHITE}`,border:h,boxSizing:`border-box`,borderRadius:`3px`,overflow:`hidden`,position:`relative`,padding:`8px 8px 8px 35px`,width:s?s.width:void 0,height:s?s.height:void 0,touchAction:`none`},"data-key":e.index,contentEditable:!1,children:[p&&(0,N.jsx)(CJ,{style:{position:`absolute`,top:`6px`,left:`15px`,color:`#9B9B9B`},contentEditable:!1}),(0,N.jsx)(`span`,{dangerouslySetInnerHTML:{__html:f}}),t]})}TJ.propTypes={n:k.object,children:k.node,isDragging:k.bool,isOver:k.bool,dragItem:k.object,value:k.object,selected:k.bool};function EJ({value:e,disabled:t,instanceId:n,children:r,n:i,onChange:a,removeResponse:o,duplicates:s,pos:c,selected:l}){let{attributes:u,listeners:d,setNodeRef:f,isDragging:p}=y_({id:`drag-${i.index}`,disabled:t||!e?.value,data:{id:`drag-${i.index}`,value:e,instanceId:n,n:i,pos:c,opts:{duplicates:s},type:`drag-in-the-blank-placed-choice`,fromChoice:!e,onRemove:e=>o(e),onDrop:(e,t)=>{t?.type===`drag-in-the-blank-drop-choice`&&(a(e),!s&&e.fromChoice&&o(e))}}}),{setNodeRef:m,isOver:h,active:g}=S_({id:`drop-${i.index}`,data:{type:`drag-in-the-blank-drop-choice`,accepts:[`drag-in-the-blank-choice`,`drag-in-the-blank-placed-choice`],instanceId:n,value:e,id:`drop-${i.index}`,pos:c,n:i,opts:{duplicates:s},onDrop:(e,t)=>{if(t?.type===`drag-in-the-blank-drop-choice`&&e.value.id!==t.value.id){if(e.type===`drag-in-the-blank-choice`){a(e),!s&&e.fromChoice&&o(e);return}e.type===`drag-in-the-blank-placed-choice`&&(o(t),a(e),setTimeout(()=>o(e),10))}}}}),_=e=>{f(e),m(e)},v=(0,N.jsx)(TJ,{n:i,isDragging:p,isOver:h,dragItem:g?.data?.current,value:e,selected:l,children:r}),y=e?(0,N.jsx)(`span`,{ref:_,...u,...d,children:v}):(0,N.jsx)(`span`,{ref:m,children:v});return(0,N.jsx)(wJ,{className:P(h&&`over`),children:y})}EJ.propTypes={value:k.object,disabled:k.bool,instanceId:k.string,children:k.node,n:k.object.isRequired,onChange:k.func.isRequired,removeResponse:k.func.isRequired,duplicates:k.bool,selected:k.bool};var DJ=(e,t,n,r)=>{let{tr:i}=e.state;i.setNodeMarkup(n,void 0,{...t.attrs,...r.value}),i.isDone=!0,e.view.dispatch(i)},OJ=(e,t,n)=>{let{tr:r}=e.state;r.setNodeMarkup(n.pos,void 0,ue(t.attrs,[`value`,`id`])),r.isDone=!0,e.view.dispatch(r)},kJ=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{inTable:s}=o,c=r();return(0,N.jsx)(vM,{className:`drag-in-the-blank`,"data-selected":a,style:{display:`inline`,whiteSpace:`normal`},children:(0,N.jsx)(`span`,{...o,style:{display:`inline-flex`,minHeight:`50px`,minWidth:`178px`,position:`relative`,margin:s?`10px`:`0 10px`,cursor:`pointer`},children:(0,N.jsx)(EJ,{n:o,dragKey:o.id,targetId:`0`,pos:c,value:o,duplicates:i.duplicates,selected:a,onChange:e=>DJ(t,n,c,e),removeResponse:e=>OJ(t,n,e)})})})};kJ.propTypes={attributes:k.object,data:k.object,n:k.object,nodeProps:k.object,opts:k.object};var AJ=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{value:s,error:c}=o,l=s||`<div> </div>`,u=r(),d=(0,M.useRef)(null),f=(0,M.useRef)(null),p=(0,M.useRef)(!1),m=(0,M.useRef)(null),h=()=>t._holdInlineDropdownToolbarIndex!=null&&String(t._holdInlineDropdownToolbarIndex)===String(n.attrs.index),[g,_]=(0,M.useState)(!1),[v,y]=(0,M.useState)({top:0,left:0}),b=()=>{h()||(_(!1),i.onInlineDropdownToolbarClose?.(t))},x=i.respAreaToolbar([n,u],t,b),S=()=>{let{tr:e}=t.state,n=e.doc.nodeAt(u);if(!n)return;let{selection:r}=e;r.from===u&&r.to===u+n.nodeSize||(e.setSelection(W.create(e.doc,u)),t.view.dispatch(e))},C=()=>{p.current||(i.onToolbarCloseRequest?(p.current=!0,i.onToolbarCloseRequest([n,u],t,()=>{p.current=!1,delete t._holdInlineDropdownToolbarIndex,b()},()=>{p.current=!1,delete t._holdInlineDropdownToolbarIndex,_(!0),setTimeout(S,0)})):b())};(0,M.useEffect)(()=>{let{selection:e}=t.state,r=e.from+n.nodeSize===e.to;a?r&&_(!0):g&&C()},[t,n,a]);let w=e=>e.clientX>document.documentElement.clientWidth||e.clientY>document.documentElement.clientHeight||e.target===document.documentElement;return(0,M.useEffect)(()=>{m.current&&typeof O==`function`&&O(m.current)},[s]),(0,M.useEffect)(()=>{let e=document.body.getBoundingClientRect(),{from:n}=t.state.selection,r=t.view.coordsAtPos(n);y({top:r.top+Math.abs(e.top)+40,left:r.left});let i=e=>{if(w(e))return;let n=e.target.closest(`[data-toolbar-for]`);!e.target.closest(`[data-inline-dropdown-toolbar]`)&&(!n||n.dataset.toolbarFor!==f.current?.instanceId)&&!t._toolbarOpened&&d.current&&!d.current.contains(e.target)&&!e.target.closest(`[data-inline-node]`)&&C()};return g?document.addEventListener(`mousedown`,i):document.removeEventListener(`mousedown`,i),()=>document.removeEventListener(`mousedown`,i)},[g,n]),(0,N.jsxs)(vM,{className:`inline-dropdown`,"data-selected":a,style:{display:`inline-flex`,height:`50px`,cursor:`pointer`},children:[(0,N.jsxs)(`div`,{ref:m,style:{display:`inline-flex`,minWidth:`178px`,height:`36px`,background:`#FFF`,border:`1px solid #C0C3CF`,boxSizing:`border-box`,borderRadius:`3px`,margin:`0 2px`,position:`relative`,alignItems:`center`},onClick:()=>_(!0),children:[(0,N.jsx)(`div`,{style:{flex:1,overflow:`hidden`,padding:`0 25px 0 8px`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},children:(0,N.jsx)(`span`,{style:{display:`inline-block`,verticalAlign:`middle`},dangerouslySetInnerHTML:{__html:l}})}),(0,N.jsx)(SJ,{direction:`down`,style:{position:`absolute`,top:`5px`,right:`5px`}})]}),g&&(0,N.jsxs)(M.Fragment,{children:[hs.createPortal((0,N.jsx)(`div`,{ref:d,children:(0,N.jsx)(x,{editorCallback:e=>{f.current=e}})}),t?._tiptapContainerEl||document.body),t._tiptapContainerEl&&hs.createPortal((0,N.jsx)(hJ,{deletable:!0,toolbarOpts:{minWidth:`auto`},autoWidth:!0,style:{top:-40,left:0,right:0},onDelete:()=>{let{tr:e}=t.state;e.delete(u,u+n.nodeSize),_J(t,!1),delete t._holdInlineDropdownToolbarIndex,t.view.dispatch(e),_(!1),t.commands.focus()},showDone:!1}),t._tiptapContainerEl)]})]})};AJ.propTypes={attributes:k.object,selectedItem:k.oneOfType([k.string,k.object])};var jJ=s({greaterThan:()=>PJ,greaterThanEqual:()=>IJ,lessThan:()=>NJ,lessThanEqual:()=>FJ}),MJ=e=>({...e,category:`comparison`}),NJ=MJ({name:`Less than`,latex:`<`,command:`\\lt`}),PJ=MJ({name:`Greater than`,latex:`>`,command:`\\gt`}),FJ=MJ({name:`Less than or equal`,latex:`\\le`,symbol:`<=`,command:`\\le`,ariaLabel:`less than or equal to`}),IJ=MJ({name:`Greater than or equal`,symbol:`>=`,command:`\\ge`,latex:`\\ge`}),LJ=e=>t=>({...t,category:e}),RJ=(e=[])=>{let t=[];de(5,()=>t.push([]));let n=e.length,r=0,i=0;for(;i<n;)t[r++].push(e[i++]),r===5&&(r=0);return t},zJ=e=>t=>{let n=ae(e),r=n.some(e=>e.latex===t.latex),i=n.some(e=>e.name===t.name);return!r&&!i},BJ=(e=[],t=[])=>{t=t.filter(zJ(e));let n=[];de(5-e.length,()=>e.push([])),de(5,()=>n.push([]));let r=RJ(t);for(let t=0;t<5;t++)n[t]=[...e[t],...r[t]];return n},VJ=s({theta:()=>GJ,x:()=>UJ,y:()=>WJ}),HJ=LJ(`vars`),UJ=HJ({name:`X`,latex:`x`,write:`x`}),WJ=HJ({name:`Y`,latex:`y`,write:`y`}),GJ=HJ({name:`Theta`,latex:`\\theta`,write:`\\theta`}),KJ=s({blankOverBlank:()=>JJ,xBlankBlank:()=>XJ,xOverBlank:()=>YJ}),qJ=LJ(`fractions`),JJ=qJ({name:`blank/blank`,latex:`\\frac{}{}`,command:`\\frac`,ariaLabel:`fraction`}),YJ=qJ({latex:`\\frac{x}{ }`,name:`X/blank`,label:`x/[]`,command:`/`,ariaLabel:`x over blank fraction`}),XJ=qJ({name:`X (blank/blank)`,latex:`x\\frac{}{}`,label:`x([]/[])`,command:`\\frac`,ariaLabel:`mixed number`}),ZJ=s({nthRoot:()=>nY,squareRoot:()=>tY,squared:()=>$J,xToPowerOfN:()=>eY}),QJ=LJ(`exponent`),$J=QJ({name:`Squared`,latex:`x^2`,write:`^2`}),eY=QJ({name:`X to the power of n`,latex:`x^{}`,command:`^`,ariaLabel:`exponent`}),tY=QJ({name:`Square root`,latex:`\\sqrt{}`,command:`\\sqrt`}),nY=QJ({name:`Nth root`,latex:`\\sqrt[{}]{}`,command:`\\nthroot`}),rY=s({absValue:()=>oY,approx:()=>uY,brackets:()=>cY,nApprox:()=>dY,notEqual:()=>fY,notSimilar:()=>mY,parenthesis:()=>sY,percentage:()=>lY,plusMinus:()=>aY,similar:()=>pY}),iY=LJ(`misc`),aY=iY({name:`Plus or Minus`,latex:`\\pm`,write:`\\pm`}),oY=iY({name:`Absolute Value`,latex:`\\abs{}`,symbol:`| |`,command:`|`}),sY=iY({name:`Parenthesis`,latex:`\\left(\\right)`,symbol:`( )`,command:`(`}),cY=iY({name:`Brackets`,latex:`\\left[\\right]`,symbol:`[ ]`,command:`[`}),lY=iY({name:`Percent`,latex:`%`,command:`%`}),uY=iY({latex:`\\approx`,command:`\\approx`,ariaLabel:`Approximately equal to`}),dY=iY({latex:`\\napprox`,command:`\\napprox`,ariaLabel:`Not pproximately equal to`}),fY=iY({latex:`\\neq`,command:`\\neq`,ariaLabel:`Not equals`}),pY=iY({latex:`\\sim`,command:`\\sim`,ariaLabel:`Similar`}),mY=iY({latex:`\\nsim`,command:`\\nsim`,ariaLabel:`Not similar`}),hY=s({eulers:()=>vY,halfInfinity:()=>bY,infinity:()=>yY,pi:()=>_Y}),gY=LJ(`constants`),_Y=gY({name:`Pi`,label:`π`,latex:`\\pi`,command:`\\pi`,category:`constants`}),vY=gY({name:`Eulers`,label:`e`,latex:`e`,command:`e`,category:`constants`}),yY=gY({name:`Infinity`,label:`\\infty`,latex:`\\infty`,command:`\\infty`,category:`constants`}),bY=gY({name:`Half Infinity`,label:`\\propto`,latex:`\\propto`,command:`\\propto`,category:`constants`}),xY=s({cos:()=>wY,cot:()=>OY,csc:()=>DY,sec:()=>EY,sin:()=>CY,tan:()=>TY}),SY=LJ(`trigonometry`),CY=SY({name:`sine`,label:`sin`,command:`\\sin`,latex:`\\sin`}),wY=SY({name:`cosine`,label:`cos`,command:`\\cos`,latex:`\\cos`}),TY=SY({name:`tanget`,label:`tan`,command:`\\tan`,latex:`\\tan`}),EY=SY({name:`secant`,label:`sec`,command:`\\sec`,latex:`\\sec`}),DY=SY({name:`cosecant`,label:`csc`,command:`\\csc`,latex:`\\csc`}),OY=SY({name:`cotangent`,label:`cot`,command:`\\cot`,latex:`\\cot`}),kY=s({angle:()=>RY,circledDot:()=>WY,congruentTo:()=>qY,degree:()=>GY,doublePrimeArcSecond:()=>XY,leftArrow:()=>ZY,leftrightArrow:()=>$Y,measureOfAngle:()=>BY,notCongruentTo:()=>JY,notParallel:()=>IY,overArc:()=>zY,overLeftRightArrow:()=>NY,overRightArrow:()=>MY,overline:()=>jY,parallel:()=>FY,parallelogram:()=>UY,perpindicular:()=>LY,primeArcminute:()=>YY,rightArrow:()=>QY,segment:()=>PY,similarTo:()=>KY,square:()=>HY,triangle:()=>VY}),AY=e=>({...e,category:`geometry`}),jY=AY({name:`Line`,latex:`\\overline{}`,command:`\\overline`}),MY=AY({name:`Ray`,latex:`\\overrightarrow{}`,command:`\\overrightarrow`}),NY=AY({name:`Segment`,latex:`\\overleftrightarrow{\\overline{}}`,symbol:`AB`,command:`\\overleftrightarrow`}),PY=AY({name:`Segment`,latex:`\\overleftrightarrow{AB}`,write:`\\overleftrightarrow{AB}`,label:`AB`}),FY=AY({name:`Parallel`,latex:`\\parallel`,command:`\\parallel`}),IY=AY({name:`Not Parallel`,latex:`\\nparallel`,command:`\\nparallel`}),LY=AY({name:`Perpendicular`,latex:`\\perp`,command:`\\perpendicular`}),RY=AY({name:`Angle`,latex:`\\angle`,command:`\\angle`}),zY=AY({name:`Over arc`,latex:`\\overarc{\\overline{}}`,command:`\\overarc`}),BY=AY({name:`Measured Angle`,latex:`\\measuredangle`,command:[`m`,`\\angle`]}),VY=AY({name:`Triangle`,latex:`\\triangle`,command:`\\triangle`}),HY=AY({name:`Square`,latex:`\\square`,command:`\\square`}),UY=AY({name:`Parallelogram`,latex:`\\parallelogram`,command:`\\parallelogram`}),WY=AY({name:`Circled Dot`,latex:`\\odot`,command:`\\odot`}),GY=AY({name:`Degree`,latex:`\\degree`,command:`\\degree`}),KY=AY({name:`Similar`,command:`\\sim`,latex:`\\sim`}),qY=AY({name:`Congruent To`,command:`\\cong`,latex:`\\cong`}),JY=AY({name:`Not Congruent To`,command:`\\ncong`,latex:`\\ncong`}),YY=AY({name:`Prime`,label:`pam`,latex:`'`,write:`'`}),XY=AY({name:`Double Prime`,latex:`''`,write:`''`}),ZY=AY({name:`Left Arrow`,latex:`\\leftarrow`,command:`\\leftarrow`}),QY=AY({name:`Right Arrow`,latex:`\\rightarrow`,command:`\\rightarrow`}),$Y=AY({name:`Left and Right Arrow`,latex:`\\leftrightarrow`,command:`\\leftrightarrow`}),eX=s({circleDot:()=>tX}),tX=LJ(`operators`)({name:`CircleDot`,label:`⋅`,write:`\\cdot`,ariaLabel:`Dot multiplier`}),nX=s({ln:()=>oX,log:()=>iX,logSubscript:()=>aX}),rX=LJ(`log`),iX=rX({name:`Log`,label:`log`,command:`\\log`,latex:`\\log`}),aX=rX({name:`log base n`,label:`log s`,latex:`\\log_{}`,command:[`\\log`,`_`]}),oX=rX({name:`natural log`,label:`ln`,command:`\\ln`,latex:`\\ln`}),sX=s({subscript:()=>uX,superscript:()=>lX}),cX=LJ(`sub-sup`),lX=cX({name:`Superscript`,latex:`x^{}`,command:`^`}),uX=cX({name:`Subscript`,latex:`x_{}`,command:`_`}),dX=s({mu:()=>hX,sigma:()=>gX,smallSigma:()=>_X,xBar:()=>pX,yBar:()=>mX}),fX=LJ(`statistics`),pX=fX({name:`X Bar`,label:`x̄`,latex:`\\overline{x}`,write:`\\overline{x}`}),mX=fX({name:`Y Bar`,latex:`\\overline{y}`,write:`\\overline{y}`}),hX=fX({name:`mu`,label:`mu`,latex:`\\mu`,write:`\\mu`}),gX=fX({name:`Sigma`,ariaLabel:`Uppercase Sigma`,label:`\\Sigma`,latex:`\\Sigma`,write:`\\Sigma`}),_X=fX({name:`sigma`,ariaLabel:`Lowercase Sigma`,label:`\\sigma`,latex:`\\sigma`,write:`\\sigma`}),vX=s({divide:()=>CX,equals:()=>bX,minus:()=>SX,multiply:()=>wX,plus:()=>xX}),yX=LJ(`operators`),bX=yX({write:`=`,label:`=`}),xX=yX({write:`+`,label:`+`}),SX=yX({write:`−`,label:`−`}),CX=yX({name:`divide`,label:`÷`,command:`\\divide`,otherNotation:`\\div`}),wX=yX({name:`multiply`,label:`×`,command:`\\times`}),TX=s({doubleCellMatrix:()=>OX,singleCellMatrix:()=>DX}),EX=LJ(`matrices`),DX=EX({name:`Single Cell Matrix`,label:`[ ]`,write:`\\begin{pmatrix}\\end{pmatrix}`}),OX=EX({name:`Double Cell Matrix`,label:`[ ] [ ] \\\\newline [ ] [ ]`,write:`\\begin{bmatrix}&\\\\&\\end{bmatrix}`}),kX={0:`zero`,1:`one`,2:`two`,3:`three`,4:`four`,5:`five`,6:`six`,7:`seven`,8:`eight`,9:`nine`},AX=de(10,String).map(e=>({name:kX[e],write:e,label:e,category:`digit`})).reduce((e,t)=>(e[t.name]=t,e),{comma:{name:`comma`,label:`,`,write:`,`,category:`digit`},decimalPoint:{name:`decimal-point`,label:`.`,write:`.`,category:`digit`}}),jX=LJ(`logic`),MX=jX({name:`Therefore`,label:`∴`,write:`∴`}),NX=jX({name:`Long division`,latex:`\\longdiv{}`,command:`\\longdiv`}),PX=LJ(`navigation`),FX=PX({label:`◀`,keystroke:`Left`,ariaLabel:`Move cursor left`}),IX=PX({label:`▶`,keystroke:`Right`,ariaLabel:`Move cursor right`}),LX={label:`⌫`,category:`edit`,keystroke:`Backspace`,ariaLabel:`Delete`},RX=[[JJ,lY,UJ,$J,tY],[tX,WJ,uX,eY,nY],[aY,NJ,PJ,FJ,IJ],[_Y,GJ,sY,cY,oY],[fY,CY,wY,TY,GY]],zX=(()=>{let e=[...RX.map(e=>[...e])];return e[0].push({name:`i`,latex:`i`,write:`i`}),e[1].push(iX),e[2].push(aX),e[3].push(oX),e[4].push(vY),e})(),BX=(()=>{let e=[...RX.map(e=>[...e])];return e[0].push(hX),e[1].push(pX),e[2].push(mX),e[3].push(gX),e[4].push(_X),e})(),VX=[{predicate:e=>e>=3&&e<=5,set:[[NJ,PJ],[YJ,XJ],[UJ,NX],[$J,eY]]},{predicate:e=>e>=6&&e<=7,set:[[GY,NJ,PJ],[tX,FJ,IJ],[UJ,WJ,$J,eY],[aY,YJ,XJ,tY],[_Y,sY,oY,nY]]},{predicate:e=>e>=8||e===`HS`,set:RX},{predicate:`non-negative-integers`,set:[[AX.seven,AX.eight,AX.nine],[AX.four,AX.five,AX.six],[AX.one,AX.two,AX.three],[AX.zero,{name:``,latex:``,write:``},{name:``,latex:``,write:``}],[FX,IX,LX]]},{predicate:`integers`,set:[[AX.seven,AX.eight,AX.nine],[AX.four,AX.five,AX.six],[AX.one,AX.two,AX.three],[AX.zero,{name:``,latex:``,write:``},SX],[FX,IX,LX]]},{predicate:`decimals`,set:[[AX.seven,AX.eight,AX.nine],[AX.four,AX.five,AX.six],[AX.one,AX.two,AX.three],[AX.zero,AX.decimalPoint,SX],[FX,IX,LX]]},{predicate:`fractions`,set:[[AX.seven,AX.eight,AX.nine],[AX.four,AX.five,AX.six],[AX.one,AX.two,AX.three],[AX.zero,JJ,SX],[FX,IX,LX]]},{predicate:`geometry`,set:[[JJ,GY,YY,XY,qY,KY],[tX,RY,BY,VY,JY,mY],[CY,wY,TY,_Y,tY,nY],[DY,EY,OY,GJ,uX,eY],[jY,MY,NY,zY,LY,FY]]},{predicate:`advanced-algebra`,set:zX},{predicate:`statistics`,set:BX},{predicate:`item-authoring`,set:[[CX,JJ,NX,bY,$J,tY,jY,MY,NY,iX],[wX,tX,{name:``,latex:``,write:``},uX,eY,nY,LY,FY,zY,aX],[aY,_Y,GJ,GY,RY,ZY,QY,VY,HY,oX],[fY,oY,_X,hX,MX,gX,$Y,CY,wY,TY],[FJ,IJ,{name:``,latex:``,write:``},{name:``,latex:``,write:``},yY,{name:``,latex:``,write:``},{name:``,latex:``,write:``},DY,EY,OY]]},{predicate:e=>e>=1&&e<=2,set:[]}],HX=e=>{let t=parseInt(e,10);if(e=isNaN(t)?e:t,!e)return[];let n=VX.find(t=>typeof t.predicate==`string`?t.predicate===e:t.predicate(e));if(n)return n.set||[];if(e!==`language`)return VX[2].set},UX=[...Object.values(vX),...Object.values(jJ),...Object.values(hY),...Object.values(AX),...Object.values(ZJ),...Object.values(KJ),...Object.values(kY),...Object.values(nX),...Object.values(TX),...Object.values(rY),...Object.values(eX),...Object.values(dX),...Object.values(sX),...Object.values(xY),...Object.values(VJ)],WX=e=>(e||[]).map(e=>{let{latex:t}=e,n=(UX||[]).find(e=>t===e.latex||t===e.write||t===e.command||t===e.otherNotation);return t&&n||e}),GX=()=>{(Array.from(document.querySelectorAll(`span[mathquill-command-id]`))||[]).forEach(e=>{e&&e.innerText===`∥`&&e.className!==`mq-editable-field`&&(e.style.fontSize=`32px`),(e.innerText===`′`||e.innerText===`′′`)&&!e.hasAttribute(`data-prime`)&&e.setAttribute(`data-prime`,`true`)})},{one:KX,two:qX,three:JX,four:YX,five:XX,six:ZX,seven:QX,eight:$X,nine:eZ,zero:tZ,comma:nZ,decimalPoint:rZ}=AX,iZ=[[QX,$X,eZ,CX],[YX,XX,ZX,wX],[KX,qX,JX,SX],[tZ,rZ,nZ,xX],[FX,IX,LX,bX]];function K(e){this.elements=Array.isArray(e)?e:[e].filter(Boolean),this.length=this.elements.length;for(var t=0;t<this.elements.length;t++)this[t]=this.elements[t]}K.prototype.addClass=function(e){var t=(e||``).split(/\s+/).filter(Boolean);return this.elements.forEach(function(e){t.forEach(function(t){e.classList.add(t)})}),this},K.prototype.removeClass=function(e){return this.elements.forEach(function(t){e?(e||``).split(/\s+/).filter(Boolean).forEach(function(e){t.classList.remove(e)}):t.className=``}),this},K.prototype.toggleClass=function(e,t){var n=(e||``).split(/\s+/).filter(Boolean),r=arguments.length>1?!!t:null;return this.elements.forEach(function(e){n.forEach(function(t){r===null?e.classList.toggle(t):e.classList.toggle(t,r)})}),this},K.prototype.attr=function(e,t){return t===lZ?this.elements[0]?this.elements[0].getAttribute(e):lZ:(this.elements.forEach(function(n){n.setAttribute(e,t)}),this)},K.prototype.html=function(e){return e===lZ?this.elements[0]?this.elements[0].innerHTML:``:(this.elements.forEach(function(t){t.innerHTML=e}),this)},K.prototype.append=function(e){var t=e instanceof K?e.elements[0]:e;return this.elements.forEach(function(e){e.appendChild(t)}),this},K.prototype.prepend=function(e){var t=e instanceof K?e.elements[0]:e;return this.elements.forEach(function(e,n){var r=n===0?t:t.cloneNode(!0);e.insertBefore(r,e.firstChild)}),this},K.prototype.wrapAll=function(e){if(!this.elements.length)return this;var t;if(typeof e==`string`&&e.trim().indexOf(`<`)===0){var n=document.createElement(`div`);n.innerHTML=e.trim(),t=n.firstChild}else if(e instanceof K)t=e.elements[0];else if(e&&e.nodeType)t=e;else return this;var r=this.elements[0],i=r.parentNode;return i&&(i.insertBefore(t,r),this.elements.forEach(function(e){t.appendChild(e)})),this},K.prototype.appendTo=function(e){var t=e instanceof K?e.elements[0]:e;return t&&this.elements.forEach(function(e){t.appendChild(e)}),this},K.prototype.prependTo=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.firstChild;return this.elements.forEach(function(e){t.insertBefore(e,n),n=e}),this},K.prototype.insertBefore=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.parentNode;return n&&this.elements.forEach(function(e){n.insertBefore(e,t)}),this},K.prototype.insertAfter=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.parentNode,r=t.nextSibling;return n&&this.elements.forEach(function(e){n.insertBefore(e,r),r=e}),this},K.prototype.replaceWith=function(e){var t=[];return e instanceof K?t=e.elements.slice():e&&typeof e.length==`number`&&!e.tagName?t=Array.from(e):e&&e.nodeType&&(t=[e]),this.elements.forEach(function(e){var n=e.parentNode;n&&(t.forEach(function(t){n.insertBefore(t,e)}),n.removeChild(e))}),this},K.prototype.insDirOf=function(e,t){return e===-1?this.insertBefore(t.first()):this.insertAfter(t.last())},K.prototype.insAtDirEnd=function(e,t){return e===-1?this.prependTo(t):this.appendTo(t)},K.prototype.children=function(e){var t=[];return this.elements.forEach(function(n){var r;if(!e)r=Array.from(n.children);else if(e===`:first`)r=n.firstElementChild?[n.firstElementChild]:[];else if(e===`:last`)r=n.lastElementChild?[n.lastElementChild]:[];else{var i=/^:eq\((\d+)\)$/.exec(e);if(i){var a=parseInt(i[1],10),o=Array.from(n.children);r=o[a]?[o[a]]:[]}else r=Array.from(n.querySelectorAll(`:scope > `+e))}t.push.apply(t,r)}),new K(t)},K.prototype.find=function(e){var t=[];return this.elements.forEach(function(n){var r=Array.from(n.querySelectorAll(e));t.push.apply(t,r)}),new K(t)},K.prototype.closest=function(e){return new K(this.elements.map(function(t){return t.closest(e)}).filter(Boolean))},K.prototype.contents=function(){var e=[];return this.elements.forEach(function(t){var n=Array.from(t.childNodes);e.push.apply(e,n)}),new K(e)},K.prototype.filter=function(e){return new K(this.elements.filter(function(t,n){return e(n,t)}))},K.prototype.detach=function(){return this.elements.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)}),this},K.prototype.remove=function(){return this.elements.forEach(function(e){e.remove()}),this},K.prototype.empty=function(){return this.elements.forEach(function(e){e.innerHTML=``}),this};function aZ(e){return(e||``).split(`.`)[0]}K.prototype.on=function(e,t){var n=aZ(e);return this.elements.forEach(function(e){e.addEventListener(n,t)}),this},K.prototype.bind=function(e,t,n){var r=this;if(typeof e==`object`){for(var i in e)e.hasOwnProperty(i)&&r.bind(i,e[i]);return this}var a=typeof t==`function`?t:n;return a===!1&&(a=function(e){e.preventDefault()}),(e||``).split(/\s+/).filter(Boolean).forEach(function(e){var t=aZ(e);r.elements.forEach(function(e){e.addEventListener(t,a)})}),this},K.prototype.off=function(e,t){var n=aZ(e);return this.elements.forEach(function(e){e.removeEventListener(n,t)}),this},K.prototype.unbind=function(e,t){if(e&&e.includes(`.`))this.elements.forEach(function(e){var t=e.cloneNode(!0);e.parentNode&&e.parentNode.replaceChild(t,e)});else if(e&&t){var n=aZ(e);this.elements.forEach(function(e){e.removeEventListener(n,t)})}return this},K.prototype.trigger=function(e){var t=new Event(aZ(e),{bubbles:!0,cancelable:!0});return this.elements.forEach(function(e){e.dispatchEvent(t)}),this},K.prototype.focus=function(e){return typeof e==`function`?this.on(`focus`,e):(this.elements.forEach(function(e){e.focus&&e.focus()}),this)},K.prototype.blur=function(e){return typeof e==`function`?this.on(`blur`,e):(this.elements.forEach(function(e){e.blur&&e.blur()}),this)},[`mousemove`,`mouseup`,`mousedown`,`mouseover`,`mouseout`,`click`,`keydown`,`keypress`,`keyup`,`focusout`,`paste`,`cut`,`copy`,`input`,`load`].forEach(function(e){K.prototype[e]=function(t){return this.on(e,t)}}),K.prototype.next=function(e){return new K(this.elements.map(function(e){return e.nextElementSibling}).filter(function(t){return!e||t&&t.matches(e)}))},K.prototype.prev=function(e){return new K(this.elements.map(function(e){return e.previousElementSibling}).filter(function(t){return!e||t&&t.matches(e)}))},K.prototype.parent=function(){return new K(this.elements.map(function(e){return e.parentElement}).filter(Boolean))},K.prototype.offset=function(){if(!this.elements[0])return{top:0,left:0};var e=this.elements[0].getBoundingClientRect();return{top:e.top+(window.pageYOffset||document.documentElement.scrollTop),left:e.left+(window.pageXOffset||document.documentElement.scrollLeft)}},K.prototype.width=function(){var e=this.elements[0];if(!e)return 0;var t=window.getComputedStyle(e);return parseFloat(t.width)||e.getBoundingClientRect().width},K.prototype.height=function(){var e=this.elements[0];if(!e)return 0;var t=window.getComputedStyle(e);return parseFloat(t.height)||e.getBoundingClientRect().height},K.prototype.outerWidth=function(){return this.elements[0]?this.elements[0].offsetWidth:0},K.prototype.outerHeight=function(){return this.elements[0]?this.elements[0].offsetHeight:0},K.prototype.innerWidth=function(){return this.elements[0]?this.elements[0].clientWidth:0},K.prototype.innerHeight=function(){return this.elements[0]?this.elements[0].clientHeight:0},K.prototype.css=function(e,t){if(t===lZ){if(typeof e==`string`){var n=this.elements[0];return n?window.getComputedStyle(n).getPropertyValue(e.replace(/([A-Z])/g,`-$1`).toLowerCase()):lZ}}else this.elements.forEach(function(n){n.style[e]=t});return this},K.prototype.scrollTop=function(e){var t=this.elements[0];return e===lZ?t?t===window?window.pageYOffset||document.documentElement.scrollTop:t.scrollTop:0:(t===window?window.scrollTo(window.pageXOffset||0,e):this.elements.forEach(function(t){t.scrollTop=e}),this)},K.prototype.scrollLeft=function(e){var t=this.elements[0];return e===lZ?t?t===window?window.pageXOffset||document.documentElement.scrollLeft:t.scrollLeft:0:(t===window?window.scrollTo(e,window.pageYOffset||0):this.elements.forEach(function(t){t.scrollLeft=e}),this)},K.prototype.each=function(e){return this.elements.forEach(function(t,n){e.call(t,n,t)}),this},K.prototype.eq=function(e){return new K([this.elements[e]])},K.prototype.get=function(e){return e===lZ?this.elements:e<0?this.elements[this.elements.length+e]:this.elements[e]},K.prototype.add=function(e){var t=this.elements.slice();return e instanceof K?t.push.apply(t,e.elements):Array.isArray(e)?t.push.apply(t,e):e&&e.nodeType&&t.push(e),new K(t)},K.prototype.first=function(){return new K([this.elements[0]])},K.prototype.last=function(){return new K([this.elements[this.elements.length-1]])},K.prototype.index=function(e){if(!e){var t=this.elements[0]&&this.elements[0].parentElement;return t?Array.from(t.children).indexOf(this.elements[0]):-1}var n=e instanceof K?e.elements[0]:e;return this.elements.indexOf(n)},K.prototype.is=function(e){return this.elements.some(function(t){return t.matches(e)})},K.prototype.text=function(e){return e===lZ?this.elements.map(function(e){return e.textContent}).join(``):(this.elements.forEach(function(t){t.textContent=e}),this)},K.prototype.val=function(e){var t=this.elements[0];return t?e===lZ?t.value===lZ?t.textContent:t.value:(this.elements.forEach(function(t){t.value===lZ?t.textContent=e:t.value=e}),this):lZ};function oZ(e){var t=Array.isArray(e)?e:[e].filter(Boolean),n=Object.create(K.prototype);n.elements=t,n.length=t.length;for(var r=0;r<t.length;r++)n[r]=t[r];return n}var sZ=function(e,t){var n;if(!e)n=[];else if(e===window||e===document)n=[e];else if(e.nodeType)n=[e];else if(e&&e.current&&e.current.nodeType)n=[e.current];else if(typeof e==`string`&&e[0]===`<`){var r=document.createElement(`div`);r.innerHTML=e.trim(),n=Array.from(r.children)}else if(typeof e==`string`){var i=t instanceof K?t.elements[0]:t||document;n=Array.from(i.querySelectorAll(e))}else n=e instanceof K?e.elements:e.length===lZ?[]:Array.from(e);return oZ(n)};sZ.contains=function(e,t){return e!==t&&e.contains(t)};var cZ=sZ,lZ,uZ=`mathquill-command-id`,dZ=`mathquill-block-id`,fZ=Math.min,pZ=Math.max;function mZ(){}var hZ=[].slice;function gZ(e){var t=e.length-1;return function(){var n=hZ.call(arguments,0,t),r=hZ.call(arguments,t);return e.apply(this,n.concat([r]))}}var _Z=gZ(function(e,t){return gZ(function(n,r){if(e in n)return n[e].apply(n,t.concat(r))})});function vZ(e){return gZ(function(t,n){return typeof t!=`function`&&(t=_Z(t)),e.call(this,function(e){return t.apply(e,[e].concat(n))})})}function q(e){var t=hZ.call(arguments,1);return function(){return e.apply(this,t)}}function yZ(e,t){if(!t)throw Error(`prayer failed: `+e)}var J=(function(e,t,n){function r(e){return typeof e==`object`}function i(e){return typeof e==`function`}function a(){}return function o(s,c){c===n&&(c=s,s=Object);function l(){var e=new u;return i(e.init)&&e.init.apply(e,arguments),e}function u(){}l.Bare=u;var d=a[e]=s[e],f=u[e]=l[e]=l.p=new a,p;return f.constructor=l,l.extend=function(e){return o(l,e)},(l.open=function(e){if(p={},i(e)?p=e.call(l,f,d,l,s):r(e)&&(p=e),r(p))for(var n in p)t.call(p,n)&&(f[n]=p[n]);return i(f.init)||(f.init=s),l})(c)}})(`prototype`,{}.hasOwnProperty),Y=-1,X=1;function bZ(e){yZ(`a direction was passed`,e===Y||e===X)}var xZ=J(function(e){e.parent=0,e[Y]=0,e[X]=0,e.init=function(e,t,n){this.parent=e,this[Y]=t,this[X]=n},this.copy=function(e){return xZ(e.parent,e[Y],e[X])}}),SZ=J(function(e){e[Y]=0,e[X]=0,e.parent=0;var t=0;function n(){return t+=1}this.byId={},e.init=function(){this.id=n(),SZ.byId[this.id]=this,this.ends={},this.ends[Y]=0,this.ends[X]=0},e.dispose=function(){delete SZ.byId[this.id]},e.toString=function(){return`{{ MathQuill Node #`+this.id+` }}`},e.jQ=sZ(),e.jQadd=function(e){return this.jQ=this.jQ.add(e)},e.jQize=function(e){var e=sZ(e||this.html());function t(e){if(e.getAttribute){var n=e.getAttribute(`mathquill-command-id`),r=e.getAttribute(`mathquill-block-id`);n&&SZ.byId[n].jQadd(e),r&&SZ.byId[r].jQadd(e)}for(e=e.firstChild;e;e=e.nextSibling)t(e)}for(var n=0;n<e.length;n+=1)t(e[n]);return e},e.createDir=function(e,t){bZ(e);var n=this;return n.jQize(),n.jQ.insDirOf(e,t.jQ),t[e]=n.adopt(t.parent,t[Y],t[X]),n},e.createLeftOf=function(e){return this.createDir(Y,e)},e.selectChildren=function(e,t){return OZ(e,t)},e.bubble=vZ(function(e){for(var t=this;t&&e(t)!==!1;t=t.parent);return this}),e.postOrder=vZ(function(e){return(function t(n){n.eachChild(t),e(n)})(this),this}),e.isEmpty=function(){return this.ends[Y]===0&&this.ends[X]===0},e.isStyleBlock=function(){return!1},e.children=function(){return wZ(this.ends[Y],this.ends[X])},e.eachChild=function(){var e=this.children();return e.each.apply(e,arguments),this},e.foldChildren=function(e,t){return this.children().fold(e,t)},e.withDirAdopt=function(e,t,n,r){return wZ(this,this).withDirAdopt(e,t,n,r),this},e.adopt=function(e,t,n){return wZ(this,this).adopt(e,t,n),this},e.disown=function(){return wZ(this,this).disown(),this},e.remove=function(){return this.jQ.remove(),this.postOrder(`dispose`),this.disown()}});function CZ(e,t,n){yZ(`a parent is always present`,e),t&&(t[X]!==n&&(t[X]=n),t.parent!==e&&(t.parent=e)),n&&(n[Y]!==t&&(n[Y]=t),n.parent!==e&&(n.parent=e)),yZ(`leftward is properly set up`,(function(){return t?t[X]===n&&t.parent===e:e.ends[Y]===n})()),yZ(`rightward is properly set up`,(function(){return n?n[Y]===t&&n.parent===e:e.ends[X]===t})())}var wZ=J(function(e){e.init=function(e,t,n){if(n===lZ&&(n=Y),bZ(n),yZ(`no half-empty fragments`,!e==!t),this.ends={},e){yZ(`withDir is passed to Fragment`,e instanceof SZ),yZ(`oppDir is passed to Fragment`,t instanceof SZ),yZ(`withDir and oppDir have the same parent`,e.parent===t.parent),this.ends[n]=e,this.ends[-n]=t;var r=this.fold([],function(e,t){return e.push.apply(e,t.jQ.get()),e});this.jQ=this.jQ.add(r)}},e.jQ=sZ(),e.withDirAdopt=function(e,t,n,r){return e===Y?this.adopt(t,n,r):this.adopt(t,r,n)},e.adopt=function(e,t,n){CZ(e,t,n);var r=this;r.disowned=!1;var i=r.ends[Y];if(!i)return this;var a=r.ends[X];return t||(e.ends[Y]=i),n?n[Y]=a:e.ends[X]=a,r.ends[X][X]=n,r.each(function(n){n[Y]=t,n.parent=e,t&&(t[X]=n),t=n}),r},e.disown=function(){var e=this,t=e.ends[Y];if(!t||e.disowned)return e;e.disowned=!0;var n=e.ends[X],r=t.parent;return CZ(r,t[Y],t),CZ(r,n,n[X]),t[Y]?t[Y][X]=n[X]:r.ends[Y]=n[X],n[X]?n[X][Y]=t[Y]:r.ends[X]=t[Y],e},e.remove=function(){return this.jQ.remove(),this.each(`postOrder`,`dispose`),this.disown()},e.each=vZ(function(e){var t=this,n=t.ends[Y];if(!n)return t;for(;n!==t.ends[X][X]&&e(n)!==!1;n=n[X]);return t}),e.fold=function(e,t){return this.each(function(n){e=t.call(this,e,n)}),e}}),Z={},TZ={},EZ={},DZ=J(xZ,function(e){e.init=function(e,t){this.parent=e,this.options=t;var n=this.jQ=this._jQ=sZ(`<span class="mq-cursor">​</span>`);this.blink=function(){n.toggleClass(`mq-blink`)},this.upDownCache={}},e.show=function(){return this.jQ=this._jQ.removeClass(`mq-blink`),`intervalId`in this?clearInterval(this.intervalId):(this[X]?this.selection&&this.selection.ends[Y][Y]===this[Y]?this.jQ.insertBefore(this.selection.jQ):this.jQ.insertBefore(this[X].jQ.first()):this.jQ.appendTo(this.parent.jQ),this.parent.focus()),this.intervalId=setInterval(this.blink,500),this},e.hide=function(){return`intervalId`in this&&clearInterval(this.intervalId),delete this.intervalId,this.jQ.detach(),this.jQ=sZ(),this},e.withDirInsertAt=function(e,t,n,r){var i=this.parent;this.parent=t,this[e]=n,this[-e]=r,i!==t&&i.blur&&i.blur(this)},e.insDirOf=function(e,t){return bZ(e),!t||!t.jQ?this:(this.jQ.insDirOf(e,t.jQ),this.withDirInsertAt(e,t.parent,t[e],t),this.parent.jQ.addClass(`mq-hasCursor`),this)},e.insLeftOf=function(e){return this.insDirOf(Y,e)},e.insRightOf=function(e){return this.insDirOf(X,e)},e.insAtDirEnd=function(e,t){return bZ(e),this.jQ.insAtDirEnd(e,t.jQ),this.withDirInsertAt(e,t,0,t.ends[e]),t.focus(),this},e.insAtLeftEnd=function(e){return this.insAtDirEnd(Y,e)},e.insAtRightEnd=function(e){return this.insAtDirEnd(X,e)},e.jumpUpDown=function(e,t){var n=this;n.upDownCache[e.id]=xZ.copy(n);var r=n.upDownCache[t.id];if(r)r[X]?n.insLeftOf(r[X]):n.insAtRightEnd(r.parent);else{var i=n.offset().left;t.seek(i,n)}},e.offset=function(){var e=this,t=e.jQ.removeClass(`mq-cursor`).offset();return e.jQ.addClass(`mq-cursor`),t},e.unwrapGramp=function(){var e=this.parent.parent,t=e.parent,n=e[X],r=this,i=e[Y];if(e.disown().eachChild(function(r){r.isEmpty()||(r.children().adopt(t,i,n).each(function(t){t.jQ.insertBefore(e.jQ.first())}),i=r.ends[X])}),!this[X])if(this[Y])this[X]=this[Y][X];else for(;!this[X];)if(this.parent=this.parent[X],this.parent)this[X]=this.parent.ends[Y];else{this[X]=e[X],this.parent=t;break}this[X]?this.insLeftOf(this[X]):this.insAtRightEnd(t),e.jQ.remove(),e[Y].siblingDeleted&&e[Y].siblingDeleted(r.options,X),e[X].siblingDeleted&&e[X].siblingDeleted(r.options,Y)},e.startSelection=function(){for(var e=this.anticursor=xZ.copy(this),t=e.ancestors={},n=e;n.parent;n=n.parent)t[n.parent.id]=n},e.endSelection=function(){delete this.anticursor},e.select=function(){var e=this.anticursor;if(!e||!e.ancestors||this[Y]===e[Y]&&this.parent===e.parent)return!1;for(var t,n=this;n.parent;n=n.parent)if(n.parent.id in e.ancestors){t=n.parent;break}if(!t)return!1;var r=e.ancestors[t.id],i,a,o=X;if(n[Y]!==r){for(var s=n;s;s=s[X])if(s[X]===r[X]){o=Y,i=n,a=r;break}}return o===X&&(i=r,a=n),i instanceof xZ&&(i=i[X]),a instanceof xZ&&(a=a[Y]),!i||!a?!1:(this.hide().selection=t.selectChildren(i,a),this.insDirOf(o,this.selection.ends[o]),this.selectionChanged(),!0)},e.clearSelection=function(){return this.selection&&(this.selection.clear(),delete this.selection,this.selectionChanged()),this},e.deleteSelection=function(){this.selection&&(this[Y]=this.selection.ends[Y][Y],this[X]=this.selection.ends[X][X],this.selection.remove(),this.selectionChanged(),delete this.selection)},e.replaceSelection=function(){var e=this.selection;return e&&(this[Y]=e.ends[Y][Y],this[X]=e.ends[X][X],delete this.selection),e},e.depth=function(){for(var e=this,t=0;e=e.parent;)t+=+(e instanceof YZ);return t},e.isTooDeep=function(e){if(this.options.maxDepth!==lZ)return this.depth()+(e||0)>this.options.maxDepth},e.howDeep=function(){for(var e=0,t=this;t=t.parent;)e++;return 1+Math.floor(e/2)},e.tooDeep=function(){var e=this.options.maxDepth;return e&&this.howDeep()>e}}),OZ=J(wZ,function(e,t){e.init=function(){t.init.apply(this,arguments),this.jQ=this.jQ.wrapAll(`<span class="mq-selection"></span>`).parent()},e.adopt=function(){return this.jQ.replaceWith(this.jQ=this.jQ.children()),t.adopt.apply(this,arguments)},e.clear=function(){var e=this.jQ[0];return e&&this.jQ.replaceWith(e.childNodes),this},e.join=function(e){return this.fold(``,function(t,n){return t+n[e]()})}}),kZ=J(function(e){e.init=function(e,t,n){this.id=e.id,this.data={},this.root=e,this.container=t,this.options=n,e.controller=this,this.cursor=e.cursor=DZ(e,n)},e.handle=function(e,t){var n=this.options.handlers;if(n&&n.fns[e]){var r=n.APIClasses[this.KIND_OF_MQ](this);t===Y||t===X?n.fns[e](t,r):n.fns[e](r)}};var t=[];this.onNotify=function(e){t.push(e)},e.notify=function(){for(var e=0;e<t.length;e+=1)t[e].apply(this.cursor,arguments);return this}}),AZ={},jZ=J(),MZ={},NZ=J(),PZ={};function FZ(){window.console&&console.warn(`You are using the MathQuill API without specifying an interface version, which will fail in v1.0.0. Easiest fix is to do the following before doing anything else:
|
|
320
320
|
|
|
321
321
|
MathQuill = MathQuill.getInterface(1);
|
|
322
322
|
// now MathQuill.MathField() works like it used to
|
|
323
323
|
|
|
324
324
|
See also the "\`dev\` branch (2014–2015) → v0.10.0 Migration Guide" at
|
|
325
|
-
https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide`)}function
|
|
325
|
+
https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide`)}function IZ(e){return FZ(),KQ(e)}IZ.prototype=NZ.p,IZ.VERSION=`v1.2.1-beta.1`,IZ.interfaceVersion=function(e){if(e!==1)throw`Only interface version 1 supported. You specified: `+e;return FZ=function(){window.console&&console.warn(`You called MathQuill.interfaceVersion(1); to specify the interface version, which will fail in v1.0.0. You can fix this easily by doing this before doing anything else:
|
|
326
326
|
|
|
327
327
|
MathQuill = MathQuill.getInterface(1);
|
|
328
328
|
// now MathQuill.MathField() works like it used to
|
|
329
329
|
|
|
330
330
|
See also the "\`dev\` branch (2014–2015) → v0.10.0 Migration Guide" at
|
|
331
|
-
https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide`)},DZ(),OZ},OZ.getInterface=jZ;var kZ=jZ.MIN=1,AZ=jZ.MAX=3;function jZ(e){if(!(kZ<=e&&e<=AZ))throw`Only interface versions between `+kZ+` and `+AZ+` supported. You specified: `+e;if(e<3&&typeof window<`u`&&!window.jQuery)throw`MathQuill interface version `+e+` requires jQuery 1.5.2+ to be loaded first`;function t(e){if(!e||!e.nodeType)return null;var t=$X(e).children(`.mq-root-block`).attr(rZ),r=t&&mZ.byId[t].controller;return r?n[r.KIND_OF_MQ](r):null}var n={};t.L=Y,t.R=X,t.saneKeyboardEvents=FZ;function r(e,t){for(var r in t&&t.handlers&&(t.handlers={fns:t.handlers,APIClasses:n}),t)if(t.hasOwnProperty(r)){var i=t[r],a=wZ[r];e[r]=a?a(i):i}}t.config=function(e){return r(CZ.p,e),this},t.registerEmbed=function(e,t){if(!/^[a-z][a-z0-9]*$/i.test(e))throw`Embed name must start with letter and be only letters and digits`;EZ[e]=t};var i=n.AbstractMathQuill=J(TZ,function(t){t.init=function(e){this.__controller=e,this.__options=e.options,this.id=e.id,this.data=e.data},t.parseLatex=function(e){return this.__controller.parseLatex(e)},t.__mathquillify=function(t){var n=this.__controller,r=n.root,i=n.container;n.createTextarea();var a=i.addClass(t).contents().detach();r.jQ=$X(`<span class="mq-root-block"/>`).attr(rZ,r.id).appendTo(i),this.latex(a.text()),this.revert=function(){var t=i.empty().unbind(`.mathquill`).removeClass(`mq-editable-field mq-math-mode mq-text-mode`).append(a);return e>=3?t[0]:t}},t.config=function(e){return r(this.__options,e),this},t.el=function(){return this.__controller.container[0]},t.text=function(){return this.__controller.exportText()},t.latex=function(e){return arguments.length>0?(this.__controller.renderLatexMath(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()},t.html=function(){return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id="?\d+"?/g,``).replace(/<span class="?mq-cursor( mq-blink)?"?>.?<\/span>/i,``).replace(/ mq-hasCursor|mq-hasCursor ?/,``).replace(/ class=(""|(?= |>))/g,``)},t.reflow=function(){return this.__controller.root.postOrder(`reflow`),this}});for(var a in t.prototype=i.prototype,n.EditableField=J(i,function(e,t){e.__mathquillify=function(){return t.__mathquillify.apply(this,arguments),this.__controller.editable=!0,this.__controller.delegateMouseEvents(),this.__controller.editablesTextareaEvents(),this},e.focus=function(){return this.__controller.textarea.focus(),this},e.blur=function(){return this.__controller.textarea.blur(),this},e.write=function(e){return this.__controller.writeLatex(e),this.__controller.scrollHoriz(),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},e.empty=function(){var e=this.__controller.root,t=this.__controller.cursor;return e.eachChild(`postOrder`,`dispose`),e.ends[Y]=e.ends[X]=0,e.jQ.empty(),delete t.selection,t.insAtRightEnd(e),this},e.cmd=function(e){var t=this.__controller.notify(),n=t.cursor;if(/^\\[a-z]+$/i.test(e)&&!n.isTooDeep()){e=e.slice(1);var r=Z[e];r&&(e=r(e),n.selection&&e.replaces(n.replaceSelection()),e.createLeftOf(n.show()),this.__controller.scrollHoriz())}else n.parent.write(n,e);return t.blurred&&n.hide().parent.blur(),this},e.select=function(){var e=this.__controller;for(e.notify(`move`).cursor.insAtRightEnd(e.root);e.cursor[Y];)e.selectLeft();return this},e.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},e.moveToDirEnd=function(e){return this.__controller.notify(`move`).cursor.insAtDirEnd(e,this.__controller.root),this},e.moveToLeftEnd=function(){return this.moveToDirEnd(Y)},e.moveToRightEnd=function(){return this.moveToDirEnd(X)},e.keystroke=function(e){for(var e=e.replace(/^\s+|\s+$/g,``).split(/\s+/),t=0;t<e.length;t+=1)this.__controller.keystroke(e[t],{preventDefault:oZ});return this},e.typedText=function(e){for(var t=0;t<e.length;t+=1)this.__controller.typedText(e.charAt(t));return this},e.dropEmbedded=function(e,t,n){var r=e-$X(window).scrollLeft(),i=t-$X(window).scrollTop(),a=document.elementFromPoint(r,i);this.__controller.seek($X(a),e,t),IQ().setOptions(n).createLeftOf(this.__controller.cursor)},e.clickAt=function(e,t,n){n||=document.elementFromPoint(e,t);var r=this.__controller,i=r.root;return eZ.contains(i.jQ[0],n)||(n=i.jQ[0]),r.seek($X(n),e+pageXOffset,t+pageYOffset),r.blurred&&this.focus(),this},e.ignoreNextMousedown=function(e){return this.__controller.cursor.options.ignoreNextMousedown=e,this}}),t.EditableField=function(){throw`wtf don't call me, I'm 'abstract'`},t.EditableField.prototype=n.EditableField.prototype,SZ)(function(r,i){var a=n[r]=i(n);t[r]=function(n,i){var o=t(n);if(o instanceof a||!n||!n.nodeType)return o;var s=xZ(a.RootBlock(),$X(n),CZ());return s.KIND_OF_MQ=r,a(s).__mathquillify(i,e)},t[r].prototype=a.prototype})(a,SZ[a]);return t}OZ.noConflict=function(){return window.MathQuill=MZ,OZ};var MZ=window.MathQuill;window.MathQuill=OZ;function NZ(e){for(var t=`moveOutOf deleteOutOf selectOutOf upOutOf downOutOf`.split(` `),n=0;n<t.length;n+=1)(function(t){e[t]=function(e){this.controller.handle(t,e)}})(t[n]);e.reflow=function(){this.controller.handle(`reflow`),this.controller.handle(`edited`),this.controller.handle(`edit`)}}var PZ=J(function(e,t,n){function r(e,t){throw e=e?`'`+e+`'`:`EOF`,`Parse Error: `+t+` at `+e}e.init=function(e){this._=e},e.parse=function(e){return this.skip(o)._(``+e,t,r);function t(e,t){return t}},e.or=function(e){dZ(`or is passed a parser`,e instanceof n);var t=this;return n(function(n,r,i){return t._(n,r,a);function a(t){return e._(n,r,i)}})},e.then=function(e){var t=this;return n(function(r,i,a){return t._(r,o,a);function o(t,r){var o=e instanceof n?e:e(r);return dZ(`a parser is returned`,o instanceof n),o._(t,i,a)}})},e.many=function(){var e=this;return n(function(t,n,r){for(var i=[];e._(t,a,o););return n(t,i);function a(e,n){return t=e,i.push(n),!0}function o(){return!1}})},e.times=function(e,t){arguments.length<2&&(t=e);var r=this;return n(function(n,i,a){for(var o=[],s=!0,c,l=0;l<e;l+=1)if(s=r._(n,u,d),!s)return a(n,c);for(;l<t&&s;l+=1)s=r._(n,u,f);return i(n,o);function u(e,t){return o.push(t),n=e,!0}function d(e,t){return c=t,n=e,!1}function f(e,t){return!1}})},e.result=function(e){return this.then(a(e))},e.atMost=function(e){return this.times(0,e)},e.atLeast=function(e){var t=this;return t.times(e).then(function(e){return t.many().map(function(t){return e.concat(t)})})},e.map=function(e){return this.then(function(t){return a(e(t))})},e.skip=function(e){return this.then(function(t){return e.result(t)})},this.string=function(e){var t=e.length,r=`expected '`+e+`'`;return n(function(n,i,a){var o=n.slice(0,t);return o===e?i(n.slice(t),o):a(n,r)})};var i=this.regex=function(e){dZ(`regexp parser is anchored`,e.toString().charAt(1)===`^`);var t=`expected `+e;return n(function(n,r,i){var a=e.exec(n);if(a){var o=a[0];return r(n.slice(o.length),o)}else return i(n,t)})},a=n.succeed=function(e){return n(function(t,n){return n(t,e)})};n.fail=function(e){return n(function(t,n,r){return r(t,e)})},n.letter=i(/^[a-z]/i),n.letters=i(/^[a-z]*/i),n.digit=i(/^[0-9]/),n.digits=i(/^[0-9]*/),n.whitespace=i(/^\s+/),n.optWhitespace=i(/^\s*/),n.any=n(function(e,t,n){return e?t(e.slice(1),e.charAt(0)):n(e,`expected any character`)}),n.all=n(function(e,t,n){return t(``,e)});var o=n.eof=n(function(e,t,n){return e?n(e,`expected EOF`):t(e,e)})}),FZ=function(){var e={8:`Backspace`,9:`Tab`,10:`Enter`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Esc`,32:`Spacebar`,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`Left`,38:`Up`,39:`Right`,40:`Down`,45:`Insert`,46:`Del`,144:`NumLock`};function t(t){var n=t.which||t.keyCode,r=e[n],i,a=[];return t.ctrlKey&&a.push(`Ctrl`),t.originalEvent&&t.originalEvent.metaKey&&a.push(`Meta`),t.altKey&&a.push(`Alt`),t.shiftKey&&a.push(`Shift`),i=r||String.fromCharCode(n),!a.length&&!r?i:(a.push(i),a.join(`-`))}return function(e,n){var r=null,i=null,a=eZ(e),o=eZ(n.container||a),s=oZ,c;function l(e){s=e,clearTimeout(c),c=setTimeout(e)}function u(e){l(function(t){s=oZ,clearTimeout(c),e(t)})}o.bind(`keydown keypress input keyup focusout paste`,function(e){s(e)});function d(e){s(),s=oZ,clearTimeout(c),a.val(e),e&&a[0]&&a[0].select&&a[0].select(),f=!!e}var f=!1;function p(){var e=a[0];return`selectionStart`in e&&e.selectionStart!==e.selectionEnd}function m(){n.keystroke(t(r),r)}function h(e){r=e,i=null,f&&u(function(e){!(e&&e.type===`focusout`)&&a[0]&&a[0].select&&a[0].select()}),m()}function g(e){r&&i&&m(),i=e,l(v)}function _(e){r&&!i&&l(v)}function v(){if(!p()){var e=a.val();e.length===1?(a.val(``),n.typedText(e)):e&&a[0]&&a[0].select&&a[0].select()}}function y(){r=i=null}function b(e){a.focus(),l(x)}function x(){var e=a.val();a.val(``),e&&n.paste(e)}return o.bind({keydown:h,keypress:g,keyup:_,focusout:y,cut:function(){u(function(){n.cut()})},copy:function(){u(function(){n.copy()})},paste:b}),{select:d}}}();xZ.open(function(e,t){e.exportText=function(){return this.root.foldChildren(``,function(e,t){return e+t.text()})}}),xZ.open(function(e){e.focusBlurEvents=function(){var e=this,t=e.root,n=e.cursor,r;e.textarea.focus(function(){e.blurred=!1,clearTimeout(r),e.container.addClass(`mq-focused`),n.parent||n.insAtRightEnd(t),n.selection?(n.selection.jQ.removeClass(`mq-blur`),e.selectionChanged()):n.show()}).blur(function(){e.blurred=!0,r=setTimeout(function(){t.postOrder(`intentionalBlur`),n.clearSelection().endSelection(),a()}),$X(window).bind(`blur`,i)});function i(){clearTimeout(r),n.selection&&n.selection.jQ.addClass(`mq-blur`),a()}function a(){n.hide().parent.blur(),e.container.removeClass(`mq-focused`),$X(window).unbind(`blur`,i)}e.blurred=!0,n.hide().parent.blur()}}),xZ.open(function(e){e.keystroke=function(e,t){this.cursor.parent.keystroke(e,t,this)}}),mZ.open(function(e){e.keystroke=function(e,t,n){var r=n.cursor;switch(e){case`Ctrl-Shift-Backspace`:case`Ctrl-Backspace`:n.ctrlDeleteDir(Y);break;case`Shift-Backspace`:case`Backspace`:n.backspace();break;case`Esc`:case`Tab`:n.escapeDir(X,e,t);return;case`Shift-Tab`:case`Shift-Esc`:n.escapeDir(Y,e,t);return;case`End`:n.notify(`move`).cursor.insAtRightEnd(r.parent);break;case`Ctrl-End`:n.notify(`move`).cursor.insAtRightEnd(n.root);break;case`Shift-End`:for(;r[X];)n.selectRight();break;case`Ctrl-Shift-End`:for(;r[X]||r.parent!==n.root;)n.selectRight();break;case`Home`:n.notify(`move`).cursor.insAtLeftEnd(r.parent);break;case`Ctrl-Home`:n.notify(`move`).cursor.insAtLeftEnd(n.root);break;case`Shift-Home`:for(;r[Y];)n.selectLeft();break;case`Ctrl-Shift-Home`:for(;r[Y]||r.parent!==n.root;)n.selectLeft();break;case`Left`:n.moveLeft();break;case`Shift-Left`:n.selectLeft();break;case`Ctrl-Left`:break;case`Right`:n.moveRight();break;case`Shift-Right`:n.selectRight();break;case`Ctrl-Right`:break;case`Up`:n.moveUp();break;case`Down`:n.moveDown();break;case`Shift-Up`:if(r[Y])for(;r[Y];)n.selectLeft();else n.selectLeft();case`Shift-Down`:if(r[X])for(;r[X];)n.selectRight();else n.selectRight();case`Ctrl-Up`:break;case`Ctrl-Down`:break;case`Ctrl-Shift-Del`:case`Ctrl-Del`:n.ctrlDeleteDir(X);break;case`Shift-Del`:case`Del`:n.deleteForward();break;case`Meta-A`:case`Ctrl-A`:for(n.notify(`move`).cursor.insAtRightEnd(n.root);r[Y];)n.selectLeft();break;default:return}t.preventDefault(),n.scrollHoriz()},e.moveOutOf=e.moveTowards=e.deleteOutOf=e.deleteTowards=e.unselectInto=e.selectOutOf=e.selectTowards=function(){dZ(`overridden or never called on this node`)}}),xZ.open(function(e){this.onNotify(function(e){(e===`move`||e===`upDown`)&&this.show().clearSelection()}),e.escapeDir=function(e,t,n){fZ(e);var r=this.cursor;if(r.parent!==this.root&&n.preventDefault(),r.parent!==this.root)return r.parent.moveOutOf(e,r),this.notify(`move`)},wZ.leftRightIntoCmdGoes=function(e){if(e&&e!==`up`&&e!==`down`)throw`"up" or "down" required for leftRightIntoCmdGoes option, got "`+e+`"`;return e},e.moveDir=function(e){fZ(e);var t=this.cursor,n=t.options.leftRightIntoCmdGoes;return t.selection?t.insDirOf(e,t.selection.ends[e]):t[e]?t[e].moveTowards(e,t,n):t.parent.moveOutOf(e,t,n),this.notify(`move`)},e.moveLeft=function(){return this.moveDir(Y)},e.moveRight=function(){return this.moveDir(X)},e.moveUp=function(){return t(this,`up`)},e.moveDown=function(){return t(this,`down`)};function t(e,t){var n=e.notify(`upDown`).cursor,r=t+`Into`,i=t+`OutOf`;return n[X][r]?n.insAtLeftEnd(n[X][r]):n[Y][r]?n.insAtRightEnd(n[Y][r]):n.parent.bubble(function(e){var t=e[i];if(t&&(typeof t==`function`&&(t=e[i](n)),t instanceof mZ&&n.jumpUpDown(e,t),t!==!0))return!1}),e}this.onNotify(function(e){e!==`upDown`&&(this.upDownCache={})}),this.onNotify(function(e){e===`edit`&&this.show().deleteSelection()}),e.deleteDir=function(e){fZ(e);var t=this.cursor,n=t.selection;return this.notify(`edit`),n||(t[e]?t[e].deleteTowards(e,t):t.parent.deleteOutOf(e,t)),t[Y].siblingDeleted&&t[Y].siblingDeleted(t.options,X),t[X].siblingDeleted&&t[X].siblingDeleted(t.options,Y),t.parent.bubble(`reflow`),this},e.ctrlDeleteDir=function(e){fZ(e);var t=this.cursor;return!t[e]||t.selection?this.deleteDir(e):(this.notify(`edit`),e===Y?gZ(t.parent.ends[Y],t[Y]).remove():gZ(t[X],t.parent.ends[X]).remove(),t.insAtDirEnd(e,t.parent),t[Y].siblingDeleted&&t[Y].siblingDeleted(t.options,X),t[X].siblingDeleted&&t[X].siblingDeleted(t.options,Y),t.parent.bubble(`reflow`),this)},e.backspace=function(){return this.deleteDir(Y)},e.deleteForward=function(){return this.deleteDir(X)},this.onNotify(function(e){e!==`select`&&this.endSelection()}),e.selectDir=function(e){var t=this.notify(`select`).cursor,n=t.selection;fZ(e),t.anticursor||t.startSelection();var r=t[e];r?n&&n.ends[e]===r&&t.anticursor[-e]!==r?r.unselectInto(e,t):r.selectTowards(e,t):t.parent.selectOutOf(e,t),t.clearSelection(),t.select()||t.show()},e.selectLeft=function(){return this.selectDir(Y)},e.selectRight=function(){return this.selectDir(X)}});var IZ=/[\\]{2,}/gm,LZ=(function(){function e(e){var t=VZ();return e.adopt(t,0,0),t}function t(e){for(var t=e[0]||VZ(),n=1;n<e.length;n+=1)e[n].children().adopt(t,t.ends[X],0);return t}var n=PZ.string,r=PZ.regex,i=PZ.letter,a=PZ.any,o=PZ.optWhitespace,s=PZ.succeed,c=PZ.fail,l=i.map(function(e){return XZ(e)}),u=r(/^[^${}\\_^]/).map(function(e){return Q(e)}),d=r(/^\\not\\[a-z]+/).then(function(e){return vZ[e]&&vZ[e]().parser()||c(`unknown compound command: `+e)}),f=r(/^[^\\a-eg-zA-Z]/).or(n(`\\`).then(r(/^begin\{.?matrix\}/).or(r(/^[a-z]+/i)).or(r(/^\s+/).result(` `)).or(a))).then(function(e){e=e.replace(/^begin\{(.?matrix)\}$/,`$1`);var t=Z[e];return t?t(e).parser():c(`unknown command: \\`+e)}),p=d.or(f).or(l).or(u),m=n(`{`).then(function(){return g}).skip(n(`}`)),h=o.then(m.or(p.map(e))),g=h.many().map(t).skip(o),_=n(`[`).then(h.then(function(e){return e.join(`latex`)===`]`?c():s(e)}).many().map(t).skip(o)).skip(n(`]`)),v=g;return v.block=h,v.optBlock=_,v})();xZ.open(function(e,t){e.exportLatex=function(){return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi,`$1`)},e.parseLatex=function(e){return LZ.parse(e).postOrder(`finalizeTree`,CZ.p).join(`latex`).trim()},wZ.maxDepth=function(e){return typeof e==`number`?e:tZ},e.writeLatex=function(e){var t=this.notify(`edit`).cursor,n=PZ.all,r=PZ.eof,i=LZ.skip(r).or(n.result(!1)).parse(e);return i&&!i.isEmpty()&&i.prepareInsertionAt(t)&&(i.children().adopt(t.parent,t[Y],t[X]),i.jQize().insertBefore(t.jQ),t[Y]=i.ends[X],i.finalizeInsert(t.options,t),i.ends[X][X].siblingCreated&&i.ends[X][X].siblingCreated(t.options,Y),i.ends[Y][Y].siblingCreated&&i.ends[Y][Y].siblingCreated(t.options,X),t.parent.bubble(`reflow`)),this},e.renderLatexMath=function(e){e&&e.replace&&(e=e.replace(IZ,`\\`));var t=this.root,n=this.cursor;n.options;var r=t.jQ,i=PZ.all,a=PZ.eof,o=LZ.skip(a).or(i.result(!1)).parse(e);if(t.eachChild(`postOrder`,`dispose`),t.ends[Y]=t.ends[X]=0,o&&o.prepareInsertionAt(n)){o.children().adopt(t,0,0);var s=o.join(`html`);r.html(s),t.jQize(r.children()),t.finalizeInsert(n.options)}else r.empty();delete n.selection,n.insAtRightEnd(t)},e.renderLatexText=function(e){var t=this.root,n=this.cursor;t.jQ.children().slice(1).remove(),t.eachChild(`postOrder`,`dispose`),t.ends[Y]=t.ends[X]=0,delete n.selection,n.show().insAtRightEnd(t);var r=PZ.regex,i=PZ.string,a=PZ.eof,o=PZ.all,s=i(`$`).then(LZ).skip(i(`$`).or(a)).map(function(e){var t=KZ(n);t.createBlocks();var r=t.ends[Y];return e.children().adopt(r,0,0),t}),c=i(`\\$`).result(`$`).or(r(/^[^$]/)).map(Q),l=s.or(c).many().skip(a).or(o.result(!1)).parse(e);if(l){for(var u=0;u<l.length;u+=1)l[u].adopt(t,t.ends[X],0);t.jQize().appendTo(t.jQ),t.finalizeInsert(n.options)}}}),xZ.open(function(e){CZ.p.ignoreNextMousedown=oZ,e.delegateMouseEvents=function(){var e=this.root.jQ;this.container.bind(`mousedown.mathquill`,function(t){var n=$X(t.target).closest(`.mq-root-block`),r=mZ.byId[n.attr(rZ)||e.attr(rZ)].controller,i=r.cursor;i.blink;var a=r.textareaSpan,o=r.textarea;if(t.preventDefault(),t.target.unselectable=!0,i.options.ignoreNextMousedown(t))return;i.options.ignoreNextMousedown=oZ;function s(e){i.anticursor||i.startSelection(),r.seek($X(e.target),e.pageX,e.pageY).cursor.select(),e.target&&$X(e.target.ownerDocument).unbind(`mousemove`,c)}function c(e){return delete e.target,s(e)}function l(e){!i.selection&&!r.editable&&a.detach(),n.unbind(`mousemove`,s),$X(e.target.ownerDocument).unbind(`mousemove`,c).unbind(`mouseup`,l)}if(a.parent().length===0)return!1;r.blurred&&(r.editable||n.prepend(a),document.body.focus(),o.focus()),t.preventDefault(),t.target.unselectable=!0,i.show(),r.seek($X(t.target),t.pageX,t.pageY).cursor.startSelection(),n.mousemove(s),$X(t.target.ownerDocument).mousemove(c).mouseup(l)})}}),xZ.open(function(e){e.seek=function(e,t,n){var r=this.notify(`select`).cursor;if(e){var i=e.attr(rZ)||e.attr(nZ);if(!i){var a=e.parent();i=a.attr(rZ)||a.attr(nZ)}}var o=i&&mZ.byId[i]?mZ.byId[i]:this.root;return r.clearSelection().show(),o.seek(t,r),this.scrollHoriz(),this}}),xZ.open(function(e){e.scrollHoriz=function(){var e=this.cursor,t=e.selection,n=this.root.jQ[0].getBoundingClientRect();if(t){var r=t.jQ[0].getBoundingClientRect(),i=r.left-(n.left+20),a=r.right-(n.right-20);if(t.ends[Y]===e[X])if(i<0)var o=i;else if(a>0)if(r.left-a<n.left+20)var o=i;else var o=a;else return;else if(a>0)var o=a;else if(i<0)if(r.right-i>n.right-20)var o=a;else var o=i;else return}else{var s=e.jQ[0].getBoundingClientRect().left;if(s>n.right-20)var o=s-(n.right-20);else if(s<n.left+20)var o=s-(n.left+20);else return}this.root.jQ.stop&&typeof this.root.jQ.stop==`function`&&this.root.jQ.stop().animate({scrollLeft:`+=`+o},100)}}),xZ.open(function(e){CZ.p.substituteTextarea=function(){return $X(`<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />`)[0]},e.createTextarea=function(){var e=this.textareaSpan=$X(`<span class="mq-textarea"></span>`),t=this.options.substituteTextarea();if(!t.nodeType)throw`substituteTextarea() must return a DOM element, got `+t;t=this.textarea=$X(t).appendTo(e);var n=this;n.cursor.selectionChanged=function(){n.selectionChanged()}},e.selectionChanged=function(){var e=this;uQ(e.container[0]),e.textareaSelectionTimeout===tZ&&(e.textareaSelectionTimeout=setTimeout(function(){e.setTextareaSelection()}))},e.setTextareaSelection=function(){this.textareaSelectionTimeout=tZ;var e=``;this.cursor.selection&&(e=this.cursor.selection.join(`latex`),this.options.statelessClipboard&&(e=`$`+e+`$`)),this.selectFn(e)},e.staticMathTextareaEvents=function(){var e=this;e.root;var t=e.cursor,n=e.textarea,r=e.textareaSpan;this.container.prepend(eZ(`<span class="mq-selectable">`).text(`$`+e.exportLatex()+`$`)),e.blurred=!0,n.bind(`cut paste`,!1).bind(`copy`,function(){e.setTextareaSelection()}).focus(function(){e.blurred=!1}).blur(function(){t.selection&&t.selection.clear(),setTimeout(i)});function i(){r.detach(),e.blurred=!0}e.selectFn=function(e){n.val(e),e&&n.select()}},CZ.p.substituteKeyboardEvents=FZ,e.editablesTextareaEvents=function(){var e=this,t=e.textarea,n=e.textareaSpan,r=this.options.substituteKeyboardEvents(t,this);this.selectFn=function(e){r.select(e)},this.container.prepend(n),this.focusBlurEvents()},e.typedText=function(e){if(e===`
|
|
332
|
-
`)return this.handle(`enter`);var t=this.notify().cursor;t.parent.write(t,e),this.scrollHoriz()},e.cut=function(){var e=this,t=e.cursor;t.selection&&setTimeout(function(){e.notify(`edit`),t.parent.bubble(`reflow`)})},e.copy=function(){this.setTextareaSelection()},e.paste=function(e){this.options.statelessClipboard&&(e=e.slice(0,1)===`$`&&e.slice(-1)===`$`?e.slice(1,-1):`\\text{`+e+`}`),this.writeLatex(e).cursor.show()}});var RZ=J(mZ,function(e,t){e.finalizeInsert=function(e,t){var n=this;n.postOrder(`finalizeTree`,e),n.postOrder(`contactWeld`,t),n.postOrder(`blur`),n.postOrder(`reflow`),n[X].siblingCreated&&n[X].siblingCreated(e,Y),n[Y].siblingCreated&&n[Y].siblingCreated(e,X),n.bubble(`reflow`)},e.prepareInsertionAt=function(e){var t=e.options.maxDepth;if(t!==tZ){var n=e.depth();if(n>t)return!1;this.removeNodesDeeperThan(t-n)}return!0},e.removeNodesDeeperThan=function(e){for(var t=0,n=[[this,t]],r;n.length;)r=n.shift(),r[0].children().each(function(i){var a=+(i instanceof VZ);t=r[1]+a,t<=e?n.push([i,t]):(a?i.children():i).remove()})}}),zZ=J(RZ,function(e,t){e.init=function(e,n,r){var i=this;t.init.call(i),i.ctrlSeq||=e,n&&(i.htmlTemplate=n),r&&(i.textTemplate=r)},e.replaces=function(e){e.disown(),this.replacedFragment=e},e.isEmpty=function(){return this.foldChildren(!0,function(e,t){return e&&t.isEmpty()})},e.parser=function(){var e=LZ.block,t=this;return e.times(t.numBlocks()).map(function(e){t.blocks=e;for(var n=0;n<e.length;n+=1)e[n].adopt(t,t.ends[X],0);return t})},e.createLeftOf=function(e){var n=this,r=n.replacedFragment;n.createBlocks(),t.createLeftOf.call(n,e),r&&(r.adopt(n.ends[Y],0,0),r.jQ.appendTo(n.ends[Y].jQ),n.placeCursor(e),n.prepareInsertionAt(e)),n.finalizeInsert(e.options),n.placeCursor(e)},e.createBlocks=function(){for(var e=this,t=e.numBlocks(),n=e.blocks=Array(t),r=0;r<t;r+=1)(n[r]=VZ()).adopt(e,e.ends[X],0)},e.placeCursor=function(e){e.insAtRightEnd(this.foldChildren(this.ends[Y],function(e,t){return e.isEmpty()?e:t}))},e.moveTowards=function(e,t,n){var r=n&&this[n+`Into`];t.insAtDirEnd(-e,r||this.ends[-e])},e.deleteTowards=function(e,t){this.isEmpty()?t[e]=this.remove()[e]:this.moveTowards(e,t,null)},e.selectTowards=function(e,t){t[-e]=this,t[e]=this[e]},e.selectChildren=function(){return bZ(this,this)},e.unselectInto=function(e,t){t.insAtDirEnd(-e,t.anticursor.ancestors[this.id])},e.seek=function(e,t){function n(e){var t={};return t[Y]=e.jQ.offset().left,t[X]=t[Y]+e.jQ.outerWidth(),t}var r=this,i=n(r);if(e<i[Y])return t.insLeftOf(r);if(e>i[X])return t.insRightOf(r);var a=i[Y];r.eachChild(function(o){var s=n(o);if(e<s[Y])return e-a<s[Y]-e?o[Y]?t.insAtRightEnd(o[Y]):t.insLeftOf(r):t.insAtLeftEnd(o),!1;if(e>s[X])o[X]?a=s[X]:i[X]-e<e-s[X]?t.insRightOf(r):t.insAtRightEnd(o);else return o.seek(e,t),!1})},e.numBlocks=function(){var e=this.htmlTemplate.match(/&\d+/g);return e?e.length:0},e.html=function(){var e=this,t=e.blocks,n=` mathquill-command-id=`+e.id,r=e.htmlTemplate.match(/<[^<>]+>|[^<>]+/g);dZ(`no unmatched angle brackets`,r.join(``)===this.htmlTemplate);for(var i=0,a=r[0];a;i+=1,a=r[i])if(a.slice(-2)===`/>`)r[i]=a.slice(0,-2)+n+`/>`;else if(a.charAt(0)===`<`){dZ(`not an unmatched top-level close tag`,a.charAt(1)!==`/`),r[i]=a.slice(0,-1)+n+`>`;var o=1;do i+=1,a=r[i],dZ(`no missing close tags`,a),a.slice(0,2)===`</`?--o:a.charAt(0)===`<`&&a.slice(-2)!==`/>`&&(o+=1);while(o>0)}return r.join(``).replace(/>&(\d+)/g,function(e,n){return` mathquill-block-id=`+t[n].id+`>`+t[n].join(`html`)})},e.latex=function(){return this.foldChildren(this.ctrlSeq,function(e,t){return e+`{`+(t.latex()||` `)+`}`})},e.textTemplate=[``],e.text=function(){var e=this,t=0;return e.foldChildren(e.textTemplate[t],function(n,r){t+=1;var i=r.text();return n&&e.textTemplate[t]===`(`&&i[0]===`(`&&i.slice(-1)===`)`?n+i.slice(1,-1)+e.textTemplate[t]:n+i+(e.textTemplate[t]||``)})}}),BZ=J(zZ,function(e,t){e.init=function(e,n,r){r||=e&&e.length>1?e.slice(1):e,t.init.call(this,e,n,[r])},e.parser=function(){return PZ.succeed(this)},e.numBlocks=function(){return 0},e.replaces=function(e){e.remove()},e.createBlocks=oZ,e.moveTowards=function(e,t){t.jQ.insDirOf(e,this.jQ),t[-e]=this,t[e]=this[e]},e.deleteTowards=function(e,t){t[e]=this.remove()[e]},e.seek=function(e,t){e-this.jQ.offset().left<this.jQ.outerWidth()/2?t.insLeftOf(this):t.insRightOf(this)},e.latex=function(){return this.ctrlSeq},e.text=function(){return this.textTemplate},e.placeCursor=oZ,e.isEmpty=function(){return!0}}),Q=J(BZ,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span>`+(n||e)+`</span>`)}}),$=J(BZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-binary-operator">`+n+`</span>`,r)}}),VZ=J(RZ,function(e,t){e.join=function(e){return this.foldChildren(``,function(t,n){return t+n[e]()})},e.html=function(){return this.join(`html`)},e.latex=function(){return this.join(`latex`)},e.text=function(){return this.ends[Y]===this.ends[X]&&this.ends[Y]!==0?this.ends[Y].text():this.join(`text`)},e.keystroke=function(e,n,r){if(r.options.spaceBehavesLikeTab&&(e===`Spacebar`||e===`Shift-Spacebar`)){n.preventDefault(),r.escapeDir(e===`Shift-Spacebar`?Y:X,e,n);return}return t.keystroke.apply(this,arguments)},e.moveOutOf=function(e,t,n){!(n&&this.parent[n+`Into`])&&this[e]?t.insAtDirEnd(-e,this[e]):t.insDirOf(e,this.parent)},e.selectOutOf=function(e,t){t.insDirOf(e,this.parent)},e.deleteOutOf=function(e,t){t.unwrapGramp()},e.seek=function(e,t){var n=this.ends[X];if(!n||n.jQ.offset().left+n.jQ.outerWidth()<e)return t.insAtRightEnd(this);if(e<this.ends[Y].jQ.offset().left)return t.insAtLeftEnd(this);for(;e<n.jQ.offset().left;)n=n[Y];return n.seek(e,t)},e.chToCmd=function(e,t){var n;return e.match(/^[a-eg-zA-Z]$/)?XZ(e):/^\d$/.test(e)?JZ(e):t&&t.typingSlashWritesDivisionSymbol&&e===`/`?Z[`÷`](e):t&&t.typingAsteriskWritesTimesSymbol&&e===`*`?Z[`×`](e):(n=_Z[e]||Z[e])?n(e):Q(e)},e.write=function(e,t){var n;if(e.tooDeep())return!1;n=this.chToCmd(t,e.options),e.selection&&n.replaces(e.replaceSelection()),e.isTooDeep()||n.createLeftOf(e.show())},e.focus=function(){return this.jQ.addClass(`mq-hasCursor`),this.jQ.removeClass(`mq-empty`),this},e.blur=function(){return this.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.jQ.addClass(`mq-empty`),this}});CZ.p.mouseEvents=!0,SZ.StaticMath=function(e){return J(e.AbstractMathQuill,function(t,n){this.RootBlock=VZ,t.__mathquillify=function(e,t){return this.config(e),n.__mathquillify.call(this,`mq-math-mode`),this.__options.mouseEvents&&(this.__controller.delegateMouseEvents(),this.__controller.staticMathTextareaEvents()),this},t.init=function(){n.init.apply(this,arguments),this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField)},t.latex=function(){var t=n.latex.apply(this,arguments);return arguments.length>0&&this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField),t}})};var HZ=J(VZ,NZ);SZ.MathField=function(e){return J(e.EditableField,function(e,t){this.RootBlock=HZ,e.__mathquillify=function(e,n){return this.config(e),n>1&&(this.__controller.root.reflow=oZ),t.__mathquillify.call(this,`mq-editable-field mq-math-mode`),delete this.__controller.root.reflow,this}})};var UZ=J(mZ,function(e,t){e.ctrlSeq=`\\text`,e.replaces=function(e){e instanceof gZ?this.replacedText=e.remove().jQ.text():typeof e==`string`&&(this.replacedText=e)},e.jQadd=function(e){t.jQadd.call(this,e),this.ends[Y]&&this.ends[Y].jQadd(this.jQ[0].firstChild)},e.createLeftOf=function(e){var n=this;if(t.createLeftOf.call(this,e),n[X].siblingCreated&&n[X].siblingCreated(e.options,Y),n[Y].siblingCreated&&n[Y].siblingCreated(e.options,X),n.bubble(`reflow`),e.insAtRightEnd(n),n.replacedText)for(var r=0;r<n.replacedText.length;r+=1)n.write(e,n.replacedText.charAt(r))},e.parser=function(){var e=this,t=PZ.string,n=PZ.regex;return PZ.optWhitespace.then(t(`{`)).then(n(/^[^}]*/)).skip(t(`}`)).map(function(t){return t.length===0?gZ():(WZ(t).adopt(e,0,0),e)})},e.textContents=function(){return this.foldChildren(``,function(e,t){return e+t.text})},e.text=function(){return`"`+this.textContents()+`"`},e.latex=function(){var e=this.textContents();return e.length===0?``:`\\text{`+e.replace(/\\/g,`\\backslash `).replace(/[{}]/g,`\\$&`)+`}`},e.html=function(){return`<span class="mq-text-mode" mathquill-command-id=`+this.id+`>`+this.textContents()+`</span>`},e.moveTowards=function(e,t){t.insAtDirEnd(-e,this)},e.moveOutOf=function(e,t){t.insDirOf(e,this)},e.unselectInto=e.moveTowards,e.selectTowards=zZ.prototype.selectTowards,e.deleteTowards=zZ.prototype.deleteTowards,e.selectOutOf=function(e,t){t.insDirOf(e,this)},e.deleteOutOf=function(e,t){this.isEmpty()&&t.insRightOf(this)},e.write=function(e,n){if(e.show().deleteSelection(),n!==`$`)e[Y]?(e[Y].appendText(n),this.bubble(`reflow`)):WZ(n).createLeftOf(e);else if(this.isEmpty())e.insRightOf(this),Q(`\\$`,`$`).createLeftOf(e);else if(!e[X])e.insRightOf(this);else if(!e[Y])e.insLeftOf(this);else{var r=UZ(),i=this.ends[Y];i.disown().jQ.detach(),i.adopt(r,0,0),e.insLeftOf(this),t.createLeftOf.call(r,e)}},e.seek=function(e,t){t.hide();var r=n(this),i=this.jQ.width()/this.text.length,a=Math.round((e-this.jQ.offset().left)/i);a<=0?t.insAtLeftEnd(this):a>=r.text.length?t.insAtRightEnd(this):t.insLeftOf(r.splitRight(a));for(var o=e-t.show().offset().left,s=o&&o<0?Y:X,c=s;t[s]&&o*c>0;)t[s].moveTowards(s,t),c=o,o=e-t.offset().left;if(s*o<-s*c&&t[-s].moveTowards(-s,t),!t.anticursor)this.anticursorPosition=t[Y]&&t[Y].text.length;else if(t.anticursor.parent===this){var l=t[Y]&&t[Y].text.length;if(this.anticursorPosition===l)t.anticursor=pZ.copy(t);else{if(this.anticursorPosition<l){var u=t[Y].splitRight(this.anticursorPosition);t[Y]=u}else var u=t[X].splitRight(this.anticursorPosition-l);t.anticursor=pZ(this,u[Y],u)}}},e.blur=function(e){VZ.prototype.blur.call(this),e&&(this.textContents()===``?(this.remove(),e[Y]===this?e[Y]=this[Y]:e[X]===this&&(e[X]=this[X])):n(this))};function n(e){e.jQ[0].normalize();var t=e.jQ.contents().filter(function(e,t){return t.nodeType===3})[0];t||={data:``},dZ(`only node in TextBlock span is Text node`,t.nodeType===3);var n=WZ(t.data);return n.jQadd(t),e.children().disown(),n.adopt(e,0,0)}e.focus=VZ.prototype.focus}),WZ=J(mZ,function(e,t){e.init=function(e){t.init.call(this),this.text=e},e.jQadd=function(e){this.dom=e,this.jQ=$X(e)},e.jQize=function(){return this.jQadd(document.createTextNode(this.text))},e.appendText=function(e){this.text+=e,this.dom.appendData(e)},e.prependText=function(e){this.text=e+this.text,this.dom.insertData(0,e)},e.insTextAtDirEnd=function(e,t){fZ(t),t===X?this.appendText(e):this.prependText(e)},e.splitRight=function(e){var t=WZ(this.text.slice(e)).adopt(this.parent,this,this[X]);return t.jQadd(this.dom.splitText(e)),this.text=this.text.slice(0,e),t};function n(e,t){return t.charAt(e===Y?0:-1+t.length)}e.moveTowards=function(e,t){fZ(e);var r=n(-e,this.text),i=this[-e];return i?i.insTextAtDirEnd(r,e):WZ(r).createDir(-e,t),this.deleteTowards(e,t)},e.latex=function(){return this.text},e.deleteTowards=function(e,t){this.text.length>1?e===X?(this.dom.deleteData(0,1),this.text=this.text.slice(1)):(this.dom.deleteData(-1+this.text.length,1),this.text=this.text.slice(0,-1)):(this.remove(),this.jQ.remove(),t[e]=this[e])},e.selectTowards=function(e,t){fZ(e);var r=t.anticursor,i=n(-e,this.text);if(r[e]===this){var a=WZ(i).createDir(e,t);r[e]=a,t.insDirOf(e,a)}else{var o=this[-e];if(o)o.insTextAtDirEnd(i,e);else{var a=WZ(i).createDir(-e,t);a.jQ.insDirOf(-e,t.selection.jQ)}this.text.length===1&&r[-e]===this&&(r[-e]=this[-e])}return this.deleteTowards(e,t)}});Z.text=Z.textnormal=Z.textrm=Z.textup=Z.textmd=UZ;function GZ(e,t,n){return J(UZ,{ctrlSeq:e,htmlTemplate:`<`+t+` `+n+`>&0</`+t+`>`})}Z.em=Z.italic=Z.italics=Z.emph=Z.textit=Z.textsl=GZ(`\\textit`,`i`,`class="mq-text-mode"`),Z.strong=Z.bold=Z.textbf=GZ(`\\textbf`,`b`,`class="mq-text-mode"`),Z.sf=Z.textsf=GZ(`\\textsf`,`span`,`class="mq-sans-serif mq-text-mode"`),Z.tt=Z.texttt=GZ(`\\texttt`,`span`,`class="mq-monospace mq-text-mode"`),Z.textsc=GZ(`\\textsc`,`span`,`style="font-variant:small-caps" class="mq-text-mode"`),Z.uppercase=GZ(`\\uppercase`,`span`,`style="text-transform:uppercase" class="mq-text-mode"`),Z.lowercase=GZ(`\\lowercase`,`span`,`style="text-transform:lowercase" class="mq-text-mode"`);var KZ=J(zZ,function(e,t){e.init=function(e){t.init.call(this,`$`),this.cursor=e},e.htmlTemplate=`<span class="mq-math-mode">&0</span>`,e.createBlocks=function(){t.createBlocks.call(this),this.ends[Y].cursor=this.cursor,this.ends[Y].write=function(e,t){t===`$`?this.isEmpty()?(e.insRightOf(this.parent),this.parent.deleteTowards(dir,e),Q(`\\$`,`$`).createLeftOf(e.show())):e[X]?e[Y]?VZ.prototype.write.call(this,e,t):e.insLeftOf(this.parent):e.insRightOf(this.parent):VZ.prototype.write.call(this,e,t)}},e.latex=function(){return`$`+this.ends[Y].latex()+`$`}}),qZ=J(HZ,function(e,t){e.keystroke=function(e){if(!(e===`Spacebar`||e===`Shift-Spacebar`))return t.keystroke.apply(this,arguments)},e.write=function(e,t){if(e.show().deleteSelection(),t===`$`)KZ(e).createLeftOf(e);else{var n;t===`<`?n=`<`:t===`>`&&(n=`>`),Q(t,n).createLeftOf(e)}}});SZ.TextField=function(e){return J(e.EditableField,function(e,t){this.RootBlock=qZ,e.__mathquillify=function(){return t.__mathquillify.call(this,`mq-editable-field mq-text-mode`)},e.latex=function(e){return arguments.length>0?(this.__controller.renderLatexText(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()}})},_Z[`\\`]=J(zZ,function(e,t){e.ctrlSeq=`\\`,e.replaces=function(e){this._replacedFragment=e.disown(),this.isEmpty=function(){return!1}},e.htmlTemplate=`<span class="mq-latex-command-input mq-non-leaf">\\<span>&0</span></span>`,e.textTemplate=[`\\`],e.createBlocks=function(){t.createBlocks.call(this),this.ends[Y].focus=function(){return this.parent.jQ.addClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.removeClass(`mq-empty`),this},this.ends[Y].blur=function(){return this.parent.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.addClass(`mq-empty`),this},this.ends[Y].write=function(e,t){e.show().deleteSelection(),t.match(/[a-z]/i)?Q(t).createLeftOf(e):(this.parent.renderCommand(e),(t!==`\\`||!this.isEmpty())&&e.parent.write(e,t))},this.ends[Y].keystroke=function(e,n,r){if(e===`Tab`||e===`Enter`||e===`Spacebar`){this.parent.renderCommand(r.cursor),n.preventDefault();return}return t.keystroke.apply(this,arguments)}},e.createLeftOf=function(e){if(t.createLeftOf.call(this,e),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass(`mq-blur`).bind(`mousedown mousemove`,function(e){return $X(e.target=n).trigger(e),!1}).insertBefore(this.jQ).add(this.jQ)}},e.latex=function(){return`\\`+this.ends[Y].latex()+` `},e.renderCommand=function(e){this.jQ=this.jQ.last(),this.remove(),this[X]?e.insLeftOf(this[X]):e.insAtRightEnd(this.parent);var t=this.ends[Y].latex();t||=` `;var n=Z[t];n?(n=n(t),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(e)):(n=UZ(),n.replaces(t),n.createLeftOf(e),e.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove())}}),Z[`∉`]=Z.notin=q($,`\\notin `,`∉`),Z[`≅`]=Z.cong=q($,`\\cong `,`≅`),Z[`≡`]=Z.equiv=q($,`\\equiv `,`≡`),Z[`⊕`]=Z.oplus=q($,`\\oplus `,`⊕`),Z[`⊗`]=Z.otimes=q($,`\\otimes `,`⊗`),Z[`≠`]=Z.ne=Z.neq=q($,`\\ne `,`≠`),Z[`≇`]=Z.ncong=q($,`\\ncong `,`≇`),Z[`∗`]=Z.ast=Z.star=Z.loast=Z.lowast=q($,`\\ast `,`∗`),Z.therefor=Z.therefore=q($,`\\therefore `,`∴`),Z.cuz=Z.because=q($,`\\because `,`∵`),Z.prop=Z.propto=q($,`\\propto `,`∝`),Z[`≈`]=Z.asymp=Z.approx=q($,`\\approx `,`≈`),Z[`≉`]=Z.nasymp=Z.napprox=q($,`\\napprox `,`≉`),Z.isin=Z.in=q($,`\\in `,`∈`),Z.ni=Z.contains=q($,`\\ni `,`∋`),Z.notni=Z.niton=Z.notcontains=Z.doesnotcontain=vZ[`\\not\\ni`]=q($,`\\not\\ni `,`∌`),Z.sub=Z.subset=q($,`\\subset `,`⊂`),Z.sup=Z.supset=Z.superset=q($,`\\supset `,`⊃`),Z.nsub=Z.notsub=Z.nsubset=Z.notsubset=vZ[`\\not\\subset`]=q($,`\\not\\subset `,`⊄`),Z.nsup=Z.notsup=Z.nsupset=Z.notsupset=Z.nsuperset=Z.notsuperset=vZ[`\\not\\supset`]=q($,`\\not\\supset `,`⊅`),Z.sube=Z.subeq=Z.subsete=Z.subseteq=q($,`\\subseteq `,`⊆`),Z.supe=Z.supeq=Z.supsete=Z.supseteq=Z.supersete=Z.superseteq=q($,`\\supseteq `,`⊇`),Z.nsube=Z.nsubeq=Z.notsube=Z.notsubeq=Z.nsubsete=Z.nsubseteq=Z.notsubsete=Z.notsubseteq=vZ[`\\not\\subseteq`]=q($,`\\not\\subseteq `,`⊈`),Z.nsupe=Z.nsupeq=Z.notsupe=Z.notsupeq=Z.nsupsete=Z.nsupseteq=Z.notsupsete=Z.notsupseteq=Z.nsupersete=Z.nsuperseteq=Z.notsupersete=Z.notsuperseteq=vZ[`\\not\\supseteq`]=q($,`\\not\\supseteq `,`⊉`),Z.N=Z.naturals=Z.Naturals=q(Q,`\\mathbb{N}`,`ℕ`),Z.P=Z.primes=Z.Primes=Z.projective=Z.Projective=Z.probability=Z.Probability=q(Q,`\\mathbb{P}`,`ℙ`),Z.Z=Z.integers=Z.Integers=q(Q,`\\mathbb{Z}`,`ℤ`),Z.Q=Z.rationals=Z.Rationals=q(Q,`\\mathbb{Q}`,`ℚ`),Z.R=Z.reals=Z.Reals=q(Q,`\\mathbb{R}`,`ℝ`),Z.C=Z.complex=Z.Complex=Z.complexes=Z.Complexes=Z.complexplane=Z.Complexplane=Z.ComplexPlane=q(Q,`\\mathbb{C}`,`ℂ`),Z.H=Z.Hamiltonian=Z.quaternions=Z.Quaternions=q(Q,`\\mathbb{H}`,`ℍ`),Z.quad=Z.emsp=q(Q,`\\quad `,` `),Z.qquad=q(Q,`\\qquad `,` `),Z.diamond=q(Q,`\\diamond `,`◇`),Z.bigtriangleup=q(Q,`\\bigtriangleup `,`△`),Z.ominus=q(Q,`\\ominus `,`⊖`),Z.uplus=q(Q,`\\uplus `,`⊎`),Z.bigtriangledown=q(Q,`\\bigtriangledown `,`▽`),Z.sqcap=q(Q,`\\sqcap `,`⊓`),Z.triangleleft=q(Q,`\\triangleleft `,`⊲`),Z.sqcup=q(Q,`\\sqcup `,`⊔`),Z.triangleright=q(Q,`\\triangleright `,`⊳`),Z.odot=Z.circledot=q(Q,`\\odot `,`⊙`),Z.bigcirc=q(Q,`\\bigcirc `,`◯`),Z.dagger=q(Q,`\\dagger `,`†`),Z.ddagger=q(Q,`\\ddagger `,`‡`),Z.wr=q(Q,`\\wr `,`≀`),Z.amalg=q(Q,`\\amalg `,`∐`),Z.models=q(Q,`\\models `,`⊨`),Z.prec=q(Q,`\\prec `,`≺`),Z.succ=q(Q,`\\succ `,`≻`),Z.preceq=q(Q,`\\preceq `,`≼`),Z.succeq=q(Q,`\\succeq `,`≽`),Z.simeq=q(Q,`\\simeq `,`≃`),Z.mid=q(Q,`\\mid `,`∣`),Z.ll=q(Q,`\\ll `,`≪`),Z.gg=q(Q,`\\gg `,`≫`),Z.parallel=q(Q,`\\parallel `,`∥`),Z.nparallel=q(Q,`\\nparallel `,`∦`),Z.bowtie=q(Q,`\\bowtie `,`⋈`),Z.sqsubset=q(Q,`\\sqsubset `,`⊏`),Z.sqsupset=q(Q,`\\sqsupset `,`⊐`),Z.smile=q(Q,`\\smile `,`⌣`),Z.sqsubseteq=q(Q,`\\sqsubseteq `,`⊑`),Z.sqsupseteq=q(Q,`\\sqsupseteq `,`⊒`),Z.doteq=q(Q,`\\doteq `,`≐`),Z.frown=q(Q,`\\frown `,`⌢`),Z.vdash=q(Q,`\\vdash `,`⊦`),Z.dashv=q(Q,`\\dashv `,`⊣`),Z.nless=q(Q,`\\nless `,`≮`),Z.ngtr=q(Q,`\\ngtr `,`≯`),Z.longleftarrow=q(Q,`\\longleftarrow `,`←`),Z.longrightarrow=q(Q,`\\longrightarrow `,`→`),Z.Longleftarrow=q(Q,`\\Longleftarrow `,`⇐`),Z.Longrightarrow=q(Q,`\\Longrightarrow `,`⇒`),Z.longleftrightarrow=q(Q,`\\longleftrightarrow `,`↔`),Z.updownarrow=q(Q,`\\updownarrow `,`↕`),Z.Longleftrightarrow=q(Q,`\\Longleftrightarrow `,`⇔`),Z.Updownarrow=q(Q,`\\Updownarrow `,`⇕`),Z.mapsto=q(Q,`\\mapsto `,`↦`),Z.nearrow=q(Q,`\\nearrow `,`↗`),Z.hookleftarrow=q(Q,`\\hookleftarrow `,`↩`),Z.hookrightarrow=q(Q,`\\hookrightarrow `,`↪`),Z.searrow=q(Q,`\\searrow `,`↘`),Z.leftharpoonup=q(Q,`\\leftharpoonup `,`↼`),Z.rightharpoonup=q(Q,`\\rightharpoonup `,`⇀`),Z.swarrow=q(Q,`\\swarrow `,`↙`),Z.leftharpoondown=q(Q,`\\leftharpoondown `,`↽`),Z.rightharpoondown=q(Q,`\\rightharpoondown `,`⇁`),Z.nwarrow=q(Q,`\\nwarrow `,`↖`),Z.ldots=q(Q,`\\ldots `,`…`),Z.cdots=q(Q,`\\cdots `,`⋯`),Z.vdots=q(Q,`\\vdots `,`⋮`),Z.ddots=q(Q,`\\ddots `,`⋱`),Z.surd=q(Q,`\\surd `,`√`),Z.triangle=q(Q,`\\triangle `,`△`),Z.ell=q(Q,`\\ell `,`ℓ`),Z.top=q(Q,`\\top `,`⊤`),Z.flat=q(Q,`\\flat `,`♭`),Z.natural=q(Q,`\\natural `,`♮`),Z.sharp=q(Q,`\\sharp `,`♯`),Z.wp=q(Q,`\\wp `,`℘`),Z.bot=q(Q,`\\bot `,`⊥`),Z.clubsuit=q(Q,`\\clubsuit `,`♣`),Z.diamondsuit=q(Q,`\\diamondsuit `,`♢`),Z.heartsuit=q(Q,`\\heartsuit `,`♡`),Z.spadesuit=q(Q,`\\spadesuit `,`♠`),Z.circledot=q(Q,`\\circledot `,`⊙`),Z.middot=q(Q,`\\middot `,`·`),Z.dottedsquare=q(Q,`\\dottedsquare `,`⬚`),Z.square=q(Q,`\\square `,`⬜`),Z.rectangle=q(Q,`\\rectangle `,`▯`),Z.oint=q(Q,`\\oint `,`∮`),Z.bigcap=q(Q,`\\bigcap `,`∩`),Z.bigcup=q(Q,`\\bigcup `,`∪`),Z.bigsqcup=q(Q,`\\bigsqcup `,`⊔`),Z.bigvee=q(Q,`\\bigvee `,`∨`),Z.bigwedge=q(Q,`\\bigwedge `,`∧`),Z.bigodot=q(Q,`\\bigodot `,`⊙`),Z.bigotimes=q(Q,`\\bigotimes `,`⊗`),Z.bigoplus=q(Q,`\\bigoplus `,`⊕`),Z.biguplus=q(Q,`\\biguplus `,`⊎`),Z.lfloor=q(Q,`\\lfloor `,`⌊`),Z.rfloor=q(Q,`\\rfloor `,`⌋`),Z.lceil=q(Q,`\\lceil `,`⌈`),Z.rceil=q(Q,`\\rceil `,`⌉`),Z.opencurlybrace=Z.lbrace=q(Q,`\\lbrace `,`{`),Z.closecurlybrace=Z.rbrace=q(Q,`\\rbrace `,`}`),Z.lbrack=q(Q,`[`),Z.rbrack=q(Q,`]`),Z.mug=q(Q,`\\mug `,`µg`),Z.mus=q(Q,`\\mus `,`µs`),Z.mum=q(Q,`\\mum `,`µm`),Z.muL=q(Q,`\\muL `,`µL`),Z.slash=q(Q,`/`),Z.vert=q(Q,`|`),Z.perp=Z.perpendicular=q(Q,`\\perp `,`⊥`),Z.nabla=Z.del=q(Q,`\\nabla `,`∇`),Z.hbar=q(Q,`\\hbar `,`ℏ`),Z.AA=Z.Angstrom=Z.angstrom=q(Q,`\\text\\AA `,`Å`),Z.ring=Z.circ=Z.circle=q(Q,`\\circ `,`∘`),Z.bull=Z.bullet=q(Q,`\\bullet `,`•`),Z.setminus=Z.smallsetminus=q(Q,`\\setminus `,`∖`),Z.not=Z[`¬`]=Z.neg=q(Q,`\\neg `,`¬`),Z[`…`]=Z.dots=Z.ellip=Z.hellip=Z.ellipsis=Z.hellipsis=q(Q,`\\dots `,`…`),Z.converges=Z.darr=Z.dnarr=Z.dnarrow=Z.downarrow=q(Q,`\\downarrow `,`↓`),Z.dArr=Z.dnArr=Z.dnArrow=Z.Downarrow=q(Q,`\\Downarrow `,`⇓`),Z.diverges=Z.uarr=Z.uparrow=q(Q,`\\uparrow `,`↑`),Z.uArr=Z.Uparrow=q(Q,`\\Uparrow `,`⇑`),Z.to=q($,`\\to `,`→`),Z.rarr=Z.rightarrow=q(Q,`\\rightarrow `,`→`),Z.implies=q($,`\\Rightarrow `,`⇒`),Z.rArr=Z.Rightarrow=q(Q,`\\Rightarrow `,`⇒`),Z.gets=q($,`\\gets `,`←`),Z.larr=Z.leftarrow=q(Q,`\\leftarrow `,`←`),Z.impliedby=q($,`\\Leftarrow `,`⇐`),Z.lArr=Z.Leftarrow=q(Q,`\\Leftarrow `,`⇐`),Z.harr=Z.lrarr=Z.leftrightarrow=q(Q,`\\leftrightarrow `,`↔`),Z.iff=q($,`\\Leftrightarrow `,`⇔`),Z.hArr=Z.lrArr=Z.Leftrightarrow=q(Q,`\\Leftrightarrow `,`⇔`),Z.Re=Z.Real=Z.real=q(Q,`\\Re `,`ℜ`),Z.Im=Z.imag=Z.image=Z.imagin=Z.imaginary=Z.Imaginary=q(Q,`\\Im `,`ℑ`),Z.part=Z.partial=q(Q,`\\partial `,`∂`),Z.infty=Z.infin=Z.infinity=q(Q,`\\infty `,`∞`),Z.pounds=q(Q,`\\pounds `,`£`),Z.alef=Z.alefsym=Z.aleph=Z.alephsym=q(Q,`\\aleph `,`ℵ`),Z.xist=Z.xists=Z.exist=Z.exists=q(Q,`\\exists `,`∃`),Z.nexists=Z.nexist=q(Q,`\\nexists `,`∄`),Z.and=Z.land=Z.wedge=q($,`\\wedge `,`∧`),Z.or=Z.lor=Z.vee=q($,`\\vee `,`∨`),Z.o=Z.O=Z.empty=Z.emptyset=Z.oslash=Z.Oslash=Z.nothing=Z.varnothing=q($,`\\varnothing `,`∅`),Z.cup=Z.union=q($,`\\cup `,`∪`),Z.cap=Z.intersect=Z.intersection=q($,`\\cap `,`∩`),Z.deg=Z.degree=q(Q,`\\degree `,`°`),Z.ang=Z.angle=q(Q,`\\angle `,`∠`),Z.measuredangle=q(Q,`\\measuredangle `,`m∠`);var JZ=J(Q,function(e,t){e.createLeftOf=function(e){e.options.autoSubscriptNumerals&&e.parent!==e.parent.parent.sub&&(e[Y]instanceof YZ&&e[Y].isItalic!==!1||e[Y]instanceof wQ&&e[Y][Y]instanceof YZ&&e[Y][Y].isItalic!==!1)?(Z._().createLeftOf(e),t.createLeftOf.call(this,e),e.insRightOf(e.parent.parent)):t.createLeftOf.call(this,e)}}),YZ=J(BZ,function(e,t){e.init=function(e,n){t.init.call(this,e,`<var>`+(n||e)+`</var>`)},e.text=function(){var e=this.ctrlSeq;return this.isPartOfOperator?e[0]==`\\`?e=e.slice(1,e.length):e[e.length-1]==` `&&(e=e.slice(0,-1)):(this[Y]&&!(this[Y]instanceof YZ)&&!(this[Y]instanceof $)&&this[Y].ctrlSeq!==`\\ `&&(e=`*`+e),this[X]&&!(this[X]instanceof $)&&!(this[X]instanceof wQ)&&(e+=`*`)),e}});CZ.p.autoCommands={_maxLength:0},wZ.autoCommands=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`autocommand "`+a+`" not minimum length of 2`;if(Z[a]===eQ)throw`"`+a+`" is a built-in operator name`;n[a]=1,r=aZ(r,a.length)}return n._maxLength=r,n};var XZ=J(YZ,function(e,t){e.init=function(e){return t.init.call(this,this.letter=e)},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments);var n=e.options.autoCommands,r=n._maxLength;if(r>0){for(var i=``,a=this,o=0;a instanceof XZ&&a.ctrlSeq===a.letter&&o<r;)i=a.letter+i,a=a[Y],o+=1;for(;i.length;){if(n.hasOwnProperty(i)){for(var o=1,a=this;o<i.length;o+=1,a=a[Y]);return gZ(a,this).remove(),e[Y]=a[Y],Z[i](i).createLeftOf(e)}i=i.slice(1)}}},e.italicize=function(e){return this.isItalic=e,this.isPartOfOperator=!e,this.jQ.toggleClass(`mq-operator-name`,!e),this},e.finalizeTree=e.siblingDeleted=e.siblingCreated=function(e,t){t!==Y&&this[X]instanceof XZ||this.autoUnItalicize(e)},e.autoUnItalicize=function(e){var t=e.autoOperatorNames;if(t._maxLength!==0){for(var r=this.letter,i=this[Y];i instanceof XZ;i=i[Y])r=i.letter+r;for(var a=this[X];a instanceof XZ;a=a[X])r+=a.letter;gZ(i[X]||this.parent.ends[Y],a[Y]||this.parent.ends[X]).each(function(e){e.italicize(!0).jQ.removeClass(`mq-first mq-last mq-followed-by-supsub`),e.ctrlSeq=e.letter});outer:for(var o=0,s=i[X]||this.parent.ends[Y];o<r.length;o+=1,s=s[X])for(var c=iZ(t._maxLength,r.length-o);c>0;--c){var l=r.slice(o,o+c);if(t.hasOwnProperty(l)){for(var u=0,d=s;u<c;u+=1,d=d[X]){d.italicize(!1);var f=d}var p=ZZ.hasOwnProperty(l);if(s.ctrlSeq=(p?`\\`:`\\operatorname{`)+s.ctrlSeq,f.ctrlSeq+=p?` `:`}`,$Z.hasOwnProperty(l)&&f[Y][Y][Y].jQ.addClass(`mq-last`),n(s[Y])||s.jQ.addClass(`mq-first`),!n(f[X]))if(f[X]instanceof wQ){var m=f[X];(m.siblingCreated=m.siblingDeleted=function(){m.jQ.toggleClass(`mq-after-operator-name`,!(m[X]instanceof NQ))})()}else f.jQ.toggleClass(`mq-last`,!(f[X]instanceof NQ));o+=c-1,s=f;continue outer}}}};function n(e){return!e||e instanceof $||e instanceof DQ}}),ZZ={},QZ=CZ.p.autoOperatorNames={_maxLength:9},$Z={limsup:1,liminf:1,projlim:1,injlim:1};(function(){for(var e=`arg deg det dim exp gcd hom inf ker lg ln log max min sup limsup liminf injlim projlim Pr`.split(` `),t=0;t<e.length;t+=1)ZZ[e[t]]=QZ[e[t]]=1;for(var n=`sin cos tan arcsin arccos arctan sinh cosh tanh sec csc cot coth`.split(` `),t=0;t<n.length;t+=1)ZZ[n[t]]=1;for(var r=`sin cos tan sec cosec csc cotan cot ctg`.split(` `),t=0;t<r.length;t+=1)QZ[r[t]]=QZ[`arc`+r[t]]=QZ[r[t]+`h`]=QZ[`ar`+r[t]+`h`]=QZ[`arc`+r[t]+`h`]=1;for(var i=`gcf hcf lcm proj span`.split(` `),t=0;t<i.length;t+=1)QZ[i[t]]=1})(),wZ.autoOperatorNames=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`"`+a+`" not minimum length of 2`;n[a]=1,r=aZ(r,a.length)}return n._maxLength=r,n};var eQ=J(BZ,function(e,t){e.init=function(e){this.ctrlSeq=e},e.createLeftOf=function(e){for(var t=this.ctrlSeq,n=0;n<t.length;n+=1)XZ(t.charAt(n)).createLeftOf(e)},e.parser=function(){for(var e=this.ctrlSeq,t=VZ(),n=0;n<e.length;n+=1)XZ(e.charAt(n)).adopt(t,t.ends[X],0);return PZ.succeed(t.children())}});for(var tQ in QZ)QZ.hasOwnProperty(tQ)&&(Z[tQ]=eQ);Z.operatorname=J(zZ,function(e){e.createLeftOf=oZ,e.numBlocks=function(){return 1},e.parser=function(){return LZ.block.map(function(e){return e.children()})}}),Z.f=J(XZ,function(e,t){e.init=function(){BZ.p.init.call(this,this.letter=`f`,`<var class="mq-f">f</var>`)},e.italicize=function(e){return this.jQ.html(`f`).toggleClass(`mq-f`,e),t.italicize.apply(this,arguments)}}),Z[` `]=Z.space=q(Q,`\\ `,` `),Z[`'`]=Z.prime=q(Q,`'`,`′`),Z[`″`]=Z.dprime=q(Q,`″`,`″`),Z[`"`]=Z.doublePrime=q(Q,`"`,`″`),Z.backslash=q(Q,`\\backslash `,`\\`),_Z[`\\`]||=Z.backslash,Z.$=q(Q,`\\$`,`$`);var nQ=J(BZ,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span class="mq-nonSymbola">`+(n||e)+`</span>`)}});Z[`@`]=nQ,Z[`&`]=q(nQ,`\\&`,`&`),Z[`%`]=q(nQ,`\\%`,`%`),Z.alpha=Z.beta=Z.gamma=Z.delta=Z.zeta=Z.eta=Z.theta=Z.iota=Z.kappa=Z.mu=Z.nu=Z.xi=Z.rho=Z.sigma=Z.tau=Z.chi=Z.psi=Z.omega=J(YZ,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),Z.phi=q(YZ,`\\phi `,`ϕ`),Z.phiv=Z.varphi=q(YZ,`\\varphi `,`φ`),Z.epsilon=q(YZ,`\\epsilon `,`ϵ`),Z.epsiv=Z.varepsilon=q(YZ,`\\varepsilon `,`ε`),Z.piv=Z.varpi=q(YZ,`\\varpi `,`ϖ`),Z.sigmaf=Z.sigmav=Z.varsigma=q(YZ,`\\varsigma `,`ς`),Z.thetav=Z.vartheta=Z.thetasym=q(YZ,`\\vartheta `,`ϑ`),Z.upsilon=Z.upsi=q(YZ,`\\upsilon `,`υ`),Z.gammad=Z.Gammad=Z.digamma=q(YZ,`\\digamma `,`ϝ`),Z.kappav=Z.varkappa=q(YZ,`\\varkappa `,`ϰ`),Z.rhov=Z.varrho=q(YZ,`\\varrho `,`ϱ`),Z.pi=Z.π=q(nQ,`\\pi `,`π`),Z.lambda=q(nQ,`\\lambda `,`λ`),Z.Upsilon=Z.Upsi=Z.upsih=Z.Upsih=q(BZ,`\\Upsilon `,`<var style="font-family: serif">ϒ</var>`),Z.Gamma=Z.Delta=Z.Theta=Z.Lambda=Z.Xi=Z.Pi=Z.Sigma=Z.Phi=Z.Psi=Z.Omega=J(Q,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),Z.forall=Z[`∀`]=q(Q,`\\forall `,`∀`);var rQ=J(zZ,function(e){e.init=function(e){this.latex=e},e.createLeftOf=function(e){var t=LZ.parse(this.latex);t.children().adopt(e.parent,e[Y],e[X]),e[Y]=t.ends[X],t.jQize().insertBefore(e.jQ),t.finalizeInsert(e.options,e),t.ends[X][X].siblingCreated&&t.ends[X][X].siblingCreated(e.options,Y),t.ends[Y][Y].siblingCreated&&t.ends[Y][Y].siblingCreated(e.options,X),e.parent.bubble(`reflow`)},e.parser=function(){var e=LZ.parse(this.latex).children();return PZ.succeed(e)}});Z[`¹`]=q(rQ,`^1`),Z[`²`]=q(rQ,`^2`),Z[`³`]=q(rQ,`^3`),Z[`¼`]=q(rQ,`\\frac14`),Z[`½`]=q(rQ,`\\frac12`),Z[`¾`]=q(rQ,`\\frac34`);var iQ=J($,function(e){e.init=Q.prototype.init,e.contactWeld=e.siblingCreated=e.siblingDeleted=function(e,t){function n(e){if(e[Y]){if(e[Y]instanceof $||/^[,;:\(\[]$/.test(e[Y].ctrlSeq))return``}else if(e.parent&&e.parent.parent&&e.parent.parent.isStyleBlock())return n(e.parent.parent);else return``;return`mq-binary-operator`}if(t!==X)return this.jQ[0].className=n(this),this}});Z[`+`]=q(iQ,`+`,`+`),Z[`–`]=Z[`-`]=q(iQ,`-`,`−`),Z[`±`]=Z.pm=Z.plusmn=Z.plusminus=q(iQ,`\\pm `,`±`),Z.mp=Z.mnplus=Z.minusplus=q(iQ,`\\mp `,`∓`),_Z[`*`]=Z.sdot=Z.cdot=q($,`\\cdot `,`·`,`*`);var aQ=J($,function(e,t){e.init=function(e,n){this.data=e,this.strict=n;var r=n?`Strict`:``;t.init.call(this,e[`ctrlSeq`+r],e[`html`+r],e[`text`+r])},e.swap=function(e){this.strict=e;var t=e?`Strict`:``;this.ctrlSeq=this.data[`ctrlSeq`+t],this.jQ.html(this.data[`html`+t]),this.textTemplate=[this.data[`text`+t]]},e.deleteTowards=function(e,n){if(e===Y&&!this.strict){this.swap(!0),this.bubble(`reflow`);return}t.deleteTowards.apply(this,arguments)}}),oQ={ctrlSeq:`\\le `,html:`≤`,text:`≤`,ctrlSeqStrict:`<`,htmlStrict:`<`,textStrict:`<`},sQ={ctrlSeq:`\\ge `,html:`≥`,text:`≥`,ctrlSeqStrict:`>`,htmlStrict:`>`,textStrict:`>`};Z[`<`]=Z.lt=q(aQ,oQ,!0),Z[`>`]=Z.gt=q(aQ,sQ,!0),Z[`≤`]=Z.le=Z.leq=q(aQ,oQ,!1),Z[`≥`]=Z.ge=Z.geq=q(aQ,sQ,!1);var cQ=J($,function(e,t){e.init=function(){t.init.call(this,`=`,`=`)},e.createLeftOf=function(e){if(e[Y]instanceof aQ&&e[Y].strict){e[Y].swap(!1),e[Y].bubble(`reflow`);return}t.createLeftOf.apply(this,arguments)}});Z[`=`]=cQ,Z[`×`]=Z.times=q($,`\\times `,`×`,`[x]`),Z[`÷`]=Z.div=Z.divide=Z.divides=q($,`\\div `,`÷`,`[/]`),_Z[`~`]=Z.sim=q($,`\\sim `,`~`,`~`),_Z[`≁`]=Z.nsim=q($,`\\nsim `,`≁`,`≁`),Z.complement=Z[`∁`]=q(Q,`\\complement `,`∁`),Z.nexists=Z[`∄`]=q(Q,`\\nexists `,`∄`),Z.sphericalangle=Z[`∢`]=q(Q,`\\sphericalangle `,`∢`),Z.iint=Z[`∬`]=q(Q,`\\iint `,`∬`),Z.iiint=Z[`∭`]=q(Q,`\\iiint `,`∭`),Z.oiint=Z[`∯`]=q(Q,`\\oiint `,`∯`),Z.oiiint=Z[`∰`]=q(Q,`\\oiiint `,`∰`),Z.backsim=Z[`∽`]=q(Q,`\\backsim `,`∽`),Z.backsimeq=Z[`⋍`]=q(Q,`\\backsimeq `,`⋍`),Z.eqsim=Z[`≂`]=q(Q,`\\eqsim `,`≂`),Z.ncong=Z[`≇`]=q(Q,`\\ncong `,`≇`),Z.approxeq=Z[`≊`]=q(Q,`\\approxeq `,`≊`),Z.bumpeq=Z[`≏`]=q(Q,`\\bumpeq `,`≏`),Z.Bumpeq=Z[`≎`]=q(Q,`\\Bumpeq `,`≎`),Z.doteqdot=Z[`≑`]=q(Q,`\\doteqdot `,`≑`),Z.fallingdotseq=Z[`≒`]=q(Q,`\\fallingdotseq `,`≒`),Z.risingdotseq=Z[`≓`]=q(Q,`\\risingdotseq `,`≓`),Z.eqcirc=Z[`≖`]=q(Q,`\\eqcirc `,`≖`),Z.circeq=Z[`≗`]=q(Q,`\\circeq `,`≗`),Z.triangleq=Z[`≜`]=q(Q,`\\triangleq `,`≜`),Z.leqq=Z[`≦`]=q(Q,`\\leqq `,`≦`),Z.geqq=Z[`≧`]=q(Q,`\\geqq `,`≧`),Z.lneqq=Z[`≨`]=q(Q,`\\lneqq `,`≨`),Z.gneqq=Z[`≩`]=q(Q,`\\gneqq `,`≩`),Z.between=Z[`≬`]=q(Q,`\\between `,`≬`),Z.nleq=Z[`≰`]=q(Q,`\\nleq `,`≰`),Z.ngeq=Z[`≱`]=q(Q,`\\ngeq `,`≱`),Z.lesssim=Z[`≲`]=q(Q,`\\lesssim `,`≲`),Z.gtrsim=Z[`≳`]=q(Q,`\\gtrsim `,`≳`),Z.lessgtr=Z[`≶`]=q(Q,`\\lessgtr `,`≶`),Z.gtrless=Z[`≷`]=q(Q,`\\gtrless `,`≷`),Z.preccurlyeq=Z[`≼`]=q(Q,`\\preccurlyeq `,`≼`),Z.succcurlyeq=Z[`≽`]=q(Q,`\\succcurlyeq `,`≽`),Z.precsim=Z[`≾`]=q(Q,`\\precsim `,`≾`),Z.succsim=Z[`≿`]=q(Q,`\\succsim `,`≿`),Z.nprec=Z[`⊀`]=q(Q,`\\nprec `,`⊀`),Z.nsucc=Z[`⊁`]=q(Q,`\\nsucc `,`⊁`),Z.subsetneq=Z[`⊊`]=q(Q,`\\subsetneq `,`⊊`),Z.supsetneq=Z[`⊋`]=q(Q,`\\supsetneq `,`⊋`),Z.vDash=Z[`⊨`]=q(Q,`\\vDash `,`⊨`),Z.Vdash=Z[`⊩`]=q(Q,`\\Vdash `,`⊩`),Z.Vvdash=Z[`⊪`]=q(Q,`\\Vvdash `,`⊪`),Z.VDash=Z[`⊫`]=q(Q,`\\VDash `,`⊫`),Z.nvdash=Z[`⊬`]=q(Q,`\\nvdash `,`⊬`),Z.nvDash=Z[`⊭`]=q(Q,`\\nvDash `,`⊭`),Z.nVdash=Z[`⊮`]=q(Q,`\\nVdash `,`⊮`),Z.nVDash=Z[`⊯`]=q(Q,`\\nVDash `,`⊯`),Z.vartriangleleft=Z[`⊲`]=q(Q,`\\vartriangleleft `,`⊲`),Z.vartriangleright=Z[`⊳`]=q(Q,`\\vartriangleright `,`⊳`),Z.trianglelefteq=Z[`⊴`]=q(Q,`\\trianglelefteq `,`⊴`),Z.trianglerighteq=Z[`⊵`]=q(Q,`\\trianglerighteq `,`⊵`),Z.multimap=Z[`⊸`]=q(Q,`\\multimap `,`⊸`),Z.Subset=Z[`⋐`]=q(Q,`\\Subset `,`⋐`),Z.Supset=Z[`⋑`]=q(Q,`\\Supset `,`⋑`),Z.Cap=Z[`⋒`]=q(Q,`\\Cap `,`⋒`),Z.Cup=Z[`⋓`]=q(Q,`\\Cup `,`⋓`),Z.pitchfork=Z[`⋔`]=q(Q,`\\pitchfork `,`⋔`),Z.lessdot=Z[`⋖`]=q(Q,`\\lessdot `,`⋖`),Z.gtrdot=Z[`⋗`]=q(Q,`\\gtrdot `,`⋗`),Z.lll=Z[`⋘`]=q(Q,`\\lll `,`⋘`),Z.ggg=Z[`⋙`]=q(Q,`\\ggg `,`⋙`),Z.lesseqgtr=Z[`⋚`]=q(Q,`\\lesseqgtr `,`⋚`),Z.gtreqless=Z[`⋛`]=q(Q,`\\gtreqless `,`⋛`),Z.curlyeqprec=Z[`⋞`]=q(Q,`\\curlyeqprec `,`⋞`),Z.curlyeqsucc=Z[`⋟`]=q(Q,`\\curlyeqsucc `,`⋟`),Z.nsim=Z[`≁`]=q(Q,`\\nsim `,`≁`),Z.lnsim=Z[`⋦`]=q(Q,`\\lnsim `,`⋦`),Z.gnsim=Z[`⋧`]=q(Q,`\\gnsim `,`⋧`),Z.precnsim=Z[`⋨`]=q(Q,`\\precnsim `,`⋨`),Z.succnsim=Z[`⋩`]=q(Q,`\\succnsim `,`⋩`),Z.ntriangleleft=Z[`⋪`]=q(Q,`\\ntriangleleft `,`⋪`),Z.ntriangleright=Z[`⋫`]=q(Q,`\\ntriangleright `,`⋫`),Z.ntrianglelefteq=Z[`⋬`]=q(Q,`\\ntrianglelefteq `,`⋬`),Z.ntrianglerighteq=Z[`⋭`]=q(Q,`\\ntrianglerighteq `,`⋭`),Z.blacksquare=Z[`∎`]=q(Q,`\\blacksquare `,`∎`),Z.colon=Z[`∶`]=q(Q,`\\colon `,`∶`),Z.llcorner=Z[`∟`]=q(Q,`\\llcorner `,`∟`),Z.dotplus=Z[`∔`]=q($,`\\dotplus `,`∔`),Z.nmid=Z[`∤`]=q($,`
|
|
333
|
-
mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`⊻`]=q($,`\\veebar `,`⊻`),Z.barwedge=Z[`⊼`]=q($,`\\barwedge `,`⊼`),Z.ltimes=Z[`⋉`]=q($,`\\ltimes `,`⋉`),Z.rtimes=Z[`⋊`]=q($,`\\rtimes `,`⋊`),Z.leftthreetimes=Z[`⋋`]=q($,`\\leftthreetimes `,`⋋`),Z.rightthreetimes=Z[`⋌`]=q($,`\\rightthreetimes `,`⋌`),Z.curlyvee=Z[`⋎`]=q($,`\\curlyvee `,`⋎`),Z.curlywedge=Z[`⋏`]=q($,`\\curlywedge `,`⋏`),Z.circledcirc=Z[`⊚`]=q($,`\\circledcirc `,`⊚`),Z.circledast=Z[`⊛`]=q($,`\\circledast `,`⊛`),Z.circleddash=Z[`⊝`]=q($,`\\circleddash `,`⊝`),Z.boxplus=Z[`⊞`]=q($,`\\boxplus `,`⊞`),Z.boxminus=Z[`⊟`]=q($,`\\boxminus `,`⊟`),Z.boxtimes=Z[`⊠`]=q($,`\\boxtimes `,`⊠`),Z.boxdot=Z[`⊡`]=q($,`\\boxdot `,`⊡`),Z[`∂`]=Z.partial,Z[`∃`]=Z.exists,Z[`∅`]=Z.varnothing,Z[`∆`]=Z.triangle,Z[`∇`]=Z.nabla,Z[`∈`]=Z.in,Z[`∊`]=Z.in,Z[`∋`]=Z.ni,Z[`∌`]=Z.notni,Z[`∍`]=Z.ni,Z[`∐`]=Z.amalg,Z[`−`]=Z[`-`],Z[`∓`]=Z.mp,Z[`∖`]=Z.setminus,Z[`∘`]=Z.circ,Z[`∙`]=Z.bullet,Z[`∝`]=Z.propto,Z[`∞`]=Z.infty,Z[`∠`]=Z.angle,Z[`∡`]=Z.measuredangle,Z[`∣`]=Z.divides,Z[`∥`]=Z.parallel,Z[`∦`]=Z.nparallel,Z[`∧`]=Z.wedge,Z[`∨`]=Z.vee,Z[`∩`]=Z.cap,Z[`∪`]=Z.cup,Z[`∮`]=Z.oint,Z[`∴`]=Z.therefore,Z[`∵`]=Z.because,Z[`∼`]=Z.sim,Z[`≀`]=Z.wr,Z[`≃`]=Z.simeq,Z[`≍`]=Z.asymp,Z[`≐`]=Z.doteq,Z[`≪`]=Z.ll,Z[`≫`]=Z.gg,Z[`≺`]=Z.prec,Z[`≻`]=Z.succ,Z[`⊂`]=Z.subset,Z[`⊃`]=Z.supset,Z[`⊆`]=Z.subseteq,Z[`⊇`]=Z.supseteq,Z[`⊈`]=Z.nsubseteq,Z[`⊉`]=Z.nsupseteq,Z[`⊏`]=Z.sqsubset,Z[`⊐`]=Z.sqsupset,Z[`⊓`]=Z.sqcap,Z[`⊔`]=Z.sqcup,Z[`⊖`]=Z.ominus,Z[`⊘`]=Z.oslash,Z[`⊙`]=Z.odot,Z[`⊢`]=Z.vdash,Z[`⊣`]=Z.dashv,Z[`⊤`]=Z.top,Z[`⊥`]=Z.bot,Z[`⊧`]=Z.models,Z[`⋀`]=Z.wedge,Z[`⋁`]=Z.vee,Z[`⋂`]=Z.cap,Z[`⋃`]=Z.cup,Z[`⋄`]=Z.diamond,Z[`⋅`]=Z.cdot,Z[`⋆`]=Z.star,Z[`⋈`]=Z.bowtie,Z[`⋮`]=Z.vdots,Z[`⋯`]=Z.cdots,Z[`⋱`]=Z.ddots;var lQ,uQ=oZ,dQ=document.createElement(`div`).style,fQ={transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1},pQ;for(var mQ in fQ)if(mQ in dQ){pQ=mQ;break}pQ?lQ=function(e,t,n){e.css(pQ,`scale(`+t+`,`+n+`)`)}:`filter`in dQ?(uQ=function(e){e.className=e.className},lQ=function(e,t,n){t/=1+(n-1)/2,e.css(`fontSize`,n+`em`),e.hasClass(`mq-matrixed-container`)||e.addClass(`mq-matrixed-container`).wrapInner(`<span class="mq-matrixed"></span>`);var r=e.children().css(`filter`,`progid:DXImageTransform.Microsoft.Matrix(M11=`+t+`,SizingMethod='auto expand')`);function i(){e.css(`marginRight`,(r.width()-1)*(t-1)/t+`px`)}i();var a=setInterval(i);$X(window).load(function(){clearTimeout(a),i()})}):lQ=function(e,t,n){e.css(`fontSize`,n+`em`)};var hQ=J(zZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`>&0</`+n+`>`)}}),gQ=J(zZ,function(e,t){e.init=function(e,n,r){this.args=arguments,this.htmlTemplate=`<`+n+` `+r+`><`+n+` class="mq-xarrow-over">&0</`+n+`><`+n+` class="mq-xarrow-under"></`+n+`></`+n+`>`,t.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`(`,`)`]},e.parser=function(){var e=this;return LZ.optBlock.then(function(t){return LZ.block.map(function(n){var r=_Q.apply(null,e.args);return r.blocks=[t,n],t.adopt(r,0,0),n.adopt(r,t,0),r})}).or(t.parser.call(this))}}),_Q=J(gQ,function(e,t){e.init=function(e,t,n){this.htmlTemplate=`<`+t+` `+n+`><`+t+` class="mq-xarrow-over">&1</`+t+`><`+t+` class="mq-xarrow-under">&0</`+t+`></`+t+`>`,zZ.prototype.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`[`,`](`,`)`]},e.latex=function(){return this.ctrlSeq+`[`+this.ends[Y].latex()+`]{`+this.ends[X].latex()+`}`},e.finalizeTree=function(){this.downInto=this.ends[Y].upOutOf=this.ends[X],this.upInto=this.ends[X].downOutOf=this.ends[Y]}}),vQ=function(e){var t=`<span class="`+e+`-inner-right">g</span><span class="`+e+`-inner-left">h</span>`;return J(zZ,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`<span class="mq-empty-box">&0</span></`+i+`></`+i+`>`)}})},yQ=J(zZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`><span class="mq-longdiv-curve-border">)</span><span class="mq-longdiv-inner"><span class="mq-empty">&0</span></`+n+`></span>`)}}),bQ=J(zZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-row"><p>`+r+`</p><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td><td class="mq-empty"></td><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),xQ=J(zZ,function(e,t){e.init=function(e){t.init.call(this,e,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>`)}}),SQ=J(zZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-col"><p>`+r+`</p></span><span class="matrix-edit-content-col"><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),CQ=function(e,t){return J(BZ,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`</`+i+`></`+i+`>`)}})};Z.mathrm=q(hQ,`\\mathrm`,`span`,`class="mq-roman mq-font"`),Z.mathit=q(hQ,`\\mathit`,`i`,`class="mq-font"`),Z.mathbf=q(hQ,`\\mathbf`,`b`,`class="mq-font"`),Z.mathsf=q(hQ,`\\mathsf`,`span`,`class="mq-sans-serif mq-font"`),Z.mathtt=q(hQ,`\\mathtt`,`span`,`class="mq-monospace mq-font"`),Z.underline=q(hQ,`\\underline`,`span`,`class="mq-non-leaf mq-underline"`),Z.overline=Z.bar=q(vQ(`mq-overline`),`\\overline`,`span`,`class="mq-non-leaf mq-overline"`),Z.longdiv=q(yQ,`\\longdiv`,`span`,`class="mq-non-leaf mq-longdiv"`),Z.overrightarrow=q(vQ(`mq-overarrow`),`\\overrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-right"`),Z.overleftarrow=q(vQ(`mq-overarrow`),`\\overleftarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-left"`),Z.xleftarrow=q(gQ,`\\xleftarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-left"`),Z.xrightarrow=q(gQ,`\\xrightarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-right"`),Z.overleftrightarrow=q(hQ,`\\overleftrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-both"`),Z.overarc=q(hQ,`\\overarc`,`span`,`class="mq-non-leaf mq-overarc"`),Z.dot=J(zZ,function(e,t){e.init=function(){t.init.call(this,`\\dot`,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>`)}}),Z.addmatrixrow=q(bQ,`\\addmatrixrow`,`span`,`+`),Z.addmatrixcol=q(SQ,`\\addmatrixcol`,`span`,`+`),Z.ngtr=Z[`≯`]=q(CQ(`mq-ngtr`,`≯`),`\\ngtr `,`span`,`class="mq-non-leaf mq-ngtr"`),Z.nless=Z[`≮`]=q(CQ(`mq-nless`,`≮`),`\\nless `,`span`,`class="mq-non-leaf mq-nless"`),Z.dot=q(xQ,`\\dot`),Z.parallelogram=q(CQ(`mq-parallelogram`,`▱`),`\\parallelogram `,`span`,`class="mq-non-leaf mq-parallelogram"`),Z.textcolor=J(zZ,function(e,t){e.setColor=function(e){this.color=e,this.htmlTemplate=`<span class="mq-textcolor" style="color:`+e+`">&0</span>`},e.latex=function(){return`\\textcolor{`+this.color+`}{`+this.blocks[0].latex()+`}`},e.parser=function(){var e=this,n=PZ.optWhitespace,r=PZ.string,i=PZ.regex;return n.then(r(`{`)).then(i(/^[#\w\s.,()%-]*/)).skip(r(`}`)).then(function(n){return e.setColor(n),t.parser.call(e)})},e.isStyleBlock=function(){return!0}}),Z.class=J(zZ,function(e,t){e.parser=function(){var e=this,n=PZ.string,r=PZ.regex;return PZ.optWhitespace.then(n(`{`)).then(r(/^[-\w\s\\\xA0-\xFF]*/)).skip(n(`}`)).then(function(n){return e.cls=n||``,e.htmlTemplate=`<span class="mq-class `+n+`">&0</span>`,t.parser.call(e)})},e.latex=function(){return`\\class{`+this.cls+`}{`+this.blocks[0].latex()+`}`},e.isStyleBlock=function(){return!0}});var wQ=J(zZ,function(e,t){e.ctrlSeq=`_{...}^{...}`,e.createLeftOf=function(e){if(!(!this.replacedFragment&&!e[Y]&&e.options.supSubsRequireOperand))return t.createLeftOf.apply(this,arguments)},e.contactWeld=function(e){for(var t=Y;t;t=t===Y&&X)if(this[t]instanceof wQ){for(var n=`sub`;n;n=n===`sub`&&`sup`){var r=this[n],i=this[t][n];if(r){if(!i)this[t].addBlock(r.disown());else if(r.isEmpty())var a=pZ(i,0,i.ends[Y]);else{r.jQ.children().insAtDirEnd(-t,i.jQ);var o=r.children().disown(),a=pZ(i,o.ends[X],i.ends[Y]);t===Y?o.adopt(i,i.ends[X],0):o.adopt(i,0,i.ends[Y])}this.placeCursor=function(e,n){return function(r){r.insAtDirEnd(-t,e||n)}}(i,r)}}this.remove(),e&&e[Y]===this&&(t===X&&a?a[Y]?e.insRightOf(a[Y]):e.insAtLeftEnd(a.parent):e.insRightOf(this[t]));break}},CZ.p.charsThatBreakOutOfSupSub=``,e.finalizeTree=function(){this.ends[Y].write=function(e,t){if(e.options.autoSubscriptNumerals&&this===this.parent.sub){if(t===`_`)return;var n=this.chToCmd(t,e.options);return n instanceof BZ?e.deleteSelection():e.clearSelection().insRightOf(this.parent),n.createLeftOf(e.show())}e[Y]&&!e[X]&&!e.selection&&e.options.charsThatBreakOutOfSupSub.indexOf(t)>-1&&e.insRightOf(this.parent),VZ.p.write.apply(this,arguments)}},e.moveTowards=function(e,n,r){n.options.autoSubscriptNumerals&&!this.sup?n.insDirOf(e,this):t.moveTowards.apply(this,arguments)},e.deleteTowards=function(e,n){if(n.options.autoSubscriptNumerals&&this.sub){var r=this.sub.ends[-e];r instanceof BZ?r.remove():r&&r.deleteTowards(e,n.insAtDirEnd(-e,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(Y,n.insAtLeftEnd(this.sub)),this.sup&&n.insDirOf(-e,this))}else t.deleteTowards.apply(this,arguments)},e.latex=function(){function e(e,t){var n=t&&t.latex();return t?e+(n.length===1?n:`{`+(n||` `)+`}`):``}return e(`_`,this.sub)+e(`^`,this.sup)},e.addBlock=function(e){this.supsub===`sub`?(this.sup=this.upInto=this.sub.upOutOf=e,e.adopt(this,this.sub,0).downOutOf=this.sub,e.jQ=$X(`<span class="mq-sup"/>`).append(e.jQ.children()).attr(rZ,e.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=e,e.adopt(this,0,this.sup).upOutOf=this.sup,e.jQ=$X(`<span class="mq-sub"></span>`).append(e.jQ.children()).attr(rZ,e.id).appendTo(this.jQ.removeClass(`mq-sup-only`)),this.jQ.append(`<span style="display:inline-block;width:0">​</span>`));for(var t=0;t<2;t+=1)(function(e,t,n,r){e[t].deleteOutOf=function(i,a){if(a.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var o=this.ends[i];this.children().disown().withDirAdopt(i,a.parent,a[i],a[-i]).jQ.insDirOf(-i,a.jQ),a[-i]=o}e.supsub=n,delete e[t],delete e[r+`Into`],e[n][r+`OutOf`]=TQ,delete e[n].deleteOutOf,t===`sub`&&$X(e.jQ.addClass(`mq-sup-only`)[0].lastChild).remove(),this.remove()}})(this,`sub sup`.split(` `)[t],`sup sub`.split(` `)[t],`down up`.split(` `)[t])},e.reflow=function(){var e=this.jQ,t=e.prev();if(t.length){var n=e.children(`.mq-sup`);if(n.length){var r=parseInt(n.css(`font-size`)),i=n.offset().top+n.height()-t.offset().top-.7*r,a=parseInt(n.css(`margin-bottom`));n.css(`margin-bottom`,a+i)}}}});function TQ(e){var t=this.parent,n=e;do{if(n[X])return e.insLeftOf(t);n=n.parent.parent}while(n!==t);e.insRightOf(t)}Z.subscript=Z._=J(wQ,function(e,t){e.supsub=`sub`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&0</span></span><span style="display:inline-block;width:0">​</span></span>`,e.textTemplate=[`_`],e.finalizeTree=function(){this.downInto=this.sub=this.ends[Y],this.sub.upOutOf=TQ,t.finalizeTree.call(this)}}),Z.superscript=Z.supscript=Z[`^`]=J(wQ,function(e,t){e.supsub=`sup`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`^`],e.finalizeTree=function(){this.upInto=this.sup=this.ends[X],this.sup.downOutOf=TQ,t.finalizeTree.call(this)}});var EQ=J(zZ,function(e,t){e.parser=function(){for(var e=PZ.string,t=PZ.optWhitespace,n=PZ.succeed,r=LZ.block,i=this,a=i.blocks=[VZ(),VZ()],o=0;o<a.length;o+=1)a[o].adopt(i,i.ends[X],0);return t.then(e(`_`).or(e(`^`))).then(function(e){var t=a[e===`_`?0:1];return r.then(function(e){return e.children().adopt(t,t.ends[X],0),n(i)})}).many().result(i)},e.finalizeTree=function(){this.downInto=this.ends[Y],this.upInto=this.ends[X],this.ends[Y].upOutOf=this.ends[X],this.ends[X].downOutOf=this.ends[Y]}}),DQ=J(EQ,function(e,t){e.init=function(e,t){var n=`<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>`+t+`</big><span class="mq-from"><span>&0</span></span></span>`;BZ.prototype.init.call(this,e,n)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[Y].latex())+`^`+e(this.ends[X].latex())},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments),e.options.sumStartsWithNEquals&&(XZ(`n`).createLeftOf(e),cQ().createLeftOf(e))}});Z[`∑`]=Z.sum=Z.summation=q(DQ,`\\sum `,`∑`),Z[`∏`]=Z.prod=Z.product=q(DQ,`\\prod `,`∏`),Z.coprod=Z.coproduct=q(DQ,`\\coprod `,`∐`),Z[`∫`]=Z.int=Z.integral=J(DQ,function(e,t){e.init=function(){BZ.prototype.init.call(this,`\\int `,`<span class="mq-int mq-non-leaf"><big>∫</big><span class="mq-supsub mq-non-leaf"><span class="mq-sup"><span class="mq-sup-inner">&1</span></span><span class="mq-sub">&0</span><span style="display:inline-block;width:0">​</span></span></span>`)},e.createLeftOf=zZ.p.createLeftOf}),Z.lim=Z.limit=J(EQ,function(e,t){e.init=function(){BZ.prototype.init.call(this,`\\lim `,`<span class="mq-lim mq-non-leaf"><span class="mq-un-italicized">lim</span><span class="mq-approaches"><span>&0</span></span></span>`)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[Y].latex())}});var OQ=Z.over=_Z[`/`]=J(Z.frac=Z.dfrac=Z.cfrac=Z.fraction=J(zZ,function(e,t){e.ctrlSeq=`\\frac`,e.htmlTemplate=`<span class="mq-fraction mq-non-leaf"><span class="mq-numerator"><span class="mq-empty-box">&0</span></span><span class="mq-denominator"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0">​</span></span>`,e.textTemplate=[`(`,`)/(`,`)`],e.finalizeTree=function(){this.upInto=this.ends[X].upOutOf=this.ends[Y],this.downInto=this.ends[Y].downOutOf=this.ends[X]}}),function(e,t){e.createLeftOf=function(e){if(!this.replacedFragment){for(var n=e[Y];n&&!(n instanceof $||n instanceof(Z.text||oZ)||n instanceof DQ||n.ctrlSeq===`\\ `||/^[,;:]$/.test(n.ctrlSeq));)n=n[Y];n instanceof DQ&&n[X]instanceof wQ&&(n=n[X],n[X]instanceof wQ&&n[X].ctrlSeq!=n.ctrlSeq&&(n=n[X])),n!==e[Y]&&!e.isTooDeep(1)&&(this.replaces(gZ(n[X]||e.parent.ends[Y],e[Y])),e[Y]=n)}t.createLeftOf.call(this,e)}});Z.underset=J(zZ,function(e,t){e.ctrlSeq=`\\underset`,e.htmlTemplate=`<span class="mq-underset mq-overunder mq-non-leaf"><span class="mq-over">&1</span><span class="mq-under">&0</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[Y].upOutOf=this.ends[X],this.upInto=this.ends[X].downOutOf=this.ends[Y]}}),Z.overset=J(zZ,function(e,t){e.ctrlSeq=`\\overset`,e.htmlTemplate=`<span class="mq-overset mq-overunder mq-non-leaf"><span class="mq-over">&0</span><span class="mq-under">&1</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[X].upOutOf=this.ends[Y],this.upInto=this.ends[Y].downOutOf=this.ends[X]}});var kQ=Z.sqrt=Z[`√`]=J(zZ,function(e,t){e.ctrlSeq=`\\sqrt`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-sqrt-prefix">√</span><span class="mq-non-leaf mq-sqrt-stem"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt(`,`)`],e.parser=function(){return LZ.optBlock.then(function(e){return LZ.block.map(function(t){var n=AQ();return n.blocks=[e,t],e.adopt(n,0,0),t.adopt(n,e,0),n})}).or(t.parser.call(this))},e.reflow=function(){var e=this.ends[X].jQ.parent();lQ(e.prev(),1,e.innerHeight()/+e.css(`fontSize`).slice(0,-2)-.1)}});Z.hat=J(zZ,function(e,t){e.ctrlSeq=`\\hat`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-hat-prefix">^</span><span class="mq-hat-stem">&0</span></span>`,e.textTemplate=[`hat(`,`)`]});var AQ=Z.nthroot=J(kQ,function(e,t){e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">&0</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&1</span></span></span>`,e.textTemplate=[`sqrt[`,`](`,`)`],e.latex=function(){return`\\sqrt[`+this.ends[Y].latex()+`]{`+this.ends[X].latex()+`}`}}),jQ=J(zZ,function(e,t){e.init=function(e,n,r){var i=`<span class="mq-non-leaf"><span class="mq-diacritic-above">`+n+`</span><span class="mq-diacritic-stem">&0</span></span>`;t.init.call(this,e,i,r)}});Z.vec=q(jQ,`\\vec`,`→`,[`vec(`,`)`]),Z.tilde=q(jQ,`\\tilde`,`~`,[`tilde(`,`)`]),Z.lrncuberoot=J(kQ,function(e,t){e.ctrlSeq=`\\lrncuberoot`,e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">3</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt[3](`,`)`],e.latex=function(){return`\\sqrt[3]{`+this.ends[Y].latex()+`}`}}),Z.abs=J(zZ,function(e){e.ctrlSeq=`\\abs`,e.htmlTemplate=`<span class="mq-abs mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[`|`,`|`]}),Z.lrnplaceholder=J(zZ,function(e,t){e.ctrlSeq=`\\lrnplaceholder`,e.htmlTemplate=`<span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[``],e.latex=function(){return this.ends[Y].latex()}}),Z.lrnexponent=J(zZ,function(e,t){e.ctrSeq=`\\lrnexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&1</span></span></span></span>`,e.textTemplate=[``,`**`],e.latex=function(){var e=this.ends[X].latex();return e.length>1?e=`{`+e+`}`:e.length===0&&(e=`{ }`),this.ends[Y].latex()+`^`+e}}),Z.lrnsquaredexponent=J(zZ,function(e,t){e.ctrSeq=`\\lrnsquaredexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">2</span></span></span></span>`,e.textTemplate=[``,`**2`],e.latex=function(){return this.ends[Y].latex()+`^2`}}),Z.lrnsubscript=J(zZ,function(e,t){e.ctrSeq=`\\lrnsubscript`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0"> </span></span></span>`,e.textTemplate=[``,`_`],e.latex=function(){return this.ends[Y].latex()+`_`+this.ends[X].latex()}});function MQ(e,t){e.jQadd=function(){t.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(`:first`).add(this.jQ.children(`:last`)),this.contentjQ=this.jQ.children(`:eq(1)`)},e.reflow=function(){var e=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css(`fontSize`));lQ(this.delimjQs,iZ(1+.2*(e-1),1.2),1.2*e)}}var NQ=J(J(zZ,MQ),function(e,t){e.init=function(e,n,r,i,a){t.init.call(this,`\\left`+i,tZ,[n,r]),this.side=e,this.sides={},this.sides[Y]={ch:n,ctrlSeq:i},this.sides[X]={ch:r,ctrlSeq:a}},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-paren`+(this.side===X?` mq-ghost`:``)+`">`+this.sides[Y].ch+`</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren`+(this.side===Y?` mq-ghost`:``)+`">`+this.sides[X].ch+`</span></span>`,t.html.call(this)},e.latex=function(){return`\\left`+this.sides[Y].ctrlSeq+this.ends[Y].latex()+`\\right`+this.sides[X].ctrlSeq},e.matchBrack=function(e,t,n){return n instanceof NQ&&n.side&&n.side!==-t&&(!e.restrictMismatchedBrackets||PQ[this.sides[this.side].ch]===n.sides[n.side].ch||{"(":`]`,"[":`)`}[this.sides[Y].ch]===n.sides[X].ch)&&n},e.closeOpposing=function(e){e.side=0,e.sides[this.side]=this.sides[this.side],e.delimjQs.eq(this.side===Y?0:1).removeClass(`mq-ghost`).html(this.sides[this.side].ch)},e.createLeftOf=function(e){if(!this.replacedFragment){var n=e.options;if(this.sides[Y].ch===`|`)var r=this.matchBrack(n,X,e[X])||this.matchBrack(n,Y,e[Y])||this.matchBrack(n,0,e.parent.parent);else var r=this.matchBrack(n,-this.side,e[-this.side])||this.matchBrack(n,-this.side,e.parent.parent)}if(r){var i=this.side=-r.side;this.closeOpposing(r),r===e.parent.parent&&e[i]&&gZ(e[i],e.parent.ends[i],-i).disown().withDirAdopt(-i,r.parent,r,r[i]).jQ.insDirOf(i,r.jQ),r.bubble(`reflow`)}else r=this,i=r.side,r.replacedFragment?r.side=0:e[-i]&&(r.replaces(gZ(e[-i],e.parent.ends[-i],i)),e[-i]=0),t.createLeftOf.call(r,e);i===Y?e.insAtLeftEnd(r.ends[Y]):e.insRightOf(r)},e.placeCursor=oZ,e.unwrap=function(){this.ends[Y].children().disown().adopt(this.parent,this,this[X]).jQ.insertAfter(this.jQ),this.remove()},e.deleteSide=function(e,t,n){var r=this.parent,i=this[e],a=r.ends[e];if(e===this.side){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}var o=n.options,s=!this.side;if(this.side=-e,this.matchBrack(o,e,this.ends[Y].ends[this.side])){this.closeOpposing(this.ends[Y].ends[this.side]);var c=this.ends[Y].ends[e];this.unwrap(),c.siblingCreated&&c.siblingCreated(n.options,e),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r)}else{if(this.matchBrack(o,e,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else if(t&&s){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}else this.sides[e]={ch:PQ[this.sides[this.side].ch],ctrlSeq:PQ[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass(`mq-ghost`).eq(e===Y?0:1).addClass(`mq-ghost`).html(this.sides[e].ch);if(i){var c=this.ends[Y].ends[e];gZ(i,a,-e).disown().withDirAdopt(-e,this.ends[Y],c,0).jQ.insAtDirEnd(e,this.ends[Y].jQ.removeClass(`mq-empty`)),c.siblingCreated&&c.siblingCreated(n.options,e),n.insDirOf(-e,i)}else t?n.insDirOf(e,this):n.insAtDirEnd(e,this.ends[Y])}},e.deleteTowards=function(e,t){this.deleteSide(-e,!1,t)},e.finalizeTree=function(){this.ends[Y].deleteOutOf=function(e,t){this.parent.deleteSide(e,!0,t)},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(+(this.side===Y)).removeClass(`mq-ghost`),this.side=0}},e.siblingCreated=function(e,t){t===-this.side&&this.finalizeTree()}}),PQ={"(":`)`,")":`(`,"[":`]`,"]":`[`,"{":`}`,"}":`{`,"\\{":`\\}`,"\\}":`\\{`,"⟨":`⟩`,"⟩":`⟨`,"\\langle ":`\\rangle `,"\\rangle ":`\\langle `,"|":`|`,"\\lVert ":`\\rVert `,"\\rVert ":`\\lVert `};function FQ(e,t){var t=t||e,n=PQ[e],r=PQ[t];_Z[e]=q(NQ,Y,e,n,t,r),_Z[n]=q(NQ,X,e,n,t,r)}FQ(`(`),FQ(`[`),FQ(`{`,`\\{`),Z.langle=q(NQ,Y,`⟨`,`⟩`,`\\langle `,`\\rangle `),Z.rangle=q(NQ,X,`⟨`,`⟩`,`\\langle `,`\\rangle `),_Z[`|`]=q(NQ,Y,`|`,`|`,`|`,`|`),Z.lVert=q(NQ,Y,`∥`,`∥`,`\\lVert `,`\\rVert `),Z.rVert=q(NQ,X,`∥`,`∥`,`\\lVert `,`\\rVert `),Z.left=J(zZ,function(e){e.parser=function(){var e=PZ.regex,t=PZ.string;PZ.succeed;var n=PZ.optWhitespace;return n.then(e(/^(?:[([|]|\\\{|\\langle(?![a-zA-Z])|\\lVert(?![a-zA-Z]))/)).then(function(r){var i=r.charAt(0)===`\\`?r.slice(1):r;return r==`\\langle`&&(i=`⟨`,r+=` `),r==`\\lVert`&&(i=`∥`,r+=` `),LZ.then(function(a){return t(`\\right`).skip(n).then(e(/^(?:[\])|]|\\\}|\\rangle(?![a-zA-Z])|\\rVert(?![a-zA-Z]))/)).map(function(e){var t=e.charAt(0)===`\\`?e.slice(1):e;e==`\\rangle`&&(t=`⟩`,e+=` `),e==`\\rVert`&&(t=`∥`,e+=` `);var n=NQ(0,i,t,r,e);return n.blocks=[a],a.adopt(n,0,0),n})})})}}),Z.right=J(zZ,function(e){e.parser=function(){return PZ.fail(`unmatched \\right`)}}),Z.choose=J(Z.binom=Z.binomial=J(J(zZ,MQ),function(e,t){e.ctrlSeq=`\\binom`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-paren mq-scaled">(</span><span class="mq-non-leaf"><span class="mq-array mq-non-leaf"><span>&0</span><span>&1</span></span></span><span class="mq-paren mq-scaled">)</span></span>`,e.textTemplate=[`choose(`,`,`,`)`]}),function(e){e.createLeftOf=OQ.prototype.createLeftOf}),Z.editable=Z.MathQuillMathField=J(zZ,function(e,t){e.ctrlSeq=`\\MathQuillMathField`,e.htmlTemplate=`<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>`,e.parser=function(){var e=this,n=PZ.string,r=PZ.regex,i=PZ.succeed;return n(`[`).then(r(/^[a-z][a-z0-9]*/i)).skip(n(`]`)).map(function(t){e.name=t}).or(i()).then(t.parser.call(e))},e.finalizeTree=function(e){var t=xZ(this.ends[Y],this.jQ,e);t.KIND_OF_MQ=`MathField`,t.editable=!0,t.createTextarea(),t.editablesTextareaEvents(),t.cursor.insAtRightEnd(t.root),NZ(t.root)},e.registerInnerField=function(e,t){e.push(e[this.name]=t(this.ends[Y].controller))},e.latex=function(){return this.ends[Y].latex()},e.text=function(){return this.ends[Y].text()}});var IQ=Z.embed=J(BZ,function(e,t){e.setOptions=function(e){function t(){return``}return this.text=e.text||t,this.htmlTemplate=e.htmlString||``,this.latex=e.latex||t,this},e.parser=function(){var e=this,t=PZ.string,n=PZ.regex,r=PZ.succeed;return t(`{`).then(n(/^[a-z][a-z0-9]*/i)).skip(t(`}`)).then(function(i){return t(`[`).then(n(/^[-\w\s]*/)).skip(t(`]`)).or(r()).map(function(t){return e.setOptions(EZ[i](t))})})}});Z.MathQuillResponseContainer=J(zZ,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainer`,e.htmlTemplate=`<span class="lrn-mq-response-container"><marker class="lrn-qe-keyboard-i-response"></marker><content>Response</content></span>`,e.latex=function(){return`\\MathQuillResponseContainer`},e.text=function(){return this.ends[Y].text()}}),Z.MathQuillResponseContainerIcon=J(zZ,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainerIcon`,e.htmlTemplate=`<span class="lrn-mq-response-container-icon"><span class="lrn-qe-keyboard-i-response"></span></span>`,e.latex=function(){return`\\MathQuillResponseContainerIcon`},e.text=function(){return this.ends[Y].text()}});var LQ=Z.matrix=J(zZ,function(e,t){var n=J(VZ,function(e,t){e.init=function(e,n){return this.column=e,this.row=n,t.init.call(this)},e.keystroke=function(e,n,r){switch(e){case`Shift-Spacebar`:return n.preventDefault(),this.parent.insertColumn(this);case`Shift-Enter`:return this.parent.insertRow(this)}return t.keystroke.apply(this,arguments)},e.deleteOutOf=function(e,n){var r=this,i=arguments;this.parent.backspace(this,e,n,function(){return t.deleteOutOf.apply(r,i)})}}),r={column:`&`,row:`\\\\`};e.parentheses={left:null,right:null},e.maximum={rows:5,columns:5},e.defaults={rows:2,columns:2},e.ctrlSeq=`\\matrix`,e.createBlocks=function(){var e=this,t=e.blocks=[],r,i,a=0;this.htmlTemplate.replace(/&\d+/g,function(o,s){var c=e.htmlTemplate.substring(0,s).match(/<tr[^>]*>/gi).length-1;i=r===c?i+1:0,t[a]=n(i,c),t[a].adopt(e,e.ends[X],0),r=c,a++})},e.reflow=function(){var e=this.jQ.children(`table`),t=e.outerHeight()/+e.css(`fontSize`).slice(0,-2),n=this.jQ.children(`.mq-paren`);n.length&&lQ(n,iZ(1+.2*(t-1),1.2),1.05*t)},e.latex=function(){var e=this.getMatrixName(),t=`\\begin{`+e+`}`,n,i,a;for(a=0;a<this.blocks.length;a++)n=this.blocks[a].row,i!==void 0&&(i===n?t+=r.column:t+=r.row),i=n,t+=this.blocks[a].latex();return t+=`\\end{`+e+`}`,t},e.createLeftOf=function(n){this.cursor=n;var r=Math.min(this.defaults.rows,this.maximum.rows),i=Math.min(this.defaults.columns,this.maximum.columns);this.defaultHtmlTemplate=this.defaultHtmlTemplate||this.generateHtmlTemplate(r,i),e.htmlTemplate=this.defaultHtmlTemplate,t.createLeftOf.call(this,n)},e.getMatrixName=function(){return this.ctrlSeq.replace(`\\`,``)},e.generateHtmlTemplate=function(e,t){var n=`<span class="mq-matrix mq-non-leaf">`+o(this.parentheses.left);n+=`<table class="mq-non-leaf">`,e=Math.min(e,this.maximum.rows),t=Math.min(t,this.maximum.columns);for(var r=0,i=0;i<e;i++){n+=`<tr>`;for(var a=0;a<t;a++)n+=`<td>&`+r+`</td>`,r++;n+=`</tr>`}return n+=`</table>`,n+=o(this.parentheses.right)+`</span>`,n;function o(e){return e?`<span class="mq-paren mq-scaled">`+e+`</span>`:``}},e.htmlTemplate=e.generateHtmlTemplate(1,1),e.parser=function(){var e=PZ.regex,t=this,i=this.getMatrixName(),a=RegExp(`^(.*?)\\\\end{`+i+`}`),o=RegExp(`\\\\end{`+i+`}`);return e(a).then(function(e){var i=e.replace(o,``),a=[],s=i.split(r.row),c=Math.min(s.length,t.maximum.rows),l=0,u,d;for(d=0;d<c;d++)u=s[d].split(r.column),l=Math.max(l,u.length);for(l=Math.min(l,t.maximum.columns),d=0;d<c;d++){u=s[d].split(r.column);for(var e=0;e<l;e++){var f=n(e,d);LZ.parse(u[e]||` `).children().adopt(f,f.ends[X],0),a.push(f)}}t.htmlTemplate=t.generateHtmlTemplate(c,l),t.blocks=a;for(var d=0;d<a.length;d+=1)a[d].adopt(t,t.ends[X],0);return PZ.succeed(t)})},e.finalizeTree=function(){var e=this.jQ.find(`table`);e.length&&(this.relink(),e.removeClass(function(e,t){var n=t.match(/mq-rows-\d+/g);return n&&n.join(` `)||``}),e.addClass(`mq-rows-`+e.find(`tr`).length))},e.relink=function(){var e=this.jQ.find(`td`),t=mZ.byId[e.first().attr(rZ)],n=mZ.byId[e.last().attr(rZ)],r=e.eq(0).closest(`tr`),i=[];e.each(function(t){var n=mZ.byId[$X(this).attr(rZ)],a=e.eq(t+1),o=$X(this).closest(`tr`).next(`tr`),s=$X(this).closest(`tr`).index(),c=$X(this).index(),l;if(a.length){var u=mZ.byId[a.attr(rZ)];n[X]=u,u[Y]=n}if(l=o.length?o.find(`td`).eq(c):r.find(`td`).eq(c+1),l.length){var d=mZ.byId[l.attr(rZ)];n.downOutOf=d,d.upOutOf=n}n.column=c,n.row=s,i.push(n)}),this.ends[Y]=t,this.ends[X]=n,t&&t[Y]&&delete t[Y],n&&n[X]&&delete n[X],this.blocks=i},e.deleteCell=function(e){var t=e.jQ.closest(`tr`),n=e.jQ.index(),r=t.index(),i=t.find(`td`).not(e.jQ),a=this.jQ.find(`tr`).not(t).map(function(){return $X(this).find(`td`)[n]}),o=this.jQ.find(`td`).length===1,s;function c(){return mZ.byId[$X(this).attr(rZ)].isEmpty()}return i.filter(c).length===i.length&&a.length&&(i.remove(),e.jQ.remove(),t.remove(),this.finalizeTree()),a.filter(c).length===a.length&&i.length&&(a.remove(),e.jQ.remove(),this.finalizeTree()),o||(r=Math.min(r,this.jQ.find(`tr`).length-1),n=Math.min(n,this.jQ.find(`tr`).eq(r).find(`td`).length-1),s=mZ.byId[this.jQ.find(`tr`).eq(r).find(`td`).eq(n).attr(rZ)]),s},e.addRow=function(e){if(!(this.jQ.find(`tr`).length>=this.maximum.rows)){for(var t=e.find(`td`).length,r=$X(`<tr></tr>`),i,a,o=0;o<t;o++)i=n(),i.parent=this,i.jQ=$X(`<td class="mq-empty">`).attr(rZ,i.id),r.append(i.jQ),a||=i;return r.insertAfter(e),a}},e.addColumn=function(e){if(!(e.closest(`tr`).find(`td`).length>=this.maximum.columns)){var t=e.index(),r=e.closest(`tr`).index(),i=this,a,o=[];return this.jQ.find(`tr`).each(function(){a=n(),a.parent=i,a.jQ=$X(`<td class="mq-empty">`).attr(rZ,a.id),a.jQ.insertAfter($X(this).find(`td`).eq(t)),o.push(a)}),o[r]}},e.insertColumn=function(e){newBlock=this.addColumn(e.jQ),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.insertRow=function(e){newBlock=this.addRow(e.jQ.closest(`tr`)),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.backspace=function(e,t,n,r){if(e.isEmpty()){var i=this.deleteCell(e);i?n.insAtRightEnd(i):(r(),this.finalizeTree()),this.bubble(`edited`)}}});Z.pmatrix=J(LQ,function(e,t){e.ctrlSeq=`\\pmatrix`,e.parentheses={left:`(`,right:`)`}}),Z.bmatrix=J(LQ,function(e,t){e.ctrlSeq=`\\bmatrix`,e.parentheses={left:`[`,right:`]`}}),Z.Bmatrix=J(LQ,function(e,t){e.ctrlSeq=`\\Bmatrix`,e.parentheses={left:`{`,right:`}`}}),Z.vmatrix=J(LQ,function(e,t){e.ctrlSeq=`\\vmatrix`,e.parentheses={left:`|`,right:`|`}}),Z.Vmatrix=J(LQ,function(e,t){e.ctrlSeq=`\\Vmatrix`,e.parentheses={left:`‖`,right:`‖`}});var RQ=jZ(3);for(var zQ in RQ)(function(e,t){typeof t==`function`?(OZ[e]=function(){return DZ(),t.apply(this,arguments)},OZ[e].prototype=t.prototype):OZ[e]=t})(zQ,RQ[zQ]);var BQ=function(e){e.registerEmbed(`newLine`,()=>({htmlString:`<div class="newLine"></div>`,text:()=>`testText`,latex:()=>`\\embed{newLine}[]`}))},VQ;typeof window<`u`&&(VQ=OZ.getInterface(3),VQ&&VQ.registerEmbed&&BQ(VQ));var HQ=md(`math-input:mq:input`),UQ=L(`span`)({}),WQ=class extends M.Component{static propTypes={className:k.string,onClick:k.func,onChange:k.func,latex:k.string,onFocus:k.func,onBlur:k.func};componentDidMount(){if(!VQ)throw Error(`MQ is not defined - but component has mounted?`);this.mathField=VQ.MathField(this.input,{handlers:{edit:this.onInputEdit.bind(this)}}),this.updateLatex()}componentDidUpdate(){this.updateLatex()}updateLatex(){if(!this.mathField)return;let{latex:e}=this.props;e!=null&&this.mathField.latex(e)}clear(){return this.mathField.latex(``),``}blur(){HQ(`blur mathfield`),this.mathField.blur()}focus(){HQ(`focus mathfield...`),this.mathField.focus()}command(e){return HQ(`command: `,e),Array.isArray(e)?e.forEach(e=>{this.mathField.cmd(e)}):this.mathField.cmd(e),this.mathField.focus(),this.mathField.latex()}keystroke(e){return this.mathField.keystroke(e),this.mathField.focus(),this.mathField.latex()}write(e){return HQ(`write: `,e),this.mathField.write(e),this.mathField.focus(),this.mathField.latex()}onInputEdit=()=>{HQ(`[onInputEdit] ...`);let{onChange:e}=this.props;this.mathField&&e&&e(this.mathField.latex())};refresh=()=>{this.blur(),this.focus()};onKeyPress=e=>{if(Object.keys(this.mathField.__controller.options).indexOf(`ignoreNextMousedown`)<0&&this.refresh(),e.charCode===13){e.preventDefault();return}};onClick=e=>{let{onClick:t}=this.props;this.refresh(),t&&t(e)};shouldComponentUpdate(e){return HQ(`next: `,e.latex),HQ(`current: `,this.mathField.latex()),e.latex!==this.mathField.latex()}render(){let{onFocus:e,onBlur:t,className:n}=this.props;return(0,N.jsx)(UQ,{className:n,onKeyDown:this.onKeyPress,onClick:this.onClick,onFocus:e,onBlur:t,ref:e=>this.input=e})}},GQ=md(`pie-lib:math-input:mq:static`),KQ=/\\MathQuillMathField\[r\d*\]\{(.*?)\}/g,qQ=/ /g;function JQ(e=``){return e.replace(qQ,``)}function YQ(e){let t=0;for(let n=0;n<(e||``).length;n++)e[n]===`{`&&t++;return t}var XQ=class extends M.Component{static propTypes={latex:k.string.isRequired,onFocus:k.func,onBlur:k.func,className:k.string,getFieldName:k.func,onSubFieldChange:k.func,onSubFieldFocus:k.func,setInput:k.func};static defaultProps={getFieldName:()=>{}};constructor(e){super(e),this.state={announcement:``,previousLatex:``,inputSource:null,isDeleteKeyPressed:!1},this.inputRef=M.createRef()}componentDidMount(){this.update(),LX(),this.createLiveRegion(),this.addEventListeners()}componentDidUpdate(){this.update(),LX()}componentWillUnmount(){this.removeLiveRegion(),this.removeEventListeners()}createLiveRegion=()=>{this.liveRegion=document.createElement(`div`),this.liveRegion.style.position=`absolute`,this.liveRegion.style.width=`1px`,this.liveRegion.style.height=`1px`,this.liveRegion.style.marginTop=`-1px`,this.liveRegion.style.clip=`rect(1px, 1px, 1px, 1px)`,this.liveRegion.style.overflow=`hidden`,this.liveRegion.setAttribute(`aria-live`,`polite`),this.liveRegion.setAttribute(`aria-atomic`,`true`),document.body.appendChild(this.liveRegion)};addEventListeners=()=>{let e=this.inputRef.current;e&&(e.addEventListener(`keydown`,this.handleKeyDown),e.addEventListener(`click`,this.handleMathKeyboardClick))};removeEventListeners=()=>{let e=this.inputRef.current;e&&(e.removeEventListener(`keydown`,this.handleKeyDown),e.removeEventListener(`click`,this.handleMathKeyboardClick))};removeLiveRegion=()=>{this.liveRegion&&=(document.body.removeChild(this.liveRegion),null)};handleKeyDown=e=>{(e?.key===`Backspace`||e?.key===`Delete`)&&this.setState({isDeleteKeyPressed:!0}),this.setState({inputSource:`keyboard`})};handleMathKeyboardClick=()=>{this.setState({inputSource:`mathKeyboard`})};onInputEdit=e=>{if(!this.mathField||this._isProgrammaticUpdate)return;let t=this.props.getFieldName(e,this.mathField.innerFields);if(this.props.onSubFieldChange){let n=e.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.inputRef?.current&&n&&n?.length)try{e.__controller.cursor.insLeftOf(e.__controller.cursor.parent[-1].parent),e.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}else this.props.onSubFieldChange(t,e.latex())}this.announceLatexConversion(e.latex())};announceLatexConversion=e=>{if(!this.state){console.error(`State is not initialized`);return}let{previousLatex:t,inputSource:n,isDeleteKeyPressed:r}=this.state,i=`Converted to math symbol`;if(n===`keyboard`&&!r)if(YQ(e)>YQ(t))this.announceMessage(i);else try{this.mathField.parseLatex(t),this.mathField.parseLatex(e),e==t&&this.announceMessage(i)}catch(e){console.warn(`Error parsing latex:`,e.message),console.warn(e)}(this.state.previousLatex!==e||this.state.isDeleteKeyPressed)&&this.setState({previousLatex:e,isDeleteKeyPressed:!1})};announceMessage=e=>{this.setState({previousLatex:``}),this.liveRegion&&(this.liveRegion.textContent=e,setTimeout(()=>{this.liveRegion.textContent=``},500))};update=()=>{if(!VQ)throw Error(`MQ is not defined - but component has mounted?`);this.mathField||=VQ.StaticMath(this.inputRef?.current,{handlers:{edit:this.onInputEdit.bind(this)}});try{this._isProgrammaticUpdate=!0,this.mathField.parseLatex(this.props.latex),this.mathField.latex(this.props.latex)}catch{this.mathField.latex(`\\MathQuillMathField[r1]{}`)}finally{this._isProgrammaticUpdate=!1}};blur=()=>{GQ(`blur mathfield`),this.mathField.blur()};focus=()=>{GQ(`focus mathfield...`),this.mathField.focus()};shouldComponentUpdate(e){try{let t=JQ(this.mathField.parseLatex(e.latex)),n=(e.latex.match(KQ)||[]).length,r=t!==JQ(this.mathField.latex().trim())||n!==Object.keys(this.mathField.innerFields).length/2;return GQ(`[shouldComponentUpdate] `,r),r}catch(e){return console.warn(`Error parsing latex:`,e.message,`skip update`),console.warn(e),!1}}onFocus=e=>{try{let t=e.target.parentElement.nextSibling,n=parseInt(t.getAttribute(`mathquill-block-id`),10);n||=(t=t.parentElement,parseInt(t.getAttribute(`mathquill-block-id`),10));let r=this.mathField.innerFields.find(e=>e.id===n);if(r){let e=this.props.getFieldName(r,this.mathField.innerFields);this.props.setInput&&this.props.setInput(r),this.props.onSubFieldFocus(e,r)}}catch(e){console.error(`error finding root block`,e.message)}};render(){let{onBlur:e,className:t}=this.props;return(0,N.jsx)(`span`,{className:t,onFocus:this.onFocus,onBlur:e,ref:this.inputRef})}},ZQ={fontFamily:`MJXZERO, MJXTEX !important`,"-webkit-font-smoothing":`antialiased !important`,"& .mq-math-mode > span > var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode span var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode .mq-nonSymbola":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode > span > var.mq-operator-name":{fontFamily:`MJXZERO, MJXTEX !important`}},QQ={"& .mq-longdiv-inner":{marginTop:`-1px`,marginLeft:`5px !important;`,"& > .mq-empty":{padding:`0 !important`,marginLeft:`0px !important`,marginTop:`2px`}},"& .mq-math-mode .mq-longdiv":{display:`inline-flex !important`}},$Q={"& .mq-math-mode sup.mq-nthroot":{fontSize:`70% !important`,verticalAlign:`0.5em !important`,paddingRight:`0.15em`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-supsub ":{fontSize:`70.7%`},"& .mq-math-mode .mq-supsub.mq-sup-only":{verticalAlign:`-0.1em !important`,"& .mq-sup":{marginBottom:`0px !important`}},"& .mq-math-mode .mq-fraction + .mq-supsub.mq-sup-only":{verticalAlign:`0.4em !important`},"& .mq-math-mode .mq-supsub.mq-sup-only.mq-after-fraction-group":{verticalAlign:`0.4em !important`}},e$={"& *":{...ZQ,...QQ,"& .mq-math-mode .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-longdiv-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-math-mode .mq-sqrt-stem":{marginTop:`-5px`,paddingTop:`4px`},"& .mq-math-mode .mq-paren":{verticalAlign:`middle !important`},"& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ":{padding:`0 !important`}}},t$={commonMqFontStyles:ZQ,longdivStyles:QQ,supsubStyles:$Q,commonMqKeyboardStyles:e$},n$=e=>(de(5-e.length,()=>e.push([])),fe.apply(null,e)),r$=md(`pie-lib:math-inline:keypad`),i$=L(XQ)(({latex:e})=>{let t={pointerEvents:`none`,textTransform:`none !important`,color:lu(),"& .mq-scaled.mq-sqrt-prefix":{transform:`scale(1, 0.9) !important`},"& .mq-sup-only .mq-sup":{marginBottom:`0.9px !important`},"& .mq-empty":{backgroundColor:`${rd()} !important`},"& .mq-overline .mq-overline-inner":{borderTop:`2px solid black`},"& .mq-non-leaf.mq-overline":{borderTop:`none !important`},"& .mq-overarrow":{width:`30px`,marginTop:`0 !important`,borderTop:`2px solid black`,fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`,"&.mq-arrow-both":{top:`0px !important`,"& *":{lineHeight:`1 !important`,borderTop:`none !important`},"&:before":{fontSize:`80%`,left:`calc(-13%) !important`,top:`-0.31em !important`},"&:after":{fontSize:`80% !important`,right:`calc(-13%) !important`,top:`-1.5em`},"&.mq-empty:before":{fontSize:`80%`,left:`calc(-13%)`,top:`-0.26em`},"&.mq-empty:after":{fontSize:`80%`,right:`calc(-13%)`,top:`-0.26em`},"&.mq-empty":{minHeight:`1.4em`}},"&.mq-arrow-right:before":{fontSize:`80%`,right:`calc(-13%) !important`,top:`-0.26em !important`},"& .mq-overarrow-inner":{border:`none !important`},"& .mq-overarrow-inner .mq-overarrow-inner-right":{display:`none !important`}},"& .mq-root-block":{padding:`5px !important`},"& .mq-overarrow.mq-arrow-both.mq-empty:after":{right:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-right.mq-empty:before":{right:`-5px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-both.mq-empty:before":{left:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},"& .mq-overarc":{borderTop:`2px solid black !important`,"& .mq-overline":{borderTop:`none !important`},"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`}}};return e===`\\parallel`?{...t,fontStyle:`italic !important`}:e===`\\overleftrightarrow{\\overline{}}`?{...t,"& .mq-overarrow.mq-arrow-both":{"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`},"&:after":{position:`absolute !important`,top:`0px !important`}}}:t});i$.propTypes={latex:k.string.isRequired};var a$=e=>e?{gridTemplateColumns:`repeat(${e.columns}, minmax(min-content, 150px))`,gridTemplateRows:`repeat(${e.rows}, minmax(40px, 60px))`,gridAutoFlow:`initial`}:{},o$=L(`div`)(()=>({...e$,width:`100%`,display:`grid`,gridTemplateRows:`repeat(5, minmax(40px, 60px))`,gridRowGap:`0px`,gridColumnGap:`0px`,gridAutoFlow:`column`,"&.character":{textTransform:`initial !important`,gridTemplateRows:`repeat(5, minmax(40px, 50px)) !important`},"&.language":{gridTemplateRows:`repeat(4, minmax(40px, 50px)) !important`,"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),s$=L(Ef)(({category:e,isDelete:t,isComma:n,isDot:r})=>({minWidth:`auto`,textTransform:`none`,fontSize:n||r?`200% !important`:`140% !important`,lineHeight:n||r?`100%`:`normal`,color:lu(),backgroundColor:e===`operators`?nd():td(),"&:hover":{backgroundColor:e===`operators`?ad():id()},borderRadius:0,...t&&{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),c$=L(Ef)(({category:e})=>({textTransform:`none`,padding:0,margin:0,fontSize:`110% !important`,minWidth:`auto`,borderRadius:0,backgroundColor:e===`operators`?nd():td(),"&:hover":{backgroundColor:e===`operators`?ad():id()}})),l$=L(Zq)(({category:e})=>({minWidth:`auto`,backgroundColor:e===`operators`?nd():td(),"&:hover":{backgroundColor:e===`operators`?ad():id()},borderRadius:0,"& .icon":{height:`30px`}})),u$=class extends M.Component{static propTypes={className:k.string,controlledKeypadMode:k.bool,baseSet:k.array,additionalKeys:k.array,layoutForKeyPad:k.object,onPress:k.func.isRequired,onFocus:k.func,noDecimal:k.bool,setKeypadInteraction:k.func,mode:k.oneOfType([k.string,k.number])};static defaultProps={baseSet:XX,noDecimal:!1};constructor(e){super(e),this.keypadRef=M.createRef()}componentDidMount(){let e=this.keypadRef?.current,t=e?.closest(`.main-container`),n=e?.closest(`.pie-toolbar`);if(this.props.controlledKeypadMode&&t&&n){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect(),i=e.top+e.height-(r.top+r.height);if(i<0){let n=e.height+e.top-i;t&&(t.style.height=`${n}px`)}}e&&(e.addEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.addEventListener(`mousedown`,this.handleKeypadInteraction,!0))}componentWillUnmount(){let e=this.keypadRef?.current;if(this.props.controlledKeypadMode&&e){let t=e.closest(`.main-container`);t&&(t.style.height=`unset`)}e&&(e.removeEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.removeEventListener(`mousedown`,this.handleKeypadInteraction,!0))}handleKeypadInteraction=()=>{this.props.setKeypadInteraction&&this.props.setKeypadInteraction(!0)};buttonClick=e=>{r$(`[buttonClick]`,e);let{onPress:t}=this.props;t(e)};flowKeys=(e,t)=>ae([...n$(e),...n$(t)]);keyIsNotAllowed=e=>{let{noDecimal:t}=this.props;return!!((e.write===`.`&&e.label===`.`||e.write===`,`&&e.label===`,`)&&t)};render(){let{className:e,baseSet:t,additionalKeys:n,layoutForKeyPad:r,onFocus:i,mode:a}=this.props,o=[`non-negative-integers`,`integers`,`decimals`,`fractions`,`item-authoring`,`language`].includes(a),s=o?this.flowKeys([],n||[]):this.flowKeys(t,n||[]),c=s.length%5?1:0,l={gridTemplateColumns:`repeat(${Math.floor(s.length/5)+c}, minmax(min-content, 150px))`,...a$(r)};return(0,N.jsx)(o$,{ref:this.keypadRef,className:[e,a].filter(Boolean).join(` `),style:l,onFocus:i,children:s.map((e,t)=>{let n=this.buttonClick.bind(this,e);if(!e)return(0,N.jsx)(`span`,{},`empty-${t}`);let r={onClick:n,disabled:this.keyIsNotAllowed(e),key:`${e.label||e.latex||e.command}-${t}`,...e.actions||{},...e.extraProps||{}};if(e.latex)return(0,N.jsx)(c$,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:(0,N.jsx)(i$,{latex:e.latex})},r.key);if(e.label)return(0,N.jsx)(s$,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,isDelete:e.label===`⌫`,isComma:e.label===`,`,isDot:e.label===`.`,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:e.label},r.key);{let t=e.icon?e.icon:`div`;return(0,N.jsx)(l$,{tabIndex:`-1`,onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,size:`large`,...e.actions||{},...e.extraProps||{},children:(0,N.jsx)(t,{className:`icon`})},r.key)}})})}},d$=e=>{if(e.command)return{value:e.command,type:`command`};if(e.write)return{value:e.write};if(e.keystroke)return{type:`cursor`,value:e.keystroke}},f$=class extends M.Component{static propTypes={className:k.string,controlledKeypadMode:k.bool,mode:k.oneOfType([k.string,k.number]),layoutForKeyPad:k.object,onClick:k.func.isRequired,onFocus:k.func,noDecimal:k.bool,additionalKeys:k.array,setKeypadInteraction:k.func};static defaultProps={mode:`scientific`,noDecimal:!1,additionalKeys:[]};keypadPress=e=>{let{onClick:t}=this.props;t(d$(e))};render(){let{mode:e,onFocus:t,controlledKeypadMode:n,noDecimal:r,className:i,additionalKeys:a,layoutForKeyPad:o,setKeypadInteraction:s}=this.props,c=IX(a);return(0,N.jsx)(u$,{className:i,controlledKeypadMode:n,onFocus:t,noDecimal:r,layoutForKeyPad:o,additionalKeys:MJ(PX(e),c),onPress:this.keypadPress,mode:e,setKeypadInteraction:s})}},p$=L(`span`)(()=>({display:`inline-flex`,border:`1px solid ${Iu()}`,margin:`1px 5px`,cursor:`pointer`,alignItems:`center`,justifyContent:`center`,minWidth:`50px`,minHeight:`36px`,height:`fit-content`})),m$=L(`div`)(()=>({background:ju(),color:lu(),display:`inline-flex`,borderRight:`2px solid ${Iu()}`,boxSizing:`border-box`,overflow:`hidden`,fontSize:`12px`,minHeight:`36px`,height:`100%`,alignItems:`center`,fontFamily:`Symbola, Times New Roman, serif`,padding:`0 2px`})),h$=L(`div`)(()=>({flex:8,color:`var(--pie-text, black)`,padding:`4px !important`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`var(--pie-background, rgba(255, 255, 255, 0))`,"& > .mq-math-mode sup.mq-nthroot":{fontSize:`70% !important`,verticalAlign:`1em !important`},"& > .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-overarrow-inner":{paddingTop:`0 !important`,border:`none !important`},"& .mq-overarrow.mq-arrow-both":{marginTop:`0px`,minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`0px !important`,position:`absolute !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`}})),g$=e=>{let{node:t,options:n,selected:r}=e,{attrs:i}=t,{value:a,index:o}=i,s=`R ${parseInt(o)+1}`;return(0,N.jsx)(vM,{className:`math-templated`,"data-selected":r,style:{display:`inline-flex`,minHeight:`36px`,minWidth:`50px`,cursor:`pointer`},children:(0,N.jsxs)(p$,{...i,children:[(0,N.jsx)(m$,{children:s}),(0,N.jsx)(h$,{children:(0,N.jsx)(XQ,{latex:a})})]})})};g$.propTypes={attributes:k.object,value:k.string,keyToDisplay:k.string};var _$={},v$=e=>String(e||``).replace(/-/g,`_`),y$=e=>e&&e.attrs&&e.attrs.index!=null?String(e.attrs.index):null,b$=(e,t)=>{let n=[];return e.descendants((e,r)=>{if(e.type&&e.type.name===t){let t=y$(e);t!=null&&n.push({index:t,pos:r,node:e})}return!0}),n},x$=(e,t)=>{let n=0;return e.descendants(e=>(e.type&&e.type.name===t&&(n+=1),!0)),n},S$=({schema:e,typeName:t,index:n})=>{let r=e.nodes[t];return r?r.create({index:String(n),id:String(n),value:``}):null},C$=(e,t)=>{let n=e.resolve(Math.min(t,e.content.size));return U.near(n,1)},w$=CA.create({name:`responseArea`,addOptions(){return{maxResponseAreas:null,error:null,options:null,respAreaToolbar:null,onHandleAreaChange:null}},addProseMirrorPlugins(){if(!this.options.type)return[];let e=v$(this.options.type);return[new Db({key:new Ab(`response-area-watcher:${e}`),view:t=>(_$[e]===void 0&&(_$[e]=0,t.state.doc.descendants(t=>{if(t.type&&t.type.name===e){let n=y$(t);if(n!=null){let t=parseInt(n,10);!Number.isNaN(t)&&t>_$[e]&&(_$[e]=t)}}return!0})),{update:(t,n)=>{let r=t.state;if(n.doc.eq(r.doc))return;let i=b$(r.doc,e),a=b$(n.doc,e);if(this.options.toolbar&&(this.options.toolbar.disabled=i.length>=this.options.maxResponseAreas),a.length>i.length){let e=new Set(i.map(e=>e.index)),t=a.filter(t=>!e.has(t.index));t.length&&typeof this.options.onHandleAreaChange==`function`&&this.options.onHandleAreaChange(t)}}})})]},addCommands(){return{insertResponseArea:e=>({tr:t,state:n,dispatch:r,commands:i})=>{let a=v$(e);if(x$(n.doc,a)>=this.options.maxResponseAreas)return!1;_$[a]===void 0&&(_$[a]=0);let o=_$[a]+1;_$[a]+=1;let s=S$({schema:n.schema,typeName:a,index:o});if(!s)return!1;let{selection:c}=n,l=c.from,u=e=>{try{return t.insert(e,s),e}catch{return null}},d=u(l);if(d??=u(t.doc.content.size),d==null)return!1;if([`inline_dropdown`,`explicit_constructed_response`].includes(a))t.setSelection(W.create(t.doc,d));else{let e=d+s.nodeSize;t.setSelection(C$(t.doc,e))}return r&&(i.focus(),r(t)),!0},refreshResponseArea:()=>({tr:e,state:t,commands:n,dispatch:r})=>{let{selection:i}=t,a=i.$from.nodeAfter,o=i.from;return e.setNodeMarkup(o,void 0,{...a?.attrs,updated:`${Date.now()}`}),e.setSelection(W.create(e.doc,o)),r&&(n.focus(),r(e)),!0}}}}),T$=$A.create({name:`explicit_constructed_response`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="explicit_constructed_response"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`explicit_constructed_response`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return EM(e=>(0,N.jsx)(uJ,{...e,options:this.options}))}}),E$=$A.create({name:`math_templated`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="math_templated"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`math_templated`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return EM(e=>(0,N.jsx)(g$,{...e,options:this.options}))}}),D$=$A.create({name:`drag_in_the_blank`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},id:{default:null},value:{default:``},inTable:{default:null},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="drag_in_the_blank"]`,getAttrs:e=>({index:e.dataset.index,id:e.dataset.id,value:e.dataset.value,inTable:e.dataset.inTable})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`drag_in_the_blank`,"data-index":e.index,"data-id":e.id,"data-value":e.value,"data-in-table":e.inTable}]},addNodeView(){return EM(e=>(0,N.jsx)(xJ,{...e,options:this.options}))}}),O$=$A.create({name:`inline_dropdown`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="inline_dropdown"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`inline_dropdown`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return EM(e=>(0,N.jsx)(SJ,{...e,options:this.options}))}}),k$=mi(`MuiDivider`,[`root`,`absolute`,`fullWidth`,`inset`,`middle`,`flexItem`,`light`,`vertical`,`withChildren`,`withChildrenVertical`,`textAlignRight`,`textAlignLeft`,`wrapper`,`wrapperVertical`]),A$=mi(`MuiListItemIcon`,[`root`,`alignItemsFlexStart`]);function j$(e){return F(`MuiTypography`,e)}mi(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`,`paragraph`]);var M$={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},N$=uc(),P$=e=>{let{align:t,gutterBottom:n,noWrap:r,paragraph:i,variant:a,classes:o}=e;return Fa({root:[`root`,a,e.align!==`inherit`&&`align${z(t)}`,n&&`gutterBottom`,r&&`noWrap`,i&&`paragraph`]},j$,o)},F$=L(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${z(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(ol(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${z(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),I$={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},L$=M.forwardRef(function(e,t){let{color:n,...r}=dc({props:e,name:`MuiTypography`}),i=!M$[n],a=N$({...r,...i&&{color:n}}),{align:o=`inherit`,className:s,component:c,gutterBottom:l=!1,noWrap:u=!1,paragraph:d=!1,variant:f=`body1`,variantMapping:p=I$,...m}=a,h={...a,align:o,color:n,className:s,component:c,gutterBottom:l,noWrap:u,paragraph:d,variant:f,variantMapping:p},g=c||(d?`p`:p[f]||I$[f])||`span`,_=P$(h);return(0,N.jsx)(F$,{as:g,ref:t,className:P(_.root,s),...m,ownerState:h,style:{...o!==`inherit`&&{"--Typography-textAlign":o},...m.style}})}),R$=mi(`MuiListItemText`,[`root`,`multiline`,`dense`,`inset`,`primary`,`secondary`]);function z$(e){return F(`MuiMenuItem`,e)}var B$=mi(`MuiMenuItem`,[`root`,`focusVisible`,`dense`,`disabled`,`divider`,`gutters`,`selected`]);function V$(e){return F(`MuiNativeSelect`,e)}var H$=mi(`MuiNativeSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]),U$=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return Fa({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${z(n)}`,a&&`iconOpen`,r&&`disabled`]},V$,t)},W$=L(`select`,{name:`MuiNativeSelect`})(({theme:e})=>({MozAppearance:`none`,WebkitAppearance:`none`,userSelect:`none`,borderRadius:0,cursor:`pointer`,"&:focus":{borderRadius:0},[`&.${H$.disabled}`]:{cursor:`default`},"&[multiple]":{height:`auto`},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(e.vars||e).palette.background.paper},variants:[{props:({ownerState:e})=>e.variant!==`filled`&&e.variant!==`outlined`,style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:`filled`},style:{"&&&":{paddingRight:32}}},{props:{variant:`outlined`},style:{borderRadius:(e.vars||e).shape.borderRadius,"&:focus":{borderRadius:(e.vars||e).shape.borderRadius},"&&&":{paddingRight:32}}}]})),G$=L(W$,{name:`MuiNativeSelect`,slot:`Select`,shouldForwardProp:Xo,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.select,t[n.variant],n.error&&t.error,{[`&.${H$.multiple}`]:t.multiple}]}})({}),K$=L(`svg`,{name:`MuiNativeSelect`})(({theme:e})=>({position:`absolute`,right:0,top:`calc(50% - .5em)`,pointerEvents:`none`,color:(e.vars||e).palette.action.active,[`&.${H$.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:e})=>e.open,style:{transform:`rotate(180deg)`}},{props:{variant:`filled`},style:{right:7}},{props:{variant:`outlined`},style:{right:7}}]})),q$=L(K$,{name:`MuiNativeSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${z(n.variant)}`],n.open&&t.iconOpen]}})({}),J$=M.forwardRef(function(e,t){let{className:n,disabled:r,error:i,IconComponent:a,inputRef:o,variant:s=`standard`,...c}=e,l={...e,disabled:r,variant:s,error:i},u=U$(l);return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(G$,{ownerState:l,className:P(u.select,n),disabled:r,ref:o||t,...c}),e.multiple?null:(0,N.jsx)(q$,{as:a,ownerState:l,className:u.icon})]})});function Y$(e){return F(`MuiSelect`,e)}var X$=mi(`MuiSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`focused`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]);function Z$(e){return e?e.type===`mousedown`||e.type===`pointerdown`||e.type===`touchstart`?`pointer`:e.type===`keydown`||e.type===`click`&&e.detail===0?`keyboard`:null:null}function Q$(e){return e==null||typeof e==`string`&&!e.trim()}function $$(e,t){return typeof t==`object`&&t?e===t:String(e)===String(t)}var e1=M.createContext(null);function t1(){return M.useContext(e1)}var n1=e1.Provider,r1,i1=L(W$,{name:`MuiSelect`,slot:`Select`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`&.${X$.select}`]:t.select},{[`&.${X$.select}`]:t[n.variant]},{[`&.${X$.error}`]:t.error},{[`&.${X$.multiple}`]:t.multiple}]}})({[`&.${X$.select}`]:{height:`auto`,minHeight:`1.4375em`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`}}),a1=L(K$,{name:`MuiSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${z(n.variant)}`],n.open&&t.iconOpen]}})({}),o1=L(`input`,{shouldForwardProp:e=>Yo(e)&&e!==`classes`,name:`MuiSelect`,slot:`NativeInput`})({bottom:0,left:0,position:`absolute`,opacity:0,pointerEvents:`none`,width:`100%`,boxSizing:`border-box`}),s1=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return Fa({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${z(n)}`,a&&`iconOpen`,r&&`disabled`],nativeInput:[`nativeInput`]},Y$,t)},c1=M.forwardRef(function(e,t){let{"aria-describedby":n,"aria-label":r,autoFocus:i,autoWidth:a,children:o,className:s,defaultOpen:c,defaultValue:l,disabled:u,displayEmpty:d,error:f=!1,IconComponent:p,inputRef:m,labelId:h,MenuProps:g={},multiple:_,name:v,onBlur:y,onChange:b,onClose:x,onFocus:S,onKeyDown:C,onMouseDown:w,onOpen:T,open:E,readOnly:D,renderValue:O,required:ee,SelectDisplayProps:te={},tabIndex:k,type:A,value:ne,variant:j=`standard`,...re}=e,[ie,ae]=Kl({controlled:ne,default:l,name:`Select`}),[oe,se]=Kl({controlled:E,default:c,name:`Select`}),ce=M.useRef(null),le=M.useRef(null),[ue,de]=M.useState(null),{current:fe}=M.useRef(E!=null),[me,he]=M.useState(),[ge,_e]=M.useState(null),ve=kc(t,m),ye=M.useCallback(e=>{le.current=e,e&&de(e)},[]),be=ue?.parentNode;M.useImperativeHandle(ve,()=>({focus:()=>{le.current.focus()},node:ce.current,value:ie}),[ie]);let xe=ue!==null&&oe;M.useEffect(()=>{if(!xe||!be||a||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{he(be.clientWidth)});return e.observe(be),()=>{e.disconnect()}},[xe,be,a]),M.useEffect(()=>{c&&oe&&ue&&!fe&&(he(a?null:be.clientWidth),le.current.focus())},[ue,a]),M.useEffect(()=>{i&&le.current.focus()},[i]),M.useEffect(()=>{if(!h)return;let e=hc(le.current).getElementById(h);if(e){let t=()=>{getSelection().isCollapsed&&le.current.focus()};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}},[h]);let Se=(e,t)=>{e?(_e(Z$(t)),T&&T(t)):(_e(null),x&&x(t)),fe||(he(a?null:be.clientWidth),se(e))},Ce=e=>{w?.(e),e.button===0&&(e.preventDefault(),le.current.focus(),Se(!0,e))},we=e=>{Se(!1,e)},Te=M.Children.toArray(o),Ee=e=>{let t=Te.find(t=>t.props.value===e.target.value);t!==void 0&&(ae(t.props.value),b&&b(e,t))},De=e=>t=>{let n;if(t.currentTarget.hasAttribute(`tabindex`)){if(_){n=Array.isArray(ie)?ie.slice():[];let t=ie.indexOf(e.props.value);t===-1?n.push(e.props.value):n.splice(t,1)}else n=e.props.value;if(e.props.onClick&&e.props.onClick(t),ie!==n&&(ae(n),b)){let r=t.nativeEvent||t,i=new r.constructor(r.type,r);Object.defineProperty(i,"target",{writable:!0,value:{value:n,name:v}}),b(i,e)}_||Se(!1,t)}},Oe=e=>{D||([` `,`ArrowUp`,`ArrowDown`,`Enter`].includes(e.key)&&(e.preventDefault(),Se(!0,e)),C?.(e))},ke=e=>{!xe&&y&&(Object.defineProperty(e,"target",{writable:!0,value:{value:ie,name:v}}),y(e))};delete re[`aria-invalid`];let Ae,je,Me=[],Ne=!1;(ep({value:ie})||d)&&(O?Ae=O(ie):Ne=!0);let Pe=Te.map(e=>{if(!M.isValidElement(e))return null;let t;if(_){if(!Array.isArray(ie))throw Error(pe(2));t=ie.some(t=>$$(t,e.props.value)),t&&Ne&&Me.push(e.props.children)}else t=$$(ie,e.props.value),t&&Ne&&(je=e.props.children);return M.cloneElement(e,{"aria-selected":t?`true`:`false`,onClick:De(e),onKeyUp:t=>{t.key===` `&&t.preventDefault(),e.props.onKeyUp&&e.props.onKeyUp(t)},role:`option`,selected:t,value:void 0,"data-value":e.props.value})});Ne&&(Ae=_?Me.length===0?null:Me.reduce((e,t,n)=>(e.push(t),n<Me.length-1&&e.push(`, `),e),[]):je);let Fe=me;!a&&fe&&ue&&(Fe=be.clientWidth);let Ie;Ie=k===void 0?u?null:0:k;let Le=te.id||(v?`mui-component-select-${v}`:void 0),Re={...e,variant:j,value:ie,open:xe,error:f},ze=s1(Re),Be={...g.PaperProps,...typeof g.slotProps?.paper==`function`?g.slotProps.paper(Re):g.slotProps?.paper},Ve={...g.MenuListProps,...typeof g.slotProps?.list==`function`?g.slotProps.list(Re):g.slotProps?.list},He=ca();return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(i1,{as:`div`,ref:ye,tabIndex:Ie,role:`combobox`,"aria-controls":xe?He:void 0,"aria-disabled":u?`true`:void 0,"aria-expanded":xe?`true`:`false`,"aria-haspopup":`listbox`,"aria-label":r,"aria-labelledby":[h,Le].filter(Boolean).join(` `)||void 0,"aria-describedby":n,"aria-required":ee?`true`:void 0,"aria-invalid":f?`true`:void 0,onKeyDown:Oe,onMouseDown:u||D?null:Ce,onBlur:ke,onFocus:S,...te,ownerState:Re,className:P(te.className,ze.select,s),id:Le,children:Q$(Ae)?r1||=(0,N.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):Ae}),(0,N.jsx)(o1,{"aria-invalid":f,value:Array.isArray(ie)?ie.join(`,`):ie,name:v,ref:ce,"aria-hidden":!0,onChange:Ee,tabIndex:-1,disabled:u,className:ze.nativeInput,autoFocus:i,required:ee,...re,ownerState:Re}),(0,N.jsx)(a1,{as:p,className:ze.icon,ownerState:Re}),(0,N.jsx)(n1,{value:ge,children:(0,N.jsx)(Hp,{id:`menu-${v||``}`,anchorEl:be,open:xe,onClose:we,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},...g,slotProps:{...g.slotProps,list:{"aria-labelledby":h,role:`listbox`,"aria-multiselectable":_?`true`:void 0,disableListWrap:!0,id:He,...Ve},paper:{...Be,style:{minWidth:Fe,...Be==null?null:Be.style}}},children:Pe})})]})}),l1=Vl((0,N.jsx)(`path`,{d:`M7 10l5 5 5-5z`}),`ArrowDropDown`);function u1(e){return parseInt(e,10)||0}var d1={shadow:{visibility:`hidden`,position:`absolute`,overflow:`hidden`,height:0,top:0,left:0,transform:`translateZ(0)`}};function f1(e){for(let t in e)return!1;return!0}function p1(e){return f1(e)||e.outerHeightStyle===0&&!e.overflowing}var m1=M.forwardRef(function(e,t){let{onChange:n,maxRows:r,minRows:i=1,style:a,value:o,...s}=e,{current:c}=M.useRef(o!=null),l=M.useRef(null),u=Oc(t,l),d=M.useRef(null),f=M.useRef(null),p=M.useCallback(()=>{let t=l.current,n=f.current;if(!t||!n)return;let a=gc(t).getComputedStyle(t);if(a.width===`0px`)return{outerHeightStyle:0,overflowing:!1};n.style.width=a.width,n.value=t.value||e.placeholder||`x`,n.value.slice(-1)===`
|
|
334
|
-
`&&(n.value+=` `);let o=a.boxSizing,s=
|
|
335
|
-
`),a=t.selectionStart===r;i&&a&&t.setSelectionRange(r,r),n&&n(e)},ref:u,rows:i,style:a,...s}),(0,N.jsx)(`textarea`,{"aria-hidden":!0,className:e.className,readOnly:!0,ref:f,tabIndex:-1,style:{...d1.shadow,...a,paddingTop:0,paddingBottom:0}})]})});function h1(e){return F(`MuiInputBase`,e)}var g1=mi(`MuiInputBase`,[`root`,`formControl`,`focused`,`disabled`,`adornedStart`,`adornedEnd`,`error`,`sizeSmall`,`multiline`,`colorSecondary`,`fullWidth`,`hiddenLabel`,`readOnly`,`input`,`inputSizeSmall`,`inputMultiline`,`inputTypeSearch`,`inputAdornedStart`,`inputAdornedEnd`,`inputHiddenLabel`]),_1,v1=`mui-auto-fill`,y1=`mui-auto-fill-cancel`,b1=(e,t)=>{let{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,n.size===`small`&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${z(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},x1=(e,t)=>{let{ownerState:n}=e;return[t.input,n.size===`small`&&t.inputSizeSmall,n.multiline&&t.inputMultiline,n.type===`search`&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]},S1=e=>{let{classes:t,color:n,disabled:r,error:i,endAdornment:a,focused:o,formControl:s,fullWidth:c,hiddenLabel:l,multiline:u,readOnly:d,size:f,startAdornment:p,type:m}=e;return Fa({root:[`root`,`color${z(n)}`,r&&`disabled`,i&&`error`,c&&`fullWidth`,o&&`focused`,s&&`formControl`,f&&f!==`medium`&&`size${z(f)}`,u&&`multiline`,p&&`adornedStart`,a&&`adornedEnd`,l&&`hiddenLabel`,d&&`readOnly`],input:[`input`,r&&`disabled`,m===`search`&&`inputTypeSearch`,u&&`inputMultiline`,f===`small`&&`inputSizeSmall`,l&&`inputHiddenLabel`,p&&`inputAdornedStart`,a&&`inputAdornedEnd`,d&&`readOnly`]},h1,t)},C1=L(`div`,{name:`MuiInputBase`,slot:`Root`,overridesResolver:b1})(ol(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:`1.4375em`,boxSizing:`border-box`,position:`relative`,cursor:`text`,display:`inline-flex`,alignItems:`center`,[`&.${g1.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:`default`},variants:[{props:({ownerState:e})=>e.multiline,style:{padding:`4px 0 5px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:1}},{props:({ownerState:e})=>e.fullWidth,style:{width:`100%`}}]}))),w1=L(`input`,{name:`MuiInputBase`,slot:`Input`,overridesResolver:x1})(ol(({theme:e})=>{let t=e.palette.mode===`light`,n={color:`currentColor`,...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.shorter})},r={opacity:`0 !important`},i=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:`inherit`,letterSpacing:`inherit`,color:`currentColor`,padding:`4px 0 5px`,border:0,boxSizing:`content-box`,background:`none`,height:`1.4375em`,margin:0,WebkitTapHighlightColor:`transparent`,display:`block`,minWidth:0,width:`100%`,"&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:`none`},"&::-webkit-search-decoration":{WebkitAppearance:`none`},[`label[data-shrink=false] + .${g1.formControl} &`]:{"&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&::-ms-input-placeholder":r,"&:focus::-webkit-input-placeholder":i,"&:focus::-moz-placeholder":i,"&:focus::-ms-input-placeholder":i},[`&.${g1.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:e})=>!e.disableInjectingGlobalStyles,style:{animationName:y1,animationDuration:`10ms`,"&:-webkit-autofill":{animationDuration:`5000s`,animationName:v1}}},{props:{size:`small`},style:{paddingTop:1}},{props:({ownerState:e})=>e.multiline,style:{height:`auto`,resize:`none`,padding:0,paddingTop:0}},{props:{type:`search`},style:{MozAppearance:`textfield`}}]}})),T1=lc({[`@keyframes ${v1}`]:{from:{animationName:v1}},[`@keyframes ${y1}`]:{from:{animationName:y1}}}),E1=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiInputBase`}),{"aria-describedby":r,autoComplete:i,autoFocus:a,className:o,color:s,components:c={},componentsProps:l={},defaultValue:u,disabled:d,disableInjectingGlobalStyles:f,endAdornment:p,error:m,fullWidth:h=!1,id:g,inputComponent:_=`input`,inputProps:v={},inputRef:y,margin:b,maxRows:x,minRows:S,multiline:C=!1,name:w,onBlur:T,onChange:E,onClick:D,onFocus:O,onKeyDown:ee,onKeyUp:te,placeholder:k,readOnly:A,renderSuffix:ne,rows:j,size:re,slotProps:ie={},slots:ae={},startAdornment:oe,type:se=`text`,value:ce,...le}=n,ue=v.value==null?ce:v.value,{current:de}=M.useRef(ue!=null),fe=M.useRef(),me=M.useCallback(e=>{},[]),he=kc(fe,y,v.ref,me),[ge,_e]=M.useState(!1),ve=Hf(),ye=Bf({props:n,muiFormControl:ve,states:[`color`,`disabled`,`error`,`hiddenLabel`,`size`,`required`,`filled`]});ye.focused=ve?ve.focused:ge,M.useEffect(()=>{!ve&&d&&ge&&(_e(!1),T&&T())},[ve,d,ge,T]);let be=ve&&ve.onFilled,xe=ve&&ve.onEmpty,Se=M.useCallback(e=>{ep(e)?be&&be():xe&&xe()},[be,xe]);Ul(()=>{de&&Se({value:ue})},[ue,Se,de]),Ul(()=>{if(!a)return;let e=fe.current;if(!e)return;let t=hc(e),n=qc(t),r=n==null||n===t.body||n===t.documentElement;e===n?ve&&ve.onFocus?ve.onFocus():_e(!0):r&&e.focus()},[a]);let Ce=e=>{O&&O(e),v.onFocus&&v.onFocus(e),ve&&ve.onFocus?ve.onFocus(e):_e(!0)},we=e=>{T&&T(e),v.onBlur&&v.onBlur(e),ve&&ve.onBlur?ve.onBlur(e):_e(!1)},Te=(e,...t)=>{if(!de){let t=e.target||fe.current;if(t==null)throw Error(pe(1));Se({value:t.value})}v.onChange&&v.onChange(e,...t),E&&E(e,...t)};M.useEffect(()=>{Se(fe.current)},[]);let Ee=e=>{fe.current&&e.currentTarget===e.target&&fe.current.focus(),D&&D(e)},De=_,Oe=v;C&&De===`input`&&(Oe=j?{type:void 0,minRows:j,maxRows:j,...Oe}:{type:void 0,maxRows:x,minRows:S,...Oe},De=m1);let ke=e=>{Se(e.animationName===y1?fe.current:{value:`x`})};M.useEffect(()=>{ve&&ve.setAdornedStart(!!oe)},[ve,oe]);let Ae={...n,color:ye.color||`primary`,disabled:ye.disabled,endAdornment:p,error:ye.error,focused:ye.focused,formControl:ve,fullWidth:h,hiddenLabel:ye.hiddenLabel,multiline:C,size:ye.size,startAdornment:oe,type:se},je=S1(Ae),Me=ae.root||c.Root||C1,Ne=ie.root||l.root||{},Pe=ae.input||c.Input||w1;return Oe={...Oe,...ie.input??l.input},(0,N.jsxs)(M.Fragment,{children:[!f&&typeof T1==`function`&&(_1||=(0,N.jsx)(T1,{})),(0,N.jsxs)(Me,{...Ne,ref:t,onClick:Ee,...le,...!sc(Me)&&{ownerState:{...Ae,...Ne.ownerState}},className:P(je.root,Ne.className,o,A&&`MuiInputBase-readOnly`),children:[oe,(0,N.jsx)(Vf.Provider,{value:null,children:(0,N.jsx)(Pe,{"aria-invalid":ye.error,"aria-describedby":r,autoComplete:i,autoFocus:a,defaultValue:u,disabled:ye.disabled,id:g,onAnimationStart:ke,name:w,placeholder:k,readOnly:A,required:ye.required,rows:j,value:ue,onKeyDown:ee,onKeyUp:te,type:se,...Oe,...!sc(Pe)&&{as:De,ownerState:{...Ae,...Oe.ownerState}},ref:he,className:P(je.input,Oe.className,A&&`MuiInputBase-readOnly`),onBlur:we,onChange:Te,onFocus:Ce})}),p,ne?ne({...ye,startAdornment:oe}):null]})]})});function D1(e){return F(`MuiInput`,e)}var O1={...g1,...mi(`MuiInput`,[`root`,`underline`,`input`])},k1=e=>{let{classes:t,disableUnderline:n}=e,r=Fa({root:[`root`,!n&&`underline`],input:[`input`]},D1,t);return{...t,...r}},A1=L(C1,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...b1(e,t),!n.disableUnderline&&t.underline]}})(ol(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`;return e.vars&&(t=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:`relative`,variants:[{props:({ownerState:e})=>e.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:`""`,position:`absolute`,right:0,transform:`scaleX(0)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:`none`},[`&.${O1.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${O1.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${O1.disabled}, .${O1.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${O1.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}}))]}})),j1=L(w1,{name:`MuiInput`,slot:`Input`,overridesResolver:x1})({}),M1=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,inputComponent:s=`input`,multiline:c=!1,slotProps:l,slots:u={},type:d=`text`,...f}=n,p=k1(n),m={root:{ownerState:{disableUnderline:r}}},h=l??a?zn(l??a,m):m;return(0,N.jsx)(E1,{slots:{root:u.root??i.Root??A1,input:u.input??i.Input??j1},slotProps:h,fullWidth:o,inputComponent:s,multiline:c,ref:t,type:d,...f,classes:p})});M1.muiName=`Input`;function N1(e){return F(`MuiFilledInput`,e)}var P1={...g1,...mi(`MuiFilledInput`,[`root`,`underline`,`input`,`adornedStart`,`adornedEnd`,`sizeSmall`,`multiline`,`hiddenLabel`])},F1=e=>{let{classes:t,disableUnderline:n,startAdornment:r,endAdornment:i,size:a,hiddenLabel:o,multiline:s}=e,c=Fa({root:[`root`,!n&&`underline`,r&&`adornedStart`,i&&`adornedEnd`,a===`small`&&`size${z(a)}`,o&&`hiddenLabel`,s&&`multiline`],input:[`input`]},N1,t);return{...t,...c}},I1=L(C1,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiFilledInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...b1(e,t),!n.disableUnderline&&t.underline]}})(ol(({theme:e})=>{let t=e.palette.mode===`light`,n=t?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`,r=t?`rgba(0, 0, 0, 0.06)`:`rgba(255, 255, 255, 0.09)`,i=t?`rgba(0, 0, 0, 0.09)`:`rgba(255, 255, 255, 0.13)`,a=t?`rgba(0, 0, 0, 0.12)`:`rgba(255, 255, 255, 0.12)`;return{position:`relative`,backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:i,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${P1.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${P1.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:`""`,position:`absolute`,right:0,transform:`scaleX(0)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:`none`},[`&.${P1.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${P1.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):n}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${P1.disabled}, .${P1.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${P1.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{disableUnderline:!1,color:t},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:12}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:12}},{props:({ownerState:e})=>e.multiline,style:{padding:`25px 12px 8px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}}]}})),L1=L(w1,{name:`MuiFilledInput`,slot:`Input`,overridesResolver:x1})(ol(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}},{props:({ownerState:e})=>e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:e})=>e.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),R1=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiFilledInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,hiddenLabel:s,inputComponent:c=`input`,multiline:l=!1,slotProps:u,slots:d={},type:f=`text`,...p}=n,m={...n,disableUnderline:r,fullWidth:o,inputComponent:c,multiline:l,type:f},h=F1(n),g={root:{ownerState:m},input:{ownerState:m}},_=u??a?zn(g,u??a):g;return(0,N.jsx)(E1,{slots:{root:d.root??i.Root??I1,input:d.input??i.Input??L1},slotProps:_,fullWidth:o,inputComponent:c,multiline:l,ref:t,type:f,...p,classes:h})});R1.muiName=`Input`;var z1,B1=L(`fieldset`,{name:`MuiNotchedOutlined`,shouldForwardProp:Xo})({textAlign:`left`,position:`absolute`,bottom:0,right:0,top:-5,left:0,margin:0,padding:`0 8px`,pointerEvents:`none`,borderRadius:`inherit`,borderStyle:`solid`,borderWidth:1,overflow:`hidden`,minWidth:`0%`}),V1=L(`legend`,{name:`MuiNotchedOutlined`,shouldForwardProp:Xo})(ol(({theme:e})=>({float:`unset`,width:`auto`,overflow:`hidden`,variants:[{props:({ownerState:e})=>!e.withLabel,style:{padding:0,lineHeight:`11px`,transition:e.transitions.create(`width`,{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:e})=>e.withLabel,style:{display:`block`,padding:0,height:11,fontSize:`0.75em`,visibility:`hidden`,maxWidth:.01,transition:e.transitions.create(`max-width`,{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:`nowrap`,"& > span":{paddingLeft:5,paddingRight:5,display:`inline-block`,opacity:0,visibility:`visible`}}},{props:({ownerState:e})=>e.withLabel&&e.notched,style:{maxWidth:`100%`,transition:e.transitions.create(`max-width`,{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function H1(e){let{children:t,classes:n,className:r,label:i,notched:a,...o}=e,s=i!=null&&i!==``,c={...e,notched:a,withLabel:s};return(0,N.jsx)(B1,{"aria-hidden":!0,className:r,ownerState:c,...o,children:(0,N.jsx)(V1,{ownerState:c,children:s?(0,N.jsx)(`span`,{children:i}):z1||=(0,N.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``})})})}function U1(e){return F(`MuiOutlinedInput`,e)}var W1={...g1,...mi(`MuiOutlinedInput`,[`root`,`notchedOutline`,`input`])},G1=e=>{let{classes:t}=e,n=Fa({root:[`root`],notchedOutline:[`notchedOutline`],input:[`input`]},U1,t);return{...t,...n}},K1=L(C1,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiOutlinedInput`,slot:`Root`,overridesResolver:b1})(ol(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{position:`relative`,borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${W1.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${W1.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${W1.focused} .${W1.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{[`&.${W1.focused} .${W1.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${W1.error} .${W1.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${W1.disabled} .${W1.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:14}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:14}},{props:({ownerState:e})=>e.multiline,style:{padding:`16.5px 14px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{padding:`8.5px 14px`}}]}})),q1=L(H1,{name:`MuiOutlinedInput`,slot:`NotchedOutline`})(ol(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),J1=L(w1,{name:`MuiOutlinedInput`,slot:`Input`,overridesResolver:x1})(ol(({theme:e})=>({padding:`16.5px 14px`,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{padding:`8.5px 14px`}},{props:({ownerState:e})=>e.multiline,style:{padding:0}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}}]}))),Y1=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiOutlinedInput`}),{components:r={},fullWidth:i=!1,inputComponent:a=`input`,label:o,multiline:s=!1,notched:c,slots:l={},slotProps:u={},type:d=`text`,...f}=n,p=G1(n),m=Hf(),h=Bf({props:n,muiFormControl:m,states:[`color`,`disabled`,`error`,`focused`,`hiddenLabel`,`size`,`required`]}),g={...n,color:h.color||`primary`,disabled:h.disabled,error:h.error,focused:h.focused,formControl:m,fullWidth:i,hiddenLabel:h.hiddenLabel,multiline:s,size:h.size,type:d},_=l.root??r.Root??K1,v=l.input??r.Input??J1,[y,b]=fl(`notchedOutline`,{elementType:q1,className:p.notchedOutline,shouldForwardComponentProp:!0,ownerState:g,externalForwardedProps:{slots:l,slotProps:u},additionalProps:{label:o!=null&&o!==``&&h.required?(0,N.jsxs)(M.Fragment,{children:[o,` `,`*`]}):o}});return(0,N.jsx)(E1,{slots:{root:_,input:v},slotProps:u,renderSuffix:e=>(0,N.jsx)(y,{...b,notched:c===void 0?!!(e.startAdornment||e.filled||e.focused):c}),fullWidth:i,inputComponent:a,multiline:s,ref:t,type:d,...f,classes:{...p,notchedOutline:null}})});Y1.muiName=`Input`;var X1=e=>{let{classes:t}=e,n=Fa({root:[`root`]},Y$,t);return{...t,...n}},Z1={name:`MuiSelect`,slot:`Root`,shouldForwardProp:e=>Xo(e)&&e!==`variant`},Q1=L(M1,Z1)(``),$1=L(Y1,Z1)(``),e0=L(R1,Z1)(``),t0=M.forwardRef(function(e,t){let n=dc({name:`MuiSelect`,props:e}),{autoWidth:r=!1,children:i,classes:a={},className:o,defaultOpen:s=!1,displayEmpty:c=!1,IconComponent:l=l1,id:u,input:d,inputProps:f,label:p,labelId:m,MenuProps:h,multiple:g=!1,native:_=!1,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:S,variant:C=`outlined`,...w}=n,T=_?J$:c1,E=Bf({props:n,muiFormControl:Hf(),states:[`variant`,`error`]}),D=E.variant||C,O={...n,variant:D,classes:a},ee=X1(O),{root:te,...k}=ee,A=d||{standard:(0,N.jsx)(Q1,{ownerState:O}),outlined:(0,N.jsx)($1,{label:p,ownerState:O}),filled:(0,N.jsx)(e0,{ownerState:O})}[D],ne=kc(t,wc(A));return(0,N.jsx)(M.Fragment,{children:M.cloneElement(A,{inputComponent:T,inputProps:{children:i,error:E.error,IconComponent:l,variant:D,type:void 0,multiple:g,..._?{id:u}:{autoWidth:r,defaultOpen:s,displayEmpty:c,labelId:m,MenuProps:h,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:{id:u,...S}},...f,classes:f?zn(k,f.classes):k,...d?d.props.inputProps:{}},...(g&&_||c)&&D===`outlined`?{notched:!0}:{},ref:ne,className:P(A.props.className,o,ee.root),...!d&&{variant:D},...w})})});t0.muiName=`Select`;function n0(e,t){if(t==null){e.focus();return}try{e.focus({focusVisible:t===`keyboard`})}catch{e.focus()}}var r0=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},i0=e=>{let{disabled:t,dense:n,divider:r,disableGutters:i,selected:a,classes:o}=e,s=Fa({root:[`root`,n&&`dense`,t&&`disabled`,!i&&`gutters`,r&&`divider`,a&&`selected`]},z$,o);return{...o,...s}},a0=L(Zd,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiMenuItem`,slot:`Root`,overridesResolver:r0})(ol(({theme:e})=>({...e.typography.body1,display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:`border-box`,whiteSpace:`nowrap`,"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${B$.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${B$.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${B$.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${B$.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${B$.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${k$.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${k$.inset}`]:{marginLeft:52},[`& .${R$.root}`]:{marginTop:0,marginBottom:0},[`& .${R$.inset}`]:{paddingLeft:36},[`& .${A$.root}`]:{minWidth:36},variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>!e.dense,style:{[e.breakpoints.up(`sm`)]:{minHeight:`auto`}}},{props:({ownerState:e})=>e.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${A$.root} svg`]:{fontSize:`1.25rem`}}}]}))),o0=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiMenuItem`}),{autoFocus:r=!1,component:i=`li`,dense:a=!1,divider:o=!1,disableGutters:s=!1,focusVisibleClassName:c,role:l=`menuitem`,tabIndex:u,className:d,...f}=n,p=t1(),m=M.useContext(wp),h=M.useMemo(()=>({dense:a||m.dense||!1,disableGutters:s}),[m.dense,a,s]),g=M.useRef(null);Ul(()=>{r&&g.current&&n0(g.current,p)},[r]);let _={...n,dense:h.dense,divider:o,disableGutters:s},v=i0(n),y=kc(g,t),{root:b,...x}=v,S;return n.disabled||(S=u===void 0?-1:u),(0,N.jsx)(wp.Provider,{value:h,children:(0,N.jsx)(a0,{ref:y,role:l,tabIndex:S,component:i,focusVisibleClassName:P(v.focusVisible,c),className:P(v.root,d),...f,ownerState:_,classes:x})})}),s0=()=>{document.querySelectorAll(`.mq-supsub.mq-sup-only`).forEach(e=>{let t=e.previousElementSibling;t&&t.classList.contains(`mq-non-leaf`)&&t.querySelector(`.mq-fraction`)?e.classList.add(`mq-after-fraction-group`):e.classList.remove(`mq-after-fraction-group`)})},{commonMqFontStyles:c0,commonMqKeyboardStyles:l0,longdivStyles:u0,supsubStyles:d0}=t$,f0=md(`@pie-lib:math-toolbar:editor-and-pad`),p0=/\.|,/g,m0=L(`div`)(({theme:e})=>({zIndex:9,position:`relative`,textAlign:`center`,width:`auto`,"& > .mq-math-mode":{border:`solid 1px lightgrey`},"& > .mq-focused":{outline:`none`,boxShadow:`none`,border:`dotted 1px ${e.palette.primary.main}`,borderRadius:`0px`},"& .mq-overarrow-inner":{border:`none !important`,paddingTop:`0 !important`},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-overarrow.mq-arrow-both":{top:`7.8px`,marginTop:`0px`,minWidth:`1.23em`},"& .mq-parallelogram":{lineHeight:.85}})),h0=L(`div`)(({theme:e,hide:t})=>({display:t?`none`:`flex`,alignItems:`center`,"& .mq-editable-field .mq-cursor":{top:`-4px`},"& .mq-math-mode .mq-selection, .mq-editable-field .mq-selection":{paddingTop:`18px`},"& .mq-math-mode .mq-overarrow":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& .mq-math-mode .mq-overline .mq-overline-inner":{paddingTop:`0.4em !important`},"& .mq-overarrow.mq-arrow-both":{minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.45em`,left:`-1px`},"&:after":{position:`absolute !important`,top:`0px !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& *":{...c0,...d0,...u0,"& .mq-math-mode .mq-sqrt-prefix":{verticalAlign:`baseline !important`,top:`1px !important`,left:`-0.1em !important`},"& .mq-math-mode .mq-overarc ":{paddingTop:`0.45em !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-root-block":{paddingTop:`10px`},"& .mq-scaled .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-longdiv .mq-longdiv-inner":{marginLeft:`4px !important`,paddingTop:`6px !important`,paddingLeft:`6px !important`},"& .mq-math-mode .mq-paren":{verticalAlign:`top !important`,padding:`1px 0.1em !important`},"& .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-math-mode .mq-denominator":{marginTop:`-5px !important`,padding:`0.5em 0.1em 0.1em !important`},"& .mq-math-mode .mq-numerator, .mq-math-mode .mq-over":{padding:`0 0.1em !important`,paddingBottom:`0 !important`,marginBottom:`-2px`}},'& span[data-prime="true"]':{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),g0=L(ap)({flex:`initial`,width:`25%`,minWidth:`100px`,marginLeft:`15px`,marginTop:`5px`,marginBottom:`5px`,marginRight:`5px`,"& label":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& div":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}),_0=L(Qf)(()=>({backgroundColor:`transparent`})),v0=L(`div`)(({theme:e,error:t})=>({minWidth:`500px`,maxWidth:`900px`,minHeight:`30px`,width:`100%`,display:`flex`,marginTop:e.spacing(1),marginBottom:e.spacing(1),...t&&{border:`2px solid red`},"& .mq-sqrt-prefix .mq-scaled":{verticalAlign:`middle !important`}})),y0=L(WQ)(({controlledKeypadMode:e})=>({maxWidth:e?`400px`:`500px`,color:lu(),backgroundColor:Au(),padding:`2px`})),b0=L(Ef)({position:`absolute`,right:`12px`,border:`1px solid lightgrey`,color:lu()}),x0=L(`hr`)(({theme:e})=>({padding:0,margin:0,height:`1px`,border:`none`,borderBottom:`solid 1px ${e.palette.primary.main}`})),S0=L(f$)(({mode:e})=>({...l0,...e===`language`&&{"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),C0=e=>{if(!e)return;let{type:t,value:n}=e;return t===`command`||t===`cursor`?e:t===`answer`?{type:`answer`,...e}:n===`clear`?{type:`clear`}:{type:`write`,value:n}},w0=class extends M.Component{static propTypes={classNames:k.object,keypadMode:k.oneOfType([k.string,k.number]),autoFocus:k.bool,allowAnswerBlock:k.bool,showKeypad:k.bool,controlledKeypad:k.bool,controlledKeypadMode:k.bool,error:k.string,noDecimal:k.bool,hideInput:k.bool,noLatexHandling:k.bool,layoutForKeyPad:k.object,maxResponseAreas:k.number,additionalKeys:k.array,latex:k.string.isRequired,onAnswerBlockAdd:k.func,onFocus:k.func,onBlur:k.func,onChange:k.func.isRequired,setKeypadInteraction:k.func};constructor(e){super(e),this.state={equationEditor:`item-authoring`,addDisabled:!1}}componentDidMount(){this.input&&this.props.autoFocus&&setTimeout(()=>this.input.focus(),0)}onClick=e=>{let{noDecimal:t,noLatexHandling:n,onChange:r}=this.props,i=C0(e);if(f0(`mathChange: `,i),n){r(i.value);return}t&&(i.value===`.`||i.value===`,`)||i&&(i.type===`clear`?(f0(`call clear...`),this.input.clear()):i.type===`command`?this.input.command(i.value):i.type===`cursor`?this.input.keystroke(i.value):i.type===`answer`?this.input.write(`%response%`):this.input.write(i.value))};updateDisable=e=>{let{maxResponseAreas:t}=this.props;if(t){let n=this.checkResponseAreasNumber(t,e);this.setState({addDisabled:n})}};onAnswerBlockClick=()=>{this.props.onAnswerBlockAdd(),this.onClick({type:`answer`}),this.updateDisable(!0)};onEditorChange=e=>{let{onChange:t,noDecimal:n}=this.props;if(LX(),s0(),this.updateDisable(!0),n&&(e.indexOf(`.`)!==-1||e.indexOf(`,`)!==-1)&&this.input){this.input.clear(),this.input.write(e.replace(p0,``));return}let r=e.match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.input&&r&&r?.length){try{this.input.mathField.__controller.cursor.insLeftOf(this.input.mathField.__controller.cursor.parent[-1].parent),this.input.mathField.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}return}t(e)};shouldComponentUpdate(e,t){let n=this.input.mathField.latex()!==e.latex;return f0(`[shouldComponentUpdate] `,`inputIsDifferent: `,n),!le(this.props.error,e.error)||!n&&this.props.keypadMode!==e.keypadMode||!n&&this.props.noDecimal!==e.noDecimal||!n&&this.state.equationEditor!==t.equationEditor?!0:!n&&this.props.controlledKeypad?this.props.showKeypad!==e.showKeypad:n}onEditorTypeChange=e=>{this.setState({equationEditor:e.target.value})};checkResponseAreasNumber=(e,t)=>{let{latex:n}=this.input&&this.input.props||{};if(n){let r=(n.match(/answerBlock/g)||[]).length;return t?r===e-1:r===e}return!1};render(){let{classNames:e,keypadMode:t,allowAnswerBlock:n,additionalKeys:r,controlledKeypad:i,controlledKeypadMode:a,showKeypad:o,setKeypadInteraction:s,noDecimal:c,hideInput:l,layoutForKeyPad:u,latex:d,onFocus:f,onBlur:p,error:m}=this.props,h=!i||i&&o,{addDisabled:g}=this.state;return f0(`[render]`,d),(0,N.jsxs)(m0,{className:e.mathToolbar,children:[(0,N.jsxs)(h0,{hide:l,children:[a&&(0,N.jsxs)(g0,{variant:`standard`,children:[(0,N.jsx)(_0,{id:`equation-editor-label`,children:`Equation Editor`}),(0,N.jsxs)(t0,{labelId:`equation-editor-label`,id:`equation-editor-select`,name:`equationEditor`,label:`Equation Editor`,onChange:this.onEditorTypeChange,value:this.state.equationEditor,MenuProps:{transitionDuration:{enter:225,exit:195}},children:[(0,N.jsx)(o0,{value:`non-negative-integers`,children:`Numeric - Non-Negative Integers`}),(0,N.jsx)(o0,{value:`integers`,children:`Numeric - Integers`}),(0,N.jsx)(o0,{value:`decimals`,children:`Numeric - Decimals`}),(0,N.jsx)(o0,{value:`fractions`,children:`Numeric - Fractions`}),(0,N.jsx)(o0,{value:1,children:`Grade 1 - 2`}),(0,N.jsx)(o0,{value:3,children:`Grade 3 - 5`}),(0,N.jsx)(o0,{value:6,children:`Grade 6 - 7`}),(0,N.jsx)(o0,{value:8,children:`Grade 8 - HS`}),(0,N.jsx)(o0,{value:`geometry`,children:`Geometry`}),(0,N.jsx)(o0,{value:`advanced-algebra`,children:`Advanced Algebra`}),(0,N.jsx)(o0,{value:`statistics`,children:`Statistics`}),(0,N.jsx)(o0,{value:`item-authoring`,children:`Item Authoring`})]})]}),(0,N.jsx)(v0,{error:m,children:(0,N.jsx)(y0,{onFocus:()=>{f&&f(),this.updateDisable(!1)},onBlur:e=>{this.updateDisable(!1),p&&p(e)},className:e&&e.editor||``,controlledKeypadMode:a,ref:e=>this.input=e,latex:d,onChange:this.onEditorChange})})]}),n&&(0,N.jsx)(b0,{type:`primary`,style:{bottom:h?`320px`:`20px`},onClick:this.onAnswerBlockClick,disabled:g,children:`+ Response Area`}),(0,N.jsx)(x0,{}),h&&(0,N.jsx)(S0,{mode:a?this.state.equationEditor:t,controlledKeypadMode:a,layoutForKeyPad:u,additionalKeys:r,onClick:this.onClick,noDecimal:c,setKeypadInteraction:s})]})}},T0=L(Zq)(({hideBackground:e})=>({verticalAlign:`top`,width:`28px`,height:`28px`,color:`#00bb00`,...e&&{backgroundColor:Wu(),"&:hover":{backgroundColor:ju()}},"& .MuiIconButton-label":{position:`absolute`,top:`2px`}})),E0=({onClick:e,hideBackground:t})=>(0,N.jsx)(T0,{"aria-label":`Done`,onClick:e,hideBackground:t,size:`large`,children:(0,N.jsx)(eJ,{})});E0.propTypes={onClick:k.func,hideBackground:k.bool};var D0=E0,{commonMqFontStyles:O0,longdivStyles:k0,supsubStyles:A0}=t$,j0=md(`@pie-lib:math-toolbar:math-preview`),M0=L(`div`)(({theme:e,isSelected:t})=>({display:`inline-flex`,alignItems:`center`,position:`relative`,"& *":O0,...A0,...k0,"& > .mq-math-mode":{border:t?`solid 0px lightgrey`:`solid 1px lightgrey`},"& > .mq-focused":{outline:`none`,boxShadow:`none`,border:`solid 1px black`,borderRadius:`0px`},"& > .mq-math-mode .mq-root-block":{paddingTop:`7px !important`},"& > .mq-math-mode .mq-overarc ":{paddingTop:`0.45em !important`},"& > .mq-math-mode .mq-sqrt-prefix":{verticalAlign:`baseline !important`,top:`1px !important`,left:`-0.1em !important`},"& > .mq-math-mode .mq-denominator":{marginTop:`-5px !important`,padding:`0.5em 0.1em 0.1em !important`},"& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over":{padding:`0 0.1em !important`,paddingBottom:`0 !important`,marginBottom:`-2px`},"& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty":{paddingTop:`6px !important`,paddingLeft:`4px !important`},"& > .mq-math-mode .mq-longdiv .mq-longdiv-inner":{marginLeft:`0 !important`},"& > .mq-math-mode .mq-overarrow":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& > .mq-math-mode .mq-paren":{verticalAlign:`top !important`,padding:`1px 0.1em !important`},"& > .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-overarrow-inner":{paddingTop:`0 !important`,border:`none !important`},"& .mq-editable-field .mq-cursor":{marginTop:`-15px !important`},"& .mq-overarrow.mq-arrow-both":{top:`7.5px`,marginTop:`0px`,minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`0px !important`,position:`absolute !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},'& span[data-prime="true"]':{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},...t&&{border:`solid 1px ${e.palette.primary.main}`}})),N0=L(`span`)({position:`absolute`,bottom:0,left:0,right:0,top:0}),P0=class extends M.Component{static propTypes={latex:k.string,isSelected:k.bool,onFocus:k.func,onBlur:k.func};componentDidMount(){s0()}componentDidUpdate(e){this.props.latex!==e.latex&&s0()}render(){let{isSelected:e,onFocus:t,onBlur:n,latex:r}=this.props;return j0(`[render] latex: `,r),(0,N.jsxs)(M0,{isSelected:e,children:[` `,(0,N.jsx)(N0,{}),(0,N.jsx)(XQ,{latex:r,onFocus:t,onBlur:n})]})}},F0=L(`div`)({display:`flex`,width:`100%`,zIndex:8,alignItems:`center`}),I0=class extends M.Component{static propTypes={autoFocus:k.bool,allowAnswerBlock:k.bool,controlledKeypad:k.bool,controlledKeypadMode:k.bool,keypadMode:k.oneOfType([k.string,k.number]),classNames:k.object,error:k.string,maxResponseAreas:k.number,showKeypad:k.bool,noDecimal:k.bool,additionalKeys:k.array,latex:k.string.isRequired,onAnswerBlockAdd:k.func,onChange:k.func,onDone:k.func.isRequired,onFocus:k.func,onBlur:k.func,hideDoneButton:k.bool,keyPadCharacterRef:k.func,setKeypadInteraction:k.func};static defaultProps={classNames:{},keypadMode:`item-authoring`,autoFocus:!1,allowAnswerBlock:!1,controlledKeypad:!1,controlledKeypadMode:!1,noDecimal:!1,showKeypad:!0,additionalKeys:[],onChange:()=>{},onAnswerBlockAdd:()=>{},onFocus:()=>{},hideDoneButton:!1};constructor(e){super(e),this.state={latex:e.latex}}done=()=>{this.props.onDone(this.state.latex)};UNSAFE_componentWillReceiveProps(e){this.setState({latex:e.latex})}onChange=e=>{this.setState({latex:e}),this.props.onChange(e)};render(){let{latex:e}=this.state,{classNames:t,autoFocus:n,allowAnswerBlock:r,onAnswerBlockAdd:i,controlledKeypad:a,controlledKeypadMode:o,keypadMode:s,noDecimal:c,additionalKeys:l,showKeypad:u,onFocus:d,onBlur:f,hideDoneButton:p,error:m,keyPadCharacterRef:h,setKeypadInteraction:g,maxResponseAreas:_}=this.props;return(0,N.jsx)(L0,{autoFocus:n,classNames:t,onAnswerBlockAdd:i,allowAnswerBlock:r,latex:e,additionalKeys:l,noDecimal:c,keypadMode:s,keyPadCharacterRef:h,setKeypadInteraction:g,onChange:this.onChange,onDone:this.done,onFocus:d,onBlur:f,showKeypad:u,controlledKeypad:a,controlledKeypadMode:o,hideDoneButton:p,error:m,maxResponseAreas:_})}},L0=class extends M.Component{static propTypes={classNames:k.object,latex:k.string.isRequired,keypadMode:k.oneOfType([k.string,k.number]),hideInput:k.bool,noLatexHandling:k.bool,layoutForKeyPad:k.object,onChange:k.func.isRequired,onDone:k.func.isRequired,onBlur:k.func,onAnswerBlockAdd:k.func,additionalKeys:k.array,onFocus:k.func,autoFocus:k.bool,noDecimal:k.bool,allowAnswerBlock:k.bool,controlledKeypad:k.bool,controlledKeypadMode:k.bool,showKeypad:k.bool,hideDoneButton:k.bool,hideDoneButtonBackground:k.bool,error:k.any,maxResponseAreas:k.number,keyPadCharacterRef:k.object,setKeypadInteraction:k.func};static defaultProps={classNames:{},hideDoneButtonBackground:!1};render(){let{classNames:e,autoFocus:t,allowAnswerBlock:n,onAnswerBlockAdd:r,controlledKeypad:i,controlledKeypadMode:a,additionalKeys:o,showKeypad:s,keypadMode:c,noDecimal:l,hideInput:u,noLatexHandling:d,layoutForKeyPad:f,keyPadCharacterRef:p,setKeypadInteraction:m,latex:h,onChange:g,onDone:_,onFocus:v,onBlur:y,hideDoneButton:b,hideDoneButtonBackground:x,error:S,maxResponseAreas:C}=this.props;return(0,N.jsxs)(F0,{className:e&&e.toolbar||``,ref:p,children:[(0,N.jsx)(`div`,{}),(0,N.jsx)(w0,{autoFocus:t,keypadMode:c,classNames:e||{},controlledKeypad:i,controlledKeypadMode:a,noDecimal:l,hideInput:u,noLatexHandling:d,layoutForKeyPad:f,showKeypad:s,additionalKeys:o,allowAnswerBlock:n,onAnswerBlockAdd:r,latex:h,onChange:g,onFocus:v,onBlur:y,error:S,maxResponseAreas:C,setKeypadInteraction:m}),(!i||i&&s)&&!b&&(0,N.jsx)(D0,{hideBackground:x,onClick:_})]})}},R0=new Ab(`ensureTextAfterMath`),z0=(e=[])=>e.map(e=>({name:e,latex:e,write:e,label:e})),B0=e=>new Db({key:R0,appendTransaction:(t,n,r)=>{if(!t.some(e=>e.docChanged))return null;let i=r.tr,a=!1;return r.doc.descendants((t,n)=>{if(t.type.name===e){let e=n+t.nodeSize,o=r.doc.nodeAt(e);(!o||o.type.name!==`text`)&&(i.insert(e,r.schema.text(``)),a=!0)}}),a?i:null}}),V0=(e,t)=>{let n;for(n=t;n>0;n--){let t=e.nodeAt(n);if(t?.type?.name===`text`&&t.textContent!==``)return-1;if(t&&t?.type?.name!==`text`)break}return n},H0=new Db({key:new Ab(`zeroWidthSpaceHandling`),props:{handleKeyDown(e,t){let{state:n,dispatch:r}=e,{selection:i,doc:a}=n,{from:o,empty:s}=i;if(s&&t.key===`Backspace`&&o>0){let e=V0(a,o);return e===-1?!1:(r(n.tr.delete(e,o)),!0)}if(s&&t.key===`ArrowLeft`&&o>0){let e=V0(a,o);if(e===-1)return!1;let t=n.doc.resolve(e);if(t.nodeAfter||t.nodeBefore){let t=n.doc.resolve(e);return r(n.tr.setSelection(W.create(n.doc,t.pos))),!0}else return r(n.tr.setSelection(U.create(n.doc,o-2))),!0}return!1}}}),U0=$A.create({name:`math`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{latex:{default:``},wrapper:{default:null},html:{default:null}}},addProseMirrorPlugins(){return[B0(this.name),H0]},parseHTML(){return[{tag:`span[data-latex]`,getAttrs:e=>({latex:e.getAttribute(`data-raw`)||e.textContent})},{tag:`span[data-type="mathml"]`,getAttrs:e=>({html:e.innerHTML})}]},addCommands(){return{insertMath:(e=``)=>({tr:t,editor:n,dispatch:r})=>{let{state:i}=n.view,a=i.schema.nodes.math.create({latex:e}),{selection:o}=i,s=o.$from.pos;if(t.insert(s,a),a?.type?.name===this.name){let e=W.create(t.doc,o.$from.pos);t.setSelection(e)}return r(t),lJ(n,!0),!0}}},renderHTML({HTMLAttributes:e}){return e.html?[`span`,{"data-type":`mathml`,dangerouslySetInnerHTML:{__html:e.html}}]:[`span`,{"data-latex":``,"data-raw":e.latex},ee(e.latex,e.wrapper)]},addNodeView(){return EM(e=>(0,N.jsx)(W0,{...e,options:this.options}))}}),W0=e=>{let{node:t,updateAttributes:n,editor:r,selected:i,options:a,getPos:o}=e,[s,c]=(0,M.useState)(i),l=(0,M.useRef)(null),u=(0,M.useRef)(null),d=(0,M.useRef)(Date.now()),[f,p]=(0,M.useState)({top:0,left:0}),{math:m={}}=a||{},{keypadMode:h,controlledKeypadMode:g=!0,customKeys:_=[],keyPadCharacterRef:v,setKeypadInteraction:y}=m,b=t.attrs.latex||``,x=e=>{n({latex:e})},S=(e,{moveCursorAfterNode:i=!0}={})=>{if(n({latex:e}),c(!1),i&&typeof o==`function`){let e=o(),{doc:n}=r.state,i=U.create(n,e+t.nodeSize),a=r.state.tr.setSelection(i);r.view.dispatch(a)}r.commands.focus()};return(0,M.useEffect)(()=>{if(!i)return;let{selection:e}=r.state;e.node?.type?.name===`math`&&c(!0)},[i,r]),(0,M.useEffect)(()=>{lJ(r,i||s)},[r,s,i]),(0,M.useEffect)(()=>{if(!r||!s){p({top:0,left:0});return}let e=()=>{if(!l.current)return;let{from:e}=r.state.selection,t=r.view.coordsAtPos(e),n=u.current?.getBoundingClientRect?.(),i=n?.height?n.top:t.top,a=n?.width?n.left:t.left,o=n?.height?n.bottom:t.bottom??t.top,s=l.current.offsetHeight,c=l.current.offsetWidth,d=window.innerHeight-(o+0)>=s?o+0:i-s-0,f=a;d=Math.max(8,Math.min(d,window.innerHeight-s-8)),f=Math.max(8,Math.min(f,window.innerWidth-c-8));let m=(r._tiptapContainerEl||document.body).getBoundingClientRect();p({top:d-m.top,left:f-m.left})};e();let t=null,n=()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))};return t=requestAnimationFrame(()=>{t=null,e()}),window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{t!==null&&cancelAnimationFrame(t),window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[r,s]),(0,M.useEffect)(()=>{let e=e=>{let n=e?.target,i=(document.querySelectorAll?.(`[id^="equation-editor-select"][id*="listbox"], [aria-labelledby="equation-editor-label"][role="listbox"]`)||[]).length>0,a=!!(n?.id&&n.id.includes(`equation-editor-select`))||!!n?.closest?.(`[id*="equation-editor-select"]`),o=!!n?.closest?.(`.math-node-${d.current}`);if(l.current&&!l.current.contains(n)&&!n?.closest?.(`[data-inline-node]`)&&!i&&!a&&!o){c(!1);let e=!!r?.view?.dom?.contains(n);S(t.attrs.latex,{moveCursorAfterNode:!e})}};return s?document.addEventListener(`click`,e):document.removeEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[r,s,t]),(0,N.jsxs)(vM,{className:`math-node-${d.current}`,style:{display:`inline-flex`,cursor:`pointer`,margin:`0 4px`},"data-selected":i,children:[(0,N.jsx)(`div`,{ref:u,onClick:()=>c(!0),contentEditable:!1,children:(0,N.jsx)(P0,{latex:b})}),s&&hs.createPortal((0,N.jsx)(`div`,{ref:l,"data-toolbar-for":r.instanceId,style:{position:`absolute`,top:`${f.top}px`,left:`${f.left}px`,zIndex:1e3,background:`var(--editable-html-toolbar-bg, #efefef)`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`},children:(0,N.jsx)(I0,{latex:b,autoFocus:!0,onChange:x,onDone:S,keypadMode:h,controlledKeypadMode:g,additionalKeys:z0(_),keyPadCharacterRef:v,setKeypadInteraction:y})}),r?._tiptapContainerEl||document.body)]})};function G0(e){return F(`MuiLinearProgress`,e)}mi(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`dashedColorPrimary`,`dashedColorSecondary`,`bar`,`bar1`,`bar2`,`barColorPrimary`,`barColorSecondary`,`bar1Indeterminate`,`bar1Determinate`,`bar1Buffer`,`bar2Indeterminate`,`bar2Buffer`]);var K0=4,q0=fn`
|
|
331
|
+
https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide`)},FZ(),IZ},IZ.getInterface=zZ;var LZ=zZ.MIN=1,RZ=zZ.MAX=3;function zZ(e){if(!(LZ<=e&&e<=RZ))throw`Only interface versions between `+LZ+` and `+RZ+` supported. You specified: `+e;if(e<3&&typeof window<`u`&&!window.jQuery)throw`MathQuill interface version `+e+` requires jQuery 1.5.2+ to be loaded first`;function t(e){if(!e||!e.nodeType)return null;var t=sZ(e).children(`.mq-root-block`).attr(dZ),r=t&&SZ.byId[t].controller;return r?n[r.KIND_OF_MQ](r):null}var n={};t.L=Y,t.R=X,t.saneKeyboardEvents=UZ;function r(e,t){for(var r in t&&t.handlers&&(t.handlers={fns:t.handlers,APIClasses:n}),t)if(t.hasOwnProperty(r)){var i=t[r],a=MZ[r];e[r]=a?a(i):i}}t.config=function(e){return r(jZ.p,e),this},t.registerEmbed=function(e,t){if(!/^[a-z][a-z0-9]*$/i.test(e))throw`Embed name must start with letter and be only letters and digits`;PZ[e]=t};var i=n.AbstractMathQuill=J(NZ,function(t){t.init=function(e){this.__controller=e,this.__options=e.options,this.id=e.id,this.data=e.data},t.parseLatex=function(e){return this.__controller.parseLatex(e)},t.__mathquillify=function(t){var n=this.__controller,r=n.root,i=n.container;n.createTextarea();var a=i.addClass(t).contents().detach();r.jQ=sZ(`<span class="mq-root-block"/>`).attr(dZ,r.id).appendTo(i),this.latex(a.text()),this.revert=function(){var t=i.empty().unbind(`.mathquill`).removeClass(`mq-editable-field mq-math-mode mq-text-mode`).append(a);return e>=3?t[0]:t}},t.config=function(e){return r(this.__options,e),this},t.el=function(){return this.__controller.container[0]},t.text=function(){return this.__controller.exportText()},t.latex=function(e){return arguments.length>0?(this.__controller.renderLatexMath(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()},t.html=function(){return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id="?\d+"?/g,``).replace(/<span class="?mq-cursor( mq-blink)?"?>.?<\/span>/i,``).replace(/ mq-hasCursor|mq-hasCursor ?/,``).replace(/ class=(""|(?= |>))/g,``)},t.reflow=function(){return this.__controller.root.postOrder(`reflow`),this}});for(var a in t.prototype=i.prototype,n.EditableField=J(i,function(e,t){e.__mathquillify=function(){return t.__mathquillify.apply(this,arguments),this.__controller.editable=!0,this.__controller.delegateMouseEvents(),this.__controller.editablesTextareaEvents(),this},e.focus=function(){return this.__controller.textarea.focus(),this},e.blur=function(){return this.__controller.textarea.blur(),this},e.write=function(e){return this.__controller.writeLatex(e),this.__controller.scrollHoriz(),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},e.empty=function(){var e=this.__controller.root,t=this.__controller.cursor;return e.eachChild(`postOrder`,`dispose`),e.ends[Y]=e.ends[X]=0,e.jQ.empty(),delete t.selection,t.insAtRightEnd(e),this},e.cmd=function(e){var t=this.__controller.notify(),n=t.cursor;if(/^\\[a-z]+$/i.test(e)&&!n.isTooDeep()){e=e.slice(1);var r=Z[e];r&&(e=r(e),n.selection&&e.replaces(n.replaceSelection()),e.createLeftOf(n.show()),this.__controller.scrollHoriz())}else n.parent.write(n,e);return t.blurred&&n.hide().parent.blur(),this},e.select=function(){var e=this.__controller;for(e.notify(`move`).cursor.insAtRightEnd(e.root);e.cursor[Y];)e.selectLeft();return this},e.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},e.moveToDirEnd=function(e){return this.__controller.notify(`move`).cursor.insAtDirEnd(e,this.__controller.root),this},e.moveToLeftEnd=function(){return this.moveToDirEnd(Y)},e.moveToRightEnd=function(){return this.moveToDirEnd(X)},e.keystroke=function(e){for(var e=e.replace(/^\s+|\s+$/g,``).split(/\s+/),t=0;t<e.length;t+=1)this.__controller.keystroke(e[t],{preventDefault:mZ});return this},e.typedText=function(e){for(var t=0;t<e.length;t+=1)this.__controller.typedText(e.charAt(t));return this},e.dropEmbedded=function(e,t,n){var r=e-sZ(window).scrollLeft(),i=t-sZ(window).scrollTop(),a=document.elementFromPoint(r,i);this.__controller.seek(sZ(a),e,t),WQ().setOptions(n).createLeftOf(this.__controller.cursor)},e.clickAt=function(e,t,n){n||=document.elementFromPoint(e,t);var r=this.__controller,i=r.root;return cZ.contains(i.jQ[0],n)||(n=i.jQ[0]),r.seek(sZ(n),e+pageXOffset,t+pageYOffset),r.blurred&&this.focus(),this},e.ignoreNextMousedown=function(e){return this.__controller.cursor.options.ignoreNextMousedown=e,this}}),t.EditableField=function(){throw`wtf don't call me, I'm 'abstract'`},t.EditableField.prototype=n.EditableField.prototype,AZ)(function(r,i){var a=n[r]=i(n);t[r]=function(n,i){var o=t(n);if(o instanceof a||!n||!n.nodeType)return o;var s=kZ(a.RootBlock(),sZ(n),jZ());return s.KIND_OF_MQ=r,a(s).__mathquillify(i,e)},t[r].prototype=a.prototype})(a,AZ[a]);return t}IZ.noConflict=function(){return window.MathQuill=BZ,IZ};var BZ=window.MathQuill;window.MathQuill=IZ;function VZ(e){for(var t=`moveOutOf deleteOutOf selectOutOf upOutOf downOutOf`.split(` `),n=0;n<t.length;n+=1)(function(t){e[t]=function(e){this.controller.handle(t,e)}})(t[n]);e.reflow=function(){this.controller.handle(`reflow`),this.controller.handle(`edited`),this.controller.handle(`edit`)}}var HZ=J(function(e,t,n){function r(e,t){throw e=e?`'`+e+`'`:`EOF`,`Parse Error: `+t+` at `+e}e.init=function(e){this._=e},e.parse=function(e){return this.skip(o)._(``+e,t,r);function t(e,t){return t}},e.or=function(e){yZ(`or is passed a parser`,e instanceof n);var t=this;return n(function(n,r,i){return t._(n,r,a);function a(t){return e._(n,r,i)}})},e.then=function(e){var t=this;return n(function(r,i,a){return t._(r,o,a);function o(t,r){var o=e instanceof n?e:e(r);return yZ(`a parser is returned`,o instanceof n),o._(t,i,a)}})},e.many=function(){var e=this;return n(function(t,n,r){for(var i=[];e._(t,a,o););return n(t,i);function a(e,n){return t=e,i.push(n),!0}function o(){return!1}})},e.times=function(e,t){arguments.length<2&&(t=e);var r=this;return n(function(n,i,a){for(var o=[],s=!0,c,l=0;l<e;l+=1)if(s=r._(n,u,d),!s)return a(n,c);for(;l<t&&s;l+=1)s=r._(n,u,f);return i(n,o);function u(e,t){return o.push(t),n=e,!0}function d(e,t){return c=t,n=e,!1}function f(e,t){return!1}})},e.result=function(e){return this.then(a(e))},e.atMost=function(e){return this.times(0,e)},e.atLeast=function(e){var t=this;return t.times(e).then(function(e){return t.many().map(function(t){return e.concat(t)})})},e.map=function(e){return this.then(function(t){return a(e(t))})},e.skip=function(e){return this.then(function(t){return e.result(t)})},this.string=function(e){var t=e.length,r=`expected '`+e+`'`;return n(function(n,i,a){var o=n.slice(0,t);return o===e?i(n.slice(t),o):a(n,r)})};var i=this.regex=function(e){yZ(`regexp parser is anchored`,e.toString().charAt(1)===`^`);var t=`expected `+e;return n(function(n,r,i){var a=e.exec(n);if(a){var o=a[0];return r(n.slice(o.length),o)}else return i(n,t)})},a=n.succeed=function(e){return n(function(t,n){return n(t,e)})};n.fail=function(e){return n(function(t,n,r){return r(t,e)})},n.letter=i(/^[a-z]/i),n.letters=i(/^[a-z]*/i),n.digit=i(/^[0-9]/),n.digits=i(/^[0-9]*/),n.whitespace=i(/^\s+/),n.optWhitespace=i(/^\s*/),n.any=n(function(e,t,n){return e?t(e.slice(1),e.charAt(0)):n(e,`expected any character`)}),n.all=n(function(e,t,n){return t(``,e)});var o=n.eof=n(function(e,t,n){return e?n(e,`expected EOF`):t(e,e)})}),UZ=function(){var e={8:`Backspace`,9:`Tab`,10:`Enter`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Esc`,32:`Spacebar`,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`Left`,38:`Up`,39:`Right`,40:`Down`,45:`Insert`,46:`Del`,144:`NumLock`};function t(t){var n=t.which||t.keyCode,r=e[n],i,a=[];return t.ctrlKey&&a.push(`Ctrl`),t.originalEvent&&t.originalEvent.metaKey&&a.push(`Meta`),t.altKey&&a.push(`Alt`),t.shiftKey&&a.push(`Shift`),i=r||String.fromCharCode(n),!a.length&&!r?i:(a.push(i),a.join(`-`))}return function(e,n){var r=null,i=null,a=cZ(e),o=cZ(n.container||a),s=mZ,c;function l(e){s=e,clearTimeout(c),c=setTimeout(e)}function u(e){l(function(t){s=mZ,clearTimeout(c),e(t)})}o.bind(`keydown keypress input keyup focusout paste`,function(e){s(e)});function d(e){s(),s=mZ,clearTimeout(c),a.val(e),e&&a[0]&&a[0].select&&a[0].select(),f=!!e}var f=!1;function p(){var e=a[0];return`selectionStart`in e&&e.selectionStart!==e.selectionEnd}function m(){n.keystroke(t(r),r)}function h(e){r=e,i=null,f&&u(function(e){!(e&&e.type===`focusout`)&&a[0]&&a[0].select&&a[0].select()}),m()}function g(e){r&&i&&m(),i=e,l(v)}function _(e){r&&!i&&l(v)}function v(){if(!p()){var e=a.val();e.length===1?(a.val(``),n.typedText(e)):e&&a[0]&&a[0].select&&a[0].select()}}function y(){r=i=null}function b(e){a.focus(),l(x)}function x(){var e=a.val();a.val(``),e&&n.paste(e)}return o.bind({keydown:h,keypress:g,keyup:_,focusout:y,cut:function(){u(function(){n.cut()})},copy:function(){u(function(){n.copy()})},paste:b}),{select:d}}}();kZ.open(function(e,t){e.exportText=function(){return this.root.foldChildren(``,function(e,t){return e+t.text()})}}),kZ.open(function(e){e.focusBlurEvents=function(){var e=this,t=e.root,n=e.cursor,r;e.textarea.focus(function(){e.blurred=!1,clearTimeout(r),e.container.addClass(`mq-focused`),n.parent||n.insAtRightEnd(t),n.selection?(n.selection.jQ.removeClass(`mq-blur`),e.selectionChanged()):n.show()}).blur(function(){e.blurred=!0,r=setTimeout(function(){t.postOrder(`intentionalBlur`),n.clearSelection().endSelection(),a()}),sZ(window).bind(`blur`,i)});function i(){clearTimeout(r),n.selection&&n.selection.jQ.addClass(`mq-blur`),a()}function a(){n.hide().parent.blur(),e.container.removeClass(`mq-focused`),sZ(window).unbind(`blur`,i)}e.blurred=!0,n.hide().parent.blur()}}),kZ.open(function(e){e.keystroke=function(e,t){this.cursor.parent.keystroke(e,t,this)}}),SZ.open(function(e){e.keystroke=function(e,t,n){var r=n.cursor;switch(e){case`Ctrl-Shift-Backspace`:case`Ctrl-Backspace`:n.ctrlDeleteDir(Y);break;case`Shift-Backspace`:case`Backspace`:n.backspace();break;case`Esc`:case`Tab`:n.escapeDir(X,e,t);return;case`Shift-Tab`:case`Shift-Esc`:n.escapeDir(Y,e,t);return;case`End`:n.notify(`move`).cursor.insAtRightEnd(r.parent);break;case`Ctrl-End`:n.notify(`move`).cursor.insAtRightEnd(n.root);break;case`Shift-End`:for(;r[X];)n.selectRight();break;case`Ctrl-Shift-End`:for(;r[X]||r.parent!==n.root;)n.selectRight();break;case`Home`:n.notify(`move`).cursor.insAtLeftEnd(r.parent);break;case`Ctrl-Home`:n.notify(`move`).cursor.insAtLeftEnd(n.root);break;case`Shift-Home`:for(;r[Y];)n.selectLeft();break;case`Ctrl-Shift-Home`:for(;r[Y]||r.parent!==n.root;)n.selectLeft();break;case`Left`:n.moveLeft();break;case`Shift-Left`:n.selectLeft();break;case`Ctrl-Left`:break;case`Right`:n.moveRight();break;case`Shift-Right`:n.selectRight();break;case`Ctrl-Right`:break;case`Up`:n.moveUp();break;case`Down`:n.moveDown();break;case`Shift-Up`:if(r[Y])for(;r[Y];)n.selectLeft();else n.selectLeft();case`Shift-Down`:if(r[X])for(;r[X];)n.selectRight();else n.selectRight();case`Ctrl-Up`:break;case`Ctrl-Down`:break;case`Ctrl-Shift-Del`:case`Ctrl-Del`:n.ctrlDeleteDir(X);break;case`Shift-Del`:case`Del`:n.deleteForward();break;case`Meta-A`:case`Ctrl-A`:for(n.notify(`move`).cursor.insAtRightEnd(n.root);r[Y];)n.selectLeft();break;default:return}t.preventDefault(),n.scrollHoriz()},e.moveOutOf=e.moveTowards=e.deleteOutOf=e.deleteTowards=e.unselectInto=e.selectOutOf=e.selectTowards=function(){yZ(`overridden or never called on this node`)}}),kZ.open(function(e){this.onNotify(function(e){(e===`move`||e===`upDown`)&&this.show().clearSelection()}),e.escapeDir=function(e,t,n){bZ(e);var r=this.cursor;if(r.parent!==this.root&&n.preventDefault(),r.parent!==this.root)return r.parent.moveOutOf(e,r),this.notify(`move`)},MZ.leftRightIntoCmdGoes=function(e){if(e&&e!==`up`&&e!==`down`)throw`"up" or "down" required for leftRightIntoCmdGoes option, got "`+e+`"`;return e},e.moveDir=function(e){bZ(e);var t=this.cursor,n=t.options.leftRightIntoCmdGoes;return t.selection?t.insDirOf(e,t.selection.ends[e]):t[e]?t[e].moveTowards(e,t,n):t.parent.moveOutOf(e,t,n),this.notify(`move`)},e.moveLeft=function(){return this.moveDir(Y)},e.moveRight=function(){return this.moveDir(X)},e.moveUp=function(){return t(this,`up`)},e.moveDown=function(){return t(this,`down`)};function t(e,t){var n=e.notify(`upDown`).cursor,r=t+`Into`,i=t+`OutOf`;return n[X][r]?n.insAtLeftEnd(n[X][r]):n[Y][r]?n.insAtRightEnd(n[Y][r]):n.parent.bubble(function(e){var t=e[i];if(t&&(typeof t==`function`&&(t=e[i](n)),t instanceof SZ&&n.jumpUpDown(e,t),t!==!0))return!1}),e}this.onNotify(function(e){e!==`upDown`&&(this.upDownCache={})}),this.onNotify(function(e){e===`edit`&&this.show().deleteSelection()}),e.deleteDir=function(e){bZ(e);var t=this.cursor,n=t.selection;return this.notify(`edit`),n||(t[e]?t[e].deleteTowards(e,t):t.parent.deleteOutOf(e,t)),t[Y].siblingDeleted&&t[Y].siblingDeleted(t.options,X),t[X].siblingDeleted&&t[X].siblingDeleted(t.options,Y),t.parent.bubble(`reflow`),this},e.ctrlDeleteDir=function(e){bZ(e);var t=this.cursor;return!t[e]||t.selection?this.deleteDir(e):(this.notify(`edit`),e===Y?wZ(t.parent.ends[Y],t[Y]).remove():wZ(t[X],t.parent.ends[X]).remove(),t.insAtDirEnd(e,t.parent),t[Y].siblingDeleted&&t[Y].siblingDeleted(t.options,X),t[X].siblingDeleted&&t[X].siblingDeleted(t.options,Y),t.parent.bubble(`reflow`),this)},e.backspace=function(){return this.deleteDir(Y)},e.deleteForward=function(){return this.deleteDir(X)},this.onNotify(function(e){e!==`select`&&this.endSelection()}),e.selectDir=function(e){var t=this.notify(`select`).cursor,n=t.selection;bZ(e),t.anticursor||t.startSelection();var r=t[e];r?n&&n.ends[e]===r&&t.anticursor[-e]!==r?r.unselectInto(e,t):r.selectTowards(e,t):t.parent.selectOutOf(e,t),t.clearSelection(),t.select()||t.show()},e.selectLeft=function(){return this.selectDir(Y)},e.selectRight=function(){return this.selectDir(X)}});var WZ=/[\\]{2,}/gm,GZ=(function(){function e(e){var t=YZ();return e.adopt(t,0,0),t}function t(e){for(var t=e[0]||YZ(),n=1;n<e.length;n+=1)e[n].children().adopt(t,t.ends[X],0);return t}var n=HZ.string,r=HZ.regex,i=HZ.letter,a=HZ.any,o=HZ.optWhitespace,s=HZ.succeed,c=HZ.fail,l=i.map(function(e){return iQ(e)}),u=r(/^[^${}\\_^]/).map(function(e){return Q(e)}),d=r(/^\\not\\[a-z]+/).then(function(e){return EZ[e]&&EZ[e]().parser()||c(`unknown compound command: `+e)}),f=r(/^[^\\a-eg-zA-Z]/).or(n(`\\`).then(r(/^begin\{.?matrix\}/).or(r(/^[a-z]+/i)).or(r(/^\s+/).result(` `)).or(a))).then(function(e){e=e.replace(/^begin\{(.?matrix)\}$/,`$1`);var t=Z[e];return t?t(e).parser():c(`unknown command: \\`+e)}),p=d.or(f).or(l).or(u),m=n(`{`).then(function(){return g}).skip(n(`}`)),h=o.then(m.or(p.map(e))),g=h.many().map(t).skip(o),_=n(`[`).then(h.then(function(e){return e.join(`latex`)===`]`?c():s(e)}).many().map(t).skip(o)).skip(n(`]`)),v=g;return v.block=h,v.optBlock=_,v})();kZ.open(function(e,t){e.exportLatex=function(){return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi,`$1`)},e.parseLatex=function(e){return GZ.parse(e).postOrder(`finalizeTree`,jZ.p).join(`latex`).trim()},MZ.maxDepth=function(e){return typeof e==`number`?e:lZ},e.writeLatex=function(e){var t=this.notify(`edit`).cursor,n=HZ.all,r=HZ.eof,i=GZ.skip(r).or(n.result(!1)).parse(e);return i&&!i.isEmpty()&&i.prepareInsertionAt(t)&&(i.children().adopt(t.parent,t[Y],t[X]),i.jQize().insertBefore(t.jQ),t[Y]=i.ends[X],i.finalizeInsert(t.options,t),i.ends[X][X].siblingCreated&&i.ends[X][X].siblingCreated(t.options,Y),i.ends[Y][Y].siblingCreated&&i.ends[Y][Y].siblingCreated(t.options,X),t.parent.bubble(`reflow`)),this},e.renderLatexMath=function(e){e&&e.replace&&(e=e.replace(WZ,`\\`));var t=this.root,n=this.cursor;n.options;var r=t.jQ,i=HZ.all,a=HZ.eof,o=GZ.skip(a).or(i.result(!1)).parse(e);if(t.eachChild(`postOrder`,`dispose`),t.ends[Y]=t.ends[X]=0,o&&o.prepareInsertionAt(n)){o.children().adopt(t,0,0);var s=o.join(`html`);r.html(s),t.jQize(r.children()),t.finalizeInsert(n.options)}else r.empty();delete n.selection,n.insAtRightEnd(t)},e.renderLatexText=function(e){var t=this.root,n=this.cursor;t.jQ.children().slice(1).remove(),t.eachChild(`postOrder`,`dispose`),t.ends[Y]=t.ends[X]=0,delete n.selection,n.show().insAtRightEnd(t);var r=HZ.regex,i=HZ.string,a=HZ.eof,o=HZ.all,s=i(`$`).then(GZ).skip(i(`$`).or(a)).map(function(e){var t=eQ(n);t.createBlocks();var r=t.ends[Y];return e.children().adopt(r,0,0),t}),c=i(`\\$`).result(`$`).or(r(/^[^$]/)).map(Q),l=s.or(c).many().skip(a).or(o.result(!1)).parse(e);if(l){for(var u=0;u<l.length;u+=1)l[u].adopt(t,t.ends[X],0);t.jQize().appendTo(t.jQ),t.finalizeInsert(n.options)}}}),kZ.open(function(e){jZ.p.ignoreNextMousedown=mZ,e.delegateMouseEvents=function(){var e=this.root.jQ;this.container.bind(`mousedown.mathquill`,function(t){var n=sZ(t.target).closest(`.mq-root-block`),r=SZ.byId[n.attr(dZ)||e.attr(dZ)].controller,i=r.cursor;i.blink;var a=r.textareaSpan,o=r.textarea;if(t.preventDefault(),t.target.unselectable=!0,i.options.ignoreNextMousedown(t))return;i.options.ignoreNextMousedown=mZ;function s(e){i.anticursor||i.startSelection(),r.seek(sZ(e.target),e.pageX,e.pageY).cursor.select(),e.target&&sZ(e.target.ownerDocument).unbind(`mousemove`,c)}function c(e){return delete e.target,s(e)}function l(e){!i.selection&&!r.editable&&a.detach(),n.unbind(`mousemove`,s),sZ(e.target.ownerDocument).unbind(`mousemove`,c).unbind(`mouseup`,l)}if(a.parent().length===0)return!1;r.blurred&&(r.editable||n.prepend(a),document.body.focus(),o.focus()),t.preventDefault(),t.target.unselectable=!0,i.show(),r.seek(sZ(t.target),t.pageX,t.pageY).cursor.startSelection(),n.mousemove(s),sZ(t.target.ownerDocument).mousemove(c).mouseup(l)})}}),kZ.open(function(e){e.seek=function(e,t,n){var r=this.notify(`select`).cursor;if(e){var i=e.attr(dZ)||e.attr(uZ);if(!i){var a=e.parent();i=a.attr(dZ)||a.attr(uZ)}}var o=i&&SZ.byId[i]?SZ.byId[i]:this.root;return r.clearSelection().show(),o.seek(t,r),this.scrollHoriz(),this}}),kZ.open(function(e){e.scrollHoriz=function(){var e=this.cursor,t=e.selection,n=this.root.jQ[0].getBoundingClientRect();if(t){var r=t.jQ[0].getBoundingClientRect(),i=r.left-(n.left+20),a=r.right-(n.right-20);if(t.ends[Y]===e[X])if(i<0)var o=i;else if(a>0)if(r.left-a<n.left+20)var o=i;else var o=a;else return;else if(a>0)var o=a;else if(i<0)if(r.right-i>n.right-20)var o=a;else var o=i;else return}else{var s=e.jQ[0].getBoundingClientRect().left;if(s>n.right-20)var o=s-(n.right-20);else if(s<n.left+20)var o=s-(n.left+20);else return}this.root.jQ.stop&&typeof this.root.jQ.stop==`function`&&this.root.jQ.stop().animate({scrollLeft:`+=`+o},100)}}),kZ.open(function(e){jZ.p.substituteTextarea=function(){return sZ(`<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />`)[0]},e.createTextarea=function(){var e=this.textareaSpan=sZ(`<span class="mq-textarea"></span>`),t=this.options.substituteTextarea();if(!t.nodeType)throw`substituteTextarea() must return a DOM element, got `+t;t=this.textarea=sZ(t).appendTo(e);var n=this;n.cursor.selectionChanged=function(){n.selectionChanged()}},e.selectionChanged=function(){var e=this;vQ(e.container[0]),e.textareaSelectionTimeout===lZ&&(e.textareaSelectionTimeout=setTimeout(function(){e.setTextareaSelection()}))},e.setTextareaSelection=function(){this.textareaSelectionTimeout=lZ;var e=``;this.cursor.selection&&(e=this.cursor.selection.join(`latex`),this.options.statelessClipboard&&(e=`$`+e+`$`)),this.selectFn(e)},e.staticMathTextareaEvents=function(){var e=this;e.root;var t=e.cursor,n=e.textarea,r=e.textareaSpan;this.container.prepend(cZ(`<span class="mq-selectable">`).text(`$`+e.exportLatex()+`$`)),e.blurred=!0,n.bind(`cut paste`,!1).bind(`copy`,function(){e.setTextareaSelection()}).focus(function(){e.blurred=!1}).blur(function(){t.selection&&t.selection.clear(),setTimeout(i)});function i(){r.detach(),e.blurred=!0}e.selectFn=function(e){n.val(e),e&&n.select()}},jZ.p.substituteKeyboardEvents=UZ,e.editablesTextareaEvents=function(){var e=this,t=e.textarea,n=e.textareaSpan,r=this.options.substituteKeyboardEvents(t,this);this.selectFn=function(e){r.select(e)},this.container.prepend(n),this.focusBlurEvents()},e.typedText=function(e){if(e===`
|
|
332
|
+
`)return this.handle(`enter`);var t=this.notify().cursor;t.parent.write(t,e),this.scrollHoriz()},e.cut=function(){var e=this,t=e.cursor;t.selection&&setTimeout(function(){e.notify(`edit`),t.parent.bubble(`reflow`)})},e.copy=function(){this.setTextareaSelection()},e.paste=function(e){this.options.statelessClipboard&&(e=e.slice(0,1)===`$`&&e.slice(-1)===`$`?e.slice(1,-1):`\\text{`+e+`}`),this.writeLatex(e).cursor.show()}});var KZ=J(SZ,function(e,t){e.finalizeInsert=function(e,t){var n=this;n.postOrder(`finalizeTree`,e),n.postOrder(`contactWeld`,t),n.postOrder(`blur`),n.postOrder(`reflow`),n[X].siblingCreated&&n[X].siblingCreated(e,Y),n[Y].siblingCreated&&n[Y].siblingCreated(e,X),n.bubble(`reflow`)},e.prepareInsertionAt=function(e){var t=e.options.maxDepth;if(t!==lZ){var n=e.depth();if(n>t)return!1;this.removeNodesDeeperThan(t-n)}return!0},e.removeNodesDeeperThan=function(e){for(var t=0,n=[[this,t]],r;n.length;)r=n.shift(),r[0].children().each(function(i){var a=+(i instanceof YZ);t=r[1]+a,t<=e?n.push([i,t]):(a?i.children():i).remove()})}}),qZ=J(KZ,function(e,t){e.init=function(e,n,r){var i=this;t.init.call(i),i.ctrlSeq||=e,n&&(i.htmlTemplate=n),r&&(i.textTemplate=r)},e.replaces=function(e){e.disown(),this.replacedFragment=e},e.isEmpty=function(){return this.foldChildren(!0,function(e,t){return e&&t.isEmpty()})},e.parser=function(){var e=GZ.block,t=this;return e.times(t.numBlocks()).map(function(e){t.blocks=e;for(var n=0;n<e.length;n+=1)e[n].adopt(t,t.ends[X],0);return t})},e.createLeftOf=function(e){var n=this,r=n.replacedFragment;n.createBlocks(),t.createLeftOf.call(n,e),r&&(r.adopt(n.ends[Y],0,0),r.jQ.appendTo(n.ends[Y].jQ),n.placeCursor(e),n.prepareInsertionAt(e)),n.finalizeInsert(e.options),n.placeCursor(e)},e.createBlocks=function(){for(var e=this,t=e.numBlocks(),n=e.blocks=Array(t),r=0;r<t;r+=1)(n[r]=YZ()).adopt(e,e.ends[X],0)},e.placeCursor=function(e){e.insAtRightEnd(this.foldChildren(this.ends[Y],function(e,t){return e.isEmpty()?e:t}))},e.moveTowards=function(e,t,n){var r=n&&this[n+`Into`];t.insAtDirEnd(-e,r||this.ends[-e])},e.deleteTowards=function(e,t){this.isEmpty()?t[e]=this.remove()[e]:this.moveTowards(e,t,null)},e.selectTowards=function(e,t){t[-e]=this,t[e]=this[e]},e.selectChildren=function(){return OZ(this,this)},e.unselectInto=function(e,t){t.insAtDirEnd(-e,t.anticursor.ancestors[this.id])},e.seek=function(e,t){function n(e){var t={};return t[Y]=e.jQ.offset().left,t[X]=t[Y]+e.jQ.outerWidth(),t}var r=this,i=n(r);if(e<i[Y])return t.insLeftOf(r);if(e>i[X])return t.insRightOf(r);var a=i[Y];r.eachChild(function(o){var s=n(o);if(e<s[Y])return e-a<s[Y]-e?o[Y]?t.insAtRightEnd(o[Y]):t.insLeftOf(r):t.insAtLeftEnd(o),!1;if(e>s[X])o[X]?a=s[X]:i[X]-e<e-s[X]?t.insRightOf(r):t.insAtRightEnd(o);else return o.seek(e,t),!1})},e.numBlocks=function(){var e=this.htmlTemplate.match(/&\d+/g);return e?e.length:0},e.html=function(){var e=this,t=e.blocks,n=` mathquill-command-id=`+e.id,r=e.htmlTemplate.match(/<[^<>]+>|[^<>]+/g);yZ(`no unmatched angle brackets`,r.join(``)===this.htmlTemplate);for(var i=0,a=r[0];a;i+=1,a=r[i])if(a.slice(-2)===`/>`)r[i]=a.slice(0,-2)+n+`/>`;else if(a.charAt(0)===`<`){yZ(`not an unmatched top-level close tag`,a.charAt(1)!==`/`),r[i]=a.slice(0,-1)+n+`>`;var o=1;do i+=1,a=r[i],yZ(`no missing close tags`,a),a.slice(0,2)===`</`?--o:a.charAt(0)===`<`&&a.slice(-2)!==`/>`&&(o+=1);while(o>0)}return r.join(``).replace(/>&(\d+)/g,function(e,n){return` mathquill-block-id=`+t[n].id+`>`+t[n].join(`html`)})},e.latex=function(){return this.foldChildren(this.ctrlSeq,function(e,t){return e+`{`+(t.latex()||` `)+`}`})},e.textTemplate=[``],e.text=function(){var e=this,t=0;return e.foldChildren(e.textTemplate[t],function(n,r){t+=1;var i=r.text();return n&&e.textTemplate[t]===`(`&&i[0]===`(`&&i.slice(-1)===`)`?n+i.slice(1,-1)+e.textTemplate[t]:n+i+(e.textTemplate[t]||``)})}}),JZ=J(qZ,function(e,t){e.init=function(e,n,r){r||=e&&e.length>1?e.slice(1):e,t.init.call(this,e,n,[r])},e.parser=function(){return HZ.succeed(this)},e.numBlocks=function(){return 0},e.replaces=function(e){e.remove()},e.createBlocks=mZ,e.moveTowards=function(e,t){t.jQ.insDirOf(e,this.jQ),t[-e]=this,t[e]=this[e]},e.deleteTowards=function(e,t){t[e]=this.remove()[e]},e.seek=function(e,t){e-this.jQ.offset().left<this.jQ.outerWidth()/2?t.insLeftOf(this):t.insRightOf(this)},e.latex=function(){return this.ctrlSeq},e.text=function(){return this.textTemplate},e.placeCursor=mZ,e.isEmpty=function(){return!0}}),Q=J(JZ,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span>`+(n||e)+`</span>`)}}),$=J(JZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-binary-operator">`+n+`</span>`,r)}}),YZ=J(KZ,function(e,t){e.join=function(e){return this.foldChildren(``,function(t,n){return t+n[e]()})},e.html=function(){return this.join(`html`)},e.latex=function(){return this.join(`latex`)},e.text=function(){return this.ends[Y]===this.ends[X]&&this.ends[Y]!==0?this.ends[Y].text():this.join(`text`)},e.keystroke=function(e,n,r){if(r.options.spaceBehavesLikeTab&&(e===`Spacebar`||e===`Shift-Spacebar`)){n.preventDefault(),r.escapeDir(e===`Shift-Spacebar`?Y:X,e,n);return}return t.keystroke.apply(this,arguments)},e.moveOutOf=function(e,t,n){!(n&&this.parent[n+`Into`])&&this[e]?t.insAtDirEnd(-e,this[e]):t.insDirOf(e,this.parent)},e.selectOutOf=function(e,t){t.insDirOf(e,this.parent)},e.deleteOutOf=function(e,t){t.unwrapGramp()},e.seek=function(e,t){var n=this.ends[X];if(!n||n.jQ.offset().left+n.jQ.outerWidth()<e)return t.insAtRightEnd(this);if(e<this.ends[Y].jQ.offset().left)return t.insAtLeftEnd(this);for(;e<n.jQ.offset().left;)n=n[Y];return n.seek(e,t)},e.chToCmd=function(e,t){var n;return e.match(/^[a-eg-zA-Z]$/)?iQ(e):/^\d$/.test(e)?nQ(e):t&&t.typingSlashWritesDivisionSymbol&&e===`/`?Z[`÷`](e):t&&t.typingAsteriskWritesTimesSymbol&&e===`*`?Z[`×`](e):(n=TZ[e]||Z[e])?n(e):Q(e)},e.write=function(e,t){var n;if(e.tooDeep())return!1;n=this.chToCmd(t,e.options),e.selection&&n.replaces(e.replaceSelection()),e.isTooDeep()||n.createLeftOf(e.show())},e.focus=function(){return this.jQ.addClass(`mq-hasCursor`),this.jQ.removeClass(`mq-empty`),this},e.blur=function(){return this.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.jQ.addClass(`mq-empty`),this}});jZ.p.mouseEvents=!0,AZ.StaticMath=function(e){return J(e.AbstractMathQuill,function(t,n){this.RootBlock=YZ,t.__mathquillify=function(e,t){return this.config(e),n.__mathquillify.call(this,`mq-math-mode`),this.__options.mouseEvents&&(this.__controller.delegateMouseEvents(),this.__controller.staticMathTextareaEvents()),this},t.init=function(){n.init.apply(this,arguments),this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField)},t.latex=function(){var t=n.latex.apply(this,arguments);return arguments.length>0&&this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField),t}})};var XZ=J(YZ,VZ);AZ.MathField=function(e){return J(e.EditableField,function(e,t){this.RootBlock=XZ,e.__mathquillify=function(e,n){return this.config(e),n>1&&(this.__controller.root.reflow=mZ),t.__mathquillify.call(this,`mq-editable-field mq-math-mode`),delete this.__controller.root.reflow,this}})};var ZZ=J(SZ,function(e,t){e.ctrlSeq=`\\text`,e.replaces=function(e){e instanceof wZ?this.replacedText=e.remove().jQ.text():typeof e==`string`&&(this.replacedText=e)},e.jQadd=function(e){t.jQadd.call(this,e),this.ends[Y]&&this.ends[Y].jQadd(this.jQ[0].firstChild)},e.createLeftOf=function(e){var n=this;if(t.createLeftOf.call(this,e),n[X].siblingCreated&&n[X].siblingCreated(e.options,Y),n[Y].siblingCreated&&n[Y].siblingCreated(e.options,X),n.bubble(`reflow`),e.insAtRightEnd(n),n.replacedText)for(var r=0;r<n.replacedText.length;r+=1)n.write(e,n.replacedText.charAt(r))},e.parser=function(){var e=this,t=HZ.string,n=HZ.regex;return HZ.optWhitespace.then(t(`{`)).then(n(/^[^}]*/)).skip(t(`}`)).map(function(t){return t.length===0?wZ():(QZ(t).adopt(e,0,0),e)})},e.textContents=function(){return this.foldChildren(``,function(e,t){return e+t.text})},e.text=function(){return`"`+this.textContents()+`"`},e.latex=function(){var e=this.textContents();return e.length===0?``:`\\text{`+e.replace(/\\/g,`\\backslash `).replace(/[{}]/g,`\\$&`)+`}`},e.html=function(){return`<span class="mq-text-mode" mathquill-command-id=`+this.id+`>`+this.textContents()+`</span>`},e.moveTowards=function(e,t){t.insAtDirEnd(-e,this)},e.moveOutOf=function(e,t){t.insDirOf(e,this)},e.unselectInto=e.moveTowards,e.selectTowards=qZ.prototype.selectTowards,e.deleteTowards=qZ.prototype.deleteTowards,e.selectOutOf=function(e,t){t.insDirOf(e,this)},e.deleteOutOf=function(e,t){this.isEmpty()&&t.insRightOf(this)},e.write=function(e,n){if(e.show().deleteSelection(),n!==`$`)e[Y]?(e[Y].appendText(n),this.bubble(`reflow`)):QZ(n).createLeftOf(e);else if(this.isEmpty())e.insRightOf(this),Q(`\\$`,`$`).createLeftOf(e);else if(!e[X])e.insRightOf(this);else if(!e[Y])e.insLeftOf(this);else{var r=ZZ(),i=this.ends[Y];i.disown().jQ.detach(),i.adopt(r,0,0),e.insLeftOf(this),t.createLeftOf.call(r,e)}},e.seek=function(e,t){t.hide();var r=n(this),i=this.jQ.width()/this.text.length,a=Math.round((e-this.jQ.offset().left)/i);a<=0?t.insAtLeftEnd(this):a>=r.text.length?t.insAtRightEnd(this):t.insLeftOf(r.splitRight(a));for(var o=e-t.show().offset().left,s=o&&o<0?Y:X,c=s;t[s]&&o*c>0;)t[s].moveTowards(s,t),c=o,o=e-t.offset().left;if(s*o<-s*c&&t[-s].moveTowards(-s,t),!t.anticursor)this.anticursorPosition=t[Y]&&t[Y].text.length;else if(t.anticursor.parent===this){var l=t[Y]&&t[Y].text.length;if(this.anticursorPosition===l)t.anticursor=xZ.copy(t);else{if(this.anticursorPosition<l){var u=t[Y].splitRight(this.anticursorPosition);t[Y]=u}else var u=t[X].splitRight(this.anticursorPosition-l);t.anticursor=xZ(this,u[Y],u)}}},e.blur=function(e){YZ.prototype.blur.call(this),e&&(this.textContents()===``?(this.remove(),e[Y]===this?e[Y]=this[Y]:e[X]===this&&(e[X]=this[X])):n(this))};function n(e){e.jQ[0].normalize();var t=e.jQ.contents().filter(function(e,t){return t.nodeType===3})[0];t||={data:``},yZ(`only node in TextBlock span is Text node`,t.nodeType===3);var n=QZ(t.data);return n.jQadd(t),e.children().disown(),n.adopt(e,0,0)}e.focus=YZ.prototype.focus}),QZ=J(SZ,function(e,t){e.init=function(e){t.init.call(this),this.text=e},e.jQadd=function(e){this.dom=e,this.jQ=sZ(e)},e.jQize=function(){return this.jQadd(document.createTextNode(this.text))},e.appendText=function(e){this.text+=e,this.dom.appendData(e)},e.prependText=function(e){this.text=e+this.text,this.dom.insertData(0,e)},e.insTextAtDirEnd=function(e,t){bZ(t),t===X?this.appendText(e):this.prependText(e)},e.splitRight=function(e){var t=QZ(this.text.slice(e)).adopt(this.parent,this,this[X]);return t.jQadd(this.dom.splitText(e)),this.text=this.text.slice(0,e),t};function n(e,t){return t.charAt(e===Y?0:-1+t.length)}e.moveTowards=function(e,t){bZ(e);var r=n(-e,this.text),i=this[-e];return i?i.insTextAtDirEnd(r,e):QZ(r).createDir(-e,t),this.deleteTowards(e,t)},e.latex=function(){return this.text},e.deleteTowards=function(e,t){this.text.length>1?e===X?(this.dom.deleteData(0,1),this.text=this.text.slice(1)):(this.dom.deleteData(-1+this.text.length,1),this.text=this.text.slice(0,-1)):(this.remove(),this.jQ.remove(),t[e]=this[e])},e.selectTowards=function(e,t){bZ(e);var r=t.anticursor,i=n(-e,this.text);if(r[e]===this){var a=QZ(i).createDir(e,t);r[e]=a,t.insDirOf(e,a)}else{var o=this[-e];if(o)o.insTextAtDirEnd(i,e);else{var a=QZ(i).createDir(-e,t);a.jQ.insDirOf(-e,t.selection.jQ)}this.text.length===1&&r[-e]===this&&(r[-e]=this[-e])}return this.deleteTowards(e,t)}});Z.text=Z.textnormal=Z.textrm=Z.textup=Z.textmd=ZZ;function $Z(e,t,n){return J(ZZ,{ctrlSeq:e,htmlTemplate:`<`+t+` `+n+`>&0</`+t+`>`})}Z.em=Z.italic=Z.italics=Z.emph=Z.textit=Z.textsl=$Z(`\\textit`,`i`,`class="mq-text-mode"`),Z.strong=Z.bold=Z.textbf=$Z(`\\textbf`,`b`,`class="mq-text-mode"`),Z.sf=Z.textsf=$Z(`\\textsf`,`span`,`class="mq-sans-serif mq-text-mode"`),Z.tt=Z.texttt=$Z(`\\texttt`,`span`,`class="mq-monospace mq-text-mode"`),Z.textsc=$Z(`\\textsc`,`span`,`style="font-variant:small-caps" class="mq-text-mode"`),Z.uppercase=$Z(`\\uppercase`,`span`,`style="text-transform:uppercase" class="mq-text-mode"`),Z.lowercase=$Z(`\\lowercase`,`span`,`style="text-transform:lowercase" class="mq-text-mode"`);var eQ=J(qZ,function(e,t){e.init=function(e){t.init.call(this,`$`),this.cursor=e},e.htmlTemplate=`<span class="mq-math-mode">&0</span>`,e.createBlocks=function(){t.createBlocks.call(this),this.ends[Y].cursor=this.cursor,this.ends[Y].write=function(e,t){t===`$`?this.isEmpty()?(e.insRightOf(this.parent),this.parent.deleteTowards(dir,e),Q(`\\$`,`$`).createLeftOf(e.show())):e[X]?e[Y]?YZ.prototype.write.call(this,e,t):e.insLeftOf(this.parent):e.insRightOf(this.parent):YZ.prototype.write.call(this,e,t)}},e.latex=function(){return`$`+this.ends[Y].latex()+`$`}}),tQ=J(XZ,function(e,t){e.keystroke=function(e){if(!(e===`Spacebar`||e===`Shift-Spacebar`))return t.keystroke.apply(this,arguments)},e.write=function(e,t){if(e.show().deleteSelection(),t===`$`)eQ(e).createLeftOf(e);else{var n;t===`<`?n=`<`:t===`>`&&(n=`>`),Q(t,n).createLeftOf(e)}}});AZ.TextField=function(e){return J(e.EditableField,function(e,t){this.RootBlock=tQ,e.__mathquillify=function(){return t.__mathquillify.call(this,`mq-editable-field mq-text-mode`)},e.latex=function(e){return arguments.length>0?(this.__controller.renderLatexText(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()}})},TZ[`\\`]=J(qZ,function(e,t){e.ctrlSeq=`\\`,e.replaces=function(e){this._replacedFragment=e.disown(),this.isEmpty=function(){return!1}},e.htmlTemplate=`<span class="mq-latex-command-input mq-non-leaf">\\<span>&0</span></span>`,e.textTemplate=[`\\`],e.createBlocks=function(){t.createBlocks.call(this),this.ends[Y].focus=function(){return this.parent.jQ.addClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.removeClass(`mq-empty`),this},this.ends[Y].blur=function(){return this.parent.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.addClass(`mq-empty`),this},this.ends[Y].write=function(e,t){e.show().deleteSelection(),t.match(/[a-z]/i)?Q(t).createLeftOf(e):(this.parent.renderCommand(e),(t!==`\\`||!this.isEmpty())&&e.parent.write(e,t))},this.ends[Y].keystroke=function(e,n,r){if(e===`Tab`||e===`Enter`||e===`Spacebar`){this.parent.renderCommand(r.cursor),n.preventDefault();return}return t.keystroke.apply(this,arguments)}},e.createLeftOf=function(e){if(t.createLeftOf.call(this,e),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass(`mq-blur`).bind(`mousedown mousemove`,function(e){return sZ(e.target=n).trigger(e),!1}).insertBefore(this.jQ).add(this.jQ)}},e.latex=function(){return`\\`+this.ends[Y].latex()+` `},e.renderCommand=function(e){this.jQ=this.jQ.last(),this.remove(),this[X]?e.insLeftOf(this[X]):e.insAtRightEnd(this.parent);var t=this.ends[Y].latex();t||=` `;var n=Z[t];n?(n=n(t),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(e)):(n=ZZ(),n.replaces(t),n.createLeftOf(e),e.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove())}}),Z[`∉`]=Z.notin=q($,`\\notin `,`∉`),Z[`≅`]=Z.cong=q($,`\\cong `,`≅`),Z[`≡`]=Z.equiv=q($,`\\equiv `,`≡`),Z[`⊕`]=Z.oplus=q($,`\\oplus `,`⊕`),Z[`⊗`]=Z.otimes=q($,`\\otimes `,`⊗`),Z[`≠`]=Z.ne=Z.neq=q($,`\\ne `,`≠`),Z[`≇`]=Z.ncong=q($,`\\ncong `,`≇`),Z[`∗`]=Z.ast=Z.star=Z.loast=Z.lowast=q($,`\\ast `,`∗`),Z.therefor=Z.therefore=q($,`\\therefore `,`∴`),Z.cuz=Z.because=q($,`\\because `,`∵`),Z.prop=Z.propto=q($,`\\propto `,`∝`),Z[`≈`]=Z.asymp=Z.approx=q($,`\\approx `,`≈`),Z[`≉`]=Z.nasymp=Z.napprox=q($,`\\napprox `,`≉`),Z.isin=Z.in=q($,`\\in `,`∈`),Z.ni=Z.contains=q($,`\\ni `,`∋`),Z.notni=Z.niton=Z.notcontains=Z.doesnotcontain=EZ[`\\not\\ni`]=q($,`\\not\\ni `,`∌`),Z.sub=Z.subset=q($,`\\subset `,`⊂`),Z.sup=Z.supset=Z.superset=q($,`\\supset `,`⊃`),Z.nsub=Z.notsub=Z.nsubset=Z.notsubset=EZ[`\\not\\subset`]=q($,`\\not\\subset `,`⊄`),Z.nsup=Z.notsup=Z.nsupset=Z.notsupset=Z.nsuperset=Z.notsuperset=EZ[`\\not\\supset`]=q($,`\\not\\supset `,`⊅`),Z.sube=Z.subeq=Z.subsete=Z.subseteq=q($,`\\subseteq `,`⊆`),Z.supe=Z.supeq=Z.supsete=Z.supseteq=Z.supersete=Z.superseteq=q($,`\\supseteq `,`⊇`),Z.nsube=Z.nsubeq=Z.notsube=Z.notsubeq=Z.nsubsete=Z.nsubseteq=Z.notsubsete=Z.notsubseteq=EZ[`\\not\\subseteq`]=q($,`\\not\\subseteq `,`⊈`),Z.nsupe=Z.nsupeq=Z.notsupe=Z.notsupeq=Z.nsupsete=Z.nsupseteq=Z.notsupsete=Z.notsupseteq=Z.nsupersete=Z.nsuperseteq=Z.notsupersete=Z.notsuperseteq=EZ[`\\not\\supseteq`]=q($,`\\not\\supseteq `,`⊉`),Z.N=Z.naturals=Z.Naturals=q(Q,`\\mathbb{N}`,`ℕ`),Z.P=Z.primes=Z.Primes=Z.projective=Z.Projective=Z.probability=Z.Probability=q(Q,`\\mathbb{P}`,`ℙ`),Z.Z=Z.integers=Z.Integers=q(Q,`\\mathbb{Z}`,`ℤ`),Z.Q=Z.rationals=Z.Rationals=q(Q,`\\mathbb{Q}`,`ℚ`),Z.R=Z.reals=Z.Reals=q(Q,`\\mathbb{R}`,`ℝ`),Z.C=Z.complex=Z.Complex=Z.complexes=Z.Complexes=Z.complexplane=Z.Complexplane=Z.ComplexPlane=q(Q,`\\mathbb{C}`,`ℂ`),Z.H=Z.Hamiltonian=Z.quaternions=Z.Quaternions=q(Q,`\\mathbb{H}`,`ℍ`),Z.quad=Z.emsp=q(Q,`\\quad `,` `),Z.qquad=q(Q,`\\qquad `,` `),Z.diamond=q(Q,`\\diamond `,`◇`),Z.bigtriangleup=q(Q,`\\bigtriangleup `,`△`),Z.ominus=q(Q,`\\ominus `,`⊖`),Z.uplus=q(Q,`\\uplus `,`⊎`),Z.bigtriangledown=q(Q,`\\bigtriangledown `,`▽`),Z.sqcap=q(Q,`\\sqcap `,`⊓`),Z.triangleleft=q(Q,`\\triangleleft `,`⊲`),Z.sqcup=q(Q,`\\sqcup `,`⊔`),Z.triangleright=q(Q,`\\triangleright `,`⊳`),Z.odot=Z.circledot=q(Q,`\\odot `,`⊙`),Z.bigcirc=q(Q,`\\bigcirc `,`◯`),Z.dagger=q(Q,`\\dagger `,`†`),Z.ddagger=q(Q,`\\ddagger `,`‡`),Z.wr=q(Q,`\\wr `,`≀`),Z.amalg=q(Q,`\\amalg `,`∐`),Z.models=q(Q,`\\models `,`⊨`),Z.prec=q(Q,`\\prec `,`≺`),Z.succ=q(Q,`\\succ `,`≻`),Z.preceq=q(Q,`\\preceq `,`≼`),Z.succeq=q(Q,`\\succeq `,`≽`),Z.simeq=q(Q,`\\simeq `,`≃`),Z.mid=q(Q,`\\mid `,`∣`),Z.ll=q(Q,`\\ll `,`≪`),Z.gg=q(Q,`\\gg `,`≫`),Z.parallel=q(Q,`\\parallel `,`∥`),Z.nparallel=q(Q,`\\nparallel `,`∦`),Z.bowtie=q(Q,`\\bowtie `,`⋈`),Z.sqsubset=q(Q,`\\sqsubset `,`⊏`),Z.sqsupset=q(Q,`\\sqsupset `,`⊐`),Z.smile=q(Q,`\\smile `,`⌣`),Z.sqsubseteq=q(Q,`\\sqsubseteq `,`⊑`),Z.sqsupseteq=q(Q,`\\sqsupseteq `,`⊒`),Z.doteq=q(Q,`\\doteq `,`≐`),Z.frown=q(Q,`\\frown `,`⌢`),Z.vdash=q(Q,`\\vdash `,`⊦`),Z.dashv=q(Q,`\\dashv `,`⊣`),Z.nless=q(Q,`\\nless `,`≮`),Z.ngtr=q(Q,`\\ngtr `,`≯`),Z.longleftarrow=q(Q,`\\longleftarrow `,`←`),Z.longrightarrow=q(Q,`\\longrightarrow `,`→`),Z.Longleftarrow=q(Q,`\\Longleftarrow `,`⇐`),Z.Longrightarrow=q(Q,`\\Longrightarrow `,`⇒`),Z.longleftrightarrow=q(Q,`\\longleftrightarrow `,`↔`),Z.updownarrow=q(Q,`\\updownarrow `,`↕`),Z.Longleftrightarrow=q(Q,`\\Longleftrightarrow `,`⇔`),Z.Updownarrow=q(Q,`\\Updownarrow `,`⇕`),Z.mapsto=q(Q,`\\mapsto `,`↦`),Z.nearrow=q(Q,`\\nearrow `,`↗`),Z.hookleftarrow=q(Q,`\\hookleftarrow `,`↩`),Z.hookrightarrow=q(Q,`\\hookrightarrow `,`↪`),Z.searrow=q(Q,`\\searrow `,`↘`),Z.leftharpoonup=q(Q,`\\leftharpoonup `,`↼`),Z.rightharpoonup=q(Q,`\\rightharpoonup `,`⇀`),Z.swarrow=q(Q,`\\swarrow `,`↙`),Z.leftharpoondown=q(Q,`\\leftharpoondown `,`↽`),Z.rightharpoondown=q(Q,`\\rightharpoondown `,`⇁`),Z.nwarrow=q(Q,`\\nwarrow `,`↖`),Z.ldots=q(Q,`\\ldots `,`…`),Z.cdots=q(Q,`\\cdots `,`⋯`),Z.vdots=q(Q,`\\vdots `,`⋮`),Z.ddots=q(Q,`\\ddots `,`⋱`),Z.surd=q(Q,`\\surd `,`√`),Z.triangle=q(Q,`\\triangle `,`△`),Z.ell=q(Q,`\\ell `,`ℓ`),Z.top=q(Q,`\\top `,`⊤`),Z.flat=q(Q,`\\flat `,`♭`),Z.natural=q(Q,`\\natural `,`♮`),Z.sharp=q(Q,`\\sharp `,`♯`),Z.wp=q(Q,`\\wp `,`℘`),Z.bot=q(Q,`\\bot `,`⊥`),Z.clubsuit=q(Q,`\\clubsuit `,`♣`),Z.diamondsuit=q(Q,`\\diamondsuit `,`♢`),Z.heartsuit=q(Q,`\\heartsuit `,`♡`),Z.spadesuit=q(Q,`\\spadesuit `,`♠`),Z.circledot=q(Q,`\\circledot `,`⊙`),Z.middot=q(Q,`\\middot `,`·`),Z.dottedsquare=q(Q,`\\dottedsquare `,`⬚`),Z.square=q(Q,`\\square `,`⬜`),Z.rectangle=q(Q,`\\rectangle `,`▯`),Z.oint=q(Q,`\\oint `,`∮`),Z.bigcap=q(Q,`\\bigcap `,`∩`),Z.bigcup=q(Q,`\\bigcup `,`∪`),Z.bigsqcup=q(Q,`\\bigsqcup `,`⊔`),Z.bigvee=q(Q,`\\bigvee `,`∨`),Z.bigwedge=q(Q,`\\bigwedge `,`∧`),Z.bigodot=q(Q,`\\bigodot `,`⊙`),Z.bigotimes=q(Q,`\\bigotimes `,`⊗`),Z.bigoplus=q(Q,`\\bigoplus `,`⊕`),Z.biguplus=q(Q,`\\biguplus `,`⊎`),Z.lfloor=q(Q,`\\lfloor `,`⌊`),Z.rfloor=q(Q,`\\rfloor `,`⌋`),Z.lceil=q(Q,`\\lceil `,`⌈`),Z.rceil=q(Q,`\\rceil `,`⌉`),Z.opencurlybrace=Z.lbrace=q(Q,`\\lbrace `,`{`),Z.closecurlybrace=Z.rbrace=q(Q,`\\rbrace `,`}`),Z.lbrack=q(Q,`[`),Z.rbrack=q(Q,`]`),Z.mug=q(Q,`\\mug `,`µg`),Z.mus=q(Q,`\\mus `,`µs`),Z.mum=q(Q,`\\mum `,`µm`),Z.muL=q(Q,`\\muL `,`µL`),Z.slash=q(Q,`/`),Z.vert=q(Q,`|`),Z.perp=Z.perpendicular=q(Q,`\\perp `,`⊥`),Z.nabla=Z.del=q(Q,`\\nabla `,`∇`),Z.hbar=q(Q,`\\hbar `,`ℏ`),Z.AA=Z.Angstrom=Z.angstrom=q(Q,`\\text\\AA `,`Å`),Z.ring=Z.circ=Z.circle=q(Q,`\\circ `,`∘`),Z.bull=Z.bullet=q(Q,`\\bullet `,`•`),Z.setminus=Z.smallsetminus=q(Q,`\\setminus `,`∖`),Z.not=Z[`¬`]=Z.neg=q(Q,`\\neg `,`¬`),Z[`…`]=Z.dots=Z.ellip=Z.hellip=Z.ellipsis=Z.hellipsis=q(Q,`\\dots `,`…`),Z.converges=Z.darr=Z.dnarr=Z.dnarrow=Z.downarrow=q(Q,`\\downarrow `,`↓`),Z.dArr=Z.dnArr=Z.dnArrow=Z.Downarrow=q(Q,`\\Downarrow `,`⇓`),Z.diverges=Z.uarr=Z.uparrow=q(Q,`\\uparrow `,`↑`),Z.uArr=Z.Uparrow=q(Q,`\\Uparrow `,`⇑`),Z.to=q($,`\\to `,`→`),Z.rarr=Z.rightarrow=q(Q,`\\rightarrow `,`→`),Z.implies=q($,`\\Rightarrow `,`⇒`),Z.rArr=Z.Rightarrow=q(Q,`\\Rightarrow `,`⇒`),Z.gets=q($,`\\gets `,`←`),Z.larr=Z.leftarrow=q(Q,`\\leftarrow `,`←`),Z.impliedby=q($,`\\Leftarrow `,`⇐`),Z.lArr=Z.Leftarrow=q(Q,`\\Leftarrow `,`⇐`),Z.harr=Z.lrarr=Z.leftrightarrow=q(Q,`\\leftrightarrow `,`↔`),Z.iff=q($,`\\Leftrightarrow `,`⇔`),Z.hArr=Z.lrArr=Z.Leftrightarrow=q(Q,`\\Leftrightarrow `,`⇔`),Z.Re=Z.Real=Z.real=q(Q,`\\Re `,`ℜ`),Z.Im=Z.imag=Z.image=Z.imagin=Z.imaginary=Z.Imaginary=q(Q,`\\Im `,`ℑ`),Z.part=Z.partial=q(Q,`\\partial `,`∂`),Z.infty=Z.infin=Z.infinity=q(Q,`\\infty `,`∞`),Z.pounds=q(Q,`\\pounds `,`£`),Z.alef=Z.alefsym=Z.aleph=Z.alephsym=q(Q,`\\aleph `,`ℵ`),Z.xist=Z.xists=Z.exist=Z.exists=q(Q,`\\exists `,`∃`),Z.nexists=Z.nexist=q(Q,`\\nexists `,`∄`),Z.and=Z.land=Z.wedge=q($,`\\wedge `,`∧`),Z.or=Z.lor=Z.vee=q($,`\\vee `,`∨`),Z.o=Z.O=Z.empty=Z.emptyset=Z.oslash=Z.Oslash=Z.nothing=Z.varnothing=q($,`\\varnothing `,`∅`),Z.cup=Z.union=q($,`\\cup `,`∪`),Z.cap=Z.intersect=Z.intersection=q($,`\\cap `,`∩`),Z.deg=Z.degree=q(Q,`\\degree `,`°`),Z.ang=Z.angle=q(Q,`\\angle `,`∠`),Z.measuredangle=q(Q,`\\measuredangle `,`m∠`);var nQ=J(Q,function(e,t){e.createLeftOf=function(e){e.options.autoSubscriptNumerals&&e.parent!==e.parent.parent.sub&&(e[Y]instanceof rQ&&e[Y].isItalic!==!1||e[Y]instanceof MQ&&e[Y][Y]instanceof rQ&&e[Y][Y].isItalic!==!1)?(Z._().createLeftOf(e),t.createLeftOf.call(this,e),e.insRightOf(e.parent.parent)):t.createLeftOf.call(this,e)}}),rQ=J(JZ,function(e,t){e.init=function(e,n){t.init.call(this,e,`<var>`+(n||e)+`</var>`)},e.text=function(){var e=this.ctrlSeq;return this.isPartOfOperator?e[0]==`\\`?e=e.slice(1,e.length):e[e.length-1]==` `&&(e=e.slice(0,-1)):(this[Y]&&!(this[Y]instanceof rQ)&&!(this[Y]instanceof $)&&this[Y].ctrlSeq!==`\\ `&&(e=`*`+e),this[X]&&!(this[X]instanceof $)&&!(this[X]instanceof MQ)&&(e+=`*`)),e}});jZ.p.autoCommands={_maxLength:0},MZ.autoCommands=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`autocommand "`+a+`" not minimum length of 2`;if(Z[a]===cQ)throw`"`+a+`" is a built-in operator name`;n[a]=1,r=pZ(r,a.length)}return n._maxLength=r,n};var iQ=J(rQ,function(e,t){e.init=function(e){return t.init.call(this,this.letter=e)},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments);var n=e.options.autoCommands,r=n._maxLength;if(r>0){for(var i=``,a=this,o=0;a instanceof iQ&&a.ctrlSeq===a.letter&&o<r;)i=a.letter+i,a=a[Y],o+=1;for(;i.length;){if(n.hasOwnProperty(i)){for(var o=1,a=this;o<i.length;o+=1,a=a[Y]);return wZ(a,this).remove(),e[Y]=a[Y],Z[i](i).createLeftOf(e)}i=i.slice(1)}}},e.italicize=function(e){return this.isItalic=e,this.isPartOfOperator=!e,this.jQ.toggleClass(`mq-operator-name`,!e),this},e.finalizeTree=e.siblingDeleted=e.siblingCreated=function(e,t){t!==Y&&this[X]instanceof iQ||this.autoUnItalicize(e)},e.autoUnItalicize=function(e){var t=e.autoOperatorNames;if(t._maxLength!==0){for(var r=this.letter,i=this[Y];i instanceof iQ;i=i[Y])r=i.letter+r;for(var a=this[X];a instanceof iQ;a=a[X])r+=a.letter;wZ(i[X]||this.parent.ends[Y],a[Y]||this.parent.ends[X]).each(function(e){e.italicize(!0).jQ.removeClass(`mq-first mq-last mq-followed-by-supsub`),e.ctrlSeq=e.letter});outer:for(var o=0,s=i[X]||this.parent.ends[Y];o<r.length;o+=1,s=s[X])for(var c=fZ(t._maxLength,r.length-o);c>0;--c){var l=r.slice(o,o+c);if(t.hasOwnProperty(l)){for(var u=0,d=s;u<c;u+=1,d=d[X]){d.italicize(!1);var f=d}var p=aQ.hasOwnProperty(l);if(s.ctrlSeq=(p?`\\`:`\\operatorname{`)+s.ctrlSeq,f.ctrlSeq+=p?` `:`}`,sQ.hasOwnProperty(l)&&f[Y][Y][Y].jQ.addClass(`mq-last`),n(s[Y])||s.jQ.addClass(`mq-first`),!n(f[X]))if(f[X]instanceof MQ){var m=f[X];(m.siblingCreated=m.siblingDeleted=function(){m.jQ.toggleClass(`mq-after-operator-name`,!(m[X]instanceof VQ))})()}else f.jQ.toggleClass(`mq-last`,!(f[X]instanceof VQ));o+=c-1,s=f;continue outer}}}};function n(e){return!e||e instanceof $||e instanceof FQ}}),aQ={},oQ=jZ.p.autoOperatorNames={_maxLength:9},sQ={limsup:1,liminf:1,projlim:1,injlim:1};(function(){for(var e=`arg deg det dim exp gcd hom inf ker lg ln log max min sup limsup liminf injlim projlim Pr`.split(` `),t=0;t<e.length;t+=1)aQ[e[t]]=oQ[e[t]]=1;for(var n=`sin cos tan arcsin arccos arctan sinh cosh tanh sec csc cot coth`.split(` `),t=0;t<n.length;t+=1)aQ[n[t]]=1;for(var r=`sin cos tan sec cosec csc cotan cot ctg`.split(` `),t=0;t<r.length;t+=1)oQ[r[t]]=oQ[`arc`+r[t]]=oQ[r[t]+`h`]=oQ[`ar`+r[t]+`h`]=oQ[`arc`+r[t]+`h`]=1;for(var i=`gcf hcf lcm proj span`.split(` `),t=0;t<i.length;t+=1)oQ[i[t]]=1})(),MZ.autoOperatorNames=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`"`+a+`" not minimum length of 2`;n[a]=1,r=pZ(r,a.length)}return n._maxLength=r,n};var cQ=J(JZ,function(e,t){e.init=function(e){this.ctrlSeq=e},e.createLeftOf=function(e){for(var t=this.ctrlSeq,n=0;n<t.length;n+=1)iQ(t.charAt(n)).createLeftOf(e)},e.parser=function(){for(var e=this.ctrlSeq,t=YZ(),n=0;n<e.length;n+=1)iQ(e.charAt(n)).adopt(t,t.ends[X],0);return HZ.succeed(t.children())}});for(var lQ in oQ)oQ.hasOwnProperty(lQ)&&(Z[lQ]=cQ);Z.operatorname=J(qZ,function(e){e.createLeftOf=mZ,e.numBlocks=function(){return 1},e.parser=function(){return GZ.block.map(function(e){return e.children()})}}),Z.f=J(iQ,function(e,t){e.init=function(){JZ.p.init.call(this,this.letter=`f`,`<var class="mq-f">f</var>`)},e.italicize=function(e){return this.jQ.html(`f`).toggleClass(`mq-f`,e),t.italicize.apply(this,arguments)}}),Z[` `]=Z.space=q(Q,`\\ `,` `),Z[`'`]=Z.prime=q(Q,`'`,`′`),Z[`″`]=Z.dprime=q(Q,`″`,`″`),Z[`"`]=Z.doublePrime=q(Q,`"`,`″`),Z.backslash=q(Q,`\\backslash `,`\\`),TZ[`\\`]||=Z.backslash,Z.$=q(Q,`\\$`,`$`);var uQ=J(JZ,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span class="mq-nonSymbola">`+(n||e)+`</span>`)}});Z[`@`]=uQ,Z[`&`]=q(uQ,`\\&`,`&`),Z[`%`]=q(uQ,`\\%`,`%`),Z.alpha=Z.beta=Z.gamma=Z.delta=Z.zeta=Z.eta=Z.theta=Z.iota=Z.kappa=Z.mu=Z.nu=Z.xi=Z.rho=Z.sigma=Z.tau=Z.chi=Z.psi=Z.omega=J(rQ,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),Z.phi=q(rQ,`\\phi `,`ϕ`),Z.phiv=Z.varphi=q(rQ,`\\varphi `,`φ`),Z.epsilon=q(rQ,`\\epsilon `,`ϵ`),Z.epsiv=Z.varepsilon=q(rQ,`\\varepsilon `,`ε`),Z.piv=Z.varpi=q(rQ,`\\varpi `,`ϖ`),Z.sigmaf=Z.sigmav=Z.varsigma=q(rQ,`\\varsigma `,`ς`),Z.thetav=Z.vartheta=Z.thetasym=q(rQ,`\\vartheta `,`ϑ`),Z.upsilon=Z.upsi=q(rQ,`\\upsilon `,`υ`),Z.gammad=Z.Gammad=Z.digamma=q(rQ,`\\digamma `,`ϝ`),Z.kappav=Z.varkappa=q(rQ,`\\varkappa `,`ϰ`),Z.rhov=Z.varrho=q(rQ,`\\varrho `,`ϱ`),Z.pi=Z.π=q(uQ,`\\pi `,`π`),Z.lambda=q(uQ,`\\lambda `,`λ`),Z.Upsilon=Z.Upsi=Z.upsih=Z.Upsih=q(JZ,`\\Upsilon `,`<var style="font-family: serif">ϒ</var>`),Z.Gamma=Z.Delta=Z.Theta=Z.Lambda=Z.Xi=Z.Pi=Z.Sigma=Z.Phi=Z.Psi=Z.Omega=J(Q,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),Z.forall=Z[`∀`]=q(Q,`\\forall `,`∀`);var dQ=J(qZ,function(e){e.init=function(e){this.latex=e},e.createLeftOf=function(e){var t=GZ.parse(this.latex);t.children().adopt(e.parent,e[Y],e[X]),e[Y]=t.ends[X],t.jQize().insertBefore(e.jQ),t.finalizeInsert(e.options,e),t.ends[X][X].siblingCreated&&t.ends[X][X].siblingCreated(e.options,Y),t.ends[Y][Y].siblingCreated&&t.ends[Y][Y].siblingCreated(e.options,X),e.parent.bubble(`reflow`)},e.parser=function(){var e=GZ.parse(this.latex).children();return HZ.succeed(e)}});Z[`¹`]=q(dQ,`^1`),Z[`²`]=q(dQ,`^2`),Z[`³`]=q(dQ,`^3`),Z[`¼`]=q(dQ,`\\frac14`),Z[`½`]=q(dQ,`\\frac12`),Z[`¾`]=q(dQ,`\\frac34`);var fQ=J($,function(e){e.init=Q.prototype.init,e.contactWeld=e.siblingCreated=e.siblingDeleted=function(e,t){function n(e){if(e[Y]){if(e[Y]instanceof $||/^[,;:\(\[]$/.test(e[Y].ctrlSeq))return``}else if(e.parent&&e.parent.parent&&e.parent.parent.isStyleBlock())return n(e.parent.parent);else return``;return`mq-binary-operator`}if(t!==X)return this.jQ[0].className=n(this),this}});Z[`+`]=q(fQ,`+`,`+`),Z[`–`]=Z[`-`]=q(fQ,`-`,`−`),Z[`±`]=Z.pm=Z.plusmn=Z.plusminus=q(fQ,`\\pm `,`±`),Z.mp=Z.mnplus=Z.minusplus=q(fQ,`\\mp `,`∓`),TZ[`*`]=Z.sdot=Z.cdot=q($,`\\cdot `,`·`,`*`);var pQ=J($,function(e,t){e.init=function(e,n){this.data=e,this.strict=n;var r=n?`Strict`:``;t.init.call(this,e[`ctrlSeq`+r],e[`html`+r],e[`text`+r])},e.swap=function(e){this.strict=e;var t=e?`Strict`:``;this.ctrlSeq=this.data[`ctrlSeq`+t],this.jQ.html(this.data[`html`+t]),this.textTemplate=[this.data[`text`+t]]},e.deleteTowards=function(e,n){if(e===Y&&!this.strict){this.swap(!0),this.bubble(`reflow`);return}t.deleteTowards.apply(this,arguments)}}),mQ={ctrlSeq:`\\le `,html:`≤`,text:`≤`,ctrlSeqStrict:`<`,htmlStrict:`<`,textStrict:`<`},hQ={ctrlSeq:`\\ge `,html:`≥`,text:`≥`,ctrlSeqStrict:`>`,htmlStrict:`>`,textStrict:`>`};Z[`<`]=Z.lt=q(pQ,mQ,!0),Z[`>`]=Z.gt=q(pQ,hQ,!0),Z[`≤`]=Z.le=Z.leq=q(pQ,mQ,!1),Z[`≥`]=Z.ge=Z.geq=q(pQ,hQ,!1);var gQ=J($,function(e,t){e.init=function(){t.init.call(this,`=`,`=`)},e.createLeftOf=function(e){if(e[Y]instanceof pQ&&e[Y].strict){e[Y].swap(!1),e[Y].bubble(`reflow`);return}t.createLeftOf.apply(this,arguments)}});Z[`=`]=gQ,Z[`×`]=Z.times=q($,`\\times `,`×`,`[x]`),Z[`÷`]=Z.div=Z.divide=Z.divides=q($,`\\div `,`÷`,`[/]`),TZ[`~`]=Z.sim=q($,`\\sim `,`~`,`~`),TZ[`≁`]=Z.nsim=q($,`\\nsim `,`≁`,`≁`),Z.complement=Z[`∁`]=q(Q,`\\complement `,`∁`),Z.nexists=Z[`∄`]=q(Q,`\\nexists `,`∄`),Z.sphericalangle=Z[`∢`]=q(Q,`\\sphericalangle `,`∢`),Z.iint=Z[`∬`]=q(Q,`\\iint `,`∬`),Z.iiint=Z[`∭`]=q(Q,`\\iiint `,`∭`),Z.oiint=Z[`∯`]=q(Q,`\\oiint `,`∯`),Z.oiiint=Z[`∰`]=q(Q,`\\oiiint `,`∰`),Z.backsim=Z[`∽`]=q(Q,`\\backsim `,`∽`),Z.backsimeq=Z[`⋍`]=q(Q,`\\backsimeq `,`⋍`),Z.eqsim=Z[`≂`]=q(Q,`\\eqsim `,`≂`),Z.ncong=Z[`≇`]=q(Q,`\\ncong `,`≇`),Z.approxeq=Z[`≊`]=q(Q,`\\approxeq `,`≊`),Z.bumpeq=Z[`≏`]=q(Q,`\\bumpeq `,`≏`),Z.Bumpeq=Z[`≎`]=q(Q,`\\Bumpeq `,`≎`),Z.doteqdot=Z[`≑`]=q(Q,`\\doteqdot `,`≑`),Z.fallingdotseq=Z[`≒`]=q(Q,`\\fallingdotseq `,`≒`),Z.risingdotseq=Z[`≓`]=q(Q,`\\risingdotseq `,`≓`),Z.eqcirc=Z[`≖`]=q(Q,`\\eqcirc `,`≖`),Z.circeq=Z[`≗`]=q(Q,`\\circeq `,`≗`),Z.triangleq=Z[`≜`]=q(Q,`\\triangleq `,`≜`),Z.leqq=Z[`≦`]=q(Q,`\\leqq `,`≦`),Z.geqq=Z[`≧`]=q(Q,`\\geqq `,`≧`),Z.lneqq=Z[`≨`]=q(Q,`\\lneqq `,`≨`),Z.gneqq=Z[`≩`]=q(Q,`\\gneqq `,`≩`),Z.between=Z[`≬`]=q(Q,`\\between `,`≬`),Z.nleq=Z[`≰`]=q(Q,`\\nleq `,`≰`),Z.ngeq=Z[`≱`]=q(Q,`\\ngeq `,`≱`),Z.lesssim=Z[`≲`]=q(Q,`\\lesssim `,`≲`),Z.gtrsim=Z[`≳`]=q(Q,`\\gtrsim `,`≳`),Z.lessgtr=Z[`≶`]=q(Q,`\\lessgtr `,`≶`),Z.gtrless=Z[`≷`]=q(Q,`\\gtrless `,`≷`),Z.preccurlyeq=Z[`≼`]=q(Q,`\\preccurlyeq `,`≼`),Z.succcurlyeq=Z[`≽`]=q(Q,`\\succcurlyeq `,`≽`),Z.precsim=Z[`≾`]=q(Q,`\\precsim `,`≾`),Z.succsim=Z[`≿`]=q(Q,`\\succsim `,`≿`),Z.nprec=Z[`⊀`]=q(Q,`\\nprec `,`⊀`),Z.nsucc=Z[`⊁`]=q(Q,`\\nsucc `,`⊁`),Z.subsetneq=Z[`⊊`]=q(Q,`\\subsetneq `,`⊊`),Z.supsetneq=Z[`⊋`]=q(Q,`\\supsetneq `,`⊋`),Z.vDash=Z[`⊨`]=q(Q,`\\vDash `,`⊨`),Z.Vdash=Z[`⊩`]=q(Q,`\\Vdash `,`⊩`),Z.Vvdash=Z[`⊪`]=q(Q,`\\Vvdash `,`⊪`),Z.VDash=Z[`⊫`]=q(Q,`\\VDash `,`⊫`),Z.nvdash=Z[`⊬`]=q(Q,`\\nvdash `,`⊬`),Z.nvDash=Z[`⊭`]=q(Q,`\\nvDash `,`⊭`),Z.nVdash=Z[`⊮`]=q(Q,`\\nVdash `,`⊮`),Z.nVDash=Z[`⊯`]=q(Q,`\\nVDash `,`⊯`),Z.vartriangleleft=Z[`⊲`]=q(Q,`\\vartriangleleft `,`⊲`),Z.vartriangleright=Z[`⊳`]=q(Q,`\\vartriangleright `,`⊳`),Z.trianglelefteq=Z[`⊴`]=q(Q,`\\trianglelefteq `,`⊴`),Z.trianglerighteq=Z[`⊵`]=q(Q,`\\trianglerighteq `,`⊵`),Z.multimap=Z[`⊸`]=q(Q,`\\multimap `,`⊸`),Z.Subset=Z[`⋐`]=q(Q,`\\Subset `,`⋐`),Z.Supset=Z[`⋑`]=q(Q,`\\Supset `,`⋑`),Z.Cap=Z[`⋒`]=q(Q,`\\Cap `,`⋒`),Z.Cup=Z[`⋓`]=q(Q,`\\Cup `,`⋓`),Z.pitchfork=Z[`⋔`]=q(Q,`\\pitchfork `,`⋔`),Z.lessdot=Z[`⋖`]=q(Q,`\\lessdot `,`⋖`),Z.gtrdot=Z[`⋗`]=q(Q,`\\gtrdot `,`⋗`),Z.lll=Z[`⋘`]=q(Q,`\\lll `,`⋘`),Z.ggg=Z[`⋙`]=q(Q,`\\ggg `,`⋙`),Z.lesseqgtr=Z[`⋚`]=q(Q,`\\lesseqgtr `,`⋚`),Z.gtreqless=Z[`⋛`]=q(Q,`\\gtreqless `,`⋛`),Z.curlyeqprec=Z[`⋞`]=q(Q,`\\curlyeqprec `,`⋞`),Z.curlyeqsucc=Z[`⋟`]=q(Q,`\\curlyeqsucc `,`⋟`),Z.nsim=Z[`≁`]=q(Q,`\\nsim `,`≁`),Z.lnsim=Z[`⋦`]=q(Q,`\\lnsim `,`⋦`),Z.gnsim=Z[`⋧`]=q(Q,`\\gnsim `,`⋧`),Z.precnsim=Z[`⋨`]=q(Q,`\\precnsim `,`⋨`),Z.succnsim=Z[`⋩`]=q(Q,`\\succnsim `,`⋩`),Z.ntriangleleft=Z[`⋪`]=q(Q,`\\ntriangleleft `,`⋪`),Z.ntriangleright=Z[`⋫`]=q(Q,`\\ntriangleright `,`⋫`),Z.ntrianglelefteq=Z[`⋬`]=q(Q,`\\ntrianglelefteq `,`⋬`),Z.ntrianglerighteq=Z[`⋭`]=q(Q,`\\ntrianglerighteq `,`⋭`),Z.blacksquare=Z[`∎`]=q(Q,`\\blacksquare `,`∎`),Z.colon=Z[`∶`]=q(Q,`\\colon `,`∶`),Z.llcorner=Z[`∟`]=q(Q,`\\llcorner `,`∟`),Z.dotplus=Z[`∔`]=q($,`\\dotplus `,`∔`),Z.nmid=Z[`∤`]=q($,`
|
|
333
|
+
mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`⊻`]=q($,`\\veebar `,`⊻`),Z.barwedge=Z[`⊼`]=q($,`\\barwedge `,`⊼`),Z.ltimes=Z[`⋉`]=q($,`\\ltimes `,`⋉`),Z.rtimes=Z[`⋊`]=q($,`\\rtimes `,`⋊`),Z.leftthreetimes=Z[`⋋`]=q($,`\\leftthreetimes `,`⋋`),Z.rightthreetimes=Z[`⋌`]=q($,`\\rightthreetimes `,`⋌`),Z.curlyvee=Z[`⋎`]=q($,`\\curlyvee `,`⋎`),Z.curlywedge=Z[`⋏`]=q($,`\\curlywedge `,`⋏`),Z.circledcirc=Z[`⊚`]=q($,`\\circledcirc `,`⊚`),Z.circledast=Z[`⊛`]=q($,`\\circledast `,`⊛`),Z.circleddash=Z[`⊝`]=q($,`\\circleddash `,`⊝`),Z.boxplus=Z[`⊞`]=q($,`\\boxplus `,`⊞`),Z.boxminus=Z[`⊟`]=q($,`\\boxminus `,`⊟`),Z.boxtimes=Z[`⊠`]=q($,`\\boxtimes `,`⊠`),Z.boxdot=Z[`⊡`]=q($,`\\boxdot `,`⊡`),Z[`∂`]=Z.partial,Z[`∃`]=Z.exists,Z[`∅`]=Z.varnothing,Z[`∆`]=Z.triangle,Z[`∇`]=Z.nabla,Z[`∈`]=Z.in,Z[`∊`]=Z.in,Z[`∋`]=Z.ni,Z[`∌`]=Z.notni,Z[`∍`]=Z.ni,Z[`∐`]=Z.amalg,Z[`−`]=Z[`-`],Z[`∓`]=Z.mp,Z[`∖`]=Z.setminus,Z[`∘`]=Z.circ,Z[`∙`]=Z.bullet,Z[`∝`]=Z.propto,Z[`∞`]=Z.infty,Z[`∠`]=Z.angle,Z[`∡`]=Z.measuredangle,Z[`∣`]=Z.divides,Z[`∥`]=Z.parallel,Z[`∦`]=Z.nparallel,Z[`∧`]=Z.wedge,Z[`∨`]=Z.vee,Z[`∩`]=Z.cap,Z[`∪`]=Z.cup,Z[`∮`]=Z.oint,Z[`∴`]=Z.therefore,Z[`∵`]=Z.because,Z[`∼`]=Z.sim,Z[`≀`]=Z.wr,Z[`≃`]=Z.simeq,Z[`≍`]=Z.asymp,Z[`≐`]=Z.doteq,Z[`≪`]=Z.ll,Z[`≫`]=Z.gg,Z[`≺`]=Z.prec,Z[`≻`]=Z.succ,Z[`⊂`]=Z.subset,Z[`⊃`]=Z.supset,Z[`⊆`]=Z.subseteq,Z[`⊇`]=Z.supseteq,Z[`⊈`]=Z.nsubseteq,Z[`⊉`]=Z.nsupseteq,Z[`⊏`]=Z.sqsubset,Z[`⊐`]=Z.sqsupset,Z[`⊓`]=Z.sqcap,Z[`⊔`]=Z.sqcup,Z[`⊖`]=Z.ominus,Z[`⊘`]=Z.oslash,Z[`⊙`]=Z.odot,Z[`⊢`]=Z.vdash,Z[`⊣`]=Z.dashv,Z[`⊤`]=Z.top,Z[`⊥`]=Z.bot,Z[`⊧`]=Z.models,Z[`⋀`]=Z.wedge,Z[`⋁`]=Z.vee,Z[`⋂`]=Z.cap,Z[`⋃`]=Z.cup,Z[`⋄`]=Z.diamond,Z[`⋅`]=Z.cdot,Z[`⋆`]=Z.star,Z[`⋈`]=Z.bowtie,Z[`⋮`]=Z.vdots,Z[`⋯`]=Z.cdots,Z[`⋱`]=Z.ddots;var _Q,vQ=mZ,yQ=document.createElement(`div`).style,bQ={transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1},xQ;for(var SQ in bQ)if(SQ in yQ){xQ=SQ;break}xQ?_Q=function(e,t,n){e.css(xQ,`scale(`+t+`,`+n+`)`)}:`filter`in yQ?(vQ=function(e){e.className=e.className},_Q=function(e,t,n){t/=1+(n-1)/2,e.css(`fontSize`,n+`em`),e.hasClass(`mq-matrixed-container`)||e.addClass(`mq-matrixed-container`).wrapInner(`<span class="mq-matrixed"></span>`);var r=e.children().css(`filter`,`progid:DXImageTransform.Microsoft.Matrix(M11=`+t+`,SizingMethod='auto expand')`);function i(){e.css(`marginRight`,(r.width()-1)*(t-1)/t+`px`)}i();var a=setInterval(i);sZ(window).load(function(){clearTimeout(a),i()})}):_Q=function(e,t,n){e.css(`fontSize`,n+`em`)};var CQ=J(qZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`>&0</`+n+`>`)}}),wQ=J(qZ,function(e,t){e.init=function(e,n,r){this.args=arguments,this.htmlTemplate=`<`+n+` `+r+`><`+n+` class="mq-xarrow-over">&0</`+n+`><`+n+` class="mq-xarrow-under"></`+n+`></`+n+`>`,t.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`(`,`)`]},e.parser=function(){var e=this;return GZ.optBlock.then(function(t){return GZ.block.map(function(n){var r=TQ.apply(null,e.args);return r.blocks=[t,n],t.adopt(r,0,0),n.adopt(r,t,0),r})}).or(t.parser.call(this))}}),TQ=J(wQ,function(e,t){e.init=function(e,t,n){this.htmlTemplate=`<`+t+` `+n+`><`+t+` class="mq-xarrow-over">&1</`+t+`><`+t+` class="mq-xarrow-under">&0</`+t+`></`+t+`>`,qZ.prototype.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`[`,`](`,`)`]},e.latex=function(){return this.ctrlSeq+`[`+this.ends[Y].latex()+`]{`+this.ends[X].latex()+`}`},e.finalizeTree=function(){this.downInto=this.ends[Y].upOutOf=this.ends[X],this.upInto=this.ends[X].downOutOf=this.ends[Y]}}),EQ=function(e){var t=`<span class="`+e+`-inner-right">g</span><span class="`+e+`-inner-left">h</span>`;return J(qZ,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`<span class="mq-empty-box">&0</span></`+i+`></`+i+`>`)}})},DQ=J(qZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`><span class="mq-longdiv-curve-border">)</span><span class="mq-longdiv-inner"><span class="mq-empty">&0</span></`+n+`></span>`)}}),OQ=J(qZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-row"><p>`+r+`</p><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td><td class="mq-empty"></td><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),kQ=J(qZ,function(e,t){e.init=function(e){t.init.call(this,e,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>`)}}),AQ=J(qZ,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-col"><p>`+r+`</p></span><span class="matrix-edit-content-col"><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),jQ=function(e,t){return J(JZ,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`</`+i+`></`+i+`>`)}})};Z.mathrm=q(CQ,`\\mathrm`,`span`,`class="mq-roman mq-font"`),Z.mathit=q(CQ,`\\mathit`,`i`,`class="mq-font"`),Z.mathbf=q(CQ,`\\mathbf`,`b`,`class="mq-font"`),Z.mathsf=q(CQ,`\\mathsf`,`span`,`class="mq-sans-serif mq-font"`),Z.mathtt=q(CQ,`\\mathtt`,`span`,`class="mq-monospace mq-font"`),Z.underline=q(CQ,`\\underline`,`span`,`class="mq-non-leaf mq-underline"`),Z.overline=Z.bar=q(EQ(`mq-overline`),`\\overline`,`span`,`class="mq-non-leaf mq-overline"`),Z.longdiv=q(DQ,`\\longdiv`,`span`,`class="mq-non-leaf mq-longdiv"`),Z.overrightarrow=q(EQ(`mq-overarrow`),`\\overrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-right"`),Z.overleftarrow=q(EQ(`mq-overarrow`),`\\overleftarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-left"`),Z.xleftarrow=q(wQ,`\\xleftarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-left"`),Z.xrightarrow=q(wQ,`\\xrightarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-right"`),Z.overleftrightarrow=q(CQ,`\\overleftrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-both"`),Z.overarc=q(CQ,`\\overarc`,`span`,`class="mq-non-leaf mq-overarc"`),Z.dot=J(qZ,function(e,t){e.init=function(){t.init.call(this,`\\dot`,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>`)}}),Z.addmatrixrow=q(OQ,`\\addmatrixrow`,`span`,`+`),Z.addmatrixcol=q(AQ,`\\addmatrixcol`,`span`,`+`),Z.ngtr=Z[`≯`]=q(jQ(`mq-ngtr`,`≯`),`\\ngtr `,`span`,`class="mq-non-leaf mq-ngtr"`),Z.nless=Z[`≮`]=q(jQ(`mq-nless`,`≮`),`\\nless `,`span`,`class="mq-non-leaf mq-nless"`),Z.dot=q(kQ,`\\dot`),Z.parallelogram=q(jQ(`mq-parallelogram`,`▱`),`\\parallelogram `,`span`,`class="mq-non-leaf mq-parallelogram"`),Z.textcolor=J(qZ,function(e,t){e.setColor=function(e){this.color=e,this.htmlTemplate=`<span class="mq-textcolor" style="color:`+e+`">&0</span>`},e.latex=function(){return`\\textcolor{`+this.color+`}{`+this.blocks[0].latex()+`}`},e.parser=function(){var e=this,n=HZ.optWhitespace,r=HZ.string,i=HZ.regex;return n.then(r(`{`)).then(i(/^[#\w\s.,()%-]*/)).skip(r(`}`)).then(function(n){return e.setColor(n),t.parser.call(e)})},e.isStyleBlock=function(){return!0}}),Z.class=J(qZ,function(e,t){e.parser=function(){var e=this,n=HZ.string,r=HZ.regex;return HZ.optWhitespace.then(n(`{`)).then(r(/^[-\w\s\\\xA0-\xFF]*/)).skip(n(`}`)).then(function(n){return e.cls=n||``,e.htmlTemplate=`<span class="mq-class `+n+`">&0</span>`,t.parser.call(e)})},e.latex=function(){return`\\class{`+this.cls+`}{`+this.blocks[0].latex()+`}`},e.isStyleBlock=function(){return!0}});var MQ=J(qZ,function(e,t){e.ctrlSeq=`_{...}^{...}`,e.createLeftOf=function(e){if(!(!this.replacedFragment&&!e[Y]&&e.options.supSubsRequireOperand))return t.createLeftOf.apply(this,arguments)},e.contactWeld=function(e){for(var t=Y;t;t=t===Y&&X)if(this[t]instanceof MQ){for(var n=`sub`;n;n=n===`sub`&&`sup`){var r=this[n],i=this[t][n];if(r){if(!i)this[t].addBlock(r.disown());else if(r.isEmpty())var a=xZ(i,0,i.ends[Y]);else{r.jQ.children().insAtDirEnd(-t,i.jQ);var o=r.children().disown(),a=xZ(i,o.ends[X],i.ends[Y]);t===Y?o.adopt(i,i.ends[X],0):o.adopt(i,0,i.ends[Y])}this.placeCursor=function(e,n){return function(r){r.insAtDirEnd(-t,e||n)}}(i,r)}}this.remove(),e&&e[Y]===this&&(t===X&&a?a[Y]?e.insRightOf(a[Y]):e.insAtLeftEnd(a.parent):e.insRightOf(this[t]));break}},jZ.p.charsThatBreakOutOfSupSub=``,e.finalizeTree=function(){this.ends[Y].write=function(e,t){if(e.options.autoSubscriptNumerals&&this===this.parent.sub){if(t===`_`)return;var n=this.chToCmd(t,e.options);return n instanceof JZ?e.deleteSelection():e.clearSelection().insRightOf(this.parent),n.createLeftOf(e.show())}e[Y]&&!e[X]&&!e.selection&&e.options.charsThatBreakOutOfSupSub.indexOf(t)>-1&&e.insRightOf(this.parent),YZ.p.write.apply(this,arguments)}},e.moveTowards=function(e,n,r){n.options.autoSubscriptNumerals&&!this.sup?n.insDirOf(e,this):t.moveTowards.apply(this,arguments)},e.deleteTowards=function(e,n){if(n.options.autoSubscriptNumerals&&this.sub){var r=this.sub.ends[-e];r instanceof JZ?r.remove():r&&r.deleteTowards(e,n.insAtDirEnd(-e,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(Y,n.insAtLeftEnd(this.sub)),this.sup&&n.insDirOf(-e,this))}else t.deleteTowards.apply(this,arguments)},e.latex=function(){function e(e,t){var n=t&&t.latex();return t?e+(n.length===1?n:`{`+(n||` `)+`}`):``}return e(`_`,this.sub)+e(`^`,this.sup)},e.addBlock=function(e){this.supsub===`sub`?(this.sup=this.upInto=this.sub.upOutOf=e,e.adopt(this,this.sub,0).downOutOf=this.sub,e.jQ=sZ(`<span class="mq-sup"/>`).append(e.jQ.children()).attr(dZ,e.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=e,e.adopt(this,0,this.sup).upOutOf=this.sup,e.jQ=sZ(`<span class="mq-sub"></span>`).append(e.jQ.children()).attr(dZ,e.id).appendTo(this.jQ.removeClass(`mq-sup-only`)),this.jQ.append(`<span style="display:inline-block;width:0">​</span>`));for(var t=0;t<2;t+=1)(function(e,t,n,r){e[t].deleteOutOf=function(i,a){if(a.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var o=this.ends[i];this.children().disown().withDirAdopt(i,a.parent,a[i],a[-i]).jQ.insDirOf(-i,a.jQ),a[-i]=o}e.supsub=n,delete e[t],delete e[r+`Into`],e[n][r+`OutOf`]=NQ,delete e[n].deleteOutOf,t===`sub`&&sZ(e.jQ.addClass(`mq-sup-only`)[0].lastChild).remove(),this.remove()}})(this,`sub sup`.split(` `)[t],`sup sub`.split(` `)[t],`down up`.split(` `)[t])},e.reflow=function(){var e=this.jQ,t=e.prev();if(t.length){var n=e.children(`.mq-sup`);if(n.length){var r=parseInt(n.css(`font-size`)),i=n.offset().top+n.height()-t.offset().top-.7*r,a=parseInt(n.css(`margin-bottom`));n.css(`margin-bottom`,a+i)}}}});function NQ(e){var t=this.parent,n=e;do{if(n[X])return e.insLeftOf(t);n=n.parent.parent}while(n!==t);e.insRightOf(t)}Z.subscript=Z._=J(MQ,function(e,t){e.supsub=`sub`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&0</span></span><span style="display:inline-block;width:0">​</span></span>`,e.textTemplate=[`_`],e.finalizeTree=function(){this.downInto=this.sub=this.ends[Y],this.sub.upOutOf=NQ,t.finalizeTree.call(this)}}),Z.superscript=Z.supscript=Z[`^`]=J(MQ,function(e,t){e.supsub=`sup`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`^`],e.finalizeTree=function(){this.upInto=this.sup=this.ends[X],this.sup.downOutOf=NQ,t.finalizeTree.call(this)}});var PQ=J(qZ,function(e,t){e.parser=function(){for(var e=HZ.string,t=HZ.optWhitespace,n=HZ.succeed,r=GZ.block,i=this,a=i.blocks=[YZ(),YZ()],o=0;o<a.length;o+=1)a[o].adopt(i,i.ends[X],0);return t.then(e(`_`).or(e(`^`))).then(function(e){var t=a[e===`_`?0:1];return r.then(function(e){return e.children().adopt(t,t.ends[X],0),n(i)})}).many().result(i)},e.finalizeTree=function(){this.downInto=this.ends[Y],this.upInto=this.ends[X],this.ends[Y].upOutOf=this.ends[X],this.ends[X].downOutOf=this.ends[Y]}}),FQ=J(PQ,function(e,t){e.init=function(e,t){var n=`<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>`+t+`</big><span class="mq-from"><span>&0</span></span></span>`;JZ.prototype.init.call(this,e,n)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[Y].latex())+`^`+e(this.ends[X].latex())},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments),e.options.sumStartsWithNEquals&&(iQ(`n`).createLeftOf(e),gQ().createLeftOf(e))}});Z[`∑`]=Z.sum=Z.summation=q(FQ,`\\sum `,`∑`),Z[`∏`]=Z.prod=Z.product=q(FQ,`\\prod `,`∏`),Z.coprod=Z.coproduct=q(FQ,`\\coprod `,`∐`),Z[`∫`]=Z.int=Z.integral=J(FQ,function(e,t){e.init=function(){JZ.prototype.init.call(this,`\\int `,`<span class="mq-int mq-non-leaf"><big>∫</big><span class="mq-supsub mq-non-leaf"><span class="mq-sup"><span class="mq-sup-inner">&1</span></span><span class="mq-sub">&0</span><span style="display:inline-block;width:0">​</span></span></span>`)},e.createLeftOf=qZ.p.createLeftOf}),Z.lim=Z.limit=J(PQ,function(e,t){e.init=function(){JZ.prototype.init.call(this,`\\lim `,`<span class="mq-lim mq-non-leaf"><span class="mq-un-italicized">lim</span><span class="mq-approaches"><span>&0</span></span></span>`)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[Y].latex())}});var IQ=Z.over=TZ[`/`]=J(Z.frac=Z.dfrac=Z.cfrac=Z.fraction=J(qZ,function(e,t){e.ctrlSeq=`\\frac`,e.htmlTemplate=`<span class="mq-fraction mq-non-leaf"><span class="mq-numerator"><span class="mq-empty-box">&0</span></span><span class="mq-denominator"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0">​</span></span>`,e.textTemplate=[`(`,`)/(`,`)`],e.finalizeTree=function(){this.upInto=this.ends[X].upOutOf=this.ends[Y],this.downInto=this.ends[Y].downOutOf=this.ends[X]}}),function(e,t){e.createLeftOf=function(e){if(!this.replacedFragment){for(var n=e[Y];n&&!(n instanceof $||n instanceof(Z.text||mZ)||n instanceof FQ||n.ctrlSeq===`\\ `||/^[,;:]$/.test(n.ctrlSeq));)n=n[Y];n instanceof FQ&&n[X]instanceof MQ&&(n=n[X],n[X]instanceof MQ&&n[X].ctrlSeq!=n.ctrlSeq&&(n=n[X])),n!==e[Y]&&!e.isTooDeep(1)&&(this.replaces(wZ(n[X]||e.parent.ends[Y],e[Y])),e[Y]=n)}t.createLeftOf.call(this,e)}});Z.underset=J(qZ,function(e,t){e.ctrlSeq=`\\underset`,e.htmlTemplate=`<span class="mq-underset mq-overunder mq-non-leaf"><span class="mq-over">&1</span><span class="mq-under">&0</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[Y].upOutOf=this.ends[X],this.upInto=this.ends[X].downOutOf=this.ends[Y]}}),Z.overset=J(qZ,function(e,t){e.ctrlSeq=`\\overset`,e.htmlTemplate=`<span class="mq-overset mq-overunder mq-non-leaf"><span class="mq-over">&0</span><span class="mq-under">&1</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[X].upOutOf=this.ends[Y],this.upInto=this.ends[Y].downOutOf=this.ends[X]}});var LQ=Z.sqrt=Z[`√`]=J(qZ,function(e,t){e.ctrlSeq=`\\sqrt`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-sqrt-prefix">√</span><span class="mq-non-leaf mq-sqrt-stem"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt(`,`)`],e.parser=function(){return GZ.optBlock.then(function(e){return GZ.block.map(function(t){var n=RQ();return n.blocks=[e,t],e.adopt(n,0,0),t.adopt(n,e,0),n})}).or(t.parser.call(this))},e.reflow=function(){var e=this.ends[X].jQ.parent();_Q(e.prev(),1,e.innerHeight()/+e.css(`fontSize`).slice(0,-2)-.1)}});Z.hat=J(qZ,function(e,t){e.ctrlSeq=`\\hat`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-hat-prefix">^</span><span class="mq-hat-stem">&0</span></span>`,e.textTemplate=[`hat(`,`)`]});var RQ=Z.nthroot=J(LQ,function(e,t){e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">&0</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&1</span></span></span>`,e.textTemplate=[`sqrt[`,`](`,`)`],e.latex=function(){return`\\sqrt[`+this.ends[Y].latex()+`]{`+this.ends[X].latex()+`}`}}),zQ=J(qZ,function(e,t){e.init=function(e,n,r){var i=`<span class="mq-non-leaf"><span class="mq-diacritic-above">`+n+`</span><span class="mq-diacritic-stem">&0</span></span>`;t.init.call(this,e,i,r)}});Z.vec=q(zQ,`\\vec`,`→`,[`vec(`,`)`]),Z.tilde=q(zQ,`\\tilde`,`~`,[`tilde(`,`)`]),Z.lrncuberoot=J(LQ,function(e,t){e.ctrlSeq=`\\lrncuberoot`,e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">3</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt[3](`,`)`],e.latex=function(){return`\\sqrt[3]{`+this.ends[Y].latex()+`}`}}),Z.abs=J(qZ,function(e){e.ctrlSeq=`\\abs`,e.htmlTemplate=`<span class="mq-abs mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[`|`,`|`]}),Z.lrnplaceholder=J(qZ,function(e,t){e.ctrlSeq=`\\lrnplaceholder`,e.htmlTemplate=`<span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[``],e.latex=function(){return this.ends[Y].latex()}}),Z.lrnexponent=J(qZ,function(e,t){e.ctrSeq=`\\lrnexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&1</span></span></span></span>`,e.textTemplate=[``,`**`],e.latex=function(){var e=this.ends[X].latex();return e.length>1?e=`{`+e+`}`:e.length===0&&(e=`{ }`),this.ends[Y].latex()+`^`+e}}),Z.lrnsquaredexponent=J(qZ,function(e,t){e.ctrSeq=`\\lrnsquaredexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">2</span></span></span></span>`,e.textTemplate=[``,`**2`],e.latex=function(){return this.ends[Y].latex()+`^2`}}),Z.lrnsubscript=J(qZ,function(e,t){e.ctrSeq=`\\lrnsubscript`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0"> </span></span></span>`,e.textTemplate=[``,`_`],e.latex=function(){return this.ends[Y].latex()+`_`+this.ends[X].latex()}});function BQ(e,t){e.jQadd=function(){t.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(`:first`).add(this.jQ.children(`:last`)),this.contentjQ=this.jQ.children(`:eq(1)`)},e.reflow=function(){var e=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css(`fontSize`));_Q(this.delimjQs,fZ(1+.2*(e-1),1.2),1.2*e)}}var VQ=J(J(qZ,BQ),function(e,t){e.init=function(e,n,r,i,a){t.init.call(this,`\\left`+i,lZ,[n,r]),this.side=e,this.sides={},this.sides[Y]={ch:n,ctrlSeq:i},this.sides[X]={ch:r,ctrlSeq:a}},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-paren`+(this.side===X?` mq-ghost`:``)+`">`+this.sides[Y].ch+`</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren`+(this.side===Y?` mq-ghost`:``)+`">`+this.sides[X].ch+`</span></span>`,t.html.call(this)},e.latex=function(){return`\\left`+this.sides[Y].ctrlSeq+this.ends[Y].latex()+`\\right`+this.sides[X].ctrlSeq},e.matchBrack=function(e,t,n){return n instanceof VQ&&n.side&&n.side!==-t&&(!e.restrictMismatchedBrackets||HQ[this.sides[this.side].ch]===n.sides[n.side].ch||{"(":`]`,"[":`)`}[this.sides[Y].ch]===n.sides[X].ch)&&n},e.closeOpposing=function(e){e.side=0,e.sides[this.side]=this.sides[this.side],e.delimjQs.eq(this.side===Y?0:1).removeClass(`mq-ghost`).html(this.sides[this.side].ch)},e.createLeftOf=function(e){if(!this.replacedFragment){var n=e.options;if(this.sides[Y].ch===`|`)var r=this.matchBrack(n,X,e[X])||this.matchBrack(n,Y,e[Y])||this.matchBrack(n,0,e.parent.parent);else var r=this.matchBrack(n,-this.side,e[-this.side])||this.matchBrack(n,-this.side,e.parent.parent)}if(r){var i=this.side=-r.side;this.closeOpposing(r),r===e.parent.parent&&e[i]&&wZ(e[i],e.parent.ends[i],-i).disown().withDirAdopt(-i,r.parent,r,r[i]).jQ.insDirOf(i,r.jQ),r.bubble(`reflow`)}else r=this,i=r.side,r.replacedFragment?r.side=0:e[-i]&&(r.replaces(wZ(e[-i],e.parent.ends[-i],i)),e[-i]=0),t.createLeftOf.call(r,e);i===Y?e.insAtLeftEnd(r.ends[Y]):e.insRightOf(r)},e.placeCursor=mZ,e.unwrap=function(){this.ends[Y].children().disown().adopt(this.parent,this,this[X]).jQ.insertAfter(this.jQ),this.remove()},e.deleteSide=function(e,t,n){var r=this.parent,i=this[e],a=r.ends[e];if(e===this.side){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}var o=n.options,s=!this.side;if(this.side=-e,this.matchBrack(o,e,this.ends[Y].ends[this.side])){this.closeOpposing(this.ends[Y].ends[this.side]);var c=this.ends[Y].ends[e];this.unwrap(),c.siblingCreated&&c.siblingCreated(n.options,e),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r)}else{if(this.matchBrack(o,e,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else if(t&&s){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}else this.sides[e]={ch:HQ[this.sides[this.side].ch],ctrlSeq:HQ[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass(`mq-ghost`).eq(e===Y?0:1).addClass(`mq-ghost`).html(this.sides[e].ch);if(i){var c=this.ends[Y].ends[e];wZ(i,a,-e).disown().withDirAdopt(-e,this.ends[Y],c,0).jQ.insAtDirEnd(e,this.ends[Y].jQ.removeClass(`mq-empty`)),c.siblingCreated&&c.siblingCreated(n.options,e),n.insDirOf(-e,i)}else t?n.insDirOf(e,this):n.insAtDirEnd(e,this.ends[Y])}},e.deleteTowards=function(e,t){this.deleteSide(-e,!1,t)},e.finalizeTree=function(){this.ends[Y].deleteOutOf=function(e,t){this.parent.deleteSide(e,!0,t)},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(+(this.side===Y)).removeClass(`mq-ghost`),this.side=0}},e.siblingCreated=function(e,t){t===-this.side&&this.finalizeTree()}}),HQ={"(":`)`,")":`(`,"[":`]`,"]":`[`,"{":`}`,"}":`{`,"\\{":`\\}`,"\\}":`\\{`,"⟨":`⟩`,"⟩":`⟨`,"\\langle ":`\\rangle `,"\\rangle ":`\\langle `,"|":`|`,"\\lVert ":`\\rVert `,"\\rVert ":`\\lVert `};function UQ(e,t){var t=t||e,n=HQ[e],r=HQ[t];TZ[e]=q(VQ,Y,e,n,t,r),TZ[n]=q(VQ,X,e,n,t,r)}UQ(`(`),UQ(`[`),UQ(`{`,`\\{`),Z.langle=q(VQ,Y,`⟨`,`⟩`,`\\langle `,`\\rangle `),Z.rangle=q(VQ,X,`⟨`,`⟩`,`\\langle `,`\\rangle `),TZ[`|`]=q(VQ,Y,`|`,`|`,`|`,`|`),Z.lVert=q(VQ,Y,`∥`,`∥`,`\\lVert `,`\\rVert `),Z.rVert=q(VQ,X,`∥`,`∥`,`\\lVert `,`\\rVert `),Z.left=J(qZ,function(e){e.parser=function(){var e=HZ.regex,t=HZ.string;HZ.succeed;var n=HZ.optWhitespace;return n.then(e(/^(?:[([|]|\\\{|\\langle(?![a-zA-Z])|\\lVert(?![a-zA-Z]))/)).then(function(r){var i=r.charAt(0)===`\\`?r.slice(1):r;return r==`\\langle`&&(i=`⟨`,r+=` `),r==`\\lVert`&&(i=`∥`,r+=` `),GZ.then(function(a){return t(`\\right`).skip(n).then(e(/^(?:[\])|]|\\\}|\\rangle(?![a-zA-Z])|\\rVert(?![a-zA-Z]))/)).map(function(e){var t=e.charAt(0)===`\\`?e.slice(1):e;e==`\\rangle`&&(t=`⟩`,e+=` `),e==`\\rVert`&&(t=`∥`,e+=` `);var n=VQ(0,i,t,r,e);return n.blocks=[a],a.adopt(n,0,0),n})})})}}),Z.right=J(qZ,function(e){e.parser=function(){return HZ.fail(`unmatched \\right`)}}),Z.choose=J(Z.binom=Z.binomial=J(J(qZ,BQ),function(e,t){e.ctrlSeq=`\\binom`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-paren mq-scaled">(</span><span class="mq-non-leaf"><span class="mq-array mq-non-leaf"><span>&0</span><span>&1</span></span></span><span class="mq-paren mq-scaled">)</span></span>`,e.textTemplate=[`choose(`,`,`,`)`]}),function(e){e.createLeftOf=IQ.prototype.createLeftOf}),Z.editable=Z.MathQuillMathField=J(qZ,function(e,t){e.ctrlSeq=`\\MathQuillMathField`,e.htmlTemplate=`<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>`,e.parser=function(){var e=this,n=HZ.string,r=HZ.regex,i=HZ.succeed;return n(`[`).then(r(/^[a-z][a-z0-9]*/i)).skip(n(`]`)).map(function(t){e.name=t}).or(i()).then(t.parser.call(e))},e.finalizeTree=function(e){var t=kZ(this.ends[Y],this.jQ,e);t.KIND_OF_MQ=`MathField`,t.editable=!0,t.createTextarea(),t.editablesTextareaEvents(),t.cursor.insAtRightEnd(t.root),VZ(t.root)},e.registerInnerField=function(e,t){e.push(e[this.name]=t(this.ends[Y].controller))},e.latex=function(){return this.ends[Y].latex()},e.text=function(){return this.ends[Y].text()}});var WQ=Z.embed=J(JZ,function(e,t){e.setOptions=function(e){function t(){return``}return this.text=e.text||t,this.htmlTemplate=e.htmlString||``,this.latex=e.latex||t,this},e.parser=function(){var e=this,t=HZ.string,n=HZ.regex,r=HZ.succeed;return t(`{`).then(n(/^[a-z][a-z0-9]*/i)).skip(t(`}`)).then(function(i){return t(`[`).then(n(/^[-\w\s]*/)).skip(t(`]`)).or(r()).map(function(t){return e.setOptions(PZ[i](t))})})}});Z.MathQuillResponseContainer=J(qZ,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainer`,e.htmlTemplate=`<span class="lrn-mq-response-container"><marker class="lrn-qe-keyboard-i-response"></marker><content>Response</content></span>`,e.latex=function(){return`\\MathQuillResponseContainer`},e.text=function(){return this.ends[Y].text()}}),Z.MathQuillResponseContainerIcon=J(qZ,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainerIcon`,e.htmlTemplate=`<span class="lrn-mq-response-container-icon"><span class="lrn-qe-keyboard-i-response"></span></span>`,e.latex=function(){return`\\MathQuillResponseContainerIcon`},e.text=function(){return this.ends[Y].text()}});var GQ=Z.matrix=J(qZ,function(e,t){var n=J(YZ,function(e,t){e.init=function(e,n){return this.column=e,this.row=n,t.init.call(this)},e.keystroke=function(e,n,r){switch(e){case`Shift-Spacebar`:return n.preventDefault(),this.parent.insertColumn(this);case`Shift-Enter`:return this.parent.insertRow(this)}return t.keystroke.apply(this,arguments)},e.deleteOutOf=function(e,n){var r=this,i=arguments;this.parent.backspace(this,e,n,function(){return t.deleteOutOf.apply(r,i)})}}),r={column:`&`,row:`\\\\`};e.parentheses={left:null,right:null},e.maximum={rows:5,columns:5},e.defaults={rows:2,columns:2},e.ctrlSeq=`\\matrix`,e.createBlocks=function(){var e=this,t=e.blocks=[],r,i,a=0;this.htmlTemplate.replace(/&\d+/g,function(o,s){var c=e.htmlTemplate.substring(0,s).match(/<tr[^>]*>/gi).length-1;i=r===c?i+1:0,t[a]=n(i,c),t[a].adopt(e,e.ends[X],0),r=c,a++})},e.reflow=function(){var e=this.jQ.children(`table`),t=e.outerHeight()/+e.css(`fontSize`).slice(0,-2),n=this.jQ.children(`.mq-paren`);n.length&&_Q(n,fZ(1+.2*(t-1),1.2),1.05*t)},e.latex=function(){var e=this.getMatrixName(),t=`\\begin{`+e+`}`,n,i,a;for(a=0;a<this.blocks.length;a++)n=this.blocks[a].row,i!==void 0&&(i===n?t+=r.column:t+=r.row),i=n,t+=this.blocks[a].latex();return t+=`\\end{`+e+`}`,t},e.createLeftOf=function(n){this.cursor=n;var r=Math.min(this.defaults.rows,this.maximum.rows),i=Math.min(this.defaults.columns,this.maximum.columns);this.defaultHtmlTemplate=this.defaultHtmlTemplate||this.generateHtmlTemplate(r,i),e.htmlTemplate=this.defaultHtmlTemplate,t.createLeftOf.call(this,n)},e.getMatrixName=function(){return this.ctrlSeq.replace(`\\`,``)},e.generateHtmlTemplate=function(e,t){var n=`<span class="mq-matrix mq-non-leaf">`+o(this.parentheses.left);n+=`<table class="mq-non-leaf">`,e=Math.min(e,this.maximum.rows),t=Math.min(t,this.maximum.columns);for(var r=0,i=0;i<e;i++){n+=`<tr>`;for(var a=0;a<t;a++)n+=`<td>&`+r+`</td>`,r++;n+=`</tr>`}return n+=`</table>`,n+=o(this.parentheses.right)+`</span>`,n;function o(e){return e?`<span class="mq-paren mq-scaled">`+e+`</span>`:``}},e.htmlTemplate=e.generateHtmlTemplate(1,1),e.parser=function(){var e=HZ.regex,t=this,i=this.getMatrixName(),a=RegExp(`^(.*?)\\\\end{`+i+`}`),o=RegExp(`\\\\end{`+i+`}`);return e(a).then(function(e){var i=e.replace(o,``),a=[],s=i.split(r.row),c=Math.min(s.length,t.maximum.rows),l=0,u,d;for(d=0;d<c;d++)u=s[d].split(r.column),l=Math.max(l,u.length);for(l=Math.min(l,t.maximum.columns),d=0;d<c;d++){u=s[d].split(r.column);for(var e=0;e<l;e++){var f=n(e,d);GZ.parse(u[e]||` `).children().adopt(f,f.ends[X],0),a.push(f)}}t.htmlTemplate=t.generateHtmlTemplate(c,l),t.blocks=a;for(var d=0;d<a.length;d+=1)a[d].adopt(t,t.ends[X],0);return HZ.succeed(t)})},e.finalizeTree=function(){var e=this.jQ.find(`table`);e.length&&(this.relink(),e.removeClass(function(e,t){var n=t.match(/mq-rows-\d+/g);return n&&n.join(` `)||``}),e.addClass(`mq-rows-`+e.find(`tr`).length))},e.relink=function(){var e=this.jQ.find(`td`),t=SZ.byId[e.first().attr(dZ)],n=SZ.byId[e.last().attr(dZ)],r=e.eq(0).closest(`tr`),i=[];e.each(function(t){var n=SZ.byId[sZ(this).attr(dZ)],a=e.eq(t+1),o=sZ(this).closest(`tr`).next(`tr`),s=sZ(this).closest(`tr`).index(),c=sZ(this).index(),l;if(a.length){var u=SZ.byId[a.attr(dZ)];n[X]=u,u[Y]=n}if(l=o.length?o.find(`td`).eq(c):r.find(`td`).eq(c+1),l.length){var d=SZ.byId[l.attr(dZ)];n.downOutOf=d,d.upOutOf=n}n.column=c,n.row=s,i.push(n)}),this.ends[Y]=t,this.ends[X]=n,t&&t[Y]&&delete t[Y],n&&n[X]&&delete n[X],this.blocks=i},e.deleteCell=function(e){var t=e.jQ.closest(`tr`),n=e.jQ.index(),r=t.index(),i=t.find(`td`).not(e.jQ),a=this.jQ.find(`tr`).not(t).map(function(){return sZ(this).find(`td`)[n]}),o=this.jQ.find(`td`).length===1,s;function c(){return SZ.byId[sZ(this).attr(dZ)].isEmpty()}return i.filter(c).length===i.length&&a.length&&(i.remove(),e.jQ.remove(),t.remove(),this.finalizeTree()),a.filter(c).length===a.length&&i.length&&(a.remove(),e.jQ.remove(),this.finalizeTree()),o||(r=Math.min(r,this.jQ.find(`tr`).length-1),n=Math.min(n,this.jQ.find(`tr`).eq(r).find(`td`).length-1),s=SZ.byId[this.jQ.find(`tr`).eq(r).find(`td`).eq(n).attr(dZ)]),s},e.addRow=function(e){if(!(this.jQ.find(`tr`).length>=this.maximum.rows)){for(var t=e.find(`td`).length,r=sZ(`<tr></tr>`),i,a,o=0;o<t;o++)i=n(),i.parent=this,i.jQ=sZ(`<td class="mq-empty">`).attr(dZ,i.id),r.append(i.jQ),a||=i;return r.insertAfter(e),a}},e.addColumn=function(e){if(!(e.closest(`tr`).find(`td`).length>=this.maximum.columns)){var t=e.index(),r=e.closest(`tr`).index(),i=this,a,o=[];return this.jQ.find(`tr`).each(function(){a=n(),a.parent=i,a.jQ=sZ(`<td class="mq-empty">`).attr(dZ,a.id),a.jQ.insertAfter(sZ(this).find(`td`).eq(t)),o.push(a)}),o[r]}},e.insertColumn=function(e){newBlock=this.addColumn(e.jQ),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.insertRow=function(e){newBlock=this.addRow(e.jQ.closest(`tr`)),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.backspace=function(e,t,n,r){if(e.isEmpty()){var i=this.deleteCell(e);i?n.insAtRightEnd(i):(r(),this.finalizeTree()),this.bubble(`edited`)}}});Z.pmatrix=J(GQ,function(e,t){e.ctrlSeq=`\\pmatrix`,e.parentheses={left:`(`,right:`)`}}),Z.bmatrix=J(GQ,function(e,t){e.ctrlSeq=`\\bmatrix`,e.parentheses={left:`[`,right:`]`}}),Z.Bmatrix=J(GQ,function(e,t){e.ctrlSeq=`\\Bmatrix`,e.parentheses={left:`{`,right:`}`}}),Z.vmatrix=J(GQ,function(e,t){e.ctrlSeq=`\\vmatrix`,e.parentheses={left:`|`,right:`|`}}),Z.Vmatrix=J(GQ,function(e,t){e.ctrlSeq=`\\Vmatrix`,e.parentheses={left:`‖`,right:`‖`}});var KQ=zZ(3);for(var qQ in KQ)(function(e,t){typeof t==`function`?(IZ[e]=function(){return FZ(),t.apply(this,arguments)},IZ[e].prototype=t.prototype):IZ[e]=t})(qQ,KQ[qQ]);var JQ=function(e){e.registerEmbed(`newLine`,()=>({htmlString:`<div class="newLine"></div>`,text:()=>`testText`,latex:()=>`\\embed{newLine}[]`}))},YQ;typeof window<`u`&&(YQ=IZ.getInterface(3),YQ&&YQ.registerEmbed&&JQ(YQ));var XQ=md(`math-input:mq:input`),ZQ=L(`span`)({}),QQ=class extends M.Component{static propTypes={className:k.string,onClick:k.func,onChange:k.func,latex:k.string,onFocus:k.func,onBlur:k.func};componentDidMount(){if(!YQ)throw Error(`MQ is not defined - but component has mounted?`);this.mathField=YQ.MathField(this.input,{handlers:{edit:this.onInputEdit.bind(this)}}),this.updateLatex()}componentDidUpdate(){this.updateLatex()}updateLatex(){if(!this.mathField)return;let{latex:e}=this.props;e!=null&&this.mathField.latex(e)}clear(){return this.mathField.latex(``),``}blur(){XQ(`blur mathfield`),this.mathField.blur()}focus(){XQ(`focus mathfield...`),this.mathField.focus()}command(e){return XQ(`command: `,e),Array.isArray(e)?e.forEach(e=>{this.mathField.cmd(e)}):this.mathField.cmd(e),this.mathField.focus(),this.mathField.latex()}keystroke(e){return this.mathField.keystroke(e),this.mathField.focus(),this.mathField.latex()}write(e){return XQ(`write: `,e),this.mathField.write(e),this.mathField.focus(),this.mathField.latex()}onInputEdit=()=>{XQ(`[onInputEdit] ...`);let{onChange:e}=this.props;this.mathField&&e&&e(this.mathField.latex())};refresh=()=>{this.blur(),this.focus()};onKeyPress=e=>{if(Object.keys(this.mathField.__controller.options).indexOf(`ignoreNextMousedown`)<0&&this.refresh(),e.charCode===13){e.preventDefault();return}};onClick=e=>{let{onClick:t}=this.props;this.refresh(),t&&t(e)};shouldComponentUpdate(e){return XQ(`next: `,e.latex),XQ(`current: `,this.mathField.latex()),e.latex!==this.mathField.latex()}render(){let{onFocus:e,onBlur:t,className:n}=this.props;return(0,N.jsx)(ZQ,{className:n,onKeyDown:this.onKeyPress,onClick:this.onClick,onFocus:e,onBlur:t,ref:e=>this.input=e})}},$Q=md(`pie-lib:math-input:mq:static`),e$=/\\MathQuillMathField\[r\d*\]\{(.*?)\}/g,t$=/ /g;function n$(e=``){return e.replace(t$,``)}function r$(e){let t=0;for(let n=0;n<(e||``).length;n++)e[n]===`{`&&t++;return t}var i$=class extends M.Component{static propTypes={latex:k.string.isRequired,onFocus:k.func,onBlur:k.func,className:k.string,getFieldName:k.func,onSubFieldChange:k.func,onSubFieldFocus:k.func,setInput:k.func};static defaultProps={getFieldName:()=>{}};constructor(e){super(e),this.state={announcement:``,previousLatex:``,inputSource:null,isDeleteKeyPressed:!1},this.inputRef=M.createRef()}componentDidMount(){this.update(),GX(),this.createLiveRegion(),this.addEventListeners()}componentDidUpdate(){this.update(),GX()}componentWillUnmount(){this.removeLiveRegion(),this.removeEventListeners()}createLiveRegion=()=>{this.liveRegion=document.createElement(`div`),this.liveRegion.style.position=`absolute`,this.liveRegion.style.width=`1px`,this.liveRegion.style.height=`1px`,this.liveRegion.style.marginTop=`-1px`,this.liveRegion.style.clip=`rect(1px, 1px, 1px, 1px)`,this.liveRegion.style.overflow=`hidden`,this.liveRegion.setAttribute(`aria-live`,`polite`),this.liveRegion.setAttribute(`aria-atomic`,`true`),document.body.appendChild(this.liveRegion)};addEventListeners=()=>{let e=this.inputRef.current;e&&(e.addEventListener(`keydown`,this.handleKeyDown),e.addEventListener(`click`,this.handleMathKeyboardClick))};removeEventListeners=()=>{let e=this.inputRef.current;e&&(e.removeEventListener(`keydown`,this.handleKeyDown),e.removeEventListener(`click`,this.handleMathKeyboardClick))};removeLiveRegion=()=>{this.liveRegion&&=(document.body.removeChild(this.liveRegion),null)};handleKeyDown=e=>{(e?.key===`Backspace`||e?.key===`Delete`)&&this.setState({isDeleteKeyPressed:!0}),this.setState({inputSource:`keyboard`})};handleMathKeyboardClick=()=>{this.setState({inputSource:`mathKeyboard`})};onInputEdit=e=>{if(!this.mathField||this._isProgrammaticUpdate)return;let t=this.props.getFieldName(e,this.mathField.innerFields);if(this.props.onSubFieldChange){let n=e.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.inputRef?.current&&n&&n?.length)try{e.__controller.cursor.insLeftOf(e.__controller.cursor.parent[-1].parent),e.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}else this.props.onSubFieldChange(t,e.latex())}this.announceLatexConversion(e.latex())};announceLatexConversion=e=>{if(!this.state){console.error(`State is not initialized`);return}let{previousLatex:t,inputSource:n,isDeleteKeyPressed:r}=this.state,i=`Converted to math symbol`;if(n===`keyboard`&&!r)if(r$(e)>r$(t))this.announceMessage(i);else try{this.mathField.parseLatex(t),this.mathField.parseLatex(e),e==t&&this.announceMessage(i)}catch(e){console.warn(`Error parsing latex:`,e.message),console.warn(e)}(this.state.previousLatex!==e||this.state.isDeleteKeyPressed)&&this.setState({previousLatex:e,isDeleteKeyPressed:!1})};announceMessage=e=>{this.setState({previousLatex:``}),this.liveRegion&&(this.liveRegion.textContent=e,setTimeout(()=>{this.liveRegion.textContent=``},500))};update=()=>{if(!YQ)throw Error(`MQ is not defined - but component has mounted?`);this.mathField||=YQ.StaticMath(this.inputRef?.current,{handlers:{edit:this.onInputEdit.bind(this)}});try{this._isProgrammaticUpdate=!0,this.mathField.parseLatex(this.props.latex),this.mathField.latex(this.props.latex)}catch{this.mathField.latex(`\\MathQuillMathField[r1]{}`)}finally{this._isProgrammaticUpdate=!1}};blur=()=>{$Q(`blur mathfield`),this.mathField.blur()};focus=()=>{$Q(`focus mathfield...`),this.mathField.focus()};shouldComponentUpdate(e){try{let t=n$(this.mathField.parseLatex(e.latex)),n=(e.latex.match(e$)||[]).length,r=t!==n$(this.mathField.latex().trim())||n!==Object.keys(this.mathField.innerFields).length/2;return $Q(`[shouldComponentUpdate] `,r),r}catch(e){return console.warn(`Error parsing latex:`,e.message,`skip update`),console.warn(e),!1}}onFocus=e=>{try{let t=e.target.parentElement.nextSibling,n=parseInt(t.getAttribute(`mathquill-block-id`),10);n||=(t=t.parentElement,parseInt(t.getAttribute(`mathquill-block-id`),10));let r=this.mathField.innerFields.find(e=>e.id===n);if(r){let e=this.props.getFieldName(r,this.mathField.innerFields);this.props.setInput&&this.props.setInput(r),this.props.onSubFieldFocus(e,r)}}catch(e){console.error(`error finding root block`,e.message)}};render(){let{onBlur:e,className:t}=this.props;return(0,N.jsx)(`span`,{className:t,onFocus:this.onFocus,onBlur:e,ref:this.inputRef})}},a$={fontFamily:`MJXZERO, MJXTEX !important`,"-webkit-font-smoothing":`antialiased !important`,"& .mq-math-mode > span > var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode span var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode .mq-nonSymbola":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode > span > var.mq-operator-name":{fontFamily:`MJXZERO, MJXTEX !important`}},o$={"& .mq-longdiv-inner":{marginTop:`-1px`,marginLeft:`5px !important;`,"& > .mq-empty":{padding:`0 !important`,marginLeft:`0px !important`,marginTop:`2px`}},"& .mq-math-mode .mq-longdiv":{display:`inline-flex !important`}},s$={"& .mq-math-mode sup.mq-nthroot":{fontSize:`70% !important`,verticalAlign:`0.5em !important`,paddingRight:`0.15em`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-supsub ":{fontSize:`70.7%`},"& .mq-math-mode .mq-supsub.mq-sup-only":{verticalAlign:`-0.1em !important`,"& .mq-sup":{marginBottom:`0px !important`}},"& .mq-math-mode .mq-fraction + .mq-supsub.mq-sup-only":{verticalAlign:`0.4em !important`},"& .mq-math-mode .mq-supsub.mq-sup-only.mq-after-fraction-group":{verticalAlign:`0.4em !important`}},c$={"& *":{...a$,...o$,"& .mq-math-mode .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-longdiv-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-math-mode .mq-sqrt-stem":{marginTop:`-5px`,paddingTop:`4px`},"& .mq-math-mode .mq-paren":{verticalAlign:`middle !important`},"& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ":{padding:`0 !important`}}},l$={commonMqFontStyles:a$,longdivStyles:o$,supsubStyles:s$,commonMqKeyboardStyles:c$},u$=e=>(de(5-e.length,()=>e.push([])),fe.apply(null,e)),d$=md(`pie-lib:math-inline:keypad`),f$=L(i$)(({latex:e})=>{let t={pointerEvents:`none`,textTransform:`none !important`,color:lu(),"& .mq-scaled.mq-sqrt-prefix":{transform:`scale(1, 0.9) !important`},"& .mq-sup-only .mq-sup":{marginBottom:`0.9px !important`},"& .mq-empty":{backgroundColor:`${rd()} !important`},"& .mq-overline .mq-overline-inner":{borderTop:`2px solid black`},"& .mq-non-leaf.mq-overline":{borderTop:`none !important`},"& .mq-overarrow":{width:`30px`,marginTop:`0 !important`,borderTop:`2px solid black`,fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`,"&.mq-arrow-both":{top:`0px !important`,"& *":{lineHeight:`1 !important`,borderTop:`none !important`},"&:before":{fontSize:`80%`,left:`calc(-13%) !important`,top:`-0.31em !important`},"&:after":{fontSize:`80% !important`,right:`calc(-13%) !important`,top:`-1.5em`},"&.mq-empty:before":{fontSize:`80%`,left:`calc(-13%)`,top:`-0.26em`},"&.mq-empty:after":{fontSize:`80%`,right:`calc(-13%)`,top:`-0.26em`},"&.mq-empty":{minHeight:`1.4em`}},"&.mq-arrow-right:before":{fontSize:`80%`,right:`calc(-13%) !important`,top:`-0.26em !important`},"& .mq-overarrow-inner":{border:`none !important`},"& .mq-overarrow-inner .mq-overarrow-inner-right":{display:`none !important`}},"& .mq-root-block":{padding:`5px !important`},"& .mq-overarrow.mq-arrow-both.mq-empty:after":{right:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-right.mq-empty:before":{right:`-5px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-both.mq-empty:before":{left:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},"& .mq-overarc":{borderTop:`2px solid black !important`,"& .mq-overline":{borderTop:`none !important`},"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`}}};return e===`\\parallel`?{...t,fontStyle:`italic !important`}:e===`\\overleftrightarrow{\\overline{}}`?{...t,"& .mq-overarrow.mq-arrow-both":{"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`},"&:after":{position:`absolute !important`,top:`0px !important`}}}:t});f$.propTypes={latex:k.string.isRequired};var p$=e=>e?{gridTemplateColumns:`repeat(${e.columns}, minmax(min-content, 150px))`,gridTemplateRows:`repeat(${e.rows}, minmax(40px, 60px))`,gridAutoFlow:`initial`}:{},m$=L(`div`)(()=>({...c$,width:`100%`,display:`grid`,gridTemplateRows:`repeat(5, minmax(40px, 60px))`,gridRowGap:`0px`,gridColumnGap:`0px`,gridAutoFlow:`column`,"&.character":{textTransform:`initial !important`,gridTemplateRows:`repeat(5, minmax(40px, 50px)) !important`},"&.language":{gridTemplateRows:`repeat(4, minmax(40px, 50px)) !important`,"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),h$=L(Ef)(({category:e,isDelete:t,isComma:n,isDot:r})=>({minWidth:`auto`,textTransform:`none`,fontSize:n||r?`200% !important`:`140% !important`,lineHeight:n||r?`100%`:`normal`,color:lu(),backgroundColor:e===`operators`?nd():td(),"&:hover":{backgroundColor:e===`operators`?ad():id()},borderRadius:0,...t&&{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),g$=L(Ef)(({category:e})=>({textTransform:`none`,padding:0,margin:0,fontSize:`110% !important`,minWidth:`auto`,borderRadius:0,backgroundColor:e===`operators`?nd():td(),"&:hover":{backgroundColor:e===`operators`?ad():id()}})),_$=L(aJ)(({category:e})=>({minWidth:`auto`,backgroundColor:e===`operators`?nd():td(),"&:hover":{backgroundColor:e===`operators`?ad():id()},borderRadius:0,"& .icon":{height:`30px`}})),v$=class extends M.Component{static propTypes={className:k.string,controlledKeypadMode:k.bool,baseSet:k.array,additionalKeys:k.array,layoutForKeyPad:k.object,onPress:k.func.isRequired,onFocus:k.func,noDecimal:k.bool,setKeypadInteraction:k.func,mode:k.oneOfType([k.string,k.number])};static defaultProps={baseSet:iZ,noDecimal:!1};constructor(e){super(e),this.keypadRef=M.createRef()}componentDidMount(){let e=this.keypadRef?.current,t=e?.closest(`.main-container`),n=e?.closest(`.pie-toolbar`);if(this.props.controlledKeypadMode&&t&&n){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect(),i=e.top+e.height-(r.top+r.height);if(i<0){let n=e.height+e.top-i;t&&(t.style.height=`${n}px`)}}e&&(e.addEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.addEventListener(`mousedown`,this.handleKeypadInteraction,!0))}componentWillUnmount(){let e=this.keypadRef?.current;if(this.props.controlledKeypadMode&&e){let t=e.closest(`.main-container`);t&&(t.style.height=`unset`)}e&&(e.removeEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.removeEventListener(`mousedown`,this.handleKeypadInteraction,!0))}handleKeypadInteraction=()=>{this.props.setKeypadInteraction&&this.props.setKeypadInteraction(!0)};buttonClick=e=>{d$(`[buttonClick]`,e);let{onPress:t}=this.props;t(e)};flowKeys=(e,t)=>ae([...u$(e),...u$(t)]);keyIsNotAllowed=e=>{let{noDecimal:t}=this.props;return!!((e.write===`.`&&e.label===`.`||e.write===`,`&&e.label===`,`)&&t)};render(){let{className:e,baseSet:t,additionalKeys:n,layoutForKeyPad:r,onFocus:i,mode:a}=this.props,o=[`non-negative-integers`,`integers`,`decimals`,`fractions`,`item-authoring`,`language`].includes(a),s=o?this.flowKeys([],n||[]):this.flowKeys(t,n||[]),c=s.length%5?1:0,l={gridTemplateColumns:`repeat(${Math.floor(s.length/5)+c}, minmax(min-content, 150px))`,...p$(r)};return(0,N.jsx)(m$,{ref:this.keypadRef,className:[e,a].filter(Boolean).join(` `),style:l,onFocus:i,children:s.map((e,t)=>{let n=this.buttonClick.bind(this,e);if(!e)return(0,N.jsx)(`span`,{},`empty-${t}`);let r={onClick:n,disabled:this.keyIsNotAllowed(e),key:`${e.label||e.latex||e.command}-${t}`,...e.actions||{},...e.extraProps||{}};if(e.latex)return(0,N.jsx)(g$,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:(0,N.jsx)(f$,{latex:e.latex})},r.key);if(e.label)return(0,N.jsx)(h$,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,isDelete:e.label===`⌫`,isComma:e.label===`,`,isDot:e.label===`.`,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:e.label},r.key);{let t=e.icon?e.icon:`div`;return(0,N.jsx)(_$,{tabIndex:`-1`,onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,size:`large`,...e.actions||{},...e.extraProps||{},children:(0,N.jsx)(t,{className:`icon`})},r.key)}})})}},y$=e=>{if(e.command)return{value:e.command,type:`command`};if(e.write)return{value:e.write};if(e.keystroke)return{type:`cursor`,value:e.keystroke}},b$=class extends M.Component{static propTypes={className:k.string,controlledKeypadMode:k.bool,mode:k.oneOfType([k.string,k.number]),layoutForKeyPad:k.object,onClick:k.func.isRequired,onFocus:k.func,noDecimal:k.bool,additionalKeys:k.array,setKeypadInteraction:k.func};static defaultProps={mode:`scientific`,noDecimal:!1,additionalKeys:[]};keypadPress=e=>{let{onClick:t}=this.props;t(y$(e))};render(){let{mode:e,onFocus:t,controlledKeypadMode:n,noDecimal:r,className:i,additionalKeys:a,layoutForKeyPad:o,setKeypadInteraction:s}=this.props,c=WX(a);return(0,N.jsx)(v$,{className:i,controlledKeypadMode:n,onFocus:t,noDecimal:r,layoutForKeyPad:o,additionalKeys:BJ(HX(e),c),onPress:this.keypadPress,mode:e,setKeypadInteraction:s})}},x$=L(`span`)(()=>({display:`inline-flex`,border:`1px solid ${Iu()}`,margin:`1px 5px`,cursor:`pointer`,alignItems:`center`,justifyContent:`center`,minWidth:`50px`,minHeight:`36px`,height:`fit-content`})),S$=L(`div`)(()=>({background:ju(),color:lu(),display:`inline-flex`,borderRight:`2px solid ${Iu()}`,boxSizing:`border-box`,overflow:`hidden`,fontSize:`12px`,minHeight:`36px`,height:`100%`,alignItems:`center`,fontFamily:`Symbola, Times New Roman, serif`,padding:`0 2px`})),C$=L(`div`)(()=>({flex:8,color:`var(--pie-text, black)`,padding:`4px !important`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`var(--pie-background, rgba(255, 255, 255, 0))`,"& > .mq-math-mode sup.mq-nthroot":{fontSize:`70% !important`,verticalAlign:`1em !important`},"& > .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-overarrow-inner":{paddingTop:`0 !important`,border:`none !important`},"& .mq-overarrow.mq-arrow-both":{marginTop:`0px`,minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`0px !important`,position:`absolute !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`}})),w$=e=>{let{node:t,options:n,selected:r}=e,{attrs:i}=t,{value:a,index:o}=i,s=`R ${parseInt(o)+1}`;return(0,N.jsx)(vM,{className:`math-templated`,"data-selected":r,style:{display:`inline-flex`,minHeight:`36px`,minWidth:`50px`,cursor:`pointer`},children:(0,N.jsxs)(x$,{...i,children:[(0,N.jsx)(S$,{children:s}),(0,N.jsx)(C$,{children:(0,N.jsx)(i$,{latex:a})})]})})};w$.propTypes={attributes:k.object,value:k.string,keyToDisplay:k.string};var T$={},E$=e=>String(e||``).replace(/-/g,`_`),D$=e=>e&&e.attrs&&e.attrs.index!=null?String(e.attrs.index):null,O$=(e,t)=>{let n=[];return e.descendants((e,r)=>{if(e.type&&e.type.name===t){let t=D$(e);t!=null&&n.push({index:t,pos:r,node:e})}return!0}),n},k$=(e,t)=>{let n=0;return e.descendants(e=>(e.type&&e.type.name===t&&(n+=1),!0)),n},A$=({schema:e,typeName:t,index:n})=>{let r=e.nodes[t];return r?r.create({index:String(n),id:String(n),value:``}):null},j$=(e,t)=>{let n=e.resolve(Math.min(t,e.content.size));return U.near(n,1)},M$=CA.create({name:`responseArea`,addOptions(){return{maxResponseAreas:null,error:null,options:null,respAreaToolbar:null,onHandleAreaChange:null}},addProseMirrorPlugins(){if(!this.options.type)return[];let e=E$(this.options.type);return[new Db({key:new Ab(`response-area-watcher:${e}`),view:t=>(T$[e]===void 0&&(T$[e]=0,t.state.doc.descendants(t=>{if(t.type&&t.type.name===e){let n=D$(t);if(n!=null){let t=parseInt(n,10);!Number.isNaN(t)&&t>T$[e]&&(T$[e]=t)}}return!0})),{update:(t,n)=>{let r=t.state;if(n.doc.eq(r.doc))return;let i=O$(r.doc,e),a=O$(n.doc,e);if(this.options.toolbar&&(this.options.toolbar.disabled=i.length>=this.options.maxResponseAreas),a.length>i.length){let e=new Set(i.map(e=>e.index)),t=a.filter(t=>!e.has(t.index));t.length&&typeof this.options.onHandleAreaChange==`function`&&this.options.onHandleAreaChange(t)}}})})]},addCommands(){return{insertResponseArea:e=>({tr:t,state:n,dispatch:r,commands:i})=>{let a=E$(e);if(k$(n.doc,a)>=this.options.maxResponseAreas)return!1;T$[a]===void 0&&(T$[a]=0);let o=T$[a]+1;T$[a]+=1;let s=A$({schema:n.schema,typeName:a,index:o});if(!s)return!1;let{selection:c}=n,l=c.from,u=e=>{try{return t.insert(e,s),e}catch{return null}},d=u(l);if(d??=u(t.doc.content.size),d==null)return!1;if([`inline_dropdown`,`explicit_constructed_response`].includes(a))t.setSelection(W.create(t.doc,d));else{let e=d+s.nodeSize;t.setSelection(j$(t.doc,e))}return r&&(i.focus(),r(t)),!0},refreshResponseArea:()=>({tr:e,state:t,commands:n,dispatch:r})=>{let{selection:i}=t,a=i.$from.nodeAfter,o=i.from;return e.setNodeMarkup(o,void 0,{...a?.attrs,updated:`${Date.now()}`}),e.setSelection(W.create(e.doc,o)),r&&(n.focus(),r(e)),!0}}}}),N$=$A.create({name:`explicit_constructed_response`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="explicit_constructed_response"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`explicit_constructed_response`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return EM(e=>(0,N.jsx)(vJ,{...e,options:this.options}))}}),P$=$A.create({name:`math_templated`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="math_templated"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`math_templated`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return EM(e=>(0,N.jsx)(w$,{...e,options:this.options}))}}),F$=$A.create({name:`drag_in_the_blank`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},id:{default:null},value:{default:``},inTable:{default:null},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="drag_in_the_blank"]`,getAttrs:e=>({index:e.dataset.index,id:e.dataset.id,value:e.dataset.value,inTable:e.dataset.inTable})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`drag_in_the_blank`,"data-index":e.index,"data-id":e.id,"data-value":e.value,"data-in-table":e.inTable}]},addNodeView(){return EM(e=>(0,N.jsx)(kJ,{...e,options:this.options}))}}),I$=$A.create({name:`inline_dropdown`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="inline_dropdown"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`inline_dropdown`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return EM(e=>(0,N.jsx)(AJ,{...e,options:this.options}))}}),L$=mi(`MuiDivider`,[`root`,`absolute`,`fullWidth`,`inset`,`middle`,`flexItem`,`light`,`vertical`,`withChildren`,`withChildrenVertical`,`textAlignRight`,`textAlignLeft`,`wrapper`,`wrapperVertical`]),R$=mi(`MuiListItemIcon`,[`root`,`alignItemsFlexStart`]);function z$(e){return F(`MuiTypography`,e)}mi(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`,`paragraph`]);var B$={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},V$=uc(),H$=e=>{let{align:t,gutterBottom:n,noWrap:r,paragraph:i,variant:a,classes:o}=e;return Fa({root:[`root`,a,e.align!==`inherit`&&`align${z(t)}`,n&&`gutterBottom`,r&&`noWrap`,i&&`paragraph`]},z$,o)},U$=L(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${z(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(ol(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${z(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),W$={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},G$=M.forwardRef(function(e,t){let{color:n,...r}=dc({props:e,name:`MuiTypography`}),i=!B$[n],a=V$({...r,...i&&{color:n}}),{align:o=`inherit`,className:s,component:c,gutterBottom:l=!1,noWrap:u=!1,paragraph:d=!1,variant:f=`body1`,variantMapping:p=W$,...m}=a,h={...a,align:o,color:n,className:s,component:c,gutterBottom:l,noWrap:u,paragraph:d,variant:f,variantMapping:p},g=c||(d?`p`:p[f]||W$[f])||`span`,_=H$(h);return(0,N.jsx)(U$,{as:g,ref:t,className:P(_.root,s),...m,ownerState:h,style:{...o!==`inherit`&&{"--Typography-textAlign":o},...m.style}})}),K$=mi(`MuiListItemText`,[`root`,`multiline`,`dense`,`inset`,`primary`,`secondary`]);function q$(e){return F(`MuiMenuItem`,e)}var J$=mi(`MuiMenuItem`,[`root`,`focusVisible`,`dense`,`disabled`,`divider`,`gutters`,`selected`]);function Y$(e){return F(`MuiNativeSelect`,e)}var X$=mi(`MuiNativeSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]),Z$=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return Fa({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${z(n)}`,a&&`iconOpen`,r&&`disabled`]},Y$,t)},Q$=L(`select`,{name:`MuiNativeSelect`})(({theme:e})=>({MozAppearance:`none`,WebkitAppearance:`none`,userSelect:`none`,borderRadius:0,cursor:`pointer`,"&:focus":{borderRadius:0},[`&.${X$.disabled}`]:{cursor:`default`},"&[multiple]":{height:`auto`},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(e.vars||e).palette.background.paper},variants:[{props:({ownerState:e})=>e.variant!==`filled`&&e.variant!==`outlined`,style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:`filled`},style:{"&&&":{paddingRight:32}}},{props:{variant:`outlined`},style:{borderRadius:(e.vars||e).shape.borderRadius,"&:focus":{borderRadius:(e.vars||e).shape.borderRadius},"&&&":{paddingRight:32}}}]})),$$=L(Q$,{name:`MuiNativeSelect`,slot:`Select`,shouldForwardProp:Xo,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.select,t[n.variant],n.error&&t.error,{[`&.${X$.multiple}`]:t.multiple}]}})({}),e1=L(`svg`,{name:`MuiNativeSelect`})(({theme:e})=>({position:`absolute`,right:0,top:`calc(50% - .5em)`,pointerEvents:`none`,color:(e.vars||e).palette.action.active,[`&.${X$.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:e})=>e.open,style:{transform:`rotate(180deg)`}},{props:{variant:`filled`},style:{right:7}},{props:{variant:`outlined`},style:{right:7}}]})),t1=L(e1,{name:`MuiNativeSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${z(n.variant)}`],n.open&&t.iconOpen]}})({}),n1=M.forwardRef(function(e,t){let{className:n,disabled:r,error:i,IconComponent:a,inputRef:o,variant:s=`standard`,...c}=e,l={...e,disabled:r,variant:s,error:i},u=Z$(l);return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)($$,{ownerState:l,className:P(u.select,n),disabled:r,ref:o||t,...c}),e.multiple?null:(0,N.jsx)(t1,{as:a,ownerState:l,className:u.icon})]})});function r1(e){return F(`MuiSelect`,e)}var i1=mi(`MuiSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`focused`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]);function a1(e){return e?e.type===`mousedown`||e.type===`pointerdown`||e.type===`touchstart`?`pointer`:e.type===`keydown`||e.type===`click`&&e.detail===0?`keyboard`:null:null}function o1(e){return e==null||typeof e==`string`&&!e.trim()}function s1(e,t){return typeof t==`object`&&t?e===t:String(e)===String(t)}var c1=M.createContext(null);function l1(){return M.useContext(c1)}var u1=c1.Provider,d1,f1=L(Q$,{name:`MuiSelect`,slot:`Select`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`&.${i1.select}`]:t.select},{[`&.${i1.select}`]:t[n.variant]},{[`&.${i1.error}`]:t.error},{[`&.${i1.multiple}`]:t.multiple}]}})({[`&.${i1.select}`]:{height:`auto`,minHeight:`1.4375em`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`}}),p1=L(e1,{name:`MuiSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${z(n.variant)}`],n.open&&t.iconOpen]}})({}),m1=L(`input`,{shouldForwardProp:e=>Yo(e)&&e!==`classes`,name:`MuiSelect`,slot:`NativeInput`})({bottom:0,left:0,position:`absolute`,opacity:0,pointerEvents:`none`,width:`100%`,boxSizing:`border-box`}),h1=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return Fa({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${z(n)}`,a&&`iconOpen`,r&&`disabled`],nativeInput:[`nativeInput`]},r1,t)},g1=M.forwardRef(function(e,t){let{"aria-describedby":n,"aria-label":r,autoFocus:i,autoWidth:a,children:o,className:s,defaultOpen:c,defaultValue:l,disabled:u,displayEmpty:d,error:f=!1,IconComponent:p,inputRef:m,labelId:h,MenuProps:g={},multiple:_,name:v,onBlur:y,onChange:b,onClose:x,onFocus:S,onKeyDown:C,onMouseDown:w,onOpen:T,open:E,readOnly:D,renderValue:O,required:ee,SelectDisplayProps:te={},tabIndex:k,type:A,value:ne,variant:j=`standard`,...re}=e,[ie,ae]=Kl({controlled:ne,default:l,name:`Select`}),[oe,se]=Kl({controlled:E,default:c,name:`Select`}),ce=M.useRef(null),le=M.useRef(null),[ue,de]=M.useState(null),{current:fe}=M.useRef(E!=null),[me,he]=M.useState(),[ge,_e]=M.useState(null),ve=kc(t,m),ye=M.useCallback(e=>{le.current=e,e&&de(e)},[]),be=ue?.parentNode;M.useImperativeHandle(ve,()=>({focus:()=>{le.current.focus()},node:ce.current,value:ie}),[ie]);let xe=ue!==null&&oe;M.useEffect(()=>{if(!xe||!be||a||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{he(be.clientWidth)});return e.observe(be),()=>{e.disconnect()}},[xe,be,a]),M.useEffect(()=>{c&&oe&&ue&&!fe&&(he(a?null:be.clientWidth),le.current.focus())},[ue,a]),M.useEffect(()=>{i&&le.current.focus()},[i]),M.useEffect(()=>{if(!h)return;let e=hc(le.current).getElementById(h);if(e){let t=()=>{getSelection().isCollapsed&&le.current.focus()};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}},[h]);let Se=(e,t)=>{e?(_e(a1(t)),T&&T(t)):(_e(null),x&&x(t)),fe||(he(a?null:be.clientWidth),se(e))},Ce=e=>{w?.(e),e.button===0&&(e.preventDefault(),le.current.focus(),Se(!0,e))},we=e=>{Se(!1,e)},Te=M.Children.toArray(o),Ee=e=>{let t=Te.find(t=>t.props.value===e.target.value);t!==void 0&&(ae(t.props.value),b&&b(e,t))},De=e=>t=>{let n;if(t.currentTarget.hasAttribute(`tabindex`)){if(_){n=Array.isArray(ie)?ie.slice():[];let t=ie.indexOf(e.props.value);t===-1?n.push(e.props.value):n.splice(t,1)}else n=e.props.value;if(e.props.onClick&&e.props.onClick(t),ie!==n&&(ae(n),b)){let r=t.nativeEvent||t,i=new r.constructor(r.type,r);Object.defineProperty(i,"target",{writable:!0,value:{value:n,name:v}}),b(i,e)}_||Se(!1,t)}},Oe=e=>{D||([` `,`ArrowUp`,`ArrowDown`,`Enter`].includes(e.key)&&(e.preventDefault(),Se(!0,e)),C?.(e))},ke=e=>{!xe&&y&&(Object.defineProperty(e,"target",{writable:!0,value:{value:ie,name:v}}),y(e))};delete re[`aria-invalid`];let Ae,je,Me=[],Ne=!1;(ep({value:ie})||d)&&(O?Ae=O(ie):Ne=!0);let Pe=Te.map(e=>{if(!M.isValidElement(e))return null;let t;if(_){if(!Array.isArray(ie))throw Error(pe(2));t=ie.some(t=>s1(t,e.props.value)),t&&Ne&&Me.push(e.props.children)}else t=s1(ie,e.props.value),t&&Ne&&(je=e.props.children);return M.cloneElement(e,{"aria-selected":t?`true`:`false`,onClick:De(e),onKeyUp:t=>{t.key===` `&&t.preventDefault(),e.props.onKeyUp&&e.props.onKeyUp(t)},role:`option`,selected:t,value:void 0,"data-value":e.props.value})});Ne&&(Ae=_?Me.length===0?null:Me.reduce((e,t,n)=>(e.push(t),n<Me.length-1&&e.push(`, `),e),[]):je);let Fe=me;!a&&fe&&ue&&(Fe=be.clientWidth);let Ie;Ie=k===void 0?u?null:0:k;let Le=te.id||(v?`mui-component-select-${v}`:void 0),Re={...e,variant:j,value:ie,open:xe,error:f},ze=h1(Re),Be={...g.PaperProps,...typeof g.slotProps?.paper==`function`?g.slotProps.paper(Re):g.slotProps?.paper},Ve={...g.MenuListProps,...typeof g.slotProps?.list==`function`?g.slotProps.list(Re):g.slotProps?.list},He=ca();return(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(f1,{as:`div`,ref:ye,tabIndex:Ie,role:`combobox`,"aria-controls":xe?He:void 0,"aria-disabled":u?`true`:void 0,"aria-expanded":xe?`true`:`false`,"aria-haspopup":`listbox`,"aria-label":r,"aria-labelledby":[h,Le].filter(Boolean).join(` `)||void 0,"aria-describedby":n,"aria-required":ee?`true`:void 0,"aria-invalid":f?`true`:void 0,onKeyDown:Oe,onMouseDown:u||D?null:Ce,onBlur:ke,onFocus:S,...te,ownerState:Re,className:P(te.className,ze.select,s),id:Le,children:o1(Ae)?d1||=(0,N.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):Ae}),(0,N.jsx)(m1,{"aria-invalid":f,value:Array.isArray(ie)?ie.join(`,`):ie,name:v,ref:ce,"aria-hidden":!0,onChange:Ee,tabIndex:-1,disabled:u,className:ze.nativeInput,autoFocus:i,required:ee,...re,ownerState:Re}),(0,N.jsx)(p1,{as:p,className:ze.icon,ownerState:Re}),(0,N.jsx)(u1,{value:ge,children:(0,N.jsx)(Hp,{id:`menu-${v||``}`,anchorEl:be,open:xe,onClose:we,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},...g,slotProps:{...g.slotProps,list:{"aria-labelledby":h,role:`listbox`,"aria-multiselectable":_?`true`:void 0,disableListWrap:!0,id:He,...Ve},paper:{...Be,style:{minWidth:Fe,...Be==null?null:Be.style}}},children:Pe})})]})}),_1=Vl((0,N.jsx)(`path`,{d:`M7 10l5 5 5-5z`}),`ArrowDropDown`);function v1(e){return parseInt(e,10)||0}var y1={shadow:{visibility:`hidden`,position:`absolute`,overflow:`hidden`,height:0,top:0,left:0,transform:`translateZ(0)`}};function b1(e){for(let t in e)return!1;return!0}function x1(e){return b1(e)||e.outerHeightStyle===0&&!e.overflowing}var S1=M.forwardRef(function(e,t){let{onChange:n,maxRows:r,minRows:i=1,style:a,value:o,...s}=e,{current:c}=M.useRef(o!=null),l=M.useRef(null),u=Oc(t,l),d=M.useRef(null),f=M.useRef(null),p=M.useCallback(()=>{let t=l.current,n=f.current;if(!t||!n)return;let a=gc(t).getComputedStyle(t);if(a.width===`0px`)return{outerHeightStyle:0,overflowing:!1};n.style.width=a.width,n.value=t.value||e.placeholder||`x`,n.value.slice(-1)===`
|
|
334
|
+
`&&(n.value+=` `);let o=a.boxSizing,s=v1(a.paddingBottom)+v1(a.paddingTop),c=v1(a.borderBottomWidth)+v1(a.borderTopWidth),u=n.scrollHeight;n.value=`x`;let d=n.scrollHeight,p=u;return i&&(p=Math.max(Number(i)*d,p)),r&&(p=Math.min(Number(r)*d,p)),p=Math.max(p,d),{outerHeightStyle:p+(o===`border-box`?s+c:0),overflowing:Math.abs(p-u)<=1}},[r,i,e.placeholder]),m=bl(()=>{let e=l.current,t=p();if(!e||!t||x1(t))return!1;let n=t.outerHeightStyle;return d.current!=null&&d.current!==n}),h=M.useCallback(()=>{let e=l.current,t=p();if(!e||!t||x1(t))return;let n=t.outerHeightStyle;d.current!==n&&(d.current=n,e.style.height=`${n}px`),e.style.overflow=t.overflowing?`hidden`:``},[p]),g=M.useRef(-1);return Oi(()=>{let e=fc(h),t=l?.current;if(!t)return;let n=gc(t);n.addEventListener(`resize`,e);let r;return typeof ResizeObserver<`u`&&(r=new ResizeObserver(()=>{m()&&(r.unobserve(t),cancelAnimationFrame(g.current),h(),g.current=requestAnimationFrame(()=>{r.observe(t)}))}),r.observe(t)),()=>{e.clear(),cancelAnimationFrame(g.current),n.removeEventListener(`resize`,e),r&&r.disconnect()}},[p,h,m]),Oi(()=>{h()}),(0,N.jsxs)(M.Fragment,{children:[(0,N.jsx)(`textarea`,{value:o,onChange:e=>{c||h();let t=e.target,r=t.value.length,i=t.value.endsWith(`
|
|
335
|
+
`),a=t.selectionStart===r;i&&a&&t.setSelectionRange(r,r),n&&n(e)},ref:u,rows:i,style:a,...s}),(0,N.jsx)(`textarea`,{"aria-hidden":!0,className:e.className,readOnly:!0,ref:f,tabIndex:-1,style:{...y1.shadow,...a,paddingTop:0,paddingBottom:0}})]})});function C1(e){return F(`MuiInputBase`,e)}var w1=mi(`MuiInputBase`,[`root`,`formControl`,`focused`,`disabled`,`adornedStart`,`adornedEnd`,`error`,`sizeSmall`,`multiline`,`colorSecondary`,`fullWidth`,`hiddenLabel`,`readOnly`,`input`,`inputSizeSmall`,`inputMultiline`,`inputTypeSearch`,`inputAdornedStart`,`inputAdornedEnd`,`inputHiddenLabel`]),T1,E1=`mui-auto-fill`,D1=`mui-auto-fill-cancel`,O1=(e,t)=>{let{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,n.size===`small`&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${z(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},k1=(e,t)=>{let{ownerState:n}=e;return[t.input,n.size===`small`&&t.inputSizeSmall,n.multiline&&t.inputMultiline,n.type===`search`&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]},A1=e=>{let{classes:t,color:n,disabled:r,error:i,endAdornment:a,focused:o,formControl:s,fullWidth:c,hiddenLabel:l,multiline:u,readOnly:d,size:f,startAdornment:p,type:m}=e;return Fa({root:[`root`,`color${z(n)}`,r&&`disabled`,i&&`error`,c&&`fullWidth`,o&&`focused`,s&&`formControl`,f&&f!==`medium`&&`size${z(f)}`,u&&`multiline`,p&&`adornedStart`,a&&`adornedEnd`,l&&`hiddenLabel`,d&&`readOnly`],input:[`input`,r&&`disabled`,m===`search`&&`inputTypeSearch`,u&&`inputMultiline`,f===`small`&&`inputSizeSmall`,l&&`inputHiddenLabel`,p&&`inputAdornedStart`,a&&`inputAdornedEnd`,d&&`readOnly`]},C1,t)},j1=L(`div`,{name:`MuiInputBase`,slot:`Root`,overridesResolver:O1})(ol(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:`1.4375em`,boxSizing:`border-box`,position:`relative`,cursor:`text`,display:`inline-flex`,alignItems:`center`,[`&.${w1.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:`default`},variants:[{props:({ownerState:e})=>e.multiline,style:{padding:`4px 0 5px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:1}},{props:({ownerState:e})=>e.fullWidth,style:{width:`100%`}}]}))),M1=L(`input`,{name:`MuiInputBase`,slot:`Input`,overridesResolver:k1})(ol(({theme:e})=>{let t=e.palette.mode===`light`,n={color:`currentColor`,...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.shorter})},r={opacity:`0 !important`},i=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:`inherit`,letterSpacing:`inherit`,color:`currentColor`,padding:`4px 0 5px`,border:0,boxSizing:`content-box`,background:`none`,height:`1.4375em`,margin:0,WebkitTapHighlightColor:`transparent`,display:`block`,minWidth:0,width:`100%`,"&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:`none`},"&::-webkit-search-decoration":{WebkitAppearance:`none`},[`label[data-shrink=false] + .${w1.formControl} &`]:{"&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&::-ms-input-placeholder":r,"&:focus::-webkit-input-placeholder":i,"&:focus::-moz-placeholder":i,"&:focus::-ms-input-placeholder":i},[`&.${w1.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:e})=>!e.disableInjectingGlobalStyles,style:{animationName:D1,animationDuration:`10ms`,"&:-webkit-autofill":{animationDuration:`5000s`,animationName:E1}}},{props:{size:`small`},style:{paddingTop:1}},{props:({ownerState:e})=>e.multiline,style:{height:`auto`,resize:`none`,padding:0,paddingTop:0}},{props:{type:`search`},style:{MozAppearance:`textfield`}}]}})),N1=lc({[`@keyframes ${E1}`]:{from:{animationName:E1}},[`@keyframes ${D1}`]:{from:{animationName:D1}}}),P1=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiInputBase`}),{"aria-describedby":r,autoComplete:i,autoFocus:a,className:o,color:s,components:c={},componentsProps:l={},defaultValue:u,disabled:d,disableInjectingGlobalStyles:f,endAdornment:p,error:m,fullWidth:h=!1,id:g,inputComponent:_=`input`,inputProps:v={},inputRef:y,margin:b,maxRows:x,minRows:S,multiline:C=!1,name:w,onBlur:T,onChange:E,onClick:D,onFocus:O,onKeyDown:ee,onKeyUp:te,placeholder:k,readOnly:A,renderSuffix:ne,rows:j,size:re,slotProps:ie={},slots:ae={},startAdornment:oe,type:se=`text`,value:ce,...le}=n,ue=v.value==null?ce:v.value,{current:de}=M.useRef(ue!=null),fe=M.useRef(),me=M.useCallback(e=>{},[]),he=kc(fe,y,v.ref,me),[ge,_e]=M.useState(!1),ve=Hf(),ye=Bf({props:n,muiFormControl:ve,states:[`color`,`disabled`,`error`,`hiddenLabel`,`size`,`required`,`filled`]});ye.focused=ve?ve.focused:ge,M.useEffect(()=>{!ve&&d&&ge&&(_e(!1),T&&T())},[ve,d,ge,T]);let be=ve&&ve.onFilled,xe=ve&&ve.onEmpty,Se=M.useCallback(e=>{ep(e)?be&&be():xe&&xe()},[be,xe]);Ul(()=>{de&&Se({value:ue})},[ue,Se,de]),Ul(()=>{if(!a)return;let e=fe.current;if(!e)return;let t=hc(e),n=qc(t),r=n==null||n===t.body||n===t.documentElement;e===n?ve&&ve.onFocus?ve.onFocus():_e(!0):r&&e.focus()},[a]);let Ce=e=>{O&&O(e),v.onFocus&&v.onFocus(e),ve&&ve.onFocus?ve.onFocus(e):_e(!0)},we=e=>{T&&T(e),v.onBlur&&v.onBlur(e),ve&&ve.onBlur?ve.onBlur(e):_e(!1)},Te=(e,...t)=>{if(!de){let t=e.target||fe.current;if(t==null)throw Error(pe(1));Se({value:t.value})}v.onChange&&v.onChange(e,...t),E&&E(e,...t)};M.useEffect(()=>{Se(fe.current)},[]);let Ee=e=>{fe.current&&e.currentTarget===e.target&&fe.current.focus(),D&&D(e)},De=_,Oe=v;C&&De===`input`&&(Oe=j?{type:void 0,minRows:j,maxRows:j,...Oe}:{type:void 0,maxRows:x,minRows:S,...Oe},De=S1);let ke=e=>{Se(e.animationName===D1?fe.current:{value:`x`})};M.useEffect(()=>{ve&&ve.setAdornedStart(!!oe)},[ve,oe]);let Ae={...n,color:ye.color||`primary`,disabled:ye.disabled,endAdornment:p,error:ye.error,focused:ye.focused,formControl:ve,fullWidth:h,hiddenLabel:ye.hiddenLabel,multiline:C,size:ye.size,startAdornment:oe,type:se},je=A1(Ae),Me=ae.root||c.Root||j1,Ne=ie.root||l.root||{},Pe=ae.input||c.Input||M1;return Oe={...Oe,...ie.input??l.input},(0,N.jsxs)(M.Fragment,{children:[!f&&typeof N1==`function`&&(T1||=(0,N.jsx)(N1,{})),(0,N.jsxs)(Me,{...Ne,ref:t,onClick:Ee,...le,...!sc(Me)&&{ownerState:{...Ae,...Ne.ownerState}},className:P(je.root,Ne.className,o,A&&`MuiInputBase-readOnly`),children:[oe,(0,N.jsx)(Vf.Provider,{value:null,children:(0,N.jsx)(Pe,{"aria-invalid":ye.error,"aria-describedby":r,autoComplete:i,autoFocus:a,defaultValue:u,disabled:ye.disabled,id:g,onAnimationStart:ke,name:w,placeholder:k,readOnly:A,required:ye.required,rows:j,value:ue,onKeyDown:ee,onKeyUp:te,type:se,...Oe,...!sc(Pe)&&{as:De,ownerState:{...Ae,...Oe.ownerState}},ref:he,className:P(je.input,Oe.className,A&&`MuiInputBase-readOnly`),onBlur:we,onChange:Te,onFocus:Ce})}),p,ne?ne({...ye,startAdornment:oe}):null]})]})});function F1(e){return F(`MuiInput`,e)}var I1={...w1,...mi(`MuiInput`,[`root`,`underline`,`input`])},L1=e=>{let{classes:t,disableUnderline:n}=e,r=Fa({root:[`root`,!n&&`underline`],input:[`input`]},F1,t);return{...t,...r}},R1=L(j1,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...O1(e,t),!n.disableUnderline&&t.underline]}})(ol(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`;return e.vars&&(t=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:`relative`,variants:[{props:({ownerState:e})=>e.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:`""`,position:`absolute`,right:0,transform:`scaleX(0)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:`none`},[`&.${I1.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${I1.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${I1.disabled}, .${I1.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${I1.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}}))]}})),z1=L(M1,{name:`MuiInput`,slot:`Input`,overridesResolver:k1})({}),B1=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,inputComponent:s=`input`,multiline:c=!1,slotProps:l,slots:u={},type:d=`text`,...f}=n,p=L1(n),m={root:{ownerState:{disableUnderline:r}}},h=l??a?zn(l??a,m):m;return(0,N.jsx)(P1,{slots:{root:u.root??i.Root??R1,input:u.input??i.Input??z1},slotProps:h,fullWidth:o,inputComponent:s,multiline:c,ref:t,type:d,...f,classes:p})});B1.muiName=`Input`;function V1(e){return F(`MuiFilledInput`,e)}var H1={...w1,...mi(`MuiFilledInput`,[`root`,`underline`,`input`,`adornedStart`,`adornedEnd`,`sizeSmall`,`multiline`,`hiddenLabel`])},U1=e=>{let{classes:t,disableUnderline:n,startAdornment:r,endAdornment:i,size:a,hiddenLabel:o,multiline:s}=e,c=Fa({root:[`root`,!n&&`underline`,r&&`adornedStart`,i&&`adornedEnd`,a===`small`&&`size${z(a)}`,o&&`hiddenLabel`,s&&`multiline`],input:[`input`]},V1,t);return{...t,...c}},W1=L(j1,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiFilledInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...O1(e,t),!n.disableUnderline&&t.underline]}})(ol(({theme:e})=>{let t=e.palette.mode===`light`,n=t?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`,r=t?`rgba(0, 0, 0, 0.06)`:`rgba(255, 255, 255, 0.09)`,i=t?`rgba(0, 0, 0, 0.09)`:`rgba(255, 255, 255, 0.13)`,a=t?`rgba(0, 0, 0, 0.12)`:`rgba(255, 255, 255, 0.12)`;return{position:`relative`,backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:i,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${H1.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${H1.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:`""`,position:`absolute`,right:0,transform:`scaleX(0)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:`none`},[`&.${H1.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${H1.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):n}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${H1.disabled}, .${H1.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${H1.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{disableUnderline:!1,color:t},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:12}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:12}},{props:({ownerState:e})=>e.multiline,style:{padding:`25px 12px 8px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}}]}})),G1=L(M1,{name:`MuiFilledInput`,slot:`Input`,overridesResolver:k1})(ol(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}},{props:({ownerState:e})=>e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:e})=>e.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),K1=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiFilledInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,hiddenLabel:s,inputComponent:c=`input`,multiline:l=!1,slotProps:u,slots:d={},type:f=`text`,...p}=n,m={...n,disableUnderline:r,fullWidth:o,inputComponent:c,multiline:l,type:f},h=U1(n),g={root:{ownerState:m},input:{ownerState:m}},_=u??a?zn(g,u??a):g;return(0,N.jsx)(P1,{slots:{root:d.root??i.Root??W1,input:d.input??i.Input??G1},slotProps:_,fullWidth:o,inputComponent:c,multiline:l,ref:t,type:f,...p,classes:h})});K1.muiName=`Input`;var q1,J1=L(`fieldset`,{name:`MuiNotchedOutlined`,shouldForwardProp:Xo})({textAlign:`left`,position:`absolute`,bottom:0,right:0,top:-5,left:0,margin:0,padding:`0 8px`,pointerEvents:`none`,borderRadius:`inherit`,borderStyle:`solid`,borderWidth:1,overflow:`hidden`,minWidth:`0%`}),Y1=L(`legend`,{name:`MuiNotchedOutlined`,shouldForwardProp:Xo})(ol(({theme:e})=>({float:`unset`,width:`auto`,overflow:`hidden`,variants:[{props:({ownerState:e})=>!e.withLabel,style:{padding:0,lineHeight:`11px`,transition:e.transitions.create(`width`,{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:e})=>e.withLabel,style:{display:`block`,padding:0,height:11,fontSize:`0.75em`,visibility:`hidden`,maxWidth:.01,transition:e.transitions.create(`max-width`,{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:`nowrap`,"& > span":{paddingLeft:5,paddingRight:5,display:`inline-block`,opacity:0,visibility:`visible`}}},{props:({ownerState:e})=>e.withLabel&&e.notched,style:{maxWidth:`100%`,transition:e.transitions.create(`max-width`,{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function X1(e){let{children:t,classes:n,className:r,label:i,notched:a,...o}=e,s=i!=null&&i!==``,c={...e,notched:a,withLabel:s};return(0,N.jsx)(J1,{"aria-hidden":!0,className:r,ownerState:c,...o,children:(0,N.jsx)(Y1,{ownerState:c,children:s?(0,N.jsx)(`span`,{children:i}):q1||=(0,N.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``})})})}function Z1(e){return F(`MuiOutlinedInput`,e)}var Q1={...w1,...mi(`MuiOutlinedInput`,[`root`,`notchedOutline`,`input`])},$1=e=>{let{classes:t}=e,n=Fa({root:[`root`],notchedOutline:[`notchedOutline`],input:[`input`]},Z1,t);return{...t,...n}},e0=L(j1,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiOutlinedInput`,slot:`Root`,overridesResolver:O1})(ol(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{position:`relative`,borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${Q1.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${Q1.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${Q1.focused} .${Q1.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{[`&.${Q1.focused} .${Q1.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${Q1.error} .${Q1.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${Q1.disabled} .${Q1.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:14}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:14}},{props:({ownerState:e})=>e.multiline,style:{padding:`16.5px 14px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{padding:`8.5px 14px`}}]}})),t0=L(X1,{name:`MuiOutlinedInput`,slot:`NotchedOutline`})(ol(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),n0=L(M1,{name:`MuiOutlinedInput`,slot:`Input`,overridesResolver:k1})(ol(({theme:e})=>({padding:`16.5px 14px`,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{padding:`8.5px 14px`}},{props:({ownerState:e})=>e.multiline,style:{padding:0}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}}]}))),r0=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiOutlinedInput`}),{components:r={},fullWidth:i=!1,inputComponent:a=`input`,label:o,multiline:s=!1,notched:c,slots:l={},slotProps:u={},type:d=`text`,...f}=n,p=$1(n),m=Hf(),h=Bf({props:n,muiFormControl:m,states:[`color`,`disabled`,`error`,`focused`,`hiddenLabel`,`size`,`required`]}),g={...n,color:h.color||`primary`,disabled:h.disabled,error:h.error,focused:h.focused,formControl:m,fullWidth:i,hiddenLabel:h.hiddenLabel,multiline:s,size:h.size,type:d},_=l.root??r.Root??e0,v=l.input??r.Input??n0,[y,b]=fl(`notchedOutline`,{elementType:t0,className:p.notchedOutline,shouldForwardComponentProp:!0,ownerState:g,externalForwardedProps:{slots:l,slotProps:u},additionalProps:{label:o!=null&&o!==``&&h.required?(0,N.jsxs)(M.Fragment,{children:[o,` `,`*`]}):o}});return(0,N.jsx)(P1,{slots:{root:_,input:v},slotProps:u,renderSuffix:e=>(0,N.jsx)(y,{...b,notched:c===void 0?!!(e.startAdornment||e.filled||e.focused):c}),fullWidth:i,inputComponent:a,multiline:s,ref:t,type:d,...f,classes:{...p,notchedOutline:null}})});r0.muiName=`Input`;var i0=e=>{let{classes:t}=e,n=Fa({root:[`root`]},r1,t);return{...t,...n}},a0={name:`MuiSelect`,slot:`Root`,shouldForwardProp:e=>Xo(e)&&e!==`variant`},o0=L(B1,a0)(``),s0=L(r0,a0)(``),c0=L(K1,a0)(``),l0=M.forwardRef(function(e,t){let n=dc({name:`MuiSelect`,props:e}),{autoWidth:r=!1,children:i,classes:a={},className:o,defaultOpen:s=!1,displayEmpty:c=!1,IconComponent:l=_1,id:u,input:d,inputProps:f,label:p,labelId:m,MenuProps:h,multiple:g=!1,native:_=!1,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:S,variant:C=`outlined`,...w}=n,T=_?n1:g1,E=Bf({props:n,muiFormControl:Hf(),states:[`variant`,`error`]}),D=E.variant||C,O={...n,variant:D,classes:a},ee=i0(O),{root:te,...k}=ee,A=d||{standard:(0,N.jsx)(o0,{ownerState:O}),outlined:(0,N.jsx)(s0,{label:p,ownerState:O}),filled:(0,N.jsx)(c0,{ownerState:O})}[D],ne=kc(t,wc(A));return(0,N.jsx)(M.Fragment,{children:M.cloneElement(A,{inputComponent:T,inputProps:{children:i,error:E.error,IconComponent:l,variant:D,type:void 0,multiple:g,..._?{id:u}:{autoWidth:r,defaultOpen:s,displayEmpty:c,labelId:m,MenuProps:h,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:{id:u,...S}},...f,classes:f?zn(k,f.classes):k,...d?d.props.inputProps:{}},...(g&&_||c)&&D===`outlined`?{notched:!0}:{},ref:ne,className:P(A.props.className,o,ee.root),...!d&&{variant:D},...w})})});l0.muiName=`Select`;function u0(e,t){if(t==null){e.focus();return}try{e.focus({focusVisible:t===`keyboard`})}catch{e.focus()}}var d0=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},f0=e=>{let{disabled:t,dense:n,divider:r,disableGutters:i,selected:a,classes:o}=e,s=Fa({root:[`root`,n&&`dense`,t&&`disabled`,!i&&`gutters`,r&&`divider`,a&&`selected`]},q$,o);return{...o,...s}},p0=L(Zd,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiMenuItem`,slot:`Root`,overridesResolver:d0})(ol(({theme:e})=>({...e.typography.body1,display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:`border-box`,whiteSpace:`nowrap`,"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${J$.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${J$.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${J$.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${J$.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${J$.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${L$.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${L$.inset}`]:{marginLeft:52},[`& .${K$.root}`]:{marginTop:0,marginBottom:0},[`& .${K$.inset}`]:{paddingLeft:36},[`& .${R$.root}`]:{minWidth:36},variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>!e.dense,style:{[e.breakpoints.up(`sm`)]:{minHeight:`auto`}}},{props:({ownerState:e})=>e.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${R$.root} svg`]:{fontSize:`1.25rem`}}}]}))),m0=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiMenuItem`}),{autoFocus:r=!1,component:i=`li`,dense:a=!1,divider:o=!1,disableGutters:s=!1,focusVisibleClassName:c,role:l=`menuitem`,tabIndex:u,className:d,...f}=n,p=l1(),m=M.useContext(wp),h=M.useMemo(()=>({dense:a||m.dense||!1,disableGutters:s}),[m.dense,a,s]),g=M.useRef(null);Ul(()=>{r&&g.current&&u0(g.current,p)},[r]);let _={...n,dense:h.dense,divider:o,disableGutters:s},v=f0(n),y=kc(g,t),{root:b,...x}=v,S;return n.disabled||(S=u===void 0?-1:u),(0,N.jsx)(wp.Provider,{value:h,children:(0,N.jsx)(p0,{ref:y,role:l,tabIndex:S,component:i,focusVisibleClassName:P(v.focusVisible,c),className:P(v.root,d),...f,ownerState:_,classes:x})})}),h0=()=>{document.querySelectorAll(`.mq-supsub.mq-sup-only`).forEach(e=>{let t=e.previousElementSibling;t&&t.classList.contains(`mq-non-leaf`)&&t.querySelector(`.mq-fraction`)?e.classList.add(`mq-after-fraction-group`):e.classList.remove(`mq-after-fraction-group`)})},{commonMqFontStyles:g0,commonMqKeyboardStyles:_0,longdivStyles:v0,supsubStyles:y0}=l$,b0=md(`@pie-lib:math-toolbar:editor-and-pad`),x0=/\.|,/g,S0=L(`div`)(({theme:e})=>({zIndex:9,position:`relative`,textAlign:`center`,width:`auto`,"& > .mq-math-mode":{border:`solid 1px lightgrey`},"& > .mq-focused":{outline:`none`,boxShadow:`none`,border:`dotted 1px ${e.palette.primary.main}`,borderRadius:`0px`},"& .mq-overarrow-inner":{border:`none !important`,paddingTop:`0 !important`},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-overarrow.mq-arrow-both":{top:`7.8px`,marginTop:`0px`,minWidth:`1.23em`},"& .mq-parallelogram":{lineHeight:.85}})),C0=L(`div`)(({theme:e,hide:t})=>({display:t?`none`:`flex`,alignItems:`center`,"& .mq-editable-field .mq-cursor":{top:`-4px`},"& .mq-math-mode .mq-selection, .mq-editable-field .mq-selection":{paddingTop:`18px`},"& .mq-math-mode .mq-overarrow":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& .mq-math-mode .mq-overline .mq-overline-inner":{paddingTop:`0.4em !important`},"& .mq-overarrow.mq-arrow-both":{minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.45em`,left:`-1px`},"&:after":{position:`absolute !important`,top:`0px !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& *":{...g0,...y0,...v0,"& .mq-math-mode .mq-sqrt-prefix":{verticalAlign:`baseline !important`,top:`1px !important`,left:`-0.1em !important`},"& .mq-math-mode .mq-overarc ":{paddingTop:`0.45em !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-root-block":{paddingTop:`10px`},"& .mq-scaled .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-longdiv .mq-longdiv-inner":{marginLeft:`4px !important`,paddingTop:`6px !important`,paddingLeft:`6px !important`},"& .mq-math-mode .mq-paren":{verticalAlign:`top !important`,padding:`1px 0.1em !important`},"& .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-math-mode .mq-denominator":{marginTop:`-5px !important`,padding:`0.5em 0.1em 0.1em !important`},"& .mq-math-mode .mq-numerator, .mq-math-mode .mq-over":{padding:`0 0.1em !important`,paddingBottom:`0 !important`,marginBottom:`-2px`}},'& span[data-prime="true"]':{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),w0=L(ap)({flex:`initial`,width:`25%`,minWidth:`100px`,marginLeft:`15px`,marginTop:`5px`,marginBottom:`5px`,marginRight:`5px`,"& label":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& div":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}),T0=L(Qf)(()=>({backgroundColor:`transparent`})),E0=L(`div`)(({theme:e,error:t})=>({minWidth:`500px`,maxWidth:`900px`,minHeight:`30px`,width:`100%`,display:`flex`,marginTop:e.spacing(1),marginBottom:e.spacing(1),...t&&{border:`2px solid red`},"& .mq-sqrt-prefix .mq-scaled":{verticalAlign:`middle !important`}})),D0=L(QQ)(({controlledKeypadMode:e})=>({maxWidth:e?`400px`:`500px`,color:lu(),backgroundColor:Au(),padding:`2px`})),O0=L(Ef)({position:`absolute`,right:`12px`,border:`1px solid lightgrey`,color:lu()}),k0=L(`hr`)(({theme:e})=>({padding:0,margin:0,height:`1px`,border:`none`,borderBottom:`solid 1px ${e.palette.primary.main}`})),A0=L(b$)(({mode:e})=>({..._0,...e===`language`&&{"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),j0=e=>{if(!e)return;let{type:t,value:n}=e;return t===`command`||t===`cursor`?e:t===`answer`?{type:`answer`,...e}:n===`clear`?{type:`clear`}:{type:`write`,value:n}},M0=class extends M.Component{static propTypes={classNames:k.object,keypadMode:k.oneOfType([k.string,k.number]),autoFocus:k.bool,allowAnswerBlock:k.bool,showKeypad:k.bool,controlledKeypad:k.bool,controlledKeypadMode:k.bool,error:k.string,noDecimal:k.bool,hideInput:k.bool,noLatexHandling:k.bool,layoutForKeyPad:k.object,maxResponseAreas:k.number,additionalKeys:k.array,latex:k.string.isRequired,onAnswerBlockAdd:k.func,onFocus:k.func,onBlur:k.func,onChange:k.func.isRequired,setKeypadInteraction:k.func};constructor(e){super(e),this.state={equationEditor:`item-authoring`,addDisabled:!1}}componentDidMount(){this.input&&this.props.autoFocus&&setTimeout(()=>this.input.focus(),0)}onClick=e=>{let{noDecimal:t,noLatexHandling:n,onChange:r}=this.props,i=j0(e);if(b0(`mathChange: `,i),n){r(i.value);return}t&&(i.value===`.`||i.value===`,`)||i&&(i.type===`clear`?(b0(`call clear...`),this.input.clear()):i.type===`command`?this.input.command(i.value):i.type===`cursor`?this.input.keystroke(i.value):i.type===`answer`?this.input.write(`%response%`):this.input.write(i.value))};updateDisable=e=>{let{maxResponseAreas:t}=this.props;if(t){let n=this.checkResponseAreasNumber(t,e);this.setState({addDisabled:n})}};onAnswerBlockClick=()=>{this.props.onAnswerBlockAdd(),this.onClick({type:`answer`}),this.updateDisable(!0)};onEditorChange=e=>{let{onChange:t,noDecimal:n}=this.props;if(GX(),h0(),this.updateDisable(!0),n&&(e.indexOf(`.`)!==-1||e.indexOf(`,`)!==-1)&&this.input){this.input.clear(),this.input.write(e.replace(x0,``));return}let r=e.match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.input&&r&&r?.length){try{this.input.mathField.__controller.cursor.insLeftOf(this.input.mathField.__controller.cursor.parent[-1].parent),this.input.mathField.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}return}t(e)};shouldComponentUpdate(e,t){let n=this.input.mathField.latex()!==e.latex;return b0(`[shouldComponentUpdate] `,`inputIsDifferent: `,n),!le(this.props.error,e.error)||!n&&this.props.keypadMode!==e.keypadMode||!n&&this.props.noDecimal!==e.noDecimal||!n&&this.state.equationEditor!==t.equationEditor?!0:!n&&this.props.controlledKeypad?this.props.showKeypad!==e.showKeypad:n}onEditorTypeChange=e=>{this.setState({equationEditor:e.target.value})};checkResponseAreasNumber=(e,t)=>{let{latex:n}=this.input&&this.input.props||{};if(n){let r=(n.match(/answerBlock/g)||[]).length;return t?r===e-1:r===e}return!1};render(){let{classNames:e,keypadMode:t,allowAnswerBlock:n,additionalKeys:r,controlledKeypad:i,controlledKeypadMode:a,showKeypad:o,setKeypadInteraction:s,noDecimal:c,hideInput:l,layoutForKeyPad:u,latex:d,onFocus:f,onBlur:p,error:m}=this.props,h=!i||i&&o,{addDisabled:g}=this.state;return b0(`[render]`,d),(0,N.jsxs)(S0,{className:e.mathToolbar,children:[(0,N.jsxs)(C0,{hide:l,children:[a&&(0,N.jsxs)(w0,{variant:`standard`,children:[(0,N.jsx)(T0,{id:`equation-editor-label`,children:`Equation Editor`}),(0,N.jsxs)(l0,{labelId:`equation-editor-label`,id:`equation-editor-select`,name:`equationEditor`,label:`Equation Editor`,onChange:this.onEditorTypeChange,value:this.state.equationEditor,MenuProps:{transitionDuration:{enter:225,exit:195}},children:[(0,N.jsx)(m0,{value:`non-negative-integers`,children:`Numeric - Non-Negative Integers`}),(0,N.jsx)(m0,{value:`integers`,children:`Numeric - Integers`}),(0,N.jsx)(m0,{value:`decimals`,children:`Numeric - Decimals`}),(0,N.jsx)(m0,{value:`fractions`,children:`Numeric - Fractions`}),(0,N.jsx)(m0,{value:1,children:`Grade 1 - 2`}),(0,N.jsx)(m0,{value:3,children:`Grade 3 - 5`}),(0,N.jsx)(m0,{value:6,children:`Grade 6 - 7`}),(0,N.jsx)(m0,{value:8,children:`Grade 8 - HS`}),(0,N.jsx)(m0,{value:`geometry`,children:`Geometry`}),(0,N.jsx)(m0,{value:`advanced-algebra`,children:`Advanced Algebra`}),(0,N.jsx)(m0,{value:`statistics`,children:`Statistics`}),(0,N.jsx)(m0,{value:`item-authoring`,children:`Item Authoring`})]})]}),(0,N.jsx)(E0,{error:m,children:(0,N.jsx)(D0,{onFocus:()=>{f&&f(),this.updateDisable(!1)},onBlur:e=>{this.updateDisable(!1),p&&p(e)},className:e&&e.editor||``,controlledKeypadMode:a,ref:e=>this.input=e,latex:d,onChange:this.onEditorChange})})]}),n&&(0,N.jsx)(O0,{type:`primary`,style:{bottom:h?`320px`:`20px`},onClick:this.onAnswerBlockClick,disabled:g,children:`+ Response Area`}),(0,N.jsx)(k0,{}),h&&(0,N.jsx)(A0,{mode:a?this.state.equationEditor:t,controlledKeypadMode:a,layoutForKeyPad:u,additionalKeys:r,onClick:this.onClick,noDecimal:c,setKeypadInteraction:s})]})}},N0=L(aJ)(({hideBackground:e})=>({verticalAlign:`top`,width:`28px`,height:`28px`,color:`#00bb00`,...e&&{backgroundColor:Wu(),"&:hover":{backgroundColor:ju()}},"& .MuiIconButton-label":{position:`absolute`,top:`2px`}})),P0=({onClick:e,hideBackground:t})=>(0,N.jsx)(N0,{"aria-label":`Done`,onClick:e,hideBackground:t,size:`large`,children:(0,N.jsx)(cJ,{})});P0.propTypes={onClick:k.func,hideBackground:k.bool};var F0=P0,{commonMqFontStyles:I0,longdivStyles:L0,supsubStyles:R0}=l$,z0=md(`@pie-lib:math-toolbar:math-preview`),B0=L(`div`)(({theme:e,isSelected:t})=>({display:`inline-flex`,alignItems:`center`,position:`relative`,"& *":I0,...R0,...L0,"& > .mq-math-mode":{border:t?`solid 0px lightgrey`:`solid 1px lightgrey`},"& > .mq-focused":{outline:`none`,boxShadow:`none`,border:`solid 1px black`,borderRadius:`0px`},"& > .mq-math-mode .mq-root-block":{paddingTop:`7px !important`},"& > .mq-math-mode .mq-overarc ":{paddingTop:`0.45em !important`},"& > .mq-math-mode .mq-sqrt-prefix":{verticalAlign:`baseline !important`,top:`1px !important`,left:`-0.1em !important`},"& > .mq-math-mode .mq-denominator":{marginTop:`-5px !important`,padding:`0.5em 0.1em 0.1em !important`},"& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over":{padding:`0 0.1em !important`,paddingBottom:`0 !important`,marginBottom:`-2px`},"& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty":{paddingTop:`6px !important`,paddingLeft:`4px !important`},"& > .mq-math-mode .mq-longdiv .mq-longdiv-inner":{marginLeft:`0 !important`},"& > .mq-math-mode .mq-overarrow":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& > .mq-math-mode .mq-paren":{verticalAlign:`top !important`,padding:`1px 0.1em !important`},"& > .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-overarrow-inner":{paddingTop:`0 !important`,border:`none !important`},"& .mq-editable-field .mq-cursor":{marginTop:`-15px !important`},"& .mq-overarrow.mq-arrow-both":{top:`7.5px`,marginTop:`0px`,minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`0px !important`,position:`absolute !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},'& span[data-prime="true"]':{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},...t&&{border:`solid 1px ${e.palette.primary.main}`}})),V0=L(`span`)({position:`absolute`,bottom:0,left:0,right:0,top:0}),H0=class extends M.Component{static propTypes={latex:k.string,isSelected:k.bool,onFocus:k.func,onBlur:k.func};componentDidMount(){h0()}componentDidUpdate(e){this.props.latex!==e.latex&&h0()}render(){let{isSelected:e,onFocus:t,onBlur:n,latex:r}=this.props;return z0(`[render] latex: `,r),(0,N.jsxs)(B0,{isSelected:e,children:[` `,(0,N.jsx)(V0,{}),(0,N.jsx)(i$,{latex:r,onFocus:t,onBlur:n})]})}},U0=L(`div`)({display:`flex`,width:`100%`,zIndex:8,alignItems:`center`}),W0=class extends M.Component{static propTypes={autoFocus:k.bool,allowAnswerBlock:k.bool,controlledKeypad:k.bool,controlledKeypadMode:k.bool,keypadMode:k.oneOfType([k.string,k.number]),classNames:k.object,error:k.string,maxResponseAreas:k.number,showKeypad:k.bool,noDecimal:k.bool,additionalKeys:k.array,latex:k.string.isRequired,onAnswerBlockAdd:k.func,onChange:k.func,onDone:k.func.isRequired,onFocus:k.func,onBlur:k.func,hideDoneButton:k.bool,keyPadCharacterRef:k.func,setKeypadInteraction:k.func};static defaultProps={classNames:{},keypadMode:`item-authoring`,autoFocus:!1,allowAnswerBlock:!1,controlledKeypad:!1,controlledKeypadMode:!1,noDecimal:!1,showKeypad:!0,additionalKeys:[],onChange:()=>{},onAnswerBlockAdd:()=>{},onFocus:()=>{},hideDoneButton:!1};constructor(e){super(e),this.state={latex:e.latex}}done=()=>{this.props.onDone(this.state.latex)};UNSAFE_componentWillReceiveProps(e){this.setState({latex:e.latex})}onChange=e=>{this.setState({latex:e}),this.props.onChange(e)};render(){let{latex:e}=this.state,{classNames:t,autoFocus:n,allowAnswerBlock:r,onAnswerBlockAdd:i,controlledKeypad:a,controlledKeypadMode:o,keypadMode:s,noDecimal:c,additionalKeys:l,showKeypad:u,onFocus:d,onBlur:f,hideDoneButton:p,error:m,keyPadCharacterRef:h,setKeypadInteraction:g,maxResponseAreas:_}=this.props;return(0,N.jsx)(G0,{autoFocus:n,classNames:t,onAnswerBlockAdd:i,allowAnswerBlock:r,latex:e,additionalKeys:l,noDecimal:c,keypadMode:s,keyPadCharacterRef:h,setKeypadInteraction:g,onChange:this.onChange,onDone:this.done,onFocus:d,onBlur:f,showKeypad:u,controlledKeypad:a,controlledKeypadMode:o,hideDoneButton:p,error:m,maxResponseAreas:_})}},G0=class extends M.Component{static propTypes={classNames:k.object,latex:k.string.isRequired,keypadMode:k.oneOfType([k.string,k.number]),hideInput:k.bool,noLatexHandling:k.bool,layoutForKeyPad:k.object,onChange:k.func.isRequired,onDone:k.func.isRequired,onBlur:k.func,onAnswerBlockAdd:k.func,additionalKeys:k.array,onFocus:k.func,autoFocus:k.bool,noDecimal:k.bool,allowAnswerBlock:k.bool,controlledKeypad:k.bool,controlledKeypadMode:k.bool,showKeypad:k.bool,hideDoneButton:k.bool,hideDoneButtonBackground:k.bool,error:k.any,maxResponseAreas:k.number,keyPadCharacterRef:k.object,setKeypadInteraction:k.func};static defaultProps={classNames:{},hideDoneButtonBackground:!1};render(){let{classNames:e,autoFocus:t,allowAnswerBlock:n,onAnswerBlockAdd:r,controlledKeypad:i,controlledKeypadMode:a,additionalKeys:o,showKeypad:s,keypadMode:c,noDecimal:l,hideInput:u,noLatexHandling:d,layoutForKeyPad:f,keyPadCharacterRef:p,setKeypadInteraction:m,latex:h,onChange:g,onDone:_,onFocus:v,onBlur:y,hideDoneButton:b,hideDoneButtonBackground:x,error:S,maxResponseAreas:C}=this.props;return(0,N.jsxs)(U0,{className:e&&e.toolbar||``,ref:p,children:[(0,N.jsx)(`div`,{}),(0,N.jsx)(M0,{autoFocus:t,keypadMode:c,classNames:e||{},controlledKeypad:i,controlledKeypadMode:a,noDecimal:l,hideInput:u,noLatexHandling:d,layoutForKeyPad:f,showKeypad:s,additionalKeys:o,allowAnswerBlock:n,onAnswerBlockAdd:r,latex:h,onChange:g,onFocus:v,onBlur:y,error:S,maxResponseAreas:C,setKeypadInteraction:m}),(!i||i&&s)&&!b&&(0,N.jsx)(F0,{hideBackground:x,onClick:_})]})}},K0=new Ab(`ensureTextAfterMath`),q0=(e=[])=>e.map(e=>({name:e,latex:e,write:e,label:e})),J0=e=>new Db({key:K0,appendTransaction:(t,n,r)=>{if(!t.some(e=>e.docChanged))return null;let i=r.tr,a=!1;return r.doc.descendants((t,n)=>{if(t.type.name===e){let e=n+t.nodeSize,o=r.doc.nodeAt(e);(!o||o.type.name!==`text`)&&(i.insert(e,r.schema.text(``)),a=!0)}}),a?i:null}}),Y0=(e,t)=>{let n;for(n=t;n>0;n--){let t=e.nodeAt(n);if(t?.type?.name===`text`&&t.textContent!==``)return-1;if(t&&t?.type?.name!==`text`)break}return n},X0=new Db({key:new Ab(`zeroWidthSpaceHandling`),props:{handleKeyDown(e,t){let{state:n,dispatch:r}=e,{selection:i,doc:a}=n,{from:o,empty:s}=i;if(s&&t.key===`Backspace`&&o>0){let e=Y0(a,o);return e===-1?!1:(r(n.tr.delete(e,o)),!0)}if(s&&t.key===`ArrowLeft`&&o>0){let e=Y0(a,o);if(e===-1)return!1;let t=n.doc.resolve(e);if(t.nodeAfter||t.nodeBefore){let t=n.doc.resolve(e);return r(n.tr.setSelection(W.create(n.doc,t.pos))),!0}else return r(n.tr.setSelection(U.create(n.doc,o-2))),!0}return!1}}}),Z0=$A.create({name:`math`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{latex:{default:``},wrapper:{default:null},html:{default:null}}},addProseMirrorPlugins(){return[J0(this.name),X0]},parseHTML(){return[{tag:`span[data-latex]`,getAttrs:e=>({latex:e.getAttribute(`data-raw`)||e.textContent})},{tag:`span[data-type="mathml"]`,getAttrs:e=>({html:e.innerHTML})}]},addCommands(){return{insertMath:(e=``)=>({tr:t,editor:n,dispatch:r})=>{let{state:i}=n.view,a=i.schema.nodes.math.create({latex:e}),{selection:o}=i,s=o.$from.pos;if(t.insert(s,a),a?.type?.name===this.name){let e=W.create(t.doc,o.$from.pos);t.setSelection(e)}return r(t),_J(n,!0),!0}}},renderHTML({HTMLAttributes:e}){return e.html?[`span`,{"data-type":`mathml`,dangerouslySetInnerHTML:{__html:e.html}}]:[`span`,{"data-latex":``,"data-raw":e.latex},ee(e.latex,e.wrapper)]},addNodeView(){return EM(e=>(0,N.jsx)(Q0,{...e,options:this.options}))}}),Q0=e=>{let{node:t,updateAttributes:n,editor:r,selected:i,options:a,getPos:o}=e,[s,c]=(0,M.useState)(i),l=(0,M.useRef)(null),u=(0,M.useRef)(null),d=(0,M.useRef)(Date.now()),[f,p]=(0,M.useState)({top:0,left:0}),{math:m={}}=a||{},{keypadMode:h,controlledKeypadMode:g=!0,customKeys:_=[],keyPadCharacterRef:v,setKeypadInteraction:y}=m,b=t.attrs.latex||``,x=e=>{n({latex:e})},S=(e,{moveCursorAfterNode:i=!0}={})=>{if(n({latex:e}),c(!1),i&&typeof o==`function`){let e=o(),{doc:n}=r.state,i=U.create(n,e+t.nodeSize),a=r.state.tr.setSelection(i);r.view.dispatch(a)}r.commands.focus()};return(0,M.useEffect)(()=>{if(!i)return;let{selection:e}=r.state;e.node?.type?.name===`math`&&c(!0)},[i,r]),(0,M.useEffect)(()=>{_J(r,i||s)},[r,s,i]),(0,M.useEffect)(()=>{if(!r||!s){p({top:0,left:0});return}let e=()=>{if(!l.current)return;let{from:e}=r.state.selection,t=r.view.coordsAtPos(e),n=u.current?.getBoundingClientRect?.(),i=n?.height?n.top:t.top,a=n?.width?n.left:t.left,o=n?.height?n.bottom:t.bottom??t.top,s=l.current.offsetHeight,c=l.current.offsetWidth,d=window.innerHeight-(o+0)>=s?o+0:i-s-0,f=a;d=Math.max(8,Math.min(d,window.innerHeight-s-8)),f=Math.max(8,Math.min(f,window.innerWidth-c-8));let m=(r._tiptapContainerEl||document.body).getBoundingClientRect();p({top:d-m.top,left:f-m.left})};e();let t=null,n=()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))};return t=requestAnimationFrame(()=>{t=null,e()}),window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{t!==null&&cancelAnimationFrame(t),window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[r,s]),(0,M.useEffect)(()=>{let e=e=>{let n=e?.target,i=(document.querySelectorAll?.(`[id^="equation-editor-select"][id*="listbox"], [aria-labelledby="equation-editor-label"][role="listbox"]`)||[]).length>0,a=!!(n?.id&&n.id.includes(`equation-editor-select`))||!!n?.closest?.(`[id*="equation-editor-select"]`),o=!!n?.closest?.(`.math-node-${d.current}`);if(l.current&&!l.current.contains(n)&&!n?.closest?.(`[data-inline-node]`)&&!i&&!a&&!o){c(!1);let e=!!r?.view?.dom?.contains(n);S(t.attrs.latex,{moveCursorAfterNode:!e})}};return s?document.addEventListener(`click`,e):document.removeEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[r,s,t]),(0,N.jsxs)(vM,{className:`math-node-${d.current}`,style:{display:`inline-flex`,cursor:`pointer`,margin:`0 4px`},"data-selected":i,children:[(0,N.jsx)(`div`,{ref:u,onClick:()=>c(!0),contentEditable:!1,children:(0,N.jsx)(H0,{latex:b})}),s&&hs.createPortal((0,N.jsx)(`div`,{ref:l,"data-toolbar-for":r.instanceId,style:{position:`absolute`,top:`${f.top}px`,left:`${f.left}px`,zIndex:1e3,background:`var(--editable-html-toolbar-bg, #efefef)`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`},children:(0,N.jsx)(W0,{latex:b,autoFocus:!0,onChange:x,onDone:S,keypadMode:h,controlledKeypadMode:g,additionalKeys:q0(_),keyPadCharacterRef:v,setKeypadInteraction:y})}),r?._tiptapContainerEl||document.body)]})};function $0(e){return F(`MuiLinearProgress`,e)}mi(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`dashedColorPrimary`,`dashedColorSecondary`,`bar`,`bar1`,`bar2`,`barColorPrimary`,`barColorSecondary`,`bar1Indeterminate`,`bar1Determinate`,`bar1Buffer`,`bar2Indeterminate`,`bar2Buffer`]);var e2=4,t2=fn`
|
|
336
336
|
0% {
|
|
337
337
|
left: -35%;
|
|
338
338
|
right: 100%;
|
|
@@ -347,9 +347,9 @@ mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`
|
|
|
347
347
|
left: 100%;
|
|
348
348
|
right: -90%;
|
|
349
349
|
}
|
|
350
|
-
`,
|
|
351
|
-
animation: ${
|
|
352
|
-
`,
|
|
350
|
+
`,n2=typeof t2==`string`?null:dn`
|
|
351
|
+
animation: ${t2} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
|
|
352
|
+
`,r2=fn`
|
|
353
353
|
0% {
|
|
354
354
|
left: -200%;
|
|
355
355
|
right: 100%;
|
|
@@ -364,9 +364,9 @@ mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`
|
|
|
364
364
|
left: 107%;
|
|
365
365
|
right: -8%;
|
|
366
366
|
}
|
|
367
|
-
`,
|
|
368
|
-
animation: ${
|
|
369
|
-
`,
|
|
367
|
+
`,i2=typeof r2==`string`?null:dn`
|
|
368
|
+
animation: ${r2} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
|
|
369
|
+
`,a2=fn`
|
|
370
370
|
0% {
|
|
371
371
|
opacity: 1;
|
|
372
372
|
background-position: 0 -23px;
|
|
@@ -381,17 +381,17 @@ mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`
|
|
|
381
381
|
opacity: 1;
|
|
382
382
|
background-position: -200px -23px;
|
|
383
383
|
}
|
|
384
|
-
`,
|
|
385
|
-
animation: ${
|
|
386
|
-
`,$0=e=>{let{classes:t,variant:n,color:r}=e;return Fa({root:[`root`,`color${z(r)}`,n],dashed:[`dashed`,`dashedColor${z(r)}`],bar1:[`bar`,`bar1`,`barColor${z(r)}`,(n===`indeterminate`||n===`query`)&&`bar1Indeterminate`,n===`determinate`&&`bar1Determinate`,n===`buffer`&&`bar1Buffer`],bar2:[`bar`,`bar2`,n!==`buffer`&&`barColor${z(r)}`,n===`buffer`&&`color${z(r)}`,(n===`indeterminate`||n===`query`)&&`bar2Indeterminate`,n===`buffer`&&`bar2Buffer`]},G0,t)},e2=(e,t)=>e.vars?e.vars.palette.LinearProgress[`${t}Bg`]:e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.5),t2=L(`span`,{name:`MuiLinearProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`color${z(n.color)}`],t[n.variant]]}})(ol(({theme:e})=>({position:`relative`,overflow:`hidden`,display:`block`,height:4,zIndex:0,"@media print":{colorAdjust:`exact`},variants:[...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{backgroundColor:e2(e,t)}})),{props:({ownerState:e})=>e.color===`inherit`&&e.variant!==`buffer`,style:{"&::before":{content:`""`,position:`absolute`,left:0,top:0,right:0,bottom:0,backgroundColor:`currentColor`,opacity:.3}}},{props:{variant:`buffer`},style:{backgroundColor:`transparent`}},{props:{variant:`query`},style:{transform:`rotate(180deg)`}}]}))),n2=L(`span`,{name:`MuiLinearProgress`,slot:`Dashed`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.dashed,t[`dashedColor${z(n.color)}`]]}})(ol(({theme:e})=>({position:`absolute`,marginTop:0,height:`100%`,width:`100%`,backgroundSize:`10px 10px`,backgroundPosition:`0 -23px`,variants:[{props:{color:`inherit`},style:{opacity:.3,backgroundImage:`radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)`}},...Object.entries(e.palette).filter(tf()).map(([t])=>{let n=e2(e,t);return{props:{color:t},style:{backgroundImage:`radial-gradient(${n} 0%, ${n} 16%, transparent 42%)`}}})]})),Q0||{animation:`${Z0} 3s infinite linear`}),r2=L(`span`,{name:`MuiLinearProgress`,slot:`Bar1`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar1,t[`barColor${z(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar1Indeterminate,n.variant===`determinate`&&t.bar1Determinate,n.variant===`buffer`&&t.bar1Buffer]}})(ol(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[{props:{color:`inherit`},style:{backgroundColor:`currentColor`}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main}})),{props:{variant:`determinate`},style:{transition:`transform .${K0}s linear`}},{props:{variant:`buffer`},style:{zIndex:1,transition:`transform .${K0}s linear`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:J0||{animation:`${q0} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite`}}]}))),i2=L(`span`,{name:`MuiLinearProgress`,slot:`Bar2`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar2,t[`barColor${z(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar2Indeterminate,n.variant===`buffer`&&t.bar2Buffer]}})(ol(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{"--LinearProgressBar2-barColor":(e.vars||e).palette[t].main}})),{props:({ownerState:e})=>e.variant!==`buffer`&&e.color!==`inherit`,style:{backgroundColor:`var(--LinearProgressBar2-barColor, currentColor)`}},{props:({ownerState:e})=>e.variant!==`buffer`&&e.color===`inherit`,style:{backgroundColor:`currentColor`}},{props:{color:`inherit`},style:{opacity:.3}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t,variant:`buffer`},style:{backgroundColor:e2(e,t),transition:`transform .${K0}s linear`}})),{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:X0||{animation:`${Y0} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite`}}]}))),a2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiLinearProgress`}),{className:r,color:i=`primary`,value:a,valueBuffer:o,variant:s=`indeterminate`,...c}=n,l={...n,color:i,variant:s},u=$0(l),d=ea(),f={},p={bar1:{},bar2:{}};if((s===`determinate`||s===`buffer`)&&a!==void 0){f[`aria-valuenow`]=Math.round(a),f[`aria-valuemin`]=0,f[`aria-valuemax`]=100;let e=a-100;d&&(e=-e),p.bar1.transform=`translateX(${e}%)`}if(s===`buffer`&&o!==void 0){let e=(o||0)-100;d&&(e=-e),p.bar2.transform=`translateX(${e}%)`}return(0,N.jsxs)(t2,{className:P(u.root,r),ownerState:l,role:`progressbar`,...f,ref:t,...c,children:[s===`buffer`?(0,N.jsx)(n2,{className:u.dashed,ownerState:l}):null,(0,N.jsx)(r2,{className:u.bar1,ownerState:l,style:p.bar1}),s===`determinate`?null:(0,N.jsx)(i2,{className:u.bar2,ownerState:l,style:p.bar2})]})}),o2=md(`@pie-lib:editable-html:image:insert-image-handler`),s2=class{constructor(e,t,n,r=!1){this.editor=e,this.nodeInfo=t,this.node=t[0],this.nodePos=t[1],this.onFinish=n,this.isPasted=r,this.chosenFile=null}cancel(){o2(`insert cancelled`);try{this.deleteNode(),this.onFinish(!1)}catch{}finally{this.editor._insertingImage=!1}}updateNode(e){let{state:t,view:n}=this.editor,{tr:r}=t,i=t.doc.nodeAt(this.nodePos);if(i){let t=r.setNodeMarkup(this.nodePos,void 0,{...i.attrs,...e});n.dispatch(t)}}deleteNode(){let{state:e,view:t}=this.editor,{tr:n}=e,r=n.delete(this.nodePos,this.nodePos+this.node.nodeSize);t.dispatch(r)}done(e,t){o2(`done: err:`,e),e?(console.log(e),this.onFinish(!1)):(this.updateNode({loaded:!0,src:t,percent:100}),this.onFinish(!0)),this.editor._insertingImage=!1}fileChosen(e){if(!e)return;this.chosenFile=e,this.editor._insertingImage=!1,o2(`[fileChosen] file: `,e);let t=new FileReader;t.onload=()=>{let e=t.result;this.updateNode({src:e})},t.readAsDataURL(e)}progress(e,t,n){o2(`progress: `,e,t,n),this.updateNode({percent:e})}getChosenFile(){return this.chosenFile}};function c2(e){return F(`MuiDialogContent`,e)}mi(`MuiDialogContent`,[`root`,`dividers`]);function l2(e){return F(`MuiDialogTitle`,e)}var u2=mi(`MuiDialogTitle`,[`root`]),d2=e=>{let{classes:t,dividers:n}=e;return Fa({root:[`root`,n&&`dividers`]},c2,t)},f2=L(`div`,{name:`MuiDialogContent`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(ol(({theme:e})=>({flex:`1 1 auto`,WebkitOverflowScrolling:`touch`,overflowY:`auto`,padding:`20px 24px`,variants:[{props:({ownerState:e})=>e.dividers,style:{padding:`16px 24px`,borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>!e.dividers,style:{[`.${u2.root} + &`]:{paddingTop:0}}}]}))),p2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialogContent`}),{className:r,dividers:i=!1,...a}=n,o={...n,dividers:i},s=d2(o);return(0,N.jsx)(f2,{className:P(s.root,r),ownerState:o,ref:t,...a})}),m2=Vl((0,N.jsx)(`path`,{d:`M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z`}),`ArrowBackIos`);function h2(e){return F(`MuiFormHelperText`,e)}var g2=mi(`MuiFormHelperText`,[`root`,`error`,`disabled`,`sizeSmall`,`sizeMedium`,`contained`,`focused`,`filled`,`required`]),_2,v2=e=>{let{classes:t,contained:n,size:r,disabled:i,error:a,filled:o,focused:s,required:c}=e;return Fa({root:[`root`,i&&`disabled`,a&&`error`,r&&`size${z(r)}`,n&&`contained`,s&&`focused`,o&&`filled`,c&&`required`]},h2,t)},y2=L(`p`,{name:`MuiFormHelperText`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.size&&t[`size${z(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(ol(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:`left`,marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${g2.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${g2.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:`small`},style:{marginTop:4}},{props:({ownerState:e})=>e.contained,style:{marginLeft:14,marginRight:14}}]}))),b2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiFormHelperText`}),{children:r,className:i,component:a=`p`,disabled:o,error:s,filled:c,focused:l,margin:u,required:d,variant:f,...p}=n,m=Bf({props:n,muiFormControl:Hf(),states:[`variant`,`size`,`disabled`,`error`,`filled`,`focused`,`required`]}),h={...n,component:a,contained:m.variant===`filled`||m.variant===`outlined`,variant:m.variant,size:m.size,disabled:m.disabled,error:m.error,filled:m.filled,focused:m.focused,required:m.required};delete h.ownerState;let g=v2(h);return(0,N.jsx)(y2,{as:a,className:P(g.root,i),ref:t,...p,ownerState:h,children:r===` `?_2||=(0,N.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):r})});function x2(e){return F(`MuiTextField`,e)}mi(`MuiTextField`,[`root`]);var S2={standard:M1,filled:R1,outlined:Y1},C2=e=>{let{classes:t}=e;return Fa({root:[`root`]},x2,t)},w2=L(ap,{name:`MuiTextField`,slot:`Root`})({}),T2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiTextField`}),{autoComplete:r,autoFocus:i=!1,children:a,className:o,color:s=`primary`,defaultValue:c,disabled:l=!1,error:u=!1,FormHelperTextProps:d,fullWidth:f=!1,helperText:p,id:m,InputLabelProps:h,inputProps:g,InputProps:_,inputRef:v,label:y,maxRows:b,minRows:x,multiline:S=!1,name:C,onBlur:w,onChange:T,onFocus:E,placeholder:D,required:O=!1,rows:ee,select:te=!1,SelectProps:k,slots:A={},slotProps:ne={},type:j,value:re,variant:ie=`outlined`,...ae}=n,oe={...n,autoFocus:i,color:s,disabled:l,error:u,fullWidth:f,multiline:S,required:O,select:te,variant:ie},se=C2(oe),ce=ca(m),le=p&&ce?`${ce}-helper-text`:void 0,ue=y&&ce?`${ce}-label`:void 0,de=S2[ie],fe={slots:A,slotProps:{input:_,inputLabel:h,htmlInput:g,formHelperText:d,select:k,...ne}},pe={},me=fe.slotProps.inputLabel;ie===`outlined`&&(me&&me.shrink!==void 0&&(pe.notched=me.shrink),pe.label=y),te&&((!k||!k.native)&&(pe.id=void 0),pe[`aria-describedby`]=void 0);let[he,ge]=fl(`root`,{elementType:w2,shouldForwardComponentProp:!0,externalForwardedProps:{...fe,...ae},ownerState:oe,className:P(se.root,o),ref:t,additionalProps:{disabled:l,error:u,fullWidth:f,required:O,color:s,variant:ie}}),[_e,ve]=fl(`input`,{elementType:de,externalForwardedProps:fe,additionalProps:pe,ownerState:oe}),[ye,be]=fl(`inputLabel`,{elementType:Qf,externalForwardedProps:fe,ownerState:oe}),[xe,Se]=fl(`htmlInput`,{elementType:`input`,externalForwardedProps:fe,ownerState:oe}),[Ce,we]=fl(`formHelperText`,{elementType:b2,externalForwardedProps:fe,ownerState:oe}),[Te,Ee]=fl(`select`,{elementType:t0,externalForwardedProps:fe,ownerState:oe}),De=(0,N.jsx)(_e,{"aria-describedby":le,autoComplete:r,autoFocus:i,defaultValue:c,fullWidth:f,multiline:S,name:C,rows:ee,maxRows:b,minRows:x,type:j,value:re,id:ce,inputRef:v,onBlur:w,onChange:T,onFocus:E,placeholder:D,inputProps:Se,slots:{input:A.htmlInput?xe:void 0},...ve});return(0,N.jsxs)(he,{...ge,children:[y!=null&&y!==``&&(0,N.jsx)(ye,{htmlFor:ce,id:ue,...be,children:y}),te?(0,N.jsx)(Te,{"aria-describedby":le,id:ce,labelId:ue,value:re,input:De,...Ee,children:a}):De,p&&(0,N.jsx)(Ce,{id:le,...we,children:p})]})});function E2(e){return F(`MuiDialogActions`,e)}mi(`MuiDialogActions`,[`root`,`spacing`]);var D2=e=>{let{classes:t,disableSpacing:n}=e;return Fa({root:[`root`,!n&&`spacing`]},E2,t)},O2=L(`div`,{name:`MuiDialogActions`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableSpacing&&t.spacing]}})({display:`flex`,alignItems:`center`,padding:8,justifyContent:`flex-end`,flex:`0 0 auto`,variants:[{props:({ownerState:e})=>!e.disableSpacing,style:{"& > :not(style) ~ :not(style)":{marginLeft:8}}}]}),k2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialogActions`}),{className:r,disableSpacing:i=!1,...a}=n,o={...n,disableSpacing:i},s=D2(o);return(0,N.jsx)(O2,{className:P(s.root,r),ownerState:o,ref:t,...a})});function A2(e){return F(`MuiDialog`,e)}var j2=mi(`MuiDialog`,[`root`,`backdrop`,`scrollPaper`,`scrollBody`,`container`,`paper`,`paperScrollPaper`,`paperScrollBody`,`paperWidthFalse`,`paperWidthXs`,`paperWidthSm`,`paperWidthMd`,`paperWidthLg`,`paperWidthXl`,`paperFullWidth`,`paperFullScreen`]),M2=M.createContext({}),N2=L(yl,{name:`MuiDialog`,slot:`Backdrop`})({zIndex:-1}),P2=e=>{let{classes:t,scroll:n,maxWidth:r,fullWidth:i,fullScreen:a}=e;return Fa({root:[`root`],backdrop:[`backdrop`],container:[`container`,`scroll${z(n)}`],paper:[`paper`,`paperScroll${z(n)}`,`paperWidth${z(String(r))}`,i&&`paperFullWidth`,a&&`paperFullScreen`]},A2,t)},F2=L(jl,{name:`MuiDialog`,slot:`Root`})({"@media print":{position:`absolute !important`}}),I2=L(`div`,{name:`MuiDialog`,slot:`Container`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.container,t[`scroll${z(n.scroll)}`]]}})({height:`100%`,"@media print":{height:`auto`},outline:0,variants:[{props:{scroll:`paper`},style:{display:`flex`,justifyContent:`center`,alignItems:`center`}},{props:{scroll:`body`},style:{overflowY:`auto`,overflowX:`hidden`,textAlign:`center`,"&::after":{content:`""`,display:`inline-block`,verticalAlign:`middle`,height:`100%`,width:`0`}}}]}),L2=L(Fl,{name:`MuiDialog`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`scrollPaper${z(n.scroll)}`],t[`paperWidth${z(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(ol(({theme:e})=>({margin:32,position:`relative`,overflowY:`auto`,"@media print":{overflowY:`visible`,boxShadow:`none`},variants:[{props:{scroll:`paper`},style:{display:`flex`,flexDirection:`column`,maxHeight:`calc(100% - 64px)`}},{props:{scroll:`body`},style:{display:`inline-block`,verticalAlign:`middle`,textAlign:`initial`}},{props:({ownerState:e})=>!e.maxWidth,style:{maxWidth:`calc(100% - 64px)`}},{props:{maxWidth:`xs`},style:{maxWidth:e.breakpoints.unit===`px`?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${j2.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:`calc(100% - 64px)`}}}},...Object.keys(e.breakpoints.values).filter(e=>e!==`xs`).map(t=>({props:{maxWidth:t},style:{maxWidth:`${e.breakpoints.values[t]}${e.breakpoints.unit}`,[`&.${j2.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t]+64)]:{maxWidth:`calc(100% - 64px)`}}}})),{props:({ownerState:e})=>e.fullWidth,style:{width:`calc(100% - 64px)`}},{props:({ownerState:e})=>e.fullScreen,style:{margin:0,width:`100%`,maxWidth:`100%`,height:`100%`,maxHeight:`none`,borderRadius:0,[`&.${j2.paperScrollBody}`]:{margin:0,maxWidth:`100%`}}}]}))),R2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialog`}),r=Jo(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":o,"aria-modal":s=!0,BackdropComponent:c,BackdropProps:l,children:u,className:d,disableEscapeKeyDown:f=!1,fullScreen:p=!1,fullWidth:m=!1,maxWidth:h=`sm`,onClick:g,onClose:_,open:v,PaperComponent:y=Fl,PaperProps:b={},role:x=`dialog`,scroll:S=`paper`,slots:C={},slotProps:w={},TransitionComponent:T=hl,transitionDuration:E=i,TransitionProps:D,...O}=n,ee={...n,disableEscapeKeyDown:f,fullScreen:p,fullWidth:m,maxWidth:h,scroll:S},te=P2(ee),k=M.useRef(),A=e=>{k.current=e.target===e.currentTarget},ne=e=>{g&&g(e),k.current&&(k.current=null,_&&_(e,`backdropClick`))},j=ca(o),re=M.useMemo(()=>({titleId:j}),[j]),ie={slots:{transition:T,...C},slotProps:{transition:D,paper:b,backdrop:l,...w}},[ae,oe]=fl(`root`,{elementType:F2,shouldForwardComponentProp:!0,externalForwardedProps:ie,ownerState:ee,className:P(te.root,d),ref:t}),[se,ce]=fl(`backdrop`,{elementType:N2,shouldForwardComponentProp:!0,externalForwardedProps:ie,ownerState:ee,className:te.backdrop}),[le,ue]=fl(`paper`,{elementType:L2,shouldForwardComponentProp:!0,externalForwardedProps:ie,ownerState:ee,className:te.paper,additionalProps:{elevation:24,role:x,"aria-describedby":a,"aria-labelledby":j,"aria-modal":s,tabIndex:-1,[Jc]:``}}),[de,fe]=fl(`container`,{elementType:I2,externalForwardedProps:ie,ownerState:ee,className:te.container}),[pe,me]=fl(`transition`,{elementType:hl,externalForwardedProps:ie,ownerState:ee,additionalProps:{appear:!0,in:v,timeout:E,role:`presentation`}});return(0,N.jsx)(ae,{closeAfterTransition:!0,slots:{backdrop:se},slotProps:{backdrop:{transitionDuration:E,as:c,...ce}},disableEscapeKeyDown:f,onClose:_,open:v,onClick:ne,...oe,...O,children:(0,N.jsx)(pe,{...me,children:(0,N.jsx)(de,{onMouseDown:A,...fe,children:(0,N.jsx)(le,{as:y,...ue,children:(0,N.jsx)(M2.Provider,{value:re,children:u})})})})})}),z2=class extends M.Component{static propTypes={onDone:k.func.isRequired,alt:k.string};constructor(e){super(e);let{alt:t}=e;this.state={value:t}}closeDialog=()=>{document.querySelectorAll(`#text-dialog`).forEach(function(e){return e.remove()})};onDone=()=>{let{onDone:e}=this.props,{value:t}=this.state;e(t),this.closeDialog()};handleOverflow=()=>{document.body.style.removeProperty(`overflow`)};render(){let{value:e}=this.state;return(0,N.jsxs)(R2,{open:!0,disablePortal:!0,onClose:this.closeDialog,id:`text-dialog`,hideBackdrop:!0,disableScrollLock:!0,onEntered:this.handleOverflow,children:[(0,N.jsx)(p2,{children:(0,N.jsxs)(`div`,{style:{display:`flex`},children:[(0,N.jsx)(m2,{style:{paddingTop:`6px`}}),(0,N.jsx)(T2,{multiline:!0,placeholder:`Enter an Alt Text description of this image`,helperText:`Users with visual limitations rely on Alt Text, since screen readers cannot otherwise describe the contents of an image.`,value:e,onChange:e=>this.setState({value:e.target.value}),FormHelperTextProps:{style:{fontSize:14}}})]})}),(0,N.jsx)(k2,{children:(0,N.jsx)(Ef,{onClick:this.onDone,children:`Done`})})]})}},B2=L(`button`,{shouldForwardProp:e=>![`active`,`disabled`,`extraStyles`].includes(e)})(({active:e,disabled:t})=>({color:e?lu():uu(),display:`inline-flex`,padding:`2px`,background:`none`,border:`none`,cursor:t?`not-allowed`:`pointer`,"& svg":{width:`24px`,height:`24px`},"&:hover":{color:t?uu():lu()},"&:focus":{outline:`2px solid ${Xu()}`},...t&&{opacity:.7}})),V2=md(`pie-elements:editable-html:raw-button`);(class extends M.Component{static propTypes={onClick:k.func.isRequired,children:k.oneOfType([k.arrayOf(k.node),k.node]).isRequired,active:k.bool,disabled:k.bool,extraStyles:k.object};constructor(e){super(e)}onClick=e=>{V2(`[onClick]`),e.preventDefault();let{onClick:t}=this.props;t(e)};onKeyDown=e=>{if(e.key===`Enter`||e.key===` `){V2(`[onKeyDown]`),e.preventDefault();let{onClick:t}=this.props;t(e)}};render(){let{active:e,children:t,disabled:n,extraStyles:r,ariaLabel:i}=this.props;return(0,N.jsx)(B2,{style:r,active:e,disabled:n,onMouseDown:this.onClick,onKeyDown:this.onKeyDown,"aria-label":i,"aria-pressed":e,tabIndex:0,children:t})}});var H2=class extends M.Component{static propTypes={onToggle:k.func.isRequired,mark:k.string,label:k.string.isRequired,children:k.oneOfType([k.arrayOf(k.node),k.node]).isRequired,active:k.bool};constructor(e){super(e)}onToggle=e=>{e.preventDefault(),this.props.onToggle(this.props.mark)};onKeyDown=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.props.onToggle(this.props.mark))};render(){let{children:e,active:t,label:n}=this.props;return(0,N.jsx)(B2,{active:t,onMouseDown:this.onToggle,"aria-pressed":t,onKeyDown:this.onKeyDown,"aria-label":n,tabIndex:0,children:e})}},U2=md(`@pie-lib:editable-html:plugins:image:image-toolbar`),W2=L(`div`)(({theme:e})=>({paddingLeft:e.spacing.unit,display:`flex`,alignItems:`center`})),G2=L(`span`,{shouldForwardProp:e=>![`disabled`,`hasAlignmentButtons`].includes(e)})(({disabled:e,hasAlignmentButtons:t})=>({...e&&{opacity:.5},...t&&{borderLeft:`1px solid grey`,paddingLeft:8,marginLeft:4}})),K2=({alignment:e,active:t,onClick:n})=>(0,N.jsx)(H2,{active:t,onToggle:()=>n(e),label:e,children:e});K2.propTypes={alignment:k.string.isRequired,active:k.bool.isRequired,onClick:k.func.isRequired};var q2=class extends M.Component{static propTypes={onChange:k.func.isRequired,alignment:k.string,alt:k.string,imageLoaded:k.bool,disableImageAlignmentButtons:k.bool};onAltTextDone=e=>{U2(`[onAltTextDone]: alt:`,e),this.props.onChange({alt:e},!0)};onAlignmentClick=e=>{U2(`[onAlignmentClick]: alignment:`,e),this.props.onChange({alignment:e})};renderDialog=()=>{let{alt:e}=this.props,t=document.createElement(`div`),n=(0,N.jsx)(z2,{alt:e,onDone:this.onAltTextDone});hs.render(n,t),document.body.appendChild(t)};render(){let{alignment:e,imageLoaded:t,disableImageAlignmentButtons:n}=this.props;return(0,N.jsxs)(W2,{children:[!n&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(K2,{alignment:`left`,active:e===`left`,onClick:this.onAlignmentClick}),(0,N.jsx)(K2,{alignment:`center`,active:e===`center`,onClick:this.onAlignmentClick}),(0,N.jsx)(K2,{alignment:`right`,active:e===`right`,onClick:this.onAlignmentClick})]}),(0,N.jsx)(G2,{disabled:!t,hasAlignmentButtons:!n,onMouseDown:e=>t&&this.renderDialog(e),children:`Alt text`})]})}},J2=L(a2,{shouldForwardProp:e=>e!==`hideProgress`})(({hideProgress:e})=>({position:`absolute`,left:`0`,width:`fit-content`,top:`0%`,transition:`opacity 200ms linear`,...e&&{opacity:0}})),Y2=L(`div`,{shouldForwardProp:e=>![`active`,`loading`,`pendingDelete`].includes(e)})(({loading:e,pendingDelete:t})=>({position:`relative`,display:`flex`,transition:`opacity 200ms linear`,...e&&{opacity:.3},...t&&{opacity:.3}})),X2=L(`div`)(({theme:e})=>({position:`relative`,width:`fit-content`,display:`flex`,alignItems:`center`,"&&:hover > .resize":{display:`block`}})),Z2=L(`img`,{shouldForwardProp:e=>e!==`active`})(({theme:e,active:t})=>({border:t?`solid 1px ${e.palette.primary.main}`:`solid 1px transparent`})),Q2=L(`div`)(({theme:e})=>({backgroundColor:e.palette.primary.main,cursor:`col-resize`,height:`35px`,width:`5px`,borderRadius:8,marginLeft:`5px`,marginRight:`10px`,display:`none`})),$2=e=>e?`${e}px`:`calc(20px)`;function e4(e){let{node:t,editor:n,attributes:r,onFocus:i,getPos:a,selected:o,options:s,maxImageWidth:c=700,maxImageHeight:l=900}=e,{alt:u}=t.attrs,d=a(),f=n.state.selection.from,p=n.state.selection.to,m=(0,M.useMemo)(()=>f+t.nodeSize===p,[f,p,t.nodeSize]),[h,g]=(0,M.useState)(!1),_=(0,M.useRef)(t),v=(0,M.useRef)(null),y=(0,M.useRef)(null),b=(0,M.useRef)(null),x=(0,M.useCallback)(e=>{let t=e/v.current.naturalWidth*4;return parseInt(t.toFixed(0)*25,10)},[]),S=(0,M.useCallback)(()=>{let e=_.current.attrs.nodeKey,t=null;return n.state.doc.descendants((n,r)=>{if(t!==null)return!1;if(n.type.name===`imageUploadNode`&&n.attrs.nodeKey===e)return t=r,!1}),t},[n]),C=(0,M.useCallback)(e=>{let t=S();if(t===null)return;let r=n.state.doc.nodeAt(t);r&&n.view.dispatch(n.state.tr.setNodeMarkup(t,void 0,{...r.attrs,...e}))},[n,S]),w=(0,M.useCallback)(()=>{if(!t.attrs.width||!v.current||!v.current.naturalWidth)return;let e=x(t.attrs.width);t.attrs.resizePercent!==e&&C({resizePercent:e})},[t.attrs.width,t.attrs.resizePercent,x,C]);(0,M.useEffect)(()=>{_.current={...t,pos:d}},[t,d]),(0,M.useEffect)(()=>{o?m&&n.isEditable&&(!String(t.attrs?.src??``).trim()&&s.imageHandling?.insertImageRequested&&s.imageHandling.insertImageRequested(n,[t,d],e=>new s2(n,[t,d],e)),g(o)):g(o)},[m,o,n.isEditable]),(0,M.useEffect)(()=>{w();let e=y?.current;return e&&n.isEditable&&e.addEventListener(`mousedown`,te,!1),()=>{e&&e.removeEventListener(`mousedown`,te,!1)}},[]),(0,M.useEffect)(()=>{w()});let T=(0,M.useCallback)(()=>{let e=v.current;if(e&&(!e.style.width||e.style.width===`calc(20px)`)){let n=Math.min(e.naturalWidth,c),r=Math.min(e.naturalHeight,l);e.style.width=`${n}px`,e.style.height=`${r}px`;let i={width:n,height:r};le(i,{width:t.attrs.width,height:t.attrs.height})||C(i)}},[t.attrs.width,t.attrs.height,c,l,C]),E=(e,t,n=!0,r)=>{if(n){let n=e.width/e.height;return r===`height`?{width:t.height*n,height:t.height}:{width:t.width,height:t.width/n}}return t},D=(0,M.useCallback)(e=>{let t=v.current;if(!t)return;let n=e.target.getBoundingClientRect(),r={width:t.naturalWidth,height:t.naturalHeight},i=E(r,{width:e.clientX-n.left,height:e.clientY-n.top});i.width>50&&i.height>50&&i.width<=700&&i.height<=900&&(t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,C({width:i.width,height:i.height}))},[n,C]),O=(0,M.useCallback)(e=>{C(e)},[n,C]),ee=(0,M.useCallback)(()=>{window.removeEventListener(`mousemove`,D),window.removeEventListener(`mouseup`,ee)},[D]),te=(0,M.useCallback)(()=>{window.addEventListener(`mousemove`,D),window.addEventListener(`mouseup`,ee)},[D,ee]),k={width:$2(t.attrs.width),height:$2(t.attrs.height),objectFit:`contain`},A={left:`flex-start`,center:`center`,right:`flex-end`}[t.attrs.alignment]||`flex-start`;return(0,N.jsxs)(vM,{children:[(0,N.jsxs)(Y2,{onFocus:i,loading:!t.attrs.loaded,pendingDelete:t.attrs.deleteStatus===`pending`,style:{justifyContent:A},children:[(0,N.jsx)(J2,{mode:`determinate`,value:t.attrs.percent||0,hideProgress:t.attrs.loaded}),(0,N.jsxs)(X2,{onDragStart:e=>e.preventDefault(),children:[(0,N.jsx)(Z2,{...r,active:o&&t.attrs.loaded,draggable:!1,ref:v,src:t.attrs.src,style:k,onLoad:T,alt:t.attrs.alt}),(0,N.jsx)(Q2,{ref:y,className:`resize`,style:{display:n.isEditable?void 0:`none`}})]})]}),h&&n._tiptapContainerEl&&hs.createPortal((0,N.jsx)(`div`,{ref:b,style:{zIndex:20,background:`var(--editable-html-toolbar-bg, #efefef)`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,width:`100%`},children:(0,N.jsx)(sJ,{showDone:!0,deletable:!0,toolbarOpts:s.toolbarOpts||{},onDelete:()=>{let e=S();e!==null&&(s.imageHandling?.onDelete?.(_.current),n.view.dispatch(n.state.tr.delete(e,e+n.state.doc.nodeAt(e).nodeSize)),g(!1),n.commands.focus())},onDone:()=>{g(!1),s.imageHandling?.onDone?.(n),n.commands.focus(`end`)},children:(0,N.jsx)(q2,{disableImageAlignmentButtons:s.imageHandling?.disableImageAlignmentButtons,alt:t.attrs.alt,imageLoaded:t.attrs.loaded,alignment:t.attrs.alignment||`left`,onChange:O})})}),n._tiptapContainerEl)]})}e4.propTypes={node:k.object.isRequired,editor:k.object.isRequired,attributes:k.object,onFocus:k.func,maxImageWidth:k.number,maxImageHeight:k.number};var t4=$A.create({name:`imageUploadNode`,group:`block`,atom:!0,selectable:!0,draggable:!0,addAttributes(){return{nodeKey:{default:null},loaded:{default:!1},deleteStatus:{default:null},alignment:{default:null},percent:{default:null},width:{default:null},height:{default:null},src:{default:null},alt:{default:null}}},parseHTML(){return[{tag:`img[data-type="image-upload-node"]`}]},renderHTML({HTMLAttributes:e}){return[`img`,rk(e,{"data-type":`image-upload-node`})]},addNodeView(){return EM(e=>(0,N.jsx)(e4,{...e,options:this.options}))},addCommands(){return{setImageUploadNode:()=>({commands:e})=>e.insertContent({type:this.name,attrs:{nodeKey:`img-${Date.now()}-${Math.random().toString(36).slice(2)}`}})}},addProseMirrorPlugins(){let e=this.editor;return[new Db({props:{handlePaste(t,n){let r=Array.from(n.clipboardData?.items||[]).find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(!r)return!1;let i=r.getAsFile();if(!i)return!1;let a=new FileReader;return a.onload=()=>{let t=a.result;typeof t==`string`&&e.commands.insertContent({type:`imageUploadNode`,attrs:{src:t,loaded:!0,nodeKey:`img-${Date.now()}-${Math.random().toString(36).slice(2)}`}})},a.readAsDataURL(i),!0}}})]}});function n4(e){return(1+Math.sin(Math.PI*e-Math.PI/2))/2}function r4(e,t,n,r={},i=()=>{}){let{ease:a=n4,duration:o=300}=r,s=null,c=t[e],l=!1,u=()=>{l=!0},d=r=>{if(l){i(Error(`Animation cancelled`));return}s===null&&(s=r);let u=Math.min(1,(r-s)/o);if(t[e]=a(u)*(n-c)+c,u>=1){requestAnimationFrame(()=>{i(null)});return}requestAnimationFrame(d)};return c===n?(i(Error(`Element already at target position`)),u):(requestAnimationFrame(d),u)}var i4={width:99,height:99,position:`absolute`,top:-9999,overflow:`scroll`};function a4(e){let{onChange:t,...n}=e,r=M.useRef(),i=M.useRef(null),a=()=>{r.current=i.current.offsetHeight-i.current.clientHeight};return Ul(()=>{let e=pc(()=>{let e=r.current;a(),e!==r.current&&t(r.current)}),n=_c(i.current);return n.addEventListener(`resize`,e),()=>{e.clear(),n.removeEventListener(`resize`,e)}},[t]),M.useEffect(()=>{a(),t(r.current)},[t]),(0,N.jsx)(`div`,{style:i4,...n,ref:i})}var o4=Vl((0,N.jsx)(`path`,{d:`M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z`}),`KeyboardArrowLeft`),s4=Vl((0,N.jsx)(`path`,{d:`M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z`}),`KeyboardArrowRight`);function c4(e){return F(`MuiTabScrollButton`,e)}var l4=mi(`MuiTabScrollButton`,[`root`,`vertical`,`horizontal`,`disabled`]),u4=e=>{let{classes:t,orientation:n,disabled:r}=e;return Fa({root:[`root`,n,r&&`disabled`]},c4,t)},d4=L(Zd,{name:`MuiTabScrollButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.orientation&&t[n.orientation]]}})({width:40,flexShrink:0,opacity:.8,[`&.${l4.disabled}`]:{opacity:0},variants:[{props:{orientation:`vertical`},style:{width:`100%`,height:40,"& svg":{transform:`var(--TabScrollButton-svgRotate)`}}}]}),f4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiTabScrollButton`}),{className:r,slots:i={},slotProps:a={},direction:o,orientation:s,disabled:c,...l}=n,u=ea(),d={isRtl:u,...n},f=u4(d),p=i.StartScrollButtonIcon??o4,m=i.EndScrollButtonIcon??s4,h=Cp({elementType:p,externalSlotProps:a.startScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:d}),g=Cp({elementType:m,externalSlotProps:a.endScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:d});return(0,N.jsx)(d4,{component:`div`,className:P(f.root,r),ref:t,role:null,ownerState:d,tabIndex:null,...l,style:{...l.style,...s===`vertical`&&{"--TabScrollButton-svgRotate":`rotate(${u?-90:90}deg)`}},children:o===`left`?(0,N.jsx)(p,{...h}):(0,N.jsx)(m,{...g})})});function p4(e){return F(`MuiTabs`,e)}var m4=mi(`MuiTabs`,[`root`,`vertical`,`list`,`flexContainer`,`flexContainerVertical`,`centered`,`scroller`,`fixed`,`scrollableX`,`scrollableY`,`hideScrollbar`,`scrollButtons`,`scrollButtonsHideMobile`,`indicator`]),h4=(e,t)=>e===t?e.firstChild:t&&t.nextElementSibling?t.nextElementSibling:e.firstChild,g4=(e,t)=>e===t?e.lastChild:t&&t.previousElementSibling?t.previousElementSibling:e.lastChild,_4=(e,t,n)=>{let r=!1,i=n(e,t);for(;i;){if(i===e.firstChild){if(r)return;r=!0}let t=i.disabled||i.getAttribute(`aria-disabled`)===`true`;if(!i.hasAttribute(`tabindex`)||t)i=n(e,i);else{i.focus();return}}},v4=e=>{let{vertical:t,fixed:n,hideScrollbar:r,scrollableX:i,scrollableY:a,centered:o,scrollButtonsHideMobile:s,classes:c}=e;return Fa({root:[`root`,t&&`vertical`],scroller:[`scroller`,n&&`fixed`,r&&`hideScrollbar`,i&&`scrollableX`,a&&`scrollableY`],list:[`list`,`flexContainer`,t&&`flexContainerVertical`,t&&`vertical`,o&&`centered`],indicator:[`indicator`],scrollButtons:[`scrollButtons`,s&&`scrollButtonsHideMobile`],scrollableX:[i&&`scrollableX`],hideScrollbar:[r&&`hideScrollbar`]},p4,c)},y4=L(`div`,{name:`MuiTabs`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${m4.scrollButtons}`]:t.scrollButtons},{[`& .${m4.scrollButtons}`]:n.scrollButtonsHideMobile&&t.scrollButtonsHideMobile},t.root,n.vertical&&t.vertical]}})(ol(({theme:e})=>({overflow:`hidden`,minHeight:48,WebkitOverflowScrolling:`touch`,display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.scrollButtonsHideMobile,style:{[`& .${m4.scrollButtons}`]:{[e.breakpoints.down(`sm`)]:{display:`none`}}}}]}))),b4=L(`div`,{name:`MuiTabs`,slot:`Scroller`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.scroller,n.fixed&&t.fixed,n.hideScrollbar&&t.hideScrollbar,n.scrollableX&&t.scrollableX,n.scrollableY&&t.scrollableY]}})({position:`relative`,display:`inline-block`,flex:`1 1 auto`,whiteSpace:`nowrap`,variants:[{props:({ownerState:e})=>e.fixed,style:{overflowX:`hidden`,width:`100%`}},{props:({ownerState:e})=>e.hideScrollbar,style:{scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}},{props:({ownerState:e})=>e.scrollableX,style:{overflowX:`auto`,overflowY:`hidden`}},{props:({ownerState:e})=>e.scrollableY,style:{overflowY:`auto`,overflowX:`hidden`}}]}),x4=L(`div`,{name:`MuiTabs`,slot:`List`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.list,t.flexContainer,n.vertical&&t.flexContainerVertical,n.centered&&t.centered]}})({display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.centered,style:{justifyContent:`center`}}]}),S4=L(`span`,{name:`MuiTabs`,slot:`Indicator`})(ol(({theme:e})=>({position:`absolute`,height:2,bottom:0,width:`100%`,transition:e.transitions.create(),variants:[{props:{indicatorColor:`primary`},style:{backgroundColor:(e.vars||e).palette.primary.main}},{props:{indicatorColor:`secondary`},style:{backgroundColor:(e.vars||e).palette.secondary.main}},{props:({ownerState:e})=>e.vertical,style:{height:`100%`,width:2,right:0}}]}))),C4=L(a4)({overflowX:`auto`,overflowY:`hidden`,scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}),w4={},T4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiTabs`}),r=Jo(),i=ea(),{"aria-label":a,"aria-labelledby":o,action:s,centered:c=!1,children:l,className:u,component:d=`div`,allowScrollButtonsMobile:f=!1,indicatorColor:p=`primary`,onChange:m,orientation:h=`horizontal`,ScrollButtonComponent:g,scrollButtons:_=`auto`,selectionFollowsFocus:v,slots:y={},slotProps:b={},TabIndicatorProps:x={},TabScrollButtonProps:S={},textColor:C=`primary`,value:w,variant:T=`standard`,visibleScrollbar:E=!1,...D}=n,O=T===`scrollable`,ee=h===`vertical`,te=ee?`scrollTop`:`scrollLeft`,k=ee?`top`:`left`,A=ee?`bottom`:`right`,ne=ee?`clientHeight`:`clientWidth`,j=ee?`height`:`width`,re={...n,component:d,allowScrollButtonsMobile:f,indicatorColor:p,orientation:h,vertical:ee,scrollButtons:_,textColor:C,variant:T,visibleScrollbar:E,fixed:!O,hideScrollbar:O&&!E,scrollableX:O&&!ee,scrollableY:O&&ee,centered:c&&!O,scrollButtonsHideMobile:!f},ie=v4(re),ae=Cp({elementType:y.StartScrollButtonIcon,externalSlotProps:b.startScrollButtonIcon,ownerState:re}),oe=Cp({elementType:y.EndScrollButtonIcon,externalSlotProps:b.endScrollButtonIcon,ownerState:re}),[se,ce]=M.useState(!1),[le,ue]=M.useState(w4),[de,fe]=M.useState(!1),[pe,me]=M.useState(!1),[he,ge]=M.useState(!1),[_e,ve]=M.useState({overflow:`hidden`,scrollbarWidth:0}),ye=new Map,be=M.useRef(null),xe=M.useRef(null),Se={slots:y,slotProps:{indicator:x,scrollButtons:S,...b}},Ce=()=>{let e=be.current,t;if(e){let n=e.getBoundingClientRect();t={clientWidth:e.clientWidth,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,scrollWidth:e.scrollWidth,top:n.top,bottom:n.bottom,left:n.left,right:n.right}}let n;if(e&&w!==!1){let e=xe.current.children;if(e.length>0){let t=e[ye.get(w)];n=t?t.getBoundingClientRect():null}}return{tabsMeta:t,tabMeta:n}},we=ql(()=>{let{tabsMeta:e,tabMeta:t}=Ce(),n=0,r;ee?(r=`top`,t&&e&&(n=t.top-e.top+e.scrollTop)):(r=i?`right`:`left`,t&&e&&(n=(i?-1:1)*(t[r]-e[r]+e.scrollLeft)));let a={[r]:n,[j]:t?t[j]:0};if(typeof le[r]!=`number`||typeof le[j]!=`number`)ue(a);else{let e=Math.abs(le[r]-a[r]),t=Math.abs(le[j]-a[j]);(e>=1||t>=1)&&ue(a)}}),Te=(e,{animation:t=!0}={})=>{t?r4(te,be.current,e,{duration:r.transitions.duration.standard}):be.current[te]=e},Ee=e=>{let t=be.current[te];ee?t+=e:t+=e*(i?-1:1),Te(t)},De=()=>{let e=be.current[ne],t=0,n=Array.from(xe.current.children);for(let r=0;r<n.length;r+=1){let i=n[r];if(t+i[ne]>e){r===0&&(t=e);break}t+=i[ne]}return t},Oe=()=>{Ee(-1*De())},ke=()=>{Ee(De())},[Ae,{onChange:je,...Me}]=fl(`scrollbar`,{className:P(ie.scrollableX,ie.hideScrollbar),elementType:C4,shouldForwardComponentProp:!0,externalForwardedProps:Se,ownerState:re}),Ne=M.useCallback(e=>{je?.(e),ve({overflow:null,scrollbarWidth:e})},[je]),[Pe,Fe]=fl(`scrollButtons`,{className:P(ie.scrollButtons,S.className),elementType:f4,externalForwardedProps:Se,ownerState:re,additionalProps:{orientation:h,slots:{StartScrollButtonIcon:y.startScrollButtonIcon||y.StartScrollButtonIcon,EndScrollButtonIcon:y.endScrollButtonIcon||y.EndScrollButtonIcon},slotProps:{startScrollButtonIcon:ae,endScrollButtonIcon:oe}}}),Ie=()=>{let e={};e.scrollbarSizeListener=O?(0,N.jsx)(Ae,{...Me,onChange:Ne}):null;let t=O&&(_===`auto`&&(de||pe)||_===!0);return e.scrollButtonStart=t?(0,N.jsx)(Pe,{direction:i?`right`:`left`,onClick:Oe,disabled:!de,...Fe}):null,e.scrollButtonEnd=t?(0,N.jsx)(Pe,{direction:i?`left`:`right`,onClick:ke,disabled:!pe,...Fe}):null,e},Le=ql(e=>{let{tabsMeta:t,tabMeta:n}=Ce();if(!(!n||!t)){if(n[k]<t[k]){let r=t[te]+(n[k]-t[k]);Te(r,{animation:e})}else if(n[A]>t[A]){let r=t[te]+(n[A]-t[A]);Te(r,{animation:e})}}}),Re=ql(()=>{O&&_!==!1&&ge(!he)});M.useEffect(()=>{let e=pc(()=>{be.current&&we()}),t,n=n=>{n.forEach(e=>{e.removedNodes.forEach(e=>{t?.unobserve(e)}),e.addedNodes.forEach(e=>{t?.observe(e)})}),e(),Re()},r=_c(be.current);r.addEventListener(`resize`,e);let i;return typeof ResizeObserver<`u`&&(t=new ResizeObserver(e),Array.from(xe.current.children).forEach(e=>{t.observe(e)})),typeof MutationObserver<`u`&&(i=new MutationObserver(n),i.observe(xe.current,{childList:!0})),()=>{e.clear(),r.removeEventListener(`resize`,e),i?.disconnect(),t?.disconnect()}},[we,Re]),M.useEffect(()=>{let e=Array.from(xe.current.children),t=e.length;if(typeof IntersectionObserver<`u`&&t>0&&O&&_!==!1){let n=e[0],r=e[t-1],i={root:be.current,threshold:.99},a=new IntersectionObserver(e=>{fe(!e[0].isIntersecting)},i);a.observe(n);let o=new IntersectionObserver(e=>{me(!e[0].isIntersecting)},i);return o.observe(r),()=>{a.disconnect(),o.disconnect()}}},[O,_,he,l?.length]),M.useEffect(()=>{ce(!0)},[]),M.useEffect(()=>{we()}),M.useEffect(()=>{Le(w4!==le)},[Le,le]),M.useImperativeHandle(s,()=>({updateIndicator:we,updateScrollButtons:Re}),[we,Re]);let[ze,Be]=fl(`indicator`,{className:P(ie.indicator,x.className),elementType:S4,externalForwardedProps:Se,ownerState:re,additionalProps:{style:le}}),Ve=(0,N.jsx)(ze,{...Be}),He=0,Ue=M.Children.map(l,e=>{if(!M.isValidElement(e))return null;let t=e.props.value===void 0?He:e.props.value;ye.set(t,He);let n=t===w;return He+=1,M.cloneElement(e,{fullWidth:T===`fullWidth`,indicator:n&&!se&&Ve,selected:n,selectionFollowsFocus:v,onChange:m,textColor:C,value:t,...He===1&&w===!1&&!e.props.tabIndex?{tabIndex:0}:{}})}),We=e=>{if(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)return;let t=xe.current,n=qc(hc(t));if(n?.getAttribute(`role`)!==`tab`)return;let r=h===`horizontal`?`ArrowLeft`:`ArrowUp`,a=h===`horizontal`?`ArrowRight`:`ArrowDown`;switch(h===`horizontal`&&i&&(r=`ArrowRight`,a=`ArrowLeft`),e.key){case r:e.preventDefault(),_4(t,n,g4);break;case a:e.preventDefault(),_4(t,n,h4);break;case`Home`:e.preventDefault(),_4(t,null,h4);break;case`End`:e.preventDefault(),_4(t,null,g4);break;default:break}},Ge=Ie(),[Ke,qe]=fl(`root`,{ref:t,className:P(ie.root,u),elementType:y4,externalForwardedProps:{...Se,...D,component:d},ownerState:re}),[Je,Ye]=fl(`scroller`,{ref:be,className:ie.scroller,elementType:b4,externalForwardedProps:Se,ownerState:re,additionalProps:{style:{overflow:_e.overflow,[ee?`margin${i?`Left`:`Right`}`:`marginBottom`]:E?void 0:-_e.scrollbarWidth}}}),[Xe,Ze]=fl(`list`,{ref:xe,className:P(ie.list,ie.flexContainer),elementType:x4,externalForwardedProps:Se,ownerState:re,getSlotProps:e=>({...e,onKeyDown:t=>{We(t),e.onKeyDown?.(t)}})});return(0,N.jsxs)(Ke,{...qe,children:[Ge.scrollButtonStart,Ge.scrollbarSizeListener,(0,N.jsxs)(Je,{...Ye,children:[(0,N.jsx)(Xe,{"aria-label":a,"aria-labelledby":o,"aria-orientation":h===`vertical`?`vertical`:null,role:`tablist`,...Ze,children:Ue}),se&&Ve]}),Ge.scrollButtonEnd]})});function E4(e){return F(`MuiTab`,e)}var D4=mi(`MuiTab`,[`root`,`labelIcon`,`textColorInherit`,`textColorPrimary`,`textColorSecondary`,`selected`,`disabled`,`fullWidth`,`wrapped`,`iconWrapper`,`icon`]),O4=e=>{let{classes:t,textColor:n,fullWidth:r,wrapped:i,icon:a,label:o,selected:s,disabled:c}=e;return Fa({root:[`root`,a&&o&&`labelIcon`,`textColor${z(n)}`,r&&`fullWidth`,i&&`wrapped`,s&&`selected`,c&&`disabled`],icon:[`iconWrapper`,`icon`]},E4,t)},k4=L(Zd,{name:`MuiTab`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.label&&n.icon&&t.labelIcon,t[`textColor${z(n.textColor)}`],n.fullWidth&&t.fullWidth,n.wrapped&&t.wrapped,{[`& .${D4.iconWrapper}`]:t.iconWrapper},{[`& .${D4.icon}`]:t.icon}]}})(ol(({theme:e})=>({...e.typography.button,maxWidth:360,minWidth:90,position:`relative`,minHeight:48,flexShrink:0,padding:`12px 16px`,overflow:`hidden`,whiteSpace:`normal`,textAlign:`center`,lineHeight:1.25,variants:[{props:({ownerState:e})=>e.label&&(e.iconPosition===`top`||e.iconPosition===`bottom`),style:{flexDirection:`column`}},{props:({ownerState:e})=>e.label&&e.iconPosition!==`top`&&e.iconPosition!==`bottom`,style:{flexDirection:`row`}},{props:({ownerState:e})=>e.icon&&e.label,style:{minHeight:72,paddingTop:9,paddingBottom:9}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`top`,style:{[`& > .${D4.icon}`]:{marginBottom:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`bottom`,style:{[`& > .${D4.icon}`]:{marginTop:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`start`,style:{[`& > .${D4.icon}`]:{marginRight:e.spacing(1)}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`end`,style:{[`& > .${D4.icon}`]:{marginLeft:e.spacing(1)}}},{props:{textColor:`inherit`},style:{color:`inherit`,opacity:.6,[`&.${D4.selected}`]:{opacity:1},[`&.${D4.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity}}},{props:{textColor:`primary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${D4.selected}`]:{color:(e.vars||e).palette.primary.main},[`&.${D4.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:{textColor:`secondary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${D4.selected}`]:{color:(e.vars||e).palette.secondary.main},[`&.${D4.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:({ownerState:e})=>e.fullWidth,style:{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:`none`}},{props:({ownerState:e})=>e.wrapped,style:{fontSize:e.typography.pxToRem(12)}}]}))),A4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiTab`}),{className:r,disabled:i=!1,disableFocusRipple:a=!1,fullWidth:o,icon:s,iconPosition:c=`top`,indicator:l,label:u,onChange:d,onClick:f,onFocus:p,selected:m,selectionFollowsFocus:h,textColor:g=`inherit`,value:_,wrapped:v=!1,...y}=n,b={...n,disabled:i,disableFocusRipple:a,selected:m,icon:!!s,iconPosition:c,label:!!u,fullWidth:o,textColor:g,wrapped:v},x=O4(b),S=s&&u&&M.isValidElement(s)?M.cloneElement(s,{className:P(x.icon,s.props.className)}):s;return(0,N.jsxs)(k4,{focusRipple:!a,className:P(x.root,r),ref:t,role:`tab`,"aria-selected":m,disabled:i,onClick:e=>{!m&&d&&d(e,_),f&&f(e)},onFocus:e=>{h&&!m&&d&&d(e,_),p&&p(e)},ownerState:b,tabIndex:m?0:-1,...y,children:[c===`top`||c===`start`?(0,N.jsxs)(M.Fragment,{children:[S,u]}):(0,N.jsxs)(M.Fragment,{children:[u,S]}),l]})}),j4=e=>{let{classes:t}=e;return Fa({root:[`root`]},l2,t)},M4=L(L$,{name:`MuiDialogTitle`,slot:`Root`})({padding:`16px 24px`,flex:`0 0 auto`}),N4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialogTitle`}),{className:r,id:i,...a}=n,o=n,s=j4(o),{titleId:c=i}=M.useContext(M2);return(0,N.jsx)(M4,{component:`h2`,className:P(s.root,r),ownerState:o,ref:t,variant:`h6`,id:i??c,...a})});function P4(e){return F(`MuiDialogContentText`,e)}mi(`MuiDialogContentText`,[`root`]);var F4=e=>{let{classes:t}=e,n=Fa({root:[`root`]},P4,t);return{...t,...n}},I4=L(L$,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiDialogContentText`,slot:`Root`})({}),L4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialogContentText`}),{children:r,className:i,...a}=n,o=F4(a);return(0,N.jsx)(I4,{component:`p`,variant:`body1`,color:`textSecondary`,ref:t,ownerState:a,className:P(o.root,i),...n,classes:o})}),R4=md(`@pie-lib:editable-html:plugins:media:dialog`),z4=e=>{if(!e)return!1;let t=/^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;return e.match(t)?e.match(t)[1]:!1},B4=e=>e&&/(http|https)?:\/\/(www\.)?(player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(video\/)?(\d+)(?:|\/\?)/.test(e),V4=e=>e&&/^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)/.test(e),H4=e=>{if(!e)return!1;let t=/^https?:\/\/(soundcloud\.com|snd\.sc)\/(.*)$/;return e.match(t)&&e.match(t)[2]},U4=e=>new Promise(t=>{try{fetch(`https://soundcloud.com/oembed?format=json&url=${e}`).then(e=>e.json()).then(e=>{let n=document.createElement(`div`);n.innerHTML=e.html,t(n.querySelector(`iframe`).src)}).catch(e=>{t(``),R4(e)})}catch{t(``)}}),W4={video:`Video`,audio:`Audio`},G4={uploadFile:`upload-file`,insertUrl:`insert-url`},K4=L(R2)(({theme:e})=>({"& .MuiDialog-paper":{minWidth:`500px`}})),q4=L(p2)(({theme:e})=>({padding:0})),J4=L(`div`)(({theme:e})=>({display:`flex`,flexDirection:`space-between`})),Y4=L(`div`)(({theme:e})=>({marginTop:e.spacing(1.5)})),X4=L(`input`)(({theme:e})=>({})),Z4=L(L$)(({theme:e})=>({marginTop:e.spacing(1.5),color:e.palette.error.main})),Q4=L(Zq)(({theme:e})=>({marginLeft:e.spacing(1.5)})),$4=class extends M.Component{static propTypes={open:k.bool,edit:k.bool,disablePortal:k.bool,handleClose:k.func,uploadSoundSupport:k.shape({add:k.func,delete:k.func}),type:k.string,src:k.string,url:k.string,urlToUse:k.string,starts:k.number,ends:k.number,height:k.number,width:k.number};constructor(e){super(e);let{ends:t,height:n,src:r,starts:i,type:a,uploadSoundSupport:o,url:s,urlToUse:c,width:l}=e,u=o?.add&&o?.delete&&a!==`video`&&!r;this.state={ends:t||0,url:s,urlToUse:c,formattedUrl:r,height:n||315,invalid:!1,starts:i||0,width:l||560,tabValue:u?G4.uploadFile:G4.insertUrl,fileUpload:{error:null,loading:!1,scheduled:!1,url:``,mimeType:``}}}componentDidMount(){this.props.url&&this.urlChange({target:{value:this.props.url}})}formatUrl=()=>{let{url:e,urlToUse:t,starts:n,ends:r}=this.state,i=z4(e),a=B4(e),o=t;if((i||a)&&t){let e=[],s,c;switch(!0){case a:s=`t`,c=`#`;break;case i:s=`start`,c=`?`;break;default:s=`start`,c=`?`}n&&e.push(`${s}=${n}`),r&&e.push(`end=${r}`),o=`${t}${e.length?c:``}${e.join(`&`)}`}this.setState({formattedUrl:null,updating:!0},()=>this.setState({formattedUrl:o,updating:!1}))};handleStateChange=e=>this.setState(e,this.formatUrl);checkAudio=e=>{H4(e)&&U4(e).then(t=>{this.handleStateChange({urlToUse:t,invalid:!t,url:e})}).catch(R4)};checkVideo=e=>{if(z4(e)){let t=`https://youtube.com/embed/${e.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)[2]}`;R4(`is youtube`),this.handleStateChange({urlToUse:t,url:e,invalid:!1})}if(B4(e)){let t=`https://player.vimeo.com/video/${e.replace(/.*vimeo.com\/(.*)/g,`$1`)}`;R4(`is vimeo`),this.handleStateChange({urlToUse:t,url:e,ends:null,invalid:!1})}if(V4(e)){let t=`https://drive.google.com/file/d/${e.replace(/^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)\/.*/,`$1`)}/preview`;R4(`is google drive`),this.handleStateChange({urlToUse:t,url:e,ends:null,invalid:!1})}};urlChange=e=>{let{value:t}=e.target||{},{type:n}=this.props;if(n&&n===`audio`){this.checkAudio(t);return}else if(n&&n===`video`){this.checkVideo(t);return}this.handleStateChange({urlToUse:null,url:null,invalid:!0})};changeHandler=e=>t=>this.handleStateChange({[e]:t.target.value});handleDone=e=>{let{handleClose:t}=this.props,{tabValue:n,fileUpload:r}=this.state,i=n===G4.insertUrl;if(!e){r.url&&this.handleRemoveFile(),t(e);return}if(i){let{ends:n,height:r,url:i,urlToUse:a,formattedUrl:o,starts:s,width:c}=this.state;t(e,{tag:`iframe`,ends:n,height:r,starts:s,width:c,url:i,urlToUse:a,src:o});return}if(!r.loading){t(e,{tag:`audio`,src:r.url});return}this.setState({fileUpload:{...r,scheduled:!0}})};handleUploadFile=async e=>{e.preventDefault(),this.setState({fileUpload:{...this.state.fileUpload,error:null,loading:!0}});let t=e.target.files[0],n=new FileReader;n.onload=()=>{let e=n.result;this.setState({fileUpload:{...this.state.fileUpload,url:e,mimeType:t.type}})},n.readAsDataURL(t),this.props.uploadSoundSupport.add({fileChosen:t,done:(e,t)=>{if(R4(`done: err:`,e),e){console.log(e),this.setState({fileUpload:{...this.state.fileUpload,scheduled:!1,loading:!1,error:e}});return}let{fileUpload:n}=this.state,r=n&&n.scheduled?this.handleDone.bind(this,!0):void 0;this.setState({fileUpload:{...n,scheduled:!1,loading:!1,url:t}},r)}})};handleRemoveFile=async()=>{this.props.uploadSoundSupport.delete(this.state.fileUpload.url,e=>{e&&(console.log(e),this.setState({fileUpload:{...this.state.fileUpload,error:e}}))}),this.setState({fileUpload:{...this.state.fileUpload,loading:!1,url:``,mimeType:``}})};render(){let{open:e,disablePortal:t,type:n,edit:r,uploadSoundSupport:i}=this.props,{ends:a,height:o,invalid:s,starts:c,width:l,url:u,mimeType:d,formattedUrl:f,updating:p,tabValue:m,fileUpload:h}=this.state,g=z4(u),_=m===G4.insertUrl,v=m===G4.uploadFile,y=_?s||u==null:!h.url||h.scheduled,b=i?.add&&i?.delete&&n!==`video`;return(0,N.jsxs)(K4,{disablePortal:t,open:e,onClose:()=>this.handleDone(!1),"aria-labelledby":`form-dialog-title`,children:[(0,N.jsxs)(N4,{id:`form-dialog-title`,children:[`Insert `,W4[n]]}),(0,N.jsx)(p2,{children:(0,N.jsxs)(`div`,{children:[(0,N.jsx)(J4,{children:(0,N.jsxs)(T4,{indicatorColor:`primary`,value:m,onChange:(e,t)=>{this.setState({tabValue:t})},children:[b?(0,N.jsx)(A4,{value:G4.uploadFile,label:`Upload file`}):null,(0,N.jsx)(A4,{value:G4.insertUrl,label:n===`video`?`Insert YouTube, Vimeo, or Google Drive URL`:`Insert SoundCloud URL`})]})}),_&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(T2,{autoFocus:!0,error:s,helperText:s?`Invalid URL`:``,margin:`dense`,id:`name`,label:`URL`,placeholder:`Paste URL of ${n}...`,type:`text`,onChange:this.urlChange,value:u,fullWidth:!0}),n===`video`&&(0,N.jsxs)(q4,{children:[(0,N.jsx)(L4,{children:`Video Properties`}),(0,N.jsx)(T2,{autoFocus:!0,margin:`dense`,id:`width`,label:`Width`,type:`number`,placeholder:`Width`,value:l,onChange:this.changeHandler(`width`)}),(0,N.jsx)(T2,{autoFocus:!0,margin:`dense`,id:`height`,label:`Height`,type:`number`,placeholder:`Height`,value:o,onChange:this.changeHandler(`height`)})]}),f&&(0,N.jsx)(`iframe`,{width:l,height:o,src:f,frameBorder:`0`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0}),n===`video`&&(f||p)&&!s&&(0,N.jsx)(M.Fragment,{children:(0,N.jsxs)(q4,{children:[(0,N.jsx)(T2,{autoFocus:!0,margin:`dense`,id:`starts`,label:`Starts`,type:`number`,placeholder:`Starts`,value:c,onChange:this.changeHandler(`starts`)}),g&&(0,N.jsx)(T2,{autoFocus:!0,margin:`dense`,id:`ends`,label:`Ends`,type:`number`,placeholder:`Ends`,value:a,onChange:this.changeHandler(`ends`)})]})})]}),v&&(0,N.jsx)(Y4,{children:(0,N.jsxs)(`div`,{children:[h.url?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(J4,{children:[(0,N.jsx)(`audio`,{controls:`controls`,controlsList:`nodownload`,children:(0,N.jsx)(`source`,{type:d,src:h.url})}),(0,N.jsx)(Q4,{"aria-label":`delete`,onClick:this.handleRemoveFile,children:(0,N.jsx)(Qq,{})})]}),!h.scheduled&&h.loading?(0,N.jsx)(L$,{variant:`subheading`,children:`Loading...`}):null,h.scheduled?(0,N.jsx)(L$,{variant:`subheading`,children:`Waiting for Upload to finish, then inserting item...`}):null]}):h.loading?null:(0,N.jsx)(X4,{accept:`audio/*`,onChange:this.handleUploadFile,type:`file`}),!!h.error&&(0,N.jsx)(Z4,{variant:`caption`,children:h.error})]})})]})}),(0,N.jsxs)(k2,{children:[(0,N.jsx)(Ef,{onClick:()=>this.handleDone(!1),color:`primary`,children:`Cancel`}),(0,N.jsx)(Ef,{disabled:y,onClick:()=>this.handleDone(!0),color:`primary`,children:r?`Update`:`Insert`})]})]})}},e3=L(`span`)(({theme:e})=>({position:`relative`,bottom:`5px`,left:0,width:`100%`,background:e.palette.common.white,display:`inline-flex`,padding:`5px`,boxShadow:`0px 4px 4px rgba(0, 0, 0, 0.25)`})),t3=L(`span`)(({theme:e})=>({cursor:`pointer`,flex:3,border:`solid ${e.palette.common.black}`,textAlign:`right`,borderWidth:`0 2px 0 0`,marginRight:`5px`,paddingRight:`5px`})),n3=L(`span`)({cursor:`pointer`}),r3=class extends M.Component{static propTypes={onEdit:k.func,hideEdit:k.bool,onRemove:k.func};render(){let{hideEdit:e,onEdit:t,onRemove:n}=this.props;return(0,N.jsxs)(e3,{children:[e?null:(0,N.jsx)(t3,{onClick:t,children:`Edit Settings`}),(0,N.jsx)(n3,{onClick:n,children:`Remove`})]})}},i3=$A.create({name:`media`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{type:{default:`video`},src:{default:null},width:{default:null},height:{default:null},title:{default:null},starts:{default:null},ends:{default:null},editing:{default:!1},tag:{default:`iframe`},url:{default:null}}},parseHTML(){return[{tag:`iframe[data-type="video"]`,getAttrs:e=>({type:`video`,tag:`iframe`,src:e.getAttribute(`src`),width:e.getAttribute(`width`),height:e.getAttribute(`height`),title:e.dataset.title,starts:e.dataset.starts,ends:e.dataset.ends,url:e.dataset.url})},{tag:`audio`,getAttrs:e=>({type:`audio`,tag:`audio`,src:e.querySelector(`source`)?.getAttribute(`src`)})}]},renderHTML({HTMLAttributes:e}){let{tag:t,src:n,width:r,height:i}=e;return t===`audio`?[`audio`,{controls:`controls`,controlsList:`nodownload`},[`source`,{src:n,type:`audio/mp3`}]]:[`iframe`,rk({"data-type":`video`,frameborder:`0`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowfullscreen:``,src:n},r?{width:r}:{},i?{height:i}:{})]},addCommands(){return{insertMedia:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateMedia:e=>({commands:t})=>t.updateAttributes(this.name,e)}},addNodeView(){return EM(e=>(0,N.jsx)(s3,{...e,options:this.options}))}}),a3=()=>{document.querySelectorAll(`.insert-media-dialog`).forEach(e=>e.remove())},o3=e=>{let t=document.createElement(`div`),{type:n,callback:r,options:i,...a}=e,o=document.body.style.overflow;a3(),t.className=`insert-media-dialog`,document.body.style.overflow=`hidden`;let s=(e,n)=>{r(e,n),t.remove(),document.body.style.overflow=o},c=(0,N.jsx)($4,{...a,uploadSoundSupport:i.uploadSoundSupport,type:n,disablePortal:!0,open:!0,handleClose:s});hs.render(c,t),document.body.appendChild(t)};function s3({editor:e,node:t,updateAttributes:n,deleteNode:r,options:i}){let{type:a,src:o,width:s,height:c,tag:l}=t.attrs;return(0,M.useEffect)(()=>{o||o3({...t.attrs,options:i,edit:!0,callback:(t,i)=>{t?n(i):r(),e.chain().focus().run()}})},[]),(0,N.jsxs)(vM,{"data-type":a,style:{width:s,height:c},children:[l===`audio`?(0,N.jsx)(`audio`,{controls:!0,controlsList:`nodownload`,children:(0,N.jsx)(`source`,{type:`audio/mp3`,src:o})}):(0,N.jsx)(`iframe`,{src:o,allowFullScreen:!0,frameBorder:`0`,width:s,height:c}),(0,N.jsx)(r3,{onEdit:()=>{o3({...t.attrs,options:i,edit:!0,callback:(t,r)=>{t&&n(r),e.chain().focus().run()}})},onRemove:r})]})}function c3(e){return F(`MuiListItem`,e)}mi(`MuiListItem`,[`root`,`container`,`dense`,`alignItemsFlexStart`,`divider`,`gutters`,`padding`,`secondaryAction`]);var l3=mi(`MuiListItemButton`,[`root`,`focusVisible`,`dense`,`alignItemsFlexStart`,`disabled`,`divider`,`gutters`,`selected`]);function u3(e){return F(`MuiListItemSecondaryAction`,e)}mi(`MuiListItemSecondaryAction`,[`root`,`disableGutters`]);var d3=e=>{let{disableGutters:t,classes:n}=e;return Fa({root:[`root`,t&&`disableGutters`]},u3,n)},f3=L(`div`,{name:`MuiListItemSecondaryAction`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.disableGutters&&t.disableGutters]}})({position:`absolute`,right:16,top:`50%`,transform:`translateY(-50%)`,variants:[{props:({ownerState:e})=>e.disableGutters,style:{right:0}}]}),p3=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiListItemSecondaryAction`}),{className:r,...i}=n,a=M.useContext(wp),o={...n,disableGutters:a.disableGutters},s=d3(o);return(0,N.jsx)(f3,{className:P(s.root,r),ownerState:o,ref:t,...i})});p3.muiName=`ListItemSecondaryAction`;var m3=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.alignItems===`flex-start`&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters,!n.disablePadding&&t.padding,n.hasSecondaryAction&&t.secondaryAction]},h3=e=>{let{alignItems:t,classes:n,dense:r,disableGutters:i,disablePadding:a,divider:o,hasSecondaryAction:s}=e;return Fa({root:[`root`,r&&`dense`,!i&&`gutters`,!a&&`padding`,o&&`divider`,t===`flex-start`&&`alignItemsFlexStart`,s&&`secondaryAction`],container:[`container`],secondaryAction:[`secondaryAction`]},c3,n)},g3=L(`div`,{name:`MuiListItem`,slot:`Root`,overridesResolver:m3})(ol(({theme:e})=>({display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,width:`100%`,boxSizing:`border-box`,textAlign:`left`,variants:[{props:({ownerState:e})=>!e.disablePadding,style:{paddingTop:8,paddingBottom:8}},{props:({ownerState:e})=>!e.disablePadding&&e.dense,style:{paddingTop:4,paddingBottom:4}},{props:({ownerState:e})=>!e.disablePadding&&!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>!e.disablePadding&&!!e.secondaryAction,style:{paddingRight:48}},{props:({ownerState:e})=>!!e.secondaryAction,style:{[`& > .${l3.root}`]:{paddingRight:48}}},{props:{alignItems:`flex-start`},style:{alignItems:`flex-start`}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>e.button,style:{transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:({ownerState:e})=>e.hasSecondaryAction,style:{paddingRight:48}}]}))),_3=L(`li`,{name:`MuiListItem`,slot:`Container`})({position:`relative`}),v3=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiListItem`}),{alignItems:r=`center`,children:i,className:a,component:o,components:s={},componentsProps:c={},ContainerComponent:l=`li`,ContainerProps:{className:u,...d}={},dense:f=!1,disableGutters:p=!1,disablePadding:m=!1,divider:h=!1,secondaryAction:g,slotProps:_={},slots:v={},...y}=n,b=M.useContext(wp),x=M.useMemo(()=>({dense:f||b.dense||!1,alignItems:r,disableGutters:p}),[r,b.dense,f,p]),S=M.useRef(null),C=M.Children.toArray(i),w=C.length&&Hl(C[C.length-1],[`ListItemSecondaryAction`]),T={...n,alignItems:r,dense:x.dense,disableGutters:p,disablePadding:m,divider:h,hasSecondaryAction:w},E=h3(T),D=kc(S,t),[O,ee]=fl(`secondaryAction`,{elementType:p3,externalForwardedProps:{slots:v,slotProps:_},ownerState:T,className:E.secondaryAction}),te=v.root||s.Root||g3,k=_.root||c.root||{},A={className:P(E.root,k.className,a),...y},ne=o||`li`;return w?(ne=!A.component&&!o?`div`:ne,l===`li`&&(ne===`li`?ne=`div`:A.component===`li`&&(A.component=`div`)),(0,N.jsx)(wp.Provider,{value:x,children:(0,N.jsxs)(_3,{as:l,className:P(E.container,u),ref:D,ownerState:T,...d,children:[(0,N.jsx)(te,{...k,...!sc(te)&&{as:ne,ownerState:{...T,...k.ownerState}},...A,children:C}),C.pop()]})})):(0,N.jsx)(wp.Provider,{value:x,children:(0,N.jsxs)(te,{...k,as:ne,ref:D,...!sc(te)&&{ownerState:{...T,...k.ownerState}},...A,children:[C,g&&(0,N.jsx)(O,{...ee,children:g})]})})}),y3=()=>{document.querySelectorAll(`.insert-css-dialog`).forEach(e=>e.remove())},b3=({editor:e,callback:t,opts:n,selectedText:r,parentNode:i})=>{let a=e.options.element,o=document.createElement(`div`),{selection:s}=e.state;y3(),o.className=`insert-css-dialog`;let c=!1,l=e=>{if(c){let t=o.contains(e.target)||void 0,n=a.contains(e.target);t||n||u()}else c=!0},u=()=>{t(void 0,!0),o.remove(),document.body.removeEventListener(`click`,l)},d=e=>{t(e,!0),o.remove(),document.body.removeEventListener(`click`,l)},f=i?.attrs.class,p=e=>{let t=`<span class="${e}">${r}</span>`;if(i){let e=`span`;i?.object===`inline`&&(e=`span`),i?.object===`block`&&(e=`div`),t=`<${e} class="${f}">${i.text.slice(0,s.$anchor.textOffset)}${t}${i.text.slice(s.$head.textOffset)}</${e}>`}return t},m=(0,N.jsxs)(`div`,{style:{background:`white`,height:500,padding:20,overflow:`hidden`,display:`flex`,flexFlow:`column`},children:[(0,N.jsx)(`h2`,{children:`Please choose a css class`}),f&&(0,N.jsxs)(`div`,{children:[`The current parent has this class `,f]}),(0,N.jsx)(Op,{component:`nav`,style:{overflow:`scroll`},children:n.names.map((e,t)=>(0,N.jsxs)(v3,{button:!0,onClick:()=>d(e),children:[(0,N.jsx)(`div`,{style:{marginRight:20},children:e}),(0,N.jsx)(`div`,{dangerouslySetInnerHTML:{__html:p(e)}})]},`rule-${t}`))})]});hs.render(m,o,()=>{let t=e.view.nodeDOM(e.state.selection.from)?.parentNode;if(t){let e=a.parentElement.parentElement.parentElement.getBoundingClientRect(),n=t.getBoundingClientRect();a.parentElement.parentElement.parentElement.appendChild(o),o.style.maxWidth=`500px`,o.style.position=`absolute`,o.style.top=0,o.style.zIndex=99999;let r=`${n.left+Math.abs(e.left)+t.offsetWidth+10}px`,i=`${n.x}px`;o.style.left=r;let s=o.offsetWidth;o.style.left=`unset`,o.style.right=i;let c=o.offsetWidth;o.style.left=`unset`,o.style.right=`unset`,s>=c?o.style.left=r:o.style.right=i,document.body.addEventListener(`click`,l)}})},x3=hA.create({name:`cssmark`,addOptions(){return{classes:[]}},addAttributes(){return{class:{default:null,parseHTML:e=>e.getAttribute(`class`),renderHTML:e=>e.class?{class:e.class}:{}}}},parseHTML(){return[{tag:`span[class]`,getAttrs:e=>{let t=e.getAttribute(`class`)||``;if(!t)return!1;if((this.options&&this.options.classes||[]).length>0){let e=this.options.classes.find(e=>t.includes(e));return e?{class:e}:!1}return{class:t}}}]},renderHTML({HTMLAttributes:e}){return[`span`,rk(e),0]},addCommands(){return{setCSSClass:e=>({commands:t})=>t.setMark(this.name,{class:e}),unsetCSSClass:()=>({commands:e})=>e.unsetMark(this.name),openCSSClassDialog:()=>({editor:e})=>{b3({editor:e,selectedText:e.state.doc.textBetween(e.state.selection.from,e.state.selection.to),parentNode:e.state.selection.$from.nodeAfter,opts:this.options.extraCSSRules,callback:t=>{t&&e.chain().focus().setCSSClass(t).run()}})}}}}),S3=Object.defineProperty,C3=(e,t)=>{for(var n in t)S3(e,n,{get:t[n],enumerable:!0})},w3=`listItem`,T3=`textStyle`,E3=/^\s*([-+*])\s$/,D3=$A.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,rk(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
387
|
-
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(
|
|
384
|
+
`,o2=typeof a2==`string`?null:dn`
|
|
385
|
+
animation: ${a2} 3s infinite linear;
|
|
386
|
+
`,s2=e=>{let{classes:t,variant:n,color:r}=e;return Fa({root:[`root`,`color${z(r)}`,n],dashed:[`dashed`,`dashedColor${z(r)}`],bar1:[`bar`,`bar1`,`barColor${z(r)}`,(n===`indeterminate`||n===`query`)&&`bar1Indeterminate`,n===`determinate`&&`bar1Determinate`,n===`buffer`&&`bar1Buffer`],bar2:[`bar`,`bar2`,n!==`buffer`&&`barColor${z(r)}`,n===`buffer`&&`color${z(r)}`,(n===`indeterminate`||n===`query`)&&`bar2Indeterminate`,n===`buffer`&&`bar2Buffer`]},$0,t)},c2=(e,t)=>e.vars?e.vars.palette.LinearProgress[`${t}Bg`]:e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.5),l2=L(`span`,{name:`MuiLinearProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`color${z(n.color)}`],t[n.variant]]}})(ol(({theme:e})=>({position:`relative`,overflow:`hidden`,display:`block`,height:4,zIndex:0,"@media print":{colorAdjust:`exact`},variants:[...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{backgroundColor:c2(e,t)}})),{props:({ownerState:e})=>e.color===`inherit`&&e.variant!==`buffer`,style:{"&::before":{content:`""`,position:`absolute`,left:0,top:0,right:0,bottom:0,backgroundColor:`currentColor`,opacity:.3}}},{props:{variant:`buffer`},style:{backgroundColor:`transparent`}},{props:{variant:`query`},style:{transform:`rotate(180deg)`}}]}))),u2=L(`span`,{name:`MuiLinearProgress`,slot:`Dashed`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.dashed,t[`dashedColor${z(n.color)}`]]}})(ol(({theme:e})=>({position:`absolute`,marginTop:0,height:`100%`,width:`100%`,backgroundSize:`10px 10px`,backgroundPosition:`0 -23px`,variants:[{props:{color:`inherit`},style:{opacity:.3,backgroundImage:`radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)`}},...Object.entries(e.palette).filter(tf()).map(([t])=>{let n=c2(e,t);return{props:{color:t},style:{backgroundImage:`radial-gradient(${n} 0%, ${n} 16%, transparent 42%)`}}})]})),o2||{animation:`${a2} 3s infinite linear`}),d2=L(`span`,{name:`MuiLinearProgress`,slot:`Bar1`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar1,t[`barColor${z(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar1Indeterminate,n.variant===`determinate`&&t.bar1Determinate,n.variant===`buffer`&&t.bar1Buffer]}})(ol(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[{props:{color:`inherit`},style:{backgroundColor:`currentColor`}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main}})),{props:{variant:`determinate`},style:{transition:`transform .${e2}s linear`}},{props:{variant:`buffer`},style:{zIndex:1,transition:`transform .${e2}s linear`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:n2||{animation:`${t2} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite`}}]}))),f2=L(`span`,{name:`MuiLinearProgress`,slot:`Bar2`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar2,t[`barColor${z(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar2Indeterminate,n.variant===`buffer`&&t.bar2Buffer]}})(ol(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t},style:{"--LinearProgressBar2-barColor":(e.vars||e).palette[t].main}})),{props:({ownerState:e})=>e.variant!==`buffer`&&e.color!==`inherit`,style:{backgroundColor:`var(--LinearProgressBar2-barColor, currentColor)`}},{props:({ownerState:e})=>e.variant!==`buffer`&&e.color===`inherit`,style:{backgroundColor:`currentColor`}},{props:{color:`inherit`},style:{opacity:.3}},...Object.entries(e.palette).filter(tf()).map(([t])=>({props:{color:t,variant:`buffer`},style:{backgroundColor:c2(e,t),transition:`transform .${e2}s linear`}})),{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:i2||{animation:`${r2} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite`}}]}))),p2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiLinearProgress`}),{className:r,color:i=`primary`,value:a,valueBuffer:o,variant:s=`indeterminate`,...c}=n,l={...n,color:i,variant:s},u=s2(l),d=ea(),f={},p={bar1:{},bar2:{}};if((s===`determinate`||s===`buffer`)&&a!==void 0){f[`aria-valuenow`]=Math.round(a),f[`aria-valuemin`]=0,f[`aria-valuemax`]=100;let e=a-100;d&&(e=-e),p.bar1.transform=`translateX(${e}%)`}if(s===`buffer`&&o!==void 0){let e=(o||0)-100;d&&(e=-e),p.bar2.transform=`translateX(${e}%)`}return(0,N.jsxs)(l2,{className:P(u.root,r),ownerState:l,role:`progressbar`,...f,ref:t,...c,children:[s===`buffer`?(0,N.jsx)(u2,{className:u.dashed,ownerState:l}):null,(0,N.jsx)(d2,{className:u.bar1,ownerState:l,style:p.bar1}),s===`determinate`?null:(0,N.jsx)(f2,{className:u.bar2,ownerState:l,style:p.bar2})]})}),m2=md(`@pie-lib:editable-html:image:insert-image-handler`),h2=class{constructor(e,t,n,r=!1){this.editor=e,this.nodeInfo=t,this.node=t[0],this.nodePos=t[1],this.onFinish=n,this.isPasted=r,this.chosenFile=null}cancel(){m2(`insert cancelled`);try{this.deleteNode(),this.onFinish(!1)}catch{}finally{this.editor._insertingImage=!1}}updateNode(e){let{state:t,view:n}=this.editor,{tr:r}=t,i=t.doc.nodeAt(this.nodePos);if(i){let t=r.setNodeMarkup(this.nodePos,void 0,{...i.attrs,...e});n.dispatch(t)}}deleteNode(){let{state:e,view:t}=this.editor,{tr:n}=e,r=n.delete(this.nodePos,this.nodePos+this.node.nodeSize);t.dispatch(r)}done(e,t){m2(`done: err:`,e),e?(console.log(e),this.onFinish(!1)):(this.updateNode({loaded:!0,src:t,percent:100}),this.onFinish(!0)),this.editor._insertingImage=!1}fileChosen(e){if(!e)return;this.chosenFile=e,this.editor._insertingImage=!1,m2(`[fileChosen] file: `,e);let t=new FileReader;t.onload=()=>{let e=t.result;this.updateNode({src:e})},t.readAsDataURL(e)}progress(e,t,n){m2(`progress: `,e,t,n),this.updateNode({percent:e})}getChosenFile(){return this.chosenFile}};function g2(e){return F(`MuiDialogContent`,e)}mi(`MuiDialogContent`,[`root`,`dividers`]);function _2(e){return F(`MuiDialogTitle`,e)}var v2=mi(`MuiDialogTitle`,[`root`]),y2=e=>{let{classes:t,dividers:n}=e;return Fa({root:[`root`,n&&`dividers`]},g2,t)},b2=L(`div`,{name:`MuiDialogContent`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(ol(({theme:e})=>({flex:`1 1 auto`,WebkitOverflowScrolling:`touch`,overflowY:`auto`,padding:`20px 24px`,variants:[{props:({ownerState:e})=>e.dividers,style:{padding:`16px 24px`,borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>!e.dividers,style:{[`.${v2.root} + &`]:{paddingTop:0}}}]}))),x2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialogContent`}),{className:r,dividers:i=!1,...a}=n,o={...n,dividers:i},s=y2(o);return(0,N.jsx)(b2,{className:P(s.root,r),ownerState:o,ref:t,...a})}),S2=Vl((0,N.jsx)(`path`,{d:`M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z`}),`ArrowBackIos`);function C2(e){return F(`MuiFormHelperText`,e)}var w2=mi(`MuiFormHelperText`,[`root`,`error`,`disabled`,`sizeSmall`,`sizeMedium`,`contained`,`focused`,`filled`,`required`]),T2,E2=e=>{let{classes:t,contained:n,size:r,disabled:i,error:a,filled:o,focused:s,required:c}=e;return Fa({root:[`root`,i&&`disabled`,a&&`error`,r&&`size${z(r)}`,n&&`contained`,s&&`focused`,o&&`filled`,c&&`required`]},C2,t)},D2=L(`p`,{name:`MuiFormHelperText`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.size&&t[`size${z(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(ol(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:`left`,marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${w2.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${w2.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:`small`},style:{marginTop:4}},{props:({ownerState:e})=>e.contained,style:{marginLeft:14,marginRight:14}}]}))),O2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiFormHelperText`}),{children:r,className:i,component:a=`p`,disabled:o,error:s,filled:c,focused:l,margin:u,required:d,variant:f,...p}=n,m=Bf({props:n,muiFormControl:Hf(),states:[`variant`,`size`,`disabled`,`error`,`filled`,`focused`,`required`]}),h={...n,component:a,contained:m.variant===`filled`||m.variant===`outlined`,variant:m.variant,size:m.size,disabled:m.disabled,error:m.error,filled:m.filled,focused:m.focused,required:m.required};delete h.ownerState;let g=E2(h);return(0,N.jsx)(D2,{as:a,className:P(g.root,i),ref:t,...p,ownerState:h,children:r===` `?T2||=(0,N.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):r})});function k2(e){return F(`MuiTextField`,e)}mi(`MuiTextField`,[`root`]);var A2={standard:B1,filled:K1,outlined:r0},j2=e=>{let{classes:t}=e;return Fa({root:[`root`]},k2,t)},M2=L(ap,{name:`MuiTextField`,slot:`Root`})({}),N2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiTextField`}),{autoComplete:r,autoFocus:i=!1,children:a,className:o,color:s=`primary`,defaultValue:c,disabled:l=!1,error:u=!1,FormHelperTextProps:d,fullWidth:f=!1,helperText:p,id:m,InputLabelProps:h,inputProps:g,InputProps:_,inputRef:v,label:y,maxRows:b,minRows:x,multiline:S=!1,name:C,onBlur:w,onChange:T,onFocus:E,placeholder:D,required:O=!1,rows:ee,select:te=!1,SelectProps:k,slots:A={},slotProps:ne={},type:j,value:re,variant:ie=`outlined`,...ae}=n,oe={...n,autoFocus:i,color:s,disabled:l,error:u,fullWidth:f,multiline:S,required:O,select:te,variant:ie},se=j2(oe),ce=ca(m),le=p&&ce?`${ce}-helper-text`:void 0,ue=y&&ce?`${ce}-label`:void 0,de=A2[ie],fe={slots:A,slotProps:{input:_,inputLabel:h,htmlInput:g,formHelperText:d,select:k,...ne}},pe={},me=fe.slotProps.inputLabel;ie===`outlined`&&(me&&me.shrink!==void 0&&(pe.notched=me.shrink),pe.label=y),te&&((!k||!k.native)&&(pe.id=void 0),pe[`aria-describedby`]=void 0);let[he,ge]=fl(`root`,{elementType:M2,shouldForwardComponentProp:!0,externalForwardedProps:{...fe,...ae},ownerState:oe,className:P(se.root,o),ref:t,additionalProps:{disabled:l,error:u,fullWidth:f,required:O,color:s,variant:ie}}),[_e,ve]=fl(`input`,{elementType:de,externalForwardedProps:fe,additionalProps:pe,ownerState:oe}),[ye,be]=fl(`inputLabel`,{elementType:Qf,externalForwardedProps:fe,ownerState:oe}),[xe,Se]=fl(`htmlInput`,{elementType:`input`,externalForwardedProps:fe,ownerState:oe}),[Ce,we]=fl(`formHelperText`,{elementType:O2,externalForwardedProps:fe,ownerState:oe}),[Te,Ee]=fl(`select`,{elementType:l0,externalForwardedProps:fe,ownerState:oe}),De=(0,N.jsx)(_e,{"aria-describedby":le,autoComplete:r,autoFocus:i,defaultValue:c,fullWidth:f,multiline:S,name:C,rows:ee,maxRows:b,minRows:x,type:j,value:re,id:ce,inputRef:v,onBlur:w,onChange:T,onFocus:E,placeholder:D,inputProps:Se,slots:{input:A.htmlInput?xe:void 0},...ve});return(0,N.jsxs)(he,{...ge,children:[y!=null&&y!==``&&(0,N.jsx)(ye,{htmlFor:ce,id:ue,...be,children:y}),te?(0,N.jsx)(Te,{"aria-describedby":le,id:ce,labelId:ue,value:re,input:De,...Ee,children:a}):De,p&&(0,N.jsx)(Ce,{id:le,...we,children:p})]})});function P2(e){return F(`MuiDialogActions`,e)}mi(`MuiDialogActions`,[`root`,`spacing`]);var F2=e=>{let{classes:t,disableSpacing:n}=e;return Fa({root:[`root`,!n&&`spacing`]},P2,t)},I2=L(`div`,{name:`MuiDialogActions`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableSpacing&&t.spacing]}})({display:`flex`,alignItems:`center`,padding:8,justifyContent:`flex-end`,flex:`0 0 auto`,variants:[{props:({ownerState:e})=>!e.disableSpacing,style:{"& > :not(style) ~ :not(style)":{marginLeft:8}}}]}),L2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialogActions`}),{className:r,disableSpacing:i=!1,...a}=n,o={...n,disableSpacing:i},s=F2(o);return(0,N.jsx)(I2,{className:P(s.root,r),ownerState:o,ref:t,...a})});function R2(e){return F(`MuiDialog`,e)}var z2=mi(`MuiDialog`,[`root`,`backdrop`,`scrollPaper`,`scrollBody`,`container`,`paper`,`paperScrollPaper`,`paperScrollBody`,`paperWidthFalse`,`paperWidthXs`,`paperWidthSm`,`paperWidthMd`,`paperWidthLg`,`paperWidthXl`,`paperFullWidth`,`paperFullScreen`]),B2=M.createContext({}),V2=L(yl,{name:`MuiDialog`,slot:`Backdrop`})({zIndex:-1}),H2=e=>{let{classes:t,scroll:n,maxWidth:r,fullWidth:i,fullScreen:a}=e;return Fa({root:[`root`],backdrop:[`backdrop`],container:[`container`,`scroll${z(n)}`],paper:[`paper`,`paperScroll${z(n)}`,`paperWidth${z(String(r))}`,i&&`paperFullWidth`,a&&`paperFullScreen`]},R2,t)},U2=L(jl,{name:`MuiDialog`,slot:`Root`})({"@media print":{position:`absolute !important`}}),W2=L(`div`,{name:`MuiDialog`,slot:`Container`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.container,t[`scroll${z(n.scroll)}`]]}})({height:`100%`,"@media print":{height:`auto`},outline:0,variants:[{props:{scroll:`paper`},style:{display:`flex`,justifyContent:`center`,alignItems:`center`}},{props:{scroll:`body`},style:{overflowY:`auto`,overflowX:`hidden`,textAlign:`center`,"&::after":{content:`""`,display:`inline-block`,verticalAlign:`middle`,height:`100%`,width:`0`}}}]}),G2=L(Fl,{name:`MuiDialog`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`scrollPaper${z(n.scroll)}`],t[`paperWidth${z(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(ol(({theme:e})=>({margin:32,position:`relative`,overflowY:`auto`,"@media print":{overflowY:`visible`,boxShadow:`none`},variants:[{props:{scroll:`paper`},style:{display:`flex`,flexDirection:`column`,maxHeight:`calc(100% - 64px)`}},{props:{scroll:`body`},style:{display:`inline-block`,verticalAlign:`middle`,textAlign:`initial`}},{props:({ownerState:e})=>!e.maxWidth,style:{maxWidth:`calc(100% - 64px)`}},{props:{maxWidth:`xs`},style:{maxWidth:e.breakpoints.unit===`px`?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${z2.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:`calc(100% - 64px)`}}}},...Object.keys(e.breakpoints.values).filter(e=>e!==`xs`).map(t=>({props:{maxWidth:t},style:{maxWidth:`${e.breakpoints.values[t]}${e.breakpoints.unit}`,[`&.${z2.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t]+64)]:{maxWidth:`calc(100% - 64px)`}}}})),{props:({ownerState:e})=>e.fullWidth,style:{width:`calc(100% - 64px)`}},{props:({ownerState:e})=>e.fullScreen,style:{margin:0,width:`100%`,maxWidth:`100%`,height:`100%`,maxHeight:`none`,borderRadius:0,[`&.${z2.paperScrollBody}`]:{margin:0,maxWidth:`100%`}}}]}))),K2=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialog`}),r=Jo(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":o,"aria-modal":s=!0,BackdropComponent:c,BackdropProps:l,children:u,className:d,disableEscapeKeyDown:f=!1,fullScreen:p=!1,fullWidth:m=!1,maxWidth:h=`sm`,onClick:g,onClose:_,open:v,PaperComponent:y=Fl,PaperProps:b={},role:x=`dialog`,scroll:S=`paper`,slots:C={},slotProps:w={},TransitionComponent:T=hl,transitionDuration:E=i,TransitionProps:D,...O}=n,ee={...n,disableEscapeKeyDown:f,fullScreen:p,fullWidth:m,maxWidth:h,scroll:S},te=H2(ee),k=M.useRef(),A=e=>{k.current=e.target===e.currentTarget},ne=e=>{g&&g(e),k.current&&(k.current=null,_&&_(e,`backdropClick`))},j=ca(o),re=M.useMemo(()=>({titleId:j}),[j]),ie={slots:{transition:T,...C},slotProps:{transition:D,paper:b,backdrop:l,...w}},[ae,oe]=fl(`root`,{elementType:U2,shouldForwardComponentProp:!0,externalForwardedProps:ie,ownerState:ee,className:P(te.root,d),ref:t}),[se,ce]=fl(`backdrop`,{elementType:V2,shouldForwardComponentProp:!0,externalForwardedProps:ie,ownerState:ee,className:te.backdrop}),[le,ue]=fl(`paper`,{elementType:G2,shouldForwardComponentProp:!0,externalForwardedProps:ie,ownerState:ee,className:te.paper,additionalProps:{elevation:24,role:x,"aria-describedby":a,"aria-labelledby":j,"aria-modal":s,tabIndex:-1,[Jc]:``}}),[de,fe]=fl(`container`,{elementType:W2,externalForwardedProps:ie,ownerState:ee,className:te.container}),[pe,me]=fl(`transition`,{elementType:hl,externalForwardedProps:ie,ownerState:ee,additionalProps:{appear:!0,in:v,timeout:E,role:`presentation`}});return(0,N.jsx)(ae,{closeAfterTransition:!0,slots:{backdrop:se},slotProps:{backdrop:{transitionDuration:E,as:c,...ce}},disableEscapeKeyDown:f,onClose:_,open:v,onClick:ne,...oe,...O,children:(0,N.jsx)(pe,{...me,children:(0,N.jsx)(de,{onMouseDown:A,...fe,children:(0,N.jsx)(le,{as:y,...ue,children:(0,N.jsx)(B2.Provider,{value:re,children:u})})})})})}),q2=class extends M.Component{static propTypes={onDone:k.func.isRequired,alt:k.string};constructor(e){super(e);let{alt:t}=e;this.state={value:t}}closeDialog=()=>{document.querySelectorAll(`#text-dialog`).forEach(function(e){return e.remove()})};onDone=()=>{let{onDone:e}=this.props,{value:t}=this.state;e(t),this.closeDialog()};handleOverflow=()=>{document.body.style.removeProperty(`overflow`)};render(){let{value:e}=this.state;return(0,N.jsxs)(K2,{open:!0,disablePortal:!0,onClose:this.closeDialog,id:`text-dialog`,hideBackdrop:!0,disableScrollLock:!0,onEntered:this.handleOverflow,children:[(0,N.jsx)(x2,{children:(0,N.jsxs)(`div`,{style:{display:`flex`},children:[(0,N.jsx)(S2,{style:{paddingTop:`6px`}}),(0,N.jsx)(N2,{multiline:!0,placeholder:`Enter an Alt Text description of this image`,helperText:`Users with visual limitations rely on Alt Text, since screen readers cannot otherwise describe the contents of an image.`,value:e,onChange:e=>this.setState({value:e.target.value}),FormHelperTextProps:{style:{fontSize:14}}})]})}),(0,N.jsx)(L2,{children:(0,N.jsx)(Ef,{onClick:this.onDone,children:`Done`})})]})}},J2=L(`button`,{shouldForwardProp:e=>![`active`,`disabled`,`extraStyles`].includes(e)})(({active:e,disabled:t})=>({color:e?lu():uu(),display:`inline-flex`,padding:`2px`,background:`none`,border:`none`,cursor:t?`not-allowed`:`pointer`,"& svg":{width:`24px`,height:`24px`},"&:hover":{color:t?uu():lu()},"&:focus":{outline:`2px solid ${Xu()}`},...t&&{opacity:.7}})),Y2=md(`pie-elements:editable-html:raw-button`);(class extends M.Component{static propTypes={onClick:k.func.isRequired,children:k.oneOfType([k.arrayOf(k.node),k.node]).isRequired,active:k.bool,disabled:k.bool,extraStyles:k.object};constructor(e){super(e)}onClick=e=>{Y2(`[onClick]`),e.preventDefault();let{onClick:t}=this.props;t(e)};onKeyDown=e=>{if(e.key===`Enter`||e.key===` `){Y2(`[onKeyDown]`),e.preventDefault();let{onClick:t}=this.props;t(e)}};render(){let{active:e,children:t,disabled:n,extraStyles:r,ariaLabel:i}=this.props;return(0,N.jsx)(J2,{style:r,active:e,disabled:n,onMouseDown:this.onClick,onKeyDown:this.onKeyDown,"aria-label":i,"aria-pressed":e,tabIndex:0,children:t})}});var X2=class extends M.Component{static propTypes={onToggle:k.func.isRequired,mark:k.string,label:k.string.isRequired,children:k.oneOfType([k.arrayOf(k.node),k.node]).isRequired,active:k.bool};constructor(e){super(e)}onToggle=e=>{e.preventDefault(),this.props.onToggle(this.props.mark)};onKeyDown=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.props.onToggle(this.props.mark))};render(){let{children:e,active:t,label:n}=this.props;return(0,N.jsx)(J2,{active:t,onMouseDown:this.onToggle,"aria-pressed":t,onKeyDown:this.onKeyDown,"aria-label":n,tabIndex:0,children:e})}},Z2=md(`@pie-lib:editable-html:plugins:image:image-toolbar`),Q2=L(`div`)(({theme:e})=>({paddingLeft:e.spacing.unit,display:`flex`,alignItems:`center`})),$2=L(`span`,{shouldForwardProp:e=>![`disabled`,`hasAlignmentButtons`].includes(e)})(({disabled:e,hasAlignmentButtons:t})=>({...e&&{opacity:.5},...t&&{borderLeft:`1px solid grey`,paddingLeft:8,marginLeft:4}})),e4=({alignment:e,active:t,onClick:n})=>(0,N.jsx)(X2,{active:t,onToggle:()=>n(e),label:e,children:e});e4.propTypes={alignment:k.string.isRequired,active:k.bool.isRequired,onClick:k.func.isRequired};var t4=class extends M.Component{static propTypes={onChange:k.func.isRequired,alignment:k.string,alt:k.string,imageLoaded:k.bool,disableImageAlignmentButtons:k.bool};onAltTextDone=e=>{Z2(`[onAltTextDone]: alt:`,e),this.props.onChange({alt:e},!0)};onAlignmentClick=e=>{Z2(`[onAlignmentClick]: alignment:`,e),this.props.onChange({alignment:e})};renderDialog=()=>{let{alt:e}=this.props,t=document.createElement(`div`),n=(0,N.jsx)(q2,{alt:e,onDone:this.onAltTextDone});hs.render(n,t),document.body.appendChild(t)};render(){let{alignment:e,imageLoaded:t,disableImageAlignmentButtons:n}=this.props;return(0,N.jsxs)(Q2,{children:[!n&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(e4,{alignment:`left`,active:e===`left`,onClick:this.onAlignmentClick}),(0,N.jsx)(e4,{alignment:`center`,active:e===`center`,onClick:this.onAlignmentClick}),(0,N.jsx)(e4,{alignment:`right`,active:e===`right`,onClick:this.onAlignmentClick})]}),(0,N.jsx)($2,{disabled:!t,hasAlignmentButtons:!n,onMouseDown:e=>t&&this.renderDialog(e),children:`Alt text`})]})}},n4=L(p2,{shouldForwardProp:e=>e!==`hideProgress`})(({hideProgress:e})=>({position:`absolute`,left:`0`,width:`fit-content`,top:`0%`,transition:`opacity 200ms linear`,...e&&{opacity:0}})),r4=L(`div`,{shouldForwardProp:e=>![`active`,`loading`,`pendingDelete`].includes(e)})(({loading:e,pendingDelete:t})=>({position:`relative`,display:`flex`,transition:`opacity 200ms linear`,...e&&{opacity:.3},...t&&{opacity:.3}})),i4=L(`div`)(({theme:e})=>({position:`relative`,width:`fit-content`,display:`flex`,alignItems:`center`,"&&:hover > .resize":{display:`block`}})),a4=L(`img`,{shouldForwardProp:e=>e!==`active`})(({theme:e,active:t})=>({border:t?`solid 1px ${e.palette.primary.main}`:`solid 1px transparent`})),o4=L(`div`)(({theme:e})=>({backgroundColor:e.palette.primary.main,cursor:`col-resize`,height:`35px`,width:`5px`,borderRadius:8,marginLeft:`5px`,marginRight:`10px`,display:`none`})),s4=e=>e?`${e}px`:`calc(20px)`;function c4(e){let{node:t,editor:n,attributes:r,onFocus:i,getPos:a,selected:o,options:s,maxImageWidth:c=700,maxImageHeight:l=900}=e,{alt:u}=t.attrs,d=a(),f=n.state.selection.from,p=n.state.selection.to,m=(0,M.useMemo)(()=>f+t.nodeSize===p,[f,p,t.nodeSize]),[h,g]=(0,M.useState)(!1),_=(0,M.useRef)(t),v=(0,M.useRef)(null),y=(0,M.useRef)(null),b=(0,M.useRef)(null),x=(0,M.useCallback)(e=>{let t=e/v.current.naturalWidth*4;return parseInt(t.toFixed(0)*25,10)},[]),S=(0,M.useCallback)(()=>{let e=_.current.attrs.nodeKey,t=null;return n.state.doc.descendants((n,r)=>{if(t!==null)return!1;if(n.type.name===`imageUploadNode`&&n.attrs.nodeKey===e)return t=r,!1}),t},[n]),C=(0,M.useCallback)(e=>{let t=S();if(t===null)return;let r=n.state.doc.nodeAt(t);r&&n.view.dispatch(n.state.tr.setNodeMarkup(t,void 0,{...r.attrs,...e}))},[n,S]),w=(0,M.useCallback)(()=>{if(!t.attrs.width||!v.current||!v.current.naturalWidth)return;let e=x(t.attrs.width);t.attrs.resizePercent!==e&&C({resizePercent:e})},[t.attrs.width,t.attrs.resizePercent,x,C]);(0,M.useEffect)(()=>{_.current={...t,pos:d}},[t,d]),(0,M.useEffect)(()=>{o?m&&n.isEditable&&(!String(t.attrs?.src??``).trim()&&s.imageHandling?.insertImageRequested&&s.imageHandling.insertImageRequested(n,[t,d],e=>new h2(n,[t,d],e)),g(o)):g(o)},[m,o,n.isEditable]),(0,M.useEffect)(()=>{w();let e=y?.current;return e&&n.isEditable&&e.addEventListener(`mousedown`,te,!1),()=>{e&&e.removeEventListener(`mousedown`,te,!1)}},[]),(0,M.useEffect)(()=>{w()});let T=(0,M.useCallback)(()=>{let e=v.current;if(e&&(!e.style.width||e.style.width===`calc(20px)`)){let n=Math.min(e.naturalWidth,c),r=Math.min(e.naturalHeight,l);e.style.width=`${n}px`,e.style.height=`${r}px`;let i={width:n,height:r};le(i,{width:t.attrs.width,height:t.attrs.height})||C(i)}},[t.attrs.width,t.attrs.height,c,l,C]),E=(e,t,n=!0,r)=>{if(n){let n=e.width/e.height;return r===`height`?{width:t.height*n,height:t.height}:{width:t.width,height:t.width/n}}return t},D=(0,M.useCallback)(e=>{let t=v.current;if(!t)return;let n=e.target.getBoundingClientRect(),r={width:t.naturalWidth,height:t.naturalHeight},i=E(r,{width:e.clientX-n.left,height:e.clientY-n.top});i.width>50&&i.height>50&&i.width<=700&&i.height<=900&&(t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,C({width:i.width,height:i.height}))},[n,C]),O=(0,M.useCallback)(e=>{C(e)},[n,C]),ee=(0,M.useCallback)(()=>{window.removeEventListener(`mousemove`,D),window.removeEventListener(`mouseup`,ee)},[D]),te=(0,M.useCallback)(()=>{window.addEventListener(`mousemove`,D),window.addEventListener(`mouseup`,ee)},[D,ee]),k={width:s4(t.attrs.width),height:s4(t.attrs.height),objectFit:`contain`},A={left:`flex-start`,center:`center`,right:`flex-end`}[t.attrs.alignment]||`flex-start`;return(0,N.jsxs)(vM,{children:[(0,N.jsxs)(r4,{onFocus:i,loading:!t.attrs.loaded,pendingDelete:t.attrs.deleteStatus===`pending`,style:{justifyContent:A},children:[(0,N.jsx)(n4,{mode:`determinate`,value:t.attrs.percent||0,hideProgress:t.attrs.loaded}),(0,N.jsxs)(i4,{onDragStart:e=>e.preventDefault(),children:[(0,N.jsx)(a4,{...r,active:o&&t.attrs.loaded,draggable:!1,ref:v,src:t.attrs.src,style:k,onLoad:T,alt:t.attrs.alt}),(0,N.jsx)(o4,{ref:y,className:`resize`,style:{display:n.isEditable?void 0:`none`}})]})]}),h&&n._tiptapContainerEl&&hs.createPortal((0,N.jsx)(`div`,{ref:b,style:{zIndex:20,background:`var(--editable-html-toolbar-bg, #efefef)`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,width:`100%`},children:(0,N.jsx)(hJ,{showDone:!0,deletable:!0,toolbarOpts:s.toolbarOpts||{},onDelete:()=>{let e=S();e!==null&&(s.imageHandling?.onDelete?.(_.current),n.view.dispatch(n.state.tr.delete(e,e+n.state.doc.nodeAt(e).nodeSize)),g(!1),n.commands.focus())},onDone:()=>{g(!1),s.imageHandling?.onDone?.(n),n.commands.focus(`end`)},children:(0,N.jsx)(t4,{disableImageAlignmentButtons:s.imageHandling?.disableImageAlignmentButtons,alt:t.attrs.alt,imageLoaded:t.attrs.loaded,alignment:t.attrs.alignment||`left`,onChange:O})})}),n._tiptapContainerEl)]})}c4.propTypes={node:k.object.isRequired,editor:k.object.isRequired,attributes:k.object,onFocus:k.func,maxImageWidth:k.number,maxImageHeight:k.number};var l4=$A.create({name:`imageUploadNode`,group:`block`,atom:!0,selectable:!0,draggable:!0,addAttributes(){return{nodeKey:{default:null},loaded:{default:!1},deleteStatus:{default:null},alignment:{default:null},percent:{default:null},width:{default:null},height:{default:null},src:{default:null},alt:{default:null}}},parseHTML(){return[{tag:`img[data-type="image-upload-node"]`}]},renderHTML({HTMLAttributes:e}){return[`img`,rk(e,{"data-type":`image-upload-node`})]},addNodeView(){return EM(e=>(0,N.jsx)(c4,{...e,options:this.options}))},addCommands(){return{setImageUploadNode:()=>({commands:e})=>e.insertContent({type:this.name,attrs:{nodeKey:`img-${Date.now()}-${Math.random().toString(36).slice(2)}`}})}},addProseMirrorPlugins(){let e=this.editor;return[new Db({props:{handlePaste(t,n){let r=Array.from(n.clipboardData?.items||[]).find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(!r)return!1;let i=r.getAsFile();if(!i)return!1;let a=new FileReader;return a.onload=()=>{let t=a.result;typeof t==`string`&&e.commands.insertContent({type:`imageUploadNode`,attrs:{src:t,loaded:!0,nodeKey:`img-${Date.now()}-${Math.random().toString(36).slice(2)}`}})},a.readAsDataURL(i),!0}}})]}});function u4(e){return(1+Math.sin(Math.PI*e-Math.PI/2))/2}function d4(e,t,n,r={},i=()=>{}){let{ease:a=u4,duration:o=300}=r,s=null,c=t[e],l=!1,u=()=>{l=!0},d=r=>{if(l){i(Error(`Animation cancelled`));return}s===null&&(s=r);let u=Math.min(1,(r-s)/o);if(t[e]=a(u)*(n-c)+c,u>=1){requestAnimationFrame(()=>{i(null)});return}requestAnimationFrame(d)};return c===n?(i(Error(`Element already at target position`)),u):(requestAnimationFrame(d),u)}var f4={width:99,height:99,position:`absolute`,top:-9999,overflow:`scroll`};function p4(e){let{onChange:t,...n}=e,r=M.useRef(),i=M.useRef(null),a=()=>{r.current=i.current.offsetHeight-i.current.clientHeight};return Ul(()=>{let e=pc(()=>{let e=r.current;a(),e!==r.current&&t(r.current)}),n=_c(i.current);return n.addEventListener(`resize`,e),()=>{e.clear(),n.removeEventListener(`resize`,e)}},[t]),M.useEffect(()=>{a(),t(r.current)},[t]),(0,N.jsx)(`div`,{style:f4,...n,ref:i})}var m4=Vl((0,N.jsx)(`path`,{d:`M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z`}),`KeyboardArrowLeft`),h4=Vl((0,N.jsx)(`path`,{d:`M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z`}),`KeyboardArrowRight`);function g4(e){return F(`MuiTabScrollButton`,e)}var _4=mi(`MuiTabScrollButton`,[`root`,`vertical`,`horizontal`,`disabled`]),v4=e=>{let{classes:t,orientation:n,disabled:r}=e;return Fa({root:[`root`,n,r&&`disabled`]},g4,t)},y4=L(Zd,{name:`MuiTabScrollButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.orientation&&t[n.orientation]]}})({width:40,flexShrink:0,opacity:.8,[`&.${_4.disabled}`]:{opacity:0},variants:[{props:{orientation:`vertical`},style:{width:`100%`,height:40,"& svg":{transform:`var(--TabScrollButton-svgRotate)`}}}]}),b4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiTabScrollButton`}),{className:r,slots:i={},slotProps:a={},direction:o,orientation:s,disabled:c,...l}=n,u=ea(),d={isRtl:u,...n},f=v4(d),p=i.StartScrollButtonIcon??m4,m=i.EndScrollButtonIcon??h4,h=Cp({elementType:p,externalSlotProps:a.startScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:d}),g=Cp({elementType:m,externalSlotProps:a.endScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:d});return(0,N.jsx)(y4,{component:`div`,className:P(f.root,r),ref:t,role:null,ownerState:d,tabIndex:null,...l,style:{...l.style,...s===`vertical`&&{"--TabScrollButton-svgRotate":`rotate(${u?-90:90}deg)`}},children:o===`left`?(0,N.jsx)(p,{...h}):(0,N.jsx)(m,{...g})})});function x4(e){return F(`MuiTabs`,e)}var S4=mi(`MuiTabs`,[`root`,`vertical`,`list`,`flexContainer`,`flexContainerVertical`,`centered`,`scroller`,`fixed`,`scrollableX`,`scrollableY`,`hideScrollbar`,`scrollButtons`,`scrollButtonsHideMobile`,`indicator`]),C4=(e,t)=>e===t?e.firstChild:t&&t.nextElementSibling?t.nextElementSibling:e.firstChild,w4=(e,t)=>e===t?e.lastChild:t&&t.previousElementSibling?t.previousElementSibling:e.lastChild,T4=(e,t,n)=>{let r=!1,i=n(e,t);for(;i;){if(i===e.firstChild){if(r)return;r=!0}let t=i.disabled||i.getAttribute(`aria-disabled`)===`true`;if(!i.hasAttribute(`tabindex`)||t)i=n(e,i);else{i.focus();return}}},E4=e=>{let{vertical:t,fixed:n,hideScrollbar:r,scrollableX:i,scrollableY:a,centered:o,scrollButtonsHideMobile:s,classes:c}=e;return Fa({root:[`root`,t&&`vertical`],scroller:[`scroller`,n&&`fixed`,r&&`hideScrollbar`,i&&`scrollableX`,a&&`scrollableY`],list:[`list`,`flexContainer`,t&&`flexContainerVertical`,t&&`vertical`,o&&`centered`],indicator:[`indicator`],scrollButtons:[`scrollButtons`,s&&`scrollButtonsHideMobile`],scrollableX:[i&&`scrollableX`],hideScrollbar:[r&&`hideScrollbar`]},x4,c)},D4=L(`div`,{name:`MuiTabs`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${S4.scrollButtons}`]:t.scrollButtons},{[`& .${S4.scrollButtons}`]:n.scrollButtonsHideMobile&&t.scrollButtonsHideMobile},t.root,n.vertical&&t.vertical]}})(ol(({theme:e})=>({overflow:`hidden`,minHeight:48,WebkitOverflowScrolling:`touch`,display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.scrollButtonsHideMobile,style:{[`& .${S4.scrollButtons}`]:{[e.breakpoints.down(`sm`)]:{display:`none`}}}}]}))),O4=L(`div`,{name:`MuiTabs`,slot:`Scroller`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.scroller,n.fixed&&t.fixed,n.hideScrollbar&&t.hideScrollbar,n.scrollableX&&t.scrollableX,n.scrollableY&&t.scrollableY]}})({position:`relative`,display:`inline-block`,flex:`1 1 auto`,whiteSpace:`nowrap`,variants:[{props:({ownerState:e})=>e.fixed,style:{overflowX:`hidden`,width:`100%`}},{props:({ownerState:e})=>e.hideScrollbar,style:{scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}},{props:({ownerState:e})=>e.scrollableX,style:{overflowX:`auto`,overflowY:`hidden`}},{props:({ownerState:e})=>e.scrollableY,style:{overflowY:`auto`,overflowX:`hidden`}}]}),k4=L(`div`,{name:`MuiTabs`,slot:`List`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.list,t.flexContainer,n.vertical&&t.flexContainerVertical,n.centered&&t.centered]}})({display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.centered,style:{justifyContent:`center`}}]}),A4=L(`span`,{name:`MuiTabs`,slot:`Indicator`})(ol(({theme:e})=>({position:`absolute`,height:2,bottom:0,width:`100%`,transition:e.transitions.create(),variants:[{props:{indicatorColor:`primary`},style:{backgroundColor:(e.vars||e).palette.primary.main}},{props:{indicatorColor:`secondary`},style:{backgroundColor:(e.vars||e).palette.secondary.main}},{props:({ownerState:e})=>e.vertical,style:{height:`100%`,width:2,right:0}}]}))),j4=L(p4)({overflowX:`auto`,overflowY:`hidden`,scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}),M4={},N4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiTabs`}),r=Jo(),i=ea(),{"aria-label":a,"aria-labelledby":o,action:s,centered:c=!1,children:l,className:u,component:d=`div`,allowScrollButtonsMobile:f=!1,indicatorColor:p=`primary`,onChange:m,orientation:h=`horizontal`,ScrollButtonComponent:g,scrollButtons:_=`auto`,selectionFollowsFocus:v,slots:y={},slotProps:b={},TabIndicatorProps:x={},TabScrollButtonProps:S={},textColor:C=`primary`,value:w,variant:T=`standard`,visibleScrollbar:E=!1,...D}=n,O=T===`scrollable`,ee=h===`vertical`,te=ee?`scrollTop`:`scrollLeft`,k=ee?`top`:`left`,A=ee?`bottom`:`right`,ne=ee?`clientHeight`:`clientWidth`,j=ee?`height`:`width`,re={...n,component:d,allowScrollButtonsMobile:f,indicatorColor:p,orientation:h,vertical:ee,scrollButtons:_,textColor:C,variant:T,visibleScrollbar:E,fixed:!O,hideScrollbar:O&&!E,scrollableX:O&&!ee,scrollableY:O&&ee,centered:c&&!O,scrollButtonsHideMobile:!f},ie=E4(re),ae=Cp({elementType:y.StartScrollButtonIcon,externalSlotProps:b.startScrollButtonIcon,ownerState:re}),oe=Cp({elementType:y.EndScrollButtonIcon,externalSlotProps:b.endScrollButtonIcon,ownerState:re}),[se,ce]=M.useState(!1),[le,ue]=M.useState(M4),[de,fe]=M.useState(!1),[pe,me]=M.useState(!1),[he,ge]=M.useState(!1),[_e,ve]=M.useState({overflow:`hidden`,scrollbarWidth:0}),ye=new Map,be=M.useRef(null),xe=M.useRef(null),Se={slots:y,slotProps:{indicator:x,scrollButtons:S,...b}},Ce=()=>{let e=be.current,t;if(e){let n=e.getBoundingClientRect();t={clientWidth:e.clientWidth,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,scrollWidth:e.scrollWidth,top:n.top,bottom:n.bottom,left:n.left,right:n.right}}let n;if(e&&w!==!1){let e=xe.current.children;if(e.length>0){let t=e[ye.get(w)];n=t?t.getBoundingClientRect():null}}return{tabsMeta:t,tabMeta:n}},we=ql(()=>{let{tabsMeta:e,tabMeta:t}=Ce(),n=0,r;ee?(r=`top`,t&&e&&(n=t.top-e.top+e.scrollTop)):(r=i?`right`:`left`,t&&e&&(n=(i?-1:1)*(t[r]-e[r]+e.scrollLeft)));let a={[r]:n,[j]:t?t[j]:0};if(typeof le[r]!=`number`||typeof le[j]!=`number`)ue(a);else{let e=Math.abs(le[r]-a[r]),t=Math.abs(le[j]-a[j]);(e>=1||t>=1)&&ue(a)}}),Te=(e,{animation:t=!0}={})=>{t?d4(te,be.current,e,{duration:r.transitions.duration.standard}):be.current[te]=e},Ee=e=>{let t=be.current[te];ee?t+=e:t+=e*(i?-1:1),Te(t)},De=()=>{let e=be.current[ne],t=0,n=Array.from(xe.current.children);for(let r=0;r<n.length;r+=1){let i=n[r];if(t+i[ne]>e){r===0&&(t=e);break}t+=i[ne]}return t},Oe=()=>{Ee(-1*De())},ke=()=>{Ee(De())},[Ae,{onChange:je,...Me}]=fl(`scrollbar`,{className:P(ie.scrollableX,ie.hideScrollbar),elementType:j4,shouldForwardComponentProp:!0,externalForwardedProps:Se,ownerState:re}),Ne=M.useCallback(e=>{je?.(e),ve({overflow:null,scrollbarWidth:e})},[je]),[Pe,Fe]=fl(`scrollButtons`,{className:P(ie.scrollButtons,S.className),elementType:b4,externalForwardedProps:Se,ownerState:re,additionalProps:{orientation:h,slots:{StartScrollButtonIcon:y.startScrollButtonIcon||y.StartScrollButtonIcon,EndScrollButtonIcon:y.endScrollButtonIcon||y.EndScrollButtonIcon},slotProps:{startScrollButtonIcon:ae,endScrollButtonIcon:oe}}}),Ie=()=>{let e={};e.scrollbarSizeListener=O?(0,N.jsx)(Ae,{...Me,onChange:Ne}):null;let t=O&&(_===`auto`&&(de||pe)||_===!0);return e.scrollButtonStart=t?(0,N.jsx)(Pe,{direction:i?`right`:`left`,onClick:Oe,disabled:!de,...Fe}):null,e.scrollButtonEnd=t?(0,N.jsx)(Pe,{direction:i?`left`:`right`,onClick:ke,disabled:!pe,...Fe}):null,e},Le=ql(e=>{let{tabsMeta:t,tabMeta:n}=Ce();if(!(!n||!t)){if(n[k]<t[k]){let r=t[te]+(n[k]-t[k]);Te(r,{animation:e})}else if(n[A]>t[A]){let r=t[te]+(n[A]-t[A]);Te(r,{animation:e})}}}),Re=ql(()=>{O&&_!==!1&&ge(!he)});M.useEffect(()=>{let e=pc(()=>{be.current&&we()}),t,n=n=>{n.forEach(e=>{e.removedNodes.forEach(e=>{t?.unobserve(e)}),e.addedNodes.forEach(e=>{t?.observe(e)})}),e(),Re()},r=_c(be.current);r.addEventListener(`resize`,e);let i;return typeof ResizeObserver<`u`&&(t=new ResizeObserver(e),Array.from(xe.current.children).forEach(e=>{t.observe(e)})),typeof MutationObserver<`u`&&(i=new MutationObserver(n),i.observe(xe.current,{childList:!0})),()=>{e.clear(),r.removeEventListener(`resize`,e),i?.disconnect(),t?.disconnect()}},[we,Re]),M.useEffect(()=>{let e=Array.from(xe.current.children),t=e.length;if(typeof IntersectionObserver<`u`&&t>0&&O&&_!==!1){let n=e[0],r=e[t-1],i={root:be.current,threshold:.99},a=new IntersectionObserver(e=>{fe(!e[0].isIntersecting)},i);a.observe(n);let o=new IntersectionObserver(e=>{me(!e[0].isIntersecting)},i);return o.observe(r),()=>{a.disconnect(),o.disconnect()}}},[O,_,he,l?.length]),M.useEffect(()=>{ce(!0)},[]),M.useEffect(()=>{we()}),M.useEffect(()=>{Le(M4!==le)},[Le,le]),M.useImperativeHandle(s,()=>({updateIndicator:we,updateScrollButtons:Re}),[we,Re]);let[ze,Be]=fl(`indicator`,{className:P(ie.indicator,x.className),elementType:A4,externalForwardedProps:Se,ownerState:re,additionalProps:{style:le}}),Ve=(0,N.jsx)(ze,{...Be}),He=0,Ue=M.Children.map(l,e=>{if(!M.isValidElement(e))return null;let t=e.props.value===void 0?He:e.props.value;ye.set(t,He);let n=t===w;return He+=1,M.cloneElement(e,{fullWidth:T===`fullWidth`,indicator:n&&!se&&Ve,selected:n,selectionFollowsFocus:v,onChange:m,textColor:C,value:t,...He===1&&w===!1&&!e.props.tabIndex?{tabIndex:0}:{}})}),We=e=>{if(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)return;let t=xe.current,n=qc(hc(t));if(n?.getAttribute(`role`)!==`tab`)return;let r=h===`horizontal`?`ArrowLeft`:`ArrowUp`,a=h===`horizontal`?`ArrowRight`:`ArrowDown`;switch(h===`horizontal`&&i&&(r=`ArrowRight`,a=`ArrowLeft`),e.key){case r:e.preventDefault(),T4(t,n,w4);break;case a:e.preventDefault(),T4(t,n,C4);break;case`Home`:e.preventDefault(),T4(t,null,C4);break;case`End`:e.preventDefault(),T4(t,null,w4);break;default:break}},Ge=Ie(),[Ke,qe]=fl(`root`,{ref:t,className:P(ie.root,u),elementType:D4,externalForwardedProps:{...Se,...D,component:d},ownerState:re}),[Je,Ye]=fl(`scroller`,{ref:be,className:ie.scroller,elementType:O4,externalForwardedProps:Se,ownerState:re,additionalProps:{style:{overflow:_e.overflow,[ee?`margin${i?`Left`:`Right`}`:`marginBottom`]:E?void 0:-_e.scrollbarWidth}}}),[Xe,Ze]=fl(`list`,{ref:xe,className:P(ie.list,ie.flexContainer),elementType:k4,externalForwardedProps:Se,ownerState:re,getSlotProps:e=>({...e,onKeyDown:t=>{We(t),e.onKeyDown?.(t)}})});return(0,N.jsxs)(Ke,{...qe,children:[Ge.scrollButtonStart,Ge.scrollbarSizeListener,(0,N.jsxs)(Je,{...Ye,children:[(0,N.jsx)(Xe,{"aria-label":a,"aria-labelledby":o,"aria-orientation":h===`vertical`?`vertical`:null,role:`tablist`,...Ze,children:Ue}),se&&Ve]}),Ge.scrollButtonEnd]})});function P4(e){return F(`MuiTab`,e)}var F4=mi(`MuiTab`,[`root`,`labelIcon`,`textColorInherit`,`textColorPrimary`,`textColorSecondary`,`selected`,`disabled`,`fullWidth`,`wrapped`,`iconWrapper`,`icon`]),I4=e=>{let{classes:t,textColor:n,fullWidth:r,wrapped:i,icon:a,label:o,selected:s,disabled:c}=e;return Fa({root:[`root`,a&&o&&`labelIcon`,`textColor${z(n)}`,r&&`fullWidth`,i&&`wrapped`,s&&`selected`,c&&`disabled`],icon:[`iconWrapper`,`icon`]},P4,t)},L4=L(Zd,{name:`MuiTab`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.label&&n.icon&&t.labelIcon,t[`textColor${z(n.textColor)}`],n.fullWidth&&t.fullWidth,n.wrapped&&t.wrapped,{[`& .${F4.iconWrapper}`]:t.iconWrapper},{[`& .${F4.icon}`]:t.icon}]}})(ol(({theme:e})=>({...e.typography.button,maxWidth:360,minWidth:90,position:`relative`,minHeight:48,flexShrink:0,padding:`12px 16px`,overflow:`hidden`,whiteSpace:`normal`,textAlign:`center`,lineHeight:1.25,variants:[{props:({ownerState:e})=>e.label&&(e.iconPosition===`top`||e.iconPosition===`bottom`),style:{flexDirection:`column`}},{props:({ownerState:e})=>e.label&&e.iconPosition!==`top`&&e.iconPosition!==`bottom`,style:{flexDirection:`row`}},{props:({ownerState:e})=>e.icon&&e.label,style:{minHeight:72,paddingTop:9,paddingBottom:9}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`top`,style:{[`& > .${F4.icon}`]:{marginBottom:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`bottom`,style:{[`& > .${F4.icon}`]:{marginTop:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`start`,style:{[`& > .${F4.icon}`]:{marginRight:e.spacing(1)}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`end`,style:{[`& > .${F4.icon}`]:{marginLeft:e.spacing(1)}}},{props:{textColor:`inherit`},style:{color:`inherit`,opacity:.6,[`&.${F4.selected}`]:{opacity:1},[`&.${F4.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity}}},{props:{textColor:`primary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${F4.selected}`]:{color:(e.vars||e).palette.primary.main},[`&.${F4.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:{textColor:`secondary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${F4.selected}`]:{color:(e.vars||e).palette.secondary.main},[`&.${F4.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:({ownerState:e})=>e.fullWidth,style:{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:`none`}},{props:({ownerState:e})=>e.wrapped,style:{fontSize:e.typography.pxToRem(12)}}]}))),R4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiTab`}),{className:r,disabled:i=!1,disableFocusRipple:a=!1,fullWidth:o,icon:s,iconPosition:c=`top`,indicator:l,label:u,onChange:d,onClick:f,onFocus:p,selected:m,selectionFollowsFocus:h,textColor:g=`inherit`,value:_,wrapped:v=!1,...y}=n,b={...n,disabled:i,disableFocusRipple:a,selected:m,icon:!!s,iconPosition:c,label:!!u,fullWidth:o,textColor:g,wrapped:v},x=I4(b),S=s&&u&&M.isValidElement(s)?M.cloneElement(s,{className:P(x.icon,s.props.className)}):s;return(0,N.jsxs)(L4,{focusRipple:!a,className:P(x.root,r),ref:t,role:`tab`,"aria-selected":m,disabled:i,onClick:e=>{!m&&d&&d(e,_),f&&f(e)},onFocus:e=>{h&&!m&&d&&d(e,_),p&&p(e)},ownerState:b,tabIndex:m?0:-1,...y,children:[c===`top`||c===`start`?(0,N.jsxs)(M.Fragment,{children:[S,u]}):(0,N.jsxs)(M.Fragment,{children:[u,S]}),l]})}),z4=e=>{let{classes:t}=e;return Fa({root:[`root`]},_2,t)},B4=L(G$,{name:`MuiDialogTitle`,slot:`Root`})({padding:`16px 24px`,flex:`0 0 auto`}),V4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialogTitle`}),{className:r,id:i,...a}=n,o=n,s=z4(o),{titleId:c=i}=M.useContext(B2);return(0,N.jsx)(B4,{component:`h2`,className:P(s.root,r),ownerState:o,ref:t,variant:`h6`,id:i??c,...a})});function H4(e){return F(`MuiDialogContentText`,e)}mi(`MuiDialogContentText`,[`root`]);var U4=e=>{let{classes:t}=e,n=Fa({root:[`root`]},H4,t);return{...t,...n}},W4=L(G$,{shouldForwardProp:e=>Xo(e)||e===`classes`,name:`MuiDialogContentText`,slot:`Root`})({}),G4=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiDialogContentText`}),{children:r,className:i,...a}=n,o=U4(a);return(0,N.jsx)(W4,{component:`p`,variant:`body1`,color:`textSecondary`,ref:t,ownerState:a,className:P(o.root,i),...n,classes:o})}),K4=md(`@pie-lib:editable-html:plugins:media:dialog`),q4=e=>{if(!e)return!1;let t=/^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;return e.match(t)?e.match(t)[1]:!1},J4=e=>e&&/(http|https)?:\/\/(www\.)?(player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(video\/)?(\d+)(?:|\/\?)/.test(e),Y4=e=>e&&/^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)/.test(e),X4=e=>{if(!e)return!1;let t=/^https?:\/\/(soundcloud\.com|snd\.sc)\/(.*)$/;return e.match(t)&&e.match(t)[2]},Z4=e=>new Promise(t=>{try{fetch(`https://soundcloud.com/oembed?format=json&url=${e}`).then(e=>e.json()).then(e=>{let n=document.createElement(`div`);n.innerHTML=e.html,t(n.querySelector(`iframe`).src)}).catch(e=>{t(``),K4(e)})}catch{t(``)}}),Q4={video:`Video`,audio:`Audio`},$4={uploadFile:`upload-file`,insertUrl:`insert-url`},e3=L(K2)(({theme:e})=>({"& .MuiDialog-paper":{minWidth:`500px`}})),t3=L(x2)(({theme:e})=>({padding:0})),n3=L(`div`)(({theme:e})=>({display:`flex`,flexDirection:`space-between`})),r3=L(`div`)(({theme:e})=>({marginTop:e.spacing(1.5)})),i3=L(`input`)(({theme:e})=>({})),a3=L(G$)(({theme:e})=>({marginTop:e.spacing(1.5),color:e.palette.error.main})),o3=L(aJ)(({theme:e})=>({marginLeft:e.spacing(1.5)})),s3=class extends M.Component{static propTypes={open:k.bool,edit:k.bool,disablePortal:k.bool,handleClose:k.func,uploadSoundSupport:k.shape({add:k.func,delete:k.func}),type:k.string,src:k.string,url:k.string,urlToUse:k.string,starts:k.number,ends:k.number,height:k.number,width:k.number};constructor(e){super(e);let{ends:t,height:n,src:r,starts:i,type:a,uploadSoundSupport:o,url:s,urlToUse:c,width:l}=e,u=o?.add&&o?.delete&&a!==`video`&&!r;this.state={ends:t||0,url:s,urlToUse:c,formattedUrl:r,height:n||315,invalid:!1,starts:i||0,width:l||560,tabValue:u?$4.uploadFile:$4.insertUrl,fileUpload:{error:null,loading:!1,scheduled:!1,url:``,mimeType:``}}}componentDidMount(){this.props.url&&this.urlChange({target:{value:this.props.url}})}formatUrl=()=>{let{url:e,urlToUse:t,starts:n,ends:r}=this.state,i=q4(e),a=J4(e),o=t;if((i||a)&&t){let e=[],s,c;switch(!0){case a:s=`t`,c=`#`;break;case i:s=`start`,c=`?`;break;default:s=`start`,c=`?`}n&&e.push(`${s}=${n}`),r&&e.push(`end=${r}`),o=`${t}${e.length?c:``}${e.join(`&`)}`}this.setState({formattedUrl:null,updating:!0},()=>this.setState({formattedUrl:o,updating:!1}))};handleStateChange=e=>this.setState(e,this.formatUrl);checkAudio=e=>{X4(e)&&Z4(e).then(t=>{this.handleStateChange({urlToUse:t,invalid:!t,url:e})}).catch(K4)};checkVideo=e=>{if(q4(e)){let t=`https://youtube.com/embed/${e.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)[2]}`;K4(`is youtube`),this.handleStateChange({urlToUse:t,url:e,invalid:!1})}if(J4(e)){let t=`https://player.vimeo.com/video/${e.replace(/.*vimeo.com\/(.*)/g,`$1`)}`;K4(`is vimeo`),this.handleStateChange({urlToUse:t,url:e,ends:null,invalid:!1})}if(Y4(e)){let t=`https://drive.google.com/file/d/${e.replace(/^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)\/.*/,`$1`)}/preview`;K4(`is google drive`),this.handleStateChange({urlToUse:t,url:e,ends:null,invalid:!1})}};urlChange=e=>{let{value:t}=e.target||{},{type:n}=this.props;if(n&&n===`audio`){this.checkAudio(t);return}else if(n&&n===`video`){this.checkVideo(t);return}this.handleStateChange({urlToUse:null,url:null,invalid:!0})};changeHandler=e=>t=>this.handleStateChange({[e]:t.target.value});handleDone=e=>{let{handleClose:t}=this.props,{tabValue:n,fileUpload:r}=this.state,i=n===$4.insertUrl;if(!e){r.url&&this.handleRemoveFile(),t(e);return}if(i){let{ends:n,height:r,url:i,urlToUse:a,formattedUrl:o,starts:s,width:c}=this.state;t(e,{tag:`iframe`,ends:n,height:r,starts:s,width:c,url:i,urlToUse:a,src:o});return}if(!r.loading){t(e,{tag:`audio`,src:r.url});return}this.setState({fileUpload:{...r,scheduled:!0}})};handleUploadFile=async e=>{e.preventDefault(),this.setState({fileUpload:{...this.state.fileUpload,error:null,loading:!0}});let t=e.target.files[0],n=new FileReader;n.onload=()=>{let e=n.result;this.setState({fileUpload:{...this.state.fileUpload,url:e,mimeType:t.type}})},n.readAsDataURL(t),this.props.uploadSoundSupport.add({fileChosen:t,done:(e,t)=>{if(K4(`done: err:`,e),e){console.log(e),this.setState({fileUpload:{...this.state.fileUpload,scheduled:!1,loading:!1,error:e}});return}let{fileUpload:n}=this.state,r=n&&n.scheduled?this.handleDone.bind(this,!0):void 0;this.setState({fileUpload:{...n,scheduled:!1,loading:!1,url:t}},r)}})};handleRemoveFile=async()=>{this.props.uploadSoundSupport.delete(this.state.fileUpload.url,e=>{e&&(console.log(e),this.setState({fileUpload:{...this.state.fileUpload,error:e}}))}),this.setState({fileUpload:{...this.state.fileUpload,loading:!1,url:``,mimeType:``}})};render(){let{open:e,disablePortal:t,type:n,edit:r,uploadSoundSupport:i}=this.props,{ends:a,height:o,invalid:s,starts:c,width:l,url:u,mimeType:d,formattedUrl:f,updating:p,tabValue:m,fileUpload:h}=this.state,g=q4(u),_=m===$4.insertUrl,v=m===$4.uploadFile,y=_?s||u==null:!h.url||h.scheduled,b=i?.add&&i?.delete&&n!==`video`;return(0,N.jsxs)(e3,{disablePortal:t,open:e,onClose:()=>this.handleDone(!1),"aria-labelledby":`form-dialog-title`,children:[(0,N.jsxs)(V4,{id:`form-dialog-title`,children:[`Insert `,Q4[n]]}),(0,N.jsx)(x2,{children:(0,N.jsxs)(`div`,{children:[(0,N.jsx)(n3,{children:(0,N.jsxs)(N4,{indicatorColor:`primary`,value:m,onChange:(e,t)=>{this.setState({tabValue:t})},children:[b?(0,N.jsx)(R4,{value:$4.uploadFile,label:`Upload file`}):null,(0,N.jsx)(R4,{value:$4.insertUrl,label:n===`video`?`Insert YouTube, Vimeo, or Google Drive URL`:`Insert SoundCloud URL`})]})}),_&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(N2,{autoFocus:!0,error:s,helperText:s?`Invalid URL`:``,margin:`dense`,id:`name`,label:`URL`,placeholder:`Paste URL of ${n}...`,type:`text`,onChange:this.urlChange,value:u,fullWidth:!0}),n===`video`&&(0,N.jsxs)(t3,{children:[(0,N.jsx)(G4,{children:`Video Properties`}),(0,N.jsx)(N2,{autoFocus:!0,margin:`dense`,id:`width`,label:`Width`,type:`number`,placeholder:`Width`,value:l,onChange:this.changeHandler(`width`)}),(0,N.jsx)(N2,{autoFocus:!0,margin:`dense`,id:`height`,label:`Height`,type:`number`,placeholder:`Height`,value:o,onChange:this.changeHandler(`height`)})]}),f&&(0,N.jsx)(`iframe`,{width:l,height:o,src:f,frameBorder:`0`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0}),n===`video`&&(f||p)&&!s&&(0,N.jsx)(M.Fragment,{children:(0,N.jsxs)(t3,{children:[(0,N.jsx)(N2,{autoFocus:!0,margin:`dense`,id:`starts`,label:`Starts`,type:`number`,placeholder:`Starts`,value:c,onChange:this.changeHandler(`starts`)}),g&&(0,N.jsx)(N2,{autoFocus:!0,margin:`dense`,id:`ends`,label:`Ends`,type:`number`,placeholder:`Ends`,value:a,onChange:this.changeHandler(`ends`)})]})})]}),v&&(0,N.jsx)(r3,{children:(0,N.jsxs)(`div`,{children:[h.url?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(n3,{children:[(0,N.jsx)(`audio`,{controls:`controls`,controlsList:`nodownload`,children:(0,N.jsx)(`source`,{type:d,src:h.url})}),(0,N.jsx)(o3,{"aria-label":`delete`,onClick:this.handleRemoveFile,children:(0,N.jsx)(oJ,{})})]}),!h.scheduled&&h.loading?(0,N.jsx)(G$,{variant:`subheading`,children:`Loading...`}):null,h.scheduled?(0,N.jsx)(G$,{variant:`subheading`,children:`Waiting for Upload to finish, then inserting item...`}):null]}):h.loading?null:(0,N.jsx)(i3,{accept:`audio/*`,onChange:this.handleUploadFile,type:`file`}),!!h.error&&(0,N.jsx)(a3,{variant:`caption`,children:h.error})]})})]})}),(0,N.jsxs)(L2,{children:[(0,N.jsx)(Ef,{onClick:()=>this.handleDone(!1),color:`primary`,children:`Cancel`}),(0,N.jsx)(Ef,{disabled:y,onClick:()=>this.handleDone(!0),color:`primary`,children:r?`Update`:`Insert`})]})]})}},c3=L(`span`)(({theme:e})=>({position:`relative`,bottom:`5px`,left:0,width:`100%`,background:e.palette.common.white,display:`inline-flex`,padding:`5px`,boxShadow:`0px 4px 4px rgba(0, 0, 0, 0.25)`})),l3=L(`span`)(({theme:e})=>({cursor:`pointer`,flex:3,border:`solid ${e.palette.common.black}`,textAlign:`right`,borderWidth:`0 2px 0 0`,marginRight:`5px`,paddingRight:`5px`})),u3=L(`span`)({cursor:`pointer`}),d3=class extends M.Component{static propTypes={onEdit:k.func,hideEdit:k.bool,onRemove:k.func};render(){let{hideEdit:e,onEdit:t,onRemove:n}=this.props;return(0,N.jsxs)(c3,{children:[e?null:(0,N.jsx)(l3,{onClick:t,children:`Edit Settings`}),(0,N.jsx)(u3,{onClick:n,children:`Remove`})]})}},f3=$A.create({name:`media`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{type:{default:`video`},src:{default:null},width:{default:null},height:{default:null},title:{default:null},starts:{default:null},ends:{default:null},editing:{default:!1},tag:{default:`iframe`},url:{default:null}}},parseHTML(){return[{tag:`iframe[data-type="video"]`,getAttrs:e=>({type:`video`,tag:`iframe`,src:e.getAttribute(`src`),width:e.getAttribute(`width`),height:e.getAttribute(`height`),title:e.dataset.title,starts:e.dataset.starts,ends:e.dataset.ends,url:e.dataset.url})},{tag:`audio`,getAttrs:e=>({type:`audio`,tag:`audio`,src:e.querySelector(`source`)?.getAttribute(`src`)})}]},renderHTML({HTMLAttributes:e}){let{tag:t,src:n,width:r,height:i}=e;return t===`audio`?[`audio`,{controls:`controls`,controlsList:`nodownload`},[`source`,{src:n,type:`audio/mp3`}]]:[`iframe`,rk({"data-type":`video`,frameborder:`0`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowfullscreen:``,src:n},r?{width:r}:{},i?{height:i}:{})]},addCommands(){return{insertMedia:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateMedia:e=>({commands:t})=>t.updateAttributes(this.name,e)}},addNodeView(){return EM(e=>(0,N.jsx)(h3,{...e,options:this.options}))}}),p3=()=>{document.querySelectorAll(`.insert-media-dialog`).forEach(e=>e.remove())},m3=e=>{let t=document.createElement(`div`),{type:n,callback:r,options:i,...a}=e,o=document.body.style.overflow;p3(),t.className=`insert-media-dialog`,document.body.style.overflow=`hidden`;let s=(e,n)=>{r(e,n),t.remove(),document.body.style.overflow=o},c=(0,N.jsx)(s3,{...a,uploadSoundSupport:i.uploadSoundSupport,type:n,disablePortal:!0,open:!0,handleClose:s});hs.render(c,t),document.body.appendChild(t)};function h3({editor:e,node:t,updateAttributes:n,deleteNode:r,options:i}){let{type:a,src:o,width:s,height:c,tag:l}=t.attrs;return(0,M.useEffect)(()=>{o||m3({...t.attrs,options:i,edit:!0,callback:(t,i)=>{t?n(i):r(),e.chain().focus().run()}})},[]),(0,N.jsxs)(vM,{"data-type":a,style:{width:s,height:c},children:[l===`audio`?(0,N.jsx)(`audio`,{controls:!0,controlsList:`nodownload`,children:(0,N.jsx)(`source`,{type:`audio/mp3`,src:o})}):(0,N.jsx)(`iframe`,{src:o,allowFullScreen:!0,frameBorder:`0`,width:s,height:c}),(0,N.jsx)(d3,{onEdit:()=>{m3({...t.attrs,options:i,edit:!0,callback:(t,r)=>{t&&n(r),e.chain().focus().run()}})},onRemove:r})]})}function g3(e){return F(`MuiListItem`,e)}mi(`MuiListItem`,[`root`,`container`,`dense`,`alignItemsFlexStart`,`divider`,`gutters`,`padding`,`secondaryAction`]);var _3=mi(`MuiListItemButton`,[`root`,`focusVisible`,`dense`,`alignItemsFlexStart`,`disabled`,`divider`,`gutters`,`selected`]);function v3(e){return F(`MuiListItemSecondaryAction`,e)}mi(`MuiListItemSecondaryAction`,[`root`,`disableGutters`]);var y3=e=>{let{disableGutters:t,classes:n}=e;return Fa({root:[`root`,t&&`disableGutters`]},v3,n)},b3=L(`div`,{name:`MuiListItemSecondaryAction`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.disableGutters&&t.disableGutters]}})({position:`absolute`,right:16,top:`50%`,transform:`translateY(-50%)`,variants:[{props:({ownerState:e})=>e.disableGutters,style:{right:0}}]}),x3=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiListItemSecondaryAction`}),{className:r,...i}=n,a=M.useContext(wp),o={...n,disableGutters:a.disableGutters},s=y3(o);return(0,N.jsx)(b3,{className:P(s.root,r),ownerState:o,ref:t,...i})});x3.muiName=`ListItemSecondaryAction`;var S3=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.alignItems===`flex-start`&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters,!n.disablePadding&&t.padding,n.hasSecondaryAction&&t.secondaryAction]},C3=e=>{let{alignItems:t,classes:n,dense:r,disableGutters:i,disablePadding:a,divider:o,hasSecondaryAction:s}=e;return Fa({root:[`root`,r&&`dense`,!i&&`gutters`,!a&&`padding`,o&&`divider`,t===`flex-start`&&`alignItemsFlexStart`,s&&`secondaryAction`],container:[`container`],secondaryAction:[`secondaryAction`]},g3,n)},w3=L(`div`,{name:`MuiListItem`,slot:`Root`,overridesResolver:S3})(ol(({theme:e})=>({display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,width:`100%`,boxSizing:`border-box`,textAlign:`left`,variants:[{props:({ownerState:e})=>!e.disablePadding,style:{paddingTop:8,paddingBottom:8}},{props:({ownerState:e})=>!e.disablePadding&&e.dense,style:{paddingTop:4,paddingBottom:4}},{props:({ownerState:e})=>!e.disablePadding&&!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>!e.disablePadding&&!!e.secondaryAction,style:{paddingRight:48}},{props:({ownerState:e})=>!!e.secondaryAction,style:{[`& > .${_3.root}`]:{paddingRight:48}}},{props:{alignItems:`flex-start`},style:{alignItems:`flex-start`}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>e.button,style:{transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:({ownerState:e})=>e.hasSecondaryAction,style:{paddingRight:48}}]}))),T3=L(`li`,{name:`MuiListItem`,slot:`Container`})({position:`relative`}),E3=M.forwardRef(function(e,t){let n=dc({props:e,name:`MuiListItem`}),{alignItems:r=`center`,children:i,className:a,component:o,components:s={},componentsProps:c={},ContainerComponent:l=`li`,ContainerProps:{className:u,...d}={},dense:f=!1,disableGutters:p=!1,disablePadding:m=!1,divider:h=!1,secondaryAction:g,slotProps:_={},slots:v={},...y}=n,b=M.useContext(wp),x=M.useMemo(()=>({dense:f||b.dense||!1,alignItems:r,disableGutters:p}),[r,b.dense,f,p]),S=M.useRef(null),C=M.Children.toArray(i),w=C.length&&Hl(C[C.length-1],[`ListItemSecondaryAction`]),T={...n,alignItems:r,dense:x.dense,disableGutters:p,disablePadding:m,divider:h,hasSecondaryAction:w},E=C3(T),D=kc(S,t),[O,ee]=fl(`secondaryAction`,{elementType:x3,externalForwardedProps:{slots:v,slotProps:_},ownerState:T,className:E.secondaryAction}),te=v.root||s.Root||w3,k=_.root||c.root||{},A={className:P(E.root,k.className,a),...y},ne=o||`li`;return w?(ne=!A.component&&!o?`div`:ne,l===`li`&&(ne===`li`?ne=`div`:A.component===`li`&&(A.component=`div`)),(0,N.jsx)(wp.Provider,{value:x,children:(0,N.jsxs)(T3,{as:l,className:P(E.container,u),ref:D,ownerState:T,...d,children:[(0,N.jsx)(te,{...k,...!sc(te)&&{as:ne,ownerState:{...T,...k.ownerState}},...A,children:C}),C.pop()]})})):(0,N.jsx)(wp.Provider,{value:x,children:(0,N.jsxs)(te,{...k,as:ne,ref:D,...!sc(te)&&{ownerState:{...T,...k.ownerState}},...A,children:[C,g&&(0,N.jsx)(O,{...ee,children:g})]})})}),D3=()=>{document.querySelectorAll(`.insert-css-dialog`).forEach(e=>e.remove())},O3=({editor:e,callback:t,opts:n,selectedText:r,parentNode:i})=>{let a=e.options.element,o=document.createElement(`div`),{selection:s}=e.state;D3(),o.className=`insert-css-dialog`;let c=!1,l=e=>{if(c){let t=o.contains(e.target)||void 0,n=a.contains(e.target);t||n||u()}else c=!0},u=()=>{t(void 0,!0),o.remove(),document.body.removeEventListener(`click`,l)},d=e=>{t(e,!0),o.remove(),document.body.removeEventListener(`click`,l)},f=i?.attrs.class,p=e=>{let t=`<span class="${e}">${r}</span>`;if(i){let e=`span`;i?.object===`inline`&&(e=`span`),i?.object===`block`&&(e=`div`),t=`<${e} class="${f}">${i.text.slice(0,s.$anchor.textOffset)}${t}${i.text.slice(s.$head.textOffset)}</${e}>`}return t},m=(0,N.jsxs)(`div`,{style:{background:`white`,height:500,padding:20,overflow:`hidden`,display:`flex`,flexFlow:`column`},children:[(0,N.jsx)(`h2`,{children:`Please choose a css class`}),f&&(0,N.jsxs)(`div`,{children:[`The current parent has this class `,f]}),(0,N.jsx)(Op,{component:`nav`,style:{overflow:`scroll`},children:n.names.map((e,t)=>(0,N.jsxs)(E3,{button:!0,onClick:()=>d(e),children:[(0,N.jsx)(`div`,{style:{marginRight:20},children:e}),(0,N.jsx)(`div`,{dangerouslySetInnerHTML:{__html:p(e)}})]},`rule-${t}`))})]});hs.render(m,o,()=>{let t=e.view.nodeDOM(e.state.selection.from)?.parentNode;if(t){let e=a.parentElement.parentElement.parentElement.getBoundingClientRect(),n=t.getBoundingClientRect();a.parentElement.parentElement.parentElement.appendChild(o),o.style.maxWidth=`500px`,o.style.position=`absolute`,o.style.top=0,o.style.zIndex=99999;let r=`${n.left+Math.abs(e.left)+t.offsetWidth+10}px`,i=`${n.x}px`;o.style.left=r;let s=o.offsetWidth;o.style.left=`unset`,o.style.right=i;let c=o.offsetWidth;o.style.left=`unset`,o.style.right=`unset`,s>=c?o.style.left=r:o.style.right=i,document.body.addEventListener(`click`,l)}})},k3=hA.create({name:`cssmark`,addOptions(){return{classes:[]}},addAttributes(){return{class:{default:null,parseHTML:e=>e.getAttribute(`class`),renderHTML:e=>e.class?{class:e.class}:{}}}},parseHTML(){return[{tag:`span[class]`,getAttrs:e=>{let t=e.getAttribute(`class`)||``;if(!t)return!1;if((this.options&&this.options.classes||[]).length>0){let e=this.options.classes.find(e=>t.includes(e));return e?{class:e}:!1}return{class:t}}}]},renderHTML({HTMLAttributes:e}){return[`span`,rk(e),0]},addCommands(){return{setCSSClass:e=>({commands:t})=>t.setMark(this.name,{class:e}),unsetCSSClass:()=>({commands:e})=>e.unsetMark(this.name),openCSSClassDialog:()=>({editor:e})=>{O3({editor:e,selectedText:e.state.doc.textBetween(e.state.selection.from,e.state.selection.to),parentNode:e.state.selection.$from.nodeAfter,opts:this.options.extraCSSRules,callback:t=>{t&&e.chain().focus().setCSSClass(t).run()}})}}}}),A3=Object.defineProperty,j3=(e,t)=>{for(var n in t)A3(e,n,{get:t[n],enumerable:!0})},M3=`listItem`,N3=`textStyle`,P3=/^\s*([-+*])\s$/,F3=$A.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,rk(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
387
|
+
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(M3,this.editor.getAttributes(N3)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=BA({find:P3,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=BA({find:P3,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(N3),editor:this.editor})),[e]}});function I3(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function L3(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var R3=$A.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,rk(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(I3(e))return{type:`listItem`,content:[{type:`paragraph`,content:L3(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>ZA(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});j3({},{findListItemPos:()=>z3,getNextListDepth:()=>B3,handleBackspace:()=>W3,handleDelete:()=>q3,hasListBefore:()=>V3,hasListItemAfter:()=>J3,hasListItemBefore:()=>H3,listItemHasSubList:()=>U3,nextListIsDeeper:()=>G3,nextListIsHigher:()=>K3});var z3=(e,t)=>{let{$from:n}=t.selection,r=VD(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},B3=(e,t)=>{let n=z3(e,t);if(!n)return!1;let[,r]=xk(t,e,n.$pos.pos+4);return r},V3=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},H3=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},U3=(e,t,n)=>{if(!n)return!1;let r=VD(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},W3=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!DO(e.state,t)&&V3(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!DO(e.state,t)||!Ok(e.state))return!1;let r=z3(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=U3(t,e.state,i);return H3(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},G3=(e,t)=>{let n=B3(e,t),r=z3(e,t);return!r||!n?!1:n>r.depth},K3=(e,t)=>{let n=B3(e,t),r=z3(e,t);return!r||!n?!1:n<r.depth},q3=(e,t)=>{if(!DO(e.state,t)||!Dk(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:G3(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():K3(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},J3=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},Y3=CA.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&q3(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&q3(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&W3(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&W3(e,n,r)&&(t=!0)}),t}}}}),X3=/^(\s*)(\d+)\.\s+(.*)$/,Z3=/^\s/;function Q3(e){let t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function $3(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&Q3(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function e6(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(X3);if(!a)break;let[,o,s,c]=a,l=o.length,u=[c],d=n+1,f=[i],p=!1;for(;d<e.length;){let t=e[d];if(t.match(X3))break;if(t.trim()===``)f.push(t),u.push(``),p=!0,d+=1;else if(t.match(Z3))f.push(t),u.push(t.slice(l+2)),d+=1;else{if(p)break;f.push(t),u.push(t),d+=1}}t.push({indent:l,number:parseInt(s,10),content:u.join(`
|
|
388
388
|
`).trim(),contentLines:u,raw:f.join(`
|
|
389
|
-
`)}),r=d,n=d}return[t,r]}function
|
|
389
|
+
`)}),r=d,n=d}return[t,r]}function t6(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=$3(a.contentLines),c=o.join(`
|
|
390
390
|
`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
|
|
391
|
-
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=
|
|
392
|
-
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function
|
|
391
|
+
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=t6(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,items:e,raw:f.map(e=>e.raw).join(`
|
|
392
|
+
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function n6(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var r6=`listItem`,i6=`textStyle`,a6=/^(\d+)\.\s$/,o6=$A.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,rk(this.options.HTMLAttributes,n),0]:[`ol`,rk(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?n6(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
393
393
|
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
|
|
394
|
-
`),[i,a]=
|
|
395
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(
|
|
396
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=XA(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=XA(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});CA.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(D3.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(A3.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(V3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Q3.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(e6.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(t6.configure(this.options.taskList)),e}});var n6=A3.extend({content:`(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+`}),r6=$A.create({name:`headingParagraph`,group:`block`,content:`inline*`,defining:!0,addAttributes(){return{"data-heading":{default:`heading1`,parseHTML:e=>e.getAttribute(`data-heading`),renderHTML:e=>({"data-heading":e[`data-heading`]})}}},parseHTML(){return[{tag:`p[data-heading]`}]},renderHTML({HTMLAttributes:e}){return[`p`,rk(e),0]},addCommands(){return{toggleHeadingParagraph:()=>({commands:e,editor:t})=>t.isActive(`headingParagraph`)?e.setNode(`paragraph`):e.setNode(`headingParagraph`,{"data-heading":`heading1`})}}}),i6=e=>{if(!e)return;let t=/^calc\((.*)\)$/;if(typeof e==`string`){if(e.endsWith(`%`))return;if(e.endsWith(`px`)||e.endsWith(`vh`)||e.endsWith(`vw`)||e.endsWith(`ch`)||e.endsWith(`em`)||e.match(t))return e;let n=parseInt(e,10);return Number.isNaN(n)?n:`${n}px`}if(typeof e==`number`)return`${e}px`},a6=Vl((0,N.jsx)(`path`,{d:`M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42M10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5`}),`FormatBold`),o6=Vl((0,N.jsx)(`path`,{d:`M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z`}),`FormatItalic`),s6=Vl((0,N.jsx)(`path`,{d:`M10 19h4v-3h-4zM5 4v3h5v3h4V7h5V4zM3 14h18v-2H3z`}),`FormatStrikethrough`),c6=Vl((0,N.jsx)(`path`,{d:`M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z`}),`Code`),l6=Vl((0,N.jsx)(`path`,{d:`M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M8 20H4v-4h4zm0-6H4v-4h4zm0-6H4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4z`}),`GridOn`),u6=Vl((0,N.jsx)(`path`,{d:`M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z`}),`FormatListBulleted`),d6=Vl((0,N.jsx)(`path`,{d:`M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z`}),`FormatListNumbered`),f6=Vl((0,N.jsx)(`path`,{d:`M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6m-7 2v2h14v-2z`}),`FormatUnderlined`),p6=Vl((0,N.jsx)(`path`,{d:`M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z`}),`Functions`),m6=Vl((0,N.jsx)(`path`,{d:`M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z`}),`Image`),h6=Vl((0,N.jsx)(`path`,{d:`M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z`}),`Redo`),g6=Vl((0,N.jsx)(`path`,{d:`M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z`}),`FormatQuote`),_6=Vl((0,N.jsx)(`path`,{d:`M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3zM8 17H6v-2h2zm0-4H6v-2h2zm0-4H6V7h2zm10 8h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2z`}),`Theaters`),v6=Vl((0,N.jsx)(`path`,{d:`M3 9v6h4l5 5V4L7 9zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77`}),`VolumeUp`),y6=Vl((0,N.jsx)(`path`,{d:`M3 3v18h18V3zm8 16H5v-6h6zm0-8H5V5h6zm8 8h-6v-6h6zm0-8h-6V5h6z`}),`BorderAll`),b6=L(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans !important`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,top:`7px`,width:`110px`,height:`28px`,whiteSpace:`nowrap`})),x6=()=>(0,N.jsx)(b6,{children:`+ Response Area`}),S6={characters:[[`á`,`é`,`í`,`ó`,`ú`],[`Á`,`É`,`Í`,`Ó`,`Ú`],[`—`,`«`,`»`,`ñ`,`ü`],[`-`,`¿`,`¡`,`Ñ`,`Ü`]]},C6={hasPreview:!0,characters:[[{unicode:`U+00A2`,description:`CENT SIGN`,write:`¢`,label:`¢`},{unicode:`U+00BF`,description:`INVERTED QUESTION MARK`,write:`¿`,label:`¿`},{unicode:`U+00B4`,description:`ACUTE ACCENT`,write:`´`,label:`´`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E1`,description:`LATIN SMALL LETTER A WITH ACUTE`,write:`á`,label:`á`},{unicode:`U+00E9`,description:`LATIN SMALL LETTER E WITH ACUTE`,write:`é`,label:`é`},{unicode:`U+00ED`,description:`LATIN SMALL LETTER I WITH ACUTE`,write:`í`,label:`í`},{unicode:`U+00F3`,description:`LATIN SMALL LETTER O WITH ACUTE`,write:`ó`,label:`ó`},{unicode:`U+00FA`,description:`LATIN SMALL LETTER U WITH ACUTE`,write:`ú`,label:`ú`},{unicode:`U+00F1`,description:`LATIN SMALL LETTER N WITH TILDE`,write:`ñ`,label:`ñ`}],[{unicode:`U+20AC`,description:`EURO SIGN`,write:`€`,label:`€`},{unicode:`U+00A1`,description:`INVERTED EXCLAMATION MARK`,write:`¡`,label:`¡`},{unicode:`U+00C1`,description:`LATIN CAPITAL LETTER A WITH ACUTE`,write:`Á`,label:`Á`},{unicode:`U+00C9`,description:`LATIN CAPITAL LETTER E WITH ACUTE`,write:`É`,label:`É`},{unicode:`U+00CD`,description:`LATIN CAPITAL LETTER I WITH ACUTE`,write:`Í`,label:`Í`},{unicode:`U+00D3`,description:`LATIN CAPITAL LETTER O WITH ACUTE`,write:`Ó`,label:`Ó`},{unicode:`U+00DA`,description:`LATIN CAPITAL LETTER U WITH ACUTE`,write:`Ú`,label:`Ú`},{unicode:`U+00D1`,description:`LATIN CAPITAL LETTER N WITH TILDE`,write:`Ñ`,label:`Ñ`}],[{unicode:`U+00A3`,description:`POUND SIGN`,write:`£`,label:`£`},{unicode:`U+00AB`,description:`LEFT-POINTING DOUBLE ANGLE QUOTATION MARK`,write:`«`,label:`«`},{unicode:`U+005E`,description:`CIRCUMFLEX ACCENT`,write:`^`,label:`^`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E2`,description:`LATIN SMALL LETTER A WITH CIRCUMFLEX`,write:`â`,label:`â`},{unicode:`U+00EA`,description:`LATIN SMALL LETTER E WITH CIRCUMFLEX`,write:`ê`,label:`ê`},{unicode:`U+00EE`,description:`LATIN SMALL LETTER I WITH CIRCUMFLEX`,write:`î`,label:`î`},{unicode:`U+00F4`,description:`LATIN SMALL LETTER O WITH CIRCUMFLEX`,write:`ô`,label:`ô`},{unicode:`U+00FB`,description:`LATIN SMALL LETTER U WITH CIRCUMFLEX`,write:`û`,label:`û`},{unicode:`U+00E7`,description:`LATIN SMALL LETTER C WITH CEDILLA`,write:`ç`,label:`ç`}],[{unicode:`U+00A5`,description:`YEN SIGN`,write:`¥`,label:`¥`},{unicode:`U+00BB`,description:`RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK`,write:`»`,label:`»`},{unicode:`U+00C2`,description:`LATIN CAPITAL LETTER A WITH CIRCUMFLEX`,write:`Â`,label:`Â`},{unicode:`U+00CA`,description:`LATIN CAPITAL LETTER E WITH CIRCUMFLEX`,write:`Ê`,label:`Ê`},{unicode:`U+00CE`,description:`LATIN CAPITAL LETTER I WITH CIRCUMFLEX`,write:`Î`,label:`Î`},{unicode:`U+00D4`,description:`LATIN CAPITAL LETTER O WITH CIRCUMFLEX`,write:`Ô`,label:`Ô`},{unicode:`U+00DB`,description:`LATIN CAPITAL LETTER U WITH CIRCUMFLEX`,write:`Û`,label:`Û`},{unicode:`U+00C7`,description:`LATIN CAPITAL LETTER C WITH CEDILLA`,write:`Ç`,label:`Ç`}],[{unicode:`U+200A`,description:`HAIR SPACE`,write:String.fromCodePoint(`0x200A`),label:` `},{unicode:`U+00A7`,description:`SECTION SIGN`,write:`§`,label:`§`},{unicode:`U+00A8`,description:`DIAERESIS`,write:`¨`,label:`¨`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E4`,description:`LATIN SMALL LETTER A WITH DIAERESIS`,write:`ä`,label:`ä`},{unicode:`U+00EB`,description:`LATIN SMALL LETTER E WITH DIAERESIS`,write:`ë`,label:`ë`},{unicode:`U+00EF`,description:`LATIN SMALL LETTER I WITH DIAERESIS`,write:`ï`,label:`ï`},{unicode:`U+00F6`,description:`LATIN SMALL LETTER O WITH DIAERESIS`,write:`ö`,label:`ö`},{unicode:`U+00FC`,description:`LATIN SMALL LETTER U WITH DIAERESIS`,write:`ü`,label:`ü`},{unicode:`U+00DF`,description:`LATIN SMALL LETTER SHARP S`,write:`ß`,label:`ß`}],[{unicode:`U+2009`,description:`THIN SPACE`,write:String.fromCodePoint(`0x2009`),label:` `},{unicode:`U+2026`,description:`HORIZONTAL ELLIPSIS`,write:`…`,label:`…`},{unicode:`U+00C4`,description:`LATIN CAPITAL LETTER A WITH DIAERESIS`,write:`Ä`,label:`Ä`},{unicode:`U+00CB`,description:`LATIN CAPITAL LETTER E WITH DIAERESIS`,write:`Ë`,label:`Ë`},{unicode:`U+00CF`,description:`LATIN CAPITAL LETTER I WITH DIAERESIS`,write:`Ï`,label:`Ï`},{unicode:`U+00D6`,description:`LATIN CAPITAL LETTER O WITH DIAERESIS`,write:`Ö`,label:`Ö`},{unicode:`U+00DC`,description:`LATIN CAPITAL LETTER U WITH DIAERESIS`,write:`Ü`,label:`Ü`},{unicode:`U+2212`,description:`MINUS SIGN`,write:`−`,label:`−`}],[{unicode:`U+00A0`,description:`NO-BREAK SPACE`,write:String.fromCodePoint(`0x00A0`),label:` `},{unicode:`U+2022`,description:`BULLET`,write:`•`,label:`•`},{unicode:`U+0060`,description:`GRAVE ACCENT`,write:"`",label:"`",extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E0`,description:`LATIN SMALL LETTER A WITH GRAVE`,write:`à`,label:`à`},{unicode:`U+00E8`,description:`LATIN SMALL LETTER E WITH GRAVE`,write:`è`,label:`è`},{unicode:`U+00EC`,description:`LATIN SMALL LETTER I WITH GRAVE`,write:`ì`,label:`ì`},{unicode:`U+00F2`,description:`LATIN SMALL LETTER O WITH GRAVE`,write:`ò`,label:`ò`},{unicode:`U+00F9`,description:`LATIN SMALL LETTER U WITH GRAVE`,write:`ù`,label:`ù`},{unicode:`U+2013`,description:`EN DASH`,write:`–`,label:`–`}],[{unicode:`U+2003`,description:`EM SPACE`,write:String.fromCodePoint(`0x2003`),label:` `},{unicode:`U+25E6`,description:`WHITE BULLET`,write:`◦`,label:`◦`},{unicode:`U+00C0`,description:`LATIN CAPITAL LETTER A WITH GRAVE`,write:`À`,label:`À`},{unicode:`U+00C8`,description:`LATIN CAPITAL LETTER E WITH GRAVE`,write:`È`,label:`È`},{unicode:`U+00CC`,description:`LATIN CAPITAL LETTER I WITH GRAVE`,write:`Ì`,label:`Ì`},{unicode:`U+00D2`,description:`LATIN CAPITAL LETTER O WITH GRAVE`,write:`Ò`,label:`Ò`},{unicode:`U+00D9`,description:`LATIN CAPITAL LETTER U WITH GRAVE`,write:`Ù`,label:`Ù`},{unicode:`U+2014`,description:`EM DASH`,write:`—`,label:`—`}]]},w6=()=>(0,N.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M42.1875 4.75C42.1875 7.38672 39.9902 9.4375 37.5 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H37.5C39.9902 0.0625 42.1875 2.25977 42.1875 4.75ZM42.1875 42.25C42.1875 44.8867 39.9902 46.9375 37.5 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H37.5C39.9902 37.5625 42.1875 39.7598 42.1875 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),T6=()=>(0,N.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H28.125C25.4883 9.4375 23.4375 7.38672 23.4375 4.75C23.4375 2.25977 25.4883 0.0625 28.125 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H28.125C25.4883 46.9375 23.4375 44.8867 23.4375 42.25C23.4375 39.7598 25.4883 37.5625 28.125 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),E6=()=>(0,N.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M51.5625 4.75C51.5625 7.38672 49.3652 9.4375 46.875 9.4375H18.75C16.1133 9.4375 14.0625 7.38672 14.0625 4.75C14.0625 2.25977 16.1133 0.0625 18.75 0.0625H46.875C49.3652 0.0625 51.5625 2.25977 51.5625 4.75ZM65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5ZM0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61ZM51.5625 42.25C51.5625 44.8867 49.3652 46.9375 46.875 46.9375H18.75C16.1133 46.9375 14.0625 44.8867 14.0625 42.25C14.0625 39.7598 16.1133 37.5625 18.75 37.5625H46.875C49.3652 37.5625 51.5625 39.7598 51.5625 42.25Z`,fill:`currentColor`})}),D6=()=>(0,N.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),O6=({editor:e,onChange:t})=>{let[n,r]=(0,M.useState)(!1),i;switch(!0){case e.isActive({textAlign:`right`}):i=(0,N.jsx)(T6,{});break;case e.isActive({textAlign:`center`}):i=(0,N.jsx)(E6,{});break;case e.isActive({textAlign:`justify`}):i=(0,N.jsx)(D6,{});break;default:i=(0,N.jsx)(w6,{});break}let a=t=>{let n=t.currentTarget?.getAttribute(`value`);n&&e.commands.setTextAlign(n),r(!1)};return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>{e.preventDefault(),e.stopPropagation(),r(!n)},children:[i,(0,N.jsx)(`span`,{style:{marginLeft:`5px`,fontSize:`8px`},"aria-hidden":`true`,children:`▼`})]}),(0,N.jsx)(Ad,{in:n,timeout:`auto`,unmountOnExit:!0,style:{position:`absolute`},children:(0,N.jsxs)(Op,{component:`div`,disablePadding:!0,style:{background:`#fff`,display:`flex`,flexDirection:`row`,padding:0},children:[(0,N.jsx)(v3,{button:!0,type:`submit`,value:`left`,"aria-label":`Align text left`,onClick:a,children:(0,N.jsx)(w6,{})}),(0,N.jsx)(v3,{button:!0,type:`submit`,value:`center`,"aria-label":`Align text center`,onClick:a,children:(0,N.jsx)(E6,{})}),(0,N.jsx)(v3,{button:!0,type:`submit`,value:`right`,"aria-label":`Align text right`,onClick:a,children:(0,N.jsx)(T6,{})}),(0,N.jsx)(v3,{button:!0,type:`submit`,value:`justify`,"aria-label":`Justify text`,onClick:a,children:(0,N.jsx)(D6,{})})]})})]})},k6=L(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans, Arial, sans-serif`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,whiteSpace:`nowrap`})),A6=()=>(0,N.jsx)(k6,{children:`CSS`}),j6=L(`path`)({fill:`grey`,"&:hover":{fill:`black`}}),M6=e=>t=>(0,N.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,version:`1.1`,width:`24`,height:`24`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(e,{...t})}),N6=M6(e=>(0,N.jsx)(j6,{...e,d:`M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z`})),P6=M6(e=>(0,N.jsx)(j6,{...e,d:`M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z`})),F6=M6(e=>(0,N.jsx)(j6,{...e,d:`M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z`})),I6=M6(e=>(0,N.jsx)(j6,{...e,d:`M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z`})),L6=M6(e=>(0,N.jsx)(j6,{...e,d:`M15.46,15.88L16.88,14.46L19,16.59L21.12,14.46L22.54,15.88L20.41,18L22.54,20.12L21.12,21.54L19,19.41L16.88,21.54L15.46,20.12L17.59,18L15.46,15.88M4,3H18A2,2 0 0,1 20,5V12.08C18.45,11.82 16.92,12.18 15.68,13H12V17H13.08C12.97,17.68 12.97,18.35 13.08,19H4A2,2 0 0,1 2,17V5A2,2 0 0,1 4,3M4,7V11H10V7H4M12,7V11H18V7H12M4,13V17H10V13H4Z`})),R6=`bottom`,z6=`right`,B6=`left`,V6=`auto`,H6=[`top`,R6,z6,B6],U6=`start`,W6=`clippingParents`,G6=`viewport`,K6=`popper`,q6=`reference`,J6=H6.reduce(function(e,t){return e.concat([t+`-`+U6,t+`-end`])},[]),Y6=[].concat(H6,[V6]).reduce(function(e,t){return e.concat([t,t+`-`+U6,t+`-end`])},[]),X6=[`beforeRead`,`read`,`afterRead`,`beforeMain`,`main`,`afterMain`,`beforeWrite`,`write`,`afterWrite`];function Z6(e){return e?(e.nodeName||``).toLowerCase():null}function Q6(e){if(e==null)return window;if(e.toString()!==`[object Window]`){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function $6(e){return e instanceof Q6(e).Element||e instanceof Element}function e8(e){return e instanceof Q6(e).HTMLElement||e instanceof HTMLElement}function t8(e){return typeof ShadowRoot>`u`?!1:e instanceof Q6(e).ShadowRoot||e instanceof ShadowRoot}function n8(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];!e8(i)||!Z6(i)||(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];t===!1?i.removeAttribute(e):i.setAttribute(e,t===!0?``:t)}))})}function r8(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]=``,e},{});!e8(r)||!Z6(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}}var i8={name:`applyStyles`,enabled:!0,phase:`write`,fn:n8,effect:r8,requires:[`computeStyles`]};function a8(e){return e.split(`-`)[0]}var o8=Math.max,s8=Math.min,c8=Math.round;function l8(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+`/`+e.version}).join(` `):navigator.userAgent}function u8(){return!/^((?!chrome|android).)*safari/i.test(l8())}function d8(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,a=1;t&&e8(e)&&(i=e.offsetWidth>0&&c8(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&c8(r.height)/e.offsetHeight||1);var o=($6(e)?Q6(e):window).visualViewport,s=!u8()&&n,c=(r.left+(s&&o?o.offsetLeft:0))/i,l=(r.top+(s&&o?o.offsetTop:0))/a,u=r.width/i,d=r.height/a;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c,x:c,y:l}}function f8(e){var t=d8(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function p8(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&t8(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function m8(e){return Q6(e).getComputedStyle(e)}function h8(e){return[`table`,`td`,`th`].indexOf(Z6(e))>=0}function g8(e){return(($6(e)?e.ownerDocument:e.document)||window.document).documentElement}function _8(e){return Z6(e)===`html`?e:e.assignedSlot||e.parentNode||(t8(e)?e.host:null)||g8(e)}function v8(e){return!e8(e)||m8(e).position===`fixed`?null:e.offsetParent}function y8(e){var t=/firefox/i.test(l8());if(/Trident/i.test(l8())&&e8(e)&&m8(e).position===`fixed`)return null;var n=_8(e);for(t8(n)&&(n=n.host);e8(n)&&[`html`,`body`].indexOf(Z6(n))<0;){var r=m8(n);if(r.transform!==`none`||r.perspective!==`none`||r.contain===`paint`||[`transform`,`perspective`].indexOf(r.willChange)!==-1||t&&r.willChange===`filter`||t&&r.filter&&r.filter!==`none`)return n;n=n.parentNode}return null}function b8(e){for(var t=Q6(e),n=v8(e);n&&h8(n)&&m8(n).position===`static`;)n=v8(n);return n&&(Z6(n)===`html`||Z6(n)===`body`&&m8(n).position===`static`)?t:n||y8(e)||t}function x8(e){return[`top`,`bottom`].indexOf(e)>=0?`x`:`y`}function S8(e,t,n){return o8(e,s8(t,n))}function C8(e,t,n){var r=S8(e,t,n);return r>n?n:r}function w8(){return{top:0,right:0,bottom:0,left:0}}function T8(e){return Object.assign({},w8(),e)}function E8(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var D8=function(e,t){return e=typeof e==`function`?e(Object.assign({},t.rects,{placement:t.placement})):e,T8(typeof e==`number`?E8(e,H6):e)};function O8(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,s=a8(n.placement),c=x8(s),l=[`left`,`right`].indexOf(s)>=0?`height`:`width`;if(!(!a||!o)){var u=D8(i.padding,n),d=f8(a),f=c===`y`?`top`:B6,p=c===`y`?R6:z6,m=n.rects.reference[l]+n.rects.reference[c]-o[c]-n.rects.popper[l],h=o[c]-n.rects.reference[c],g=b8(a),_=g?c===`y`?g.clientHeight||0:g.clientWidth||0:0,v=m/2-h/2,y=u[f],b=_-d[l]-u[p],x=_/2-d[l]/2+v,S=S8(y,x,b),C=c;n.modifiersData[r]=(t={},t[C]=S,t.centerOffset=S-x,t)}}function k8(e){var t=e.state,n=e.options.element,r=n===void 0?`[data-popper-arrow]`:n;r!=null&&(typeof r==`string`&&(r=t.elements.popper.querySelector(r),!r)||p8(t.elements.popper,r)&&(t.elements.arrow=r))}var A8={name:`arrow`,enabled:!0,phase:`main`,fn:O8,effect:k8,requires:[`popperOffsets`],requiresIfExists:[`preventOverflow`]};function j8(e){return e.split(`-`)[1]}var M8={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};function N8(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:c8(n*i)/i||0,y:c8(r*i)/i||0}}function P8(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,o=e.offsets,s=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,p=f===void 0?0:f,m=o.y,h=m===void 0?0:m,g=typeof u==`function`?u({x:p,y:h}):{x:p,y:h};p=g.x,h=g.y;var _=o.hasOwnProperty(`x`),v=o.hasOwnProperty(`y`),y=B6,b=`top`,x=window;if(l){var S=b8(n),C=`clientHeight`,w=`clientWidth`;if(S===Q6(n)&&(S=g8(n),m8(S).position!==`static`&&s===`absolute`&&(C=`scrollHeight`,w=`scrollWidth`)),S=S,i===`top`||(i===`left`||i===`right`)&&a===`end`){b=R6;var T=d&&S===x&&x.visualViewport?x.visualViewport.height:S[C];h-=T-r.height,h*=c?1:-1}if(i===`left`||(i===`top`||i===`bottom`)&&a===`end`){y=z6;var E=d&&S===x&&x.visualViewport?x.visualViewport.width:S[w];p-=E-r.width,p*=c?1:-1}}var D=Object.assign({position:s},l&&M8),O=u===!0?N8({x:p,y:h},Q6(n)):{x:p,y:h};if(p=O.x,h=O.y,c){var ee;return Object.assign({},D,(ee={},ee[b]=v?`0`:``,ee[y]=_?`0`:``,ee.transform=(x.devicePixelRatio||1)<=1?`translate(`+p+`px, `+h+`px)`:`translate3d(`+p+`px, `+h+`px, 0)`,ee))}return Object.assign({},D,(t={},t[b]=v?h+`px`:``,t[y]=_?p+`px`:``,t.transform=``,t))}function F8(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0||r,a=n.adaptive,o=a===void 0||a,s=n.roundOffsets,c=s===void 0||s,l={placement:a8(t.placement),variation:j8(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy===`fixed`};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,P8(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,P8(Object.assign({},l,{offsets:t.modifiersData.arrow,position:`absolute`,adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var I8={name:`computeStyles`,enabled:!0,phase:`beforeWrite`,fn:F8,data:{}},L8={passive:!0};function R8(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0||i,o=r.resize,s=o===void 0||o,c=Q6(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&l.forEach(function(e){e.addEventListener(`scroll`,n.update,L8)}),s&&c.addEventListener(`resize`,n.update,L8),function(){a&&l.forEach(function(e){e.removeEventListener(`scroll`,n.update,L8)}),s&&c.removeEventListener(`resize`,n.update,L8)}}var z8={name:`eventListeners`,enabled:!0,phase:`write`,fn:function(){},effect:R8,data:{}},B8={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function V8(e){return e.replace(/left|right|bottom|top/g,function(e){return B8[e]})}var H8={start:`end`,end:`start`};function U8(e){return e.replace(/start|end/g,function(e){return H8[e]})}function W8(e){var t=Q6(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function G8(e){return d8(g8(e)).left+W8(e).scrollLeft}function K8(e,t){var n=Q6(e),r=g8(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;var l=u8();(l||!l&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s+G8(e),y:c}}function q8(e){var t=g8(e),n=W8(e),r=e.ownerDocument?.body,i=o8(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=o8(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),o=-n.scrollLeft+G8(e),s=-n.scrollTop;return m8(r||t).direction===`rtl`&&(o+=o8(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:o,y:s}}function J8(e){var t=m8(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Y8(e){return[`html`,`body`,`#document`].indexOf(Z6(e))>=0?e.ownerDocument.body:e8(e)&&J8(e)?e:Y8(_8(e))}function X8(e,t){t===void 0&&(t=[]);var n=Y8(e),r=n===e.ownerDocument?.body,i=Q6(n),a=r?[i].concat(i.visualViewport||[],J8(n)?n:[]):n,o=t.concat(a);return r?o:o.concat(X8(_8(a)))}function Z8(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Q8(e,t){var n=d8(e,!1,t===`fixed`);return n.top+=e.clientTop,n.left+=e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function $8(e,t,n){return t===`viewport`?Z8(K8(e,n)):$6(t)?Q8(t,n):Z8(q8(g8(e)))}function e5(e){var t=X8(_8(e)),n=[`absolute`,`fixed`].indexOf(m8(e).position)>=0&&e8(e)?b8(e):e;return $6(n)?t.filter(function(e){return $6(e)&&p8(e,n)&&Z6(e)!==`body`}):[]}function t5(e,t,n,r){var i=t===`clippingParents`?e5(e):[].concat(t),a=[].concat(i,[n]),o=a[0],s=a.reduce(function(t,n){var i=$8(e,n,r);return t.top=o8(i.top,t.top),t.right=s8(i.right,t.right),t.bottom=s8(i.bottom,t.bottom),t.left=o8(i.left,t.left),t},$8(e,o,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function n5(e){var t=e.reference,n=e.element,r=e.placement,i=r?a8(r):null,a=r?j8(r):null,o=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,c;switch(i){case`top`:c={x:o,y:t.y-n.height};break;case R6:c={x:o,y:t.y+t.height};break;case z6:c={x:t.x+t.width,y:s};break;case B6:c={x:t.x-n.width,y:s};break;default:c={x:t.x,y:t.y}}var l=i?x8(i):null;if(l!=null){var u=l===`y`?`height`:`width`;switch(a){case U6:c[l]=c[l]-(t[u]/2-n[u]/2);break;case`end`:c[l]=c[l]+(t[u]/2-n[u]/2);break;default:}}return c}function r5(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.strategy,o=a===void 0?e.strategy:a,s=n.boundary,c=s===void 0?W6:s,l=n.rootBoundary,u=l===void 0?G6:l,d=n.elementContext,f=d===void 0?K6:d,p=n.altBoundary,m=p!==void 0&&p,h=n.padding,g=h===void 0?0:h,_=T8(typeof g==`number`?E8(g,H6):g),v=f===`popper`?q6:K6,y=e.rects.popper,b=e.elements[m?v:f],x=t5($6(b)?b:b.contextElement||g8(e.elements.popper),c,u,o),S=d8(e.elements.reference),C=n5({reference:S,element:y,strategy:`absolute`,placement:i}),w=Z8(Object.assign({},y,C)),T=f===`popper`?w:S,E={top:x.top-T.top+_.top,bottom:T.bottom-x.bottom+_.bottom,left:x.left-T.left+_.left,right:T.right-x.right+_.right},D=e.modifiersData.offset;if(f===`popper`&&D){var O=D[i];Object.keys(E).forEach(function(e){var t=[`right`,`bottom`].indexOf(e)>=0?1:-1,n=[`top`,`bottom`].indexOf(e)>=0?`y`:`x`;E[e]+=O[n]*t})}return E}function i5(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,o=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?Y6:c,u=j8(r),d=u?s?J6:J6.filter(function(e){return j8(e)===u}):H6,f=d.filter(function(e){return l.indexOf(e)>=0});f.length===0&&(f=d);var p=f.reduce(function(t,n){return t[n]=r5(e,{placement:n,boundary:i,rootBoundary:a,padding:o})[a8(n)],t},{});return Object.keys(p).sort(function(e,t){return p[e]-p[t]})}function a5(e){if(a8(e)===`auto`)return[];var t=V8(e);return[U8(e),t,U8(t)]}function o5(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o===void 0||o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,m=p===void 0||p,h=n.allowedAutoPlacements,g=t.options.placement,_=a8(g)===g,v=c||(_||!m?[V8(g)]:a5(g)),y=[g].concat(v).reduce(function(e,n){return e.concat(a8(n)===`auto`?i5(t,{placement:n,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:h}):n)},[]),b=t.rects.reference,x=t.rects.popper,S=new Map,C=!0,w=y[0],T=0;T<y.length;T++){var E=y[T],D=a8(E),O=j8(E)===U6,ee=[`top`,R6].indexOf(D)>=0,te=ee?`width`:`height`,k=r5(t,{placement:E,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),A=ee?O?z6:B6:O?R6:`top`;b[te]>x[te]&&(A=V8(A));var ne=V8(A),j=[];if(a&&j.push(k[D]<=0),s&&j.push(k[A]<=0,k[ne]<=0),j.every(function(e){return e})){w=E,C=!1;break}S.set(E,j)}if(C)for(var re=m?3:1,ie=function(e){var t=y.find(function(t){var n=S.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return w=t,`break`},ae=re;ae>0&&ie(ae)!==`break`;ae--);t.placement!==w&&(t.modifiersData[r]._skip=!0,t.placement=w,t.reset=!0)}}var s5={name:`flip`,enabled:!0,phase:`main`,fn:o5,requiresIfExists:[`offset`],data:{_skip:!1}};function c5(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function l5(e){return[`top`,z6,R6,B6].some(function(t){return e[t]>=0})}function u5(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,o=r5(t,{elementContext:`reference`}),s=r5(t,{altBoundary:!0}),c=c5(o,r),l=c5(s,i,a),u=l5(c),d=l5(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var d5={name:`hide`,enabled:!0,phase:`main`,requiresIfExists:[`preventOverflow`],fn:u5};function f5(e,t,n){var r=a8(e),i=[`left`,`top`].indexOf(r)>=0?-1:1,a=typeof n==`function`?n(Object.assign({},t,{placement:e})):n,o=a[0],s=a[1];return o||=0,s=(s||0)*i,[`left`,`right`].indexOf(r)>=0?{x:s,y:o}:{x:o,y:s}}function p5(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,o=Y6.reduce(function(e,n){return e[n]=f5(n,t.rects,a),e},{}),s=o[t.placement],c=s.x,l=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}var m5={name:`offset`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:p5};function h5(e){var t=e.state,n=e.name;t.modifiersData[n]=n5({reference:t.rects.reference,element:t.rects.popper,strategy:`absolute`,placement:t.placement})}var g5={name:`popperOffsets`,enabled:!0,phase:`read`,fn:h5,data:{}};function _5(e){return e===`x`?`y`:`x`}function v5(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o!==void 0&&o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0||f,m=n.tetherOffset,h=m===void 0?0:m,g=r5(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),_=a8(t.placement),v=j8(t.placement),y=!v,b=x8(_),x=_5(b),S=t.modifiersData.popperOffsets,C=t.rects.reference,w=t.rects.popper,T=typeof h==`function`?h(Object.assign({},t.rects,{placement:t.placement})):h,E=typeof T==`number`?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),D=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(S){if(a){var ee=b===`y`?`top`:B6,te=b===`y`?R6:z6,k=b===`y`?`height`:`width`,A=S[b],ne=A+g[ee],j=A-g[te],re=p?-w[k]/2:0,ie=v===`start`?C[k]:w[k],ae=v===`start`?-w[k]:-C[k],oe=t.elements.arrow,se=p&&oe?f8(oe):{width:0,height:0},ce=t.modifiersData[`arrow#persistent`]?t.modifiersData[`arrow#persistent`].padding:w8(),le=ce[ee],ue=ce[te],de=S8(0,C[k],se[k]),fe=y?C[k]/2-re-de-le-E.mainAxis:ie-de-le-E.mainAxis,pe=y?-C[k]/2+re+de+ue+E.mainAxis:ae+de+ue+E.mainAxis,me=t.elements.arrow&&b8(t.elements.arrow),he=me?b===`y`?me.clientTop||0:me.clientLeft||0:0,ge=D?.[b]??0,_e=A+fe-ge-he,ve=A+pe-ge,ye=S8(p?s8(ne,_e):ne,A,p?o8(j,ve):j);S[b]=ye,O[b]=ye-A}if(s){var be=b===`x`?`top`:B6,xe=b===`x`?R6:z6,Se=S[x],Ce=x===`y`?`height`:`width`,we=Se+g[be],Te=Se-g[xe],Ee=[`top`,B6].indexOf(_)!==-1,De=D?.[x]??0,Oe=Ee?we:Se-C[Ce]-w[Ce]-De+E.altAxis,ke=Ee?Se+C[Ce]+w[Ce]-De-E.altAxis:Te,Ae=p&&Ee?C8(Oe,Se,ke):S8(p?Oe:we,Se,p?ke:Te);S[x]=Ae,O[x]=Ae-Se}t.modifiersData[r]=O}}var y5={name:`preventOverflow`,enabled:!0,phase:`main`,fn:v5,requiresIfExists:[`offset`]};function b5(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function x5(e){return e===Q6(e)||!e8(e)?W8(e):b5(e)}function S5(e){var t=e.getBoundingClientRect(),n=c8(t.width)/e.offsetWidth||1,r=c8(t.height)/e.offsetHeight||1;return n!==1||r!==1}function C5(e,t,n){n===void 0&&(n=!1);var r=e8(t),i=e8(t)&&S5(t),a=g8(t),o=d8(e,i,n),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Z6(t)!==`body`||J8(a))&&(s=x5(t)),e8(t)?(c=d8(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=G8(a))),{x:o.left+s.scrollLeft-c.x,y:o.top+s.scrollTop-c.y,width:o.width,height:o.height}}function w5(e){var t=new Map,n=new Set,r=[];e.forEach(function(e){t.set(e.name,e)});function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}}),r.push(e)}return e.forEach(function(e){n.has(e.name)||i(e)}),r}function T5(e){var t=w5(e);return X6.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}function E5(e){var t;return function(){return t||=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})}),t}}function D5(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}var O5={placement:`bottom`,modifiers:[],strategy:`absolute`};function k5(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&typeof e.getBoundingClientRect==`function`)})}function A5(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?O5:i;return function(e,t,n){n===void 0&&(n=a);var i={placement:`bottom`,orderedModifiers:[],options:Object.assign({},O5,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},o=[],s=!1,c={state:i,setOptions:function(n){var o=typeof n==`function`?n(i.options):n;u(),i.options=Object.assign({},a,i.options,o),i.scrollParents={reference:$6(e)?X8(e):e.contextElement?X8(e.contextElement):[],popper:X8(t)};var s=T5(D5([].concat(r,i.options.modifiers)));return i.orderedModifiers=s.filter(function(e){return e.enabled}),l(),c.update()},forceUpdate:function(){if(!s){var e=i.elements,t=e.reference,n=e.popper;if(k5(t,n)){i.rects={reference:C5(t,b8(n),i.options.strategy===`fixed`),popper:f8(n)},i.reset=!1,i.placement=i.options.placement,i.orderedModifiers.forEach(function(e){return i.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<i.orderedModifiers.length;r++){if(i.reset===!0){i.reset=!1,r=-1;continue}var a=i.orderedModifiers[r],o=a.fn,l=a.options,u=l===void 0?{}:l,d=a.name;typeof o==`function`&&(i=o({state:i,options:u,name:d,instance:c})||i)}}}},update:E5(function(){return new Promise(function(e){c.forceUpdate(),e(i)})}),destroy:function(){u(),s=!0}};if(!k5(e,t))return c;c.setOptions(n).then(function(e){!s&&n.onFirstUpdate&&n.onFirstUpdate(e)});function l(){i.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=n===void 0?{}:n,a=e.effect;if(typeof a==`function`){var s=a({state:i,name:t,instance:c,options:r});o.push(s||function(){})}})}function u(){o.forEach(function(e){return e()}),o=[]}return c}}var j5=A5({defaultModifiers:[z8,g5,I8,i8,m5,s5,y5,A8,d5]});function M5(e){return F(`MuiPopper`,e)}mi(`MuiPopper`,[`root`]);function N5(e,t){if(t===`ltr`)return e;switch(e){case`bottom-end`:return`bottom-start`;case`bottom-start`:return`bottom-end`;case`top-end`:return`top-start`;case`top-start`:return`top-end`;default:return e}}function P5(e){return typeof e==`function`?e():e}function F5(e){return e.nodeType!==void 0}var I5=e=>{let{classes:t}=e;return Fa({root:[`root`]},M5,t)},L5={},R5=M.forwardRef(function(e,t){let{anchorEl:n,children:r,direction:i,disablePortal:a,modifiers:o,open:s,placement:c,popperOptions:l,popperRef:u,slotProps:d={},slots:f={},TransitionProps:p,ownerState:m,...h}=e,g=M.useRef(null),_=Oc(g,t),v=M.useRef(null),y=Oc(v,u),b=M.useRef(y);Oi(()=>{b.current=y},[y]),M.useImperativeHandle(u,()=>v.current,[]);let x=N5(c,i),[S,C]=M.useState(x),[w,T]=M.useState(P5(n));M.useEffect(()=>{v.current&&v.current.forceUpdate()}),M.useEffect(()=>{n&&T(P5(n))},[n]),Oi(()=>{if(!w||!s)return;let e=e=>{C(e.placement)},t=[{name:`preventOverflow`,options:{altBoundary:a}},{name:`flip`,options:{altBoundary:a}},{name:`onUpdate`,enabled:!0,phase:`afterWrite`,fn:({state:t})=>{e(t)}}];o!=null&&(t=t.concat(o)),l&&l.modifiers!=null&&(t=t.concat(l.modifiers));let n=j5(w,g.current,{placement:x,...l,modifiers:t});b.current(n);let r=g.current;return()=>{if(r){let{style:e}=r,t=e.position,i=e.top,a=e.left,o=e.transform;n.destroy(),e.position=t,e.top=i,e.left=a,e.transform=o}else n.destroy();b.current(null)}},[w,a,o,s,l,x]);let E={placement:S};p!==null&&(E.TransitionProps=p);let D=I5(e),O=f.root??`div`;return(0,N.jsx)(O,{...Cp({elementType:O,externalSlotProps:d.root,externalForwardedProps:h,additionalProps:{role:`tooltip`,ref:_},ownerState:e,className:D.root}),children:typeof r==`function`?r(E):r})}),z5=L(M.forwardRef(function(e,t){let{anchorEl:n,children:r,container:i,direction:a=`ltr`,disablePortal:o=!1,keepMounted:s=!1,modifiers:c,open:l,placement:u=`bottom`,popperOptions:d=L5,popperRef:f,style:p,transition:m=!1,slotProps:h={},slots:g={},..._}=e,[v,y]=M.useState(!0),b=()=>{y(!1)},x=()=>{y(!0)};if(!s&&!l&&(!m||v))return null;let S;if(i)S=i;else if(n){let e=P5(n);S=e&&F5(e)?mc(e).body:mc(null).body}let C=!l&&s&&(!m||v)?`none`:void 0,w=m?{in:l,onEnter:b,onExited:x}:void 0;return(0,N.jsx)(al,{disablePortal:o,container:S,children:(0,N.jsx)(R5,{anchorEl:n,direction:a,disablePortal:o,modifiers:c,ref:t,open:m?!v:l,placement:u,popperOptions:d,popperRef:f,slotProps:h,slots:g,..._,style:{position:`fixed`,top:0,left:0,display:C,...p},TransitionProps:w,children:r})})}),{name:`MuiPopper`,slot:`Root`})({}),B5=L(M.forwardRef(function(e,t){let n=ea(),{anchorEl:r,component:i,components:a,componentsProps:o,container:s,disablePortal:c,keepMounted:l,modifiers:u,open:d,placement:f,popperOptions:p,popperRef:m,transition:h,slots:g,slotProps:_,...v}=dc({props:e,name:`MuiPopper`}),y=g?.root??a?.Root,b={anchorEl:r,container:s,disablePortal:c,keepMounted:l,modifiers:u,open:d,placement:f,popperOptions:p,popperRef:m,transition:h,...v};return(0,N.jsx)(z5,{as:i,direction:n?`rtl`:`ltr`,slots:{root:y},slotProps:_??o,...b,ref:t})}))({background:`#fff`,padding:`10px`,pointerEvents:`none`,zIndex:99999}),V5=L(L$)({fontSize:50,textAlign:`center`}),H5=({children:e,...t})=>(0,N.jsx)(B5,{id:`mouse-over-popover`,open:!0,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},disableRestoreFocus:!0,disableAutoFocus:!0,...t,children:(0,N.jsx)(V5,{children:e})}),U5=({letter:e})=>(0,N.jsx)(`div`,{style:{fontSize:`24px`,lineHeight:`24px`},children:e});U5.propTypes={letter:k.string};function W5({editor:e,opts:t,onClose:n}){if(!t?.characters?.length)return null;let r=(0,M.useRef)(null),i=(0,M.useRef)(n),[a,o]=(0,M.useState)({top:0,left:0}),[s,c]=(0,M.useState)(null);i.current=n;let l=(0,M.useMemo)(()=>{if(!t)return S6;switch(!0){case t.language===`spanish`:return S6;case t.language===`special`:return C6;default:return t}},[t]),u=(0,M.useMemo)(()=>l.characters.reduce((e,t)=>(t.length>=e.columns&&(e.columns=t.length),e),{rows:l.characters.length,columns:0}),[l]),d=()=>c(null);(0,M.useEffect)(()=>()=>{d()},[]),(0,M.useEffect)(()=>{if(!e)return;let t=e.options.element,n=e.view.dom,a=()=>{if(!r.current)return;let n=t.getBoundingClientRect(),{from:i}=e.state.selection,a=e.view.coordsAtPos(i),s=r.current.offsetHeight,c=r.current.offsetWidth,l=window.innerHeight-(n.bottom+60)>=s||n.top<s+80?n.bottom+60:n.top-s-20,u=a.left;l=Math.max(8,Math.min(l,window.innerHeight-s-8)),u=Math.max(8,Math.min(u,window.innerWidth-c-8)),o({top:l,left:u})};a();let s=null,c=()=>{s===null&&(s=requestAnimationFrame(()=>{s=null,a()}))};window.addEventListener(`scroll`,c,!0),window.addEventListener(`resize`,c);let l=e=>{r.current&&!r.current.contains(e.target)&&!n.contains(e.target)&&i.current()},u=setTimeout(()=>{document.addEventListener(`click`,l)});return()=>{clearTimeout(u),s!==null&&cancelAnimationFrame(s),window.removeEventListener(`scroll`,c,!0),window.removeEventListener(`resize`,c),document.removeEventListener(`click`,l)}},[e]);let f=(e,t)=>c({anchorEl:e.currentTarget,el:t});return(0,N.jsxs)(N.Fragment,{children:[hs.createPortal((0,N.jsx)(`div`,{ref:r,className:`insert-character-dialog`,"data-toolbar-for":e.instanceId,style:{visibility:a.top===0&&a.left===0?`hidden`:`initial`,position:`fixed`,top:`${a.top}px`,left:`${a.left}px`,maxWidth:`500px`,zIndex:1e3},children:(0,N.jsx)(`div`,{children:(0,N.jsx)(L0,{keyPadCharacterRef:t.keyPadCharacterRef,setKeypadInteraction:t.setKeypadInteraction,autoFocus:!0,noDecimal:!0,hideInput:!0,noLatexHandling:!0,hideDoneButtonBackground:!0,layoutForKeyPad:u,additionalKeys:l.characters.reduce((e,t)=>(e=[...e,...t.map(e=>({name:oe(e,`name`)||e,write:oe(e,`write`)||e,label:oe(e,`label`)||e,category:`character`,extraClass:`character`,extraProps:{...e.extraProps||{},style:{...(e.extraProps||{}).style,border:`1px solid #000`}},...l.hasPreview?{actions:{onMouseEnter:t=>f(t,e),onMouseLeave:d}}:{}}))],e),[]),keypadMode:`language`,onChange:t=>{typeof t==`string`&&e.chain().focus().insertContent(t).run()},onDone:n})})}),document.body),s&&hs.createPortal((0,N.jsxs)(H5,{onClose:d,anchorEl:s.anchorEl,children:[(0,N.jsx)(`div`,{children:s.el.label}),(0,N.jsx)(`div`,{style:{fontSize:20,lineHeight:`20px`},children:s.el.description}),(0,N.jsx)(`div`,{style:{fontSize:20,lineHeight:`20px`},children:s.el.unicode})]}),document.body)]})}W5.propTypes={editor:k.object,opts:k.object,onClose:k.func.isRequired};var G5=()=>(0,N.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M22,7h-2v1h3v1h-4V7c0-0.55,0.45-1,1-1h2V5h-3V4h3c0.55,0,1,0.45,1,1v1C23,6.55,22.55,7,22,7z M5.88,20h2.66l3.4-5.42h0.12 l3.4,5.42h2.66l-4.65-7.27L17.81,6h-2.68l-3.07,4.99h-0.12L8.85,6H6.19l4.32,6.73L5.88,20z`,fill:`currentColor`})}),K5=()=>(0,N.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M22,18h-2v1h3v1h-4v-2c0-0.55,0.45-1,1-1h2v-1h-3v-1h3c0.55,0,1,0.45,1,1v1C23,17.55,22.55,18,22,18z M5.88,18h2.66 l3.4-5.42h0.12l3.4,5.42h2.66l-4.65-7.27L17.81,4h-2.68l-3.07,4.99h-0.12L8.85,4H6.19l4.32,6.73L5.88,18z`,fill:`currentColor`})}),q5=()=>(0,N.jsx)(`svg`,{width:`30`,height:`28`,viewBox:`0 0 30 28`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{width:`20px`,height:`18px`},"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M27 4V24H29C29.5 24 30 24.5 30 25V27C30 27.5625 29.5 28 29 28H19C18.4375 28 18 27.5625 18 27V25C18 24.5 18.4375 24 19 24H21V16H9V24H11C11.5 24 12 24.5 12 25V27C12 27.5625 11.5 28 11 28H1C0.4375 28 0 27.5625 0 27V25C0 24.5 0.4375 24 1 24H3V4H1C0.4375 4 0 3.5625 0 3V1C0 0.5 0.4375 0 1 0H11C11.5 0 12 0.5 12 1V3C12 3.5625 11.5 4 11 4H9V12H21V4H19C18.4375 4 18 3.5625 18 3V1C18 0.5 18.4375 0 19 0H29C29.5 0 30 0.5 30 1V3C30 3.5625 29.5 4 29 4H27Z`,fill:`currentColor`})});function J5({editor:e,classes:t,activePlugins:n,toolbarOpts:r,responseAreaProps:i,onChange:a,autoWidthToolbar:o}){let[s,c]=(0,M.useState)(!1),l=r??{},u=uM({editor:e,selector:e=>{let{selection:t}=e.editor?.state||{},n;if(!e.editor?.commandManager)return{};t instanceof W&&(n=t.node);let r=e.editor?.isActive(`math`)||e.editor?.isActive(`explicit_constructed_response`)||e.editor?.isActive(`imageUploadNode`)||e.editor?.isActive(`drag_in_the_blank`),i=t&&t.empty===!1&&e.editor.isActive(`table`);return{currentNode:n,hideDefaultToolbar:r,hasTextSelectionInTable:i,isFocused:e.editor?.isFocused,toolbarOpened:e.editor?._toolbarOpened??!1,isBold:e.editor.isActive(`bold`)??!1,canBold:e.editor.can().chain().toggleBold().run()??!1,isTable:e.editor.isActive(`table`)??!1,tableHasBorder:e.editor.getAttributes(`table`)?.border===`1`,canTable:e.editor.can().chain().insertTable().run()??!1,isItalic:e.editor.isActive(`italic`)??!1,canItalic:e.editor.can().chain().toggleItalic().run()??!1,isStrike:e.editor.isActive(`strike`)??!1,canStrike:e.editor.can().chain().toggleStrike().run()??!1,isCode:e.editor.isActive(`code`)??!1,canCode:e.editor.can().chain().toggleCode().run()??!1,canClearMarks:e.editor.can().chain().unsetAllMarks().run()??!1,isUnderline:e.editor.isActive(`underline`)??!1,isSubScript:e.editor.isActive(`subscript`)??!1,isSuperScript:e.editor.isActive(`superscript`)??!1,isParagraph:e.editor.isActive(`paragraph`)??!1,isHeading1:e.editor.isActive(`heading`,{level:1})??!1,isHeading2:e.editor.isActive(`heading`,{level:2})??!1,isHeading3:e.editor.isActive(`heading`,{level:3})??!1,isHeadingParagraph:e.editor.isActive(`headingParagraph`)??!1,isHeading4:e.editor.isActive(`heading`,{level:4})??!1,isHeading5:e.editor.isActive(`heading`,{level:5})??!1,isHeading6:e.editor.isActive(`heading`,{level:6})??!1,isBulletList:e.editor.isActive(`bulletList`)??!1,isOrderedList:e.editor.isActive(`orderedList`)??!1,isCodeBlock:e.editor.isActive(`codeBlock`)??!1,isBlockquote:e.editor.isActive(`blockquote`)??!1,canUndo:e.editor.can().chain().undo().run()??!1,canRedo:e.editor.can().chain().redo().run()??!1}}}),d=!!o,f=P(t.toolbar,$q,{[t.toolbarWithNoDone]:!0,[t.toolbarTop]:l.position===`top`,[t.toolbarRight]:l.alignment===`right`,[t.focused]:l.alwaysVisible||u.isFocused&&!u.toolbarOpened&&!u.hideDefaultToolbar,[t.autoWidth]:d,[t.fullWidth]:!d,[t.hidden]:l.isHidden===!0}),p=l.minWidth===void 0?{}:{minWidth:l.minWidth},m=e=>{e.preventDefault()},h=(0,M.useMemo)(()=>[{icon:(0,N.jsx)(l6,{}),label:`Insert table`,onClick:e=>e.chain().focus().insertTable({rows:2,cols:2,withHeaderRow:!1}).run(),hidden:e=>!n?.includes(`table`)||e.isTable,isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(N6,{}),label:`Add table row`,onClick:e=>e.chain().focus().addRowAfter().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(P6,{}),label:`Remove table row`,onClick:e=>e.chain().focus().deleteRow().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(F6,{}),label:`Add table column`,onClick:e=>e.chain().focus().addColumnAfter().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(I6,{}),label:`Remove table column`,onClick:e=>e.chain().focus().deleteColumn().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(L6,{}),label:`Remove table`,onClick:e=>e.chain().focus().deleteTable().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(y6,{}),label:`Table borders`,toggle:!0,onClick:e=>{let t=e.getAttributes(`table`),n={...t,border:t.border===`0`?`1`:`0`};e.commands.updateAttributes(`table`,n)},hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.tableHasBorder,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(a6,{}),label:`Bold`,toggle:!0,onClick:e=>e.chain().focus().toggleBold().run(),hidden:()=>!n?.includes(`bold`),isActive:e=>e.isBold,isDisabled:e=>!e.canBold},{icon:(0,N.jsx)(o6,{}),label:`Italic`,toggle:!0,onClick:e=>e.chain().focus().toggleItalic().run(),hidden:()=>!n?.includes(`italic`),isActive:e=>e.isItalic,isDisabled:e=>!e.canItalic},{icon:(0,N.jsx)(s6,{}),label:`Strikethrough`,toggle:!0,onClick:e=>e.chain().focus().toggleStrike().run(),hidden:()=>!n?.includes(`strikethrough`),isActive:e=>e.isStrike,isDisabled:e=>!e.canStrike},{icon:(0,N.jsx)(c6,{}),label:`Code`,toggle:!0,onClick:e=>e.chain().focus().toggleCode().run(),hidden:()=>!n?.includes(`code`),isActive:e=>e.isCode,isDisabled:e=>!e.canCode},{icon:(0,N.jsx)(f6,{}),label:`Underline`,toggle:!0,onClick:e=>e.chain().focus().toggleUnderline().run(),hidden:()=>!n?.includes(`underline`),isActive:e=>e.isUnderline},{icon:(0,N.jsx)(K5,{}),label:`Subscript`,toggle:!0,onClick:e=>e.chain().focus().toggleSubscript().run(),hidden:()=>!n?.includes(`subscript`),isActive:e=>e.isSubScript},{icon:(0,N.jsx)(G5,{}),label:`Superscript`,toggle:!0,onClick:e=>e.chain().focus().toggleSuperscript().run(),hidden:()=>!n?.includes(`superscript`),isActive:e=>e.isSuperScript},{icon:(0,N.jsx)(m6,{}),label:`Insert image`,hidden:()=>!n?.includes(`image`),onClick:e=>e.chain().focus().setImageUploadNode().run()},{icon:(0,N.jsx)(_6,{}),label:`Insert video`,hidden:()=>!n?.includes(`video`),onClick:e=>e.chain().focus().insertMedia({type:`video`}).run()},{icon:(0,N.jsx)(v6,{}),label:`Insert audio`,hidden:()=>!n?.includes(`audio`),onClick:e=>e.chain().focus().insertMedia({type:`audio`,tag:`audio`}).run()},{icon:(0,N.jsx)(A6,{}),label:`CSS classes`,hidden:()=>!n?.includes(`css`),onClick:e=>e.commands.openCSSClassDialog()},{icon:(0,N.jsx)(g6,{}),label:`Blockquote`,toggle:!0,hidden:()=>!n?.includes(`blockquote`),onClick:e=>e.chain().focus().toggleBlockquote().run(),isActive:e=>e.isBlockquote},{icon:(0,N.jsx)(q5,{}),label:`Heading`,toggle:!0,hidden:()=>!n?.includes(`h3`),onClick:e=>e.chain().focus().toggleHeadingParagraph().run(),isActive:e=>e.isHeadingParagraph},{icon:(0,N.jsx)(p6,{}),label:`Insert math`,hidden:()=>!n?.includes(`math`),onClick:e=>e.chain().focus().insertMath(``).run()},{icon:(0,N.jsx)(U5,{letter:`ñ`}),label:`Spanish characters (ñ)`,hidden:()=>!n?.includes(`languageCharacters`),onClick:()=>c(S6)},{icon:(0,N.jsx)(U5,{letter:`€`}),label:`Special characters (€)`,hidden:()=>n?.filter(e=>e===`languageCharacters`).length!==2,onClick:()=>c(C6)},{icon:(0,N.jsx)(O6,{editor:e}),label:`Text alignment`,hidden:()=>!n?.includes(`text-align`),onClick:()=>{}},{icon:(0,N.jsx)(u6,{}),label:`Bulleted list`,toggle:!0,hidden:()=>!n?.includes(`bulleted-list`),onClick:e=>e.chain().focus().toggleBulletList().run(),isActive:e=>e.isBulletList},{icon:(0,N.jsx)(d6,{}),label:`Numbered list`,toggle:!0,hidden:()=>!n?.includes(`numbered-list`),onClick:e=>e.chain().focus().toggleOrderedList().run(),isActive:e=>e.isOrderedList},{icon:(0,N.jsx)(Of,{}),label:`Undo`,hidden:()=>!n?.includes(`undo`),onClick:e=>e.chain().focus().undo().run(),isDisabled:e=>!e.canUndo},{icon:(0,N.jsx)(h6,{}),label:`Redo`,hidden:()=>!n?.includes(`redo`),onClick:e=>e.chain().focus().redo().run(),isDisabled:e=>!e.canRedo}],[n,e]),g=u.hideDefaultToolbar&&u.currentNode?.type?.name===`drag_in_the_blank`;return(0,N.jsxs)(`div`,{className:f,style:{...p},onMouseDown:m,children:[g&&(0,N.jsx)(`div`,{className:t.defaultToolbar,tabIndex:`1`,children:(0,N.jsx)(`div`,{className:t.buttonsContainer,children:(0,N.jsx)(`button`,{type:`button`,className:t.button,onClick:t=>{t.preventDefault(),e.chain().focus().deleteSelection().run(),a?.(e.getHTML())},"aria-label":`Delete response area`,title:`Delete response area`,children:(0,N.jsx)(Qq,{})})})}),!u.hideDefaultToolbar&&(0,N.jsxs)(`div`,{className:t.defaultToolbar,tabIndex:`1`,children:[(0,N.jsx)(`div`,{className:t.buttonsContainer,children:h.filter(e=>!e.hidden?.(u)).map((n,r)=>{let i=n.isDisabled?.(u),a=n.isActive?.(u);return(0,N.jsx)(`button`,{type:`button`,disabled:i,"aria-label":n.label,title:n.label,"aria-pressed":n.toggle?!!a:void 0,onClick:t=>{t.preventDefault(),n.onClick(e)},className:P(t.button,{[t.active]:a}),children:n.icon},r)})}),n?.includes(`responseArea`)&&(0,N.jsx)(`button`,{type:`button`,"aria-label":`Insert response area`,title:`Insert response area`,onClick:()=>{e.chain().focus().insertResponseArea(i.type).run()},className:t.button,children:(0,N.jsx)(x6,{})}),l.showDone&&(0,N.jsx)(rJ,{onClick:()=>{a?.(e.getHTML()),e.commands.blur()}})]}),s&&(0,N.jsx)(W5,{editor:e,opts:{...s,renderPopOver:(e,t)=>console.log(`Show popover`,t),closePopOver:()=>console.log(`Close popover`)},onClose:()=>c(!1)})]})}var Y5=e=>{Jo();let t={defaultToolbar:`defaultToolbar`,buttonsContainer:`buttonsContainer`,button:`toolbarButton`,active:`active`,disabled:`disabled`,isActive:`isActive`,toolbar:`toolbar`,toolbarWithNoDone:`toolbarWithNoDone`,toolbarTop:`toolbarTop`,toolbarRight:`toolbarRight`,fullWidth:`fullWidth`,hidden:`hidden`,autoWidth:`autoWidth`,focused:`focused`,iconRoot:`iconRoot`,label:`label`,shared:`shared`};return(0,N.jsx)(X5,{children:(0,N.jsx)(J5,{...e,classes:t})})},X5=L(`div`)(()=>({"& .defaultToolbar":{display:`flex`,width:`100%`,justifyContent:`space-between`},"& .buttonsContainer":{alignItems:`center`,display:`flex`,width:`100%`},"& .toolbarButton":{color:`grey`,display:`inline-flex`,padding:`2px`,background:`none`,border:`none`,cursor:`pointer`,"& svg":{width:`24px`,height:`24px`},"&:hover":{color:lu()},"&:focus":{outline:`2px solid ${Xu()}`}},"& .active":{color:lu()},"& .disabled":{opacity:.7,cursor:`not-allowed`,"& :hover":{color:uu()}},"& .isActive":{background:`var(--purple)`,color:`var(--white)`},"& .toolbar":{position:`absolute`,zIndex:20,cursor:`pointer`,justifyContent:`space-between`,background:`var(--editable-html-toolbar-bg, #efefef)`,minWidth:`280px`,margin:`5px 0 0 0`,padding:`2px`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,boxSizing:`border-box`,display:`flex`,opacity:0,pointerEvents:`none`},"& .toolbarWithNoDone":{minWidth:`265px`},"& .toolbarTop":{top:`-45px`},"& .toolbarRight":{right:0},"& .fullWidth":{width:`100%`},"& .hidden":{visibility:`hidden`},"& .autoWidth":{width:`auto`},"& .focused":{opacity:1,pointerEvents:`auto`},"& .iconRoot":{width:`28px`,height:`28px`,padding:`4px`,verticalAlign:`top`},"& .label":{color:`var(--editable-html-toolbar-check, #00bb00)`},"& .shared":{display:`flex`}})),Z5=L(`div`,{shouldForwardProp:e=>![`noBorder`,`error`].includes(e)})(({theme:e,noBorder:t,error:n})=>({position:`relative`,padding:`0px`,border:t?`none`:`1px solid #ccc`,borderRadius:`4px`,cursor:`text`,'& [data-slate-editor="true"]':{wordBreak:`break-word`,overflow:`visible`,maxHeight:`500px`,padding:`5px`},"&:first-child":{marginTop:0},"& ul, & ol":{padding:`0 1rem`,margin:`1.25rem 1rem 1.25rem 0.4rem`},"& ul li p, & ol li p":{marginTop:`0.25em`,marginBottom:`0.25em`},"& h1, & h2, & h3, & h4, & h5, & h6":{lineHeight:1.1,marginTop:`2.5rem`,textWrap:`pretty`},"& h1, & h2":{marginTop:`3.5rem`,marginBottom:`1.5rem`},"& h1":{fontSize:`1.4rem`},"& h2":{fontSize:`1.2rem`},"& h3":{fontSize:`1.1rem`},"& h4, & h5, & h6":{fontSize:`1rem`},"& code":{backgroundColor:`var(--purple-light)`,borderRadius:`0.4rem`,color:`var(--black)`,fontSize:`0.85rem`,padding:`0.25em 0.3em`},"& pre":{background:`var(--black)`,borderRadius:`0.5rem`,color:`var(--white)`,fontFamily:`'JetBrainsMono', monospace`,margin:`1.5rem 0`,padding:`0.75rem 1rem`,"& code":{background:`none`,color:`inherit`,fontSize:`0.8rem`,padding:0}},"& blockquote":{background:`#f9f9f9`,borderLeft:`5px solid #ccc`,margin:`1.5em 10px`,padding:`.5em 10px`},"& p":{margin:`0`},"& table":{tableLayout:`fixed`,width:`100%`,borderCollapse:`collapse`,color:lu(),backgroundColor:Au()},'& table:not([border="1"]) tr':{borderTop:`1px solid ${Vu()}`},"& td, th":{padding:`.6em 1em`,textAlign:`center`},'& table:not([border="1"]) td, th':{border:`1px solid ${Vu()}`},...n&&{border:`2px solid ${e.palette.error.main} !important`}})),Q5=L(`div`,{shouldForwardProp:e=>![`disableScrollbar`,`highlightShape`].includes(e)})(({theme:e,disableScrollbar:t,highlightShape:n})=>({position:`relative`,padding:`0px`,overflowY:`auto`,color:lu(),backgroundColor:n?e.palette.action.selected:Au(),...t&&{"&::-webkit-scrollbar":{display:`none`},scrollbarWidth:`none`,"-ms-overflow-style":`none`}})),$5=L(`div`,{shouldForwardProp:e=>e!==`noPadding`})(({noPadding:e})=>({padding:e?0:`10px 8px`}));function e7(e){let[t,n]=(0,M.useState)(null),r=(0,M.useRef)(null),{editor:i,disabled:a,children:o,disableScrollbar:s,activePlugins:c,toolbarOpts:l,responseAreaProps:u,autoFocus:d,minWidth:f,width:p,maxWidth:m,minHeight:h,height:g,maxHeight:_,highlightShape:v,ref:y}=e;(0,M.useEffect)(()=>{i&&r.current&&(i._tiptapContainerEl=r.current)},[i,r.current]),(0,M.useEffect)(()=>{i&&d&&Promise.resolve().then(()=>{i.commands.focus(`end`)})},[i,d]),(0,M.useEffect)(()=>{if(e.adjustWidthForLimit){let t=document.createElement(`p`);t.style.visibility=`hidden`,t.style.position=`absolute`,t.style.whiteSpace=`nowrap`,t.textContent=`W`.repeat(e.charactersLimit);let i=window.getComputedStyle(r.current);[`fontFamily`,`fontSize`,`fontWeight`,`fontStyle`,`letterSpacing`,`wordSpacing`,`textTransform`,`lineHeight`].forEach(e=>{t.style[e]=i[e]}),document.body.appendChild(t),n(`${t.offsetWidth+27}px`),t.remove()}},[e.adjustWidthForLimit,e.charactersLimit]);let b=(0,M.useMemo)(()=>({width:i6(t||p),minWidth:i6(f),maxWidth:i6(m),height:i6(g),minHeight:i6(h),maxHeight:i6(_)}),[t,f,p,m,h,g,_]);return(0,N.jsxs)(Z5,{noBorder:l&&l.noBorder,error:l&&l.error,className:e.className,style:{width:b.width,minWidth:b.minWidth,maxWidth:b.maxWidth},ref:r,children:[(0,N.jsx)(Q5,{disableScrollbar:s,highlightShape:v,children:(0,N.jsx)($5,{noPadding:l&&l.noPadding,children:o})}),i&&(0,N.jsx)(Y5,{editor:i,responseAreaProps:u,toolbarOpts:l,activePlugins:c,onChange:e.onChange,autoWidthToolbar:e.autoWidthToolbar})]})}var t7=md(`@pie-lib:editable-html:plugins`),n7=[`bold`,`html`,`extraCSSRules`,`italic`,`underline`,`strikethrough`,`bulleted-list`,`numbered-list`,`image`,`math`,`languageCharacters`,`text-align`,`blockquote`,`h3`,`table`,`video`,`audio`,`responseArea`,`redo`,`undo`,`superscript`,`subscript`],r7={"text-align":`textAlign`,"bulleted-list":`ul_list`,"numbered-list":`ol_list`},i7=n7.filter(e=>![`responseArea`,`h3`,`blockquote`].includes(e)),a7=(e,t,n)=>{t7(`[buildPlugins] opts: `,n),e||=i7;let r=(t,n=!0)=>e.includes(t)&&n&&t,i=n.image&&n.image.delete,a=n.math,o=n.responseArea&&n.responseArea.type,s=!se(n.extraCSSRules),c=n?.languageCharacters||[];return re([r(`table`),r(`bold`),r(`italic`),r(`strikethrough`),r(`underline`),r(`superscript`),r(`subscript`),r(`image`,!!i),r(`video`),r(`audio`),r(`math`,!!a),...c.map(e=>r(`languageCharacters`,e)),r(`text-align`),r(`blockquote`),r(`h3`),r(`bulleted-list`),r(`numbered-list`),r(`undo`),r(`redo`),r(`responseArea`,!!o),r(`css`,!!s),r(`html`,!!n.html)])},o7={position:`bottom`,alignment:`left`,alwaysVisible:!1,showDone:!0,doneOn:`blur`},s7={options:{},respAreaToolbar:()=>{},onHandleAreaChange:()=>{}},c7=[`bold`,`italic`,`underline`,`strikethrough`,`code`,`bulleted-list`,`numbered-list`,`image`,`math`,`languageCharacters`,`text-align`,`table`,`video`,`audio`,`responseArea`,`superscript`,`subscript`,`css`,`h3`,`undo`,`redo`],l7={"--white":`#fff`,"--black":`#2e2b29`,"--black-contrast":`#110f0e`,"--gray-1":`rgba(61, 37, 20, .05)`,"--gray-2":`rgba(61, 37, 20, .08)`,"--gray-3":`rgba(61, 37, 20, .12)`,"--gray-4":`rgba(53, 38, 28, .3)`,"--gray-5":`rgba(28, 25, 23, .6)`,"--green":`#22c55e`,"--purple":`#6a00f5`,"--purple-contrast":`#5800cc`,"--purple-light":`rgba(88, 5, 255, .05)`,"--yellow-contrast":`#facc15`,"--yellow":`rgba(250, 204, 21, .4)`,"--yellow-light":`#fffae5`,"--red":`#ff5c33`,"--red-light":`#ffebe5`,"--shadow":`0px 12px 33px 0px rgba(0, 0, 0, .06),
|
|
397
|
-
0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)`},u7=e=>{let{showParagraphs:t,separateParagraphs:n}=e.pluginProps||{},[r,i]=(0,M.useState)([]),[a,o]=(0,M.useState)(!1),{toolbarOpts:s}=e,c=(0,M.useCallback)(e=>{i(t=>{let n=t.filter(t=>t.pos!==e);return n.length===0&&o(!1),n})},[i]),l={...o7,...s},u=(0,M.useCallback)(t=>{let n=t.getHTML();e.markup!==n&&e.onChange?.(n),l.doneOn===`blur`&&e.onDone?.(n)},[e.markup,e.onChange,e.onDone,l.doneOn]),d=(0,M.useMemo)(()=>({...s7,...e.responseAreaProps,onInlineDropdownToolbarClose:u}),[e.responseAreaProps,u]),f=(0,M.useMemo)(()=>{let{customPlugins:t,...n}=e.pluginProps||{};t||=[];let r=(e.activePlugins||c7)?.filter(e=>{let t=r7[e]||e,r=n[t]||{};return!r||!r.disabled});return a7(r,t,{math:{},textAlign:e.textAlign,html:{},extraCSSRules:e.extraCSSRules||{},image:{...e.imageSupport},toolbar:{},table:{},responseArea:{type:d.type},languageCharacters:e.languageCharactersProps,keyPadCharacterRef:{},setKeypadInteraction:{},media:{}})},[e,d.type]),p=mM({extensions:[kG.configure({types:[`heading`,`paragraph`,`div`,`headingParagraph`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`td`,`th`],alignments:[`left`,`right`,`center`,`justify`]}),uG,dG.configure({limit:e.charactersLimit||1e6}),eG.configure({trailingNode:{node:`paragraph`,notAfter:[`paragraph`,`div`]}}),n6,Uq,r6,Wq,Gq,MG.configure({placeholder:e.placeholder,showOnlyWhenEditable:!0,showOnlyCurrent:!1,includeChildren:!0}),zq,Cq,Hq,Vq,w$.configure(d),T$.configure(d),D$.configure(d),O$.configure(d),E$.configure(d),U0.configure({toolbarOpts:l,math:e.pluginProps?.math||{}}),OG,DG,jG,t4.configure({toolbarOpts:l,imageHandling:{disableImageAlignmentButtons:e.disableImageAlignmentButtons,onDone:t=>e.onDone?.(t.getHTML()),onDelete:e.imageSupport&&e.imageSupport.delete&&(t=>{let{src:n}=t.attrs;e.imageSupport.delete(n,e=>{c(t.pos)})}),insertImageRequested:e.imageSupport&&((t,n,r)=>{let[o,s]=n,l=n=>{let r;a&&n&&(r=e.onChange),c(s),r?.(t.getHTML())};t._insertingImage=!0,i(e=>[...e,o]),(()=>{let n=r(l),i=ie(()=>{let e=()=>window.removeEventListener(`focus`,i);if(!t._insertingImage){e();return}c(s),t._insertingImage=!1,e()},500);window.addEventListener(`focus`,i),e.imageSupport.add(n)})()}),maxImageWidth:e.maxImageWidth,maxImageHeight:e.maxImageHeight},limit:3}),i3.configure({uploadSoundSupport:e.uploadSoundSupport}),x3.configure({extraCSSRules:e.extraCSSRules})],immediatelyRender:!1,editorProps:{handleKeyDown(t,n){return e.onKeyDown?e.onKeyDown(n):!1}},editable:!e.disabled,content:FG(e.markup),onUpdate:({editor:t,transaction:n})=>{n.isDone&&e.onChange?.(t.getHTML())},onBlur:({editor:e})=>{e._insertingImage||e._toolbarOpened||e.isActive(`inline_dropdown`)||e.isActive(`explicit_constructed_response`)||!e.schema||u(e)}},[e.charactersLimit]);(0,M.useEffect)(()=>{e.editorRef&&e.editorRef(p)},[e.editorRef,p]),(0,M.useEffect)(()=>{p?.setEditable(!e.disabled)},[e.disabled,p]),(0,M.useEffect)(()=>{if(!p)return;let t=FG(e.markup);t!==p.getHTML()&&p.commands.setContent(t,{emitUpdate:!1})},[e.markup,p]),(0,M.useEffect)(()=>{Object.entries(l7).forEach(([e,t])=>{document.documentElement.style.setProperty(e,t)})},[]);let m=uM({editor:p,selector:e=>({isFocused:e.editor?.isFocused})}),h=(0,M.useMemo)(()=>{let{minWidth:t,width:n,maxWidth:r,minHeight:i,height:a,maxHeight:o}=e;return{width:i6(n),minWidth:i6(t),maxWidth:i6(r),height:i6(a),minHeight:i6(i),maxHeight:i6(o)}},[e]);return(0,N.jsx)(e7,{...e,activePlugins:f,toolbarOpts:l,editorState:m,editor:p,children:p&&(0,N.jsx)(d7,{style:{minHeight:h.minHeight,height:h.height,maxHeight:h.maxHeight},showParagraph:t&&!t.disabled,separateParagraph:n&&!n.disabled,editor:p})})},d7=L(sM,{shouldForwardProp:e=>![`showParagraph`,`separateParagraph`].includes(e)})(({showParagraph:e,separateParagraph:t})=>({display:`flex`,outline:`none !important`,"& .ProseMirror":{flex:1,padding:`5px`,maxHeight:`500px`,outline:`none !important`,position:`initial`,"& > p, & > div":{margin:`0`},"& p[data-placeholder].is-empty:only-child, & div[data-placeholder].is-empty:only-child":{position:`relative`},"& p[data-placeholder].is-empty:only-child::before, & div[data-placeholder].is-empty:only-child::before":{content:`attr(data-placeholder)`,position:`absolute`,left:0,top:0,color:`#9CA3AF`,pointerEvents:`none`,whiteSpace:`pre-wrap`},...e&&{"& > p:has(+ p)::after, & > div:has(+ div)::after":{display:`block`,content:`"¶"`,fontSize:`1em`,color:`#146EB3`}},...t&&{"& > p:has(+ p)":{marginBottom:`1em`}}}})),f7=L(u7)(()=>({display:`inline-block`,verticalAlign:`middle`,margin:`4px`,borderRadius:`4px`,border:`1px solid ${Uu()}`,"&.correct":{border:`1px solid ${fu()}`},"&.incorrect":{border:`1px solid ${gu()}`}})),p7=ng(`input`,e=>(t,n)=>{let{adjustedLimit:r,disabled:i,feedback:a,showCorrectAnswer:o,maxLength:s,spellCheck:c,pluginProps:l,onChange:u}=e,d=t.data?.dataset||{};if(d.component===`input`){let f=(e.choices&&d&&e.choices[d.id]||[])[0],p=o?f&&f.label:n[d.id]||``,m=s&&s[d.id],h=a&&a[d.id],g=o||h===`correct`,_=!o&&h===`incorrect`;return(0,N.jsx)(f7,{id:d.id,disabled:o||i,disableUnderline:!0,onChange:e=>{let t={...n,[d.id]:e};u(t)},markup:p||``,charactersLimit:r?m:25,activePlugins:[`languageCharacters`],pluginProps:l,languageCharactersProps:[{language:`spanish`}],spellCheck:c,adjustWidthForLimit:!0,onKeyDown:e=>{if(e.key===`Enter`||e.keyCode===13)return!0},autoWidthToolbar:!0,toolbarOpts:{minWidth:`auto`,noBorder:!0,isHidden:!!l?.characters?.disabled},className:P({correct:g,incorrect:_})},`${t.type}-input-${d.id}`)}});function m7(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function h7(e,t){return!e||m7(e)?e:m7(e.default)?e.default:t&&m7(e[t])?e[t]:t&&m7(e[t]?.default)?e[t].default:e}var g7=h7(If,`UiLayout`)||h7(x7.UiLayout,`UiLayout`),_7=h7(pp,`PreviewPrompt`)||h7(x7.PreviewPrompt,`PreviewPrompt`),v7=h7(Nd,`Collapsible`)||h7(x7.Collapsible,`Collapsible`),y7=Wp,b7=y7.default,x7=b7&&typeof b7==`object`?b7:y7,{translator:S7}=Ym,C7=L(g7)(({alwaysShowCorrect:e})=>({color:lu(),backgroundColor:Au(),...e&&{"& *":{borderColor:`${lu()} !important`}}})),w7=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),T7=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),E7=L(`h2`)({position:`absolute`,left:`-10000px`,top:`auto`,width:`1px`,height:`1px`,overflow:`hidden`}),D7=class extends M.Component{static propTypes={alwaysShowCorrect:k.bool,animationsDisabled:k.bool,disabled:k.bool,displayType:k.string,feedback:k.object,language:k.string,markup:k.string,maxLengthPerChoice:k.array,maxLengthPerChoiceEnabled:k.bool,mode:k.string,note:k.string,onChange:k.func,playerSpellCheckEnabled:k.bool,prompt:k.string,rationale:k.string,role:k.string,showNote:k.bool,teacherInstructions:k.string,value:k.object,responseAreaInputConfiguration:k.object,model:k.object.isRequired};static defaultProps={value:{}};state={showCorrectAnswer:this.props.alwaysShowCorrect||!1};getChangeSession=e=>e&&e.every((e,t,n)=>e===n[0]&&e===1)?this.props.onChange:ie(this.props.onChange,200,{maxWait:200});UNSAFE_componentWillReceiveProps(e){let{maxLengthPerChoice:t,language:n}=this.props,{note:r}=this.props;se(e.feedback)&&this.setState({showCorrectAnswer:!1}),e.alwaysShowCorrect&&this.setState({showCorrectAnswer:!0}),t&&!le(t,e.maxLengthPerChoice)&&(this.changeSession=this.getChangeSession(e.maxLengthPerChoice)),r&&n&&n!==e.language&&r===S7.t(`common:commonCorrectAnswerWithAlternates`,{lng:n})&&(r=S7.t(`common:commonCorrectAnswerWithAlternates`,{lng:e.language}))}toggleShowCorrect=()=>{this.setState({showCorrectAnswer:!this.state.showCorrectAnswer})};changeSession=this.getChangeSession(this.props.maxLengthPerChoice);onChange=e=>{this.changeSession(e)};render(){let{showCorrectAnswer:e}=this.state,{alwaysShowCorrect:t,animationsDisabled:n,mode:r,displayType:i,role:a,language:o,maxLengthPerChoice:s,maxLengthPerChoiceEnabled:c,note:l,playerSpellCheckEnabled:u,prompt:d,rationale:f,showNote:p,teacherInstructions:m,responseAreaInputConfiguration:h,model:g,value:_}=this.props,{extraCSSRules:v}=g||{},y=(e||r===`view`&&a===`instructor`)&&p&&l,b=(0,N.jsx)(_7,{defaultClassName:`teacher-instructions`,prompt:m}),x=(0,N.jsx)(_7,{prompt:f}),S=f&&(vp(f)||bp(f)),C=m&&(vp(m)||bp(m));return(0,N.jsxs)(C7,{extraCSSRules:v,alwaysShowCorrect:t,style:{display:`${i}`},children:[r===`gather`&&(0,N.jsx)(E7,{children:`Fill in the Blank Question`}),C&&(0,N.jsx)(T7,{children:n?b:(0,N.jsx)(v7,{labels:{hidden:`Show Teacher Instructions`,visible:`Hide Teacher Instructions`},children:b})}),d&&(0,N.jsx)(_7,{prompt:d}),!t&&r===`evaluate`&&(0,N.jsx)(lh,{show:!0,toggled:e,onToggle:this.toggleShowCorrect,language:o}),(0,N.jsx)(p7,{...this.props,onChange:this.onChange,showCorrectAnswer:e,value:_,maxLength:s,adjustedLimit:c,spellCheck:u,pluginProps:h}),y&&(0,N.jsx)(w7,{dangerouslySetInnerHTML:{__html:l}}),S&&(0,N.jsx)(T7,{children:n?x:(0,N.jsx)(v7,{labels:{hidden:`Show Rationale`,visible:`Hide Rationale`},children:x})})]})}},O7=g(),k7=class extends HTMLElement{constructor(){super(),this._model=null,this._session=null,this._root=null}setLangAttribute(){let e=this._model&&typeof this._model.language?this._model.language:``,t=e?e.slice(0,2):`en`;this.setAttribute(`lang`,t)}set model(e){this._model=e,this.dispatchEvent(new _(this.tagName.toLowerCase(),this.session&&!!this.session.value,!!this._model)),this.setLangAttribute(),this._render()}set session(e){this._session=e,this._render()}get session(){return this._session}_render=()=>{if(this._model&&this._session){let e=M.createElement(D7,{choices:this._model.choices,disabled:this._model.disabled,displayType:this._model.displayType,feedback:this._model.feedback,language:this._model.language,markup:this._model.markup,maxLengthPerChoice:this._model.maxLengthPerChoice,maxLengthPerChoiceEnabled:this._model.maxLengthPerChoiceEnabled,mode:this._model.mode,note:this._model.note,onChange:this.changeSession,playerSpellCheckEnabled:this._model.playerSpellCheckEnabled,prompt:this._model.prompt,rationale:this._model.rationale,role:this._model.role,showNote:this._model.showNote,teacherInstructions:this._model.teacherInstructions,value:this._session.value,responseAreaInputConfiguration:this._model.responseAreaInputConfiguration});this._root||=(0,O7.createRoot)(this),this._root.render(e),queueMicrotask(()=>{O(this)})}};dispatchChangedEvent=()=>{this.dispatchEvent(new v(this.tagName.toLowerCase(),this.session&&!!this.session.value))};changeSession=e=>{this.session.value=e,this.dispatchChangedEvent(),this._render()};connectedCallback(){this.setAttribute(`aria-label`,`Fill in the Blank Question`),this.setAttribute(`role`,`region`),this._render()}disconnectedCallback(){this._root&&=(this._root.unmount(),null)}};return typeof window<`u`&&!customElements.get(`explicit-constructed-response-element`)&&customElements.define(`explicit-constructed-response-element`,k7),k7})();
|
|
394
|
+
`),[i,a]=e6(r);if(i.length===0)return;let o=t6(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
|
|
395
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(r6,this.editor.getAttributes(i6)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=BA({find:a6,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=BA({find:a6,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(i6)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),s6=/^\s*(\[([( |x])?\])\s$/,c6=$A.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,rk(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>ZA(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=ik(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[BA({find:s6,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),l6=$A.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,rk(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
396
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=XA(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=XA(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});CA.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(F3.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(R3.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Y3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(o6.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(c6.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(l6.configure(this.options.taskList)),e}});var u6=R3.extend({content:`(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+`}),d6=$A.create({name:`headingParagraph`,group:`block`,content:`inline*`,defining:!0,addAttributes(){return{"data-heading":{default:`heading1`,parseHTML:e=>e.getAttribute(`data-heading`),renderHTML:e=>({"data-heading":e[`data-heading`]})}}},parseHTML(){return[{tag:`p[data-heading]`}]},renderHTML({HTMLAttributes:e}){return[`p`,rk(e),0]},addCommands(){return{toggleHeadingParagraph:()=>({commands:e,editor:t})=>t.isActive(`headingParagraph`)?e.setNode(`paragraph`):e.setNode(`headingParagraph`,{"data-heading":`heading1`})}}}),f6=e=>{if(!e)return;let t=/^calc\((.*)\)$/;if(typeof e==`string`){if(e.endsWith(`%`))return;if(e.endsWith(`px`)||e.endsWith(`vh`)||e.endsWith(`vw`)||e.endsWith(`ch`)||e.endsWith(`em`)||e.match(t))return e;let n=parseInt(e,10);return Number.isNaN(n)?n:`${n}px`}if(typeof e==`number`)return`${e}px`},p6=Vl((0,N.jsx)(`path`,{d:`M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42M10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5`}),`FormatBold`),m6=Vl((0,N.jsx)(`path`,{d:`M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z`}),`FormatItalic`),h6=Vl((0,N.jsx)(`path`,{d:`M10 19h4v-3h-4zM5 4v3h5v3h4V7h5V4zM3 14h18v-2H3z`}),`FormatStrikethrough`),g6=Vl((0,N.jsx)(`path`,{d:`M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z`}),`Code`),_6=Vl((0,N.jsx)(`path`,{d:`M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M8 20H4v-4h4zm0-6H4v-4h4zm0-6H4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4z`}),`GridOn`),v6=Vl((0,N.jsx)(`path`,{d:`M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z`}),`FormatListBulleted`),y6=Vl((0,N.jsx)(`path`,{d:`M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z`}),`FormatListNumbered`),b6=Vl((0,N.jsx)(`path`,{d:`M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6m-7 2v2h14v-2z`}),`FormatUnderlined`),x6=Vl((0,N.jsx)(`path`,{d:`M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z`}),`Functions`),S6=Vl((0,N.jsx)(`path`,{d:`M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z`}),`Image`),C6=Vl((0,N.jsx)(`path`,{d:`M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z`}),`Redo`),w6=Vl((0,N.jsx)(`path`,{d:`M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z`}),`FormatQuote`),T6=Vl((0,N.jsx)(`path`,{d:`M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3zM8 17H6v-2h2zm0-4H6v-2h2zm0-4H6V7h2zm10 8h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2z`}),`Theaters`),E6=Vl((0,N.jsx)(`path`,{d:`M3 9v6h4l5 5V4L7 9zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77`}),`VolumeUp`),D6=Vl((0,N.jsx)(`path`,{d:`M3 3v18h18V3zm8 16H5v-6h6zm0-8H5V5h6zm8 8h-6v-6h6zm0-8h-6V5h6z`}),`BorderAll`),O6=L(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans !important`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,top:`7px`,width:`110px`,height:`28px`,whiteSpace:`nowrap`})),k6=()=>(0,N.jsx)(O6,{children:`+ Response Area`}),A6={characters:[[`á`,`é`,`í`,`ó`,`ú`],[`Á`,`É`,`Í`,`Ó`,`Ú`],[`—`,`«`,`»`,`ñ`,`ü`],[`-`,`¿`,`¡`,`Ñ`,`Ü`]]},j6={hasPreview:!0,characters:[[{unicode:`U+00A2`,description:`CENT SIGN`,write:`¢`,label:`¢`},{unicode:`U+00BF`,description:`INVERTED QUESTION MARK`,write:`¿`,label:`¿`},{unicode:`U+00B4`,description:`ACUTE ACCENT`,write:`´`,label:`´`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E1`,description:`LATIN SMALL LETTER A WITH ACUTE`,write:`á`,label:`á`},{unicode:`U+00E9`,description:`LATIN SMALL LETTER E WITH ACUTE`,write:`é`,label:`é`},{unicode:`U+00ED`,description:`LATIN SMALL LETTER I WITH ACUTE`,write:`í`,label:`í`},{unicode:`U+00F3`,description:`LATIN SMALL LETTER O WITH ACUTE`,write:`ó`,label:`ó`},{unicode:`U+00FA`,description:`LATIN SMALL LETTER U WITH ACUTE`,write:`ú`,label:`ú`},{unicode:`U+00F1`,description:`LATIN SMALL LETTER N WITH TILDE`,write:`ñ`,label:`ñ`}],[{unicode:`U+20AC`,description:`EURO SIGN`,write:`€`,label:`€`},{unicode:`U+00A1`,description:`INVERTED EXCLAMATION MARK`,write:`¡`,label:`¡`},{unicode:`U+00C1`,description:`LATIN CAPITAL LETTER A WITH ACUTE`,write:`Á`,label:`Á`},{unicode:`U+00C9`,description:`LATIN CAPITAL LETTER E WITH ACUTE`,write:`É`,label:`É`},{unicode:`U+00CD`,description:`LATIN CAPITAL LETTER I WITH ACUTE`,write:`Í`,label:`Í`},{unicode:`U+00D3`,description:`LATIN CAPITAL LETTER O WITH ACUTE`,write:`Ó`,label:`Ó`},{unicode:`U+00DA`,description:`LATIN CAPITAL LETTER U WITH ACUTE`,write:`Ú`,label:`Ú`},{unicode:`U+00D1`,description:`LATIN CAPITAL LETTER N WITH TILDE`,write:`Ñ`,label:`Ñ`}],[{unicode:`U+00A3`,description:`POUND SIGN`,write:`£`,label:`£`},{unicode:`U+00AB`,description:`LEFT-POINTING DOUBLE ANGLE QUOTATION MARK`,write:`«`,label:`«`},{unicode:`U+005E`,description:`CIRCUMFLEX ACCENT`,write:`^`,label:`^`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E2`,description:`LATIN SMALL LETTER A WITH CIRCUMFLEX`,write:`â`,label:`â`},{unicode:`U+00EA`,description:`LATIN SMALL LETTER E WITH CIRCUMFLEX`,write:`ê`,label:`ê`},{unicode:`U+00EE`,description:`LATIN SMALL LETTER I WITH CIRCUMFLEX`,write:`î`,label:`î`},{unicode:`U+00F4`,description:`LATIN SMALL LETTER O WITH CIRCUMFLEX`,write:`ô`,label:`ô`},{unicode:`U+00FB`,description:`LATIN SMALL LETTER U WITH CIRCUMFLEX`,write:`û`,label:`û`},{unicode:`U+00E7`,description:`LATIN SMALL LETTER C WITH CEDILLA`,write:`ç`,label:`ç`}],[{unicode:`U+00A5`,description:`YEN SIGN`,write:`¥`,label:`¥`},{unicode:`U+00BB`,description:`RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK`,write:`»`,label:`»`},{unicode:`U+00C2`,description:`LATIN CAPITAL LETTER A WITH CIRCUMFLEX`,write:`Â`,label:`Â`},{unicode:`U+00CA`,description:`LATIN CAPITAL LETTER E WITH CIRCUMFLEX`,write:`Ê`,label:`Ê`},{unicode:`U+00CE`,description:`LATIN CAPITAL LETTER I WITH CIRCUMFLEX`,write:`Î`,label:`Î`},{unicode:`U+00D4`,description:`LATIN CAPITAL LETTER O WITH CIRCUMFLEX`,write:`Ô`,label:`Ô`},{unicode:`U+00DB`,description:`LATIN CAPITAL LETTER U WITH CIRCUMFLEX`,write:`Û`,label:`Û`},{unicode:`U+00C7`,description:`LATIN CAPITAL LETTER C WITH CEDILLA`,write:`Ç`,label:`Ç`}],[{unicode:`U+200A`,description:`HAIR SPACE`,write:String.fromCodePoint(`0x200A`),label:` `},{unicode:`U+00A7`,description:`SECTION SIGN`,write:`§`,label:`§`},{unicode:`U+00A8`,description:`DIAERESIS`,write:`¨`,label:`¨`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E4`,description:`LATIN SMALL LETTER A WITH DIAERESIS`,write:`ä`,label:`ä`},{unicode:`U+00EB`,description:`LATIN SMALL LETTER E WITH DIAERESIS`,write:`ë`,label:`ë`},{unicode:`U+00EF`,description:`LATIN SMALL LETTER I WITH DIAERESIS`,write:`ï`,label:`ï`},{unicode:`U+00F6`,description:`LATIN SMALL LETTER O WITH DIAERESIS`,write:`ö`,label:`ö`},{unicode:`U+00FC`,description:`LATIN SMALL LETTER U WITH DIAERESIS`,write:`ü`,label:`ü`},{unicode:`U+00DF`,description:`LATIN SMALL LETTER SHARP S`,write:`ß`,label:`ß`}],[{unicode:`U+2009`,description:`THIN SPACE`,write:String.fromCodePoint(`0x2009`),label:` `},{unicode:`U+2026`,description:`HORIZONTAL ELLIPSIS`,write:`…`,label:`…`},{unicode:`U+00C4`,description:`LATIN CAPITAL LETTER A WITH DIAERESIS`,write:`Ä`,label:`Ä`},{unicode:`U+00CB`,description:`LATIN CAPITAL LETTER E WITH DIAERESIS`,write:`Ë`,label:`Ë`},{unicode:`U+00CF`,description:`LATIN CAPITAL LETTER I WITH DIAERESIS`,write:`Ï`,label:`Ï`},{unicode:`U+00D6`,description:`LATIN CAPITAL LETTER O WITH DIAERESIS`,write:`Ö`,label:`Ö`},{unicode:`U+00DC`,description:`LATIN CAPITAL LETTER U WITH DIAERESIS`,write:`Ü`,label:`Ü`},{unicode:`U+2212`,description:`MINUS SIGN`,write:`−`,label:`−`}],[{unicode:`U+00A0`,description:`NO-BREAK SPACE`,write:String.fromCodePoint(`0x00A0`),label:` `},{unicode:`U+2022`,description:`BULLET`,write:`•`,label:`•`},{unicode:`U+0060`,description:`GRAVE ACCENT`,write:"`",label:"`",extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E0`,description:`LATIN SMALL LETTER A WITH GRAVE`,write:`à`,label:`à`},{unicode:`U+00E8`,description:`LATIN SMALL LETTER E WITH GRAVE`,write:`è`,label:`è`},{unicode:`U+00EC`,description:`LATIN SMALL LETTER I WITH GRAVE`,write:`ì`,label:`ì`},{unicode:`U+00F2`,description:`LATIN SMALL LETTER O WITH GRAVE`,write:`ò`,label:`ò`},{unicode:`U+00F9`,description:`LATIN SMALL LETTER U WITH GRAVE`,write:`ù`,label:`ù`},{unicode:`U+2013`,description:`EN DASH`,write:`–`,label:`–`}],[{unicode:`U+2003`,description:`EM SPACE`,write:String.fromCodePoint(`0x2003`),label:` `},{unicode:`U+25E6`,description:`WHITE BULLET`,write:`◦`,label:`◦`},{unicode:`U+00C0`,description:`LATIN CAPITAL LETTER A WITH GRAVE`,write:`À`,label:`À`},{unicode:`U+00C8`,description:`LATIN CAPITAL LETTER E WITH GRAVE`,write:`È`,label:`È`},{unicode:`U+00CC`,description:`LATIN CAPITAL LETTER I WITH GRAVE`,write:`Ì`,label:`Ì`},{unicode:`U+00D2`,description:`LATIN CAPITAL LETTER O WITH GRAVE`,write:`Ò`,label:`Ò`},{unicode:`U+00D9`,description:`LATIN CAPITAL LETTER U WITH GRAVE`,write:`Ù`,label:`Ù`},{unicode:`U+2014`,description:`EM DASH`,write:`—`,label:`—`}]]},M6=()=>(0,N.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M42.1875 4.75C42.1875 7.38672 39.9902 9.4375 37.5 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H37.5C39.9902 0.0625 42.1875 2.25977 42.1875 4.75ZM42.1875 42.25C42.1875 44.8867 39.9902 46.9375 37.5 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H37.5C39.9902 37.5625 42.1875 39.7598 42.1875 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),N6=()=>(0,N.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H28.125C25.4883 9.4375 23.4375 7.38672 23.4375 4.75C23.4375 2.25977 25.4883 0.0625 28.125 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H28.125C25.4883 46.9375 23.4375 44.8867 23.4375 42.25C23.4375 39.7598 25.4883 37.5625 28.125 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),P6=()=>(0,N.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M51.5625 4.75C51.5625 7.38672 49.3652 9.4375 46.875 9.4375H18.75C16.1133 9.4375 14.0625 7.38672 14.0625 4.75C14.0625 2.25977 16.1133 0.0625 18.75 0.0625H46.875C49.3652 0.0625 51.5625 2.25977 51.5625 4.75ZM65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5ZM0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61ZM51.5625 42.25C51.5625 44.8867 49.3652 46.9375 46.875 46.9375H18.75C16.1133 46.9375 14.0625 44.8867 14.0625 42.25C14.0625 39.7598 16.1133 37.5625 18.75 37.5625H46.875C49.3652 37.5625 51.5625 39.7598 51.5625 42.25Z`,fill:`currentColor`})}),F6=()=>(0,N.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),I6=({editor:e,onChange:t})=>{let[n,r]=(0,M.useState)(!1),i;switch(!0){case e.isActive({textAlign:`right`}):i=(0,N.jsx)(N6,{});break;case e.isActive({textAlign:`center`}):i=(0,N.jsx)(P6,{});break;case e.isActive({textAlign:`justify`}):i=(0,N.jsx)(F6,{});break;default:i=(0,N.jsx)(M6,{});break}let a=t=>{let n=t.currentTarget?.getAttribute(`value`);n&&e.commands.setTextAlign(n),r(!1)};return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>{e.preventDefault(),e.stopPropagation(),r(!n)},children:[i,(0,N.jsx)(`span`,{style:{marginLeft:`5px`,fontSize:`8px`},"aria-hidden":`true`,children:`▼`})]}),(0,N.jsx)(Ad,{in:n,timeout:`auto`,unmountOnExit:!0,style:{position:`absolute`},children:(0,N.jsxs)(Op,{component:`div`,disablePadding:!0,style:{background:`#fff`,display:`flex`,flexDirection:`row`,padding:0},children:[(0,N.jsx)(E3,{button:!0,type:`submit`,value:`left`,"aria-label":`Align text left`,onClick:a,children:(0,N.jsx)(M6,{})}),(0,N.jsx)(E3,{button:!0,type:`submit`,value:`center`,"aria-label":`Align text center`,onClick:a,children:(0,N.jsx)(P6,{})}),(0,N.jsx)(E3,{button:!0,type:`submit`,value:`right`,"aria-label":`Align text right`,onClick:a,children:(0,N.jsx)(N6,{})}),(0,N.jsx)(E3,{button:!0,type:`submit`,value:`justify`,"aria-label":`Justify text`,onClick:a,children:(0,N.jsx)(F6,{})})]})})]})},L6=L(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans, Arial, sans-serif`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,whiteSpace:`nowrap`})),R6=()=>(0,N.jsx)(L6,{children:`CSS`}),z6=L(`path`)({fill:`grey`,"&:hover":{fill:`black`}}),B6=e=>t=>(0,N.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,version:`1.1`,width:`24`,height:`24`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(e,{...t})}),V6=B6(e=>(0,N.jsx)(z6,{...e,d:`M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z`})),H6=B6(e=>(0,N.jsx)(z6,{...e,d:`M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z`})),U6=B6(e=>(0,N.jsx)(z6,{...e,d:`M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z`})),W6=B6(e=>(0,N.jsx)(z6,{...e,d:`M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z`})),G6=B6(e=>(0,N.jsx)(z6,{...e,d:`M15.46,15.88L16.88,14.46L19,16.59L21.12,14.46L22.54,15.88L20.41,18L22.54,20.12L21.12,21.54L19,19.41L16.88,21.54L15.46,20.12L17.59,18L15.46,15.88M4,3H18A2,2 0 0,1 20,5V12.08C18.45,11.82 16.92,12.18 15.68,13H12V17H13.08C12.97,17.68 12.97,18.35 13.08,19H4A2,2 0 0,1 2,17V5A2,2 0 0,1 4,3M4,7V11H10V7H4M12,7V11H18V7H12M4,13V17H10V13H4Z`})),K6=`bottom`,q6=`right`,J6=`left`,Y6=`auto`,X6=[`top`,K6,q6,J6],Z6=`start`,Q6=`clippingParents`,$6=`viewport`,e8=`popper`,t8=`reference`,n8=X6.reduce(function(e,t){return e.concat([t+`-`+Z6,t+`-end`])},[]),r8=[].concat(X6,[Y6]).reduce(function(e,t){return e.concat([t,t+`-`+Z6,t+`-end`])},[]),i8=[`beforeRead`,`read`,`afterRead`,`beforeMain`,`main`,`afterMain`,`beforeWrite`,`write`,`afterWrite`];function a8(e){return e?(e.nodeName||``).toLowerCase():null}function o8(e){if(e==null)return window;if(e.toString()!==`[object Window]`){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function s8(e){return e instanceof o8(e).Element||e instanceof Element}function c8(e){return e instanceof o8(e).HTMLElement||e instanceof HTMLElement}function l8(e){return typeof ShadowRoot>`u`?!1:e instanceof o8(e).ShadowRoot||e instanceof ShadowRoot}function u8(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];!c8(i)||!a8(i)||(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];t===!1?i.removeAttribute(e):i.setAttribute(e,t===!0?``:t)}))})}function d8(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]=``,e},{});!c8(r)||!a8(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}}var f8={name:`applyStyles`,enabled:!0,phase:`write`,fn:u8,effect:d8,requires:[`computeStyles`]};function p8(e){return e.split(`-`)[0]}var m8=Math.max,h8=Math.min,g8=Math.round;function _8(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+`/`+e.version}).join(` `):navigator.userAgent}function v8(){return!/^((?!chrome|android).)*safari/i.test(_8())}function y8(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,a=1;t&&c8(e)&&(i=e.offsetWidth>0&&g8(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&g8(r.height)/e.offsetHeight||1);var o=(s8(e)?o8(e):window).visualViewport,s=!v8()&&n,c=(r.left+(s&&o?o.offsetLeft:0))/i,l=(r.top+(s&&o?o.offsetTop:0))/a,u=r.width/i,d=r.height/a;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c,x:c,y:l}}function b8(e){var t=y8(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function x8(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&l8(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function S8(e){return o8(e).getComputedStyle(e)}function C8(e){return[`table`,`td`,`th`].indexOf(a8(e))>=0}function w8(e){return((s8(e)?e.ownerDocument:e.document)||window.document).documentElement}function T8(e){return a8(e)===`html`?e:e.assignedSlot||e.parentNode||(l8(e)?e.host:null)||w8(e)}function E8(e){return!c8(e)||S8(e).position===`fixed`?null:e.offsetParent}function D8(e){var t=/firefox/i.test(_8());if(/Trident/i.test(_8())&&c8(e)&&S8(e).position===`fixed`)return null;var n=T8(e);for(l8(n)&&(n=n.host);c8(n)&&[`html`,`body`].indexOf(a8(n))<0;){var r=S8(n);if(r.transform!==`none`||r.perspective!==`none`||r.contain===`paint`||[`transform`,`perspective`].indexOf(r.willChange)!==-1||t&&r.willChange===`filter`||t&&r.filter&&r.filter!==`none`)return n;n=n.parentNode}return null}function O8(e){for(var t=o8(e),n=E8(e);n&&C8(n)&&S8(n).position===`static`;)n=E8(n);return n&&(a8(n)===`html`||a8(n)===`body`&&S8(n).position===`static`)?t:n||D8(e)||t}function k8(e){return[`top`,`bottom`].indexOf(e)>=0?`x`:`y`}function A8(e,t,n){return m8(e,h8(t,n))}function j8(e,t,n){var r=A8(e,t,n);return r>n?n:r}function M8(){return{top:0,right:0,bottom:0,left:0}}function N8(e){return Object.assign({},M8(),e)}function P8(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var F8=function(e,t){return e=typeof e==`function`?e(Object.assign({},t.rects,{placement:t.placement})):e,N8(typeof e==`number`?P8(e,X6):e)};function I8(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,s=p8(n.placement),c=k8(s),l=[`left`,`right`].indexOf(s)>=0?`height`:`width`;if(!(!a||!o)){var u=F8(i.padding,n),d=b8(a),f=c===`y`?`top`:J6,p=c===`y`?K6:q6,m=n.rects.reference[l]+n.rects.reference[c]-o[c]-n.rects.popper[l],h=o[c]-n.rects.reference[c],g=O8(a),_=g?c===`y`?g.clientHeight||0:g.clientWidth||0:0,v=m/2-h/2,y=u[f],b=_-d[l]-u[p],x=_/2-d[l]/2+v,S=A8(y,x,b),C=c;n.modifiersData[r]=(t={},t[C]=S,t.centerOffset=S-x,t)}}function L8(e){var t=e.state,n=e.options.element,r=n===void 0?`[data-popper-arrow]`:n;r!=null&&(typeof r==`string`&&(r=t.elements.popper.querySelector(r),!r)||x8(t.elements.popper,r)&&(t.elements.arrow=r))}var R8={name:`arrow`,enabled:!0,phase:`main`,fn:I8,effect:L8,requires:[`popperOffsets`],requiresIfExists:[`preventOverflow`]};function z8(e){return e.split(`-`)[1]}var B8={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};function V8(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:g8(n*i)/i||0,y:g8(r*i)/i||0}}function H8(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,o=e.offsets,s=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,p=f===void 0?0:f,m=o.y,h=m===void 0?0:m,g=typeof u==`function`?u({x:p,y:h}):{x:p,y:h};p=g.x,h=g.y;var _=o.hasOwnProperty(`x`),v=o.hasOwnProperty(`y`),y=J6,b=`top`,x=window;if(l){var S=O8(n),C=`clientHeight`,w=`clientWidth`;if(S===o8(n)&&(S=w8(n),S8(S).position!==`static`&&s===`absolute`&&(C=`scrollHeight`,w=`scrollWidth`)),S=S,i===`top`||(i===`left`||i===`right`)&&a===`end`){b=K6;var T=d&&S===x&&x.visualViewport?x.visualViewport.height:S[C];h-=T-r.height,h*=c?1:-1}if(i===`left`||(i===`top`||i===`bottom`)&&a===`end`){y=q6;var E=d&&S===x&&x.visualViewport?x.visualViewport.width:S[w];p-=E-r.width,p*=c?1:-1}}var D=Object.assign({position:s},l&&B8),O=u===!0?V8({x:p,y:h},o8(n)):{x:p,y:h};if(p=O.x,h=O.y,c){var ee;return Object.assign({},D,(ee={},ee[b]=v?`0`:``,ee[y]=_?`0`:``,ee.transform=(x.devicePixelRatio||1)<=1?`translate(`+p+`px, `+h+`px)`:`translate3d(`+p+`px, `+h+`px, 0)`,ee))}return Object.assign({},D,(t={},t[b]=v?h+`px`:``,t[y]=_?p+`px`:``,t.transform=``,t))}function U8(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0||r,a=n.adaptive,o=a===void 0||a,s=n.roundOffsets,c=s===void 0||s,l={placement:p8(t.placement),variation:z8(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy===`fixed`};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,H8(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,H8(Object.assign({},l,{offsets:t.modifiersData.arrow,position:`absolute`,adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var W8={name:`computeStyles`,enabled:!0,phase:`beforeWrite`,fn:U8,data:{}},G8={passive:!0};function K8(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0||i,o=r.resize,s=o===void 0||o,c=o8(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&l.forEach(function(e){e.addEventListener(`scroll`,n.update,G8)}),s&&c.addEventListener(`resize`,n.update,G8),function(){a&&l.forEach(function(e){e.removeEventListener(`scroll`,n.update,G8)}),s&&c.removeEventListener(`resize`,n.update,G8)}}var q8={name:`eventListeners`,enabled:!0,phase:`write`,fn:function(){},effect:K8,data:{}},J8={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Y8(e){return e.replace(/left|right|bottom|top/g,function(e){return J8[e]})}var X8={start:`end`,end:`start`};function Z8(e){return e.replace(/start|end/g,function(e){return X8[e]})}function Q8(e){var t=o8(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function $8(e){return y8(w8(e)).left+Q8(e).scrollLeft}function e5(e,t){var n=o8(e),r=w8(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;var l=v8();(l||!l&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s+$8(e),y:c}}function t5(e){var t=w8(e),n=Q8(e),r=e.ownerDocument?.body,i=m8(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=m8(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),o=-n.scrollLeft+$8(e),s=-n.scrollTop;return S8(r||t).direction===`rtl`&&(o+=m8(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:o,y:s}}function n5(e){var t=S8(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function r5(e){return[`html`,`body`,`#document`].indexOf(a8(e))>=0?e.ownerDocument.body:c8(e)&&n5(e)?e:r5(T8(e))}function i5(e,t){t===void 0&&(t=[]);var n=r5(e),r=n===e.ownerDocument?.body,i=o8(n),a=r?[i].concat(i.visualViewport||[],n5(n)?n:[]):n,o=t.concat(a);return r?o:o.concat(i5(T8(a)))}function a5(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function o5(e,t){var n=y8(e,!1,t===`fixed`);return n.top+=e.clientTop,n.left+=e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function s5(e,t,n){return t===`viewport`?a5(e5(e,n)):s8(t)?o5(t,n):a5(t5(w8(e)))}function c5(e){var t=i5(T8(e)),n=[`absolute`,`fixed`].indexOf(S8(e).position)>=0&&c8(e)?O8(e):e;return s8(n)?t.filter(function(e){return s8(e)&&x8(e,n)&&a8(e)!==`body`}):[]}function l5(e,t,n,r){var i=t===`clippingParents`?c5(e):[].concat(t),a=[].concat(i,[n]),o=a[0],s=a.reduce(function(t,n){var i=s5(e,n,r);return t.top=m8(i.top,t.top),t.right=h8(i.right,t.right),t.bottom=h8(i.bottom,t.bottom),t.left=m8(i.left,t.left),t},s5(e,o,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function u5(e){var t=e.reference,n=e.element,r=e.placement,i=r?p8(r):null,a=r?z8(r):null,o=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,c;switch(i){case`top`:c={x:o,y:t.y-n.height};break;case K6:c={x:o,y:t.y+t.height};break;case q6:c={x:t.x+t.width,y:s};break;case J6:c={x:t.x-n.width,y:s};break;default:c={x:t.x,y:t.y}}var l=i?k8(i):null;if(l!=null){var u=l===`y`?`height`:`width`;switch(a){case Z6:c[l]=c[l]-(t[u]/2-n[u]/2);break;case`end`:c[l]=c[l]+(t[u]/2-n[u]/2);break;default:}}return c}function d5(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.strategy,o=a===void 0?e.strategy:a,s=n.boundary,c=s===void 0?Q6:s,l=n.rootBoundary,u=l===void 0?$6:l,d=n.elementContext,f=d===void 0?e8:d,p=n.altBoundary,m=p!==void 0&&p,h=n.padding,g=h===void 0?0:h,_=N8(typeof g==`number`?P8(g,X6):g),v=f===`popper`?t8:e8,y=e.rects.popper,b=e.elements[m?v:f],x=l5(s8(b)?b:b.contextElement||w8(e.elements.popper),c,u,o),S=y8(e.elements.reference),C=u5({reference:S,element:y,strategy:`absolute`,placement:i}),w=a5(Object.assign({},y,C)),T=f===`popper`?w:S,E={top:x.top-T.top+_.top,bottom:T.bottom-x.bottom+_.bottom,left:x.left-T.left+_.left,right:T.right-x.right+_.right},D=e.modifiersData.offset;if(f===`popper`&&D){var O=D[i];Object.keys(E).forEach(function(e){var t=[`right`,`bottom`].indexOf(e)>=0?1:-1,n=[`top`,`bottom`].indexOf(e)>=0?`y`:`x`;E[e]+=O[n]*t})}return E}function f5(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,o=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?r8:c,u=z8(r),d=u?s?n8:n8.filter(function(e){return z8(e)===u}):X6,f=d.filter(function(e){return l.indexOf(e)>=0});f.length===0&&(f=d);var p=f.reduce(function(t,n){return t[n]=d5(e,{placement:n,boundary:i,rootBoundary:a,padding:o})[p8(n)],t},{});return Object.keys(p).sort(function(e,t){return p[e]-p[t]})}function p5(e){if(p8(e)===`auto`)return[];var t=Y8(e);return[Z8(e),t,Z8(t)]}function m5(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o===void 0||o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,m=p===void 0||p,h=n.allowedAutoPlacements,g=t.options.placement,_=p8(g)===g,v=c||(_||!m?[Y8(g)]:p5(g)),y=[g].concat(v).reduce(function(e,n){return e.concat(p8(n)===`auto`?f5(t,{placement:n,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:h}):n)},[]),b=t.rects.reference,x=t.rects.popper,S=new Map,C=!0,w=y[0],T=0;T<y.length;T++){var E=y[T],D=p8(E),O=z8(E)===Z6,ee=[`top`,K6].indexOf(D)>=0,te=ee?`width`:`height`,k=d5(t,{placement:E,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),A=ee?O?q6:J6:O?K6:`top`;b[te]>x[te]&&(A=Y8(A));var ne=Y8(A),j=[];if(a&&j.push(k[D]<=0),s&&j.push(k[A]<=0,k[ne]<=0),j.every(function(e){return e})){w=E,C=!1;break}S.set(E,j)}if(C)for(var re=m?3:1,ie=function(e){var t=y.find(function(t){var n=S.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return w=t,`break`},ae=re;ae>0&&ie(ae)!==`break`;ae--);t.placement!==w&&(t.modifiersData[r]._skip=!0,t.placement=w,t.reset=!0)}}var h5={name:`flip`,enabled:!0,phase:`main`,fn:m5,requiresIfExists:[`offset`],data:{_skip:!1}};function g5(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function _5(e){return[`top`,q6,K6,J6].some(function(t){return e[t]>=0})}function v5(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,o=d5(t,{elementContext:`reference`}),s=d5(t,{altBoundary:!0}),c=g5(o,r),l=g5(s,i,a),u=_5(c),d=_5(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var y5={name:`hide`,enabled:!0,phase:`main`,requiresIfExists:[`preventOverflow`],fn:v5};function b5(e,t,n){var r=p8(e),i=[`left`,`top`].indexOf(r)>=0?-1:1,a=typeof n==`function`?n(Object.assign({},t,{placement:e})):n,o=a[0],s=a[1];return o||=0,s=(s||0)*i,[`left`,`right`].indexOf(r)>=0?{x:s,y:o}:{x:o,y:s}}function x5(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,o=r8.reduce(function(e,n){return e[n]=b5(n,t.rects,a),e},{}),s=o[t.placement],c=s.x,l=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}var S5={name:`offset`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:x5};function C5(e){var t=e.state,n=e.name;t.modifiersData[n]=u5({reference:t.rects.reference,element:t.rects.popper,strategy:`absolute`,placement:t.placement})}var w5={name:`popperOffsets`,enabled:!0,phase:`read`,fn:C5,data:{}};function T5(e){return e===`x`?`y`:`x`}function E5(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o!==void 0&&o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0||f,m=n.tetherOffset,h=m===void 0?0:m,g=d5(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),_=p8(t.placement),v=z8(t.placement),y=!v,b=k8(_),x=T5(b),S=t.modifiersData.popperOffsets,C=t.rects.reference,w=t.rects.popper,T=typeof h==`function`?h(Object.assign({},t.rects,{placement:t.placement})):h,E=typeof T==`number`?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),D=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(S){if(a){var ee=b===`y`?`top`:J6,te=b===`y`?K6:q6,k=b===`y`?`height`:`width`,A=S[b],ne=A+g[ee],j=A-g[te],re=p?-w[k]/2:0,ie=v===`start`?C[k]:w[k],ae=v===`start`?-w[k]:-C[k],oe=t.elements.arrow,se=p&&oe?b8(oe):{width:0,height:0},ce=t.modifiersData[`arrow#persistent`]?t.modifiersData[`arrow#persistent`].padding:M8(),le=ce[ee],ue=ce[te],de=A8(0,C[k],se[k]),fe=y?C[k]/2-re-de-le-E.mainAxis:ie-de-le-E.mainAxis,pe=y?-C[k]/2+re+de+ue+E.mainAxis:ae+de+ue+E.mainAxis,me=t.elements.arrow&&O8(t.elements.arrow),he=me?b===`y`?me.clientTop||0:me.clientLeft||0:0,ge=D?.[b]??0,_e=A+fe-ge-he,ve=A+pe-ge,ye=A8(p?h8(ne,_e):ne,A,p?m8(j,ve):j);S[b]=ye,O[b]=ye-A}if(s){var be=b===`x`?`top`:J6,xe=b===`x`?K6:q6,Se=S[x],Ce=x===`y`?`height`:`width`,we=Se+g[be],Te=Se-g[xe],Ee=[`top`,J6].indexOf(_)!==-1,De=D?.[x]??0,Oe=Ee?we:Se-C[Ce]-w[Ce]-De+E.altAxis,ke=Ee?Se+C[Ce]+w[Ce]-De-E.altAxis:Te,Ae=p&&Ee?j8(Oe,Se,ke):A8(p?Oe:we,Se,p?ke:Te);S[x]=Ae,O[x]=Ae-Se}t.modifiersData[r]=O}}var D5={name:`preventOverflow`,enabled:!0,phase:`main`,fn:E5,requiresIfExists:[`offset`]};function O5(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function k5(e){return e===o8(e)||!c8(e)?Q8(e):O5(e)}function A5(e){var t=e.getBoundingClientRect(),n=g8(t.width)/e.offsetWidth||1,r=g8(t.height)/e.offsetHeight||1;return n!==1||r!==1}function j5(e,t,n){n===void 0&&(n=!1);var r=c8(t),i=c8(t)&&A5(t),a=w8(t),o=y8(e,i,n),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((a8(t)!==`body`||n5(a))&&(s=k5(t)),c8(t)?(c=y8(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=$8(a))),{x:o.left+s.scrollLeft-c.x,y:o.top+s.scrollTop-c.y,width:o.width,height:o.height}}function M5(e){var t=new Map,n=new Set,r=[];e.forEach(function(e){t.set(e.name,e)});function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}}),r.push(e)}return e.forEach(function(e){n.has(e.name)||i(e)}),r}function N5(e){var t=M5(e);return i8.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}function P5(e){var t;return function(){return t||=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})}),t}}function F5(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}var I5={placement:`bottom`,modifiers:[],strategy:`absolute`};function L5(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&typeof e.getBoundingClientRect==`function`)})}function R5(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?I5:i;return function(e,t,n){n===void 0&&(n=a);var i={placement:`bottom`,orderedModifiers:[],options:Object.assign({},I5,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},o=[],s=!1,c={state:i,setOptions:function(n){var o=typeof n==`function`?n(i.options):n;u(),i.options=Object.assign({},a,i.options,o),i.scrollParents={reference:s8(e)?i5(e):e.contextElement?i5(e.contextElement):[],popper:i5(t)};var s=N5(F5([].concat(r,i.options.modifiers)));return i.orderedModifiers=s.filter(function(e){return e.enabled}),l(),c.update()},forceUpdate:function(){if(!s){var e=i.elements,t=e.reference,n=e.popper;if(L5(t,n)){i.rects={reference:j5(t,O8(n),i.options.strategy===`fixed`),popper:b8(n)},i.reset=!1,i.placement=i.options.placement,i.orderedModifiers.forEach(function(e){return i.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<i.orderedModifiers.length;r++){if(i.reset===!0){i.reset=!1,r=-1;continue}var a=i.orderedModifiers[r],o=a.fn,l=a.options,u=l===void 0?{}:l,d=a.name;typeof o==`function`&&(i=o({state:i,options:u,name:d,instance:c})||i)}}}},update:P5(function(){return new Promise(function(e){c.forceUpdate(),e(i)})}),destroy:function(){u(),s=!0}};if(!L5(e,t))return c;c.setOptions(n).then(function(e){!s&&n.onFirstUpdate&&n.onFirstUpdate(e)});function l(){i.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=n===void 0?{}:n,a=e.effect;if(typeof a==`function`){var s=a({state:i,name:t,instance:c,options:r});o.push(s||function(){})}})}function u(){o.forEach(function(e){return e()}),o=[]}return c}}var z5=R5({defaultModifiers:[q8,w5,W8,f8,S5,h5,D5,R8,y5]});function B5(e){return F(`MuiPopper`,e)}mi(`MuiPopper`,[`root`]);function V5(e,t){if(t===`ltr`)return e;switch(e){case`bottom-end`:return`bottom-start`;case`bottom-start`:return`bottom-end`;case`top-end`:return`top-start`;case`top-start`:return`top-end`;default:return e}}function H5(e){return typeof e==`function`?e():e}function U5(e){return e.nodeType!==void 0}var W5=e=>{let{classes:t}=e;return Fa({root:[`root`]},B5,t)},G5={},K5=M.forwardRef(function(e,t){let{anchorEl:n,children:r,direction:i,disablePortal:a,modifiers:o,open:s,placement:c,popperOptions:l,popperRef:u,slotProps:d={},slots:f={},TransitionProps:p,ownerState:m,...h}=e,g=M.useRef(null),_=Oc(g,t),v=M.useRef(null),y=Oc(v,u),b=M.useRef(y);Oi(()=>{b.current=y},[y]),M.useImperativeHandle(u,()=>v.current,[]);let x=V5(c,i),[S,C]=M.useState(x),[w,T]=M.useState(H5(n));M.useEffect(()=>{v.current&&v.current.forceUpdate()}),M.useEffect(()=>{n&&T(H5(n))},[n]),Oi(()=>{if(!w||!s)return;let e=e=>{C(e.placement)},t=[{name:`preventOverflow`,options:{altBoundary:a}},{name:`flip`,options:{altBoundary:a}},{name:`onUpdate`,enabled:!0,phase:`afterWrite`,fn:({state:t})=>{e(t)}}];o!=null&&(t=t.concat(o)),l&&l.modifiers!=null&&(t=t.concat(l.modifiers));let n=z5(w,g.current,{placement:x,...l,modifiers:t});b.current(n);let r=g.current;return()=>{if(r){let{style:e}=r,t=e.position,i=e.top,a=e.left,o=e.transform;n.destroy(),e.position=t,e.top=i,e.left=a,e.transform=o}else n.destroy();b.current(null)}},[w,a,o,s,l,x]);let E={placement:S};p!==null&&(E.TransitionProps=p);let D=W5(e),O=f.root??`div`;return(0,N.jsx)(O,{...Cp({elementType:O,externalSlotProps:d.root,externalForwardedProps:h,additionalProps:{role:`tooltip`,ref:_},ownerState:e,className:D.root}),children:typeof r==`function`?r(E):r})}),q5=L(M.forwardRef(function(e,t){let{anchorEl:n,children:r,container:i,direction:a=`ltr`,disablePortal:o=!1,keepMounted:s=!1,modifiers:c,open:l,placement:u=`bottom`,popperOptions:d=G5,popperRef:f,style:p,transition:m=!1,slotProps:h={},slots:g={},..._}=e,[v,y]=M.useState(!0),b=()=>{y(!1)},x=()=>{y(!0)};if(!s&&!l&&(!m||v))return null;let S;if(i)S=i;else if(n){let e=H5(n);S=e&&U5(e)?mc(e).body:mc(null).body}let C=!l&&s&&(!m||v)?`none`:void 0,w=m?{in:l,onEnter:b,onExited:x}:void 0;return(0,N.jsx)(al,{disablePortal:o,container:S,children:(0,N.jsx)(K5,{anchorEl:n,direction:a,disablePortal:o,modifiers:c,ref:t,open:m?!v:l,placement:u,popperOptions:d,popperRef:f,slotProps:h,slots:g,..._,style:{position:`fixed`,top:0,left:0,display:C,...p},TransitionProps:w,children:r})})}),{name:`MuiPopper`,slot:`Root`})({}),J5=L(M.forwardRef(function(e,t){let n=ea(),{anchorEl:r,component:i,components:a,componentsProps:o,container:s,disablePortal:c,keepMounted:l,modifiers:u,open:d,placement:f,popperOptions:p,popperRef:m,transition:h,slots:g,slotProps:_,...v}=dc({props:e,name:`MuiPopper`}),y=g?.root??a?.Root,b={anchorEl:r,container:s,disablePortal:c,keepMounted:l,modifiers:u,open:d,placement:f,popperOptions:p,popperRef:m,transition:h,...v};return(0,N.jsx)(q5,{as:i,direction:n?`rtl`:`ltr`,slots:{root:y},slotProps:_??o,...b,ref:t})}))({background:`#fff`,padding:`10px`,pointerEvents:`none`,zIndex:99999}),Y5=L(G$)({fontSize:50,textAlign:`center`}),X5=({children:e,...t})=>(0,N.jsx)(J5,{id:`mouse-over-popover`,open:!0,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},disableRestoreFocus:!0,disableAutoFocus:!0,...t,children:(0,N.jsx)(Y5,{children:e})}),Z5=({letter:e})=>(0,N.jsx)(`div`,{style:{fontSize:`24px`,lineHeight:`24px`},children:e});Z5.propTypes={letter:k.string};function Q5({editor:e,opts:t,onClose:n}){if(!t?.characters?.length)return null;let r=(0,M.useRef)(null),i=(0,M.useRef)(n),[a,o]=(0,M.useState)({top:0,left:0}),[s,c]=(0,M.useState)(null);i.current=n;let l=(0,M.useMemo)(()=>{if(!t)return A6;switch(!0){case t.language===`spanish`:return A6;case t.language===`special`:return j6;default:return t}},[t]),u=(0,M.useMemo)(()=>l.characters.reduce((e,t)=>(t.length>=e.columns&&(e.columns=t.length),e),{rows:l.characters.length,columns:0}),[l]),d=()=>c(null);(0,M.useEffect)(()=>()=>{d()},[]),(0,M.useEffect)(()=>{if(!e)return;let t=e.options.element,n=e.view.dom,a=()=>{if(!r.current)return;let n=t.getBoundingClientRect(),{from:i}=e.state.selection,a=e.view.coordsAtPos(i),s=r.current.offsetHeight,c=r.current.offsetWidth,l=window.innerHeight-(n.bottom+60)>=s||n.top<s+80?n.bottom+60:n.top-s-20,u=a.left;l=Math.max(8,Math.min(l,window.innerHeight-s-8)),u=Math.max(8,Math.min(u,window.innerWidth-c-8)),o({top:l,left:u})};a();let s=null,c=()=>{s===null&&(s=requestAnimationFrame(()=>{s=null,a()}))};window.addEventListener(`scroll`,c,!0),window.addEventListener(`resize`,c);let l=e=>{r.current&&!r.current.contains(e.target)&&!n.contains(e.target)&&i.current()},u=setTimeout(()=>{document.addEventListener(`click`,l)});return()=>{clearTimeout(u),s!==null&&cancelAnimationFrame(s),window.removeEventListener(`scroll`,c,!0),window.removeEventListener(`resize`,c),document.removeEventListener(`click`,l)}},[e]);let f=(e,t)=>c({anchorEl:e.currentTarget,el:t});return(0,N.jsxs)(N.Fragment,{children:[hs.createPortal((0,N.jsx)(`div`,{ref:r,className:`insert-character-dialog`,"data-toolbar-for":e.instanceId,style:{visibility:a.top===0&&a.left===0?`hidden`:`initial`,position:`fixed`,top:`${a.top}px`,left:`${a.left}px`,maxWidth:`500px`,zIndex:1e3},children:(0,N.jsx)(`div`,{children:(0,N.jsx)(G0,{keyPadCharacterRef:t.keyPadCharacterRef,setKeypadInteraction:t.setKeypadInteraction,autoFocus:!0,noDecimal:!0,hideInput:!0,noLatexHandling:!0,hideDoneButtonBackground:!0,layoutForKeyPad:u,additionalKeys:l.characters.reduce((e,t)=>(e=[...e,...t.map(e=>({name:oe(e,`name`)||e,write:oe(e,`write`)||e,label:oe(e,`label`)||e,category:`character`,extraClass:`character`,extraProps:{...e.extraProps||{},style:{...(e.extraProps||{}).style,border:`1px solid #000`}},...l.hasPreview?{actions:{onMouseEnter:t=>f(t,e),onMouseLeave:d}}:{}}))],e),[]),keypadMode:`language`,onChange:t=>{typeof t==`string`&&e.chain().focus().insertContent(t).run()},onDone:n})})}),document.body),s&&hs.createPortal((0,N.jsxs)(X5,{onClose:d,anchorEl:s.anchorEl,children:[(0,N.jsx)(`div`,{children:s.el.label}),(0,N.jsx)(`div`,{style:{fontSize:20,lineHeight:`20px`},children:s.el.description}),(0,N.jsx)(`div`,{style:{fontSize:20,lineHeight:`20px`},children:s.el.unicode})]}),document.body)]})}Q5.propTypes={editor:k.object,opts:k.object,onClose:k.func.isRequired};var $5=()=>(0,N.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M22,7h-2v1h3v1h-4V7c0-0.55,0.45-1,1-1h2V5h-3V4h3c0.55,0,1,0.45,1,1v1C23,6.55,22.55,7,22,7z M5.88,20h2.66l3.4-5.42h0.12 l3.4,5.42h2.66l-4.65-7.27L17.81,6h-2.68l-3.07,4.99h-0.12L8.85,6H6.19l4.32,6.73L5.88,20z`,fill:`currentColor`})}),e7=()=>(0,N.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M22,18h-2v1h3v1h-4v-2c0-0.55,0.45-1,1-1h2v-1h-3v-1h3c0.55,0,1,0.45,1,1v1C23,17.55,22.55,18,22,18z M5.88,18h2.66 l3.4-5.42h0.12l3.4,5.42h2.66l-4.65-7.27L17.81,4h-2.68l-3.07,4.99h-0.12L8.85,4H6.19l4.32,6.73L5.88,18z`,fill:`currentColor`})}),t7=()=>(0,N.jsx)(`svg`,{width:`30`,height:`28`,viewBox:`0 0 30 28`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{width:`20px`,height:`18px`},"aria-hidden":`true`,focusable:`false`,children:(0,N.jsx)(`path`,{d:`M27 4V24H29C29.5 24 30 24.5 30 25V27C30 27.5625 29.5 28 29 28H19C18.4375 28 18 27.5625 18 27V25C18 24.5 18.4375 24 19 24H21V16H9V24H11C11.5 24 12 24.5 12 25V27C12 27.5625 11.5 28 11 28H1C0.4375 28 0 27.5625 0 27V25C0 24.5 0.4375 24 1 24H3V4H1C0.4375 4 0 3.5625 0 3V1C0 0.5 0.4375 0 1 0H11C11.5 0 12 0.5 12 1V3C12 3.5625 11.5 4 11 4H9V12H21V4H19C18.4375 4 18 3.5625 18 3V1C18 0.5 18.4375 0 19 0H29C29.5 0 30 0.5 30 1V3C30 3.5625 29.5 4 29 4H27Z`,fill:`currentColor`})});function n7({editor:e,classes:t,activePlugins:n,toolbarOpts:r,responseAreaProps:i,onChange:a,autoWidthToolbar:o}){let[s,c]=(0,M.useState)(!1),l=r??{},u=uM({editor:e,selector:e=>{let{selection:t}=e.editor?.state||{},n;if(!e.editor?.commandManager)return{};t instanceof W&&(n=t.node);let r=e.editor?.isActive(`math`)||e.editor?.isActive(`explicit_constructed_response`)||e.editor?.isActive(`imageUploadNode`)||e.editor?.isActive(`drag_in_the_blank`),i=t&&t.empty===!1&&e.editor.isActive(`table`);return{currentNode:n,hideDefaultToolbar:r,hasTextSelectionInTable:i,isFocused:e.editor?.isFocused,toolbarOpened:e.editor?._toolbarOpened??!1,isBold:e.editor.isActive(`bold`)??!1,canBold:e.editor.can().chain().toggleBold().run()??!1,isTable:e.editor.isActive(`table`)??!1,tableHasBorder:e.editor.getAttributes(`table`)?.border===`1`,canTable:e.editor.can().chain().insertTable().run()??!1,isItalic:e.editor.isActive(`italic`)??!1,canItalic:e.editor.can().chain().toggleItalic().run()??!1,isStrike:e.editor.isActive(`strike`)??!1,canStrike:e.editor.can().chain().toggleStrike().run()??!1,isCode:e.editor.isActive(`code`)??!1,canCode:e.editor.can().chain().toggleCode().run()??!1,canClearMarks:e.editor.can().chain().unsetAllMarks().run()??!1,isUnderline:e.editor.isActive(`underline`)??!1,isSubScript:e.editor.isActive(`subscript`)??!1,isSuperScript:e.editor.isActive(`superscript`)??!1,isParagraph:e.editor.isActive(`paragraph`)??!1,isHeading1:e.editor.isActive(`heading`,{level:1})??!1,isHeading2:e.editor.isActive(`heading`,{level:2})??!1,isHeading3:e.editor.isActive(`heading`,{level:3})??!1,isHeadingParagraph:e.editor.isActive(`headingParagraph`)??!1,isHeading4:e.editor.isActive(`heading`,{level:4})??!1,isHeading5:e.editor.isActive(`heading`,{level:5})??!1,isHeading6:e.editor.isActive(`heading`,{level:6})??!1,isBulletList:e.editor.isActive(`bulletList`)??!1,isOrderedList:e.editor.isActive(`orderedList`)??!1,isCodeBlock:e.editor.isActive(`codeBlock`)??!1,isBlockquote:e.editor.isActive(`blockquote`)??!1,canUndo:e.editor.can().chain().undo().run()??!1,canRedo:e.editor.can().chain().redo().run()??!1}}}),d=!!o,f=P(t.toolbar,sJ,{[t.toolbarWithNoDone]:!0,[t.toolbarTop]:l.position===`top`,[t.toolbarRight]:l.alignment===`right`,[t.focused]:l.alwaysVisible||u.isFocused&&!u.toolbarOpened&&!u.hideDefaultToolbar,[t.autoWidth]:d,[t.fullWidth]:!d,[t.hidden]:l.isHidden===!0}),p=l.minWidth===void 0?{}:{minWidth:l.minWidth},m=e=>{e.preventDefault()},h=(0,M.useMemo)(()=>[{icon:(0,N.jsx)(_6,{}),label:`Insert table`,onClick:e=>e.chain().focus().insertTable({rows:2,cols:2,withHeaderRow:!1}).run(),hidden:e=>!n?.includes(`table`)||e.isTable,isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(V6,{}),label:`Add table row`,onClick:e=>e.chain().focus().addRowAfter().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(H6,{}),label:`Remove table row`,onClick:e=>e.chain().focus().deleteRow().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(U6,{}),label:`Add table column`,onClick:e=>e.chain().focus().addColumnAfter().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(W6,{}),label:`Remove table column`,onClick:e=>e.chain().focus().deleteColumn().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(G6,{}),label:`Remove table`,onClick:e=>e.chain().focus().deleteTable().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(D6,{}),label:`Table borders`,toggle:!0,onClick:e=>{let t=e.getAttributes(`table`),n={...t,border:t.border===`0`?`1`:`0`};e.commands.updateAttributes(`table`,n)},hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.tableHasBorder,isDisabled:e=>!e.canTable},{icon:(0,N.jsx)(p6,{}),label:`Bold`,toggle:!0,onClick:e=>e.chain().focus().toggleBold().run(),hidden:()=>!n?.includes(`bold`),isActive:e=>e.isBold,isDisabled:e=>!e.canBold},{icon:(0,N.jsx)(m6,{}),label:`Italic`,toggle:!0,onClick:e=>e.chain().focus().toggleItalic().run(),hidden:()=>!n?.includes(`italic`),isActive:e=>e.isItalic,isDisabled:e=>!e.canItalic},{icon:(0,N.jsx)(h6,{}),label:`Strikethrough`,toggle:!0,onClick:e=>e.chain().focus().toggleStrike().run(),hidden:()=>!n?.includes(`strikethrough`),isActive:e=>e.isStrike,isDisabled:e=>!e.canStrike},{icon:(0,N.jsx)(g6,{}),label:`Code`,toggle:!0,onClick:e=>e.chain().focus().toggleCode().run(),hidden:()=>!n?.includes(`code`),isActive:e=>e.isCode,isDisabled:e=>!e.canCode},{icon:(0,N.jsx)(b6,{}),label:`Underline`,toggle:!0,onClick:e=>e.chain().focus().toggleUnderline().run(),hidden:()=>!n?.includes(`underline`),isActive:e=>e.isUnderline},{icon:(0,N.jsx)(e7,{}),label:`Subscript`,toggle:!0,onClick:e=>e.chain().focus().toggleSubscript().run(),hidden:()=>!n?.includes(`subscript`),isActive:e=>e.isSubScript},{icon:(0,N.jsx)($5,{}),label:`Superscript`,toggle:!0,onClick:e=>e.chain().focus().toggleSuperscript().run(),hidden:()=>!n?.includes(`superscript`),isActive:e=>e.isSuperScript},{icon:(0,N.jsx)(S6,{}),label:`Insert image`,hidden:()=>!n?.includes(`image`),onClick:e=>e.chain().focus().setImageUploadNode().run()},{icon:(0,N.jsx)(T6,{}),label:`Insert video`,hidden:()=>!n?.includes(`video`),onClick:e=>e.chain().focus().insertMedia({type:`video`}).run()},{icon:(0,N.jsx)(E6,{}),label:`Insert audio`,hidden:()=>!n?.includes(`audio`),onClick:e=>e.chain().focus().insertMedia({type:`audio`,tag:`audio`}).run()},{icon:(0,N.jsx)(R6,{}),label:`CSS classes`,hidden:()=>!n?.includes(`css`),onClick:e=>e.commands.openCSSClassDialog()},{icon:(0,N.jsx)(w6,{}),label:`Blockquote`,toggle:!0,hidden:()=>!n?.includes(`blockquote`),onClick:e=>e.chain().focus().toggleBlockquote().run(),isActive:e=>e.isBlockquote},{icon:(0,N.jsx)(t7,{}),label:`Heading`,toggle:!0,hidden:()=>!n?.includes(`h3`),onClick:e=>e.chain().focus().toggleHeadingParagraph().run(),isActive:e=>e.isHeadingParagraph},{icon:(0,N.jsx)(x6,{}),label:`Insert math`,hidden:()=>!n?.includes(`math`),onClick:e=>e.chain().focus().insertMath(``).run()},{icon:(0,N.jsx)(Z5,{letter:`ñ`}),label:`Spanish characters (ñ)`,hidden:()=>!n?.includes(`languageCharacters`),onClick:()=>c(A6)},{icon:(0,N.jsx)(Z5,{letter:`€`}),label:`Special characters (€)`,hidden:()=>n?.filter(e=>e===`languageCharacters`).length!==2,onClick:()=>c(j6)},{icon:(0,N.jsx)(I6,{editor:e}),label:`Text alignment`,hidden:()=>!n?.includes(`text-align`),onClick:()=>{}},{icon:(0,N.jsx)(v6,{}),label:`Bulleted list`,toggle:!0,hidden:()=>!n?.includes(`bulleted-list`),onClick:e=>e.chain().focus().toggleBulletList().run(),isActive:e=>e.isBulletList},{icon:(0,N.jsx)(y6,{}),label:`Numbered list`,toggle:!0,hidden:()=>!n?.includes(`numbered-list`),onClick:e=>e.chain().focus().toggleOrderedList().run(),isActive:e=>e.isOrderedList},{icon:(0,N.jsx)(Of,{}),label:`Undo`,hidden:()=>!n?.includes(`undo`),onClick:e=>e.chain().focus().undo().run(),isDisabled:e=>!e.canUndo},{icon:(0,N.jsx)(C6,{}),label:`Redo`,hidden:()=>!n?.includes(`redo`),onClick:e=>e.chain().focus().redo().run(),isDisabled:e=>!e.canRedo}],[n,e]),g=u.hideDefaultToolbar&&u.currentNode?.type?.name===`drag_in_the_blank`;return(0,N.jsxs)(`div`,{className:f,style:{...p},onMouseDown:m,children:[g&&(0,N.jsx)(`div`,{className:t.defaultToolbar,tabIndex:`1`,children:(0,N.jsx)(`div`,{className:t.buttonsContainer,children:(0,N.jsx)(`button`,{type:`button`,className:t.button,onClick:t=>{t.preventDefault(),e.chain().focus().deleteSelection().run(),a?.(e.getHTML())},"aria-label":`Delete response area`,title:`Delete response area`,children:(0,N.jsx)(oJ,{})})})}),!u.hideDefaultToolbar&&(0,N.jsxs)(`div`,{className:t.defaultToolbar,tabIndex:`1`,children:[(0,N.jsx)(`div`,{className:t.buttonsContainer,children:h.filter(e=>!e.hidden?.(u)).map((n,r)=>{let i=n.isDisabled?.(u),a=n.isActive?.(u);return(0,N.jsx)(`button`,{type:`button`,disabled:i,"aria-label":n.label,title:n.label,"aria-pressed":n.toggle?!!a:void 0,onClick:t=>{t.preventDefault(),n.onClick(e)},className:P(t.button,{[t.active]:a}),children:n.icon},r)})}),n?.includes(`responseArea`)&&(0,N.jsx)(`button`,{type:`button`,"aria-label":`Insert response area`,title:`Insert response area`,onClick:()=>{e.chain().focus().insertResponseArea(i.type).run()},className:t.button,children:(0,N.jsx)(k6,{})}),l.showDone&&(0,N.jsx)(dJ,{onClick:()=>{a?.(e.getHTML()),e.commands.blur()}})]}),s&&(0,N.jsx)(Q5,{editor:e,opts:{...s,renderPopOver:(e,t)=>console.log(`Show popover`,t),closePopOver:()=>console.log(`Close popover`)},onClose:()=>c(!1)})]})}var r7=e=>{Jo();let t={defaultToolbar:`defaultToolbar`,buttonsContainer:`buttonsContainer`,button:`toolbarButton`,active:`active`,disabled:`disabled`,isActive:`isActive`,toolbar:`toolbar`,toolbarWithNoDone:`toolbarWithNoDone`,toolbarTop:`toolbarTop`,toolbarRight:`toolbarRight`,fullWidth:`fullWidth`,hidden:`hidden`,autoWidth:`autoWidth`,focused:`focused`,iconRoot:`iconRoot`,label:`label`,shared:`shared`};return(0,N.jsx)(i7,{children:(0,N.jsx)(n7,{...e,classes:t})})},i7=L(`div`)(()=>({"& .defaultToolbar":{display:`flex`,width:`100%`,justifyContent:`space-between`},"& .buttonsContainer":{alignItems:`center`,display:`flex`,width:`100%`},"& .toolbarButton":{color:`grey`,display:`inline-flex`,padding:`2px`,background:`none`,border:`none`,cursor:`pointer`,"& svg":{width:`24px`,height:`24px`},"&:hover":{color:lu()},"&:focus":{outline:`2px solid ${Xu()}`}},"& .active":{color:lu()},"& .disabled":{opacity:.7,cursor:`not-allowed`,"& :hover":{color:uu()}},"& .isActive":{background:`var(--purple)`,color:`var(--white)`},"& .toolbar":{position:`absolute`,zIndex:20,cursor:`pointer`,justifyContent:`space-between`,background:`var(--editable-html-toolbar-bg, #efefef)`,minWidth:`280px`,margin:`5px 0 0 0`,padding:`2px`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,boxSizing:`border-box`,display:`flex`,opacity:0,pointerEvents:`none`},"& .toolbarWithNoDone":{minWidth:`265px`},"& .toolbarTop":{top:`-45px`},"& .toolbarRight":{right:0},"& .fullWidth":{width:`100%`},"& .hidden":{visibility:`hidden`},"& .autoWidth":{width:`auto`},"& .focused":{opacity:1,pointerEvents:`auto`},"& .iconRoot":{width:`28px`,height:`28px`,padding:`4px`,verticalAlign:`top`},"& .label":{color:`var(--editable-html-toolbar-check, #00bb00)`},"& .shared":{display:`flex`}})),a7=L(`div`,{shouldForwardProp:e=>![`noBorder`,`error`].includes(e)})(({theme:e,noBorder:t,error:n})=>({position:`relative`,padding:`0px`,border:t?`none`:`1px solid #ccc`,borderRadius:`4px`,cursor:`text`,'& [data-slate-editor="true"]':{wordBreak:`break-word`,overflow:`visible`,maxHeight:`500px`,padding:`5px`},"&:first-child":{marginTop:0},"& ul, & ol":{padding:`0 1rem`,margin:`1.25rem 1rem 1.25rem 0.4rem`},"& ul li p, & ol li p":{marginTop:`0.25em`,marginBottom:`0.25em`},"& h1, & h2, & h3, & h4, & h5, & h6":{lineHeight:1.1,marginTop:`2.5rem`,textWrap:`pretty`},"& h1, & h2":{marginTop:`3.5rem`,marginBottom:`1.5rem`},"& h1":{fontSize:`1.4rem`},"& h2":{fontSize:`1.2rem`},"& h3":{fontSize:`1.1rem`},"& h4, & h5, & h6":{fontSize:`1rem`},"& code":{backgroundColor:`var(--purple-light)`,borderRadius:`0.4rem`,color:`var(--black)`,fontSize:`0.85rem`,padding:`0.25em 0.3em`},"& pre":{background:`var(--black)`,borderRadius:`0.5rem`,color:`var(--white)`,fontFamily:`'JetBrainsMono', monospace`,margin:`1.5rem 0`,padding:`0.75rem 1rem`,"& code":{background:`none`,color:`inherit`,fontSize:`0.8rem`,padding:0}},"& blockquote":{background:`#f9f9f9`,borderLeft:`5px solid #ccc`,margin:`1.5em 10px`,padding:`.5em 10px`},"& p":{margin:`0`},"& table":{tableLayout:`fixed`,width:`100%`,borderCollapse:`collapse`,color:lu(),backgroundColor:Au()},'& table:not([border="1"]) tr':{borderTop:`1px solid ${Vu()}`},"& td, th":{padding:`.6em 1em`,textAlign:`center`},'& table:not([border="1"]) td, th':{border:`1px solid ${Vu()}`},...n&&{border:`2px solid ${e.palette.error.main} !important`}})),o7=L(`div`,{shouldForwardProp:e=>![`disableScrollbar`,`highlightShape`].includes(e)})(({theme:e,disableScrollbar:t,highlightShape:n})=>({position:`relative`,padding:`0px`,overflowY:`auto`,color:lu(),backgroundColor:n?e.palette.action.selected:Au(),...t&&{"&::-webkit-scrollbar":{display:`none`},scrollbarWidth:`none`,"-ms-overflow-style":`none`}})),s7=L(`div`,{shouldForwardProp:e=>e!==`noPadding`})(({noPadding:e})=>({padding:e?0:`10px 8px`}));function c7(e){let[t,n]=(0,M.useState)(null),r=(0,M.useRef)(null),{editor:i,disabled:a,children:o,disableScrollbar:s,activePlugins:c,toolbarOpts:l,responseAreaProps:u,autoFocus:d,minWidth:f,width:p,maxWidth:m,minHeight:h,height:g,maxHeight:_,highlightShape:v,ref:y}=e;(0,M.useEffect)(()=>{i&&r.current&&(i._tiptapContainerEl=r.current)},[i,r.current]),(0,M.useEffect)(()=>{i&&d&&Promise.resolve().then(()=>{i.commands.focus(`end`)})},[i,d]),(0,M.useEffect)(()=>{if(e.adjustWidthForLimit){let t=document.createElement(`p`);t.style.visibility=`hidden`,t.style.position=`absolute`,t.style.whiteSpace=`nowrap`,t.textContent=`W`.repeat(e.charactersLimit);let i=window.getComputedStyle(r.current);[`fontFamily`,`fontSize`,`fontWeight`,`fontStyle`,`letterSpacing`,`wordSpacing`,`textTransform`,`lineHeight`].forEach(e=>{t.style[e]=i[e]}),document.body.appendChild(t),n(`${t.offsetWidth+27}px`),t.remove()}},[e.adjustWidthForLimit,e.charactersLimit]);let b=(0,M.useMemo)(()=>({width:f6(t||p),minWidth:f6(f),maxWidth:f6(m),height:f6(g),minHeight:f6(h),maxHeight:f6(_)}),[t,f,p,m,h,g,_]);return(0,N.jsxs)(a7,{noBorder:l&&l.noBorder,error:l&&l.error,className:e.className,style:{width:b.width,minWidth:b.minWidth,maxWidth:b.maxWidth},ref:r,children:[(0,N.jsx)(o7,{disableScrollbar:s,highlightShape:v,children:(0,N.jsx)(s7,{noPadding:l&&l.noPadding,children:o})}),i&&(0,N.jsx)(r7,{editor:i,responseAreaProps:u,toolbarOpts:l,activePlugins:c,onChange:e.onChange,autoWidthToolbar:e.autoWidthToolbar})]})}var l7=md(`@pie-lib:editable-html:plugins`),u7=[`bold`,`html`,`extraCSSRules`,`italic`,`underline`,`strikethrough`,`bulleted-list`,`numbered-list`,`image`,`math`,`languageCharacters`,`text-align`,`blockquote`,`h3`,`table`,`video`,`audio`,`responseArea`,`redo`,`undo`,`superscript`,`subscript`],d7={"text-align":`textAlign`,"bulleted-list":`ul_list`,"numbered-list":`ol_list`},f7=u7.filter(e=>![`responseArea`,`h3`,`blockquote`].includes(e)),p7=(e,t,n)=>{l7(`[buildPlugins] opts: `,n),e||=f7;let r=(t,n=!0)=>e.includes(t)&&n&&t,i=n.image&&n.image.delete,a=n.math,o=n.responseArea&&n.responseArea.type,s=!se(n.extraCSSRules),c=n?.languageCharacters||[];return re([r(`table`),r(`bold`),r(`italic`),r(`strikethrough`),r(`underline`),r(`superscript`),r(`subscript`),r(`image`,!!i),r(`video`),r(`audio`),r(`math`,!!a),...c.map(e=>r(`languageCharacters`,e)),r(`text-align`),r(`blockquote`),r(`h3`),r(`bulleted-list`),r(`numbered-list`),r(`undo`),r(`redo`),r(`responseArea`,!!o),r(`css`,!!s),r(`html`,!!n.html)])},m7={position:`bottom`,alignment:`left`,alwaysVisible:!1,showDone:!0,doneOn:`blur`},h7={options:{},respAreaToolbar:()=>{},onHandleAreaChange:()=>{}},g7=[`bold`,`italic`,`underline`,`strikethrough`,`code`,`bulleted-list`,`numbered-list`,`image`,`math`,`languageCharacters`,`text-align`,`table`,`video`,`audio`,`responseArea`,`superscript`,`subscript`,`css`,`h3`,`undo`,`redo`],_7={"--white":`#fff`,"--black":`#2e2b29`,"--black-contrast":`#110f0e`,"--gray-1":`rgba(61, 37, 20, .05)`,"--gray-2":`rgba(61, 37, 20, .08)`,"--gray-3":`rgba(61, 37, 20, .12)`,"--gray-4":`rgba(53, 38, 28, .3)`,"--gray-5":`rgba(28, 25, 23, .6)`,"--green":`#22c55e`,"--purple":`#6a00f5`,"--purple-contrast":`#5800cc`,"--purple-light":`rgba(88, 5, 255, .05)`,"--yellow-contrast":`#facc15`,"--yellow":`rgba(250, 204, 21, .4)`,"--yellow-light":`#fffae5`,"--red":`#ff5c33`,"--red-light":`#ffebe5`,"--shadow":`0px 12px 33px 0px rgba(0, 0, 0, .06),
|
|
397
|
+
0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)`},v7=e=>({spellcheck:e?`true`:`false`,autocorrect:e?`on`:`off`,autocapitalize:e?`on`:`off`}),y7=e=>{let{showParagraphs:t,separateParagraphs:n}=e.pluginProps||{},[r,i]=(0,M.useState)([]),[a,o]=(0,M.useState)(!1),{toolbarOpts:s}=e,c=(0,M.useCallback)(e=>{i(t=>{let n=t.filter(t=>t.pos!==e);return n.length===0&&o(!1),n})},[i]),l={...m7,...s},u=(0,M.useCallback)(t=>{let n=t.getHTML();e.markup!==n&&e.onChange?.(n),l.doneOn===`blur`&&e.onDone?.(n)},[e.markup,e.onChange,e.onDone,l.doneOn]),d=(0,M.useMemo)(()=>({...h7,...e.responseAreaProps,onInlineDropdownToolbarClose:u}),[e.responseAreaProps,u]),f=(0,M.useMemo)(()=>{let{customPlugins:t,...n}=e.pluginProps||{};t||=[];let r=(e.activePlugins||g7)?.filter(e=>{let t=d7[e]||e,r=n[t]||{};return!r||!r.disabled});return p7(r,t,{math:{},textAlign:e.textAlign,html:{},extraCSSRules:e.extraCSSRules||{},image:{...e.imageSupport},toolbar:{},table:{},responseArea:{type:d.type},languageCharacters:e.languageCharactersProps,keyPadCharacterRef:{},setKeypadInteraction:{},media:{}})},[e,d.type]),p=[LG.configure({types:[`heading`,`paragraph`,`div`,`headingParagraph`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`td`,`th`],alignments:[`left`,`right`,`center`,`justify`]}),uG,dG.configure({limit:e.charactersLimit||1e6}),eG.configure({trailingNode:{node:`paragraph`,notAfter:[`paragraph`,`div`]},link:{autolink:!1,linkOnPaste:!1}}),u6,Zq,d6,Qq,$q,BG.configure({placeholder:e.placeholder,showOnlyWhenEditable:!0,showOnlyCurrent:!1,includeChildren:!0}),qq,jq,Xq,Yq,M$.configure(d),N$.configure(d),F$.configure(d),I$.configure(d),P$.configure(d),Z0.configure({toolbarOpts:l,math:e.pluginProps?.math||{}}),IG,FG,zG,l4.configure({toolbarOpts:l,imageHandling:{disableImageAlignmentButtons:e.disableImageAlignmentButtons,onDone:t=>e.onDone?.(t.getHTML()),onDelete:e.imageSupport&&e.imageSupport.delete&&(t=>{let{src:n}=t.attrs;e.imageSupport.delete(n,e=>{c(t.pos)})}),insertImageRequested:e.imageSupport&&((t,n,r)=>{let[o,s]=n,l=n=>{let r;a&&n&&(r=e.onChange),c(s),r?.(t.getHTML())};t._insertingImage=!0,i(e=>[...e,o]),(()=>{let n=r(l),i=ie(()=>{let e=()=>window.removeEventListener(`focus`,i);if(!t._insertingImage){e();return}c(s),t._insertingImage=!1,e()},500);window.addEventListener(`focus`,i),e.imageSupport.add(n)})()}),maxImageWidth:e.maxImageWidth,maxImageHeight:e.maxImageHeight},limit:3}),f3.configure({uploadSoundSupport:e.uploadSoundSupport}),k3.configure({extraCSSRules:e.extraCSSRules})],m=e.spellCheck!==!1,h=mM({extensions:p,immediatelyRender:!1,editorProps:{attributes:v7(m),handleKeyDown(t,n){return e.onKeyDown?e.onKeyDown(n):!1}},editable:!e.disabled,content:UG(e.markup),onUpdate:({editor:t,transaction:n})=>{n.isDone&&e.onChange?.(t.getHTML())},onBlur:({editor:e})=>{e._insertingImage||e._toolbarOpened||e.isActive(`inline_dropdown`)||e.isActive(`explicit_constructed_response`)||!e.schema||u(e)}},[e.charactersLimit]);(0,M.useEffect)(()=>{e.editorRef&&e.editorRef(h)},[e.editorRef,h]),(0,M.useEffect)(()=>{h?.setEditable(!e.disabled)},[e.disabled,h]),(0,M.useEffect)(()=>{if(!h)return;let e=h.options?.editorProps,t=v7(m);e?.attributes?.spellcheck!==t.spellcheck&&h.setOptions({editorProps:{...e,attributes:t}})},[m,h]),(0,M.useEffect)(()=>{if(!h)return;let t=UG(e.markup);t!==h.getHTML()&&h.commands.setContent(t,{emitUpdate:!1})},[e.markup,h]),(0,M.useEffect)(()=>{Object.entries(_7).forEach(([e,t])=>{document.documentElement.style.setProperty(e,t)})},[]);let g=uM({editor:h,selector:e=>({isFocused:e.editor?.isFocused})}),_=(0,M.useMemo)(()=>{let{minWidth:t,width:n,maxWidth:r,minHeight:i,height:a,maxHeight:o}=e;return{width:f6(n),minWidth:f6(t),maxWidth:f6(r),height:f6(a),minHeight:f6(i),maxHeight:f6(o)}},[e]);return(0,N.jsx)(c7,{...e,activePlugins:f,toolbarOpts:l,editorState:g,editor:h,children:h&&(0,N.jsx)(b7,{style:{minHeight:_.minHeight,height:_.height,maxHeight:_.maxHeight},showParagraph:t&&!t.disabled,separateParagraph:n&&!n.disabled,editor:h})})},b7=L(sM,{shouldForwardProp:e=>![`showParagraph`,`separateParagraph`].includes(e)})(({showParagraph:e,separateParagraph:t})=>({display:`flex`,outline:`none !important`,"& .ProseMirror":{flex:1,padding:`5px`,maxHeight:`500px`,outline:`none !important`,position:`initial`,"& > p, & > div":{margin:`0`},"& p[data-placeholder].is-empty:only-child, & div[data-placeholder].is-empty:only-child":{position:`relative`},"& p[data-placeholder].is-empty:only-child::before, & div[data-placeholder].is-empty:only-child::before":{content:`attr(data-placeholder)`,position:`absolute`,left:0,top:0,color:`#9CA3AF`,pointerEvents:`none`,whiteSpace:`pre-wrap`},...e&&{"& > p:has(+ p)::after, & > div:has(+ div)::after":{display:`block`,content:`"¶"`,fontSize:`1em`,color:`#146EB3`}},...t&&{"& > p:has(+ p)":{marginBottom:`1em`}}}})),x7=L(y7)(()=>({display:`inline-block`,verticalAlign:`middle`,margin:`4px`,borderRadius:`4px`,border:`1px solid ${Uu()}`,"&.correct":{border:`1px solid ${fu()}`},"&.incorrect":{border:`1px solid ${gu()}`}})),S7=ng(`input`,e=>(t,n)=>{let{adjustedLimit:r,disabled:i,feedback:a,showCorrectAnswer:o,maxLength:s,spellCheck:c,pluginProps:l,onChange:u}=e,d=t.data?.dataset||{};if(d.component===`input`){let f=(e.choices&&d&&e.choices[d.id]||[])[0],p=o?f&&f.label:n[d.id]||``,m=s&&s[d.id],h=a&&a[d.id],g=o||h===`correct`,_=!o&&h===`incorrect`;return(0,N.jsx)(x7,{id:d.id,disabled:o||i,disableUnderline:!0,onChange:e=>{let t={...n,[d.id]:e};u(t)},markup:p||``,charactersLimit:r?m:25,activePlugins:[`languageCharacters`],pluginProps:l,languageCharactersProps:[{language:`spanish`}],spellCheck:c,adjustWidthForLimit:!0,onKeyDown:e=>{if(e.key===`Enter`||e.keyCode===13)return!0},autoWidthToolbar:!0,toolbarOpts:{minWidth:`auto`,noBorder:!0,isHidden:!!l?.characters?.disabled},className:P({correct:g,incorrect:_})},`${t.type}-input-${d.id}`)}});function C7(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function w7(e,t){return!e||C7(e)?e:C7(e.default)?e.default:t&&C7(e[t])?e[t]:t&&C7(e[t]?.default)?e[t].default:e}var T7=w7(If,`UiLayout`)||w7(A7.UiLayout,`UiLayout`),E7=w7(pp,`PreviewPrompt`)||w7(A7.PreviewPrompt,`PreviewPrompt`),D7=w7(Nd,`Collapsible`)||w7(A7.Collapsible,`Collapsible`),O7=Wp,k7=O7.default,A7=k7&&typeof k7==`object`?k7:O7,{translator:j7}=Ym,M7=L(T7)(({alwaysShowCorrect:e})=>({color:lu(),backgroundColor:Au(),...e&&{"& *":{borderColor:`${lu()} !important`}}})),N7=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),P7=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),F7=L(`h2`)({position:`absolute`,left:`-10000px`,top:`auto`,width:`1px`,height:`1px`,overflow:`hidden`}),I7=class extends M.Component{static propTypes={alwaysShowCorrect:k.bool,animationsDisabled:k.bool,disabled:k.bool,displayType:k.string,feedback:k.object,language:k.string,markup:k.string,maxLengthPerChoice:k.array,maxLengthPerChoiceEnabled:k.bool,mode:k.string,note:k.string,onChange:k.func,playerSpellCheckEnabled:k.bool,prompt:k.string,rationale:k.string,role:k.string,showNote:k.bool,teacherInstructions:k.string,value:k.object,responseAreaInputConfiguration:k.object,model:k.object.isRequired};static defaultProps={value:{}};state={showCorrectAnswer:this.props.alwaysShowCorrect||!1};getChangeSession=e=>e&&e.every((e,t,n)=>e===n[0]&&e===1)?this.props.onChange:ie(this.props.onChange,200,{maxWait:200});UNSAFE_componentWillReceiveProps(e){let{maxLengthPerChoice:t,language:n}=this.props,{note:r}=this.props;se(e.feedback)&&this.setState({showCorrectAnswer:!1}),e.alwaysShowCorrect&&this.setState({showCorrectAnswer:!0}),t&&!le(t,e.maxLengthPerChoice)&&(this.changeSession=this.getChangeSession(e.maxLengthPerChoice)),r&&n&&n!==e.language&&r===j7.t(`common:commonCorrectAnswerWithAlternates`,{lng:n})&&(r=j7.t(`common:commonCorrectAnswerWithAlternates`,{lng:e.language}))}toggleShowCorrect=()=>{this.setState({showCorrectAnswer:!this.state.showCorrectAnswer})};changeSession=this.getChangeSession(this.props.maxLengthPerChoice);onChange=e=>{this.changeSession(e)};render(){let{showCorrectAnswer:e}=this.state,{alwaysShowCorrect:t,animationsDisabled:n,mode:r,displayType:i,role:a,language:o,maxLengthPerChoice:s,maxLengthPerChoiceEnabled:c,note:l,playerSpellCheckEnabled:u,prompt:d,rationale:f,showNote:p,teacherInstructions:m,responseAreaInputConfiguration:h,model:g,value:_}=this.props,{extraCSSRules:v}=g||{},y=(e||r===`view`&&a===`instructor`)&&p&&l,b=(0,N.jsx)(E7,{defaultClassName:`teacher-instructions`,prompt:m}),x=(0,N.jsx)(E7,{prompt:f}),S=f&&(vp(f)||bp(f)),C=m&&(vp(m)||bp(m));return(0,N.jsxs)(M7,{extraCSSRules:v,alwaysShowCorrect:t,style:{display:`${i}`},children:[r===`gather`&&(0,N.jsx)(F7,{children:`Fill in the Blank Question`}),C&&(0,N.jsx)(P7,{children:n?b:(0,N.jsx)(D7,{labels:{hidden:`Show Teacher Instructions`,visible:`Hide Teacher Instructions`},children:b})}),d&&(0,N.jsx)(E7,{prompt:d}),!t&&r===`evaluate`&&(0,N.jsx)(lh,{show:!0,toggled:e,onToggle:this.toggleShowCorrect,language:o}),(0,N.jsx)(S7,{...this.props,onChange:this.onChange,showCorrectAnswer:e,value:_,maxLength:s,adjustedLimit:c,spellCheck:u,pluginProps:h}),y&&(0,N.jsx)(N7,{dangerouslySetInnerHTML:{__html:l}}),S&&(0,N.jsx)(P7,{children:n?x:(0,N.jsx)(D7,{labels:{hidden:`Show Rationale`,visible:`Hide Rationale`},children:x})})]})}},L7=g(),R7=class extends HTMLElement{constructor(){super(),this._model=null,this._session=null,this._root=null}setLangAttribute(){let e=this._model&&typeof this._model.language?this._model.language:``,t=e?e.slice(0,2):`en`;this.setAttribute(`lang`,t)}set model(e){this._model=e,this.dispatchEvent(new _(this.tagName.toLowerCase(),this.session&&!!this.session.value,!!this._model)),this.setLangAttribute(),this._render()}set session(e){this._session=e,this._render()}get session(){return this._session}_render=()=>{if(this._model&&this._session){let e=M.createElement(I7,{choices:this._model.choices,disabled:this._model.disabled,displayType:this._model.displayType,feedback:this._model.feedback,language:this._model.language,markup:this._model.markup,maxLengthPerChoice:this._model.maxLengthPerChoice,maxLengthPerChoiceEnabled:this._model.maxLengthPerChoiceEnabled,mode:this._model.mode,note:this._model.note,onChange:this.changeSession,playerSpellCheckEnabled:this._model.playerSpellCheckEnabled,prompt:this._model.prompt,rationale:this._model.rationale,role:this._model.role,showNote:this._model.showNote,teacherInstructions:this._model.teacherInstructions,value:this._session.value,responseAreaInputConfiguration:this._model.responseAreaInputConfiguration});this._root||=(0,L7.createRoot)(this),this._root.render(e),queueMicrotask(()=>{O(this)})}};dispatchChangedEvent=()=>{this.dispatchEvent(new v(this.tagName.toLowerCase(),this.session&&!!this.session.value))};changeSession=e=>{this.session.value=e,this.dispatchChangedEvent(),this._render()};connectedCallback(){this.setAttribute(`aria-label`,`Fill in the Blank Question`),this.setAttribute(`role`,`region`),this._render()}disconnectedCallback(){this._root&&=(this._root.unmount(),null)}};return typeof window<`u`&&!customElements.get(`explicit-constructed-response-element`)&&customElements.define(`explicit-constructed-response-element`,R7),R7})();
|