wysimark-lite 0.25.14 → 0.25.17

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,14 +1,14 @@
1
- "use client";import{createRef as wE,useCallback as IE,useImperativeHandle as ME,useRef as PE,useState as CE}from"react";import{createRoot as SE}from"react-dom/client";import EE from"lodash.throttle";import{useCallback as vt,useRef as Tt,useState as vp}from"react";import{Editor as xE,Transforms as yE}from"slate";import{ReactEditor as kE,Slate as vE}from"slate-react";import ld from"remark-parse";import{unified as sd}from"unified";function To(){return{enter:{table:Dp,tableData:Ar,tableHeader:Ar,tableRow:$p},exit:{codeText:Hp,table:Np,tableData:vo,tableHeader:vo,tableRow:vo}}}function Dp(e){let t=e._align;this.enter({type:"table",align:t.map(function(o){return o==="none"?null:o}),children:[]},e),this.data.inTable=!0}function Np(e){this.exit(e),this.data.inTable=void 0}function $p(e){this.enter({type:"tableRow",children:[]},e)}function vo(e){this.exit(e)}function Ar(e){this.enter({type:"tableCell",children:[]},e)}function Hp(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Ap));let o=this.stack[this.stack.length-1];o.type,o.value=t,this.exit(e)}function Ap(e,t){return t==="|"?t:e}import{gfm as Op}from"micromark-extension-gfm";import{gfmToMarkdown as Up}from"mdast-util-gfm";function Or(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function Ur(){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(Op());let n=function(){let i=To();if(i.enter)for(let a of Object.keys(i.enter))i.enter[a]=Or(i.enter[a]);if(i.exit)for(let a of Object.keys(i.exit))i.exit[a]=Or(i.exit[a]);return i};o.push(n()),r.push(Up())}}function ge(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,o="\x07WYSIMARK_",r=`${o}LINK_`,n=`${o}HTML_`,i="\x07",a=[],l=0,m=e.replace(t,p=>(a.push(p),`${r}${l++}${i}`)),s=[];m=Vp(m,s,n,i);let d=/(https?:\/\/[^\s]+)/g;m=m.replace(d,p=>p.replace(/\//g,"\\/"));for(let p=0;p<s.length;p++)m=m.replace(`${n}${p}${i}`,s[p]);for(let p=0;p<a.length;p++)m=m.replace(`${r}${p}${i}`,a[p]);return m}function rt(e){return e.replace(/\\\//g,"/")}var Fp=new Set(["script","style"]);function Vp(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 g=e.slice(a,u+3);t.push(g),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 g=e.slice(a,u+3);t.push(g),n+=`${o}${t.length-1}${r}`,i=u+3;continue}let l=wo(e,a);if(!l){n+="<",i=a+1;continue}let m=t.length,s=`${o}${m}${r}`;if(!l.name){let u=e.slice(a,l.endIndex+1);t.push(u),n+=s,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+=s,i=l.endIndex+1;continue}if(Fp.has(c)){let u=e.toLowerCase().indexOf(`</${c}`,l.endIndex+1);if(u!==-1){let g=wo(e,u);if(g){let w=e.slice(a,g.endIndex+1);t.push(w),n+=s,i=g.endIndex+1;continue}}}let d=_p(e,c,l.endIndex+1);if(d!==null){let u=e.slice(a,d+1);t.push(u),n+=s,i=d+1;continue}let p=e.slice(a,l.endIndex+1);t.push(p),n+=s,i=l.endIndex+1}return n}function wo(e,t){if(e[t]!=="<")return null;let o=Kp(e,t);if(o===-1)return null;let r=t+1;if(r>=e.length)return null;let n=e[r];if(n==="!"||n==="?")return{name:null,endIndex:o,isClosing:!1,isSelfClosing:!0};let i=!1;n==="/"&&(i=!0,r+=1);let a=/^[A-Za-z][A-Za-z0-9-]*/.exec(e.slice(r));if(!a)return null;let l=a[0],m=e.slice(t,o+1),s=/\/\s*>$/.test(m);return{name:l,endIndex:o,isClosing:i,isSelfClosing:s}}function Kp(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 _p(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=wo(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 Fr(e,t){if(!e)throw new Error(`${t}`)}function wt(e,t){if(e.type!==t)throw new Error(`Expected element to be of type ${JSON.stringify(e)} but is ${JSON.stringify(e,null,2)}`)}function be(e){throw new Error(`Didn't expect to get here with value ${JSON.stringify(e,null,2)}`)}function Vr(e){return[{type:"block-quote",children:De(e.children)}]}function Kr(e){let t=e.value.split(`
2
- `);return[{type:"code-block",language:e.lang||"text",children:t.map(o=>({type:"code-block-line",children:[{text:o}]}))}]}function _r(e){return[{type:"block-quote",children:[{type:"paragraph",children:[{text:`[${e.identifier}]`}]},...De(e.children)]}]}import{Text as en}from"slate";import{Text as Jr}from"slate";import*as nt from"slate";function U(e){return nt.Text.isText(e)}function re(e){return nt.Element.isElement(e)}function B(e){return nt.Text.isText(e)&&!!e.text.match(/^\s+$/)&&!e.code}var Wr={bold:"**",italic:"_",strike:"~~",highlight:"<mark>",code:""},Gr={bold:"**",italic:"_",strike:"~~",highlight:"</mark>",code:""};function Wp(e){if(e in Wr)return Wr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_OPEN_TOKEN lookup`)}function Gp(e){if(e in Gr)return Gr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_CLOSE_TOKEN lookup`)}function qr(e){return e.map(Wp).join("")}function Qr(e){return e.map(Gp).join("")}import{Text as qp}from"slate";function it(e){let{text:t,...o}=e;return Object.keys(o)}function Io(e){if(qp.isText(e)){if(B(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 it(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(!U(o)){if(o.type==="image-inline")continue;throw new Error("Expected every segment in an anchor to be a Text segment")}if(B(o))continue;let r=it(o);if(t===void 0){t=r;continue}t=t.filter(n=>r.includes(n))}if(t===void 0)throw new Error("No text segments were found as children in this anchor which should not be possible");return t}var Xr=["bold","italic","underline","strike","highlight","code"];function jr(e){return e.slice().sort((t,o)=>Xr.indexOf(t)-Xr.indexOf(o))}var Qp=["\\","`","*","_","[","]","~","|","<"],Xp=new RegExp(`(${Qp.map(e=>`\\${e}`).join("|")})`,"g");function Yr(e){let t=e.replace(Xp,o=>`\\${o}`);return t=t.replace(/^(#{1,6})(\s)/m,"\\$1$2"),t=t.replace(/^(\d+)([.)]\s)/m,"$1\\$2"),t=t.replace(/^([-+>])\s/m,"\\$1 "),t}function jp(e,t){let o=it(e),r=it(t);return o.length==r.length&&o.every(n=>r.includes(n))}function Zr(e,t){let o=Jr.isText(e),r=Jr.isText(t);return t&&!r&&!o?[{text:""},e]:o?t===void 0||!r?[e]:jp(t,e)?(t.text=[t.text,e.text].join(""),[]):[e]:[e]}function tn(e){let t=[];for(let o=0;o<e.length;o++){let r=t[t.length-1];t.push(...Zr(e[o],r))}return t.length===0&&t.push({text:""}),en.isText(t[0])||t.unshift({text:""}),en.isText(t[t.length-1])||t.push({text:""}),t}function on(e){return{url:e.url,title:e.title||void 0,alt:e.alt||void 0}}var Yp=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;function Ne(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(Yp);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 at(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 rn(e){let t=Ne(e.url);if(!t.hostname.match(/[.]portive[.]com$/i))return;let o=t.searchParams.get("size");if(o===null)return;let r=at(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 nn(e){let t=Ne(e.url);if(t.hash.length===0)return;let o=new URLSearchParams(t.hash.slice(1)),r=at(o.get("size")),n=at(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 an=[rn,nn,on];function ln(e){for(let t of an){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 Jp(e,t){let o=e.match(/^<mark>(.+?)<\/mark>$/s);return o?[{text:o[1],...t,highlight:!0}]:[{text:e,code:!0}]}function K(e,t={}){let o=[];for(let n of e)o.push(...Zp(n,t));return tn(o)}function Zp(e,t={}){switch(e.type){case"delete":return K(e.children,{...t,strike:!0});case"emphasis":return K(e.children,{...t,italic:!0});case"footnoteReference":return[{text:`[${e.identifier}]`}];case"html":return Jp(e.value,t);case"image":return ln(e);case"inlineCode":return[{text:e.value,...t,code:!0}];case"link":return[{type:"anchor",href:e.url,title:e.title==null?void 0:e.title,children:K(e.children,t)}];case"strong":return K(e.children,{...t,bold:!0});case"text":return[{text:e.value,...t}];case"linkReference":case"imageReference":throw new Error("linkReference and imageReference should be converted to link and image through our transformInlineLinks function");case"break":return[{text:`
3
- `}];case"footnote":throw new Error("footnote is not supported yet")}be(e)}function sn(e){return[{type:"heading",level:e.depth,children:K(e.children)}]}function mn(e){return[{type:"html-block",html:e.value,children:[{text:""}]}]}function cn(e,{depth:t,ordered:o,checked:r}){switch(e.type){case"paragraph":return r===!0||r===!1?[{type:"task-list-item",depth:t,checked:r,children:K(e.children)}]:o?[{type:"ordered-list-item",depth:t,children:K(e.children)}]:[{type:"unordered-list-item",depth:t,children:K(e.children)}];case"list":return It(e,t+1);default:return Po(e)}}function pn(e,t){let o=[];for(let r of e.children)o.push(...cn(r,{...t,checked:e.checked}));return o}function It(e,t=0){let o=[];for(let r of e.children)o.push(...pn(r,{depth:t,ordered:!!e.ordered}));return o}function ed(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 td="\xA0";function od(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==td)}function dn(e){let t=K(e.children);return ed(t)?[{...t[1],type:"image-block"}]:od(t)?[{type:"paragraph",children:[{text:""}]}]:[{type:"paragraph",children:t}]}function un(e){if(e.align==null)throw new Error("Expected an array of AlignType for table.align");return[{type:"table",columns:e.align.map(t=>({align:t||"left"})),children:e.children.map(rd)}]}function rd(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(nd)}}function nd(e){if(e.type!=="tableCell")throw new Error("Expected a tableCell");return{type:"table-cell",children:[{type:"table-content",children:K(e.children)}]}}function fn(){return[{type:"horizontal-rule",children:[{text:""}]}]}function De(e){let t=[];for(let o of e)t.push(...Po(o));return t}function Po(e){switch(e.type){case"blockquote":return Vr(e);case"code":return Kr(e);case"definition":throw new Error('The type "definition" should not exist. See comments');case"footnoteDefinition":return _r(e);case"heading":return sn(e);case"html":return mn(e);case"list":return It(e);case"paragraph":return dn(e);case"table":return un(e);case"thematicBreak":return fn();case"yaml":return[]}be(e)}import{definitions as id}from"mdast-util-definitions";import{SKIP as hn,visit as ad}from"unist-util-visit";function gn(e){let t=id(e);ad(e,(o,r,n)=>{let i=o,a=n;if(i.type==="definition"&&a!==null&&typeof r=="number")return a.children.splice(r,1),[hn,r];if(i.type==="imageReference"||i.type==="linkReference"){let l="identifier"in i&&typeof i.identifier=="string"?i.identifier:"",m=t(l);if(m&&a!==null&&typeof r=="number"){let s=i.type==="imageReference"?{type:"image",url:m.url,title:m.title,alt:i.alt}:{type:"link",url:m.url,title:m.title,children:i.children};return a.children[r]=s,[hn,r]}}})}var md=sd().use(ld).use(Ur());function cd(e){let t=md.parse(e);return gn(t),t}function Ee(e){let t=cd(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:De(t.children)}function pd(e){return e.type==="ordered-list-item"||e.type==="unordered-list-item"||e.type==="task-list-item"}function bn(e){let t=[],o=-1;for(let r of e){if(!pd(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 En(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 xn(e){let t=[],o=3;for(let r of e.children){let n=En(r),i=n.match(/^([`]+)/);i&&(o=Math.max(o,i[1].length+1)),t.push(n)}return t.unshift(`${"`".repeat(o)}${e.language}`),t.push(`${"`".repeat(o)}`),`${t.join(`
1
+ "use client";import{createRef as ME,useCallback as PE,useImperativeHandle as CE,useRef as SE,useState as RE}from"react";import{createRoot as LE}from"react-dom/client";import yE from"lodash.throttle";import{useCallback as Tt,useRef as wt,useState as Tp}from"react";import{Editor as kE,Transforms as vE}from"slate";import{ReactEditor as TE,Slate as wE}from"slate-react";import sd from"remark-parse";import{unified as md}from"unified";function To(){return{enter:{table:$p,tableData:Ar,tableHeader:Ar,tableRow:Hp},exit:{codeText:Ap,table:Np,tableData:vo,tableHeader:vo,tableRow:vo}}}function $p(e){let t=e._align;this.enter({type:"table",align:t.map(function(o){return o==="none"?null:o}),children:[]},e),this.data.inTable=!0}function Np(e){this.exit(e),this.data.inTable=void 0}function Hp(e){this.enter({type:"tableRow",children:[]},e)}function vo(e){this.exit(e)}function Ar(e){this.enter({type:"tableCell",children:[]},e)}function Ap(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Op));let o=this.stack[this.stack.length-1];o.type,o.value=t,this.exit(e)}function Op(e,t){return t==="|"?t:e}import{gfm as Up}from"micromark-extension-gfm";import{gfmToMarkdown as Fp}from"mdast-util-gfm";function Or(e){if(e)return function(t){return this.data||(this.data={}),e.call(this,t)}}function Ur(){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(Up());let n=function(){let i=To();if(i.enter)for(let a of Object.keys(i.enter))i.enter[a]=Or(i.enter[a]);if(i.exit)for(let a of Object.keys(i.exit))i.exit[a]=Or(i.exit[a]);return i};o.push(n()),r.push(Fp())}}function ge(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,o="\x07WYSIMARK_",r=`${o}LINK_`,n=`${o}HTML_`,i="\x07",a=[],l=0,m=e.replace(t,p=>(a.push(p),`${r}${l++}${i}`)),s=[];m=Kp(m,s,n,i);let d=/(https?:\/\/[^\s]+)/g;m=m.replace(d,p=>p.replace(/\//g,"\\/"));for(let p=0;p<s.length;p++)m=m.replace(`${n}${p}${i}`,s[p]);for(let p=0;p<a.length;p++)m=m.replace(`${r}${p}${i}`,a[p]);return m}function nt(e){return e.replace(/\\\//g,"/")}var Vp=new Set(["script","style"]);function Kp(e,t,o,r){let n="",i=0;for(;i<e.length;){let a=e.indexOf("<",i);if(a===-1){n+=e.slice(i);break}if(n+=e.slice(i,a),e.startsWith("<!--",a)){let u=e.indexOf("-->",a+4);if(u===-1){n+=e.slice(a);break}let g=e.slice(a,u+3);t.push(g),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 g=e.slice(a,u+3);t.push(g),n+=`${o}${t.length-1}${r}`,i=u+3;continue}let l=wo(e,a);if(!l){n+="<",i=a+1;continue}let m=t.length,s=`${o}${m}${r}`;if(!l.name){let u=e.slice(a,l.endIndex+1);t.push(u),n+=s,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+=s,i=l.endIndex+1;continue}if(Vp.has(c)){let u=e.toLowerCase().indexOf(`</${c}`,l.endIndex+1);if(u!==-1){let g=wo(e,u);if(g){let T=e.slice(a,g.endIndex+1);t.push(T),n+=s,i=g.endIndex+1;continue}}}let d=Wp(e,c,l.endIndex+1);if(d!==null){let u=e.slice(a,d+1);t.push(u),n+=s,i=d+1;continue}let p=e.slice(a,l.endIndex+1);t.push(p),n+=s,i=l.endIndex+1}return n}function wo(e,t){if(e[t]!=="<")return null;let o=_p(e,t);if(o===-1)return null;let r=t+1;if(r>=e.length)return null;let n=e[r];if(n==="!"||n==="?")return{name:null,endIndex:o,isClosing:!1,isSelfClosing:!0};let i=!1;n==="/"&&(i=!0,r+=1);let a=/^[A-Za-z][A-Za-z0-9-]*/.exec(e.slice(r));if(!a)return null;let l=a[0],m=e.slice(t,o+1),s=/\/\s*>$/.test(m);return{name:l,endIndex:o,isClosing:i,isSelfClosing:s}}function _p(e,t){let o=null;for(let r=t+1;r<e.length;r++){let n=e[r];if(o){n===o&&(o=null);continue}if(n==="'"||n==='"'){o=n;continue}if(n===">")return r}return-1}function Wp(e,t,o){let r=1,n=o,i=t.toLowerCase();for(;n<e.length;){let a=e.indexOf("<",n);if(a===-1)return null;let l=wo(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 Fr(e,t){if(!e)throw new Error(`${t}`)}function It(e,t){if(e.type!==t)throw new Error(`Expected element to be of type ${JSON.stringify(e)} but is ${JSON.stringify(e,null,2)}`)}function be(e){throw new Error(`Didn't expect to get here with value ${JSON.stringify(e,null,2)}`)}function Vr(e){return[{type:"block-quote",children:$e(e.children)}]}function Kr(e){let t=e.value.split(`
2
+ `);return[{type:"code-block",language:e.lang||"text",children:t.map(o=>({type:"code-block-line",children:[{text:o}]}))}]}function _r(e){return[{type:"block-quote",children:[{type:"paragraph",children:[{text:`[${e.identifier}]`}]},...$e(e.children)]}]}import{Text as en}from"slate";import{Text as Jr}from"slate";import*as it from"slate";function U(e){return it.Text.isText(e)}function re(e){return it.Element.isElement(e)}function B(e){return it.Text.isText(e)&&!!e.text.match(/^\s+$/)&&!e.code}var Wr={bold:"**",italic:"_",strike:"~~",highlight:"<mark>",code:""},Gr={bold:"**",italic:"_",strike:"~~",highlight:"</mark>",code:""};function Gp(e){if(e in Wr)return Wr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_OPEN_TOKEN lookup`)}function qp(e){if(e in Gr)return Gr[e];throw new Error(`Could not find mark ${JSON.stringify(e)} in MARK_KEY_TO_CLOSE_TOKEN lookup`)}function qr(e){return e.map(Gp).join("")}function Qr(e){return e.map(qp).join("")}import{Text as Qp}from"slate";function at(e){let{text:t,...o}=e;return Object.keys(o)}function Io(e){if(Qp.isText(e)){if(B(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 at(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(!U(o)){if(o.type==="image-inline")continue;throw new Error("Expected every segment in an anchor to be a Text segment")}if(B(o))continue;let r=at(o);if(t===void 0){t=r;continue}t=t.filter(n=>r.includes(n))}return t===void 0?[]:t}var Xr=["bold","italic","underline","strike","highlight","code"];function jr(e){return e.slice().sort((t,o)=>Xr.indexOf(t)-Xr.indexOf(o))}var Xp=["\\","`","*","_","[","]","~","|","<"],jp=new RegExp(`(${Xp.map(e=>`\\${e}`).join("|")})`,"g");function Yr(e){let t=e.replace(jp,o=>`\\${o}`);return t=t.replace(/^(#{1,6})(\s)/m,"\\$1$2"),t=t.replace(/^(\d+)([.)]\s)/m,"$1\\$2"),t=t.replace(/^([-+>])\s/m,"\\$1 "),t}function Yp(e,t){let o=at(e),r=at(t);return o.length==r.length&&o.every(n=>r.includes(n))}function Zr(e,t){let o=Jr.isText(e),r=Jr.isText(t);return t&&!r&&!o?[{text:""},e]:o?t===void 0||!r?[e]:Yp(t,e)?(t.text=[t.text,e.text].join(""),[]):[e]:[e]}function tn(e){let t=[];for(let o=0;o<e.length;o++){let r=t[t.length-1];t.push(...Zr(e[o],r))}return t.length===0&&t.push({text:""}),en.isText(t[0])||t.unshift({text:""}),en.isText(t[t.length-1])||t.push({text:""}),t}function on(e){return{url:e.url,title:e.title||void 0,alt:e.alt||void 0}}var Jp=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;function Ne(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(Jp);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 lt(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 rn(e){let t=Ne(e.url);if(!t.hostname.match(/[.]portive[.]com$/i))return;let o=t.searchParams.get("size");if(o===null)return;let r=lt(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 nn(e){let t=Ne(e.url);if(t.hash.length===0)return;let o=new URLSearchParams(t.hash.slice(1)),r=lt(o.get("size")),n=lt(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 an=[rn,nn,on];function ln(e){for(let t of an){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 Zp(e,t){let o=e.match(/^<mark>(.+?)<\/mark>$/s);return o?[{text:o[1],...t,highlight:!0}]:[{text:e,code:!0}]}function K(e,t={}){let o=[];for(let n of e)o.push(...ed(n,t));return tn(o)}function ed(e,t={}){switch(e.type){case"delete":return K(e.children,{...t,strike:!0});case"emphasis":return K(e.children,{...t,italic:!0});case"footnoteReference":return[{text:`[${e.identifier}]`}];case"html":return Zp(e.value,t);case"image":return ln(e);case"inlineCode":return[{text:e.value,...t,code:!0}];case"link":return[{type:"anchor",href:e.url,title:e.title==null?void 0:e.title,children:K(e.children,t)}];case"strong":return K(e.children,{...t,bold:!0});case"text":return[{text:e.value,...t}];case"linkReference":case"imageReference":throw new Error("linkReference and imageReference should be converted to link and image through our transformInlineLinks function");case"break":return[{text:`
3
+ `}];case"footnote":throw new Error("footnote is not supported yet")}be(e)}function sn(e){return[{type:"heading",level:e.depth,children:K(e.children)}]}function mn(e){return[{type:"html-block",html:e.value,children:[{text:""}]}]}function cn(e,{depth:t,ordered:o,checked:r}){switch(e.type){case"paragraph":return r===!0||r===!1?[{type:"task-list-item",depth:t,checked:r,children:K(e.children)}]:o?[{type:"ordered-list-item",depth:t,children:K(e.children)}]:[{type:"unordered-list-item",depth:t,children:K(e.children)}];case"list":return Mt(e,t+1);default:return Po(e)}}function pn(e,t){let o=[];for(let r of e.children)o.push(...cn(r,{...t,checked:e.checked}));return o}function Mt(e,t=0){let o=[];for(let r of e.children)o.push(...pn(r,{depth:t,ordered:!!e.ordered}));return o}function td(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 od="\xA0";function rd(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==od)}function dn(e){let t=K(e.children);return td(t)?[{...t[1],type:"image-block"}]:rd(t)?[{type:"paragraph",children:[{text:""}]}]:[{type:"paragraph",children:t}]}function un(e){if(e.align==null)throw new Error("Expected an array of AlignType for table.align");return[{type:"table",columns:e.align.map(t=>({align:t||"left"})),children:e.children.map(nd)}]}function nd(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(id)}}function id(e){if(e.type!=="tableCell")throw new Error("Expected a tableCell");return{type:"table-cell",children:[{type:"table-content",children:K(e.children)}]}}function fn(){return[{type:"horizontal-rule",children:[{text:""}]}]}function $e(e){let t=[];for(let o of e)t.push(...Po(o));return t}function Po(e){switch(e.type){case"blockquote":return Vr(e);case"code":return Kr(e);case"definition":throw new Error('The type "definition" should not exist. See comments');case"footnoteDefinition":return _r(e);case"heading":return sn(e);case"html":return mn(e);case"list":return Mt(e);case"paragraph":return dn(e);case"table":return un(e);case"thematicBreak":return fn();case"yaml":return[]}be(e)}import{definitions as ad}from"mdast-util-definitions";import{SKIP as hn,visit as ld}from"unist-util-visit";function gn(e){let t=ad(e);ld(e,(o,r,n)=>{let i=o,a=n;if(i.type==="definition"&&a!==null&&typeof r=="number")return a.children.splice(r,1),[hn,r];if(i.type==="imageReference"||i.type==="linkReference"){let l="identifier"in i&&typeof i.identifier=="string"?i.identifier:"",m=t(l);if(m&&a!==null&&typeof r=="number"){let s=i.type==="imageReference"?{type:"image",url:m.url,title:m.title,alt:i.alt}:{type:"link",url:m.url,title:m.title,children:i.children};return a.children[r]=s,[hn,r]}}})}var cd=md().use(sd).use(Ur());function pd(e){let t=cd.parse(e);return gn(t),t}function Ee(e){let t=pd(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:$e(t.children)}function dd(e){return e.type==="ordered-list-item"||e.type==="unordered-list-item"||e.type==="task-list-item"}function bn(e){let t=[],o=-1;for(let r of e){if(!dd(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 En(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 xn(e){let t=[],o=3;for(let r of e.children){let n=En(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(`
4
4
  `)}
5
5
 
6
- `}function yn(e){return e.url}function kn(e){if(e.url.startsWith("$"))return"";let{hostname:t}=Ne(e.url);if(t.match(/[.]portive[.]com$/i)&&e.width&&e.height)return`${e.url}?size=${e.width}x${e.height}`}function vn(e){if(e.width&&e.height&&e.srcWidth&&e.srcHeight)return`${e.url}#srcSize=${e.srcWidth}x${e.srcHeight}&size=${e.width}x${e.height}`}var dd=[kn,vn,yn];function Mt(e){for(let t of dd){let o=t(e);if(typeof o=="string")return o===""?"":`![${e.alt}](${o}${typeof e.title=="string"?` "${e.title}"`:""})`}throw new Error("Shouldn't get here")}function Tn(e){let t=Mt(e);return t?`${t}
6
+ `}function yn(e){return e.url}function kn(e){if(e.url.startsWith("$"))return"";let{hostname:t}=Ne(e.url);if(t.match(/[.]portive[.]com$/i)&&e.width&&e.height)return`${e.url}?size=${e.width}x${e.height}`}function vn(e){if(e.width&&e.height&&e.srcWidth&&e.srcHeight)return`${e.url}#srcSize=${e.srcWidth}x${e.srcHeight}&size=${e.width}x${e.height}`}var ud=[kn,vn,yn];function Pt(e){for(let t of ud){let o=t(e);if(typeof o=="string")return o===""?"":`![${e.alt}](${o}${typeof e.title=="string"?` "${e.title}"`:""})`}throw new Error("Shouldn't get here")}function Tn(e){let t=Pt(e);return t?`${t}
7
7
 
8
- `:""}import{Element as bd,Text as Ed}from"slate";function wn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:jr(o)}}function In(e,t){let o=[...e],r=e.filter(i=>!t.includes(i)),n=[];for(let i=0;i<e.length&&r.length!==0;i++){let a=o.pop();if(a===void 0)throw new Error("This shouldn't happen unless we made a mistake in the algorithm");n.push(a);let l=r.indexOf(a);l!==-1&&r.splice(l,1)}return{orderedMarksToRemove:n,nextOrderedMarks:o}}function Co(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=In(e,t),{orderedMarksToAdd:n}=wn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as fd}from"slate";function Mn({node:e,nextNode:t,nodes:o,index:r}){return!U(e)||!B(e)||e.code||!U(t)||!B(t)||t.code?!1:(o.splice(r,2,{text:`${e.text}${t.text}`}),!0)}function Pn({node:e,nodes:t,prevNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[0];return U(n)&&B(n)?(e.children.splice(0,1),U(o)&&B(o)?o.text=`${o.text}${n.text}`:t.splice(r,0,{text:n.text}),!0):!1}function Cn({node:e,nodes:t,nextNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[e.children.length-1];return U(n)&&B(n)?(e.children.splice(e.children.length-1,1),U(o)&&B(o)?o.text=`${n.text}${o.text}`:t.splice(r+1,0,{text:n.text}),!0):!1}function Sn({node:e}){return!re(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function Rn({node:e,nodes:t,index:o}){if(!U(e)||B(e)||e.code)return!1;let r=e.text.match(/^(\s*)(.*?)(\s*)$/);if(!r||r[1].length===0&&r[3].length===0)return!1;let n=[{text:r[1]},{...e,text:r[2]},{text:r[3]}].filter(i=>i.text!=="");return t.splice(o,1,...n),!0}function Ln({index:e,nodes:t,node:o,parent:r}){return e!==t.length-1||t.length<=1||!U(o)||!B(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(t.length-1,1),!0):!1}function Bn({index:e,nodes:t,node:o,parent:r}){return e!==0||t.length===0||!U(o)||!B(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(0,1),!0):!1}var zn=[Rn,Pn,Cn,Mn,Bn,Ln,Sn];function Dn(e){for(let t of zn)if(t(e))return!0;return!1}var ud=72;function So(e,t){let o=!1,r,n=0,i=(e.length+1)*ud;do{if(r=!1,n=n+1,n>i)throw new Error(`There have been ${n} normalization passes (72x the number of nodes at this level). This likely indicates a bug in the code.`);e:for(let a=0;a<e.length;a++){let l=e[a];if(re(l)&&So(l.children,l)){r=!0,o=!0;break e}let m=e[a-1],s=e[a+1];if(Dn({parent:t,node:l,prevNode:m,nextNode:s,index:a,nodes:e})){r=!0,o=!0;break e}}}while(r);return o}var Nn=e=>e.map(t=>fd.isElement(t)&&t.type==="anchor"?{...t,children:Nn(t.children)}:t);function $n(e){let t={type:"line",children:Nn(e)};return So([t],void 0),t.children}import{Text as gd}from"slate";function Hn(e){let t=0;for(let o of e.text.matchAll(/[`]+/g))t=Math.max(t,o[0].length);return t===0?`\`${e.text.replace(/[`]/g,"\\`")}\``:`${"`".repeat(t+1)} ${e.text} ${"`".repeat(t+1)}`}function hd(e){return e.replace(/"/g,'\\"')}function An(e){let t=Mo(e.children);return e.href.startsWith("$")?G(e.children,t,t):typeof e.title=="string"&&e.title.length>0?`[${G(e.children,t,t)}](${e.href} "${hd(e.title)}")`:`[${G(e.children,t,t)}](${e.href})`}function On(e){return Yr(e.text)}function Un(e){if(gd.isText(e))return e.code?Hn(e):On(e);switch(e.type){case"anchor":return An(e);case"image-inline":return Mt(e);default:be(e)}}function G(e,t=[],o=[]){let r=$n(e),n=[],i=Co(t,Io(r[0]));for(let a=0;a<r.length;a++){let l=r[a];if(Ed.isText(l)&&B(l)){n.push(l.text);continue}n.push(qr(i.add)),n.push(Un(l));let m=xd(r,a,o),s=Co(i.nextOrderedMarks,m);n.push(Qr(s.remove)),i=s}return n.join("")}function xd(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!B(n)&&!(bd.isElement(n)&&n.type==="image-inline"))return Io(n)}return o}function Vn(e){let t=[];return t.push(Fn(e.children[0])),t.push(yd(e.columns)),e.children.slice(1).forEach(o=>{t.push(Fn(o))}),`${t.join(`
8
+ `:""}import{Element as Ed,Text as xd}from"slate";function wn(e,t){let o=t.filter(n=>!e.includes(n));return{orderedMarksToAdd:jr(o)}}function In(e,t){let o=[...e],r=e.filter(i=>!t.includes(i)),n=[];for(let i=0;i<e.length&&r.length!==0;i++){let a=o.pop();if(a===void 0)throw new Error("This shouldn't happen unless we made a mistake in the algorithm");n.push(a);let l=r.indexOf(a);l!==-1&&r.splice(l,1)}return{orderedMarksToRemove:n,nextOrderedMarks:o}}function Co(e,t){let{orderedMarksToRemove:o,nextOrderedMarks:r}=In(e,t),{orderedMarksToAdd:n}=wn(r,t);return{remove:o,add:n,nextOrderedMarks:[...r,...n]}}import{Element as hd}from"slate";function Mn({node:e,nextNode:t,nodes:o,index:r}){return!U(e)||!B(e)||e.code||!U(t)||!B(t)||t.code?!1:(o.splice(r,2,{text:`${e.text}${t.text}`}),!0)}function Pn({node:e,nodes:t,prevNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[0];return U(n)&&B(n)?(e.children.splice(0,1),U(o)&&B(o)?o.text=`${o.text}${n.text}`:t.splice(r,0,{text:n.text}),!0):!1}function Cn({node:e,nodes:t,nextNode:o,index:r}){if(!re(e)||e.type!=="anchor")return!1;let n=e.children[e.children.length-1];return U(n)&&B(n)?(e.children.splice(e.children.length-1,1),U(o)&&B(o)?o.text=`${n.text}${o.text}`:t.splice(r+1,0,{text:n.text}),!0):!1}function Sn({node:e}){return!re(e)||e.type!=="line"||e.children.length>0?!1:(e.children.push({text:""}),!0)}function Rn({node:e,nodes:t,index:o}){if(!U(e)||B(e)||e.code)return!1;let r=e.text.match(/^(\s*)(.*?)(\s*)$/);if(!r||r[1].length===0&&r[3].length===0)return!1;let n=[{text:r[1]},{...e,text:r[2]},{text:r[3]}].filter(i=>i.text!=="");return t.splice(o,1,...n),!0}function Ln({index:e,nodes:t,node:o,parent:r}){return e!==t.length-1||t.length<=1||!U(o)||!B(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(t.length-1,1),!0):!1}function zn({index:e,nodes:t,node:o,parent:r}){return e!==0||t.length===0||!U(o)||!B(o)?!1:r&&re(r)&&r.type==="line"?(t.splice(0,1),!0):!1}var Bn=[Rn,Pn,Cn,Mn,zn,Ln,Sn];function Dn(e){for(let t of Bn)if(t(e))return!0;return!1}var fd=72;function So(e,t){let o=!1,r,n=0,i=(e.length+1)*fd;do{if(r=!1,n=n+1,n>i)throw new Error(`There have been ${n} normalization passes (72x the number of nodes at this level). This likely indicates a bug in the code.`);e:for(let a=0;a<e.length;a++){let l=e[a];if(re(l)&&So(l.children,l)){r=!0,o=!0;break e}let m=e[a-1],s=e[a+1];if(Dn({parent:t,node:l,prevNode:m,nextNode:s,index:a,nodes:e})){r=!0,o=!0;break e}}}while(r);return o}var $n=e=>e.map(t=>hd.isElement(t)&&t.type==="anchor"?{...t,children:$n(t.children)}:t);function Nn(e){let t={type:"line",children:$n(e)};return So([t],void 0),t.children}import{Text as bd}from"slate";function Hn(e){let t=0;for(let o of e.text.matchAll(/[`]+/g))t=Math.max(t,o[0].length);return t===0?`\`${e.text.replace(/[`]/g,"\\`")}\``:`${"`".repeat(t+1)} ${e.text} ${"`".repeat(t+1)}`}function gd(e){return e.replace(/"/g,'\\"')}function An(e){let t=Mo(e.children);return e.href.startsWith("$")?G(e.children,t,t):typeof e.title=="string"&&e.title.length>0?`[${G(e.children,t,t)}](${e.href} "${gd(e.title)}")`:`[${G(e.children,t,t)}](${e.href})`}function On(e){return Yr(e.text)}function Un(e){if(bd.isText(e))return e.code?Hn(e):On(e);switch(e.type){case"anchor":return An(e);case"image-inline":return Pt(e);default:be(e)}}function G(e,t=[],o=[]){let r=Nn(e),n=[],i=Co(t,Io(r[0]));for(let a=0;a<r.length;a++){let l=r[a];if(xd.isText(l)&&B(l)){n.push(l.text);continue}n.push(qr(i.add)),n.push(Un(l));let m=yd(r,a,o),s=Co(i.nextOrderedMarks,m);n.push(Qr(s.remove)),i=s}return n.join("")}function yd(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!B(n)&&!(Ed.isElement(n)&&n.type==="image-inline"))return Io(n)}return o}function Vn(e){let t=[];return t.push(Fn(e.children[0])),t.push(kd(e.columns)),e.children.slice(1).forEach(o=>{t.push(Fn(o))}),`${t.join(`
9
9
  `)}
10
10
 
11
- `}function yd(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>kd(o.align)).join("|")}|`}function kd(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function Fn(e){return wt(e,"table-row"),`|${e.children.map(vd).join("|")}|`}function vd(e){return wt(e,"table-cell"),Fr(e.children.length===1,`Expected table-cell to have one child but is ${JSON.stringify(e.children)}`),e.children.map(Td).join("")}function Td(e){return wt(e,"table-content"),G(e.children)}var Ro=4;function Kn(e,t){switch(e.type){case"anchor":return`[${G(e.children)}](${e.href})`;case"block-quote":return`${Pt(e.children).split(`
11
+ `}function kd(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>vd(o.align)).join("|")}|`}function vd(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function Fn(e){return It(e,"table-row"),`|${e.children.map(Td).join("|")}|`}function Td(e){return It(e,"table-cell"),Fr(e.children.length===1,`Expected table-cell to have one child but is ${JSON.stringify(e.children)}`),e.children.map(wd).join("")}function wd(e){return It(e,"table-content"),G(e.children)}var Ro=4;function Kn(e,t){switch(e.type){case"anchor":return`[${G(e.children)}](${e.href})`;case"block-quote":return`${Ct(e.children).split(`
12
12
  `).map(r=>r?`> ${r}`:">").join(`
13
13
  `)}
14
14
 
@@ -23,16 +23,16 @@
23
23
  `;case"task-list-item":{let o=" ".repeat(e.depth*Ro),r=G(e.children);return r.trim()===""&&(r="&#32;"),`${o}- [${e.checked?"x":" "}] ${r}
24
24
  `}case"image-block":return Tn(e);case"image-inline":return`![${e.alt||""}](${e.url})`;case"code-block":return xn(e);case"code-block-line":throw new Error("Code block line elements should only be present as children of code-block which should be handled by serializeCodeBlock. Got code-block-line may indicate an error in normalization.");case"html-block":return`${e.html}
25
25
 
26
- `}be(e)}function Pt(e){let t=[],o=[];for(let n=0;n<e.length;n++){let i=e[n],a=n<e.length-1?e[n+1]:null;i.type==="ordered-list-item"?(o[i.depth]=(o[i.depth]||0)+1,o=o.slice(0,i.depth+1)):i.type==="unordered-list-item"||i.type==="task-list-item"?o=o.slice(0,i.depth):o=[];let l=Kn(i,o);(i.type==="ordered-list-item"||i.type==="unordered-list-item"||i.type==="task-list-item")&&(!a||a.type!=="ordered-list-item"&&a.type!=="unordered-list-item"&&a.type!=="task-list-item")&&(l=l.replace(/\n$/,`
26
+ `}be(e)}function Ct(e){let t=[],o=[];for(let n=0;n<e.length;n++){let i=e[n],a=n<e.length-1?e[n+1]:null;i.type==="ordered-list-item"?(o[i.depth]=(o[i.depth]||0)+1,o=o.slice(0,i.depth+1)):i.type==="unordered-list-item"||i.type==="task-list-item"?o=o.slice(0,i.depth):o=[];let l=Kn(i,o);(i.type==="ordered-list-item"||i.type==="unordered-list-item"||i.type==="task-list-item")&&(!a||a.type!=="ordered-list-item"&&a.type!=="unordered-list-item"&&a.type!=="task-list-item")&&(l=l.replace(/\n$/,`
27
27
 
28
- `)),t.push(l)}let r=t.join("");return r.trim()===""?"":r.replace(/^\n+/,"").trim()}function lt(e){let t=bn(e);return Pt(t)}var Lo={ja:{bold:"\u592A\u5B57",italic:"\u659C\u4F53",strike:"\u53D6\u308A\u6D88\u3057\u7DDA",inlineCode:"\u30A4\u30F3\u30E9\u30A4\u30F3\u30B3\u30FC\u30C9",underline:"\u4E0B\u7DDA",highlight:"\u30CF\u30A4\u30E9\u30A4\u30C8",increaseDepth:"\u968E\u5C64\u3092\u6DF1\u304F\u3059\u308B",decreaseDepth:"\u968E\u5C64\u3092\u6D45\u304F\u3059\u308B",heading1:"\u898B\u51FA\u30571",heading2:"\u898B\u51FA\u30572",heading3:"\u898B\u51FA\u30573",normal:"\u6A19\u6E96",paragraph:"\u6BB5\u843D",paragraphStyle:"\u6BB5\u843D\u30B9\u30BF\u30A4\u30EB",bulletList:"\u7B87\u6761\u66F8\u304D",numberedList:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkList:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",list:"\u30EA\u30B9\u30C8",linkUrl:"\u30EA\u30F3\u30AF\u306EURL",linkText:"\u30EA\u30F3\u30AF\u30C6\u30AD\u30B9\u30C8",linkTextHint:"\u30EA\u30F3\u30AF\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u308B\u30C6\u30AD\u30B9\u30C8",tooltipText:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\u30C6\u30AD\u30B9\u30C8",tooltipHint:"\u30DE\u30A6\u30B9\u30DB\u30D0\u30FC\u6642\u306B\u8868\u793A\u3055\u308C\u308B\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",apply:"\u9069\u7528",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",insertLink:"\u30EA\u30F3\u30AF",quote:"\u5F15\u7528",insertTable:"\u8868",insertImage:"\u753B\u50CF",insertImageFromUrl:"\u753B\u50CF",insert:"\u633F\u5165",format:"\u66F8\u5F0F",imageUrlRequired:"\u753B\u50CFURL\uFF08\u5FC5\u9808\uFF09\uFF1A",altText:"\u4EE3\u66FF\u30C6\u30AD\u30B9\u30C8\uFF1A",title:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\uFF1A",imageDescription:"\u753B\u50CF\u306E\u8AAC\u660E",imageTitle:"\u753B\u50CF\u306E\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",switchToVisualEditor:"\u30D3\u30B8\u30E5\u30A2\u30EB\u30A8\u30C7\u30A3\u30BF\u306B\u5207\u308A\u66FF\u3048",switchToRawMarkdown:"\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8868\u793A\u306B\u5207\u308A\u66FF\u3048",codeBlock:"\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF",increaseQuoteDepth:"\u5F15\u7528\u3092\u91CD\u306D\u308B",horizontalRule:"\u533A\u5207\u308A\u7DDA",register:"\u767B\u9332",imageSourceUrl:"URL",imageSourceFile:"\u30D5\u30A1\u30A4\u30EB",selectFile:"\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E",uploading:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D...",saving:"\u4FDD\u5B58\u4E2D...",uploadComplete:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5B8C\u4E86",imageSourceSelect:"\u30D5\u30A1\u30A4\u30EB\u9078\u629E",vaultPath:"\u4FDD\u5B58\u5148\u30D1\u30B9\uFF1A",vaultPathHint:"vault\u5185\u306E\u4FDD\u5B58\u5148\u30D1\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},en:{bold:"Bold",italic:"Italic",strike:"Strikethrough",inlineCode:"Inline Code",underline:"Underline",highlight:"Highlight",increaseDepth:"Increase Depth",decreaseDepth:"Decrease Depth",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",normal:"Normal",paragraph:"Paragraph",paragraphStyle:"Paragraph Style",bulletList:"Bullet List",numberedList:"Numbered List",checkList:"Check List",list:"List",linkUrl:"Link URL",linkText:"Link Text",linkTextHint:"Text displayed as the link",tooltipText:"Tooltip Text",tooltipHint:"Tooltip shown on mouse hover",apply:"Apply",cancel:"Cancel",insertLink:"Link",quote:"Quote",insertTable:"Table",insertImage:"Image",insertImageFromUrl:"Image",insert:"Insert",format:"Format",imageUrlRequired:"Image URL (required):",altText:"Alt Text:",title:"tooltip:",imageDescription:"Description of the image",imageTitle:"tooltip",switchToVisualEditor:"Switch to visual editor",switchToRawMarkdown:"Switch to raw markdown",codeBlock:"Code Block",increaseQuoteDepth:"Increase Quote Depth",horizontalRule:"Horizontal Rule",register:"Register",imageSourceUrl:"URL",imageSourceFile:"File",selectFile:"Select File",uploading:"Uploading...",saving:"Saving...",uploadComplete:"Upload Complete",imageSourceSelect:"Select File",vaultPath:"Save Path:",vaultPathHint:"Enter the path within the vault to save the file"}},_n=()=>{try{if(typeof window<"u"&&window.navigator)return window.navigator.language.split("-")[0]}catch{}return"en"},h=e=>{let t=_n();return Lo[t==="ja"?"ja":"en"][e]},Bo=e=>{let t=_n();return Object.keys(Lo[t==="ja"?"ja":"en"]).find(r=>Lo[t==="ja"?"ja":"en"][r]===e)||""};var v=e=>({fn:e});import{useEffect as Cd,useMemo as ei}from"react";import{Editor as Sd}from"slate";import{useSlateStatic as Rd}from"slate-react";function ie(e){return!!e}function Wn(e,t){let o=t.map(r=>r.editableProps?.decorate).filter(ie);return function(r){let n=[];for(let i of o){let a=i(r);n.push(...a)}return e&&n.push(...e(r)),n}}import{Editable as wd}from"slate-react";import{jsx as Id}from"react/jsx-runtime";function Gn(e){let t=e.map(r=>r.renderEditable).filter(ie),o=r=>Id(wd,{...r});for(let r of t){let n=o;o=i=>r({attributes:i,Editable:n})}return o}function Ct(e,t){let o=[];for(let r of e){let n=r.editableProps?.[t];n&&o.push(n)}return o}function St(e,t){return function(o){for(let r of e)if(r(o))return;t?.(o)}}var qn=(e,t)=>{let o=Ct(t,"onKeyDown");return St(o,e)},Qn=(e,t)=>{let o=Ct(t,"onKeyUp");return St(o,e)},Xn=(e,t)=>{let o=Ct(t,"onPaste");return St(o,e)},jn=(e,t)=>{let o=Ct(t,"onDrop");return St(o,e)};function Yn(e,t){let o=t.map(r=>r.editableProps?.renderElement).filter(ie);return function(n){for(let i of o){let a=i(n);if(a)return a}if(e===void 0)throw new Error(`Element with type ${n.element.type} not handled. Note that renderElement is not defined on SinkEditable so this is only the result of checking the Sink Plugins.`);return e(n)}}import{cloneElement as Md}from"react";function Jn(e,t){if(e===void 0)throw new Error("renderLeaf was not defined on SinkEditable");let o=t.map(r=>r.editableProps?.renderLeaf).filter(ie).reverse();return function(r){let n=e({...r,attributes:{}});for(let i of o){let a=i({...r,children:n});a&&(n=a)}return n=Md(n,r.attributes),n}}function Zn(e,t){if(e)return e;let o=t.map(r=>r.editableProps?.renderPlaceholder).filter(ie);if(o.length!==0)return function(r){if(o.length>1)throw new Error(`Only one plugin can define renderPlaceholder but there are ${o.length}`);let n=o[0];if(n==null)throw new Error("Expected fn to be defined");return n(r)}}import Pd from"@emotion/styled";var st=Pd("div")`
28
+ `)),t.push(l)}let r=t.join("");return r.trim()===""?"":r.replace(/^\n+/,"").trim()}function st(e){let t=bn(e);return Ct(t)}var Lo={ja:{bold:"\u592A\u5B57",italic:"\u659C\u4F53",strike:"\u53D6\u308A\u6D88\u3057\u7DDA",inlineCode:"\u30A4\u30F3\u30E9\u30A4\u30F3\u30B3\u30FC\u30C9",underline:"\u4E0B\u7DDA",highlight:"\u30CF\u30A4\u30E9\u30A4\u30C8",increaseDepth:"\u968E\u5C64\u3092\u6DF1\u304F\u3059\u308B",decreaseDepth:"\u968E\u5C64\u3092\u6D45\u304F\u3059\u308B",heading1:"\u898B\u51FA\u30571",heading2:"\u898B\u51FA\u30572",heading3:"\u898B\u51FA\u30573",normal:"\u6A19\u6E96",paragraph:"\u6BB5\u843D",paragraphStyle:"\u6BB5\u843D\u30B9\u30BF\u30A4\u30EB",bulletList:"\u7B87\u6761\u66F8\u304D",numberedList:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkList:"\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",list:"\u30EA\u30B9\u30C8",linkUrl:"\u30EA\u30F3\u30AF\u306EURL",linkText:"\u30EA\u30F3\u30AF\u30C6\u30AD\u30B9\u30C8",linkTextHint:"\u30EA\u30F3\u30AF\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u308B\u30C6\u30AD\u30B9\u30C8",tooltipText:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\u30C6\u30AD\u30B9\u30C8",tooltipHint:"\u30DE\u30A6\u30B9\u30DB\u30D0\u30FC\u6642\u306B\u8868\u793A\u3055\u308C\u308B\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",apply:"\u9069\u7528",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",insertLink:"\u30EA\u30F3\u30AF",quote:"\u5F15\u7528",insertTable:"\u8868",insertImage:"\u753B\u50CF",insertImageFromUrl:"\u753B\u50CF",insert:"\u633F\u5165",format:"\u66F8\u5F0F",imageUrlRequired:"\u753B\u50CFURL\uFF08\u5FC5\u9808\uFF09\uFF1A",altText:"\u4EE3\u66FF\u30C6\u30AD\u30B9\u30C8\uFF1A",title:"\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\uFF1A",imageDescription:"\u753B\u50CF\u306E\u8AAC\u660E",imageTitle:"\u753B\u50CF\u306E\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",switchToVisualEditor:"\u30D3\u30B8\u30E5\u30A2\u30EB\u30A8\u30C7\u30A3\u30BF\u306B\u5207\u308A\u66FF\u3048",switchToRawMarkdown:"\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8868\u793A\u306B\u5207\u308A\u66FF\u3048",codeBlock:"\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF",increaseQuoteDepth:"\u5F15\u7528\u3092\u91CD\u306D\u308B",horizontalRule:"\u533A\u5207\u308A\u7DDA",register:"\u767B\u9332",imageSourceUrl:"URL",imageSourceFile:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",selectFile:"\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E",uploading:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D...",saving:"\u4FDD\u5B58\u4E2D...",uploadComplete:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5B8C\u4E86",imageSourceSelect:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u6E08\u307F",vaultPath:"\u4FDD\u5B58\u5148\u30D1\u30B9\uFF1A",vaultPathHint:"vault\u5185\u306E\u4FDD\u5B58\u5148\u30D1\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},en:{bold:"Bold",italic:"Italic",strike:"Strikethrough",inlineCode:"Inline Code",underline:"Underline",highlight:"Highlight",increaseDepth:"Increase Depth",decreaseDepth:"Decrease Depth",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",normal:"Normal",paragraph:"Paragraph",paragraphStyle:"Paragraph Style",bulletList:"Bullet List",numberedList:"Numbered List",checkList:"Check List",list:"List",linkUrl:"Link URL",linkText:"Link Text",linkTextHint:"Text displayed as the link",tooltipText:"Tooltip Text",tooltipHint:"Tooltip shown on mouse hover",apply:"Apply",cancel:"Cancel",insertLink:"Link",quote:"Quote",insertTable:"Table",insertImage:"Image",insertImageFromUrl:"Image",insert:"Insert",format:"Format",imageUrlRequired:"Image URL (required):",altText:"Alt Text:",title:"tooltip:",imageDescription:"Description of the image",imageTitle:"tooltip",switchToVisualEditor:"Switch to visual editor",switchToRawMarkdown:"Switch to raw markdown",codeBlock:"Code Block",increaseQuoteDepth:"Increase Quote Depth",horizontalRule:"Horizontal Rule",register:"Register",imageSourceUrl:"URL",imageSourceFile:"Upload",selectFile:"Select File",uploading:"Uploading...",saving:"Saving...",uploadComplete:"Upload Complete",imageSourceSelect:"Uploaded",vaultPath:"Save Path:",vaultPathHint:"Enter the path within the vault to save the file"}},_n=()=>{try{if(typeof window<"u"&&window.navigator)return window.navigator.language.split("-")[0]}catch{}return"en"},h=e=>{let t=_n();return Lo[t==="ja"?"ja":"en"][e]},zo=e=>{let t=_n();return Object.keys(Lo[t==="ja"?"ja":"en"]).find(r=>Lo[t==="ja"?"ja":"en"][r]===e)||""};var v=e=>({fn:e});import{useEffect as Sd,useMemo as ei}from"react";import{Editor as Rd}from"slate";import{useSlateStatic as Ld}from"slate-react";function ie(e){return!!e}function Wn(e,t){let o=t.map(r=>r.editableProps?.decorate).filter(ie);return function(r){let n=[];for(let i of o){let a=i(r);n.push(...a)}return e&&n.push(...e(r)),n}}import{Editable as Id}from"slate-react";import{jsx as Md}from"react/jsx-runtime";function Gn(e){let t=e.map(r=>r.renderEditable).filter(ie),o=r=>Md(Id,{...r});for(let r of t){let n=o;o=i=>r({attributes:i,Editable:n})}return o}function St(e,t){let o=[];for(let r of e){let n=r.editableProps?.[t];n&&o.push(n)}return o}function Rt(e,t){return function(o){for(let r of e)if(r(o))return;t?.(o)}}var qn=(e,t)=>{let o=St(t,"onKeyDown");return Rt(o,e)},Qn=(e,t)=>{let o=St(t,"onKeyUp");return Rt(o,e)},Xn=(e,t)=>{let o=St(t,"onPaste");return Rt(o,e)},jn=(e,t)=>{let o=St(t,"onDrop");return Rt(o,e)};function Yn(e,t){let o=t.map(r=>r.editableProps?.renderElement).filter(ie);return function(n){for(let i of o){let a=i(n);if(a)return a}if(e===void 0)throw new Error(`Element with type ${n.element.type} not handled. Note that renderElement is not defined on SinkEditable so this is only the result of checking the Sink Plugins.`);return e(n)}}import{cloneElement as Pd}from"react";function Jn(e,t){if(e===void 0)throw new Error("renderLeaf was not defined on SinkEditable");let o=t.map(r=>r.editableProps?.renderLeaf).filter(ie).reverse();return function(r){let n=e({...r,attributes:{}});for(let i of o){let a=i({...r,children:n});a&&(n=a)}return n=Pd(n,r.attributes),n}}function Zn(e,t){if(e)return e;let o=t.map(r=>r.editableProps?.renderPlaceholder).filter(ie);if(o.length!==0)return function(r){if(o.length>1)throw new Error(`Only one plugin can define renderPlaceholder but there are ${o.length}`);let n=o[0];if(n==null)throw new Error("Expected fn to be defined");return n(r)}}import Cd from"@emotion/styled";var mt=Cd("div")`
29
29
  -webkit-font-smoothing: antialiased;
30
30
  -moz-osx-font-smoothing: grayscale;
31
31
  font-size: 1rem;
32
32
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
33
33
  Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
34
34
  box-sizing: border-box;
35
- `;import{jsx as Ld}from"react/jsx-runtime";function ti(e){let t=Rd();Cd(()=>{Sd.normalize(t,{force:!0})},[t]);let{plugins:o}=t.sink,r=ei(()=>({...e,decorate:Wn(e.decorate,o),renderElement:Yn(e.renderElement,o),renderLeaf:Jn(e.renderLeaf,o),renderPlaceholder:Zn(e.renderPlaceholder,o),onKeyDown:qn(e.onKeyDown,o),onKeyUp:Qn(e.onKeyUp,o),onPaste:Xn(e.onPaste,o),onDrop:jn(e.onDrop,o)}),[e.decorate,e.renderElement,e.renderLeaf,e.renderPlaceholder,e.onKeyDown,e.onKeyUp,e.onPaste,e.onDrop,e.placeholder,e.className,o]),n=ei(()=>Gn(o),[o]);return Ld(n,{...r})}function $e(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(a){for(let m of n){let c=m.editor?.[t],d=c?.(a);if(typeof d=="boolean")return d}return r(a)}}function me(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,m=[];for(let s of n){let c=s.editor?.[t]?.(...a);if(typeof c=="function")m.push(c);else if(c===!0){l=!0;break}}l||r(...a),m.forEach(s=>s())}}function oi(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:me(r,"normalizeNode",n),deleteBackward:me(r,"deleteBackward",n),deleteForward:me(r,"deleteForward",n),deleteFragment:me(r,"deleteFragment",n),insertBreak:me(r,"insertBreak",n),insertFragment:me(r,"insertFragment",n),insertNode:me(r,"insertNode",n),insertText:me(r,"insertText",n),isInline:$e(r,"isInline",n),isVoid:$e(r,"isVoid",n),isMaster:$e(r,"isMaster",n),isSlave:$e(r,"isSlave",n),isStandalone:$e(r,"isStandalone",n)}),r}}var ri=e=>{let t=e.map(n=>n.fn);return{withSink:oi(t),SinkEditable:ti}};import{Element as Bd}from"slate";import{ReactEditor as zd}from"slate-react";function ni(e,t){return Bd.isElement(t)?zd.findPath(e,t):t}function f(e,t){return e.bind(null,t)}function q(e,t,o){return e.bind(null,t,o)}var Dd=/mac os x|macintosh/i,mt;function Rt(){if(mt!==void 0)return mt;try{let{userAgent:e}=window.navigator;mt=Dd.test(e)}catch{mt=!1}return mt}function Ie(e){e.preventDefault(),e.stopPropagation()}import{Editor as li,Path as Nd}from"slate";import{Element as ii}from"slate";function ai(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>ii.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>ii.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=ni(e,o),n=ai(t);if(Nd.isPath(r)){let i=li.node(e,r);if(i&&n(i[0]))return i}return li.above(e,{at:r,match:n})}function He(...e){return E(...e)?.[1]}import{jsx as $d}from"react/jsx-runtime";var y=({strokeWidth:e=1.5,...t})=>$d("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 Hd}from"slate";function ce(e){return e==null?!1:Hd.isCollapsed(e)}import{Element as si}from"slate";function Lt(e){return Array.isArray(e)?t=>si.isElement(t)&&e.includes(t.type):t=>si.isElement(t)&&e==t.type}import{Editor as Ad}from"slate";function mi(e,t){let{selection:o}=e;if(!ce(o))return!1;let r=E(e,t,{at:o});return!!r&&Ad.isEnd(e,o.anchor,r[1])}import{Editor as Rv}from"slate";import{Editor as Od}from"slate";function Me(e,t){let{selection:o}=e;if(!ce(o))return!1;let r=E(e,t,{at:o});return!!r&&Od.isStart(e,o.anchor,r[1])}import{isHotkey as ci}from"is-hotkey";import{Editor as zo,Element as Ud,Range as Fd,Transforms as Vd}from"slate";var Kd=ci(" "),_d=ci("SHIFT+SPACE");function pi(e,t){return o=>{if(!Kd(o.nativeEvent)&&!_d(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Fd.isExpanded(r))return!1;let n=E(e,s=>Ud.isElement(s)&&e.convertElement.isConvertibleElement(s));if(!n)return!1;let i={anchor:zo.start(e,n[1]),focus:r.focus},a=zo.string(e,i),l=t[a];if(!l)return!1;Ie(o);let m={anchor:zo.start(e,n[1]),focus:r.focus};return Vd.delete(e,{at:m}),l(),!0}}import{isHotkey as Wd}from"is-hotkey";function di(e){let t=e.replace(/\bsuper\b/g,Rt()?"cmd+alt":"ctrl+shift");return Wd(t)}function N(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[di(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 Gd,Transforms as ui}from"slate";function fi(e,t){Gd.withoutNormalizing(e,()=>{ui.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),ui.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as hi}from"slate";function xe(e,t,o){let[,r]=t,n=hi.previous(e,{at:r});if(n&&o(n,t))return!0;let i=hi.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as gi,Transforms as bi}from"slate";function Q(e,t){bi.select(e,gi.start(e,t))}function Ei(e,t){bi.select(e,gi.end(e,t))}function xi(e,t){return typeof t!="function"?t:t(e)}import{Editor as Do,Element as qd,Path as Qd,Transforms as ct}from"slate";function yi(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>qd.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;Do.withoutNormalizing(e,()=>{ct.insertNodes(e,t,{at:o}),n&&(ct.select(e,n),ct.move(e))})}else{let n=Qd.next(r[1]);Do.withoutNormalizing(e,()=>{ct.insertNodes(e,t,{at:n}),ct.select(e,Do.start(e,n))})}return!0}import{Editor as ki,Transforms as vi}from"slate";function pt(e,t,o){ki.withoutNormalizing(e,()=>{let r=ki.node(e,o),n=xi(r[0],t);vi.wrapNodes(e,n,{at:o}),vi.unwrapNodes(e,{at:[...o,0]})})}import{Editor as Xd,Transforms as jd}from"slate";function Bt(e,t,o){let r=Array.from(Xd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;jd.setNodes(e,t(i),{at:n[1]})}return!0}function Ti(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 Yd(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function Yd(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as Jd,Node as Zd,Transforms as No}from"slate";function wi(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(No.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let m=Zd.string(a);r!==m&&Jd.withoutNormalizing(e,()=>{let s=a.children.length;for(let c=s-1;c>=0;c--)No.removeNodes(e,{at:[...l,c]});No.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as zt,Element as eu,Range as tu,Text as ou,Transforms as $o}from"slate";function Ii(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:zt.start(e,[0]),focus:zt.start(e,[0])};if(tu.isCollapsed(i)){if($o.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=zt.node(e,e.selection);$o.select(e,a[1])}}else $o.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>ou.isText(a)||eu.isElement(a)&&zt.isInline(e,a)})}import{Transforms as ru}from"slate";function Mi(e,{at:t}){let o=E(e,"anchor",{at:t});return o?(ru.unwrapNodes(e,{at:o[1]}),!0):!1}function Pi(e){return{insertLink:f(Ii,e),removeLink:f(Mi,e),editLink:f(wi,e)}}import{Element as Ci,Transforms as nu}from"slate";function Si(e,t){if(!Ci.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(!(!Ci.isElement(n)||n.type!=="anchor"))return nu.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Ju}from"clsx";import{useEffect as Zu,useRef as ha}from"react";import{useSelected as ef,useSlate as tf}from"slate-react";import{createContext as Li,useState as au}from"react";import{createPortal as iu}from"react-dom";function Ri({children:e}){return typeof document>"u"||!document.body?null:iu(e,document.body)}import{jsx as Ho,jsxs as su}from"react/jsx-runtime";var Ao=Li({}),lu=Li({});function Bi({children:e}){let[t,o]=au({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return su(Ao.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Ho(Ri,{children:Ho(lu.Provider,{value:i,children:Ho(i.Component,{})})},i.type))]})}import{useContext as mu}from"react";function O(e){let{openLayer:t,closeLayer:o,layers:r}=mu(Ao);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import Dt from"@emotion/styled";var zi=Dt("a")`
35
+ `;import{jsx as zd}from"react/jsx-runtime";function ti(e){let t=Ld();Sd(()=>{Rd.normalize(t,{force:!0})},[t]);let{plugins:o}=t.sink,r=ei(()=>({...e,decorate:Wn(e.decorate,o),renderElement:Yn(e.renderElement,o),renderLeaf:Jn(e.renderLeaf,o),renderPlaceholder:Zn(e.renderPlaceholder,o),onKeyDown:qn(e.onKeyDown,o),onKeyUp:Qn(e.onKeyUp,o),onPaste:Xn(e.onPaste,o),onDrop:jn(e.onDrop,o)}),[e.decorate,e.renderElement,e.renderLeaf,e.renderPlaceholder,e.onKeyDown,e.onKeyUp,e.onPaste,e.onDrop,e.placeholder,e.className,o]),n=ei(()=>Gn(o),[o]);return zd(n,{...r})}function He(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(a){for(let m of n){let c=m.editor?.[t],d=c?.(a);if(typeof d=="boolean")return d}return r(a)}}function me(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,m=[];for(let s of n){let c=s.editor?.[t]?.(...a);if(typeof c=="function")m.push(c);else if(c===!0){l=!0;break}}l||r(...a),m.forEach(s=>s())}}function oi(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:me(r,"normalizeNode",n),deleteBackward:me(r,"deleteBackward",n),deleteForward:me(r,"deleteForward",n),deleteFragment:me(r,"deleteFragment",n),insertBreak:me(r,"insertBreak",n),insertFragment:me(r,"insertFragment",n),insertNode:me(r,"insertNode",n),insertText:me(r,"insertText",n),isInline:He(r,"isInline",n),isVoid:He(r,"isVoid",n),isMaster:He(r,"isMaster",n),isSlave:He(r,"isSlave",n),isStandalone:He(r,"isStandalone",n)}),r}}var ri=e=>{let t=e.map(n=>n.fn);return{withSink:oi(t),SinkEditable:ti}};import{Element as Bd}from"slate";import{ReactEditor as Dd}from"slate-react";function ni(e,t){return Bd.isElement(t)?Dd.findPath(e,t):t}function f(e,t){return e.bind(null,t)}function q(e,t,o){return e.bind(null,t,o)}var $d=/mac os x|macintosh/i,ct;function Lt(){if(ct!==void 0)return ct;try{let{userAgent:e}=window.navigator;ct=$d.test(e)}catch{ct=!1}return ct}function Me(e){e.preventDefault(),e.stopPropagation()}import{Editor as li,Path as Nd}from"slate";import{Element as ii}from"slate";function ai(e){if(typeof e=="function")return e;if(typeof e=="string")return o=>ii.isElement(o)&&o.type===e;if(Array.isArray(e))return o=>ii.isElement(o)&&e.includes(o.type);let t=e;throw new Error(`Expected matchNode to be a function, string or array but is ${t}`)}function x(e,t,{at:o=e.selection}={}){if(o===null)return;let r=ni(e,o),n=ai(t);if(Nd.isPath(r)){let i=li.node(e,r);if(i&&n(i[0]))return i}return li.above(e,{at:r,match:n})}function Ae(...e){return x(...e)?.[1]}import{jsx as Hd}from"react/jsx-runtime";var y=({strokeWidth:e=1.5,...t})=>Hd("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 Ad}from"slate";function ce(e){return e==null?!1:Ad.isCollapsed(e)}import{Element as si}from"slate";function zt(e){return Array.isArray(e)?t=>si.isElement(t)&&e.includes(t.type):t=>si.isElement(t)&&e==t.type}import{Editor as Od}from"slate";function mi(e,t){let{selection:o}=e;if(!ce(o))return!1;let r=x(e,t,{at:o});return!!r&&Od.isEnd(e,o.anchor,r[1])}import{Editor as zv}from"slate";import{Editor as Ud}from"slate";function Pe(e,t){let{selection:o}=e;if(!ce(o))return!1;let r=x(e,t,{at:o});return!!r&&Ud.isStart(e,o.anchor,r[1])}import{isHotkey as ci}from"is-hotkey";import{Editor as Bo,Element as Fd,Range as Vd,Transforms as Kd}from"slate";var _d=ci(" "),Wd=ci("SHIFT+SPACE");function pi(e,t){return o=>{if(!_d(o.nativeEvent)&&!Wd(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Vd.isExpanded(r))return!1;let n=x(e,s=>Fd.isElement(s)&&e.convertElement.isConvertibleElement(s));if(!n)return!1;let i={anchor:Bo.start(e,n[1]),focus:r.focus},a=Bo.string(e,i),l=t[a];if(!l)return!1;Me(o);let m={anchor:Bo.start(e,n[1]),focus:r.focus};return Kd.delete(e,{at:m}),l(),!0}}import{isHotkey as Gd}from"is-hotkey";function di(e){let t=e.replace(/\bsuper\b/g,Lt()?"cmd+alt":"ctrl+shift");return Gd(t)}function H(e){let t=null;return function(r){t==null&&(t=Object.entries(e).map(([n,i])=>[di(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 qd,Transforms as ui}from"slate";function fi(e,t){qd.withoutNormalizing(e,()=>{ui.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:"123"},{at:t}),ui.setNodes(e,{__DOESNT_MATTER_JUST_TO_START_NORMALIZING__:null},{at:t})})}import{Editor as hi}from"slate";function xe(e,t,o){let[,r]=t,n=hi.previous(e,{at:r});if(n&&o(n,t))return!0;let i=hi.next(e,{at:r});return!!(i&&o(t,i))}import{Editor as gi,Transforms as bi}from"slate";function Q(e,t){bi.select(e,gi.start(e,t))}function Ei(e,t){bi.select(e,gi.end(e,t))}function xi(e,t){return typeof t!="function"?t:t(e)}import{Editor as Do,Element as Qd,Path as Xd,Transforms as pt}from"slate";function yi(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Qd.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;Do.withoutNormalizing(e,()=>{pt.insertNodes(e,t,{at:o}),n&&(pt.select(e,n),pt.move(e))})}else{let n=Xd.next(r[1]);Do.withoutNormalizing(e,()=>{pt.insertNodes(e,t,{at:n}),pt.select(e,Do.start(e,n))})}return!0}import{Editor as ki,Transforms as vi}from"slate";function dt(e,t,o){ki.withoutNormalizing(e,()=>{let r=ki.node(e,o),n=xi(r[0],t);vi.wrapNodes(e,n,{at:o}),vi.unwrapNodes(e,{at:[...o,0]})})}import{Editor as jd,Transforms as Yd}from"slate";function Bt(e,t,o){let r=Array.from(jd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Yd.setNodes(e,t(i),{at:n[1]})}return!0}function Ti(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 Jd(n)?(t.preventDefault(),t.stopPropagation(),e.anchor.insertLink(n),!0):!1}function Jd(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}import{Editor as Zd,Node as eu,Transforms as $o}from"slate";function wi(e,{href:t,title:o,text:r},{at:n}){let i=x(e,"anchor",{at:n});if(!i)return!1;let[a,l]=i;if($o.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let m=eu.string(a);r!==m&&Zd.withoutNormalizing(e,()=>{let s=a.children.length;for(let c=s-1;c>=0;c--)$o.removeNodes(e,{at:[...l,c]});$o.insertNodes(e,{text:r},{at:[...l,0]})})}return!0}import{Editor as Dt,Element as tu,Range as ou,Text as ru,Transforms as No}from"slate";function Ii(e,t,o=t,{select:r=!0,title:n}={}){let i=e.selection||{anchor:Dt.start(e,[0]),focus:Dt.start(e,[0])};if(ou.isCollapsed(i)){if(No.insertNodes(e,{type:"anchor",href:t,title:n,children:[{text:o}]},{select:r,at:i}),r&&e.selection){let a=Dt.node(e,e.selection);No.select(e,a[1])}}else No.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>ru.isText(a)||tu.isElement(a)&&Dt.isInline(e,a)})}import{Transforms as nu}from"slate";function Mi(e,{at:t}){let o=x(e,"anchor",{at:t});return o?(nu.unwrapNodes(e,{at:o[1]}),!0):!1}function Pi(e){return{insertLink:f(Ii,e),removeLink:f(Mi,e),editLink:f(wi,e)}}import{Element as Ci,Transforms as iu}from"slate";function Si(e,t){if(!Ci.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(!(!Ci.isElement(n)||n.type!=="anchor"))return iu.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Zu}from"clsx";import{useEffect as ef,useRef as ga}from"react";import{useSelected as tf,useSlate as of}from"slate-react";import{createContext as Li,useState as lu}from"react";import{createPortal as au}from"react-dom";function Ri({children:e}){return typeof document>"u"||!document.body?null:au(e,document.body)}import{jsx as Ho,jsxs as mu}from"react/jsx-runtime";var Ao=Li({}),su=Li({});function zi({children:e}){let[t,o]=lu({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return mu(Ao.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Ho(Ri,{children:Ho(su.Provider,{value:i,children:Ho(i.Component,{})})},i.type))]})}import{useContext as cu}from"react";function O(e){let{openLayer:t,closeLayer:o,layers:r}=cu(Ao);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import $t from"@emotion/styled";var Bi=$t("a")`
36
36
  /**
37
37
  * Link colors
38
38
  */
@@ -51,10 +51,10 @@
51
51
  &.--selected {
52
52
  background: var(--blue-50);
53
53
  }
54
- `,Oo=Dt("span")`
54
+ `,Oo=$t("span")`
55
55
  display: inline;
56
56
  padding: 0 1px 0 0;
57
- `,NT=Dt("span")`
57
+ `,HT=$t("span")`
58
58
  position: fixed;
59
59
  width: 100px;
60
60
  background: var(--shade-50);
@@ -63,14 +63,14 @@
63
63
  border: 1px solid var(--shade-400);
64
64
  overflow: hidden;
65
65
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
66
- `,$T=Dt("span")`
66
+ `,AT=$t("span")`
67
67
  position: absolute;
68
68
  left: 0;
69
69
  top: 0;
70
70
  height: 14px;
71
71
  background: var(--blue-400);
72
72
  transition: width 100ms linear;
73
- `;import qu from"@emotion/styled";import{useCallback as _t,useState as Qu}from"react";import{useSlateStatic as Xu}from"slate-react";import{useRef as pu}from"react";import cu from"@emotion/styled";var Di=cu("div")`
73
+ `;import qu from"@emotion/styled";import{useCallback as _t,useRef as Qu,useState as Xu}from"react";import{useSlateStatic as ju}from"slate-react";import{useRef as du}from"react";import pu from"@emotion/styled";var Di=pu("div")`
74
74
  position: fixed;
75
75
  user-select: none;
76
76
  top: 0;
@@ -79,7 +79,7 @@
79
79
  bottom: 0;
80
80
  overflow-y: auto;
81
81
  background: rgba(0, 0, 0, 0.01);
82
- `;import{jsx as du}from"react/jsx-runtime";function ye({close:e}){let t=pu(null);return du(Di,{ref:t,onClick:e})}var ae={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},uu={shift:ae.shift,opt:ae.opt,alt:ae.opt,ctrl:ae.ctrl,mod:ae.cmd,cmd:ae.cmd,enter:ae.enter,super:`${ae.opt}${ae.cmd}`},fu={alt:"ALT",ctrl:"CTRL",opt:"ALT",shift:"SHIFT",mod:"CTRL",cmd:"CTRL",enter:ae.enter,super:"CTRL+SHIFT"};function Ni(e,t){let o=e.findIndex(r=>r===t);o!==-1&&e.splice(o,1)}function hu(e){let t=[];return Object.entries(uu).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Ni(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}function gu(e){let t=[];return Object.entries(fu).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Ni(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("+")}function Nt(e){let t=e.toLowerCase().split("+");return Rt()?hu(t):gu(t)}import{useRef as Cu}from"react";import{useSlateStatic as Su}from"slate-react";function Uo(e){let t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}}function $i(e){let t=Uo(e),{scrollY:o}=window;return Object.assign(t,{top:t.top+o,bottom:t.bottom+o})}function Fo(){let e=document.documentElement.clientWidth||document.body.clientWidth;return{top:0,right:e,bottom:window.innerHeight,left:0,width:e,height:window.innerHeight}}function Hi(){let e=Fo();return Object.assign(e,{top:window.scrollY,bottom:window.scrollY+e.height})}var Ai=bu;function bu(e,t){for(var o={},r=Object.keys(e),n=r.length,i=0;i<n;i++){var a=r[i];o[a]=t(e[a],a,e)}return o}function Vo(e,t){return Ai(e,r=>{let n=r instanceof HTMLElement?r:r.current;return n?t(n):null})}import{useEffect as ku}from"react";import Eu from"lodash.throttle";import{useMemo as xu,useState as yu}from"react";function $t(e=100){let[t,o]=yu(0),r=xu(()=>Eu(()=>{o(n=>n+1)},e,{trailing:!0}),[e]);return Object.assign(r,{counter:t})}function Ko(){let e=$t();return ku(()=>(e(),window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}),[]),e}function j(e,t){let o=Ko(),r=Vo(e,n=>$i(n));return t(r,Hi(),o)}function Ht(e,t,o,{margin:r=0}={}){if(e==null)return{...o,left:-1024};let{top:n}=o,{left:i}=o,a=t.right-t.left-r*2;return e.width>=a?i=t.left+r:(i+e.width>t.right-r&&(i=t.right-e.width-r),i<t.left+r&&(i=t.left+r)),{left:i,top:n}}import _o from"@emotion/styled";import vu from"@emotion/styled";var Y=vu(st)`
82
+ `;import{jsx as uu}from"react/jsx-runtime";function ye({close:e}){let t=du(null);return uu(Di,{ref:t,onClick:e})}var ae={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},fu={shift:ae.shift,opt:ae.opt,alt:ae.opt,ctrl:ae.ctrl,mod:ae.cmd,cmd:ae.cmd,enter:ae.enter,super:`${ae.opt}${ae.cmd}`},hu={alt:"ALT",ctrl:"CTRL",opt:"ALT",shift:"SHIFT",mod:"CTRL",cmd:"CTRL",enter:ae.enter,super:"CTRL+SHIFT"};function $i(e,t){let o=e.findIndex(r=>r===t);o!==-1&&e.splice(o,1)}function gu(e){let t=[];return Object.entries(fu).forEach(([o,r])=>{e.includes(o)&&(t.push(r),$i(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}function bu(e){let t=[];return Object.entries(hu).forEach(([o,r])=>{e.includes(o)&&(t.push(r),$i(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("+")}function Nt(e){let t=e.toLowerCase().split("+");return Lt()?gu(t):bu(t)}import{useRef as Su}from"react";import{useSlateStatic as Ru}from"slate-react";function Uo(e){let t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}}function Ni(e){let t=Uo(e),{scrollY:o}=window;return Object.assign(t,{top:t.top+o,bottom:t.bottom+o})}function Fo(){let e=document.documentElement.clientWidth||document.body.clientWidth;return{top:0,right:e,bottom:window.innerHeight,left:0,width:e,height:window.innerHeight}}function Hi(){let e=Fo();return Object.assign(e,{top:window.scrollY,bottom:window.scrollY+e.height})}var Ai=Eu;function Eu(e,t){for(var o={},r=Object.keys(e),n=r.length,i=0;i<n;i++){var a=r[i];o[a]=t(e[a],a,e)}return o}function Vo(e,t){return Ai(e,r=>{let n=r instanceof HTMLElement?r:r.current;return n?t(n):null})}import{useEffect as vu}from"react";import xu from"lodash.throttle";import{useMemo as yu,useState as ku}from"react";function Ht(e=100){let[t,o]=ku(0),r=yu(()=>xu(()=>{o(n=>n+1)},e,{trailing:!0}),[e]);return Object.assign(r,{counter:t})}function Ko(){let e=Ht();return vu(()=>(e(),window.addEventListener("resize",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}),[]),e}function j(e,t){let o=Ko(),r=Vo(e,n=>Ni(n));return t(r,Hi(),o)}function ke(e,t,o,{margin:r=0}={}){if(e==null)return{...o,left:-1024};let{top:n}=o,{left:i}=o,a=t.right-t.left-r*2;return e.width>=a?i=t.left+r:(i+e.width>t.right-r&&(i=t.right-e.width-r),i<t.left+r&&(i=t.left+r)),{left:i,top:n}}import _o from"@emotion/styled";import Tu from"@emotion/styled";var Y=Tu(mt)`
83
83
  position: absolute;
84
84
  z-index: 1000;
85
85
  border: 1px solid var(--table-border-color);
@@ -89,6 +89,8 @@
89
89
  drop-shadow(0 2px 2px rgb(0 0 0 / 0.06));
90
90
  background: white;
91
91
  color: #333;
92
+ max-width: calc(100vw - 32px);
93
+ box-sizing: border-box;
92
94
  /**
93
95
  * If you are tempted to add the transitions back in, here's why we left
94
96
  * them off:
@@ -124,7 +126,7 @@
124
126
  &:focus {
125
127
  outline: 2px solid var(--blue-200);
126
128
  }
127
- `;import Fi from"@emotion/styled";import Tu from"@emotion/styled";var Ui=Tu(st)`
129
+ `;import Fi from"@emotion/styled";import wu from"@emotion/styled";var Ui=wu(mt)`
128
130
  border: 1px solid var(--shade-300); /* shade-300 */
129
131
  border-radius: 0.5em;
130
132
  color: rgb(39 39 42); /* shade-800 */
@@ -219,7 +221,7 @@
219
221
  background: var(--shade-200);
220
222
  margin-top: 0.25em;
221
223
  margin-bottom: 0.25em;
222
- `;import dt from"@emotion/styled";var qi=dt("div")`
224
+ `;import ut from"@emotion/styled";var qi=ut("div")`
223
225
  /**
224
226
  * This flex rule applies to the "display: flex;" of the parent container.
225
227
  * Ensures the toolbar does not shrink or grow vertically.
@@ -258,22 +260,22 @@
258
260
  3em + 1px
259
261
  ); // $ToolbarDivider height + border-bottom of 1px above
260
262
  overflow: hidden;
261
- `,Qi=dt("div")`
263
+ `,Qi=ut("div")`
262
264
  display: inline-block;
263
265
  height: calc(
264
266
  3em + 1px
265
267
  ); // $ToolbarDivider height + border-bottom of 1px above
266
- `,Xi=dt("div")`
268
+ `,Xi=ut("div")`
267
269
  display: inline-block;
268
270
  height: 3em;
269
271
  padding: 0 0.375em;
270
- `,ji=dt("div")`
272
+ `,ji=ut("div")`
271
273
  display: inline-block;
272
274
  background: var(--shade-300);
273
275
  opacity: 50%;
274
276
  width: 1px;
275
277
  height: 3em;
276
- `,Yi=dt("div")`
278
+ `,Yi=ut("div")`
277
279
  box-sizing: border-box;
278
280
  position: relative;
279
281
  display: inline-block;
@@ -323,7 +325,7 @@
323
325
  margin-left: -0.25em;
324
326
  opacity: 0.375;
325
327
  }
326
- `;import{useCallback as wu}from"react";import{ReactEditor as Iu}from"slate-react";import{Fragment as Pu,jsx as Ae,jsxs as Mu}from"react/jsx-runtime";function Ji({editor:e,item:t,close:o,dest:r}){let n=O("menu"),i=wu(()=>{if(t.Component){let a=t.Component;n.open(()=>Ae(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),Iu.focus(e),o())},[e,t]);return Ae(Pu,{children:Mu(Wi,{onClick:i,children:[Ae("div",{className:"--icon",children:Ae(t.icon,{})}),Ae("div",{className:"--title",children:t.title}),Ae("div",{className:"--hotkey",children:t.hotkey?Nt(t.hotkey):void 0})]})})}import{Fragment as Ru,jsx as Ut,jsxs as Lu}from"react/jsx-runtime";function Oe({dest:e,items:t,close:o}){let r=Su(),n=Cu(null),i=j({src:n,dest:e},({dest:a})=>a?{left:a.left-8,top:a.top+a.height}:{left:0,top:0});return Lu(Ru,{children:[Ut(ye,{close:o}),Ut(_i,{ref:n,style:i,children:t.map((a,l)=>a==="divider"?Ut(Gi,{},l):a.show&&!a.show(r)?null:Ut(Ji,{editor:r,item:a,close:o,dest:e},l))})]})}import{useCallback as oa}from"react";import Zi from"@emotion/styled";import{jsx as Du,jsxs as Nu}from"react/jsx-runtime";function Go(e){return e.getBoundingClientRect()}var Bu=Zi("div")`
328
+ `;import{useCallback as Iu}from"react";import{ReactEditor as Mu}from"slate-react";import{Fragment as Cu,jsx as Oe,jsxs as Pu}from"react/jsx-runtime";function Ji({editor:e,item:t,close:o,dest:r}){let n=O("menu"),i=Iu(()=>{if(t.Component){let a=t.Component;n.open(()=>Oe(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),Mu.focus(e),o())},[e,t]);return Oe(Cu,{children:Pu(Wi,{onClick:i,children:[Oe("div",{className:"--icon",children:Oe(t.icon,{})}),Oe("div",{className:"--title",children:t.title}),Oe("div",{className:"--hotkey",children:t.hotkey?Nt(t.hotkey):void 0})]})})}import{Fragment as Lu,jsx as Ut,jsxs as zu}from"react/jsx-runtime";function Ue({dest:e,items:t,close:o}){let r=Ru(),n=Su(null),i=j({src:n,dest:e},({dest:a})=>a?{left:a.left-8,top:a.top+a.height}:{left:0,top:0});return zu(Lu,{children:[Ut(ye,{close:o}),Ut(_i,{ref:n,style:i,children:t.map((a,l)=>a==="divider"?Ut(Gi,{},l):a.show&&!a.show(r)?null:Ut(Ji,{editor:r,item:a,close:o,dest:e},l))})]})}import{useCallback as oa}from"react";import Zi from"@emotion/styled";import{jsx as $u,jsxs as Nu}from"react/jsx-runtime";function Go(e){return e.getBoundingClientRect()}var Bu=Zi("div")`
327
329
  position: fixed;
328
330
  z-index: 10;
329
331
  -webkit-font-smoothing: antialiased;
@@ -339,12 +341,12 @@
339
341
  background: var(--shade-700);
340
342
  border-radius: 0.25em;
341
343
  white-space: nowrap;
342
- `,zu=Zi("span")`
344
+ `,Du=Zi("span")`
343
345
  margin-left: 0.75em;
344
346
  font-size: 0.875em;
345
347
  font-weight: 500;
346
348
  color: var(--shade-400);
347
- `;function ea({title:e,hotkey:t,dest:o}){let r=Go(o);return Nu(Bu,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?Du(zu,{children:t}):null]})}import $u from"@emotion/styled";import{jsx as Au}from"react/jsx-runtime";var Hu=$u("span")`
349
+ `;function ea({title:e,hotkey:t,dest:o}){let r=Go(o);return Nu(Bu,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?$u(Du,{children:t}):null]})}import Hu from"@emotion/styled";import{jsx as Ou}from"react/jsx-runtime";var Au=Hu("span")`
348
350
  position: fixed;
349
351
  z-index: 10;
350
352
  width: 0;
@@ -352,7 +354,7 @@
352
354
  border-left: 0.375em solid transparent;
353
355
  border-right: 0.375em solid transparent;
354
356
  border-top: 0.375em solid var(--shade-700);
355
- `;function ta({dest:e}){let t=Go(e);return Au(Hu,{style:{left:`calc(${t.left+t.width/2}px - 0.375em)`,top:`calc(${t.top}px - 0.5em)`}})}import{jsx as ra}from"react/jsx-runtime";function J({title:e,hotkey:t},o=[]){let r=O("tooltip-label"),n=O("tooltip-triangle"),i=oa(l=>{let m=l.currentTarget;e!==void 0&&(r.open(()=>ra(ea,{title:e,hotkey:typeof t=="function"?t():t,dest:m})),n.open(()=>ra(ta,{dest:m})))},o),a=oa(()=>{r.close(),n.close()},o);return{onMouseEnter:i,onMouseLeave:a}}import Vu from"@emotion/styled";import{useCallback as Fe,useRef as Ku,useState as Vt}from"react";import{Node as _u}from"slate";import{useSlateStatic as Wu}from"slate-react";import ke from"@emotion/styled";var Ue=ke("div")`
357
+ `;function ta({dest:e}){let t=Go(e);return Ou(Au,{style:{left:`calc(${t.left+t.width/2}px - 0.375em)`,top:`calc(${t.top}px - 0.5em)`}})}import{jsx as ra}from"react/jsx-runtime";function J({title:e,hotkey:t},o=[]){let r=O("tooltip-label"),n=O("tooltip-triangle"),i=oa(l=>{let m=l.currentTarget;e!==void 0&&(r.open(()=>ra(ea,{title:e,hotkey:typeof t=="function"?t():t,dest:m})),n.open(()=>ra(ta,{dest:m})))},[e,t,r,n,...o]),a=oa(()=>{r.close(),n.close()},[r,n,...o]);return{onMouseEnter:i,onMouseLeave:a}}import Ku from"@emotion/styled";import{useCallback as Ve,useRef as ca,useState as Vt}from"react";import{Node as _u}from"slate";import{useSlateStatic as Wu}from"slate-react";import ve from"@emotion/styled";var Fe=ve("div")`
356
358
  margin: 0.5em 0;
357
359
  &:first-of-type {
358
360
  margin-top: 0;
@@ -360,15 +362,15 @@
360
362
  &:last-of-type {
361
363
  margin-bottom: 0;
362
364
  }
363
- `,Ft=ke("div")`
365
+ `,Ft=ve("div")`
364
366
  font-size: 0.9375em;
365
367
  margin-bottom: 0.25em;
366
368
  color: var(--shade-700);
367
- `,qo=ke("div")`
369
+ `,qo=ve("div")`
368
370
  font-size: 0.875em;
369
371
  margin-top: 0.25em;
370
372
  color: var(--shade-500);
371
- `,na=ke("input")`
373
+ `,na=ve("input")`
372
374
  box-sizing: border-box;
373
375
  width: 100%;
374
376
  height: 6em;
@@ -382,7 +384,7 @@
382
384
  &:focus {
383
385
  outline: 2px solid var(--blue-200);
384
386
  }
385
- `,Qo=ke("input")`
387
+ `,Qo=ve("input")`
386
388
  box-sizing: border-box;
387
389
  width: 100%;
388
390
  padding: 0.5em 0.75em;
@@ -394,7 +396,7 @@
394
396
  &:focus {
395
397
  outline: 2px solid var(--blue-200);
396
398
  }
397
- `,ia=ke("div")`
399
+ `,ia=ve("div")`
398
400
  /* Center vertically and horizontally */
399
401
  display: flex;
400
402
  align-items: center;
@@ -408,7 +410,7 @@
408
410
  font-size: 1.25em;
409
411
  stroke-width: 2px;
410
412
  }
411
- `,aa=ke(ia)`
413
+ `,aa=ve(ia)`
412
414
  color: var(--blue-50);
413
415
  background: var(--blue-500);
414
416
  outline: 0px solid white;
@@ -420,7 +422,7 @@
420
422
  svg {
421
423
  color: var(--blue-200);
422
424
  }
423
- `,la=ke(ia)`
425
+ `,la=ve(ia)`
424
426
  color: var(--shade-500);
425
427
  background: var(--shade-200);
426
428
  outline: 0px solid white;
@@ -432,7 +434,7 @@
432
434
  svg {
433
435
  color: var(--shade-400);
434
436
  }
435
- `;import{useRef as Ou,useCallback as Pe}from"react";import ma from"@emotion/styled";import{jsx as sa}from"react/jsx-runtime";var Uu=ma.div`
437
+ `;import{useRef as Uu,useCallback as Ce}from"react";import ma from"@emotion/styled";import{jsx as sa}from"react/jsx-runtime";var Fu=ma.div`
436
438
  display: flex;
437
439
  align-items: center;
438
440
  justify-content: center;
@@ -447,17 +449,17 @@
447
449
  &:active {
448
450
  cursor: grabbing;
449
451
  }
450
- `,Fu=ma.div`
452
+ `,Vu=ma.div`
451
453
  width: 32px;
452
454
  height: 4px;
453
455
  background: #ccc;
454
456
  border-radius: 2px;
455
- `;function ve({onDrag:e}){let t=Ou(null),o=Pe((s,c)=>{t.current={x:s,y:c}},[]),r=Pe((s,c)=>{if(!t.current)return;let d=s-t.current.x,p=c-t.current.y;t.current={x:s,y:c},e(d,p)},[e]),n=Pe(()=>{t.current=null},[]),i=Pe(s=>{s.preventDefault(),o(s.clientX,s.clientY);let c=p=>{r(p.clientX,p.clientY)},d=()=>{n(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",d)},[o,r,n]),a=Pe(s=>{if(s.touches.length!==1)return;let c=s.touches[0];o(c.clientX,c.clientY)},[o]),l=Pe(s=>{if(s.touches.length!==1)return;let c=s.touches[0];r(c.clientX,c.clientY)},[r]),m=Pe(()=>{n()},[n]);return sa(Uu,{onMouseDown:i,onTouchStart:a,onTouchMove:l,onTouchEnd:m,children:sa(Fu,{})})}import{jsx as _,jsxs as ut}from"react/jsx-runtime";var Gu=Vu(Y)`
457
+ `;function Te({onDrag:e}){let t=Uu(null),o=Ce((s,c)=>{t.current={x:s,y:c}},[]),r=Ce((s,c)=>{if(!t.current)return;let d=s-t.current.x,p=c-t.current.y;t.current={x:s,y:c},e(d,p)},[e]),n=Ce(()=>{t.current=null},[]),i=Ce(s=>{s.preventDefault(),o(s.clientX,s.clientY);let c=p=>{r(p.clientX,p.clientY)},d=()=>{n(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",d)},[o,r,n]),a=Ce(s=>{if(s.touches.length!==1)return;let c=s.touches[0];o(c.clientX,c.clientY)},[o]),l=Ce(s=>{if(s.touches.length!==1)return;let c=s.touches[0];r(c.clientX,c.clientY)},[r]),m=Ce(()=>{n()},[n]);return sa(Fu,{onMouseDown:i,onTouchStart:a,onTouchMove:l,onTouchEnd:m,children:sa(Vu,{})})}import{jsx as _,jsxs as ft}from"react/jsx-runtime";var Gu=Ku(Y)`
456
458
  position: absolute;
457
459
  width: 20em;
458
460
  padding: 0;
459
461
  overflow: hidden;
460
- `;function ca({destAnchor:e,destStartEdge:t,element:o}){let r=O("dialog"),[n,i]=Vt({x:0,y:0}),a=Fe((k,x)=>{i(T=>({x:T.x+k,y:T.y+x}))},[]),l=j({destAnchor:e,destStartEdge:t},({destAnchor:k,destStartEdge:x})=>({left:x.left,top:k.top+k.height})),m={...l,left:l.left+n.x,top:l.top+n.y},s=Wu(),[c,d]=Vt(o.href),[p,u]=Vt(_u.string(o)),[g,w]=Vt(o.title||""),P=Ku({href:c,text:p,title:g});P.current={href:c,text:p,title:g};let S=Fe(k=>{d(k.target.value)},[]),M=Fe(k=>{u(k.target.value)},[]),H=Fe(k=>{w(k.target.value)},[]),I=Fe(()=>{r.open(()=>_(Kt,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]),A=Fe(()=>{let{href:k,text:x,title:T}=P.current;s.anchor.editLink({href:k,text:x,title:T},{at:o}),I()},[I]);return ut(Gu,{contentEditable:!1,style:m,children:[_(ve,{onDrag:a}),ut("div",{style:{padding:"1em"},children:[ut(Ue,{children:[_(Ft,{children:h("linkUrl")}),_(na,{as:"textarea",value:c,onChange:S})]}),ut(Ue,{children:[_(Ft,{children:h("linkText")}),_(Qo,{type:"text",value:p,onChange:M}),_(qo,{children:h("linkTextHint")})]}),ut(Ue,{children:[_(Ft,{children:h("tooltipText")}),_(Qo,{type:"text",value:g,onChange:H}),_(qo,{children:h("tooltipHint")})]}),_(Ue,{children:_(aa,{onClick:A,children:h("apply")})}),_(Ue,{children:_(la,{onClick:I,children:h("cancel")})})]})]})}import{jsx as Te}from"react/jsx-runtime";var pa=e=>Te(y,{...e,children:Te("path",{d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6M11 13l9-9M15 4h5v5"})}),da=e=>Te(y,{...e,children:Te("path",{d:"m9 15 3-3m2-2 1-1M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13M3 3l18 18M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0 4.972 4.972 0 0 1 0-7.071L6 11"})}),ua=e=>Te(y,{...e,children:Te("path",{d:"M4 20h4L18.5 9.5a1.5 1.5 0 0 0-4-4L4 16v4M13.5 6.5l4 4"})}),fa=e=>Te(y,{...e,children:Te("path",{d:"M18 6L6 18M6 6l12 12"})});import{jsx as Z,jsxs as ft}from"react/jsx-runtime";var ju=qu(Y)`
462
+ `;function pa({destAnchor:e,destStartEdge:t,element:o}){let r=O("dialog"),n=ca(null),[i,a]=Vt({x:0,y:0}),l=Ve((E,k)=>{a(P=>({x:P.x+E,y:P.y+k}))},[]),m=j({src:n,destAnchor:e,destStartEdge:t},({src:E,destAnchor:k,destStartEdge:P},C)=>ke(E,C,{left:P.left,top:k.top+k.height},{margin:16})),s={...m,left:m.left+i.x,top:m.top+i.y},c=Wu(),[d,p]=Vt(o.href),[u,g]=Vt(_u.string(o)),[T,S]=Vt(o.title||""),L=ca({href:d,text:u,title:T});L.current={href:d,text:u,title:T};let M=Ve(E=>{p(E.target.value)},[]),N=Ve(E=>{g(E.target.value)},[]),w=Ve(E=>{S(E.target.value)},[]),z=Ve(()=>{r.open(()=>_(Kt,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]),I=Ve(()=>{let{href:E,text:k,title:P}=L.current;c.anchor.editLink({href:E,text:k,title:P},{at:o}),z()},[z]);return ft(Gu,{ref:n,contentEditable:!1,style:s,children:[_(Te,{onDrag:l}),ft("div",{style:{padding:"1em"},children:[ft(Fe,{children:[_(Ft,{children:h("linkUrl")}),_(na,{as:"textarea",value:d,onChange:M})]}),ft(Fe,{children:[_(Ft,{children:h("linkText")}),_(Qo,{type:"text",value:u,onChange:N}),_(qo,{children:h("linkTextHint")})]}),ft(Fe,{children:[_(Ft,{children:h("tooltipText")}),_(Qo,{type:"text",value:T,onChange:w}),_(qo,{children:h("tooltipHint")})]}),_(Fe,{children:_(aa,{onClick:I,children:h("apply")})}),_(Fe,{children:_(la,{onClick:z,children:h("cancel")})})]})]})}import{jsx as we}from"react/jsx-runtime";var da=e=>we(y,{...e,children:we("path",{d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6M11 13l9-9M15 4h5v5"})}),ua=e=>we(y,{...e,children:we("path",{d:"m9 15 3-3m2-2 1-1M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13M3 3l18 18M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0 4.972 4.972 0 0 1 0-7.071L6 11"})}),fa=e=>we(y,{...e,children:we("path",{d:"M4 20h4L18.5 9.5a1.5 1.5 0 0 0-4-4L4 16v4M13.5 6.5l4 4"})}),ha=e=>we(y,{...e,children:we("path",{d:"M18 6L6 18M6 6l12 12"})});import{jsx as Z,jsxs as ht}from"react/jsx-runtime";var Yu=qu(Y)`
461
463
  position: absolute;
462
464
  width: 20em;
463
465
  z-index: 1000;
@@ -474,7 +476,8 @@
474
476
  .--link {
475
477
  text-decoration: none;
476
478
  display: flex;
477
- flex: 0 0 14em;
479
+ flex: 1 1 auto;
480
+ min-width: 0;
478
481
  overflow: hidden;
479
482
  color: var(--shade-400);
480
483
  &:hover {
@@ -487,7 +490,7 @@
487
490
  margin-left: 0.5em;
488
491
  .--hostname {
489
492
  font-size: 0.875em;
490
- width: 14em;
493
+ max-width: 14em;
491
494
  line-height: 1.5em;
492
495
  color: var(--blue-600);
493
496
  overflow-wrap: break-word;
@@ -499,7 +502,7 @@
499
502
  .--pathname {
500
503
  margin-top: 0.125em;
501
504
  font-size: 0.75em;
502
- width: 16.25em;
505
+ max-width: 16.25em;
503
506
  line-height: 1.5em;
504
507
  overflow-wrap: break-word;
505
508
  }
@@ -508,7 +511,7 @@
508
511
  position: relative;
509
512
  margin-top: 1em;
510
513
  font-size: 0.875em;
511
- width: 14em;
514
+ max-width: 14em;
512
515
  line-height: 1.5em;
513
516
  background: var(--shade-200);
514
517
  border-radius: 0.5em;
@@ -541,10 +544,10 @@
541
544
  height: 1.25em;
542
545
  stroke-width: 1.5;
543
546
  }
544
- `;function Yu(e){try{let t=new URL(e);return{hostname:t.hostname,pathname:t.pathname}}catch{return{hostname:"",pathname:""}}}function Kt({destAnchor:e,destStartEdge:t,element:o}){let r=O("dialog"),n=Xu(),i=Yu(o.href),[a,l]=Qu({x:0,y:0}),m=_t((S,M)=>{l(H=>({x:H.x+S,y:H.y+M}))},[]),s=j({destAnchor:e,destStartEdge:t},({destAnchor:S,destStartEdge:M})=>({left:M.left,top:S.top+S.height})),c={...s,left:s.left+a.x,top:s.top+a.y},d=J({title:"\u30EA\u30F3\u30AF\u3092\u524A\u9664"}),p=J({title:"\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6"}),u=J({title:"\u9589\u3058\u308B"}),g=_t(()=>{r.close()},[r]),w=_t(()=>{n.anchor.removeLink({at:o}),r.close()},[n,r]),P=_t(()=>{p.onMouseLeave(),r.open(()=>Z(ca,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]);return ft(ju,{contentEditable:!1,style:c,children:[Z(ve,{onDrag:m}),ft("div",{style:{display:"flex",padding:"1em"},children:[ft("a",{className:"--link",href:o.href,target:"_blank",rel:"noreferrer",children:[Z(pa,{}),ft("div",{className:"--url",children:[Z("div",{className:"--hostname",children:i.hostname}),i.pathname===""||i.pathname==="/"?null:Z("div",{className:"--pathname",children:i.pathname}),o.title==null||o.title===""?null:Z("div",{className:"--tooltip",children:o.title})]})]}),ft("span",{className:"--icons",children:[Z("span",{className:"--icon",onClick:w,onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,children:Z(da,{})}),Z("span",{className:"--icon",onMouseEnter:p.onMouseEnter,onMouseLeave:p.onMouseLeave,onClick:P,children:Z(ua,{})}),Z("span",{className:"--icon",onClick:g,onMouseEnter:u.onMouseEnter,onMouseLeave:u.onMouseLeave,children:Z(fa,{})})]})]})]})}import{jsx as Wt,jsxs as of}from"react/jsx-runtime";function ga({element:e,attributes:t,children:o}){let r=ha(null),n=ha(null),i=ef(),a=tf(),l=O("dialog");return Zu(()=>{let m=n.current,s=r.current;if(!m||!s)return;let c=a.selection&&a.selection.anchor.offset!==a.selection.focus.offset;i&&!c?setTimeout(()=>{l.open(()=>Wt(Kt,{destAnchor:m,destStartEdge:s,element:e}))}):l.close()},[i,e]),of(zi,{className:Ju({"--selected":i}),href:e.href,target:e.target,...t,ref:n,children:[Wt(Oo,{ref:r,contentEditable:!1}),Wt("span",{children:o}),Wt(Oo,{contentEditable:!1})]})}import{jsx as rf}from"react/jsx-runtime";var ba=v((e,t,{createPolicy:o})=>(e.anchor=Pi(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:f(Si,e)},editableProps:{onPaste:f(Ti,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return rf(ga,{element:r,attributes:n,children:i})}}})));import{Editor as Gt,Transforms as ya}from"slate";import{Element as Ea,Path as xa}from"slate";function Xo(e,t,o){if(!t||!o||xa.equals(t[1],o[1]))return!0;let r=E(e,i=>Ea.isElement(i)&&e.isMaster(i),{at:t[1]}),n=E(e,i=>Ea.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&xa.equals(r[1],n[1]))}var ka=v(e=>(e.atomicDelete=!0,{name:"atomic-delete",editor:{deleteBackward(){if(e.selection==null)return!1;let t=Gt.node(e,e.selection),o=Gt.previous(e,{mode:"lowest"});return Xo(e,t,o)?!1:(ya.move(e,{unit:"character",reverse:!0}),!0)},deleteForward(){if(e.selection==null)return!1;let t=Gt.node(e,e.selection),o=Gt.next(e,{mode:"lowest"});return Xo(e,t,o)?!1:(ya.move(e,{unit:"character"}),!0)}}}));import{Transforms as qf}from"slate";import{ReactEditor as Qf}from"slate-react";import{Editor as nf,Transforms as va}from"slate";import{ReactEditor as af}from"slate-react";function lf(e){}function sf(e,t,o,r){let{selection:n}=e;if(va.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=nf.end(e,[]);va.select(e,i),af.focus(e)}}function Ta(e){return{noop:f(lf,e),insertImageFromUrl:f(sf,e)}}function wa(e,t){return!1}import{useSlateStatic as Vf}from"slate-react";import mf from"@emotion/styled";var Ia=mf("div")`
547
+ `;function Ju(e){try{let t=new URL(e);return{hostname:t.hostname,pathname:t.pathname}}catch{return{hostname:"",pathname:""}}}function Kt({destAnchor:e,destStartEdge:t,element:o}){let r=O("dialog"),n=ju(),i=Qu(null),a=Ju(o.href),[l,m]=Xu({x:0,y:0}),s=_t((M,N)=>{m(w=>({x:w.x+M,y:w.y+N}))},[]),c=j({src:i,destAnchor:e,destStartEdge:t},({src:M,destAnchor:N,destStartEdge:w},z)=>ke(M,z,{left:w.left,top:N.top+N.height},{margin:16})),d={...c,left:c.left+l.x,top:c.top+l.y},p=J({title:"\u30EA\u30F3\u30AF\u3092\u524A\u9664"}),u=J({title:"\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6"}),g=J({title:"\u9589\u3058\u308B"}),T=_t(()=>{r.close()},[r]),S=_t(()=>{n.anchor.removeLink({at:o}),r.close()},[n,r]),L=_t(()=>{u.onMouseLeave(),r.open(()=>Z(pa,{destAnchor:e,destStartEdge:t,element:o}))},[e,t,o]);return ht(Yu,{ref:i,contentEditable:!1,style:d,children:[Z(Te,{onDrag:s}),ht("div",{style:{display:"flex",padding:"1em"},children:[ht("a",{className:"--link",href:o.href,target:"_blank",rel:"noreferrer",children:[Z(da,{}),ht("div",{className:"--url",children:[Z("div",{className:"--hostname",children:a.hostname}),a.pathname===""||a.pathname==="/"?null:Z("div",{className:"--pathname",children:a.pathname}),o.title==null||o.title===""?null:Z("div",{className:"--tooltip",children:o.title})]})]}),ht("span",{className:"--icons",children:[Z("span",{className:"--icon",onClick:S,onMouseEnter:p.onMouseEnter,onMouseLeave:p.onMouseLeave,children:Z(ua,{})}),Z("span",{className:"--icon",onMouseEnter:u.onMouseEnter,onMouseLeave:u.onMouseLeave,onClick:L,children:Z(fa,{})}),Z("span",{className:"--icon",onClick:T,onMouseEnter:g.onMouseEnter,onMouseLeave:g.onMouseLeave,children:Z(ha,{})})]})]})]})}import{jsx as Wt,jsxs as rf}from"react/jsx-runtime";function ba({element:e,attributes:t,children:o}){let r=ga(null),n=ga(null),i=tf(),a=of(),l=O("dialog");return ef(()=>{let m=n.current,s=r.current;if(!m||!s)return;let c=a.selection&&a.selection.anchor.offset!==a.selection.focus.offset;i&&!c?setTimeout(()=>{l.open(()=>Wt(Kt,{destAnchor:m,destStartEdge:s,element:e}))}):l.close()},[i,e]),rf(Bi,{className:Zu({"--selected":i}),href:e.href,target:e.target,...t,ref:n,children:[Wt(Oo,{ref:r,contentEditable:!1}),Wt("span",{children:o}),Wt(Oo,{contentEditable:!1})]})}import{jsx as nf}from"react/jsx-runtime";var Ea=v((e,t,{createPolicy:o})=>(e.anchor=Pi(e),o({name:"anchor",editor:{isInline(r){if(r.type==="anchor")return!0},normalizeNode:f(Si,e)},editableProps:{onPaste:f(Ti,e),renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="anchor")return nf(ba,{element:r,attributes:n,children:i})}}})));import{Editor as Gt,Transforms as ka}from"slate";import{Element as xa,Path as ya}from"slate";function Xo(e,t,o){if(!t||!o||ya.equals(t[1],o[1]))return!0;let r=x(e,i=>xa.isElement(i)&&e.isMaster(i),{at:t[1]}),n=x(e,i=>xa.isElement(i)&&e.isMaster(i),{at:o[1]});return!!(!r&&!n||r&&n&&ya.equals(r[1],n[1]))}var va=v(e=>(e.atomicDelete=!0,{name:"atomic-delete",editor:{deleteBackward(){if(e.selection==null)return!1;let t=Gt.node(e,e.selection),o=Gt.previous(e,{mode:"lowest"});return Xo(e,t,o)?!1:(ka.move(e,{unit:"character",reverse:!0}),!0)},deleteForward(){if(e.selection==null)return!1;let t=Gt.node(e,e.selection),o=Gt.next(e,{mode:"lowest"});return Xo(e,t,o)?!1:(ka.move(e,{unit:"character"}),!0)}}}));import{Transforms as Qf}from"slate";import{ReactEditor as Xf}from"slate-react";import{Editor as af,Transforms as Ta}from"slate";import{ReactEditor as lf}from"slate-react";function sf(e){}function mf(e,t,o,r){let{selection:n}=e;if(Ta.insertNodes(e,{type:"image-block",url:t,alt:o||"",title:r||"",width:320,height:240,children:[{text:""}]}),!n){let i=af.end(e,[]);Ta.select(e,i),lf.focus(e)}}function wa(e){return{noop:f(sf,e),insertImageFromUrl:f(mf,e)}}function Ia(e,t){return!1}import{useSlateStatic as Kf}from"slate-react";import cf from"@emotion/styled";var Ma=cf("div")`
545
548
  display: block;
546
549
  margin: 1em 0;
547
- `;import{clsx as Of}from"clsx";import{useState as al}from"react";import{useSelected as Uf}from"slate-react";import Ma from"@emotion/styled";var Pa=Ma("span")`
550
+ `;import{clsx as Uf}from"clsx";import{useState as ll}from"react";import{useSelected as Ff}from"slate-react";import Pa from"@emotion/styled";var Ca=Pa("span")`
548
551
  /**
549
552
  * In order for this container to wrap tightly (without space), it needs to be
550
553
  * an "inline-block". If it's just an "inline" we end up with spacing
@@ -556,7 +559,7 @@
556
559
  * so that we can place UI controls for the image in and around the image.
557
560
  */
558
561
  position: relative;
559
- `,Ca=Ma("img")`
562
+ `,Sa=Pa("img")`
560
563
  /**
561
564
  * TODO:
562
565
  *
@@ -618,7 +621,7 @@
618
621
  .--dragging > & {
619
622
  transition: border-radius 250ms;
620
623
  }
621
- `;import{clsx as ff}from"clsx";import{useCallback as Da,useEffect as hf,useRef as Qt}from"react";import{Transforms as Na}from"slate";import{ReactEditor as Yo,useSlateStatic as gf}from"slate-react";import{useEffect as cf}from"react";function Sa(){let e=$t();return cf(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import Ra from"@emotion/styled";var La=Ra("span")`
624
+ `;import{clsx as hf}from"clsx";import{useCallback as $a,useEffect as gf,useRef as Qt}from"react";import{Transforms as Na}from"slate";import{ReactEditor as Yo,useSlateStatic as bf}from"slate-react";import{useEffect as pf}from"react";function Ra(){let e=Ht();return pf(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import La from"@emotion/styled";var za=La("span")`
622
625
  position: absolute;
623
626
  display: block;
624
627
  /**
@@ -645,7 +648,7 @@
645
648
  /* background: green; */
646
649
  width: 1.25em;
647
650
  }
648
- `,Ba=Ra("span")`
651
+ `,Ba=La("span")`
649
652
  position: absolute;
650
653
  display: block;
651
654
  background: var(--select-color);
@@ -738,7 +741,7 @@
738
741
  .--small > & > .--bar-right {
739
742
  left: calc(50% + 1px);
740
743
  }
741
- `;function jo({value:e,min:t,max:o}){if(!(o>=t))throw new Error("Expected max >= min but is not");return Math.max(t,Math.min(o,e))}import{ReactEditor as pf}from"slate-react";function qt(e,t){e=Math.round(e);let o=t.width/t.height;return{width:e,height:Math.round(e/o)}}function df(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function uf(e,t){let o=e.width/e.height,r=t.width/t.height;if(o>=r){if(e.width>t.width)return qt(t.width,e)}else if(e.height>t.height)return df(t.height,e);return e}function Ce(e,t,o){switch(o.type){case"bounds":return uf(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function za(e){let t=pf.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft,10)+parseInt(o.paddingRight,10);return t.clientWidth-r}import{Fragment as xf,jsx as ht,jsxs as Ef}from"react/jsx-runtime";function bf(e,t){let r=Yo.toDOMNode(e,t).querySelector("img");if(!r)throw new Error("Image Element could not be found but should exist");return r.getBoundingClientRect()}function $a({element:e,srcSize:t,size:o,setSize:r,isDragging:n,setIsDragging:i}){let a=gf(),l=Qt(null),m=Qt(null),s=Qt(null),c=Qt(null);Sa();let d=za(a),p=o.width,u=Math.min(t.width,d),g=Math.min(12,t.width),w=Da(M=>{Ie(M),i(!0);let H=M.clientX,A=bf(a,e).width,k={...o},x=L=>{let C=jo({value:A+L.clientX-H,min:g,max:u});k=qt(C,t),r(k)},T=()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",T),l.current=null,m.current=null;let L=Yo.findPath(a,e),C={width:k.width,height:k.height};r(C),Na.setNodes(a,C,{at:L}),i(!1)};l.current=x,m.current=T,document.addEventListener("mousemove",x),document.addEventListener("mouseup",T)},[t.width,t.height,o.width,e]),P=Da(M=>{Ie(M),i(!0);let H=M.changedTouches[0].clientX,I=o.width,A={...o},k=T=>{let L=T.changedTouches[0],C=jo({value:I+L.clientX-H,min:g,max:u});A=qt(C,t),r(A)},x=()=>{document.removeEventListener("touchmove",k),document.removeEventListener("touchend",x),s.current=null,c.current=null;let T=Yo.findPath(a,e);Na.setNodes(a,{width:A.width,height:A.height},{at:T}),i(!1)};s.current=k,c.current=x,document.addEventListener("touchmove",k),document.addEventListener("touchend",x)},[t.width,t.height,o.width,e]);hf(()=>()=>{l.current&&document.removeEventListener("mousemove",l.current),m.current&&document.removeEventListener("mouseup",m.current),s.current&&document.removeEventListener("touchmove",s.current),c.current&&document.removeEventListener("touchend",c.current)},[]);let S=ff({"--center":p<u&&p>g,"--left":p>=u&&p>g,"--right":p<=g&&p<u,"--dragging":n,"--small":p<=64||o.height<=64});return ht(xf,{children:ht(La,{className:S,onMouseDown:w,onTouchStart:P,children:Ef(Ba,{children:[ht("span",{className:"--bar --bar-left"}),ht("span",{className:"--bar --bar-center"}),ht("span",{className:"--bar --bar-right"})]})})})}import yf from"@emotion/styled";var Ha=yf("span")`
744
+ `;function jo({value:e,min:t,max:o}){if(!(o>=t))throw new Error("Expected max >= min but is not");return Math.max(t,Math.min(o,e))}import{ReactEditor as df}from"slate-react";function qt(e,t){e=Math.round(e);let o=t.width/t.height;return{width:e,height:Math.round(e/o)}}function uf(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function ff(e,t){let o=e.width/e.height,r=t.width/t.height;if(o>=r){if(e.width>t.width)return qt(t.width,e)}else if(e.height>t.height)return uf(t.height,e);return e}function Se(e,t,o){switch(o.type){case"bounds":return ff(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function Da(e){let t=df.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft,10)+parseInt(o.paddingRight,10);return t.clientWidth-r}import{Fragment as yf,jsx as gt,jsxs as xf}from"react/jsx-runtime";function Ef(e,t){let r=Yo.toDOMNode(e,t).querySelector("img");if(!r)throw new Error("Image Element could not be found but should exist");return r.getBoundingClientRect()}function Ha({element:e,srcSize:t,size:o,setSize:r,isDragging:n,setIsDragging:i}){let a=bf(),l=Qt(null),m=Qt(null),s=Qt(null),c=Qt(null);Ra();let d=Da(a),p=o.width,u=Math.min(t.width,d),g=Math.min(12,t.width),T=$a(M=>{Me(M),i(!0);let N=M.clientX,z=Ef(a,e).width,I={...o},E=P=>{let C=jo({value:z+P.clientX-N,min:g,max:u});I=qt(C,t),r(I)},k=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",k),l.current=null,m.current=null;let P=Yo.findPath(a,e),C={width:I.width,height:I.height};r(C),Na.setNodes(a,C,{at:P}),i(!1)};l.current=E,m.current=k,document.addEventListener("mousemove",E),document.addEventListener("mouseup",k)},[t.width,t.height,o.width,e]),S=$a(M=>{Me(M),i(!0);let N=M.changedTouches[0].clientX,w=o.width,z={...o},I=k=>{let P=k.changedTouches[0],C=jo({value:w+P.clientX-N,min:g,max:u});z=qt(C,t),r(z)},E=()=>{document.removeEventListener("touchmove",I),document.removeEventListener("touchend",E),s.current=null,c.current=null;let k=Yo.findPath(a,e);Na.setNodes(a,{width:z.width,height:z.height},{at:k}),i(!1)};s.current=I,c.current=E,document.addEventListener("touchmove",I),document.addEventListener("touchend",E)},[t.width,t.height,o.width,e]);gf(()=>()=>{l.current&&document.removeEventListener("mousemove",l.current),m.current&&document.removeEventListener("mouseup",m.current),s.current&&document.removeEventListener("touchmove",s.current),c.current&&document.removeEventListener("touchend",c.current)},[]);let L=hf({"--center":p<u&&p>g,"--left":p>=u&&p>g,"--right":p<=g&&p<u,"--dragging":n,"--small":p<=64||o.height<=64});return gt(yf,{children:gt(za,{className:L,onMouseDown:T,onTouchStart:S,children:xf(Ba,{children:[gt("span",{className:"--bar --bar-left"}),gt("span",{className:"--bar --bar-center"}),gt("span",{className:"--bar --bar-right"})]})})})}import kf from"@emotion/styled";var Aa=kf("span")`
742
745
  position: absolute;
743
746
  /**
744
747
  * The status appears with a 1px gap from the outline.
@@ -760,7 +763,7 @@
760
763
 
761
764
  /* force numbers to be monospaced for better alignment */
762
765
  font-variant-numeric: tabular-nums;
763
- `;import{jsxs as kf}from"react/jsx-runtime";function Aa({size:e}){return kf(Ha,{children:[e.width," \xD7 ",e.height]})}import vf from"@emotion/styled";var Oa=vf("span")`
766
+ `;import{jsxs as vf}from"react/jsx-runtime";function Oa({size:e}){return vf(Aa,{children:[e.width," \xD7 ",e.height]})}import Tf from"@emotion/styled";var Ua=Tf("span")`
764
767
  position: absolute;
765
768
  /**
766
769
  * On top of the image +1 for space inside outline, +2 for outline,
@@ -791,7 +794,7 @@
791
794
  }
792
795
  display: flex;
793
796
  gap: 0.25em;
794
- `;import Ua from"@emotion/styled";var Xt=Ua("span")`
797
+ `;import Fa from"@emotion/styled";var Xt=Fa("span")`
795
798
  /* font-size: 0.75em; */
796
799
  border-radius: 0.5em;
797
800
  display: flex;
@@ -804,7 +807,7 @@
804
807
  * see the border of the buttons.
805
808
  */
806
809
  outline: 1px solid white;
807
- `,Ve=Ua("span")`
810
+ `,Ke=Fa("span")`
808
811
  font-size: 0.75em;
809
812
  line-height: 2em;
810
813
  padding: 0 0.625em;
@@ -858,17 +861,17 @@
858
861
  font-size: 1.33em;
859
862
  line-height: 1em;
860
863
  }
861
- `;import{clsx as Tf}from"clsx";import{useCallback as wf}from"react";import{Transforms as If}from"slate";import{ReactEditor as Mf,useSlateStatic as Pf}from"slate-react";import{jsx as Cf}from"react/jsx-runtime";function Fa({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=Pf(),a=Ce(o,n,t),l=J({title:t.title,hotkey:`${a.width}x${a.height}`}),m=wf(()=>{let u=Mf.findPath(i,e),g=Ce(o,n,t);r(g),If.setNodes(i,g,{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=Tf({"--disabled":c,"--selected":!c&&d});return Cf(Ve,{className:p,onClick:c?void 0:m,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Va}from"react/jsx-runtime";function Ka({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Va(Xt,{children:n.map((i,a)=>Va(Fa,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as Lf}from"react";import{useSlateStatic as Bf}from"slate-react";import{jsx as jt,jsxs as Ga}from"react/jsx-runtime";var _a=e=>Ga(y,{...e,children:[jt("rect",{width:6,height:6,x:4,y:5,rx:1}),jt("path",{d:"M4 15h16M4 19h16"})]}),Wa=e=>Ga(y,{...e,children:[jt("rect",{width:6,height:6,x:9,y:5,rx:1}),jt("path",{d:"M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16"})]});import{Editor as Sf,Transforms as qa}from"slate";import{ReactEditor as Rf}from"slate-react";function Qa(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=Rf.findPath(e,t);Sf.withoutNormalizing(e,()=>{let i=Ce(o,r,{name:"initial-inline-image",title:"",type:"bounds",width:24,height:24});qa.setNodes(e,{type:"image-inline",...i},{at:n}),qa.wrapNodes(e,{type:"paragraph",children:[]},{at:n})})}import{jsx as Xa}from"react/jsx-runtime";function ja({element:e}){let t=Bf(),o=J({title:"Inline Image",hotkey:"In a line with text"}),r=Lf(()=>{e.type==="image-block"&&Qa(t,e)},[t,e]);return Xa(Ve,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:Xa(Wa,{})})}import{useCallback as Nf}from"react";import{useSlateStatic as $f}from"slate-react";import{Editor as Ya,Element as zf,Text as Ja,Transforms as Yt}from"slate";import{ReactEditor as Df}from"slate-react";function Za(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=Df.findPath(e,t);Ya.withoutNormalizing(e,()=>{let i=Ce(o,r,{name:"initial-block-image",title:"",type:"bounds",width:320,height:320});Yt.setNodes(e,{type:"image-block",...i},{at:n});let a=E(e,w=>zf.isElement(w)&&Ya.isBlock(e,w)&&w.type!=="image-block");if(!a)throw new Error("This shouldn't happen");let[l,m]=a,s=l.children,c=l.children.length,d=n.slice(-1)[0],p=s[c-1];d===c-2&&Ja.isText(p)&&p.text===""&&Yt.removeNodes(e,{at:[...m,c-1]});let u=s[0],g=d===1&&Ja.isText(u)&&u.text==="";g&&Yt.removeNodes(e,{at:[...m,0]}),Yt.liftNodes(e,{at:[...m,g?d-1:d]})})}import{jsx as el}from"react/jsx-runtime";function tl({element:e}){let t=$f(),o=J({title:"Block Image",hotkey:"On a line by itself"}),r=Nf(()=>{e.type==="image-inline"&&Za(t,e)},[t,e]);return el(Ve,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:el(_a,{})})}import{jsx as ol,jsxs as Hf}from"react/jsx-runtime";function rl({element:e}){return Hf(Xt,{children:[ol(tl,{element:e}),ol(ja,{element:e})]})}import{jsx as nl,jsxs as Af}from"react/jsx-runtime";function il({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Af(Oa,{children:[nl(rl,{element:e}),nl(Ka,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as Jt,jsxs as Ff}from"react/jsx-runtime";function Zt({element:e,presets:t}){let o=e.url,r=Uf(),[n,i]=al(!1),[a,l]=al(e.srcWidth&&e.srcHeight&&e.width&&e.height?{width:e.width,height:e.height}:null),m=e.srcWidth&&e.srcHeight?{width:e.srcWidth,height:e.srcHeight}:null,s=r&&a&&m,c=Of({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Ff(Pa,{className:c,children:[Jt(Ca,{src:o,width:a?.width,height:a?.height}),s?Jt(il,{element:e,size:a,setSize:l,srcSize:m,presets:t}):null,n&&a?Jt(Aa,{size:a}):null,s?Jt($a,{element:e,srcSize:m,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import{jsx as ll,jsxs as Kf}from"react/jsx-runtime";function sl({element:e,attributes:t,children:o}){let r=Vf();return Kf("div",{...t,children:[ll(Ia,{contentEditable:!1,children:ll(Zt,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as Wf}from"slate-react";import _f from"@emotion/styled";var ml=_f("span")`
864
+ `;import{clsx as wf}from"clsx";import{useCallback as If}from"react";import{Transforms as Mf}from"slate";import{ReactEditor as Pf,useSlateStatic as Cf}from"slate-react";import{jsx as Sf}from"react/jsx-runtime";function Va({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=Cf(),a=Se(o,n,t),l=J({title:t.title,hotkey:`${a.width}x${a.height}`}),m=If(()=>{let u=Pf.findPath(i,e),g=Se(o,n,t);r(g),Mf.setNodes(i,g,{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=wf({"--disabled":c,"--selected":!c&&d});return Sf(Ke,{className:p,onClick:c?void 0:m,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,children:t.name})}import{jsx as Ka}from"react/jsx-runtime";function _a({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Ka(Xt,{children:n.map((i,a)=>Ka(Va,{element:e,preset:i,size:t,setSize:o,srcSize:r},a))})}import{useCallback as zf}from"react";import{useSlateStatic as Bf}from"slate-react";import{jsx as jt,jsxs as qa}from"react/jsx-runtime";var Wa=e=>qa(y,{...e,children:[jt("rect",{width:6,height:6,x:4,y:5,rx:1}),jt("path",{d:"M4 15h16M4 19h16"})]}),Ga=e=>qa(y,{...e,children:[jt("rect",{width:6,height:6,x:9,y:5,rx:1}),jt("path",{d:"M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16"})]});import{Editor as Rf,Transforms as Qa}from"slate";import{ReactEditor as Lf}from"slate-react";function Xa(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=Lf.findPath(e,t);Rf.withoutNormalizing(e,()=>{let i=Se(o,r,{name:"initial-inline-image",title:"",type:"bounds",width:24,height:24});Qa.setNodes(e,{type:"image-inline",...i},{at:n}),Qa.wrapNodes(e,{type:"paragraph",children:[]},{at:n})})}import{jsx as ja}from"react/jsx-runtime";function Ya({element:e}){let t=Bf(),o=J({title:"Inline Image",hotkey:"In a line with text"}),r=zf(()=>{e.type==="image-block"&&Xa(t,e)},[t,e]);return ja(Ke,{className:e.type==="image-inline"?"--selected":"",onClick:e.type==="image-inline"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:ja(Ga,{})})}import{useCallback as Nf}from"react";import{useSlateStatic as Hf}from"slate-react";import{Editor as Ja,Element as Df,Text as Za,Transforms as Yt}from"slate";import{ReactEditor as $f}from"slate-react";function el(e,t){if(!t.width||!t.height||!t.srcWidth||!t.srcHeight)return;let o={width:t.width,height:t.height},r={width:t.srcWidth,height:t.srcHeight},n=$f.findPath(e,t);Ja.withoutNormalizing(e,()=>{let i=Se(o,r,{name:"initial-block-image",title:"",type:"bounds",width:320,height:320});Yt.setNodes(e,{type:"image-block",...i},{at:n});let a=x(e,T=>Df.isElement(T)&&Ja.isBlock(e,T)&&T.type!=="image-block");if(!a)throw new Error("This shouldn't happen");let[l,m]=a,s=l.children,c=l.children.length,d=n.slice(-1)[0],p=s[c-1];d===c-2&&Za.isText(p)&&p.text===""&&Yt.removeNodes(e,{at:[...m,c-1]});let u=s[0],g=d===1&&Za.isText(u)&&u.text==="";g&&Yt.removeNodes(e,{at:[...m,0]}),Yt.liftNodes(e,{at:[...m,g?d-1:d]})})}import{jsx as tl}from"react/jsx-runtime";function ol({element:e}){let t=Hf(),o=J({title:"Block Image",hotkey:"On a line by itself"}),r=Nf(()=>{e.type==="image-inline"&&el(t,e)},[t,e]);return tl(Ke,{className:e.type==="image-block"?"--selected":"",onClick:e.type==="image-block"?void 0:r,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,children:tl(Wa,{})})}import{jsx as rl,jsxs as Af}from"react/jsx-runtime";function nl({element:e}){return Af(Xt,{children:[rl(ol,{element:e}),rl(Ya,{element:e})]})}import{jsx as il,jsxs as Of}from"react/jsx-runtime";function al({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Of(Ua,{children:[il(nl,{element:e}),il(_a,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as Jt,jsxs as Vf}from"react/jsx-runtime";function Zt({element:e,presets:t}){let o=e.url,r=Ff(),[n,i]=ll(!1),[a,l]=ll(e.srcWidth&&e.srcHeight&&e.width&&e.height?{width:e.width,height:e.height}:null),m=e.srcWidth&&e.srcHeight?{width:e.srcWidth,height:e.srcHeight}:null,s=r&&a&&m,c=Uf({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Vf(Ca,{className:c,children:[Jt(Sa,{src:o,width:a?.width,height:a?.height}),s?Jt(al,{element:e,size:a,setSize:l,srcSize:m,presets:t}):null,n&&a?Jt(Oa,{size:a}):null,s?Jt(Ha,{element:e,srcSize:m,isDragging:n,setIsDragging:i,size:a,setSize:l}):null]})}import{jsx as sl,jsxs as _f}from"react/jsx-runtime";function ml({element:e,attributes:t,children:o}){let r=Kf();return _f("div",{...t,children:[sl(Ma,{contentEditable:!1,children:sl(Zt,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as Gf}from"slate-react";import Wf from"@emotion/styled";var cl=Wf("span")`
862
865
  display: inline;
863
- `;import{jsx as cl,jsxs as Gf}from"react/jsx-runtime";function pl({element:e,attributes:t,children:o}){let r=Wf();return Gf("span",{...t,style:{display:"inline-block"},children:[cl(ml,{contentEditable:!1,children:cl(Zt,{element:e,presets:r.image.imageInlinePresets})}),o]})}import{jsx as dl}from"react/jsx-runtime";function ul({element:e,attributes:t,children:o}){switch(e.type){case"image-block":return dl(sl,{element:e,attributes:t,children:o});case"image-inline":return dl(pl,{element:e,attributes:t,children:o})}}function Xf(e){return t=>{let{dataTransfer:o}=t;if(!o.files||o.files.length===0)return!1;let r=Array.from(o.files).filter(a=>a.type.startsWith("image/"));if(r.length===0)return!1;t.preventDefault(),t.stopPropagation();let n=Qf.findEventRange(e,t);n&&qf.select(e,n);let i=e.wysimark?.onImageChange;for(let a of r)if(i)i(a).then(l=>{l&&e.image.insertImageFromUrl(l,a.name,"")}).catch(()=>{});else{let l=new FileReader;l.onload=()=>{let m=l.result;e.image.insertImageFromUrl(m,a.name,"")},l.readAsDataURL(a)}return!0}}var jf={maxInitialInlineImageSize:{width:64,height:64},maxInitialImageSize:{width:320,height:320},maxImageSize:{width:1024,height:1024},imageBlockPresets:[{name:"S",title:"Small",type:"bounds",width:160,height:160},{name:"M",title:"Medium",type:"bounds",width:320,height:320},{name:"L",title:"Large",type:"bounds",width:640,height:640},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}],imageInlinePresets:[{name:"16",title:"16 pixels",type:"bounds",width:16,height:16},{name:"24",title:"24 pixels",type:"bounds",width:24,height:24},{name:"32",title:"32 pixels",type:"bounds",width:32,height:32},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}]},fl=v((e,t,{createPolicy:o})=>{let r={...jf,...t.image};return e.image={...Ta(e),maxInitialInlineImageSize:r.maxInitialInlineImageSize,maxInitialImageSize:r.maxInitialImageSize,maxImageSize:r.maxImageSize,imageBlockPresets:r.imageBlockPresets,imageInlinePresets:r.imageInlinePresets},o({name:"image",editor:{isVoid:n=>{if(["image-block","image-inline"].includes(n.type))return!0},isInline:n=>{if(n.type==="image-inline")return!0},normalizeNode:f(wa,e)},editableProps:{renderElement:ul,onDrop:Xf(e)}})});import{Editor as gt,Element as X,Transforms as Ke}from"slate";import Yf from"@emotion/styled";var hl=Yf("blockquote")`
866
+ `;import{jsx as pl,jsxs as qf}from"react/jsx-runtime";function dl({element:e,attributes:t,children:o}){let r=Gf();return qf("span",{...t,style:{display:"inline-block"},children:[pl(cl,{contentEditable:!1,children:pl(Zt,{element:e,presets:r.image.imageInlinePresets})}),o]})}import{jsx as ul}from"react/jsx-runtime";function fl({element:e,attributes:t,children:o}){switch(e.type){case"image-block":return ul(ml,{element:e,attributes:t,children:o});case"image-inline":return ul(dl,{element:e,attributes:t,children:o})}}function jf(e){return t=>{let{dataTransfer:o}=t;if(!o.files||o.files.length===0)return!1;let r=Array.from(o.files).filter(a=>a.type.startsWith("image/"));if(r.length===0)return!1;t.preventDefault(),t.stopPropagation();let n=Xf.findEventRange(e,t);n&&Qf.select(e,n);let i=e.wysimark?.onImageChange;for(let a of r)if(i)i(a).then(l=>{l&&e.image.insertImageFromUrl(l,a.name,"")}).catch(()=>{});else{let l=new FileReader;l.onload=()=>{let m=l.result;e.image.insertImageFromUrl(m,a.name,"")},l.readAsDataURL(a)}return!0}}var Yf={maxInitialInlineImageSize:{width:64,height:64},maxInitialImageSize:{width:320,height:320},maxImageSize:{width:1024,height:1024},imageBlockPresets:[{name:"S",title:"Small",type:"bounds",width:160,height:160},{name:"M",title:"Medium",type:"bounds",width:320,height:320},{name:"L",title:"Large",type:"bounds",width:640,height:640},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}],imageInlinePresets:[{name:"16",title:"16 pixels",type:"bounds",width:16,height:16},{name:"24",title:"24 pixels",type:"bounds",width:24,height:24},{name:"32",title:"32 pixels",type:"bounds",width:32,height:32},{name:"\u2153",title:"1/3 scale",type:"scale",scale:1/3},{name:"\xBD",title:"1/2 scale",type:"scale",scale:.5},{name:"Full",title:"Full size",type:"scale",scale:1}]},hl=v((e,t,{createPolicy:o})=>{let r={...Yf,...t.image};return e.image={...wa(e),maxInitialInlineImageSize:r.maxInitialInlineImageSize,maxInitialImageSize:r.maxInitialImageSize,maxImageSize:r.maxImageSize,imageBlockPresets:r.imageBlockPresets,imageInlinePresets:r.imageInlinePresets},o({name:"image",editor:{isVoid:n=>{if(["image-block","image-inline"].includes(n.type))return!0},isInline:n=>{if(n.type==="image-inline")return!0},normalizeNode:f(Ia,e)},editableProps:{renderElement:fl,onDrop:jf(e)}})});import{Editor as bt,Element as X,Transforms as _e}from"slate";import Jf from"@emotion/styled";var gl=Jf("blockquote")`
864
867
  position: relative;
865
868
  margin-top: 1em;
866
869
  margin-bottom: 1em;
867
870
  margin-left: 0;
868
871
  border-left: 0.25em solid rgba(0, 0, 0, 0.075);
869
872
  padding-left: 1.5em;
870
- `;import{jsx as Zf}from"react/jsx-runtime";function gl(e){return X.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 Jf=2,bl=v(e=>(e.supportsBlockQuote=!0,e.blockQuotePlugin={indent:()=>{Ke.wrapNodes(e,{type:"block-quote",children:[]},{match:gl})},outdent:()=>{Ke.liftNodes(e,{match:(t,o)=>gl(t)&&o.length>1})},isActive:()=>{let[t]=gt.nodes(e,{match:o=>X.isElement(o)&&o.type==="block-quote"});return!!t},increaseDepth:()=>{let[t]=gt.nodes(e,{match:r=>X.isElement(r)&&r.type==="block-quote"});if(!t||!e.blockQuotePlugin.canIncreaseDepth())return;let[,o]=t;Ke.select(e,o),Ke.wrapNodes(e,{type:"block-quote",children:[]},{at:o,split:!1})},decreaseDepth:()=>{let[t]=gt.nodes(e,{match:i=>X.isElement(i)&&i.type==="block-quote"});if(!t||!e.blockQuotePlugin.canDecreaseDepth())return;let[o,r]=t,n=o.children;n.length===1&&X.isElement(n[0])&&n[0].type==="block-quote"&&Ke.unwrapNodes(e,{at:[...r,0],match:i=>X.isElement(i)&&i.type==="block-quote"})},canIncreaseDepth:()=>{let[t]=gt.nodes(e,{match:i=>X.isElement(i)&&i.type==="block-quote"});if(!t)return!1;let[o]=t,r=0,n=o;for(;n.children.length===1&&X.isElement(n.children[0])&&n.children[0]&&n.children[0]&&n.children[0].type==="block-quote";)r++,n=n.children[0];return r<Jf},canDecreaseDepth:()=>{let[t]=gt.nodes(e,{match:r=>X.isElement(r)&&r.type==="block-quote"});if(!t)return!1;let[o]=t;return o.children.length===1&&X.isElement(o.children[0])&&o.children[0]&&o.children[0].type==="block-quote"}},{name:"block-quote",editor:{normalizeNode(t){let[o,r]=t;return!X.isElement(o)||o.type!=="block-quote"?!1:xe(e,[o,r],(n,i)=>(X.isElement(n[0])&&X.isElement(i[0])&&n[0].type==="block-quote"&&i[0].type==="block-quote"&&Ke.mergeNodes(e,{at:i[1]}),!0))}},editableProps:{renderElement:({element:t,attributes:o,children:r})=>{if(t.type==="block-quote")return Zf(hl,{...o,children:r})},onKeyDown:N({"super+.":e.blockQuotePlugin.indent,"super+,":e.blockQuotePlugin.outdent})}}));import{Editor as hh,Element as gh,Transforms as Ul}from"slate";import eh from"prismjs";import{Element as rh,Node as nh}from"slate";var{languages:th,tokenize:oh}=eh;function ih(e){let t=0,o=[];for(let r of e)o.push(t),t=t+r.length;return o}function El(e){let[t,o]=e;if(!rh.isElement(t))return[];if(t.type!=="code-block")return[];let r=th[t.language];if(r===void 0)return[];let i=t.children.map(p=>`${nh.string(p)}
871
- `),a=i.join(""),l=ih(i);function m(p){for(let u=l.length;u>=0;u--){let g=l[u];if(g<=p)return{path:[...o,u],offset:p-g}}throw new Error("This shouldn't happen and indicates a bug in the logic")}let s=[],c=oh(a,r),d=0;for(let p of c)if(typeof p=="string")d+=p.length;else{let u=m(d),g=m(d+p.length);s.push({anchor:u,focus:g,prismToken:p.type}),d+=p.length}return s}function xl(e,{language:t}){yi(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as ah,Transforms as lh}from"slate";function yl(e,t,o={}){let r=E(e,n=>ah.isElement(n)&&n.type==="code-block",{at:o.at});return r?(lh.setNodes(e,{language:t},{at:r[1]}),!0):!1}function kl(e){return{createCodeBlock:f(xl,e),setCodeBlockLanguage:f(yl,e)}}var eo={color:"#999988",fontStyle:"italic"},sh={opacity:"0.7"},vl={color:"#e3116c"},Tl={color:"#393a34"},le={color:"#36acaa"},Jo={color:"#00a4db"},wl={color:"#9a050f"},Il={color:"#00009f"},Zo={fontWeight:"bold"},mh={fontStyle:"italic"},Ml={comment:eo,prolog:eo,doctype:eo,cdata:eo,namespace:sh,string:vl,"attr-value":vl,puncutation:Tl,operator:Tl,entity:le,url:le,symbol:le,number:le,boolean:le,variable:le,constant:le,property:le,regex:le,insert:le,atrule:Jo,keyword:Jo,"attr-name":Jo,function:{...wl,...Zo},delete:wl,tag:Il,selector:Il,important:Zo,bold:Zo,italic:mh};var Pl=["text","html","css","svg","javascript","java","c"];import{Element as er,Node as tr,Transforms as _e}from"slate";function Cl(e,t){if(!er.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of tr.children(e,t[1]))if(er.isElement(o))return e.isVoid(o)?(_e.removeNodes(e,{at:r}),!0):(_e.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of tr.children(e,t[1]))if(er.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(_e.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(_e.removeNodes(e,{at:r}),!0):(_e.removeNodes(e,{at:r}),_e.insertNodes(e,{type:"code-block-line",children:[{text:tr.string(o)}]}),!0)}return!1}import{useCallback as ch,useRef as ph}from"react";import{useSelected as dh}from"slate-react";import{jsx as Sl}from"react/jsx-runtime";var Rl=e=>Sl(y,{...e,children:Sl("path",{d:"m6 9 6 6 6-6"})});import to from"@emotion/styled";var Ll=to("div")`
873
+ `;import{jsx as eh}from"react/jsx-runtime";function bl(e){return X.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 Zf=2,El=v(e=>(e.supportsBlockQuote=!0,e.blockQuotePlugin={indent:()=>{_e.wrapNodes(e,{type:"block-quote",children:[]},{match:bl})},outdent:()=>{_e.liftNodes(e,{match:(t,o)=>bl(t)&&o.length>1})},isActive:()=>{let[t]=bt.nodes(e,{match:o=>X.isElement(o)&&o.type==="block-quote"});return!!t},increaseDepth:()=>{let[t]=bt.nodes(e,{match:r=>X.isElement(r)&&r.type==="block-quote"});if(!t||!e.blockQuotePlugin.canIncreaseDepth())return;let[,o]=t;_e.select(e,o),_e.wrapNodes(e,{type:"block-quote",children:[]},{at:o,split:!1})},decreaseDepth:()=>{let[t]=bt.nodes(e,{match:i=>X.isElement(i)&&i.type==="block-quote"});if(!t||!e.blockQuotePlugin.canDecreaseDepth())return;let[o,r]=t,n=o.children;n.length===1&&X.isElement(n[0])&&n[0].type==="block-quote"&&_e.unwrapNodes(e,{at:[...r,0],match:i=>X.isElement(i)&&i.type==="block-quote"})},canIncreaseDepth:()=>{let[t]=bt.nodes(e,{match:i=>X.isElement(i)&&i.type==="block-quote"});if(!t)return!1;let[o]=t,r=0,n=o;for(;n.children.length===1&&X.isElement(n.children[0])&&n.children[0].type==="block-quote";)r++,n=n.children[0];return r<Zf},canDecreaseDepth:()=>{let[t]=bt.nodes(e,{match:r=>X.isElement(r)&&r.type==="block-quote"});if(!t)return!1;let[o]=t;return o.children.length===1&&X.isElement(o.children[0])&&o.children[0]&&o.children[0].type==="block-quote"}},{name:"block-quote",editor:{normalizeNode(t){let[o,r]=t;return!X.isElement(o)||o.type!=="block-quote"?!1:xe(e,[o,r],(n,i)=>(X.isElement(n[0])&&X.isElement(i[0])&&n[0].type==="block-quote"&&i[0].type==="block-quote"&&_e.mergeNodes(e,{at:i[1]}),!0))}},editableProps:{renderElement:({element:t,attributes:o,children:r})=>{if(t.type==="block-quote")return eh(gl,{...o,children:r})},onKeyDown:H({"super+.":e.blockQuotePlugin.indent,"super+,":e.blockQuotePlugin.outdent})}}));import{Editor as gh,Element as bh,Transforms as Fl}from"slate";import th from"prismjs";import{Element as nh,Node as ih}from"slate";var{languages:oh,tokenize:rh}=th;function ah(e){let t=0,o=[];for(let r of e)o.push(t),t=t+r.length;return o}function xl(e){let[t,o]=e;if(!nh.isElement(t))return[];if(t.type!=="code-block")return[];let r=oh[t.language];if(r===void 0)return[];let i=t.children.map(p=>`${ih.string(p)}
874
+ `),a=i.join(""),l=ah(i);function m(p){for(let u=l.length-1;u>=0;u--){let g=l[u];if(g<=p)return{path:[...o,u],offset:p-g}}throw new Error("This shouldn't happen and indicates a bug in the logic")}let s=[],c=rh(a,r),d=0;for(let p of c)if(typeof p=="string")d+=p.length;else{let u=m(d),g=m(d+p.length);s.push({anchor:u,focus:g,prismToken:p.type}),d+=p.length}return s}function yl(e,{language:t}){yi(e,{type:"code-block",language:t,children:[{type:"code-block-line",children:[{text:""}]}]})}import{Element as lh,Transforms as sh}from"slate";function kl(e,t,o={}){let r=x(e,n=>lh.isElement(n)&&n.type==="code-block",{at:o.at});return r?(sh.setNodes(e,{language:t},{at:r[1]}),!0):!1}function vl(e){return{createCodeBlock:f(yl,e),setCodeBlockLanguage:f(kl,e)}}var eo={color:"#999988",fontStyle:"italic"},mh={opacity:"0.7"},Tl={color:"#e3116c"},wl={color:"#393a34"},le={color:"#36acaa"},Jo={color:"#00a4db"},Il={color:"#9a050f"},Ml={color:"#00009f"},Zo={fontWeight:"bold"},ch={fontStyle:"italic"},Pl={comment:eo,prolog:eo,doctype:eo,cdata:eo,namespace:mh,string:Tl,"attr-value":Tl,puncutation:wl,operator:wl,entity:le,url:le,symbol:le,number:le,boolean:le,variable:le,constant:le,property:le,regex:le,insert:le,atrule:Jo,keyword:Jo,"attr-name":Jo,function:{...Il,...Zo},delete:Il,tag:Ml,selector:Ml,important:Zo,bold:Zo,italic:ch};var Cl=["text","html","css","svg","javascript","java","c"];import{Element as er,Node as tr,Transforms as We}from"slate";function Sl(e,t){if(!er.isElement(t[0]))return!1;if(t[0].type==="code-block-line"){for(let[o,r]of tr.children(e,t[1]))if(er.isElement(o))return e.isVoid(o)?(We.removeNodes(e,{at:r}),!0):(We.unwrapNodes(e,{at:r}),!0)}if(t[0].type==="code-block"){for(let[o,r]of tr.children(e,t[1]))if(er.isElement(o)&&o.type!=="code-block-line")return o.type==="code-block"?(We.unwrapNodes(e,{at:r}),!0):e.isVoid(o)?(We.removeNodes(e,{at:r}),!0):(We.removeNodes(e,{at:r}),We.insertNodes(e,{type:"code-block-line",children:[{text:tr.string(o)}]}),!0)}return!1}import{useCallback as ph,useRef as dh}from"react";import{useSelected as uh}from"slate-react";import{jsx as Rl}from"react/jsx-runtime";var Ll=e=>Rl(y,{...e,children:Rl("path",{d:"m6 9 6 6 6-6"})});import to from"@emotion/styled";var zl=to("div")`
872
875
  position: relative;
873
876
  background: var(--code-block-bgcolor);
874
877
  margin: 1em 0;
@@ -891,7 +894,7 @@
891
894
  padding: 2.25em 1em 1.5em 1em;
892
895
  border-radius: 0.5em;
893
896
  overflow-x: auto;
894
- `,zl=to("span")`
897
+ `,Dl=to("span")`
895
898
  cursor: pointer;
896
899
  position: absolute;
897
900
  top: 0.25em;
@@ -917,7 +920,7 @@
917
920
  color: var(--shade-800);
918
921
  background: var(--shade-300);
919
922
  }
920
- `,Dl=to("div")`
923
+ `,$l=to("div")`
921
924
  white-space: pre;
922
925
  line-height: 1.5em;
923
926
  counter-increment: line;
@@ -940,7 +943,7 @@
940
943
  display: inline-block;
941
944
  width: 2em;
942
945
  } */
