wysimark-lite 0.25.41 → 0.25.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- "use client";import{createRef as OE,useCallback as UE,useImperativeHandle as FE,useRef as VE,useState as KE}from"react";import{createRoot as _E}from"react-dom/client";import DE from"lodash.throttle";import{useCallback as It,useRef as Mt,useState as Pp}from"react";import{Editor as zE,Transforms as $E}from"slate";import{ReactEditor as NE,Slate as HE}from"slate-react";import fu from"remark-parse";import{unified as hu}from"unified";function Io(){return{enter:{table:Op,tableData:Fr,tableHeader:Fr,tableRow:Fp},exit:{codeText:Vp,table:Up,tableData:wo,tableHeader:wo,tableRow:wo}}}function Op(e){let t=e._align;this.enter({type:"table",align:t.map(function(o){return o==="none"?null:o}),children:[]},e),this.data.inTable=!0}function Up(e){this.exit(e),this.data.inTable=void 0}function Fp(e){this.enter({type:"tableRow",children:[]},e)}function wo(e){this.exit(e)}function Fr(e){this.enter({type:"tableCell",children:[]},e)}function Vp(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Kp));let o=this.stack[this.stack.length-1];o.type,o.value=t,this.exit(e)}function Kp(e,t){return t==="|"?t:e}import{gfm as _p}from"micromark-extension-gfm";import{gfmToMarkdown as Wp}from"mdast-util-gfm";function Vr(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function Kr(){return function(){if(!this)return;let e=this.data(),t=e.micromarkExtensions||(e.micromarkExtensions=[]),o=e.fromMarkdownExtensions||(e.fromMarkdownExtensions=[]),r=e.toMarkdownExtensions||(e.toMarkdownExtensions=[]);t.push(_p());let n=function(){let i=Io();if(i.enter)for(let a of Object.keys(i.enter))i.enter[a]=Vr(i.enter[a]);if(i.exit)for(let a of Object.keys(i.exit))i.exit[a]=Vr(i.exit[a]);return i};o.push(n()),r.push(Wp())}}function ge(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,o="\x07WYSIMARK_",r=`${o}LINK_`,n=`${o}HTML_`,i="\x07",a=[],l=0,m=e.replace(t,p=>(a.push(p),`${r}${l++}${i}`)),s=[];m=qp(m,s,n,i);let u=/(https?:\/\/[^\s]+)/g;m=m.replace(u,p=>p.replace(/\//g,"\\/"));for(let p=0;p<s.length;p++)m=m.replace(`${n}${p}${i}`,s[p]);for(let p=0;p<a.length;p++)m=m.replace(`${r}${p}${i}`,a[p]);return m}function at(e){return e.replace(/\\\//g,"/")}function _r(e){return e.replace(/\\([\\`*_\[\]~|<])/g,"$1")}var Gp=new Set(["script","style"]);function qp(e,t,o,r){let n="",i=0;for(;i<e.length;){let a=e.indexOf("<",i);if(a===-1){n+=e.slice(i);break}if(n+=e.slice(i,a),e.startsWith("<!--",a)){let d=e.indexOf("-->",a+4);if(d===-1){n+=e.slice(a);break}let g=e.slice(a,d+3);t.push(g),n+=`${o}${t.length-1}${r}`,i=d+3;continue}if(e.startsWith("<![CDATA[",a)){let d=e.indexOf("]]>",a+9);if(d===-1){n+=e.slice(a);break}let g=e.slice(a,d+3);t.push(g),n+=`${o}${t.length-1}${r}`,i=d+3;continue}let l=Mo(e,a);if(!l){n+="<",i=a+1;continue}let m=t.length,s=`${o}${m}${r}`;if(!l.name){let d=e.slice(a,l.endIndex+1);t.push(d),n+=s,i=l.endIndex+1;continue}let c=l.name.toLowerCase();if(l.isClosing||l.isSelfClosing){let d=e.slice(a,l.endIndex+1);t.push(d),n+=s,i=l.endIndex+1;continue}if(Gp.has(c)){let d=e.toLowerCase().indexOf(`</${c}`,l.endIndex+1);if(d!==-1){let g=Mo(e,d);if(g){let v=e.slice(a,g.endIndex+1);t.push(v),n+=s,i=g.endIndex+1;continue}}}let u=jp(e,c,l.endIndex+1);if(u!==null){let d=e.slice(a,u+1);t.push(d),n+=s,i=u+1;continue}let p=e.slice(a,l.endIndex+1);t.push(p),n+=s,i=l.endIndex+1}return n}function Mo(e,t){if(e[t]!=="<")return null;let o=Qp(e,t);if(o===-1)return null;let r=t+1;if(r>=e.length)return null;let n=e[r];if(n==="!"||n==="?")return{name:null,endIndex:o,isClosing:!1,isSelfClosing:!0};let i=!1;n==="/"&&(i=!0,r+=1);let a=/^[A-Za-z][A-Za-z0-9-]*/.exec(e.slice(r));if(!a)return null;let l=a[0],m=e.slice(t,o+1),s=/\/\s*>$/.test(m);return{name:l,endIndex:o,isClosing:i,isSelfClosing:s}}function Qp(e,t){let o=null;for(let r=t+1;r<e.length;r++){let n=e[r];if(o){n===o&&(o=null);continue}if(n==="'"||n==='"'){o=n;continue}if(n===">")return r}return-1}function jp(e,t,o){let r=1,n=o,i=t.toLowerCase();for(;n<e.length;){let a=e.indexOf("<",n);if(a===-1)return null;let l=Mo(e,a);if(!l||!l.name){n=a+1;continue}if(l.name.toLowerCase()===i&&(l.isClosing?r-=1:l.isSelfClosing||(r+=1),r===0))return l.endIndex;n=l.endIndex+1}return null}function Wr(e,t){if(!e)throw new Error(`${t}`)}function Pt(e,t){if(e.type!==t)throw new Error(`Expected element to be of type ${JSON.stringify(e)} but is ${JSON.stringify(e,null,2)}`)}function be(e){throw new Error(`Didn't expect to get here with value ${JSON.stringify(e,null,2)}`)}function Gr(e){return[{type:"block-quote",children:$e(e.children)}]}function qr(e){let t=e.value.split(`
2
- `);return[{type:"code-block",language:e.lang||"text",children:t.map(o=>({type:"code-block-line",children:[{text:o}]}))}]}function Qr(e){return[{type:"block-quote",children:[{type:"paragraph",children:[{text:`[${e.identifier}]`}]},...$e(e.children)]}]}import{Text as an}from"slate";import{Text as rn}from"slate";import*as lt from"slate";function U(e){return lt.Text.isText(e)}function re(e){return lt.Element.isElement(e)}function D(e){return lt.Text.isText(e)&&!!e.text.match(/^\s+$/)&&!e.code}var jr={bold:"**",italic:"_",strike:"~~",highlight:"<mark>",code:""},Xr={bold:"**",italic:"_",strike:"~~",highlight:"</mark>",code:""};function Xp(e){if(e in jr)return jr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_OPEN_TOKEN lookup`)}function Yp(e){if(e in Xr)return Xr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_CLOSE_TOKEN lookup`)}function Yr(e){return e.map(Xp).join("")}function Jr(e){return e.map(Yp).join("")}import{Text as Jp}from"slate";function st(e){let{text:t,...o}=e;return Object.keys(o)}function Po(e){if(Jp.isText(e)){if(D(e))throw new Error("You probably didn't mean to do this. We should only be getting marks from segments that are not plain space segments.");return st(e)}else{if(e.type==="anchor")return Co(e.children);throw new Error(`Unhandled type ${e.type}`)}}function Co(e){let t;for(let o of e){if(!U(o)){if(o.type==="image-inline")continue;throw new Error("Expected every segment in an anchor to be a Text segment")}if(D(o))continue;let r=st(o);if(t===void 0){t=r;continue}t=t.filter(n=>r.includes(n))}return t===void 0?[]:t}var Zr=["bold","italic","underline","strike","highlight","code"];function en(e){return e.slice().sort((t,o)=>Zr.indexOf(t)-Zr.indexOf(o))}function Zp(e){return/[!-/:-@\[-`{-~]/.test(e)}function He(e){return e===""||/\s/u.test(e)}function Ne(e){return e!==""&&/[\p{P}\p{S}]/u.test(e)}function eu(e){return/[a-zA-Z/?!]/.test(e)}function tn(e,t,o){let r=new Set,n=[];for(let i=0;i<e.length;i++){if(e[i]!==t)continue;let a=i>0?e[i-1]:"",l=i+1<e.length?e[i+1]:"",m=!He(l)&&(!Ne(l)||He(a)||Ne(a)),s=!He(a)&&(!Ne(a)||He(l)||Ne(l)),c=m&&(o||!s||Ne(a));s&&(o||!m||Ne(l))&&n.length>0&&(r.add(n.pop()),r.add(i)),c&&n.push(i)}return r}function tu(e){let t=new Set,o=[];for(let r=0;r<e.length;r++){if(e[r]!=="~")continue;let n=r>0?e[r-1]:"",i=r+1<e.length?e[r+1]:"",a=!He(i);!He(n)&&o.length>0&&(t.add(o.pop()),t.add(r)),a&&o.push(r)}return t}function ou(e){let t=new Set,o=[];for(let r=0;r<e.length;r++)if(e[r]==="[")e[r+1]==="^"&&t.add(r),o.push(r);else if(e[r]==="]"){let n=o.pop();n!==void 0&&e[r+1]==="("&&(t.add(n),t.add(r))}return t}function on(e,t={}){let o=Array.from(e),r=tn(o,"_",!1),n=tn(o,"*",!0),i=tu(o),a=ou(o),l=t.escapeBackticks??o.filter(s=>s==="`").length>=2,m="";for(let s=0;s<o.length;s++){let c=o[s],u=s+1<o.length?o[s+1]:"";c==="`"?m+=l?"\\`":c:c==="\\"?m+=Zp(u)?"\\\\":"\\":c==="<"?m+=eu(u)?"\\<":"<":c==="_"?m+=r.has(s)?`\\${c}`:c:c==="*"?m+=n.has(s)?`\\${c}`:c:c==="~"?m+=i.has(s)?`\\${c}`:c:c==="["||c==="]"?m+=t.inAnchorLabel||a.has(s)?`\\${c}`:c:m+=c}return m=m.replace(/^(#{1,6})(\s)/m,"\\$1$2"),m=m.replace(/^(\d+)([.)]\s)/m,"$1\\$2"),m=m.replace(/^([-+*>])\s/m,"\\$1 "),m}function ru(e,t){let o=st(e),r=st(t);return o.length==r.length&&o.every(n=>r.includes(n))}function nn(e,t){let o=rn.isText(e),r=rn.isText(t);return t&&!r&&!o?[{text:""},e]:o?t===void 0||!r?[e]:ru(t,e)?(t.text=[t.text,e.text].join(""),[]):[e]:[e]}function ln(e){let t=[];for(let o=0;o<e.length;o++){let r=t[t.length-1];t.push(...nn(e[o],r))}return t.length===0&&t.push({text:""}),an.isText(t[0])||t.unshift({text:""}),an.isText(t[t.length-1])||t.push({text:""}),t}function sn(e){return{url:e.url,title:e.title||void 0,alt:e.alt||void 0}}var nu=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;function Ae(e){try{let t=new URL(e);return{origin:t.origin,hostname:t.hostname,pathname:t.pathname,searchParams:t.searchParams,hash:t.hash}}catch{let t=e.match(nu);if(t===null)throw new Error(`Invalid format should not happen: ${e}`);let[,o,r,n]=[...t];return{origin:"",hostname:"",pathname:o||"",searchParams:new URLSearchParams(r),hash:n||""}}}function mt(e){if(typeof e!="string")return null;let t=e.match(/^(\d+)x(\d+)$/);return t===null?null:{width:parseInt(t[1],10),height:parseInt(t[2],10)}}function mn(e){let t=Ae(e.url);if(!t.hostname.match(/[.]portive[.]com$/i))return;let o=t.searchParams.get("size");if(o===null)return;let r=mt(o);if(r===null)return;let n=t.pathname.match(/[-][-](\d+)x(\d+)[.][a-zA-Z]+$/);if(n!==null)return{url:`${t.origin}${t.pathname}`,title:e.title||void 0,alt:e.alt||void 0,width:r.width,height:r.height,srcWidth:parseInt(n[1],10),srcHeight:parseInt(n[2],10)}}function cn(e){let t=Ae(e.url);if(t.hash.length===0)return;let o=new URLSearchParams(t.hash.slice(1)),r=mt(o.get("size")),n=mt(o.get("srcSize"));if(!(!r||!n))return{url:`${t.origin}${t.pathname}`,title:e.title||void 0,alt:e.alt||void 0,width:r.width,height:r.height,srcWidth:n.width,srcHeight:n.height}}var pn=[mn,cn,sn];function un(e){for(let t of pn){let o=t(e);if(o)return[{type:"image-inline",...o,children:[{text:""}]}]}throw new Error("Shouldn't get here because last parser always returns data")}function iu(e,t){if(/^<br\s*\/?>$/i.test(e))return[{text:`
3
- `,...t}];let o=e.match(/^<mark\b[^>]*>(.+?)<\/mark>$/is);return o?[{text:o[1],...t,highlight:!0}]:[{text:e,code:!0}]}function K(e,t={}){let o=[],r={...t};for(let i of e){if(i.type==="html"){if(/^<mark\b[^>]*>$/i.test(i.value)){r={...r,highlight:!0};continue}if(/^<\/mark>$/i.test(i.value)){let{highlight:a,...l}=r;r=l;continue}}o.push(...au(i,r))}return ln(o)}function au(e,t={}){switch(e.type){case"delete":return K(e.children,{...t,strike:!0});case"emphasis":return K(e.children,{...t,italic:!0});case"footnoteReference":return[{text:`[${e.identifier}]`}];case"html":return iu(e.value,t);case"image":return un(e);case"inlineCode":return[{text:e.value,...t,code:!0}];case"link":return[{type:"anchor",href:e.url,title:e.title==null?void 0:e.title,children:K(e.children,t)}];case"strong":return K(e.children,{...t,bold:!0});case"text":return[{text:e.value,...t}];case"linkReference":case"imageReference":throw new Error("linkReference and imageReference should be converted to link and image through our transformInlineLinks function");case"break":return[{text:`
4
- `}];case"footnote":throw new Error("footnote is not supported yet")}be(e)}function dn(e){return[{type:"heading",level:e.depth,children:K(e.children)}]}function fn(e){return[{type:"html-block",html:e.value,children:[{text:""}]}]}function hn(e,{depth:t,ordered:o,checked:r}){switch(e.type){case"paragraph":return r===!0||r===!1?[{type:"task-list-item",depth:t,checked:r,children:K(e.children)}]:o?[{type:"ordered-list-item",depth:t,children:K(e.children)}]:[{type:"unordered-list-item",depth:t,children:K(e.children)}];case"list":return Ct(e,t+1);default:return So(e)}}function gn(e,t){let o=[];for(let r of e.children)o.push(...hn(r,{...t,checked:e.checked}));return o}function Ct(e,t=0){let o=[];for(let r of e.children)o.push(...gn(r,{depth:t,ordered:!!e.ordered}));return o}function lu(e){return!(e.length!==3||!("text"in e[0])||e[0].text!==""||!("text"in e[2])||e[2].text!==""||!("type"in e[1])||e[1].type!=="image-inline")}var su="\xA0";function mu(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==su)}function bn(e){let t=K(e.children);return lu(t)?[{...t[1],type:"image-block"}]:mu(t)?[{type:"paragraph",children:[{text:""}]}]:[{type:"paragraph",children:t}]}function En(e){if(e.align==null)throw new Error("Expected an array of AlignType for table.align");return[{type:"table",columns:e.align.map(t=>({align:t||"left"})),children:e.children.map(cu)}]}function cu(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(pu)}}function pu(e){if(e.type!=="tableCell")throw new Error("Expected a tableCell");return{type:"table-cell",children:[{type:"table-content",children:K(e.children)}]}}function xn(){return[{type:"horizontal-rule",children:[{text:""}]}]}function $e(e){let t=[];for(let o=0;o<e.length;o++){if(o>0){let r=e[o-1],n=e[o];if(r.position&&n.position){let i=n.position.start.line-r.position.end.line-1;for(let a=1;a<i;a++)t.push({type:"paragraph",children:[{text:""}]})}}t.push(...So(e[o]))}return t}function So(e){switch(e.type){case"blockquote":return Gr(e);case"code":return qr(e);case"definition":throw new Error('The type "definition" should not exist. See comments');case"footnoteDefinition":return Qr(e);case"heading":return dn(e);case"html":return fn(e);case"list":return Ct(e);case"paragraph":return bn(e);case"table":return En(e);case"thematicBreak":return xn();case"yaml":return[]}be(e)}import{definitions as uu}from"mdast-util-definitions";import{SKIP as yn,visit as du}from"unist-util-visit";function kn(e){let t=uu(e);du(e,(o,r,n)=>{let i=o,a=n;if(i.type==="definition"&&a!==null&&typeof r=="number")return a.children.splice(r,1),[yn,r];if(i.type==="imageReference"||i.type==="linkReference"){let l="identifier"in i&&typeof i.identifier=="string"?i.identifier:"",m=t(l);if(m&&a!==null&&typeof r=="number"){let s=i.type==="imageReference"?{type:"image",url:m.url,title:m.title,alt:i.alt}:{type:"link",url:m.url,title:m.title,children:i.children};return a.children[r]=s,[yn,r]}}})}var gu=hu().use(fu).use(Kr());function bu(e){let t=gu.parse(e);return kn(t),t}function Ee(e){let t=bu(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:$e(t.children)}function Eu(e){return e.type==="ordered-list-item"||e.type==="unordered-list-item"||e.type==="task-list-item"}function Tn(e){let t=[],o=-1;for(let r of e){if(!Eu(r)){t.push(r),o=-1;continue}let n=r.depth>o+1?o+1:r.depth;t.push({...r,depth:n}),o=n}return t}function vn(e){if(e.type!=="code-block-line")throw new Error(`Expected all children of code-block to be a codeline but is ${JSON.stringify(e,null,2)}`);return e.children.map(t=>t.text).join("")}function wn(e){let t=[],o=3;for(let r of e.children){let n=vn(r),i=n.match(/^([`]+)/);i&&(o=Math.max(o,i[1].length+1)),t.push(n)}return t.unshift(`${"`".repeat(o)}${e.language}`),t.push(`${"`".repeat(o)}`),`${t.join(`
1
+ "use client";import{createRef as NE,useCallback as HE,useImperativeHandle as AE,useRef as OE,useState as UE}from"react";import{createRoot as FE}from"react-dom/client";import RE from"lodash.throttle";import{useCallback as Mt,useRef as Pt,useState as Mp}from"react";import{Editor as LE,Transforms as BE}from"slate";import{ReactEditor as DE,Slate as zE}from"slate-react";import cu from"remark-parse";import{unified as pu}from"unified";import{gfm as Ap}from"micromark-extension-gfm";import{gfmFromMarkdown as Op,gfmToMarkdown as Up}from"mdast-util-gfm";function Ur(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function Fp(e){if(e.enter)for(let t of Object.keys(e.enter))e.enter[t]=Ur(e.enter[t]);if(e.exit)for(let t of Object.keys(e.exit))e.exit[t]=Ur(e.exit[t]);return e}function Fr(){return function(){if(!this)return;let e=this.data(),t=e.micromarkExtensions||(e.micromarkExtensions=[]),o=e.fromMarkdownExtensions||(e.fromMarkdownExtensions=[]),r=e.toMarkdownExtensions||(e.toMarkdownExtensions=[]);t.push(Ap());let n=Op().map(Fp);o.push(...n),r.push(Up())}}function ge(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,o="\x07WYSIMARK_",r=`${o}LINK_`,n=`${o}HTML_`,i="\x07",a=[],l=0,s=e.replace(t,p=>(a.push(p),`${r}${l++}${i}`)),m=[];s=Kp(s,m,n,i);let u=/(https?:\/\/[^\s]+)/g;s=s.replace(u,p=>p.replace(/\//g,"\\/"));for(let p=0;p<m.length;p++)s=s.replace(`${n}${p}${i}`,m[p]);for(let p=0;p<a.length;p++)s=s.replace(`${r}${p}${i}`,a[p]);return s}function at(e){return e.replace(/\\\//g,"/")}function Vr(e){return e.replace(/\\([\\`*_\[\]~|<])/g,"$1")}var Vp=new Set(["script","style"]);function Kp(e,t,o,r){let n="",i=0;for(;i<e.length;){let a=e.indexOf("<",i);if(a===-1){n+=e.slice(i);break}if(n+=e.slice(i,a),e.startsWith("<!--",a)){let d=e.indexOf("-->",a+4);if(d===-1){n+=e.slice(a);break}let g=e.slice(a,d+3);t.push(g),n+=`${o}${t.length-1}${r}`,i=d+3;continue}if(e.startsWith("<![CDATA[",a)){let d=e.indexOf("]]>",a+9);if(d===-1){n+=e.slice(a);break}let g=e.slice(a,d+3);t.push(g),n+=`${o}${t.length-1}${r}`,i=d+3;continue}let l=Io(e,a);if(!l){n+="<",i=a+1;continue}let s=t.length,m=`${o}${s}${r}`;if(!l.name){let d=e.slice(a,l.endIndex+1);t.push(d),n+=m,i=l.endIndex+1;continue}let c=l.name.toLowerCase();if(l.isClosing||l.isSelfClosing){let d=e.slice(a,l.endIndex+1);t.push(d),n+=m,i=l.endIndex+1;continue}if(Vp.has(c)){let d=e.toLowerCase().indexOf(`</${c}`,l.endIndex+1);if(d!==-1){let g=Io(e,d);if(g){let T=e.slice(a,g.endIndex+1);t.push(T),n+=m,i=g.endIndex+1;continue}}}let u=Wp(e,c,l.endIndex+1);if(u!==null){let d=e.slice(a,u+1);t.push(d),n+=m,i=u+1;continue}let p=e.slice(a,l.endIndex+1);t.push(p),n+=m,i=l.endIndex+1}return n}function Io(e,t){if(e[t]!=="<")return null;let o=_p(e,t);if(o===-1)return null;let r=t+1;if(r>=e.length)return null;let n=e[r];if(n==="!"||n==="?")return{name:null,endIndex:o,isClosing:!1,isSelfClosing:!0};let i=!1;n==="/"&&(i=!0,r+=1);let a=/^[A-Za-z][A-Za-z0-9-]*/.exec(e.slice(r));if(!a)return null;let l=a[0],s=e.slice(t,o+1),m=/\/\s*>$/.test(s);return{name:l,endIndex:o,isClosing:i,isSelfClosing:m}}function _p(e,t){let o=null;for(let r=t+1;r<e.length;r++){let n=e[r];if(o){n===o&&(o=null);continue}if(n==="'"||n==='"'){o=n;continue}if(n===">")return r}return-1}function Wp(e,t,o){let r=1,n=o,i=t.toLowerCase();for(;n<e.length;){let a=e.indexOf("<",n);if(a===-1)return null;let l=Io(e,a);if(!l||!l.name){n=a+1;continue}if(l.name.toLowerCase()===i&&(l.isClosing?r-=1:l.isSelfClosing||(r+=1),r===0))return l.endIndex;n=l.endIndex+1}return null}function Kr(e,t){if(!e)throw new Error(`${t}`)}function Ct(e,t){if(e.type!==t)throw new Error(`Expected element to be of type ${JSON.stringify(e)} but is ${JSON.stringify(e,null,2)}`)}function be(e){throw new Error(`Didn't expect to get here with value ${JSON.stringify(e,null,2)}`)}function _r(e){return[{type:"block-quote",children:$e(e.children)}]}function Wr(e){let t=e.value.split(`
2
+ `);return[{type:"code-block",language:e.lang||"text",children:t.map(o=>({type:"code-block-line",children:[{text:o}]}))}]}function Gr(e){return[{type:"block-quote",children:[{type:"paragraph",children:[{text:`[${e.identifier}]`}]},...$e(e.children)]}]}import{Text as rn}from"slate";import{Text as tn}from"slate";import*as lt from"slate";function U(e){return lt.Text.isText(e)}function re(e){return lt.Element.isElement(e)}function D(e){return lt.Text.isText(e)&&!!e.text.match(/^\s+$/)&&!e.code}var qr={bold:"**",italic:"_",strike:"~~",highlight:"<mark>",code:""},Qr={bold:"**",italic:"_",strike:"~~",highlight:"</mark>",code:""};function Gp(e){if(e in qr)return qr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_OPEN_TOKEN lookup`)}function qp(e){if(e in Qr)return Qr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_CLOSE_TOKEN lookup`)}function jr(e){return e.map(Gp).join("")}function Xr(e){return e.map(qp).join("")}import{Text as Qp}from"slate";function st(e){let{text:t,...o}=e;return Object.keys(o)}function Mo(e){if(Qp.isText(e)){if(D(e))throw new Error("You probably didn't mean to do this. We should only be getting marks from segments that are not plain space segments.");return st(e)}else{if(e.type==="anchor")return Po(e.children);throw new Error(`Unhandled type ${e.type}`)}}function Po(e){let t;for(let o of e){if(!U(o)){if(o.type==="image-inline")continue;throw new Error("Expected every segment in an anchor to be a Text segment")}if(D(o))continue;let r=st(o);if(t===void 0){t=r;continue}t=t.filter(n=>r.includes(n))}return t===void 0?[]:t}var Yr=["bold","italic","underline","strike","highlight","code"];function Jr(e){return e.slice().sort((t,o)=>Yr.indexOf(t)-Yr.indexOf(o))}function jp(e){return/[!-/:-@\[-`{-~]/.test(e)}function He(e){return e===""||/\s/u.test(e)}function Ne(e){return e!==""&&/[\p{P}\p{S}]/u.test(e)}function Xp(e){return/[a-zA-Z/?!]/.test(e)}function Zr(e,t,o){let r=new Set,n=[];for(let i=0;i<e.length;i++){if(e[i]!==t)continue;let a=i>0?e[i-1]:"",l=i+1<e.length?e[i+1]:"",s=!He(l)&&(!Ne(l)||He(a)||Ne(a)),m=!He(a)&&(!Ne(a)||He(l)||Ne(l)),c=s&&(o||!m||Ne(a));m&&(o||!s||Ne(l))&&n.length>0&&(r.add(n.pop()),r.add(i)),c&&n.push(i)}return r}function Yp(e){let t=new Set,o=[];for(let r=0;r<e.length;r++){if(e[r]!=="~")continue;let n=r>0?e[r-1]:"",i=r+1<e.length?e[r+1]:"",a=!He(i);!He(n)&&o.length>0&&(t.add(o.pop()),t.add(r)),a&&o.push(r)}return t}function Jp(e){let t=new Set,o=[];for(let r=0;r<e.length;r++)if(e[r]==="[")e[r+1]==="^"&&t.add(r),o.push(r);else if(e[r]==="]"){let n=o.pop();n!==void 0&&e[r+1]==="("&&(t.add(n),t.add(r))}return t}function en(e,t={}){let o=Array.from(e),r=Zr(o,"_",!1),n=Zr(o,"*",!0),i=Yp(o),a=Jp(o),l=t.escapeBackticks??o.filter(m=>m==="`").length>=2,s="";for(let m=0;m<o.length;m++){let c=o[m],u=m+1<o.length?o[m+1]:"";c==="`"?s+=l?"\\`":c:c==="\\"?s+=jp(u)?"\\\\":"\\":c==="<"?s+=Xp(u)?"\\<":"<":c==="_"?s+=r.has(m)?`\\${c}`:c:c==="*"?s+=n.has(m)?`\\${c}`:c:c==="~"?s+=i.has(m)?`\\${c}`:c:c==="["||c==="]"?s+=t.inAnchorLabel||a.has(m)?`\\${c}`:c:s+=c}return s=s.replace(/^(#{1,6})(\s)/m,"\\$1$2"),s=s.replace(/^(\d+)([.)]\s)/m,"$1\\$2"),s=s.replace(/^([-+*>])\s/m,"\\$1 "),s}function Zp(e,t){let o=st(e),r=st(t);return o.length==r.length&&o.every(n=>r.includes(n))}function on(e,t){let o=tn.isText(e),r=tn.isText(t);return t&&!r&&!o?[{text:""},e]:o?t===void 0||!r?[e]:Zp(t,e)?(t.text=[t.text,e.text].join(""),[]):[e]:[e]}function nn(e){let t=[];for(let o=0;o<e.length;o++){let r=t[t.length-1];t.push(...on(e[o],r))}return t.length===0&&t.push({text:""}),rn.isText(t[0])||t.unshift({text:""}),rn.isText(t[t.length-1])||t.push({text:""}),t}function an(e){return{url:e.url,title:e.title||void 0,alt:e.alt||void 0}}var eu=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;function Ae(e){try{let t=new URL(e);return{origin:t.origin,hostname:t.hostname,pathname:t.pathname,searchParams:t.searchParams,hash:t.hash}}catch{let t=e.match(eu);if(t===null)throw new Error(`Invalid format should not happen: ${e}`);let[,o,r,n]=[...t];return{origin:"",hostname:"",pathname:o||"",searchParams:new URLSearchParams(r),hash:n||""}}}function mt(e){if(typeof e!="string")return null;let t=e.match(/^(\d+)x(\d+)$/);return t===null?null:{width:parseInt(t[1],10),height:parseInt(t[2],10)}}function ln(e){let t=Ae(e.url);if(!t.hostname.match(/[.]portive[.]com$/i))return;let o=t.searchParams.get("size");if(o===null)return;let r=mt(o);if(r===null)return;let n=t.pathname.match(/[-][-](\d+)x(\d+)[.][a-zA-Z]+$/);if(n!==null)return{url:`${t.origin}${t.pathname}`,title:e.title||void 0,alt:e.alt||void 0,width:r.width,height:r.height,srcWidth:parseInt(n[1],10),srcHeight:parseInt(n[2],10)}}function sn(e){let t=Ae(e.url);if(t.hash.length===0)return;let o=new URLSearchParams(t.hash.slice(1)),r=mt(o.get("size")),n=mt(o.get("srcSize"));if(!(!r||!n))return{url:`${t.origin}${t.pathname}`,title:e.title||void 0,alt:e.alt||void 0,width:r.width,height:r.height,srcWidth:n.width,srcHeight:n.height}}var mn=[ln,sn,an];function cn(e){for(let t of mn){let o=t(e);if(o)return[{type:"image-inline",...o,children:[{text:""}]}]}throw new Error("Shouldn't get here because last parser always returns data")}function tu(e,t){if(/^<br\s*\/?>$/i.test(e))return[{text:`
3
+ `,...t}];let o=e.match(/^<mark\b[^>]*>(.+?)<\/mark>$/is);return o?[{text:o[1],...t,highlight:!0}]:[{text:e,code:!0}]}function K(e,t={}){let o=[],r={...t};for(let i of e){if(i.type==="html"){if(/^<mark\b[^>]*>$/i.test(i.value)){r={...r,highlight:!0};continue}if(/^<\/mark>$/i.test(i.value)){let{highlight:a,...l}=r;r=l;continue}}o.push(...ou(i,r))}return nn(o)}function ou(e,t={}){switch(e.type){case"delete":return K(e.children,{...t,strike:!0});case"emphasis":return K(e.children,{...t,italic:!0});case"footnoteReference":return[{text:`[${e.identifier}]`}];case"html":return tu(e.value,t);case"image":return cn(e);case"inlineCode":return[{text:e.value,...t,code:!0}];case"link":return[{type:"anchor",href:e.url,title:e.title==null?void 0:e.title,children:K(e.children,t)}];case"strong":return K(e.children,{...t,bold:!0});case"text":return[{text:e.value,...t}];case"linkReference":case"imageReference":throw new Error("linkReference and imageReference should be converted to link and image through our transformInlineLinks function");case"break":return[{text:`
4
+ `}];case"footnote":throw new Error("footnote is not supported yet")}be(e)}function pn(e){return[{type:"heading",level:e.depth,children:K(e.children)}]}function un(e){return[{type:"html-block",html:e.value,children:[{text:""}]}]}function dn(e,{depth:t,ordered:o,checked:r}){switch(e.type){case"paragraph":return r===!0||r===!1?[{type:"task-list-item",depth:t,checked:r,children:K(e.children)}]:o?[{type:"ordered-list-item",depth:t,children:K(e.children)}]:[{type:"unordered-list-item",depth:t,children:K(e.children)}];case"list":return St(e,t+1);default:return Co(e)}}function fn(e,t){let o=[];for(let r of e.children)o.push(...dn(r,{...t,checked:e.checked}));return o}function St(e,t=0){let o=[];for(let r of e.children)o.push(...fn(r,{depth:t,ordered:!!e.ordered}));return o}function ru(e){return!(e.length!==3||!("text"in e[0])||e[0].text!==""||!("text"in e[2])||e[2].text!==""||!("type"in e[1])||e[1].type!=="image-inline")}var nu="\xA0";function iu(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==nu)}function hn(e){let t=K(e.children);return ru(t)?[{...t[1],type:"image-block"}]:iu(t)?[{type:"paragraph",children:[{text:""}]}]:[{type:"paragraph",children:t}]}function gn(e){if(e.align==null)throw new Error("Expected an array of AlignType for table.align");return[{type:"table",columns:e.align.map(t=>({align:t||"left"})),children:e.children.map(au)}]}function au(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(lu)}}function lu(e){if(e.type!=="tableCell")throw new Error("Expected a tableCell");return{type:"table-cell",children:[{type:"table-content",children:K(e.children)}]}}function bn(){return[{type:"horizontal-rule",children:[{text:""}]}]}function $e(e){let t=[];for(let o=0;o<e.length;o++){if(o>0){let r=e[o-1],n=e[o];if(r.position&&n.position){let i=n.position.start.line-r.position.end.line-1;for(let a=1;a<i;a++)t.push({type:"paragraph",children:[{text:""}]})}}t.push(...Co(e[o]))}return t}function Co(e){switch(e.type){case"blockquote":return _r(e);case"code":return Wr(e);case"definition":throw new Error('The type "definition" should not exist. See comments');case"footnoteDefinition":return Gr(e);case"heading":return pn(e);case"html":return un(e);case"list":return St(e);case"paragraph":return hn(e);case"table":return gn(e);case"thematicBreak":return bn();case"yaml":return[]}be(e)}import{definitions as su}from"mdast-util-definitions";import{SKIP as En,visit as mu}from"unist-util-visit";function xn(e){let t=su(e);mu(e,(o,r,n)=>{let i=o,a=n;if(i.type==="definition"&&a!==null&&typeof r=="number")return a.children.splice(r,1),[En,r];if(i.type==="imageReference"||i.type==="linkReference"){let l="identifier"in i&&typeof i.identifier=="string"?i.identifier:"",s=t(l);if(s&&a!==null&&typeof r=="number"){let m=i.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:i.alt}:{type:"link",url:s.url,title:s.title,children:i.children};return a.children[r]=m,[En,r]}}})}var uu=pu().use(cu).use(Fr());function du(e){let t=uu.parse(e);return xn(t),t}function Ee(e){let t=du(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:$e(t.children)}function fu(e){return e.type==="ordered-list-item"||e.type==="unordered-list-item"||e.type==="task-list-item"}function yn(e){let t=[],o=-1;for(let r of e){if(!fu(r)){t.push(r),o=-1;continue}let n=r.depth>o+1?o+1:r.depth;t.push({...r,depth:n}),o=n}return t}function kn(e){if(e.type!=="code-block-line")throw new Error(`Expected all children of code-block to be a codeline but is ${JSON.stringify(e,null,2)}`);return e.children.map(t=>t.text).join("")}function vn(e){let t=[],o=3;for(let r of e.children){let n=kn(r),i=n.match(/^([`]+)/);i&&(o=Math.max(o,i[1].length+1)),t.push(n)}return t.unshift(`${"`".repeat(o)}${e.language}`),t.push(`${"`".repeat(o)}`),`${t.join(`
5
5
  `)}
6
6
 
7
- `}function In(e){return e.url}function Mn(e){if(e.url.startsWith("$"))return"";let{hostname:t}=Ae(e.url);if(t.match(/[.]portive[.]com$/i)&&e.width&&e.height)return`${e.url}?size=${e.width}x${e.height}`}function Pn(e){if(e.width&&e.height&&e.srcWidth&&e.srcHeight)return`${e.url}#srcSize=${e.srcWidth}x${e.srcHeight}&size=${e.width}x${e.height}`}var xu=[Mn,Pn,In];function St(e){for(let t of xu){let o=t(e);if(typeof o=="string")return o===""?"":`![${e.alt}](${o}${typeof e.title=="string"?` "${e.title}"`:""})`}throw new Error("Shouldn't get here")}function Cn(e){let t=St(e);return t?`${t}
7
+ `}function Tn(e){return e.url}function wn(e){if(e.url.startsWith("$"))return"";let{hostname:t}=Ae(e.url);if(t.match(/[.]portive[.]com$/i)&&e.width&&e.height)return`${e.url}?size=${e.width}x${e.height}`}function In(e){if(e.width&&e.height&&e.srcWidth&&e.srcHeight)return`${e.url}#srcSize=${e.srcWidth}x${e.srcHeight}&size=${e.width}x${e.height}`}var hu=[wn,In,Tn];function Rt(e){for(let t of hu){let o=t(e);if(typeof o=="string")return o===""?"":`![${e.alt}](${o}${typeof e.title=="string"?` "${e.title}"`:""})`}throw new Error("Shouldn't get here")}function Mn(e){let t=Rt(e);return t?`${t}
8
8
 
9
- `:""}import{Element as wu,Text as Gn}from"slate";function Sn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:en(o)}}function Rn(e,t){let o=[...e],r=e.filter(i=>!t.includes(i)),n=[];for(let i=0;i<e.length&&r.length!==0;i++){let a=o.pop();if(a===void 0)throw new Error("This shouldn't happen unless we made a mistake in the algorithm");n.push(a);let l=r.indexOf(a);l!==-1&&r.splice(l,1)}return{orderedMarksToRemove:n,nextOrderedMarks:o}}function Ro(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=Rn(e,t),{orderedMarksToAdd:n}=Sn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as ku}from"slate";function Ln({node:e,nextNode:t,nodes:o,index:r}){return!U(e)||!D(e)||e.code||!U(t)||!D(t)||t.code?!1:(o.splice(r,2,{text:`${e.text}${t.text}`}),!0)}function Bn({node:e,nodes:t,prevNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[0];return U(n)&&D(n)?(e.children.splice(0,1),U(o)&&D(o)?o.text=`${o.text}${n.text}`:t.splice(r,0,{text:n.text}),!0):!1}function Dn({node:e,nodes:t,nextNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[e.children.length-1];return U(n)&&D(n)?(e.children.splice(e.children.length-1,1),U(o)&&D(o)?o.text=`${n.text}${o.text}`:t.splice(r+1,0,{text:n.text}),!0):!1}function zn({node:e}){return!re(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function $n({node:e,nodes:t,index:o}){if(!U(e)||D(e)||e.code)return!1;let r=e.text.match(/^(\s*)(.*?)(\s*)$/);if(!r||r[1].length===0&&r[3].length===0)return!1;let n=[{text:r[1]},{...e,text:r[2]},{text:r[3]}].filter(i=>i.text!=="");return t.splice(o,1,...n),!0}function Nn({index:e,nodes:t,node:o,parent:r}){return e!==t.length-1||t.length<=1||!U(o)||!D(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(t.length-1,1),!0):!1}function Hn({index:e,nodes:t,node:o,parent:r}){return e!==0||t.length===0||!U(o)||!D(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(0,1),!0):!1}var An=[$n,Bn,Dn,Ln,Hn,Nn,zn];function On(e){for(let t of An)if(t(e))return!0;return!1}var yu=72;function Lo(e,t){let o=!1,r,n=0,i=(e.length+1)*yu;do{if(r=!1,n=n+1,n>i)throw new Error(`There have been ${n} normalization passes (72x the number of nodes at this level). This likely indicates a bug in the code.`);e:for(let a=0;a<e.length;a++){let l=e[a];if(re(l)&&Lo(l.children,l)){r=!0,o=!0;break e}let m=e[a-1],s=e[a+1];if(On({parent:t,node:l,prevNode:m,nextNode:s,index:a,nodes:e})){r=!0,o=!0;break e}}}while(r);return o}var Un=e=>e.map(t=>ku.isElement(t)&&t.type==="anchor"?{...t,children:Un(t.children)}:t);function Fn(e){let t={type:"line",children:Un(e)};return Lo([t],void 0),t.children}import{Text as vu}from"slate";function Vn(e){let t=0;for(let o of e.text.matchAll(/[`]+/g))t=Math.max(t,o[0].length);return t===0?`\`${e.text.replace(/[`]/g,"\\`")}\``:`${"`".repeat(t+1)} ${e.text} ${"`".repeat(t+1)}`}function Tu(e){return e.replace(/"/g,'\\"')}function Kn(e,t){let o=Co(e.children),r={...t,inAnchorLabel:!0};return e.href.startsWith("$")?G(e.children,o,o,t):typeof e.title=="string"&&e.title.length>0?`[${G(e.children,o,o,r)}](${e.href} "${Tu(e.title)}")`:`[${G(e.children,o,o,r)}](${e.href})`}function _n(e,t){return on(e.text,t).replace(/\n/g,`
10
- `)}function Wn(e,t){if(vu.isText(e))return e.code?Vn(e):_n(e,t);switch(e.type){case"anchor":return Kn(e,t);case"image-inline":return St(e);default:be(e)}}function Iu(e){let t=0,o=r=>{for(let n of r)if(Gn.isText(n)){if(n.code)return!0;for(let i of n.text)if(i==="`"&&++t>=2)return!0}else if(n.type==="anchor"&&o(n.children))return!0;return!1};return o(e)}function G(e,t=[],o=[],r){let n=Fn(e),i=[],a={...r,escapeBackticks:r?.escapeBackticks??Iu(n)},l=Ro(t,Po(n[0]));for(let m=0;m<n.length;m++){let s=n[m];if(Gn.isText(s)&&D(s)){i.push(s.text);continue}i.push(Yr(l.add)),i.push(Wn(s,a));let c=Mu(n,m,o),u=Ro(l.nextOrderedMarks,c);i.push(Jr(u.remove)),l=u}return i.join("")}function Mu(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!D(n)&&!(wu.isElement(n)&&n.type==="image-inline"))return Po(n)}return o}function Qn(e){let t=[];return t.push(qn(e.children[0])),t.push(Pu(e.columns)),e.children.slice(1).forEach(o=>{t.push(qn(o))}),`${t.join(`
9
+ `:""}import{Element as yu,Text as _n}from"slate";function Pn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:Jr(o)}}function Cn(e,t){let o=[...e],r=e.filter(i=>!t.includes(i)),n=[];for(let i=0;i<e.length&&r.length!==0;i++){let a=o.pop();if(a===void 0)throw new Error("This shouldn't happen unless we made a mistake in the algorithm");n.push(a);let l=r.indexOf(a);l!==-1&&r.splice(l,1)}return{orderedMarksToRemove:n,nextOrderedMarks:o}}function So(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=Cn(e,t),{orderedMarksToAdd:n}=Pn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as bu}from"slate";function Sn({node:e,nextNode:t,nodes:o,index:r}){return!U(e)||!D(e)||e.code||!U(t)||!D(t)||t.code?!1:(o.splice(r,2,{text:`${e.text}${t.text}`}),!0)}function Rn({node:e,nodes:t,prevNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[0];return U(n)&&D(n)?(e.children.splice(0,1),U(o)&&D(o)?o.text=`${o.text}${n.text}`:t.splice(r,0,{text:n.text}),!0):!1}function Ln({node:e,nodes:t,nextNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[e.children.length-1];return U(n)&&D(n)?(e.children.splice(e.children.length-1,1),U(o)&&D(o)?o.text=`${n.text}${o.text}`:t.splice(r+1,0,{text:n.text}),!0):!1}function Bn({node:e}){return!re(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function Dn({node:e,nodes:t,index:o}){if(!U(e)||D(e)||e.code)return!1;let r=e.text.match(/^(\s*)(.*?)(\s*)$/);if(!r||r[1].length===0&&r[3].length===0)return!1;let n=[{text:r[1]},{...e,text:r[2]},{text:r[3]}].filter(i=>i.text!=="");return t.splice(o,1,...n),!0}function zn({index:e,nodes:t,node:o,parent:r}){return e!==t.length-1||t.length<=1||!U(o)||!D(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(t.length-1,1),!0):!1}function $n({index:e,nodes:t,node:o,parent:r}){return e!==0||t.length===0||!U(o)||!D(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(0,1),!0):!1}var Nn=[Dn,Rn,Ln,Sn,$n,zn,Bn];function Hn(e){for(let t of Nn)if(t(e))return!0;return!1}var gu=72;function Ro(e,t){let o=!1,r,n=0,i=(e.length+1)*gu;do{if(r=!1,n=n+1,n>i)throw new Error(`There have been ${n} normalization passes (72x the number of nodes at this level). This likely indicates a bug in the code.`);e:for(let a=0;a<e.length;a++){let l=e[a];if(re(l)&&Ro(l.children,l)){r=!0,o=!0;break e}let s=e[a-1],m=e[a+1];if(Hn({parent:t,node:l,prevNode:s,nextNode:m,index:a,nodes:e})){r=!0,o=!0;break e}}}while(r);return o}var An=e=>e.map(t=>bu.isElement(t)&&t.type==="anchor"?{...t,children:An(t.children)}:t);function On(e){let t={type:"line",children:An(e)};return Ro([t],void 0),t.children}import{Text as xu}from"slate";function Un(e){let t=0;for(let o of e.text.matchAll(/[`]+/g))t=Math.max(t,o[0].length);return t===0?`\`${e.text.replace(/[`]/g,"\\`")}\``:`${"`".repeat(t+1)} ${e.text} ${"`".repeat(t+1)}`}function Eu(e){return e.replace(/"/g,'\\"')}function Fn(e,t){let o=Po(e.children),r={...t,inAnchorLabel:!0};return e.href.startsWith("$")?G(e.children,o,o,t):typeof e.title=="string"&&e.title.length>0?`[${G(e.children,o,o,r)}](${e.href} "${Eu(e.title)}")`:`[${G(e.children,o,o,r)}](${e.href})`}function Vn(e,t){return en(e.text,t).replace(/\n/g,`
10
+ `)}function Kn(e,t){if(xu.isText(e))return e.code?Un(e):Vn(e,t);switch(e.type){case"anchor":return Fn(e,t);case"image-inline":return Rt(e);default:be(e)}}function ku(e){let t=0,o=r=>{for(let n of r)if(_n.isText(n)){if(n.code)return!0;for(let i of n.text)if(i==="`"&&++t>=2)return!0}else if(n.type==="anchor"&&o(n.children))return!0;return!1};return o(e)}function G(e,t=[],o=[],r){let n=On(e),i=[],a={...r,escapeBackticks:r?.escapeBackticks??ku(n)},l=So(t,Mo(n[0]));for(let s=0;s<n.length;s++){let m=n[s];if(_n.isText(m)&&D(m)){i.push(m.text);continue}i.push(jr(l.add)),i.push(Kn(m,a));let c=vu(n,s,o),u=So(l.nextOrderedMarks,c);i.push(Xr(u.remove)),l=u}return i.join("")}function vu(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!D(n)&&!(yu.isElement(n)&&n.type==="image-inline"))return Mo(n)}return o}function Gn(e){let t=[];return t.push(Wn(e.children[0])),t.push(Tu(e.columns)),e.children.slice(1).forEach(o=>{t.push(Wn(o))}),`${t.join(`
11
11
  `)}
12
12
 
13
- `}function Pu(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>Cu(o.align)).join("|")}|`}function Cu(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function qn(e){return Pt(e,"table-row"),`|${e.children.map(Su).join("|")}|`}function Su(e){return Pt(e,"table-cell"),Wr(e.children.length===1,`Expected table-cell to have one child but is ${JSON.stringify(e.children)}`),e.children.map(Ru).join("")}function Ru(e){return Pt(e,"table-content"),G(e.children).replace(/\|/g,"\\|").replace(/ {2}\n/g,"<br>").replace(/\n/g,"<br>")}var Bo=4;function jn(e,t){switch(e.type){case"anchor":return`[${G(e.children)}](${e.href})`;case"block-quote":return`${Rt(e.children).split(`
13
+ `}function Tu(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>wu(o.align)).join("|")}|`}function wu(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function Wn(e){return Ct(e,"table-row"),`|${e.children.map(Iu).join("|")}|`}function Iu(e){return Ct(e,"table-cell"),Kr(e.children.length===1,`Expected table-cell to have one child but is ${JSON.stringify(e.children)}`),e.children.map(Mu).join("")}function Mu(e){return Ct(e,"table-content"),G(e.children).replace(/\|/g,"\\|").replace(/ {2}\n/g,"<br>").replace(/\n/g,"<br>")}var Lo=4;function qn(e,t){switch(e.type){case"anchor":return`[${G(e.children)}](${e.href})`;case"block-quote":return`${Lt(e.children).split(`
14
14
  `).map(r=>r?`> ${r}`:">").join(`
15
15
  `)}
