@fgbg/mdocs 1.4.0 → 1.4.1

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.
Files changed (25) hide show
  1. package/README.md +1 -1
  2. package/agent-skills/changelog/SKILL.md +6 -0
  3. package/dist/web/assets/{AgentChatPanel-_IV-LAS4.js → AgentChatPanel-BMOzVvwA.js} +1 -1
  4. package/dist/web/assets/{AiWriteWorkbench-DzJAmRHY.js → AiWriteWorkbench-ob4AeDFt.js} +1 -1
  5. package/dist/web/assets/{DiagramEditor-NtNY3sZL-KWdKFFEL.js → DiagramEditor-NtNY3sZL-BuZCaqLT.js} +1 -1
  6. package/dist/web/assets/DocChrome-DwSYxHOP.js +16 -0
  7. package/dist/web/assets/{DocumentEditor-CrU6HKmU.js → DocumentEditor-C_TFaCan.js} +1 -1
  8. package/dist/web/assets/{HtmlEditor-BBcreXJD.js → HtmlEditor-CYPTi1_L.js} +1 -1
  9. package/dist/web/assets/{MergeView-LV_hny8a.js → MergeView-FPF3k11v.js} +1 -1
  10. package/dist/web/assets/{PlaygroundPage-Bo9rM8MY.js → PlaygroundPage-Bt53Sr06.js} +1 -1
  11. package/dist/web/assets/{SettingsPage-D09P0j48.js → SettingsPage-C2SYz-8K.js} +1 -1
  12. package/dist/web/assets/{SheetEditor-Dyk-jpRL.js → SheetEditor-BOF-OgqU.js} +1 -1
  13. package/dist/web/assets/{Toolbar-C1HmC2Qc.js → Toolbar-LRioFemr.js} +1 -1
  14. package/dist/web/assets/{VisitorPickerModal-Cx03Papl.js → VisitorPickerModal-iK2QsYfY.js} +1 -1
  15. package/dist/web/assets/{check-BAYRiedE.js → check-65pb-o1o.js} +1 -1
  16. package/dist/web/assets/{copy-J9XXv57X.js → copy-BT35-MU9.js} +1 -1
  17. package/dist/web/assets/{index-Btfv_3-Q.js → index-92xZ1zjh.js} +2 -2
  18. package/dist/web/assets/{index-C1Mc0Svw.css → index-DE_nAopH.css} +1 -1
  19. package/dist/web/assets/{italic-BfR6fH81.js → italic-BmGXEOKX.js} +1 -1
  20. package/dist/web/assets/{meta2dEngine-BD2XbzaV-MY1Hyyeh.js → meta2dEngine-BD2XbzaV-DeIPntMM.js} +1 -1
  21. package/dist/web/assets/{plus-DvWl4lHk.js → plus-Ss1czARp.js} +1 -1
  22. package/dist/web/assets/{react-C7aGt3wN.js → react-DHtvOuT-.js} +3 -3
  23. package/dist/web/index.html +2 -2
  24. package/package.json +1 -1
  25. package/dist/web/assets/DocChrome-CtT7xOl6.js +0 -16