943
- `;import{jsx as bt,jsxs as Nl}from"react/jsx-runtime";function $l({element:e,attributes:t,children:o}){let r=ph(null),n=dh(),i=O("code-block-dropdown"),a=ch(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let m=Pl.map(s=>({icon:()=>bt("span",{}),title:s,action:c=>{c.codeBlock.setCodeBlockLanguage(s,{at:e})}}));i.open(()=>bt(Oe,{dest:l,items:m,close:i.close}))},[e]);return Nl(Ll,{className:n?"--selected":"",...t,children:[Nl(zl,{contentEditable:!1,onClick:a,ref:r,children:[bt("span",{children:e.language}),bt(Rl,{})]}),bt(Bl,{children:o})]})}import{useSelected as uh}from"slate-react";import{jsx as fh}from"react/jsx-runtime";function Hl({attributes:e,children:t}){let o=uh();return fh(Dl,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as Al}from"react/jsx-runtime";function Ol({element:e,attributes:t,children:o}){if(e.type==="code-block")return Al($l,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return Al(Hl,{element:e,attributes:t,children:o})}import{Fragment as bh,jsx as Fl}from"react/jsx-runtime";var Vl=v((e,t,{createPolicy:o})=>{e.codeBlock=kl(e);function r(){let{selection:n}=e;if(!ce(n))return!1;let i=E(e,"code-block");return i==null?!1:hh.string(e,i[1])===""?(Ul.removeNodes(e,{at:i[1]}),!0):!1}return o({name:"code-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isVoid(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isMaster(n){if(n.type==="code-block")return!0},normalizeNode:f(Cl,e)},editableProps:{decorate:El,onKeyDown:N({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=E(e,i=>gh.isElement(i)&&i.type==="code-block");return n?(Ul.select(e,n[1]),!0):!1}}),renderElement:Ol,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&Ml[n.prismToken]||null;return a===null?Fl(bh,{children:i}):Fl("span",{style:a,children:i})}}})});import{Transforms as xh}from"slate";import Kl from"@emotion/styled";var _l=Kl("div")`
946
+ `;import{jsx as Et,jsxs as Nl}from"react/jsx-runtime";function Hl({element:e,attributes:t,children:o}){let r=dh(null),n=uh(),i=O("code-block-dropdown"),a=ph(()=>{i.layer&&i.close();let l=r.current;if(l===null)return;let m=Cl.map(s=>({icon:()=>Et("span",{}),title:s,action:c=>{c.codeBlock.setCodeBlockLanguage(s,{at:e})}}));i.open(()=>Et(Ue,{dest:l,items:m,close:i.close}))},[e]);return Nl(zl,{className:n?"--selected":"",...t,children:[Nl(Dl,{contentEditable:!1,onClick:a,ref:r,children:[Et("span",{children:e.language}),Et(Ll,{})]}),Et(Bl,{children:o})]})}import{useSelected as fh}from"slate-react";import{jsx as hh}from"react/jsx-runtime";function Al({attributes:e,children:t}){let o=fh();return hh($l,{className:o?"--selected":"",...e,spellCheck:"false",children:t})}import{jsx as Ol}from"react/jsx-runtime";function Ul({element:e,attributes:t,children:o}){if(e.type==="code-block")return Ol(Hl,{element:e,attributes:t,children:o});if(e.type==="code-block-line")return Ol(Al,{element:e,attributes:t,children:o})}import{Fragment as Eh,jsx as Vl}from"react/jsx-runtime";var Kl=v((e,t,{createPolicy:o})=>{e.codeBlock=vl(e);function r(){let{selection:n}=e;if(!ce(n))return!1;let i=x(e,"code-block");return i==null?!1:gh.string(e,i[1])===""?(Fl.removeNodes(e,{at:i[1]}),!0):!1}return o({name:"code-block",editor:{deleteBackward:r,deleteForward:r,isInline(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isVoid(n){if(n.type==="code-block"||n.type==="code-block-line")return!1},isMaster(n){if(n.type==="code-block")return!0},normalizeNode:f(Sl,e)},editableProps:{decorate:xl,onKeyDown:H({"super+`":()=>e.codeBlock.createCodeBlock({language:"text"}),"mod+a":()=>{let n=x(e,i=>bh.isElement(i)&&i.type==="code-block");return n?(Fl.select(e,n[1]),!0):!1}}),renderElement:Ul,renderLeaf:({leaf:n,children:i})=>{let a=n.prismToken&&Pl[n.prismToken]||null;return a===null?Vl(Eh,{children:i}):Vl("span",{style:a,children:i})}}})});import{Transforms as yh}from"slate";import _l from"@emotion/styled";var Wl=_l("div")`
944
947
  position: relative;