16
16
 
@@ -22,21 +22,21 @@
22
22
 
23
23
  `:`${o}
24
24
 
25
- `}case"table":return Qn(e);case"table-row":case"table-cell":case"table-content":throw new Error(`Table elements should only be present as children of table which should be handled by serializeTable. Got ${e.type} may indicate an error in normalization.`);case"unordered-list-item":return`${" ".repeat(e.depth*Bo)}- ${G(e.children)}
26
- `;case"ordered-list-item":return`${" ".repeat(e.depth*Bo)}${t[e.depth]}. ${G(e.children)}
27
- `;case"task-list-item":{let o=" ".repeat(e.depth*Bo),r=G(e.children);return r.trim()===""&&(r="&#32;"),`${o}- [${e.checked?"x":" "}] ${r}
28
- `}case"image-block":return Cn(e);case"image-inline":return`![${e.alt||""}](${e.url})`;case"code-block":return wn(e);case"code-block-line":throw new Error("Code block line elements should only be present as children of code-block which should be handled by serializeCodeBlock. Got code-block-line may indicate an error in normalization.");case"html-block":return`${e.html}
25
+ `}case"table":return Gn(e);case"table-row":case"table-cell":case"table-content":throw new Error(`Table elements should only be present as children of table which should be handled by serializeTable. Got ${e.type} may indicate an error in normalization.`);case"unordered-list-item":return`${" ".repeat(e.depth*Lo)}- ${G(e.children)}
26
+ `;case"ordered-list-item":return`${" ".repeat(e.depth*Lo)}${t[e.depth]}. ${G(e.children)}
27
+ `;case"task-list-item":{let o=" ".repeat(e.depth*Lo),r=G(e.children);return r.trim()===""&&(r="&#32;"),`${o}- [${e.checked?"x":" "}] ${r}
28
+ `}case"image-block":return Mn(e);case"image-inline":return`![${e.alt||""}](${e.url})`;case"code-block":return vn(e);case"code-block-line":throw new Error("Code block line elements should only be present as children of code-block which should be handled by serializeCodeBlock. Got code-block-line may indicate an error in normalization.");case"html-block":return`${e.html}
29
29
 
30
- `}be(e)}function Rt(e){let t=[],o=[];for(let n=0;n<e.length;n++){let i=e[n],a=n<e.length-1?e[n+1]:null;i.type==="ordered-list-item"?(o[i.depth]=(o[i.depth]||0)+1,o=o.slice(0,i.depth+1)):i.type==="unordered-list-item"||i.type==="task-list-item"?o=o.slice(0,i.depth):o=[];let l=jn(i,o);(i.type==="ordered-list-item"||i.type==="unordered-list-item"||i.type==="task-list-item")&&(!a||a.type!=="ordered-list-item"&&a.type!=="unordered-list-item"&&a.type!=="task-list-item")&&(l=l.replace(/\n$/,`
30
+ `}be(e)}function Lt(e){let t=[],o=[];for(let n=0;n<e.length;n++){let i=e[n],a=n<e.length-1?e[n+1]:null;i.type==="ordered-list-item"?(o[i.depth]=(o[i.depth]||0)+1,o=o.slice(0,i.depth+1)):i.type==="unordered-list-item"||i.type==="task-list-item"?o=o.slice(0,i.depth):o=[];let l=qn(i,o);(i.type==="ordered-list-item"||i.type==="unordered-list-item"||i.type==="task-list-item")&&(!a||a.type!=="ordered-list-item"&&a.type!=="unordered-list-item"&&a.type!=="task-list-item")&&(l=l.replace(/\n$/,`
31
31
 
32
- `)),t.push(l)}let r=t.join("");return r.replace(/[\t\n\r ]/g,"")===""?"":r.replace(/^\n+/,"").replace(/[\t\n\r ]+$/,"")}function ct(e){let t=Tn(e);return Rt(t)}var Do={ja:{bold:"\u592A\u5B57",italic:"\u659C\u4F53",strike:"\u53D6\u308A\u6D88\u3057\u7DDA",inlineCode:"\u30A4\u30F3\u30E9\u30A4\u30F3\u30B3\u30FC\u30C9",underline:"\u4E0B\u7DDA",highlight:"\u30CF\u30A4\u30E9\u30A4\u30C8",increaseDepth:"\u968E\u5C64\u3092\u6DF1\u304F\u3059\u308B",decreaseDepth:"\u968E\u5C64\u3092\u6D45\u304F\u3059\u308B",heading1:"\u898B\u51FA\u30571",heading2:"\u898B\u51FA\u30572",heading3:"\u898B\u51FA\u30573",normal:"\u6A19\u6E96",paragraph:"\u6BB5\u843D",paragraphStyle:"\u6BB5\u843D\u30B9\u30BF\u30A4\u30EB",bulletList:"\u7B87\u6761\u66F8\u304D",numberedList:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkList:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",list:"\u30EA\u30B9\u30C8",linkUrl:"\u30EA\u30F3\u30AF\u306EURL",linkText:"\u30EA\u30F3\u30AF\u30C6\u30AD\u30B9\u30C8",linkTextHint:"\u30EA\u30F3\u30AF\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u308B\u30C6\u30AD\u30B9\u30C8",tooltipText:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\u30C6\u30AD\u30B9\u30C8",tooltipHint:"\u30DE\u30A6\u30B9\u30DB\u30D0\u30FC\u6642\u306B\u8868\u793A\u3055\u308C\u308B\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",apply:"\u9069\u7528",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",insertLink:"\u30EA\u30F3\u30AF",quote:"\u5F15\u7528",insertTable:"\u8868",insertImage:"\u753B\u50CF",insertImageFromUrl:"\u753B\u50CF",insert:"\u633F\u5165",format:"\u66F8\u5F0F",imageUrlRequired:"\u753B\u50CFURL\uFF08\u5FC5\u9808\uFF09\uFF1A",altText:"\u4EE3\u66FF\u30C6\u30AD\u30B9\u30C8\uFF1A",title:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\uFF1A",imageDescription:"\u753B\u50CF\u306E\u8AAC\u660E",imageTitle:"\u753B\u50CF\u306E\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",switchToVisualEditor:"\u30D3\u30B8\u30E5\u30A2\u30EB\u30A8\u30C7\u30A3\u30BF\u306B\u5207\u308A\u66FF\u3048",switchToRawMarkdown:"\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8868\u793A\u306B\u5207\u308A\u66FF\u3048",codeBlock:"\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF",increaseQuoteDepth:"\u5F15\u7528\u3092\u91CD\u306D\u308B",horizontalRule:"\u533A\u5207\u308A\u7DDA",register:"\u767B\u9332",imageSourceUrl:"URL",imageSourceFile:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",selectFile:"\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E",uploading:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D...",saving:"\u4FDD\u5B58\u4E2D...",uploadComplete:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5B8C\u4E86",imageSourceSelect:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u6E08\u307F",vaultPath:"\u4FDD\u5B58\u5148\u30D1\u30B9\uFF1A",vaultPathHint:"vault\u5185\u306E\u4FDD\u5B58\u5148\u30D1\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},en:{bold:"Bold",italic:"Italic",strike:"Strikethrough",inlineCode:"Inline Code",underline:"Underline",highlight:"Highlight",increaseDepth:"Increase Depth",decreaseDepth:"Decrease Depth",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",normal:"Normal",paragraph:"Paragraph",paragraphStyle:"Paragraph Style",bulletList:"Bullet List",numberedList:"Numbered List",checkList:"Check List",list:"List",linkUrl:"Link URL",linkText:"Link Text",linkTextHint:"Text displayed as the link",tooltipText:"Tooltip Text",tooltipHint:"Tooltip shown on mouse hover",apply:"Apply",cancel:"Cancel",insertLink:"Link",quote:"Quote",insertTable:"Table",insertImage:"Image",insertImageFromUrl:"Image",insert:"Insert",format:"Format",imageUrlRequired:"Image URL (required):",altText:"Alt Text:",title:"tooltip:",imageDescription:"Description of the image",imageTitle:"tooltip",switchToVisualEditor:"Switch to visual editor",switchToRawMarkdown:"Switch to raw markdown",codeBlock:"Code Block",increaseQuoteDepth:"Increase Quote Depth",horizontalRule:"Horizontal Rule",register:"Register",imageSourceUrl:"URL",imageSourceFile:"Upload",selectFile:"Select File",uploading:"Uploading...",saving:"Saving...",uploadComplete:"Upload Complete",imageSourceSelect:"Uploaded",vaultPath:"Save Path:",vaultPathHint:"Enter the path within the vault to save the file"}},Xn=()=>{try{if(typeof window<"u"&&window.navigator)return window.navigator.language.split("-")[0]}catch{}return"en"},h=e=>{let t=Xn();return Do[t==="ja"?"ja":"en"][e]},zo=e=>{let t=Xn();return Object.keys(Do[t==="ja"?"ja":"en"]).find(r=>Do[t==="ja"?"ja":"en"][r]===e)||""};var T=e=>({fn:e});import{useEffect as $u,useMemo as ai,useRef as Nu}from"react";import{Editor as $o,Transforms as Hu}from"slate";import{ReactEditor as Au,useSlateStatic as Ou}from"slate-react";function ie(e){return!!e}function Yn(e,t){let o=t.map(r=>r.editableProps?.decorate).filter(ie);return function(r){let n=[];for(let i of o){let a=i(r);n.push(...a)}return e&&n.push(...e(r)),n}}import{Editable as Lu}from"slate-react";import{jsx as Bu}from"react/jsx-runtime";function Jn(e){let t=e.map(r=>r.renderEditable).filter(ie),o=r=>Bu(Lu,{...r});for(let r of t){let n=o;o=i=>r({attributes:i,Editable:n})}return o}function Lt(e,t){let o=[];for(let r of e){let n=r.editableProps?.[t];n&&o.push(n)}return o}function Bt(e,t){return function(o){for(let r of e)if(r(o))return;t?.(o)}}var Zn=(e,t)=>{let o=Lt(t,"onKeyDown");return Bt(o,e)},ei=(e,t)=>{let o=Lt(t,"onKeyUp");return Bt(o,e)},ti=(e,t)=>{let o=Lt(t,"onPaste");return Bt(o,e)},oi=(e,t)=>{let o=Lt(t,"onDrop");return Bt(o,e)};function ri(e,t){let o=t.map(r=>r.editableProps?.renderElement).filter(ie);return function(n){for(let i of o){let a=i(n);if(a)return a}if(e===void 0)throw new Error(`Element with type ${n.element.type} not handled. Note that renderElement is not defined on SinkEditable so this is only the result of checking the Sink Plugins.`);return e(n)}}import{cloneElement as Du}from"react";function ni(e,t){if(e===void 0)throw new Error("renderLeaf was not defined on SinkEditable");let o=t.map(r=>r.editableProps?.renderLeaf).filter(ie).reverse();return function(r){let n=e({...r,attributes:{}});for(let i of o){let a=i({...r,children:n});a&&(n=a)}return n=Du(n,r.attributes),n}}function ii(e,t){if(e)return e;let o=t.map(r=>r.editableProps?.renderPlaceholder).filter(ie);if(o.length!==0)return function(r){if(o.length>1)throw new Error(`Only one plugin can define renderPlaceholder but there are ${o.length}`);let n=o[0];if(n==null)throw new Error("Expected fn to be defined");return n(r)}}import zu from"@emotion/styled";var pt=zu("div")`
32
+ `)),t.push(l)}let r=t.join("");return r.replace(/[\t\n\r ]/g,"")===""?"":r.replace(/^\n+/,"").replace(/[\t\n\r ]+$/,"")}function ct(e){let t=yn(e);return Lt(t)}var Bo={ja:{bold:"\u592A\u5B57",italic:"\u659C\u4F53",strike:"\u53D6\u308A\u6D88\u3057\u7DDA",inlineCode:"\u30A4\u30F3\u30E9\u30A4\u30F3\u30B3\u30FC\u30C9",underline:"\u4E0B\u7DDA",highlight:"\u30CF\u30A4\u30E9\u30A4\u30C8",increaseDepth:"\u968E\u5C64\u3092\u6DF1\u304F\u3059\u308B",decreaseDepth:"\u968E\u5C64\u3092\u6D45\u304F\u3059\u308B",heading1:"\u898B\u51FA\u30571",heading2:"\u898B\u51FA\u30572",heading3:"\u898B\u51FA\u30573",normal:"\u6A19\u6E96",paragraph:"\u6BB5\u843D",paragraphStyle:"\u6BB5\u843D\u30B9\u30BF\u30A4\u30EB",bulletList:"\u7B87\u6761\u66F8\u304D",numberedList:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkList:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",list:"\u30EA\u30B9\u30C8",linkUrl:"\u30EA\u30F3\u30AF\u306EURL",linkText:"\u30EA\u30F3\u30AF\u30C6\u30AD\u30B9\u30C8",linkTextHint:"\u30EA\u30F3\u30AF\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u308B\u30C6\u30AD\u30B9\u30C8",tooltipText:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\u30C6\u30AD\u30B9\u30C8",tooltipHint:"\u30DE\u30A6\u30B9\u30DB\u30D0\u30FC\u6642\u306B\u8868\u793A\u3055\u308C\u308B\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",apply:"\u9069\u7528",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",insertLink:"\u30EA\u30F3\u30AF",quote:"\u5F15\u7528",insertTable:"\u8868",insertImage:"\u753B\u50CF",insertImageFromUrl:"\u753B\u50CF",insert:"\u633F\u5165",format:"\u66F8\u5F0F",imageUrlRequired:"\u753B\u50CFURL\uFF08\u5FC5\u9808\uFF09\uFF1A",altText:"\u4EE3\u66FF\u30C6\u30AD\u30B9\u30C8\uFF1A",title:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\uFF1A",imageDescription:"\u753B\u50CF\u306E\u8AAC\u660E",imageTitle:"\u753B\u50CF\u306E\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",switchToVisualEditor:"\u30D3\u30B8\u30E5\u30A2\u30EB\u30A8\u30C7\u30A3\u30BF\u306B\u5207\u308A\u66FF\u3048",switchToRawMarkdown:"\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8868\u793A\u306B\u5207\u308A\u66FF\u3048",codeBlock:"\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF",increaseQuoteDepth:"\u5F15\u7528\u3092\u91CD\u306D\u308B",horizontalRule:"\u533A\u5207\u308A\u7DDA",register:"\u767B\u9332",imageSourceUrl:"URL",imageSourceFile:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",selectFile:"\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E",uploading:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D...",saving:"\u4FDD\u5B58\u4E2D...",uploadComplete:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5B8C\u4E86",imageSourceSelect:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u6E08\u307F",vaultPath:"\u4FDD\u5B58\u5148\u30D1\u30B9\uFF1A",vaultPathHint:"vault\u5185\u306E\u4FDD\u5B58\u5148\u30D1\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},en:{bold:"Bold",italic:"Italic",strike:"Strikethrough",inlineCode:"Inline Code",underline:"Underline",highlight:"Highlight",increaseDepth:"Increase Depth",decreaseDepth:"Decrease Depth",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",normal:"Normal",paragraph:"Paragraph",paragraphStyle:"Paragraph Style",bulletList:"Bullet List",numberedList:"Numbered List",checkList:"Check List",list:"List",linkUrl:"Link URL",linkText:"Link Text",linkTextHint:"Text displayed as the link",tooltipText:"Tooltip Text",tooltipHint:"Tooltip shown on mouse hover",apply:"Apply",cancel:"Cancel",insertLink:"Link",quote:"Quote",insertTable:"Table",insertImage:"Image",insertImageFromUrl:"Image",insert:"Insert",format:"Format",imageUrlRequired:"Image URL (required):",altText:"Alt Text:",title:"tooltip:",imageDescription:"Description of the image",imageTitle:"tooltip",switchToVisualEditor:"Switch to visual editor",switchToRawMarkdown:"Switch to raw markdown",codeBlock:"Code Block",increaseQuoteDepth:"Increase Quote Depth",horizontalRule:"Horizontal Rule",register:"Register",imageSourceUrl:"URL",imageSourceFile:"Upload",selectFile:"Select File",uploading:"Uploading...",saving:"Saving...",uploadComplete:"Upload Complete",imageSourceSelect:"Uploaded",vaultPath:"Save Path:",vaultPathHint:"Enter the path within the vault to save the file"}},Qn=()=>{try{if(typeof window<"u"&&window.navigator)return window.navigator.language.split("-")[0]}catch{}return"en"},h=e=>{let t=Qn();return Bo[t==="ja"?"ja":"en"][e]},Do=e=>{let t=Qn();return Object.keys(Bo[t==="ja"?"ja":"en"]).find(r=>Bo[t==="ja"?"ja":"en"][r]===e)||""};var v=e=>({fn:e});import{useEffect as Lu,useMemo as ni,useRef as Bu}from"react";import{Editor as zo,Transforms as Du}from"slate";import{ReactEditor as zu,useSlateStatic as $u}from"slate-react";function ie(e){return!!e}function jn(e,t){let o=t.map(r=>r.editableProps?.decorate).filter(ie);return function(r){let n=[];for(let i of o){let a=i(r);n.push(...a)}return e&&n.push(...e(r)),n}}import{Editable as Pu}from"slate-react";import{jsx as Cu}from"react/jsx-runtime";function Xn(e){let t=e.map(r=>r.renderEditable).filter(ie),o=r=>Cu(Pu,{...r});for(let r of t){let n=o;o=i=>r({attributes:i,Editable:n})}return o}function Bt(e,t){let o=[];for(let r of e){let n=r.editableProps?.[t];n&&o.push(n)}return o}function Dt(e,t){return function(o){for(let r of e)if(r(o))return;t?.(o)}}var Yn=(e,t)=>{let o=Bt(t,"onKeyDown");return Dt(o,e)},Jn=(e,t)=>{let o=Bt(t,"onKeyUp");return Dt(o,e)},Zn=(e,t)=>{let o=Bt(t,"onPaste");return Dt(o,e)},ei=(e,t)=>{let o=Bt(t,"onDrop");return Dt(o,e)};function ti(e,t){let o=t.map(r=>r.editableProps?.renderElement).filter(ie);return function(n){for(let i of o){let a=i(n);if(a)return a}if(e===void 0)throw new Error(`Element with type ${n.element.type} not handled. Note that renderElement is not defined on SinkEditable so this is only the result of checking the Sink Plugins.`);return e(n)}}import{cloneElement as Su}from"react";function oi(e,t){if(e===void 0)throw new Error("renderLeaf was not defined on SinkEditable");let o=t.map(r=>r.editableProps?.renderLeaf).filter(ie).reverse();return function(r){let n=e({...r,attributes:{}});for(let i of o){let a=i({...r,children:n});a&&(n=a)}return n=Su(n,r.attributes),n}}function ri(e,t){if(e)return e;let o=t.map(r=>r.editableProps?.renderPlaceholder).filter(ie);if(o.length!==0)return function(r){if(o.length>1)throw new Error(`Only one plugin can define renderPlaceholder but there are ${o.length}`);let n=o[0];if(n==null)throw new Error("Expected fn to be defined");return n(r)}}import Ru from"@emotion/styled";var pt=Ru("div")`
33
33
  -webkit-font-smoothing: antialiased;
34
34
  -moz-osx-font-smoothing: grayscale;
35
35
  font-size: 1rem;
36
36
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
37
37
  Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
38
38
  box-sizing: border-box;