@@ -1,4 +1,4 @@
1
- import{o}from"./index-Btfv_3-Q.js";/**
1
+ import{o}from"./index-92xZ1zjh.js";/**
2
2
  * @license lucide-react v0.562.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{T as D,W as _}from"./react-C7aGt3wN.js";import{r as p,a as A,b as u,c as z,i as N,M as O,C,f as k,d as q,e as L,g as V,h as j,s as B,j as G,k as H,l as J,m as W,n as K,o as Q}from"./meta2d-DP4Vt_ZE.js";import"./react-vendor-BVS1XoFi.js";import"./editor-DBWWidi3.js";import"./ui-CEFkTVnG.js";import"./motion-BAXVQJfN.js";import"./diagram-BF8g9yg4.js";import"./index-Btfv_3-Q.js";import"./plus-DvWl4lHk.js";import"./copy-J9XXv57X.js";import"./check-BAYRiedE.js";let E=!1;function U(){E||(p(k()),A(q()),p(L()),u(V()),p(j()),p(B()),u(G()),z(),u(H()),u(J()),p(W()),u(K()),A(Q()),E=!0)}let F=!1;function Z(){F||(U(),F=!0)}function Y(e,r){try{e==null||e.destroy()}catch{}try{r.remove()}catch{}}function X(e){let r=e.font;Object.defineProperty(e,"font",{configurable:!0,get:()=>r,set:t=>{r=typeof t=="string"?t.replace(/(\d+(?:\.\d+)?(?:px|pt|pc|em|ex|%|in|cm|mm))\s*\/\s*(\d+(?:\.\d+)?)(?=\s|$)/,"$1/normal"):t,e.__ctx&&(e.__ctx.font=r)}})}function ee(e){typeof e.ellipse!="function"&&(e.ellipse=(r,t,n,a,s=0,o=0,m=Math.PI*2,i=!1)=>{var M;if(n<0||a<0)throw new Error("IndexSizeError: The radius provided is negative.");((M=e.__currentElement)==null?void 0:M.nodeName)!=="path"&&e.beginPath();const h=Math.PI*2,f=Math.abs(m-o),y=f>=h-1e-4||f===0,w=s*180/Math.PI,v=i?0:1,c=g=>{const l=Math.cos(g),S=Math.sin(g),b=Math.cos(s),x=Math.sin(s);return{x:r+n*l*b-a*S*x,y:t+n*l*x+a*S*b}},d=(g,l)=>{e.__addPathCommand(`A ${n} ${a} ${w} ${g} ${v} ${l.x} ${l.y}`),e.__currentPosition=l},P=c(o);if(e.moveTo(P.x,P.y),y){d(1,c(o+Math.PI)),d(1,P);return}const T=c(m);d(f>Math.PI?1:0,T)})}function $(){return new Promise(e=>{requestAnimationFrame(()=>e())})}async function I(){await $(),await $()}function R(){const e=C.default??C.C2S??C;if(typeof e=="function")return e;const r=window.C2S;return typeof r=="function"?r:null}async function te(e,r=R()){var f,y,w,v;if(!r)return console.error("[meta2d] preview failed: canvas2svg constructor missing"),"";D(e.data()),e.render(!0),await I();const t=e.store,n=(f=t==null?void 0:t.data)==null?void 0:f.pens,a=Array.isArray(n)?n.length:0,s=10,o=e.getRect();if(!o||!Number.isFinite(o.width)||!Number.isFinite(o.height)||o.width<=0||o.height<=0)return a===0?_:(console.error("[meta2d] preview failed: invalid bounds",o),"");const m={...o,x:o.x-s,y:o.y-s},i=new r(Math.ceil(o.width+s*2),Math.ceil(o.height+s*2));if(i.textBaseline="middle",i.strokeStyle=((y=t==null?void 0:t.styles)==null?void 0:y.color)||"#1f1f1f",X(i),ee(i),Array.isArray(n)&&t){for(const c of n)if(!((c==null?void 0:c.visible)===!1||!N(c,t)))try{e.renderPenRaw(i,c,m,!0)}catch(d){console.error("[meta2d] preview failed: render pen",c,d)}}const h=((v=(w=i.getSerializedSvg)==null?void 0:w.call(i))==null?void 0:v.replace(/--le5le--/g,"&#x"))??"";return h.trim()?h:a===0?_:(console.error("[meta2d] preview failed: serialized SVG is empty",{pensCount:a}),"")}async function ue(e){const r=R();if(!r)return console.error("[meta2d] preview failed: canvas2svg constructor missing"),"";Z();const t=document.createElement("div");t.style.cssText="position:fixed;left:-20000px;top:0;width:1200px;height:800px;pointer-events:none;z-index:-1;",document.body.append(t);let n=null;try{let a;try{a=JSON.parse(e)}catch(s){return console.error("[meta2d] preview failed: invalid diagram JSON",s,e),""}return n=new O(t,{background:"#fff",grid:!1,rule:!1}),D(a),n.open(a),n.render(!0),await I(),te(n,r)}catch(a){return console.error("[meta2d] preview failed: unexpected error",a),""}finally{Y(n,t)}}export{Z as ensureMeta2dShapes,ue as generateSvgFromDiagram,te as generateSvgFromMeta2d};
1
+ import{T as D,W as _}from"./react-DHtvOuT-.js";import{r as p,a as A,b as u,c as z,i as N,M as O,C,f as k,d as q,e as L,g as V,h as j,s as B,j as G,k as H,l as J,m as W,n as K,o as Q}from"./meta2d-DP4Vt_ZE.js";import"./react-vendor-BVS1XoFi.js";import"./editor-DBWWidi3.js";import"./ui-CEFkTVnG.js";import"./motion-BAXVQJfN.js";import"./diagram-BF8g9yg4.js";import"./index-92xZ1zjh.js";import"./plus-Ss1czARp.js";import"./copy-BT35-MU9.js";import"./check-65pb-o1o.js";let E=!1;function U(){E||(p(k()),A(q()),p(L()),u(V()),p(j()),p(B()),u(G()),z(),u(H()),u(J()),p(W()),u(K()),A(Q()),E=!0)}let F=!1;function Z(){F||(U(),F=!0)}function Y(e,r){try{e==null||e.destroy()}catch{}try{r.remove()}catch{}}function X(e){let r=e.font;Object.defineProperty(e,"font",{configurable:!0,get:()=>r,set:t=>{r=typeof t=="string"?t.replace(/(\d+(?:\.\d+)?(?:px|pt|pc|em|ex|%|in|cm|mm))\s*\/\s*(\d+(?:\.\d+)?)(?=\s|$)/,"$1/normal"):t,e.__ctx&&(e.__ctx.font=r)}})}function ee(e){typeof e.ellipse!="function"&&(e.ellipse=(r,t,n,a,s=0,o=0,m=Math.PI*2,i=!1)=>{var M;if(n<0||a<0)throw new Error("IndexSizeError: The radius provided is negative.");((M=e.__currentElement)==null?void 0:M.nodeName)!=="path"&&e.beginPath();const h=Math.PI*2,f=Math.abs(m-o),y=f>=h-1e-4||f===0,w=s*180/Math.PI,v=i?0:1,c=g=>{const l=Math.cos(g),S=Math.sin(g),b=Math.cos(s),x=Math.sin(s);return{x:r+n*l*b-a*S*x,y:t+n*l*x+a*S*b}},d=(g,l)=>{e.__addPathCommand(`A ${n} ${a} ${w} ${g} ${v} ${l.x} ${l.y}`),e.__currentPosition=l},P=c(o);if(e.moveTo(P.x,P.y),y){d(1,c(o+Math.PI)),d(1,P);return}const T=c(m);d(f>Math.PI?1:0,T)})}function $(){return new Promise(e=>{requestAnimationFrame(()=>e())})}async function I(){await $(),await $()}function R(){const e=C.default??C.C2S??C;if(typeof e=="function")return e;const r=window.C2S;return typeof r=="function"?r:null}async function te(e,r=R()){var f,y,w,v;if(!r)return console.error("[meta2d] preview failed: canvas2svg constructor missing"),"";D(e.data()),e.render(!0),await I();const t=e.store,n=(f=t==null?void 0:t.data)==null?void 0:f.pens,a=Array.isArray(n)?n.length:0,s=10,o=e.getRect();if(!o||!Number.isFinite(o.width)||!Number.isFinite(o.height)||o.width<=0||o.height<=0)return a===0?_:(console.error("[meta2d] preview failed: invalid bounds",o),"");const m={...o,x:o.x-s,y:o.y-s},i=new r(Math.ceil(o.width+s*2),Math.ceil(o.height+s*2));if(i.textBaseline="middle",i.strokeStyle=((y=t==null?void 0:t.styles)==null?void 0:y.color)||"#1f1f1f",X(i),ee(i),Array.isArray(n)&&t){for(const c of n)if(!((c==null?void 0:c.visible)===!1||!N(c,t)))try{e.renderPenRaw(i,c,m,!0)}catch(d){console.error("[meta2d] preview failed: render pen",c,d)}}const h=((v=(w=i.getSerializedSvg)==null?void 0:w.call(i))==null?void 0:v.replace(/--le5le--/g,"&#x"))??"";return h.trim()?h:a===0?_:(console.error("[meta2d] preview failed: serialized SVG is empty",{pensCount:a}),"")}async function ue(e){const r=R();if(!r)return console.error("[meta2d] preview failed: canvas2svg constructor missing"),"";Z();const t=document.createElement("div");t.style.cssText="position:fixed;left:-20000px;top:0;width:1200px;height:800px;pointer-events:none;z-index:-1;",document.body.append(t);let n=null;try{let a;try{a=JSON.parse(e)}catch(s){return console.error("[meta2d] preview failed: invalid diagram JSON",s,e),""}return n=new O(t,{background:"#fff",grid:!1,rule:!1}),D(a),n.open(a),n.render(!0),await I(),te(n,r)}catch(a){return console.error("[meta2d] preview failed: unexpected error",a),""}finally{Y(n,t)}}export{Z as ensureMeta2dShapes,ue as generateSvgFromDiagram,te as generateSvgFromMeta2d};
@@ -1,4 +1,4 @@
1
- import{o}from"./index-Btfv_3-Q.js";/**
1
+ import{o}from"./index-92xZ1zjh.js";/**
2
2
  * @license lucide-react v0.562.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-GMplVEZG.js","assets/javascript-wDzz0qaB.js","assets/css-DPfMkruS.js","assets/scss-OYdSNvt2.js","assets/vue-DVfSmUF7.js","assets/typescript-BPQ3VLAy.js","assets/json-Cp-IABpG.js","assets/svelte-DZMnMd3x.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/cpp-BRuaLJcg.js","assets/c-BIGW1oBm.js","assets/sql-BLtJtn59.js","assets/ruby-BGX7qA9Y.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/tsx-COt5Ahok.js","assets/shellscript-Yzrsuije.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/php-Dhbhpdrm.js","assets/shellsession-BADoaaVG.js","assets/nginx-BpAMiNFr.js","assets/meta2dEngine-BD2XbzaV-MY1Hyyeh.js","assets/meta2d-DP4Vt_ZE.js","assets/react-vendor-BVS1XoFi.js","assets/editor-DBWWidi3.js","assets/ui-CEFkTVnG.js","assets/motion-BAXVQJfN.js","assets/diagram-BF8g9yg4.js","assets/index-Btfv_3-Q.js","assets/index-C1Mc0Svw.css","assets/plus-DvWl4lHk.js","assets/copy-J9XXv57X.js","assets/check-BAYRiedE.js","assets/DiagramEditor-NtNY3sZL-KWdKFFEL.js"])))=>i.map(i=>d[i]);
2
- var x7=Object.defineProperty;var k7=(e,t,n)=>t in e?x7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Mn=(e,t,n)=>k7(e,typeof t!="symbol"?t+"":t,n);import{B as eb,_ as Oe,r as E,af as w7,ag as v7,ah as S7,ai as Dn,aj as Xh,ak as Em,al as C7,j as O,b as Pi,am as _7,an as E7,ao as T7,ap as A7,z as M7,C as Jh,aq as N7,ar as D7,as as I7,at as L7}from"./react-vendor-BVS1XoFi.js";import{P as ze,e as Yh,A as ru,a as Ut,b as tb,w as de,c as fn,k as Cn,n as lt,F as Wr,p as Bi,$ as ce,O as Ln,G as pr,d as gs,l as gd,z as Sn,r as gt,v as nb,B as je,X as Fn,T as rb,M as Il,L as Ai,W as ml,f as hi,g as bs,h as So,C as Zh,Y as ib,y as Pt,i as Ll,H as Xe,j as F7,t as O7,m as Lo,J as bn,o as sb,R as fi,S as iu,Q as Zn,q as ob,s as z7,u as Aa,x as mt,E as R7,D as yc,I as P7,K as B7,_ as $7,N as su,U as bd,Z as ys,a0 as Co,a1 as Tt,a2 as ab,a3 as yn,a4 as j7,a5 as q7,a6 as Hr,a7 as Li,a8 as Fl,a9 as _n,aa as yd,ab as H7,ac as ub,ad as xd,ae as kd,af as _o,V as hn,ag as lb,ah as Qh,ai as U7,aj as cb,ak as W7,al as K7,am as V7,an as G7,ao as hb,ap as Qn,aq as X7,ar as jr,as as qn,at as xs,au as Tm,av as Am,aw as J7,ax as Y7,ay as Z7,az as Q7,aA as Ma,aB as fb,aC as db,aD as aa,aE as Na,aF as ou,aG as ek,aH as ef,aI as Mm,aJ as tk,aK as nk,aL as pb,aM as rk,aN as ik,aO as sk,aP as wd,aQ as Rr,aR as Eo,aS as vd,aT as ma,aU as fs,aV as Da,aW as tf,aX as Nm,aY as ga,aZ as gl,a_ as Ol,a$ as ok,b0 as ak,b1 as uk,b2 as lk,b3 as ck,b4 as Pr,b5 as hk,b6 as fk,b7 as dk,b8 as Dm,b9 as bl,ba as Im,bb as pk,bc as mk,bd as gk,be as bk,bf as ks,bg as Lm,bh as nf,bi as yk,bj as xk,bk as kk,bl as wk,bm as Fm,bn as ii,bo as Ia,bp as rf,bq as vk,br as ua,bs as mb,bt as gb,bu as bb,bv as yb,bw as xb,bx as Sk,by as Ck,bz as Sd,bA as kb,bB as _k,bC as Ek,bD as Cd,bE as Tk,bF as sf,bG as wb,bH as vb,bI as Ak,bJ as Mk,bK as Ju,bL as Sb,bM as Nk,bN as Dk,bO as Ik,bP as Cb,bQ as Lk,bR as Fk,bS as _b,bT as zl,bU as Ok,bV as zk,bW as Rk}from"./editor-DBWWidi3.js";import{as as tt,at,au as Pk,av as La,aw as Bk,ax as Rl,ay as $k,az as wi,aA as Zo,aB as jk,aC as qk,aD as Hk,aE as Uk,aF as Wk,aG as Kk,aH as Vk,aI as Gk,ad as _d,aJ as Xk,aK as It,ac as qr,aL as of,aM as Fa,aN as Ue,aO as Pl,aP as Eb,aQ as Jk,aR as zn,aS as Yk,aT as Zk,aU as Qk,aV as au,aW as Ed,aX as af,aY as Bl,aZ as Tb,a_ as ew,a$ as Om,b0 as tw,b1 as nw,t as uf,b2 as Ab,b3 as rw,b4 as iw,b5 as Mb,b6 as Nb,b7 as sw}from"./ui-CEFkTVnG.js";import{i as B0,j as ow,k as aw,l as uw,n as zm,e as Qo,s as lw,y as cw,h as Rm,m as Pm,r as hw,u as fw,v as dw,o as pw,w as mw,x as Db}from"./diagram-BF8g9yg4.js";import{o as xn,be as gw,aZ as Td,aK as bw}from"./index-Btfv_3-Q.js";import{P as Bm}from"./plus-DvWl4lHk.js";import{a as yw,C as xw}from"./copy-J9XXv57X.js";import{C as kw}from"./check-BAYRiedE.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-GMplVEZG.js","assets/javascript-wDzz0qaB.js","assets/css-DPfMkruS.js","assets/scss-OYdSNvt2.js","assets/vue-DVfSmUF7.js","assets/typescript-BPQ3VLAy.js","assets/json-Cp-IABpG.js","assets/svelte-DZMnMd3x.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/cpp-BRuaLJcg.js","assets/c-BIGW1oBm.js","assets/sql-BLtJtn59.js","assets/ruby-BGX7qA9Y.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/tsx-COt5Ahok.js","assets/shellscript-Yzrsuije.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/php-Dhbhpdrm.js","assets/shellsession-BADoaaVG.js","assets/nginx-BpAMiNFr.js","assets/meta2dEngine-BD2XbzaV-DeIPntMM.js","assets/meta2d-DP4Vt_ZE.js","assets/react-vendor-BVS1XoFi.js","assets/editor-DBWWidi3.js","assets/ui-CEFkTVnG.js","assets/motion-BAXVQJfN.js","assets/diagram-BF8g9yg4.js","assets/index-92xZ1zjh.js","assets/index-DE_nAopH.css","assets/plus-Ss1czARp.js","assets/copy-BT35-MU9.js","assets/check-65pb-o1o.js","assets/DiagramEditor-NtNY3sZL-BuZCaqLT.js"])))=>i.map(i=>d[i]);
2
+ var x7=Object.defineProperty;var k7=(e,t,n)=>t in e?x7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Mn=(e,t,n)=>k7(e,typeof t!="symbol"?t+"":t,n);import{B as eb,_ as Oe,r as E,af as w7,ag as v7,ah as S7,ai as Dn,aj as Xh,ak as Em,al as C7,j as O,b as Pi,am as _7,an as E7,ao as T7,ap as A7,z as M7,C as Jh,aq as N7,ar as D7,as as I7,at as L7}from"./react-vendor-BVS1XoFi.js";import{P as ze,e as Yh,A as ru,a as Ut,b as tb,w as de,c as fn,k as Cn,n as lt,F as Wr,p as Bi,$ as ce,O as Ln,G as pr,d as gs,l as gd,z as Sn,r as gt,v as nb,B as je,X as Fn,T as rb,M as Il,L as Ai,W as ml,f as hi,g as bs,h as So,C as Zh,Y as ib,y as Pt,i as Ll,H as Xe,j as F7,t as O7,m as Lo,J as bn,o as sb,R as fi,S as iu,Q as Zn,q as ob,s as z7,u as Aa,x as mt,E as R7,D as yc,I as P7,K as B7,_ as $7,N as su,U as bd,Z as ys,a0 as Co,a1 as Tt,a2 as ab,a3 as yn,a4 as j7,a5 as q7,a6 as Hr,a7 as Li,a8 as Fl,a9 as _n,aa as yd,ab as H7,ac as ub,ad as xd,ae as kd,af as _o,V as hn,ag as lb,ah as Qh,ai as U7,aj as cb,ak as W7,al as K7,am as V7,an as G7,ao as hb,ap as Qn,aq as X7,ar as jr,as as qn,at as xs,au as Tm,av as Am,aw as J7,ax as Y7,ay as Z7,az as Q7,aA as Ma,aB as fb,aC as db,aD as aa,aE as Na,aF as ou,aG as ek,aH as ef,aI as Mm,aJ as tk,aK as nk,aL as pb,aM as rk,aN as ik,aO as sk,aP as wd,aQ as Rr,aR as Eo,aS as vd,aT as ma,aU as fs,aV as Da,aW as tf,aX as Nm,aY as ga,aZ as gl,a_ as Ol,a$ as ok,b0 as ak,b1 as uk,b2 as lk,b3 as ck,b4 as Pr,b5 as hk,b6 as fk,b7 as dk,b8 as Dm,b9 as bl,ba as Im,bb as pk,bc as mk,bd as gk,be as bk,bf as ks,bg as Lm,bh as nf,bi as yk,bj as xk,bk as kk,bl as wk,bm as Fm,bn as ii,bo as Ia,bp as rf,bq as vk,br as ua,bs as mb,bt as gb,bu as bb,bv as yb,bw as xb,bx as Sk,by as Ck,bz as Sd,bA as kb,bB as _k,bC as Ek,bD as Cd,bE as Tk,bF as sf,bG as wb,bH as vb,bI as Ak,bJ as Mk,bK as Ju,bL as Sb,bM as Nk,bN as Dk,bO as Ik,bP as Cb,bQ as Lk,bR as Fk,bS as _b,bT as zl,bU as Ok,bV as zk,bW as Rk}from"./editor-DBWWidi3.js";import{as as tt,at,au as Pk,av as La,aw as Bk,ax as Rl,ay as $k,az as wi,aA as Zo,aB as jk,aC as qk,aD as Hk,aE as Uk,aF as Wk,aG as Kk,aH as Vk,aI as Gk,ad as _d,aJ as Xk,aK as It,ac as qr,aL as of,aM as Fa,aN as Ue,aO as Pl,aP as Eb,aQ as Jk,aR as zn,aS as Yk,aT as Zk,aU as Qk,aV as au,aW as Ed,aX as af,aY as Bl,aZ as Tb,a_ as ew,a$ as Om,b0 as tw,b1 as nw,t as uf,b2 as Ab,b3 as rw,b4 as iw,b5 as Mb,b6 as Nb,b7 as sw}from"./ui-CEFkTVnG.js";import{i as B0,j as ow,k as aw,l as uw,n as zm,e as Qo,s as lw,y as cw,h as Rm,m as Pm,r as hw,u as fw,v as dw,o as pw,w as mw,x as Db}from"./diagram-BF8g9yg4.js";import{o as xn,be as gw,aZ as Td,aK as bw}from"./index-92xZ1zjh.js";import{P as Bm}from"./plus-Ss1czARp.js";import{a as yw,C as xw}from"./copy-BT35-MU9.js";import{C as kw}from"./check-65pb-o1o.js";/**
3
3
  * @license lucide-react v0.562.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -1729,7 +1729,7 @@ ${this.__markdown}
1729
1729
  ## 分支 2`,style:{border:"none",flex:1,fontFamily:"monospace",fontSize:14,lineHeight:1.6,outline:"none",padding:16,resize:"none"},value:r})]}),O.jsx("div",{style:{display:"flex",flexDirection:"column",width:"50%"},children:O.jsx(Wx,{markdown:r})})]})]})}function Oq({className:e,editor:t,node:n}){const[r,i]=E.useState(!1),s=n.__markdown;E.useLayoutEffect(()=>{const u=n.getKey();let l=!1;t.getEditorState().read(()=>{const h=ze(u);h&&j4(h)&&h.__autoOpenEditor&&(l=!0)}),l&&(i(!0),t.update(()=>{const h=ze(u);h&&j4(h)&&h.__autoOpenEditor&&h.clearAutoOpenEditor()}))},[t,n.getKey()]);const o=E.useCallback(()=>{t.update(()=>{const u=n.getLatest(),l=u.getNextSibling(),h=u.getPreviousSibling();if(u.remove(),l){l.selectStart();return}h&&h.selectEnd()})},[t,n]),a=E.useCallback(u=>{t.update(()=>{n.updateMarkdown(u)}),i(!1)},[t,n]);return r?O.jsx("div",{className:e,children:O.jsx(Fq,{markdown:s,onClose:()=>i(!1),onSave:a})}):O.jsxs("div",{className:e,style:{margin:"8px 0",position:"relative"},children:[O.jsxs("div",{style:{bottom:8,display:"flex",gap:4,position:"absolute",right:8,zIndex:10},children:[O.jsx("button",{onClick:()=>i(!0),style:{background:"rgba(0,0,0,0.5)",border:"none",borderRadius:4,color:"#fff",cursor:"pointer",fontSize:12,padding:"4px 8px"},type:"button",children:"编辑"}),O.jsx("button",{onClick:o,style:{background:"rgba(255,77,79,0.7)",border:"none",borderRadius:4,color:"#fff",cursor:"pointer",fontSize:12,padding:"4px 8px"},type:"button",children:"删除"})]}),O.jsx("div",{style:{border:"1px solid #f0f0f0",borderRadius:8,height:350},children:O.jsx(Wx,{markdown:s})})]})}function yU({className:e,theme:t}){const[n]=_t(),r=E.useCallback((s,o)=>O.jsx(Oq,{className:e,editor:o,node:s}),[e]),i=E.useRef(!1);return i.current||(i.current=!0,n.registerPlugin(Lq,{decorator:r,theme:t})),null}const zq=lt("INSERT_MATH_COMMAND"),Kx=lt("UPDATE_MATH_COMMAND"),Nl=lt("SELECT_MATH_SIDE_COMMAND");function Rq(e){return gt(e.registerCommand(zq,t=>{const{code:n}=t;return e.update(()=>{const r=cu(n);_n([r]),qn(r.getParentOrThrow())&&xs(r,hn).selectEnd()}),!0},Fn),e.registerCommand(Kx,t=>{const{code:n,key:r}=t;return e.update(()=>{const i=ze(r);i&&(i.updateCode(n),i.selectNext())}),!0},Fn),e.registerCommand(Nl,t=>{const{key:n,prev:r}=t;return e.update(()=>{const i=ze(n);i&&(r?i.selectPrevious():i.selectNext())}),!0},Fn))}function Pq(e){const t=e.trim();return t?!!(/\\[A-Za-z]/.test(t)||/[\d!()*+,/<=>^_{|}-]/.test(t)||/^[A-Za-z]$/.test(t)):!1}rn();Bt();Ot();var wo;const Bq=(wo=class extends zt{constructor(t,n){super(),this.kernel=t,this.config=n,this.logger=Qe("plugin","math"),t.registerNodes([xa,Fi]),n!=null&&n.theme&&t.registerThemes(n==null?void 0:n.theme),this.registerDecorator(t,xa.getType(),(r,i)=>n!=null&&n.decorator?n.decorator(r,i):null),this.registerDecorator(t,Fi.getType(),(r,i)=>n!=null&&n.decorator?n.decorator(r,i):null)}onInit(t){this.register(Rq(t)),this.registerMarkdown()}registerMarkdown(){const t=this.kernel.requireService(Lt);t==null||t.registerMarkdownShortCut({regExp:/\$([^\s$](?:[^$]*[^\s$])?)\$\s?$/,replace:(n,r)=>{const[,i]=r;if(!Pq(i))return;const s=cu(i);this.logger.debug("Math node inserted:",s),n.insertBefore(s),n.setTextContent(""),n.select()},trigger:"$",type:"text-match"}),t==null||t.registerMarkdownShortCut({regExp:/^(\$\$)$/,replace:(n,r,i,s)=>{const o=wc();s||n.getNextSibling()?n.replace(o):n.insertBefore(o);const a=bn();a.add(o.getKey()),je(a)},trigger:"enter",type:"element"}),t==null||t.registerMarkdownWriter(xa.getType(),(n,r)=>(n.appendLine(r.getTextContent()),!0)),t==null||t.registerMarkdownWriter(Fi.getType(),(n,r)=>(n.appendLine(r.getTextContent()),!0)),t==null||t.registerMarkdownReader("inlineMath",n=>ke.createElementNode("math",{code:n.value,version:1})),t==null||t.registerMarkdownReader("math",n=>ke.createElementNode("mathBlock",{code:n.value,version:1}))}},wo.pluginName="MathPlugin",wo),Vx=E.memo(({children:e,isBlockMode:t,mathDOM:n,onFocus:r,prev:i})=>{const s=E.useRef(null),[o,a]=E.useState(void 0),u=E.useRef(void 0),l=E.useCallback(m=>{const y=typeof m=="number"?Math.round(m):void 0;u.current!==y&&(u.current=y,a(y))},[]),h=E.useCallback(()=>{if(!t){l(void 0);return}const m=n==null?void 0:n.closest('[contenteditable="true"]');m&&l(m.getBoundingClientRect().width)},[t,n,l]),d=E.useCallback(()=>Zc({callback:()=>{!s.current||!n||(r==null||r(),h())},floating:s.current,placement:t?"bottom-start":"bottom",reference:n}),[t,n,r,h]),g=E.useCallback(()=>{n&&d()},[n,d]);return E.useEffect(()=>{if(!n||!s.current)return;const m=s.current,y=new ResizeObserver(()=>{h()});y.observe(m);let w=null;return t&&(w=n.closest('[contenteditable="true"]'),w&&y.observe(w)),d(),window.addEventListener("resize",d),()=>{y.disconnect(),window.removeEventListener("resize",d)}},[n,i,t,d]),E.useEffect(()=>{n||!s.current||tu(s.current)},[n]),O.jsx(au,{arrow:!1,content:O.jsx(It,{className:zi.mathEditor,"data-math-editor-container":!0,style:o?{width:o}:void 0,children:e}),open:!!n,placement:t?"bottomLeft":"bottom",styles:{content:{borderRadius:"6px",padding:0}},children:O.jsx("span",{className:zi.mathEditorAnchor,onClick:g,ref:s})})});Vx.displayName="MathEditorContainer";Hb();const Gx=E.memo(({focusRef:e,mathNode:t,onArrowLeft:n,onArrowRight:r,onCancel:i,onDelete:s,onSubmit:o,onValidationChange:a,onValueChange:u,value:l})=>{const h=nr(),d=E.useRef(null),[g,m]=E.useState("");E.useEffect(()=>{e==null||e(d.current)},[e]),E.useEffect(()=>{if(!t)return;if(!l.trim()){m(""),a==null||a(!0);return}const w=setTimeout(()=>{try{tw(l,{displayMode:!0,throwOnError:!0}),m(""),a==null||a(!0)}catch(_){m(_ instanceof Error?_.message:"LaTeX Parse Error"),a==null||a(!1)}},50);return()=>clearTimeout(w)},[l,t,a]);const y=E.useCallback(w=>{if(t){if(ob(w,qb)&&w.key==="Enter"){w.preventDefault(),o();return}if(w.key==="Escape"){w.preventDefault(),i();return}if(w.key==="Backspace"&&!l.trim()){w.preventDefault(),s();return}w.key==="ArrowLeft"&&w.currentTarget.selectionStart===0&&(w.preventDefault(),n()),w.key==="ArrowRight"&&w.currentTarget.selectionStart===w.currentTarget.value.length&&(w.preventDefault(),r())}},[t,o,i,s,n,r,l]);return O.jsxs(O.Fragment,{children:[O.jsx(nw,{autoFocus:!0,autoSize:{maxRows:6,minRows:1},className:zi.mathEditorTextArea,onChange:w=>{u(w.target.value)},onKeyDown:y,placeholder:`${h("math.placeholder")}...`,ref:d,resize:!1,value:l,variant:"borderless"}),g&&O.jsx(It,{className:zi.mathEditorFooter,horizontal:!0,paddingBlock:4,paddingInline:12,width:"100%",children:O.jsx(qr,{fontSize:13,type:"danger",children:g})}),O.jsx(It,{className:zi.mathEditorFooter,horizontal:!0,justify:"flex-end",padding:4,width:"100%",children:O.jsxs(Pl,{onClick:w=>{w.preventDefault(),o()},size:"small",type:"text",variant:"filled",children:[h("confirm"),O.jsx(Eb,{compact:!0,keys:"mod+enter",variant:"borderless"})]})})]})});Gx.displayName="MathEditorContent";kr();const $q=E.memo(({renderComp:e})=>{const t=E.useRef(null),n=E.useRef(!1),[r,i]=E.useState(null),[s,o]=E.useState(""),a=E.useRef(""),u=E.useRef(!0),[l,h]=E.useState(null),[d,g]=E.useState(!1),[m,y]=E.useState(!1),[w,_]=E.useState(!1),[v]=_t();E.useEffect(()=>{if(!r||!u.current)return;const z=setTimeout(()=>{const V=v.getLexicalEditor();if(V&&!n.current){const X=r.code;if(s&&X&&X===s)return;n.current=!0,V.update(()=>{if(V.getEditorState().read(()=>V.getElementByKey(r.getKey()))){const ee=r.getWritable();ee.__code=s}}),setTimeout(()=>{n.current=!1},50)}},50);return()=>clearTimeout(z)},[s,r,v]);const M=E.useCallback(()=>{if(!r)return;const z=v.getLexicalEditor();if(z){const V=u.current?s:a.current;z.dispatchCommand(Kx,{code:V,key:r.getKey()})}},[v,r,s]),T=E.useCallback(()=>{if(!r)return;const z=v.getLexicalEditor();z&&(z.dispatchCommand(Nl,{key:r.getKey(),prev:!1}),z.focus())},[r,v]),D=E.useCallback(()=>{if(!r)return;const z=v.getLexicalEditor();z&&z.update(()=>{r.remove()})},[r,v]),R=E.useCallback(()=>{r&&v.dispatchCommand(Nl,{key:r.getKey(),prev:!0})},[r,v]),F=E.useCallback(()=>{r&&v.dispatchCommand(Nl,{key:r.getKey(),prev:!1})},[r,v]),j=E.useCallback(()=>{var z,V,X,ee;(z=t.current)==null||z.focus(),d&&((ee=(X=(V=t.current)==null?void 0:V.resizableTextArea)==null?void 0:X.textArea)==null||ee.setSelectionRange(0,0))},[d]),K=E.useCallback(z=>{t.current=z},[]);br(z=>gt(z.registerUpdateListener(({prevEditorState:V})=>{if(n.current)return;const X=z.getEditorState().read(()=>{const ee=ce();if(!Ln(ee))return!1;const Q=ee.getNodes()[0];if(!x3(Q))return!1;const ae=r&&r.getKey()===Q.getKey();return i(Q),!ae&&Q.code!==s&&(o(Q.code),a.current=Q.code,u.current=!0),h(z.getElementByKey(Q.getKey())),y(Q instanceof Fi),Q});if(X){const ee=V.read(()=>{const Q=V._selection;return de(Q)?Q.anchor.key:!1});z.getEditorState().read(()=>{const Q=ee?ze(ee):null;Q&&h9(Q,X)<0?g(!0):g(!1)}),_(!0)}X||(i(null),h(null),o(""),a.current="",u.current=!0,y(!1),_(!1))})),[r,s]);const U=O.jsx(Gx,{focusRef:K,mathNode:r,onArrowLeft:R,onArrowRight:F,onCancel:T,onDelete:D,onSubmit:M,onValidationChange:z=>{u.current=z,z&&(a.current=s)},onValueChange:o,value:s});return E.useEffect(()=>{if(!w)return;const z=V=>{const X=V.target;X&&(Array.from(document.querySelectorAll("[data-math-editor-container]")).some(ee=>ee&&ee.contains(X))||T())};return document.addEventListener("mousedown",z),document.addEventListener("touchstart",z),()=>{document.removeEventListener("mousedown",z),document.removeEventListener("touchstart",z)}},[w,T]),e?O.jsx(O.Fragment,{children:e({children:O.jsx("div",{"data-math-editor-container":!0,children:U}),open:w})}):O.jsx(Yc,{children:O.jsx(Vx,{isBlockMode:m,mathDOM:l,onFocus:j,prev:d,children:U})})}),jq=({mathBlock:e})=>{const t=nr(),n=O.jsx(qr,{as:"span",className:at("katex",zi.mathPlaceholder),fontSize:e?"1.2em":"1em",type:"secondary",children:t("math.placeholder")});return e?O.jsx(af,{padding:18,width:"100%",children:n}):n};Ot();const qq=Qe("plugin","math"),Hq=({editor:e,node:t,className:n})=>{const r=E.useRef(null),[i,s,o]=zo(t.getKey()),[a,u]=E.useState(!1),l=t instanceof Fi;return E.useEffect(()=>{r.current&&t.code&&Yk.render(t.code,r.current,{displayMode:t instanceof Fi,throwOnError:!1})},[t.code]),E.useEffect(()=>{const h=e.getElementByKey(t.getKey());if(h){const d=setTimeout(()=>{a?(Ut(h,"editing"),ua(h,"selected")):i?(Ut(h,"selected"),ua(h,"editing")):(ua(h,"selected"),ua(h,"editing"))},10);return()=>clearTimeout(d)}},[i,a,e,t]),br(h=>h.registerUpdateListener(()=>{h.getEditorState().read(()=>{const d=ce();if(!Ln(d)){u(!1);return}const g=d.getNodes()[0];if(!x3(g)){u(!1);return}g.getKey()===t.getKey()?u(!0):u(!1)})}),[t]),O.jsx("span",{className:n,onClick:E.useCallback(h=>{qq.debug("📊 Math click event:",h.target===r.current),h.preventDefault(),h.stopPropagation(),i&&o(),s(!0),e.focus()},[o,e,i,s]),ref:r,children:t.code?t.code:O.jsx(jq,{mathBlock:l})})},Uq=({className:e,renderComp:t,theme:n})=>{const[r]=_t();return E.useLayoutEffect(()=>{r.registerPlugin(Vi),r.registerPlugin(Bq,{decorator:(i,s)=>O.jsx(Hq,{className:e,editor:s,node:i}),theme:n||zi})},[r,e,n,zi]),O.jsx($q,{renderComp:t})};Uq.displayName="ReactMathPlugin";var Gs=class Dl extends Wr{static getType(){return"meta2d"}static clone(t){return new Dl(t.__diagram,t.__svg,t.__key,t.__autoOpenEditor)}static importJSON(t){return new Dl(t.diagram,t.svg)}constructor(t="",n="",r,i=!1){super(r),this.__diagram=t,this.__svg=n,this.__autoOpenEditor=i}clearAutoOpenEditor(){const t=this.getWritable();t.__autoOpenEditor=!1}createDOM(t){const n=document.createElement("div");return Ut(n,t.theme.meta2d??"editor-meta2d"),n}decorate(t){var r;const n=(r=Hi(t))==null?void 0:r.getDecorator(Dl.getType());return n?typeof n=="function"?n(this,t):{queryDOM:n.queryDOM,render:n.render(this,t)}:null}exportJSON(){return{...super.exportJSON(),diagram:this.__diagram,svg:this.__svg}}getTextContent(){return`---meta2d---
1730
1730
  ${this.__diagram}
1731
1731
  ---/meta2d---
1732
- `}isInline(){return!1}updateDiagram(t,n){const r=this.getWritable();r.__diagram=t,r.__svg=n}updateDOM(){return!1}};function Xx(e="",t="",n){return Cn(new Gs(e,t,void 0,(n==null?void 0:n.autoOpenEditor)??!1))}function H4(e){return e instanceof Gs}const Wq=lt("INSERT_META2D_COMMAND");function Kq(e){return e.registerCommand(Wq,t=>(e.update(()=>{var n;_n([Xx(((n=t==null?void 0:t.diagram)==null?void 0:n.trim())||Cl,(t==null?void 0:t.svg)!==void 0&&t.svg.trim()!==""?t.svg:nc,{autoOpenEditor:(t==null?void 0:t.autoOpenEditor)??!0})])}),!0),Tt)}rn();Bt();const Vq=/^---meta2d---$/i,Gq=/---meta2d---(\\n?)([\S\s]*?)\n?---\/meta2d---/i;function Xq(e){return(e.children||[]).map(t=>"value"in t&&typeof t.value=="string"?t.value:"").join("")}var vo;const Jq=(vo=class extends zt{constructor(t,n){super(),this.kernel=t,this.config=n,t.registerNodes([Gs]),n!=null&&n.theme&&t.registerThemes(n.theme),this.registerDecorator(t,Gs.getType(),(r,i)=>n!=null&&n.decorator?n.decorator(r,i):null)}onInit(t){this.register(Kq(t)),this.registerMarkdown()}registerMarkdown(){const t=this.kernel.requireService(Lt);t&&(t.registerMarkdownShortCut({regExp:Vq,replace:n=>{const r=Xx(Cl,nc,{autoOpenEditor:!0});n.replace(r);const i=bn();i.add(r.getKey()),je(i)},trigger:"enter",type:"element"}),t.registerMarkdownWriter(Gs.getType(),(n,r)=>{const i=r;return n.appendLine("---meta2d---"),n.appendLine(i.__diagram||Cl),n.appendLine("---/meta2d---"),!0}),t.registerMarkdownReader("paragraph",n=>{var s;const r=Xq(n).match(Gq);if(!r)return!1;const i=((s=r[2])==null?void 0:s.trim())||Cl;return ke.createTypeNode(Gs.getType(),{diagram:i,svg:yD(i)})},1))}},vo.pluginName="Meta2dPlugin",vo);let U4=null;function Yq(){return U4??(U4=Oe(()=>import("./meta2dEngine-BD2XbzaV-MY1Hyyeh.js"),__vite__mapDeps([23,24,25,26,27,28,29,30,31,32,33,34]))),U4}async function Zq(e){return(await Yq()).generateSvgFromDiagram(e)}function Qq(e){const t=e.trimStart();return t.startsWith("<svg")?t.replace(/^<svg\b/,'<svg style="max-width:100%;height:auto;display:block;margin:0 auto" '):e}function W4({color:e,label:t,onClick:n,title:r}){return O.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n()},style:{alignItems:"center",background:"#fff",border:"1px solid #e5e5e5",borderRadius:6,color:e,cursor:"pointer",display:"inline-flex",height:28,justifyContent:"center",width:28},title:r,type:"button",children:t})}function eH({diagram:e,onDelete:t,onEdit:n,onSvgReady:r,svg:i}){const[s,o]=E.useState(!1),[a,u]=E.useState(null),[l,h]=E.useState(!1),[d,g]=E.useState(!1),m=E.useRef(null);return E.useEffect(()=>{u(null),g(!1)},[e]),E.useEffect(()=>{if(!e||d||s)return;if(i){m.current=e;return}let y=!0;const w=window.setTimeout(()=>{y&&(u("Preview timeout (still loading). Double-click to open editor."),g(!0),o(!1))},5e3);return o(!0),Zq(e).then(_=>{if(y){if(window.clearTimeout(w),_){m.current=e,r(_);return}u("Preview generation failed. Double-click to open editor."),g(!0)}}).finally(()=>{y&&o(!1)}),()=>{y=!1,window.clearTimeout(w)}},[e,d,r,i]),O.jsxs("div",{onDoubleClick:y=>{y.stopPropagation(),n()},onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{background:"#fff",border:"1px solid #efefef",borderRadius:10,cursor:"pointer",minHeight:140,overflow:"hidden",padding:10,position:"relative"},children:[l&&!!i&&O.jsxs("div",{style:{display:"flex",gap:8,position:"absolute",right:10,top:10,zIndex:1},children:[O.jsx(W4,{color:"#1677ff",label:"✎",onClick:n,title:"Edit diagram"}),O.jsx(W4,{color:"#ff4d4f",label:"🗑",onClick:t,title:"Delete diagram"})]}),i?O.jsx("div",{style:{alignItems:"center",display:"flex",justifyContent:"center",maxHeight:400,overflow:"auto",width:"100%"},children:O.jsx("div",{dangerouslySetInnerHTML:{__html:Qq(i)},style:{lineHeight:0,maxWidth:"100%",width:"100%"}})}):O.jsx("div",{style:{alignItems:"center",color:a?"#cf1322":"#999",display:"flex",justifyContent:"center",minHeight:120,textAlign:"center"},children:s?"Generating preview...":a||"Double-click to edit diagram"})]})}const tH=E.memo(eH),nH=E.lazy(async()=>({default:(await Oe(async()=>{const{DiagramEditor:e}=await import("./DiagramEditor-NtNY3sZL-KWdKFFEL.js");return{DiagramEditor:e}},__vite__mapDeps([35,25,23,24,26,27,28,29,30,31,32,33,34]))).DiagramEditor}));function rH({className:e,editor:t,node:n}){const[r,i]=E.useState(!1),s=n.__diagram,o=n.__svg;E.useLayoutEffect(()=>{const l=n.getKey();let h=!1;t.getEditorState().read(()=>{const d=ze(l);d&&H4(d)&&d.__autoOpenEditor&&(h=!0)}),h&&i(!0),h&&t.update(()=>{const d=ze(l);d&&H4(d)&&d.__autoOpenEditor&&d.clearAutoOpenEditor()})},[t,n.getKey()]);const a=E.useCallback(()=>{t.update(()=>{const l=n.getLatest(),h=l.getNextSibling(),d=l.getPreviousSibling();if(l.remove(),h){h.selectStart();return}d&&d.selectEnd()})},[t,n]),u=E.useCallback((l,h)=>{t.update(()=>{n.updateDiagram(l,h)}),i(!1)},[t,n]);return O.jsxs("div",{className:e,style:{margin:0},children:[O.jsx(tH,{diagram:s,onDelete:a,onEdit:()=>i(!0),onSvgReady:E.useCallback(l=>{t.update(()=>{n.updateDiagram(n.__diagram,l)})},[t,n]),svg:o}),r&&O.jsx(E.Suspense,{fallback:null,children:O.jsx(nH,{diagram:s,onClose:()=>i(!1),onSave:u})})]})}function xU({className:e,theme:t}){const[n]=_t(),r=E.useCallback((i,s)=>O.jsx(rH,{className:e,editor:s,node:i}),[e]);return E.useLayoutEffect(()=>{n.registerPlugin(Jq,{decorator:r,theme:t})},[r,n,t]),null}const Jx=E.createContext(null),iH=({children:e,defaultVisible:t=!0})=>{const[n,r]=E.useState(t),i=E.useCallback(()=>r(o=>!o),[]),s=E.useMemo(()=>({setVisible:r,toggle:i,visible:n}),[i,n]);return O.jsx(Jx.Provider,{value:s,children:e})};iH.displayName="OutlineProvider";function Y1(){return E.useContext(Jx)}function kU(){const e=Y1();if(!e)throw new Error("useOutlineVisibility must be used within <OutlineProvider>.");return e}function sH(e){const t=Y1(),n=(e==null?void 0:e.visible)!==void 0&&(e==null?void 0:e.onVisibleChange)!==void 0;return E.useMemo(()=>n&&(e!=null&&e.onVisibleChange)?{ready:!0,toggle:()=>e.onVisibleChange(!e.visible),visible:e.visible}:t?{ready:!0,toggle:t.toggle,visible:t.visible}:{ready:!1},[e==null?void 0:e.onVisibleChange,e==null?void 0:e.visible,t,n])}kr();const wU=({editor:e,visible:t})=>{const n=Y1(),r=E.useMemo(()=>t!==void 0?t:(n==null?void 0:n.visible)??!0,[t,n==null?void 0:n.visible]),[i,s]=E.useState([]),o=E.useCallback(()=>{const u=[],l=Sn(),h=d=>{for(const g of d){if(_o(g)){const m=g.getTextContent().trim();m&&u.push({key:g.getKey(),level:parseInt(g.getTag()[1],10),text:m})}if(fn(g)){const m=g.getChildren();m.length>0&&h(m)}}};h(l.getChildren()),s(u)},[]);E.useEffect(()=>{const u=e.getLexicalEditor();let l=Fo;const h=d=>(l=d.registerUpdateListener(({editorState:g})=>{g.read(o)}),d.getEditorState().read(o),l);return u?h(u):(e.on("initialized",h),()=>{l(),e.off("initialized",h)})},[e,o]);const a=E.useCallback(u=>{const l=e.getLexicalEditor();l&&(l.update(()=>{const h=bn();h.add(u),je(h)}),requestAnimationFrame(()=>{const h=l.getElementByKey(u);h&&h.scrollIntoView({behavior:"smooth",block:"center"})}))},[e]);return!r||i.length===0?null:O.jsxs("div",{style:{borderLeft:"1px solid rgba(0, 0, 0, 0.08)",paddingLeft:12},children:[O.jsx("div",{style:{color:"rgba(0,0,0,0.45)",fontSize:12,fontWeight:600,marginBottom:8},children:"OUTLINE"}),i.map(u=>O.jsx("div",{onClick:()=>a(u.key),onMouseEnter:l=>{l.currentTarget.style.background="rgba(0,0,0,0.04)"},onMouseLeave:l=>{l.currentTarget.style.background="transparent"},style:{borderRadius:4,color:"rgba(0,0,0,0.75)",cursor:"pointer",fontSize:13,lineHeight:"28px",overflow:"hidden",paddingLeft:(u.level-1)*16+8,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.text},u.key))]})},oH="Hide outline",aH="Show outline",uH="outline";function vU(e){const{collapseTitle:t=oH,expandTitle:n=aH,onVisibleChange:r,visible:i}=e??{},s=sH(i!==void 0&&r!==void 0?{onVisibleChange:r,visible:i}:void 0);return E.useMemo(()=>{if(!s.ready)return null;const{toggle:o,visible:a}=s;return{active:a,icon:a?zb:Fw,key:uH,label:a?t:n,onClick:o}},[t,n,s])}kr();function lH(e,t){const{domRows:n}=e;for(const[r,i]of n.entries())if(i)for(const[s,o]of i.entries()){if(!o)continue;const a=jr(o.elem);a!==null&&t(o,a,{x:s,y:r})}}function cH(e,t){const n=t.elem,r=e._config.theme;xc(hi(jr(n)),"Expected to find LexicalNode from Table Cell DOMNode"),Ut(n,r.tableCellSelected)}function hH(e,t){const n=t.elem;xc(hi(jr(n)),"Expected to find LexicalNode from Table Cell DOMNode");const r=e._config.theme;ua(n,r.tableCellSelected)}function fH(e,t,n){const r=new Set(n?n.getNodes():[]);lH(t,(i,s)=>{const o=i.elem;r.has(s)?(i.highlighted=!0,cH(e,i)):(i.highlighted=!1,hH(e,i),o.getAttribute("style")||o.removeAttribute("style"))})}function K4(e){const t=e.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function dH(){const e=ce();if(de(e)&&!e.isCollapsed()||fi(e)&&!e.anchor.is(e.focus)||!de(e)&&!fi(e))return!1;const[t]=Cb(e.anchor);return t.__colSpan>1||t.__rowSpan>1}function pH(e){const t=e.getLastDescendant();Pt(t)?t.select():fn(t)?t.selectEnd():t!==null&&t.selectNext()}function V4(e){return e.getEditorState().read(()=>{const t=ce();if(de(t)||fi(t)){const[n]=Cb(t.anchor);if(hi(n))return n.getBackgroundColor()}return null})}const Yx=E.memo(({editor:e,tableCellNode:t,cellMerge:n,children:r})=>{const[i,s]=E.useState(t),[o,a]=E.useState({columns:1,rows:1}),[u,l]=E.useState(!1),[h,d]=E.useState(!1),[,g]=E.useState(()=>V4(e)||""),m=nr();E.useEffect(()=>e.registerMutationListener(nf,K=>{K.get(i.getKey())==="updated"&&(e.getEditorState().read(()=>{s(i.getLatest())}),g(V4(e)||""))},{skipInitialization:!0}),[e,i]),E.useEffect(()=>{e.getEditorState().read(()=>{const K=ce();if(fi(K)){const U=K4(K);a(K4(K)),l(U.columns>1||U.rows>1)}d(dH())})},[e]);const y=E.useCallback(()=>{e.update(()=>{if(i.isAttached()){const K=ii(i),U=Ia(K,e.getElementByKey(K.getKey()));if(U===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");const z=rf(U);z!==null&&z.$clearHighlight(),K.markDirty(),s(i.getLatest())}je(null)})},[e,i]),w=()=>{e.update(()=>{const K=ce();if(!fi(K))return;const U=Lk(K.getNodes().filter(hi));U&&pH(U)})},_=()=>{e.update(()=>{Fk()})},v=E.useCallback(K=>{e.update(()=>{for(let U=0;U<o.rows;U++)wb(K)})},[e,o.rows]),M=E.useCallback(K=>{e.update(()=>{for(let U=0;U<o.columns;U++)vb(K)})},[e,o.columns]),T=E.useCallback(()=>{e.update(()=>{Ak()})},[e]),D=E.useCallback(()=>{e.update(()=>{ii(i).remove(),y()})},[e,i,y]),R=E.useCallback(()=>{e.update(()=>{Mk()})},[e]),F=E.useCallback(()=>{e.update(()=>{const K=ii(i),U=Cd(i),[z]=sf(K,null,null),V=new Set,X=i.getHeaderStyles()^Ju.ROW;for(let ee=0;ee<z[U].length;ee++){const Q=z[U][ee];Q!=null&&Q.cell&&(V.has(Q.cell)||(V.add(Q.cell),Q.cell.setHeaderStyles(X,Ju.ROW)))}y()})},[e,i,y]),j=E.useCallback(()=>{e.update(()=>{const K=ii(i),U=Sb(i),[z]=sf(K,null,null),V=new Set,X=i.getHeaderStyles()^Ju.COLUMN;for(const ee of z){const Q=ee[U];Q!=null&&Q.cell&&(V.has(Q.cell)||(V.add(Q.cell),Q.cell.setHeaderStyles(X,Ju.COLUMN)))}y()})},[e,i,y]);return O.jsx(Ed,{menu:{items:E.useMemo(()=>[{icon:Bw,key:"table-insert-row-above",label:m("table.insertRowAbove",{count:o.rows}),onClick:()=>v(!1)},{icon:zw,key:"table-insert-row-below",label:m("table.insertRowBelow",{count:o.rows}),onClick:()=>v(!0)},{type:"divider"},{icon:bw,key:"table-insert-column-before",label:m("table.insertColumnLeft",{count:o.columns}),onClick:()=>M(!1)},{icon:zb,key:"table-insert-column-after",label:m("table.insertColumnRight",{count:o.columns}),onClick:()=>M(!0)},{type:"divider"},{icon:Hw,key:"table-delete-columns",label:m("table.deleteColumn"),onClick:()=>R()},{icon:Ww,key:"table-delete-rows",label:m("table.deleteRow"),onClick:()=>T()},{type:"divider"},{icon:Dw,key:"table-delete",label:m("table.delete"),onClick:()=>D()}],[n,u,h,o.rows,o.columns,i.__headerState,w,_,v,M,R,T,D,F,j])},children:r})});Yx.displayName="TableActionMenu";const G4=tt(({css:e})=>({actionIcon:e`
1732
+ `}isInline(){return!1}updateDiagram(t,n){const r=this.getWritable();r.__diagram=t,r.__svg=n}updateDOM(){return!1}};function Xx(e="",t="",n){return Cn(new Gs(e,t,void 0,(n==null?void 0:n.autoOpenEditor)??!1))}function H4(e){return e instanceof Gs}const Wq=lt("INSERT_META2D_COMMAND");function Kq(e){return e.registerCommand(Wq,t=>(e.update(()=>{var n;_n([Xx(((n=t==null?void 0:t.diagram)==null?void 0:n.trim())||Cl,(t==null?void 0:t.svg)!==void 0&&t.svg.trim()!==""?t.svg:nc,{autoOpenEditor:(t==null?void 0:t.autoOpenEditor)??!0})])}),!0),Tt)}rn();Bt();const Vq=/^---meta2d---$/i,Gq=/---meta2d---(\\n?)([\S\s]*?)\n?---\/meta2d---/i;function Xq(e){return(e.children||[]).map(t=>"value"in t&&typeof t.value=="string"?t.value:"").join("")}var vo;const Jq=(vo=class extends zt{constructor(t,n){super(),this.kernel=t,this.config=n,t.registerNodes([Gs]),n!=null&&n.theme&&t.registerThemes(n.theme),this.registerDecorator(t,Gs.getType(),(r,i)=>n!=null&&n.decorator?n.decorator(r,i):null)}onInit(t){this.register(Kq(t)),this.registerMarkdown()}registerMarkdown(){const t=this.kernel.requireService(Lt);t&&(t.registerMarkdownShortCut({regExp:Vq,replace:n=>{const r=Xx(Cl,nc,{autoOpenEditor:!0});n.replace(r);const i=bn();i.add(r.getKey()),je(i)},trigger:"enter",type:"element"}),t.registerMarkdownWriter(Gs.getType(),(n,r)=>{const i=r;return n.appendLine("---meta2d---"),n.appendLine(i.__diagram||Cl),n.appendLine("---/meta2d---"),!0}),t.registerMarkdownReader("paragraph",n=>{var s;const r=Xq(n).match(Gq);if(!r)return!1;const i=((s=r[2])==null?void 0:s.trim())||Cl;return ke.createTypeNode(Gs.getType(),{diagram:i,svg:yD(i)})},1))}},vo.pluginName="Meta2dPlugin",vo);let U4=null;function Yq(){return U4??(U4=Oe(()=>import("./meta2dEngine-BD2XbzaV-DeIPntMM.js"),__vite__mapDeps([23,24,25,26,27,28,29,30,31,32,33,34]))),U4}async function Zq(e){return(await Yq()).generateSvgFromDiagram(e)}function Qq(e){const t=e.trimStart();return t.startsWith("<svg")?t.replace(/^<svg\b/,'<svg style="max-width:100%;height:auto;display:block;margin:0 auto" '):e}function W4({color:e,label:t,onClick:n,title:r}){return O.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n()},style:{alignItems:"center",background:"#fff",border:"1px solid #e5e5e5",borderRadius:6,color:e,cursor:"pointer",display:"inline-flex",height:28,justifyContent:"center",width:28},title:r,type:"button",children:t})}function eH({diagram:e,onDelete:t,onEdit:n,onSvgReady:r,svg:i}){const[s,o]=E.useState(!1),[a,u]=E.useState(null),[l,h]=E.useState(!1),[d,g]=E.useState(!1),m=E.useRef(null);return E.useEffect(()=>{u(null),g(!1)},[e]),E.useEffect(()=>{if(!e||d||s)return;if(i){m.current=e;return}let y=!0;const w=window.setTimeout(()=>{y&&(u("Preview timeout (still loading). Double-click to open editor."),g(!0),o(!1))},5e3);return o(!0),Zq(e).then(_=>{if(y){if(window.clearTimeout(w),_){m.current=e,r(_);return}u("Preview generation failed. Double-click to open editor."),g(!0)}}).finally(()=>{y&&o(!1)}),()=>{y=!1,window.clearTimeout(w)}},[e,d,r,i]),O.jsxs("div",{onDoubleClick:y=>{y.stopPropagation(),n()},onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{background:"#fff",border:"1px solid #efefef",borderRadius:10,cursor:"pointer",minHeight:140,overflow:"hidden",padding:10,position:"relative"},children:[l&&!!i&&O.jsxs("div",{style:{display:"flex",gap:8,position:"absolute",right:10,top:10,zIndex:1},children:[O.jsx(W4,{color:"#1677ff",label:"✎",onClick:n,title:"Edit diagram"}),O.jsx(W4,{color:"#ff4d4f",label:"🗑",onClick:t,title:"Delete diagram"})]}),i?O.jsx("div",{style:{alignItems:"center",display:"flex",justifyContent:"center",maxHeight:400,overflow:"auto",width:"100%"},children:O.jsx("div",{dangerouslySetInnerHTML:{__html:Qq(i)},style:{lineHeight:0,maxWidth:"100%",width:"100%"}})}):O.jsx("div",{style:{alignItems:"center",color:a?"#cf1322":"#999",display:"flex",justifyContent:"center",minHeight:120,textAlign:"center"},children:s?"Generating preview...":a||"Double-click to edit diagram"})]})}const tH=E.memo(eH),nH=E.lazy(async()=>({default:(await Oe(async()=>{const{DiagramEditor:e}=await import("./DiagramEditor-NtNY3sZL-BuZCaqLT.js");return{DiagramEditor:e}},__vite__mapDeps([35,25,23,24,26,27,28,29,30,31,32,33,34]))).DiagramEditor}));function rH({className:e,editor:t,node:n}){const[r,i]=E.useState(!1),s=n.__diagram,o=n.__svg;E.useLayoutEffect(()=>{const l=n.getKey();let h=!1;t.getEditorState().read(()=>{const d=ze(l);d&&H4(d)&&d.__autoOpenEditor&&(h=!0)}),h&&i(!0),h&&t.update(()=>{const d=ze(l);d&&H4(d)&&d.__autoOpenEditor&&d.clearAutoOpenEditor()})},[t,n.getKey()]);const a=E.useCallback(()=>{t.update(()=>{const l=n.getLatest(),h=l.getNextSibling(),d=l.getPreviousSibling();if(l.remove(),h){h.selectStart();return}d&&d.selectEnd()})},[t,n]),u=E.useCallback((l,h)=>{t.update(()=>{n.updateDiagram(l,h)}),i(!1)},[t,n]);return O.jsxs("div",{className:e,style:{margin:0},children:[O.jsx(tH,{diagram:s,onDelete:a,onEdit:()=>i(!0),onSvgReady:E.useCallback(l=>{t.update(()=>{n.updateDiagram(n.__diagram,l)})},[t,n]),svg:o}),r&&O.jsx(E.Suspense,{fallback:null,children:O.jsx(nH,{diagram:s,onClose:()=>i(!1),onSave:u})})]})}function xU({className:e,theme:t}){const[n]=_t(),r=E.useCallback((i,s)=>O.jsx(rH,{className:e,editor:s,node:i}),[e]);return E.useLayoutEffect(()=>{n.registerPlugin(Jq,{decorator:r,theme:t})},[r,n,t]),null}const Jx=E.createContext(null),iH=({children:e,defaultVisible:t=!0})=>{const[n,r]=E.useState(t),i=E.useCallback(()=>r(o=>!o),[]),s=E.useMemo(()=>({setVisible:r,toggle:i,visible:n}),[i,n]);return O.jsx(Jx.Provider,{value:s,children:e})};iH.displayName="OutlineProvider";function Y1(){return E.useContext(Jx)}function kU(){const e=Y1();if(!e)throw new Error("useOutlineVisibility must be used within <OutlineProvider>.");return e}function sH(e){const t=Y1(),n=(e==null?void 0:e.visible)!==void 0&&(e==null?void 0:e.onVisibleChange)!==void 0;return E.useMemo(()=>n&&(e!=null&&e.onVisibleChange)?{ready:!0,toggle:()=>e.onVisibleChange(!e.visible),visible:e.visible}:t?{ready:!0,toggle:t.toggle,visible:t.visible}:{ready:!1},[e==null?void 0:e.onVisibleChange,e==null?void 0:e.visible,t,n])}kr();const wU=({editor:e,visible:t})=>{const n=Y1(),r=E.useMemo(()=>t!==void 0?t:(n==null?void 0:n.visible)??!0,[t,n==null?void 0:n.visible]),[i,s]=E.useState([]),o=E.useCallback(()=>{const u=[],l=Sn(),h=d=>{for(const g of d){if(_o(g)){const m=g.getTextContent().trim();m&&u.push({key:g.getKey(),level:parseInt(g.getTag()[1],10),text:m})}if(fn(g)){const m=g.getChildren();m.length>0&&h(m)}}};h(l.getChildren()),s(u)},[]);E.useEffect(()=>{const u=e.getLexicalEditor();let l=Fo;const h=d=>(l=d.registerUpdateListener(({editorState:g})=>{g.read(o)}),d.getEditorState().read(o),l);return u?h(u):(e.on("initialized",h),()=>{l(),e.off("initialized",h)})},[e,o]);const a=E.useCallback(u=>{const l=e.getLexicalEditor();l&&(l.update(()=>{const h=bn();h.add(u),je(h)}),requestAnimationFrame(()=>{const h=l.getElementByKey(u);h&&h.scrollIntoView({behavior:"smooth",block:"center"})}))},[e]);return!r||i.length===0?null:O.jsxs("div",{style:{borderLeft:"1px solid rgba(0, 0, 0, 0.08)",paddingLeft:12},children:[O.jsx("div",{style:{color:"rgba(0,0,0,0.45)",fontSize:12,fontWeight:600,marginBottom:8},children:"OUTLINE"}),i.map(u=>O.jsx("div",{onClick:()=>a(u.key),onMouseEnter:l=>{l.currentTarget.style.background="rgba(0,0,0,0.04)"},onMouseLeave:l=>{l.currentTarget.style.background="transparent"},style:{borderRadius:4,color:"rgba(0,0,0,0.75)",cursor:"pointer",fontSize:13,lineHeight:"28px",overflow:"hidden",paddingLeft:(u.level-1)*16+8,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.text},u.key))]})},oH="Hide outline",aH="Show outline",uH="outline";function vU(e){const{collapseTitle:t=oH,expandTitle:n=aH,onVisibleChange:r,visible:i}=e??{},s=sH(i!==void 0&&r!==void 0?{onVisibleChange:r,visible:i}:void 0);return E.useMemo(()=>{if(!s.ready)return null;const{toggle:o,visible:a}=s;return{active:a,icon:a?zb:Fw,key:uH,label:a?t:n,onClick:o}},[t,n,s])}kr();function lH(e,t){const{domRows:n}=e;for(const[r,i]of n.entries())if(i)for(const[s,o]of i.entries()){if(!o)continue;const a=jr(o.elem);a!==null&&t(o,a,{x:s,y:r})}}function cH(e,t){const n=t.elem,r=e._config.theme;xc(hi(jr(n)),"Expected to find LexicalNode from Table Cell DOMNode"),Ut(n,r.tableCellSelected)}function hH(e,t){const n=t.elem;xc(hi(jr(n)),"Expected to find LexicalNode from Table Cell DOMNode");const r=e._config.theme;ua(n,r.tableCellSelected)}function fH(e,t,n){const r=new Set(n?n.getNodes():[]);lH(t,(i,s)=>{const o=i.elem;r.has(s)?(i.highlighted=!0,cH(e,i)):(i.highlighted=!1,hH(e,i),o.getAttribute("style")||o.removeAttribute("style"))})}function K4(e){const t=e.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function dH(){const e=ce();if(de(e)&&!e.isCollapsed()||fi(e)&&!e.anchor.is(e.focus)||!de(e)&&!fi(e))return!1;const[t]=Cb(e.anchor);return t.__colSpan>1||t.__rowSpan>1}function pH(e){const t=e.getLastDescendant();Pt(t)?t.select():fn(t)?t.selectEnd():t!==null&&t.selectNext()}function V4(e){return e.getEditorState().read(()=>{const t=ce();if(de(t)||fi(t)){const[n]=Cb(t.anchor);if(hi(n))return n.getBackgroundColor()}return null})}const Yx=E.memo(({editor:e,tableCellNode:t,cellMerge:n,children:r})=>{const[i,s]=E.useState(t),[o,a]=E.useState({columns:1,rows:1}),[u,l]=E.useState(!1),[h,d]=E.useState(!1),[,g]=E.useState(()=>V4(e)||""),m=nr();E.useEffect(()=>e.registerMutationListener(nf,K=>{K.get(i.getKey())==="updated"&&(e.getEditorState().read(()=>{s(i.getLatest())}),g(V4(e)||""))},{skipInitialization:!0}),[e,i]),E.useEffect(()=>{e.getEditorState().read(()=>{const K=ce();if(fi(K)){const U=K4(K);a(K4(K)),l(U.columns>1||U.rows>1)}d(dH())})},[e]);const y=E.useCallback(()=>{e.update(()=>{if(i.isAttached()){const K=ii(i),U=Ia(K,e.getElementByKey(K.getKey()));if(U===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");const z=rf(U);z!==null&&z.$clearHighlight(),K.markDirty(),s(i.getLatest())}je(null)})},[e,i]),w=()=>{e.update(()=>{const K=ce();if(!fi(K))return;const U=Lk(K.getNodes().filter(hi));U&&pH(U)})},_=()=>{e.update(()=>{Fk()})},v=E.useCallback(K=>{e.update(()=>{for(let U=0;U<o.rows;U++)wb(K)})},[e,o.rows]),M=E.useCallback(K=>{e.update(()=>{for(let U=0;U<o.columns;U++)vb(K)})},[e,o.columns]),T=E.useCallback(()=>{e.update(()=>{Ak()})},[e]),D=E.useCallback(()=>{e.update(()=>{ii(i).remove(),y()})},[e,i,y]),R=E.useCallback(()=>{e.update(()=>{Mk()})},[e]),F=E.useCallback(()=>{e.update(()=>{const K=ii(i),U=Cd(i),[z]=sf(K,null,null),V=new Set,X=i.getHeaderStyles()^Ju.ROW;for(let ee=0;ee<z[U].length;ee++){const Q=z[U][ee];Q!=null&&Q.cell&&(V.has(Q.cell)||(V.add(Q.cell),Q.cell.setHeaderStyles(X,Ju.ROW)))}y()})},[e,i,y]),j=E.useCallback(()=>{e.update(()=>{const K=ii(i),U=Sb(i),[z]=sf(K,null,null),V=new Set,X=i.getHeaderStyles()^Ju.COLUMN;for(const ee of z){const Q=ee[U];Q!=null&&Q.cell&&(V.has(Q.cell)||(V.add(Q.cell),Q.cell.setHeaderStyles(X,Ju.COLUMN)))}y()})},[e,i,y]);return O.jsx(Ed,{menu:{items:E.useMemo(()=>[{icon:Bw,key:"table-insert-row-above",label:m("table.insertRowAbove",{count:o.rows}),onClick:()=>v(!1)},{icon:zw,key:"table-insert-row-below",label:m("table.insertRowBelow",{count:o.rows}),onClick:()=>v(!0)},{type:"divider"},{icon:bw,key:"table-insert-column-before",label:m("table.insertColumnLeft",{count:o.columns}),onClick:()=>M(!1)},{icon:zb,key:"table-insert-column-after",label:m("table.insertColumnRight",{count:o.columns}),onClick:()=>M(!0)},{type:"divider"},{icon:Hw,key:"table-delete-columns",label:m("table.deleteColumn"),onClick:()=>R()},{icon:Ww,key:"table-delete-rows",label:m("table.deleteRow"),onClick:()=>T()},{type:"divider"},{icon:Dw,key:"table-delete",label:m("table.delete"),onClick:()=>D()}],[n,u,h,o.rows,o.columns,i.__headerState,w,_,v,M,R,T,D,F,j])},children:r})});Yx.displayName="TableActionMenu";const G4=tt(({css:e})=>({actionIcon:e`
1733
1733
  transform: translateX(2px);
1734
1734
  `,root:e`
1735
1735
  will-change: transform;
@@ -27,12 +27,12 @@
27
27
  opacity: 0.65;
28
28
  }
29
29
  </style>
30
- <script type="module" crossorigin src="/assets/index-Btfv_3-Q.js"></script>
30
+ <script type="module" crossorigin src="/assets/index-92xZ1zjh.js"></script>
31
31
  <link rel="modulepreload" crossorigin href="/assets/react-vendor-BVS1XoFi.js">
32
32
  <link rel="modulepreload" crossorigin href="/assets/motion-BAXVQJfN.js">
33
33
  <link rel="modulepreload" crossorigin href="/assets/ui-CEFkTVnG.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/diagram-BF8g9yg4.js">
35
- <link rel="stylesheet" crossorigin href="/assets/index-C1Mc0Svw.css">
35
+ <link rel="stylesheet" crossorigin href="/assets/index-DE_nAopH.css">
36
36
  </head>
37
37
  <body>
38
38
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fgbg/mdocs",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "A Markdown knowledge base for small teams",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,16 +0,0 @@
1
- import{o as m,c as B,U as A,V as S,W as k,l as j,Y as v,Z as I,_ as W,S as z,$ as H}from"./index-Btfv_3-Q.js";import{r as C,j as n}from"./react-vendor-BVS1XoFi.js";import{g as O}from"./file-type-policy-aRrzC4LZ.js";/**
2
- * @license lucide-react v0.562.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const R=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],L=m("chevron-up",R);/**
7
- * @license lucide-react v0.562.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const T=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M6.376 18.91a6 6 0 0 1 11.249.003",key:"hnjrf2"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}]],q=m("shield-user",T);/**
12
- * @license lucide-react v0.562.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const _=[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],K=m("text-align-justify",_);function N(){if(typeof navigator>"u")return!1;const e=navigator.userAgent||"",a=navigator.platform||"";return/Mac|iPhone|iPad|iPod/i.test(a)||/Mac OS X|Macintosh/i.test(e)}function U(){return N()?"⌘+Enter":"Alt+Enter"}function V(e){return e.key!=="Enter"||e.shiftKey||e.ctrlKey?!1:N()?e.metaKey&&!e.altKey:e.altKey&&!e.metaKey}function J(e){const{t:a,lang:u}=B(),l=O(e.fileType||"md"),D=!!(l!=null&&l.aiWrite&&e.onAiWrite),M=!!(l!=null&&l.comments&&e.onToggleComments),h=e.canEdit&&(e.editing||!!e.actionsAlwaysVisible),[c,P]=C.useState(!1),y=e.domains.length?e.domains:[A],b=!e.readerChrome&&!!e.onPublish&&h&&!e.busy;C.useEffect(()=>{if(!b)return;const t=o=>{var d;V(o)&&(o.preventDefault(),(d=e.onPublish)==null||d.call(e))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[b,e.onPublish]);const E=e.readerChrome?a("publish"):a("publishHotkeyHint",{hotkey:U()}),w=n.jsxs("span",{className:"mdocs-save-indicator","aria-live":"polite",children:[n.jsx("span",{className:"mdocs-save-dot "+(e.busy?"saving":e.draftExists?"unsaved":"saved")}),n.jsx("span",{children:e.busy?a("publishing"):e.draftExists?a("unsaved"):a("published")})]}),s="mdocs-editor-toolbar"+(e.readerChrome?e.readerHeaderDocked?" mdocs-editor-toolbar--docked":" mdocs-editor-toolbar--float":""),r=e.readerChrome&&!e.readerHeaderDocked&&e.readerDragOffset?{transform:`translateY(${e.readerDragOffset}px)`}:void 0;if(e.readerChrome){const t=n.jsxs("div",{className:"mdocs-editor-toolbar-leading",onPointerDown:e.onReaderHeaderPointerDown,onPointerMove:e.onReaderHeaderPointerMove,onPointerUp:e.onReaderHeaderPointerUp,onPointerCancel:e.onReaderHeaderPointerUp,children:[n.jsx("button",{type:"button",className:"mdocs-reader-nav-btn",onClick:()=>{var i;return(i=e.onOpenMobileNav)==null?void 0:i.call(e)},"aria-label":a("expandSidebar"),children:n.jsx(S,{size:18,strokeWidth:1.75})}),n.jsx("input",{className:"mdocs-editor-title-input",value:e.displayName,onChange:i=>e.onDisplayNameChange(i.target.value),onBlur:e.onDisplayNameBlur,placeholder:a("displayNamePlaceholder"),disabled:!e.editing,readOnly:!e.editing})]}),o=n.jsx(k,{domains:y,value:e.currentDomainId,onChange:e.onDomainChange,onDomainsChange:e.onDomainsChange,ariaLabel:a("currentDomainAria"),localizeName:i=>j(i,u,a)}),d=e.canEdit&&e.onPublish?n.jsx("button",{type:"button",className:"primary mdocs-reader-action-btn",disabled:e.busy,onMouseDown:i=>i.preventDefault(),onClick:()=>{var i,f;e.editing||(i=e.onEnterEdit)==null||i.call(e),(f=e.onPublish)==null||f.call(e)},children:e.busy?a("publishing"):a("publish")}):null,g=e.onSyncClick?n.jsx("button",{type:"button",className:"mdocs-sync-btn mdocs-reader-sync-btn"+(e.syncBehind?" behind":""),"aria-label":e.syncBehind?a("syncBehindHint"):a("syncPull"),onClick:()=>{var i;return void((i=e.onSyncClick)==null?void 0:i.call(e))},children:n.jsx(v,{size:16,strokeWidth:1.75})}):null,x=e.readerMoreMenu!=null?n.jsxs("div",{ref:e.readerMoreMenuRef,className:"mdocs-reader-more-menu",children:[n.jsx("button",{type:"button",className:"mdocs-reader-more-btn","aria-label":"更多","aria-expanded":e.readerMoreOpen,onClick:()=>{var i;return(i=e.onToggleReaderMore)==null?void 0:i.call(e)},children:n.jsx(I,{size:18,strokeWidth:1.75})}),e.readerMoreOpen?n.jsx("div",{className:"mdocs-reader-more-dropdown card",children:e.readerMoreMenu}):null]}):null;return e.readerActionsCollapsible?n.jsxs("div",{className:s+" mdocs-editor-toolbar--stacked",style:r,children:[n.jsxs("div",{className:"mdocs-reader-top-row",children:[t,g,n.jsx("button",{type:"button",className:"mdocs-reader-expand-btn",onClick:()=>P(i=>!i),"aria-label":c?"收起操作栏":"展开操作栏",children:n.jsx(L,{size:16,strokeWidth:2,style:{transform:c?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.2s"}})}),x]}),c&&n.jsxs("div",{className:"mdocs-reader-actions-row",children:[o,e.leadingExtra,d,e.trailingExtra]})]}):n.jsxs("div",{className:s,style:r,children:[t,o,e.leadingExtra,g,d,x,e.trailingExtra]})}return n.jsxs("div",{className:s,style:r,children:[n.jsxs("div",{className:"mdocs-editor-toolbar-leading",children:[n.jsx("input",{className:"mdocs-editor-title-input",value:e.displayName,onChange:t=>e.onDisplayNameChange(t.target.value),onBlur:e.onDisplayNameBlur,placeholder:a("displayNamePlaceholder"),disabled:!e.editing}),n.jsx(k,{domains:y,value:e.currentDomainId,onChange:e.onDomainChange,onDomainsChange:e.onDomainsChange,ariaLabel:a("currentDomainAria"),localizeName:t=>j(t,u,a)}),D?n.jsxs("button",{type:"button",className:"secondary",onClick:()=>{var t;return(t=e.onAiWrite)==null?void 0:t.call(e)},style:{padding:"4px 10px",whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx("img",{src:W,alt:"",width:16,height:16,style:{display:"block"}}),"帮写"]}):null,e.leadingExtra]}),n.jsx("span",{className:"mdocs-editor-toolbar-spacer","aria-hidden":!0}),n.jsxs("div",{className:"mdocs-editor-toolbar-trailing",children:[e.onToggleBookmark?n.jsxs("button",{type:"button",className:"ghost mdocs-tooltip mdocs-tooltip-bottom",onClick:()=>{var t;return(t=e.onToggleBookmark)==null?void 0:t.call(e)},disabled:e.bookmarkBusy,"data-tooltip":e.isBookmarked?"取消收藏":"收藏",style:{padding:"4px 8px",minWidth:"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:4,opacity:e.bookmarkBusy?.5:1},children:[n.jsx(z,{size:18,strokeWidth:1.5,style:{color:e.isBookmarked?"#faad14":"var(--mdocs-text-secondary, #6b7280)",fill:e.isBookmarked?"#faad14":"none"}}),e.isBookmarked?n.jsx("span",{children:"已收藏"}):null]}):null,n.jsxs("div",{className:"mdocs-editor-toolbar-actions",children:[e.onSyncClick?n.jsxs("button",{type:"button",className:"mdocs-sync-btn mdocs-tooltip mdocs-tooltip-bottom"+(e.syncBehind?" behind":""),"data-tooltip":e.syncBehind?a("syncBehindHint"):a("syncPull"),onClick:()=>{var t;return void((t=e.onSyncClick)==null?void 0:t.call(e))},style:{display:"flex",alignItems:"center",gap:4},children:[n.jsx(v,{size:16,strokeWidth:1.5}),n.jsx("span",{children:a("syncPull")})]}):null,h?n.jsxs(n.Fragment,{children:[w,e.onPublish?n.jsx("button",{type:"button",className:"primary mdocs-tooltip mdocs-tooltip-bottom",disabled:e.busy,"data-tooltip":E,onMouseDown:t=>t.preventDefault(),onClick:()=>{var t;return(t=e.onPublish)==null?void 0:t.call(e)},children:e.busy?a("publishing"):a("publish")}):null,e.onDelete?n.jsx("button",{type:"button",className:"danger",disabled:e.busy,onClick:()=>{var t;return(t=e.onDelete)==null?void 0:t.call(e)},children:a("delete")}):null]}):null,!e.editing&&e.canEdit&&e.onEnterEdit&&!e.actionsAlwaysVisible?n.jsx("button",{type:"button",className:"primary",onClick:()=>{var t;return(t=e.onEnterEdit)==null?void 0:t.call(e)},children:a("edit")}):null,e.trailingExtra,M?n.jsxs("button",{type:"button",className:"ghost mdocs-tooltip mdocs-tooltip-bottom",onClick:()=>{var t;return(t=e.onToggleComments)==null?void 0:t.call(e)},"data-tooltip":"评论",style:{padding:"4px 8px",minWidth:"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:4,background:e.commentPanelOpen?"var(--mdocs-hover-bg, #f0f0f0)":void 0},children:[n.jsx(H,{size:18,strokeWidth:1.5,style:{color:"var(--mdocs-text-secondary, #6b7280)"}}),e.commentCount&&e.commentCount>0?n.jsx("span",{style:{fontSize:"0.85rem"},children:e.commentCount}):null]}):null,e.onToggleDocInfo?n.jsxs("div",{ref:e.docInfoMenuRef,className:"mdocs-tooltip mdocs-tooltip-bottom","data-tooltip":a("docInfo"),style:{position:"relative"},children:[n.jsx("button",{type:"button",className:"secondary",onClick:()=>{var t;return(t=e.onToggleDocInfo)==null?void 0:t.call(e)},style:{padding:"4px 8px",minWidth:"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:n.jsx(K,{size:18,strokeWidth:1.5,style:{color:"var(--mdocs-text-secondary, #6b7280)"}})}),e.docInfoOpen?n.jsx("div",{className:"mdocs-doc-info-dropdown",children:e.docInfoMenu}):null]}):null]})]})]})}export{J as D,q as S};