945
948
  background-color: var(--shade-100);
946
949
  border: 1px solid var(--shade-300);
@@ -958,7 +961,7 @@
958
961
  &.--selected {
959
962
  outline: 2px solid var(--select-color);
960
963
  }
961
- `,Wl=Kl("span")`
964
+ `,Gl=_l("span")`
962
965
  position: absolute;
963
966
  top: 0.25em;
964
967
  right: 0.5em;
@@ -966,7 +969,7 @@
966
969
  color: var(--shade-500);
967
970
  text-transform: uppercase;
968
971
  letter-spacing: 0.5px;
969
- `;import{jsx as Gl,jsxs as Eh}from"react/jsx-runtime";function ql({attributes:e,children:t,element:o}){return Eh(_l,{...e,contentEditable:!1,children:[Gl(Wl,{children:"HTML"}),Gl("div",{children:rt(o.html)}),t]})}import{jsx as yh}from"react/jsx-runtime";var Ql=v((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!ce(n))return!1;let i=E(e,"html-block");return i==null?!1:(xh.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 yh(ql,{element:n,attributes:i,children:a})}}})});import{Editor as os}from"slate";import{Element as Ih}from"slate";import{Element as kh,Transforms as vh}from"slate";function Xl(e){return kh.isElement(e)&&e.type==="paragraph"}function jl(e,t){return xe(e,t,(o,r)=>!Xl(o[0])||!Xl(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(vh.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as Th,Transforms as wh}from"slate";function or(e,t){return Th.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function Yl(e,t){return or(e,t[0])?xe(e,t,(o,r)=>!or(e,o[0])||!or(e,r[0])?!1:(wh.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function Jl(e,t){let[o,r]=t;return Ih.isElement(o)?!!(Yl(e,[o,r])||jl(e,[o,r])):!1}import{clsx as Ch}from"clsx";import{useSelected as Sh}from"slate-react";import Mh from"@emotion/styled";var Zl=Mh("p")`
972
+ `;import{jsx as ql,jsxs as xh}from"react/jsx-runtime";function Ql({attributes:e,children:t,element:o}){return xh(Wl,{...e,contentEditable:!1,children:[ql(Gl,{children:"HTML"}),ql("div",{children:nt(o.html)}),t]})}import{jsx as kh}from"react/jsx-runtime";var Xl=v((e,t,{createPolicy:o})=>{function r(){let{selection:n}=e;if(!ce(n))return!1;let i=x(e,"html-block");return i==null?!1:(yh.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 kh(Ql,{element:n,attributes:i,children:a})}}})});import{Editor as rs}from"slate";import{Element as Mh}from"slate";import{Element as vh,Transforms as Th}from"slate";function jl(e){return vh.isElement(e)&&e.type==="paragraph"}function Yl(e,t){return xe(e,t,(o,r)=>!jl(o[0])||!jl(r[0])?!1:o[0].__collapsible&&r[0].__collapsible?(Th.removeNodes(e,{at:o[1]}),!0):!1)}import{Element as wh,Transforms as Ih}from"slate";function or(e,t){return wh.isElement(t)?e.isVoid(t)||e.isMaster(t):!1}function Jl(e,t){return or(e,t[0])?xe(e,t,(o,r)=>!or(e,o[0])||!or(e,r[0])?!1:(Ih.insertNodes(e,{type:"paragraph",__collapsible:!0,children:[{text:""}]},{at:r[1]}),!0)):!1}function Zl(e,t){let[o,r]=t;return Mh.isElement(o)?!!(Jl(e,[o,r])||Yl(e,[o,r])):!1}import{clsx as Sh}from"clsx";import{useSelected as Rh}from"slate-react";import Ph from"@emotion/styled";var es=Ph("p")`
970
973
  padding: 0;