39
- `;import{jsx as Ku}from"react/jsx-runtime";var li=e=>/[^\x00-\x7F]/.test(e);function Uu(e,t){let[o]=t.getTargetRanges();if(o)try{let r=Au.toSlateRange(e,o,{exactMatch:!1,suppressThrow:!1});Hu.select(e,r)}catch{}}function Fu(e,t,o){return r=>{let n=e?.(r);return n!=null||r.defaultPrevented||r.inputType!=="insertText"||r.isComposing||typeof r.data!="string"||r.data.length===0||!li(r.data)?n:(Uu(t,r),r.preventDefault(),$o.insertText(t,r.data),o.current=r.data,!0)}}function Vu(e,t,o){return r=>{let n=e?.(r);if(n!=null||r.defaultPrevented)return n;let i=r.nativeEvent;return!(i instanceof InputEvent)||i.inputType!=="insertText"||i.isComposing||typeof i.data!="string"||i.data.length===0||!li(i.data)?n:o.current===i.data?(o.current=null,n):($o.insertText(t,i.data),n)}}function si(e){let t=Ou(),o=Nu(null);$u(()=>{$o.normalize(t,{force:!0})},[t]);let{plugins:r}=t.sink,n=ai(()=>({...e,decorate:Yn(e.decorate,r),renderElement:ri(e.renderElement,r),renderLeaf:ni(e.renderLeaf,r),renderPlaceholder:ii(e.renderPlaceholder,r),onKeyDown:Zn(e.onKeyDown,r),onKeyUp:ei(e.onKeyUp,r),onPaste:ti(e.onPaste,r),onDrop:oi(e.onDrop,r),onDOMBeforeInput:Fu(e.onDOMBeforeInput,t,o),onInput:Vu(e.onInput,t,o)}),[e.decorate,e.renderElement,e.renderLeaf,e.renderPlaceholder,e.onKeyDown,e.onKeyUp,e.onPaste,e.onDrop,e.onDOMBeforeInput,e.onInput,e.placeholder,e.className,t,r]),i=ai(()=>Jn(r),[r]);return Ku(i,{...n})}function Oe(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(a){for(let m of n){let c=m.editor?.[t],u=c?.(a);if(typeof u=="boolean")return u}return r(a)}}function se(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,m=[];for(let s of n){let c=s.editor?.[t]?.(...a);if(typeof c=="function")m.push(c);else if(c===!0){l=!0;break}}l||r(...a),m.forEach(s=>s())}}function mi(e){return(t,o)=>{let r=t,n=e.map(i=>i(r,o,{createPolicy:a=>a}));return r.sink={plugins:n},r.isMaster="isMaster"in r?r.isMaster:()=>!1,r.isSlave="isSlave"in r?r.isSlave:()=>!1,r.isStandalone="isStandalone"in r?r.isStandalone:()=>!1,Object.assign(r,{normalizeNode:se(r,"normalizeNode",n),deleteBackward:se(r,"deleteBackward",n),deleteForward:se(r,"deleteForward",n),deleteFragment:se(r,"deleteFragment",n),insertBreak:se(r,"insertBreak",n),insertFragment:se(r,"insertFragment",n),insertNode:se(r,"insertNode",n),insertText:se(r,"insertText",n),isInline:Oe(r,"isInline",n),isVoid:Oe(r,"isVoid",n),isMaster:Oe(r,"isMaster",n),isSlave:Oe(r,"isSlave",n),isStandalone:Oe(r,"isStandalone",n)}),r}}var ci=e=>{let t=e.map(n=>n.fn);return{withSink:mi(t),SinkEditable:si}};import{Element as _u}from"slate";import{ReactEditor as Wu}from"slate-react";function pi(e,t){return _u.isElement(t)?Wu.findPath(e,t):t}function f(e,t){return e.bind(null,t)}function q(e,t,o){return e.bind(null,t,o)}var Gu=/mac os x|macintosh/i,ut;function Dt(){if(ut!==void 0)return ut;try{let{userAgent:e}=window.navigator;ut=Gu.test(e)}catch{ut=!1}return ut}function Me(e){e.preventDefault(),e.stopPropagation()}import{Editor as fi,Path as qu}from"slate";import{Element as ui}from"slate";function di(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>ui.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>ui.isElement(o)&&e.includes(o.type);let t=e;throw new Error(`Expected matchNode to be a function, string or array but is ${t}`)}function x(e,t,{at:o=e.selection}={}){if(o===null)return;let r=pi(e,o),n=di(t);if(qu.isPath(r)){let i=fi.node(e,r);if(i&&n(i[0]))return i}return fi.above(e,{at:r,match:n})}function Ue(...e){return x(...e)?.[1]}import{jsx as Qu}from"react/jsx-runtime";var y=({strokeWidth:e=1.5,...t})=>Qu("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",strokeWidth:e,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...t});import{Range as ju}from"slate";function me(e){return e==null?!1:ju.isCollapsed(e)}import{Element as hi}from"slate";function zt(e){return Array.isArray(e)?t=>hi.isElement(t)&&e.includes(t.type):t=>hi.isElement(t)&&e==t.type}import{Editor as Xu}from"slate";function gi(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&Xu.isEnd(e,o.anchor,r[1])}import{Editor as Q1}from"slate";import{Editor as Yu}from"slate";function Pe(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&Yu.isStart(e,o.anchor,r[1])}import{isHotkey as bi}from"is-hotkey";import{Editor as No,Element as Ju,Range as Zu,Transforms as ed}from"slate";var td=bi(" "),od=bi("SHIFT+SPACE");function Ei(e,t){return o=>{if(!td(o.nativeEvent)&&!od(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Zu.isExpanded(r))return!1;let n=x(e,s=>Ju.isElement(s)&&e.convertElement.isConvertibleElement(s));if(!n)return!1;let i={anchor:No.start(e,n[1]),focus:r.focus},a=No.string(e,i),l=t[a];if(!l)return!1;Me(o);let m={anchor:No.start(e,n[1]),focus:r.focus};return ed.delete(e,{at:m}),l(),!0}}import{isHotkey as rd}from"is-hotkey";function xi(e){let t=e.replace(/\bsuper\b/g,Dt()?"cmd+alt":"ctrl+shift");return rd(t)}function H(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[xi(n),i]));for(let[n,i]of t)if(n(r.nativeEvent)){let a=i();if(a===!0||a===void 0)return r.preventDefault(),r.stopPropagation(),!0}return!1}}import{Editor as nd,Transforms as yi}from"slate";function ki(e,t){nd.withoutNormalizing(e,()=>{yi.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),yi.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as Ti}from"slate";function xe(e,t,o){let[,r]=t,n=Ti.previous(e,{at:r});if(n&&o(n,t))return!0;let i=Ti.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as vi,Transforms as wi}from"slate";function Q(e,t){wi.select(e,vi.start(e,t))}function Ii(e,t){wi.select(e,vi.end(e,t))}function Mi(e,t){return typeof t!="function"?t:t(e)}import{Editor as Ho,Element as id,Path as ad,Transforms as dt}from"slate";function Pi(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>id.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;Ho.withoutNormalizing(e,()=>{dt.insertNodes(e,t,{at:o}),n&&(dt.select(e,n),dt.move(e))})}else{let n=ad.next(r[1]);Ho.withoutNormalizing(e,()=>{dt.insertNodes(e,t,{at:n}),dt.select(e,Ho.start(e,n))})}return!0}import{Editor as Ci,Transforms as Si}from"slate";function ft(e,t,o){Ci.withoutNormalizing(e,()=>{let r=Ci.node(e,o),n=Mi(r[0],t);Si.wrapNodes(e,n,{at:o}),Si.unwrapNodes(e,{at:[...o,0]})})}import{Editor as ld,Transforms as sd}from"slate";function $t(e,t,o){let r=Array.from(ld.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;sd.setNodes(e,t(i),{at:n[1]})}return!0}function Ri(e,t){let o=t.clipboardData,{types:r}=o;if(r.length>1||r[0]!=="text/plain")return!1;let n=o.getData("text/plain");return md(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function md(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as cd,Node as pd,Transforms as Ao}from"slate";function Li(e,{href:t,title:o,text:r},{at:n}){let i=x(e,"anchor",{at:n});if(!i)return!1;let[a,l]=i;if(Ao.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let m=pd.string(a);r!==m&&cd.withoutNormalizing(e,()=>{let s=a.children.length;for(let c=s-1;c>=0;c--)Ao.removeNodes(e,{at:[...l,c]});Ao.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as Nt,Element as ud,Range as dd,Text as fd,Transforms as Oo}from"slate";function Bi(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:Nt.start(e,[0]),focus:Nt.start(e,[0])};if(dd.isCollapsed(i)){if(Oo.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=Nt.node(e,e.selection);Oo.select(e,a[1])}}else Oo.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>fd.isText(a)||ud.isElement(a)&&Nt.isInline(e,a)})}import{Transforms as hd}from"slate";function Di(e,{at:t}){let o=x(e,"anchor",{at:t});return o?(hd.unwrapNodes(e,{at:o[1]}),!0):!1}function zi(e){return{insertLink:f(Bi,e),removeLink:f(Di,e),editLink:f(Li,e)}}import{Element as $i,Transforms as gd}from"slate";function Ni(e,t){if(!$i.isElement(t[0])||t[0].type!=="anchor")return!1;let o=t[0].children;for(let r=0;r<o.length;r++){let n=o[r];if(!(!$i.isElement(n)||n.type!=="anchor"))return gd.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as pf}from"clsx";import{useEffect as uf,useRef as va}from"react";import{useSelected as df,useSlate as ff}from"slate-react";import{createContext as Ai,useState as Ed}from"react";import{createPortal as bd}from"react-dom";function Hi({children:e}){return typeof document>"u"||!document.body?null:bd(e,document.body)}import{jsx as Uo,jsxs as yd}from"react/jsx-runtime";var Fo=Ai({}),xd=Ai({});function Oi({children:e}){let[t,o]=Ed({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return yd(Fo.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Uo(Hi,{children:Uo(xd.Provider,{value:i,children:Uo(i.Component,{})})},i.type))]})}import{useContext as kd}from"react";function O(e){let{openLayer:t,closeLayer:o,layers:r}=kd(Fo);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import Ht from"@emotion/styled";var Ui=Ht("a")`
39
+ `;import{jsx as Ou}from"react/jsx-runtime";var ii=e=>/[^\x00-\x7F]/.test(e);function Nu(e,t){let[o]=t.getTargetRanges();if(o)try{let r=zu.toSlateRange(e,o,{exactMatch:!1,suppressThrow:!1});Du.select(e,r)}catch{}}function Hu(e,t,o){return r=>{let n=e?.(r);return n!=null||r.defaultPrevented||r.inputType!=="insertText"||r.isComposing||typeof r.data!="string"||r.data.length===0||!ii(r.data)?n:(Nu(t,r),r.preventDefault(),zo.insertText(t,r.data),o.current=r.data,!0)}}function Au(e,t,o){return r=>{let n=e?.(r);if(n!=null||r.defaultPrevented)return n;let i=r.nativeEvent;return!(i instanceof InputEvent)||i.inputType!=="insertText"||i.isComposing||typeof i.data!="string"||i.data.length===0||!ii(i.data)?n:o.current===i.data?(o.current=null,n):(zo.insertText(t,i.data),n)}}function ai(e){let t=$u(),o=Bu(null);Lu(()=>{zo.normalize(t,{force:!0})},[t]);let{plugins:r}=t.sink,n=ni(()=>({...e,decorate:jn(e.decorate,r),renderElement:ti(e.renderElement,r),renderLeaf:oi(e.renderLeaf,r),renderPlaceholder:ri(e.renderPlaceholder,r),onKeyDown:Yn(e.onKeyDown,r),onKeyUp:Jn(e.onKeyUp,r),onPaste:Zn(e.onPaste,r),onDrop:ei(e.onDrop,r),onDOMBeforeInput:Hu(e.onDOMBeforeInput,t,o),onInput:Au(e.onInput,t,o)}),[e.decorate,e.renderElement,e.renderLeaf,e.renderPlaceholder,e.onKeyDown,e.onKeyUp,e.onPaste,e.onDrop,e.onDOMBeforeInput,e.onInput,e.placeholder,e.className,t,r]),i=ni(()=>Xn(r),[r]);return Ou(i,{...n})}function Oe(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(a){for(let s of n){let c=s.editor?.[t],u=c?.(a);if(typeof u=="boolean")return u}return r(a)}}function se(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,s=[];for(let m of n){let c=m.editor?.[t]?.(...a);if(typeof c=="function")s.push(c);else if(c===!0){l=!0;break}}l||r(...a),s.forEach(m=>m())}}function li(e){return(t,o)=>{let r=t,n=e.map(i=>i(r,o,{createPolicy:a=>a}));return r.sink={plugins:n},r.isMaster="isMaster"in r?r.isMaster:()=>!1,r.isSlave="isSlave"in r?r.isSlave:()=>!1,r.isStandalone="isStandalone"in r?r.isStandalone:()=>!1,Object.assign(r,{normalizeNode:se(r,"normalizeNode",n),deleteBackward:se(r,"deleteBackward",n),deleteForward:se(r,"deleteForward",n),deleteFragment:se(r,"deleteFragment",n),insertBreak:se(r,"insertBreak",n),insertFragment:se(r,"insertFragment",n),insertNode:se(r,"insertNode",n),insertText:se(r,"insertText",n),isInline:Oe(r,"isInline",n),isVoid:Oe(r,"isVoid",n),isMaster:Oe(r,"isMaster",n),isSlave:Oe(r,"isSlave",n),isStandalone:Oe(r,"isStandalone",n)}),r}}var si=e=>{let t=e.map(n=>n.fn);return{withSink:li(t),SinkEditable:ai}};import{Element as Uu}from"slate";import{ReactEditor as Fu}from"slate-react";function mi(e,t){return Uu.isElement(t)?Fu.findPath(e,t):t}function f(e,t){return e.bind(null,t)}function q(e,t,o){return e.bind(null,t,o)}var Vu=/mac os x|macintosh/i,ut;function zt(){if(ut!==void 0)return ut;try{let{userAgent:e}=window.navigator;ut=Vu.test(e)}catch{ut=!1}return ut}function Me(e){e.preventDefault(),e.stopPropagation()}import{Editor as ui,Path as Ku}from"slate";import{Element as ci}from"slate";function pi(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>ci.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>ci.isElement(o)&&e.includes(o.type);let t=e;throw new Error(`Expected matchNode to be a function, string or array but is ${t}`)}function x(e,t,{at:o=e.selection}={}){if(o===null)return;let r=mi(e,o),n=pi(t);if(Ku.isPath(r)){let i=ui.node(e,r);if(i&&n(i[0]))return i}return ui.above(e,{at:r,match:n})}function Ue(...e){return x(...e)?.[1]}import{jsx as _u}from"react/jsx-runtime";var y=({strokeWidth:e=1.5,...t})=>_u("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",strokeWidth:e,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...t});import{Range as Wu}from"slate";function me(e){return e==null?!1:Wu.isCollapsed(e)}import{Element as di}from"slate";function $t(e){return Array.isArray(e)?t=>di.isElement(t)&&e.includes(t.type):t=>di.isElement(t)&&e==t.type}import{Editor as Gu}from"slate";function fi(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&Gu.isEnd(e,o.anchor,r[1])}import{Editor as U1}from"slate";import{Editor as qu}from"slate";function Pe(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&qu.isStart(e,o.anchor,r[1])}import{isHotkey as hi}from"is-hotkey";import{Editor as $o,Element as Qu,Range as ju,Transforms as Xu}from"slate";var Yu=hi(" "),Ju=hi("SHIFT+SPACE");function gi(e,t){return o=>{if(!Yu(o.nativeEvent)&&!Ju(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||ju.isExpanded(r))return!1;let n=x(e,m=>Qu.isElement(m)&&e.convertElement.isConvertibleElement(m));if(!n)return!1;let i={anchor:$o.start(e,n[1]),focus:r.focus},a=$o.string(e,i),l=t[a];if(!l)return!1;Me(o);let s={anchor:$o.start(e,n[1]),focus:r.focus};return Xu.delete(e,{at:s}),l(),!0}}import{isHotkey as Zu}from"is-hotkey";function bi(e){let t=e.replace(/\bsuper\b/g,zt()?"cmd+alt":"ctrl+shift");return Zu(t)}function H(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[bi(n),i]));for(let[n,i]of t)if(n(r.nativeEvent)){let a=i();if(a===!0||a===void 0)return r.preventDefault(),r.stopPropagation(),!0}return!1}}import{Editor as ed,Transforms as Ei}from"slate";function xi(e,t){ed.withoutNormalizing(e,()=>{Ei.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),Ei.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as yi}from"slate";function xe(e,t,o){let[,r]=t,n=yi.previous(e,{at:r});if(n&&o(n,t))return!0;let i=yi.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as ki,Transforms as vi}from"slate";function Q(e,t){vi.select(e,ki.start(e,t))}function Ti(e,t){vi.select(e,ki.end(e,t))}function wi(e,t){return typeof t!="function"?t:t(e)}import{Editor as No,Element as td,Path as od,Transforms as dt}from"slate";function Ii(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>td.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;No.withoutNormalizing(e,()=>{dt.insertNodes(e,t,{at:o}),n&&(dt.select(e,n),dt.move(e))})}else{let n=od.next(r[1]);No.withoutNormalizing(e,()=>{dt.insertNodes(e,t,{at:n}),dt.select(e,No.start(e,n))})}return!0}import{Editor as Mi,Transforms as Pi}from"slate";function ft(e,t,o){Mi.withoutNormalizing(e,()=>{let r=Mi.node(e,o),n=wi(r[0],t);Pi.wrapNodes(e,n,{at:o}),Pi.unwrapNodes(e,{at:[...o,0]})})}import{Editor as rd,Transforms as nd}from"slate";function Nt(e,t,o){let r=Array.from(rd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;nd.setNodes(e,t(i),{at:n[1]})}return!0}function Ci(e,t){let o=t.clipboardData,{types:r}=o;if(r.length>1||r[0]!=="text/plain")return!1;let n=o.getData("text/plain");return id(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function id(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as ad,Node as ld,Transforms as Ho}from"slate";function Si(e,{href:t,title:o,text:r},{at:n}){let i=x(e,"anchor",{at:n});if(!i)return!1;let[a,l]=i;if(Ho.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let s=ld.string(a);r!==s&&ad.withoutNormalizing(e,()=>{let m=a.children.length;for(let c=m-1;c>=0;c--)Ho.removeNodes(e,{at:[...l,c]});Ho.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as Ht,Element as sd,Range as md,Text as cd,Transforms as Ao}from"slate";function Ri(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:Ht.start(e,[0]),focus:Ht.start(e,[0])};if(md.isCollapsed(i)){if(Ao.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=Ht.node(e,e.selection);Ao.select(e,a[1])}}else Ao.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>cd.isText(a)||sd.isElement(a)&&Ht.isInline(e,a)})}import{Transforms as pd}from"slate";function Li(e,{at:t}){let o=x(e,"anchor",{at:t});return o?(pd.unwrapNodes(e,{at:o[1]}),!0):!1}function Bi(e){return{insertLink:f(Ri,e),removeLink:f(Li,e),editLink:f(Si,e)}}import{Element as Di,Transforms as ud}from"slate";function zi(e,t){if(!Di.isElement(t[0])||t[0].type!=="anchor")return!1;let o=t[0].children;for(let r=0;r<o.length;r++){let n=o[r];if(!(!Di.isElement(n)||n.type!=="anchor"))return ud.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as lf}from"clsx";import{useEffect as sf,useRef as ka}from"react";import{useSelected as mf,useSlate as cf}from"slate-react";import{createContext as Ni,useState as fd}from"react";import{createPortal as dd}from"react-dom";function $i({children:e}){return typeof document>"u"||!document.body?null:dd(e,document.body)}import{jsx as Oo,jsxs as gd}from"react/jsx-runtime";var Uo=Ni({}),hd=Ni({});function Hi({children:e}){let[t,o]=fd({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return gd(Uo.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Oo($i,{children:Oo(hd.Provider,{value:i,children:Oo(i.Component,{})})},i.type))]})}import{useContext as bd}from"react";function O(e){let{openLayer:t,closeLayer:o,layers:r}=bd(Uo);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import At from"@emotion/styled";var Ai=At("a")`
40
40
  /**
41
41
  * Link colors
42
42
  */
@@ -55,10 +55,10 @@
55
55
  &.--selected {
56
56
  background: var(--blue-50);
57
57
  }
58
- `,Vo=Ht("span")`
58
+ `,Fo=At("span")`
59
59
  display: inline;
60
60
  padding: 0 1px 0 0;
61
- `,Zv=Ht("span")`
61
+ `,WT=At("span")`
62
62
  position: fixed;
63
63
  width: 100px;
64
64
  background: var(--shade-50);
@@ -67,14 +67,14 @@
67
67
  border: 1px solid var(--shade-400);
68
68
  overflow: hidden;
69
69
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
70
- `,ew=Ht("span")`
70
+ `,GT=At("span")`
71
71
  position: absolute;
72
72
  left: 0;
73
73
  top: 0;
74
74
  height: 14px;
75
75
  background: var(--blue-400);
76
76
  transition: width 100ms linear;
77
- `;import nf from"@emotion/styled";import{useCallback as Gt,useRef as af,useState as lf}from"react";import{useSlateStatic as sf}from"slate-react";import{useRef as vd}from"react";import Td from"@emotion/styled";var Fi=Td("div")`
77
+ `;import ef from"@emotion/styled";import{useCallback as qt,useRef as tf,useState as of}from"react";import{useSlateStatic as rf}from"slate-react";import{useRef as xd}from"react";import Ed from"@emotion/styled";var Oi=Ed("div")`
78
78
  position: fixed;
79
79
  user-select: none;
80
80
  top: 0;
@@ -83,7 +83,7 @@
83
83
  bottom: 0;
84
84
  overflow-y: auto;
85
85
  background: rgba(0, 0, 0, 0.01);
86
- `;import{jsx as wd}from"react/jsx-runtime";function ye({close:e}){let t=vd(null);return wd(Fi,{ref:t,onClick:e})}var ae={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},Id={shift:ae.shift,opt:ae.opt,alt:ae.opt,ctrl:ae.ctrl,mod:ae.cmd,cmd:ae.cmd,enter:ae.enter,super:`${ae.opt}${ae.cmd}`},Md={alt:"ALT",ctrl:"CTRL",opt:"ALT",shift:"SHIFT",mod:"CTRL",cmd:"CTRL",enter:ae.enter,super:"CTRL+SHIFT"};function Vi(e,t){let o=e.findIndex(r=>r===t);o!==-1&&e.splice(o,1)}function Pd(e){let t=[];return Object.entries(Id).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Vi(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}function Cd(e){let t=[];return Object.entries(Md).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Vi(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("+")}function At(e){let t=e.toLowerCase().split("+");return Dt()?Pd(t):Cd(t)}import{useRef as Ud}from"react";import{useSlateStatic as Fd}from"slate-react";function Ko(e){let t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}}function Ki(e){let t=Ko(e),{scrollY:o}=window;return Object.assign(t,{top:t.top+o,bottom:t.bottom+o})}function _o(){let e=document.documentElement.clientWidth||document.body.clientWidth;return{top:0,right:e,bottom:window.innerHeight,left:0,width:e,height:window.innerHeight}}function _i(){let e=_o();return Object.assign(e,{top:window.scrollY,bottom:window.scrollY+e.height})}var Wi=Sd;function Sd(e,t){for(var o={},r=Object.keys(e),n=r.length,i=0;i<n;i++){var a=r[i];o[a]=t(e[a],a,e)}return o}function Wo(e,t){return Wi(e,r=>{let n=r instanceof HTMLElement?r:r.current;return n?t(n):null})}import{useEffect as Dd}from"react";import Rd from"lodash.throttle";import{useMemo as Ld,useState as Bd}from"react";function Ot(e=100){let[t,o]=Bd(0),r=Ld(()=>Rd(()=>{o(n=>n+1)},e,{trailing:!0}),[e]);return Object.assign(r,{counter:t})}function Go(){let e=Ot();return Dd(()=>(e(),window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}),[]),e}function X(e,t){let o=Go(),r=Wo(e,n=>Ki(n));return t(r,_i(),o)}function ke(e,t,o,{margin:r=0}={}){if(e==null)return{...o,left:-1024};let{top:n}=o,{left:i}=o,a=t.right-t.left-r*2;return e.width>=a?i=t.left+r:(i+e.width>t.right-r&&(i=t.right-e.width-r),i<t.left+r&&(i=t.left+r)),{left:i,top:n}}import qo from"@emotion/styled";import zd from"@emotion/styled";var Y=zd(pt)`
86
+ `;import{jsx as yd}from"react/jsx-runtime";function ye({close:e}){let t=xd(null);return yd(Oi,{ref:t,onClick:e})}var ae={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},kd={shift:ae.shift,opt:ae.opt,alt:ae.opt,ctrl:ae.ctrl,mod:ae.cmd,cmd:ae.cmd,enter:ae.enter,super:`${ae.opt}${ae.cmd}`},vd={alt:"ALT",ctrl:"CTRL",opt:"ALT",shift:"SHIFT",mod:"CTRL",cmd:"CTRL",enter:ae.enter,super:"CTRL+SHIFT"};function Ui(e,t){let o=e.findIndex(r=>r===t);o!==-1&&e.splice(o,1)}function Td(e){let t=[];return Object.entries(kd).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Ui(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}function wd(e){let t=[];return Object.entries(vd).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Ui(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("+")}function Ot(e){let t=e.toLowerCase().split("+");return zt()?Td(t):wd(t)}import{useRef as Nd}from"react";import{useSlateStatic as Hd}from"slate-react";function Vo(e){let t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}}function Fi(e){let t=Vo(e),{scrollY:o}=window;return Object.assign(t,{top:t.top+o,bottom:t.bottom+o})}function Ko(){let e=document.documentElement.clientWidth||document.body.clientWidth;return{top:0,right:e,bottom:window.innerHeight,left:0,width:e,height:window.innerHeight}}function Vi(){let e=Ko();return Object.assign(e,{top:window.scrollY,bottom:window.scrollY+e.height})}var Ki=Id;function Id(e,t){for(var o={},r=Object.keys(e),n=r.length,i=0;i<n;i++){var a=r[i];o[a]=t(e[a],a,e)}return o}function _o(e,t){return Ki(e,r=>{let n=r instanceof HTMLElement?r:r.current;return n?t(n):null})}import{useEffect as Sd}from"react";import Md from"lodash.throttle";import{useMemo as Pd,useState as Cd}from"react";function Ut(e=100){let[t,o]=Cd(0),r=Pd(()=>Md(()=>{o(n=>n+1)},e,{trailing:!0}),[e]);return Object.assign(r,{counter:t})}function Wo(){let e=Ut();return Sd(()=>(e(),window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}),[]),e}function X(e,t){let o=Wo(),r=_o(e,n=>Fi(n));return t(r,Vi(),o)}function ke(e,t,o,{margin:r=0}={}){if(e==null)return{...o,left:-1024};let{top:n}=o,{left:i}=o,a=t.right-t.left-r*2;return e.width>=a?i=t.left+r:(i+e.width>t.right-r&&(i=t.right-e.width-r),i<t.left+r&&(i=t.left+r)),{left:i,top:n}}import Go from"@emotion/styled";import Rd from"@emotion/styled";var Y=Rd(pt)`
87
87
  position: absolute;
88
88
  z-index: 1000;
89
89
  border: 1px solid var(--table-border-color);
@@ -112,14 +112,14 @@
112
112
  * even if we did, it looks better this way.
113
113
  */
114
114
  /* transition: left 100ms, top 100ms; */
115
- `;var Gi=qo(Y)`
115
+ `;var _i=Go(Y)`
116
116
  width: 24em;
117
117
  padding: 0;
118
118
  overflow: hidden;
119
- `,Ut=qo("div")`
119
+ `,Ft=Go("div")`
120
120
  display: flex;
121
121
  gap: 0.5em;
122
- `,Ft=qo("input")`
122
+ `,Vt=Go("input")`
123
123
  flex: 1 1 auto;
124
124
  padding: 0.5em 0.75em;
125
125
  border-radius: 0.25em;
@@ -130,7 +130,7 @@
130
130
  &:focus {
131
131
  outline: 2px solid var(--blue-200);
132
132
  }
133
- `;import Qi from"@emotion/styled";import $d from"@emotion/styled";var qi=$d(pt)`
133
+ `;import Gi from"@emotion/styled";import Ld from"@emotion/styled";var Wi=Ld(pt)`
134
134
  border: 1px solid var(--shade-300); /* shade-300 */
135
135
  border-radius: 0.5em;
136
136
  color: rgb(39 39 42); /* shade-800 */
@@ -146,11 +146,11 @@
146
146
  */
147
147
  outline: 2px solid var(--select-editor-color) !important;
148
148
  }
149
- `;var ji=Qi("div")`
149
+ `;var qi=Gi("div")`
150
150
  padding: 2em;
151
151
  flex: 1;
152
152
  min-height: 0;
153
- `,Xi=Qi(qi)`
153
+ `,Qi=Gi(Wi)`
154
154
  /**
155
155
  * We use this to make sure the top of the container is rounded even though
156
156
  * the toolbar inside is square. We keep the toolbar square so that as the
@@ -173,7 +173,7 @@
173
173
  flex-direction: column;
174
174
  flex: 1;
175
175
  min-height: 0;
176
- `;import Qo from"@emotion/styled";var Yi=Qo(Y)`
176
+ `;import qo from"@emotion/styled";var ji=qo(Y)`
177
177
  position: absolute;
178
178
  padding-top: 0.5em;
179
179
  padding-bottom: 0.5em;
@@ -183,7 +183,7 @@
183
183
  * Prevent clicks from stealing focus from the editor
184
184
  */
185
185
  user-select: none;
186
- `,Ji=Qo("div")`
186
+ `,Xi=qo("div")`
187
187
  display: flex;
188
188
  z-index: 10;
189
189
  padding: 0 1em 0 1.5em;
@@ -223,12 +223,12 @@
223
223
  &:hover {
224
224
  background: var(--blue-50);
225
225
  }
226
- `,Zi=Qo("div")`
226
+ `,Yi=qo("div")`
227
227
  height: 1px;
228
228
  background: var(--shade-200);
229
229
  margin-top: 0.25em;
230
230
  margin-bottom: 0.25em;
231
- `;import ht from"@emotion/styled";var ea=ht("div")`
231
+ `;import ht from"@emotion/styled";var Ji=ht("div")`
232
232
  /**
233
233
  * This flex rule applies to the "display: flex;" of the parent container.
234
234
  * Ensures the toolbar does not shrink or grow vertically.
@@ -267,22 +267,22 @@
267
267
  3em + 1px
268
268
  ); // $ToolbarDivider height + border-bottom of 1px above
269
269
  overflow: hidden;
270
- `,ta=ht("div")`
270
+ `,Zi=ht("div")`
271
271
  display: inline-block;
272
272
  height: calc(
273
273
  3em + 1px
274
274
  ); // $ToolbarDivider height + border-bottom of 1px above
275
- `,oa=ht("div")`
275
+ `,ea=ht("div")`
276
276
  display: inline-block;
277
277
  height: 3em;
278
278
  padding: 0 0.375em;
279
- `,ra=ht("div")`
279
+ `,ta=ht("div")`
280
280
  display: inline-block;
281
281
  background: var(--shade-300);
282
282
  opacity: 50%;
283
283
  width: 1px;
284
284
  height: 3em;
285
- `,na=ht("div")`
285
+ `,oa=ht("div")`
286
286
  box-sizing: border-box;
287
287
  position: relative;
288
288
  display: inline-block;
@@ -332,7 +332,7 @@
332
332
  margin-left: -0.25em;
333
333
  opacity: 0.375;
334
334
  }
335
- `;import{useCallback as Nd}from"react";import{ReactEditor as Hd}from"slate-react";import{Fragment as Od,jsx as Fe,jsxs as Ad}from"react/jsx-runtime";function ia({editor:e,item:t,close:o,dest:r}){let n=O("menu"),i=Nd(()=>{if(t.Component){let a=t.Component;n.open(()=>Fe(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),Hd.focus(e),o())},[e,t]);return Fe(Od,{children:Ad(Ji,{onClick:i,children:[Fe("div",{className:"--icon",children:Fe(t.icon,{})}),Fe("div",{className:"--title",children:t.title}),Fe("div",{className:"--hotkey",children:t.hotkey?At(t.hotkey):void 0})]})})}import{Fragment as Vd,jsx as Vt,jsxs as Kd}from"react/jsx-runtime";function Ve({dest:e,items:t,close:o}){let r=Fd(),n=Ud(null),i=X({src:n,dest:e},({dest:a})=>a?{left:a.left-8,top:a.top+a.height}:{left:0,top:0});return Kd(Vd,{children:[Vt(ye,{close:o}),Vt(Yi,{ref:n,style:i,children:t.map((a,l)=>a==="divider"?Vt(Zi,{},l):a.show&&!a.show(r)?null:Vt(ia,{editor:r,item:a,close:o,dest:e},l))})]})}import{useCallback as ma}from"react";import aa from"@emotion/styled";import{jsx as Gd,jsxs as qd}from"react/jsx-runtime";function jo(e){return e.getBoundingClientRect()}var _d=aa("div")`
335
+ `;import{useCallback as Bd}from"react";import{ReactEditor as Dd}from"slate-react";import{Fragment as $d,jsx as Fe,jsxs as zd}from"react/jsx-runtime";function ra({editor:e,item:t,close:o,dest:r}){let n=O("menu"),i=Bd(()=>{if(t.Component){let a=t.Component;n.open(()=>Fe(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),Dd.focus(e),o())},[e,t]);return Fe($d,{children:zd(Xi,{onClick:i,children:[Fe("div",{className:"--icon",children:Fe(t.icon,{})}),Fe("div",{className:"--title",children:t.title}),Fe("div",{className:"--hotkey",children:t.hotkey?Ot(t.hotkey):void 0})]})})}import{Fragment as Ad,jsx as Kt,jsxs as Od}from"react/jsx-runtime";function Ve({dest:e,items:t,close:o}){let r=Hd(),n=Nd(null),i=X({src:n,dest:e},({dest:a})=>a?{left:a.left-8,top:a.top+a.height}:{left:0,top:0});return Od(Ad,{children:[Kt(ye,{close:o}),Kt(ji,{ref:n,style:i,children:t.map((a,l)=>a==="divider"?Kt(Yi,{},l):a.show&&!a.show(r)?null:Kt(ra,{editor:r,item:a,close:o,dest:e},l))})]})}import{useCallback as la}from"react";import na from"@emotion/styled";import{jsx as Vd,jsxs as Kd}from"react/jsx-runtime";function Qo(e){return e.getBoundingClientRect()}var Ud=na("div")`
336
336
  position: fixed;
337
337
  z-index: 10;
338
338
  -webkit-font-smoothing: antialiased;
@@ -348,12 +348,12 @@
348
348
  background: var(--shade-700);
349
349
  border-radius: 0.25em;
350
350
  white-space: nowrap;
351
- `,Wd=aa("span")`
351
+ `,Fd=na("span")`
352
352
  margin-left: 0.75em;
353
353
  font-size: 0.875em;
354
354
  font-weight: 500;
355
355
  color: var(--shade-400);
356
- `;function la({title:e,hotkey:t,dest:o}){let r=jo(o);return qd(_d,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?Gd(Wd,{children:t}):null]})}import Qd from"@emotion/styled";import{jsx as Xd}from"react/jsx-runtime";var jd=Qd("span")`
356
+ `;function ia({title:e,hotkey:t,dest:o}){let r=Qo(o);return Kd(Ud,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?Vd(Fd,{children:t}):null]})}import _d from"@emotion/styled";import{jsx as Gd}from"react/jsx-runtime";var Wd=_d("span")`
357
357
  position: fixed;
358
358
  z-index: 10;
359
359
  width: 0;
@@ -361,7 +361,7 @@
361
361
  border-left: 0.375em solid transparent;
362
362
  border-right: 0.375em solid transparent;
363
363
  border-top: 0.375em solid var(--shade-700);
364
- `;function sa({dest:e}){let t=jo(e);return Xd(jd,{style:{left:`calc(${t.left+t.width/2}px - 0.375em)`,top:`calc(${t.top}px - 0.5em)`}})}import{jsx as ca}from"react/jsx-runtime";function J({title:e,hotkey:t},o=[]){let r=O("tooltip-label"),n=O("tooltip-triangle"),i=ma(l=>{let m=l.currentTarget;e!==void 0&&(r.open(()=>ca(la,{title:e,hotkey:typeof t=="function"?t():t,dest:m})),n.open(()=>ca(sa,{dest:m})))},[e,t,r,n,...o]),a=ma(()=>{r.close(),n.close()},[r,n,...o]);return{onMouseEnter:i,onMouseLeave:a}}import ef from"@emotion/styled";import{useCallback as _e,useRef as ba,useState as _t}from"react";import{Node as tf}from"slate";import{useSlateStatic as of}from"slate-react";import Te from"@emotion/styled";var Ke=Te("div")`
364
+ `;function aa({dest:e}){let t=Qo(e);return Gd(Wd,{style:{left:`calc(${t.left+t.width/2}px - 0.375em)`,top:`calc(${t.top}px - 0.5em)`}})}import{jsx as sa}from"react/jsx-runtime";function J({title:e,hotkey:t},o=[]){let r=O("tooltip-label"),n=O("tooltip-triangle"),i=la(l=>{let s=l.currentTarget;e!==void 0&&(r.open(()=>sa(ia,{title:e,hotkey:typeof t=="function"?t():t,dest:s})),n.open(()=>sa(aa,{dest:s})))},[e,t,r,n,...o]),a=la(()=>{r.close(),n.close()},[r,n,...o]);return{onMouseEnter:i,onMouseLeave:a}}import Xd from"@emotion/styled";import{useCallback as _e,useRef as ha,useState as Wt}from"react";import{Node as Yd}from"slate";import{useSlateStatic as Jd}from"slate-react";import ve from"@emotion/styled";var Ke=ve("div")`
365
365
  margin: 0.5em 0;
366
366
  &:first-of-type {
367
367
  margin-top: 0;
@@ -369,15 +369,15 @@
369
369
  &:last-of-type {
370
370
  margin-bottom: 0;
371
371
  }
372
- `,Kt=Te("div")`
372
+ `,_t=ve("div")`
373
373
  font-size: 0.9375em;
374
374
  margin-bottom: 0.25em;
375
375
  color: var(--shade-700);
376
- `,Xo=Te("div")`
376
+ `,jo=ve("div")`
377
377
  font-size: 0.875em;
378
378
  margin-top: 0.25em;
379
379
  color: var(--shade-500);
380
- `,pa=Te("input")`
380
+ `,ma=ve("input")`
381
381
  box-sizing: border-box;
382
382
  width: 100%;
383
383
  height: 6em;
@@ -391,7 +391,7 @@
391
391
  &:focus {
392
392
  outline: 2px solid var(--blue-200);
393
393
  }
394
- `,Yo=Te("input")`
394
+ `,Xo=ve("input")`
395
395
  box-sizing: border-box;
396
396
  width: 100%;
397
397
  padding: 0.5em 0.75em;
@@ -403,7 +403,7 @@
403
403
  &:focus {
404
404
  outline: 2px solid var(--blue-200);
405
405
  }
406
- `,ua=Te("div")`
406
+ `,ca=ve("div")`
407
407
  /* Center vertically and horizontally */
408
408
  display: flex;
409
409
  align-items: center;
@@ -417,7 +417,7 @@
417
417
  font-size: 1.25em;
418
418
  stroke-width: 2px;
419
419
  }
420
- `,da=Te(ua)`
420
+ `,pa=ve(ca)`
421
421
  color: var(--blue-50);
422
422
  background: var(--blue-500);
423
423
  outline: 0px solid white;
@@ -429,7 +429,7 @@
429
429
  svg {
430
430
  color: var(--blue-200);
431
431
  }
432
- `,fa=Te(ua)`
432
+ `,ua=ve(ca)`
433
433
  color: var(--shade-500);
434
434
  background: var(--shade-200);
435
435
  outline: 0px solid white;
@@ -441,7 +441,7 @@
441
441
  svg {
442
442
  color: var(--shade-400);
443
443
  }
