wysimark-lite 0.27.5 → 0.27.7

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,4 +1,4 @@
1
- "use client";import{createRef as $x,useCallback as Dx,useImperativeHandle as zx,useRef as Nx,useState as Hx}from"react";import{createRoot as Ax}from"react-dom/client";import Cx from"lodash.throttle";import{useCallback as Zt,useRef as eo,useState as Yd}from"react";import{Editor as Px,Transforms as Sx}from"slate";import{ReactEditor as Lx,Slate as Rx}from"slate-react";import Lu from"remark-parse";import{unified as Ru}from"unified";import{gfm as ou}from"micromark-extension-gfm";import{gfmFromMarkdown as ru,gfmToMarkdown as nu}from"mdast-util-gfm";function $n(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function iu(e){if(e.enter)for(let t of Object.keys(e.enter))e.enter[t]=$n(e.enter[t]);if(e.exit)for(let t of Object.keys(e.exit))e.exit[t]=$n(e.exit[t]);return e}function Dn(){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(ou());let n=ru().map(iu);o.push(...n),r.push(nu())}}var lr="wysimark:wiki-link:",sr="wysimark:wiki-embed:",zn="\uE000WYSIMARK_ESCAPED_WIKI_OPEN\uE000",Nn="\uE000WYSIMARK_ESCAPED_WIKI_CLOSE\uE000";function Hn(e){return e.replace(/\\\[\[/g,zn).replace(/\\\]/g,Nn)}function Oe(e){return e.replace(new RegExp(zn,"g"),"[[").replace(new RegExp(Nn,"g"),"]")}function Ce(e){return`${lr}${encodeURIComponent(e)}`}function no(e){return`${sr}${encodeURIComponent(e)}`}function se(e){return e.startsWith(lr)}function Ze(e){return e.startsWith(sr)}function $t(e){return decodeURIComponent(e.slice(lr.length))}function mr(e){return decodeURIComponent(e.slice(sr.length))}function et(e){let t=e.lastIndexOf("|");return t<0?{target:e.trim()}:{target:e.slice(0,t).trim(),display:e.slice(t+1).trim()}}function io(e){return et(e).target}function ao(e){let t=e.trim(),o=t.match(/^!?\[\[([\s\S]+)\]\]$/);return et(o?o[1]:t)}function me(e){let{target:t,display:o}=et(e);if(o)return o;if(t.startsWith("##"))return t.slice(2).trim()||"Headings";if(t.startsWith("^^"))return t.slice(2).trim()||"Blocks";let r=t.indexOf("#");if(r<0)return t;let n=t.slice(0,r).trim(),i=t.slice(r+1).split("#").map(a=>a.trim()).filter(Boolean);return n?i.length===0?n:[n,...i].join(" > "):i.join(" > ")}function An(e,t){let o=$t(e),{target:r,display:n}=et(o),i=t.trim();if(n&&i===n)return`[[${r}|${n}]]`;let a=me(r);return i&&i!==a?`[[${r}|${i}]]`:`[[${r}]]`}function On(e){return`![[${mr(e)}]]`}function Pe(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=lu(s,m,n,i);let d=/(https?:\/\/[^\s]+)/g;s=s.replace(d,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 Dt(e){return e.replace(/\\\//g,"/")}function lo(e){return e.replace(/\\([\\`*_\[\]~|<])/g,"$1")}var au=new Set(["script","style"]);function lu(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 u=e.indexOf("-->",a+4);if(u===-1){n+=e.slice(a);break}let h=e.slice(a,u+3);t.push(h),n+=`${o}${t.length-1}${r}`,i=u+3;continue}if(e.startsWith("<![CDATA[",a)){let u=e.indexOf("]]>",a+9);if(u===-1){n+=e.slice(a);break}let h=e.slice(a,u+3);t.push(h),n+=`${o}${t.length-1}${r}`,i=u+3;continue}let l=cr(e,a);if(!l){n+="<",i=a+1;continue}let s=t.length,m=`${o}${s}${r}`;if(!l.name){let u=e.slice(a,l.endIndex+1);t.push(u),n+=m,i=l.endIndex+1;continue}let c=l.name.toLowerCase();if(l.isClosing||l.isSelfClosing){let u=e.slice(a,l.endIndex+1);t.push(u),n+=m,i=l.endIndex+1;continue}if(au.has(c)){let u=e.toLowerCase().indexOf(`</${c}`,l.endIndex+1);if(u!==-1){let h=cr(e,u);if(h){let k=e.slice(a,h.endIndex+1);t.push(k),n+=m,i=h.endIndex+1;continue}}}let d=mu(e,c,l.endIndex+1);if(d!==null){let u=e.slice(a,d+1);t.push(u),n+=m,i=d+1;continue}let p=e.slice(a,l.endIndex+1);t.push(p),n+=m,i=l.endIndex+1}return n}function cr(e,t){if(e[t]!=="<")return null;let o=su(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 su(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 mu(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=cr(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 Un(e,t){if(!e)throw new Error(`${t}`)}function so(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 Se(e){throw new Error(`Didn't expect to get here with value ${JSON.stringify(e,null,2)}`)}function cu(e){let t=e[0];if(!t||t.type!=="paragraph")return e;let o=t.children[0];if(!o||!("text"in o))return e;let r=o.text.match(/^(\[![A-Za-z0-9_-]+\][+-]?(?:[^\n]*))(?:\n([\s\S]*))?$/);if(!r)return e;let n=r[1],i=r[2],a={type:"paragraph",children:[{...o,text:n}]};if(!i)return[a,...e.slice(1)];let l={...t,children:[{...o,text:i},...t.children.slice(1)]};return[a,l,...e.slice(1)]}function Fn(e,t={}){return[{type:"block-quote",children:cu(tt(e.children,t))}]}function Wn(e){let t=e.value.split(`
1
+ "use client";import{createRef as Dx,useCallback as zx,useImperativeHandle as Nx,useRef as Hx,useState as Ax}from"react";import{createRoot as Ox}from"react-dom/client";import Px from"lodash.throttle";import{useCallback as Zt,useRef as eo,useState as Yd}from"react";import{Editor as Sx,Transforms as Lx}from"slate";import{ReactEditor as Rx,Slate as Bx}from"slate-react";import Lu from"remark-parse";import{unified as Ru}from"unified";import{gfm as ou}from"micromark-extension-gfm";import{gfmFromMarkdown as ru,gfmToMarkdown as nu}from"mdast-util-gfm";function $n(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function iu(e){if(e.enter)for(let t of Object.keys(e.enter))e.enter[t]=$n(e.enter[t]);if(e.exit)for(let t of Object.keys(e.exit))e.exit[t]=$n(e.exit[t]);return e}function Dn(){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(ou());let n=ru().map(iu);o.push(...n),r.push(nu())}}var lr="wysimark:wiki-link:",sr="wysimark:wiki-embed:",zn="\uE000WYSIMARK_ESCAPED_WIKI_OPEN\uE000",Nn="\uE000WYSIMARK_ESCAPED_WIKI_CLOSE\uE000";function Hn(e){return e.replace(/\\\[\[/g,zn).replace(/\\\]/g,Nn)}function Oe(e){return e.replace(new RegExp(zn,"g"),"[[").replace(new RegExp(Nn,"g"),"]")}function Ce(e){return`${lr}${encodeURIComponent(e)}`}function no(e){return`${sr}${encodeURIComponent(e)}`}function se(e){return e.startsWith(lr)}function Ze(e){return e.startsWith(sr)}function $t(e){return decodeURIComponent(e.slice(lr.length))}function mr(e){return decodeURIComponent(e.slice(sr.length))}function et(e){let t=e.lastIndexOf("|");return t<0?{target:e.trim()}:{target:e.slice(0,t).trim(),display:e.slice(t+1).trim()}}function io(e){return et(e).target}function ao(e){let t=e.trim(),o=t.match(/^!?\[\[([\s\S]+)\]\]$/);return et(o?o[1]:t)}function me(e){let{target:t,display:o}=et(e);if(o)return o;if(t.startsWith("##"))return t.slice(2).trim()||"Headings";if(t.startsWith("^^"))return t.slice(2).trim()||"Blocks";let r=t.indexOf("#");if(r<0)return t;let n=t.slice(0,r).trim(),i=t.slice(r+1).split("#").map(a=>a.trim()).filter(Boolean);return n?i.length===0?n:[n,...i].join(" > "):i.join(" > ")}function An(e,t){let o=$t(e),{target:r,display:n}=et(o),i=t.trim();if(n&&i===n)return`[[${r}|${n}]]`;let a=me(r);return i&&i!==a?`[[${r}|${i}]]`:`[[${r}]]`}function On(e){return`![[${mr(e)}]]`}function Pe(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=lu(s,m,n,i);let d=/(https?:\/\/[^\s]+)/g;s=s.replace(d,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 Dt(e){return e.replace(/\\\//g,"/")}function lo(e){return e.replace(/\\([\\`*_\[\]~|<])/g,"$1")}var au=new Set(["script","style"]);function lu(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 u=e.indexOf("-->",a+4);if(u===-1){n+=e.slice(a);break}let h=e.slice(a,u+3);t.push(h),n+=`${o}${t.length-1}${r}`,i=u+3;continue}if(e.startsWith("<![CDATA[",a)){let u=e.indexOf("]]>",a+9);if(u===-1){n+=e.slice(a);break}let h=e.slice(a,u+3);t.push(h),n+=`${o}${t.length-1}${r}`,i=u+3;continue}let l=cr(e,a);if(!l){n+="<",i=a+1;continue}let s=t.length,m=`${o}${s}${r}`;if(!l.name){let u=e.slice(a,l.endIndex+1);t.push(u),n+=m,i=l.endIndex+1;continue}let c=l.name.toLowerCase();if(l.isClosing||l.isSelfClosing){let u=e.slice(a,l.endIndex+1);t.push(u),n+=m,i=l.endIndex+1;continue}if(au.has(c)){let u=e.toLowerCase().indexOf(`</${c}`,l.endIndex+1);if(u!==-1){let h=cr(e,u);if(h){let k=e.slice(a,h.endIndex+1);t.push(k),n+=m,i=h.endIndex+1;continue}}}let d=mu(e,c,l.endIndex+1);if(d!==null){let u=e.slice(a,d+1);t.push(u),n+=m,i=d+1;continue}let p=e.slice(a,l.endIndex+1);t.push(p),n+=m,i=l.endIndex+1}return n}function cr(e,t){if(e[t]!=="<")return null;let o=su(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 su(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 mu(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=cr(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 Un(e,t){if(!e)throw new Error(`${t}`)}function so(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 Se(e){throw new Error(`Didn't expect to get here with value ${JSON.stringify(e,null,2)}`)}function cu(e){let t=e[0];if(!t||t.type!=="paragraph")return e;let o=t.children[0];if(!o||!("text"in o))return e;let r=o.text.match(/^(\[![A-Za-z0-9_-]+\][+-]?(?:[^\n]*))(?:\n([\s\S]*))?$/);if(!r)return e;let n=r[1],i=r[2],a={type:"paragraph",children:[{...o,text:n}]};if(!i)return[a,...e.slice(1)];let l={...t,children:[{...o,text:i},...t.children.slice(1)]};return[a,l,...e.slice(1)]}function Fn(e,t={}){return[{type:"block-quote",children:cu(tt(e.children,t))}]}function Wn(e){let t=e.value.split(`
2
2
  `);return[{type:"code-block",language:e.lang||"text",children:t.map(o=>({type:"code-block-line",children:[{text:o}]}))}]}function Vn(e,t={}){return[{type:"block-quote",children:[{type:"paragraph",children:[{text:`[${e.identifier}]`}]},...tt(e.children,t)]}]}import{Text as ei}from"slate";import{Text as Jn}from"slate";import*as zt from"slate";function q(e){return zt.Text.isText(e)}function ce(e){return zt.Element.isElement(e)}function A(e){return zt.Text.isText(e)&&!!e.text.match(/^\s+$/)&&!e.code}var _n={bold:"**",italic:"_",strike:"~~",highlight:"<mark>",code:""},Kn={bold:"**",italic:"_",strike:"~~",highlight:"</mark>",code:""};function pu(e){if(e in _n)return _n[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_OPEN_TOKEN lookup`)}function du(e){if(e in Kn)return Kn[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_CLOSE_TOKEN lookup`)}function Gn(e){return e.map(pu).join("")}function qn(e){return e.map(du).join("")}import{Text as uu}from"slate";function Nt(e){let{text:t,...o}=e;return Object.keys(o)}function pr(e){if(uu.isText(e)){if(A(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 Nt(e)}else{if(e.type==="anchor")return mo(e.children);throw new Error(`Unhandled type ${e.type}`)}}function mo(e){let t;for(let o of e){if(!q(o)){if(o.type==="image-inline")continue;throw new Error("Expected every segment in an anchor to be a Text segment")}if(A(o))continue;let r=Nt(o);if(t===void 0){t=r;continue}t=t.filter(n=>r.includes(n))}return t===void 0?[]:t}var Qn=["bold","italic","underline","strike","highlight","code"];function jn(e){return e.slice().sort((t,o)=>Qn.indexOf(t)-Qn.indexOf(o))}function fu(e){return/[!-/:-@\[-`{-~]/.test(e)}function rt(e){return e===""||/\s/u.test(e)}function ot(e){return e!==""&&/[\p{P}\p{S}]/u.test(e)}function hu(e){return/[a-zA-Z/?!]/.test(e)}function Xn(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=!rt(l)&&(!ot(l)||rt(a)||ot(a)),m=!rt(a)&&(!ot(a)||rt(l)||ot(l)),c=s&&(o||!m||ot(a));m&&(o||!s||ot(l))&&n.length>0&&(r.add(n.pop()),r.add(i)),c&&n.push(i)}return r}function gu(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=!rt(i);!rt(n)&&o.length>0&&(t.add(o.pop()),t.add(r)),a&&o.push(r)}return t}function bu(e,t=!1){let o=new Set,r=[];for(let n=0;n<e.length;n++)if(e[n]==="[")t&&e[n+1]==="["&&o.add(n),e[n+1]==="^"&&o.add(n),r.push(n);else if(e[n]==="]"){let i=r.pop();i!==void 0&&e[n+1]==="("&&(o.add(i),o.add(n))}return o}function Yn(e,t={}){let o=Array.from(e),r=Xn(o,"_",!1),n=Xn(o,"*",!0),i=gu(o),a=bu(o,t.enableInternalLinks),l=t.escapeBackticks??o.filter(m=>m==="`").length>=2,s="";for(let m=0;m<o.length;m++){let c=o[m],d=m+1<o.length?o[m+1]:"";c==="`"?s+=l?"\\`":c:c==="\\"?s+=fu(d)?"\\\\":"\\":c==="<"?s+=hu(d)?"\\<":"<":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 Eu(e,t){let o=Nt(e),r=Nt(t);return o.length==r.length&&o.every(n=>r.includes(n))}function Zn(e,t){let o=Jn.isText(e),r=Jn.isText(t);return t&&!r&&!o?[{text:""},e]:o?t===void 0||!r?[e]:Eu(t,e)?(t.text=[t.text,e.text].join(""),[]):[e]:[e]}function ti(e){let t=[];for(let o=0;o<e.length;o++){let r=t[t.length-1];t.push(...Zn(e[o],r))}return t.length===0&&t.push({text:""}),ei.isText(t[0])||t.unshift({text:""}),ei.isText(t[t.length-1])||t.push({text:""}),t}function oi(e){return{url:e.url,title:e.title||void 0,alt:e.alt||void 0}}var ku=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;function nt(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(ku);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 Ht(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 ri(e){let t=nt(e.url);if(!t.hostname.match(/[.]portive[.]com$/i))return;let o=t.searchParams.get("size");if(o===null)return;let r=Ht(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 ni(e){let t=nt(e.url);if(t.hash.length===0)return;let o=new URLSearchParams(t.hash.slice(1)),r=Ht(o.get("size")),n=Ht(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 ii=[ri,ni,oi];function ai(e){for(let t of ii){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 xu(e,t){if(/^<br\s*\/?>$/i.test(e))return[{text:`
3
3
  `,...t}];let o=e.match(/^<mark\b[^>]*>(.+?)<\/mark>$/is);return o?[{text:o[1],...t,highlight:!0}]:[{text:e,code:!0}]}function yu(e,t){let o=[],r=/(!)?\[\[((?:\\.|[^\]\\\n])+?)\]\]/g,n=0,i;for(;(i=r.exec(e))!==null;){let a=i.index;if(a>0&&e[a-1]==="\\")continue;a>n&&o.push({text:Oe(e.slice(n,a)),...t});let l=lo(Oe(i[2])).trim();i[1]?o.push({type:"image-inline",url:no(l),alt:l,children:[{text:""}]}):o.push({type:"anchor",href:Ce(l),children:[{text:me(l),...t}]}),n=a+i[0].length}return n===0?[{text:Oe(e),...t}]:(n<e.length&&o.push({text:Oe(e.slice(n)),...t}),o)}function J(e,t={},o={}){let r=[],n={...t};for(let a of e){if(a.type==="html"){if(/^<mark\b[^>]*>$/i.test(a.value)){n={...n,highlight:!0};continue}if(/^<\/mark>$/i.test(a.value)){let{highlight:l,...s}=n;n=s;continue}}r.push(...vu(a,n,o))}return ti(r)}function vu(e,t={},o={}){switch(e.type){case"delete":return J(e.children,{...t,strike:!0},o);case"emphasis":return J(e.children,{...t,italic:!0},o);case"footnoteReference":return[{text:`[${e.identifier}]`}];case"html":return xu(e.value,t);case"image":return ai(e);case"inlineCode":return[{text:Oe(e.value),...t,code:!0}];case"link":return[{type:"anchor",href:e.url,title:e.title==null?void 0:e.title,children:J(e.children,t,o)}];case"strong":return J(e.children,{...t,bold:!0},o);case"text":return o.enableInternalLinks?yu(e.value,t):[{text:Oe(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
4
  `}];case"footnote":throw new Error("footnote is not supported yet")}Se(e)}function li(e,t={}){return[{type:"heading",level:e.depth,children:J(e.children,{},t)}]}function si(e){return[{type:"html-block",html:e.value,children:[{text:""}]}]}function mi(e,{depth:t,ordered:o,checked:r},n={}){switch(e.type){case"paragraph":return r===!0||r===!1?[{type:"task-list-item",depth:t,checked:r,children:J(e.children,{},n)}]:o?[{type:"ordered-list-item",depth:t,children:J(e.children,{},n)}]:[{type:"unordered-list-item",depth:t,children:J(e.children,{},n)}];case"list":return co(e,t+1,n);default:return dr(e,n)}}function ci(e,t,o={}){let r=[];for(let n of e.children)r.push(...mi(n,{...t,checked:e.checked},o));return r}function co(e,t=0,o={}){let r=[];for(let n of e.children)r.push(...ci(n,{depth:t,ordered:!!e.ordered},o));return r}function Tu(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 wu="\xA0";function Iu(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==wu)}function pi(e,t={}){let o=J(e.children,{},t);return Tu(o)?[{...o[1],type:"image-block"}]:Iu(o)?[{type:"paragraph",children:[{text:""}]}]:[{type:"paragraph",children:o}]}function di(e,t={}){if(e.align==null)throw new Error("Expected an array of AlignType for table.align");return[{type:"table",columns:e.align.map(o=>({align:o||"left"})),children:e.children.map(o=>Mu(o,t))}]}function Mu(e,t){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(o=>Cu(o,t))}}function Cu(e,t){if(e.type!=="tableCell")throw new Error("Expected a tableCell");return{type:"table-cell",children:[{type:"table-content",children:J(e.children,{},t)}]}}function ui(){return[{type:"horizontal-rule",children:[{text:""}]}]}function tt(e,t={}){let o=[];for(let r=0;r<e.length;r++){if(r>0){let n=e[r-1],i=e[r];if(n.position&&i.position){let a=i.position.start.line-n.position.end.line-1;for(let l=1;l<a;l++)o.push({type:"paragraph",children:[{text:""}]})}}o.push(...dr(e[r],t))}return o}function dr(e,t={}){switch(e.type){case"blockquote":return Fn(e,t);case"code":return Wn(e);case"definition":throw new Error('The type "definition" should not exist. See comments');case"footnoteDefinition":return Vn(e,t);case"heading":return li(e,t);case"html":return si(e);case"list":return co(e,0,t);case"paragraph":return pi(e,t);case"table":return di(e,t);case"thematicBreak":return ui();case"yaml":return[]}Se(e)}import{definitions as Pu}from"mdast-util-definitions";import{SKIP as fi,visit as Su}from"unist-util-visit";function hi(e){let t=Pu(e);Su(e,(o,r,n)=>{let i=o,a=n;if(i.type==="definition"&&a!==null&&typeof r=="number")return a.children.splice(r,1),[fi,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,[fi,r]}}})}var Bu=Ru().use(Lu).use(Dn());function $u(e,t={}){let o=Bu.parse(t.enableInternalLinks?Hn(e):e);return hi(o),o}function Le(e,t={}){let o=$u(e,t);return o.children.length===0?[{type:"paragraph",children:[{text:""}]}]:tt(o.children,t)}function Du(e){return e.type==="ordered-list-item"||e.type==="unordered-list-item"||e.type==="task-list-item"}function gi(e){let t=[],o=-1;for(let r of e){if(!Du(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 bi(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 Ei(e){let t=[],o=3;for(let r of e.children){let n=bi(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(`
@@ -37,7 +37,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
37
37
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
38
38
  Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
39
39
  box-sizing: border-box;
40
- `;import{jsx as lf}from"react/jsx-runtime";var ta=e=>/[^\x00-\x7F]/.test(e);function rf(e,t){let[o]=t.getTargetRanges();if(o)try{let r=tf.toSlateRange(e,o,{exactMatch:!1,suppressThrow:!1});ea.select(e,r)}catch{}}function nf(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||!ta(r.data)?n:(rf(t,r),r.preventDefault(),ho.insertText(t,r.data),o.current=r.data,!0)}}function af(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||!ta(i.data)?n:o.current===i.data?(o.current=null,n):(ho.insertText(t,i.data),n)}}function oa(e){let t=of(),o=Zu(null),r=Yu((l,s)=>{let{selection:m}=t;if(m==null||ef.isCollapsed(m))return!1;let c=ho.fragment(t,m),d=fe(c,{enableInternalLinks:t.wysimark.enableInternalLinks}).trimEnd();return d===""?!1:(l.preventDefault(),l.clipboardData.setData("text/plain",d),l.clipboardData.setData("text/markdown",d),s.deleteSelection&&ea.delete(t),!0)},[t]);Ju(()=>{ho.normalize(t,{force:!0})},[t]);let{plugins:n}=t.sink,i=Zi(()=>({...e,decorate:_i(e.decorate,n),renderElement:Xi(e.renderElement,n),renderLeaf:Yi(e.renderLeaf,n),renderPlaceholder:Ji(e.renderPlaceholder,n),onKeyDown:Gi(e.onKeyDown,n),onKeyUp:qi(e.onKeyUp,n),onPaste:Qi(e.onPaste,n),onCopy:l=>{e.onCopy?.(l),l.defaultPrevented||r(l,{deleteSelection:!1})},onCut:l=>{e.onCut?.(l),l.defaultPrevented||r(l,{deleteSelection:!0})},onDrop:ji(e.onDrop,n),onDOMBeforeInput:nf(e.onDOMBeforeInput,t,o),onInput:af(e.onInput,t,o)}),[e.decorate,e.renderElement,e.renderLeaf,e.renderPlaceholder,e.onKeyDown,e.onKeyUp,e.onPaste,e.onCopy,e.onCut,e.onDrop,e.onDOMBeforeInput,e.onInput,e.placeholder,e.className,t,n,r]),a=Zi(()=>Ki(n),[n]);return lf(a,{...i})}function it(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],d=c?.(a);if(typeof d=="boolean")return d}return r(a)}}function xe(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 ra(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:xe(r,"normalizeNode",n),deleteBackward:xe(r,"deleteBackward",n),deleteForward:xe(r,"deleteForward",n),deleteFragment:xe(r,"deleteFragment",n),insertBreak:xe(r,"insertBreak",n),insertFragment:xe(r,"insertFragment",n),insertNode:xe(r,"insertNode",n),insertText:xe(r,"insertText",n),isInline:it(r,"isInline",n),isVoid:it(r,"isVoid",n),isMaster:it(r,"isMaster",n),isSlave:it(r,"isSlave",n),isStandalone:it(r,"isStandalone",n)}),r}}var na=e=>{let t=e.map(n=>n.fn);return{withSink:ra(t),SinkEditable:oa}};import{Element as sf}from"slate";import{ReactEditor as mf}from"slate-react";function ia(e,t){return sf.isElement(t)?mf.findPath(e,t):t}function g(e,t){return e.bind(null,t)}function ee(e,t,o){return e.bind(null,t,o)}var cf=/mac os x|macintosh/i,Ut;function go(){if(Ut!==void 0)return Ut;try{let{userAgent:e}=window.navigator;Ut=cf.test(e)}catch{Ut=!1}return Ut}function Ue(e){e.preventDefault(),e.stopPropagation()}import{Editor as sa,Path as pf}from"slate";import{Element as aa}from"slate";function la(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>aa.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>aa.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 E(e,t,{at:o=e.selection}={}){if(o===null)return;let r=ia(e,o),n=la(t);if(pf.isPath(r)){let i=sa.node(e,r);if(i&&n(i[0]))return i}return sa.above(e,{at:r,match:n})}function at(...e){return E(...e)?.[1]}import{jsx as df}from"react/jsx-runtime";var x=({strokeWidth:e=1.5,...t})=>df("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 uf}from"slate";function ye(e){return e==null?!1:uf.isCollapsed(e)}import{Element as ma}from"slate";function bo(e){return Array.isArray(e)?t=>ma.isElement(t)&&e.includes(t.type):t=>ma.isElement(t)&&e==t.type}import{Editor as ff}from"slate";function ca(e,t){let{selection:o}=e;if(!ye(o))return!1;let r=E(e,t,{at:o});return!!r&&ff.isEnd(e,o.anchor,r[1])}import{Editor as qT}from"slate";import{Editor as hf}from"slate";function Fe(e,t){let{selection:o}=e;if(!ye(o))return!1;let r=E(e,t,{at:o});return!!r&&hf.isStart(e,o.anchor,r[1])}import{isHotkey as pa}from"is-hotkey";import{Editor as kr,Element as gf,Range as bf,Transforms as Ef}from"slate";var kf=pa(" "),xf=pa("SHIFT+SPACE");function Eo(e,t){return o=>{if(!kf(o.nativeEvent)&&!xf(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||bf.isExpanded(r))return!1;let n=E(e,m=>gf.isElement(m)&&e.convertElement.isConvertibleElement(m));if(!n)return!1;let i={anchor:kr.start(e,n[1]),focus:r.focus},a=kr.string(e,i),l=t[a];if(!l)return!1;Ue(o);let s={anchor:kr.start(e,n[1]),focus:r.focus};return Ef.delete(e,{at:s}),l(),!0}}import{isHotkey as yf}from"is-hotkey";function da(e){let t=e.replace(/\bsuper\b/g,go()?"cmd+alt":"ctrl+shift");return yf(t)}function _(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[da(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 vf,Transforms as ua}from"slate";function fa(e,t){vf.withoutNormalizing(e,()=>{ua.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),ua.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as ha}from"slate";function lt(e,t,o){let[,r]=t,n=ha.previous(e,{at:r});if(n&&o(n,t))return!0;let i=ha.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as ga,Transforms as ba}from"slate";function te(e,t){ba.select(e,ga.start(e,t))}function Ea(e,t){ba.select(e,ga.end(e,t))}function ka(e,t){return typeof t!="function"?t:t(e)}import{Editor as xr,Element as Tf,Path as wf,Transforms as Ft}from"slate";function xa(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>Tf.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;xr.withoutNormalizing(e,()=>{Ft.insertNodes(e,t,{at:o}),n&&(Ft.select(e,n),Ft.move(e))})}else{let n=wf.next(r[1]);xr.withoutNormalizing(e,()=>{Ft.insertNodes(e,t,{at:n}),Ft.select(e,xr.start(e,n))})}return!0}import{Editor as ya,Transforms as va}from"slate";function Wt(e,t,o){ya.withoutNormalizing(e,()=>{let r=ya.node(e,o),n=ka(r[0],t);va.wrapNodes(e,n,{at:o}),va.unwrapNodes(e,{at:[...o,0]})})}import{Editor as If,Transforms as Mf}from"slate";function ko(e,t,o){let r=Array.from(If.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Mf.setNodes(e,t(i),{at:n[1]})}return!0}import{Editor as Cf,Path as xo,Range as yo}from"slate";import{ReactEditor as Ta,useSlate as wa}from"slate-react";function Ia(e,t){if(!e)return!1;let o=e.anchor.path,r=e.focus.path;return xo.equals(t,o)||xo.equals(t,r)||xo.isAncestor(t,o)||xo.isAncestor(t,r)}function Ma(e){let t=wa(),{selection:o}=t;if(!o)return!1;try{let r=Ta.findPath(t,e);return Ia(o,r)}catch{return!1}}function Ca(e){let t=wa(),{selection:o}=t;if(!o)return!1;try{let r=Ta.findPath(t,e);if(Ia(o,r))return!0;let n=Cf.range(t,r);return yo.includes(o,n.anchor)||yo.includes(o,n.focus)||yo.includes(n,o.anchor)||yo.includes(n,o.focus)}catch{return!1}}function Pa(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 Pf(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function Pf(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as Sf,Transforms as Sa}from"slate";function La(e,t,{at:o}){let r=E(e,"anchor",{at:o});if(!r)return!1;let[,n]=r;return Sf.withoutNormalizing(e,()=>{Sa.removeNodes(e,{at:n}),Sa.insertNodes(e,{type:"image-inline",url:no(t),alt:t,children:[{text:""}]},{at:n})}),!0}import{Editor as Ra,Transforms as st}from"slate";function Ba(e,t,{at:o}){let r=E(e,["image-inline","image-block"],{at:o});if(!r)return!1;let[n,i]=r,a=me(t),l={type:"anchor",href:Ce(t),children:[{text:a}]};if(n.type==="image-block"){let s={type:"paragraph",children:[{text:""},l,{text:""}]};Ra.withoutNormalizing(e,()=>{st.removeNodes(e,{at:i}),st.insertNodes(e,s,{at:i})});let m=[...i,1];return st.select(e,m),[l,m]}return Ra.withoutNormalizing(e,()=>{st.removeNodes(e,{at:i}),st.insertNodes(e,l,{at:i})}),st.select(e,i),[l,i]}import{Editor as Lf,Node as Rf,Transforms as yr}from"slate";function $a(e,{href:t,title:o,text:r},{at:n}){let i=E(e,"anchor",{at:n});if(!i)return!1;let[a,l]=i;if(yr.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let s=Rf.string(a);r!==s&&Lf.withoutNormalizing(e,()=>{let m=a.children.length;for(let c=m-1;c>=0;c--)yr.removeNodes(e,{at:[...l,c]});yr.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as vo,Element as Bf,Range as $f,Text as Df,Transforms as vr}from"slate";function Da(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:vo.start(e,[0]),focus:vo.start(e,[0])};if($f.isCollapsed(i)){if(vr.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=vo.node(e,e.selection);vr.select(e,a[1])}}else vr.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>Df.isText(a)||Bf.isElement(a)&&vo.isInline(e,a)})}import{Transforms as zf}from"slate";function za(e,{at:t}){let o=E(e,"anchor",{at:t});return o?(zf.unwrapNodes(e,{at:o[1]}),!0):!1}function Na(e){return{insertLink:g(Da,e),removeLink:g(za,e),editLink:g($a,e),convertToEmbed:g(La,e),convertToLink:g(Ba,e)}}import{Element as Ha,Transforms as Nf}from"slate";function Aa(e,t){if(!Ha.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(!(!Ha.isElement(n)||n.type!=="anchor"))return Nf.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Lh}from"clsx";import{useEffect as Rh,useRef as wl}from"react";import{useSelected as Bh,useSlate as $h}from"slate-react";import{createContext as Ua,useState as Af}from"react";import{createPortal as Hf}from"react-dom";function Oa({children:e}){return typeof document>"u"||!document.body?null:Hf(e,document.body)}import{jsx as Tr,jsxs as Uf}from"react/jsx-runtime";var wr=Ua({}),Of=Ua({});function Fa({children:e}){let[t,o]=Af({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return Uf(wr.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Tr(Oa,{children:Tr(Of.Provider,{value:i,children:Tr(i.Component,{})})},i.type))]})}import{useContext as Ff}from"react";function W(e){let{openLayer:t,closeLayer:o,layers:r}=Ff(wr);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import To from"@emotion/styled";var Wa=To("a")`
40
+ `;import{jsx as lf}from"react/jsx-runtime";var ta=e=>/[^\x00-\x7F]/.test(e);function rf(e,t){let[o]=t.getTargetRanges();if(o)try{let r=tf.toSlateRange(e,o,{exactMatch:!1,suppressThrow:!1});ea.select(e,r)}catch{}}function nf(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||!ta(r.data)?n:(rf(t,r),r.preventDefault(),ho.insertText(t,r.data),o.current=r.data,!0)}}function af(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||!ta(i.data)?n:o.current===i.data?(o.current=null,n):(ho.insertText(t,i.data),n)}}function oa(e){let t=of(),o=Zu(null),r=Yu((l,s)=>{let{selection:m}=t;if(m==null||ef.isCollapsed(m))return!1;let c=ho.fragment(t,m),d=fe(c,{enableInternalLinks:t.wysimark.enableInternalLinks}).trimEnd();return d===""?!1:(l.preventDefault(),l.clipboardData.setData("text/plain",d),l.clipboardData.setData("text/markdown",d),s.deleteSelection&&ea.delete(t),!0)},[t]);Ju(()=>{ho.normalize(t,{force:!0})},[t]);let{plugins:n}=t.sink,i=Zi(()=>({...e,decorate:_i(e.decorate,n),renderElement:Xi(e.renderElement,n),renderLeaf:Yi(e.renderLeaf,n),renderPlaceholder:Ji(e.renderPlaceholder,n),onKeyDown:Gi(e.onKeyDown,n),onKeyUp:qi(e.onKeyUp,n),onPaste:Qi(e.onPaste,n),onCopy:l=>{e.onCopy?.(l),l.defaultPrevented||r(l,{deleteSelection:!1})},onCut:l=>{e.onCut?.(l),l.defaultPrevented||r(l,{deleteSelection:!0})},onDrop:ji(e.onDrop,n),onDOMBeforeInput:nf(e.onDOMBeforeInput,t,o),onInput:af(e.onInput,t,o)}),[e.decorate,e.renderElement,e.renderLeaf,e.renderPlaceholder,e.onKeyDown,e.onKeyUp,e.onPaste,e.onCopy,e.onCut,e.onDrop,e.onDOMBeforeInput,e.onInput,e.placeholder,e.className,t,n,r]),a=Zi(()=>Ki(n),[n]);return lf(a,{...i})}function it(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],d=c?.(a);if(typeof d=="boolean")return d}return r(a)}}function xe(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 ra(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:xe(r,"normalizeNode",n),deleteBackward:xe(r,"deleteBackward",n),deleteForward:xe(r,"deleteForward",n),deleteFragment:xe(r,"deleteFragment",n),insertBreak:xe(r,"insertBreak",n),insertFragment:xe(r,"insertFragment",n),insertNode:xe(r,"insertNode",n),insertText:xe(r,"insertText",n),isInline:it(r,"isInline",n),isVoid:it(r,"isVoid",n),isMaster:it(r,"isMaster",n),isSlave:it(r,"isSlave",n),isStandalone:it(r,"isStandalone",n)}),r}}var na=e=>{let t=e.map(n=>n.fn);return{withSink:ra(t),SinkEditable:oa}};import{Element as sf}from"slate";import{ReactEditor as mf}from"slate-react";function ia(e,t){return sf.isElement(t)?mf.findPath(e,t):t}function g(e,t){return e.bind(null,t)}function ee(e,t,o){return e.bind(null,t,o)}var cf=/mac os x|macintosh/i,Ut;function go(){if(Ut!==void 0)return Ut;try{let{userAgent:e}=window.navigator;Ut=cf.test(e)}catch{Ut=!1}return Ut}function Ue(e){e.preventDefault(),e.stopPropagation()}import{Editor as sa,Path as pf}from"slate";import{Element as aa}from"slate";function la(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>aa.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>aa.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 b(e,t,{at:o=e.selection}={}){if(o===null)return;let r=ia(e,o),n=la(t);if(pf.isPath(r)){let i=sa.node(e,r);if(i&&n(i[0]))return i}return sa.above(e,{at:r,match:n})}function at(...e){return b(...e)?.[1]}import{jsx as df}from"react/jsx-runtime";var x=({strokeWidth:e=1.5,...t})=>df("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 uf}from"slate";function ye(e){return e==null?!1:uf.isCollapsed(e)}import{Element as ma}from"slate";function bo(e){return Array.isArray(e)?t=>ma.isElement(t)&&e.includes(t.type):t=>ma.isElement(t)&&e==t.type}import{Editor as ff}from"slate";function ca(e,t){let{selection:o}=e;if(!ye(o))return!1;let r=b(e,t,{at:o});return!!r&&ff.isEnd(e,o.anchor,r[1])}import{Editor as QT}from"slate";import{Editor as hf}from"slate";function Fe(e,t){let{selection:o}=e;if(!ye(o))return!1;let r=b(e,t,{at:o});return!!r&&hf.isStart(e,o.anchor,r[1])}import{isHotkey as pa}from"is-hotkey";import{Editor as kr,Element as gf,Range as bf,Transforms as Ef}from"slate";var kf=pa(" "),xf=pa("SHIFT+SPACE");function Eo(e,t){return o=>{if(!kf(o.nativeEvent)&&!xf(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||bf.isExpanded(r))return!1;let n=b(e,m=>gf.isElement(m)&&e.convertElement.isConvertibleElement(m));if(!n)return!1;let i={anchor:kr.start(e,n[1]),focus:r.focus},a=kr.string(e,i),l=t[a];if(!l)return!1;Ue(o);let s={anchor:kr.start(e,n[1]),focus:r.focus};return Ef.delete(e,{at:s}),l(),!0}}import{isHotkey as yf}from"is-hotkey";function da(e){let t=e.replace(/\bsuper\b/g,go()?"cmd+alt":"ctrl+shift");return yf(t)}function _(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[da(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 vf,Transforms as ua}from"slate";function fa(e,t){vf.withoutNormalizing(e,()=>{ua.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),ua.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as ha}from"slate";function lt(e,t,o){let[,r]=t,n=ha.previous(e,{at:r});if(n&&o(n,t))return!0;let i=ha.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as ga,Transforms as ba}from"slate";function te(e,t){ba.select(e,ga.start(e,t))}function Ea(e,t){ba.select(e,ga.end(e,t))}function ka(e,t){return typeof t!="function"?t:t(e)}import{Editor as xr,Element as Tf,Path as wf,Transforms as Ft}from"slate";function xa(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=b(e,n=>Tf.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;xr.withoutNormalizing(e,()=>{Ft.insertNodes(e,t,{at:o}),n&&(Ft.select(e,n),Ft.move(e))})}else{let n=wf.next(r[1]);xr.withoutNormalizing(e,()=>{Ft.insertNodes(e,t,{at:n}),Ft.select(e,xr.start(e,n))})}return!0}import{Editor as ya,Transforms as va}from"slate";function Wt(e,t,o){ya.withoutNormalizing(e,()=>{let r=ya.node(e,o),n=ka(r[0],t);va.wrapNodes(e,n,{at:o}),va.unwrapNodes(e,{at:[...o,0]})})}import{Editor as If,Transforms as Mf}from"slate";function ko(e,t,o){let r=Array.from(If.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Mf.setNodes(e,t(i),{at:n[1]})}return!0}import{Editor as Cf,Path as xo,Range as yo}from"slate";import{ReactEditor as Ta,useSlate as wa}from"slate-react";function Ia(e,t){if(!e)return!1;let o=e.anchor.path,r=e.focus.path;return xo.equals(t,o)||xo.equals(t,r)||xo.isAncestor(t,o)||xo.isAncestor(t,r)}function Ma(e){let t=wa(),{selection:o}=t;if(!o)return!1;try{let r=Ta.findPath(t,e);return Ia(o,r)}catch{return!1}}function Ca(e){let t=wa(),{selection:o}=t;if(!o)return!1;try{let r=Ta.findPath(t,e);if(Ia(o,r))return!0;let n=Cf.range(t,r);return yo.includes(o,n.anchor)||yo.includes(o,n.focus)||yo.includes(n,o.anchor)||yo.includes(n,o.focus)}catch{return!1}}function Pa(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 Pf(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function Pf(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as Sf,Transforms as Sa}from"slate";function La(e,t,{at:o}){let r=b(e,"anchor",{at:o});if(!r)return!1;let[,n]=r;return Sf.withoutNormalizing(e,()=>{Sa.removeNodes(e,{at:n}),Sa.insertNodes(e,{type:"image-inline",url:no(t),alt:t,children:[{text:""}]},{at:n})}),!0}import{Editor as Ra,Transforms as st}from"slate";function Ba(e,t,{at:o}){let r=b(e,["image-inline","image-block"],{at:o});if(!r)return!1;let[n,i]=r,a=me(t),l={type:"anchor",href:Ce(t),children:[{text:a}]};if(n.type==="image-block"){let s={type:"paragraph",children:[{text:""},l,{text:""}]};Ra.withoutNormalizing(e,()=>{st.removeNodes(e,{at:i}),st.insertNodes(e,s,{at:i})});let m=[...i,1];return st.select(e,m),[l,m]}return Ra.withoutNormalizing(e,()=>{st.removeNodes(e,{at:i}),st.insertNodes(e,l,{at:i})}),st.select(e,i),[l,i]}import{Editor as Lf,Node as Rf,Transforms as yr}from"slate";function $a(e,{href:t,title:o,text:r},{at:n}){let i=b(e,"anchor",{at:n});if(!i)return!1;let[a,l]=i;if(yr.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let s=Rf.string(a);r!==s&&Lf.withoutNormalizing(e,()=>{let m=a.children.length;for(let c=m-1;c>=0;c--)yr.removeNodes(e,{at:[...l,c]});yr.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as vo,Element as Bf,Range as $f,Text as Df,Transforms as vr}from"slate";function Da(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:vo.start(e,[0]),focus:vo.start(e,[0])};if($f.isCollapsed(i)){if(vr.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=vo.node(e,e.selection);vr.select(e,a[1])}}else vr.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>Df.isText(a)||Bf.isElement(a)&&vo.isInline(e,a)})}import{Transforms as zf}from"slate";function za(e,{at:t}){let o=b(e,"anchor",{at:t});return o?(zf.unwrapNodes(e,{at:o[1]}),!0):!1}function Na(e){return{insertLink:g(Da,e),removeLink:g(za,e),editLink:g($a,e),convertToEmbed:g(La,e),convertToLink:g(Ba,e)}}import{Element as Ha,Transforms as Nf}from"slate";function Aa(e,t){if(!Ha.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(!(!Ha.isElement(n)||n.type!=="anchor"))return Nf.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Lh}from"clsx";import{useEffect as Rh,useRef as wl}from"react";import{useSelected as Bh,useSlate as $h}from"slate-react";import{createContext as Ua,useState as Af}from"react";import{createPortal as Hf}from"react-dom";function Oa({children:e}){return typeof document>"u"||!document.body?null:Hf(e,document.body)}import{jsx as Tr,jsxs as Uf}from"react/jsx-runtime";var wr=Ua({}),Of=Ua({});function Fa({children:e}){let[t,o]=Af({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return Uf(wr.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Tr(Oa,{children:Tr(Of.Provider,{value:i,children:Tr(i.Component,{})})},i.type))]})}import{useContext as Ff}from"react";function W(e){let{openLayer:t,closeLayer:o,layers:r}=Ff(wr);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import To from"@emotion/styled";var Wa=To("a")`
41
41
  /**
42
42
  * Link colors
43
43
  */
@@ -62,7 +62,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
62
62
  `,Ir=To("span")`
63
63
  display: inline;
64
64
  padding: 0 1px 0 0;
65
- `,hM=To("span")`
65
+ `,gM=To("span")`
66
66
  position: fixed;
67
67
  width: 100px;
68
68
  background: var(--shade-50);
@@ -71,7 +71,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
71
71
  border: 1px solid var(--shade-400);
72
72
  overflow: hidden;
73
73
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
74
- `,gM=To("span")`
74
+ `,bM=To("span")`
75
75
  position: absolute;
76
76
  left: 0;
77
77
  top: 0;
@@ -603,7 +603,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
603
603
  height: 1.25em;
604
604
  stroke-width: 1.5;
605
605
  }
606
- `;function Sh(e){try{let t=new URL(e);return{hostname:t.hostname,pathname:t.pathname}}catch{return{hostname:"",pathname:""}}}function pt({destAnchor:e,destStartEdge:t,element:o,embed:r}){let n=W("dialog"),i=Ch(),a=Ih(null),l=!!r,s=o?.href??"",m=Sh(s),c=l||se(s),d=l?r.target:se(s)?io($t(s)):"",p=c?i.wysimark.renderInternalLinkPreview?.(d):null,[u,h]=Mh({x:0,y:0}),k=So((S,R)=>{h(w=>({x:w.x+S,y:w.y+R}))},[]),L=oe({src:a,destAnchor:e,destStartEdge:t},({src:S,destAnchor:R,destStartEdge:w},U)=>Be(S,U,{left:w.left,top:R.top+R.height},{margin:16})),M={...L,left:L.left+u.x,top:L.top+u.y},T=ne({title:"\u30EA\u30F3\u30AF\u3092\u524A\u9664"}),D=ne({title:"\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6"}),P=ne({title:"\u9589\u3058\u308B"}),H=So(()=>{n.close()},[n]),C=So(()=>{if(r){r.onRemove(),n.close();return}o&&i.anchor.removeLink({at:o}),n.close()},[i,n,r,o]),B=So(()=>{if(D.onMouseLeave(),r){r.onEdit();return}o&&n.open(()=>Q(Po,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o,r,D,n]);return _e(Ph,{ref:a,contentEditable:!1,style:M,children:[Q(De,{onDrag:k}),_e("div",{style:{display:"flex",padding:"1em"},children:[c?_e("span",{className:"--internal-link",style:i.wysimark.onInternalLinkClick?{cursor:"pointer"}:void 0,onMouseDown:S=>{i.wysimark.onInternalLinkClick&&(S.preventDefault(),i.wysimark.onInternalLinkClick(d),n.close())},children:[Q($r,{}),_e("div",{className:"--url",children:[Q("div",{className:"--hostname",children:f("linkTypeInternal")}),Q("div",{className:"--pathname",children:d}),Q("div",{className:"--internal-preview",children:p??d})]})]}):_e("a",{className:"--link",href:s,target:"_blank",rel:"noreferrer",children:[Q($r,{}),_e("div",{className:"--url",children:[Q("div",{className:"--hostname",children:m.hostname}),m.pathname===""||m.pathname==="/"?null:Q("div",{className:"--pathname",children:m.pathname}),o?.title==null||o.title===""?null:Q("div",{className:"--tooltip",children:o.title})]})]}),_e("span",{className:"--icons",children:[Q("span",{className:"--icon",onClick:C,onMouseEnter:T.onMouseEnter,onMouseLeave:T.onMouseLeave,children:Q(yl,{})}),Q("span",{className:"--icon",onMouseEnter:D.onMouseEnter,onMouseLeave:D.onMouseLeave,onClick:B,children:Q(vl,{})}),Q("span",{className:"--icon",onClick:H,onMouseEnter:P.onMouseEnter,onMouseLeave:P.onMouseLeave,children:Q(Tl,{})})]})]})]})}import{jsx as Lo,jsxs as Dh}from"react/jsx-runtime";function Il({element:e,attributes:t,children:o}){let r=wl(null),n=wl(null),i=Bh(),a=$h(),l=W("dialog"),s=se(e.href);return Rh(()=>{let m=n.current,c=r.current;if(!m||!c)return;let d=a.selection&&a.selection.anchor.offset!==a.selection.focus.offset;i&&!d?setTimeout(()=>{l.open(()=>Lo(pt,{destAnchor:m,destStartEdge:c,element:e}))}):l.close()},[i,e]),Dh(Wa,{className:Lh({"--selected":i,"--internal-link":s}),href:s?void 0:e.href,target:s?void 0:e.target,"data-internal-link":s?"true":void 0,onClick:s?m=>m.preventDefault():void 0,...t,ref:n,children:[Lo(Ir,{ref:r,contentEditable:!1}),Lo("span",{children:o}),Lo(Ir,{contentEditable:!1})]})}import{jsx as zh}from"react/jsx-runtime";var Ml=y((e,t,{createPolicy:o})=>(e.anchor=Na(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:g(Aa,e)},editableProps:{onPaste:g(Pa,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return zh(Il,{element:r,attributes:n,children:i})}}})));import{Editor as Ro,Transforms as Sl}from"slate";import{Element as Cl,Path as Pl}from"slate";function Dr(e,t,o){if(!t||!o||Pl.equals(t[1],o[1]))return!0;let r=E(e,i=>Cl.isElement(i)&&e.isMaster(i),{at:t[1]}),n=E(e,i=>Cl.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&Pl.equals(r[1],n[1]))}var Ll=y(e=>(e.atomicDelete=!0,{name:"atomic-delete",editor:{deleteBackward(){if(e.selection==null)return!1;let t=Ro.node(e,e.selection),o=Ro.previous(e,{mode:"lowest"});return Dr(e,t,o)?!1:(Sl.move(e,{unit:"character",reverse:!0}),!0)},deleteForward(){if(e.selection==null)return!1;let t=Ro.node(e,e.selection),o=Ro.next(e,{mode:"lowest"});return Dr(e,t,o)?!1:(Sl.move(e,{unit:"character"}),!0)}}}));import{Transforms as Sg}from"slate";import{ReactEditor as Lg}from"slate-react";import{Editor as Nh,Transforms as Rl}from"slate";import{ReactEditor as Hh}from"slate-react";function Ah(e){}function Oh(e,t,o,r){let{selection:n}=e;if(Rl.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=Nh.end(e,[]);Rl.select(e,i),Hh.focus(e)}}function Bl(e){return{noop:g(Ah,e),insertImageFromUrl:g(Oh,e)}}function $l(e,t){return!1}import{useSlateStatic as Mg}from"slate-react";import Uh from"@emotion/styled";var Dl=Uh("div")`
606
+ `;function Sh(e){try{let t=new URL(e);return{hostname:t.hostname,pathname:t.pathname}}catch{return{hostname:"",pathname:""}}}function pt({destAnchor:e,destStartEdge:t,element:o,embed:r}){let n=W("dialog"),i=Ch(),a=Ih(null),l=!!r,s=o?.href??"",m=Sh(s),c=l||se(s),d=l?r.target:se(s)?io($t(s)):"",p=c?i.wysimark.renderInternalLinkPreview?.(d):null,[u,h]=Mh({x:0,y:0}),k=So((S,R)=>{h(w=>({x:w.x+S,y:w.y+R}))},[]),L=oe({src:a,destAnchor:e,destStartEdge:t},({src:S,destAnchor:R,destStartEdge:w},U)=>Be(S,U,{left:w.left,top:R.top+R.height},{margin:16})),M={...L,left:L.left+u.x,top:L.top+u.y},T=ne({title:"\u30EA\u30F3\u30AF\u3092\u524A\u9664"}),D=ne({title:"\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6"}),P=ne({title:"\u9589\u3058\u308B"}),H=So(()=>{n.close()},[n]),C=So(()=>{if(r){r.onRemove(),n.close();return}o&&i.anchor.removeLink({at:o}),n.close()},[i,n,r,o]),B=So(()=>{if(D.onMouseLeave(),r){r.onEdit();return}o&&n.open(()=>Q(Po,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o,r,D,n]);return _e(Ph,{ref:a,contentEditable:!1,style:M,children:[Q(De,{onDrag:k}),_e("div",{style:{display:"flex",padding:"1em"},children:[c?_e("span",{className:"--internal-link",style:i.wysimark.onInternalLinkClick?{cursor:"pointer"}:void 0,onMouseDown:S=>{i.wysimark.onInternalLinkClick&&(S.preventDefault(),i.wysimark.onInternalLinkClick(d),n.close())},children:[Q($r,{}),_e("div",{className:"--url",children:[Q("div",{className:"--hostname",children:f("linkTypeInternal")}),Q("div",{className:"--pathname",children:d}),Q("div",{className:"--internal-preview",children:p??d})]})]}):_e("a",{className:"--link",href:s,target:"_blank",rel:"noreferrer",children:[Q($r,{}),_e("div",{className:"--url",children:[Q("div",{className:"--hostname",children:m.hostname}),m.pathname===""||m.pathname==="/"?null:Q("div",{className:"--pathname",children:m.pathname}),o?.title==null||o.title===""?null:Q("div",{className:"--tooltip",children:o.title})]})]}),_e("span",{className:"--icons",children:[Q("span",{className:"--icon",onClick:C,onMouseEnter:T.onMouseEnter,onMouseLeave:T.onMouseLeave,children:Q(yl,{})}),Q("span",{className:"--icon",onMouseEnter:D.onMouseEnter,onMouseLeave:D.onMouseLeave,onClick:B,children:Q(vl,{})}),Q("span",{className:"--icon",onClick:H,onMouseEnter:P.onMouseEnter,onMouseLeave:P.onMouseLeave,children:Q(Tl,{})})]})]})]})}import{jsx as Lo,jsxs as Dh}from"react/jsx-runtime";function Il({element:e,attributes:t,children:o}){let r=wl(null),n=wl(null),i=Bh(),a=$h(),l=W("dialog"),s=se(e.href);return Rh(()=>{let m=n.current,c=r.current;if(!m||!c)return;let d=a.selection&&a.selection.anchor.offset!==a.selection.focus.offset;i&&!d?setTimeout(()=>{l.open(()=>Lo(pt,{destAnchor:m,destStartEdge:c,element:e}))}):l.close()},[i,e]),Dh(Wa,{className:Lh({"--selected":i,"--internal-link":s}),href:s?void 0:e.href,target:s?void 0:e.target,"data-internal-link":s?"true":void 0,onClick:s?m=>m.preventDefault():void 0,...t,ref:n,children:[Lo(Ir,{ref:r,contentEditable:!1}),Lo("span",{children:o}),Lo(Ir,{contentEditable:!1})]})}import{jsx as zh}from"react/jsx-runtime";var Ml=y((e,t,{createPolicy:o})=>(e.anchor=Na(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:g(Aa,e)},editableProps:{onPaste:g(Pa,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return zh(Il,{element:r,attributes:n,children:i})}}})));import{Editor as Ro,Transforms as Sl}from"slate";import{Element as Cl,Path as Pl}from"slate";function Dr(e,t,o){if(!t||!o||Pl.equals(t[1],o[1]))return!0;let r=b(e,i=>Cl.isElement(i)&&e.isMaster(i),{at:t[1]}),n=b(e,i=>Cl.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&Pl.equals(r[1],n[1]))}var Ll=y(e=>(e.atomicDelete=!0,{name:"atomic-delete",editor:{deleteBackward(){if(e.selection==null)return!1;let t=Ro.node(e,e.selection),o=Ro.previous(e,{mode:"lowest"});return Dr(e,t,o)?!1:(Sl.move(e,{unit:"character",reverse:!0}),!0)},deleteForward(){if(e.selection==null)return!1;let t=Ro.node(e,e.selection),o=Ro.next(e,{mode:"lowest"});return Dr(e,t,o)?!1:(Sl.move(e,{unit:"character"}),!0)}}}));import{Transforms as Sg}from"slate";import{ReactEditor as Lg}from"slate-react";import{Editor as Nh,Transforms as Rl}from"slate";import{ReactEditor as Hh}from"slate-react";function Ah(e){}function Oh(e,t,o,r){let{selection:n}=e;if(Rl.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=Nh.end(e,[]);Rl.select(e,i),Hh.focus(e)}}function Bl(e){return{noop:g(Ah,e),insertImageFromUrl:g(Oh,e)}}function $l(e,t){return!1}import{useSlateStatic as Mg}from"slate-react";import Uh from"@emotion/styled";var Dl=Uh("div")`
607
607
  display: block;
608
608
  margin: 1em 0;
609
609
  `;import{clsx as gg}from"clsx";import{useState as hs}from"react";import{useSelected as bg}from"slate-react";import zl from"@emotion/styled";var Nl=zl("span")`
@@ -921,7 +921,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
921
921
  font-size: 1.33em;
922
922
  line-height: 1em;
923
923
  }
924
- `;import{clsx as eg}from"clsx";import{useCallback as tg}from"react";import{Transforms as og}from"slate";import{ReactEditor as rg,useSlateStatic as ng}from"slate-react";import{jsx as ig}from"react/jsx-runtime";function Xl({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=ng(),a=Ke(o,n,t),l=ne({title:t.title,hotkey:`${a.width}x${a.height}`}),s=tg(()=>{let u=rg.findPath(i,e),h=Ke(o,n,t);r(h),og.setNodes(i,h,{at:u})},[e,t,o,n]),c=!(t.type==="scale"?!0:t.width<=n.width||t.height<=n.height),d=o.width===a.width&&o.height===a.height,p=eg({"--disabled":c,"--selected":!c&&d});return ig(dt,{className:p,onClick:c?void 0:s,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Yl}from"react/jsx-runtime";function Jl({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Yl(Do,{children:n.map((i,a)=>Yl(Xl,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as sg}from"react";import{useSlateStatic as mg}from"slate-react";import{jsx as zo,jsxs as ts}from"react/jsx-runtime";var Zl=e=>ts(x,{...e,children:[zo("rect",{width:6,height:6,x:4,y:5,rx:1}),zo("path",{d:"M4 15h16M4 19h16"})]}),es=e=>ts(x,{...e,children:[zo("rect",{width:6,height:6,x:9,y:5,rx:1}),zo("path",{d:"M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16"})]});import{Editor as ag,Transforms as os}from"slate";import{ReactEditor as lg}from"slate-react";function rs(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=lg.findPath(e,t);ag.withoutNormalizing(e,()=>{let i=Ke(o,r,{name:"initial-inline-image",title:"",type:"bounds",width:24,height:24});os.setNodes(e,{type:"image-inline",...i},{at:n}),os.wrapNodes(e,{type:"paragraph",children:[]},{at:n})})}import{jsx as ns}from"react/jsx-runtime";function is({element:e}){let t=mg(),o=ne({title:"Inline Image",hotkey:"In a line with text"}),r=sg(()=>{e.type==="image-block"&&rs(t,e)},[t,e]);return ns(dt,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:ns(es,{})})}import{useCallback as dg}from"react";import{useSlateStatic as ug}from"slate-react";import{Editor as as,Element as cg,Text as ls,Transforms as No}from"slate";import{ReactEditor as pg}from"slate-react";function ss(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=pg.findPath(e,t);as.withoutNormalizing(e,()=>{let i=Ke(o,r,{name:"initial-block-image",title:"",type:"bounds",width:320,height:320});No.setNodes(e,{type:"image-block",...i},{at:n});let a=E(e,k=>cg.isElement(k)&&as.isBlock(e,k)&&k.type!=="image-block");if(!a)throw new Error("This shouldn't happen");let[l,s]=a,m=l.children,c=l.children.length,d=n.slice(-1)[0],p=m[c-1];d===c-2&&ls.isText(p)&&p.text===""&&No.removeNodes(e,{at:[...s,c-1]});let u=m[0],h=d===1&&ls.isText(u)&&u.text==="";h&&No.removeNodes(e,{at:[...s,0]}),No.liftNodes(e,{at:[...s,h?d-1:d]})})}import{jsx as ms}from"react/jsx-runtime";function cs({element:e}){let t=ug(),o=ne({title:"Block Image",hotkey:"On a line by itself"}),r=dg(()=>{e.type==="image-inline"&&ss(t,e)},[t,e]);return ms(dt,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:ms(Zl,{})})}import{jsx as ps,jsxs as fg}from"react/jsx-runtime";function ds({element:e}){return fg(Do,{children:[ps(cs,{element:e}),ps(is,{element:e})]})}import{jsx as us,jsxs as hg}from"react/jsx-runtime";function fs({element:e,size:t,setSize:o,srcSize:r,presets:n}){return hg(Ql,{children:[us(ds,{element:e}),us(Jl,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as Ho,jsxs as Eg}from"react/jsx-runtime";function Ao({element:e,presets:t}){let o=e.url,r=bg(),[n,i]=hs(!1),[a,l]=hs(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=gg({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Eg(Nl,{className:c,children:[Ho(Hl,{src:o,width:a?.width,height:a?.height}),m?Ho(fs,{element:e,size:a,setSize:l,srcSize:s,presets:t}):null,n&&a?Ho(ql,{size:a}):null,m?Ho(Kl,{element:e,srcSize:s,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import kg from"@emotion/styled";import{useCallback as gs,useEffect as xg,useRef as bs}from"react";import{Transforms as yg}from"slate";import{ReactEditor as Hr,useSelected as vg,useSlate as Tg}from"slate-react";import{jsx as Ar,jsxs as Ig}from"react/jsx-runtime";var wg=kg("span")`
924
+ `;import{clsx as eg}from"clsx";import{useCallback as tg}from"react";import{Transforms as og}from"slate";import{ReactEditor as rg,useSlateStatic as ng}from"slate-react";import{jsx as ig}from"react/jsx-runtime";function Xl({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=ng(),a=Ke(o,n,t),l=ne({title:t.title,hotkey:`${a.width}x${a.height}`}),s=tg(()=>{let u=rg.findPath(i,e),h=Ke(o,n,t);r(h),og.setNodes(i,h,{at:u})},[e,t,o,n]),c=!(t.type==="scale"?!0:t.width<=n.width||t.height<=n.height),d=o.width===a.width&&o.height===a.height,p=eg({"--disabled":c,"--selected":!c&&d});return ig(dt,{className:p,onClick:c?void 0:s,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Yl}from"react/jsx-runtime";function Jl({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Yl(Do,{children:n.map((i,a)=>Yl(Xl,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as sg}from"react";import{useSlateStatic as mg}from"slate-react";import{jsx as zo,jsxs as ts}from"react/jsx-runtime";var Zl=e=>ts(x,{...e,children:[zo("rect",{width:6,height:6,x:4,y:5,rx:1}),zo("path",{d:"M4 15h16M4 19h16"})]}),es=e=>ts(x,{...e,children:[zo("rect",{width:6,height:6,x:9,y:5,rx:1}),zo("path",{d:"M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16"})]});import{Editor as ag,Transforms as os}from"slate";import{ReactEditor as lg}from"slate-react";function rs(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=lg.findPath(e,t);ag.withoutNormalizing(e,()=>{let i=Ke(o,r,{name:"initial-inline-image",title:"",type:"bounds",width:24,height:24});os.setNodes(e,{type:"image-inline",...i},{at:n}),os.wrapNodes(e,{type:"paragraph",children:[]},{at:n})})}import{jsx as ns}from"react/jsx-runtime";function is({element:e}){let t=mg(),o=ne({title:"Inline Image",hotkey:"In a line with text"}),r=sg(()=>{e.type==="image-block"&&rs(t,e)},[t,e]);return ns(dt,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:ns(es,{})})}import{useCallback as dg}from"react";import{useSlateStatic as ug}from"slate-react";import{Editor as as,Element as cg,Text as ls,Transforms as No}from"slate";import{ReactEditor as pg}from"slate-react";function ss(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=pg.findPath(e,t);as.withoutNormalizing(e,()=>{let i=Ke(o,r,{name:"initial-block-image",title:"",type:"bounds",width:320,height:320});No.setNodes(e,{type:"image-block",...i},{at:n});let a=b(e,k=>cg.isElement(k)&&as.isBlock(e,k)&&k.type!=="image-block");if(!a)throw new Error("This shouldn't happen");let[l,s]=a,m=l.children,c=l.children.length,d=n.slice(-1)[0],p=m[c-1];d===c-2&&ls.isText(p)&&p.text===""&&No.removeNodes(e,{at:[...s,c-1]});let u=m[0],h=d===1&&ls.isText(u)&&u.text==="";h&&No.removeNodes(e,{at:[...s,0]}),No.liftNodes(e,{at:[...s,h?d-1:d]})})}import{jsx as ms}from"react/jsx-runtime";function cs({element:e}){let t=ug(),o=ne({title:"Block Image",hotkey:"On a line by itself"}),r=dg(()=>{e.type==="image-inline"&&ss(t,e)},[t,e]);return ms(dt,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:ms(Zl,{})})}import{jsx as ps,jsxs as fg}from"react/jsx-runtime";function ds({element:e}){return fg(Do,{children:[ps(cs,{element:e}),ps(is,{element:e})]})}import{jsx as us,jsxs as hg}from"react/jsx-runtime";function fs({element:e,size:t,setSize:o,srcSize:r,presets:n}){return hg(Ql,{children:[us(ds,{element:e}),us(Jl,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as Ho,jsxs as Eg}from"react/jsx-runtime";function Ao({element:e,presets:t}){let o=e.url,r=bg(),[n,i]=hs(!1),[a,l]=hs(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=gg({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Eg(Nl,{className:c,children:[Ho(Hl,{src:o,width:a?.width,height:a?.height}),m?Ho(fs,{element:e,size:a,setSize:l,srcSize:s,presets:t}):null,n&&a?Ho(ql,{size:a}):null,m?Ho(Kl,{element:e,srcSize:s,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import kg from"@emotion/styled";import{useCallback as gs,useEffect as xg,useRef as bs}from"react";import{Transforms as yg}from"slate";import{ReactEditor as Hr,useSelected as vg,useSlate as Tg}from"slate-react";import{jsx as Ar,jsxs as Ig}from"react/jsx-runtime";var wg=kg("span")`
925
925
  position: relative;
926
926
  display: inline-block;
927
927
  `;function Oo({element:e}){let t=Tg(),o=vg(),r=W("dialog"),n=bs(null),i=bs(null),a=t.wysimark.renderInternalEmbed,l=mr(e.url),s=gs(()=>{let c=n.current,d=i.current;if(!c||!d)return;let p=Hr.findPath(t,e),u=t.anchor.convertToLink(l,{at:p});if(!u)return;let[h]=u;setTimeout(()=>{let k=c;try{k=Hr.toDOMNode(t,h)}catch{}let L=k.querySelector('[contenteditable="false"]')||d;r.open(()=>Ar(Po,{destAnchor:k,destStartEdge:L,element:h,initialEmbed:!0,onCancel:()=>{t.anchor.convertToEmbed(l,{at:h}),r.close()}}))})},[r,t,e,l]),m=gs(()=>{let c=Hr.findPath(t,e);yg.removeNodes(t,{at:c})},[t,e]);return xg(()=>{let c=n.current,d=i.current;if(!c||!d)return;let p=t.selection&&t.selection.anchor.offset!==t.selection.focus.offset;o&&!p?setTimeout(()=>{r.open(()=>Ar(pt,{destAnchor:c,destStartEdge:d,embed:{target:io(l),onEdit:s,onRemove:m}}))}):r.close()},[o,l]),Ig(wg,{ref:n,contentEditable:!1,children:[Ar("span",{ref:i,style:{display:"none"}}),a?.(l)]})}import{jsx as Or,jsxs as Es}from"react/jsx-runtime";function ks({element:e,attributes:t,children:o}){let r=Mg();return Ze(e.url)&&r.wysimark.renderInternalEmbed?Es("div",{...t,children:[Or(Oo,{element:e}),o]}):Es("div",{...t,children:[Or(Dl,{contentEditable:!1,children:Or(Ao,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as Pg}from"slate-react";import Cg from"@emotion/styled";var xs=Cg("span")`
@@ -1032,7 +1032,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1032
1032
  }
1033
1033
  `,Ds=Ne("span")`
1034
1034
  flex: 1 1 auto;
1035
- `,gR=Ne("div")`
1035
+ `,bR=Ne("div")`
1036
1036
  color: var(--shade-500);
1037
1037
  font-size: 0.875em;
1038
1038
  margin-bottom: 0.25em;
@@ -1046,7 +1046,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1046
1046
  color: var(--shade-400);
1047
1047
  }
1048
1048
  `;import{jsx as ht,jsxs as Hs}from"react/jsx-runtime";function Ug({element:e,attributes:t,children:o}){let r=Og(),n=Cs(e),i=Ag(),a=Ma(e),l=i&&a;function s(m){let c=m.target;if(c instanceof HTMLElement&&c.closest(".wysimark-callout-body"))return;m.preventDefault();let d=zs.findPath(r,e);ft.select(r,ut.start(r,d)),zs.focus(r)}return n&&!l?Hs(Ss,{...t,"data-callout":n.type,"data-callout-source-type":n.displayType,"data-callout-fold":n.fold,onMouseDown:s,children:[Hs(Ls,{className:"wysimark-callout-title",contentEditable:!1,"data-fold":n.fold,children:[ht(Bs,{children:n.fold==="closed"?"\u203A":n.fold==="open"?"\u2304":null}),ht(Rs,{children:n.icon}),ht(Ds,{children:n.title})]}),ht($s,{className:"wysimark-callout-body",children:o})]}):ht(Ps,{...t,children:o})}function Ns(e){return Ee.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 Fg=2,As=y(e=>{e.supportsBlockQuote=!0,e.blockQuotePlugin={indent:()=>{ft.wrapNodes(e,{type:"block-quote",children:[]},{match:Ns})},outdent:()=>{ft.liftNodes(e,{match:(r,n)=>Ns(r)&&n.length>1})},isActive:()=>{let[r]=ut.nodes(e,{match:n=>Ee.isElement(n)&&n.type==="block-quote"});return!!r},increaseDepth:()=>{let[r]=ut.nodes(e,{match:i=>Ee.isElement(i)&&i.type==="block-quote"});if(!r||!e.blockQuotePlugin.canIncreaseDepth())return;let[,n]=r;ft.select(e,n),ft.wrapNodes(e,{type:"block-quote",children:[]},{at:n,split:!1})},decreaseDepth:()=>{let[r]=ut.nodes(e,{match:l=>Ee.isElement(l)&&l.type==="block-quote"});if(!r||!e.blockQuotePlugin.canDecreaseDepth())return;let[n,i]=r,a=n.children;a.length===1&&Ee.isElement(a[0])&&a[0].type==="block-quote"&&ft.unwrapNodes(e,{at:[...i,0],match:l=>Ee.isElement(l)&&l.type==="block-quote"})},canIncreaseDepth:()=>{let[r]=ut.nodes(e,{match:l=>Ee.isElement(l)&&l.type==="block-quote"});if(!r)return!1;let[n]=r,i=0,a=n;for(;a.children.length===1&&Ee.isElement(a.children[0])&&a.children[0].type==="block-quote";)i++,a=a.children[0];return i<Fg},canDecreaseDepth:()=>{let[r]=ut.nodes(e,{match:i=>Ee.isElement(i)&&i.type==="block-quote"});if(!r)return!1;let[n]=r;return n.children.length===1&&Ee.isElement(n.children[0])&&n.children[0]&&n.children[0].type==="block-quote"}};let t=Eo(e,{">":e.blockQuotePlugin.indent}),o=_({"super+.":e.blockQuotePlugin.indent,"super+,":e.blockQuotePlugin.outdent});return{name:"block-quote",editableProps:{renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="block-quote")return ht(Ug,{element:r,attributes:n,children:i})},onKeyDown:r=>!!(o(r)||t(r))}}});import{Editor as Eb,Element as kb,Transforms as Em}from"slate";import Wg from"prismjs";import{Element as Kg,Node as Gg}from"slate";var{languages:Vg,tokenize:_g}=Wg;function qg(e){let t=0,o=[];for(let r of e)o.push(t),t=t+r.length;return o}function Os(e){let[t,o]=e;if(!Kg.isElement(t))return[];if(t.type!=="code-block")return[];let r=Vg[t.language];if(r===void 0)return[];let i=t.children.map(p=>`${Gg.string(p)}
1049
- `),a=i.join(""),l=qg(i);function s(p){for(let u=l.length-1;u>=0;u--){let h=l[u];if(h<=p)return{path:[...o,u],offset:p-h}}throw new Error("This shouldn't happen and indicates a bug in the logic")}let m=[],c=_g(a,r),d=0;for(let p of c)if(typeof p=="string")d+=p.length;else{let u=s(d),h=s(d+p.length);m.push({anchor:u,focus:h,prismToken:p.type}),d+=p.length}return m}function Us(e,{language:t}){xa(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as Qg,Transforms as jg}from"slate";function Fs(e,t,o={}){let r=E(e,n=>Qg.isElement(n)&&n.type==="code-block",{at:o.at});return r?(jg.setNodes(e,{language:t},{at:r[1]}),!0):!1}function Ws(e){return{createCodeBlock:g(Us,e),setCodeBlockLanguage:g(Fs,e)}}var Uo={color:"#999988",fontStyle:"italic"},Xg={opacity:"0.7"},Vs={color:"#e3116c"},_s={color:"#393a34"},ke={color:"#36acaa"},Fr={color:"#00a4db"},Ks={color:"#9a050f"},Gs={color:"#00009f"},Wr={fontWeight:"bold"},Yg={fontStyle:"italic"},qs={comment:Uo,prolog:Uo,doctype:Uo,cdata:Uo,namespace:Xg,string:Vs,"attr-value":Vs,puncutation:_s,operator:_s,entity:ke,url:ke,symbol:ke,number:ke,boolean:ke,variable:ke,constant:ke,property:ke,regex:ke,insert:ke,atrule:Fr,keyword:Fr,"attr-name":Fr,function:{...Ks,...Wr},delete:Ks,tag:Gs,selector:Gs,important:Wr,bold:Wr,italic:Yg};var Qs=["text","html","css","svg","mermaid","javascript","java","c"];import{Element as Vr,Node as _r,Transforms as gt}from"slate";function js(e,t){if(!Vr.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of _r.children(e,t[1]))if(Vr.isElement(o))return e.isVoid(o)?(gt.removeNodes(e,{at:r}),!0):(gt.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of _r.children(e,t[1]))if(Vr.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(gt.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(gt.removeNodes(e,{at:r}),!0):(gt.removeNodes(e,{at:r}),gt.insertNodes(e,{type:"code-block-line",children:[{text:_r.string(o)}]}),!0)}return!1}import{useCallback as pb,useRef as db}from"react";import{useFocused as ub,useSelected as fb}from"slate-react";import{jsx as Xs}from"react/jsx-runtime";var Ys=e=>Xs(x,{...e,children:Xs("path",{d:"m6 9 6 6 6-6"})});import ie from"@emotion/styled";var Kr=ie("div")`
1049
+ `),a=i.join(""),l=qg(i);function s(p){for(let u=l.length-1;u>=0;u--){let h=l[u];if(h<=p)return{path:[...o,u],offset:p-h}}throw new Error("This shouldn't happen and indicates a bug in the logic")}let m=[],c=_g(a,r),d=0;for(let p of c)if(typeof p=="string")d+=p.length;else{let u=s(d),h=s(d+p.length);m.push({anchor:u,focus:h,prismToken:p.type}),d+=p.length}return m}function Us(e,{language:t}){xa(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as Qg,Transforms as jg}from"slate";function Fs(e,t,o={}){let r=b(e,n=>Qg.isElement(n)&&n.type==="code-block",{at:o.at});return r?(jg.setNodes(e,{language:t},{at:r[1]}),!0):!1}function Ws(e){return{createCodeBlock:g(Us,e),setCodeBlockLanguage:g(Fs,e)}}var Uo={color:"#999988",fontStyle:"italic"},Xg={opacity:"0.7"},Vs={color:"#e3116c"},_s={color:"#393a34"},ke={color:"#36acaa"},Fr={color:"#00a4db"},Ks={color:"#9a050f"},Gs={color:"#00009f"},Wr={fontWeight:"bold"},Yg={fontStyle:"italic"},qs={comment:Uo,prolog:Uo,doctype:Uo,cdata:Uo,namespace:Xg,string:Vs,"attr-value":Vs,puncutation:_s,operator:_s,entity:ke,url:ke,symbol:ke,number:ke,boolean:ke,variable:ke,constant:ke,property:ke,regex:ke,insert:ke,atrule:Fr,keyword:Fr,"attr-name":Fr,function:{...Ks,...Wr},delete:Ks,tag:Gs,selector:Gs,important:Wr,bold:Wr,italic:Yg};var Qs=["text","html","css","svg","mermaid","javascript","java","c"];import{Element as Vr,Node as _r,Transforms as gt}from"slate";function js(e,t){if(!Vr.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of _r.children(e,t[1]))if(Vr.isElement(o))return e.isVoid(o)?(gt.removeNodes(e,{at:r}),!0):(gt.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of _r.children(e,t[1]))if(Vr.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(gt.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(gt.removeNodes(e,{at:r}),!0):(gt.removeNodes(e,{at:r}),gt.insertNodes(e,{type:"code-block-line",children:[{text:_r.string(o)}]}),!0)}return!1}import{useCallback as pb,useRef as db}from"react";import{useFocused as ub,useSelected as fb}from"slate-react";import{jsx as Xs}from"react/jsx-runtime";var Ys=e=>Xs(x,{...e,children:Xs("path",{d:"m6 9 6 6 6-6"})});import ie from"@emotion/styled";var Kr=ie("div")`
1050
1050
  position: relative;
1051
1051
  background: var(--code-block-bgcolor);
1052
1052
  margin: 1em 0;
@@ -1122,7 +1122,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1122
1122
  color: var(--shade-800);
1123
1123
  background: var(--shade-300);
1124
1124
  }
1125
- `,t5=ie("input")`
1125
+ `,o5=ie("input")`
1126
1126
  box-sizing: border-box;
1127
1127
  min-width: 0;
1128
1128
  flex: 1 1 auto;
@@ -1193,7 +1193,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1193
1193
  opacity: 0;
1194
1194
  pointer-events: none;
1195
1195
  `;import{useCallback as am}from"react";import{Transforms as Jg}from"slate";import{ReactEditor as lm,useSlateStatic as Zg}from"slate-react";import{jsx as mm,jsxs as eb}from"react/jsx-runtime";async function sm(e){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}throw new Error("Clipboard API is unavailable")}function Fo({element:e}){let t=Zg(),o=am(async n=>{n.preventDefault(),n.stopPropagation();try{await sm(fe([e]).trimEnd())}catch{}},[e]),r=am(async n=>{n.preventDefault(),n.stopPropagation();try{await sm(fe([e]).trimEnd())}catch{return}let i=lm.findPath(t,e);Jg.removeNodes(t,{at:i}),lm.focus(t)},[t,e]);return eb(Zs,{contentEditable:!1,children:[mm(qr,{"aria-label":"Copy code block",title:"Copy",type:"button",onMouseDown:n=>{n.preventDefault(),n.stopPropagation()},onClick:o,children:"\u29C9"}),mm(qr,{"aria-label":"Cut code block",title:"Cut",type:"button",onMouseDown:n=>{n.preventDefault(),n.stopPropagation()},onClick:r,children:"\u2702"})]})}import{useEffect as tb,useMemo as ob,useState as cm}from"react";import dm from"mermaid";import{Editor as rb,Node as nb,Transforms as ib}from"slate";import{ReactEditor as pm,useFocused as ab,useSelected as lb,useSlateStatic as sb}from"slate-react";import{jsx as bt,jsxs as cb}from"react/jsx-runtime";dm.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default"});var mb=0;function um({element:e,attributes:t,children:o}){let r=sb(),n=lb(),i=ab(),a=ob(()=>e.children.map(p=>nb.string(p)).join(`
1196
- `),[e.children]),[l,s]=cm(""),[m,c]=cm("");tb(()=>{let p=!1,u=`wysimark-mermaid-${++mb}`;c(""),s("");async function h(){try{let k=await dm.render(u,a);p||s(k.svg)}catch(k){p||c(k instanceof Error?k.message:"Invalid Mermaid diagram")}}return h(),()=>{p=!0}},[a]);function d(p){p.preventDefault(),p.stopPropagation();let u=pm.findPath(r,e);ib.select(r,rb.start(r,u)),pm.focus(r)}return cb(om,{...t,onMouseDown:d,children:[n&&i?bt(Fo,{element:e}):null,bt(rm,{contentEditable:!1,onMouseDown:d,children:m?bt(nm,{children:m}):l?bt("div",{dangerouslySetInnerHTML:{__html:l}}):bt("span",{children:"Rendering diagram..."})}),bt(im,{"aria-hidden":"true",children:o})]})}import{Fragment as hb,jsx as He,jsxs as Qr}from"react/jsx-runtime";function fm({element:e,attributes:t,children:o}){let r=db(null),n=fb(),i=ub(),a=Ca(e),l=i&&a,s=W("code-block-dropdown"),m=pb(()=>{s.layer&&s.close();let c=r.current;if(c===null)return;let d=Qs.map(p=>({icon:()=>He("span",{}),title:p,action:u=>{u.codeBlock.setCodeBlockLanguage(p,{at:e})}}));s.open(()=>He(ct,{dest:c,items:d,close:s.close}))},[s,e]);return e.language.toLowerCase()==="mermaid"&&!l?He(um,{element:e,attributes:t,children:o}):Qr(Kr,{className:n?"--selected":"",...t,children:[n&&i?He(Fo,{element:e}):null,l?He(Js,{children:o}):Qr(hb,{children:[Qr(em,{contentEditable:!1,onClick:m,ref:r,children:[He("span",{children:e.language}),He(Ys,{})]}),He(Gr,{children:o})]})]})}import{useSelected as gb}from"slate-react";import{jsx as bb}from"react/jsx-runtime";function hm({attributes:e,children:t}){let o=gb();return bb(tm,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as gm}from"react/jsx-runtime";function bm({element:e,attributes:t,children:o}){if(e.type==="code-block")return gm(fm,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return gm(hm,{element:e,attributes:t,children:o})}import{Fragment as xb,jsx as km}from"react/jsx-runtime";var xm=y((e,t,{createPolicy:o})=>{e.codeBlock=Ws(e);function r(){let{selection:n}=e;if(!ye(n))return!1;let i=E(e,"code-block");return i==null?!1:Eb.string(e,i[1])===""?(Em.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:g(js,e)},editableProps:{decorate:Os,onKeyDown:_({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=E(e,i=>kb.isElement(i)&&i.type==="code-block");return n?(Em.select(e,n[1]),!0):!1}}),renderElement:bm,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&qs[n.prismToken]||null;return a===null?km(xb,{children:i}):km("span",{style:a,children:i})}}})});import{Transforms as vb}from"slate";import ym from"@emotion/styled";var vm=ym("div")`
1196
+ `),[e.children]),[l,s]=cm(""),[m,c]=cm("");tb(()=>{let p=!1,u=`wysimark-mermaid-${++mb}`;c(""),s("");async function h(){try{let k=await dm.render(u,a);p||s(k.svg)}catch(k){p||c(k instanceof Error?k.message:"Invalid Mermaid diagram")}}return h(),()=>{p=!0}},[a]);function d(p){p.preventDefault(),p.stopPropagation();let u=pm.findPath(r,e);ib.select(r,rb.start(r,u)),pm.focus(r)}return cb(om,{...t,onMouseDown:d,children:[n&&i?bt(Fo,{element:e}):null,bt(rm,{contentEditable:!1,onMouseDown:d,children:m?bt(nm,{children:m}):l?bt("div",{dangerouslySetInnerHTML:{__html:l}}):bt("span",{children:"Rendering diagram..."})}),bt(im,{"aria-hidden":"true",children:o})]})}import{Fragment as hb,jsx as He,jsxs as Qr}from"react/jsx-runtime";function fm({element:e,attributes:t,children:o}){let r=db(null),n=fb(),i=ub(),a=Ca(e),l=i&&a,s=W("code-block-dropdown"),m=pb(()=>{s.layer&&s.close();let c=r.current;if(c===null)return;let d=Qs.map(p=>({icon:()=>He("span",{}),title:p,action:u=>{u.codeBlock.setCodeBlockLanguage(p,{at:e})}}));s.open(()=>He(ct,{dest:c,items:d,close:s.close}))},[s,e]);return e.language.toLowerCase()==="mermaid"&&!l?He(um,{element:e,attributes:t,children:o}):Qr(Kr,{className:n?"--selected":"",...t,children:[n&&i?He(Fo,{element:e}):null,l?He(Js,{children:o}):Qr(hb,{children:[Qr(em,{contentEditable:!1,onClick:m,ref:r,children:[He("span",{children:e.language}),He(Ys,{})]}),He(Gr,{children:o})]})]})}import{useSelected as gb}from"slate-react";import{jsx as bb}from"react/jsx-runtime";function hm({attributes:e,children:t}){let o=gb();return bb(tm,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as gm}from"react/jsx-runtime";function bm({element:e,attributes:t,children:o}){if(e.type==="code-block")return gm(fm,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return gm(hm,{element:e,attributes:t,children:o})}import{Fragment as xb,jsx as km}from"react/jsx-runtime";var xm=y((e,t,{createPolicy:o})=>{e.codeBlock=Ws(e);function r(){let{selection:n}=e;if(!ye(n))return!1;let i=b(e,"code-block");return i==null?!1:Eb.string(e,i[1])===""?(Em.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:g(js,e)},editableProps:{decorate:Os,onKeyDown:_({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=b(e,i=>kb.isElement(i)&&i.type==="code-block");return n?(Em.select(e,n[1]),!0):!1}}),renderElement:bm,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&qs[n.prismToken]||null;return a===null?km(xb,{children:i}):km("span",{style:a,children:i})}}})});import{Transforms as vb}from"slate";import ym from"@emotion/styled";var vm=ym("div")`
1197
1197
  position: relative;
1198
1198
  background-color: var(--shade-100);
1199
1199
  border: 1px solid var(--shade-300);
@@ -1219,7 +1219,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1219
1219
  color: var(--shade-500);
1220
1220
  text-transform: uppercase;
1221
1221
  letter-spacing: 0.5px;
1222
- `;import{jsx as wm,jsxs as yb}from"react/jsx-runtime";function Im({attributes:e,children:t,element:o}){return yb(vm,{...e,contentEditable:!1,children:[wm(Tm,{children:"HTML"}),wm("div",{children:Dt(o.html)}),t]})}import{jsx as Tb}from"react/jsx-runtime";var Mm=y((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!ye(n))return!1;let i=E(e,"html-block");return i==null?!1:(vb.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 Tb(Im,{element:n,attributes:i,children:a})}}})});import{Element as Pb}from"slate";import{Element as wb,Transforms as Ib}from"slate";function Cm(e){return wb.isElement(e)&&e.type==="paragraph"}function Pm(e,t){return lt(e,t,(o,r)=>!Cm(o[0])||!Cm(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(Ib.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as Mb,Transforms as Cb}from"slate";function jr(e,t){return Mb.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function Sm(e,t){return jr(e,t[0])?lt(e,t,(o,r)=>!jr(e,o[0])||!jr(e,r[0])?!1:(Cb.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function Lm(e,t){let[o,r]=t;return Pb.isElement(o)?!!(Sm(e,[o,r])||Pm(e,[o,r])):!1}import{clsx as Rb}from"clsx";import{useSelected as Bb}from"slate-react";import Sb from"@emotion/styled";var Rm=Sb("p")`
1222
+ `;import{jsx as wm,jsxs as yb}from"react/jsx-runtime";function Im({attributes:e,children:t,element:o}){return yb(vm,{...e,contentEditable:!1,children:[wm(Tm,{children:"HTML"}),wm("div",{children:Dt(o.html)}),t]})}import{jsx as Tb}from"react/jsx-runtime";var Mm=y((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!ye(n))return!1;let i=b(e,"html-block");return i==null?!1:(vb.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 Tb(Im,{element:n,attributes:i,children:a})}}})});import{Element as Pb}from"slate";import{Element as wb,Transforms as Ib}from"slate";function Cm(e){return wb.isElement(e)&&e.type==="paragraph"}function Pm(e,t){return lt(e,t,(o,r)=>!Cm(o[0])||!Cm(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(Ib.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as Mb,Transforms as Cb}from"slate";function jr(e,t){return Mb.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function Sm(e,t){return jr(e,t[0])?lt(e,t,(o,r)=>!jr(e,o[0])||!jr(e,r[0])?!1:(Cb.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function Lm(e,t){let[o,r]=t;return Pb.isElement(o)?!!(Sm(e,[o,r])||Pm(e,[o,r])):!1}import{clsx as Rb}from"clsx";import{useSelected as Bb}from"slate-react";import Sb from"@emotion/styled";var Rm=Sb("p")`
1223
1223
  padding: 0;
1224
1224
  margin: 0;
1225
1225
  &:first-of-type {
@@ -1262,7 +1262,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1262
1262
  `),k={...t,children:[{text:h}]};Ge.insertNodes(e,k,{at:[...d,p+1]})}let u=t.children.length;for(let h=u-1;h>=0;h--)Ge.removeNodes(e,{at:[...o,h]});if(s.length>0){Ge.insertNodes(e,{text:s.join(`
1263
1263
  `)},{at:[...o,0]});let k={type:"paragraph",children:[{text:m.join(`
1264
1264
  `)}]};Ge.insertNodes(e,k,{at:[...d,p+1]})}else Ge.insertNodes(e,{text:m.join(`
1265
- `)},{at:[...o,0]})}),s.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function Am(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=zb.isCollapsed(n),s=Array.from(Z.nodes(e,{match:p=>Wo.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(s.length>0){let[,p]=s[0];i=Nm(e,n.anchor,p),a=Nm(e,n.focus,p)}if(s.length===0)return!1;let m=[];Z.withoutNormalizing(e,()=>{for(let p=s.length-1;p>=0;p--){let[u,h]=s[p];if(Nb(u)){let k=Ab(e,u,h,n);m.unshift(k)}else m.unshift(h)}});let c=m.map(p=>{try{let u=pe.get(e,p);return Wo.isElement(u)?[u,p]:null}catch{return null}}).filter(p=>p!==null);if(c.length===0)return!1;if(r&&c.every(p=>t(p[0]))?Z.withoutNormalizing(e,()=>{for(let p of c)Wt(e,{type:"paragraph"},p[1])}):Z.withoutNormalizing(e,()=>{for(let p of c)Wt(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)Hm(e,p,i);else if(a>=0)try{let u=pe.get(e,p);if(Wo.isElement(u)){let h=pe.string(u),k=Math.min(i,h.length),L=Math.min(a,h.length),M=Z.start(e,p),T=M.path,D=k,P=0;for(let[B,S]of pe.texts(u)){let R=B.text.length;if(P+R>=k){T=[...p,...S],D=k-P;break}P+=R}let H=M.path,C=L;P=0;for(let[B,S]of pe.texts(u)){let R=B.text.length;if(P+R>=L){H=[...p,...S],C=L-P;break}P+=R}Ge.select(e,{anchor:{path:T,offset:D},focus:{path:H,offset:C}})}}catch{Hm(e,p,i)}}return!0}function Om(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function Um(e){return{convertElementTypes:[],addConvertElementType:g(zm,e),isConvertibleElement:g(Om,e),convertElements:g(Am,e)}}var Fm=y(e=>(e.convertElement=Um(e),{name:"convert-element"}));import{Editor as Xr,Path as Ob,Range as Ub,Transforms as Wm}from"slate";function Vm(e){let t=E(e,"heading");if(!t||!e.selection||Ub.isExpanded(e.selection)||!Xr.isEnd(e,e.selection.anchor,t[1]))return!1;let o=Ob.next(t[1]);return Wm.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),Wm.select(e,{anchor:Xr.start(e,o),focus:Xr.start(e,o)}),!0}import{Editor as Fb}from"slate";function Wb(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Vb(e,t){let[o]=Fb.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function _m(e){return{convertHeading:g(Wb,e),isHeadingActive:g(Vb,e)}}import{css as _b}from"@emotion/react";import kt from"@emotion/styled";var xt=_b`
1265
+ `)},{at:[...o,0]})}),s.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function Am(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=zb.isCollapsed(n),s=Array.from(Z.nodes(e,{match:p=>Wo.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(s.length>0){let[,p]=s[0];i=Nm(e,n.anchor,p),a=Nm(e,n.focus,p)}if(s.length===0)return!1;let m=[];Z.withoutNormalizing(e,()=>{for(let p=s.length-1;p>=0;p--){let[u,h]=s[p];if(Nb(u)){let k=Ab(e,u,h,n);m.unshift(k)}else m.unshift(h)}});let c=m.map(p=>{try{let u=pe.get(e,p);return Wo.isElement(u)?[u,p]:null}catch{return null}}).filter(p=>p!==null);if(c.length===0)return!1;if(r&&c.every(p=>t(p[0]))?Z.withoutNormalizing(e,()=>{for(let p of c)Wt(e,{type:"paragraph"},p[1])}):Z.withoutNormalizing(e,()=>{for(let p of c)Wt(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)Hm(e,p,i);else if(a>=0)try{let u=pe.get(e,p);if(Wo.isElement(u)){let h=pe.string(u),k=Math.min(i,h.length),L=Math.min(a,h.length),M=Z.start(e,p),T=M.path,D=k,P=0;for(let[B,S]of pe.texts(u)){let R=B.text.length;if(P+R>=k){T=[...p,...S],D=k-P;break}P+=R}let H=M.path,C=L;P=0;for(let[B,S]of pe.texts(u)){let R=B.text.length;if(P+R>=L){H=[...p,...S],C=L-P;break}P+=R}Ge.select(e,{anchor:{path:T,offset:D},focus:{path:H,offset:C}})}}catch{Hm(e,p,i)}}return!0}function Om(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function Um(e){return{convertElementTypes:[],addConvertElementType:g(zm,e),isConvertibleElement:g(Om,e),convertElements:g(Am,e)}}var Fm=y(e=>(e.convertElement=Um(e),{name:"convert-element"}));import{Editor as Xr,Path as Ob,Range as Ub,Transforms as Wm}from"slate";function Vm(e){let t=b(e,"heading");if(!t||!e.selection||Ub.isExpanded(e.selection)||!Xr.isEnd(e,e.selection.anchor,t[1]))return!1;let o=Ob.next(t[1]);return Wm.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),Wm.select(e,{anchor:Xr.start(e,o),focus:Xr.start(e,o)}),!0}import{Editor as Fb}from"slate";function Wb(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Vb(e,t){let[o]=Fb.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function _m(e){return{convertHeading:g(Wb,e),isHeadingActive:g(Vb,e)}}import{css as _b}from"@emotion/react";import kt from"@emotion/styled";var xt=_b`
1266
1266
  margin-top: 1em;
1267
1267
  &:first-of-type {
1268
1268
  margin-top: 0;
@@ -1317,7 +1317,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1317
1317
  outline: 2px solid var(--select-color, blue);
1318
1318
  }
1319
1319
  }
1320
- `;import{jsx as Zm,jsxs as qb}from"react/jsx-runtime";function ec({attributes:e,children:t}){let o=Gb();return qb("div",{...e,draggable:!0,children:[t,Zm("div",{contentEditable:!1,children:Zm(Jm,{className:o?"--selected":""})})]})}import{Editor as Yr,Element as Qb,Path as tc,Transforms as Vo}from"slate";function jb(e){let{selection:t}=e;if(!t)return!1;let o=E(e,i=>Qb.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)Yr.withoutNormalizing(e,()=>{Vo.insertNodes(e,[r,n]),Vo.move(e)});else{let i=tc.next(o[1]);Yr.withoutNormalizing(e,()=>{Vo.insertNodes(e,[r,n],{at:i});let a=tc.next(i);Vo.select(e,Yr.start(e,a))})}return!0}function oc(e){return{insertHorizontalRule:g(jb,e)}}import{jsx as Xb}from"react/jsx-runtime";var rc=y((e,t,{createPolicy:o})=>(e.horizontalRule=oc(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 Xb(ec,{...r})},onKeyDown:_({"super+-":e.horizontalRule.insertHorizontalRule})}})));import nc from"@emotion/styled";var ic=nc("code")`
1320
+ `;import{jsx as Zm,jsxs as qb}from"react/jsx-runtime";function ec({attributes:e,children:t}){let o=Gb();return qb("div",{...e,draggable:!0,children:[t,Zm("div",{contentEditable:!1,children:Zm(Jm,{className:o?"--selected":""})})]})}import{Editor as Yr,Element as Qb,Path as tc,Transforms as Vo}from"slate";function jb(e){let{selection:t}=e;if(!t)return!1;let o=b(e,i=>Qb.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)Yr.withoutNormalizing(e,()=>{Vo.insertNodes(e,[r,n]),Vo.move(e)});else{let i=tc.next(o[1]);Yr.withoutNormalizing(e,()=>{Vo.insertNodes(e,[r,n],{at:i});let a=tc.next(i);Vo.select(e,Yr.start(e,a))})}return!0}function oc(e){return{insertHorizontalRule:g(jb,e)}}import{jsx as Xb}from"react/jsx-runtime";var rc=y((e,t,{createPolicy:o})=>(e.horizontalRule=oc(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 Xb(ec,{...r})},onKeyDown:_({"super+-":e.horizontalRule.insertHorizontalRule})}})));import nc from"@emotion/styled";var ic=nc("code")`
1321
1321
  color: var(--shade-600);
1322
1322
  background-color: var(--inline-code-bgcolor);
1323
1323
  border: 1px solid var(--inline-code-border-color);
@@ -1343,7 +1343,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1343
1343
  opacity: 0;
1344
1344
  width: 1px;
1345
1345
  overflow: hidden;
1346
- `;import{jsx as ac,jsxs as Yb}from"react/jsx-runtime";var lc=y(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?Yb(ic,{spellCheck:!1,children:[ac(Jr,{contentEditable:!1,children:"|"}),o,ac(Jr,{contentEditable:!1,children:"|"})]}):o,onKeyDown:_({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as jt,Element as fE,Range as hE,Transforms as Bc}from"slate";function sc(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 mc(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 cc(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 Jb=2;function _o(e){let t=E(e,V);return t?t[0].depth:0}function Zr(e){return Fe(e,V)?_o(e)<Jb:!1}function en(e){return Fe(e,V)?_o(e)>0:!1}function pc(e){Zr(e)&&e.list.indent()}function dc(e){en(e)&&e.list.outdent()}function uc(e){return ko(e,t=>({depth:t.depth+1}),{match:V})}import{Editor as Zb,Transforms as tn}from"slate";function fc(e){let t=E(e,V);if(!t)return!1;let[o,r]=t;if(Zb.isEmpty(e,o))return o.depth>0?(tn.setNodes(e,{depth:o.depth-1},{at:r}),!0):(Wt(e,{type:"paragraph"},r),!0);tn.splitNodes(e,{always:!0});let n=E(e,V);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&tn.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as eE}from"slate";function hc(e){let t=Array.from(eE.nodes(e,{match:V}));for(let o of t)if(o[0].depth===0)return!0;return ko(e,o=>({depth:Math.max(0,o.depth-1)}),{match:V})}import{Transforms as tE}from"slate";function gc(e,{at:t=e.selection}={}){let o=E(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;return tE.setNodes(e,{checked:r},{at:o[1]}),!0}function bc(e){return{indent:g(uc,e),outdent:g(hc,e),convertUnorderedList:g(cc,e),convertOrderedList:g(sc,e),convertTaskList:g(mc,e),insertBreak:g(fc,e),toggleTaskListItem:g(gc,e),getListDepth:g(_o,e),canIncreaseDepth:g(Zr,e),canDecreaseDepth:g(en,e),increaseDepth:g(pc,e),decreaseDepth:g(dc,e)}}import{Element as oE,Transforms as rE}from"slate";var Ec=bo(["ordered-list-item"]);function Ko(e,t){let[o,r]=t;return oE.isElement(o)?lt(e,[o,r],(n,i)=>{if(!Ec(i[0]))return!1;let a=Ec(n[0])||V(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(rE.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function kc(e,t){let[o]=t;return V(o)?Ko(e,t):!1}import{clsx as iE}from"clsx";import{useEffect as aE}from"react";import{ReactEditor as lE,useSlateStatic as sE}from"slate-react";import Go from"@emotion/styled";var on=Go("li")`
1346
+ `;import{jsx as ac,jsxs as Yb}from"react/jsx-runtime";var lc=y(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?Yb(ic,{spellCheck:!1,children:[ac(Jr,{contentEditable:!1,children:"|"}),o,ac(Jr,{contentEditable:!1,children:"|"})]}):o,onKeyDown:_({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as jt,Element as fE,Range as hE,Transforms as Bc}from"slate";function sc(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 mc(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 cc(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 Jb=2;function _o(e){let t=b(e,V);return t?t[0].depth:0}function Zr(e){return Fe(e,V)?_o(e)<Jb:!1}function en(e){return Fe(e,V)?_o(e)>0:!1}function pc(e){Zr(e)&&e.list.indent()}function dc(e){en(e)&&e.list.outdent()}function uc(e){return ko(e,t=>({depth:t.depth+1}),{match:V})}import{Editor as Zb,Transforms as tn}from"slate";function fc(e){let t=b(e,V);if(!t)return!1;let[o,r]=t;if(Zb.isEmpty(e,o))return o.depth>0?(tn.setNodes(e,{depth:o.depth-1},{at:r}),!0):(Wt(e,{type:"paragraph"},r),!0);tn.splitNodes(e,{always:!0});let n=b(e,V);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&tn.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as eE}from"slate";function hc(e){let t=Array.from(eE.nodes(e,{match:V}));for(let o of t)if(o[0].depth===0)return!0;return ko(e,o=>({depth:Math.max(0,o.depth-1)}),{match:V})}import{Transforms as tE}from"slate";function gc(e,{at:t=e.selection}={}){let o=b(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;return tE.setNodes(e,{checked:r},{at:o[1]}),!0}function bc(e){return{indent:g(uc,e),outdent:g(hc,e),convertUnorderedList:g(cc,e),convertOrderedList:g(sc,e),convertTaskList:g(mc,e),insertBreak:g(fc,e),toggleTaskListItem:g(gc,e),getListDepth:g(_o,e),canIncreaseDepth:g(Zr,e),canDecreaseDepth:g(en,e),increaseDepth:g(pc,e),decreaseDepth:g(dc,e)}}import{Element as oE,Transforms as rE}from"slate";var Ec=bo(["ordered-list-item"]);function Ko(e,t){let[o,r]=t;return oE.isElement(o)?lt(e,[o,r],(n,i)=>{if(!Ec(i[0]))return!1;let a=Ec(n[0])||V(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(rE.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function kc(e,t){let[o]=t;return V(o)?Ko(e,t):!1}import{clsx as iE}from"clsx";import{useEffect as aE}from"react";import{ReactEditor as lE,useSlateStatic as sE}from"slate-react";import Go from"@emotion/styled";var on=Go("li")`
1347
1347
  margin-top: 0.5em;
1348
1348
  margin-bottom: 0.5em;
1349
1349
  list-style-position: outside;
@@ -1396,7 +1396,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1396
1396
  stroke-width: 3px;
1397
1397
  }
1398
1398
  }
1399
- `;import{jsx as mE}from"react/jsx-runtime";function Tc({element:e,attributes:t,children:o}){let r=sE();aE(()=>{let a=lE.findPath(r,e);Ko(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=iE({"--first-at-depth":e.__firstAtDepth});return mE(yc,{...t,className:i,style:n,children:o})}import{useCallback as cE}from"react";import{useSlateStatic as pE}from"slate-react";import{jsx as qe,jsxs as Cc}from"react/jsx-runtime";var wc=e=>Cc("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:[qe("path",{d:"M0 0h24v24H0z",stroke:"none"}),qe("rect",{x:4,y:4,width:16,height:16,rx:2})]}),Ic=e=>Cc("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:[qe("path",{d:"M0 0h24v24H0z",stroke:"none"}),qe("path",{d:"m9 11 3 3 8-8",className:"--checkmark"}),qe("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),Mc=e=>qe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",...e,children:qe("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 rn,jsxs as dE}from"react/jsx-runtime";function Pc({element:e,attributes:t,children:o}){let r=pE(),n=cE(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return dE(vc,{...t,style:{marginLeft:i},children:[rn("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?rn(Ic,{onClick:n,style:{cursor:"pointer"}}):rn(wc,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as Sc,jsxs as uE}from"react/jsx-runtime";function Lc({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return uE(xc,{...t,style:{marginLeft:r},children:[Sc("div",{className:"--list-item-icon",contentEditable:!1,children:Sc(Mc,{})}),o]})}import{jsx as nn}from"react/jsx-runtime";function Rc({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return nn(Tc,{element:e,attributes:t,children:o});case"unordered-list-item":return nn(Lc,{element:e,attributes:t,children:o});case"task-list-item":return nn(Pc,{element:e,attributes:t,children:o})}}var $c=["unordered-list-item","ordered-list-item","task-list-item"],V=bo($c);function gE(e,t){if(t!==" "||!e.selection||!hE.isCollapsed(e.selection))return!1;let[o]=Array.from(jt.nodes(e,{match:s=>fE.isElement(s)&&s.type==="paragraph",mode:"lowest"}));if(!o)return!1;let[,r]=o,i={anchor:jt.start(e,r),focus:e.selection.anchor},a=jt.string(e,i),l=/^-\s+\[([ xX])\]$/.exec(a);return l?(jt.withoutNormalizing(e,()=>{Bc.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 Dc=y((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType($c);let r=e.list=bc(e),n=_({tab:r.indent,"shift+tab":r.outdent,"super+7":g(r.convertOrderedList,!0),"super+8":g(r.convertUnorderedList,!0),"super+9":g(r.convertTaskList,!0)});return o({name:"list",editor:{normalizeNode:i=>kc(e,i),insertText:i=>gE(e,i),insertBreak:r.insertBreak,deleteBackward:i=>{if(i!=="character"||!Fe(e,V))return!1;let a=E(e,V);if(!a)return!1;let[l,s]=a;return l.depth>0?(Bc.setNodes(e,{depth:l.depth-1},{at:s}),!0):(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:Rc,onKeyDown(i){return jt.nodes(e,{match:V})?n(i):!1}}})});import{clsx as vE}from"clsx";import{Editor as an,Range as TE}from"slate";import{Editor as bE,Text as zc,Transforms as EE}from"slate";function Nc(e,{at:t=e.selection}={}){if(t==null)return;let o=[...bE.nodes(e,{match:n=>zc.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);EE.setNodes(e,r,{match:n=>zc.isText(n),split:!0,at:t})}import{Editor as Qe,Point as kE,Range as xE}from"slate";function je(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=xE.isRange(r)?r.focus:r,i=kE.isPoint(n)&&(Qe.after(e,n)===null||Qe.isEnd(e,n,Qe.end(e,[]))),a=t,s=(Qe.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?Qe.removeMark(e,a):Qe.addMark(e,a,!0),typeof o=="string"&&Qe.removeMark(e,o)}function Hc(e){return{removeMarks:g(Nc,e),toggleMark:g(je,e),toggleBold:()=>je(e,"bold"),toggleItalic:()=>je(e,"italic"),toggleUnderline:()=>je(e,"underline"),toggleStrike:()=>je(e,"strike"),toggleHighlight:()=>je(e,"highlight")}}import yE from"@emotion/styled";var Ac=yE("span")`
1399
+ `;import{jsx as mE}from"react/jsx-runtime";function Tc({element:e,attributes:t,children:o}){let r=sE();aE(()=>{let a=lE.findPath(r,e);Ko(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=iE({"--first-at-depth":e.__firstAtDepth});return mE(yc,{...t,className:i,style:n,children:o})}import{useCallback as cE}from"react";import{useSlateStatic as pE}from"slate-react";import{jsx as qe,jsxs as Cc}from"react/jsx-runtime";var wc=e=>Cc("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:[qe("path",{d:"M0 0h24v24H0z",stroke:"none"}),qe("rect",{x:4,y:4,width:16,height:16,rx:2})]}),Ic=e=>Cc("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:[qe("path",{d:"M0 0h24v24H0z",stroke:"none"}),qe("path",{d:"m9 11 3 3 8-8",className:"--checkmark"}),qe("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),Mc=e=>qe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",...e,children:qe("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 rn,jsxs as dE}from"react/jsx-runtime";function Pc({element:e,attributes:t,children:o}){let r=pE(),n=cE(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return dE(vc,{...t,style:{marginLeft:i},children:[rn("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?rn(Ic,{onClick:n,style:{cursor:"pointer"}}):rn(wc,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as Sc,jsxs as uE}from"react/jsx-runtime";function Lc({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return uE(xc,{...t,style:{marginLeft:r},children:[Sc("div",{className:"--list-item-icon",contentEditable:!1,children:Sc(Mc,{})}),o]})}import{jsx as nn}from"react/jsx-runtime";function Rc({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return nn(Tc,{element:e,attributes:t,children:o});case"unordered-list-item":return nn(Lc,{element:e,attributes:t,children:o});case"task-list-item":return nn(Pc,{element:e,attributes:t,children:o})}}var $c=["unordered-list-item","ordered-list-item","task-list-item"],V=bo($c);function gE(e,t){if(t!==" "||!e.selection||!hE.isCollapsed(e.selection))return!1;let[o]=Array.from(jt.nodes(e,{match:s=>fE.isElement(s)&&s.type==="paragraph",mode:"lowest"}));if(!o)return!1;let[,r]=o,i={anchor:jt.start(e,r),focus:e.selection.anchor},a=jt.string(e,i),l=/^-\s+\[([ xX])\]$/.exec(a);return l?(jt.withoutNormalizing(e,()=>{Bc.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 Dc=y((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType($c);let r=e.list=bc(e),n=_({tab:r.indent,"shift+tab":r.outdent,"super+7":g(r.convertOrderedList,!0),"super+8":g(r.convertUnorderedList,!0),"super+9":g(r.convertTaskList,!0)});return o({name:"list",editor:{normalizeNode:i=>kc(e,i),insertText:i=>gE(e,i),insertBreak:r.insertBreak,deleteBackward:i=>{if(i!=="character"||!Fe(e,V))return!1;let a=b(e,V);if(!a)return!1;let[l,s]=a;return l.depth>0?(Bc.setNodes(e,{depth:l.depth-1},{at:s}),!0):(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:Rc,onKeyDown(i){return jt.nodes(e,{match:V})?n(i):!1}}})});import{clsx as vE}from"clsx";import{Editor as an,Range as TE}from"slate";import{Editor as bE,Text as zc,Transforms as EE}from"slate";function Nc(e,{at:t=e.selection}={}){if(t==null)return;let o=[...bE.nodes(e,{match:n=>zc.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);EE.setNodes(e,r,{match:n=>zc.isText(n),split:!0,at:t})}import{Editor as Qe,Point as kE,Range as xE}from"slate";function je(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=xE.isRange(r)?r.focus:r,i=kE.isPoint(n)&&(Qe.after(e,n)===null||Qe.isEnd(e,n,Qe.end(e,[]))),a=t,s=(Qe.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?Qe.removeMark(e,a):Qe.addMark(e,a,!0),typeof o=="string"&&Qe.removeMark(e,o)}function Hc(e){return{removeMarks:g(Nc,e),toggleMark:g(je,e),toggleBold:()=>je(e,"bold"),toggleItalic:()=>je(e,"italic"),toggleUnderline:()=>je(e,"underline"),toggleStrike:()=>je(e,"strike"),toggleHighlight:()=>je(e,"highlight")}}import yE from"@emotion/styled";var Ac=yE("span")`
1400
1400
  &.--bold {
1401
1401
  font-weight: bold;
1402
1402
  }
@@ -1419,7 +1419,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1419
1419
  &.--highlight {
1420
1420
  background-color: #ffff00;
1421
1421
  }
1422
- `;import{jsx as wE}from"react/jsx-runtime";var Oc=y(e=>{e.marksPlugin=Hc(e),e.activeMarks={};let t=_({"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&&TE.isRange(e.selection)){let n=e.selection.focus;(an.after(e,n)===null||an.isEnd(e,n,an.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>wE(Ac,{className:vE({"--bold":n.bold,"--italic":n.italic,"--underline":n.underline,"--strike":n.strike,"--highlight":n.highlight}),children:i}),onKeyDown:n=>!!t(n)}}});import{Editor as Xt,Point as Uc}from"slate";function Fc(e){if(!e.selection)return;let t=Xt.parent(e,e.selection);fa(e,t[1])}var Wc=y(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=Xt.parent(e,e.selection);return Uc.equals(Xt.start(e,t[1]),e.selection.anchor)?function(){Fc(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=Xt.parent(e,e.selection);return Uc.equals(Xt.end(e,t[1]),e.selection.anchor)?function(){Fc(e)}:!1}},editableProps:{}}));import{Element as pk}from"slate";import{Editor as _c,Path as CE,Transforms as Kc}from"slate";import{Editor as IE,Path as ME}from"slate";function Vc(e,t,o){let r=[...IE.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=at(e,o,{at:i});for(let m of r){let c=at(e,o,{at:m});if(l&&c&&ME.equals(l,c)||l==null&&c==null)a=m;else{let d={anchor:i,focus:a};n.push(d),i=a=m,l=c}}let s={anchor:i,focus:a};return n.push(s),n.reverse(),n}function Gc(e,t){if(e.selection==null)return!1;let[o,r]=_c.edges(e,e.selection),n=at(e,t,{at:o}),i=at(e,t,{at:r});if(!n&&!i||n&&i&&CE.equals(n,i))return!1;let a=Vc(e,e.selection,t);return _c.withoutNormalizing(e,()=>{for(let l of a)Kc.delete(e,{at:l});Kc.collapse(e,{edge:"start"})}),!0}import{Transforms as _E}from"slate";function O(e,{at:t=e.selection}={}){if(t==null)return;let o=E(e,"table-cell",{at:t});if(!o)return;let r=E(e,"table-row",{at:t});if(!r)return;let n=E(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 PE,Transforms as qc}from"slate";function vt(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function Qc(e,{offset:t=0,at:o=e.selection}={}){let r=O(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return PE.withoutNormalizing(e,()=>{let{columns:s}=n,m=[...s],c=Math.min(l,s.length-1);m.splice(l,0,s[c]),qc.setNodes(e,{columns:m},{at:i}),n.children.forEach((d,p)=>{qc.insertNodes(e,vt(l),{at:[...i,p,l]})})}),!0}import{Transforms as SE}from"slate";function LE(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>vt(t))}}function ln(e,{at:t=e.selection,offset:o=0}={}){let r=O(e,{at:t});if(!r)return!1;let n=LE(r.tableElement.columns.length);return SE.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function jc(e,{at:t}={}){return ln(e,{at:t,offset:1})}import{Editor as sn,Element as RE,Path as BE,Transforms as Yt}from"slate";function Xc(e){return[...Array(e).keys()]}function $E(e){return Xc(e).map(()=>({align:"left"}))}function DE(e,t){return{type:"table",columns:$E(e),children:Xc(t).map(()=>zE(e))}}function zE(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>vt(t))}}function Yc(e,t,o,{at:r=e.selection}={}){let n=DE(t,o);return NE(e,n,{at:r})}function NE(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>RE.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;sn.withoutNormalizing(e,()=>{Yt.insertNodes(e,t,{at:o}),n&&(Yt.select(e,n),Yt.move(e))})}else{let n=BE.next(r[1]);sn.withoutNormalizing(e,()=>{Yt.insertNodes(e,t,{at:n}),Yt.select(e,sn.start(e,n))})}return!0}import{Path as Jc}from"slate";function Zc(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return te(e,[...i,r+1,o]),!0;try{return te(e,Jc.next(i)),!0}catch{return!1}}function ep(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return te(e,[...n,r-1,o]),!0;try{return Ea(e,Jc.previous(n)),!0}catch{return!1}}import{ReactEditor as HE}from"slate-react";function AE(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;try{return e.getRangeAt(0).getBoundingClientRect()}catch{return null}}function OE(e,t){return HE.toDOMNode(e,t).getBoundingClientRect()}function mn(e,t){let o=AE();if(!o)return!1;let r=OE(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function tp(e){let t=O(e);return t&&setTimeout(()=>{mn(e,t.cellElement)||Zc(e,t)}),!1}function op(e){let t=O(e);return t&&setTimeout(()=>{mn(e,t.cellElement)||ep(e,t)}),!1}import{Editor as rp,Transforms as cn}from"slate";import{Transforms as UE}from"slate";function Tt(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(UE.removeNodes(e,{at:t.tablePath}),!0)}function np(e,{at:t=e.selection}={}){let o=O(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return Tt(e);rp.withoutNormalizing(e,()=>{let s=[...r.columns];s.splice(a,1),cn.setNodes(e,{columns:s},{at:n}),r.children.forEach((c,d)=>{cn.removeNodes(e,{at:[...n,d,a]})});let m=rp.start(e,[...n,i,Math.min(a,l-2)]);cn.select(e,m)})}import{Editor as ip,Transforms as ap}from"slate";function lp(e,{at:t=e.selection}={}){let o=O(e,{at:t});return o===void 0?!1:o.rowCount===1?(Tt(e),!0):(ip.withoutNormalizing(e,()=>{ap.removeNodes(e,{at:o.rowPath}),ap.select(e,ip.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as FE}from"slate";function sp(e,t){let o=O(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}),FE.setNodes(e,{columns:a},{at:n}),!0}import{Path as WE,Transforms as VE}from"slate";function mp(e){let t=O(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return te(e,[...a,n,o+1]),!0;if(n<i-1)return te(e,[...a,n+1,0]),!0;let l=WE.next(a);return VE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),te(e,l),!0}function cp(e){let t=O(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return te(e,[...i,n,o-1]),!0;if(n>0)return te(e,[...i,n-1,r-1]),!0}function pp(e){let t=O(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(te(e,[...a,n,o+1]),!0):n<i-1?(te(e,[...a,n+1,0]),!0):(jc(e),te(e,[...a,n+1,0]),!0)}function dp(e){return{getTableInfo:g(O,e),insertTable:g(Yc,e),insertColumn:g(Qc,e),insertRow:g(ln,e),removeTable:g(Tt,e),removeColumn:g(np,e),removeRow:g(lp,e),tabForward:g(mp,e),tabBackward:g(cp,e),shiftEnterForward:g(pp,e),selectCell:g(KE,e),down:g(tp,e),up:g(op,e),setTableColumnAlign:g(sp,e)}}function KE(e,{at:t=e.selection}={}){let o=O(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return _E.select(e,r),!0}import{Transforms as GE}from"slate";function qo(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,s)=>{(l.x!==s||l.y!==i)&&(GE.setNodes(e,{x:s,y:i},{at:[...t[1],i,s]}),o=!0)})}),o}import{Editor as qE,Transforms as pn}from"slate";function up(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(qE.withoutNormalizing(e,()=>{pn.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)pn.mergeNodes(e,{at:[...r,n]});pn.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as jE}from"react";import{ReactEditor as XE,useSelected as YE,useSlateStatic as JE}from"slate-react";import jo from"@emotion/styled";import we from"@emotion/styled";var fp=we("div")`
1422
+ `;import{jsx as wE}from"react/jsx-runtime";var Oc=y(e=>{e.marksPlugin=Hc(e),e.activeMarks={};let t=_({"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&&TE.isRange(e.selection)){let n=e.selection.focus;(an.after(e,n)===null||an.isEnd(e,n,an.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>wE(Ac,{className:vE({"--bold":n.bold,"--italic":n.italic,"--underline":n.underline,"--strike":n.strike,"--highlight":n.highlight}),children:i}),onKeyDown:n=>!!t(n)}}});import{Editor as Xt,Point as Uc}from"slate";function Fc(e){if(!e.selection)return;let t=Xt.parent(e,e.selection);fa(e,t[1])}var Wc=y(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=Xt.parent(e,e.selection);return Uc.equals(Xt.start(e,t[1]),e.selection.anchor)?function(){Fc(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=Xt.parent(e,e.selection);return Uc.equals(Xt.end(e,t[1]),e.selection.anchor)?function(){Fc(e)}:!1}},editableProps:{}}));import{Element as pk}from"slate";import{Editor as _c,Path as CE,Transforms as Kc}from"slate";import{Editor as IE,Path as ME}from"slate";function Vc(e,t,o){let r=[...IE.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=at(e,o,{at:i});for(let m of r){let c=at(e,o,{at:m});if(l&&c&&ME.equals(l,c)||l==null&&c==null)a=m;else{let d={anchor:i,focus:a};n.push(d),i=a=m,l=c}}let s={anchor:i,focus:a};return n.push(s),n.reverse(),n}function Gc(e,t){if(e.selection==null)return!1;let[o,r]=_c.edges(e,e.selection),n=at(e,t,{at:o}),i=at(e,t,{at:r});if(!n&&!i||n&&i&&CE.equals(n,i))return!1;let a=Vc(e,e.selection,t);return _c.withoutNormalizing(e,()=>{for(let l of a)Kc.delete(e,{at:l});Kc.collapse(e,{edge:"start"})}),!0}import{Transforms as _E}from"slate";function O(e,{at:t=e.selection}={}){if(t==null)return;let o=b(e,"table-cell",{at:t});if(!o)return;let r=b(e,"table-row",{at:t});if(!r)return;let n=b(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 PE,Transforms as qc}from"slate";function vt(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function Qc(e,{offset:t=0,at:o=e.selection}={}){let r=O(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return PE.withoutNormalizing(e,()=>{let{columns:s}=n,m=[...s],c=Math.min(l,s.length-1);m.splice(l,0,s[c]),qc.setNodes(e,{columns:m},{at:i}),n.children.forEach((d,p)=>{qc.insertNodes(e,vt(l),{at:[...i,p,l]})})}),!0}import{Transforms as SE}from"slate";function LE(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>vt(t))}}function ln(e,{at:t=e.selection,offset:o=0}={}){let r=O(e,{at:t});if(!r)return!1;let n=LE(r.tableElement.columns.length);return SE.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function jc(e,{at:t}={}){return ln(e,{at:t,offset:1})}import{Editor as sn,Element as RE,Path as BE,Transforms as Yt}from"slate";function Xc(e){return[...Array(e).keys()]}function $E(e){return Xc(e).map(()=>({align:"left"}))}function DE(e,t){return{type:"table",columns:$E(e),children:Xc(t).map(()=>zE(e))}}function zE(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>vt(t))}}function Yc(e,t,o,{at:r=e.selection}={}){let n=DE(t,o);return NE(e,n,{at:r})}function NE(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=b(e,n=>RE.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;sn.withoutNormalizing(e,()=>{Yt.insertNodes(e,t,{at:o}),n&&(Yt.select(e,n),Yt.move(e))})}else{let n=BE.next(r[1]);sn.withoutNormalizing(e,()=>{Yt.insertNodes(e,t,{at:n}),Yt.select(e,sn.start(e,n))})}return!0}import{Path as Jc}from"slate";function Zc(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return te(e,[...i,r+1,o]),!0;try{return te(e,Jc.next(i)),!0}catch{return!1}}function ep(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return te(e,[...n,r-1,o]),!0;try{return Ea(e,Jc.previous(n)),!0}catch{return!1}}import{ReactEditor as HE}from"slate-react";function AE(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;try{return e.getRangeAt(0).getBoundingClientRect()}catch{return null}}function OE(e,t){return HE.toDOMNode(e,t).getBoundingClientRect()}function mn(e,t){let o=AE();if(!o)return!1;let r=OE(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function tp(e){let t=O(e);return t&&setTimeout(()=>{mn(e,t.cellElement)||Zc(e,t)}),!1}function op(e){let t=O(e);return t&&setTimeout(()=>{mn(e,t.cellElement)||ep(e,t)}),!1}import{Editor as rp,Transforms as cn}from"slate";import{Transforms as UE}from"slate";function Tt(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(UE.removeNodes(e,{at:t.tablePath}),!0)}function np(e,{at:t=e.selection}={}){let o=O(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return Tt(e);rp.withoutNormalizing(e,()=>{let s=[...r.columns];s.splice(a,1),cn.setNodes(e,{columns:s},{at:n}),r.children.forEach((c,d)=>{cn.removeNodes(e,{at:[...n,d,a]})});let m=rp.start(e,[...n,i,Math.min(a,l-2)]);cn.select(e,m)})}import{Editor as ip,Transforms as ap}from"slate";function lp(e,{at:t=e.selection}={}){let o=O(e,{at:t});return o===void 0?!1:o.rowCount===1?(Tt(e),!0):(ip.withoutNormalizing(e,()=>{ap.removeNodes(e,{at:o.rowPath}),ap.select(e,ip.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as FE}from"slate";function sp(e,t){let o=O(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}),FE.setNodes(e,{columns:a},{at:n}),!0}import{Path as WE,Transforms as VE}from"slate";function mp(e){let t=O(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return te(e,[...a,n,o+1]),!0;if(n<i-1)return te(e,[...a,n+1,0]),!0;let l=WE.next(a);return VE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),te(e,l),!0}function cp(e){let t=O(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return te(e,[...i,n,o-1]),!0;if(n>0)return te(e,[...i,n-1,r-1]),!0}function pp(e){let t=O(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(te(e,[...a,n,o+1]),!0):n<i-1?(te(e,[...a,n+1,0]),!0):(jc(e),te(e,[...a,n+1,0]),!0)}function dp(e){return{getTableInfo:g(O,e),insertTable:g(Yc,e),insertColumn:g(Qc,e),insertRow:g(ln,e),removeTable:g(Tt,e),removeColumn:g(np,e),removeRow:g(lp,e),tabForward:g(mp,e),tabBackward:g(cp,e),shiftEnterForward:g(pp,e),selectCell:g(KE,e),down:g(tp,e),up:g(op,e),setTableColumnAlign:g(sp,e)}}function KE(e,{at:t=e.selection}={}){let o=O(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return _E.select(e,r),!0}import{Transforms as GE}from"slate";function qo(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,s)=>{(l.x!==s||l.y!==i)&&(GE.setNodes(e,{x:s,y:i},{at:[...t[1],i,s]}),o=!0)})}),o}import{Editor as qE,Transforms as pn}from"slate";function up(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(qE.withoutNormalizing(e,()=>{pn.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)pn.mergeNodes(e,{at:[...r,n]});pn.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as jE}from"react";import{ReactEditor as XE,useSelected as YE,useSlateStatic as JE}from"slate-react";import jo from"@emotion/styled";import we from"@emotion/styled";var fp=we("div")`
1423
1423
  position: absolute;
1424
1424
  /**
1425
1425
  * very slightly shaded
@@ -1626,7 +1626,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1626
1626
  height: 1.5em;
1627
1627
  background: rgba(0, 0, 0, 0.05);
1628
1628
  border-radius: 50%;
1629
- `;import{jsx as Np}from"react/jsx-runtime";function Hp(){return Np(Dp,{contentEditable:!1,children:Np(zp,{className:"--table-menu-tile"})})}import{jsx as fn,jsxs as sk}from"react/jsx-runtime";function Ap({element:e,attributes:t,children:o}){let r=ak(Xo),n=lk(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return sk(Tp,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?fn(Hp,{}):null,a?fn(Bp,{cellElement:e}):null,l?fn(Lp,{cellElement:e}):null]})}import{jsx as mk}from"react/jsx-runtime";function Op({attributes:e,children:t}){return mk(wp,{...e,children:t})}import{jsx as ck}from"react/jsx-runtime";function Up({attributes:e,children:t}){return ck(vp,{...e,children:t})}import{jsx as Zo}from"react/jsx-runtime";function Fp({element:e,attributes:t,children:o}){switch(e.type){case"table":return Zo(Ip,{element:e,attributes:t,children:o});case"table-row":return Zo(Up,{element:e,attributes:t,children:o});case"table-cell":return Zo(Ap,{element:e,attributes:t,children:o});case"table-content":return Zo(Op,{element:e,attributes:t,children:o})}}var Wp=y((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=dp(e),o({name:"table",editor:{deleteBackward:()=>Fe(e,"table-cell"),deleteForward:()=>ca(e,"table-cell"),deleteFragment:()=>Gc(e,["table-cell"]),insertBreak:()=>E(e,"table-cell")?(e.insertText(`
1629
+ `;import{jsx as Np}from"react/jsx-runtime";function Hp(){return Np(Dp,{contentEditable:!1,children:Np(zp,{className:"--table-menu-tile"})})}import{jsx as fn,jsxs as sk}from"react/jsx-runtime";function Ap({element:e,attributes:t,children:o}){let r=ak(Xo),n=lk(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return sk(Tp,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?fn(Hp,{}):null,a?fn(Bp,{cellElement:e}):null,l?fn(Lp,{cellElement:e}):null]})}import{jsx as mk}from"react/jsx-runtime";function Op({attributes:e,children:t}){return mk(wp,{...e,children:t})}import{jsx as ck}from"react/jsx-runtime";function Up({attributes:e,children:t}){return ck(vp,{...e,children:t})}import{jsx as Zo}from"react/jsx-runtime";function Fp({element:e,attributes:t,children:o}){switch(e.type){case"table":return Zo(Ip,{element:e,attributes:t,children:o});case"table-row":return Zo(Up,{element:e,attributes:t,children:o});case"table-cell":return Zo(Ap,{element:e,attributes:t,children:o});case"table-content":return Zo(Op,{element:e,attributes:t,children:o})}}var Wp=y((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=dp(e),o({name:"table",editor:{deleteBackward:()=>Fe(e,"table-cell"),deleteForward:()=>ca(e,"table-cell"),deleteFragment:()=>Gc(e,["table-cell"]),insertBreak:()=>b(e,"table-cell")?(e.insertText(`
1630
1630
  `),!0):!1,isMaster(r){if(r.type==="table")return!0},normalizeNode:r=>{let[n]=r;if(!pk.isElement(n))return!1;switch(n.type){case"table":return qo(e,r);case"table-cell":return up(e,r)}return!1}},editableProps:{renderElement:Fp,onKeyDown:_({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 hk}from"@emotion/react";import{css as dk}from"@emotion/react";var uk=`
1631
1631
  --blue-50: rgb(239 246 255);
1632
1632
  --blue-100: rgb(219 234 254);
@@ -1675,7 +1675,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1675
1675
  /* Horizontal Rule Colors */
1676
1676
  --hr-color: var(--shade-300);
1677
1677
  }
1678
- `;import{Fragment as gk,jsx as _p,jsxs as bk}from"react/jsx-runtime";var Kp=y(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>bk(gk,{children:[_p(hk,{styles:Vp}),_p(o,{...t})]}),editableProps:{}}));import{clsx as ox}from"clsx";import{useCallback as rx,useRef as nx}from"react";import{Editor as ix,Transforms as ax}from"slate";import{ReactEditor as lx,useFocused as sx,useSlateStatic as mx}from"slate-react";import{clsx as Ek}from"clsx";import{useCallback as jp,useRef as kk,useState as xk}from"react";import{ReactEditor as yk,useSlateStatic as vk}from"slate-react";import hn from"@emotion/styled";var Gp=hn(re)`
1678
+ `;import{Fragment as gk,jsx as _p,jsxs as bk}from"react/jsx-runtime";var Kp=y(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>bk(gk,{children:[_p(hk,{styles:Vp}),_p(o,{...t})]}),editableProps:{}}));import{clsx as rx}from"clsx";import{useCallback as nx,useRef as ix}from"react";import{Editor as ax,Transforms as lx}from"slate";import{ReactEditor as sx,useFocused as mx,useSlateStatic as cx}from"slate-react";import{clsx as Ek}from"clsx";import{useCallback as jp,useRef as kk,useState as xk}from"react";import{ReactEditor as yk,useSlateStatic as vk}from"slate-react";import hn from"@emotion/styled";var Gp=hn(re)`
1679
1679
  padding: 0.5em;
1680
1680
  `,qp=hn("div")`
1681
1681
  display: grid;
@@ -1692,7 +1692,7 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1692
1692
  &.--selected {
1693
1693
  background: var(--blue-100);
1694
1694
  }
1695
- `;import{Fragment as Tk,jsx as er,jsxs as wk}from"react/jsx-runtime";function Xp(e){return[...Array(e).keys()]}function Yp({dest:e,close:t}){let[o,r]=xk({x:0,y:0}),n=vk(),i=kk(null),a=oe({src:i,dest:e},({dest:d})=>d?{left:d.left-8,top:d.top+d.height}:{left:0,top:0}),l=Xp(5).map(d=>d+1),s=Xp(5).map(d=>d+1),m=jp((d,p)=>{r({x:d,y:p})},[r]),c=jp((d,p)=>{n.tablePlugin.insertTable(d,p),yk.focus(n),t()},[n]);return wk(Tk,{children:[er(Re,{close:t}),er(Gp,{ref:i,style:a,children:er(qp,{onMouseLeave:()=>m(0,0),children:l.map(d=>s.map(p=>{let u=p<=o.x&&d<=o.y;return er(Qp,{className:Ek({"--selected":u}),onMouseEnter:()=>m(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import{useEffect as Qk,useRef as jk,useState as Xk}from"react";import{useSlateStatic as Yk}from"slate-react";import{jsx as b,jsxs as Mt}from"react/jsx-runtime";var Jp=()=>b(x,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),Zp=()=>b(x,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),ed=()=>b(x,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),td=()=>b(x,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),od=()=>b(x,{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"})}),rd=()=>b(x,{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 nd=()=>b(x,{children:b("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),gn=()=>b(x,{children:b("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),id=()=>b(x,{children:b("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var tr=()=>Mt(x,{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 bn=()=>b(x,{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"})}),ad=()=>Mt(x,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var ld=()=>b(x,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),sd=()=>Mt(x,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),md=()=>b(x,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),cd=()=>b(x,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),pd=()=>Mt(x,{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 dd=()=>b(x,{children:b("path",{d:"M12 5v14M5 12h14"})}),ud=()=>b(x,{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"})}),fd=()=>b(x,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var hd=()=>Mt(x,{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"})]}),En=()=>b(x,{children:b("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),gd=()=>b(x,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),bd=()=>b(x,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Ed=()=>b(x,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),kd=()=>Mt(x,{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"})]}),xd=()=>b(x,{children:b("path",{d:"M5 12h14"})});var kn=[{icon:gd,title:f("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:bd,title:f("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],yd=[{icon:nd,title:f("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:td,title:f("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:od,title:f("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:rd,title:f("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],vd=[...yd],xn=[{icon:Jp,title:f("paragraphStyle"),more:!0,children:yd}];import{useState as Me,useRef as wd,useEffect as Mk,useCallback as yn}from"react";import{useSlateStatic as Ck}from"slate-react";import Ik from"@emotion/styled";var Td=Ik(re)`
1695
+ `;import{Fragment as Tk,jsx as er,jsxs as wk}from"react/jsx-runtime";function Xp(e){return[...Array(e).keys()]}function Yp({dest:e,close:t}){let[o,r]=xk({x:0,y:0}),n=vk(),i=kk(null),a=oe({src:i,dest:e},({dest:d})=>d?{left:d.left-8,top:d.top+d.height}:{left:0,top:0}),l=Xp(5).map(d=>d+1),s=Xp(5).map(d=>d+1),m=jp((d,p)=>{r({x:d,y:p})},[r]),c=jp((d,p)=>{n.tablePlugin.insertTable(d,p),yk.focus(n),t()},[n]);return wk(Tk,{children:[er(Re,{close:t}),er(Gp,{ref:i,style:a,children:er(qp,{onMouseLeave:()=>m(0,0),children:l.map(d=>s.map(p=>{let u=p<=o.x&&d<=o.y;return er(Qp,{className:Ek({"--selected":u}),onMouseEnter:()=>m(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import{useEffect as jk,useRef as Xk,useState as Yk}from"react";import{useSlateStatic as Jk}from"slate-react";import{jsx as E,jsxs as Mt}from"react/jsx-runtime";var Jp=()=>E(x,{children:E("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),Zp=()=>E(x,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:E("path",{d:"m2 12 4 4 4-4"})}),ed=()=>E(x,{width:"0.5em",viewBox:"6 0 12 24",children:E("path",{d:"M9 12h6M12 9v6"})}),td=()=>E(x,{children:E("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),od=()=>E(x,{children:E("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"})}),rd=()=>E(x,{children:E("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 nd=()=>E(x,{children:E("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),gn=()=>E(x,{children:E("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),id=()=>E(x,{children:E("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var tr=()=>Mt(x,{children:[E("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),E("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 bn=()=>E(x,{children:E("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"})}),ad=()=>Mt(x,{children:[E("path",{d:"M10 9l4 3-4 3"}),E("path",{d:"M16 9l4 3-4 3"})]});var ld=()=>E(x,{children:E("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),sd=()=>Mt(x,{children:[E("rect",{x:4,y:4,width:16,height:16,rx:2}),E("path",{d:"M4 10h16M10 4v16"})]}),md=()=>E(x,{children:E("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),cd=()=>E(x,{children:E("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),pd=()=>Mt(x,{children:[E("path",{d:"M15 8h.01"}),E("rect",{x:4,y:4,width:16,height:16,rx:3}),E("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),E("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var dd=()=>E(x,{children:E("path",{d:"M12 5v14M5 12h14"})}),ud=()=>E(x,{children:E("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"})}),fd=()=>E(x,{children:E("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var hd=()=>Mt(x,{children:[E("path",{d:"m9 11 3 3 8-8"}),E("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),En=()=>E(x,{children:E("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),gd=()=>E(x,{children:E("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),bd=()=>E(x,{children:E("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Ed=()=>E(x,{children:E("path",{d:"M18 6L6 18M6 6l12 12"})}),kd=()=>Mt(x,{children:[E("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),E("path",{d:"M13.5 6.5l4 4"}),E("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),xd=()=>E(x,{children:E("path",{d:"M5 12h14"})});var kn=[{icon:gd,title:f("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:bd,title:f("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],yd=[{icon:nd,title:f("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:td,title:f("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:od,title:f("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:rd,title:f("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],vd=[...yd],xn=[{icon:Jp,title:f("paragraphStyle"),more:!0,children:yd}];import{useState as Me,useRef as wd,useEffect as Mk,useCallback as yn}from"react";import{useSlateStatic as Ck}from"slate-react";import Ik from"@emotion/styled";var Td=Ik(re)`
1696
1696
  width: 18em;
1697
1697
  padding: 0;
1698
1698
  overflow: hidden;
@@ -1725,4 +1725,4 @@ ${At(r.slice(1),o).trimStart()}`:At(r,o)).split(`
1725
1725
  margin-top: 0.5em;
1726
1726
  color: var(--shade-500);
1727
1727
  line-height: 1.375;
1728
- `;import{Fragment as Hk,jsx as G,jsxs as Ct}from"react/jsx-runtime";var Nk=Sk("enter");function Cd({dest:e,close:t}){let o=zk(),r=Rk(null),[n,i]=Ye({x:0,y:0}),a=Jt((v,$)=>{i(de=>({x:de.x+v,y:de.y+$}))},[]),l=oe({src:r,dest:e},({src:v,dest:$},de)=>!v||!$?{left:0,top:0}:Be(v,de,{left:$.left-12,top:$.top+$.height},{margin:16})),s={...l,left:l.left+n.x,top:l.top+n.y},m=Lk(()=>{let{selection:v}=o;return v&&!$k.isCollapsed(v)?Bk.string(o,v):""},[]),[c,d]=Ye(""),[p,u]=Ye(""),[h,k]=Ye(m),[L,M]=Ye(m),[T,D]=Ye("external"),[P,H]=Ye(!1),C=()=>{if(T==="internal"){let v=p.trim();if(v==="")return;let $=h.trim(),de=$&&$!==me(v)?`${v}|${$}`:v;o.anchor.insertLink(Ce(de),$||me(v),{select:!0})}else{let v=h.trim()||c,$=L.trim()||void 0;o.anchor.insertLink(c,v,{select:!0,title:$})}Dk.focus(o),t()},B=Jt(v=>{d(v.currentTarget.value)},[d]),S=Jt(v=>{let $=ao(v.currentTarget.value);u($.target),$.display!==void 0&&k($.display)},[u,k]),R=Jt(v=>{let $=v.currentTarget.value;k($),P||M($)},[k,M,P]),w=Jt(v=>{M(v.currentTarget.value),H(!0)},[M]),U=v=>{Nk(v)&&(v.preventDefault(),v.stopPropagation(),C())};return Ct(Hk,{children:[G(Re,{close:t}),Ct(Qa,{ref:r,style:s,children:[G(De,{onDrag:a}),Ct("div",{style:{padding:"0.75em"},children:[o.wysimark.enableInternalLinks?G(Vt,{children:Ct("div",{style:{display:"flex",gap:"0.25em",padding:"0.25em",borderRadius:"0.375em",background:"var(--shade-100)",width:"100%"},children:[G("button",{type:"button",onClick:()=>D("external"),style:{flex:"1 1 0",border:0,borderRadius:"0.25em",padding:"0.375em 0.5em",cursor:"pointer",background:T==="external"?"white":"transparent",color:T==="external"?"var(--shade-700)":"var(--shade-500)",boxShadow:T==="external"?"0 1px 2px rgb(0 0 0 / 12%)":"none"},children:f("linkTypeExternal")}),G("button",{type:"button",onClick:()=>D("internal"),style:{flex:"1 1 0",border:0,borderRadius:"0.25em",padding:"0.375em 0.5em",cursor:"pointer",background:T==="internal"?"white":"transparent",color:T==="internal"?"var(--shade-700)":"var(--shade-500)",boxShadow:T==="internal"?"0 1px 2px rgb(0 0 0 / 12%)":"none"},children:f("linkTypeInternal")})]})}):null,G(Vt,{style:{marginTop:o.wysimark.enableInternalLinks?"0.5em":0},children:T==="internal"?G(_t,{type:"text",value:p,autoFocus:!0,placeholder:f("internalLinkTarget"),onChange:S,onKeyDown:U}):G(_t,{type:"text",value:c,autoFocus:!0,placeholder:f("linkUrl"),onChange:B,onKeyDown:U})}),G(Vt,{style:{marginTop:"0.5em"},children:G(_t,{type:"text",value:h,placeholder:f("linkText"),onChange:R,onKeyDown:U})}),Ct(Vt,{style:{marginTop:"0.5em"},children:[T==="external"?G(_t,{type:"text",value:L,placeholder:f("tooltipText"),onChange:w,onKeyDown:U}):G("span",{style:{flex:"1 1 auto"}}),Ct(vn,{onClick:C,children:[G(tr,{}),G(ed,{})]}),G(vn,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:G(Ed,{})})]}),T==="external"?G(Tn,{children:f("tooltipHint")}):G(Tn,{children:f("internalLinkTargetHint")})]})]})]})}var wn=[{icon:tr,title:f("insertLink"),more:!0,hotkey:"mod+k",Component:Cd},{icon:pd,title:f("insertImageFromUrl"),more:!0,Component:Id},{icon:sd,title:f("insertTable"),more:!0,Component:Yp},{icon:xd,title:f("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Pd=wn,Sd=wn,Ld=[{icon:dd,title:f("insert"),more:!0,children:wn}];import{Editor as Ak}from"slate";function Pt(e){let t=Ak.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 Rd=[{icon:gn,title:f("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>Pt(e).bold},{icon:id,title:f("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>Pt(e).italic},{icon:ud,title:f("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>Pt(e).strike},{icon:md,title:f("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>Pt(e).code},{icon:fd,title:f("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>Pt(e).underline},{icon:kd,title:f("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>Pt(e).highlight,show:e=>!e.wysimark.disableHighlight}],In=Rd,Bd=[{icon:gn,title:f("format"),more:!0,children:Rd}];var $d=[{icon:ld,title:f("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:En,title:f("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:hd,title:f("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Mn=[...$d,"divider",...kn],Dd=[{icon:En,title:f("list"),more:!0,children:[...$d,"divider",...kn]}];import{Editor as zd,Path as Ok,Transforms as or}from"slate";var Nd=[{icon:bn,title:f("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:ad,title:f("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:cd,title:f("codeBlock"),action:e=>{let{selection:t}=e,o=E(e,"code-block");if(o){let[,r]=o,n=zd.string(e,r);or.removeNodes(e,{at:r}),or.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&!Ok.equals(t.anchor.path,t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&t.anchor.offset!==t.focus.offset){let r=zd.string(e,t);or.delete(e),or.insertNodes(e,{type:"code-block",language:"text",children:[{type:"code-block-line",children:[{text:r}]}]});return}e.codeBlock.createCodeBlock({language:"text"})},active:e=>!!E(e,"code-block"),show:e=>!e.wysimark.disableCodeBlock}],Cn=Nd,Hd=[{icon:bn,title:f("quote"),more:!0,children:Nd}];var Uk=[...vd,"divider",...Mn,"divider",...In,"divider",...Pd,"divider",...Cn],Fk=[...xn,"divider",...Mn,"divider",...In,"divider",...Sd,"divider",...Cn],Ad=[...xn,"divider",...Dd,"divider",...Bd,"divider",...Ld,"divider",...Hd],Od=Ad;var St=[Uk,Fk,Ad];import{clsx as Wk}from"clsx";import{useCallback as Pn,useRef as Vk}from"react";import{ReactEditor as _k,useSlate as Kk,useSlateStatic as Gk}from"slate-react";import{jsx as rr,jsxs as qk}from"react/jsx-runtime";function Ud({item:e}){let t=Gk(),o=Kk(),r=e.active?e.active(o):!1,n=Vk(null),i=ne({title:e.title,hotkey:()=>e.hotkey?wo(e.hotkey):void 0}),a=W("menu"),l=Pn(()=>{let c=n.current,d=e.children,p=e.Component;c&&(d?a.open(()=>rr(ct,{dest:c,items:d,close:a.close})):p&&a.open(()=>rr(p,{dest:c,close:a.close})))},[e]),s=Pn(()=>{if(e.action){e.action(t),_k.focus(t);return}a.layer?a.close():l()},[a.layer,e]),m=Pn(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer,l,i.onMouseEnter]);return qk(al,{"data-item-type":"button",ref:n,onMouseEnter:m,onMouseLeave:i.onMouseLeave,onClick:s,className:Wk({"--active":r&&!Er(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Er(e?.title)?.includes("Depth")}),children:[rr(e.icon,{}),e.more?rr(Zp,{}):null]})}import{jsx as Lt}from"react/jsx-runtime";function Jk({item:e}){let t=Yk();return e==="divider"?Lt(nl,{"data-item-type":"divider",children:Lt(il,{})}):(e.show===void 0?!0:e.show(t))?Lt(Ud,{item:e}):null}function Zk(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 ex(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var tx=4;function Fd(){let e=jk(null),[t,o]=Xk(Od);return Qk(()=>{let r=e.current;if(!r)return;let n=()=>{let a=Zk(r);if(a){for(let l=0;l<St.length-1;l++)if(ex(St[l],a.button,a.divider)<a.toolbar-tx){o(St[l]);return}o(St[St.length-1])}},i=new ResizeObserver(n);return i.observe(r),()=>{i.disconnect()}},[]),Lt(ol,{ref:e,children:Lt(rl,{children:t.map((r,n)=>Lt(Jk,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Sn,jsxs as cx}from"react/jsx-runtime";function Wd({attributes:e,Editable:t}){let o=nx(null),r=mx(),n=sx(),i=rx(a=>{a.target===a.currentTarget&&(ax.select(r,ix.end(r,[])),lx.focus(r))},[r]);return Sn(Fa,{children:cx(Ja,{ref:o,className:ox({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Sn(Fd,{}),Sn(t,{as:Ya,...e,style:{overflowY:"auto"}})]})})}var Vd=y((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:Wd,editableProps:{}}));import{Editor as Ln,Node as px,Path as dx,Transforms as ux}from"slate";var _d=y(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Ln.isEditor(t[0]))return!1;let o=[e.children.length-1],r=px.child(e,e.children.length-1);return(Ln.hasBlocks(e,r)||Ln.isVoid(e,r))&&ux.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:dx.next(o)}),!0}}}));import{Transforms as fx}from"slate";function hx(e,t){let o=Pe(t),r=Le(o,{enableInternalLinks:e.wysimark.enableInternalLinks});fx.insertNodes(e,r)}function Kd(e){return{pasteMarkdown:g(hx,e)}}function gx(e){return e.length===1&&e[0]==="text/plain"}function bx(e){return/^>\s*\[![A-Za-z0-9_-]+\][+-]?(?:\s|$)/m.test(e)}var Gd=y(e=>(e.pasteMarkdown=Kd(e),{name:"paste-markdown",editor:{},editableProps:{onPaste(t){let o=Array.from(t.clipboardData.types),r=t.clipboardData.getData("text/markdown"),n=t.clipboardData.getData("text/plain");return r||n&&(gx(o)||bx(n))?(e.pasteMarkdown.pasteMarkdown(r||n),Ue(t),!0):!1}}}));import{jsx as kx}from"react/jsx-runtime";function Ex(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return kx("span",{...t,children:e.children})}var qd=y((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:Ex}})));var Qd=[Gd,Fm,Ml,Ym,Oc,lc,As,xm,Mm,Wp,rc,_d,Dc,Ll,Wc,Dm,Kp,Vd,Is,qd];var xx=na(Qd),{withSink:jd,SinkEditable:Xd}=xx;import{useState as yx}from"react";import{createEditor as vx,Editor as Tx,Transforms as wx}from"slate";import{withHistory as Ix}from"slate-history";import{withReact as Mx}from"slate-react";function Rn({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l,enableInternalLinks:s,renderInternalLinkPreview:m,renderInternalEmbed:c,onInternalLinkClick:d}={}){let[p]=yx(()=>{let u=vx(),h=jd(Mx(Ix(u)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return h.convertElement.addConvertElementType("paragraph"),u.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0,enableInternalLinks:s??!1,renderInternalLinkPreview:m,renderInternalEmbed:c,onInternalLinkClick:d},u.getMarkdown=()=>fe(u.children,{enableInternalLinks:u.wysimark.enableInternalLinks}),u.setMarkdown=k=>{let L=Pe(k),M=Le(L,{enableInternalLinks:u.wysimark.enableInternalLinks});u.children=M,u.selection=null,wx.select(u,Tx.start(u,[0]))},h});return p.wysimark.renderInternalLinkPreview=m,p.wysimark.renderInternalEmbed=c,p.wysimark.onInternalLinkClick=d,p}import{jsx as le,jsxs as Jd}from"react/jsx-runtime";function Bx({children:e,attributes:t}){return le("span",{...t,children:e})}function Zd({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:s}){let[m,c]=Yd(!1),[d,p]=Yd(t),u=eo(!1),h=eo(void 0),k=eo(void 0),L=eo(null),M=eo(o);M.current=o;let T=Zt(Cx(()=>{let w=fe(e.children,{enableInternalLinks:e.wysimark.enableInternalLinks});e.wysimark.prevValue={markdown:w,children:e.children},M.current(w)},r,{leading:!1,trailing:!0}),[e,r]),D=Zt(()=>{k.current!==e.children&&(k.current=e.children,T())},[T]);if(!m){let w=L.current??t;if(L.current!==null&&(L.current=null),e.wysimark.prevValue==null||h.current==null){u.current=!0;let U=Pe(w),v=Le(U,{enableInternalLinks:e.wysimark.enableInternalLinks});e.children=v,k.current=h.current=v,e.wysimark.prevValue={markdown:w,children:v}}else if(w!==e.wysimark.prevValue.markdown){u.current=!0;let U=Pe(w),v=Le(U,{enableInternalLinks:e.wysimark.enableInternalLinks});e.children=v,e.selection=null,Sx.select(e,Px.start(e,[0]))}}let P=Zt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&Lx.focus(e)},[e]),H=Zt(()=>{T.flush()},[T]),C=w=>{let U=w.target.value;p(U),o(U)},B=Zt(()=>{let w=e.getMarkdown();p(w)},[e]),S=()=>{m?(L.current=d,e.wysimark.prevValue=void 0,h.current=void 0,k.current=void 0):B(),c(!m)};e.wysimark.onImageChange=l,e.wysimark.onFileSelect=s;let R=e.wysimark.disableRawMode;return Jd("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[!R&&le("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:le("div",{onClick:S,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?f("switchToVisualEditor"):f("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(S(),w.preventDefault())},children:Jd("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le("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"}),le("path",{d:"M7 15V9L10 12L13 9V15",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),le("path",{d:"M16 9H18V15",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),le("path",{d:"M16 12H18",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),le("div",{style:{display:m?"block":"none",textAlign:"center"},children:le("textarea",{value:Dt(d),onChange:C,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}})}),le("div",{style:{display:m?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:le(Rx,{editor:e,initialValue:h.current,onChange:D,children:le(Xd,{renderLeaf:Bx,onMouseDown:P,onBlur:H,placeholder:n,className:i,style:a})})})]})}import{jsx as eu}from"react/jsx-runtime";function Ox({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=Hx(r.initialMarkdown||""),l=Nx(i),s=Rn(r);l.current=i,zx(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let m=Dx(c=>{l.current=c,a(c),e?.(c)},[s]);return eu(Zd,{editor:s,value:i,className:o||"",onChange:m,placeholder:t})}function o6(e,t){let o=$x(),r=Ax(e);return r.render(eu(Ox,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Zd as Editable,o6 as createWysimark,lo as unescapeMarkdown,Rn as useEditor};
1728
+ `;import{Fragment as Hk,jsx as G,jsxs as Ct}from"react/jsx-runtime";var Nk=Sk("enter");function Cd({dest:e,close:t}){let o=zk(),r=Rk(null),[n,i]=Ye({x:0,y:0}),a=Jt((v,$)=>{i(de=>({x:de.x+v,y:de.y+$}))},[]),l=oe({src:r,dest:e},({src:v,dest:$},de)=>!v||!$?{left:0,top:0}:Be(v,de,{left:$.left-12,top:$.top+$.height},{margin:16})),s={...l,left:l.left+n.x,top:l.top+n.y},m=Lk(()=>{let{selection:v}=o;return v&&!$k.isCollapsed(v)?Bk.string(o,v):""},[]),[c,d]=Ye(""),[p,u]=Ye(""),[h,k]=Ye(m),[L,M]=Ye(m),[T,D]=Ye("external"),[P,H]=Ye(!1),C=()=>{if(T==="internal"){let v=p.trim();if(v==="")return;let $=h.trim(),de=$&&$!==me(v)?`${v}|${$}`:v;o.anchor.insertLink(Ce(de),$||me(v),{select:!0})}else{let v=h.trim()||c,$=L.trim()||void 0;o.anchor.insertLink(c,v,{select:!0,title:$})}Dk.focus(o),t()},B=Jt(v=>{d(v.currentTarget.value)},[d]),S=Jt(v=>{let $=ao(v.currentTarget.value);u($.target),$.display!==void 0&&k($.display)},[u,k]),R=Jt(v=>{let $=v.currentTarget.value;k($),P||M($)},[k,M,P]),w=Jt(v=>{M(v.currentTarget.value),H(!0)},[M]),U=v=>{Nk(v)&&(v.preventDefault(),v.stopPropagation(),C())};return Ct(Hk,{children:[G(Re,{close:t}),Ct(Qa,{ref:r,style:s,children:[G(De,{onDrag:a}),Ct("div",{style:{padding:"0.75em"},children:[o.wysimark.enableInternalLinks?G(Vt,{children:Ct("div",{style:{display:"flex",gap:"0.25em",padding:"0.25em",borderRadius:"0.375em",background:"var(--shade-100)",width:"100%"},children:[G("button",{type:"button",onClick:()=>D("external"),style:{flex:"1 1 0",border:0,borderRadius:"0.25em",padding:"0.375em 0.5em",cursor:"pointer",background:T==="external"?"white":"transparent",color:T==="external"?"var(--shade-700)":"var(--shade-500)",boxShadow:T==="external"?"0 1px 2px rgb(0 0 0 / 12%)":"none"},children:f("linkTypeExternal")}),G("button",{type:"button",onClick:()=>D("internal"),style:{flex:"1 1 0",border:0,borderRadius:"0.25em",padding:"0.375em 0.5em",cursor:"pointer",background:T==="internal"?"white":"transparent",color:T==="internal"?"var(--shade-700)":"var(--shade-500)",boxShadow:T==="internal"?"0 1px 2px rgb(0 0 0 / 12%)":"none"},children:f("linkTypeInternal")})]})}):null,G(Vt,{style:{marginTop:o.wysimark.enableInternalLinks?"0.5em":0},children:T==="internal"?G(_t,{type:"text",value:p,autoFocus:!0,placeholder:f("internalLinkTarget"),onChange:S,onKeyDown:U}):G(_t,{type:"text",value:c,autoFocus:!0,placeholder:f("linkUrl"),onChange:B,onKeyDown:U})}),G(Vt,{style:{marginTop:"0.5em"},children:G(_t,{type:"text",value:h,placeholder:f("linkText"),onChange:R,onKeyDown:U})}),Ct(Vt,{style:{marginTop:"0.5em"},children:[T==="external"?G(_t,{type:"text",value:L,placeholder:f("tooltipText"),onChange:w,onKeyDown:U}):G("span",{style:{flex:"1 1 auto"}}),Ct(vn,{onClick:C,children:[G(tr,{}),G(ed,{})]}),G(vn,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:G(Ed,{})})]}),T==="external"?G(Tn,{children:f("tooltipHint")}):G(Tn,{children:f("internalLinkTargetHint")})]})]})]})}var wn=[{icon:tr,title:f("insertLink"),more:!0,hotkey:"mod+k",Component:Cd},{icon:pd,title:f("insertImageFromUrl"),more:!0,Component:Id},{icon:sd,title:f("insertTable"),more:!0,Component:Yp},{icon:xd,title:f("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Pd=wn,Sd=wn,Ld=[{icon:dd,title:f("insert"),more:!0,children:wn}];import{Editor as Ak}from"slate";function Pt(e){let t=Ak.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 Rd=[{icon:gn,title:f("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>Pt(e).bold},{icon:id,title:f("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>Pt(e).italic},{icon:ud,title:f("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>Pt(e).strike},{icon:md,title:f("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>Pt(e).code},{icon:fd,title:f("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>Pt(e).underline},{icon:kd,title:f("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>Pt(e).highlight,show:e=>!e.wysimark.disableHighlight}],In=Rd,Bd=[{icon:gn,title:f("format"),more:!0,children:Rd}];var Ok=["unordered-list-item","ordered-list-item","task-list-item"],$d=[{icon:ld,title:f("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0),active:e=>!!b(e,"unordered-list-item")},{icon:En,title:f("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0),active:e=>!!b(e,"ordered-list-item")},{icon:hd,title:f("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),active:e=>!!b(e,"task-list-item"),show:e=>!e.wysimark.disableTaskList}],Mn=[...$d,"divider",...kn],Dd=[{icon:En,title:f("list"),more:!0,active:e=>!!b(e,Ok),children:[...$d,"divider",...kn]}];import{Editor as zd,Path as Uk,Transforms as or}from"slate";var Nd=[{icon:bn,title:f("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:ad,title:f("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:cd,title:f("codeBlock"),action:e=>{let{selection:t}=e,o=b(e,"code-block");if(o){let[,r]=o,n=zd.string(e,r);or.removeNodes(e,{at:r}),or.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&!Uk.equals(t.anchor.path,t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&t.anchor.offset!==t.focus.offset){let r=zd.string(e,t);or.delete(e),or.insertNodes(e,{type:"code-block",language:"text",children:[{type:"code-block-line",children:[{text:r}]}]});return}e.codeBlock.createCodeBlock({language:"text"})},active:e=>!!b(e,"code-block"),show:e=>!e.wysimark.disableCodeBlock}],Cn=Nd,Hd=[{icon:bn,title:f("quote"),more:!0,children:Nd}];var Fk=[...vd,"divider",...Mn,"divider",...In,"divider",...Pd,"divider",...Cn],Wk=[...xn,"divider",...Mn,"divider",...In,"divider",...Sd,"divider",...Cn],Ad=[...xn,"divider",...Dd,"divider",...Bd,"divider",...Ld,"divider",...Hd],Od=Ad;var St=[Fk,Wk,Ad];import{clsx as Vk}from"clsx";import{useCallback as Pn,useRef as _k}from"react";import{ReactEditor as Kk,useSlate as Gk,useSlateStatic as qk}from"slate-react";import{jsx as rr,jsxs as Qk}from"react/jsx-runtime";function Ud({item:e}){let t=qk(),o=Gk(),r=e.active?e.active(o):!1,n=_k(null),i=ne({title:e.title,hotkey:()=>e.hotkey?wo(e.hotkey):void 0}),a=W("menu"),l=Pn(()=>{let c=n.current,d=e.children,p=e.Component;c&&(d?a.open(()=>rr(ct,{dest:c,items:d,close:a.close})):p&&a.open(()=>rr(p,{dest:c,close:a.close})))},[e]),s=Pn(()=>{if(e.action){e.action(t),Kk.focus(t);return}a.layer?a.close():l()},[a.layer,e]),m=Pn(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer,l,i.onMouseEnter]);return Qk(al,{"data-item-type":"button",ref:n,onMouseEnter:m,onMouseLeave:i.onMouseLeave,onClick:s,className:Vk({"--active":r&&!Er(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Er(e?.title)?.includes("Depth")}),children:[rr(e.icon,{}),e.more?rr(Zp,{}):null]})}import{jsx as Lt}from"react/jsx-runtime";function Zk({item:e}){let t=Jk();return e==="divider"?Lt(nl,{"data-item-type":"divider",children:Lt(il,{})}):(e.show===void 0?!0:e.show(t))?Lt(Ud,{item:e}):null}function ex(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 tx(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var ox=4;function Fd(){let e=Xk(null),[t,o]=Yk(Od);return jk(()=>{let r=e.current;if(!r)return;let n=()=>{let a=ex(r);if(a){for(let l=0;l<St.length-1;l++)if(tx(St[l],a.button,a.divider)<a.toolbar-ox){o(St[l]);return}o(St[St.length-1])}},i=new ResizeObserver(n);return i.observe(r),()=>{i.disconnect()}},[]),Lt(ol,{ref:e,children:Lt(rl,{children:t.map((r,n)=>Lt(Zk,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Sn,jsxs as px}from"react/jsx-runtime";function Wd({attributes:e,Editable:t}){let o=ix(null),r=cx(),n=mx(),i=nx(a=>{a.target===a.currentTarget&&(lx.select(r,ax.end(r,[])),sx.focus(r))},[r]);return Sn(Fa,{children:px(Ja,{ref:o,className:rx({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Sn(Fd,{}),Sn(t,{as:Ya,...e,style:{overflowY:"auto"}})]})})}var Vd=y((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:Wd,editableProps:{}}));import{Editor as Ln,Node as dx,Path as ux,Transforms as fx}from"slate";var _d=y(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Ln.isEditor(t[0]))return!1;let o=[e.children.length-1],r=dx.child(e,e.children.length-1);return(Ln.hasBlocks(e,r)||Ln.isVoid(e,r))&&fx.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:ux.next(o)}),!0}}}));import{Transforms as hx}from"slate";function gx(e,t){let o=Pe(t),r=Le(o,{enableInternalLinks:e.wysimark.enableInternalLinks});hx.insertNodes(e,r)}function Kd(e){return{pasteMarkdown:g(gx,e)}}function bx(e){return e.length===1&&e[0]==="text/plain"}function Ex(e){return/^>\s*\[![A-Za-z0-9_-]+\][+-]?(?:\s|$)/m.test(e)}var Gd=y(e=>(e.pasteMarkdown=Kd(e),{name:"paste-markdown",editor:{},editableProps:{onPaste(t){let o=Array.from(t.clipboardData.types),r=t.clipboardData.getData("text/markdown"),n=t.clipboardData.getData("text/plain");return r||n&&(bx(o)||Ex(n))?(e.pasteMarkdown.pasteMarkdown(r||n),Ue(t),!0):!1}}}));import{jsx as xx}from"react/jsx-runtime";function kx(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return xx("span",{...t,children:e.children})}var qd=y((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:kx}})));var Qd=[Gd,Fm,Ml,Ym,Oc,lc,As,xm,Mm,Wp,rc,_d,Dc,Ll,Wc,Dm,Kp,Vd,Is,qd];var yx=na(Qd),{withSink:jd,SinkEditable:Xd}=yx;import{useState as vx}from"react";import{createEditor as Tx,Editor as wx,Transforms as Ix}from"slate";import{withHistory as Mx}from"slate-history";import{withReact as Cx}from"slate-react";function Rn({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l,enableInternalLinks:s,renderInternalLinkPreview:m,renderInternalEmbed:c,onInternalLinkClick:d}={}){let[p]=vx(()=>{let u=Tx(),h=jd(Cx(Mx(u)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return h.convertElement.addConvertElementType("paragraph"),u.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0,enableInternalLinks:s??!1,renderInternalLinkPreview:m,renderInternalEmbed:c,onInternalLinkClick:d},u.getMarkdown=()=>fe(u.children,{enableInternalLinks:u.wysimark.enableInternalLinks}),u.setMarkdown=k=>{let L=Pe(k),M=Le(L,{enableInternalLinks:u.wysimark.enableInternalLinks});u.children=M,u.selection=null,Ix.select(u,wx.start(u,[0]))},h});return p.wysimark.renderInternalLinkPreview=m,p.wysimark.renderInternalEmbed=c,p.wysimark.onInternalLinkClick=d,p}import{jsx as le,jsxs as Jd}from"react/jsx-runtime";function $x({children:e,attributes:t}){return le("span",{...t,children:e})}function Zd({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:s}){let[m,c]=Yd(!1),[d,p]=Yd(t),u=eo(!1),h=eo(void 0),k=eo(void 0),L=eo(null),M=eo(o);M.current=o;let T=Zt(Px(()=>{let w=fe(e.children,{enableInternalLinks:e.wysimark.enableInternalLinks});e.wysimark.prevValue={markdown:w,children:e.children},M.current(w)},r,{leading:!1,trailing:!0}),[e,r]),D=Zt(()=>{k.current!==e.children&&(k.current=e.children,T())},[T]);if(!m){let w=L.current??t;if(L.current!==null&&(L.current=null),e.wysimark.prevValue==null||h.current==null){u.current=!0;let U=Pe(w),v=Le(U,{enableInternalLinks:e.wysimark.enableInternalLinks});e.children=v,k.current=h.current=v,e.wysimark.prevValue={markdown:w,children:v}}else if(w!==e.wysimark.prevValue.markdown){u.current=!0;let U=Pe(w),v=Le(U,{enableInternalLinks:e.wysimark.enableInternalLinks});e.children=v,e.selection=null,Lx.select(e,Sx.start(e,[0]))}}let P=Zt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&Rx.focus(e)},[e]),H=Zt(()=>{T.flush()},[T]),C=w=>{let U=w.target.value;p(U),o(U)},B=Zt(()=>{let w=e.getMarkdown();p(w)},[e]),S=()=>{m?(L.current=d,e.wysimark.prevValue=void 0,h.current=void 0,k.current=void 0):B(),c(!m)};e.wysimark.onImageChange=l,e.wysimark.onFileSelect=s;let R=e.wysimark.disableRawMode;return Jd("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[!R&&le("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:le("div",{onClick:S,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?f("switchToVisualEditor"):f("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(S(),w.preventDefault())},children:Jd("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[le("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"}),le("path",{d:"M7 15V9L10 12L13 9V15",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),le("path",{d:"M16 9H18V15",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),le("path",{d:"M16 12H18",stroke:m?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),le("div",{style:{display:m?"block":"none",textAlign:"center"},children:le("textarea",{value:Dt(d),onChange:C,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}})}),le("div",{style:{display:m?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:le(Bx,{editor:e,initialValue:h.current,onChange:D,children:le(Xd,{renderLeaf:$x,onMouseDown:P,onBlur:H,placeholder:n,className:i,style:a})})})]})}import{jsx as eu}from"react/jsx-runtime";function Ux({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=Ax(r.initialMarkdown||""),l=Hx(i),s=Rn(r);l.current=i,Nx(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let m=zx(c=>{l.current=c,a(c),e?.(c)},[s]);return eu(Zd,{editor:s,value:i,className:o||"",onChange:m,placeholder:t})}function n6(e,t){let o=Dx(),r=Ox(e);return r.render(eu(Ux,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Zd as Editable,n6 as createWysimark,lo as unescapeMarkdown,Rn as useEditor};