971
974
  margin: 0;
972
975
  &:first-of-type {
@@ -996,42 +999,42 @@
996
999
  }
997
1000
  border-radius: 8px;
998
1001
  }
999
- `;import{Node as Ph}from"slate";function es(e){return e.children.length===1&&Ph.string(e.children[0]).length===0}import{jsx as Rh}from"react/jsx-runtime";function ts({element:e,attributes:t,children:o}){let r=Sh(),n=es(e);return Rh(Zl,{...t,className:Ch({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as Lh}from"react/jsx-runtime";var rs=v(e=>{let{insertBreak:t}=e;if(e.insertBreak=()=>{let{selection:o}=e;if(o&&o.anchor.path[0]===o.focus.path[0]){let r=[o.anchor.path[0]],n=os.start(e,r);os.string(e,{anchor:n,focus:o.anchor}).endsWith(`
1002
+ `;import{Node as Ch}from"slate";function ts(e){return e.children.length===1&&Ch.string(e.children[0]).length===0}import{jsx as Lh}from"react/jsx-runtime";function os({element:e,attributes:t,children:o}){let r=Rh(),n=ts(e);return Lh(es,{...t,className:Sh({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as zh}from"react/jsx-runtime";var ns=v(e=>{let{insertBreak:t}=e;if(e.insertBreak=()=>{let{selection:o}=e;if(o&&o.anchor.path[0]===o.focus.path[0]){let r=[o.anchor.path[0]],n=rs.start(e,r);rs.string(e,{anchor:n,focus:o.anchor}).endsWith(`
1000
1003
  `)?t():e.insertText(`