444
- `;import{useRef as Yd,useCallback as Ce}from"react";import ga from"@emotion/styled";import{jsx as ha}from"react/jsx-runtime";var Jd=ga.div`
444
+ `;import{useRef as qd,useCallback as Ce}from"react";import fa from"@emotion/styled";import{jsx as da}from"react/jsx-runtime";var Qd=fa.div`
445
445
  display: flex;
446
446
  align-items: center;
447
447
  justify-content: center;
@@ -456,17 +456,17 @@
456
456
  &:active {
457
457
  cursor: grabbing;
458
458
  }
459
- `,Zd=ga.div`
459
+ `,jd=fa.div`
460
460
  width: 32px;
461
461
  height: 4px;
462
462
  background: #ccc;
463
463
  border-radius: 2px;
464
- `;function ve({onDrag:e}){let t=Yd(null),o=Ce((s,c)=>{t.current={x:s,y:c}},[]),r=Ce((s,c)=>{if(!t.current)return;let u=s-t.current.x,p=c-t.current.y;t.current={x:s,y:c},e(u,p)},[e]),n=Ce(()=>{t.current=null},[]),i=Ce(s=>{s.preventDefault(),o(s.clientX,s.clientY);let c=p=>{r(p.clientX,p.clientY)},u=()=>{n(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",u)},[o,r,n]),a=Ce(s=>{if(s.touches.length!==1)return;let c=s.touches[0];o(c.clientX,c.clientY)},[o]),l=Ce(s=>{if(s.touches.length!==1)return;let c=s.touches[0];r(c.clientX,c.clientY)},[r]),m=Ce(()=>{n()},[n]);return ha(Jd,{onMouseDown:i,onTouchStart:a,onTouchMove:l,onTouchEnd:m,children:ha(Zd,{})})}import{jsx as _,jsxs as gt}from"react/jsx-runtime";var rf=ef(Y)`
464
+ `;function Te({onDrag:e}){let t=qd(null),o=Ce((m,c)=>{t.current={x:m,y:c}},[]),r=Ce((m,c)=>{if(!t.current)return;let u=m-t.current.x,p=c-t.current.y;t.current={x:m,y:c},e(u,p)},[e]),n=Ce(()=>{t.current=null},[]),i=Ce(m=>{m.preventDefault(),o(m.clientX,m.clientY);let c=p=>{r(p.clientX,p.clientY)},u=()=>{n(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",u)},[o,r,n]),a=Ce(m=>{if(m.touches.length!==1)return;let c=m.touches[0];o(c.clientX,c.clientY)},[o]),l=Ce(m=>{if(m.touches.length!==1)return;let c=m.touches[0];r(c.clientX,c.clientY)},[r]),s=Ce(()=>{n()},[n]);return da(Qd,{onMouseDown:i,onTouchStart:a,onTouchMove:l,onTouchEnd:s,children:da(jd,{})})}import{jsx as _,jsxs as gt}from"react/jsx-runtime";var Zd=Xd(Y)`
465
465
  position: absolute;
466
466
  width: 20em;
467
467
  padding: 0;
468
468
  overflow: hidden;
469
- `;function Ea({destAnchor:e,destStartEdge:t,element:o}){let r=O("dialog"),n=ba(null),[i,a]=_t({x:0,y:0}),l=_e((E,k)=>{a(P=>({x:P.x+E,y:P.y+k}))},[]),m=X({src:n,destAnchor:e,destStartEdge:t},({src:E,destAnchor:k,destStartEdge:P},C)=>ke(E,C,{left:P.left,top:k.top+k.height},{margin:16})),s={...m,left:m.left+i.x,top:m.top+i.y},c=of(),[u,p]=_t(o.href),[d,g]=_t(tf.string(o)),[v,S]=_t(o.title||""),L=ba({href:u,text:d,title:v});L.current={href:u,text:d,title:v};let M=_e(E=>{p(E.target.value)},[]),$=_e(E=>{g(E.target.value)},[]),w=_e(E=>{S(E.target.value)},[]),B=_e(()=>{r.open(()=>_(Wt,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]),I=_e(()=>{let{href:E,text:k,title:P}=L.current;c.anchor.editLink({href:E,text:k,title:P},{at:o}),B()},[B]);return gt(rf,{ref:n,contentEditable:!1,style:s,children:[_(ve,{onDrag:l}),gt("div",{style:{padding:"1em"},children:[gt(Ke,{children:[_(Kt,{children:h("linkUrl")}),_(pa,{as:"textarea",value:u,onChange:M})]}),gt(Ke,{children:[_(Kt,{children:h("linkText")}),_(Yo,{type:"text",value:d,onChange:$}),_(Xo,{children:h("linkTextHint")})]}),gt(Ke,{children:[_(Kt,{children:h("tooltipText")}),_(Yo,{type:"text",value:v,onChange:w}),_(Xo,{children:h("tooltipHint")})]}),_(Ke,{children:_(da,{onClick:I,children:h("apply")})}),_(Ke,{children:_(fa,{onClick:B,children:h("cancel")})})]})]})}import{jsx as we}from"react/jsx-runtime";var xa=e=>we(y,{...e,children:we("path",{d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6M11 13l9-9M15 4h5v5"})}),ya=e=>we(y,{...e,children:we("path",{d:"m9 15 3-3m2-2 1-1M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13M3 3l18 18M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0 4.972 4.972 0 0 1 0-7.071L6 11"})}),ka=e=>we(y,{...e,children:we("path",{d:"M4 20h4L18.5 9.5a1.5 1.5 0 0 0-4-4L4 16v4M13.5 6.5l4 4"})}),Ta=e=>we(y,{...e,children:we("path",{d:"M18 6L6 18M6 6l12 12"})});import{jsx as Z,jsxs as bt}from"react/jsx-runtime";var mf=nf(Y)`
469
+ `;function ga({destAnchor:e,destStartEdge:t,element:o}){let r=O("dialog"),n=ha(null),[i,a]=Wt({x:0,y:0}),l=_e((E,k)=>{a(P=>({x:P.x+E,y:P.y+k}))},[]),s=X({src:n,destAnchor:e,destStartEdge:t},({src:E,destAnchor:k,destStartEdge:P},C)=>ke(E,C,{left:P.left,top:k.top+k.height},{margin:16})),m={...s,left:s.left+i.x,top:s.top+i.y},c=Jd(),[u,p]=Wt(o.href),[d,g]=Wt(Yd.string(o)),[T,S]=Wt(o.title||""),L=ha({href:u,text:d,title:T});L.current={href:u,text:d,title:T};let M=_e(E=>{p(E.target.value)},[]),$=_e(E=>{g(E.target.value)},[]),w=_e(E=>{S(E.target.value)},[]),B=_e(()=>{r.open(()=>_(Gt,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]),I=_e(()=>{let{href:E,text:k,title:P}=L.current;c.anchor.editLink({href:E,text:k,title:P},{at:o}),B()},[B]);return gt(Zd,{ref:n,contentEditable:!1,style:m,children:[_(Te,{onDrag:l}),gt("div",{style:{padding:"1em"},children:[gt(Ke,{children:[_(_t,{children:h("linkUrl")}),_(ma,{as:"textarea",value:u,onChange:M})]}),gt(Ke,{children:[_(_t,{children:h("linkText")}),_(Xo,{type:"text",value:d,onChange:$}),_(jo,{children:h("linkTextHint")})]}),gt(Ke,{children:[_(_t,{children:h("tooltipText")}),_(Xo,{type:"text",value:T,onChange:w}),_(jo,{children:h("tooltipHint")})]}),_(Ke,{children:_(pa,{onClick:I,children:h("apply")})}),_(Ke,{children:_(ua,{onClick:B,children:h("cancel")})})]})]})}import{jsx as we}from"react/jsx-runtime";var ba=e=>we(y,{...e,children:we("path",{d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6M11 13l9-9M15 4h5v5"})}),Ea=e=>we(y,{...e,children:we("path",{d:"m9 15 3-3m2-2 1-1M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13M3 3l18 18M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0 4.972 4.972 0 0 1 0-7.071L6 11"})}),xa=e=>we(y,{...e,children:we("path",{d:"M4 20h4L18.5 9.5a1.5 1.5 0 0 0-4-4L4 16v4M13.5 6.5l4 4"})}),ya=e=>we(y,{...e,children:we("path",{d:"M18 6L6 18M6 6l12 12"})});import{jsx as Z,jsxs as bt}from"react/jsx-runtime";var nf=ef(Y)`
470
470
  position: absolute;
471
471
  width: 20em;
472
472
  z-index: 1000;
@@ -551,10 +551,10 @@
551
551
  height: 1.25em;
552
552
  stroke-width: 1.5;
553
553
  }
554
- `;function cf(e){try{let t=new URL(e);return{hostname:t.hostname,pathname:t.pathname}}catch{return{hostname:"",pathname:""}}}function Wt({destAnchor:e,destStartEdge:t,element:o}){let r=O("dialog"),n=sf(),i=af(null),a=cf(o.href),[l,m]=lf({x:0,y:0}),s=Gt((M,$)=>{m(w=>({x:w.x+M,y:w.y+$}))},[]),c=X({src:i,destAnchor:e,destStartEdge:t},({src:M,destAnchor:$,destStartEdge:w},B)=>ke(M,B,{left:w.left,top:$.top+$.height},{margin:16})),u={...c,left:c.left+l.x,top:c.top+l.y},p=J({title:"\u30EA\u30F3\u30AF\u3092\u524A\u9664"}),d=J({title:"\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6"}),g=J({title:"\u9589\u3058\u308B"}),v=Gt(()=>{r.close()},[r]),S=Gt(()=>{n.anchor.removeLink({at:o}),r.close()},[n,r]),L=Gt(()=>{d.onMouseLeave(),r.open(()=>Z(Ea,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]);return bt(mf,{ref:i,contentEditable:!1,style:u,children:[Z(ve,{onDrag:s}),bt("div",{style:{display:"flex",padding:"1em"},children:[bt("a",{className:"--link",href:o.href,target:"_blank",rel:"noreferrer",children:[Z(xa,{}),bt("div",{className:"--url",children:[Z("div",{className:"--hostname",children:a.hostname}),a.pathname===""||a.pathname==="/"?null:Z("div",{className:"--pathname",children:a.pathname}),o.title==null||o.title===""?null:Z("div",{className:"--tooltip",children:o.title})]})]}),bt("span",{className:"--icons",children:[Z("span",{className:"--icon",onClick:S,onMouseEnter:p.onMouseEnter,onMouseLeave:p.onMouseLeave,children:Z(ya,{})}),Z("span",{className:"--icon",onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,onClick:L,children:Z(ka,{})}),Z("span",{className:"--icon",onClick:v,onMouseEnter:g.onMouseEnter,onMouseLeave:g.onMouseLeave,children:Z(Ta,{})})]})]})]})}import{jsx as qt,jsxs as hf}from"react/jsx-runtime";function wa({element:e,attributes:t,children:o}){let r=va(null),n=va(null),i=df(),a=ff(),l=O("dialog");return uf(()=>{let m=n.current,s=r.current;if(!m||!s)return;let c=a.selection&&a.selection.anchor.offset!==a.selection.focus.offset;i&&!c?setTimeout(()=>{l.open(()=>qt(Wt,{destAnchor:m,destStartEdge:s,element:e}))}):l.close()},[i,e]),hf(Ui,{className:pf({"--selected":i}),href:e.href,target:e.target,...t,ref:n,children:[qt(Vo,{ref:r,contentEditable:!1}),qt("span",{children:o}),qt(Vo,{contentEditable:!1})]})}import{jsx as gf}from"react/jsx-runtime";var Ia=T((e,t,{createPolicy:o})=>(e.anchor=zi(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:f(Ni,e)},editableProps:{onPaste:f(Ri,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return gf(wa,{element:r,attributes:n,children:i})}}})));import{Editor as Qt,Transforms as Ca}from"slate";import{Element as Ma,Path as Pa}from"slate";function Jo(e,t,o){if(!t||!o||Pa.equals(t[1],o[1]))return!0;let r=x(e,i=>Ma.isElement(i)&&e.isMaster(i),{at:t[1]}),n=x(e,i=>Ma.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&Pa.equals(r[1],n[1]))}var Sa=T(e=>(e.atomicDelete=!0,{name:"atomic-delete",editor:{deleteBackward(){if(e.selection==null)return!1;let t=Qt.node(e,e.selection),o=Qt.previous(e,{mode:"lowest"});return Jo(e,t,o)?!1:(Ca.move(e,{unit:"character",reverse:!0}),!0)},deleteForward(){if(e.selection==null)return!1;let t=Qt.node(e,e.selection),o=Qt.next(e,{mode:"lowest"});return Jo(e,t,o)?!1:(Ca.move(e,{unit:"character"}),!0)}}}));import{Transforms as ih}from"slate";import{ReactEditor as ah}from"slate-react";import{Editor as bf,Transforms as Ra}from"slate";import{ReactEditor as Ef}from"slate-react";function xf(e){}function yf(e,t,o,r){let{selection:n}=e;if(Ra.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=bf.end(e,[]);Ra.select(e,i),Ef.focus(e)}}function La(e){return{noop:f(xf,e),insertImageFromUrl:f(yf,e)}}function Ba(e,t){return!1}import{useSlateStatic as eh}from"slate-react";import kf from"@emotion/styled";var Da=kf("div")`
554
+ `;function af(e){try{let t=new URL(e);return{hostname:t.hostname,pathname:t.pathname}}catch{return{hostname:"",pathname:""}}}function Gt({destAnchor:e,destStartEdge:t,element:o}){let r=O("dialog"),n=rf(),i=tf(null),a=af(o.href),[l,s]=of({x:0,y:0}),m=qt((M,$)=>{s(w=>({x:w.x+M,y:w.y+$}))},[]),c=X({src:i,destAnchor:e,destStartEdge:t},({src:M,destAnchor:$,destStartEdge:w},B)=>ke(M,B,{left:w.left,top:$.top+$.height},{margin:16})),u={...c,left:c.left+l.x,top:c.top+l.y},p=J({title:"\u30EA\u30F3\u30AF\u3092\u524A\u9664"}),d=J({title:"\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6"}),g=J({title:"\u9589\u3058\u308B"}),T=qt(()=>{r.close()},[r]),S=qt(()=>{n.anchor.removeLink({at:o}),r.close()},[n,r]),L=qt(()=>{d.onMouseLeave(),r.open(()=>Z(ga,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]);return bt(nf,{ref:i,contentEditable:!1,style:u,children:[Z(Te,{onDrag:m}),bt("div",{style:{display:"flex",padding:"1em"},children:[bt("a",{className:"--link",href:o.href,target:"_blank",rel:"noreferrer",children:[Z(ba,{}),bt("div",{className:"--url",children:[Z("div",{className:"--hostname",children:a.hostname}),a.pathname===""||a.pathname==="/"?null:Z("div",{className:"--pathname",children:a.pathname}),o.title==null||o.title===""?null:Z("div",{className:"--tooltip",children:o.title})]})]}),bt("span",{className:"--icons",children:[Z("span",{className:"--icon",onClick:S,onMouseEnter:p.onMouseEnter,onMouseLeave:p.onMouseLeave,children:Z(Ea,{})}),Z("span",{className:"--icon",onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,onClick:L,children:Z(xa,{})}),Z("span",{className:"--icon",onClick:T,onMouseEnter:g.onMouseEnter,onMouseLeave:g.onMouseLeave,children:Z(ya,{})})]})]})]})}import{jsx as Qt,jsxs as pf}from"react/jsx-runtime";function va({element:e,attributes:t,children:o}){let r=ka(null),n=ka(null),i=mf(),a=cf(),l=O("dialog");return sf(()=>{let s=n.current,m=r.current;if(!s||!m)return;let c=a.selection&&a.selection.anchor.offset!==a.selection.focus.offset;i&&!c?setTimeout(()=>{l.open(()=>Qt(Gt,{destAnchor:s,destStartEdge:m,element:e}))}):l.close()},[i,e]),pf(Ai,{className:lf({"--selected":i}),href:e.href,target:e.target,...t,ref:n,children:[Qt(Fo,{ref:r,contentEditable:!1}),Qt("span",{children:o}),Qt(Fo,{contentEditable:!1})]})}import{jsx as uf}from"react/jsx-runtime";var Ta=v((e,t,{createPolicy:o})=>(e.anchor=Bi(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:f(zi,e)},editableProps:{onPaste:f(Ci,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return uf(va,{element:r,attributes:n,children:i})}}})));import{Editor as jt,Transforms as Ma}from"slate";import{Element as wa,Path as Ia}from"slate";function Yo(e,t,o){if(!t||!o||Ia.equals(t[1],o[1]))return!0;let r=x(e,i=>wa.isElement(i)&&e.isMaster(i),{at:t[1]}),n=x(e,i=>wa.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&Ia.equals(r[1],n[1]))}var Pa=v(e=>(e.atomicDelete=!0,{name:"atomic-delete",editor:{deleteBackward(){if(e.selection==null)return!1;let t=jt.node(e,e.selection),o=jt.previous(e,{mode:"lowest"});return Yo(e,t,o)?!1:(Ma.move(e,{unit:"character",reverse:!0}),!0)},deleteForward(){if(e.selection==null)return!1;let t=jt.node(e,e.selection),o=jt.next(e,{mode:"lowest"});return Yo(e,t,o)?!1:(Ma.move(e,{unit:"character"}),!0)}}}));import{Transforms as th}from"slate";import{ReactEditor as oh}from"slate-react";import{Editor as df,Transforms as Ca}from"slate";import{ReactEditor as ff}from"slate-react";function hf(e){}function gf(e,t,o,r){let{selection:n}=e;if(Ca.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=df.end(e,[]);Ca.select(e,i),ff.focus(e)}}function Sa(e){return{noop:f(hf,e),insertImageFromUrl:f(gf,e)}}function Ra(e,t){return!1}import{useSlateStatic as Xf}from"slate-react";import bf from"@emotion/styled";var La=bf("div")`
555
555
  display: block;
556
556
  margin: 1em 0;
557
- `;import{clsx as Yf}from"clsx";import{useState as fl}from"react";import{useSelected as Jf}from"slate-react";import za from"@emotion/styled";var $a=za("span")`
557
+ `;import{clsx as qf}from"clsx";import{useState as ul}from"react";import{useSelected as Qf}from"slate-react";import Ba from"@emotion/styled";var Da=Ba("span")`
558
558
  /**
559
559
  * In order for this container to wrap tightly (without space), it needs to be
560
560
  * an "inline-block". If it's just an "inline" we end up with spacing
@@ -566,7 +566,7 @@
566
566
  * so that we can place UI controls for the image in and around the image.
567
567
  */
568
568
  position: relative;
569
- `,Na=za("img")`
569
+ `,za=Ba("img")`
570
570
  /**
571
571
  * TODO:
572
572
  *
@@ -629,7 +629,7 @@
629
629
  .--dragging > & {
630
630
  transition: border-radius 250ms;
631
631
  }
632
- `;import{clsx as Mf}from"clsx";import{useCallback as Va,useEffect as Pf,useRef as Xt}from"react";import{Transforms as Ka}from"slate";import{ReactEditor as er,useSlateStatic as Cf}from"slate-react";import{useEffect as Tf}from"react";function Ha(){let e=Ot();return Tf(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import Aa from"@emotion/styled";var Oa=Aa("span")`
632
+ `;import{clsx as vf}from"clsx";import{useCallback as Ua,useEffect as Tf,useRef as Yt}from"react";import{Transforms as Fa}from"slate";import{ReactEditor as Zo,useSlateStatic as wf}from"slate-react";import{useEffect as Ef}from"react";function $a(){let e=Ut();return Ef(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import Na from"@emotion/styled";var Ha=Na("span")`
633
633
  position: absolute;
634
634
  display: block;
635
635
  /**
@@ -656,7 +656,7 @@
656
656
  /* background: green; */
657
657
  width: 1.25em;
658
658
  }
659
- `,Ua=Aa("span")`
659
+ `,Aa=Na("span")`
660
660
  position: absolute;
661
661
  display: block;
662
662
  background: var(--select-color);
@@ -749,7 +749,7 @@
749
749
  .--small > & > .--bar-right {
750
750
  left: calc(50% + 1px);
751
751
  }
752
- `;function Zo({value:e,min:t,max:o}){if(!(o>=t))throw new Error("Expected max >= min but is not");return Math.max(t,Math.min(o,e))}import{ReactEditor as vf}from"slate-react";function jt(e,t){e=Math.round(e);let o=t.width/t.height;return{width:e,height:Math.round(e/o)}}function wf(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function If(e,t){let o=e.width/e.height,r=t.width/t.height;if(o>=r){if(e.width>t.width)return jt(t.width,e)}else if(e.height>t.height)return wf(t.height,e);return e}function Se(e,t,o){switch(o.type){case"bounds":return If(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function Fa(e){let t=vf.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft,10)+parseInt(o.paddingRight,10);return t.clientWidth-r}import{Fragment as Lf,jsx as Et,jsxs as Rf}from"react/jsx-runtime";function Sf(e,t){let r=er.toDOMNode(e,t).querySelector("img");if(!r)throw new Error("Image Element could not be found but should exist");return r.getBoundingClientRect()}function _a({element:e,srcSize:t,size:o,setSize:r,isDragging:n,setIsDragging:i}){let a=Cf(),l=Xt(null),m=Xt(null),s=Xt(null),c=Xt(null);Ha();let u=Fa(a),p=o.width,d=Math.min(t.width,u),g=Math.min(12,t.width),v=Va(M=>{Me(M),i(!0);let $=M.clientX,B=Sf(a,e).width,I={...o},E=P=>{let C=Zo({value:B+P.clientX-$,min:g,max:d});I=jt(C,t),r(I)},k=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",k),l.current=null,m.current=null;let P=er.findPath(a,e),C={width:I.width,height:I.height};r(C),Ka.setNodes(a,C,{at:P}),i(!1)};l.current=E,m.current=k,document.addEventListener("mousemove",E),document.addEventListener("mouseup",k)},[t.width,t.height,o.width,e]),S=Va(M=>{Me(M),i(!0);let $=M.changedTouches[0].clientX,w=o.width,B={...o},I=k=>{let P=k.changedTouches[0],C=Zo({value:w+P.clientX-$,min:g,max:d});B=jt(C,t),r(B)},E=()=>{document.removeEventListener("touchmove",I),document.removeEventListener("touchend",E),s.current=null,c.current=null;let k=er.findPath(a,e);Ka.setNodes(a,{width:B.width,height:B.height},{at:k}),i(!1)};s.current=I,c.current=E,document.addEventListener("touchmove",I),document.addEventListener("touchend",E)},[t.width,t.height,o.width,e]);Pf(()=>()=>{l.current&&document.removeEventListener("mousemove",l.current),m.current&&document.removeEventListener("mouseup",m.current),s.current&&document.removeEventListener("touchmove",s.current),c.current&&document.removeEventListener("touchend",c.current)},[]);let L=Mf({"--center":p<d&&p>g,"--left":p>=d&&p>g,"--right":p<=g&&p<d,"--dragging":n,"--small":p<=64||o.height<=64});return Et(Lf,{children:Et(Oa,{className:L,onMouseDown:v,onTouchStart:S,children:Rf(Ua,{children:[Et("span",{className:"--bar --bar-left"}),Et("span",{className:"--bar --bar-center"}),Et("span",{className:"--bar --bar-right"})]})})})}import Bf from"@emotion/styled";var Wa=Bf("span")`
752
+ `;function Jo({value:e,min:t,max:o}){if(!(o>=t))throw new Error("Expected max >= min but is not");return Math.max(t,Math.min(o,e))}import{ReactEditor as xf}from"slate-react";function Xt(e,t){e=Math.round(e);let o=t.width/t.height;return{width:e,height:Math.round(e/o)}}function yf(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function kf(e,t){let o=e.width/e.height,r=t.width/t.height;if(o>=r){if(e.width>t.width)return Xt(t.width,e)}else if(e.height>t.height)return yf(t.height,e);return e}function Se(e,t,o){switch(o.type){case"bounds":return kf(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function Oa(e){let t=xf.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft,10)+parseInt(o.paddingRight,10);return t.clientWidth-r}import{Fragment as Pf,jsx as Et,jsxs as Mf}from"react/jsx-runtime";function If(e,t){let r=Zo.toDOMNode(e,t).querySelector("img");if(!r)throw new Error("Image Element could not be found but should exist");return r.getBoundingClientRect()}function Va({element:e,srcSize:t,size:o,setSize:r,isDragging:n,setIsDragging:i}){let a=wf(),l=Yt(null),s=Yt(null),m=Yt(null),c=Yt(null);$a();let u=Oa(a),p=o.width,d=Math.min(t.width,u),g=Math.min(12,t.width),T=Ua(M=>{Me(M),i(!0);let $=M.clientX,B=If(a,e).width,I={...o},E=P=>{let C=Jo({value:B+P.clientX-$,min:g,max:d});I=Xt(C,t),r(I)},k=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",k),l.current=null,s.current=null;let P=Zo.findPath(a,e),C={width:I.width,height:I.height};r(C),Fa.setNodes(a,C,{at:P}),i(!1)};l.current=E,s.current=k,document.addEventListener("mousemove",E),document.addEventListener("mouseup",k)},[t.width,t.height,o.width,e]),S=Ua(M=>{Me(M),i(!0);let $=M.changedTouches[0].clientX,w=o.width,B={...o},I=k=>{let P=k.changedTouches[0],C=Jo({value:w+P.clientX-$,min:g,max:d});B=Xt(C,t),r(B)},E=()=>{document.removeEventListener("touchmove",I),document.removeEventListener("touchend",E),m.current=null,c.current=null;let k=Zo.findPath(a,e);Fa.setNodes(a,{width:B.width,height:B.height},{at:k}),i(!1)};m.current=I,c.current=E,document.addEventListener("touchmove",I),document.addEventListener("touchend",E)},[t.width,t.height,o.width,e]);Tf(()=>()=>{l.current&&document.removeEventListener("mousemove",l.current),s.current&&document.removeEventListener("mouseup",s.current),m.current&&document.removeEventListener("touchmove",m.current),c.current&&document.removeEventListener("touchend",c.current)},[]);let L=vf({"--center":p<d&&p>g,"--left":p>=d&&p>g,"--right":p<=g&&p<d,"--dragging":n,"--small":p<=64||o.height<=64});return Et(Pf,{children:Et(Ha,{className:L,onMouseDown:T,onTouchStart:S,children:Mf(Aa,{children:[Et("span",{className:"--bar --bar-left"}),Et("span",{className:"--bar --bar-center"}),Et("span",{className:"--bar --bar-right"})]})})})}import Cf from"@emotion/styled";var Ka=Cf("span")`
753
753
  position: absolute;
754
754
  /**
755
755
  * The status appears with a 1px gap from the outline.
@@ -771,7 +771,7 @@
771
771
 
772
772
  /* force numbers to be monospaced for better alignment */
773
773
  font-variant-numeric: tabular-nums;
774
- `;import{jsxs as Df}from"react/jsx-runtime";function Ga({size:e}){return Df(Wa,{children:[e.width," \xD7 ",e.height]})}import zf from"@emotion/styled";var qa=zf("span")`
774
+ `;import{jsxs as Sf}from"react/jsx-runtime";function _a({size:e}){return Sf(Ka,{children:[e.width," \xD7 ",e.height]})}import Rf from"@emotion/styled";var Wa=Rf("span")`
775
775
  position: absolute;
776
776
  /**
777
777
  * On top of the image +1 for space inside outline, +2 for outline,
@@ -802,7 +802,7 @@
802
802
  }
803
803
  display: flex;
804
804
  gap: 0.25em;
805
- `;import Qa from"@emotion/styled";var Yt=Qa("span")`
805
+ `;import Ga from"@emotion/styled";var Jt=Ga("span")`
806
806
  /* font-size: 0.75em; */
807
807
  border-radius: 0.5em;
808
808
  display: flex;
@@ -815,7 +815,7 @@
815
815
  * see the border of the buttons.
816
816
  */
817
817
  outline: 1px solid white;
818
- `,We=Qa("span")`
818
+ `,We=Ga("span")`
819
819
  font-size: 0.75em;
820
820
  line-height: 2em;
821
821
  padding: 0 0.625em;
@@ -869,17 +869,17 @@
869
869
  font-size: 1.33em;
870
870
  line-height: 1em;
871
871
  }
872
- `;import{clsx as $f}from"clsx";import{useCallback as Nf}from"react";import{Transforms as Hf}from"slate";import{ReactEditor as Af,useSlateStatic as Of}from"slate-react";import{jsx as Uf}from"react/jsx-runtime";function ja({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=Of(),a=Se(o,n,t),l=J({title:t.title,hotkey:`${a.width}x${a.height}`}),m=Nf(()=>{let d=Af.findPath(i,e),g=Se(o,n,t);r(g),Hf.setNodes(i,g,{at:d})},[e,t,o,n]),c=!(t.type==="scale"?!0:t.width<=n.width||t.height<=n.height),u=o.width===a.width&&o.height===a.height,p=$f({"--disabled":c,"--selected":!c&&u});return Uf(We,{className:p,onClick:c?void 0:m,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Xa}from"react/jsx-runtime";function Ya({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Xa(Yt,{children:n.map((i,a)=>Xa(ja,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as Kf}from"react";import{useSlateStatic as _f}from"slate-react";import{jsx as Jt,jsxs as el}from"react/jsx-runtime";var Ja=e=>el(y,{...e,children:[Jt("rect",{width:6,height:6,x:4,y:5,rx:1}),Jt("path",{d:"M4 15h16M4 19h16"})]}),Za=e=>el(y,{...e,children:[Jt("rect",{width:6,height:6,x:9,y:5,rx:1}),Jt("path",{d:"M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16"})]});import{Editor as Ff,Transforms as tl}from"slate";import{ReactEditor as Vf}from"slate-react";function ol(e,t){if(!t.width||!t.height||!t.srcWidth||!t.srcHeight)return;let o={width:t.width,height:t.height},r={width:t.srcWidth,height:t.srcHeight},n=Vf.findPath(e,t);Ff.withoutNormalizing(e,()=>{let i=Se(o,r,{name:"initial-inline-image",title:"",type:"bounds",width:24,height:24});tl.setNodes(e,{type:"image-inline",...i},{at:n}),tl.wrapNodes(e,{type:"paragraph",children:[]},{at:n})})}import{jsx as rl}from"react/jsx-runtime";function nl({element:e}){let t=_f(),o=J({title:"Inline Image",hotkey:"In a line with text"}),r=Kf(()=>{e.type==="image-block"&&ol(t,e)},[t,e]);return rl(We,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:rl(Za,{})})}import{useCallback as qf}from"react";import{useSlateStatic as Qf}from"slate-react";import{Editor as il,Element as Wf,Text as al,Transforms as Zt}from"slate";import{ReactEditor as Gf}from"slate-react";function ll(e,t){if(!t.width||!t.height||!t.srcWidth||!t.srcHeight)return;let o={width:t.width,height:t.height},r={width:t.srcWidth,height:t.srcHeight},n=Gf.findPath(e,t);il.withoutNormalizing(e,()=>{let i=Se(o,r,{name:"initial-block-image",title:"",type:"bounds",width:320,height:320});Zt.setNodes(e,{type:"image-block",...i},{at:n});let a=x(e,v=>Wf.isElement(v)&&il.isBlock(e,v)&&v.type!=="image-block");if(!a)throw new Error("This shouldn't happen");let[l,m]=a,s=l.children,c=l.children.length,u=n.slice(-1)[0],p=s[c-1];u===c-2&&al.isText(p)&&p.text===""&&Zt.removeNodes(e,{at:[...m,c-1]});let d=s[0],g=u===1&&al.isText(d)&&d.text==="";g&&Zt.removeNodes(e,{at:[...m,0]}),Zt.liftNodes(e,{at:[...m,g?u-1:u]})})}import{jsx as sl}from"react/jsx-runtime";function ml({element:e}){let t=Qf(),o=J({title:"Block Image",hotkey:"On a line by itself"}),r=qf(()=>{e.type==="image-inline"&&ll(t,e)},[t,e]);return sl(We,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:sl(Ja,{})})}import{jsx as cl,jsxs as jf}from"react/jsx-runtime";function pl({element:e}){return jf(Yt,{children:[cl(ml,{element:e}),cl(nl,{element:e})]})}import{jsx as ul,jsxs as Xf}from"react/jsx-runtime";function dl({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Xf(qa,{children:[ul(pl,{element:e}),ul(Ya,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as eo,jsxs as Zf}from"react/jsx-runtime";function to({element:e,presets:t}){let o=e.url,r=Jf(),[n,i]=fl(!1),[a,l]=fl(e.srcWidth&&e.srcHeight&&e.width&&e.height?{width:e.width,height:e.height}:null),m=e.srcWidth&&e.srcHeight?{width:e.srcWidth,height:e.srcHeight}:null,s=r&&a&&m,c=Yf({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Zf($a,{className:c,children:[eo(Na,{src:o,width:a?.width,height:a?.height}),s?eo(dl,{element:e,size:a,setSize:l,srcSize:m,presets:t}):null,n&&a?eo(Ga,{size:a}):null,s?eo(_a,{element:e,srcSize:m,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import{jsx as hl,jsxs as th}from"react/jsx-runtime";function gl({element:e,attributes:t,children:o}){let r=eh();return th("div",{...t,children:[hl(Da,{contentEditable:!1,children:hl(to,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as rh}from"slate-react";import oh from"@emotion/styled";var bl=oh("span")`
872
+ `;import{clsx as Lf}from"clsx";import{useCallback as Bf}from"react";import{Transforms as Df}from"slate";import{ReactEditor as zf,useSlateStatic as $f}from"slate-react";import{jsx as Nf}from"react/jsx-runtime";function qa({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=$f(),a=Se(o,n,t),l=J({title:t.title,hotkey:`${a.width}x${a.height}`}),s=Bf(()=>{let d=zf.findPath(i,e),g=Se(o,n,t);r(g),Df.setNodes(i,g,{at:d})},[e,t,o,n]),c=!(t.type==="scale"?!0:t.width<=n.width||t.height<=n.height),u=o.width===a.width&&o.height===a.height,p=Lf({"--disabled":c,"--selected":!c&&u});return Nf(We,{className:p,onClick:c?void 0:s,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Qa}from"react/jsx-runtime";function ja({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Qa(Jt,{children:n.map((i,a)=>Qa(qa,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as Of}from"react";import{useSlateStatic as Uf}from"slate-react";import{jsx as Zt,jsxs as Ja}from"react/jsx-runtime";var Xa=e=>Ja(y,{...e,children:[Zt("rect",{width:6,height:6,x:4,y:5,rx:1}),Zt("path",{d:"M4 15h16M4 19h16"})]}),Ya=e=>Ja(y,{...e,children:[Zt("rect",{width:6,height:6,x:9,y:5,rx:1}),Zt("path",{d:"M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16"})]});import{Editor as Hf,Transforms as Za}from"slate";import{ReactEditor as Af}from"slate-react";function el(e,t){if(!t.width||!t.height||!t.srcWidth||!t.srcHeight)return;let o={width:t.width,height:t.height},r={width:t.srcWidth,height:t.srcHeight},n=Af.findPath(e,t);Hf.withoutNormalizing(e,()=>{let i=Se(o,r,{name:"initial-inline-image",title:"",type:"bounds",width:24,height:24});Za.setNodes(e,{type:"image-inline",...i},{at:n}),Za.wrapNodes(e,{type:"paragraph",children:[]},{at:n})})}import{jsx as tl}from"react/jsx-runtime";function ol({element:e}){let t=Uf(),o=J({title:"Inline Image",hotkey:"In a line with text"}),r=Of(()=>{e.type==="image-block"&&el(t,e)},[t,e]);return tl(We,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:tl(Ya,{})})}import{useCallback as Kf}from"react";import{useSlateStatic as _f}from"slate-react";import{Editor as rl,Element as Ff,Text as nl,Transforms as eo}from"slate";import{ReactEditor as Vf}from"slate-react";function il(e,t){if(!t.width||!t.height||!t.srcWidth||!t.srcHeight)return;let o={width:t.width,height:t.height},r={width:t.srcWidth,height:t.srcHeight},n=Vf.findPath(e,t);rl.withoutNormalizing(e,()=>{let i=Se(o,r,{name:"initial-block-image",title:"",type:"bounds",width:320,height:320});eo.setNodes(e,{type:"image-block",...i},{at:n});let a=x(e,T=>Ff.isElement(T)&&rl.isBlock(e,T)&&T.type!=="image-block");if(!a)throw new Error("This shouldn't happen");let[l,s]=a,m=l.children,c=l.children.length,u=n.slice(-1)[0],p=m[c-1];u===c-2&&nl.isText(p)&&p.text===""&&eo.removeNodes(e,{at:[...s,c-1]});let d=m[0],g=u===1&&nl.isText(d)&&d.text==="";g&&eo.removeNodes(e,{at:[...s,0]}),eo.liftNodes(e,{at:[...s,g?u-1:u]})})}import{jsx as al}from"react/jsx-runtime";function ll({element:e}){let t=_f(),o=J({title:"Block Image",hotkey:"On a line by itself"}),r=Kf(()=>{e.type==="image-inline"&&il(t,e)},[t,e]);return al(We,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:al(Xa,{})})}import{jsx as sl,jsxs as Wf}from"react/jsx-runtime";function ml({element:e}){return Wf(Jt,{children:[sl(ll,{element:e}),sl(ol,{element:e})]})}import{jsx as cl,jsxs as Gf}from"react/jsx-runtime";function pl({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Gf(Wa,{children:[cl(ml,{element:e}),cl(ja,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as to,jsxs as jf}from"react/jsx-runtime";function oo({element:e,presets:t}){let o=e.url,r=Qf(),[n,i]=ul(!1),[a,l]=ul(e.srcWidth&&e.srcHeight&&e.width&&e.height?{width:e.width,height:e.height}:null),s=e.srcWidth&&e.srcHeight?{width:e.srcWidth,height:e.srcHeight}:null,m=r&&a&&s,c=qf({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return jf(Da,{className:c,children:[to(za,{src:o,width:a?.width,height:a?.height}),m?to(pl,{element:e,size:a,setSize:l,srcSize:s,presets:t}):null,n&&a?to(_a,{size:a}):null,m?to(Va,{element:e,srcSize:s,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import{jsx as dl,jsxs as Yf}from"react/jsx-runtime";function fl({element:e,attributes:t,children:o}){let r=Xf();return Yf("div",{...t,children:[dl(La,{contentEditable:!1,children:dl(oo,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as Zf}from"slate-react";import Jf from"@emotion/styled";var hl=Jf("span")`
873
873
  display: inline;
