wysimark-lite 0.25.24 → 0.25.26

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,11 +1,11 @@
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 kp}from"react";import{Editor as kE,Transforms as vE}from"slate";import{ReactEditor as TE,Slate as wE}from"slate-react";import ad from"remark-parse";import{unified as ld}from"unified";function To(){return{enter:{table:zp,tableData:Ar,tableHeader:Ar,tableRow:Np},exit:{codeText:$p,table:Dp,tableData:vo,tableHeader:vo,tableRow:vo}}}function zp(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 Dp(e){this.exit(e),this.data.inTable=void 0}function Np(e){this.enter({type:"tableRow",children:[]},e)}function vo(e){this.exit(e)}function Ar(e){this.enter({type:"tableCell",children:[]},e)}function $p(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Hp));let o=this.stack[this.stack.length-1];o.type,o.value=t,this.exit(e)}function Hp(e,t){return t==="|"?t:e}import{gfm as Ap}from"micromark-extension-gfm";import{gfmToMarkdown as Op}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(Ap());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(Op())}}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=Fp(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 Up=new Set(["script","style"]);function Fp(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(Up.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=Kp(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=Vp(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 Vp(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 Kp(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:Ne(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}]`}]},...Ne(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 z(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 _p(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 Wp(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(_p).join("")}function Qr(e){return e.map(Wp).join("")}import{Text as Gp}from"slate";function at(e){let{text:t,...o}=e;return Object.keys(o)}function Io(e){if(Gp.isText(e)){if(z(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(z(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 qp=["\\","`","*","_","[","]","~","|","<"],Qp=new RegExp(`(${qp.map(e=>`\\${e}`).join("|")})`,"g");function Yr(e){let t=e.replace(Qp,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 Xp(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]:Xp(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 $e(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=$e(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=$e(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 Yp(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(...Jp(n,t));return tn(o)}function Jp(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 Yp(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 Zp(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 ed="\xA0";function td(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==ed)}function dn(e){let t=K(e.children);return Zp(t)?[{...t[1],type:"image-block"}]:td(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(od)}]}function od(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(rd)}}function rd(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 Ne(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 nd}from"mdast-util-definitions";import{SKIP as hn,visit as id}from"unist-util-visit";function gn(e){let t=nd(e);id(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 sd=ld().use(ad).use(Ur());function md(e){let t=sd.parse(e);return gn(t),t}function Ee(e){let t=md(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:Ne(t.children)}function cd(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(!cd(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 kp}from"react";import{Editor as kE,Transforms as vE}from"slate";import{ReactEditor as TE,Slate as wE}from"slate-react";import ad from"remark-parse";import{unified as ld}from"unified";function To(){return{enter:{table:zp,tableData:Ar,tableHeader:Ar,tableRow:$p},exit:{codeText:Np,table:Dp,tableData:vo,tableHeader:vo,tableRow:vo}}}function zp(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 Dp(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 Np(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Hp));let o=this.stack[this.stack.length-1];o.type,o.value=t,this.exit(e)}function Hp(e,t){return t==="|"?t:e}import{gfm as Ap}from"micromark-extension-gfm";import{gfmToMarkdown as Op}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(Ap());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(Op())}}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=Fp(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 Up=new Set(["script","style"]);function Fp(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(Up.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=Kp(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=Vp(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 Vp(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 Kp(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 z(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 _p(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 Wp(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(_p).join("")}function Qr(e){return e.map(Wp).join("")}import{Text as Gp}from"slate";function at(e){let{text:t,...o}=e;return Object.keys(o)}function Io(e){if(Gp.isText(e)){if(z(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(z(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 qp=["\\","`","*","_","[","]","~","|","<"],Qp=new RegExp(`(${qp.map(e=>`\\${e}`).join("|")})`,"g");function Yr(e){let t=e.replace(Qp,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 Xp(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]:Xp(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 Yp(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(...Jp(n,t));return tn(o)}function Jp(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 Yp(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 Zp(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 ed="\xA0";function td(e){return!(e.length!==1||!("text"in e[0])||e[0].text!==ed)}function dn(e){let t=K(e.children);return Zp(t)?[{...t[1],type:"image-block"}]:td(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(od)}]}function od(e){if(e.type!=="tableRow")throw new Error("Expected a tableRow");return{type:"table-row",children:e.children.map(rd)}}function rd(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=0;o<e.length;o++){if(o>0){let r=e[o-1],n=e[o];if(r.position&&n.position){let i=n.position.start.line-r.position.end.line-1;for(let a=1;a<i;a++)t.push({type:"paragraph",children:[{text:""}]})}}t.push(...Po(e[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 nd}from"mdast-util-definitions";import{SKIP as hn,visit as id}from"unist-util-visit";function gn(e){let t=nd(e);id(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 sd=ld().use(ad).use(Ur());function md(e){let t=sd.parse(e);return gn(t),t}function Ee(e){let t=md(e);return t.children.length===0?[{type:"paragraph",children:[{text:""}]}]:$e(t.children)}function cd(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(!cd(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}=$e(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 pd=[kn,vn,yn];function Pt(e){for(let t of pd){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}
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 pd=[kn,vn,yn];function Pt(e){for(let t of pd){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 gd,Text as bd}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 ud}from"slate";function Mn({node:e,nextNode:t,nodes:o,index:r}){return!U(e)||!z(e)||e.code||!U(t)||!z(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)&&z(n)?(e.children.splice(0,1),U(o)&&z(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)&&z(n)?(e.children.splice(e.children.length-1,1),U(o)&&z(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)||z(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)||!z(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)||!z(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 dd=72;function So(e,t){let o=!1,r,n=0,i=(e.length+1)*dd;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=>ud.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 hd}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 fd(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} "${fd(e.title)}")`:`[${G(e.children,t,t)}](${e.href})`}function On(e){return Yr(e.text)}function Un(e){if(hd.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=$n(e),n=[],i=Co(t,Io(r[0]));for(let a=0;a<r.length;a++){let l=r[a];if(bd.isText(l)&&z(l)){n.push(l.text);continue}n.push(qr(i.add)),n.push(Un(l));let m=Ed(r,a,o),s=Co(i.nextOrderedMarks,m);n.push(Qr(s.remove)),i=s}return n.join("")}function Ed(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!z(n)&&!(gd.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(xd(e.columns)),e.children.slice(1).forEach(o=>{t.push(Fn(o))}),`${t.join(`
8
+ `:""}import{Element as gd,Text as bd}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 ud}from"slate";function Mn({node:e,nextNode:t,nodes:o,index:r}){return!U(e)||!z(e)||e.code||!U(t)||!z(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)&&z(n)?(e.children.splice(0,1),U(o)&&z(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)&&z(n)?(e.children.splice(e.children.length-1,1),U(o)&&z(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)||z(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)||!z(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)||!z(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 dd=72;function So(e,t){let o=!1,r,n=0,i=(e.length+1)*dd;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=>ud.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 hd}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 fd(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} "${fd(e.title)}")`:`[${G(e.children,t,t)}](${e.href})`}function On(e){return Yr(e.text)}function Un(e){if(hd.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(bd.isText(l)&&z(l)){n.push(l.text);continue}n.push(qr(i.add)),n.push(Un(l));let m=Ed(r,a,o),s=Co(i.nextOrderedMarks,m);n.push(Qr(s.remove)),i=s}return n.join("")}function Ed(e,t,o){for(let r=t+1;r<e.length;r++){let n=e[r];if(!z(n)&&!(gd.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(xd(e.columns)),e.children.slice(1).forEach(o=>{t.push(Fn(o))}),`${t.join(`
9
9
  `)}
10
10
 
11
11
  `}function xd(e){return e.every(o=>o.align==="left")?`|${e.map(()=>"---").join("|")}|`:`|${e.map(o=>yd(o.align)).join("|")}|`}function yd(e){switch(e){case"left":return":---";case"center":return":---:";case"right":return"---:"}}function Fn(e){return It(e,"table-row"),`|${e.children.map(kd).join("|")}|`}function kd(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(vd).join("")}function vd(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(`
@@ -27,14 +27,14 @@
27
27
 
28
28
  `}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$/,`
29
29
 
30
- `)),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]},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 Pd,useMemo as ei}from"react";import{Editor as Cd}from"slate";import{useSlateStatic as Sd}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 Td}from"slate-react";import{jsx as wd}from"react/jsx-runtime";function Gn(e){let t=e.map(r=>r.renderEditable).filter(ie),o=r=>wd(Td,{...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 Id}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=Id(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 Md from"@emotion/styled";var mt=Md("div")`
30
+ `)),t.push(l)}let r=t.join("");return r.trim()===""?"":r.replace(/^\n+/,"").replace(/[\t\n\r ]+$/,"")}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]},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 Pd,useMemo as ei}from"react";import{Editor as Cd}from"slate";import{useSlateStatic as Sd}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 Td}from"slate-react";import{jsx as wd}from"react/jsx-runtime";function Gn(e){let t=e.map(r=>r.renderEditable).filter(ie),o=r=>wd(Td,{...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 Id}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=Id(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 Md from"@emotion/styled";var mt=Md("div")`
31
31
  -webkit-font-smoothing: antialiased;
32
32
  -moz-osx-font-smoothing: grayscale;
33
33
  font-size: 1rem;
34
34
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
35
35
  Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
36
36
  box-sizing: border-box;
37
- `;import{jsx as Rd}from"react/jsx-runtime";function ti(e){let t=Sd();Pd(()=>{Cd.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 Rd(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 se(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,m=[];for(let s of n){let c=s.editor?.[t]?.(...a);if(typeof c=="function")m.push(c);else if(c===!0){l=!0;break}}l||r(...a),m.forEach(s=>s())}}function 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:se(r,"normalizeNode",n),deleteBackward:se(r,"deleteBackward",n),deleteForward:se(r,"deleteForward",n),deleteFragment:se(r,"deleteFragment",n),insertBreak:se(r,"insertBreak",n),insertFragment:se(r,"insertFragment",n),insertNode:se(r,"insertNode",n),insertText:se(r,"insertText",n),isInline: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 Ld}from"slate";import{ReactEditor as Bd}from"slate-react";function ni(e,t){return Ld.isElement(t)?Bd.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 zd=/mac os x|macintosh/i,ct;function Lt(){if(ct!==void 0)return ct;try{let{userAgent:e}=window.navigator;ct=zd.test(e)}catch{ct=!1}return ct}function Me(e){e.preventDefault(),e.stopPropagation()}import{Editor as li,Path as Dd}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(Dd.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 Nd}from"react/jsx-runtime";var y=({strokeWidth:e=1.5,...t})=>Nd("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 $d}from"slate";function me(e){return e==null?!1:$d.isCollapsed(e)}import{Element as si}from"slate";function Bt(e){return Array.isArray(e)?t=>si.isElement(t)&&e.includes(t.type):t=>si.isElement(t)&&e==t.type}import{Editor as Hd}from"slate";function mi(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&Hd.isEnd(e,o.anchor,r[1])}import{Editor as B1}from"slate";import{Editor as Ad}from"slate";function Pe(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&Ad.isStart(e,o.anchor,r[1])}import{isHotkey as ci}from"is-hotkey";import{Editor as zo,Element as Od,Range as Ud,Transforms as Fd}from"slate";var Vd=ci(" "),Kd=ci("SHIFT+SPACE");function pi(e,t){return o=>{if(!Vd(o.nativeEvent)&&!Kd(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Ud.isExpanded(r))return!1;let n=x(e,s=>Od.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;Me(o);let m={anchor:zo.start(e,n[1]),focus:r.focus};return Fd.delete(e,{at:m}),l(),!0}}import{isHotkey as _d}from"is-hotkey";function di(e){let t=e.replace(/\bsuper\b/g,Lt()?"cmd+alt":"ctrl+shift");return _d(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 Wd,Transforms as ui}from"slate";function fi(e,t){Wd.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 Gd,Path as qd,Transforms as pt}from"slate";function yi(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Gd.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=qd.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 Qd,Transforms as Xd}from"slate";function zt(e,t,o){let r=Array.from(Qd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Xd.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 Yd,Node as Jd,Transforms as No}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(No.setNodes(e,{href:t,title:o},{at:l}),r!==void 0){let m=Jd.string(a);r!==m&&Yd.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 Dt,Element as Zd,Range as eu,Text as tu,Transforms as $o}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(eu.isCollapsed(i)){if($o.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);$o.select(e,a[1])}}else $o.wrapNodes(e,{type:"anchor",href:t,title:n,children:[]},{split:!0,match:a=>tu.isText(a)||Zd.isElement(a)&&Dt.isInline(e,a)})}import{Transforms as ou}from"slate";function Mi(e,{at:t}){let o=x(e,"anchor",{at:t});return o?(ou.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 ru}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 ru.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Yu}from"clsx";import{useEffect as Ju,useRef as ga}from"react";import{useSelected as Zu,useSlate as ef}from"slate-react";import{createContext as Li,useState as iu}from"react";import{createPortal as nu}from"react-dom";function Ri({children:e}){return typeof document>"u"||!document.body?null:nu(e,document.body)}import{jsx as Ho,jsxs as lu}from"react/jsx-runtime";var Ao=Li({}),au=Li({});function Bi({children:e}){let[t,o]=iu({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return lu(Ao.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Ho(Ri,{children:Ho(au.Provider,{value:i,children:Ho(i.Component,{})})},i.type))]})}import{useContext as su}from"react";function O(e){let{openLayer:t,closeLayer:o,layers:r}=su(Ao);function n(a){t({type:e,Component:a})}function i(){o(e)}return{open:n,close:i,layer:r[e],type:e}}import Nt from"@emotion/styled";var zi=Nt("a")`
37
+ `;import{jsx as Rd}from"react/jsx-runtime";function ti(e){let t=Sd();Pd(()=>{Cd.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 Rd(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 se(e,t,o){let r=e[t],n=o.filter(i=>i.editor?.[t]);return function(...a){let l=!1,m=[];for(let s of n){let c=s.editor?.[t]?.(...a);if(typeof c=="function")m.push(c);else if(c===!0){l=!0;break}}l||r(...a),m.forEach(s=>s())}}function 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:se(r,"normalizeNode",n),deleteBackward:se(r,"deleteBackward",n),deleteForward:se(r,"deleteForward",n),deleteFragment:se(r,"deleteFragment",n),insertBreak:se(r,"insertBreak",n),insertFragment:se(r,"insertFragment",n),insertNode:se(r,"insertNode",n),insertText:se(r,"insertText",n),isInline: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 Ld}from"slate";import{ReactEditor as Bd}from"slate-react";function ni(e,t){return Ld.isElement(t)?Bd.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 zd=/mac os x|macintosh/i,ct;function Lt(){if(ct!==void 0)return ct;try{let{userAgent:e}=window.navigator;ct=zd.test(e)}catch{ct=!1}return ct}function Me(e){e.preventDefault(),e.stopPropagation()}import{Editor as li,Path as Dd}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(Dd.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 $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 Nd}from"slate";function me(e){return e==null?!1:Nd.isCollapsed(e)}import{Element as si}from"slate";function Bt(e){return Array.isArray(e)?t=>si.isElement(t)&&e.includes(t.type):t=>si.isElement(t)&&e==t.type}import{Editor as Hd}from"slate";function mi(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&Hd.isEnd(e,o.anchor,r[1])}import{Editor as B1}from"slate";import{Editor as Ad}from"slate";function Pe(e,t){let{selection:o}=e;if(!me(o))return!1;let r=x(e,t,{at:o});return!!r&&Ad.isStart(e,o.anchor,r[1])}import{isHotkey as ci}from"is-hotkey";import{Editor as zo,Element as Od,Range as Ud,Transforms as Fd}from"slate";var Vd=ci(" "),Kd=ci("SHIFT+SPACE");function pi(e,t){return o=>{if(!Vd(o.nativeEvent)&&!Kd(o.nativeEvent))return!1;let{selection:r}=e;if(r===null||Ud.isExpanded(r))return!1;let n=x(e,s=>Od.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;Me(o);let m={anchor:zo.start(e,n[1]),focus:r.focus};return Fd.delete(e,{at:m}),l(),!0}}import{isHotkey as _d}from"is-hotkey";function di(e){let t=e.replace(/\bsuper\b/g,Lt()?"cmd+alt":"ctrl+shift");return _d(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 Wd,Transforms as ui}from"slate";function fi(e,t){Wd.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 Gd,Path as qd,Transforms as pt}from"slate";function yi(e,t,{at:o=e.selection}={}){if(o==null)return!1;let r=x(e,n=>Gd.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=qd.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 Qd,Transforms as Xd}from"slate";function zt(e,t,o){let r=Array.from(Qd.nodes(e,o));if(r.length===0)return!1;for(let n of r){let[i]=n;Xd.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 Yd,Node as Jd,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=Jd.string(a);r!==m&&Yd.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 Zd,Range as eu,Text as tu,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(eu.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=>tu.isText(a)||Zd.isElement(a)&&Dt.isInline(e,a)})}import{Transforms as ou}from"slate";function Mi(e,{at:t}){let o=x(e,"anchor",{at:t});return o?(ou.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 ru}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 ru.unwrapNodes(e,{at:[...t[1],r]}),!0}return!1}import{clsx as Yu}from"clsx";import{useEffect as Ju,useRef as ga}from"react";import{useSelected as Zu,useSlate as ef}from"slate-react";import{createContext as Li,useState as iu}from"react";import{createPortal as nu}from"react-dom";function Ri({children:e}){return typeof document>"u"||!document.body?null:nu(e,document.body)}import{jsx as Ho,jsxs as lu}from"react/jsx-runtime";var Ao=Li({}),au=Li({});function Bi({children:e}){let[t,o]=iu({});function r(i){o(a=>({...a,[i.type]:i}))}function n(i){o(a=>{let l={...a};return delete l[i],l})}return lu(Ao.Provider,{value:{layers:t,setLayers:o,openLayer:r,closeLayer:n},children:[e,Object.entries(t).map(([,i])=>Ho(Ri,{children:Ho(au.Provider,{value:i,children:Ho(i.Component,{})})},i.type))]})}import{useContext as su}from"react";function O(e){let{openLayer:t,closeLayer:o,layers:r}=su(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 zi=$t("a")`
38
38
  /**
39
39
  * Link colors
40
40
  */
@@ -53,10 +53,10 @@
53
53
  &.--selected {
54
54
  background: var(--blue-50);
55
55
  }
56
- `,Oo=Nt("span")`
56
+ `,Oo=$t("span")`
57
57
  display: inline;
58
58
  padding: 0 1px 0 0;
59
- `,HT=Nt("span")`
59
+ `,HT=$t("span")`
60
60
  position: fixed;
61
61
  width: 100px;
62
62
  background: var(--shade-50);
@@ -65,7 +65,7 @@
65
65
  border: 1px solid var(--shade-400);
66
66
  overflow: hidden;
67
67
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
68
- `,AT=Nt("span")`
68
+ `,AT=$t("span")`
69
69
  position: absolute;
70
70
  left: 0;
71
71
  top: 0;
@@ -81,7 +81,7 @@
81
81
  bottom: 0;
82
82
  overflow-y: auto;
83
83
  background: rgba(0, 0, 0, 0.01);
84
- `;import{jsx as pu}from"react/jsx-runtime";function ye({close:e}){let t=cu(null);return pu(Di,{ref:t,onClick:e})}var ae={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},du={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}`},uu={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 fu(e){let t=[];return Object.entries(du).forEach(([o,r])=>{e.includes(o)&&(t.push(r),Ni(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}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 $t(e){let t=e.toLowerCase().split("+");return Lt()?fu(t):hu(t)}import{useRef as Pu}from"react";import{useSlateStatic as Cu}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=gu;function gu(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 yu}from"react";import bu from"lodash.throttle";import{useMemo as Eu,useState as xu}from"react";function Ht(e=100){let[t,o]=xu(0),r=Eu(()=>bu(()=>{o(n=>n+1)},e,{trailing:!0}),[e]);return Object.assign(r,{counter:t})}function Ko(){let e=Ht();return yu(()=>(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 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 ku from"@emotion/styled";var Y=ku(mt)`
84
+ `;import{jsx as pu}from"react/jsx-runtime";function ye({close:e}){let t=cu(null);return pu(Di,{ref:t,onClick:e})}var ae={cmd:"\u2318",ctrl:"\u2303",shift:"\u21E7",opt:"\u2325",enter:"\u23CE"},du={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}`},uu={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 fu(e){let t=[];return Object.entries(du).forEach(([o,r])=>{e.includes(o)&&(t.push(r),$i(e,o))}),t.push(...e.map(o=>o.toUpperCase())),t.join("")}function hu(e){let t=[];return Object.entries(uu).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()?fu(t):hu(t)}import{useRef as Pu}from"react";import{useSlateStatic as Cu}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=gu;function gu(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 yu}from"react";import bu from"lodash.throttle";import{useMemo as Eu,useState as xu}from"react";function Ht(e=100){let[t,o]=xu(0),r=Eu(()=>bu(()=>{o(n=>n+1)},e,{trailing:!0}),[e]);return Object.assign(r,{counter:t})}function Ko(){let e=Ht();return yu(()=>(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 ku from"@emotion/styled";var Y=ku(mt)`
85
85
  position: absolute;
86
86
  z-index: 1000;
87
87
  border: 1px solid var(--table-border-color);
@@ -330,7 +330,7 @@
330
330
  margin-left: -0.25em;
331
331
  opacity: 0.375;
332
332
  }
333
- `;import{useCallback as Tu}from"react";import{ReactEditor as wu}from"slate-react";import{Fragment as Mu,jsx as Oe,jsxs as Iu}from"react/jsx-runtime";function Ji({editor:e,item:t,close:o,dest:r}){let n=O("menu"),i=Tu(()=>{if(t.Component){let a=t.Component;n.open(()=>Oe(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),wu.focus(e),o())},[e,t]);return Oe(Mu,{children:Iu(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?$t(t.hotkey):void 0})]})})}import{Fragment as Su,jsx as Ut,jsxs as Ru}from"react/jsx-runtime";function Ue({dest:e,items:t,close:o}){let r=Cu(),n=Pu(null),i=j({src:n,dest:e},({dest:a})=>a?{left:a.left-8,top:a.top+a.height}:{left:0,top:0});return Ru(Su,{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 zu,jsxs as Du}from"react/jsx-runtime";function Go(e){return e.getBoundingClientRect()}var Lu=Zi("div")`
333
+ `;import{useCallback as Tu}from"react";import{ReactEditor as wu}from"slate-react";import{Fragment as Mu,jsx as Oe,jsxs as Iu}from"react/jsx-runtime";function Ji({editor:e,item:t,close:o,dest:r}){let n=O("menu"),i=Tu(()=>{if(t.Component){let a=t.Component;n.open(()=>Oe(a,{dest:r,close:n.close}))}else t.action&&(t.action(e),wu.focus(e),o())},[e,t]);return Oe(Mu,{children:Iu(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 Su,jsx as Ut,jsxs as Ru}from"react/jsx-runtime";function Ue({dest:e,items:t,close:o}){let r=Cu(),n=Pu(null),i=j({src:n,dest:e},({dest:a})=>a?{left:a.left-8,top:a.top+a.height}:{left:0,top:0});return Ru(Su,{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 zu,jsxs as Du}from"react/jsx-runtime";function Go(e){return e.getBoundingClientRect()}var Lu=Zi("div")`
334
334
  position: fixed;
335
335
  z-index: 10;
336
336
  -webkit-font-smoothing: antialiased;
@@ -351,7 +351,7 @@
351
351
  font-size: 0.875em;
352
352
  font-weight: 500;
353
353
  color: var(--shade-400);
354
- `;function ea({title:e,hotkey:t,dest:o}){let r=Go(o);return Du(Lu,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?zu(Bu,{children:t}):null]})}import Nu from"@emotion/styled";import{jsx as Hu}from"react/jsx-runtime";var $u=Nu("span")`
354
+ `;function ea({title:e,hotkey:t,dest:o}){let r=Go(o);return Du(Lu,{style:{left:r.left,top:`calc(${r.top}px - 2em)`},children:[e,t?zu(Bu,{children:t}):null]})}import $u from"@emotion/styled";import{jsx as Hu}from"react/jsx-runtime";var Nu=$u("span")`
355
355
  position: fixed;
356
356
  z-index: 10;
357
357
  width: 0;
@@ -359,7 +359,7 @@
359
359
  border-left: 0.375em solid transparent;
360
360
  border-right: 0.375em solid transparent;
361
361
  border-top: 0.375em solid var(--shade-700);
362
- `;function ta({dest:e}){let t=Go(e);return Hu($u,{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 Fu from"@emotion/styled";import{useCallback as Ve,useRef as ca,useState as Vt}from"react";import{Node as Vu}from"slate";import{useSlateStatic as Ku}from"slate-react";import ve from"@emotion/styled";var Fe=ve("div")`
362
+ `;function ta({dest:e}){let t=Go(e);return Hu(Nu,{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 Fu from"@emotion/styled";import{useCallback as Ve,useRef as ca,useState as Vt}from"react";import{Node as Vu}from"slate";import{useSlateStatic as Ku}from"slate-react";import ve from"@emotion/styled";var Fe=ve("div")`
363
363
  margin: 0.5em 0;
364
364
  &:first-of-type {
365
365
  margin-top: 0;
@@ -464,7 +464,7 @@
464
464
  width: 20em;
465
465
  padding: 0;
466
466
  overflow: hidden;
467
- `;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=Ku(),[d,p]=Vt(o.href),[u,g]=Vt(Vu.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)},[]),B=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}),B()},[B]);return ft(_u,{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:B,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 Xu=Wu(Y)`
467
+ `;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=Ku(),[d,p]=Vt(o.href),[u,g]=Vt(Vu.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)},[]),$=Ve(E=>{g(E.target.value)},[]),w=Ve(E=>{S(E.target.value)},[]),B=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}),B()},[B]);return ft(_u,{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:$}),_(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:B,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 Xu=Wu(Y)`
468
468
  position: absolute;
469
469
  width: 20em;
470
470
  z-index: 1000;
@@ -549,7 +549,7 @@
549
549
  height: 1.25em;
550
550
  stroke-width: 1.5;
551
551
  }
552
- `;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=Qu(),i=Gu(null),a=ju(o.href),[l,m]=qu({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},B)=>ke(M,B,{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(Xu,{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 tf}from"react/jsx-runtime";function ba({element:e,attributes:t,children:o}){let r=ga(null),n=ga(null),i=Zu(),a=ef(),l=O("dialog");return Ju(()=>{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]),tf(zi,{className:Yu({"--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 of}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 of(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 Gf}from"slate";import{ReactEditor as qf}from"slate-react";import{Editor as rf,Transforms as Ta}from"slate";import{ReactEditor as nf}from"slate-react";function af(e){}function lf(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=rf.end(e,[]);Ta.select(e,i),nf.focus(e)}}function wa(e){return{noop:f(af,e),insertImageFromUrl:f(lf,e)}}function Ia(e,t){return!1}import{useSlateStatic as Ff}from"slate-react";import sf from"@emotion/styled";var Ma=sf("div")`
552
+ `;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=Qu(),i=Gu(null),a=ju(o.href),[l,m]=qu({x:0,y:0}),s=_t((M,$)=>{m(w=>({x:w.x+M,y:w.y+$}))},[]),c=j({src:i,destAnchor:e,destStartEdge:t},({src:M,destAnchor:$,destStartEdge:w},B)=>ke(M,B,{left:w.left,top:$.top+$.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(Xu,{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 tf}from"react/jsx-runtime";function ba({element:e,attributes:t,children:o}){let r=ga(null),n=ga(null),i=Zu(),a=ef(),l=O("dialog");return Ju(()=>{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]),tf(zi,{className:Yu({"--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 of}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 of(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 Gf}from"slate";import{ReactEditor as qf}from"slate-react";import{Editor as rf,Transforms as Ta}from"slate";import{ReactEditor as nf}from"slate-react";function af(e){}function lf(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=rf.end(e,[]);Ta.select(e,i),nf.focus(e)}}function wa(e){return{noop:f(af,e),insertImageFromUrl:f(lf,e)}}function Ia(e,t){return!1}import{useSlateStatic as Ff}from"slate-react";import sf from"@emotion/styled";var Ma=sf("div")`
553
553
  display: block;
554
554
  margin: 1em 0;
555
555
  `;import{clsx as Af}from"clsx";import{useState as ll}from"react";import{useSelected as Of}from"slate-react";import Pa from"@emotion/styled";var Ca=Pa("span")`
@@ -627,7 +627,7 @@
627
627
  .--dragging > & {
628
628
  transition: border-radius 250ms;
629
629
  }
630
- `;import{clsx as uf}from"clsx";import{useCallback as Na,useEffect as ff,useRef as Qt}from"react";import{Transforms as $a}from"slate";import{ReactEditor as Yo,useSlateStatic as hf}from"slate-react";import{useEffect as mf}from"react";function Ra(){let e=Ht();return mf(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import La from"@emotion/styled";var Ba=La("span")`
630
+ `;import{clsx as uf}from"clsx";import{useCallback as $a,useEffect as ff,useRef as Qt}from"react";import{Transforms as Na}from"slate";import{ReactEditor as Yo,useSlateStatic as hf}from"slate-react";import{useEffect as mf}from"react";function Ra(){let e=Ht();return mf(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[]),e}import La from"@emotion/styled";var Ba=La("span")`
631
631
  position: absolute;
632
632
  display: block;
633
633
  /**
@@ -747,7 +747,7 @@
747
747
  .--small > & > .--bar-right {
748
748
  left: calc(50% + 1px);
749
749
  }
750
- `;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 cf}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 pf(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function df(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 pf(t.height,e);return e}function Se(e,t,o){switch(o.type){case"bounds":return df(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function Da(e){let t=cf.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft,10)+parseInt(o.paddingRight,10);return t.clientWidth-r}import{Fragment as Ef,jsx as gt,jsxs as bf}from"react/jsx-runtime";function gf(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=hf(),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=Na(M=>{Me(M),i(!0);let N=M.clientX,B=gf(a,e).width,I={...o},E=P=>{let C=jo({value:B+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),$a.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=Na(M=>{Me(M),i(!0);let N=M.changedTouches[0].clientX,w=o.width,B={...o},I=k=>{let P=k.changedTouches[0],C=jo({value:w+P.clientX-N,min:g,max:u});B=qt(C,t),r(B)},E=()=>{document.removeEventListener("touchmove",I),document.removeEventListener("touchend",E),s.current=null,c.current=null;let k=Yo.findPath(a,e);$a.setNodes(a,{width:B.width,height:B.height},{at:k}),i(!1)};s.current=I,c.current=E,document.addEventListener("touchmove",I),document.addEventListener("touchend",E)},[t.width,t.height,o.width,e]);ff(()=>()=>{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=uf({"--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(Ef,{children:gt(Ba,{className:L,onMouseDown:T,onTouchStart:S,children:bf(za,{children:[gt("span",{className:"--bar --bar-left"}),gt("span",{className:"--bar --bar-center"}),gt("span",{className:"--bar --bar-right"})]})})})}import xf from"@emotion/styled";var Aa=xf("span")`
750
+ `;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 cf}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 pf(e,t){e=Math.round(e);let o=t.width/t.height;return{width:Math.round(e*o),height:e}}function df(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 pf(t.height,e);return e}function Se(e,t,o){switch(o.type){case"bounds":return df(t,o);case"scale":return{width:Math.round(t.width*o.scale),height:Math.round(t.height*o.scale)}}}function Da(e){let t=cf.toDOMNode(e,e),o=getComputedStyle(t),r=parseInt(o.paddingLeft,10)+parseInt(o.paddingRight,10);return t.clientWidth-r}import{Fragment as Ef,jsx as gt,jsxs as bf}from"react/jsx-runtime";function gf(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=hf(),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 $=M.clientX,B=gf(a,e).width,I={...o},E=P=>{let C=jo({value:B+P.clientX-$,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 $=M.changedTouches[0].clientX,w=o.width,B={...o},I=k=>{let P=k.changedTouches[0],C=jo({value:w+P.clientX-$,min:g,max:u});B=qt(C,t),r(B)},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:B.width,height:B.height},{at:k}),i(!1)};s.current=I,c.current=E,document.addEventListener("touchmove",I),document.addEventListener("touchend",E)},[t.width,t.height,o.width,e]);ff(()=>()=>{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=uf({"--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(Ef,{children:gt(Ba,{className:L,onMouseDown:T,onTouchStart:S,children:bf(za,{children:[gt("span",{className:"--bar --bar-left"}),gt("span",{className:"--bar --bar-center"}),gt("span",{className:"--bar --bar-right"})]})})})}import xf from"@emotion/styled";var Aa=xf("span")`
751
751
  position: absolute;
752
752
  /**
753
753
  * The status appears with a 1px gap from the outline.
@@ -867,7 +867,7 @@
867
867
  font-size: 1.33em;
868
868
  line-height: 1em;
869
869
  }
870
- `;import{clsx as vf}from"clsx";import{useCallback as Tf}from"react";import{Transforms as wf}from"slate";import{ReactEditor as If,useSlateStatic as Mf}from"slate-react";import{jsx as Pf}from"react/jsx-runtime";function Va({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=Mf(),a=Se(o,n,t),l=J({title:t.title,hotkey:`${a.width}x${a.height}`}),m=Tf(()=>{let u=If.findPath(i,e),g=Se(o,n,t);r(g),wf.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=vf({"--disabled":c,"--selected":!c&&d});return Pf(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 Rf}from"react";import{useSlateStatic as Lf}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 Cf,Transforms as Qa}from"slate";import{ReactEditor as Sf}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=Sf.findPath(e,t);Cf.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=Lf(),o=J({title:"Inline Image",hotkey:"In a line with text"}),r=Rf(()=>{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 Df}from"react";import{useSlateStatic as Nf}from"slate-react";import{Editor as Ja,Element as Bf,Text as Za,Transforms as Yt}from"slate";import{ReactEditor as zf}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=zf.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=>Bf.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=Nf(),o=J({title:"Block Image",hotkey:"On a line by itself"}),r=Df(()=>{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 $f}from"react/jsx-runtime";function nl({element:e}){return $f(Xt,{children:[rl(ol,{element:e}),rl(Ya,{element:e})]})}import{jsx as il,jsxs as Hf}from"react/jsx-runtime";function al({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Hf(Ua,{children:[il(nl,{element:e}),il(_a,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as Jt,jsxs as Uf}from"react/jsx-runtime";function Zt({element:e,presets:t}){let o=e.url,r=Of(),[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=Af({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Uf(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 Vf}from"react/jsx-runtime";function ml({element:e,attributes:t,children:o}){let r=Ff();return Vf("div",{...t,children:[sl(Ma,{contentEditable:!1,children:sl(Zt,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as _f}from"slate-react";import Kf from"@emotion/styled";var cl=Kf("span")`
870
+ `;import{clsx as vf}from"clsx";import{useCallback as Tf}from"react";import{Transforms as wf}from"slate";import{ReactEditor as If,useSlateStatic as Mf}from"slate-react";import{jsx as Pf}from"react/jsx-runtime";function Va({element:e,preset:t,size:o,setSize:r,srcSize:n}){let i=Mf(),a=Se(o,n,t),l=J({title:t.title,hotkey:`${a.width}x${a.height}`}),m=Tf(()=>{let u=If.findPath(i,e),g=Se(o,n,t);r(g),wf.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=vf({"--disabled":c,"--selected":!c&&d});return Pf(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 Rf}from"react";import{useSlateStatic as Lf}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 Cf,Transforms as Qa}from"slate";import{ReactEditor as Sf}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=Sf.findPath(e,t);Cf.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=Lf(),o=J({title:"Inline Image",hotkey:"In a line with text"}),r=Rf(()=>{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 Df}from"react";import{useSlateStatic as $f}from"slate-react";import{Editor as Ja,Element as Bf,Text as Za,Transforms as Yt}from"slate";import{ReactEditor as zf}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=zf.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=>Bf.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=$f(),o=J({title:"Block Image",hotkey:"On a line by itself"}),r=Df(()=>{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 Nf}from"react/jsx-runtime";function nl({element:e}){return Nf(Xt,{children:[rl(ol,{element:e}),rl(Ya,{element:e})]})}import{jsx as il,jsxs as Hf}from"react/jsx-runtime";function al({element:e,size:t,setSize:o,srcSize:r,presets:n}){return Hf(Ua,{children:[il(nl,{element:e}),il(_a,{element:e,size:t,setSize:o,srcSize:r,presets:n})]})}import{jsx as Jt,jsxs as Uf}from"react/jsx-runtime";function Zt({element:e,presets:t}){let o=e.url,r=Of(),[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=Af({"--selected":r,"--dragging":n,"--small":a&&(a.width<=64||a.height<=64)});return Uf(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 Vf}from"react/jsx-runtime";function ml({element:e,attributes:t,children:o}){let r=Ff();return Vf("div",{...t,children:[sl(Ma,{contentEditable:!1,children:sl(Zt,{element:e,presets:r.image.imageBlockPresets})}),o]})}import{useSlateStatic as _f}from"slate-react";import Kf from"@emotion/styled";var cl=Kf("span")`
871
871
  display: inline;
872
872
  `;import{jsx as pl,jsxs as Wf}from"react/jsx-runtime";function dl({element:e,attributes:t,children:o}){let r=_f();return Wf("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 Qf(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&&Gf.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 Xf={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={...Xf,...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:Qf(e)}})});import{Editor as bt,Element as X,Transforms as _e}from"slate";import jf from"@emotion/styled";var gl=jf("blockquote")`
873
873
  position: relative;
@@ -926,7 +926,7 @@
926
926
  color: var(--shade-800);
927
927
  background: var(--shade-300);
928
928
  }
929
- `,Nl=to("div")`
929
+ `,$l=to("div")`
930
930
  white-space: pre;
931
931
  line-height: 1.5em;
932
932
  counter-increment: line;
@@ -949,7 +949,7 @@
949
949
  display: inline-block;
950
950
  width: 2em;
951
951
  } */
952
- `;import{jsx as Et,jsxs as $l}from"react/jsx-runtime";function Hl({element:e,attributes:t,children:o}){let r=ch(null),n=ph(),i=O("code-block-dropdown"),a=mh(()=>{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 $l(Bl,{className:n?"--selected":"",...t,children:[$l(Dl,{contentEditable:!1,onClick:a,ref:r,children:[Et("span",{children:e.language}),Et(Ll,{})]}),Et(zl,{children:o})]})}import{useSelected as dh}from"slate-react";import{jsx as uh}from"react/jsx-runtime";function Al({attributes:e,children:t}){let o=dh();return uh(Nl,{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 gh,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(!me(n))return!1;let i=x(e,"code-block");return i==null?!1:fh.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=>hh.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(gh,{children:i}):Vl("span",{style:a,children:i})}}})});import{Transforms as Eh}from"slate";import _l from"@emotion/styled";var Wl=_l("div")`
952
+ `;import{jsx as Et,jsxs as Nl}from"react/jsx-runtime";function Hl({element:e,attributes:t,children:o}){let r=ch(null),n=ph(),i=O("code-block-dropdown"),a=mh(()=>{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(Bl,{className:n?"--selected":"",...t,children:[Nl(Dl,{contentEditable:!1,onClick:a,ref:r,children:[Et("span",{children:e.language}),Et(Ll,{})]}),Et(zl,{children:o})]})}import{useSelected as dh}from"slate-react";import{jsx as uh}from"react/jsx-runtime";function Al({attributes:e,children:t}){let o=dh();return uh($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 gh,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(!me(n))return!1;let i=x(e,"code-block");return i==null?!1:fh.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=>hh.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(gh,{children:i}):Vl("span",{style:a,children:i})}}})});import{Transforms as Eh}from"slate";import _l from"@emotion/styled";var Wl=_l("div")`
953
953
  position: relative;
954
954
  background-color: var(--shade-100);
955
955
  border: 1px solid var(--shade-300);
@@ -1006,7 +1006,7 @@
1006
1006
  border-radius: 8px;
1007
1007
  }
1008
1008
  `;import{Node as Mh}from"slate";function ts(e){return e.children.length===1&&Mh.string(e.children[0]).length===0}import{jsx as Sh}from"react/jsx-runtime";function os({element:e,attributes:t,children:o}){let r=Ch(),n=ts(e);return Sh(es,{...t,className:Ph({"--selected":r,"--empty":n,"--collapsible":!!e.__collapsible}),children:o})}import{jsx as Rh}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(`
1009
- `)?t():e.insertText(`
1009
+ `)?(e.deleteBackward("character"),t()):e.insertText(`
1010
1010
  `)}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 Rh(os,{element:o,attributes:r,children:n})},onKeyDown:o=>o.key==="Enter"&&!o.nativeEvent.isComposing&&!o.shiftKey?(o.preventDefault(),e.insertBreak(),!0):H({"super+0":e.collapsibleParagraph.convertParagraph})(o)}}});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 Lh,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 Bh(e){return ne.string(e).includes(`
1011
1011
  `)}function zh(e,t,o,r){let n=ne.string(t),i=n.split(`
1012
1012
  `),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 Dh(e,t,o,r){let n=ne.string(t);if(!n.includes(`
@@ -1015,7 +1015,7 @@
1015
1015
  `),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(`
1016
1016
  `)},{at:[...o,0]});let T={type:"paragraph",children:[{text:s.join(`
1017
1017
  `)}]};Re.insertNodes(e,T,{at:[...d,p+1]})}else Re.insertNodes(e,{text:s.join(`
1018
- `)},{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=Lh.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(Bh(u)){let T=Dh(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 B=L.path,I=S;w=0;for(let[E,k]of ne.texts(u)){let P=E.text.length;if(w+P>=S){B=[...p,...k],I=S-w;break}w+=P}Re.select(e,{anchor:{path:M,offset:N},focus:{path:B,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 Nh,Range as $h,Transforms as ds}from"slate";function us(e){let t=x(e,"heading");if(!t||!e.selection||$h.isExpanded(e.selection)||!rr.isEnd(e,e.selection.anchor,t[1]))return!1;let o=Nh.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 Hh}from"slate";function Ah(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Oh(e,t){let[o]=Hh.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function fs(e){return{convertHeading:f(Ah,e),isHeadingActive:f(Oh,e)}}import{css as Uh}from"@emotion/react";import qe from"@emotion/styled";var Qe=Uh`
1018
+ `)},{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=Lh.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(Bh(u)){let T=Dh(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,$=T,w=0;for(let[E,k]of ne.texts(u)){let P=E.text.length;if(w+P>=T){M=[...p,...k],$=T-w;break}w+=P}let B=L.path,I=S;w=0;for(let[E,k]of ne.texts(u)){let P=E.text.length;if(w+P>=S){B=[...p,...k],I=S-w;break}w+=P}Re.select(e,{anchor:{path:M,offset:$},focus:{path:B,offset:I}})}}catch{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 $h,Range as Nh,Transforms as ds}from"slate";function us(e){let t=x(e,"heading");if(!t||!e.selection||Nh.isExpanded(e.selection)||!rr.isEnd(e,e.selection.anchor,t[1]))return!1;let o=$h.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 Hh}from"slate";function Ah(e,t,o){e.convertElement.convertElements(r=>r.type==="heading"&&r.level==t,{type:"heading",level:t},o)}function Oh(e,t){let[o]=Hh.nodes(e,{match:r=>"type"in r&&"level"in r&&r.type==="heading"&&r.level===t});return!!o}function fs(e){return{convertHeading:f(Ah,e),isHeadingActive:f(Oh,e)}}import{css as Uh}from"@emotion/react";import qe from"@emotion/styled";var Qe=Uh`
1019
1019
  margin-top: 1em;
1020
1020
  &:first-of-type {
1021
1021
  margin-top: 0;
@@ -1096,7 +1096,7 @@
1096
1096
  opacity: 0;
1097
1097
  width: 1px;
1098
1098
  overflow: hidden;
1099
- `;import{jsx as Rs,jsxs as qh}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?qh(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 cg,Transforms as pg}from"slate";function Bs(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 zs(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 Qh=2;function no(e){let t=x(e,$);return t?t[0].depth:0}function ar(e){return Pe(e,$)?no(e)<Qh:!1}function lr(e){return Pe(e,$)?no(e)>0:!1}function Ns(e){ar(e)&&e.list.indent()}function $s(e){lr(e)&&e.list.outdent()}function Hs(e){return zt(e,t=>({depth:t.depth+1}),{match:$})}import{Editor as Xh,Transforms as sr}from"slate";function As(e){let t=x(e,$);if(!t)return!1;let[o,r]=t;if(Xh.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,$);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:$}));for(let o of t)if(o[0].depth===0)return!0;return zt(e,o=>({depth:Math.max(0,o.depth-1)}),{match:$})}import{Transforms as Yh}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 Yh.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(Bs,e),convertTaskList:f(zs,e),insertBreak:f(As,e),toggleTaskListItem:f(Us,e),getListDepth:f(no,e),canIncreaseDepth:f(ar,e),canDecreaseDepth:f(lr,e),increaseDepth:f(Ns,e),decreaseDepth:f($s,e)}}import{Element as Jh,Transforms as Zh}from"slate";var Vs=Bt(["ordered-list-item"]);function io(e,t){let[o,r]=t;return Jh.isElement(o)?xe(e,[o,r],(n,i)=>{if(!Vs(i[0]))return!1;let a=Vs(n[0])||$(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(Zh.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function Ks(e,t){let[o]=t;return $(o)?io(e,t):!1}import{clsx as tg}from"clsx";import{useEffect as og}from"react";import{ReactEditor as rg,useSlateStatic as ng}from"slate-react";import ao from"@emotion/styled";var mr=ao("li")`
1099
+ `;import{jsx as Rs,jsxs as qh}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?qh(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 cg,Transforms as pg}from"slate";function Bs(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 zs(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 Qh=2;function no(e){let t=x(e,N);return t?t[0].depth:0}function ar(e){return Pe(e,N)?no(e)<Qh:!1}function lr(e){return Pe(e,N)?no(e)>0:!1}function $s(e){ar(e)&&e.list.indent()}function Ns(e){lr(e)&&e.list.outdent()}function Hs(e){return zt(e,t=>({depth:t.depth+1}),{match:N})}import{Editor as Xh,Transforms as sr}from"slate";function As(e){let t=x(e,N);if(!t)return!1;let[o,r]=t;if(Xh.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,N);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:N}));for(let o of t)if(o[0].depth===0)return!0;return zt(e,o=>({depth:Math.max(0,o.depth-1)}),{match:N})}import{Transforms as Yh}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 Yh.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(Bs,e),convertTaskList:f(zs,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 Jh,Transforms as Zh}from"slate";var Vs=Bt(["ordered-list-item"]);function io(e,t){let[o,r]=t;return Jh.isElement(o)?xe(e,[o,r],(n,i)=>{if(!Vs(i[0]))return!1;let a=Vs(n[0])||N(n[0])?i[0].depth>n[0].depth:!0;return i[0].__firstAtDepth!==a?(Zh.setNodes(e,{__firstAtDepth:a},{at:i[1]}),!0):!1}):!1}function Ks(e,t){let[o]=t;return N(o)?io(e,t):!1}import{clsx as tg}from"clsx";import{useEffect as og}from"react";import{ReactEditor as rg,useSlateStatic as ng}from"slate-react";import ao from"@emotion/styled";var mr=ao("li")`
1100
1100
  margin-top: 0.5em;
1101
1101
  margin-bottom: 0.5em;
1102
1102
  list-style-position: outside;
@@ -1149,7 +1149,7 @@
1149
1149
  stroke-width: 3px;
1150
1150
  }
1151
1151
  }
1152
- `;import{jsx as ig}from"react/jsx-runtime";function qs({element:e,attributes:t,children:o}){let r=ng();og(()=>{let a=rg.findPath(r,e);io(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=tg({"--first-at-depth":e.__firstAtDepth});return ig(Ws,{...t,className:i,style:n,children:o})}import{useCallback as ag}from"react";import{useSlateStatic as lg}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 sg}from"react/jsx-runtime";function Js({element:e,attributes:t,children:o}){let r=lg(),n=ag(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return sg(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 mg}from"react/jsx-runtime";function em({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return mg(_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 om=["unordered-list-item","ordered-list-item","task-list-item"],$=Bt(om),rm=v((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(om);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,$))return!1;let a=x(e,$);if(!a)return!1;let[l,m]=a;return l.depth>0?(pg.setNodes(e,{depth:l.depth-1},{at:m}),!0):(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:tm,onKeyDown(i){return cg.nodes(e,{match:$})?n(i):!1}}})});import{clsx as bg}from"clsx";import{Editor as dr,Range as Eg}from"slate";import{Editor as dg,Text as nm,Transforms as ug}from"slate";function im(e,{at:t=e.selection}={}){if(t==null)return;let o=[...dg.nodes(e,{match:n=>nm.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=>nm.isText(n),split:!0,at:t})}import{Editor as Be,Point as fg,Range as hg}from"slate";function ze(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=hg.isRange(r)?r.focus:r,i=fg.isPoint(n)&&(Be.after(e,n)===null||Be.isEnd(e,n,Be.end(e,[]))),a=t,m=(Be.marks(e)||{})[a]===!0;if(i)if(!m)e.activeMarks={...e.activeMarks,[a]:!0};else{let{[a]:s,...c}=e.activeMarks||{};e.activeMarks=c}m?Be.removeMark(e,a):Be.addMark(e,a,!0),typeof o=="string"&&Be.removeMark(e,o)}function am(e){return{removeMarks:f(im,e),toggleMark:f(ze,e),toggleBold:()=>ze(e,"bold"),toggleItalic:()=>ze(e,"italic"),toggleUnderline:()=>ze(e,"underline"),toggleStrike:()=>ze(e,"strike"),toggleHighlight:()=>ze(e,"highlight")}}import gg from"@emotion/styled";var lm=gg("span")`
1152
+ `;import{jsx as ig}from"react/jsx-runtime";function qs({element:e,attributes:t,children:o}){let r=ng();og(()=>{let a=rg.findPath(r,e);io(r,[e,a])},[]);let n={marginLeft:`${2+e.depth*2}em`,"--list-item-var":`list-item-depth-${e.depth}`},i=tg({"--first-at-depth":e.__firstAtDepth});return ig(Ws,{...t,className:i,style:n,children:o})}import{useCallback as ag}from"react";import{useSlateStatic as lg}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 sg}from"react/jsx-runtime";function Js({element:e,attributes:t,children:o}){let r=lg(),n=ag(()=>{r.list.toggleTaskListItem({at:e})},[r,e]),i=`${2+e.depth*2}em`;return sg(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 mg}from"react/jsx-runtime";function em({element:e,attributes:t,children:o}){let r=`${2+e.depth*2}em`;return mg(_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 om=["unordered-list-item","ordered-list-item","task-list-item"],N=Bt(om),rm=v((e,t,{createPolicy:o})=>{e.convertElement.addConvertElementType(om);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,N))return!1;let a=x(e,N);if(!a)return!1;let[l,m]=a;return l.depth>0?(pg.setNodes(e,{depth:l.depth-1},{at:m}),!0):(e.collapsibleParagraph.convertParagraph(),!0)}},editableProps:{renderElement:tm,onKeyDown(i){return cg.nodes(e,{match:N})?n(i):!1}}})});import{clsx as bg}from"clsx";import{Editor as dr,Range as Eg}from"slate";import{Editor as dg,Text as nm,Transforms as ug}from"slate";function im(e,{at:t=e.selection}={}){if(t==null)return;let o=[...dg.nodes(e,{match:n=>nm.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=>nm.isText(n),split:!0,at:t})}import{Editor as Be,Point as fg,Range as hg}from"slate";function ze(e,t,o,{at:r=e.selection}={}){if(r==null)return;let n=hg.isRange(r)?r.focus:r,i=fg.isPoint(n)&&(Be.after(e,n)===null||Be.isEnd(e,n,Be.end(e,[]))),a=t,m=(Be.marks(e)||{})[a]===!0;if(i)if(!m)e.activeMarks={...e.activeMarks,[a]:!0};else{let{[a]:s,...c}=e.activeMarks||{};e.activeMarks=c}m?Be.removeMark(e,a):Be.addMark(e,a,!0),typeof o=="string"&&Be.removeMark(e,o)}function am(e){return{removeMarks:f(im,e),toggleMark:f(ze,e),toggleBold:()=>ze(e,"bold"),toggleItalic:()=>ze(e,"italic"),toggleUnderline:()=>ze(e,"underline"),toggleStrike:()=>ze(e,"strike"),toggleHighlight:()=>ze(e,"highlight")}}import gg from"@emotion/styled";var lm=gg("span")`
1153
1153
  &.--bold {
1154
1154
  font-weight: bold;
1155
1155
  }
@@ -1172,7 +1172,7 @@
1172
1172
  &.--highlight {
1173
1173
  background-color: #ffff00;
1174
1174
  }
1175
- `;import{jsx as xg}from"react/jsx-runtime";var sm=v(e=>{e.marksPlugin=am(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(lm,{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 mm}from"slate";function cm(e){if(!e.selection)return;let t=xt.parent(e,e.selection);fi(e,t[1])}var pm=v(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return mm.equals(xt.start(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return mm.equals(xt.end(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1}},editableProps:{}}));import{Element as ab}from"slate";import{Editor as um,Path as vg,Transforms as fm}from"slate";import{Editor as yg,Path as kg}from"slate";function dm(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 hm(e,t){if(e.selection==null)return!1;let[o,r]=um.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=dm(e,e.selection,t);return um.withoutNormalizing(e,()=>{for(let l of a)fm.delete(e,{at:l});fm.collapse(e,{edge:"start"})}),!0}import{Transforms as Og}from"slate";function D(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 gm}from"slate";function je(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function bm(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 Tg.withoutNormalizing(e,()=>{let{columns:m}=n,s=[...m],c=Math.min(l,m.length-1);s.splice(l,0,m[c]),gm.setNodes(e,{columns:s},{at:i}),n.children.forEach((d,p)=>{gm.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=D(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 Em(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 xm(e){return[...Array(e).keys()]}function Cg(e){return xm(e).map(()=>({align:"left"}))}function Sg(e,t){return{type:"table",columns:Cg(e),children:xm(t).map(()=>Rg(e))}}function Rg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>je(t))}}function ym(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 km}from"slate";function vm(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,km.next(i)),!0}catch{return!1}}function Tm(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,km.previous(n)),!0}catch{return!1}}import{ReactEditor as Bg}from"slate-react";function zg(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;try{return e.getRangeAt(0).getBoundingClientRect()}catch{return null}}function Dg(e,t){return Bg.toDOMNode(e,t).getBoundingClientRect()}function hr(e,t){let o=zg();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 wm(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||vm(e,t)}),!1}function Im(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||Tm(e,t)}),!1}import{Editor as Mm,Transforms as gr}from"slate";import{Transforms as Ng}from"slate";function Ye(e){let t=e.tablePlugin.getTableInfo();return t===void 0?!1:(Ng.removeNodes(e,{at:t.tablePath}),!0)}function Pm(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 Ye(e);Mm.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=Mm.start(e,[...n,i,Math.min(a,l-2)]);gr.select(e,s)})}import{Editor as Cm,Transforms as Sm}from"slate";function Rm(e,{at:t=e.selection}={}){let o=D(e,{at:t});return o===void 0?!1:o.rowCount===1?(Ye(e),!0):(Cm.withoutNormalizing(e,()=>{Sm.removeNodes(e,{at:o.rowPath}),Sm.select(e,Cm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as $g}from"slate";function Lm(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}),$g.setNodes(e,{columns:a},{at:n}),!0}import{Path as Hg,Transforms as Ag}from"slate";function Bm(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=Hg.next(a);return Ag.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),Q(e,l),!0}function zm(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 Dm(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):(Em(e),Q(e,[...a,n+1,0]),!0)}function Nm(e){return{getTableInfo:f(D,e),insertTable:f(ym,e),insertColumn:f(bm,e),insertRow:f(ur,e),removeTable:f(Ye,e),removeColumn:f(Pm,e),removeRow:f(Rm,e),tabForward:f(Bm,e),tabBackward:f(zm,e),shiftEnterForward:f(Dm,e),selectCell:f(Ug,e),down:f(wm,e),up:f(Im,e),setTableColumnAlign:f(Lm,e)}}function Ug(e,{at:t=e.selection}={}){let o=D(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 $m(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 ce from"@emotion/styled";var Hm=ce("div")`
1175
+ `;import{jsx as xg}from"react/jsx-runtime";var sm=v(e=>{e.marksPlugin=am(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(lm,{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 mm}from"slate";function cm(e){if(!e.selection)return;let t=xt.parent(e,e.selection);fi(e,t[1])}var pm=v(e=>(e.normalizeAfterDelete=!0,{name:"normalize-after-delete",editor:{deleteBackward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return mm.equals(xt.start(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1},deleteForward(){if(!e.selection)return!1;let t=xt.parent(e,e.selection);return mm.equals(xt.end(e,t[1]),e.selection.anchor)?function(){cm(e)}:!1}},editableProps:{}}));import{Element as ab}from"slate";import{Editor as um,Path as vg,Transforms as fm}from"slate";import{Editor as yg,Path as kg}from"slate";function dm(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 hm(e,t){if(e.selection==null)return!1;let[o,r]=um.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=dm(e,e.selection,t);return um.withoutNormalizing(e,()=>{for(let l of a)fm.delete(e,{at:l});fm.collapse(e,{edge:"start"})}),!0}import{Transforms as Og}from"slate";function D(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 gm}from"slate";function je(e,t=[{type:"table-content",children:[{text:""}]}]){return{type:"table-cell",children:t}}function bm(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 Tg.withoutNormalizing(e,()=>{let{columns:m}=n,s=[...m],c=Math.min(l,m.length-1);s.splice(l,0,m[c]),gm.setNodes(e,{columns:s},{at:i}),n.children.forEach((d,p)=>{gm.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=D(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 Em(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 xm(e){return[...Array(e).keys()]}function Cg(e){return xm(e).map(()=>({align:"left"}))}function Sg(e,t){return{type:"table",columns:Cg(e),children:xm(t).map(()=>Rg(e))}}function Rg(e){return{type:"table-row",children:[...Array(e).keys()].map(t=>je(t))}}function ym(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 km}from"slate";function vm(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,km.next(i)),!0}catch{return!1}}function Tm(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,km.previous(n)),!0}catch{return!1}}import{ReactEditor as Bg}from"slate-react";function zg(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;try{return e.getRangeAt(0).getBoundingClientRect()}catch{return null}}function Dg(e,t){return Bg.toDOMNode(e,t).getBoundingClientRect()}function hr(e,t){let o=zg();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 wm(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||vm(e,t)}),!1}function Im(e){let t=D(e);return t&&setTimeout(()=>{hr(e,t.cellElement)||Tm(e,t)}),!1}import{Editor as Mm,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 Pm(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 Ye(e);Mm.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=Mm.start(e,[...n,i,Math.min(a,l-2)]);gr.select(e,s)})}import{Editor as Cm,Transforms as Sm}from"slate";function Rm(e,{at:t=e.selection}={}){let o=D(e,{at:t});return o===void 0?!1:o.rowCount===1?(Ye(e),!0):(Cm.withoutNormalizing(e,()=>{Sm.removeNodes(e,{at:o.rowPath}),Sm.select(e,Cm.start(e,[...o.tablePath,Math.min(o.rowIndex,o.rowCount-2),o.cellIndex]))}),!0)}import{Transforms as Ng}from"slate";function Lm(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 Hg,Transforms as Ag}from"slate";function Bm(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=Hg.next(a);return Ag.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:l}),Q(e,l),!0}function zm(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 Dm(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):(Em(e),Q(e,[...a,n+1,0]),!0)}function $m(e){return{getTableInfo:f(D,e),insertTable:f(ym,e),insertColumn:f(bm,e),insertRow:f(ur,e),removeTable:f(Ye,e),removeColumn:f(Pm,e),removeRow:f(Rm,e),tabForward:f(Bm,e),tabBackward:f(zm,e),shiftEnterForward:f(Dm,e),selectCell:f(Ug,e),down:f(wm,e),up:f(Im,e),setTableColumnAlign:f(Lm,e)}}function Ug(e,{at:t=e.selection}={}){let o=D(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 Nm(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 ce from"@emotion/styled";var Hm=ce("div")`
1176
1176
  position: absolute;
1177
1177
  /**
1178
1178
  * very slightly shaded
@@ -1379,8 +1379,8 @@
1379
1379
  height: 1.5em;
1380
1380
  background: rgba(0, 0, 0, 0.05);
1381
1381
  border-radius: 50%;
1382
- `;import{jsx as ic}from"react/jsx-runtime";function ac(){return ic(rc,{contentEditable:!1,children:ic(nc,{className:"--table-menu-tile"})})}import{jsx as yr,jsxs as rb}from"react/jsx-runtime";function lc({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(Gm,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?yr(ac,{}):null,a?yr(tc,{cellElement:e}):null,l?yr(Zm,{cellElement:e}):null]})}import{jsx as nb}from"react/jsx-runtime";function sc({attributes:e,children:t}){return nb(qm,{...e,children:t})}import{jsx as ib}from"react/jsx-runtime";function mc({attributes:e,children:t}){return ib(Wm,{...e,children:t})}import{jsx as fo}from"react/jsx-runtime";function cc({element:e,attributes:t,children:o}){switch(e.type){case"table":return fo(Qm,{element:e,attributes:t,children:o});case"table-row":return fo(mc,{element:e,attributes:t,children:o});case"table-cell":return fo(lc,{element:e,attributes:t,children:o});case"table-content":return fo(sc,{element:e,attributes:t,children:o})}}var pc=v((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=Nm(e),o({name:"table",editor:{deleteBackward:()=>Pe(e,"table-cell"),deleteForward:()=>mi(e,"table-cell"),deleteFragment:()=>hm(e,["table-cell"]),insertBreak:()=>x(e,"table-cell")?(e.insertText(`
1383
- `),!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 $m(e,r)}return!1}},editableProps:{renderElement:cc,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=`
1382
+ `;import{jsx as ic}from"react/jsx-runtime";function ac(){return ic(rc,{contentEditable:!1,children:ic(nc,{className:"--table-menu-tile"})})}import{jsx as yr,jsxs as rb}from"react/jsx-runtime";function lc({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(Gm,{className:n?"--selected":"",...t,"data-x":e.x,"data-y":e.y,children:[o,i?yr(ac,{}):null,a?yr(tc,{cellElement:e}):null,l?yr(Zm,{cellElement:e}):null]})}import{jsx as nb}from"react/jsx-runtime";function sc({attributes:e,children:t}){return nb(qm,{...e,children:t})}import{jsx as ib}from"react/jsx-runtime";function mc({attributes:e,children:t}){return ib(Wm,{...e,children:t})}import{jsx as fo}from"react/jsx-runtime";function cc({element:e,attributes:t,children:o}){switch(e.type){case"table":return fo(Qm,{element:e,attributes:t,children:o});case"table-row":return fo(mc,{element:e,attributes:t,children:o});case"table-cell":return fo(lc,{element:e,attributes:t,children:o});case"table-content":return fo(sc,{element:e,attributes:t,children:o})}}var pc=v((e,t,{createPolicy:o})=>(e.supportsTable=!0,e.tablePlugin=$m(e),o({name:"table",editor:{deleteBackward:()=>Pe(e,"table-cell"),deleteForward:()=>mi(e,"table-cell"),deleteFragment:()=>hm(e,["table-cell"]),insertBreak:()=>x(e,"table-cell")?(e.insertText(`
1383
+ `),!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 Nm(e,r)}return!1}},editableProps:{renderElement:cc,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=`
1384
1384
  --blue-50: rgb(239 246 255);
1385
1385
  --blue-100: rgb(219 234 254);
1386
1386
  --blue-200: rgb(191 219 254);
@@ -1445,11 +1445,11 @@
1445
1445
  &.--selected {
1446
1446
  background: var(--blue-100);
1447
1447
  }
1448
- `;import{Fragment as Eb,jsx as ho,jsxs as xb}from"react/jsx-runtime";function xc(e){return[...Array(e).keys()]}function yc({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=xc(5).map(d=>d+1),m=xc(5).map(d=>d+1),s=Ec((d,p)=>{r({x:d,y:p})},[r]),c=Ec((d,p)=>{n.tablePlugin.insertTable(d,p),gb.focus(n),t()},[n]);return xb(Eb,{children:[ho(ye,{close:t}),ho(hc,{ref:i,style:a,children:ho(gc,{onMouseLeave:()=>s(0,0),children:l.map(d=>m.map(p=>{let u=p<=o.x&&d<=o.y;return ho(bc,{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 kc=()=>b(y,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),vc=()=>b(y,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),Tc=()=>b(y,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),wc=()=>b(y,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Ic=()=>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"})}),Mc=()=>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 Pc=()=>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"})}),Cc=()=>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"})}),Sc=()=>et(y,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var Rc=()=>b(y,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Lc=()=>et(y,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),Bc=()=>b(y,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),zc=()=>b(y,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Dc=()=>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 Nc=()=>b(y,{children:b("path",{d:"M12 5v14M5 12h14"})}),$c=()=>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"})}),Hc=()=>b(y,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Ac=()=>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"})}),Oc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Uc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Fc=()=>b(y,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),Vc=()=>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"})]}),Kc=()=>b(y,{children:b("path",{d:"M5 12h14"})});var Ir=[{icon:Oc,title:h("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Uc,title:h("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],_c=[{icon:Pc,title:h("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:wc,title:h("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Ic,title:h("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Mc,title:h("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Wc=[..._c],Mr=[{icon:kc,title:h("paragraphStyle"),more:!0,children:_c}];import{useState as de,useRef as qc,useEffect as kb,useCallback as Pr}from"react";import{useSlateStatic as vb}from"slate-react";import yb from"@emotion/styled";var Gc=yb(Y)`
1448
+ `;import{Fragment as Eb,jsx as ho,jsxs as xb}from"react/jsx-runtime";function xc(e){return[...Array(e).keys()]}function yc({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=xc(5).map(d=>d+1),m=xc(5).map(d=>d+1),s=Ec((d,p)=>{r({x:d,y:p})},[r]),c=Ec((d,p)=>{n.tablePlugin.insertTable(d,p),gb.focus(n),t()},[n]);return xb(Eb,{children:[ho(ye,{close:t}),ho(hc,{ref:i,style:a,children:ho(gc,{onMouseLeave:()=>s(0,0),children:l.map(d=>m.map(p=>{let u=p<=o.x&&d<=o.y;return ho(bc,{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 kc=()=>b(y,{children:b("path",{d:"M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4"})}),vc=()=>b(y,{className:"--more-icon",width:"0.5em",viewBox:"0 0 12 24",children:b("path",{d:"m2 12 4 4 4-4"})}),Tc=()=>b(y,{width:"0.5em",viewBox:"6 0 12 24",children:b("path",{d:"M9 12h6M12 9v6"})}),wc=()=>b(y,{children:b("path",{d:"M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2"})}),Ic=()=>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"})}),Mc=()=>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 Pc=()=>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"})}),Cc=()=>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"})}),Sc=()=>et(y,{children:[b("path",{d:"M10 9l4 3-4 3"}),b("path",{d:"M16 9l4 3-4 3"})]});var Rc=()=>b(y,{children:b("path",{d:"M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01"})}),Lc=()=>et(y,{children:[b("rect",{x:4,y:4,width:16,height:16,rx:2}),b("path",{d:"M4 10h16M10 4v16"})]}),Bc=()=>b(y,{children:b("path",{d:"m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16"})}),zc=()=>b(y,{children:b("path",{d:"M9 8L5 12L9 16M15 8L19 12L15 16"})}),Dc=()=>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 $c=()=>b(y,{children:b("path",{d:"M12 5v14M5 12h14"})}),Nc=()=>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"})}),Hc=()=>b(y,{children:b("path",{d:"M7 5v5a5 5 0 0 0 10 0V5M5 19h14"})});var Ac=()=>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"})}),Oc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3"})}),Uc=()=>b(y,{children:b("path",{d:"M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3"})});var Fc=()=>b(y,{children:b("path",{d:"M18 6L6 18M6 6l12 12"})}),Vc=()=>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"})]}),Kc=()=>b(y,{children:b("path",{d:"M5 12h14"})});var Ir=[{icon:Oc,title:h("increaseDepth"),hotkey:"tab",action:e=>e.list.increaseDepth(),active:e=>e.list.canIncreaseDepth()},{icon:Uc,title:h("decreaseDepth"),hotkey:"shift+tab",action:e=>e.list.decreaseDepth(),active:e=>e.list.canDecreaseDepth()}],_c=[{icon:Pc,title:h("normal"),hotkey:"super+0",action:e=>{e.collapsibleParagraph.convertParagraph()}},{icon:wc,title:h("heading1"),hotkey:"super+1",action:e=>e.heading.convertHeading(1,!0),active:e=>e.heading.isHeadingActive(1)},{icon:Ic,title:h("heading2"),hotkey:"super+2",action:e=>e.heading.convertHeading(2,!0),active:e=>e.heading.isHeadingActive(2)},{icon:Mc,title:h("heading3"),hotkey:"super+3",action:e=>e.heading.convertHeading(3,!0),active:e=>e.heading.isHeadingActive(3)}],Wc=[..._c],Mr=[{icon:kc,title:h("paragraphStyle"),more:!0,children:_c}];import{useState as de,useRef as qc,useEffect as kb,useCallback as Pr}from"react";import{useSlateStatic as vb}from"slate-react";import yb from"@emotion/styled";var Gc=yb(Y)`
1449
1449
  width: 18em;
1450
1450
  padding: 0;
1451
1451
  overflow: hidden;
1452
- `;import{Fragment as Tb,jsx as A,jsxs as V}from"react/jsx-runtime";function Qc({dest:e,close:t}){let o=vb(),r=qc(null),n=qc(null),[i,a]=de({x:0,y:0}),l=Pr((R,F)=>{a(he=>({x:he.x+R,y:he.y+F}))},[]),m=o.wysimark?.imageDialogState,s=!!o.wysimark?.onImageChange,c=!!o.wysimark?.onFileSelect,d=m?.imageSource??(s?"file":c?"select":"url"),[p,u]=de(m?.url??""),[g,T]=de(m?.alt??""),[S,L]=de(m?.title??""),[M,N]=de(!1),[w,B]=de(d),[I,E]=de(!1),[k,P]=de(m?.uploadedUrl??""),C=R=>{B(R),P(""),fe("")},[ue,fe]=de(""),Ip=Pr(R=>{let F=R.target.value;T(F),M||L(F)},[M]),Mp=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:F},he)=>ke(R,he,{left:F.left-16,top:F.top+F.height},{margin:16})),Pp={...yo,left:yo.left+i.x,top:yo.top+i.y};function Cp(R){R.preventDefault();let F=w==="file"||w==="select"?k:p;F.trim()!==""&&(o.image.insertImageFromUrl(F,g,S),Hr(),t())}function Sp(){Hr(),t()}async function Rp(R){let F=R.target.files?.[0];if(!(!F||!o.wysimark?.onImageChange)){fe(F.name),E(!0);try{let he=await o.wysimark.onImageChange(F);P(he)}catch(he){}finally{E(!1)}}}function Lp(){n.current?.click()}async function Bp(){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 V(Tb,{children:[A(ye,{close:t}),V(Gc,{ref:r,style:Pp,children:[A(Te,{onDrag:l}),V("form",{onSubmit:R=>{Cp(R)},style:{padding:"8px"},children:[(s||c)&&V("div",{style:{marginBottom:"12px"},children:[s&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"file",checked:w==="file",onChange:()=>C("file"),style:{marginRight:"4px"}}),h("imageSourceFile")]}),c&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"select",checked:w==="select",onChange:()=>C("select"),style:{marginRight:"4px"}}),h("imageSourceSelect")]}),V("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"url",checked:w==="url",onChange:()=>C("url"),style:{marginRight:"4px"}}),h("imageSourceUrl")]})]}),w==="url"?V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("imageUrlRequired")}),A("input",{type:"text",value:p,onChange:R=>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"?V("div",{style:{marginBottom:"8px"},children:[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("imageSourceSelect")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",k.split("/").pop()]})})]}):V("div",{style:{marginBottom:"8px"},children:[A("input",{ref:n,type:"file",accept:"image/*",onChange:R=>{Rp(R)},style:{display:"none"}}),A("button",{type:"button",onClick:Lp,disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("selectFile")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",ue]})})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("altText")}),A("input",{type:"text",value:g,onChange:Ip,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageDescription")})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("title")}),A("input",{type:"text",value:S,onChange: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("imageTitle")})]}),V("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:Sp,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 Xc from"@emotion/styled";var Cr=Xc("div")`
1452
+ `;import{Fragment as Tb,jsx as A,jsxs as V}from"react/jsx-runtime";function Qc({dest:e,close:t}){let o=vb(),r=qc(null),n=qc(null),[i,a]=de({x:0,y:0}),l=Pr((R,F)=>{a(he=>({x:he.x+R,y:he.y+F}))},[]),m=o.wysimark?.imageDialogState,s=!!o.wysimark?.onImageChange,c=!!o.wysimark?.onFileSelect,d=m?.imageSource??(s?"file":c?"select":"url"),[p,u]=de(m?.url??""),[g,T]=de(m?.alt??""),[S,L]=de(m?.title??""),[M,$]=de(!1),[w,B]=de(d),[I,E]=de(!1),[k,P]=de(m?.uploadedUrl??""),C=R=>{B(R),P(""),fe("")},[ue,fe]=de(""),Ip=Pr(R=>{let F=R.target.value;T(F),M||L(F)},[M]),Mp=Pr(R=>{L(R.target.value),$(!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:F},he)=>ke(R,he,{left:F.left-16,top:F.top+F.height},{margin:16})),Pp={...yo,left:yo.left+i.x,top:yo.top+i.y};function Cp(R){R.preventDefault();let F=w==="file"||w==="select"?k:p;F.trim()!==""&&(o.image.insertImageFromUrl(F,g,S),Hr(),t())}function Sp(){Hr(),t()}async function Rp(R){let F=R.target.files?.[0];if(!(!F||!o.wysimark?.onImageChange)){fe(F.name),E(!0);try{let he=await o.wysimark.onImageChange(F);P(he)}catch(he){}finally{E(!1)}}}function Lp(){n.current?.click()}async function Bp(){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 V(Tb,{children:[A(ye,{close:t}),V(Gc,{ref:r,style:Pp,children:[A(Te,{onDrag:l}),V("form",{onSubmit:R=>{Cp(R)},style:{padding:"8px"},children:[(s||c)&&V("div",{style:{marginBottom:"12px"},children:[s&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"file",checked:w==="file",onChange:()=>C("file"),style:{marginRight:"4px"}}),h("imageSourceFile")]}),c&&V("label",{style:{display:"inline-flex",alignItems:"center",marginRight:"16px",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"select",checked:w==="select",onChange:()=>C("select"),style:{marginRight:"4px"}}),h("imageSourceSelect")]}),V("label",{style:{display:"inline-flex",alignItems:"center",cursor:"pointer"},children:[A("input",{type:"radio",name:"imageSource",value:"url",checked:w==="url",onChange:()=>C("url"),style:{marginRight:"4px"}}),h("imageSourceUrl")]})]}),w==="url"?V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("imageUrlRequired")}),A("input",{type:"text",value:p,onChange:R=>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"?V("div",{style:{marginBottom:"8px"},children:[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("imageSourceSelect")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",k.split("/").pop()]})})]}):V("div",{style:{marginBottom:"8px"},children:[A("input",{ref:n,type:"file",accept:"image/*",onChange:R=>{Rp(R)},style:{display:"none"}}),A("button",{type:"button",onClick:Lp,disabled:I,style:{padding:"8px 16px",backgroundColor:I?"#ccc":"#0078d4",color:I?"#666":"white",border:"none",borderRadius:"4px",cursor:I?"not-allowed":"pointer",marginBottom:"8px",fontWeight:"bold"},children:I?h("uploading"):h("selectFile")}),k&&A("div",{style:{marginTop:"8px",padding:"8px",backgroundColor:"var(--shade-100)",borderRadius:"4px"},children:V("div",{style:{color:"green",marginBottom:"4px"},children:["\u2713 ",ue]})})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("altText")}),A("input",{type:"text",value:g,onChange:Ip,style:{width:"100%",padding:"6px",boxSizing:"border-box",border:"1px solid var(--shade-300)",borderRadius:"4px",backgroundColor:"var(--shade-50)",color:"var(--shade-700)"},placeholder:h("imageDescription")})]}),V("div",{style:{marginBottom:"8px"},children:[A("label",{style:{display:"block",marginBottom:"4px"},children:h("title")}),A("input",{type:"text",value:S,onChange: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("imageTitle")})]}),V("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:Sp,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 Xc from"@emotion/styled";var Cr=Xc("div")`
1453
1453
  /* Center vertically and horizontally */
1454
1454
  display: flex;
1455
1455
  align-items: center;
@@ -1478,4 +1478,4 @@
1478
1478
  margin-top: 0.5em;
1479
1479
  color: var(--shade-500);
1480
1480
  line-height: 1.375;
1481
- `;import{Fragment as Bb,jsx as te,jsxs as vt}from"react/jsx-runtime";var Lb=wb("enter");function Yc({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]),B=bo(E=>{T(E.currentTarget.value),L(!0)},[T]),I=E=>{Lb(E)&&(E.preventDefault(),E.stopPropagation(),M())};return vt(Bb,{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:B,onKeyDown:I}),vt(Cr,{onClick:M,children:[te(go,{}),te(Tc,{})]}),te(Cr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:te(Fc,{})})]}),te(jc,{children:h("tooltipHint")})]})]})]})}var Sr=[{icon:go,title:h("insertLink"),more:!0,hotkey:"mod+k",Component:Yc},{icon:Dc,title:h("insertImageFromUrl"),more:!0,Component:Qc},{icon:Lc,title:h("insertTable"),more:!0,Component:yc},{icon:Kc,title:h("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Jc=Sr,Zc=Sr,ep=[{icon:Nc,title:h("insert"),more:!0,children:Sr}];import{Editor as zb}from"slate";function tt(e){let t=zb.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 tp=[{icon:vr,title:h("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>tt(e).bold},{icon:Cc,title:h("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>tt(e).italic},{icon:$c,title:h("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>tt(e).strike},{icon:Bc,title:h("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>tt(e).code},{icon:Hc,title:h("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>tt(e).underline},{icon:Vc,title:h("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>tt(e).highlight,show:e=>!e.wysimark.disableHighlight}],Rr=tp,op=[{icon:vr,title:h("format"),more:!0,children:tp}];var rp=[{icon:Rc,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:Ac,title:h("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Lr=[...rp,"divider",...Ir],np=[{icon:wr,title:h("list"),more:!0,children:[...rp,"divider",...Ir]}];import{Editor as ip,Path as Db,Transforms as Eo}from"slate";var ap=[{icon:Tr,title:h("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Sc,title:h("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:zc,title:h("codeBlock"),action:e=>{let{selection:t}=e,o=x(e,"code-block");if(o){let[,r]=o,n=ip.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=ip.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}],Br=ap,lp=[{icon:Tr,title:h("quote"),more:!0,children:ap}];var Nb=[...Wc,"divider",...Lr,"divider",...Rr,"divider",...Jc,"divider",...Br],$b=[...Mr,"divider",...Lr,"divider",...Rr,"divider",...Zc,"divider",...Br],sp=[...Mr,"divider",...np,"divider",...op,"divider",...ep,"divider",...lp],mp=sp;var ot=[Nb,$b,sp];import{clsx as Hb}from"clsx";import{useCallback as zr,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 cp({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?$t(e.hotkey):void 0}),a=O("menu"),l=zr(()=>{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=zr(()=>{if(e.action){e.action(t),Ob.focus(t);return}a.layer?a.close():l()},[a.layer,e]),s=zr(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&&!Bo(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Bo(e?.title)?.includes("Depth")}),children:[xo(e.icon,{}),e.more?xo(vc,{}):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(cp,{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 pp(){let e=_b(null),[t,o]=Wb(mp);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 dp({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(Bi,{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(pp,{}),Dr(t,{as:Vi,...e,style:{overflowY:"auto"}})]})})}var up=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:dp,editableProps:{}}));import{Editor as Nr,Node as aE,Path as lE,Transforms as sE}from"slate";var fp=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=aE.child(e,e.children.length-1);return(Nr.hasBlocks(e,r)||Nr.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 hp(e){return{pasteMarkdown:f(cE,e)}}var gp=v(e=>(e.pasteMarkdown=hp(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 bp=v((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:pE}})));var Ep=[gp,ps,Ea,ks,sm,Ls,El,Kl,Xl,pc,Ps,fp,rm,va,pm,ns,fc,up,hl,bp];var uE=ri(Ep),{withSink:xp,SinkEditable:yp}=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 $r({authToken:e,height:t,minHeight:o,maxHeight:r,disableRawMode:n,disableTaskList:i,disableCodeBlock:a,disableHighlight:l}={}){let[m]=fE(()=>{let s=hE(),c=xp(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 vp}from"react/jsx-runtime";function IE({children:e,attributes:t}){return oe("span",{...t,children:e})}function Tp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:m}){let[s,c]=kp(!1),[d,p]=kp(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 ue=ge(C),fe=Ee(ue);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 ue=ge(C),fe=Ee(ue);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]),B=Tt(()=>{M.flush()},[M]),I=C=>{let ue=C.target.value;p(ue),o(ue)},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 vp("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[!P&&oe("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:oe("div",{onClick:k,style:{background:"none",border:s?"1px solid #4a90e2":"1px solid transparent",cursor:"pointer",padding:"6px",borderRadius:"4px",backgroundColor:s?"rgba(74, 144, 226, 0.1)":"transparent",boxShadow:s?"0 1px 3px rgba(0, 0, 0, 0.1)":"none",transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center"},title:s?h("switchToVisualEditor"):h("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(k(),C.preventDefault())},children:vp("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),onChange:I,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"1rem",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),oe("div",{style:{display:s?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:oe(wE,{editor:e,initialValue:g.current,onChange:N,children:oe(yp,{renderLeaf:IE,onMouseDown:w,onBlur:B,placeholder:n,className:i,style:a})})})]})}import{jsx as wp}from"react/jsx-runtime";function BE({standaloneOptions:{onChange:e,placeholder:t,className:o,...r},standaloneMethodsRef:n}){let[i,a]=RE(r.initialMarkdown||""),l=SE(i),m=$r(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 wp(Tp,{editor:m,value:i,className:o||"",onChange:s,placeholder:t})}function zA(e,t){let o=ME(),r=LE(e);return r.render(wp(BE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Tp as Editable,zA as createWysimark,$r as useEditor};
1481
+ `;import{Fragment as Bb,jsx as te,jsxs as vt}from"react/jsx-runtime";var Lb=wb("enter");function Yc({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()},$=bo(E=>{d(E.currentTarget.value)},[d]),w=bo(E=>{let k=E.currentTarget.value;u(k),S||T(k)},[u,T,S]),B=bo(E=>{T(E.currentTarget.value),L(!0)},[T]),I=E=>{Lb(E)&&(E.preventDefault(),E.stopPropagation(),M())};return vt(Bb,{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:$,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:B,onKeyDown:I}),vt(Cr,{onClick:M,children:[te(go,{}),te(Tc,{})]}),te(Cr,{onClick:t,style:{marginLeft:"0.25em",background:"var(--shade-400)"},children:te(Fc,{})})]}),te(jc,{children:h("tooltipHint")})]})]})]})}var Sr=[{icon:go,title:h("insertLink"),more:!0,hotkey:"mod+k",Component:Yc},{icon:Dc,title:h("insertImageFromUrl"),more:!0,Component:Qc},{icon:Lc,title:h("insertTable"),more:!0,Component:yc},{icon:Kc,title:h("horizontalRule"),hotkey:"super+-",action:e=>e.horizontalRule.insertHorizontalRule()}],Jc=Sr,Zc=Sr,ep=[{icon:$c,title:h("insert"),more:!0,children:Sr}];import{Editor as zb}from"slate";function tt(e){let t=zb.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 tp=[{icon:vr,title:h("bold"),hotkey:"mod+b",action:e=>e.marksPlugin.toggleBold(),active:e=>tt(e).bold},{icon:Cc,title:h("italic"),hotkey:"mod+i",action:e=>e.marksPlugin.toggleItalic(),active:e=>tt(e).italic},{icon:Nc,title:h("strike"),hotkey:"super+k",action:e=>e.marksPlugin.toggleStrike(),active:e=>tt(e).strike},{icon:Bc,title:h("inlineCode"),hotkey:"mod+j",action:e=>e.inlineCode.toggleInlineCode(),active:e=>tt(e).code},{icon:Hc,title:h("underline"),hotkey:"mod+u",action:e=>e.marksPlugin.toggleUnderline(),active:e=>tt(e).underline},{icon:Vc,title:h("highlight"),hotkey:"mod+h",action:e=>e.marksPlugin.toggleHighlight(),active:e=>tt(e).highlight,show:e=>!e.wysimark.disableHighlight}],Rr=tp,op=[{icon:vr,title:h("format"),more:!0,children:tp}];var rp=[{icon:Rc,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:Ac,title:h("checkList"),hotkey:"super+9",action:e=>e.list.convertTaskList(!0),show:e=>!e.wysimark.disableTaskList}],Lr=[...rp,"divider",...Ir],np=[{icon:wr,title:h("list"),more:!0,children:[...rp,"divider",...Ir]}];import{Editor as ip,Path as Db,Transforms as Eo}from"slate";var ap=[{icon:Tr,title:h("quote"),hotkey:"super+.",action:e=>{e.blockQuotePlugin.isActive()?e.blockQuotePlugin.outdent():e.blockQuotePlugin.indent()},active:e=>e.blockQuotePlugin.isActive()},{icon:Sc,title:h("increaseQuoteDepth"),action:e=>e.blockQuotePlugin.increaseDepth(),active:e=>e.blockQuotePlugin.canIncreaseDepth()},{icon:zc,title:h("codeBlock"),action:e=>{let{selection:t}=e,o=x(e,"code-block");if(o){let[,r]=o,n=ip.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=ip.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}],Br=ap,lp=[{icon:Tr,title:h("quote"),more:!0,children:ap}];var $b=[...Wc,"divider",...Lr,"divider",...Rr,"divider",...Jc,"divider",...Br],Nb=[...Mr,"divider",...Lr,"divider",...Rr,"divider",...Zc,"divider",...Br],sp=[...Mr,"divider",...np,"divider",...op,"divider",...ep,"divider",...lp],mp=sp;var ot=[$b,Nb,sp];import{clsx as Hb}from"clsx";import{useCallback as zr,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 cp({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=zr(()=>{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=zr(()=>{if(e.action){e.action(t),Ob.focus(t);return}a.layer?a.close():l()},[a.layer,e]),s=zr(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&&!Bo(e?.title)?.includes("Depth"),"--more":e.more,"--disabled":!r&&Bo(e?.title)?.includes("Depth")}),children:[xo(e.icon,{}),e.more?xo(vc,{}):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(cp,{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 pp(){let e=_b(null),[t,o]=Wb(mp);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 dp({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(Bi,{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(pp,{}),Dr(t,{as:Vi,...e,style:{overflowY:"auto"}})]})})}var up=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:dp,editableProps:{}}));import{Editor as $r,Node as aE,Path as lE,Transforms as sE}from"slate";var fp=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 hp(e){return{pasteMarkdown:f(cE,e)}}var gp=v(e=>(e.pasteMarkdown=hp(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 bp=v((e,t,{createPolicy:o})=>(e.placeholder={},o({name:"placeholder",editableProps:{renderPlaceholder:pE}})));var Ep=[gp,ps,Ea,ks,sm,Ls,El,Kl,Xl,pc,Ps,fp,rm,va,pm,ns,fc,up,hl,bp];var uE=ri(Ep),{withSink:xp,SinkEditable:yp}=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=xp(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 vp}from"react/jsx-runtime";function IE({children:e,attributes:t}){return oe("span",{...t,children:e})}function Tp({editor:e,value:t,onChange:o,throttleInMs:r=1e3,placeholder:n,className:i,style:a,onImageChange:l,onFileSelect:m}){let[s,c]=kp(!1),[d,p]=kp(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]),$=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 ue=ge(C),fe=Ee(ue);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 ue=ge(C),fe=Ee(ue);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]),B=Tt(()=>{M.flush()},[M]),I=C=>{let ue=C.target.value;p(ue),o(ue)},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 vp("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[!P&&oe("div",{style:{position:"absolute",top:"5px",right:"25px",zIndex:10},children:oe("div",{onClick:k,style:{background:"none",border:s?"1px solid #4a90e2":"1px solid transparent",cursor:"pointer",padding:"6px",borderRadius:"4px",backgroundColor:s?"rgba(74, 144, 226, 0.1)":"transparent",boxShadow:s?"0 1px 3px rgba(0, 0, 0, 0.1)":"none",transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center"},title:s?h("switchToVisualEditor"):h("switchToRawMarkdown"),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(k(),C.preventDefault())},children:vp("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),onChange:I,placeholder:n,className:i,style:{width:"calc(100% - 60px)",margin:"0 auto",minHeight:"200px",padding:"20px",fontFamily:"monospace",fontSize:"1rem",color:"#333",lineHeight:"1.5",backgroundColor:"#fff",border:"1px solid #ddd",borderRadius:"4px",...a}})}),oe("div",{style:{display:s?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:oe(wE,{editor:e,initialValue:g.current,onChange:$,children:oe(yp,{renderLeaf:IE,onMouseDown:w,onBlur:B,placeholder:n,className:i,style:a})})})]})}import{jsx as wp}from"react/jsx-runtime";function BE({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 wp(Tp,{editor:m,value:i,className:o||"",onChange:s,placeholder:t})}function zA(e,t){let o=ME(),r=LE(e);return r.render(wp(BE,{standaloneMethodsRef:o,standaloneOptions:t})),{unmount(){try{r.unmount()}catch{}},getMarkdown(){return o.current?.getMarkdown()||""},setMarkdown(n){o.current?.setMarkdown(n)}}}export{Tp as Editable,zA as createWysimark,Nr as useEditor};