1001
- `)}else t()},e.convertElement.addConvertElementType("paragraph"),e.collapsibleParagraph={convertParagraph:()=>{e.convertElement.convertElements(()=>!1,{type:"paragraph"},!1)}},!e.normalizeAfterDelete)throw new Error("The collapsible-paragraph-plugin has a dependency on the normalize-after-delete plugin. Please add that plugin before this one.");return{name:"collapsible-paragraph",editor:{normalizeNode:f(Jl,e)},editableProps:{renderElement:({element:o,attributes:r,children:n})=>{if(o.type==="paragraph")return Lh(ts,{element:o,attributes:r,children:n})},onKeyDown:N({"super+0":e.collapsibleParagraph.convertParagraph})}}});function ns(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}import{Editor as W,Element as oo,Node as ne,Point as We,Range as Bh,Transforms as Se}from"slate";function is(e,t,o){try{let r=W.start(e,o),n=W.end(e,o);if(We.isBefore(t,r)||We.isAfter(t,n))return-1;let i={anchor:r,focus:t};return W.string(e,i).length}catch{return-1}}function as(e,t,o){try{let r=ne.get(e,t);if(!oo.isElement(r))return;let n=ne.string(r),i=Math.min(o,n.length),a=W.start(e,t),l=0,m=a.path,s=0;for(let[d,p]of ne.texts(r)){let u=d.text.length;if(l+u>=i){m=[...t,...p],s=i-l;break}l+=u}let c={path:m,offset:s};Se.select(e,{anchor:c,focus:c})}catch{}}function zh(e){return ne.string(e).includes(`
1002
- `)}function Dh(e,t,o,r){let n=ne.string(t),i=n.split(`
1003
- `),a=W.start(e,o),l=W.end(e,o),m=We.isBefore(r.anchor,a)?a:We.isAfter(r.anchor,l)?l:r.anchor,s=We.isBefore(r.focus,a)?a:We.isAfter(r.focus,l)?l:r.focus,c=Math.min(W.string(e,{anchor:a,focus:m}).length,n.length),d=Math.min(W.string(e,{anchor:a,focus:s}).length,n.length),p=Math.min(c,d),u=Math.max(c,d),g=0,w=0,P=i.length-1;for(let S=0;S<i.length;S++){let M=g+i[S].length;if(g<=p&&p<=M&&(w=S),g<=u&&u<=M){P=S;break}g=M+1}return{startLineIndex:w,endLineIndex:P}}function Nh(e,t,o,r){let n=ne.string(t);if(!n.includes(`
1004
+ `)}else t()},e.convertElement.addConvertElementType("paragraph"),e.collapsibleParagraph={convertParagraph:()=>{e.convertElement.convertElements(()=>!1,{type:"paragraph"},!1)}},!e.normalizeAfterDelete)throw new Error("The collapsible-paragraph-plugin has a dependency on the normalize-after-delete plugin. Please add that plugin before this one.");return{name:"collapsible-paragraph",editor:{normalizeNode:f(Zl,e)},editableProps:{renderElement:({element:o,attributes:r,children:n})=>{if(o.type==="paragraph")return zh(os,{element:o,attributes:r,children:n})},onKeyDown:H({"super+0":e.collapsibleParagraph.convertParagraph})}}});function is(e,t){Array.isArray(t)?e.convertElement.convertElementTypes.push(...t):e.convertElement.convertElementTypes.push(t)}import{Editor as W,Element as oo,Node as ne,Point as Ge,Range as Bh,Transforms as Re}from"slate";function as(e,t,o){try{let r=W.start(e,o),n=W.end(e,o);if(Ge.isBefore(t,r)||Ge.isAfter(t,n))return-1;let i={anchor:r,focus:t};return W.string(e,i).length}catch{return-1}}function ls(e,t,o){try{let r=ne.get(e,t);if(!oo.isElement(r))return;let n=ne.string(r),i=Math.min(o,n.length),a=W.start(e,t),l=0,m=a.path,s=0;for(let[d,p]of ne.texts(r)){let u=d.text.length;if(l+u>=i){m=[...t,...p],s=i-l;break}l+=u}let c={path:m,offset:s};Re.select(e,{anchor:c,focus:c})}catch{}}function Dh(e){return ne.string(e).includes(`
1005
+ `)}function $h(e,t,o,r){let n=ne.string(t),i=n.split(`
1006
+ `),a=W.start(e,o),l=W.end(e,o),m=Ge.isBefore(r.anchor,a)?a:Ge.isAfter(r.anchor,l)?l:r.anchor,s=Ge.isBefore(r.focus,a)?a:Ge.isAfter(r.focus,l)?l:r.focus,c=Math.min(W.string(e,{anchor:a,focus:m}).length,n.length),d=Math.min(W.string(e,{anchor:a,focus:s}).length,n.length),p=Math.min(c,d),u=Math.max(c,d),g=0,T=0,S=i.length-1;for(let L=0;L<i.length;L++){let M=g+i[L].length;if(g<=p&&p<=M&&(T=L),g<=u&&u<=M){S=L;break}g=M+1}return{startLineIndex:T,endLineIndex:S}}function Nh(e,t,o,r){let n=ne.string(t);if(!n.includes(`
1004
1007
  `))return o;let i=n.split(`
1005
- `);if(i.length<=1)return o;let{startLineIndex:a,endLineIndex:l}=Dh(e,t,o,r),m=i.slice(0,a),s=i.slice(a,l+1),c=i.slice(l+1);return m.length===0&&c.length===0?o:(W.withoutNormalizing(e,()=>{let d=o.slice(0,-1),p=o[o.length-1];if(c.length>0){let g=c.join(`
1006
- `),w={...t,children:[{text:g}]};Se.insertNodes(e,w,{at:[...d,p+1]})}let u=t.children.length;for(let g=u-1;g>=0;g--)Se.removeNodes(e,{at:[...o,g]});if(m.length>0){Se.insertNodes(e,{text:m.join(`
1007
- `)},{at:[...o,0]});let w={type:"paragraph",children:[{text:s.join(`
1008
- `)}]};Se.insertNodes(e,w,{at:[...d,p+1]})}else Se.insertNodes(e,{text:s.join(`
1009
- `)},{at:[...o,0]})}),m.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function ls(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=Bh.isCollapsed(n),m=Array.from(W.nodes(e,{match:p=>oo.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(m.length>0){let[,p]=m[0];i=is(e,n.anchor,p),a=is(e,n.focus,p)}if(m.length===0)return!1;let s=[];W.withoutNormalizing(e,()=>{for(let p=m.length-1;p>=0;p--){let[u,g]=m[p];if(zh(u)){let w=Nh(e,u,g,n);s.unshift(w)}else s.unshift(g)}});let c=s.map(p=>{try{let u=ne.get(e,p);return oo.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]))?W.withoutNormalizing(e,()=>{for(let p of c)pt(e,{type:"paragraph"},p[1])}):W.withoutNormalizing(e,()=>{for(let p of c)pt(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)as(e,p,i);else if(a>=0)try{let u=ne.get(e,p);if(oo.isElement(u)){let g=ne.string(u),w=Math.min(i,g.length),P=Math.min(a,g.length),S=W.start(e,p),M=S.path,H=w,I=0;for(let[x,T]of ne.texts(u)){let L=x.text.length;if(I+L>=w){M=[...p,...T],H=w-I;break}I+=L}let A=S.path,k=P;I=0;for(let[x,T]of ne.texts(u)){let L=x.text.length;if(I+L>=P){A=[...p,...T],k=P-I;break}I+=L}Se.select(e,{anchor:{path:M,offset:H},focus:{path:A,offset:k}})}}catch{as(e,p,i)}}return!0}function ss(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function ms(e){return{convertElementTypes:[],addConvertElementType:f(ns,e),isConvertibleElement:f(ss,e),convertElements:f(ls,e)}}var cs=v(e=>(e.convertElement=ms(e),{name:"convert-element"}));import{Editor as rr,Path as $h,Range as Hh,Transforms as ps}from"slate";function ds(e){let t=E(e,"heading");if(!t||!e.selection||Hh.isExpanded(e.selection)||!rr.isEnd(e,e.selection.anchor,t[1]))return!1;let o=$h.next(t[1]);return ps.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),ps.select(e,{anchor:rr.start(e,o),focus:rr.start(e,o)}),!0}import{Editor as Ah}from"slate";function Oh(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Uh(e,t){let[o]=Ah.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function us(e){return{convertHeading:f(Oh,e),isHeadingActive:f(Uh,e)}}import{css as Fh}from"@emotion/react";import Ge from"@emotion/styled";var qe=Fh`
1008
+ `);if(i.length<=1)return o;let{startLineIndex:a,endLineIndex:l}=$h(e,t,o,r),m=i.slice(0,a),s=i.slice(a,l+1),c=i.slice(l+1);return m.length===0&&c.length===0?o:(W.withoutNormalizing(e,()=>{let d=o.slice(0,-1),p=o[o.length-1];if(c.length>0){let g=c.join(`
1009
+ `),T={...t,children:[{text:g}]};Re.insertNodes(e,T,{at:[...d,p+1]})}let u=t.children.length;for(let g=u-1;g>=0;g--)Re.removeNodes(e,{at:[...o,g]});if(m.length>0){Re.insertNodes(e,{text:m.join(`
1010
+ `)},{at:[...o,0]});let T={type:"paragraph",children:[{text:s.join(`
1011
+ `)}]};Re.insertNodes(e,T,{at:[...d,p+1]})}else Re.insertNodes(e,{text:s.join(`
1012
+ `)},{at:[...o,0]})}),m.length>0?[...o.slice(0,-1),o[o.length-1]+1]:o)}function ss(e,t,o,r){let{selection:n}=e;if(!n)return!1;let i=-1,a=-1,l=Bh.isCollapsed(n),m=Array.from(W.nodes(e,{match:p=>oo.isElement(p)&&e.convertElement.isConvertibleElement(p)}));if(m.length>0){let[,p]=m[0];i=as(e,n.anchor,p),a=as(e,n.focus,p)}if(m.length===0)return!1;let s=[];W.withoutNormalizing(e,()=>{for(let p=m.length-1;p>=0;p--){let[u,g]=m[p];if(Dh(u)){let T=Nh(e,u,g,n);s.unshift(T)}else s.unshift(g)}});let c=s.map(p=>{try{let u=ne.get(e,p);return oo.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]))?W.withoutNormalizing(e,()=>{for(let p of c)dt(e,{type:"paragraph"},p[1])}):W.withoutNormalizing(e,()=>{for(let p of c)dt(e,o,p[1])}),c.length>0&&i>=0){let[,p]=c[0];if(l)ls(e,p,i);else if(a>=0)try{let u=ne.get(e,p);if(oo.isElement(u)){let g=ne.string(u),T=Math.min(i,g.length),S=Math.min(a,g.length),L=W.start(e,p),M=L.path,N=T,w=0;for(let[E,k]of ne.texts(u)){let P=E.text.length;if(w+P>=T){M=[...p,...k],N=T-w;break}w+=P}let z=L.path,I=S;w=0;for(let[E,k]of ne.texts(u)){let P=E.text.length;if(w+P>=S){z=[...p,...k],I=S-w;break}w+=P}Re.select(e,{anchor:{path:M,offset:N},focus:{path:z,offset:I}})}}catch{ls(e,p,i)}}return!0}function ms(e,t){return e.convertElement.convertElementTypes.includes(t.type)}function cs(e){return{convertElementTypes:[],addConvertElementType:f(is,e),isConvertibleElement:f(ms,e),convertElements:f(ss,e)}}var ps=v(e=>(e.convertElement=cs(e),{name:"convert-element"}));import{Editor as rr,Path as Hh,Range as Ah,Transforms as ds}from"slate";function us(e){let t=x(e,"heading");if(!t||!e.selection||Ah.isExpanded(e.selection)||!rr.isEnd(e,e.selection.anchor,t[1]))return!1;let o=Hh.next(t[1]);return ds.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o}),ds.select(e,{anchor:rr.start(e,o),focus:rr.start(e,o)}),!0}import{Editor as Oh}from"slate";function Uh(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Fh(e,t){let[o]=Oh.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function fs(e){return{convertHeading:f(Uh,e),isHeadingActive:f(Fh,e)}}import{css as Vh}from"@emotion/react";import qe from"@emotion/styled";var Qe=Vh`
1010
1013
  margin-top: 1em;
1011
1014
  &:first-of-type {
1012
1015
  margin-top: 0;
1013
1016
  }
1014
1017
  font-weight: bold;
1015
- `,fs=Ge("h1")`
1016
- ${qe}
1018
+ `,hs=qe("h1")`
1019
+ ${Qe}
1017
1020
  font-size: 2.25em;
1018
1021
  letter-spacing: -0.01em;
1019
- `,hs=Ge("h2")`
1020
- ${qe}
1022
+ `,gs=qe("h2")`
1023
+ ${Qe}
1021
1024
  font-size: 1.5em;
1022
- `,gs=Ge("h3")`
1023
- ${qe}
1025
+ `,bs=qe("h3")`
1026
+ ${Qe}
1024
1027
  font-size: 1.25em;
1025
- `,bs=Ge("h4")`
1026
- ${qe}
1028
+ `,Es=qe("h4")`
1029
+ ${Qe}
1027
1030
  font-size: 1em;
1028
- `,Es=Ge("h5")`
1029
- ${qe}
1031
+ `,xs=qe("h5")`
1032
+ ${Qe}
1030
1033
  font-size: 1em;