874
- `;import{jsx as El,jsxs as nh}from"react/jsx-runtime";function xl({element:e,attributes:t,children:o}){let r=rh();return nh("span",{...t,style:{display:"inline-block"},children:[El(bl,{contentEditable:!1,children:El(to,{element:e,presets:r.image.imageInlinePresets})}),o]})}import{jsx as yl}from"react/jsx-runtime";function kl({element:e,attributes:t,children:o}){switch(e.type){case"image-block":return yl(gl,{element:e,attributes:t,children:o});case"image-inline":return yl(xl,{element:e,attributes:t,children:o})}}function lh(e){return t=>{let{dataTransfer:o}=t;if(!o.files||o.files.length===0)return!1;let r=Array.from(o.files).filter(a=>a.type.startsWith("image/"));if(r.length===0)return!1;t.preventDefault(),t.stopPropagation();let n=ah.findEventRange(e,t);n&&ih.select(e,n);let i=e.wysimark?.onImageChange;for(let a of r)if(i)i(a).then(l=>{l&&e.image.insertImageFromUrl(l,a.name,"")}).catch(()=>{});else{let l=new FileReader;l.onload=()=>{let m=l.result;e.image.insertImageFromUrl(m,a.name,"")},l.readAsDataURL(a)}return!0}}var sh={maxInitialInlineImageSize:{width:64,height:64},maxInitialImageSize:{width:320,height:320},maxImageSize:{width:1024,height:1024},imageBlockPresets:[{name:"S",title:"Small",type:"bounds",width:160,height:160},{name:"M",title:"Medium",type:"bounds",width:320,height:320},{name:"L",title:"Large",type:"bounds",width:640,height:640},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}],imageInlinePresets:[{name:"16",title:"16 pixels",type:"bounds",width:16,height:16},{name:"24",title:"24 pixels",type:"bounds",width:24,height:24},{name:"32",title:"32 pixels",type:"bounds",width:32,height:32},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}]},Tl=T((e,t,{createPolicy:o})=>{let r={...sh,...t.image};return e.image={...La(e),maxInitialInlineImageSize:r.maxInitialInlineImageSize,maxInitialImageSize:r.maxInitialImageSize,maxImageSize:r.maxImageSize,imageBlockPresets:r.imageBlockPresets,imageInlinePresets:r.imageInlinePresets},o({name:"image",editor:{isVoid:n=>{if(["image-block","image-inline"].includes(n.type))return!0},isInline:n=>{if(n.type==="image-inline")return!0},normalizeNode:f(Ba,e)},editableProps:{renderElement:kl,onDrop:lh(e)}})});import{Editor as xt,Element as j,Transforms as Ge}from"slate";import mh from"@emotion/styled";var vl=mh("blockquote")`
874
+ `;import{jsx as gl,jsxs as eh}from"react/jsx-runtime";function bl({element:e,attributes:t,children:o}){let r=Zf();return eh("span",{...t,style:{display:"inline-block"},children:[gl(hl,{contentEditable:!1,children:gl(oo,{element:e,presets:r.image.imageInlinePresets})}),o]})}import{jsx as El}from"react/jsx-runtime";function xl({element:e,attributes:t,children:o}){switch(e.type){case"image-block":return El(fl,{element:e,attributes:t,children:o});case"image-inline":return El(bl,{element:e,attributes:t,children:o})}}function rh(e){return t=>{let{dataTransfer:o}=t;if(!o.files||o.files.length===0)return!1;let r=Array.from(o.files).filter(a=>a.type.startsWith("image/"));if(r.length===0)return!1;t.preventDefault(),t.stopPropagation();let n=oh.findEventRange(e,t);n&&th.select(e,n);let i=e.wysimark?.onImageChange;for(let a of r)if(i)i(a).then(l=>{l&&e.image.insertImageFromUrl(l,a.name,"")}).catch(()=>{});else{let l=new FileReader;l.onload=()=>{let s=l.result;e.image.insertImageFromUrl(s,a.name,"")},l.readAsDataURL(a)}return!0}}var nh={maxInitialInlineImageSize:{width:64,height:64},maxInitialImageSize:{width:320,height:320},maxImageSize:{width:1024,height:1024},imageBlockPresets:[{name:"S",title:"Small",type:"bounds",width:160,height:160},{name:"M",title:"Medium",type:"bounds",width:320,height:320},{name:"L",title:"Large",type:"bounds",width:640,height:640},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}],imageInlinePresets:[{name:"16",title:"16 pixels",type:"bounds",width:16,height:16},{name:"24",title:"24 pixels",type:"bounds",width:24,height:24},{name:"32",title:"32 pixels",type:"bounds",width:32,height:32},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}]},yl=v((e,t,{createPolicy:o})=>{let r={...nh,...t.image};return e.image={...Sa(e),maxInitialInlineImageSize:r.maxInitialInlineImageSize,maxInitialImageSize:r.maxInitialImageSize,maxImageSize:r.maxImageSize,imageBlockPresets:r.imageBlockPresets,imageInlinePresets:r.imageInlinePresets},o({name:"image",editor:{isVoid:n=>{if(["image-block","image-inline"].includes(n.type))return!0},isInline:n=>{if(n.type==="image-inline")return!0},normalizeNode:f(Ra,e)},editableProps:{renderElement:xl,onDrop:rh(e)}})});import{Editor as xt,Element as j,Transforms as Ge}from"slate";import ih from"@emotion/styled";var kl=ih("blockquote")`
875
875
  position: relative;
876
876
  margin-top: 1em;
877
877
  margin-bottom: 1em;
878
878
  margin-left: 0;
879
879
  border-left: 0.25em solid rgba(0, 0, 0, 0.075);
880
880
  padding-left: 1.5em;
881
- `;import{jsx as ph}from"react/jsx-runtime";function wl(e){return j.isElement(e)&&(e.type==="paragraph"||e.type==="code-block"||e.type==="table"||e.type==="horizontal-rule"||e.type==="task-list-item"||e.type==="unordered-list-item"||e.type==="ordered-list-item"||e.type==="heading")}var ch=2,Il=T(e=>(e.supportsBlockQuote=!0,e.blockQuotePlugin={indent:()=>{Ge.wrapNodes(e,{type:"block-quote",children:[]},{match:wl})},outdent:()=>{Ge.liftNodes(e,{match:(t,o)=>wl(t)&&o.length>1})},isActive:()=>{let[t]=xt.nodes(e,{match:o=>j.isElement(o)&&o.type==="block-quote"});return!!t},increaseDepth:()=>{let[t]=xt.nodes(e,{match:r=>j.isElement(r)&&r.type==="block-quote"});if(!t||!e.blockQuotePlugin.canIncreaseDepth())return;let[,o]=t;Ge.select(e,o),Ge.wrapNodes(e,{type:"block-quote",children:[]},{at:o,split:!1})},decreaseDepth:()=>{let[t]=xt.nodes(e,{match:i=>j.isElement(i)&&i.type==="block-quote"});if(!t||!e.blockQuotePlugin.canDecreaseDepth())return;let[o,r]=t,n=o.children;n.length===1&&j.isElement(n[0])&&n[0].type==="block-quote"&&Ge.unwrapNodes(e,{at:[...r,0],match:i=>j.isElement(i)&&i.type==="block-quote"})},canIncreaseDepth:()=>{let[t]=xt.nodes(e,{match:i=>j.isElement(i)&&i.type==="block-quote"});if(!t)return!1;let[o]=t,r=0,n=o;for(;n.children.length===1&&j.isElement(n.children[0])&&n.children[0].type==="block-quote";)r++,n=n.children[0];return r<ch},canDecreaseDepth:()=>{let[t]=xt.nodes(e,{match:r=>j.isElement(r)&&r.type==="block-quote"});if(!t)return!1;let[o]=t;return o.children.length===1&&j.isElement(o.children[0])&&o.children[0]&&o.children[0].type==="block-quote"}},{name:"block-quote",editor:{normalizeNode(t){let[o,r]=t;return!j.isElement(o)||o.type!=="block-quote"?!1:xe(e,[o,r],(n,i)=>(j.isElement(n[0])&&j.isElement(i[0])&&n[0].type==="block-quote"&&i[0].type==="block-quote"&&Ge.mergeNodes(e,{at:i[1]}),!0))}},editableProps:{renderElement:({element:t,attributes:o,children:r})=>{if(t.type==="block-quote")return ph(vl,{...o,children:r})},onKeyDown:H({"super+.":e.blockQuotePlugin.indent,"super+,":e.blockQuotePlugin.outdent})}}));import{Editor as Ph,Element as Ch,Transforms as Ql}from"slate";import uh from"prismjs";import{Element as hh,Node as gh}from"slate";var{languages:dh,tokenize:fh}=uh;function bh(e){let t=0,o=[];for(let r of e)o.push(t),t=t+r.length;return o}function Ml(e){let[t,o]=e;if(!hh.isElement(t))return[];if(t.type!=="code-block")return[];let r=dh[t.language];if(r===void 0)return[];let i=t.children.map(p=>`${gh.string(p)}
882
- `),a=i.join(""),l=bh(i);function m(p){for(let d=l.length-1;d>=0;d--){let g=l[d];if(g<=p)return{path:[...o,d],offset:p-g}}throw new Error("This shouldn't happen and indicates a bug in the logic")}let s=[],c=fh(a,r),u=0;for(let p of c)if(typeof p=="string")u+=p.length;else{let d=m(u),g=m(u+p.length);s.push({anchor:d,focus:g,prismToken:p.type}),u+=p.length}return s}function Pl(e,{language:t}){Pi(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as Eh,Transforms as xh}from"slate";function Cl(e,t,o={}){let r=x(e,n=>Eh.isElement(n)&&n.type==="code-block",{at:o.at});return r?(xh.setNodes(e,{language:t},{at:r[1]}),!0):!1}function Sl(e){return{createCodeBlock:f(Pl,e),setCodeBlockLanguage:f(Cl,e)}}var oo={color:"#999988",fontStyle:"italic"},yh={opacity:"0.7"},Rl={color:"#e3116c"},Ll={color:"#393a34"},le={color:"#36acaa"},tr={color:"#00a4db"},Bl={color:"#9a050f"},Dl={color:"#00009f"},or={fontWeight:"bold"},kh={fontStyle:"italic"},zl={comment:oo,prolog:oo,doctype:oo,cdata:oo,namespace:yh,string:Rl,"attr-value":Rl,puncutation:Ll,operator:Ll,entity:le,url:le,symbol:le,number:le,boolean:le,variable:le,constant:le,property:le,regex:le,insert:le,atrule:tr,keyword:tr,"attr-name":tr,function:{...Bl,...or},delete:Bl,tag:Dl,selector:Dl,important:or,bold:or,italic:kh};var $l=["text","html","css","svg","javascript","java","c"];import{Element as rr,Node as nr,Transforms as qe}from"slate";function Nl(e,t){if(!rr.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of nr.children(e,t[1]))if(rr.isElement(o))return e.isVoid(o)?(qe.removeNodes(e,{at:r}),!0):(qe.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of nr.children(e,t[1]))if(rr.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(qe.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(qe.removeNodes(e,{at:r}),!0):(qe.removeNodes(e,{at:r}),qe.insertNodes(e,{type:"code-block-line",children:[{text:nr.string(o)}]}),!0)}return!1}import{useCallback as Th,useRef as vh}from"react";import{useSelected as wh}from"slate-react";import{jsx as Hl}from"react/jsx-runtime";var Al=e=>Hl(y,{...e,children:Hl("path",{d:"m6 9 6 6 6-6"})});import ro from"@emotion/styled";var Ol=ro("div")`
881
+ `;import{jsx as lh}from"react/jsx-runtime";function vl(e){return j.isElement(e)&&(e.type==="paragraph"||e.type==="code-block"||e.type==="table"||e.type==="horizontal-rule"||e.type==="task-list-item"||e.type==="unordered-list-item"||e.type==="ordered-list-item"||e.type==="heading")}var ah=2,Tl=v(e=>(e.supportsBlockQuote=!0,e.blockQuotePlugin={indent:()=>{Ge.wrapNodes(e,{type:"block-quote",children:[]},{match:vl})},outdent:()=>{Ge.liftNodes(e,{match:(t,o)=>vl(t)&&o.length>1})},isActive:()=>{let[t]=xt.nodes(e,{match:o=>j.isElement(o)&&o.type==="block-quote"});return!!t},increaseDepth:()=>{let[t]=xt.nodes(e,{match:r=>j.isElement(r)&&r.type==="block-quote"});if(!t||!e.blockQuotePlugin.canIncreaseDepth())return;let[,o]=t;Ge.select(e,o),Ge.wrapNodes(e,{type:"block-quote",children:[]},{at:o,split:!1})},decreaseDepth:()=>{let[t]=xt.nodes(e,{match:i=>j.isElement(i)&&i.type==="block-quote"});if(!t||!e.blockQuotePlugin.canDecreaseDepth())return;let[o,r]=t,n=o.children;n.length===1&&j.isElement(n[0])&&n[0].type==="block-quote"&&Ge.unwrapNodes(e,{at:[...r,0],match:i=>j.isElement(i)&&i.type==="block-quote"})},canIncreaseDepth:()=>{let[t]=xt.nodes(e,{match:i=>j.isElement(i)&&i.type==="block-quote"});if(!t)return!1;let[o]=t,r=0,n=o;for(;n.children.length===1&&j.isElement(n.children[0])&&n.children[0].type==="block-quote";)r++,n=n.children[0];return r<ah},canDecreaseDepth:()=>{let[t]=xt.nodes(e,{match:r=>j.isElement(r)&&r.type==="block-quote"});if(!t)return!1;let[o]=t;return o.children.length===1&&j.isElement(o.children[0])&&o.children[0]&&o.children[0].type==="block-quote"}},{name:"block-quote",editor:{normalizeNode(t){let[o,r]=t;return!j.isElement(o)||o.type!=="block-quote"?!1:xe(e,[o,r],(n,i)=>(j.isElement(n[0])&&j.isElement(i[0])&&n[0].type==="block-quote"&&i[0].type==="block-quote"&&Ge.mergeNodes(e,{at:i[1]}),!0))}},editableProps:{renderElement:({element:t,attributes:o,children:r})=>{if(t.type==="block-quote")return lh(kl,{...o,children:r})},onKeyDown:H({"super+.":e.blockQuotePlugin.indent,"super+,":e.blockQuotePlugin.outdent})}}));import{Editor as Th,Element as wh,Transforms as Gl}from"slate";import sh from"prismjs";import{Element as ph,Node as uh}from"slate";var{languages:mh,tokenize:ch}=sh;function dh(e){let t=0,o=[];for(let r of e)o.push(t),t=t+r.length;return o}function wl(e){let[t,o]=e;if(!ph.isElement(t))return[];if(t.type!=="code-block")return[];let r=mh[t.language];if(r===void 0)return[];let i=t.children.map(p=>`${uh.string(p)}
882
+ `),a=i.join(""),l=dh(i);function s(p){for(let d=l.length-1;d>=0;d--){let g=l[d];if(g<=p)return{path:[...o,d],offset:p-g}}throw new Error("This shouldn't happen and indicates a bug in the logic")}let m=[],c=ch(a,r),u=0;for(let p of c)if(typeof p=="string")u+=p.length;else{let d=s(u),g=s(u+p.length);m.push({anchor:d,focus:g,prismToken:p.type}),u+=p.length}return m}function Il(e,{language:t}){Ii(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as fh,Transforms as hh}from"slate";function Ml(e,t,o={}){let r=x(e,n=>fh.isElement(n)&&n.type==="code-block",{at:o.at});return r?(hh.setNodes(e,{language:t},{at:r[1]}),!0):!1}function Pl(e){return{createCodeBlock:f(Il,e),setCodeBlockLanguage:f(Ml,e)}}var ro={color:"#999988",fontStyle:"italic"},gh={opacity:"0.7"},Cl={color:"#e3116c"},Sl={color:"#393a34"},le={color:"#36acaa"},er={color:"#00a4db"},Rl={color:"#9a050f"},Ll={color:"#00009f"},tr={fontWeight:"bold"},bh={fontStyle:"italic"},Bl={comment:ro,prolog:ro,doctype:ro,cdata:ro,namespace:gh,string:Cl,"attr-value":Cl,puncutation:Sl,operator:Sl,entity:le,url:le,symbol:le,number:le,boolean:le,variable:le,constant:le,property:le,regex:le,insert:le,atrule:er,keyword:er,"attr-name":er,function:{...Rl,...tr},delete:Rl,tag:Ll,selector:Ll,important:tr,bold:tr,italic:bh};var Dl=["text","html","css","svg","javascript","java","c"];import{Element as or,Node as rr,Transforms as qe}from"slate";function zl(e,t){if(!or.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of rr.children(e,t[1]))if(or.isElement(o))return e.isVoid(o)?(qe.removeNodes(e,{at:r}),!0):(qe.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of rr.children(e,t[1]))if(or.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(qe.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(qe.removeNodes(e,{at:r}),!0):(qe.removeNodes(e,{at:r}),qe.insertNodes(e,{type:"code-block-line",children:[{text:rr.string(o)}]}),!0)}return!1}import{useCallback as Eh,useRef as xh}from"react";import{useSelected as yh}from"slate-react";import{jsx as $l}from"react/jsx-runtime";var Nl=e=>$l(y,{...e,children:$l("path",{d:"m6 9 6 6 6-6"})});import no from"@emotion/styled";var Hl=no("div")`
883
883
  position: relative;
884
884
  background: var(--code-block-bgcolor);
885
885
  margin: 1em 0;
@@ -898,11 +898,11 @@
898
898
  * Otherwise they will be square.
899
899
  */
900
900
  overflow-x: hidden;
901
- `,Ul=ro("div")`
901
+ `,Al=no("div")`
902
902
  padding: 2.25em 1em 1.5em 1em;
903
903
  border-radius: 0.5em;
904
904
  overflow-x: auto;
905
- `,Fl=ro("span")`
905
+ `,Ol=no("span")`
906
906
  cursor: pointer;
907
907
  position: absolute;
908
908
  top: 0.25em;
@@ -928,7 +928,7 @@
928
928
  color: var(--shade-800);
929
929
  background: var(--shade-300);
930
930
  }
931
- `,Vl=ro("div")`
931
+ `,Ul=no("div")`
932
932
  white-space: pre;
933
933
  line-height: 1.5em;
934
934
  counter-increment: line;
@@ -951,7 +951,7 @@
951
951
  display: inline-block;
952
952
  width: 2em;
953
953
  } */
954
- `;import{jsx as yt,jsxs as Kl}from"react/jsx-runtime";function _l({element:e,attributes:t,children:o}){let r=vh(null),n=wh(),i=O("code-block-dropdown"),a=Th(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let m=$l.map(s=>({icon:()=>yt("span",{}),title:s,action:c=>{c.codeBlock.setCodeBlockLanguage(s,{at:e})}}));i.open(()=>yt(Ve,{dest:l,items:m,close:i.close}))},[e]);return Kl(Ol,{className:n?"--selected":"",...t,children:[Kl(Fl,{contentEditable:!1,onClick:a,ref:r,children:[yt("span",{children:e.language}),yt(Al,{})]}),yt(Ul,{children:o})]})}import{useSelected as Ih}from"slate-react";import{jsx as Mh}from"react/jsx-runtime";function Wl({attributes:e,children:t}){let o=Ih();return Mh(Vl,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as Gl}from"react/jsx-runtime";function ql({element:e,attributes:t,children:o}){if(e.type==="code-block")return Gl(_l,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return Gl(Wl,{element:e,attributes:t,children:o})}import{Fragment as Sh,jsx as jl}from"react/jsx-runtime";var Xl=T((e,t,{createPolicy:o})=>{e.codeBlock=Sl(e);function r(){let{selection:n}=e;if(!me(n))return!1;let i=x(e,"code-block");return i==null?!1:Ph.string(e,i[1])===""?(Ql.removeNodes(e,{at:i[1]}),!0):!1}return o({name:"code-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isVoid(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isMaster(n){if(n.type==="code-block")return!0},normalizeNode:f(Nl,e)},editableProps:{decorate:Ml,onKeyDown:H({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=x(e,i=>Ch.isElement(i)&&i.type==="code-block");return n?(Ql.select(e,n[1]),!0):!1}}),renderElement:ql,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&zl[n.prismToken]||null;return a===null?jl(Sh,{children:i}):jl("span",{style:a,children:i})}}})});import{Transforms as Lh}from"slate";import Yl from"@emotion/styled";var Jl=Yl("div")`
954
+ `;import{jsx as yt,jsxs as Fl}from"react/jsx-runtime";function Vl({element:e,attributes:t,children:o}){let r=xh(null),n=yh(),i=O("code-block-dropdown"),a=Eh(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let s=Dl.map(m=>({icon:()=>yt("span",{}),title:m,action:c=>{c.codeBlock.setCodeBlockLanguage(m,{at:e})}}));i.open(()=>yt(Ve,{dest:l,items:s,close:i.close}))},[e]);return Fl(Hl,{className:n?"--selected":"",...t,children:[Fl(Ol,{contentEditable:!1,onClick:a,ref:r,children:[yt("span",{children:e.language}),yt(Nl,{})]}),yt(Al,{children:o})]})}import{useSelected as kh}from"slate-react";import{jsx as vh}from"react/jsx-runtime";function Kl({attributes:e,children:t}){let o=kh();return vh(Ul,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as _l}from"react/jsx-runtime";function Wl({element:e,attributes:t,children:o}){if(e.type==="code-block")return _l(Vl,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return _l(Kl,{element:e,attributes:t,children:o})}import{Fragment as Ih,jsx as ql}from"react/jsx-runtime";var Ql=v((e,t,{createPolicy:o})=>{e.codeBlock=Pl(e);function r(){let{selection:n}=e;if(!me(n))return!1;let i=x(e,"code-block");return i==null?!1:Th.string(e,i[1])===""?(Gl.removeNodes(e,{at:i[1]}),!0):!1}return o({name:"code-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isVoid(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isMaster(n){if(n.type==="code-block")return!0},normalizeNode:f(zl,e)},editableProps:{decorate:wl,onKeyDown:H({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=x(e,i=>wh.isElement(i)&&i.type==="code-block");return n?(Gl.select(e,n[1]),!0):!1}}),renderElement:Wl,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&Bl[n.prismToken]||null;return a===null?ql(Ih,{children:i}):ql("span",{style:a,children:i})}}})});import{Transforms as Ph}from"slate";import jl from"@emotion/styled";var Xl=jl("div")`
955
955
  position: relative;
956
956
  background-color: var(--shade-100);
957
957
  border: 1px solid var(--shade-300);
@@ -969,7 +969,7 @@
969
969
  &.--selected {
970
970
  outline: 2px solid var(--select-color);
971
971
  }
972
- `,Zl=Yl("span")`
972
+ `,Yl=jl("span")`
973
973
  position: absolute;
974
974
  top: 0.25em;
975
975
  right: 0.5em;
@@ -977,7 +977,7 @@
977
977
  color: var(--shade-500);
978
978
  text-transform: uppercase;
979
979
  letter-spacing: 0.5px;
980
- `;import{jsx as es,jsxs as Rh}from"react/jsx-runtime";function ts({attributes:e,children:t,element:o}){return Rh(Jl,{...e,contentEditable:!1,children:[es(Zl,{children:"HTML"}),es("div",{children:at(o.html)}),t]})}import{jsx as Bh}from"react/jsx-runtime";var os=T((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!me(n))return!1;let i=x(e,"html-block");return i==null?!1:(Lh.removeNodes(e,{at:i[1]}),!0)}return o({name:"html-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="html-block")return!1},isVoid(n){if(n.type==="html-block")return!0},isMaster(n){if(n.type==="html-block")return!0}},editableProps:{renderElement:({element:n,attributes:i,children:a})=>{if(n.type==="html-block")return Bh(ts,{element:n,attributes:i,children:a})}}})});import{Element as Hh}from"slate";import{Element as Dh,Transforms as zh}from"slate";function rs(e){return Dh.isElement(e)&&e.type==="paragraph"}function ns(e,t){return xe(e,t,(o,r)=>!rs(o[0])||!rs(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(zh.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as $h,Transforms as Nh}from"slate";function ir(e,t){return $h.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function is(e,t){return ir(e,t[0])?xe(e,t,(o,r)=>!ir(e,o[0])||!ir(e,r[0])?!1:(Nh.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function as(e,t){let[o,r]=t;return Hh.isElement(o)?!!(is(e,[o,r])||ns(e,[o,r])):!1}import{clsx as Uh}from"clsx";import{useSelected as Fh}from"slate-react";import Ah from"@emotion/styled";var ls=Ah("p")`
980
+ `;import{jsx as Jl,jsxs as Mh}from"react/jsx-runtime";function Zl({attributes:e,children:t,element:o}){return Mh(Xl,{...e,contentEditable:!1,children:[Jl(Yl,{children:"HTML"}),Jl("div",{children:at(o.html)}),t]})}import{jsx as Ch}from"react/jsx-runtime";var es=v((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!me(n))return!1;let i=x(e,"html-block");return i==null?!1:(Ph.removeNodes(e,{at:i[1]}),!0)}return o({name:"html-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="html-block")return!1},isVoid(n){if(n.type==="html-block")return!0},isMaster(n){if(n.type==="html-block")return!0}},editableProps:{renderElement:({element:n,attributes:i,children:a})=>{if(n.type==="html-block")return Ch(Zl,{element:n,attributes:i,children:a})}}})});import{Element as Dh}from"slate";import{Element as Sh,Transforms as Rh}from"slate";function ts(e){return Sh.isElement(e)&&e.type==="paragraph"}function os(e,t){return xe(e,t,(o,r)=>!ts(o[0])||!ts(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(Rh.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as Lh,Transforms as Bh}from"slate";function nr(e,t){return Lh.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function rs(e,t){return nr(e,t[0])?xe(e,t,(o,r)=>!nr(e,o[0])||!nr(e,r[0])?!1:(Bh.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function ns(e,t){let[o,r]=t;return Dh.isElement(o)?!!(rs(e,[o,r])||os(e,[o,r])):!1}import{clsx as Nh}from"clsx";import{useSelected as Hh}from"slate-react";import zh from"@emotion/styled";var is=zh("p")`
981
981
  padding: 0;
982
982
  margin: 0;
983
983
  &:first-of-type {
@@ -1011,41 +1011,41 @@
1011
1011
  }
1012
1012
  border-radius: 8px;
1013
1013
  }
1014
- `;import{Node as Oh}from"slate";function ss(e){return e.children.length===1&&Oh.string(e.children[0]).length===0}import{jsx as Vh}from"react/jsx-runtime";function ms({element:e,attributes:t,children:o}){let r=Fh(),n=ss(e);return Vh(ls,{...t,className:Uh({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as Kh}from"react/jsx-runtime";var cs=T(e=>{let{insertBreak:t}=e;if(e.insertBreak=()=>{t()},e.insertSoftBreak=()=>{e.insertText(`
1015
- `)},e.convertElement.addConvertElementType("paragraph"),e.collapsibleParagraph={convertParagraph:()=>{e.convertElement.convertElements(()=>!1,{type:"paragraph"},!1)}},!e.normalizeAfterDelete)throw new Error("The collapsible-paragraph-plugin has a dependency on the normalize-after-delete plugin. Please add that plugin before this one.");return{name:"collapsible-paragraph",editor:{normalizeNode:f(as,e)},editableProps:{renderElement:({element:o,attributes:r,children:n})=>{if(o.type==="paragraph")return Kh(ms,{element:o,attributes:r,children:n})},onKeyDown:o=>o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),o.shiftKey?e.insertSoftBreak():e.insertBreak(),!0):H({"super+0":e.collapsibleParagraph.convertParagraph})(o)}}});function ps(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}import{Editor as W,Element as no,Node as ne,Point as Qe,Range as _h,Transforms as Re}from"slate";function us(e,t,o){try{let r=W.start(e,o),n=W.end(e,o);if(Qe.isBefore(t,r)||Qe.isAfter(t,n))return-1;let i={anchor:r,focus:t};return W.string(e,i).length}catch{return-1}}function ds(e,t,o){try{let r=ne.get(e,t);if(!no.isElement(r))return;let n=ne.string(r),i=Math.min(o,n.length),a=W.start(e,t),l=0,m=a.path,s=0;for(let[u,p]of ne.texts(r)){let d=u.text.length;if(l+d>=i){m=[...t,...p],s=i-l;break}l+=d}let c={path:m,offset:s};Re.select(e,{anchor:c,focus:c})}catch{}}function Wh(e){return ne.string(e).includes(`
1016
- `)}function Gh(e,t,o,r){let n=ne.string(t),i=n.split(`
1017
- `),a=W.start(e,o),l=W.end(e,o),m=Qe.isBefore(r.anchor,a)?a:Qe.isAfter(r.anchor,l)?l:r.anchor,s=Qe.isBefore(r.focus,a)?a:Qe.isAfter(r.focus,l)?l:r.focus,c=Math.min(W.string(e,{anchor:a,focus:m}).length,n.length),u=Math.min(W.string(e,{anchor:a,focus:s}).length,n.length),p=Math.min(c,u),d=Math.max(c,u),g=0,v=0,S=i.length-1;for(let L=0;L<i.length;L++){let M=g+i[L].length;if(g<=p&&p<=M&&(v=L),g<=d&&d<=M){S=L;break}g=M+1}return{startLineIndex:v,endLineIndex:S}}function qh(e,t,o,r){let n=ne.string(t);if(!n.includes(`
1014
+ `;import{Node as $h}from"slate";function as(e){return e.children.length===1&&$h.string(e.children[0]).length===0}import{jsx as Ah}from"react/jsx-runtime";function ls({element:e,attributes:t,children:o}){let r=Hh(),n=as(e);return Ah(is,{...t,className:Nh({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as Oh}from"react/jsx-runtime";var ss=v(e=>{let{insertBreak:t}=e;if(e.insertBreak=()=>{t()},e.insertSoftBreak=()=>{e.insertText(`
1015
+ `)},e.convertElement.addConvertElementType("paragraph"),e.collapsibleParagraph={convertParagraph:()=>{e.convertElement.convertElements(()=>!1,{type:"paragraph"},!1)}},!e.normalizeAfterDelete)throw new Error("The collapsible-paragraph-plugin has a dependency on the normalize-after-delete plugin. Please add that plugin before this one.");return{name:"collapsible-paragraph",editor:{normalizeNode:f(ns,e)},editableProps:{renderElement:({element:o,attributes:r,children:n})=>{if(o.type==="paragraph")return Oh(ls,{element:o,attributes:r,children:n})},onKeyDown:o=>o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),o.shiftKey?e.insertSoftBreak():e.insertBreak(),!0):H({"super+0":e.collapsibleParagraph.convertParagraph})(o)}}});function ms(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}import{Editor as W,Element as io,Node as ne,Point as Qe,Range as Uh,Transforms as Re}from"slate";function cs(e,t,o){try{let r=W.start(e,o),n=W.end(e,o);if(Qe.isBefore(t,r)||Qe.isAfter(t,n))return-1;let i={anchor:r,focus:t};return W.string(e,i).length}catch{return-1}}function ps(e,t,o){try{let r=ne.get(e,t);if(!io.isElement(r))return;let n=ne.string(r),i=Math.min(o,n.length),a=W.start(e,t),l=0,s=a.path,m=0;for(let[u,p]of ne.texts(r)){let d=u.text.length;if(l+d>=i){s=[...t,...p],m=i-l;break}l+=d}let c={path:s,offset:m};Re.select(e,{anchor:c,focus:c})}catch{}}function Fh(e){return ne.string(e).includes(`
1016
+ `)}function Vh(e,t,o,r){let n=ne.string(t),i=n.split(`
1017
+ `),a=W.start(e,o),l=W.end(e,o),s=Qe.isBefore(r.anchor,a)?a:Qe.isAfter(r.anchor,l)?l:r.anchor,m=Qe.isBefore(r.focus,a)?a:Qe.isAfter(r.focus,l)?l:r.focus,c=Math.min(W.string(e,{anchor:a,focus:s}).length,n.length),u=Math.min(W.string(e,{anchor:a,focus:m}).length,n.length),p=Math.min(c,u),d=Math.max(c,u),g=0,T=0,S=i.length-1;for(let L=0;L<i.length;L++){let M=g+i[L].length;if(g<=p&&p<=M&&(T=L),g<=d&&d<=M){S=L;break}g=M+1}return{startLineIndex:T,endLineIndex:S}}function Kh(e,t,o,r){let n=ne.string(t);if(!n.includes(`
1018
1018
  `))return o;let i=n.split(`
1019
- `);if(i.length<=1)return o;let{startLineIndex:a,endLineIndex:l}=Gh(e,t,o,r),m=i.slice(0,a),s=i.slice(a,l+1),c=i.slice(l+1);return m.length===0&&c.length===0?o:(W.withoutNormalizing(e,()=>{let u=o.slice(0,-1),p=o[o.length-1];if(c.length>0){let g=c.join(`
1020
- `),v={...t,children:[{text:g}]};Re.insertNodes(e,v,{at:[...u,p+1]})}let d=t.children.length;for(let g=d-1;g>=0;g--)Re.removeNodes(e,{at:[...o,g]});if(m.length>0){Re.insertNodes(e,{text:m.join(`
1021
- `)},{at:[...o,0]});let v={type:"paragraph",children:[{text:s.join(`
1022
- `)}]};Re.insertNodes(e,v,{at:[...u,p+1]})}else Re.insertNodes(e,{text:s.join(`
1023
- `)},{at:[...o,0]})}),m.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function fs(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=_h.isCollapsed(n),m=Array.from(W.nodes(e,{match:p=>no.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(m.length>0){let[,p]=m[0];i=us(e,n.anchor,p),a=us(e,n.focus,p)}if(m.length===0)return!1;let s=[];W.withoutNormalizing(e,()=>{for(let p=m.length-1;p>=0;p--){let[d,g]=m[p];if(Wh(d)){let v=qh(e,d,g,n);s.unshift(v)}else s.unshift(g)}});let c=s.map(p=>{try{let d=ne.get(e,p);return no.isElement(d)?[d,p]:null}catch{return null}}).filter(p=>p!==null);if(c.length===0)return!1;if(r&&c.every(p=>t(p[0]))?W.withoutNormalizing(e,()=>{for(let p of c)ft(e,{type:"paragraph"},p[1])}):W.withoutNormalizing(e,()=>{for(let p of c)ft(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)ds(e,p,i);else if(a>=0)try{let d=ne.get(e,p);if(no.isElement(d)){let g=ne.string(d),v=Math.min(i,g.length),S=Math.min(a,g.length),L=W.start(e,p),M=L.path,$=v,w=0;for(let[E,k]of ne.texts(d)){let P=E.text.length;if(w+P>=v){M=[...p,...k],$=v-w;break}w+=P}let B=L.path,I=S;w=0;for(let[E,k]of ne.texts(d)){let P=E.text.length;if(w+P>=S){B=[...p,...k],I=S-w;break}w+=P}Re.select(e,{anchor:{path:M,offset:$},focus:{path:B,offset:I}})}}catch{ds(e,p,i)}}return!0}function hs(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function gs(e){return{convertElementTypes:[],addConvertElementType:f(ps,e),isConvertibleElement:f(hs,e),convertElements:f(fs,e)}}var bs=T(e=>(e.convertElement=gs(e),{name:"convert-element"}));import{Editor as ar,Path as Qh,Range as jh,Transforms as Es}from"slate";function xs(e){let t=x(e,"heading");if(!t||!e.selection||jh.isExpanded(e.selection)||!ar.isEnd(e,e.selection.anchor,t[1]))return!1;let o=Qh.next(t[1]);return Es.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),Es.select(e,{anchor:ar.start(e,o),focus:ar.start(e,o)}),!0}import{Editor as Xh}from"slate";function Yh(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Jh(e,t){let[o]=Xh.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function ys(e){return{convertHeading:f(Yh,e),isHeadingActive:f(Jh,e)}}import{css as Zh}from"@emotion/react";import je from"@emotion/styled";var Xe=Zh`
1019
+ `);if(i.length<=1)return o;let{startLineIndex:a,endLineIndex:l}=Vh(e,t,o,r),s=i.slice(0,a),m=i.slice(a,l+1),c=i.slice(l+1);return s.length===0&&c.length===0?o:(W.withoutNormalizing(e,()=>{let u=o.slice(0,-1),p=o[o.length-1];if(c.length>0){let g=c.join(`
1020
+ `),T={...t,children:[{text:g}]};Re.insertNodes(e,T,{at:[...u,p+1]})}let d=t.children.length;for(let g=d-1;g>=0;g--)Re.removeNodes(e,{at:[...o,g]});if(s.length>0){Re.insertNodes(e,{text:s.join(`
1021
+ `)},{at:[...o,0]});let T={type:"paragraph",children:[{text:m.join(`
1022
+ `)}]};Re.insertNodes(e,T,{at:[...u,p+1]})}else Re.insertNodes(e,{text:m.join(`
1023
+ `)},{at:[...o,0]})}),s.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function us(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=Uh.isCollapsed(n),s=Array.from(W.nodes(e,{match:p=>io.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(s.length>0){let[,p]=s[0];i=cs(e,n.anchor,p),a=cs(e,n.focus,p)}if(s.length===0)return!1;let m=[];W.withoutNormalizing(e,()=>{for(let p=s.length-1;p>=0;p--){let[d,g]=s[p];if(Fh(d)){let T=Kh(e,d,g,n);m.unshift(T)}else m.unshift(g)}});let c=m.map(p=>{try{let d=ne.get(e,p);return io.isElement(d)?[d,p]:null}catch{return null}}).filter(p=>p!==null);if(c.length===0)return!1;if(r&&c.every(p=>t(p[0]))?W.withoutNormalizing(e,()=>{for(let p of c)ft(e,{type:"paragraph"},p[1])}):W.withoutNormalizing(e,()=>{for(let p of c)ft(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)ps(e,p,i);else if(a>=0)try{let d=ne.get(e,p);if(io.isElement(d)){let g=ne.string(d),T=Math.min(i,g.length),S=Math.min(a,g.length),L=W.start(e,p),M=L.path,$=T,w=0;for(let[E,k]of ne.texts(d)){let P=E.text.length;if(w+P>=T){M=[...p,...k],$=T-w;break}w+=P}let B=L.path,I=S;w=0;for(let[E,k]of ne.texts(d)){let P=E.text.length;if(w+P>=S){B=[...p,...k],I=S-w;break}w+=P}Re.select(e,{anchor:{path:M,offset:$},focus:{path:B,offset:I}})}}catch{ps(e,p,i)}}return!0}function ds(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function fs(e){return{convertElementTypes:[],addConvertElementType:f(ms,e),isConvertibleElement:f(ds,e),convertElements:f(us,e)}}var hs=v(e=>(e.convertElement=fs(e),{name:"convert-element"}));import{Editor as ir,Path as _h,Range as Wh,Transforms as gs}from"slate";function bs(e){let t=x(e,"heading");if(!t||!e.selection||Wh.isExpanded(e.selection)||!ir.isEnd(e,e.selection.anchor,t[1]))return!1;let o=_h.next(t[1]);return gs.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),gs.select(e,{anchor:ir.start(e,o),focus:ir.start(e,o)}),!0}import{Editor as Gh}from"slate";function qh(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Qh(e,t){let[o]=Gh.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function Es(e){return{convertHeading:f(qh,e),isHeadingActive:f(Qh,e)}}import{css as jh}from"@emotion/react";import je from"@emotion/styled";var Xe=jh`
1024
1024
  margin-top: 1em;
1025
1025
  &:first-of-type {
1026
1026
  margin-top: 0;
1027
1027
  }
1028
1028
  font-weight: bold;
1029
- `,ks=je("h1")`
1029
+ `,xs=je("h1")`
1030
1030
  ${Xe}
1031
1031
  font-size: 2.25em;
1032
1032
  letter-spacing: -0.01em;
1033
- `,Ts=je("h2")`
1033
+ `,ys=je("h2")`
1034
1034
  ${Xe}
1035
1035
  font-size: 1.5em;
1036
- `,vs=je("h3")`
1036
+ `,ks=je("h3")`
1037
1037
  ${Xe}
1038
1038
  font-size: 1.25em;
1039
- `,ws=je("h4")`
1039
+ `,vs=je("h4")`
1040
1040
  ${Xe}
1041
1041
  font-size: 1em;
1042
- `,Is=je("h5")`
1042
+ `,Ts=je("h5")`
1043
1043
  ${Xe}
1044
1044
  font-size: 1em;
1045
- `,Ms=je("h6")`
1045
+ `,ws=je("h6")`
1046
1046
  ${Xe}
1047
1047
  font-size: 1em;
1048
- `;import{jsx as Ye}from"react/jsx-runtime";var Ps=T(e=>{e.convertElement.addConvertElementType("heading"),e.heading=ys(e);let t=H({"super+1":q(e.heading.convertHeading,1,!0),"super+2":q(e.heading.convertHeading,2,!0),"super+3":q(e.heading.convertHeading,3,!0),"super+4":q(e.heading.convertHeading,4,!0),"super+5":q(e.heading.convertHeading,5,!0),"super+6":q(e.heading.convertHeading,6,!0)}),o=Ei(e,{"#":q(e.heading.convertHeading,1,!1),"##":q(e.heading.convertHeading,2,!1),"###":q(e.heading.convertHeading,3,!1),"####":q(e.heading.convertHeading,4,!1),"#####":q(e.heading.convertHeading,5,!1),"######":q(e.heading.convertHeading,6,!1)});return{name:"heading",editor:{insertBreak:f(xs,e)},editableProps:{renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="heading")switch(r.level){case 1:return Ye(ks,{...n,children:i});case 2:return Ye(Ts,{...n,children:i});case 3:return Ye(vs,{...n,children:i});case 4:return Ye(ws,{...n,children:i});case 5:return Ye(Is,{...n,children:i});case 6:return Ye(Ms,{...n,children:i});default:{let a=r.level;throw new Error(`Expected element.level to be 1-6 but got ${a}`)}}},onKeyDown:r=>!!(t(r)||o(r))}}});import{useSelected as tg}from"slate-react";import eg from"@emotion/styled";var Cs=eg("hr")`
1048
+ `;import{jsx as Ye}from"react/jsx-runtime";var Is=v(e=>{e.convertElement.addConvertElementType("heading"),e.heading=Es(e);let t=H({"super+1":q(e.heading.convertHeading,1,!0),"super+2":q(e.heading.convertHeading,2,!0),"super+3":q(e.heading.convertHeading,3,!0),"super+4":q(e.heading.convertHeading,4,!0),"super+5":q(e.heading.convertHeading,5,!0),"super+6":q(e.heading.convertHeading,6,!0)}),o=gi(e,{"#":q(e.heading.convertHeading,1,!1),"##":q(e.heading.convertHeading,2,!1),"###":q(e.heading.convertHeading,3,!1),"####":q(e.heading.convertHeading,4,!1),"#####":q(e.heading.convertHeading,5,!1),"######":q(e.heading.convertHeading,6,!1)});return{name:"heading",editor:{insertBreak:f(bs,e)},editableProps:{renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="heading")switch(r.level){case 1:return Ye(xs,{...n,children:i});case 2:return Ye(ys,{...n,children:i});case 3:return Ye(ks,{...n,children:i});case 4:return Ye(vs,{...n,children:i});case 5:return Ye(Ts,{...n,children:i});case 6:return Ye(ws,{...n,children:i});default:{let a=r.level;throw new Error(`Expected element.level to be 1-6 but got ${a}`)}}},onKeyDown:r=>!!(t(r)||o(r))}}});import{useSelected as Yh}from"slate-react";import Xh from"@emotion/styled";var Ms=Xh("hr")`
1049
1049
  position: relative;
1050
1050
  height: 1em;
1051
1051
  /* background-color: var(--hr-color); */
@@ -1075,7 +1075,7 @@
1075
1075
  outline: 2px solid var(--select-color, blue);
1076
1076
  }
1077
1077
  }
1078
- `;import{jsx as Ss,jsxs as og}from"react/jsx-runtime";function Rs({attributes:e,children:t}){let o=tg();return og("div",{...e,draggable:!0,children:[t,Ss("div",{contentEditable:!1,children:Ss(Cs,{className:o?"--selected":""})})]})}import{Editor as lr,Element as rg,Path as Ls,Transforms as io}from"slate";function ng(e){let{selection:t}=e;if(!t)return!1;let o=x(e,i=>rg.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)lr.withoutNormalizing(e,()=>{io.insertNodes(e,[r,n]),io.move(e)});else{let i=Ls.next(o[1]);lr.withoutNormalizing(e,()=>{io.insertNodes(e,[r,n],{at:i});let a=Ls.next(i);io.select(e,lr.start(e,a))})}return!0}function Bs(e){return{insertHorizontalRule:f(ng,e)}}import{jsx as ig}from"react/jsx-runtime";var Ds=T((e,t,{createPolicy:o})=>(e.horizontalRule=Bs(e),o({name:"horizontal-rule",editor:{isVoid(r){if(r.type==="horizontal-rule")return!0}},editableProps:{renderElement:r=>{if(r.element.type==="horizontal-rule")return ig(Rs,{...r})},onKeyDown:H({"super+-":e.horizontalRule.insertHorizontalRule})}})));import zs from"@emotion/styled";var $s=zs("code")`
1078
+ `;import{jsx as Ps,jsxs as Jh}from"react/jsx-runtime";function Cs({attributes:e,children:t}){let o=Yh();return Jh("div",{...e,draggable:!0,children:[t,Ps("div",{contentEditable:!1,children:Ps(Ms,{className:o?"--selected":""})})]})}import{Editor as ar,Element as Zh,Path as Ss,Transforms as ao}from"slate";function eg(e){let{selection:t}=e;if(!t)return!1;let o=x(e,i=>Zh.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)ar.withoutNormalizing(e,()=>{ao.insertNodes(e,[r,n]),ao.move(e)});else{let i=Ss.next(o[1]);ar.withoutNormalizing(e,()=>{ao.insertNodes(e,[r,n],{at:i});let a=Ss.next(i);ao.select(e,ar.start(e,a))})}return!0}function Rs(e){return{insertHorizontalRule:f(eg,e)}}import{jsx as tg}from"react/jsx-runtime";var Ls=v((e,t,{createPolicy:o})=>(e.horizontalRule=Rs(e),o({name:"horizontal-rule",editor:{isVoid(r){if(r.type==="horizontal-rule")return!0}},editableProps:{renderElement:r=>{if(r.element.type==="horizontal-rule")return tg(Cs,{...r})},onKeyDown:H({"super+-":e.horizontalRule.insertHorizontalRule})}})));import Bs from"@emotion/styled";var Ds=Bs("code")`
1079
1079
  color: var(--shade-600);
1080
1080
  background-color: var(--inline-code-bgcolor);
1081
1081
  border: 1px solid var(--inline-code-border-color);
@@ -1096,16 +1096,16 @@
1096
1096
  */
1097
1097
  font-size: 0.75em;
1098
1098
  vertical-align: baseline;
1099
- `,sr=zs("span")`
1099
+ `,lr=Bs("span")`
1100
1100
  display: inline-block;
1101
1101
  opacity: 0;
1102
1102
  width: 1px;
1103
1103
  overflow: hidden;
1104
- `;import{jsx as Ns,jsxs as ag}from"react/jsx-runtime";var Hs=T(e=>{if(!e.marksPlugin)throw new Error("InlineCodePlugin has a dependency on the MarksPlugin but the MarksPlugin has not been added or is added after the InlineCodePlugin");return e.inlineCode={toggleInlineCode:()=>e.marksPlugin.toggleMark("code")},{name:"inline-code",editableProps:{renderLeaf:({leaf:t,children:o})=>t.code?ag($s,{spellCheck:!1,children:[Ns(sr,{contentEditable:!1,children:"|"}),o,Ns(sr,{contentEditable:!1,children:"|"})]}):o,onKeyDown:H({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as vg,Transforms as wg}from"slate";function As(e,t){return e.convertElement.convertElements(o=>o.type==="ordered-list-item",o=>({type:"ordered-list-item",depth:"depth"in o?o.depth:0}),t)}function Os(e,t){return e.convertElement.convertElements(o=>o.type==="task-list-item",o=>({type:"task-list-item",checked:"checked"in o?o.checked:!1,depth:"depth"in o?o.depth:0}),t)}function Us(e,t){return e.convertElement.convertElements(o=>o.type==="unordered-list-item",o=>({type:"unordered-list-item",depth:"depth"in o?o.depth:0}),t)}var lg=2;function ao(e){let t=x(e,N);return t?t[0].depth:0}function mr(e){return Pe(e,N)?ao(e)<lg:!1}function cr(e){return Pe(e,N)?ao(e)>0:!1}function Fs(e){mr(e)&&e.list.indent()}function Vs(e){cr(e)&&e.list.outdent()}function Ks(e){return $t(e,t=>({depth:t.depth+1}),{match:N})}import{Editor as sg,Transforms as pr}from"slate";function _s(e){let t=x(e,N);if(!t)return!1;let[o,r]=t;if(sg.isEmpty(e,o))return o.depth>0?(pr.setNodes(e,{depth:o.depth-1},{at:r}),!0):(ft(e,{type:"paragraph"},r),!0);pr.splitNodes(e,{always:!0});let n=x(e,N);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&pr.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as mg}from"slate";function Ws(e){let t=Array.from(mg.nodes(e,{match:N}));for(let o of t)if(o[0].depth===0)return!0;return $t(e,o=>({depth:Math.max(0,o.depth-1)}),{match:N})}import{Transforms as cg}from"slate";function Gs(e,{at:t=e.selection}={}){let o=x(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;return cg.setNodes(e,{checked:r},{at:o[1]}),!0}function qs(e){return{indent:f(Ks,e),outdent:f(Ws,e),convertUnorderedList:f(Us,e),convertOrderedList:f(As,e),convertTaskList:f(Os,e),insertBreak:f(_s,e),toggleTaskListItem:f(Gs,e),getListDepth:f(ao,e),canIncreaseDepth:f(mr,e),canDecreaseDepth:f(cr,e),increaseDepth:f(Fs,e),decreaseDepth:f(Vs,e)}}import{Element as pg,Transforms as ug}from"slate";var Qs=zt(["ordered-list-item"]);function lo(e,t){let[o,r]=t;return pg.isElement(o)?xe(e,[o,r],(n,i)=>{if(!Qs(i[0]))return!1;let a=Qs(n[0])||N(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(ug.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function js(e,t){let[o]=t;return N(o)?lo(e,t):!1}import{clsx as fg}from"clsx";import{useEffect as hg}from"react";import{ReactEditor as gg,useSlateStatic as bg}from"slate-react";import so from"@emotion/styled";var ur=so("li")`
1104
+ `;import{jsx as zs,jsxs as og}from"react/jsx-runtime";var $s=v(e=>{if(!e.marksPlugin)throw new Error("InlineCodePlugin has a dependency on the MarksPlugin but the MarksPlugin has not been added or is added after the InlineCodePlugin");return e.inlineCode={toggleInlineCode:()=>e.marksPlugin.toggleMark("code")},{name:"inline-code",editableProps:{renderLeaf:({leaf:t,children:o})=>t.code?og(Ds,{spellCheck:!1,children:[zs(lr,{contentEditable:!1,children:"|"}),o,zs(lr,{contentEditable:!1,children:"|"})]}):o,onKeyDown:H({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as kt,Element as xg,Range as yg,Transforms as am}from"slate";function Ns(e,t){return e.convertElement.convertElements(o=>o.type==="ordered-list-item",o=>({type:"ordered-list-item",depth:"depth"in o?o.depth:0}),t)}function Hs(e,t){return e.convertElement.convertElements(o=>o.type==="task-list-item",o=>({type:"task-list-item",checked:"checked"in o?o.checked:!1,depth:"depth"in o?o.depth:0}),t)}function As(e,t){return e.convertElement.convertElements(o=>o.type==="unordered-list-item",o=>({type:"unordered-list-item",depth:"depth"in o?o.depth:0}),t)}var rg=2;function lo(e){let t=x(e,N);return t?t[0].depth:0}function sr(e){return Pe(e,N)?lo(e)<rg:!1}function mr(e){return Pe(e,N)?lo(e)>0:!1}function Os(e){sr(e)&&e.list.indent()}function Us(e){mr(e)&&e.list.outdent()}function Fs(e){return Nt(e,t=>({depth:t.depth+1}),{match:N})}import{Editor as ng,Transforms as cr}from"slate";function Vs(e){let t=x(e,N);if(!t)return!1;let[o,r]=t;if(ng.isEmpty(e,o))return o.depth>0?(cr.setNodes(e,{depth:o.depth-1},{at:r}),!0):(ft(e,{type:"paragraph"},r),!0);cr.splitNodes(e,{always:!0});let n=x(e,N);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&cr.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as ig}from"slate";function Ks(e){let t=Array.from(ig.nodes(e,{match:N}));for(let o of t)if(o[0].depth===0)return!0;return Nt(e,o=>({depth:Math.max(0,o.depth-1)}),{match:N})}import{Transforms as ag}from"slate";function _s(e,{at:t=e.selection}={}){let o=x(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;return ag.setNodes(e,{checked:r},{at:o[1]}),!0}function Ws(e){return{indent:f(Fs,e),outdent:f(Ks,e),convertUnorderedList:f(As,e),convertOrderedList:f(Ns,e),convertTaskList:f(Hs,e),insertBreak:f(Vs,e),toggleTaskListItem:f(_s,e),getListDepth:f(lo,e),canIncreaseDepth:f(sr,e),canDecreaseDepth:f(mr,e),increaseDepth:f(Os,e),decreaseDepth:f(Us,e)}}import{Element as lg,Transforms as sg}from"slate";var Gs=$t(["ordered-list-item"]);function so(e,t){let[o,r]=t;return lg.isElement(o)?xe(e,[o,r],(n,i)=>{if(!Gs(i[0]))return!1;let a=Gs(n[0])||N(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(sg.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function qs(e,t){let[o]=t;return N(o)?so(e,t):!1}import{clsx as cg}from"clsx";import{useEffect as pg}from"react";import{ReactEditor as ug,useSlateStatic as dg}from"slate-react";import mo from"@emotion/styled";var pr=mo("li")`
1105
1105
  margin-top: 0.5em;
1106
1106
  margin-bottom: 0.5em;
1107
1107
  list-style-position: outside;
1108
- `,Xs=so(ur)`
1108
+ `,Qs=mo(pr)`
1109
1109
  position: relative;
1110
1110
  list-style-type: none;
1111
1111
  .--list-item-icon {
@@ -1115,7 +1115,7 @@
1115
1115
  line-height: 1.5em;
1116
1116
  color: var(--shade-600);
1117
1117
  }
1118
- `,Ys=so(ur)`
1118
+ `,js=mo(pr)`
1119
1119
  position: relative;
1120
1120
  list-style-type: none;
1121
1121
  counter-increment: var(--list-item-var);
@@ -1140,7 +1140,7 @@
1140
1140
  /* force numbers to be monospaced for better alignment */
1141
1141
  font-variant-numeric: tabular-nums;
1142
1142
  }
1143
- `,Js=so(ur)`
1143
+ `,Xs=mo(pr)`
1144
1144
  position: relative;
1145
1145
  list-style-type: none;
1146
1146
  .--list-item-icon {
@@ -1154,7 +1154,7 @@
1154
1154
  stroke-width: 3px;
1155
1155
  }
1156
1156
  }
1157
- `;import{jsx as Eg}from"react/jsx-runtime";function Zs({element:e,attributes:t,children:o}){let r=bg();hg(()=>{let a=gg.findPath(r,e);lo(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=fg({"--first-at-depth":e.__firstAtDepth});return Eg(Ys,{...t,className:i,style:n,children:o})}import{useCallback as xg}from"react";import{useSlateStatic as yg}from"slate-react";import{jsx as Le,jsxs as rm}from"react/jsx-runtime";var em=e=>rm("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Le("path",{d:"M0 0h24v24H0z",stroke:"none"}),Le("rect",{x:4,y:4,width:16,height:16,rx:2})]}),tm=e=>rm("svg",{xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-checkbox",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Le("path",{d:"M0 0h24v24H0z",stroke:"none"}),Le("path",{d:"m9 11 3 3 8-8",className:"--checkmark"}),Le("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),om=e=>Le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",...e,children:Le("path",{d:"M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z"})});import{jsx as dr,jsxs as kg}from"react/jsx-runtime";function nm({element:e,attributes:t,children:o}){let r=yg(),n=xg(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return kg(Js,{...t,style:{marginLeft:i},children:[dr("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?dr(tm,{onClick:n,style:{cursor:"pointer"}}):dr(em,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as im,jsxs as Tg}from"react/jsx-runtime";function am({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return Tg(Xs,{...t,style:{marginLeft:r},children:[im("div",{className:"--list-item-icon",contentEditable:!1,children:im(om,{})}),o]})}import{jsx as fr}from"react/jsx-runtime";function lm({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return fr(Zs,{element:e,attributes:t,children:o});case"unordered-list-item":return fr(am,{element:e,attributes:t,children:o});case"task-list-item":return fr(nm,{element:e,attributes:t,children:o})}}var sm=["unordered-list-item","ordered-list-item","task-list-item"],N=zt(sm),mm=T((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(sm);let r=e.list=qs(e),n=H({tab:r.indent,"shift+tab":r.outdent,"super+7":f(r.convertOrderedList,!0),"super+8":f(r.convertUnorderedList,!0),"super+9":f(r.convertTaskList,!0)});return o({name:"list",editor:{normalizeNode:i=>js(e,i),insertBreak:r.insertBreak,deleteBackward:i=>{if(i!=="character"||!Pe(e,N))return!1;let a=x(e,N);if(!a)return!1;let[l,m]=a;return l.depth>0?(wg.setNodes(e,{depth:l.depth-1},{at:m}),!0):(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:lm,onKeyDown(i){return vg.nodes(e,{match:N})?n(i):!1}}})});import{clsx as Rg}from"clsx";import{Editor as hr,Range as Lg}from"slate";import{Editor as Ig,Text as cm,Transforms as Mg}from"slate";function pm(e,{at:t=e.selection}={}){if(t==null)return;let o=[...Ig.nodes(e,{match:n=>cm.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);Mg.setNodes(e,r,{match:n=>cm.isText(n),split:!0,at:t})}import{Editor as Be,Point as Pg,Range as Cg}from"slate";function De(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=Cg.isRange(r)?r.focus:r,i=Pg.isPoint(n)&&(Be.after(e,n)===null||Be.isEnd(e,n,Be.end(e,[]))),a=t,m=(Be.marks(e)||{})[a]===!0;if(i)if(!m)e.activeMarks={...e.activeMarks,[a]:!0};else{let{[a]:s,...c}=e.activeMarks||{};e.activeMarks=c}m?Be.removeMark(e,a):Be.addMark(e,a,!0),typeof o=="string"&&Be.removeMark(e,o)}function um(e){return{removeMarks:f(pm,e),toggleMark:f(De,e),toggleBold:()=>De(e,"bold"),toggleItalic:()=>De(e,"italic"),toggleUnderline:()=>De(e,"underline"),toggleStrike:()=>De(e,"strike"),toggleHighlight:()=>De(e,"highlight")}}import Sg from"@emotion/styled";var dm=Sg("span")`
1157
+ `;import{jsx as fg}from"react/jsx-runtime";function Ys({element:e,attributes:t,children:o}){let r=dg();pg(()=>{let a=ug.findPath(r,e);so(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=cg({"--first-at-depth":e.__firstAtDepth});return fg(js,{...t,className:i,style:n,children:o})}import{useCallback as hg}from"react";import{useSlateStatic as gg}from"slate-react";import{jsx as Le,jsxs as tm}from"react/jsx-runtime";var Js=e=>tm("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Le("path",{d:"M0 0h24v24H0z",stroke:"none"}),Le("rect",{x:4,y:4,width:16,height:16,rx:2})]}),Zs=e=>tm("svg",{xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-checkbox",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Le("path",{d:"M0 0h24v24H0z",stroke:"none"}),Le("path",{d:"m9 11 3 3 8-8",className:"--checkmark"}),Le("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),em=e=>Le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",...e,children:Le("path",{d:"M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z"})});import{jsx as ur,jsxs as bg}from"react/jsx-runtime";function om({element:e,attributes:t,children:o}){let r=gg(),n=hg(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return bg(Xs,{...t,style:{marginLeft:i},children:[ur("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?ur(Zs,{onClick:n,style:{cursor:"pointer"}}):ur(Js,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as rm,jsxs as Eg}from"react/jsx-runtime";function nm({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return Eg(Qs,{...t,style:{marginLeft:r},children:[rm("div",{className:"--list-item-icon",contentEditable:!1,children:rm(em,{})}),o]})}import{jsx as dr}from"react/jsx-runtime";function im({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return dr(Ys,{element:e,attributes:t,children:o});case"unordered-list-item":return dr(nm,{element:e,attributes:t,children:o});case"task-list-item":return dr(om,{element:e,attributes:t,children:o})}}var lm=["unordered-list-item","ordered-list-item","task-list-item"],N=$t(lm);function kg(e,t){if(t!==" "||!e.selection||!yg.isCollapsed(e.selection))return!1;let[o]=Array.from(kt.nodes(e,{match:s=>xg.isElement(s)&&s.type==="paragraph",mode:"lowest"}));if(!o)return!1;let[,r]=o,i={anchor:kt.start(e,r),focus:e.selection.anchor},a=kt.string(e,i),l=/^-\s+\[([ xX])\]$/.exec(a);return l?(kt.withoutNormalizing(e,()=>{am.delete(e,{at:i}),e.convertElement.convertElements(s=>s.type==="task-list-item",s=>({type:"task-list-item",checked:l[1].toLowerCase()==="x",depth:"depth"in s&&typeof s.depth=="number"?s.depth:0}),!1)}),!0):!1}var sm=v((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(lm);let r=e.list=Ws(e),n=H({tab:r.indent,"shift+tab":r.outdent,"super+7":f(r.convertOrderedList,!0),"super+8":f(r.convertUnorderedList,!0),"super+9":f(r.convertTaskList,!0)});return o({name:"list",editor:{normalizeNode:i=>qs(e,i),insertText:i=>kg(e,i),insertBreak:r.insertBreak,deleteBackward:i=>{if(i!=="character"||!Pe(e,N))return!1;let a=x(e,N);if(!a)return!1;let[l,s]=a;return l.depth>0?(am.setNodes(e,{depth:l.depth-1},{at:s}),!0):(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:im,onKeyDown(i){return kt.nodes(e,{match:N})?n(i):!1}}})});import{clsx as Pg}from"clsx";import{Editor as fr,Range as Cg}from"slate";import{Editor as vg,Text as mm,Transforms as Tg}from"slate";function cm(e,{at:t=e.selection}={}){if(t==null)return;let o=[...vg.nodes(e,{match:n=>mm.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);Tg.setNodes(e,r,{match:n=>mm.isText(n),split:!0,at:t})}import{Editor as Be,Point as wg,Range as Ig}from"slate";function De(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=Ig.isRange(r)?r.focus:r,i=wg.isPoint(n)&&(Be.after(e,n)===null||Be.isEnd(e,n,Be.end(e,[]))),a=t,s=(Be.marks(e)||{})[a]===!0;if(i)if(!s)e.activeMarks={...e.activeMarks,[a]:!0};else{let{[a]:m,...c}=e.activeMarks||{};e.activeMarks=c}s?Be.removeMark(e,a):Be.addMark(e,a,!0),typeof o=="string"&&Be.removeMark(e,o)}function pm(e){return{removeMarks:f(cm,e),toggleMark:f(De,e),toggleBold:()=>De(e,"bold"),toggleItalic:()=>De(e,"italic"),toggleUnderline:()=>De(e,"underline"),toggleStrike:()=>De(e,"strike"),toggleHighlight:()=>De(e,"highlight")}}import Mg from"@emotion/styled";var um=Mg("span")`
1158
1158
  &.--bold {
1159
1159
  font-weight: bold;
1160
1160
  }
@@ -1177,7 +1177,7 @@
1177
1177
  &.--highlight {
1178
1178
  background-color: #ffff00;
1179
1179
  }