1031
- `,xs=Ge("h6")`
1032
- ${qe}
1034
+ `,ys=qe("h6")`
1035
+ ${Qe}
1033
1036
  font-size: 1em;
1034
- `;import{jsx as Qe}from"react/jsx-runtime";var ys=v(e=>{e.convertElement.addConvertElementType("heading"),e.heading=us(e);let t=N({"super+1":q(e.heading.convertHeading,1,!0),"super+2":q(e.heading.convertHeading,2,!0),"super+3":q(e.heading.convertHeading,3,!0),"super+4":q(e.heading.convertHeading,4,!0),"super+5":q(e.heading.convertHeading,5,!0),"super+6":q(e.heading.convertHeading,6,!0)}),o=pi(e,{"#":q(e.heading.convertHeading,1,!1),"##":q(e.heading.convertHeading,2,!1),"###":q(e.heading.convertHeading,3,!1),"####":q(e.heading.convertHeading,4,!1),"#####":q(e.heading.convertHeading,5,!1),"######":q(e.heading.convertHeading,6,!1)});return{name:"heading",editor:{insertBreak:f(ds,e)},editableProps:{renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="heading")switch(r.level){case 1:return Qe(fs,{...n,children:i});case 2:return Qe(hs,{...n,children:i});case 3:return Qe(gs,{...n,children:i});case 4:return Qe(bs,{...n,children:i});case 5:return Qe(Es,{...n,children:i});case 6:return Qe(xs,{...n,children:i});default:{let a=r.level;throw new Error(`Expected element.level to be 1-6 but got ${a}`)}}},onKeyDown:r=>!!(t(r)||o(r))}}});import{useSelected as Kh}from"slate-react";import Vh from"@emotion/styled";var ks=Vh("hr")`
1037
+ `;import{jsx as Xe}from"react/jsx-runtime";var ks=v(e=>{e.convertElement.addConvertElementType("heading"),e.heading=fs(e);let t=H({"super+1":q(e.heading.convertHeading,1,!0),"super+2":q(e.heading.convertHeading,2,!0),"super+3":q(e.heading.convertHeading,3,!0),"super+4":q(e.heading.convertHeading,4,!0),"super+5":q(e.heading.convertHeading,5,!0),"super+6":q(e.heading.convertHeading,6,!0)}),o=pi(e,{"#":q(e.heading.convertHeading,1,!1),"##":q(e.heading.convertHeading,2,!1),"###":q(e.heading.convertHeading,3,!1),"####":q(e.heading.convertHeading,4,!1),"#####":q(e.heading.convertHeading,5,!1),"######":q(e.heading.convertHeading,6,!1)});return{name:"heading",editor:{insertBreak:f(us,e)},editableProps:{renderElement:({element:r,attributes:n,children:i})=>{if(r.type==="heading")switch(r.level){case 1:return Xe(hs,{...n,children:i});case 2:return Xe(gs,{...n,children:i});case 3:return Xe(bs,{...n,children:i});case 4:return Xe(Es,{...n,children:i});case 5:return Xe(xs,{...n,children:i});case 6:return Xe(ys,{...n,children:i});default:{let a=r.level;throw new Error(`Expected element.level to be 1-6 but got ${a}`)}}},onKeyDown:r=>!!(t(r)||o(r))}}});import{useSelected as _h}from"slate-react";import Kh from"@emotion/styled";var vs=Kh("hr")`
1035
1038
  position: relative;
1036
1039
  height: 1em;
1037
1040
  /* background-color: var(--hr-color); */
@@ -1061,7 +1064,7 @@
1061
1064
  outline: 2px solid var(--select-color, blue);
1062
1065
  }
1063
1066
  }
1064
- `;import{jsx as vs,jsxs as _h}from"react/jsx-runtime";function Ts({attributes:e,children:t}){let o=Kh();return _h("div",{...e,draggable:!0,children:[t,vs("div",{contentEditable:!1,children:vs(ks,{className:o?"--selected":""})})]})}import{Editor as nr,Element as Wh,Path as ws,Transforms as ro}from"slate";function Gh(e){let{selection:t}=e;if(!t)return!1;let o=E(e,i=>Wh.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)nr.withoutNormalizing(e,()=>{ro.insertNodes(e,[r,n]),ro.move(e)});else{let i=ws.next(o[1]);nr.withoutNormalizing(e,()=>{ro.insertNodes(e,[r,n],{at:i});let a=ws.next(i);ro.select(e,nr.start(e,a))})}return!0}function Is(e){return{insertHorizontalRule:f(Gh,e)}}import{jsx as qh}from"react/jsx-runtime";var Ms=v((e,t,{createPolicy:o})=>(e.horizontalRule=Is(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 qh(Ts,{...r})},onKeyDown:N({"super+-":e.horizontalRule.insertHorizontalRule})}})));import Ps from"@emotion/styled";var Cs=Ps("code")`
1067
+ `;import{jsx as Ts,jsxs as Wh}from"react/jsx-runtime";function ws({attributes:e,children:t}){let o=_h();return Wh("div",{...e,draggable:!0,children:[t,Ts("div",{contentEditable:!1,children:Ts(vs,{className:o?"--selected":""})})]})}import{Editor as nr,Element as Gh,Path as Is,Transforms as ro}from"slate";function qh(e){let{selection:t}=e;if(!t)return!1;let o=x(e,i=>Gh.isElement(i)&&e.isMaster(i)),r={type:"horizontal-rule",children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};if(o==null)nr.withoutNormalizing(e,()=>{ro.insertNodes(e,[r,n]),ro.move(e)});else{let i=Is.next(o[1]);nr.withoutNormalizing(e,()=>{ro.insertNodes(e,[r,n],{at:i});let a=Is.next(i);ro.select(e,nr.start(e,a))})}return!0}function Ms(e){return{insertHorizontalRule:f(qh,e)}}import{jsx as Qh}from"react/jsx-runtime";var Ps=v((e,t,{createPolicy:o})=>(e.horizontalRule=Ms(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 Qh(ws,{...r})},onKeyDown:H({"super+-":e.horizontalRule.insertHorizontalRule})}})));import Cs from"@emotion/styled";var Ss=Cs("code")`
1065
1068
  color: var(--shade-600);
1066
1069
  background-color: var(--inline-code-bgcolor);
1067
1070
  border: 1px solid var(--inline-code-border-color);
@@ -1082,16 +1085,16 @@
1082
1085
  */
1083
1086
  font-size: 0.75em;
1084
1087
  vertical-align: baseline;
1085
- `,ir=Ps("span")`
1088
+ `,ir=Cs("span")`
1086
1089
  display: inline-block;
1087
1090
  opacity: 0;
1088
1091
  width: 1px;
1089
1092
  overflow: hidden;
1090
- `;import{jsx as Ss,jsxs as Qh}from"react/jsx-runtime";var Rs=v(e=>{if(!e.marksPlugin)throw new Error("InlineCodePlugin has a dependency on the MarksPlugin but the MarksPlugin has not been added or is added after the InlineCodePlugin");return e.inlineCode={toggleInlineCode:()=>e.marksPlugin.toggleMark("code")},{name:"inline-code",editableProps:{renderLeaf:({leaf:t,children:o})=>t.code?Qh(Cs,{spellCheck:!1,children:[Ss(ir,{contentEditable:!1,children:"|"}),o,Ss(ir,{contentEditable:!1,children:"|"})]}):o,onKeyDown:N({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as tm,Path as om}from"slate";function Ls(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 Bs(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 zs(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 Xh=2;function no(e){let t=E(e,z);return t?t[0].depth:0}function ar(e){return Me(e,z)?no(e)<Xh:!1}function lr(e){return Me(e,z)?no(e)>0:!1}function Ds(e){ar(e)&&e.list.indent()}function Ns(e){lr(e)&&e.list.outdent()}function $s(e){return Bt(e,t=>({depth:t.depth+1}),{match:z})}import{Editor as jh,Transforms as sr}from"slate";function Hs(e){let t=E(e,z);if(!t)return!1;let[o,r]=t;if(jh.isEmpty(e,o))return o.depth>0?(sr.setNodes(e,{depth:o.depth-1},{at:r}),!0):(pt(e,{type:"paragraph"},r),!0);sr.splitNodes(e,{always:!0});let n=E(e,z);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&sr.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as Yh}from"slate";function As(e){let t=Array.from(Yh.nodes(e,{match:z}));for(let o of t)if(o[0].depth===0)return!0;return Bt(e,o=>({depth:Math.max(0,o.depth-1)}),{match:z})}import{Transforms as Jh}from"slate";function Os(e,{at:t=e.selection}={}){let o=E(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;Jh.setNodes(e,{checked:r},{at:o[1]})}function Us(e){return{indent:f($s,e),outdent:f(As,e),convertUnorderedList:f(zs,e),convertOrderedList:f(Ls,e),convertTaskList:f(Bs,e),insertBreak:f(Hs,e),toggleTaskListItem:f(Os,e),getListDepth:f(no,e),canIncreaseDepth:f(ar,e),canDecreaseDepth:f(lr,e),increaseDepth:f(Ds,e),decreaseDepth:f(Ns,e)}}import{Element as Zh,Transforms as eg}from"slate";var Fs=Lt(["ordered-list-item"]);function io(e,t){let[o,r]=t;return Zh.isElement(o)?xe(e,[o,r],(n,i)=>{if(!Fs(i[0]))return!1;let a=Fs(n[0])||z(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(eg.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function Vs(e,t){let[o]=t;return z(o)?io(e,t):!1}import{clsx as og}from"clsx";import{useEffect as rg}from"react";import{ReactEditor as ng,useSlateStatic as ig}from"slate-react";import ao from"@emotion/styled";var mr=ao("li")`
1093
+ `;import{jsx as Rs,jsxs as Xh}from"react/jsx-runtime";var Ls=v(e=>{if(!e.marksPlugin)throw new Error("InlineCodePlugin has a dependency on the MarksPlugin but the MarksPlugin has not been added or is added after the InlineCodePlugin");return e.inlineCode={toggleInlineCode:()=>e.marksPlugin.toggleMark("code")},{name:"inline-code",editableProps:{renderLeaf:({leaf:t,children:o})=>t.code?Xh(Ss,{spellCheck:!1,children:[Rs(ir,{contentEditable:!1,children:"|"}),o,Rs(ir,{contentEditable:!1,children:"|"})]}):o,onKeyDown:H({"mod+j":()=>e.inlineCode.toggleInlineCode()})}}});import{Editor as om,Path as rm}from"slate";function zs(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 Bs(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 Ds(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 jh=2;function no(e){let t=x(e,D);return t?t[0].depth:0}function ar(e){return Pe(e,D)?no(e)<jh:!1}function lr(e){return Pe(e,D)?no(e)>0:!1}function $s(e){ar(e)&&e.list.indent()}function Ns(e){lr(e)&&e.list.outdent()}function Hs(e){return Bt(e,t=>({depth:t.depth+1}),{match:D})}import{Editor as Yh,Transforms as sr}from"slate";function As(e){let t=x(e,D);if(!t)return!1;let[o,r]=t;if(Yh.isEmpty(e,o))return o.depth>0?(sr.setNodes(e,{depth:o.depth-1},{at:r}),!0):(dt(e,{type:"paragraph"},r),!0);sr.splitNodes(e,{always:!0});let n=x(e,D);return n&&n[0].type==="task-list-item"&&n[0].checked===!0&&sr.setNodes(e,{checked:!1},{at:n[1]}),!0}import{Editor as Jh}from"slate";function Os(e){let t=Array.from(Jh.nodes(e,{match:D}));for(let o of t)if(o[0].depth===0)return!0;return Bt(e,o=>({depth:Math.max(0,o.depth-1)}),{match:D})}import{Transforms as Zh}from"slate";function Us(e,{at:t=e.selection}={}){let o=x(e,"task-list-item",{at:t});if(!o)return!1;let r=!o[0].checked;return Zh.setNodes(e,{checked:r},{at:o[1]}),!0}function Fs(e){return{indent:f(Hs,e),outdent:f(Os,e),convertUnorderedList:f(Ds,e),convertOrderedList:f(zs,e),convertTaskList:f(Bs,e),insertBreak:f(As,e),toggleTaskListItem:f(Us,e),getListDepth:f(no,e),canIncreaseDepth:f(ar,e),canDecreaseDepth:f(lr,e),increaseDepth:f($s,e),decreaseDepth:f(Ns,e)}}import{Element as eg,Transforms as tg}from"slate";var Vs=zt(["ordered-list-item"]);function io(e,t){let[o,r]=t;return eg.isElement(o)?xe(e,[o,r],(n,i)=>{if(!Vs(i[0]))return!1;let a=Vs(n[0])||D(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(tg.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function Ks(e,t){let[o]=t;return D(o)?io(e,t):!1}import{clsx as rg}from"clsx";import{useEffect as ng}from"react";import{ReactEditor as ig,useSlateStatic as ag}from"slate-react";import ao from"@emotion/styled";var mr=ao("li")`
1091
1094
  margin-top: 0.5em;
1092
1095
  margin-bottom: 0.5em;
1093
1096
  list-style-position: outside;
1094
- `,Ks=ao(mr)`
1097
+ `,_s=ao(mr)`
1095
1098
  position: relative;
1096
1099
  list-style-type: none;
1097
1100
  .--list-item-icon {
@@ -1101,7 +1104,7 @@
1101
1104
  line-height: 1.5em;
1102
1105
  color: var(--shade-600);
1103
1106
  }
1104
- `,_s=ao(mr)`
1107
+ `,Ws=ao(mr)`
1105
1108
  position: relative;
1106
1109
  list-style-type: none;
1107
1110
  counter-increment: var(--list-item-var);
@@ -1126,7 +1129,7 @@
1126
1129
  /* force numbers to be monospaced for better alignment */
1127
1130
  font-variant-numeric: tabular-nums;
1128
1131
  }
1129
- `,Ws=ao(mr)`
1132
+ `,Gs=ao(mr)`
1130
1133
  position: relative;
1131
1134
  list-style-type: none;
1132
1135
  .--list-item-icon {
@@ -1140,7 +1143,7 @@
1140
1143
  stroke-width: 3px;
1141
1144
  }
1142
1145
  }
1143
- `;import{jsx as ag}from"react/jsx-runtime";function Gs({element:e,attributes:t,children:o}){let r=ig();rg(()=>{let a=ng.findPath(r,e);io(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=og({"--first-at-depth":e.__firstAtDepth});return ag(_s,{...t,className:i,style:n,children:o})}import{useCallback as lg}from"react";import{useSlateStatic as sg}from"slate-react";import{jsx as Re,jsxs as js}from"react/jsx-runtime";var qs=e=>js("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:[Re("path",{d:"M0 0h24v24H0z",stroke:"none"}),Re("rect",{x:4,y:4,width:16,height:16,rx:2})]}),Qs=e=>js("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:[Re("path",{d:"M0 0h24v24H0z",stroke:"none"}),Re("path",{d:"m9 11 3 3 8-8",className:"--checkmark"}),Re("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),Xs=e=>Re("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",...e,children:Re("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 cr,jsxs as mg}from"react/jsx-runtime";function Ys({element:e,attributes:t,children:o}){let r=sg(),n=lg(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return mg(Ws,{...t,style:{marginLeft:i},children:[cr("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?cr(Qs,{onClick:n,style:{cursor:"pointer"}}):cr(qs,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as Js,jsxs as cg}from"react/jsx-runtime";function Zs({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return cg(Ks,{...t,style:{marginLeft:r},children:[Js("div",{className:"--list-item-icon",contentEditable:!1,children:Js(Xs,{})}),o]})}import{jsx as pr}from"react/jsx-runtime";function em({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return pr(Gs,{element:e,attributes:t,children:o});case"unordered-list-item":return pr(Zs,{element:e,attributes:t,children:o});case"task-list-item":return pr(Ys,{element:e,attributes:t,children:o})}}var rm=["unordered-list-item","ordered-list-item","task-list-item"],z=Lt(rm),nm=v((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(rm);let r=e.list=Us(e),n=N({tab:r.indent,"shift+tab":r.outdent,"super+7":f(r.convertOrderedList,!0),"super+8":f(r.convertUnorderedList,!0),"super+9":f(r.convertTaskList,!0)});return o({name:"list",editor:{normalizeNode:i=>Vs(e,i),insertBreak:r.insertBreak,deleteBackward:i=>{if(i!=="character"||!Me(e,z))return!1;let a=E(e,z);if(!a)return!1;let l=a[1];if(!om.hasPrevious(l))return e.collapsibleParagraph.convertParagraph(),!0;let m=om.previous(l),s=tm.node(e,m);return z(s[0])?!1:(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:em,onKeyDown(i){return tm.nodes(e,{match:z})?n(i):!1}}})});import{clsx as gg}from"clsx";import{Editor as dr,Range as bg}from"slate";import{Editor as pg,Text as im,Transforms as dg}from"slate";function am(e,{at:t=e.selection}={}){if(t==null)return;let o=[...pg.nodes(e,{match:n=>im.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);dg.setNodes(e,r,{match:n=>im.isText(n),split:!0,at:t})}import{Editor as Le,Point as ug,Range as fg}from"slate";function Be(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=fg.isRange(r)?r.focus:r,i=ug.isPoint(n)&&(Le.after(e,n)===null||Le.isEnd(e,n,Le.end(e,[]))),a=t,m=(Le.marks(e)||{})[a]===!0;if(i)if(!m)e.activeMarks={...e.activeMarks,[a]:!0};else{let{[a]:s,...c}=e.activeMarks||{};e.activeMarks=c}m?Le.removeMark(e,a):Le.addMark(e,a,!0),typeof o=="string"&&Le.removeMark(e,o)}function lm(e){return{removeMarks:f(am,e),toggleMark:f(Be,e),toggleBold:()=>Be(e,"bold"),toggleItalic:()=>Be(e,"italic"),toggleUnderline:()=>Be(e,"underline"),toggleStrike:()=>Be(e,"strike"),toggleHighlight:()=>Be(e,"highlight")}}import hg from"@emotion/styled";var sm=hg("span")`
1146
+ `;import{jsx as lg}from"react/jsx-runtime";function qs({element:e,attributes:t,children:o}){let r=ag();ng(()=>{let a=ig.findPath(r,e);io(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=rg({"--first-at-depth":e.__firstAtDepth});return lg(Ws,{...t,className:i,style:n,children:o})}import{useCallback as sg}from"react";import{useSlateStatic as mg}from"slate-react";import{jsx as Le,jsxs as Ys}from"react/jsx-runtime";var Qs=e=>Ys("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Le("path",{d:"M0 0h24v24H0z",stroke:"none"}),Le("rect",{x:4,y:4,width:16,height:16,rx:2})]}),Xs=e=>Ys("svg",{xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-checkbox",width:"1em",height:"1em",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",...e,children:[Le("path",{d:"M0 0h24v24H0z",stroke:"none"}),Le("path",{d:"m9 11 3 3 8-8",className:"--checkmark"}),Le("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),js=e=>Le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em",...e,children:Le("path",{d:"M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z"})});import{jsx as cr,jsxs as cg}from"react/jsx-runtime";function Js({element:e,attributes:t,children:o}){let r=mg(),n=sg(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return cg(Gs,{...t,style:{marginLeft:i},children:[cr("div",{className:"--list-item-icon",contentEditable:!1,children:e.checked?cr(Xs,{onClick:n,style:{cursor:"pointer"}}):cr(Qs,{onClick:n,style:{cursor:"pointer"}})}),o]})}import{jsx as Zs,jsxs as pg}from"react/jsx-runtime";function em({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return pg(_s,{...t,style:{marginLeft:r},children:[Zs("div",{className:"--list-item-icon",contentEditable:!1,children:Zs(js,{})}),o]})}import{jsx as pr}from"react/jsx-runtime";function tm({element:e,attributes:t,children:o}){switch(e.type){case"ordered-list-item":return pr(qs,{element:e,attributes:t,children:o});case"unordered-list-item":return pr(em,{element:e,attributes:t,children:o});case"task-list-item":return pr(Js,{element:e,attributes:t,children:o})}}var nm=["unordered-list-item","ordered-list-item","task-list-item"],D=zt(nm),im=v((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(nm);let r=e.list=Fs(e),n=H({tab:r.indent,"shift+tab":r.outdent,"super+7":f(r.convertOrderedList,!0),"super+8":f(r.convertUnorderedList,!0),"super+9":f(r.convertTaskList,!0)});return o({name:"list",editor:{normalizeNode:i=>Ks(e,i),insertBreak:r.insertBreak,deleteBackward:i=>{if(i!=="character"||!Pe(e,D))return!1;let a=x(e,D);if(!a)return!1;let l=a[1];if(!rm.hasPrevious(l))return e.collapsibleParagraph.convertParagraph(),!0;let m=rm.previous(l),s=om.node(e,m);return D(s[0])?!1:(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:tm,onKeyDown(i){return om.nodes(e,{match:D})?n(i):!1}}})});import{clsx as bg}from"clsx";import{Editor as dr,Range as Eg}from"slate";import{Editor as dg,Text as am,Transforms as ug}from"slate";function lm(e,{at:t=e.selection}={}){if(t==null)return;let o=[...dg.nodes(e,{match:n=>am.isText(n),at:t})],r={};for(let[n]of o)for(let i of Object.keys(n))i!=="text"&&(r[i]=null);ug.setNodes(e,r,{match:n=>am.isText(n),split:!0,at:t})}import{Editor as ze,Point as fg,Range as hg}from"slate";function Be(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=hg.isRange(r)?r.focus:r,i=fg.isPoint(n)&&(ze.after(e,n)===null||ze.isEnd(e,n,ze.end(e,[]))),a=t,m=(ze.marks(e)||{})[a]===!0;if(i)if(!m)e.activeMarks={...e.activeMarks,[a]:!0};else{let{[a]:s,...c}=e.activeMarks||{};e.activeMarks=c}m?ze.removeMark(e,a):ze.addMark(e,a,!0),typeof o=="string"&&ze.removeMark(e,o)}function sm(e){return{removeMarks:f(lm,e),toggleMark:f(Be,e),toggleBold:()=>Be(e,"bold"),toggleItalic:()=>Be(e,"italic"),toggleUnderline:()=>Be(e,"underline"),toggleStrike:()=>Be(e,"strike"),toggleHighlight:()=>Be(e,"highlight")}}import gg from"@emotion/styled";var mm=gg("span")`
1144
1147
  &.--bold {
1145
1148
  font-weight: bold;
1146
1149
  }
@@ -1163,7 +1166,7 @@
1163
1166
  &.--highlight {
1164
1167
  background-color: #ffff00;
1165
1168
  }
1166
- `;import{jsx as Eg}from"react/jsx-runtime";var mm=v(e=>{e.marksPlugin=lm(e),e.activeMarks={};let t=N({"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&&bg.isRange(e.selection)){let n=e.selection.focus;(dr.after(e,n)===null||dr.isEnd(e,n,dr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>Eg(sm,{className:gg({"--bold":n.bold,"--italic":n.italic,"--underline":n.underline,"--strike":n.strike,"--highlight":n.highlight}),children:i}),onKeyDown:n=>!!t(n)}}});import{Editor as Et,Point as cm}from"slate";function pm(e){if(!e.selection)return;let t=Et.parent(e,e.selection);fi(e,t[1])}var dm=v(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=Et.parent(e,e.selection);return cm.equals(Et.start(e,t[1]),e.selection.anchor)?function(){pm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=Et.parent(e,e.selection);return cm.equals(Et.end(e,t[1]),e.selection.anchor)?function(){pm(e)}:!1}},editableProps:{}}));import{Element as ib}from"slate";import{Editor as fm,Path as kg,Transforms as hm}from"slate";import{Editor as xg,Path as yg}from"slate";function um(e,t,o){let r=[...xg.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=He(e,o,{at:i});for(let s of r){let c=He(e,o,{at:s});if(l&&c&&yg.equals(l,c)||l==null&&c==null)a=s;else{let d={anchor:i,focus:a};n.push(d),i=a=s,l=c}}let m={anchor:i,focus:a};return n.push(m),n.reverse(),n}function gm(e,t){if(e.selection==null)return!1;let[o,r]=fm.edges(e,e.selection),n=He(e,t,{at:o}),i=He(e,t,{at:r});if(!n&&!i||n&&i&&kg.equals(n,i))return!1;let a=um(e,e.selection,t);return fm.withoutNormalizing(e,()=>{for(let l of a)hm.delete(e,{at:l});hm.collapse(e,{edge:"start"})}),!0}import{Transforms as Ag}from"slate";function D(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,m]=r,[s,c]=o;return{tableElement:i,tablePath:a,tableColumns:i.columns,rowElement:l,rowPath:m,rowIndex:m.slice(-1)[0],rowCount:i.children.length,cellElement:s,cellPath:c,cellIndex:c.slice(-1)[0],cellCount:l.children.length}}import{Editor as vg,Transforms as bm}from"slate";function Xe(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function Em(e,{offset:t=0,at:o=e.selection}={}){let r=D(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return vg.withoutNormalizing(e,()=>{let{columns:m}=n,s=[...m],c=Math.min(l,m.length-1);s.splice(l,0,m[c]),bm.setNodes(e,{columns:s},{at:i}),n.children.forEach((d,p)=>{bm.insertNodes(e,Xe(l),{at:[...i,p,l]})})}),!0}import{Transforms as Tg}from"slate";function wg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Xe(t))}}function ur(e,{at:t=e.selection,offset:o=0}={}){let r=D(e,{at:t});if(!r)return!1;let n=wg(r.tableElement.columns.length);return Tg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function xm(e,{at:t}={}){return ur(e,{at:t,offset:1})}import{Editor as fr,Element as Ig,Path as Mg,Transforms as xt}from"slate";function ym(e){return[...Array(e).keys()]}function Pg(e){return ym(e).map(()=>({align:"left"}))}function Cg(e,t){return{type:"table",columns:Pg(e),children:ym(t).map(()=>Sg(e))}}function Sg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>Xe(t))}}function km(e,t,o,{at:r=e.selection}={}){let n=Cg(t,o);return Rg(e,n,{at:r})}function Rg(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=E(e,n=>Ig.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;fr.withoutNormalizing(e,()=>{xt.insertNodes(e,t,{at:o}),n&&(xt.select(e,n),xt.move(e))})}else{let n=Mg.next(r[1]);fr.withoutNormalizing(e,()=>{xt.insertNodes(e,t,{at:n}),xt.select(e,fr.start(e,n))})}return!0}import{Path as vm}from"slate";function Tm(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return Q(e,[...i,r+1,o]),!0;try{return Q(e,vm.next(i)),!0}catch{return!1}}function wm(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return Q(e,[...n,r-1,o]),!0;try{return Ei(e,vm.previous(n)),!0}catch{return!1}}import{ReactEditor as Lg}from"slate-react";function Bg(){let e=window.getSelection();return e?e.getRangeAt(0).getBoundingClientRect():null}function zg(e,t){return Lg.toDOMNode(e,t).getBoundingClientRect()}function hr(e,t){let o=Bg();if(!o)return!1;let r=zg(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function Im(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||Tm(e,t)}),!1}function Mm(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||wm(e,t)}),!1}import{Editor as Pm,Transforms as gr}from"slate";import{Transforms as Dg}from"slate";function je(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(Dg.removeNodes(e,{at:t.tablePath}),!0)}function Cm(e,{at:t=e.selection}={}){let o=D(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return je(e);Pm.withoutNormalizing(e,()=>{let m=[...r.columns];m.splice(a,1),gr.setNodes(e,{columns:m},{at:n}),r.children.forEach((c,d)=>{gr.removeNodes(e,{at:[...n,d,a]})});let s=Pm.start(e,[...n,i,Math.min(a,l-2)]);gr.select(e,s)})}import{Editor as Sm,Transforms as Rm}from"slate";function Lm(e,{at:t=e.selection}={}){let o=D(e,{at:t});return o===void 0?!1:o.rowCount===1?(je(e),!0):(Sm.withoutNormalizing(e,()=>{Rm.removeNodes(e,{at:o.rowPath}),Rm.select(e,Sm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as Ng}from"slate";function Bm(e,t){let o=D(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}),Ng.setNodes(e,{columns:a},{at:n}),!0}import{Path as $g,Transforms as Hg}from"slate";function zm(e){let t=D(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return Q(e,[...a,n,o+1]),!0;if(n<i-1)return Q(e,[...a,n+1,0]),!0;let l=$g.next(a);return Hg.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),Q(e,l),!0}function Dm(e){let t=D(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return Q(e,[...i,n,o-1]),!0;if(n>0)return Q(e,[...i,n-1,r-1]),!0}function Nm(e){let t=D(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(Q(e,[...a,n,o+1]),!0):n<i-1?(Q(e,[...a,n+1,0]),!0):(xm(e),Q(e,[...a,n+1,0]),!0)}function $m(e){return{getTableInfo:f(D,e),insertTable:f(km,e),insertColumn:f(Em,e),insertRow:f(ur,e),removeTable:f(je,e),removeColumn:f(Cm,e),removeRow:f(Lm,e),tabForward:f(zm,e),tabBackward:f(Dm,e),shiftEnterForward:f(Nm,e),selectCell:f(Og,e),down:f(Im,e),up:f(Mm,e),setTableColumnAlign:f(Bm,e)}}function Og(e,{at:t=e.selection}={}){let o=D(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return Ag.select(e,r),!0}import{Transforms as Ug}from"slate";function lo(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,m)=>{(l.x!==m||l.y!==i)&&(Ug.setNodes(e,{x:m,y:i},{at:[...t[1],i,m]}),o=!0)})}),o}import{Editor as Fg,Transforms as br}from"slate";function Hm(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(Fg.withoutNormalizing(e,()=>{br.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)br.mergeNodes(e,{at:[...r,n]});br.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as Kg}from"react";import{ReactEditor as _g,useSelected as Wg,useSlateStatic as Gg}from"slate-react";import mo from"@emotion/styled";import pe from"@emotion/styled";var Am=pe("div")`
1169
+ `;import{jsx as xg}from"react/jsx-runtime";var cm=v(e=>{e.marksPlugin=sm(e),e.activeMarks={};let t=H({"mod+b":e.marksPlugin.toggleBold,"mod+i":e.marksPlugin.toggleItalic,"mod+u":e.marksPlugin.toggleUnderline,"super+0":e.marksPlugin.removeMarks,"super+k":e.marksPlugin.toggleStrike,"mod+h":e.marksPlugin.toggleHighlight}),{insertText:o}=e;e.insertText=n=>{if(e.activeMarks&&Object.keys(e.activeMarks).length>0){let{activeMarks:i}=e;Object.entries(i).forEach(([a,l])=>{l&&e.addMark(a,!0)})}o(n)};let{removeMarks:r}=e.marksPlugin;return e.marksPlugin.removeMarks=()=>{if(r(),e.selection&&Eg.isRange(e.selection)){let n=e.selection.focus;(dr.after(e,n)===null||dr.isEnd(e,n,dr.end(e,[])))&&(e.activeMarks={})}},{name:"marks",editableProps:{renderLeaf:({leaf:n,children:i})=>xg(mm,{className:bg({"--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 pm}from"slate";function dm(e){if(!e.selection)return;let t=xt.parent(e,e.selection);fi(e,t[1])}var um=v(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return pm.equals(xt.start(e,t[1]),e.selection.anchor)?function(){dm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return pm.equals(xt.end(e,t[1]),e.selection.anchor)?function(){dm(e)}:!1}},editableProps:{}}));import{Element as ab}from"slate";import{Editor as hm,Path as vg,Transforms as gm}from"slate";import{Editor as yg,Path as kg}from"slate";function fm(e,t,o){let r=[...yg.positions(e,{at:t})],n=[],i,a,l;i=a=r[0],l=Ae(e,o,{at:i});for(let s of r){let c=Ae(e,o,{at:s});if(l&&c&&kg.equals(l,c)||l==null&&c==null)a=s;else{let d={anchor:i,focus:a};n.push(d),i=a=s,l=c}}let m={anchor:i,focus:a};return n.push(m),n.reverse(),n}function bm(e,t){if(e.selection==null)return!1;let[o,r]=hm.edges(e,e.selection),n=Ae(e,t,{at:o}),i=Ae(e,t,{at:r});if(!n&&!i||n&&i&&vg.equals(n,i))return!1;let a=fm(e,e.selection,t);return hm.withoutNormalizing(e,()=>{for(let l of a)gm.delete(e,{at:l});gm.collapse(e,{edge:"start"})}),!0}import{Transforms as Og}from"slate";function $(e,{at:t=e.selection}={}){if(t==null)return;let o=x(e,"table-cell",{at:t});if(!o)return;let r=x(e,"table-row",{at:t});if(!r)return;let n=x(e,"table",{at:t});if(!n)return;let[i,a]=n,[l,m]=r,[s,c]=o;return{tableElement:i,tablePath:a,tableColumns:i.columns,rowElement:l,rowPath:m,rowIndex:m.slice(-1)[0],rowCount:i.children.length,cellElement:s,cellPath:c,cellIndex:c.slice(-1)[0],cellCount:l.children.length}}import{Editor as Tg,Transforms as Em}from"slate";function je(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function xm(e,{offset:t=0,at:o=e.selection}={}){let r=$(e,{at:o});if(r===void 0)return!1;let{tableElement:n,tablePath:i,cellIndex:a}=r,l=a+t;return Tg.withoutNormalizing(e,()=>{let{columns:m}=n,s=[...m],c=Math.min(l,m.length-1);s.splice(l,0,m[c]),Em.setNodes(e,{columns:s},{at:i}),n.children.forEach((d,p)=>{Em.insertNodes(e,je(l),{at:[...i,p,l]})})}),!0}import{Transforms as wg}from"slate";function Ig(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>je(t))}}function ur(e,{at:t=e.selection,offset:o=0}={}){let r=$(e,{at:t});if(!r)return!1;let n=Ig(r.tableElement.columns.length);return wg.insertNodes(e,n,{at:[...r.tablePath,r.rowIndex+o]}),!0}function ym(e,{at:t}={}){return ur(e,{at:t,offset:1})}import{Editor as fr,Element as Mg,Path as Pg,Transforms as yt}from"slate";function km(e){return[...Array(e).keys()]}function Cg(e){return km(e).map(()=>({align:"left"}))}function Sg(e,t){return{type:"table",columns:Cg(e),children:km(t).map(()=>Rg(e))}}function Rg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>je(t))}}function vm(e,t,o,{at:r=e.selection}={}){let n=Sg(t,o);return Lg(e,n,{at:r})}function Lg(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Mg.isElement(n)&&e.isMaster(n));if(r==null){let n=e.selection;fr.withoutNormalizing(e,()=>{yt.insertNodes(e,t,{at:o}),n&&(yt.select(e,n),yt.move(e))})}else{let n=Pg.next(r[1]);fr.withoutNormalizing(e,()=>{yt.insertNodes(e,t,{at:n}),yt.select(e,fr.start(e,n))})}return!0}import{Path as Tm}from"slate";function wm(e,t){let{cellIndex:o,rowIndex:r,rowCount:n,tablePath:i}=t;if(r<n-1)return Q(e,[...i,r+1,o]),!0;try{return Q(e,Tm.next(i)),!0}catch{return!1}}function Im(e,t){let{cellIndex:o,rowIndex:r,tablePath:n}=t;if(r>0)return Q(e,[...n,r-1,o]),!0;try{return Ei(e,Tm.previous(n)),!0}catch{return!1}}import{ReactEditor as zg}from"slate-react";function Bg(){let e=window.getSelection();return e?e.getRangeAt(0).getBoundingClientRect():null}function Dg(e,t){return zg.toDOMNode(e,t).getBoundingClientRect()}function hr(e,t){let o=Bg();if(!o)return!1;let r=Dg(e,t);return o.right<r.right&&o.left>r.left&&o.bottom<r.bottom&&o.top>r.top}function Mm(e){let t=$(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||wm(e,t)}),!1}function Pm(e){let t=$(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||Im(e,t)}),!1}import{Editor as Cm,Transforms as gr}from"slate";import{Transforms as $g}from"slate";function Ye(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:($g.removeNodes(e,{at:t.tablePath}),!0)}function Sm(e,{at:t=e.selection}={}){let o=$(e,{at:t});if(!o)return!1;let{tableElement:r,tablePath:n,rowIndex:i,cellIndex:a,cellCount:l}=o;if(l===1)return Ye(e);Cm.withoutNormalizing(e,()=>{let m=[...r.columns];m.splice(a,1),gr.setNodes(e,{columns:m},{at:n}),r.children.forEach((c,d)=>{gr.removeNodes(e,{at:[...n,d,a]})});let s=Cm.start(e,[...n,i,Math.min(a,l-2)]);gr.select(e,s)})}import{Editor as Rm,Transforms as Lm}from"slate";function zm(e,{at:t=e.selection}={}){let o=$(e,{at:t});return o===void 0?!1:o.rowCount===1?(Ye(e),!0):(Rm.withoutNormalizing(e,()=>{Lm.removeNodes(e,{at:o.rowPath}),Lm.select(e,Rm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as Ng}from"slate";function Bm(e,t){let 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}),Ng.setNodes(e,{columns:a},{at:n}),!0}import{Path as Hg,Transforms as Ag}from"slate";function Dm(e){let t=$(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;if(o<r-1)return Q(e,[...a,n,o+1]),!0;if(n<i-1)return Q(e,[...a,n+1,0]),!0;let l=Hg.next(a);return Ag.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),Q(e,l),!0}function $m(e){let t=$(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,tablePath:i}=t;if(o>0)return Q(e,[...i,n,o-1]),!0;if(n>0)return Q(e,[...i,n-1,r-1]),!0}function Nm(e){let t=$(e);if(!t)return!1;let{cellIndex:o,cellCount:r,rowIndex:n,rowCount:i,tablePath:a}=t;return o<r-1?(Q(e,[...a,n,o+1]),!0):n<i-1?(Q(e,[...a,n+1,0]),!0):(ym(e),Q(e,[...a,n+1,0]),!0)}function Hm(e){return{getTableInfo:f($,e),insertTable:f(vm,e),insertColumn:f(xm,e),insertRow:f(ur,e),removeTable:f(Ye,e),removeColumn:f(Sm,e),removeRow:f(zm,e),tabForward:f(Dm,e),tabBackward:f($m,e),shiftEnterForward:f(Nm,e),selectCell:f(Ug,e),down:f(Mm,e),up:f(Pm,e),setTableColumnAlign:f(Bm,e)}}function Ug(e,{at:t=e.selection}={}){let o=$(e,{at:t});if(o===void 0)return!1;let{cellPath:r}=o;return Og.select(e,r),!0}import{Transforms as Fg}from"slate";function lo(e,t){let o=!1;return t[0].children.forEach((n,i)=>{n.children.forEach((l,m)=>{(l.x!==m||l.y!==i)&&(Fg.setNodes(e,{x:m,y:i},{at:[...t[1],i,m]}),o=!0)})}),o}import{Editor as Vg,Transforms as br}from"slate";function Am(e,t){let[o,r]=t;return o.children.length===1&&o.children[0].type==="table-content"?!1:(Vg.withoutNormalizing(e,()=>{br.insertNodes(e,{type:"table-content",children:[{text:"X"}]},{at:[...t[1],0]});for(let n=o.children.length;n>=0;n--)br.mergeNodes(e,{at:[...r,n]});br.delete(e,{at:{path:[...r,0,0],offset:0},unit:"character"})}),!0)}import{useEffect as _g}from"react";import{ReactEditor as Wg,useSelected as Gg,useSlateStatic as qg}from"slate-react";import mo from"@emotion/styled";import pe from"@emotion/styled";var Om=pe("div")`
1167
1170
  position: absolute;
1168
1171
  /**
1169
1172
  * very slightly shaded
@@ -1187,7 +1190,7 @@
1187
1190
  background: rgba(0, 0, 0, 0.15);
1188
1191
  }
1189
1192
  }
1190
- `,Om=pe(Am)`
1193
+ `,Um=pe(Om)`
1191
1194
  cursor: pointer;
1192
1195
  /**
1193
1196
  * hangs out on top
@@ -1197,7 +1200,7 @@
1197
1200
  right: 0;
1198
1201
  height: 3em;
1199
1202
  top: -3em;
1200
- `,Um=pe(Am)`
1203
+ `,Fm=pe(Om)`
1201
1204
  /**
1202
1205
  * hangs out on left
1203
1206
  */
@@ -1205,7 +1208,7 @@
1205
1208
  bottom: -1px;
1206
1209
  width: 3em;
1207
1210
  left: -3em;
1208
- `,Fm=pe("div")`
1211
+ `,Vm=pe("div")`
1209
1212
  position: absolute;
1210
1213
  background: rgba(0, 0, 0, 0.05);
1211
1214
  border: 1px solid rgba(0, 0, 0, 0.05);
@@ -1217,7 +1220,7 @@
1217
1220
  left: 0;
1218
1221
  right: 0;
1219
1222
  bottom: 0;
1220
- `,Vm=pe(Fm)`
1223
+ `,Km=pe(Vm)`
1221
1224
  top: 50%;
1222
1225
  border-bottom: none;
1223
1226
  border-right: none;
@@ -1243,7 +1246,7 @@
1243
1246
 
1244
1247
  /* border-top-left-radius: 0.5em;
1245
1248
  border-top-right-radius: 0.5em; */
1246
- `,Km=pe(Fm)`
1249
+ `,_m=pe(Vm)`
1247
1250
  left: 50%;
1248
1251
  border-right: none;
1249
1252
  border-bottom: none;
@@ -1269,7 +1272,7 @@
1269
1272
 
1270
1273
  /* border-top-left-radius: 0.5em;
1271
1274
  border-bottom-left-radius: 0.5em; */
1272
- `,_m=pe("div")`
1275
+ `,Wm=pe("div")`
1273
1276
  position: absolute;
1274
1277
  font-size: 1.5em;
1275
1278
  background: white;
@@ -1278,27 +1281,27 @@
1278
1281
  svg {
1279
1282
  display: block;
1280
1283
  }
1281
- `,Ye=pe(_m)`
1284
+ `,Je=pe(Wm)`
1282
1285
  color: #c0c0c0;
1283
1286
  &:hover {
1284
1287
  color: royalblue;
1285
1288
  }
1286
- `,so=pe(_m)`
1289
+ `,so=pe(Wm)`
1287
1290
  color: #c0c0c0;
1288
1291
  &:hover {
1289
1292
  color: firebrick;
1290
1293
  }
1291
- `;var Wm=mo("table")`
1294
+ `;var Gm=mo("table")`
1292
1295
  border-collapse: collapse;
1293
1296
  margin: 1em 0;
1294
1297
  ${({columns:e})=>e.map((t,o)=>`td:nth-of-type(${o+1}) { text-align: ${t.align}; }`).join(`
1295
1298
  `)}
1296
- `,Gm=mo("tr")`
1299
+ `,qm=mo("tr")`
1297
1300
  position: relative;
1298
1301
  &:first-of-type {
1299
1302
  background: var(--table-head-bgcolor);
1300
1303
  }
1301
- `,qm=mo("td")`
1304
+ `,Qm=mo("td")`
1302
1305
  position: relative;
1303
1306
  border-width: 1px;
1304
1307
  border-style: solid;
@@ -1318,7 +1321,7 @@
1318
1321
  &:last-of-type {
1319
1322
  border-right-color: var(--table-border-color);
1320
1323
  }
1321
- `,Qm=mo("div")`
1324
+ `,Xm=mo("div")`
1322
1325
  /**
1323
1326
  * Smaller font inside a table than outside of it
1324
1327
  */
@@ -1330,7 +1333,7 @@
1330
1333
  color: rgba(0, 0, 0, 0.6);
1331
1334
  font-size: 0.875em; /* 14px */
1332
1335
  }
1333
- `;import{createContext as Vg}from"react";var co=Vg({isSelected:!1});import{jsx as Er}from"react/jsx-runtime";function Xm({element:e,attributes:t,children:o}){let r=Gg(),n=Wg();return Kg(()=>{try{let i=_g.findPath(r,e);lo(r,[e,i])}catch{}},[]),Er(co.Provider,{value:{isSelected:n},children:Er(Wm,{...t,columns:e.columns,children:Er("tbody",{children:o})})})}import{useContext as eb}from"react";import{useSelected as tb}from"slate-react";import{useCallback as xr,useRef as qg,useState as Qg}from"react";import{useSlateStatic as Xg}from"slate-react";import{jsx as ee}from"react/jsx-runtime";var Je=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm.75-11.25a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5z",clipRule:"evenodd"})}),po=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5z",clipRule:"evenodd"})}),uo=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h16M4 18h16"})}),jm=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h10M4 18h14"})}),Ym=()=>ee(y,{children:ee("path",{d:"M4 6h16M8 12h8M6 18h12"})}),Jm=()=>ee(y,{children:ee("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as jg,jsx as de,jsxs as Zm}from"react/jsx-runtime";function ec({cellElement:e}){let t=Xg(),o=O("column-menu"),r=qg(null),[n,i]=Qg(!1),a=xr(()=>{i(!0)},[]),l=xr(()=>{i(!1)},[]),m=xr(()=>{o.layer&&o.close();let s=r.current;if(s===null)return;let c=[{icon:jm,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:Ym,title:"\u4E2D\u592E\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"center"})}},{icon:Jm,title:"\u53F3\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"right"})}}];o.open(()=>de(Oe,{dest:s,items:c,close:o.close}))},[]);return Zm(Om,{ref:r,contentEditable:!1,onClick:m,onMouseEnter:a,onMouseLeave:l,children:[de(Vm,{className:"--tile",children:de(uo,{})}),n?Zm(jg,{children:[de(so,{style:{top:0,left:"50%",marginLeft:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeColumn({at:e}),children:de(po,{})}),de(Ye,{style:{left:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e}),children:de(Je,{})}),de(Ye,{style:{right:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e,offset:1}),children:de(Je,{})})]}):null]})}import{useState as Yg}from"react";import{useSlateStatic as Jg}from"slate-react";import{Fragment as Zg,jsx as we,jsxs as tc}from"react/jsx-runtime";function oc({cellElement:e}){let t=Jg(),[o,r]=Yg(!1);return tc(Um,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[we(Km,{className:"--tile",children:we(uo,{})}),o?tc(Zg,{children:[we(so,{style:{top:"50%",left:"0.5em",marginTop:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeRow({at:e}),children:we(po,{})}),we(Ye,{style:{top:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e}),children:we(Je,{})}),we(Ye,{style:{bottom:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e,offset:1}),children:we(Je,{})})]}):null]})}import rc from"@emotion/styled";var nc=rc("div")`
1336
+ `;import{createContext as Kg}from"react";var co=Kg({isSelected:!1});import{jsx as Er}from"react/jsx-runtime";function jm({element:e,attributes:t,children:o}){let r=qg(),n=Gg();return _g(()=>{try{let i=Wg.findPath(r,e);lo(r,[e,i])}catch{}},[]),Er(co.Provider,{value:{isSelected:n},children:Er(Gm,{...t,columns:e.columns,children:Er("tbody",{children:o})})})}import{useContext as tb}from"react";import{useSelected as ob}from"slate-react";import{useCallback as xr,useRef as Qg,useState as Xg}from"react";import{useSlateStatic as jg}from"slate-react";import{jsx as ee}from"react/jsx-runtime";var Ze=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm.75-11.25a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5z",clipRule:"evenodd"})}),po=e=>ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"1em",height:"1em",...e,children:ee("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5z",clipRule:"evenodd"})}),uo=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Ym=()=>ee(y,{children:ee("path",{d:"M4 6h16M4 12h10M4 18h14"})}),Jm=()=>ee(y,{children:ee("path",{d:"M4 6h16M8 12h8M6 18h12"})}),Zm=()=>ee(y,{children:ee("path",{d:"M4 6h16M10 12h10M6 18h14"})});import{Fragment as Yg,jsx as de,jsxs as ec}from"react/jsx-runtime";function tc({cellElement:e}){let t=jg(),o=O("column-menu"),r=Qg(null),[n,i]=Xg(!1),a=xr(()=>{i(!0)},[]),l=xr(()=>{i(!1)},[]),m=xr(()=>{o.layer&&o.close();let s=r.current;if(s===null)return;let c=[{icon:Ym,title:"\u5DE6\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"left"})}},{icon:Jm,title:"\u4E2D\u592E\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"center"})}},{icon:Zm,title:"\u53F3\u63C3\u3048",action:()=>{t.tablePlugin.setTableColumnAlign({align:"right"})}}];o.open(()=>de(Ue,{dest:s,items:c,close:o.close}))},[]);return ec(Um,{ref:r,contentEditable:!1,onClick:m,onMouseEnter:a,onMouseLeave:l,children:[de(Km,{className:"--tile",children:de(uo,{})}),n?ec(Yg,{children:[de(so,{style:{top:0,left:"50%",marginLeft:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeColumn({at:e}),children:de(po,{})}),de(Je,{style:{left:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e}),children:de(Ze,{})}),de(Je,{style:{right:"-0.5em",top:0},onMouseDown:()=>t.tablePlugin.insertColumn({at:e,offset:1}),children:de(Ze,{})})]}):null]})}import{useState as Jg}from"react";import{useSlateStatic as Zg}from"slate-react";import{Fragment as eb,jsx as Ie,jsxs as oc}from"react/jsx-runtime";function rc({cellElement:e}){let t=Zg(),[o,r]=Jg(!1);return oc(Fm,{contentEditable:!1,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[Ie(_m,{className:"--tile",children:Ie(uo,{})}),o?oc(eb,{children:[Ie(so,{style:{top:"50%",left:"0.5em",marginTop:"-0.5em"},onMouseDown:()=>t.tablePlugin.removeRow({at:e}),children:Ie(po,{})}),Ie(Je,{style:{top:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e}),children:Ie(Ze,{})}),Ie(Je,{style:{bottom:"-0.5em",left:"0.5em"},onMouseDown:()=>t.tablePlugin.insertRow({at:e,offset:1}),children:Ie(Ze,{})})]}):null]})}import nc from"@emotion/styled";var ic=nc("div")`
1334
1337
  position: absolute;
1335
1338
  /**
1336
1339
  * very slightly shaded
@@ -1362,7 +1365,7 @@
1362
1365
  background: rgba(0, 0, 0, 0.15);
1363
1366
  }
1364
1367
  }
1365
- `,ic=rc("div")`
1368
+ `,ac=nc("div")`
1366
1369
  position: absolute;
1367
1370
  left: 0;
1368
1371
  top: 0;
@@ -1370,8 +1373,8 @@
1370
1373
  height: 1.5em;
1371
1374
  background: rgba(0, 0, 0, 0.05);
1372
1375
  border-radius: 50%;
1373
- `;import{jsx as ac}from"react/jsx-runtime";function lc(){return ac(nc,{contentEditable:!1,children:ac(ic,{className:"--table-menu-tile"})})}import{jsx as yr,jsxs as ob}from"react/jsx-runtime";function sc({element:e,attributes:t,children:o}){let r=eb(co),n=tb(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return ob(qm,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?yr(lc,{}):null,a?yr(oc,{cellElement:e}):null,l?yr(ec,{cellElement:e}):null]})}import{jsx as rb}from"react/jsx-runtime";function mc({attributes:e,children:t}){return rb(Qm,{...e,children:t})}import{jsx as nb}from"react/jsx-runtime";function cc({attributes:e,children:t}){return nb(Gm,{...e,children:t})}import{jsx as fo}from"react/jsx-runtime";function pc({element:e,attributes:t,children:o}){switch(e.type){case"table":return fo(Xm,{element:e,attributes:t,children:o});case"table-row":return fo(cc,{element:e,attributes:t,children:o});case"table-cell":return fo(sc,{element:e,attributes:t,children:o});case"table-content":return fo(mc,{element:e,attributes:t,children:o})}}var dc=v((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=$m(e),o({name:"table",editor:{deleteBackward:()=>Me(e,"table-cell"),deleteForward:()=>mi(e,"table-cell"),deleteFragment:()=>gm(e,["table-cell"]),insertBreak:()=>E(e,"table-cell")?(e.insertText(`
1374
- `),!0):!1,isMaster(r){if(r.type==="table")return!0},normalizeNode:r=>{let[n]=r;if(!ib.isElement(n))return!1;switch(n.type){case"table":return lo(e,r);case"table-cell":return Hm(e,r)}return!1}},editableProps:{renderElement:pc,onKeyDown:N({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 mb}from"@emotion/react";import{css as ab}from"@emotion/react";var lb=`
1376
+ `;import{jsx as lc}from"react/jsx-runtime";function sc(){return lc(ic,{contentEditable:!1,children:lc(ac,{className:"--table-menu-tile"})})}import{jsx as yr,jsxs as rb}from"react/jsx-runtime";function mc({element:e,attributes:t,children:o}){let r=tb(co),n=ob(),i=r.isSelected&&e.x===0&&e.y===0,a=r.isSelected&&e.x===0,l=r.isSelected&&e.y===0;return rb(Qm,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?yr(sc,{}):null,a?yr(rc,{cellElement:e}):null,l?yr(tc,{cellElement:e}):null]})}import{jsx as nb}from"react/jsx-runtime";function cc({attributes:e,children:t}){return nb(Xm,{...e,children:t})}import{jsx as ib}from"react/jsx-runtime";function pc({attributes:e,children:t}){return ib(qm,{...e,children:t})}import{jsx as fo}from"react/jsx-runtime";function dc({element:e,attributes:t,children:o}){switch(e.type){case"table":return fo(jm,{element:e,attributes:t,children:o});case"table-row":return fo(pc,{element:e,attributes:t,children:o});case"table-cell":return fo(mc,{element:e,attributes:t,children:o});case"table-content":return fo(cc,{element:e,attributes:t,children:o})}}var uc=v((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=Hm(e),o({name:"table",editor:{deleteBackward:()=>Pe(e,"table-cell"),deleteForward:()=>mi(e,"table-cell"),deleteFragment:()=>bm(e,["table-cell"]),insertBreak:()=>x(e,"table-cell")?(e.insertText(`
1377
+ `),!0):!1,isMaster(r){if(r.type==="table")return!0},normalizeNode:r=>{let[n]=r;if(!ab.isElement(n))return!1;switch(n.type){case"table":return lo(e,r);case"table-cell":return Am(e,r)}return!1}},editableProps:{renderElement:dc,onKeyDown:H({tab:e.tablePlugin.tabForward,"shift+tab":e.tablePlugin.tabBackward,"shift+enter":e.tablePlugin.shiftEnterForward,down:e.tablePlugin.down,up:e.tablePlugin.up,"mod+a":e.tablePlugin.selectCell,"super+t":()=>e.tablePlugin.insertTable(3,2),"mod+shift+enter":()=>e.tablePlugin.insertRow({offset:0}),"mod+enter":()=>e.tablePlugin.insertRow({offset:1}),"super+[":()=>e.tablePlugin.insertColumn({offset:0}),"super+]":()=>e.tablePlugin.insertColumn({offset:1}),"super+backspace":e.tablePlugin.removeTable,"mod+backspace":e.tablePlugin.removeRow,"mod+shift+backspace":e.tablePlugin.removeColumn})}})));import{Global as cb}from"@emotion/react";import{css as lb}from"@emotion/react";var sb=`
1375
1378
  --blue-50: rgb(239 246 255);
1376
1379
  --blue-100: rgb(219 234 254);
1377
1380
  --blue-200: rgb(191 219 254);
@@ -1382,7 +1385,7 @@
1382
1385
  --blue-700: rgb(29 78 216);
1383
1386
  --blue-800: rgb(30 64 175);
1384
1387
  --blue-900: rgb(30 58 138);
1385
- `,sb=`
1388
+ `,mb=`
1386
1389
  --shade-50: rgb(250 250 250);
1387
1390
  --shade-100: rgb(244 244 245);
1388
1391
  --shade-200: rgb(228 228 231);
@@ -1393,11 +1396,11 @@
1393
1396
  --shade-700: rgb(63 63 70);
1394
1397
  --shade-800: rgb(39 39 42);
1395
1398
  --shade-900: rgb(24 24 27);
1396
- `,uc=ab`
1399
+ `,fc=lb`
1397
1400
  :root {
1398
1401
  /* Tailwind Colors */
1399
- ${lb}
1400
1402
  ${sb}
1403
+ ${mb}
1401
1404
  /* Select Colors */
1402
1405
  --select-color: var(--blue-400);
1403
1406
  --select-editor-color: var(--blue-200);
@@ -1419,14 +1422,14 @@
1419
1422
  /* Horizontal Rule Colors */
1420
1423
  --hr-color: var(--shade-300);
1421
1424
  }
1422
- `;import{Fragment as cb,jsx as fc,jsxs as pb}from"react/jsx-runtime";var hc=v(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>pb(cb,{children:[fc(mb,{styles:uc}),fc(o,{...t})]}),editableProps:{}}));import{clsx as Xb}from"clsx";import{useCallback as jb,useRef as Yb}from"react";import{Editor as Jb,Transforms as Zb}from"slate";import{ReactEditor as eE,useFocused as tE,useSlateStatic as oE}from"slate-react";import{clsx as db}from"clsx";import{useCallback as xc,useRef as ub,useState as fb}from"react";import{ReactEditor as hb,useSlateStatic as gb}from"slate-react";import kr from"@emotion/styled";var gc=kr(Y)`
1425
+ `;import{Fragment as pb,jsx as hc,jsxs as db}from"react/jsx-runtime";var gc=v(e=>(e.theme=!0,{name:"theme",editor:{},renderEditable:({attributes:t,Editable:o})=>db(pb,{children:[hc(cb,{styles:fc}),hc(o,{...t})]}),editableProps:{}}));import{clsx as Yb}from"clsx";import{useCallback as Jb,useRef as Zb}from"react";import{Editor as eE,Transforms as tE}from"slate";import{ReactEditor as oE,useFocused as rE,useSlateStatic as nE}from"slate-react";import{clsx as ub}from"clsx";import{useCallback as yc,useRef as fb,useState as hb}from"react";import{ReactEditor as gb,useSlateStatic as bb}from"slate-react";import kr from"@emotion/styled";var bc=kr(Y)`
1423
1426
  padding: 0.5em;
1424
- `,bc=kr("div")`
1427
+ `,Ec=kr("div")`
1425
1428
  display: grid;
1426
1429
  grid-template-columns: repeat(5, 1.75em);
1427
1430
  grid-template-rows: 1.5em;
1428
1431
  /* grid-gap: 1px; */
1429
- `,Ec=kr("div")`
1432
+ `,xc=kr("div")`
1430
1433
  background: var(--shade-100);
1431
1434
  height: 1.5em;
1432
1435
  border-radius: 0.125em;
@@ -1436,11 +1439,11 @@
1436
1439
  &.--selected {
1437
1440
  background: var(--blue-100);
1438
1441
  }
1439
- `;import{Fragment as bb,jsx as ho,jsxs as Eb}from"react/jsx-runtime";function yc(e){return[...Array(e).keys()]}function kc({dest:e,close:t}){let[o,r]=fb({x:0,y:0}),n=gb(),i=ub(null),a=j({src:i,dest:e},({dest:d})=>d?{left:d.left-8,top:d.top+d.height}:{left:0,top:0}),l=yc(5).map(d=>d+1),m=yc(5).map(d=>d+1),s=xc((d,p)=>{r({x:d,y:p})},[r]),c=xc((d,p)=>{n.tablePlugin.insertTable(d,p),hb.focus(n),t()},[n]);return Eb(bb,{children:[ho(ye,{close:t}),ho(gc,{ref:i,style:a,children:ho(bc,{onMouseLeave:()=>s(0,0),children:l.map(d=>m.map(p=>{let u=p<=o.x&&d<=o.y;return ho(Ec,{className:db({"--selected":u}),onMouseEnter:()=>s(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import{useEffect as Fb,useRef as Vb,useState as Kb}from"react";import{useSlateStatic as _b}from"slate-react";import{jsx as b,jsxs as Ze}from"react/jsx-runtime";var vc=()=>b(y,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),Tc=()=>b(y,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),wc=()=>b(y,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),Ic=()=>b(y,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Mc=()=>b(y,{children:b("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Pc=()=>b(y,{children:b("path",{d:"M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})});var Cc=()=>b(y,{children:b("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),vr=()=>b(y,{children:b("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),Sc=()=>b(y,{children:b("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var go=()=>Ze(y,{children:[b("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),b("path",{d:"M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5"})]});var Tr=()=>b(y,{children:b("path",{d:"M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5"})}),Rc=()=>Ze(y,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var Lc=()=>b(y,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Bc=()=>Ze(y,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),zc=()=>b(y,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),Dc=()=>b(y,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Nc=()=>Ze(y,{children:[b("path",{d:"M15 8h.01"}),b("rect",{x:4,y:4,width:16,height:16,rx:3}),b("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),b("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var $c=()=>b(y,{children:b("path",{d:"M12 5v14M5 12h14"})}),Hc=()=>b(y,{children:b("path",{d:"M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5"})}),Ac=()=>b(y,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Oc=()=>Ze(y,{children:[b("path",{d:"m9 11 3 3 8-8"}),b("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),wr=()=>b(y,{children:b("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),Uc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Fc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Vc=()=>b(y,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),Kc=()=>Ze(y,{children:[b("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),b("path",{d:"M13.5 6.5l4 4"}),b("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),_c=()=>b(y,{children:b("path",{d:"M5 12h14"})});var Ir=[{icon:Uc,title:h("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Fc,title:h("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],Wc=[{icon:Cc,title:h("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:Ic,title:h("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Mc,title:h("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Pc,title:h("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Gc=[...Wc],Mr=[{icon:vc,title:h("paragraphStyle"),more:!0,children:Wc}];import{useState as ue,useRef as Qc,useEffect as yb,useCallback as Pr}from"react";import{useSlateStatic as kb}from"slate-react";import xb from"@emotion/styled";var qc=xb(Y)`
1442
+ `;import{Fragment as Eb,jsx as ho,jsxs as xb}from"react/jsx-runtime";function kc(e){return[...Array(e).keys()]}function vc({dest:e,close:t}){let[o,r]=hb({x:0,y:0}),n=bb(),i=fb(null),a=j({src:i,dest:e},({dest:d})=>d?{left:d.left-8,top:d.top+d.height}:{left:0,top:0}),l=kc(5).map(d=>d+1),m=kc(5).map(d=>d+1),s=yc((d,p)=>{r({x:d,y:p})},[r]),c=yc((d,p)=>{n.tablePlugin.insertTable(d,p),gb.focus(n),t()},[n]);return xb(Eb,{children:[ho(ye,{close:t}),ho(bc,{ref:i,style:a,children:ho(Ec,{onMouseLeave:()=>s(0,0),children:l.map(d=>m.map(p=>{let u=p<=o.x&&d<=o.y;return ho(xc,{className:ub({"--selected":u}),onMouseEnter:()=>s(p,d),onClick:()=>c(p,d)},`${p},${d}`)}))})})]})}import{useEffect as Kb,useRef as _b,useState as Wb}from"react";import{useSlateStatic as Gb}from"slate-react";import{jsx as b,jsxs as et}from"react/jsx-runtime";var Tc=()=>b(y,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),wc=()=>b(y,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),Ic=()=>b(y,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),Mc=()=>b(y,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Pc=()=>b(y,{children:b("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Cc=()=>b(y,{children:b("path",{d:"M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})});var Sc=()=>b(y,{children:b("path",{d:"M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z"})}),vr=()=>b(y,{children:b("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7"})}),Rc=()=>b(y,{children:b("path",{d:"M11 5h6M7 19h6M14 5l-4 14"})});var go=()=>et(y,{children:[b("path",{d:"M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5"}),b("path",{d:"M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5"})]});var Tr=()=>b(y,{children:b("path",{d:"M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5"})}),Lc=()=>et(y,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var zc=()=>b(y,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Bc=()=>et(y,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),Dc=()=>b(y,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),$c=()=>b(y,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Nc=()=>et(y,{children:[b("path",{d:"M15 8h.01"}),b("rect",{x:4,y:4,width:16,height:16,rx:3}),b("path",{d:"m4 15 4-4a3 5 0 0 1 3 0l5 5"}),b("path",{d:"m14 14 1-1a3 5 0 0 1 3 0l2 2"})]});var Hc=()=>b(y,{children:b("path",{d:"M12 5v14M5 12h14"})}),Ac=()=>b(y,{children:b("path",{d:"M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5"})}),Oc=()=>b(y,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Uc=()=>et(y,{children:[b("path",{d:"m9 11 3 3 8-8"}),b("path",{d:"M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9"})]}),wr=()=>b(y,{children:b("path",{d:"M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6"})}),Fc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Vc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Kc=()=>b(y,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),_c=()=>et(y,{children:[b("path",{d:"M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4"}),b("path",{d:"M13.5 6.5l4 4"}),b("path",{d:"m14 19 6-6M18 15l2 2M5 21h4"})]}),Wc=()=>b(y,{children:b("path",{d:"M5 12h14"})});var Ir=[{icon:Fc,title:h("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Vc,title:h("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],Gc=[{icon:Sc,title:h("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:Mc,title:h("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Pc,title:h("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Cc,title:h("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],qc=[...Gc],Mr=[{icon:Tc,title:h("paragraphStyle"),more:!0,children:Gc}];import{useState as ue,useRef as Xc,useEffect as kb,useCallback as Pr}from"react";import{useSlateStatic as vb}from"slate-react";import yb from"@emotion/styled";var Qc=yb(Y)`
1440
1443
  width: 18em;
1441
1444
  padding: 0;
1442
1445
  overflow: hidden;