1180
- `;import{jsx as Bg}from"react/jsx-runtime";var fm=T(e=>{e.marksPlugin=um(e),e.activeMarks={};let t=H({"mod+b":e.marksPlugin.toggleBold,"mod+i":e.marksPlugin.toggleItalic,"mod+u":e.marksPlugin.toggleUnderline,"super+0":e.marksPlugin.removeMarks,"super+k":e.marksPlugin.toggleStrike,"mod+h":e.marksPlugin.toggleHighlight}),{insertText:o}=e;e.insertText=n=>{if(e.activeMarks&&Object.keys(e.activeMarks).length>0){let{activeMarks:i}=e;Object.entries(i).forEach(([a,l])=>{l&&e.addMark(a,!0)})}o(n)};let{removeMarks:r}=e.marksPlugin;return e.marksPlugin.removeMarks=()=>{if(r(),e.selection&&Lg.isRange(e.selection)){let n=e.selection.focus;(hr.after(e,n)===null||hr.isEnd(e,n,hr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>Bg(dm,{className:Rg({"--bold":n.bold,"--italic":n.italic,"--underline":n.underline,"--strike":n.strike,"--highlight":n.highlight}),children:i}),onKeyDown:n=>!!t(n)}}});import{Editor as kt,Point as hm}from"slate";function gm(e){if(!e.selection)return;let t=kt.parent(e,e.selection);ki(e,t[1])}var bm=T(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=kt.parent(e,e.selection);return hm.equals(kt.start(e,t[1]),e.selection.anchor)?function(){gm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=kt.parent(e,e.selection);return hm.equals(kt.end(e,t[1]),e.selection.anchor)?function(){gm(e)}:!1}},editableProps:{}}));import{Element as xb}from"slate";import{Editor as xm,Path as $g,Transforms as ym}from"slate";import{Editor as Dg,Path as zg}from"slate";function Em(e,t,o){let r=[...Dg.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=Ue(e,o,{at:i});for(let s of r){let c=Ue(e,o,{at:s});if(l&&c&&zg.equals(l,c)||l==null&&c==null)a=s;else{let u={anchor:i,focus:a};n.push(u),i=a=s,l=c}}let m={anchor:i,focus:a};return n.push(m),n.reverse(),n}function km(e,t){if(e.selection==null)return!1;let[o,r]=xm.edges(e,e.selection),n=Ue(e,t,{at:o}),i=Ue(e,t,{at:r});if(!n&&!i||n&&i&&$g.equals(n,i))return!1;let a=Em(e,e.selection,t);return xm.withoutNormalizing(e,()=>{for(let l of a)ym.delete(e,{at:l});ym.collapse(e,{edge:"start"})}),!0}import{Transforms as Jg}from"slate";function z(e,{at:t=e.selection}={}){if(t==null)return;let o=x(e,"table-cell",{at:t});if(!o)return;let r=x(e,"table-row",{at:t});if(!r)return;let n=x(e,"table",{at:t});if(!n)return;let[i,a]=n,[l,m]=r,[s,c]=o;return{tableElement:i,tablePath:a,tableColumns:i.columns,rowElement:l,rowPath:m,rowIndex:m.slice(-1)[0],rowCount:i.children.length,cellElement:s,cellPath:c,cellIndex:c.slice(-1)[0],cellCount:l.children.length}}import{Editor as Ng,Transforms as Tm}from"slate";function Je(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function vm(e,{offset:t=0,at:o=e.selection}={}){let r=z(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return Ng.withoutNormalizing(e,()=>{let{columns:m}=n,s=[...m],c=Math.min(l,m.length-1);s.splice(l,0,m[c]),Tm.setNodes(e,{columns:s},{at:i}),n.children.forEach((u,p)=>{Tm.insertNodes(e,Je(l),{at:[...i,p,l]})})}),!0}import{Transforms as Hg}from"slate";function Ag(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Je(t))}}function gr(e,{at:t=e.selection,offset:o=0}={}){let r=z(e,{at:t});if(!r)return!1;let n=Ag(r.tableElement.columns.length);return Hg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function wm(e,{at:t}={}){return gr(e,{at:t,offset:1})}import{Editor as br,Element as Og,Path as Ug,Transforms as Tt}from"slate";function Im(e){return[...Array(e).keys()]}function Fg(e){return Im(e).map(()=>({align:"left"}))}function Vg(e,t){return{type:"table",columns:Fg(e),children:Im(t).map(()=>Kg(e))}}function Kg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Je(t))}}function Mm(e,t,o,{at:r=e.selection}={}){let n=Vg(t,o);return _g(e,n,{at:r})}function _g(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Og.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;br.withoutNormalizing(e,()=>{Tt.insertNodes(e,t,{at:o}),n&&(Tt.select(e,n),Tt.move(e))})}else{let n=Ug.next(r[1]);br.withoutNormalizing(e,()=>{Tt.insertNodes(e,t,{at:n}),Tt.select(e,br.start(e,n))})}return!0}import{Path as Pm}from"slate";function Cm(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return Q(e,[...i,r+1,o]),!0;try{return Q(e,Pm.next(i)),!0}catch{return!1}}function Sm(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return Q(e,[...n,r-1,o]),!0;try{return Ii(e,Pm.previous(n)),!0}catch{return!1}}import{ReactEditor as Wg}from"slate-react";function Gg(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;try{return e.getRangeAt(0).getBoundingClientRect()}catch{return null}}function qg(e,t){return Wg.toDOMNode(e,t).getBoundingClientRect()}function Er(e,t){let o=Gg();if(!o)return!1;let r=qg(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function Rm(e){let t=z(e);return t&&setTimeout(()=>{Er(e,t.cellElement)||Cm(e,t)}),!1}function Lm(e){let t=z(e);return t&&setTimeout(()=>{Er(e,t.cellElement)||Sm(e,t)}),!1}import{Editor as Bm,Transforms as xr}from"slate";import{Transforms as Qg}from"slate";function Ze(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(Qg.removeNodes(e,{at:t.tablePath}),!0)}function Dm(e,{at:t=e.selection}={}){let o=z(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return Ze(e);Bm.withoutNormalizing(e,()=>{let m=[...r.columns];m.splice(a,1),xr.setNodes(e,{columns:m},{at:n}),r.children.forEach((c,u)=>{xr.removeNodes(e,{at:[...n,u,a]})});let s=Bm.start(e,[...n,i,Math.min(a,l-2)]);xr.select(e,s)})}import{Editor as zm,Transforms as $m}from"slate";function Nm(e,{at:t=e.selection}={}){let o=z(e,{at:t});return o===void 0?!1:o.rowCount===1?(Ze(e),!0):(zm.withoutNormalizing(e,()=>{$m.removeNodes(e,{at:o.rowPath}),$m.select(e,zm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as jg}from"slate";function Hm(e,t){let o=z(e);if(o===void 0)return!1;let{tableElement:r,tablePath:n,cellIndex:i}=o,a=r.columns.slice();return a.splice(i,1,{align:t.align}),jg.setNodes(e,{columns:a},{at:n}),!0}import{Path as Xg,Transforms as Yg}from"slate";function Am(e){let t=z(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return Q(e,[...a,n,o+1]),!0;if(n<i-1)return Q(e,[...a,n+1,0]),!0;let l=Xg.next(a);return Yg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),Q(e,l),!0}function Om(e){let t=z(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return Q(e,[...i,n,o-1]),!0;if(n>0)return Q(e,[...i,n-1,r-1]),!0}function Um(e){let t=z(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(Q(e,[...a,n,o+1]),!0):n<i-1?(Q(e,[...a,n+1,0]),!0):(wm(e),Q(e,[...a,n+1,0]),!0)}function Fm(e){return{getTableInfo:f(z,e),insertTable:f(Mm,e),insertColumn:f(vm,e),insertRow:f(gr,e),removeTable:f(Ze,e),removeColumn:f(Dm,e),removeRow:f(Nm,e),tabForward:f(Am,e),tabBackward:f(Om,e),shiftEnterForward:f(Um,e),selectCell:f(Zg,e),down:f(Rm,e),up:f(Lm,e),setTableColumnAlign:f(Hm,e)}}function Zg(e,{at:t=e.selection}={}){let o=z(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return Jg.select(e,r),!0}import{Transforms as eb}from"slate";function mo(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,m)=>{(l.x!==m||l.y!==i)&&(eb.setNodes(e,{x:m,y:i},{at:[...t[1],i,m]}),o=!0)})}),o}import{Editor as tb,Transforms as yr}from"slate";function Vm(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(tb.withoutNormalizing(e,()=>{yr.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)yr.mergeNodes(e,{at:[...r,n]});yr.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as rb}from"react";import{ReactEditor as nb,useSelected as ib,useSlateStatic as ab}from"slate-react";import po from"@emotion/styled";import ce from"@emotion/styled";var Km=ce("div")`
1180
+ `;import{jsx as Sg}from"react/jsx-runtime";var dm=v(e=>{e.marksPlugin=pm(e),e.activeMarks={};let t=H({"mod+b":e.marksPlugin.toggleBold,"mod+i":e.marksPlugin.toggleItalic,"mod+u":e.marksPlugin.toggleUnderline,"super+0":e.marksPlugin.removeMarks,"super+k":e.marksPlugin.toggleStrike,"mod+h":e.marksPlugin.toggleHighlight}),{insertText:o}=e;e.insertText=n=>{if(e.activeMarks&&Object.keys(e.activeMarks).length>0){let{activeMarks:i}=e;Object.entries(i).forEach(([a,l])=>{l&&e.addMark(a,!0)})}o(n)};let{removeMarks:r}=e.marksPlugin;return e.marksPlugin.removeMarks=()=>{if(r(),e.selection&&Cg.isRange(e.selection)){let n=e.selection.focus;(fr.after(e,n)===null||fr.isEnd(e,n,fr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>Sg(um,{className:Pg({"--bold":n.bold,"--italic":n.italic,"--underline":n.underline,"--strike":n.strike,"--highlight":n.highlight}),children:i}),onKeyDown:n=>!!t(n)}}});import{Editor as vt,Point as fm}from"slate";function hm(e){if(!e.selection)return;let t=vt.parent(e,e.selection);xi(e,t[1])}var gm=v(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=vt.parent(e,e.selection);return fm.equals(vt.start(e,t[1]),e.selection.anchor)?function(){hm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=vt.parent(e,e.selection);return fm.equals(vt.end(e,t[1]),e.selection.anchor)?function(){hm(e)}:!1}},editableProps:{}}));import{Element as gb}from"slate";import{Editor as Em,Path as Bg,Transforms as xm}from"slate";import{Editor as Rg,Path as Lg}from"slate";function bm(e,t,o){let r=[...Rg.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=Ue(e,o,{at:i});for(let m of r){let c=Ue(e,o,{at:m});if(l&&c&&Lg.equals(l,c)||l==null&&c==null)a=m;else{let u={anchor:i,focus:a};n.push(u),i=a=m,l=c}}let s={anchor:i,focus:a};return n.push(s),n.reverse(),n}function ym(e,t){if(e.selection==null)return!1;let[o,r]=Em.edges(e,e.selection),n=Ue(e,t,{at:o}),i=Ue(e,t,{at:r});if(!n&&!i||n&&i&&Bg.equals(n,i))return!1;let a=bm(e,e.selection,t);return Em.withoutNormalizing(e,()=>{for(let l of a)xm.delete(e,{at:l});xm.collapse(e,{edge:"start"})}),!0}import{Transforms as jg}from"slate";function z(e,{at:t=e.selection}={}){if(t==null)return;let o=x(e,"table-cell",{at:t});if(!o)return;let r=x(e,"table-row",{at:t});if(!r)return;let n=x(e,"table",{at:t});if(!n)return;let[i,a]=n,[l,s]=r,[m,c]=o;return{tableElement:i,tablePath:a,tableColumns:i.columns,rowElement:l,rowPath:s,rowIndex:s.slice(-1)[0],rowCount:i.children.length,cellElement:m,cellPath:c,cellIndex:c.slice(-1)[0],cellCount:l.children.length}}import{Editor as Dg,Transforms as km}from"slate";function Je(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function vm(e,{offset:t=0,at:o=e.selection}={}){let r=z(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return Dg.withoutNormalizing(e,()=>{let{columns:s}=n,m=[...s],c=Math.min(l,s.length-1);m.splice(l,0,s[c]),km.setNodes(e,{columns:m},{at:i}),n.children.forEach((u,p)=>{km.insertNodes(e,Je(l),{at:[...i,p,l]})})}),!0}import{Transforms as zg}from"slate";function $g(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Je(t))}}function hr(e,{at:t=e.selection,offset:o=0}={}){let r=z(e,{at:t});if(!r)return!1;let n=$g(r.tableElement.columns.length);return zg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function Tm(e,{at:t}={}){return hr(e,{at:t,offset:1})}import{Editor as gr,Element as Ng,Path as Hg,Transforms as Tt}from"slate";function wm(e){return[...Array(e).keys()]}function Ag(e){return wm(e).map(()=>({align:"left"}))}function Og(e,t){return{type:"table",columns:Ag(e),children:wm(t).map(()=>Ug(e))}}function Ug(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Je(t))}}function Im(e,t,o,{at:r=e.selection}={}){let n=Og(t,o);return Fg(e,n,{at:r})}function Fg(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Ng.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;gr.withoutNormalizing(e,()=>{Tt.insertNodes(e,t,{at:o}),n&&(Tt.select(e,n),Tt.move(e))})}else{let n=Hg.next(r[1]);gr.withoutNormalizing(e,()=>{Tt.insertNodes(e,t,{at:n}),Tt.select(e,gr.start(e,n))})}return!0}import{Path as Mm}from"slate";function Pm(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return Q(e,[...i,r+1,o]),!0;try{return Q(e,Mm.next(i)),!0}catch{return!1}}function Cm(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return Q(e,[...n,r-1,o]),!0;try{return Ti(e,Mm.previous(n)),!0}catch{return!1}}import{ReactEditor as Vg}from"slate-react";function Kg(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;try{return e.getRangeAt(0).getBoundingClientRect()}catch{return null}}function _g(e,t){return Vg.toDOMNode(e,t).getBoundingClientRect()}function br(e,t){let o=Kg();if(!o)return!1;let r=_g(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function Sm(e){let t=z(e);return t&&setTimeout(()=>{br(e,t.cellElement)||Pm(e,t)}),!1}function Rm(e){let t=z(e);return t&&setTimeout(()=>{br(e,t.cellElement)||Cm(e,t)}),!1}import{Editor as Lm,Transforms as Er}from"slate";import{Transforms as Wg}from"slate";function Ze(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(Wg.removeNodes(e,{at:t.tablePath}),!0)}function Bm(e,{at:t=e.selection}={}){let o=z(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return Ze(e);Lm.withoutNormalizing(e,()=>{let s=[...r.columns];s.splice(a,1),Er.setNodes(e,{columns:s},{at:n}),r.children.forEach((c,u)=>{Er.removeNodes(e,{at:[...n,u,a]})});let m=Lm.start(e,[...n,i,Math.min(a,l-2)]);Er.select(e,m)})}import{Editor as Dm,Transforms as zm}from"slate";function $m(e,{at:t=e.selection}={}){let o=z(e,{at:t});return o===void 0?!1:o.rowCount===1?(Ze(e),!0):(Dm.withoutNormalizing(e,()=>{zm.removeNodes(e,{at:o.rowPath}),zm.select(e,Dm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as Gg}from"slate";function Nm(e,t){let o=z(e);if(o===void 0)return!1;let{tableElement:r,tablePath:n,cellIndex:i}=o,a=r.columns.slice();return a.splice(i,1,{align:t.align}),Gg.setNodes(e,{columns:a},{at:n}),!0}import{Path as qg,Transforms as Qg}from"slate";function Hm(e){let t=z(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return Q(e,[...a,n,o+1]),!0;if(n<i-1)return Q(e,[...a,n+1,0]),!0;let l=qg.next(a);return Qg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),Q(e,l),!0}function Am(e){let t=z(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return Q(e,[...i,n,o-1]),!0;if(n>0)return Q(e,[...i,n-1,r-1]),!0}function Om(e){let t=z(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(Q(e,[...a,n,o+1]),!0):n<i-1?(Q(e,[...a,n+1,0]),!0):(Tm(e),Q(e,[...a,n+1,0]),!0)}function Um(e){return{getTableInfo:f(z,e),insertTable:f(Im,e),insertColumn:f(vm,e),insertRow:f(hr,e),removeTable:f(Ze,e),removeColumn:f(Bm,e),removeRow:f($m,e),tabForward:f(Hm,e),tabBackward:f(Am,e),shiftEnterForward:f(Om,e),selectCell:f(Xg,e),down:f(Sm,e),up:f(Rm,e),setTableColumnAlign:f(Nm,e)}}function Xg(e,{at:t=e.selection}={}){let o=z(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return jg.select(e,r),!0}import{Transforms as Yg}from"slate";function co(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,s)=>{(l.x!==s||l.y!==i)&&(Yg.setNodes(e,{x:s,y:i},{at:[...t[1],i,s]}),o=!0)})}),o}import{Editor as Jg,Transforms as xr}from"slate";function Fm(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(Jg.withoutNormalizing(e,()=>{xr.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)xr.mergeNodes(e,{at:[...r,n]});xr.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as eb}from"react";import{ReactEditor as tb,useSelected as ob,useSlateStatic as rb}from"slate-react";import uo from"@emotion/styled";import ce from"@emotion/styled";var Vm=ce("div")`
1181
1181
  position: absolute;
1182
1182
  /**
1183
1183
  * very slightly shaded
@@ -1201,7 +1201,7 @@
1201
1201
  background: rgba(0, 0, 0, 0.15);
1202
1202
  }
1203
1203
  }
1204
- `,_m=ce(Km)`
1204
+ `,Km=ce(Vm)`
1205
1205
  cursor: pointer;
1206
1206
  /**
1207
1207
  * hangs out on top
@@ -1211,7 +1211,7 @@
1211
1211
  right: 0;
1212
1212
  height: 3em;
1213
1213
  top: -3em;
1214
- `,Wm=ce(Km)`
1214
+ `,_m=ce(Vm)`
1215
1215
  /**
1216
1216
  * hangs out on left
1217
1217
  */
@@ -1219,7 +1219,7 @@
1219
1219
  bottom: -1px;
1220
1220
  width: 3em;
1221
1221
  left: -3em;
1222
- `,Gm=ce("div")`
1222
+ `,Wm=ce("div")`
1223
1223
  position: absolute;
1224
1224
  background: rgba(0, 0, 0, 0.05);
1225
1225
  border: 1px solid rgba(0, 0, 0, 0.05);
@@ -1231,7 +1231,7 @@
1231
1231
  left: 0;
1232
1232
  right: 0;
1233
1233
  bottom: 0;
1234
- `,qm=ce(Gm)`
1234
+ `,Gm=ce(Wm)`
1235
1235
  top: 50%;
1236
1236
  border-bottom: none;
1237
1237
  border-right: none;
@@ -1257,7 +1257,7 @@
1257
1257
 
1258
1258
  /* border-top-left-radius: 0.5em;
1259
1259
  border-top-right-radius: 0.5em; */
1260
- `,Qm=ce(Gm)`
1260
+ `,qm=ce(Wm)`
1261
1261
  left: 50%;
1262
1262
  border-right: none;
1263
1263
  border-bottom: none;
@@ -1283,7 +1283,7 @@
1283
1283
 
1284
1284
  /* border-top-left-radius: 0.5em;
1285
1285
  border-bottom-left-radius: 0.5em; */
1286
- `,jm=ce("div")`
1286
+ `,Qm=ce("div")`
1287
1287
  position: absolute;
1288
1288
  font-size: 1.5em;
1289
1289
  background: white;
@@ -1292,27 +1292,27 @@
1292
1292
  svg {
1293
1293
  display: block;
1294
1294
  }
1295
- `,et=ce(jm)`
1295
+ `,et=ce(Qm)`
1296
1296
  color: #c0c0c0;
1297
1297
  &:hover {
1298
1298
  color: royalblue;
1299
1299
  }
1300
- `,co=ce(jm)`
1300
+ `,po=ce(Qm)`
1301
1301
  color: #c0c0c0;
1302
1302
  &:hover {
1303
1303
  color: firebrick;
1304
1304
  }
1305
- `;var Xm=po("table")`
1305
+ `;var jm=uo("table")`
1306
1306
  border-collapse: collapse;
1307
1307
  margin: 1em 0;
1308
1308
  ${({columns:e})=>e.map((t,o)=>`td:nth-of-type(${o+1}) { text-align: ${t.align}; }`).join(`
1309
1309
  `)}
1310
- `,Ym=po("tr")`
1310
+ `,Xm=uo("tr")`
1311
1311
  position: relative;
1312
1312
  &:first-of-type {
1313
1313
  background: var(--table-head-bgcolor);
1314
1314
  }
1315
- `,Jm=po("td")`
1315
+ `,Ym=uo("td")`
1316
1316
  position: relative;
1317
1317
  border-width: 1px;
1318
1318
  border-style: solid;
@@ -1332,7 +1332,7 @@
1332
1332
  &:last-of-type {
1333
1333
  border-right-color: var(--table-border-color);
1334
1334
  }
1335
- `,Zm=po("div")`
1335
+ `,Jm=uo("div")`
1336
1336
  /**
1337
1337
  * Smaller font inside a table than outside of it
1338
1338
  */
@@ -1344,7 +1344,7 @@
1344
1344
  color: rgba(0, 0, 0, 0.6);
1345
1345
  font-size: 0.875em; /* 14px */
1346
1346
  }
1347
- `;import{createContext as ob}from"react";var uo=ob({isSelected:!1});import{jsx as kr}from"react/jsx-runtime";function ec({element:e,attributes:t,children:o}){let r=ab(),n=ib();return rb(()=>{try{let i=nb.findPath(r,e);mo(r,[e,i])}catch{}},[]),kr(uo.Provider,{value:{isSelected:n},children:kr(Xm,{...t,columns:e.columns,children:kr("tbody",{children:o})})})}import{useContext as fb}from"react";import{useSelected as hb}from"slate-react";import{useCallback as Tr,useRef as lb,useState as sb}from"react";import{useSlateStatic as mb}from"slate-react";import{jsx as ee}from"react/jsx-runtime";var tt=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm.75-11.25a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5z",clipRule:"evenodd"})}),fo=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5z",clipRule:"evenodd"})}),ho=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h16M4 18h16"})}),tc=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h10M4 18h14"})}),oc=()=>ee(y,{children:ee("path",{d:"M4 6h16M8 12h8M6 18h12"})}),rc=()=>ee(y,{children:ee("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as cb,jsx as pe,jsxs as nc}from"react/jsx-runtime";function ic({cellElement:e}){let t=mb(),o=O("column-menu"),r=lb(null),[n,i]=sb(!1),a=Tr(()=>{i(!0)},[]),l=Tr(()=>{i(!1)},[]),m=Tr(()=>{o.layer&&o.close();let s=r.current;if(s===null)return;let c=[{icon:tc,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:oc,title:"\u4E2D\u592E\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"center"})}},{icon:rc,title:"\u53F3\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"right"})}}];o.open(()=>pe(Ve,{dest:s,items:c,close:o.close}))},[]);return nc(_m,{ref:r,contentEditable:!1,onClick:m,onMouseEnter:a,onMouseLeave:l,children:[pe(qm,{className:"--tile",children:pe(ho,{})}),n?nc(cb,{children:[pe(co,{style:{top:0,left:"50%",marginLeft:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeColumn({at:e}),children:pe(fo,{})}),pe(et,{style:{left:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e}),children:pe(tt,{})}),pe(et,{style:{right:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e,offset:1}),children:pe(tt,{})})]}):null]})}import{useState as pb}from"react";import{useSlateStatic as ub}from"slate-react";import{Fragment as db,jsx as Ie,jsxs as ac}from"react/jsx-runtime";function lc({cellElement:e}){let t=ub(),[o,r]=pb(!1);return ac(Wm,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[Ie(Qm,{className:"--tile",children:Ie(ho,{})}),o?ac(db,{children:[Ie(co,{style:{top:"50%",left:"0.5em",marginTop:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeRow({at:e}),children:Ie(fo,{})}),Ie(et,{style:{top:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e}),children:Ie(tt,{})}),Ie(et,{style:{bottom:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e,offset:1}),children:Ie(tt,{})})]}):null]})}import sc from"@emotion/styled";var mc=sc("div")`
1347
+ `;import{createContext as Zg}from"react";var fo=Zg({isSelected:!1});import{jsx as yr}from"react/jsx-runtime";function Zm({element:e,attributes:t,children:o}){let r=rb(),n=ob();return eb(()=>{try{let i=tb.findPath(r,e);co(r,[e,i])}catch{}},[]),yr(fo.Provider,{value:{isSelected:n},children:yr(jm,{...t,columns:e.columns,children:yr("tbody",{children:o})})})}import{useContext as pb}from"react";import{useSelected as ub}from"slate-react";import{useCallback as kr,useRef as nb,useState as ib}from"react";import{useSlateStatic as ab}from"slate-react";import{jsx as ee}from"react/jsx-runtime";var tt=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm.75-11.25a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5z",clipRule:"evenodd"})}),ho=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5z",clipRule:"evenodd"})}),go=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h16M4 18h16"})}),ec=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h10M4 18h14"})}),tc=()=>ee(y,{children:ee("path",{d:"M4 6h16M8 12h8M6 18h12"})}),oc=()=>ee(y,{children:ee("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as lb,jsx as pe,jsxs as rc}from"react/jsx-runtime";function nc({cellElement:e}){let t=ab(),o=O("column-menu"),r=nb(null),[n,i]=ib(!1),a=kr(()=>{i(!0)},[]),l=kr(()=>{i(!1)},[]),s=kr(()=>{o.layer&&o.close();let m=r.current;if(m===null)return;let c=[{icon:ec,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:tc,title:"\u4E2D\u592E\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"center"})}},{icon:oc,title:"\u53F3\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"right"})}}];o.open(()=>pe(Ve,{dest:m,items:c,close:o.close}))},[]);return rc(Km,{ref:r,contentEditable:!1,onClick:s,onMouseEnter:a,onMouseLeave:l,children:[pe(Gm,{className:"--tile",children:pe(go,{})}),n?rc(lb,{children:[pe(po,{style:{top:0,left:"50%",marginLeft:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeColumn({at:e}),children:pe(ho,{})}),pe(et,{style:{left:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e}),children:pe(tt,{})}),pe(et,{style:{right:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e,offset:1}),children:pe(tt,{})})]}):null]})}import{useState as sb}from"react";import{useSlateStatic as mb}from"slate-react";import{Fragment as cb,jsx as Ie,jsxs as ic}from"react/jsx-runtime";function ac({cellElement:e}){let t=mb(),[o,r]=sb(!1);return ic(_m,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[Ie(qm,{className:"--tile",children:Ie(go,{})}),o?ic(cb,{children:[Ie(po,{style:{top:"50%",left:"0.5em",marginTop:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeRow({at:e}),children:Ie(ho,{})}),Ie(et,{style:{top:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e}),children:Ie(tt,{})}),Ie(et,{style:{bottom:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e,offset:1}),children:Ie(tt,{})})]}):null]})}import lc from"@emotion/styled";var sc=lc("div")`
1348
1348
  position: absolute;
1349
1349
  /**
1350
1350
  * very slightly shaded
@@ -1376,7 +1376,7 @@
1376
1376
  background: rgba(0, 0, 0, 0.15);
1377
1377
  }
1378
1378
  }
1379
- `,cc=sc("div")`
1379
+ `,mc=lc("div")`
1380
1380
  position: absolute;
1381
1381
  left: 0;
1382
1382
  top: 0;
@@ -1384,8 +1384,8 @@
1384
1384
  height: 1.5em;
1385
1385
  background: rgba(0, 0, 0, 0.05);
1386
1386
  border-radius: 50%;
1387
- `;import{jsx as pc}from"react/jsx-runtime";function uc(){return pc(mc,{contentEditable:!1,children:pc(cc,{className:"--table-menu-tile"})})}import{jsx as vr,jsxs as gb}from"react/jsx-runtime";function dc({element:e,attributes:t,children:o}){let r=fb(uo),n=hb(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return gb(Jm,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?vr(uc,{}):null,a?vr(lc,{cellElement:e}):null,l?vr(ic,{cellElement:e}):null]})}import{jsx as bb}from"react/jsx-runtime";function fc({attributes:e,children:t}){return bb(Zm,{...e,children:t})}import{jsx as Eb}from"react/jsx-runtime";function hc({attributes:e,children:t}){return Eb(Ym,{...e,children:t})}import{jsx as go}from"react/jsx-runtime";function gc({element:e,attributes:t,children:o}){switch(e.type){case"table":return go(ec,{element:e,attributes:t,children:o});case"table-row":return go(hc,{element:e,attributes:t,children:o});case"table-cell":return go(dc,{element:e,attributes:t,children:o});case"table-content":return go(fc,{element:e,attributes:t,children:o})}}var bc=T((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=Fm(e),o({name:"table",editor:{deleteBackward:()=>Pe(e,"table-cell"),deleteForward:()=>gi(e,"table-cell"),deleteFragment:()=>km(e,["table-cell"]),insertBreak:()=>x(e,"table-cell")?(e.insertText(`
1388
- `),!0):!1,isMaster(r){if(r.type==="table")return!0},normalizeNode:r=>{let[n]=r;if(!xb.isElement(n))return!1;switch(n.type){case"table":return mo(e,r);case"table-cell":return Vm(e,r)}return!1}},editableProps:{renderElement:gc,onKeyDown:H({tab:e.tablePlugin.tabForward,"shift+tab":e.tablePlugin.tabBackward,"shift+enter":e.tablePlugin.shiftEnterForward,down:e.tablePlugin.down,up:e.tablePlugin.up,"mod+a":e.tablePlugin.selectCell,"super+t":()=>e.tablePlugin.insertTable(3,2),"mod+shift+enter":()=>e.tablePlugin.insertRow({offset:0}),"mod+enter":()=>e.tablePlugin.insertRow({offset:1}),"super+[":()=>e.tablePlugin.insertColumn({offset:0}),"super+]":()=>e.tablePlugin.insertColumn({offset:1}),"super+backspace":e.tablePlugin.removeTable,"mod+backspace":e.tablePlugin.removeRow,"mod+shift+backspace":e.tablePlugin.removeColumn})}})));import{Global as vb}from"@emotion/react";import{css as yb}from"@emotion/react";var kb=`
1387
+ `;import{jsx as cc}from"react/jsx-runtime";function pc(){return cc(sc,{contentEditable:!1,children:cc(mc,{className:"--table-menu-tile"})})}import{jsx as vr,jsxs as db}from"react/jsx-runtime";function uc({element:e,attributes:t,children:o}){let r=pb(fo),n=ub(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return db(Ym,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?vr(pc,{}):null,a?vr(ac,{cellElement:e}):null,l?vr(nc,{cellElement:e}):null]})}import{jsx as fb}from"react/jsx-runtime";function dc({attributes:e,children:t}){return fb(Jm,{...e,children:t})}import{jsx as hb}from"react/jsx-runtime";function fc({attributes:e,children:t}){return hb(Xm,{...e,children:t})}import{jsx as bo}from"react/jsx-runtime";function hc({element:e,attributes:t,children:o}){switch(e.type){case"table":return bo(Zm,{element:e,attributes:t,children:o});case"table-row":return bo(fc,{element:e,attributes:t,children:o});case"table-cell":return bo(uc,{element:e,attributes:t,children:o});case"table-content":return bo(dc,{element:e,attributes:t,children:o})}}var gc=v((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=Um(e),o({name:"table",editor:{deleteBackward:()=>Pe(e,"table-cell"),deleteForward:()=>fi(e,"table-cell"),deleteFragment:()=>ym(e,["table-cell"]),insertBreak:()=>x(e,"table-cell")?(e.insertText(`
1388
+ `),!0):!1,isMaster(r){if(r.type==="table")return!0},normalizeNode:r=>{let[n]=r;if(!gb.isElement(n))return!1;switch(n.type){case"table":return co(e,r);case"table-cell":return Fm(e,r)}return!1}},editableProps:{renderElement:hc,onKeyDown:H({tab:e.tablePlugin.tabForward,"shift+tab":e.tablePlugin.tabBackward,"shift+enter":e.tablePlugin.shiftEnterForward,down:e.tablePlugin.down,up:e.tablePlugin.up,"mod+a":e.tablePlugin.selectCell,"super+t":()=>e.tablePlugin.insertTable(3,2),"mod+shift+enter":()=>e.tablePlugin.insertRow({offset:0}),"mod+enter":()=>e.tablePlugin.insertRow({offset:1}),"super+[":()=>e.tablePlugin.insertColumn({offset:0}),"super+]":()=>e.tablePlugin.insertColumn({offset:1}),"super+backspace":e.tablePlugin.removeTable,"mod+backspace":e.tablePlugin.removeRow,"mod+shift+backspace":e.tablePlugin.removeColumn})}})));import{Global as yb}from"@emotion/react";import{css as bb}from"@emotion/react";var Eb=`
1389
1389
  --blue-50: rgb(239 246 255);
1390
1390
  --blue-100: rgb(219 234 254);
1391
1391
  --blue-200: rgb(191 219 254);
@@ -1396,7 +1396,7 @@
1396
1396
  --blue-700: rgb(29 78 216);
1397
1397
  --blue-800: rgb(30 64 175);
1398
1398
  --blue-900: rgb(30 58 138);
1399
- `,Tb=`
1399
+ `,xb=`
1400
1400
  --shade-50: rgb(250 250 250);
1401
1401
  --shade-100: rgb(244 244 245);
1402
1402
  --shade-200: rgb(228 228 231);
@@ -1407,11 +1407,11 @@
1407
1407
  --shade-700: rgb(63 63 70);
1408
1408
  --shade-800: rgb(39 39 42);
1409
1409
  --shade-900: rgb(24 24 27);
1410
- `,Ec=yb`
1410
+ `,bc=bb`
1411
1411
  :root {
1412
1412
  /* Tailwind Colors */
1413
- ${kb}
1414
- ${Tb}
1413
+ ${Eb}
1414
+ ${xb}
1415
1415
  /* Select Colors */
1416
1416
  --select-color: var(--blue-400);
1417
1417
  --select-editor-color: var(--blue-200);
@@ -1433,14 +1433,14 @@
1433
1433
  /* Horizontal Rule Colors */
1434
1434
  --hr-color: var(--shade-300);
1435
1435
  }
1436
- `;import{Fragment as wb,jsx as xc,jsxs as Ib}from"react/jsx-runtime";var yc=T(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>Ib(wb,{children:[xc(vb,{styles:Ec}),xc(o,{...t})]}),editableProps:{}}));import{clsx as cE}from"clsx";import{useCallback as pE,useRef as uE}from"react";import{Editor as dE,Transforms as fE}from"slate";import{ReactEditor as hE,useFocused as gE,useSlateStatic as bE}from"slate-react";import{clsx as Mb}from"clsx";import{useCallback as wc,useRef as Pb,useState as Cb}from"react";import{ReactEditor as Sb,useSlateStatic as Rb}from"slate-react";import wr from"@emotion/styled";var kc=wr(Y)`
1436
+ `;import{Fragment as kb,jsx as Ec,jsxs as vb}from"react/jsx-runtime";var xc=v(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>vb(kb,{children:[Ec(yb,{styles:bc}),Ec(o,{...t})]}),editableProps:{}}));import{clsx as lE}from"clsx";import{useCallback as sE,useRef as mE}from"react";import{Editor as cE,Transforms as pE}from"slate";import{ReactEditor as uE,useFocused as dE,useSlateStatic as fE}from"slate-react";import{clsx as Tb}from"clsx";import{useCallback as Tc,useRef as wb,useState as Ib}from"react";import{ReactEditor as Mb,useSlateStatic as Pb}from"slate-react";import Tr from"@emotion/styled";var yc=Tr(Y)`
1437
1437
  padding: 0.5em;
1438
- `,Tc=wr("div")`
1438
+ `,kc=Tr("div")`
1439
1439
  display: grid;
1440
1440
  grid-template-columns: repeat(5, 1.75em);
1441
1441
  grid-template-rows: 1.5em;
1442
1442
  /* grid-gap: 1px; */
1443
- `,vc=wr("div")`
1443
+ `,vc=Tr("div")`
1444
1444
  background: var(--shade-100);
1445
1445
  height: 1.5em;
1446
1446
  border-radius: 0.125em;
@@ -1450,11 +1450,11 @@
1450
1450
  &.--selected {
1451
1451
  background: var(--blue-100);
1452
1452
  }
1453
- `;import{Fragment as Lb,jsx as bo,jsxs as Bb}from"react/jsx-runtime";function Ic(e){return[...Array(e).keys()]}function Mc({dest:e,close:t}){let[o,r]=Cb({x:0,y:0}),n=Rb(),i=Pb(null),a=X({src:i,dest:e},({dest:u})=>u?{left:u.left-8,top:u.top+u.height}:{left:0,top:0}),l=Ic(5).map(u=>u+1),m=Ic(5).map(u=>u+1),s=wc((u,p)=>{r({x:u,y:p})},[r]),c=wc((u,p)=>{n.tablePlugin.insertTable(u,p),Sb.focus(n),t()},[n]);return Bb(Lb,{children:[bo(ye,{close:t}),bo(kc,{ref:i,style:a,children:bo(Tc,{onMouseLeave:()=>s(0,0),children:l.map(u=>m.map(p=>{let d=p<=o.x&&u<=o.y;return bo(vc,{className:Mb({"--selected":d}),onMouseEnter:()=>s(p,u),onClick:()=>c(p,u)},`${p},${u}`)}))})})]})}import{useEffect as oE,useRef as rE,useState as nE}from"react";import{useSlateStatic as iE}from"slate-react";import{jsx as b,jsxs as ot}from"react/jsx-runtime";var Pc=()=>b(y,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),Cc=()=>b(y,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),Sc=()=>b(y,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),Rc=()=>b(y,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Lc=()=>b(y,{children:b("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Bc=()=>b(y,{children:b("path",{d:"M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})});var Dc=()=>b(y,{children:b("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),Ir=()=>b(y,{children:b("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),zc=()=>b(y,{children:b("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var Eo=()=>ot(y,{children:[b("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),b("path",{d:"M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5"})]});var Mr=()=>b(y,{children:b("path",{d:"M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5"})}),$c=()=>ot(y,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var Nc=()=>b(y,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Hc=()=>ot(y,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),Ac=()=>b(y,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),Oc=()=>b(y,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Uc=()=>ot(y,{children:[b("path",{d:"M15 8h.01"}),b("rect",{x:4,y:4,width:16,height:16,rx:3}),b("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),b("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var Fc=()=>b(y,{children:b("path",{d:"M12 5v14M5 12h14"})}),Vc=()=>b(y,{children:b("path",{d:"M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5"})}),Kc=()=>b(y,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var _c=()=>ot(y,{children:[b("path",{d:"m9 11 3 3 8-8"}),b("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),Pr=()=>b(y,{children:b("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),Wc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Gc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var qc=()=>b(y,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),Qc=()=>ot(y,{children:[b("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),b("path",{d:"M13.5 6.5l4 4"}),b("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),jc=()=>b(y,{children:b("path",{d:"M5 12h14"})});var Cr=[{icon:Wc,title:h("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Gc,title:h("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],Xc=[{icon:Dc,title:h("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:Rc,title:h("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Lc,title:h("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Bc,title:h("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Yc=[...Xc],Sr=[{icon:Pc,title:h("paragraphStyle"),more:!0,children:Xc}];import{useState as ue,useRef as Zc,useEffect as zb,useCallback as Rr}from"react";import{useSlateStatic as $b}from"slate-react";import Db from"@emotion/styled";var Jc=Db(Y)`
1453
+ `;import{Fragment as Cb,jsx as Eo,jsxs as Sb}from"react/jsx-runtime";function wc(e){return[...Array(e).keys()]}function Ic({dest:e,close:t}){let[o,r]=Ib({x:0,y:0}),n=Pb(),i=wb(null),a=X({src:i,dest:e},({dest:u})=>u?{left:u.left-8,top:u.top+u.height}:{left:0,top:0}),l=wc(5).map(u=>u+1),s=wc(5).map(u=>u+1),m=Tc((u,p)=>{r({x:u,y:p})},[r]),c=Tc((u,p)=>{n.tablePlugin.insertTable(u,p),Mb.focus(n),t()},[n]);return Sb(Cb,{children:[Eo(ye,{close:t}),Eo(yc,{ref:i,style:a,children:Eo(kc,{onMouseLeave:()=>m(0,0),children:l.map(u=>s.map(p=>{let d=p<=o.x&&u<=o.y;return Eo(vc,{className:Tb({"--selected":d}),onMouseEnter:()=>m(p,u),onClick:()=>c(p,u)},`${p},${u}`)}))})})]})}import{useEffect as Zb,useRef as eE,useState as tE}from"react";import{useSlateStatic as oE}from"slate-react";import{jsx as b,jsxs as ot}from"react/jsx-runtime";var Mc=()=>b(y,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),Pc=()=>b(y,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),Cc=()=>b(y,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),Sc=()=>b(y,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Rc=()=>b(y,{children:b("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Lc=()=>b(y,{children:b("path",{d:"M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})});var Bc=()=>b(y,{children:b("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),wr=()=>b(y,{children:b("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),Dc=()=>b(y,{children:b("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var xo=()=>ot(y,{children:[b("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),b("path",{d:"M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5"})]});var Ir=()=>b(y,{children:b("path",{d:"M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5"})}),zc=()=>ot(y,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var $c=()=>b(y,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Nc=()=>ot(y,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),Hc=()=>b(y,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),Ac=()=>b(y,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Oc=()=>ot(y,{children:[b("path",{d:"M15 8h.01"}),b("rect",{x:4,y:4,width:16,height:16,rx:3}),b("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),b("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var Uc=()=>b(y,{children:b("path",{d:"M12 5v14M5 12h14"})}),Fc=()=>b(y,{children:b("path",{d:"M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5"})}),Vc=()=>b(y,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Kc=()=>ot(y,{children:[b("path",{d:"m9 11 3 3 8-8"}),b("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),Mr=()=>b(y,{children:b("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),_c=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Wc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Gc=()=>b(y,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),qc=()=>ot(y,{children:[b("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),b("path",{d:"M13.5 6.5l4 4"}),b("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),Qc=()=>b(y,{children:b("path",{d:"M5 12h14"})});var Pr=[{icon:_c,title:h("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Wc,title:h("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],jc=[{icon:Bc,title:h("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:Sc,title:h("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Rc,title:h("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Lc,title:h("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Xc=[...jc],Cr=[{icon:Mc,title:h("paragraphStyle"),more:!0,children:jc}];import{useState as ue,useRef as Jc,useEffect as Lb,useCallback as Sr}from"react";import{useSlateStatic as Bb}from"slate-react";import Rb from"@emotion/styled";var Yc=Rb(Y)`
1454
1454
  width: 18em;
1455
1455
  padding: 0;
1456
1456
  overflow: hidden;
1457
- `;import{Fragment as Nb,jsx as A,jsxs as V}from"react/jsx-runtime";function ep({dest:e,close:t}){let o=$b(),r=Zc(null),n=Zc(null),[i,a]=ue({x:0,y:0}),l=Rr((R,F)=>{a(he=>({x:he.x+R,y:he.y+F}))},[]),m=o.wysimark?.imageDialogState,s=!!o.wysimark?.onImageChange,c=!!o.wysimark?.onFileSelect,u=m?.imageSource??(s?"file":c?"select":"url"),[p,d]=ue(m?.url??""),[g,v]=ue(m?.alt??""),[S,L]=ue(m?.title??""),[M,$]=ue(!1),[w,B]=ue(u),[I,E]=ue(!1),[k,P]=ue(m?.uploadedUrl??""),C=R=>{B(R),P(""),fe("")},[de,fe]=ue(""),Lp=Rr(R=>{let F=R.target.value;v(F),M||L(F)},[M]),Bp=Rr(R=>{L(R.target.value),$(!0)},[]);zb(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:p,alt:g,title:S,imageSource:w,uploadedUrl:k})},[o,p,g,S,w,k]);let Ur=()=>{o.wysimark&&(o.wysimark.imageDialogState=void 0)},To=X({src:r,dest:e},({src:R,dest:F},he)=>ke(R,he,{left:F.left-16,top:F.top+F.height},{margin:16})),Dp={...To,left:To.left+i.x,top:To.top+i.y};function zp(R){R.preventDefault();let F=w==="file"||w==="select"?k:p;F.trim()!==""&&(o.image.insertImageFromUrl(F,g,S),Ur(),t())}function $p(){Ur(),t()}async function Np(R){let F=R.target.files?.[0];if(!(!F||!o.wysimark?.onImageChange)){fe(F.name),E(!0);try{let he=await o.wysimark.onImageChange(F);P(he)}catch(he){}finally{E(!1)}}}function Hp(){n.current?.click()}async function Ap(){if(o.wysimark?.onFileSelect){E(!0);try{let R=await o.wysimark.onFileSelect();R&&P(R)}catch(R){}finally{E(!1)}}}let vo=w==="file"||w==="select"?k.trim()===""||I:p.trim()==="";return V(Nb,{children:[A(ye,{close:t}),V(Jc,{ref:r,style:Dp,children:[A(ve,{onDrag:l}),V("form",{onSubmit:R=>{zp(R)},style:{padding:"8px"},children:[(s||c)&&V("div",{style:{marginBottom:"12px"},children:[s&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"file",checked:w==="file",onChange:()=>C("file"),style:{marginRight:"4px"}}),h("imageSourceFile")]}),c&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"select",checked:w==="select",onChange:()=>C("select"),style:{marginRight:"4px"}}),h("imageSourceSelect")]}),V("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"url",checked:w==="url",onChange:()=>C("url"),style:{marginRight:"4px"}}),h("imageSourceUrl")]})]}),w==="url"?V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("imageUrlRequired")}),A("input",{type:"text",value:p,onChange:R=>d(R.target.value),style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:"https://example.com/image.jpg"})]}):w==="select"?V("div",{style:{marginBottom:"8px"},children:[A("button",{type:"button",onClick:()=>{Ap()},disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("imageSourceSelect")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",k.split("/").pop()]})})]}):V("div",{style:{marginBottom:"8px"},children:[A("input",{ref:n,type:"file",accept:"image/*",onChange:R=>{Np(R)},style:{display:"none"}}),A("button",{type:"button",onClick:Hp,disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("selectFile")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",de]})})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("altText")}),A("input",{type:"text",value:g,onChange:Lp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageDescription")})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("title")}),A("input",{type:"text",value:S,onChange:Bp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageTitle")})]}),V("div",{style:{display:"flex",gap:"8px"},children:[A("button",{type:"submit",disabled:vo,style:{display:"flex",alignItems:"center",padding:"8px 16px",backgroundColor:vo?"#ccc":"#0078d4",color:"white",border:"none",borderRadius:"4px",cursor:vo?"not-allowed":"pointer",fontWeight:"bold"},children:h("register")}),A("button",{type:"button",onClick:$p,style:{padding:"8px 16px",backgroundColor:"var(--shade-100)",color:"var(--shade-700)",border:"1px solid var(--shade-300)",borderRadius:"4px",cursor:"pointer"},children:h("cancel")})]})]})]})]})}import{isHotkey as Hb}from"is-hotkey";import{useCallback as xo,useMemo as Ab,useRef as Ob,useState as vt}from"react";import{Editor as Ub,Range as Fb}from"slate";import{ReactEditor as Vb,useSlateStatic as Kb}from"slate-react";import tp from"@emotion/styled";var Lr=tp("div")`
1457
+ `;import{Fragment as Db,jsx as A,jsxs as V}from"react/jsx-runtime";function Zc({dest:e,close:t}){let o=Bb(),r=Jc(null),n=Jc(null),[i,a]=ue({x:0,y:0}),l=Sr((R,F)=>{a(he=>({x:he.x+R,y:he.y+F}))},[]),s=o.wysimark?.imageDialogState,m=!!o.wysimark?.onImageChange,c=!!o.wysimark?.onFileSelect,u=s?.imageSource??(m?"file":c?"select":"url"),[p,d]=ue(s?.url??""),[g,T]=ue(s?.alt??""),[S,L]=ue(s?.title??""),[M,$]=ue(!1),[w,B]=ue(u),[I,E]=ue(!1),[k,P]=ue(s?.uploadedUrl??""),C=R=>{B(R),P(""),fe("")},[de,fe]=ue(""),Rp=Sr(R=>{let F=R.target.value;T(F),M||L(F)},[M]),Lp=Sr(R=>{L(R.target.value),$(!0)},[]);Lb(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:p,alt:g,title:S,imageSource:w,uploadedUrl:k})},[o,p,g,S,w,k]);let Or=()=>{o.wysimark&&(o.wysimark.imageDialogState=void 0)},To=X({src:r,dest:e},({src:R,dest:F},he)=>ke(R,he,{left:F.left-16,top:F.top+F.height},{margin:16})),Bp={...To,left:To.left+i.x,top:To.top+i.y};function Dp(R){R.preventDefault();let F=w==="file"||w==="select"?k:p;F.trim()!==""&&(o.image.insertImageFromUrl(F,g,S),Or(),t())}function zp(){Or(),t()}async function $p(R){let F=R.target.files?.[0];if(!(!F||!o.wysimark?.onImageChange)){fe(F.name),E(!0);try{let he=await o.wysimark.onImageChange(F);P(he)}catch(he){}finally{E(!1)}}}function Np(){n.current?.click()}async function Hp(){if(o.wysimark?.onFileSelect){E(!0);try{let R=await o.wysimark.onFileSelect();R&&P(R)}catch(R){}finally{E(!1)}}}let wo=w==="file"||w==="select"?k.trim()===""||I:p.trim()==="";return V(Db,{children:[A(ye,{close:t}),V(Yc,{ref:r,style:Bp,children:[A(Te,{onDrag:l}),V("form",{onSubmit:R=>{Dp(R)},style:{padding:"8px"},children:[(m||c)&&V("div",{style:{marginBottom:"12px"},children:[m&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"file",checked:w==="file",onChange:()=>C("file"),style:{marginRight:"4px"}}),h("imageSourceFile")]}),c&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"select",checked:w==="select",onChange:()=>C("select"),style:{marginRight:"4px"}}),h("imageSourceSelect")]}),V("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"url",checked:w==="url",onChange:()=>C("url"),style:{marginRight:"4px"}}),h("imageSourceUrl")]})]}),w==="url"?V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("imageUrlRequired")}),A("input",{type:"text",value:p,onChange:R=>d(R.target.value),style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:"https://example.com/image.jpg"})]}):w==="select"?V("div",{style:{marginBottom:"8px"},children:[A("button",{type:"button",onClick:()=>{Hp()},disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("imageSourceSelect")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",k.split("/").pop()]})})]}):V("div",{style:{marginBottom:"8px"},children:[A("input",{ref:n,type:"file",accept:"image/*",onChange:R=>{$p(R)},style:{display:"none"}}),A("button",{type:"button",onClick:Np,disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("selectFile")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",de]})})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("altText")}),A("input",{type:"text",value:g,onChange:Rp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageDescription")})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("title")}),A("input",{type:"text",value:S,onChange:Lp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageTitle")})]}),V("div",{style:{display:"flex",gap:"8px"},children:[A("button",{type:"submit",disabled:wo,style:{display:"flex",alignItems:"center",padding:"8px 16px",backgroundColor:wo?"#ccc":"#0078d4",color:"white",border:"none",borderRadius:"4px",cursor:wo?"not-allowed":"pointer",fontWeight:"bold"},children:h("register")}),A("button",{type:"button",onClick:zp,style:{padding:"8px 16px",backgroundColor:"var(--shade-100)",color:"var(--shade-700)",border:"1px solid var(--shade-300)",borderRadius:"4px",cursor:"pointer"},children:h("cancel")})]})]})]})]})}import{isHotkey as zb}from"is-hotkey";import{useCallback as yo,useMemo as $b,useRef as Nb,useState as wt}from"react";import{Editor as Hb,Range as Ab}from"slate";import{ReactEditor as Ob,useSlateStatic as Ub}from"slate-react";import ep from"@emotion/styled";var Rr=ep("div")`
1458
1458
  /* Center vertically and horizontally */
1459
1459
  display: flex;
1460
1460
  align-items: center;
@@ -1478,9 +1478,9 @@
1478
1478
  font-size: 1.25em;
1479
1479
  stroke-width: 2px;
1480
1480
  }
1481
- `,op=tp("div")`
1481
+ `,tp=ep("div")`
1482
1482
  font-size: 0.875em;
1483
1483
  margin-top: 0.5em;
1484
1484
  color: var(--shade-500);
1485
1485
  line-height: 1.375;
1486
- `;import{Fragment as Wb,jsx as te,jsxs as wt}from"react/jsx-runtime";var _b=Hb("enter");function rp({dest:e,close:t}){let o=Kb(),r=Ob(null),[n,i]=vt({x:0,y:0}),a=xo((E,k)=>{i(P=>({x:P.x+E,y:P.y+k}))},[]),l=X({src:r,dest:e},({src:E,dest:k},P)=>!E||!k?{left:0,top:0}:ke(E,P,{left:k.left-12,top:k.top+k.height},{margin:16})),m={...l,left:l.left+n.x,top:l.top+n.y},s=Ab(()=>{let{selection:E}=o;return E&&!Fb.isCollapsed(E)?Ub.string(o,E):""},[]),[c,u]=vt(""),[p,d]=vt(s),[g,v]=vt(s),[S,L]=vt(!1),M=()=>{let E=p.trim()||c,k=g.trim()||void 0;o.anchor.insertLink(c,E,{select:!0,title:k}),Vb.focus(o),t()},$=xo(E=>{u(E.currentTarget.value)},[u]),w=xo(E=>{let k=E.currentTarget.value;d(k),S||v(k)},[d,v,S]),B=xo(E=>{v(E.currentTarget.value),L(!0)},[v]),I=E=>{_b(E)&&(E.preventDefault(),E.stopPropagation(),M())};return wt(Wb,{children:[te(ye,{close:t}),wt(Gi,{ref:r,style:m,children:[te(ve,{onDrag:a}),wt("div",{style:{padding:"0.75em"},children:[te(Ut,{children:te(Ft,{type:"text",value:c,autoFocus:!0,placeholder:h("linkUrl"),onChange:$,onKeyDown:I})}),te(Ut,{style:{marginTop:"0.5em"},children:te(Ft,{type:"text",value:p,placeholder:h("linkText"),onChange:w,onKeyDown:I})}),wt(Ut,{style:{marginTop:"0.5em"},children:[te(Ft,{type:"text",value:g,placeholder:h("tooltipText"),onChange:B,onKeyDown:I}),wt(Lr,{onClick:M,children:[te(Eo,{}),te(Sc,{})]}),te(Lr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:te(qc,{})})]}),te(op,{children:h("tooltipHint")})]})]})]})}var Br=[{icon:Eo,title:h("insertLink"),more:!0,hotkey:"mod+k",Component:rp},{icon:Uc,title:h("insertImageFromUrl"),more:!0,Component:ep},{icon:Hc,title:h("insertTable"),more:!0,Component:Mc},{icon:jc,title:h("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],np=Br,ip=Br,ap=[{icon:Fc,title:h("insert"),more:!0,children:Br}];import{Editor as Gb}from"slate";function rt(e){let t=Gb.marks(e);return{bold:t?.bold||!1,italic:t?.italic||!1,strike:t?.strike||!1,code:t?.code||!1,underline:t?.underline||!1,highlight:t?.highlight||!1}}var lp=[{icon:Ir,title:h("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>rt(e).bold},{icon:zc,title:h("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>rt(e).italic},{icon:Vc,title:h("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>rt(e).strike},{icon:Ac,title:h("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>rt(e).code},{icon:Kc,title:h("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>rt(e).underline},{icon:Qc,title:h("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>rt(e).highlight,show:e=>!e.wysimark.disableHighlight}],Dr=lp,sp=[{icon:Ir,title:h("format"),more:!0,children:lp}];var mp=[{icon:Nc,title:h("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:Pr,title:h("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:_c,title:h("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],zr=[...mp,"divider",...Cr],cp=[{icon:Pr,title:h("list"),more:!0,children:[...mp,"divider",...Cr]}];import{Editor as pp,Path as qb,Transforms as yo}from"slate";var up=[{icon:Mr,title:h("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:$c,title:h("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:Oc,title:h("codeBlock"),action:e=>{let{selection:t}=e,o=x(e,"code-block");if(o){let[,r]=o,n=pp.string(e,r);yo.removeNodes(e,{at:r}),yo.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&!qb.equals(t.anchor.path,t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&t.anchor.offset!==t.focus.offset){let r=pp.string(e,t);yo.delete(e),yo.insertNodes(e,{type:"code-block",language:"text",children:[{type:"code-block-line",children:[{text:r}]}]});return}e.codeBlock.createCodeBlock({language:"text"})},active:e=>!!x(e,"code-block"),show:e=>!e.wysimark.disableCodeBlock}],$r=up,dp=[{icon:Mr,title:h("quote"),more:!0,children:up}];var Qb=[...Yc,"divider",...zr,"divider",...Dr,"divider",...np,"divider",...$r],jb=[...Sr,"divider",...zr,"divider",...Dr,"divider",...ip,"divider",...$r],fp=[...Sr,"divider",...cp,"divider",...sp,"divider",...ap,"divider",...dp],hp=fp;var nt=[Qb,jb,fp];import{clsx as Xb}from"clsx";import{useCallback as Nr,useRef as Yb}from"react";import{ReactEditor as Jb,useSlate as Zb,useSlateStatic as eE}from"slate-react";import{jsx as ko,jsxs as tE}from"react/jsx-runtime";function gp({item:e}){let t=eE(),o=Zb(),r=e.active?e.active(o):!1,n=Yb(null),i=J({title:e.title,hotkey:()=>e.hotkey?At(e.hotkey):void 0}),a=O("menu"),l=Nr(()=>{let c=n.current,u=e.children,p=e.Component;c&&(u?a.open(()=>ko(Ve,{dest:c,items:u,close:a.close})):p&&a.open(()=>ko(p,{dest:c,close:a.close})))},[e]),m=Nr(()=>{if(e.action){e.action(t),Jb.focus(t);return}a.layer?a.close():l()},[a.layer,e]),s=Nr(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer,l,i.onMouseEnter]);return tE(na,{"data-item-type":"button",ref:n,onMouseEnter:s,onMouseLeave:i.onMouseLeave,onClick:m,className:Xb({"--active":r&&!zo(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&zo(e?.title)?.includes("Depth")}),children:[ko(e.icon,{}),e.more?ko(Cc,{}):null]})}import{jsx as it}from"react/jsx-runtime";function aE({item:e}){let t=iE();return e==="divider"?it(oa,{"data-item-type":"divider",children:it(ra,{})}):(e.show===void 0?!0:e.show(t))?it(gp,{item:e}):null}function lE(e){let t=e.querySelector("[data-item-type=button]"),o=e.querySelector("[data-item-type=divider]");return!t||!o?null:{toolbar:e.offsetWidth,button:t.offsetWidth,divider:o.offsetWidth}}function sE(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var mE=4;function bp(){let e=rE(null),[t,o]=nE(hp);return oE(()=>{let r=e.current;if(!r)return;let n=()=>{let a=lE(r);if(a){for(let l=0;l<nt.length-1;l++)if(sE(nt[l],a.button,a.divider)<a.toolbar-mE){o(nt[l]);return}o(nt[nt.length-1])}},i=new ResizeObserver(n);return i.observe(r),()=>{i.disconnect()}},[]),it(ea,{ref:e,children:it(ta,{children:t.map((r,n)=>it(aE,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Hr,jsxs as EE}from"react/jsx-runtime";function Ep({attributes:e,Editable:t}){let o=uE(null),r=bE(),n=gE(),i=pE(a=>{a.target===a.currentTarget&&(fE.select(r,dE.end(r,[])),hE.focus(r))},[r]);return Hr(Oi,{children:EE(Xi,{ref:o,className:cE({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Hr(bp,{}),Hr(t,{as:ji,...e,style:{overflowY:"auto"}})]})})}var xp=T((e,t)=>(e.toolbar={height:t.toolbar?.height,minHeight:t.toolbar?.minHeight,maxHeight:t.toolbar?.maxHeight,showUploadButtons:t.toolbar?.showUploadButtons??!0},{name:"toolbar",editor:{},renderEditable:Ep,editableProps:{}}));import{Editor as Ar,Node as xE,Path as yE,Transforms as kE}from"slate";var yp=T(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Ar.isEditor(t[0]))return!1;let o=[e.children.length-1],r=xE.child(e,e.children.length-1);return(Ar.hasBlocks(e,r)||Ar.isVoid(e,r))&&kE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:yE.next(o)}),!0}}}));import{Transforms as TE}from"slate";function vE(e,t){let o=ge(t),r=Ee(o);TE.insertNodes(e,r)}function kp(e){return{pasteMarkdown:f(vE,e)}}var Tp=T(e=>(e.pasteMarkdown=kp(e),{name:"paste-markdown",editor:{},editableProps:{onPaste(t){let{types:o}=t.clipboardData;if(o.length!==1||o[0]!=="text/plain")return!1;let r=t.clipboardData.getData("text/plain");return e.pasteMarkdown.pasteMarkdown(r),Me(t),!0}}}));import{jsx as IE}from"react/jsx-runtime";function wE(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return IE("span",{...t,children:e.children})}var vp=T((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:wE}})));var wp=[Tp,bs,Ia,Ps,fm,Hs,Il,Xl,os,bc,Ds,yp,mm,Sa,bm,cs,yc,xp,Tl,vp];var ME=ci(wp),{withSink:Ip,SinkEditable:Mp}=ME;import{useState as PE}from"react";import{createEditor as CE,Editor as SE,Transforms as RE}from"slate";import{withHistory as LE}from"slate-history";import{withReact as BE}from"slate-react";function Or({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[m]=PE(()=>{let s=CE(),c=Ip(BE(LE(s)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return c.convertElement.addConvertElementType("paragraph"),s.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0},s.getMarkdown=()=>ct(s.children),s.setMarkdown=u=>{let p=ge(u),d=Ee(p);s.children=d,s.selection=null,RE.select(s,SE.start(s,[0]))},c});return m}import{jsx as oe,jsxs as Cp}from"react/jsx-runtime";function AE({children:e,attributes:t}){return oe("span",{...t,children:e})}function Sp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:m}){let[s,c]=Pp(!1),[u,p]=Pp(t),d=Mt(!1),g=Mt(void 0),v=Mt(void 0),S=Mt(null),L=Mt(o);L.current=o;let M=It(DE(()=>{let C=ct(e.children);e.wysimark.prevValue={markdown:C,children:e.children},L.current(C)},r,{leading:!1,trailing:!0}),[e,r]),$=It(()=>{v.current!==e.children&&(v.current=e.children,M())},[M]);if(!s){let C=S.current??t;if(S.current!==null&&(S.current=null),e.wysimark.prevValue==null||g.current==null){d.current=!0;let de=ge(C),fe=Ee(de);e.children=fe,v.current=g.current=fe,e.wysimark.prevValue={markdown:C,children:fe}}else if(C!==e.wysimark.prevValue.markdown){d.current=!0;let de=ge(C),fe=Ee(de);e.children=fe,e.selection=null,$E.select(e,zE.start(e,[0]))}}let w=It(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&NE.focus(e)},[e]),B=It(()=>{M.flush()},[M]),I=C=>{let de=C.target.value;p(de),o(de)},E=It(()=>{let C=e.getMarkdown();p(C)},[e]),k=()=>{s?(S.current=u,e.wysimark.prevValue=void 0,g.current=void 0,v.current=void 0):E(),c(!s)};e.wysimark.onImageChange=l,e.wysimark.onFileSelect=m;let P=e.wysimark.disableRawMode;return Cp("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[!P&&oe("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:oe("div",{onClick:k,style:{background:"none",border:s?"1px solid #4a90e2":"1px solid transparent",cursor:"pointer",padding:"6px",borderRadius:"4px",backgroundColor:s?"rgba(74, 144, 226, 0.1)":"transparent",boxShadow:s?"0 1px 3px rgba(0, 0, 0, 0.1)":"none",transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center"},title:s?h("switchToVisualEditor"):h("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(k(),C.preventDefault())},children:Cp("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",fill:s?"rgba(74, 144, 226, 0.05)":"transparent"}),oe("path",{d:"M7 15V9L10 12L13 9V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 9H18V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 12H18",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),oe("div",{style:{display:s?"block":"none",textAlign:"center"},children:oe("textarea",{value:at(u),onChange:I,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"1rem",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),oe("div",{style:{display:s?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:oe(HE,{editor:e,initialValue:g.current,onChange:$,children:oe(Mp,{renderLeaf:AE,onMouseDown:w,onBlur:B,placeholder:n,className:i,style:a})})})]})}import{jsx as Rp}from"react/jsx-runtime";function WE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=KE(r.initialMarkdown||""),l=VE(i),m=Or(r);l.current=i,FE(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let s=UE(c=>{l.current=c,a(c),e?.(c)},[m]);return Rp(Sp,{editor:m,value:i,className:o||"",onChange:s,placeholder:t})}function QA(e,t){let o=OE(),r=_E(e);return r.render(Rp(WE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Sp as Editable,QA as createWysimark,_r as unescapeMarkdown,Or as useEditor};
1486
+ `;import{Fragment as Vb,jsx as te,jsxs as It}from"react/jsx-runtime";var Fb=zb("enter");function op({dest:e,close:t}){let o=Ub(),r=Nb(null),[n,i]=wt({x:0,y:0}),a=yo((E,k)=>{i(P=>({x:P.x+E,y:P.y+k}))},[]),l=X({src:r,dest:e},({src:E,dest:k},P)=>!E||!k?{left:0,top:0}:ke(E,P,{left:k.left-12,top:k.top+k.height},{margin:16})),s={...l,left:l.left+n.x,top:l.top+n.y},m=$b(()=>{let{selection:E}=o;return E&&!Ab.isCollapsed(E)?Hb.string(o,E):""},[]),[c,u]=wt(""),[p,d]=wt(m),[g,T]=wt(m),[S,L]=wt(!1),M=()=>{let E=p.trim()||c,k=g.trim()||void 0;o.anchor.insertLink(c,E,{select:!0,title:k}),Ob.focus(o),t()},$=yo(E=>{u(E.currentTarget.value)},[u]),w=yo(E=>{let k=E.currentTarget.value;d(k),S||T(k)},[d,T,S]),B=yo(E=>{T(E.currentTarget.value),L(!0)},[T]),I=E=>{Fb(E)&&(E.preventDefault(),E.stopPropagation(),M())};return It(Vb,{children:[te(ye,{close:t}),It(_i,{ref:r,style:s,children:[te(Te,{onDrag:a}),It("div",{style:{padding:"0.75em"},children:[te(Ft,{children:te(Vt,{type:"text",value:c,autoFocus:!0,placeholder:h("linkUrl"),onChange:$,onKeyDown:I})}),te(Ft,{style:{marginTop:"0.5em"},children:te(Vt,{type:"text",value:p,placeholder:h("linkText"),onChange:w,onKeyDown:I})}),It(Ft,{style:{marginTop:"0.5em"},children:[te(Vt,{type:"text",value:g,placeholder:h("tooltipText"),onChange:B,onKeyDown:I}),It(Rr,{onClick:M,children:[te(xo,{}),te(Cc,{})]}),te(Rr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:te(Gc,{})})]}),te(tp,{children:h("tooltipHint")})]})]})]})}var Lr=[{icon:xo,title:h("insertLink"),more:!0,hotkey:"mod+k",Component:op},{icon:Oc,title:h("insertImageFromUrl"),more:!0,Component:Zc},{icon:Nc,title:h("insertTable"),more:!0,Component:Ic},{icon:Qc,title:h("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],rp=Lr,np=Lr,ip=[{icon:Uc,title:h("insert"),more:!0,children:Lr}];import{Editor as Kb}from"slate";function rt(e){let t=Kb.marks(e);return{bold:t?.bold||!1,italic:t?.italic||!1,strike:t?.strike||!1,code:t?.code||!1,underline:t?.underline||!1,highlight:t?.highlight||!1}}var ap=[{icon:wr,title:h("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>rt(e).bold},{icon:Dc,title:h("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>rt(e).italic},{icon:Fc,title:h("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>rt(e).strike},{icon:Hc,title:h("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>rt(e).code},{icon:Vc,title:h("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>rt(e).underline},{icon:qc,title:h("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>rt(e).highlight,show:e=>!e.wysimark.disableHighlight}],Br=ap,lp=[{icon:wr,title:h("format"),more:!0,children:ap}];var sp=[{icon:$c,title:h("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:Mr,title:h("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:Kc,title:h("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Dr=[...sp,"divider",...Pr],mp=[{icon:Mr,title:h("list"),more:!0,children:[...sp,"divider",...Pr]}];import{Editor as cp,Path as _b,Transforms as ko}from"slate";var pp=[{icon:Ir,title:h("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:zc,title:h("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:Ac,title:h("codeBlock"),action:e=>{let{selection:t}=e,o=x(e,"code-block");if(o){let[,r]=o,n=cp.string(e,r);ko.removeNodes(e,{at:r}),ko.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&!_b.equals(t.anchor.path,t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&t.anchor.offset!==t.focus.offset){let r=cp.string(e,t);ko.delete(e),ko.insertNodes(e,{type:"code-block",language:"text",children:[{type:"code-block-line",children:[{text:r}]}]});return}e.codeBlock.createCodeBlock({language:"text"})},active:e=>!!x(e,"code-block"),show:e=>!e.wysimark.disableCodeBlock}],zr=pp,up=[{icon:Ir,title:h("quote"),more:!0,children:pp}];var Wb=[...Xc,"divider",...Dr,"divider",...Br,"divider",...rp,"divider",...zr],Gb=[...Cr,"divider",...Dr,"divider",...Br,"divider",...np,"divider",...zr],dp=[...Cr,"divider",...mp,"divider",...lp,"divider",...ip,"divider",...up],fp=dp;var nt=[Wb,Gb,dp];import{clsx as qb}from"clsx";import{useCallback as $r,useRef as Qb}from"react";import{ReactEditor as jb,useSlate as Xb,useSlateStatic as Yb}from"slate-react";import{jsx as vo,jsxs as Jb}from"react/jsx-runtime";function hp({item:e}){let t=Yb(),o=Xb(),r=e.active?e.active(o):!1,n=Qb(null),i=J({title:e.title,hotkey:()=>e.hotkey?Ot(e.hotkey):void 0}),a=O("menu"),l=$r(()=>{let c=n.current,u=e.children,p=e.Component;c&&(u?a.open(()=>vo(Ve,{dest:c,items:u,close:a.close})):p&&a.open(()=>vo(p,{dest:c,close:a.close})))},[e]),s=$r(()=>{if(e.action){e.action(t),jb.focus(t);return}a.layer?a.close():l()},[a.layer,e]),m=$r(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer,l,i.onMouseEnter]);return Jb(oa,{"data-item-type":"button",ref:n,onMouseEnter:m,onMouseLeave:i.onMouseLeave,onClick:s,className:qb({"--active":r&&!Do(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Do(e?.title)?.includes("Depth")}),children:[vo(e.icon,{}),e.more?vo(Pc,{}):null]})}import{jsx as it}from"react/jsx-runtime";function rE({item:e}){let t=oE();return e==="divider"?it(ea,{"data-item-type":"divider",children:it(ta,{})}):(e.show===void 0?!0:e.show(t))?it(hp,{item:e}):null}function nE(e){let t=e.querySelector("[data-item-type=button]"),o=e.querySelector("[data-item-type=divider]");return!t||!o?null:{toolbar:e.offsetWidth,button:t.offsetWidth,divider:o.offsetWidth}}function iE(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var aE=4;function gp(){let e=eE(null),[t,o]=tE(fp);return Zb(()=>{let r=e.current;if(!r)return;let n=()=>{let a=nE(r);if(a){for(let l=0;l<nt.length-1;l++)if(iE(nt[l],a.button,a.divider)<a.toolbar-aE){o(nt[l]);return}o(nt[nt.length-1])}},i=new ResizeObserver(n);return i.observe(r),()=>{i.disconnect()}},[]),it(Ji,{ref:e,children:it(Zi,{children:t.map((r,n)=>it(rE,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Nr,jsxs as hE}from"react/jsx-runtime";function bp({attributes:e,Editable:t}){let o=mE(null),r=fE(),n=dE(),i=sE(a=>{a.target===a.currentTarget&&(pE.select(r,cE.end(r,[])),uE.focus(r))},[r]);return Nr(Hi,{children:hE(Qi,{ref:o,className:lE({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Nr(gp,{}),Nr(t,{as:qi,...e,style:{overflowY:"auto"}})]})})}var Ep=v((e,t)=>(e.toolbar={height:t.toolbar?.height,minHeight:t.toolbar?.minHeight,maxHeight:t.toolbar?.maxHeight,showUploadButtons:t.toolbar?.showUploadButtons??!0},{name:"toolbar",editor:{},renderEditable:bp,editableProps:{}}));import{Editor as Hr,Node as gE,Path as bE,Transforms as EE}from"slate";var xp=v(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Hr.isEditor(t[0]))return!1;let o=[e.children.length-1],r=gE.child(e,e.children.length-1);return(Hr.hasBlocks(e,r)||Hr.isVoid(e,r))&&EE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:bE.next(o)}),!0}}}));import{Transforms as xE}from"slate";function yE(e,t){let o=ge(t),r=Ee(o);xE.insertNodes(e,r)}function yp(e){return{pasteMarkdown:f(yE,e)}}var kp=v(e=>(e.pasteMarkdown=yp(e),{name:"paste-markdown",editor:{},editableProps:{onPaste(t){let{types:o}=t.clipboardData;if(o.length!==1||o[0]!=="text/plain")return!1;let r=t.clipboardData.getData("text/plain");return e.pasteMarkdown.pasteMarkdown(r),Me(t),!0}}}));import{jsx as vE}from"react/jsx-runtime";function kE(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return vE("span",{...t,children:e.children})}var vp=v((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:kE}})));var Tp=[kp,hs,Ta,Is,dm,$s,Tl,Ql,es,gc,Ls,xp,sm,Pa,gm,ss,xc,Ep,yl,vp];var TE=si(Tp),{withSink:wp,SinkEditable:Ip}=TE;import{useState as wE}from"react";import{createEditor as IE,Editor as ME,Transforms as PE}from"slate";import{withHistory as CE}from"slate-history";import{withReact as SE}from"slate-react";function Ar({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[s]=wE(()=>{let m=IE(),c=wp(SE(CE(m)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return c.convertElement.addConvertElementType("paragraph"),m.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0},m.getMarkdown=()=>ct(m.children),m.setMarkdown=u=>{let p=ge(u),d=Ee(p);m.children=d,m.selection=null,PE.select(m,ME.start(m,[0]))},c});return s}import{jsx as oe,jsxs as Pp}from"react/jsx-runtime";function $E({children:e,attributes:t}){return oe("span",{...t,children:e})}function Cp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:s}){let[m,c]=Mp(!1),[u,p]=Mp(t),d=Pt(!1),g=Pt(void 0),T=Pt(void 0),S=Pt(null),L=Pt(o);L.current=o;let M=Mt(RE(()=>{let C=ct(e.children);e.wysimark.prevValue={markdown:C,children:e.children},L.current(C)},r,{leading:!1,trailing:!0}),[e,r]),$=Mt(()=>{T.current!==e.children&&(T.current=e.children,M())},[M]);if(!m){let C=S.current??t;if(S.current!==null&&(S.current=null),e.wysimark.prevValue==null||g.current==null){d.current=!0;let de=ge(C),fe=Ee(de);e.children=fe,T.current=g.current=fe,e.wysimark.prevValue={markdown:C,children:fe}}else if(C!==e.wysimark.prevValue.markdown){d.current=!0;let de=ge(C),fe=Ee(de);e.children=fe,e.selection=null,BE.select(e,LE.start(e,[0]))}}let w=Mt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&DE.focus(e)},[e]),B=Mt(()=>{M.flush()},[M]),I=C=>{let de=C.target.value;p(de),o(de)},E=Mt(()=>{let C=e.getMarkdown();p(C)},[e]),k=()=>{m?(S.current=u,e.wysimark.prevValue=void 0,g.current=void 0,T.current=void 0):E(),c(!m)};e.wysimark.onImageChange=l,e.wysimark.onFileSelect=s;let P=e.wysimark.disableRawMode;return Pp("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[!P&&oe("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:oe("div",{onClick:k,style:{background:"none",border:m?"1px solid #4a90e2":"1px solid transparent",cursor:"pointer",padding:"6px",borderRadius:"4px",backgroundColor:m?"rgba(74, 144, 226, 0.1)":"transparent",boxShadow:m?"0 1px 3px rgba(0, 0, 0, 0.1)":"none",transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center"},title:m?h("switchToVisualEditor"):h("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(k(),C.preventDefault())},children:Pp("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",fill:m?"rgba(74, 144, 226, 0.05)":"transparent"}),oe("path",{d:"M7 15V9L10 12L13 9V15",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 9H18V15",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 12H18",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),oe("div",{style:{display:m?"block":"none",textAlign:"center"},children:oe("textarea",{value:at(u),onChange:I,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"1rem",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),oe("div",{style:{display:m?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:oe(zE,{editor:e,initialValue:g.current,onChange:$,children:oe(Ip,{renderLeaf:$E,onMouseDown:w,onBlur:B,placeholder:n,className:i,style:a})})})]})}import{jsx as Sp}from"react/jsx-runtime";function VE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=UE(r.initialMarkdown||""),l=OE(i),s=Ar(r);l.current=i,AE(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let m=HE(c=>{l.current=c,a(c),e?.(c)},[s]);return Sp(Cp,{editor:s,value:i,className:o||"",onChange:m,placeholder:t})}function UA(e,t){let o=NE(),r=FE(e);return r.render(Sp(VE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Cp as Editable,UA as createWysimark,Vr as unescapeMarkdown,Ar as useEditor};