1443
- `;import{Fragment as vb,jsx as $,jsxs as F}from"react/jsx-runtime";function Xc({dest:e,close:t}){let o=kb(),r=Qc(null),n=Qc(null),[i,a]=ue({x:0,y:0}),l=Pr((R,V)=>{a(he=>({x:he.x+R,y:he.y+V}))},[]),m=o.wysimark?.imageDialogState,s=!!o.wysimark?.onImageChange,c=!!o.wysimark?.onFileSelect,d=m?.imageSource??(c?"select":s?"file":"url"),[p,u]=ue(m?.url??""),[g,w]=ue(m?.alt??""),[P,S]=ue(m?.title??""),[M,H]=ue(!1),[I,A]=ue(d),[k,x]=ue(!1),[T,L]=ue(m?.uploadedUrl??""),C=R=>{A(R),L(""),fe("")},[se,fe]=ue(""),Mp=Pr(R=>{let V=R.target.value;w(V),M||S(V)},[M]),Pp=Pr(R=>{S(R.target.value),H(!0)},[]);yb(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:p,alt:g,title:P,imageSource:I,uploadedUrl:T})},[o,p,g,P,I,T]);let Hr=()=>{o.wysimark&&(o.wysimark.imageDialogState=void 0)},yo=j({src:r,dest:e},({src:R,dest:V},he)=>Ht(R,he,{left:V.left-16,top:V.top+V.height},{margin:16})),Cp={...yo,left:yo.left+i.x,top:yo.top+i.y};function Sp(R){R.preventDefault();let V=I==="file"||I==="select"?T:p;V.trim()!==""&&(o.image.insertImageFromUrl(V,g,P),Hr(),t())}function Rp(){Hr(),t()}async function Lp(R){let V=R.target.files?.[0];if(!(!V||!o.wysimark?.onImageChange)){fe(V.name),x(!0);try{let he=await o.wysimark.onImageChange(V);L(he)}catch(he){}finally{x(!1)}}}function Bp(){n.current?.click()}async function zp(){if(o.wysimark?.onFileSelect){x(!0);try{let R=await o.wysimark.onFileSelect();R&&L(R)}catch(R){}finally{x(!1)}}}let ko=I==="file"||I==="select"?T.trim()===""||k:p.trim()==="";return F(vb,{children:[$(ye,{close:t}),F(qc,{ref:r,style:Cp,children:[$(ve,{onDrag:l}),F("form",{onSubmit:R=>{Sp(R)},style:{padding:"8px"},children:[(s||c)&&F("div",{style:{marginBottom:"12px"},children:[c&&F("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[$("input",{type:"radio",name:"imageSource",value:"select",checked:I==="select",onChange:()=>C("select"),style:{marginRight:"4px"}}),h("imageSourceSelect")]}),s&&F("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[$("input",{type:"radio",name:"imageSource",value:"file",checked:I==="file",onChange:()=>C("file"),style:{marginRight:"4px"}}),h("imageSourceFile")]}),F("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[$("input",{type:"radio",name:"imageSource",value:"url",checked:I==="url",onChange:()=>C("url"),style:{marginRight:"4px"}}),h("imageSourceUrl")]})]}),I==="url"?F("div",{style:{marginBottom:"8px"},children:[$("label",{style:{display:"block",marginBottom:"4px"},children:h("imageUrlRequired")}),$("input",{type:"text",value:p,onChange:R=>u(R.target.value),style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:"https://example.com/image.jpg"})]}):I==="select"?F("div",{style:{marginBottom:"8px"},children:[$("button",{type:"button",onClick:()=>{zp()},disabled:k,style:{padding:"8px 16px",backgroundColor:k?"#ccc":"#0078d4",color:k?"#666":"white",border:"none",borderRadius:"4px",cursor:k?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:k?h("uploading"):h("imageSourceSelect")}),T&&$("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:F("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",h("uploadComplete")]})})]}):F("div",{style:{marginBottom:"8px"},children:[$("input",{ref:n,type:"file",accept:"image/*",onChange:R=>{Lp(R)},style:{display:"none"}}),$("button",{type:"button",onClick:Bp,disabled:k,style:{padding:"8px 16px",backgroundColor:k?"#ccc":"#0078d4",color:k?"#666":"white",border:"none",borderRadius:"4px",cursor:k?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:k?h("uploading"):h("selectFile")}),T&&F("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:[F("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",h("uploadComplete")]}),se&&$("div",{style:{fontSize:"12px",color:"var(--shade-500)"},children:se})]})]}),F("div",{style:{marginBottom:"8px"},children:[$("label",{style:{display:"block",marginBottom:"4px"},children:h("altText")}),$("input",{type:"text",value:g,onChange:Mp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageDescription")})]}),F("div",{style:{marginBottom:"8px"},children:[$("label",{style:{display:"block",marginBottom:"4px"},children:h("title")}),$("input",{type:"text",value:P,onChange:Pp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageTitle")})]}),F("div",{style:{display:"flex",gap:"8px"},children:[$("button",{type:"submit",disabled:ko,style:{display:"flex",alignItems:"center",padding:"8px 16px",backgroundColor:ko?"#ccc":"#0078d4",color:"white",border:"none",borderRadius:"4px",cursor:ko?"not-allowed":"pointer",fontWeight:"bold"},children:h("register")}),$("button",{type:"button",onClick:Rp,style:{padding:"8px 16px",backgroundColor:"var(--shade-100)",color:"var(--shade-700)",border:"1px solid var(--shade-300)",borderRadius:"4px",cursor:"pointer"},children:h("cancel")})]})]})]})]})}import{isHotkey as Tb}from"is-hotkey";import{useCallback as bo,useMemo as wb,useRef as Ib,useState as yt}from"react";import{Editor as Mb,Range as Pb}from"slate";import{ReactEditor as Cb,useSlateStatic as Sb}from"slate-react";import jc from"@emotion/styled";var Cr=jc("div")`
1446
+ `;import{Fragment as Tb,jsx as A,jsxs as F}from"react/jsx-runtime";function jc({dest:e,close:t}){let o=vb(),r=Xc(null),n=Xc(null),[i,a]=ue({x:0,y:0}),l=Pr((R,V)=>{a(he=>({x:he.x+R,y:he.y+V}))},[]),m=o.wysimark?.imageDialogState,s=!!o.wysimark?.onImageChange,c=!!o.wysimark?.onFileSelect,d=m?.imageSource??(s?"file":c?"select":"url"),[p,u]=ue(m?.url??""),[g,T]=ue(m?.alt??""),[S,L]=ue(m?.title??""),[M,N]=ue(!1),[w,z]=ue(d),[I,E]=ue(!1),[k,P]=ue(m?.uploadedUrl??""),C=R=>{z(R),P(""),fe("")},[se,fe]=ue(""),Pp=Pr(R=>{let V=R.target.value;T(V),M||L(V)},[M]),Cp=Pr(R=>{L(R.target.value),N(!0)},[]);kb(()=>{o.wysimark&&(o.wysimark.imageDialogState={url:p,alt:g,title:S,imageSource:w,uploadedUrl:k})},[o,p,g,S,w,k]);let Hr=()=>{o.wysimark&&(o.wysimark.imageDialogState=void 0)},yo=j({src:r,dest:e},({src:R,dest:V},he)=>ke(R,he,{left:V.left-16,top:V.top+V.height},{margin:16})),Sp={...yo,left:yo.left+i.x,top:yo.top+i.y};function Rp(R){R.preventDefault();let V=w==="file"||w==="select"?k:p;V.trim()!==""&&(o.image.insertImageFromUrl(V,g,S),Hr(),t())}function Lp(){Hr(),t()}async function zp(R){let V=R.target.files?.[0];if(!(!V||!o.wysimark?.onImageChange)){fe(V.name),E(!0);try{let he=await o.wysimark.onImageChange(V);P(he)}catch(he){}finally{E(!1)}}}function Bp(){n.current?.click()}async function Dp(){if(o.wysimark?.onFileSelect){E(!0);try{let R=await o.wysimark.onFileSelect();R&&P(R)}catch(R){}finally{E(!1)}}}let ko=w==="file"||w==="select"?k.trim()===""||I:p.trim()==="";return F(Tb,{children:[A(ye,{close:t}),F(Qc,{ref:r,style:Sp,children:[A(Te,{onDrag:l}),F("form",{onSubmit:R=>{Rp(R)},style:{padding:"8px"},children:[(s||c)&&F("div",{style:{marginBottom:"12px"},children:[s&&F("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"file",checked:w==="file",onChange:()=>C("file"),style:{marginRight:"4px"}}),h("imageSourceFile")]}),c&&F("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"select",checked:w==="select",onChange:()=>C("select"),style:{marginRight:"4px"}}),h("imageSourceSelect")]}),F("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"url",checked:w==="url",onChange:()=>C("url"),style:{marginRight:"4px"}}),h("imageSourceUrl")]})]}),w==="url"?F("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("imageUrlRequired")}),A("input",{type:"text",value:p,onChange:R=>u(R.target.value),style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:"https://example.com/image.jpg"})]}):w==="select"?F("div",{style:{marginBottom:"8px"},children:[A("button",{type:"button",onClick:()=>{Dp()},disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("imageSourceSelect")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:F("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",h("uploadComplete")]})})]}):F("div",{style:{marginBottom:"8px"},children:[A("input",{ref:n,type:"file",accept:"image/*",onChange:R=>{zp(R)},style:{display:"none"}}),A("button",{type:"button",onClick:Bp,disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("selectFile")}),k&&F("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:[F("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",h("uploadComplete")]}),se&&A("div",{style:{fontSize:"12px",color:"var(--shade-500)"},children:se})]})]}),F("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("altText")}),A("input",{type:"text",value:g,onChange:Pp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageDescription")})]}),F("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("title")}),A("input",{type:"text",value:S,onChange:Cp,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageTitle")})]}),F("div",{style:{display:"flex",gap:"8px"},children:[A("button",{type:"submit",disabled:ko,style:{display:"flex",alignItems:"center",padding:"8px 16px",backgroundColor:ko?"#ccc":"#0078d4",color:"white",border:"none",borderRadius:"4px",cursor:ko?"not-allowed":"pointer",fontWeight:"bold"},children:h("register")}),A("button",{type:"button",onClick:Lp,style:{padding:"8px 16px",backgroundColor:"var(--shade-100)",color:"var(--shade-700)",border:"1px solid var(--shade-300)",borderRadius:"4px",cursor:"pointer"},children:h("cancel")})]})]})]})]})}import{isHotkey as wb}from"is-hotkey";import{useCallback as bo,useMemo as Ib,useRef as Mb,useState as kt}from"react";import{Editor as Pb,Range as Cb}from"slate";import{ReactEditor as Sb,useSlateStatic as Rb}from"slate-react";import Yc from"@emotion/styled";var Cr=Yc("div")`
1444
1447
  /* Center vertically and horizontally */
1445
1448
  display: flex;
1446
1449
  align-items: center;
@@ -1464,9 +1467,9 @@
1464
1467
  font-size: 1.25em;
1465
1468
  stroke-width: 2px;
1466
1469
  }
1467
- `,Yc=jc("div")`
1470
+ `,Jc=Yc("div")`
1468
1471
  font-size: 0.875em;
1469
1472
  margin-top: 0.5em;
1470
1473
  color: var(--shade-500);
1471
1474
  line-height: 1.375;
1472
- `;import{Fragment as Lb,jsx as te,jsxs as kt}from"react/jsx-runtime";var Rb=Tb("enter");function Jc({dest:e,close:t}){let o=Sb(),r=Ib(null),[n,i]=yt({x:0,y:0}),a=bo((x,T)=>{i(L=>({x:L.x+x,y:L.y+T}))},[]),l=j({src:r,dest:e},({src:x,dest:T},L)=>!x||!T?{left:0,top:0}:Ht(x,L,{left:T.left-12,top:T.top+T.height},{margin:16})),m={...l,left:l.left+n.x,top:l.top+n.y},s=wb(()=>{let{selection:x}=o;return x&&!Pb.isCollapsed(x)?Mb.string(o,x):""},[]),[c,d]=yt(""),[p,u]=yt(s),[g,w]=yt(s),[P,S]=yt(!1),M=()=>{let x=p.trim()||c,T=g.trim()||void 0;o.anchor.insertLink(c,x,{select:!0,title:T}),Cb.focus(o),t()},H=bo(x=>{d(x.currentTarget.value)},[d]),I=bo(x=>{let T=x.currentTarget.value;u(T),P||w(T)},[u,w,P]),A=bo(x=>{w(x.currentTarget.value),S(!0)},[w]),k=x=>{Rb(x)&&(x.preventDefault(),x.stopPropagation(),M())};return kt(Lb,{children:[te(ye,{close:t}),kt(Oi,{ref:r,style:m,children:[te(ve,{onDrag:a}),kt("div",{style:{padding:"0.75em"},children:[te(At,{children:te(Ot,{type:"text",value:c,autoFocus:!0,placeholder:h("linkUrl"),onChange:H,onKeyDown:k})}),te(At,{style:{marginTop:"0.5em"},children:te(Ot,{type:"text",value:p,placeholder:h("linkText"),onChange:I,onKeyDown:k})}),kt(At,{style:{marginTop:"0.5em"},children:[te(Ot,{type:"text",value:g,placeholder:h("tooltipText"),onChange:A,onKeyDown:k}),kt(Cr,{onClick:M,children:[te(go,{}),te(wc,{})]}),te(Cr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:te(Vc,{})})]}),te(Yc,{children:h("tooltipHint")})]})]})]})}var Sr=[{icon:go,title:h("insertLink"),more:!0,hotkey:"mod+k",Component:Jc},{icon:Nc,title:h("insertImageFromUrl"),more:!0,Component:Xc},{icon:Bc,title:h("insertTable"),more:!0,Component:kc},{icon:_c,title:h("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Zc=Sr,ep=Sr,tp=[{icon:$c,title:h("insert"),more:!0,children:Sr}];import{Editor as Bb}from"slate";function et(e){let t=Bb.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 op=[{icon:vr,title:h("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>et(e).bold},{icon:Sc,title:h("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>et(e).italic},{icon:Hc,title:h("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>et(e).strike},{icon:zc,title:h("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>et(e).code},{icon:Ac,title:h("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>et(e).underline},{icon:Kc,title:h("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>et(e).highlight,show:e=>!e.wysimark.disableHighlight}],Rr=op,rp=[{icon:vr,title:h("format"),more:!0,children:op}];var np=[{icon:Lc,title:h("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:wr,title:h("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:Oc,title:h("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Lr=[...np,"divider",...Ir],ip=[{icon:wr,title:h("list"),more:!0,children:[...np,"divider",...Ir]}];import{Editor as ap,Transforms as Eo}from"slate";var lp=[{icon:Tr,title:h("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Rc,title:h("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:Dc,title:h("codeBlock"),action:e=>{let{selection:t}=e,o=E(e,"code-block");if(o){let[,r]=o,n=ap.string(e,r);Eo.removeNodes(e,{at:r}),Eo.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&JSON.stringify(t.anchor.path)!==JSON.stringify(t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&(t.anchor.offset!==t.focus.offset||JSON.stringify(t.anchor.path)!==JSON.stringify(t.focus.path))){let r=ap.string(e,t);Eo.delete(e),Eo.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}],Br=lp,sp=[{icon:Tr,title:h("quote"),more:!0,children:lp}];var zb=[...Gc,"divider",...Lr,"divider",...Rr,"divider",...Zc,"divider",...Br],Db=[...Mr,"divider",...Lr,"divider",...Rr,"divider",...ep,"divider",...Br],mp=[...Mr,"divider",...ip,"divider",...rp,"divider",...tp,"divider",...sp],cp=mp;var tt=[zb,Db,mp];import{clsx as Nb}from"clsx";import{useCallback as zr,useRef as $b}from"react";import{ReactEditor as Hb,useSlate as Ab,useSlateStatic as Ob}from"slate-react";import{jsx as xo,jsxs as Ub}from"react/jsx-runtime";function pp({item:e}){let t=Ob(),o=Ab(),r=e.active?e.active(o):!1,n=$b(null),i=J({title:e.title,hotkey:()=>e.hotkey?Nt(e.hotkey):void 0}),a=O("menu"),l=zr(()=>{let c=n.current,d=e.children,p=e.Component;c&&(d?a.open(()=>xo(Oe,{dest:c,items:d,close:a.close})):p&&a.open(()=>xo(p,{dest:c,close:a.close})))},[e]),m=zr(()=>{if(e.action){e.action(t),Hb.focus(t);return}a.layer?a.close():l()},[a.layer,e]),s=zr(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer]);return Ub(Yi,{"data-item-type":"button",ref:n,onMouseEnter:s,onMouseLeave:i.onMouseLeave,onClick:m,className:Nb({"--active":r&&!Bo(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Bo(e?.title)?.includes("Depth")}),children:[xo(e.icon,{}),e.more?xo(Tc,{}):null]})}import{jsx as ot}from"react/jsx-runtime";function Wb({item:e}){let t=_b();return e==="divider"?ot(Xi,{"data-item-type":"divider",children:ot(ji,{})}):(e.show===void 0?!0:e.show(t))?ot(pp,{item:e}):null}function Gb(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 qb(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var Qb=4;function dp(){let e=Vb(null),[t,o]=Kb(cp);return Fb(()=>{let r=e.current;if(!r)return;let n=()=>{let a=Gb(r);if(a){for(let l=0;l<tt.length-1;l++)if(qb(tt[l],a.button,a.divider)<a.toolbar-Qb){o(tt[l]);return}o(tt[tt.length-1])}},i=new ResizeObserver(n);return i.observe(r),()=>{i.disconnect()}},[]),ot(qi,{ref:e,children:ot(Qi,{children:t.map((r,n)=>ot(Wb,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Dr,jsxs as rE}from"react/jsx-runtime";function up({attributes:e,Editable:t}){let o=Yb(null),r=oE(),n=tE(),i=jb(a=>{a.target===a.currentTarget&&(Zb.select(r,Jb.end(r,[])),eE.focus(r))},[r]);return Dr(Bi,{children:rE(Ki,{ref:o,className:Xb({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Dr(dp,{}),Dr(t,{as:Vi,...e,style:{overflowY:"auto"}})]})})}var fp=v((e,t)=>(e.toolbar={height:t.toolbar?.height,minHeight:t.toolbar?.minHeight,maxHeight:t.toolbar?.maxHeight,showUploadButtons:t.toolbar?.showUploadButtons??!0},{name:"toolbar",editor:{},renderEditable:up,editableProps:{}}));import{Editor as Nr,Node as nE,Path as iE,Transforms as aE}from"slate";var hp=v(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!Nr.isEditor(t[0]))return!1;let o=[e.children.length-1],r=nE.child(e,e.children.length-1);return(Nr.hasBlocks(e,r)||Nr.isVoid(e,r))&&aE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:iE.next(o)}),!0}}}));import{Transforms as lE}from"slate";function sE(e,t){let o=ge(t),r=Ee(o);lE.insertNodes(e,r)}function gp(e){return{pasteMarkdown:f(sE,e)}}var bp=v(e=>(e.pasteMarkdown=gp(e),{name:"paste-markdown",editor:{},editableProps:{onPaste(t){let{types:o}=t.clipboardData;if(o.length!==1||o[0]!=="text/plain")return!1;let r=t.clipboardData.getData("text/plain");return e.pasteMarkdown.pasteMarkdown(r),Ie(t),!0}}}));import{jsx as cE}from"react/jsx-runtime";function mE(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return cE("span",{...t,children:e.children})}var Ep=v((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:mE}})));var xp=[bp,cs,ba,ys,mm,Rs,bl,Vl,Ql,dc,Ms,hp,nm,ka,dm,rs,hc,fp,fl,Ep];var pE=ri(xp),{withSink:yp,SinkEditable:kp}=pE;import{useState as dE}from"react";import{createEditor as uE,Editor as fE,Transforms as hE}from"slate";import{withHistory as gE}from"slate-history";import{withReact as bE}from"slate-react";function $r({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[m]=dE(()=>{let s=uE(),c=yp(bE(gE(s)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return c.convertElement.addConvertElementType("paragraph"),s.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0},s.getMarkdown=()=>lt(s.children),s.setMarkdown=d=>{let p=ge(d),u=Ee(p);s.children=u,s.selection=null,hE.select(s,fE.start(s,[0]))},c});return m}import{jsx as oe,jsxs as Tp}from"react/jsx-runtime";function TE({children:e,attributes:t}){return oe("span",{...t,children:e})}function wp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:m}){let[s,c]=vp(!1),[d,p]=vp(t),u=Tt(!1),g=Tt(void 0),w=Tt(void 0),P=Tt(null),S=Tt(o);S.current=o;let M=vt(EE(()=>{let C=lt(e.children);e.wysimark.prevValue={markdown:C,children:e.children},S.current(C)},r,{leading:!1,trailing:!0}),[e,r]),H=vt(()=>{w.current!==e.children&&(w.current=e.children,M())},[M]);if(!s){let C=P.current??t;if(P.current!==null&&(P.current=null),e.wysimark.prevValue==null||g.current==null){u.current=!0;let se=ge(C),fe=Ee(se);e.children=fe,w.current=g.current=fe,e.wysimark.prevValue={markdown:C,children:fe}}else if(C!==e.wysimark.prevValue.markdown){u.current=!0;let se=ge(C),fe=Ee(se);e.children=fe,e.selection=null,yE.select(e,xE.start(e,[0]))}}let I=vt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&kE.focus(e)},[e]),A=vt(()=>{M.flush()},[M]),k=C=>{let se=C.target.value;p(se),o(se)},x=vt(()=>{let C=e.getMarkdown();p(C)},[e]),T=()=>{s?(P.current=d,e.wysimark.prevValue=void 0,g.current=void 0,w.current=void 0):x(),c(!s)};e.wysimark.onImageChange=l,e.wysimark.onFileSelect=m,e.wysimark.onChange=o;let L=e.wysimark.disableRawMode;return Tp("div",{style:{position:"relative"},children:[!L&&oe("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:oe("div",{onClick:T,style:{background:"none",border:s?"1px solid #4a90e2":"1px solid transparent",cursor:"pointer",padding:"6px",borderRadius:"4px",backgroundColor:s?"rgba(74, 144, 226, 0.1)":"transparent",boxShadow:s?"0 1px 3px rgba(0, 0, 0, 0.1)":"none",transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center"},title:s?h("switchToVisualEditor"):h("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(T(),C.preventDefault())},children:Tp("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",fill:s?"rgba(74, 144, 226, 0.05)":"transparent"}),oe("path",{d:"M7 15V9L10 12L13 9V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 9H18V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 12H18",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),oe("div",{style:{display:s?"block":"none",textAlign:"center"},children:oe("textarea",{value:rt(d).replace(/&nbsp;/g,""),onChange:k,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"1rem",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),oe("div",{style:{display:s?"none":"block"},children:oe(vE,{editor:e,initialValue:g.current,onChange:H,children:oe(kp,{renderLeaf:TE,onMouseDown:I,onBlur:A,placeholder:n,className:i,style:a})})})]})}import{jsx as Ip}from"react/jsx-runtime";function RE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=CE(r.initialMarkdown||""),l=PE(i),m=$r(r);l.current=i,ME(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let s=IE(c=>{l.current=c,a(c),e?.(c)},[m]);return Ip(wp,{editor:m,value:i,className:o||"",onChange:s,placeholder:t})}function LA(e,t){let o=wE(),r=SE(e);return r.render(Ip(RE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{wp as Editable,LA as createWysimark,$r as useEditor};
1475
+ `;import{Fragment as zb,jsx as te,jsxs as vt}from"react/jsx-runtime";var Lb=wb("enter");function Zc({dest:e,close:t}){let o=Rb(),r=Mb(null),[n,i]=kt({x:0,y:0}),a=bo((E,k)=>{i(P=>({x:P.x+E,y:P.y+k}))},[]),l=j({src:r,dest:e},({src:E,dest:k},P)=>!E||!k?{left:0,top:0}:ke(E,P,{left:k.left-12,top:k.top+k.height},{margin:16})),m={...l,left:l.left+n.x,top:l.top+n.y},s=Ib(()=>{let{selection:E}=o;return E&&!Cb.isCollapsed(E)?Pb.string(o,E):""},[]),[c,d]=kt(""),[p,u]=kt(s),[g,T]=kt(s),[S,L]=kt(!1),M=()=>{let E=p.trim()||c,k=g.trim()||void 0;o.anchor.insertLink(c,E,{select:!0,title:k}),Sb.focus(o),t()},N=bo(E=>{d(E.currentTarget.value)},[d]),w=bo(E=>{let k=E.currentTarget.value;u(k),S||T(k)},[u,T,S]),z=bo(E=>{T(E.currentTarget.value),L(!0)},[T]),I=E=>{Lb(E)&&(E.preventDefault(),E.stopPropagation(),M())};return vt(zb,{children:[te(ye,{close:t}),vt(Oi,{ref:r,style:m,children:[te(Te,{onDrag:a}),vt("div",{style:{padding:"0.75em"},children:[te(At,{children:te(Ot,{type:"text",value:c,autoFocus:!0,placeholder:h("linkUrl"),onChange:N,onKeyDown:I})}),te(At,{style:{marginTop:"0.5em"},children:te(Ot,{type:"text",value:p,placeholder:h("linkText"),onChange:w,onKeyDown:I})}),vt(At,{style:{marginTop:"0.5em"},children:[te(Ot,{type:"text",value:g,placeholder:h("tooltipText"),onChange:z,onKeyDown:I}),vt(Cr,{onClick:M,children:[te(go,{}),te(Ic,{})]}),te(Cr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:te(Kc,{})})]}),te(Jc,{children:h("tooltipHint")})]})]})]})}var Sr=[{icon:go,title:h("insertLink"),more:!0,hotkey:"mod+k",Component:Zc},{icon:Nc,title:h("insertImageFromUrl"),more:!0,Component:jc},{icon:Bc,title:h("insertTable"),more:!0,Component:vc},{icon:Wc,title:h("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],ep=Sr,tp=Sr,op=[{icon:Hc,title:h("insert"),more:!0,children:Sr}];import{Editor as Bb}from"slate";function tt(e){let t=Bb.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 rp=[{icon:vr,title:h("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>tt(e).bold},{icon:Rc,title:h("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>tt(e).italic},{icon:Ac,title:h("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>tt(e).strike},{icon:Dc,title:h("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>tt(e).code},{icon:Oc,title:h("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>tt(e).underline},{icon:_c,title:h("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>tt(e).highlight,show:e=>!e.wysimark.disableHighlight}],Rr=rp,np=[{icon:vr,title:h("format"),more:!0,children:rp}];var ip=[{icon:zc,title:h("bulletList"),hotkey:"super+8",action:e=>e.list.convertUnorderedList(!0)},{icon:wr,title:h("numberedList"),hotkey:"super+7",action:e=>e.list.convertOrderedList(!0)},{icon:Uc,title:h("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Lr=[...ip,"divider",...Ir],ap=[{icon:wr,title:h("list"),more:!0,children:[...ip,"divider",...Ir]}];import{Editor as lp,Path as Db,Transforms as Eo}from"slate";var sp=[{icon:Tr,title:h("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Lc,title:h("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:$c,title:h("codeBlock"),action:e=>{let{selection:t}=e,o=x(e,"code-block");if(o){let[,r]=o,n=lp.string(e,r);Eo.removeNodes(e,{at:r}),Eo.insertNodes(e,{type:"paragraph",children:[{text:n}]},{at:r});return}if(t&&!Db.equals(t.anchor.path,t.focus.path)){e.codeBlock.createCodeBlock({language:"text"});return}if(t&&t.anchor.offset!==t.focus.offset){let r=lp.string(e,t);Eo.delete(e),Eo.insertNodes(e,{type:"code-block",language:"text",children:[{type:"code-block-line",children:[{text:r}]}]});return}e.codeBlock.createCodeBlock({language:"text"})},active:e=>!!x(e,"code-block"),show:e=>!e.wysimark.disableCodeBlock}],zr=sp,mp=[{icon:Tr,title:h("quote"),more:!0,children:sp}];var $b=[...qc,"divider",...Lr,"divider",...Rr,"divider",...ep,"divider",...zr],Nb=[...Mr,"divider",...Lr,"divider",...Rr,"divider",...tp,"divider",...zr],cp=[...Mr,"divider",...ap,"divider",...np,"divider",...op,"divider",...mp],pp=cp;var ot=[$b,Nb,cp];import{clsx as Hb}from"clsx";import{useCallback as Br,useRef as Ab}from"react";import{ReactEditor as Ob,useSlate as Ub,useSlateStatic as Fb}from"slate-react";import{jsx as xo,jsxs as Vb}from"react/jsx-runtime";function dp({item:e}){let t=Fb(),o=Ub(),r=e.active?e.active(o):!1,n=Ab(null),i=J({title:e.title,hotkey:()=>e.hotkey?Nt(e.hotkey):void 0}),a=O("menu"),l=Br(()=>{let c=n.current,d=e.children,p=e.Component;c&&(d?a.open(()=>xo(Ue,{dest:c,items:d,close:a.close})):p&&a.open(()=>xo(p,{dest:c,close:a.close})))},[e]),m=Br(()=>{if(e.action){e.action(t),Ob.focus(t);return}a.layer?a.close():l()},[a.layer,e]),s=Br(c=>{i.onMouseEnter(c),a.layer&&l()},[a.layer,l,i.onMouseEnter]);return Vb(Yi,{"data-item-type":"button",ref:n,onMouseEnter:s,onMouseLeave:i.onMouseLeave,onClick:m,className:Hb({"--active":r&&!zo(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&zo(e?.title)?.includes("Depth")}),children:[xo(e.icon,{}),e.more?xo(wc,{}):null]})}import{jsx as rt}from"react/jsx-runtime";function qb({item:e}){let t=Gb();return e==="divider"?rt(Xi,{"data-item-type":"divider",children:rt(ji,{})}):(e.show===void 0?!0:e.show(t))?rt(dp,{item:e}):null}function Qb(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 Xb(e,t,o){let r=0;for(let n of e)r+=n==="divider"?o:t;return r}var jb=4;function up(){let e=_b(null),[t,o]=Wb(pp);return Kb(()=>{let r=e.current;if(!r)return;let n=()=>{let a=Qb(r);if(a){for(let l=0;l<ot.length-1;l++)if(Xb(ot[l],a.button,a.divider)<a.toolbar-jb){o(ot[l]);return}o(ot[ot.length-1])}},i=new ResizeObserver(n);return i.observe(r),()=>{i.disconnect()}},[]),rt(qi,{ref:e,children:rt(Qi,{children:t.map((r,n)=>rt(qb,{item:r},typeof r=="string"?n:r.title))})})}import{jsx as Dr,jsxs as iE}from"react/jsx-runtime";function fp({attributes:e,Editable:t}){let o=Zb(null),r=nE(),n=rE(),i=Jb(a=>{a.target===a.currentTarget&&(tE.select(r,eE.end(r,[])),oE.focus(r))},[r]);return Dr(zi,{children:iE(Ki,{ref:o,className:Yb({"--focused":n}),style:{height:r.toolbar.height,minHeight:r.toolbar.minHeight,maxHeight:r.toolbar.maxHeight},onClick:i,children:[Dr(up,{}),Dr(t,{as:Vi,...e,style:{overflowY:"auto"}})]})})}var hp=v((e,t)=>(e.toolbar={height:t.toolbar?.height,minHeight:t.toolbar?.minHeight,maxHeight:t.toolbar?.maxHeight,showUploadButtons:t.toolbar?.showUploadButtons??!0},{name:"toolbar",editor:{},renderEditable:fp,editableProps:{}}));import{Editor as $r,Node as aE,Path as lE,Transforms as sE}from"slate";var gp=v(e=>(e.allowTrailingBlock=!0,{name:"trailing-block",editor:{normalizeNode:t=>{if(!$r.isEditor(t[0]))return!1;let o=[e.children.length-1],r=aE.child(e,e.children.length-1);return($r.hasBlocks(e,r)||$r.isVoid(e,r))&&sE.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:lE.next(o)}),!0}}}));import{Transforms as mE}from"slate";function cE(e,t){let o=ge(t),r=Ee(o);mE.insertNodes(e,r)}function bp(e){return{pasteMarkdown:f(cE,e)}}var Ep=v(e=>(e.pasteMarkdown=bp(e),{name:"paste-markdown",editor:{},editableProps:{onPaste(t){let{types:o}=t.clipboardData;if(o.length!==1||o[0]!=="text/plain")return!1;let r=t.clipboardData.getData("text/plain");return e.pasteMarkdown.pasteMarkdown(r),Me(t),!0}}}));import{jsx as dE}from"react/jsx-runtime";function pE(e){let t={...e.attributes,style:{...e.attributes.style,width:void 0,maxWidth:void 0}};return dE("span",{...t,children:e.children})}var xp=v((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:pE}})));var yp=[Ep,ps,Ea,ks,cm,Ls,El,Kl,Xl,uc,Ps,gp,im,va,um,ns,gc,hp,hl,xp];var uE=ri(yp),{withSink:kp,SinkEditable:vp}=uE;import{useState as fE}from"react";import{createEditor as hE,Editor as gE,Transforms as bE}from"slate";import{withHistory as EE}from"slate-history";import{withReact as xE}from"slate-react";function Nr({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[m]=fE(()=>{let s=hE(),c=kp(xE(EE(s)),{toolbar:{height:t,minHeight:o,maxHeight:r,showUploadButtons:!!e},image:{}});return c.convertElement.addConvertElementType("paragraph"),s.wysimark={disableRawMode:n??!0,disableTaskList:i,disableCodeBlock:a,disableHighlight:l??!0},s.getMarkdown=()=>st(s.children),s.setMarkdown=d=>{let p=ge(d),u=Ee(p);s.children=u,s.selection=null,bE.select(s,gE.start(s,[0]))},c});return m}import{jsx as oe,jsxs as wp}from"react/jsx-runtime";function IE({children:e,attributes:t}){return oe("span",{...t,children:e})}function Ip({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:m}){let[s,c]=Tp(!1),[d,p]=Tp(t),u=wt(!1),g=wt(void 0),T=wt(void 0),S=wt(null),L=wt(o);L.current=o;let M=Tt(yE(()=>{let C=st(e.children);e.wysimark.prevValue={markdown:C,children:e.children},L.current(C)},r,{leading:!1,trailing:!0}),[e,r]),N=Tt(()=>{T.current!==e.children&&(T.current=e.children,M())},[M]);if(!s){let C=S.current??t;if(S.current!==null&&(S.current=null),e.wysimark.prevValue==null||g.current==null){u.current=!0;let se=ge(C),fe=Ee(se);e.children=fe,T.current=g.current=fe,e.wysimark.prevValue={markdown:C,children:fe}}else if(C!==e.wysimark.prevValue.markdown){u.current=!0;let se=ge(C),fe=Ee(se);e.children=fe,e.selection=null,vE.select(e,kE.start(e,[0]))}}let w=Tt(()=>{navigator.userAgent.toLowerCase().includes("firefox")&&TE.focus(e)},[e]),z=Tt(()=>{M.flush()},[M]),I=C=>{let se=C.target.value;p(se),o(se)},E=Tt(()=>{let C=e.getMarkdown();p(C)},[e]),k=()=>{s?(S.current=d,e.wysimark.prevValue=void 0,g.current=void 0,T.current=void 0):E(),c(!s)};e.wysimark.onImageChange=l,e.wysimark.onFileSelect=m,e.wysimark.onChange=o;let P=e.wysimark.disableRawMode;return wp("div",{style:{position:"relative"},children:[!P&&oe("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:oe("div",{onClick:k,style:{background:"none",border:s?"1px solid #4a90e2":"1px solid transparent",cursor:"pointer",padding:"6px",borderRadius:"4px",backgroundColor:s?"rgba(74, 144, 226, 0.1)":"transparent",boxShadow:s?"0 1px 3px rgba(0, 0, 0, 0.1)":"none",transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center"},title:s?h("switchToVisualEditor"):h("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(k(),C.preventDefault())},children:wp("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",fill:s?"rgba(74, 144, 226, 0.05)":"transparent"}),oe("path",{d:"M7 15V9L10 12L13 9V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 9H18V15",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),oe("path",{d:"M16 12H18",stroke:s?"#4a90e2":"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),oe("div",{style:{display:s?"block":"none",textAlign:"center"},children:oe("textarea",{value:nt(d).replace(/&nbsp;/g,""),onChange:I,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"1rem",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),oe("div",{style:{display:s?"none":"block"},children:oe(wE,{editor:e,initialValue:g.current,onChange:N,children:oe(vp,{renderLeaf:IE,onMouseDown:w,onBlur:z,placeholder:n,className:i,style:a})})})]})}import{jsx as Mp}from"react/jsx-runtime";function zE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=RE(r.initialMarkdown||""),l=SE(i),m=Nr(r);l.current=i,CE(n,()=>({getMarkdown(){return l.current},setMarkdown(c){l.current=c,a(c)}}),[l,a]);let s=PE(c=>{l.current=c,a(c),e?.(c)},[m]);return Mp(Ip,{editor:m,value:i,className:o||"",onChange:s,placeholder:t})}function BA(e,t){let o=ME(),r=LE(e);return r.render(Mp(zE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Ip as Editable,BA as createWysimark,Nr as useEditor};