showai-reader 0.9.0 → 0.10.0-reader.26q2bofu

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 (66) hide show
  1. package/README.md +2 -2
  2. package/chunks/CardGrid-LFAHWD2H.js +2 -0
  3. package/chunks/CommandReference-FUXNAYX5.js +3 -0
  4. package/chunks/ComparisonMatrix-UUPANCP3.js +1 -0
  5. package/chunks/EventTimeline-5PGD2AWU.js +2 -0
  6. package/chunks/ExperimentTracker-N3LCLCJE.js +1 -0
  7. package/chunks/{ExternalDiagram-3BONLRGZ.js → ExternalDiagram-524DRV6Q.js} +7924 -4810
  8. package/chunks/Flowchart-XLOMH75Z.js +12 -0
  9. package/chunks/{G2Chart-GQH7Q6PL.js → G2Chart-G2WIXRPN.js} +2 -2
  10. package/chunks/LayerDiagram-56SJZNW7.js +2 -0
  11. package/chunks/{Mindmap-UMIFB7CR.js → Mindmap-MZP663AI.js} +2 -2
  12. package/chunks/RichTextEditor-AEA3NDBM.js +156 -0
  13. package/chunks/Roadmap-EMA6NSWS.js +2 -0
  14. package/chunks/{Scene3D-J7TCRL6V.js → Scene3D-57LFP4JM.js} +2 -2
  15. package/chunks/SequenceDiagram-JHWFLG2U.js +2 -0
  16. package/chunks/StatusTree-H4J4FJLQ.js +1 -0
  17. package/chunks/StepGuide-BQI3ACTG.js +1 -0
  18. package/chunks/StructureBrowser-DWYAVSOM.js +3 -0
  19. package/chunks/Waterfall-SIVV2RSV.js +2 -0
  20. package/chunks/chunk-3RZMLHCB.js +1 -0
  21. package/chunks/{chunk-WDYURK6F.js → chunk-5AW2WUSZ.js} +1 -1
  22. package/chunks/chunk-5HKZMSJF.js +9 -0
  23. package/chunks/chunk-6XZJHSRJ.js +2 -0
  24. package/chunks/chunk-7G6RMB6W.js +5 -0
  25. package/chunks/{chunk-MPVTJQTD.js → chunk-AGCPSBAJ.js} +2 -2
  26. package/chunks/chunk-AIBH6MTQ.js +1 -0
  27. package/chunks/{chunk-SWLYSV5D.js → chunk-CE7CZRPD.js} +1 -1
  28. package/chunks/chunk-DCANE7XH.js +1 -0
  29. package/chunks/chunk-GLP5VV7P.js +1 -0
  30. package/chunks/chunk-HFI3ZB2W.js +21 -0
  31. package/chunks/{chunk-4QSHXFHM.js.LEGAL.txt → chunk-HFI3ZB2W.js.LEGAL.txt} +25 -8
  32. package/chunks/{chunk-LAAA5HWB.js → chunk-HWP77DDH.js} +1 -1
  33. package/chunks/chunk-I2YI7JTH.js +1 -0
  34. package/chunks/{chunk-CEJFAFXK.js → chunk-IGS2BNHB.js} +50 -47
  35. package/chunks/chunk-J6IRWTF7.js +1 -0
  36. package/chunks/chunk-JLTBSSKD.js +1 -0
  37. package/chunks/chunk-JXKAISUX.js +1 -0
  38. package/chunks/chunk-LPO3XSPL.js +1 -0
  39. package/chunks/{chunk-LY26FKQZ.js → chunk-MENLQ7WW.js} +1 -1
  40. package/chunks/chunk-N4STN5JL.js +4 -0
  41. package/chunks/chunk-RM3453FR.js +1 -0
  42. package/chunks/{chunk-7GHGKKPY.js → chunk-SNEZ3O5V.js} +1 -1
  43. package/chunks/chunk-UVFZRJKC.js +1 -0
  44. package/chunks/code-highlighting-F3WJZEML.js +1 -0
  45. package/chunks/{pdf-engine-PQMJ3BVE.js → pdf-engine-XQHKQXXX.js} +1 -1
  46. package/index.js +1 -1
  47. package/manifest.json +6 -5
  48. package/package.json +1 -1
  49. package/reader-26Q2BOFU.js +50 -0
  50. package/chunks/ComparisonMatrix-SYFIP5WP.js +0 -1
  51. package/chunks/ExperimentTracker-HOUNXCEC.js +0 -1
  52. package/chunks/Flowchart-72CIZ5IT.js +0 -10
  53. package/chunks/RichTextEditor-YMFOBGOU.js +0 -155
  54. package/chunks/StatusTree-MDKGDYK5.js +0 -1
  55. package/chunks/chunk-4QSHXFHM.js +0 -21
  56. package/chunks/chunk-6WHB3GS2.js +0 -2
  57. package/chunks/chunk-DUIGVKKG.js +0 -1
  58. package/chunks/chunk-M3KEZP5Z.js +0 -1
  59. package/chunks/chunk-QSELZI5S.js +0 -1
  60. package/chunks/chunk-YSVZKKKM.js +0 -1
  61. package/reader-N3YKYCK3.js +0 -40
  62. /package/chunks/{Flowchart-72CIZ5IT.js.LEGAL.txt → Flowchart-XLOMH75Z.js.LEGAL.txt} +0 -0
  63. /package/chunks/{G2Chart-GQH7Q6PL.js.LEGAL.txt → G2Chart-G2WIXRPN.js.LEGAL.txt} +0 -0
  64. /package/chunks/{Scene3D-J7TCRL6V.js.LEGAL.txt → Scene3D-57LFP4JM.js.LEGAL.txt} +0 -0
  65. /package/chunks/{chunk-MPVTJQTD.js.LEGAL.txt → chunk-AGCPSBAJ.js.LEGAL.txt} +0 -0
  66. /package/{reader-N3YKYCK3.js.LEGAL.txt → reader-26Q2BOFU.js.LEGAL.txt} +0 -0
@@ -0,0 +1,2 @@
1
+ import{a as G,d as U}from"./chunk-AIBH6MTQ.js";import{f as ss}from"./chunk-JLTBSSKD.js";import{d as Z}from"./chunk-I2YI7JTH.js";import{a as Q,c as as,ib as Y,lb as J}from"./chunk-HFI3ZB2W.js";import{a as V}from"./chunk-J6IRWTF7.js";import{c as B}from"./chunk-DCANE7XH.js";var h=B(as(),1);Q(`.sb-block.sq-block :is(h3,h4,p,ul,ol,li,pre):not(svg){margin:0}.sb-block.sq-block li:not(svg){padding:0}.sb-block.sq-block pre:not(svg){border:0;border-radius:0;background:none;color:inherit}.sb-block.sq-block{--sq-text: var(--sb-text);--sq-muted: var(--sb-muted);--sq-faint: color-mix(in srgb, var(--sb-muted) 70%, transparent);--sq-line: var(--sb-line);--sq-paper: var(--sb-surface);--sq-soft: var(--sb-soft);--sq-accent: var(--sb-accent);--sq-accent-soft: var(--sb-accent-soft);--sq-wire: color-mix(in srgb, var(--sb-muted) 85%, var(--sb-text));--sq-teal: #0d8579;--sq-teal-soft: #e6f4f2;--sq-orange: #bf6528;--sq-orange-soft: #fbefe6;--sq-violet: #7348d0;--sq-violet-soft: #f2edfc;--sq-rose: #c4415a;--sq-rose-soft: #fbebee;--sq-slate: #526476;--sq-slate-soft: #edf1f4;--t: var(--sq-accent);--ts: var(--sq-accent-soft);color:var(--sq-text);font-family:inherit;font-size:14px;line-height:1.65;padding:8px 0;overflow-wrap:anywhere}:root[data-theme=dark] .sb-block.sq-block,[data-theme=dark] .sb-block.sq-block{--sq-teal: #4fc4b6;--sq-teal-soft: #163734;--sq-orange: #e79c64;--sq-orange-soft: #3b2b1e;--sq-violet: #b497ff;--sq-violet-soft: #2e2648;--sq-rose: #f0839a;--sq-rose-soft: #3e222a;--sq-slate: #a2b2c2;--sq-slate-soft: #242d35}.sb-block.sq-block *{box-sizing:border-box}.sb-block.sq-block [data-tone=accent]{--t: var(--sq-accent);--ts: var(--sq-accent-soft)}.sb-block.sq-block [data-tone=teal]{--t: var(--sq-teal);--ts: var(--sq-teal-soft)}.sb-block.sq-block [data-tone=orange]{--t: var(--sq-orange);--ts: var(--sq-orange-soft)}.sb-block.sq-block [data-tone=violet]{--t: var(--sq-violet);--ts: var(--sq-violet-soft)}.sb-block.sq-block [data-tone=rose]{--t: var(--sq-rose);--ts: var(--sq-rose-soft)}.sb-block.sq-block [data-tone=slate]{--t: var(--sq-slate);--ts: var(--sq-slate-soft)}.sb-block.sq-block .sq-top{display:flex;align-items:baseline;justify-content:space-between;gap:16px;margin:0 0 12px}.sb-block.sq-block .sq-title{margin:0;font-size:16px;line-height:1.5;font-weight:650}.sb-block.sq-block .sq-description{margin:2px 0 0;color:var(--sq-muted);font-size:13px}.sb-block.sq-block .sq-hint{flex:none;font-size:12px;color:var(--sq-faint);white-space:nowrap}.sb-block.sq-block code{font-family:var(--mono, ui-monospace, Menlo, Consolas, monospace);font-size:.88em;background:var(--sq-soft);border-radius:4px;padding:1px 5px}.sb-block.sq-block .sq-svg{display:block;max-width:100%;height:auto;overflow:visible;border-radius:6px;user-select:none;-webkit-user-select:none}.sb-block.sq-block .sq-svg:focus{outline:none}.sb-block.sq-block .sq-svg:focus-visible{outline:2px solid var(--sq-accent);outline-offset:2px}.sb-block.sq-block .sq-svg text{font-family:inherit}.sb-block.sq-block .sq-life{stroke:var(--sq-line);stroke-width:1.2;stroke-dasharray:3 4}.sb-block.sq-block .sq-life[data-on]{stroke:var(--t);stroke-opacity:.45;stroke-dasharray:none}.sb-block.sq-block .sq-actor rect{fill:var(--sq-paper);stroke:var(--sq-line)}.sb-block.sq-block .sq-actor[data-on] rect{fill:var(--ts);stroke:var(--t);stroke-width:1.4}.sb-block.sq-block .sq-alabel{fill:var(--sq-text);font-size:14px;font-weight:600}.sb-block.sq-block .sq-asub{fill:var(--sq-muted);font-size:12px}.sb-block.sq-block .sq-icon{font-size:15px}.sb-block.sq-block .sq-band{fill:var(--sq-accent-soft);opacity:.6}.sb-block.sq-block .sq-step{cursor:pointer;transition:opacity .2s ease}.sb-block.sq-block .sq-hit{fill:transparent}.sb-block.sq-block .sq-line{fill:none;stroke:var(--sq-wire);stroke-width:1.4;stroke-linejoin:round}.sb-block.sq-block .sq-line[data-reply]{stroke-dasharray:5 4}.sb-block.sq-block .sq-head{fill:var(--sq-wire)}.sb-block.sq-block .sq-open{fill:none;stroke:var(--sq-wire);stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}.sb-block.sq-block .sq-label{fill:var(--sq-text);font-size:13px;font-weight:500}.sb-block.sq-block .sq-note{fill:var(--sq-orange-soft);stroke:var(--sq-orange);stroke-opacity:.35}.sb-block.sq-block .sq-num circle{fill:var(--sq-paper);stroke:var(--sq-line)}.sb-block.sq-block .sq-num text{fill:var(--sq-muted);font-size:11.5px;font-weight:600;font-variant-numeric:tabular-nums}.sb-block.sq-block .sq-step[data-state=todo]{opacity:.3}.sb-block.sq-block .sq-step[data-state=todo]:hover{opacity:.55}.sb-block.sq-block .sq-step[data-state=cur] .sq-line{stroke:var(--sq-accent);stroke-width:2}.sb-block.sq-block .sq-step[data-state=cur] .sq-head{fill:var(--sq-accent)}.sb-block.sq-block .sq-step[data-state=cur] .sq-open{stroke:var(--sq-accent);stroke-width:2}.sb-block.sq-block .sq-step[data-state=cur] .sq-label{font-weight:650}.sb-block.sq-block .sq-step[data-state=cur] .sq-num circle{fill:var(--sq-accent);stroke:var(--sq-accent)}.sb-block.sq-block .sq-step[data-state=cur] .sq-num text{fill:var(--sq-paper)}.sb-block.sq-block .sq-step[data-state=cur] .sq-note{stroke-opacity:.8}.sb-block.sq-block .sq-actor rect,.sb-block.sq-block .sq-life{transition:fill .2s ease,stroke .2s ease}.sb-block.sq-block .sq-panel{margin-top:14px;border:1px solid var(--sq-line);border-radius:10px;background:var(--sq-soft);overflow:hidden}.sb-block.sq-block .sq-bar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 12px;padding:10px 12px}.sb-block.sq-block .sq-buttons{display:flex;flex-wrap:wrap;gap:6px}.sb-block.sq-block .sq-buttons button{display:inline-flex;align-items:center;gap:6px;font:inherit;font-size:13px;line-height:1;color:var(--sq-text);background:var(--sq-paper);border:1px solid var(--sq-line);border-radius:6px;padding:7px 11px 7px 9px;cursor:pointer;transition:border-color .15s ease}.sb-block.sq-block .sq-buttons button:hover:not(:disabled){border-color:var(--sq-muted)}.sb-block.sq-block .sq-buttons button:disabled{color:var(--sq-faint);cursor:default}.sb-block.sq-block .sq-buttons svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.sb-block.sq-block .sq-buttons svg .sq-fill{fill:currentColor;stroke:none}.sb-block.sq-block .sq-buttons .sq-play{background:var(--sq-accent);border-color:var(--sq-accent);color:var(--sq-paper)}.sb-block.sq-block .sq-buttons .sq-play:disabled{opacity:.5;color:var(--sq-paper)}.sb-block.sq-block .sq-buttons button:focus-visible,.sb-block.sq-block .sq-list button:focus-visible,.sb-block.sq-block a:focus-visible{outline:2px solid var(--sq-accent);outline-offset:2px}.sb-block.sq-block .sq-count{font-size:12px;color:var(--sq-muted);font-variant-numeric:tabular-nums;white-space:nowrap}.sb-block.sq-block .sq-progress{height:2px;background:var(--sq-line)}.sb-block.sq-block .sq-progress i{display:block;height:100%;background:var(--sq-accent);transition:width .25s ease}.sb-block.sq-block .sq-detail{padding:14px 18px 16px;background:var(--sq-paper)}.sb-block.sq-block .sq-meta,.sb-block.sq-block .sq-route{display:flex;align-items:center;flex-wrap:wrap;gap:5px 6px;font-size:12px;color:var(--sq-muted)}.sb-block.sq-block .sq-meta em,.sb-block.sq-block .sq-route em{font-style:normal;font-size:12px;color:var(--sq-faint);margin-left:2px}.sb-block.sq-block .sq-detail h4{margin:8px 0 4px;font-size:15px;line-height:1.5;font-weight:650}.sb-block.sq-block .sq-md p{margin:0 0 6px;font-size:14px;line-height:1.7}.sb-block.sq-block .sq-md p:last-child{margin-bottom:0}.sb-block.sq-block .sq-md strong{font-weight:650}.sb-block.sq-block .sq-md a{color:var(--sq-accent);text-underline-offset:3px}.sb-block.sq-block .sq-lnum{flex:none;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;background:var(--sq-accent);color:var(--sq-paper);font-size:11.5px;font-weight:600;font-variant-numeric:tabular-nums}.sb-block.sq-block .sq-chip{display:inline-flex;align-items:center;gap:5px;font-size:12px;line-height:1;padding:4px 8px;border-radius:6px;background:var(--ts);color:var(--t);font-weight:600;white-space:nowrap}.sb-block.sq-block .sq-arrow{color:var(--sq-faint);font-size:13px}.sb-block.sq-block .sq-cast{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}.sb-block.sq-block .sq-panel-bar{margin:0 0 10px}.sb-block.sq-block .sq-panel-bar .sq-buttons button{padding:7px 9px}.sb-block.sq-block .sq-list{list-style:none;margin:0;padding:0;position:relative}.sb-block.sq-block .sq-list:before{content:"";position:absolute;left:21px;top:16px;bottom:16px;width:1px;background:var(--sq-line)}.sb-block.sq-block .sq-list li{position:relative;border-radius:10px;transition:opacity .2s ease}.sb-block.sq-block .sq-list li[data-state=todo]{opacity:.5}.sb-block.sq-block .sq-list li[data-state=cur]{background:var(--sq-soft);box-shadow:inset 0 0 0 1px var(--sq-line)}.sb-block.sq-block .sq-list button{display:flex;align-items:flex-start;gap:12px;width:100%;font:inherit;text-align:left;color:inherit;background:none;border:0;padding:10px;cursor:pointer;border-radius:10px}.sb-block.sq-block .sq-list .sq-lnum{position:relative;margin-top:1px;background:var(--sq-paper);color:var(--sq-muted);box-shadow:inset 0 0 0 1px var(--sq-line)}.sb-block.sq-block .sq-list li[data-state=cur] .sq-lnum{background:var(--sq-accent);color:var(--sq-paper);box-shadow:none}.sb-block.sq-block .sq-lbody{flex:1;min-width:0;display:grid;gap:5px}.sb-block.sq-block .sq-ltitle{font-size:14px;line-height:1.5;font-weight:500}.sb-block.sq-block .sq-list li[data-state=cur] .sq-ltitle{font-weight:650}.sb-block.sq-block .sq-ldetail{padding:0 14px 12px 44px}.sb-block.sq-block .sq-static{display:none}@media(prefers-reduced-motion:reduce){.sb-block.sq-block .sq-step,.sb-block.sq-block .sq-actor rect,.sb-block.sq-block .sq-life,.sb-block.sq-block .sq-progress i,.sb-block.sq-block .sq-list li,.sb-block.sq-block .sq-buttons button{transition:none}}@media print{.sb-block.sq-block .sq-hint,.sb-block.sq-block .sq-panel,.sb-block.sq-block .sq-list,.sb-block.sq-block .sq-cast{display:none}.sb-block.sq-block .sq-step[data-state]{opacity:1}.sb-block.sq-block .sq-band{display:none}.sb-block.sq-block .sq-actor[data-on] rect{fill:var(--sq-paper);stroke:var(--sq-line);stroke-width:1}.sb-block.sq-block .sq-life[data-on]{stroke:var(--sq-line);stroke-opacity:1;stroke-dasharray:3 4}.sb-block.sq-block .sq-step[data-state=cur] .sq-line,.sb-block.sq-block .sq-step[data-state=cur] .sq-open{stroke:var(--sq-wire);stroke-width:1.4}.sb-block.sq-block .sq-step[data-state=cur] .sq-head{fill:var(--sq-wire)}.sb-block.sq-block .sq-step[data-state=cur] .sq-num circle{fill:var(--sq-paper);stroke:var(--sq-line)}.sb-block.sq-block .sq-step[data-state=cur] .sq-num text{fill:var(--sq-muted)}.sb-block.sq-block .sq-static{display:block;margin-top:12px}.sb-block.sq-block .sq-static-title{margin:0 0 6px;font-weight:650}.sb-block.sq-block .sq-static ol{margin:0;padding-left:22px}.sb-block.sq-block .sq-static li{break-inside:avoid;margin-bottom:8px}.sb-block.sq-block .sq-static b{display:block;font-weight:600}}
2
+ `);var ts=V("sequenceDiagram",{"zh-CN":{title:"\u65F6\u5E8F\u56FE",diagram:"\u65F6\u5E8F\u56FE\uFF0C\u5171 {count} \u6B65\u3002\u65B9\u5411\u952E\u5207\u6362\u6B65\u9AA4\uFF0CHome / End \u8DF3\u5230\u9996\u5C3E\u3002",controls:"\u6B65\u9AA4\u63A7\u5236",prev:"\u4E0A\u4E00\u6B65",next:"\u4E0B\u4E00\u6B65",play:"\u64AD\u653E",pause:"\u6682\u505C",restart:"\u91CD\u6765",count:"\u7B2C {current} / {total} \u6B65",hint:"\u70B9\u51FB\u7BAD\u5934\u8DF3\u5230\u8BE5\u6B65 \xB7 \u65B9\u5411\u952E\u5207\u6362",reply:"\u8FD4\u56DE",note:"\u5907\u6CE8",stepTitle:"{number}. {from} \u2192 {to}\uFF1A{label}",allSteps:"\u5168\u90E8\u6B65\u9AA4",actors:"\u53C2\u4E0E\u8005"},en:{title:"Sequence diagram",diagram:"Sequence diagram with {count} steps. Arrow keys change the step; Home and End jump to the ends.",controls:"Step controls",prev:"Previous",next:"Next",play:"Play",pause:"Pause",restart:"Restart",count:"Step {current} of {total}",hint:"Click an arrow to jump \xB7 arrow keys to step",reply:"reply",note:"note",stepTitle:"{number}. {from} \u2192 {to}: {label}",allSteps:"All steps",actors:"Participants"}});var s=B(Y(),1),ls=1600,ns=46,rs=56,es="system-ui, -apple-system, sans-serif";function F({source:e}){return(0,s.jsx)(s.Fragment,{children:U(e).map((o,l)=>(0,s.jsx)("p",{children:(0,s.jsx)(ss,{source:o})},l))})}var j;function cs(e){return j===void 0&&(j=typeof document>"u"?null:document.createElement("canvas").getContext("2d")),(o,l,b=400)=>{if(j)return j.font=`${b} ${l}px ${e}`,j.measureText(o).width;let n=0;for(let m of o)n+=/[\u2e80-\uffff]/.test(m)?l:l*.58;return n}}function K(e,o,l,b,n=400){if(e(o,b,n)<=l)return o;let m=Array.from(o),N=0,S=m.length;for(;N<S;){let H=N+S+1>>1;e(`${m.slice(0,H).join("")}\u2026`,b,n)<=l?N=H:S=H-1}return`${m.slice(0,N).join("").trimEnd()}\u2026`}function is(e){let o=(Array.isArray(e.actors)?e.actors:[]).map(n=>({...n,tone:G.includes(n.tone)?n.tone:"accent"})),l=new Map(o.map((n,m)=>[n.id,m])),b=[];for(let n of Array.isArray(e.steps)?e.steps:[]){let m=l.get(n.from),N=l.get(n.to);m===void 0||N===void 0||b.push({...n,a:m,b:N,kind:n.kind==="reply"||n.kind==="note"?n.kind:"call"})}return{actors:o,steps:b}}var bs={prev:(0,s.jsx)("path",{d:"M10 3.5 5.5 8l4.5 4.5"}),next:(0,s.jsx)("path",{d:"M6 3.5 10.5 8 6 12.5"}),play:(0,s.jsx)("path",{className:"sq-fill",d:"M5 3.2v9.6L12.6 8z"}),pause:(0,s.jsx)("path",{className:"sq-fill",d:"M4.5 3.5h2.4v9H4.5zM9.1 3.5h2.4v9H9.1z"}),restart:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("path",{d:"M3.5 8a4.5 4.5 0 1 0 1.4-3.3"}),(0,s.jsx)("path",{d:"M4.6 2.2v2.7h2.7"})]})},I=({name:e})=>(0,s.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:bs[e]});function X({actor:e}){return(0,s.jsxs)("span",{className:"sq-chip","data-tone":e.tone,children:[e.icon&&(0,s.jsx)("span",{"aria-hidden":"true",children:e.icon}),e.label]})}function _({step:e,actors:o,t:l}){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(X,{actor:o[e.a]}),e.a!==e.b&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"sq-arrow","aria-hidden":"true",children:e.kind==="note"?"\xB7":"\u2192"}),(0,s.jsx)(X,{actor:o[e.b]})]}),e.kind!=="call"&&(0,s.jsx)("em",{children:l(e.kind)})]})}function os(e,o,l){return e.key==="Home"?0:e.key==="End"?l-1:e.key==="ArrowRight"||e.key==="ArrowDown"?Math.min(l-1,o+1):e.key==="ArrowLeft"||e.key==="ArrowUp"?Math.max(0,o-1):null}function ps({actors:e,steps:o,width:l,current:b,measure:n,go:m,label:N,stepTitle:S}){let T=(l-8)/e.length,L=t=>4+T*(t+.5),W=e.some(t=>t.sub)?58:42,D=Math.min(T-12,176),v=[],P=W+16;for(let t of o){let c=t.kind!=="note"&&t.a===t.b?rs:ns;v.push({top:P,h:c,y:P+30}),P+=c}let f=P+14,p=o[b],O=new Set(p?[p.a,p.b]:[]),z=(t,c,q)=>(0,s.jsxs)("g",{className:"sq-num",children:[(0,s.jsx)("circle",{cx:t,cy:c,r:10}),(0,s.jsx)("text",{x:t,y:c+4,textAnchor:"middle",children:q+1})]});return(0,s.jsxs)("svg",{className:"sq-svg",width:l,height:f,viewBox:`0 0 ${l} ${f}`,tabIndex:0,role:"group","aria-label":N,onKeyDown:t=>{let c=os(t,b,o.length);c!==null&&(t.preventDefault(),m(c))},children:[e.map((t,c)=>(0,s.jsx)("line",{className:"sq-life","data-tone":t.tone,"data-on":O.has(c)?"":void 0,x1:L(c),x2:L(c),y1:W,y2:f-4},t.id)),p&&(0,s.jsx)("rect",{className:"sq-band",x:2,y:v[b].top+3,width:l-4,height:v[b].h-6,rx:8}),e.map((t,c)=>{let q=L(c),M=t.icon?26:0,r=K(n,t.label,D-20-M,14,600),w=q-(n(r,14,600)+M)/2,y=t.sub?K(n,t.sub,D-16,12):"",g=t.sub?24:W/2+5;return(0,s.jsxs)("g",{className:"sq-actor","data-tone":t.tone,"data-on":O.has(c)?"":void 0,children:[(0,s.jsx)("rect",{x:q-D/2,y:1,width:D,height:W-2,rx:10}),t.icon&&(0,s.jsx)("text",{className:"sq-icon",x:w+9,y:g,textAnchor:"middle",children:t.icon}),(0,s.jsx)("text",{className:"sq-alabel",x:w+M,y:g,children:r}),y&&(0,s.jsx)("text",{className:"sq-asub",x:q,y:g+19,textAnchor:"middle",children:y}),(0,s.jsx)("title",{children:t.sub?`${t.label} \xB7 ${t.sub}`:t.label})]},t.id)}),o.map((t,c)=>{let q=v[c],M=c<b?"done":c===b?"cur":"todo",r=L(t.a),w=L(t.b),y=13,g=M==="cur"?600:500,a,i;if(t.kind==="note"){let k=Math.min(r,w),$=Math.max(r,w),x=n(t.label,y,g)+52,d,u;if(t.a===t.b){let E=Math.min(x,T-8);d=k-E/2,u=k+E/2}else if(d=k-T*.36,u=$+T*.36,u-d<x){let E=(k+$)/2;d=E-x/2,u=E+x/2}d=Math.max(4,d),u=Math.min(l-4,u);let C=K(n,t.label,u-d-52,y,g),R=27+n(C,y,g),A=(d+u)/2-R/2;a=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("rect",{className:"sq-note",x:d,y:q.top+8,width:u-d,height:30,rx:6}),z(A+10,q.top+23,c),(0,s.jsx)("text",{className:"sq-label",x:A+27,y:q.top+27.5,children:C})]}),i={x:d,w:u-d}}else if(t.a===t.b){let k=r+74+n(t.label,y,g)<l-4||r<l/2,$=k?1:-1,x=q.top+16,d=q.top+40,u=r+$*30,C=K(n,t.label,k?l-4-(r+70):r-74,y,g),R=27+n(C,y,g),A=k?r+44:r-44-R;a=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("path",{className:"sq-line","data-reply":t.kind==="reply"?"":void 0,d:`M${r},${x}H${u-$*6}Q${u},${x} ${u},${x+6}V${d-6}Q${u},${d} ${u-$*6},${d}H${r+$*8}`}),(0,s.jsx)("path",{className:"sq-head",d:`M${r+$},${d}l${$*8},-4.5v9z`}),z(A+10,(x+d)/2,c),(0,s.jsx)("text",{className:"sq-label",x:A+27,y:(x+d)/2+4.5,children:C})]});let E=k?r-8:A-4;i={x:E,w:(k?A+R+8:r+8)-E}}else{let k=w>r?1:-1,$=r+k*2,x=w-k*2,d=K(n,t.label,Math.max(84,Math.abs(w-r)+T*.4-36),y,g),u=27+n(d,y,g),C=Math.max(4,Math.min(l-4-u,(r+w)/2-u/2)),R=t.kind==="reply";a=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("path",{className:"sq-line","data-reply":R?"":void 0,d:`M${$},${q.y}H${x-k*(R?1:7)}`}),R?(0,s.jsx)("path",{className:"sq-open",d:`M${x-k*8},${q.y-5}L${x},${q.y}L${x-k*8},${q.y+5}`}):(0,s.jsx)("path",{className:"sq-head",d:`M${x},${q.y}l${-k*8},-4.5v9z`}),z(C+10,q.y-15,c),(0,s.jsx)("text",{className:"sq-label",x:C+27,y:q.y-10.5,children:d})]});let A=Math.min(r,w,C)-6;i={x:A,w:Math.max(r,w,C+u)+6-A}}return(0,s.jsxs)("g",{className:"sq-step","data-state":M,"data-kind":t.kind,onClick:()=>m(c),children:[(0,s.jsx)("rect",{className:"sq-hit",x:i.x,y:q.top+2,width:i.w,height:q.h-4}),a,(0,s.jsx)("title",{children:S(t,c)})]},c)})]})}function vs({data:e}){let o=J(ts),l=e,{actors:b,steps:n}=(0,h.useMemo)(()=>is(l),[l]),m=(0,h.useRef)(null),N=(0,h.useRef)(null),[S,H]=(0,h.useState)(800),[T,L]=(0,h.useState)(es),[W,D]=(0,h.useState)(0),[v,P]=(0,h.useState)(!1),f=n.length,p=Math.min(W,Math.max(0,f-1));(0,h.useEffect)(()=>{let a=m.current;if(!a)return;L(getComputedStyle(a).fontFamily||es);let i=()=>H(Math.floor(a.clientWidth));if(i(),typeof ResizeObserver!="function")return;let k=new ResizeObserver(i);return k.observe(a),()=>k.disconnect()},[]),(0,h.useEffect)(()=>{if(!v)return;let a=setInterval(()=>D(i=>Math.min(i+1,f-1)),ls);return()=>clearInterval(a)},[v,f]),(0,h.useEffect)(()=>{v&&p>=f-1&&P(!1)},[p,v,f]);let O=(0,h.useMemo)(()=>cs(T),[T]),z=a=>{P(!1),D(Math.max(0,Math.min(f-1,a)))},t=()=>{if(v)return P(!1);p>=f-1&&D(0),P(!0)},c=(a,i)=>o("stepTitle",{number:i+1,from:b[a.a].label,to:b[a.b].label,label:a.label}),q=Z(l.title,o("title")),M=S<640||(S-8)/Math.max(1,b.length)<96,r=n[p],w=a=>a<p?"done":a===p?"cur":"todo",y=(0,s.jsxs)("div",{className:"sq-bar",children:[(0,s.jsxs)("div",{className:"sq-buttons",role:"group","aria-label":o("controls"),children:[(0,s.jsxs)("button",{type:"button",onClick:()=>z(p-1),disabled:p===0,children:[(0,s.jsx)(I,{name:"prev"}),(0,s.jsx)("span",{children:o("prev")})]}),(0,s.jsxs)("button",{type:"button",onClick:()=>z(p+1),disabled:p>=f-1,children:[(0,s.jsx)(I,{name:"next"}),(0,s.jsx)("span",{children:o("next")})]}),(0,s.jsxs)("button",{type:"button",className:"sq-play","aria-pressed":v,onClick:t,disabled:f<2,children:[(0,s.jsx)(I,{name:v?"pause":"play"}),(0,s.jsx)("span",{children:o(v?"pause":"play")})]}),(0,s.jsxs)("button",{type:"button",onClick:()=>z(0),disabled:p===0&&!v,children:[(0,s.jsx)(I,{name:"restart"}),(0,s.jsx)("span",{children:o("restart")})]})]}),(0,s.jsx)("span",{className:"sq-count","aria-live":"polite",children:o("count",{current:p+1,total:f})})]}),g=(0,s.jsx)("div",{className:"sq-progress","aria-hidden":"true",children:(0,s.jsx)("i",{style:{width:`${(p+1)/Math.max(1,f)*100}%`}})});return(0,s.jsxs)("section",{className:"sb-block sq-block","aria-label":q,ref:m,"data-narrow":M?"":void 0,children:[(l.title||l.description||!M)&&(0,s.jsxs)("div",{className:"sq-top",children:[(0,s.jsxs)("div",{children:[l.title&&(0,s.jsx)("h3",{className:"sq-title",children:l.title}),l.description&&(0,s.jsx)("p",{className:"sq-description",children:l.description})]}),!M&&f>0&&(0,s.jsx)("span",{className:"sq-hint",children:o("hint")})]}),r&&(M?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"sq-cast","aria-label":o("actors"),children:b.map(a=>(0,s.jsx)(X,{actor:a},a.id))}),(0,s.jsxs)("div",{className:"sq-panel sq-panel-bar",children:[y,g]}),(0,s.jsx)("ol",{className:"sq-list",ref:N,onKeyDown:a=>{let i=os(a,p,f);i!==null&&(a.preventDefault(),z(i),N.current?.querySelectorAll("button")[i]?.focus())},children:n.map((a,i)=>(0,s.jsxs)("li",{"data-state":w(i),"data-kind":a.kind,children:[(0,s.jsxs)("button",{type:"button","aria-current":i===p?"step":void 0,onClick:()=>z(i),children:[(0,s.jsx)("span",{className:"sq-lnum",children:i+1}),(0,s.jsxs)("span",{className:"sq-lbody",children:[(0,s.jsx)("span",{className:"sq-route",children:(0,s.jsx)(_,{step:a,actors:b,t:o})}),(0,s.jsx)("span",{className:"sq-ltitle",children:a.label})]})]}),i===p&&a.detail&&(0,s.jsx)("div",{className:"sq-ldetail sq-md",children:(0,s.jsx)(F,{source:a.detail})})]},i))})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ps,{actors:b,steps:n,width:S,current:p,measure:O,go:z,label:o("diagram",{count:f}),stepTitle:c}),(0,s.jsxs)("div",{className:"sq-panel",children:[y,g,(0,s.jsxs)("div",{className:"sq-detail","aria-live":"polite",children:[(0,s.jsxs)("div",{className:"sq-meta",children:[(0,s.jsx)("span",{className:"sq-lnum",children:p+1}),(0,s.jsx)(_,{step:r,actors:b,t:o})]}),(0,s.jsx)("h4",{children:r.label}),r.detail&&(0,s.jsx)("div",{className:"sq-md",children:(0,s.jsx)(F,{source:r.detail})})]})]})]})),(0,s.jsxs)("div",{className:"sq-static",children:[(0,s.jsx)("p",{className:"sq-static-title",children:o("allSteps")}),(0,s.jsx)("ol",{children:n.map((a,i)=>(0,s.jsxs)("li",{children:[(0,s.jsx)("div",{className:"sq-route",children:(0,s.jsx)(_,{step:a,actors:b,t:o})}),(0,s.jsx)("b",{children:a.label}),a.detail&&(0,s.jsx)("div",{className:"sq-md",children:(0,s.jsx)(F,{source:a.detail})})]},i))})]})]})}export{F as DetailText,vs as SequenceDiagramBlock};
@@ -0,0 +1 @@
1
+ import{a as H}from"./chunk-CE7CZRPD.js";import{a as x,d as U}from"./chunk-KF47DKNH.js";import{d as z}from"./chunk-I2YI7JTH.js";import{c as ee,ib as O,lb as q}from"./chunk-HFI3ZB2W.js";import"./chunk-J6IRWTF7.js";import{c as L}from"./chunk-DCANE7XH.js";var m=L(ee(),1);var t=L(O(),1),R={done:"\u2713",failed:"\u2715",active:"\u25CF",todo:"\u25CB",paused:"\u2016"},X={done:["var(--an-good)","var(--an-good-soft)"],failed:["var(--an-bad)","var(--an-bad-soft)"],active:["var(--an-info)","var(--an-info-soft)"],todo:["var(--an-idle)","var(--an-idle-soft)"],paused:["var(--an-warn)","var(--an-warn-soft)"]},v=s=>({"--tone":s.color??X[s.tone][0],"--tone-soft":s.color?`color-mix(in srgb, ${s.color} 14%, transparent)`:X[s.tone][1]}),te=new Map(x.map(s=>[s.id,s.label])),se={done:"tree.status.done",active:"tree.status.active",failed:"tree.status.failed",todo:"tree.status.todo",paused:"tree.status.paused"};function ae(s,o){let a=se[s.id];return a&&te.get(s.id)===s.label?{...s,label:o(a)}:s}function ne(){let s=(0,m.useRef)(null),[o,a]=(0,m.useState)(800);return(0,m.useEffect)(()=>{let r=s.current;if(!r)return;let d=new ResizeObserver(([c])=>a(c.contentRect.width));return d.observe(r),()=>d.disconnect()},[]),[s,o]}function Y({items:s,statuses:o,height:a}){return(0,t.jsx)("div",{className:"an-bar",style:a?{height:a,borderRadius:a/2}:void 0,children:o.map(r=>{let d=s.filter(c=>c.status===r.id).length;return d?(0,t.jsx)("div",{style:{...v(r),width:`${d/s.length*100}%`,background:"var(--tone)"}},r.id):null})})}function ue({data:s}){let o=q(H),a=s,r=(a.statuses??x).map(e=>ae(e,o)),d=new Map(r.map(e=>[e.id,e])),c=a.groups.flatMap(e=>e.items),G=U(a),[V,E]=ne(),[g,J]=(0,m.useState)(()=>(c.find(e=>d.get(e.status)?.tone==="active")??c[0])?.id??""),[h,Q]=(0,m.useState)(null),k=E<980?E:E-316,b=!!a.root&&k>760,N=b?150:0,W=200,D=b?46:36,y=b?N+D:0,S=y+W+D,I=Math.max(180,k-S),K=38,P=16,p=0,A=[],$=[];for(let e of a.groups){let n=p;for(let l of e.items)A.push({item:l,y:p+K/2,group:e}),p+=K;$.push({group:e,y:(n+p)/2,top:n,bottom:p}),p+=P}let C=Math.max(0,p-P),B=C/2,i=c.find(e=>e.id===g),_=a.groups.find(e=>e.items.some(n=>n.id===g)),f=i?d.get(i.status):void 0,F=e=>h!==null&&e.status!==h;return(0,t.jsxs)("section",{className:"sb-block an-block","aria-label":z(a.title,o("tree.title")),children:[(0,t.jsxs)("div",{className:"an-head",children:[a.title&&(0,t.jsx)("h3",{className:"an-title",children:a.title}),a.description&&(0,t.jsx)("p",{className:"an-sub",children:a.description}),(0,t.jsx)("div",{className:"an-tools",role:"group","aria-label":o("tree.highlightByStatus"),children:r.map(e=>(0,t.jsx)("button",{type:"button",className:"an-chip",style:{...v(e),color:"var(--tone)"},"aria-pressed":h===e.id,onClick:()=>Q(h===e.id?null:e.id),children:`${R[e.tone]} ${e.label} ${G[e.id]??0}`},e.id))})]}),(0,t.jsxs)("div",{className:"an-tree-layout",ref:V,children:[(0,t.jsxs)("div",{className:"an-tree",style:{height:C,width:k},children:[(0,t.jsxs)("svg",{width:k,height:C,"aria-hidden":"true",children:[b&&$.map(({group:e,y:n})=>{let l=(N+y)/2;return(0,t.jsx)("path",{d:`M${N},${B} C${l},${B} ${l},${n} ${y},${n}`,fill:"none",stroke:"var(--an-line)",strokeWidth:1.5},e.id)}),A.map(({item:e,y:n,group:l})=>{let w=$.find(j=>j.group.id===l.id),u=d.get(e.status),T=y+W,M=(T+S)/2,Z=u.tone==="todo"||u.tone==="paused";return(0,t.jsx)("path",{d:`M${T},${w.y} C${M},${w.y} ${M},${n} ${S},${n}`,fill:"none",style:v(u),stroke:"var(--tone)",strokeOpacity:F(e)?.12:Z?.45:.7,strokeWidth:e.id===g?2.5:1.6,strokeDasharray:u.tone==="failed"||u.tone==="todo"?"4 4":void 0},e.id)})]}),b&&(0,t.jsxs)("div",{className:"an-root",style:{left:0,top:B-60,width:N,height:120},children:[(0,t.jsx)("small",{children:o("tree.question")}),a.root]}),$.map(({group:e,y:n,top:l,bottom:w})=>{let u=Math.max(56,Math.min(w-l-6,92)),T=e.items.filter(M=>d.get(M.status)?.tone==="done").length;return(0,t.jsxs)("div",{className:"an-group",style:{left:y,top:n-u/2,width:W,height:u},children:[(0,t.jsxs)("div",{className:"an-group-top",children:[(0,t.jsx)("b",{children:e.label}),(0,t.jsxs)("span",{children:[T,"/",e.items.length]})]}),e.summary&&u>70&&(0,t.jsx)("div",{className:"an-group-summary",children:e.summary}),(0,t.jsx)(Y,{items:e.items,statuses:r})]},e.id)}),A.map(({item:e,y:n})=>{let l=d.get(e.status);return(0,t.jsxs)("button",{type:"button",className:`an-item an-st-${l.tone}${e.id===g?" is-selected":""}${F(e)?" is-dim":""}`,style:{...v(l),left:S,top:n-15,width:I,height:30},"aria-pressed":e.id===g,onClick:()=>J(e.id),children:[(0,t.jsx)("span",{className:"an-mark","aria-label":l.label,children:R[l.tone]}),(0,t.jsx)("span",{className:"an-item-label",children:e.label}),e.result&&I>420&&(0,t.jsx)("span",{className:"an-item-result",children:e.result}),e.source&&(0,t.jsx)("span",{className:"an-item-source",children:e.source})]},e.id)})]}),i&&f&&(0,t.jsxs)("aside",{className:"an-detail","aria-live":"polite",children:[(0,t.jsxs)("div",{className:"an-panel",children:[_&&(0,t.jsx)("div",{className:"an-sub",children:_.label}),(0,t.jsx)("h4",{children:i.label}),(0,t.jsxs)("span",{className:"an-pill",style:v(f),children:[R[f.tone]," ",f.label]}),i.source&&(0,t.jsxs)("span",{className:"an-sub",children:[" \xB7 ",o("tree.source",{source:i.source})]}),i.detail&&(0,t.jsxs)("div",{className:"an-field",children:[(0,t.jsx)("small",{children:o("tree.detail")}),i.detail]}),i.result&&(0,t.jsxs)("div",{className:"an-result-box",style:v(f),children:[(0,t.jsx)("small",{style:{color:"var(--tone)",fontWeight:600},children:o("tree.result")}),(0,t.jsx)("div",{children:i.result})]}),i.links&&i.links.length>0&&(0,t.jsxs)("div",{className:"an-field",children:[(0,t.jsx)("small",{children:o("tree.links")}),(0,t.jsx)("div",{className:"an-tags",children:i.links.map(e=>(0,t.jsx)("span",{className:"an-tag",children:e},e))})]})]}),(0,t.jsxs)("div",{className:"an-panel",children:[(0,t.jsx)("p",{className:"an-panel-title",children:o("tree.overall")}),(0,t.jsx)(Y,{items:c,statuses:r,height:10}),(0,t.jsx)("div",{className:"an-legend",children:r.map(e=>(0,t.jsxs)("span",{style:v(e),children:[(0,t.jsx)("b",{children:R[e.tone]})," ",e.label," ",G[e.id]??0]},e.id))})]})]})]}),(0,t.jsxs)("details",{className:"an-static",children:[(0,t.jsx)("summary",{children:o("tree.readAll",{count:c.length})}),a.groups.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{children:e.label}),(0,t.jsx)("ul",{children:e.items.map(n=>(0,t.jsxs)("li",{children:[(0,t.jsx)("b",{children:d.get(n.status)?.label})," \xB7"," ",n.result?o("tree.itemResult",{label:n.label,result:n.result}):n.label]},n.id))})]},e.id))]})]})}export{ue as StatusTreeBlock};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-N4STN5JL.js";import"./chunk-RM3453FR.js";import"./chunk-JLTBSSKD.js";import"./chunk-I2YI7JTH.js";import"./chunk-HFI3ZB2W.js";import"./chunk-J6IRWTF7.js";import"./chunk-DCANE7XH.js";export{a as CodePanel,b as StepGuideBlock};
@@ -0,0 +1,3 @@
1
+ import{a as M,b as I,c as O}from"./chunk-LPO3XSPL.js";import{d as E,f as y}from"./chunk-JLTBSSKD.js";import{d as K}from"./chunk-I2YI7JTH.js";import{a as P,c as V,ib as D,lb as T}from"./chunk-HFI3ZB2W.js";import{a as A}from"./chunk-J6IRWTF7.js";import{c as j}from"./chunk-DCANE7XH.js";var c=j(V(),1);P(`.sb-block.stb-block :is(h3,h4,p,ul,ol,li,pre):not(svg){margin:0}.sb-block.stb-block li:not(svg){padding:0}.sb-block.stb-block pre:not(svg){border:0;border-radius:0;background:none;color:inherit}.sb-block.stb-block{--stb-text: var(--text, #222222);--stb-muted: var(--muted, #6a6a6a);--stb-faint: var(--subtle, #929292);--stb-line: var(--line, #dddddd);--stb-paper: var(--paper, #ffffff);--stb-surface: var(--surface, #fafafa);--stb-hover: var(--hover, #f7f7f7);--stb-accent: var(--accent, #120a8f);--stb-accent-soft: var(--accent-soft, #eeedf9);--stb-mono: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);--stb-object: #7348d0;--stb-object-soft: #f2edfc;--stb-array: #0d8579;--stb-array-soft: #e6f4f2;--stb-note: #a8582a;color:var(--stb-text);font-family:inherit;font-size:14px;line-height:1.7;padding:8px 0;container-type:inline-size}:root[data-theme=dark] .sb-block.stb-block,[data-theme=dark] .sb-block.stb-block{--stb-object: #b497ff;--stb-object-soft: #2e2648;--stb-array: #4fc4b6;--stb-array-soft: #163734;--stb-note: #e79c64}.sb-block.stb-block *{box-sizing:border-box}.sb-block.stb-block .stb-heading{margin:0 0 10px;font-size:17px;font-weight:700}.sb-block.stb-block .stb-frame{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);border:1px solid var(--stb-line);border-radius:10px;overflow:hidden;background:var(--stb-paper)}.sb-block.stb-block .stb-nav{background:var(--stb-surface);border-right:1px solid var(--stb-line);padding:8px 0;min-width:0}.sb-block.stb-block .stb-tree{display:flex;flex-direction:column;gap:1px}.sb-block.stb-block .stb-row{position:relative;display:flex;align-items:center;gap:6px;min-height:30px;margin:0 6px;padding:0 10px 0 calc(8px + var(--depth) * 18px);border-radius:6px;cursor:pointer;font-family:var(--stb-mono);font-size:12.5px;line-height:1.2;color:var(--stb-text);user-select:none;-webkit-user-select:none}.sb-block.stb-block .stb-row:hover{background:var(--stb-hover)}.sb-block.stb-block .stb-row.is-selected{background:var(--stb-accent-soft)}.sb-block.stb-block .stb-row.is-selected .stb-name{color:var(--stb-accent);font-weight:600}.sb-block.stb-block .stb-row:focus{outline:none}.sb-block.stb-block .stb-row:focus-visible{outline:2px solid var(--stb-accent);outline-offset:-2px}.sb-block.stb-block .stb-guide{position:absolute;top:0;bottom:-1px;left:calc(8px + var(--level) * 18px + 6px);width:1px;background:var(--stb-line)}.sb-block.stb-block .stb-row.is-selected .stb-guide{background:color-mix(in srgb,var(--stb-accent) 18%,transparent)}.sb-block.stb-block .stb-chevron{flex:none;display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;margin-right:-1px;border-radius:4px;color:var(--stb-faint)}.sb-block.stb-block .stb-chevron svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;transition:transform .15s}.sb-block.stb-block .stb-chevron.is-open svg{transform:rotate(90deg)}.sb-block.stb-block .stb-row:hover .stb-chevron:not(.is-none){color:var(--stb-muted)}.sb-block.stb-block .stb-name,.sb-block.stb-block .stb-type{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 0}.sb-block.stb-block .stb-type{color:var(--stb-faint);font-family:var(--stb-mono);font-size:11.5px}.sb-block.stb-block .stb-badge{flex:none;margin-left:auto;display:inline-flex;align-items:center;height:19px;padding:0 7px;border-radius:6px;background:var(--stb-surface);border:1px solid var(--stb-line);font-family:var(--font-sans, inherit);font-size:11px;line-height:1;color:var(--stb-muted);white-space:nowrap}.sb-block.stb-block .stb-row .stb-badge{background:var(--stb-paper)}.sb-block.stb-block .stb-row.is-selected .stb-badge{border-color:color-mix(in srgb,var(--stb-accent) 22%,transparent);color:var(--stb-accent)}.sb-block.stb-block .stb-icon{flex:none;width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center}.sb-block.stb-block svg.stb-icon{overflow:visible}.sb-block.stb-block .stb-icon.is-dir path{fill:color-mix(in srgb,var(--stb-accent) 14%,transparent);stroke:var(--stb-accent);stroke-width:1.2;stroke-linejoin:round}.sb-block.stb-block .stb-icon.is-dir.is-open path{fill:color-mix(in srgb,var(--stb-accent) 30%,transparent)}.sb-block.stb-block .stb-icon.is-file path{fill:none;stroke:var(--stb-muted);stroke-width:1.2;stroke-linejoin:round}.sb-block.stb-block .stb-icon.is-file path:first-child{fill:var(--stb-paper)}.sb-block.stb-block .stb-icon.is-field rect{fill:none;stroke:var(--stb-faint);stroke-width:1.3}.sb-block.stb-block .stb-icon.is-glyph{font-family:var(--stb-mono);font-size:10.5px;font-weight:700;letter-spacing:-.5px;border-radius:4px;line-height:16px}.sb-block.stb-block .stb-icon.is-object{color:var(--stb-object);background:var(--stb-object-soft)}.sb-block.stb-block .stb-icon.is-array{color:var(--stb-array);background:var(--stb-array-soft);letter-spacing:-2px;padding-right:2px}.sb-block.stb-block .stb-detail{padding:18px 24px 22px;min-width:0;overflow-wrap:anywhere}.sb-block.stb-block .stb-crumbs{display:flex;flex-wrap:wrap;align-items:center;gap:2px 4px;font-family:var(--stb-mono);font-size:11.5px;line-height:1.5;color:var(--stb-muted)}.sb-block.stb-block .stb-crumbs button{border:0;background:none;font:inherit;cursor:pointer;color:var(--stb-muted);border-radius:4px;padding:0 2px}.sb-block.stb-block .stb-crumbs button:hover{color:var(--stb-accent)}.sb-block.stb-block .stb-crumbs button:focus-visible{outline:2px solid var(--stb-accent);outline-offset:2px}.sb-block.stb-block .stb-crumbs [aria-current]{color:var(--stb-text);padding:0 2px}.sb-block.stb-block .stb-sep{color:var(--stb-faint)}.sb-block.stb-block .stb-title{display:flex;flex-wrap:wrap;align-items:center;gap:6px 9px;margin-top:12px}.sb-block.stb-block .stb-title .stb-icon{width:18px;height:18px}.sb-block.stb-block .stb-title .stb-icon.is-glyph{font-size:11.5px;line-height:18px}.sb-block.stb-block .stb-title h4{margin:0;font-family:var(--stb-mono);font-size:17px;line-height:1.35;font-weight:600;letter-spacing:-.01em}.sb-block.stb-block .stb-dtype{font-family:var(--stb-mono);font-size:12px;line-height:1.5;color:var(--stb-muted);background:var(--stb-surface);border-radius:6px;padding:1px 7px}.sb-block.stb-block .stb-title .stb-badge{margin-left:0}.sb-block.stb-block .stb-meta{margin-top:3px;padding-left:27px;font-size:12px;color:var(--stb-faint)}.sb-block.stb-block .stb-summary{margin:12px 0 0;font-size:15px;line-height:1.65}.sb-block.stb-block .stb-body{margin-top:2px}.sb-block.stb-block .stb-para{margin:10px 0 0;line-height:1.75}.sb-block.stb-block ul.stb-para{padding-left:18px}.sb-block.stb-block ul.stb-para li+li{margin-top:3px}.sb-block.stb-block .stb-empty{margin:14px 0 0;font-size:13px;color:var(--stb-faint)}.sb-block.stb-block .stb-code{margin-top:16px;border:1px solid var(--stb-line);border-radius:8px;background:var(--stb-surface);overflow:hidden}.sb-block.stb-block .stb-codebar{display:flex;align-items:center;gap:8px;padding:5px 6px 5px 12px;border-bottom:1px solid var(--stb-line)}.sb-block.stb-block .stb-lang{font-family:var(--stb-mono);font-size:11px;color:var(--stb-muted);letter-spacing:.03em}.sb-block.stb-block .stb-copystate{flex:1;min-width:0;text-align:right;font-size:11.5px;color:var(--stb-note);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sb-block.stb-block .stb-copy{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 8px;border:0;border-radius:6px;background:transparent;color:var(--stb-muted);font:inherit;font-size:12px;cursor:pointer}.sb-block.stb-block .stb-copy:hover{background:var(--stb-line);color:var(--stb-text)}.sb-block.stb-block .stb-copy:focus-visible{outline:2px solid var(--stb-accent);outline-offset:2px}.sb-block.stb-block .stb-copy svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}.sb-block.stb-block .stb-copy.is-done{color:var(--stb-array)}.sb-block.stb-block .stb-code .stb-pre{margin:0;padding:12px 14px 14px;overflow-x:auto;font-family:var(--stb-mono);font-size:12.5px;line-height:1.65;white-space:pre;tab-size:2;scrollbar-width:thin}.sb-block.stb-block .stb-code code{font:inherit;background:none;border:0;padding:0;border-radius:0;color:inherit;overflow-wrap:normal}.sb-block.stb-block .stb-kids{margin-top:20px}.sb-block.stb-block .stb-kidshead{font-size:12px;font-weight:600;color:var(--stb-muted);letter-spacing:.04em;margin-bottom:4px}.sb-block.stb-block .stb-kid{display:grid;grid-template-columns:16px auto minmax(0,1fr);align-items:center;gap:9px;width:100%;padding:7px 8px;border:0;border-top:1px solid var(--stb-line);border-radius:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.sb-block.stb-block .stb-kid:last-child{border-bottom:1px solid var(--stb-line)}.sb-block.stb-block .stb-kid:hover{background:var(--stb-hover)}.sb-block.stb-block .stb-kid:focus-visible{outline:2px solid var(--stb-accent);outline-offset:-2px;border-radius:4px}.sb-block.stb-block .stb-kidname{font-family:var(--stb-mono);font-size:12.5px;white-space:nowrap}.sb-block.stb-block .stb-kidsum{font-size:12.5px;color:var(--stb-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sb-block.stb-block .stb-detail code,.sb-block.stb-block .stb-caption code,.sb-block.stb-block .stb-print code{font-family:var(--stb-mono);font-size:.88em;background:var(--stb-surface);border:1px solid var(--stb-line);border-radius:4px;padding:0 4px;overflow-wrap:anywhere}.sb-block.stb-block a{color:var(--stb-accent);text-decoration:none;border-bottom:1px solid color-mix(in srgb,var(--stb-accent) 35%,transparent)}.sb-block.stb-block a:hover{border-bottom-color:var(--stb-accent)}.sb-block.stb-block strong{font-weight:600}.sb-block.stb-block .stb-caption{margin:10px 2px 0;font-size:12.5px;line-height:1.65;color:var(--stb-muted)}.sb-block.stb-block .stb-print{display:none}.sb-block.stb-block .stb-print ul{list-style:none;margin:0;padding-left:18px}.sb-block.stb-block .stb-print>ul{padding-left:0}.sb-block.stb-block .stb-print li{margin:2px 0;break-inside:avoid}.sb-block.stb-block .stb-print-name{font-family:var(--stb-mono);font-weight:600;margin-right:6px}.sb-block.stb-block .stb-print .stb-type{display:inline;margin-right:6px}.sb-block.stb-block .stb-print .stb-badge{display:inline;height:auto;margin:0;padding:0 4px}.sb-block.stb-block .stb-print-summary{color:var(--stb-muted)}@container (max-width: 640px){.sb-block.stb-block .stb-frame{grid-template-columns:minmax(0,1fr)}.sb-block.stb-block .stb-nav{border-right:0;border-bottom:1px solid var(--stb-line)}.sb-block.stb-block .stb-detail{padding:16px 16px 18px}.sb-block.stb-block .stb-row{padding-left:calc(6px + var(--depth) * 16px)}.sb-block.stb-block .stb-guide{left:calc(6px + var(--level) * 16px + 6px)}.sb-block.stb-block .stb-summary{font-size:14.5px}}@media(prefers-reduced-motion:reduce){.sb-block.stb-block *{transition:none!important}}@media print{.sb-block.stb-block .stb-frame{display:none}.sb-block.stb-block .stb-print{display:block;font-size:12.5px;line-height:1.6}}
2
+ `);var B=A("structureBrowser",{"zh-CN":{title:"\u7ED3\u6784\u6D4F\u89C8\u5668",tree:"\u7ED3\u6784",path:"\u8DEF\u5F84","kind.dir":"\u6587\u4EF6\u5939","kind.file":"\u6587\u4EF6","kind.object":"\u5BF9\u8C61","kind.array":"\u6570\u7EC4","kind.field":"\u5B57\u6BB5",childCount:{other:"{count} \u4E2A\u5B50\u9879"},contains:"\u5305\u542B",example:"\u793A\u4F8B",copy:"\u590D\u5236",copied:"\u5DF2\u590D\u5236",copyLabel:"\u590D\u5236\u793A\u4F8B\uFF1A{name}",selectedToCopy:"\u5DF2\u9009\u4E2D\uFF0C\u6309 \u2318C / Ctrl+C \u590D\u5236",toggle:"\u5C55\u5F00\u6216\u6536\u8D77 {name}",noDetail:"\u8FD9\u4E00\u9879\u6CA1\u6709\u66F4\u591A\u8BF4\u660E\u3002",empty:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u7ED3\u6784\u3002"},en:{title:"Structure browser",tree:"Structure",path:"Path","kind.dir":"Folder","kind.file":"File","kind.object":"Object","kind.array":"Array","kind.field":"Field",childCount:{one:"{count} child",other:"{count} children"},contains:"Contains",example:"Example",copy:"Copy",copied:"Copied",copyLabel:"Copy example: {name}",selectedToCopy:"Selected \u2014 press \u2318C / Ctrl+C to copy",toggle:"Expand or collapse {name}",noDetail:"No further description for this item.",empty:"There is no structure to show."}});var t=j(D(),1);function U({source:l}){return l.trim().split(/\n\s*\n/).map((i,b)=>{let s=i.split(`
3
+ `);return s.every(a=>/^\s*[-•]\s+/.test(a))?(0,t.jsx)("ul",{className:"stb-para",children:s.map((a,d)=>(0,t.jsx)("li",{children:(0,t.jsx)(y,{source:a.replace(/^\s*[-•]\s+/,"")})},d))},b):(0,t.jsx)("p",{className:"stb-para",children:s.map((a,d)=>(0,t.jsxs)(c.Fragment,{children:[d>0&&(0,t.jsx)("br",{}),(0,t.jsx)(y,{source:a})]},d))},b)})}function L({kind:l,open:i}){return l==="dir"?(0,t.jsx)("svg",{className:`stb-icon is-dir${i?" is-open":""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M1.75 4.25c0-.69.56-1.25 1.25-1.25h2.6l1.4 1.5h6c.69 0 1.25.56 1.25 1.25v6c0 .69-.56 1.25-1.25 1.25H3c-.69 0-1.25-.56-1.25-1.25z"})}):l==="file"?(0,t.jsxs)("svg",{className:"stb-icon is-file",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M4 1.75h5.2L12.75 5.3v8.2c0 .41-.34.75-.75.75H4a.75.75 0 0 1-.75-.75V2.5c0-.41.34-.75.75-.75z"}),(0,t.jsx)("path",{d:"M9 1.9v3.6h3.6"})]}):l==="object"?(0,t.jsx)("span",{className:"stb-icon is-glyph is-object","aria-hidden":"true",children:"{}"}):l==="array"?(0,t.jsx)("span",{className:"stb-icon is-glyph is-array","aria-hidden":"true",children:"[ ]"}):(0,t.jsx)("svg",{className:"stb-icon is-field",viewBox:"0 0 16 16","aria-hidden":"true",children:(0,t.jsx)("rect",{x:"5",y:"5",width:"6",height:"6",rx:"1.5",transform:"rotate(45 8 8)"})})}function _({code:l,lang:i,name:b}){let s=T(B),a=(0,c.useRef)(null),d=(0,c.useRef)(void 0),[m,k]=(0,c.useState)("idle");(0,c.useEffect)(()=>()=>window.clearTimeout(d.current),[]);let p=x=>{k(x),window.clearTimeout(d.current),d.current=window.setTimeout(()=>k("idle"),x==="copied"?1500:4e3)},h=()=>{let x=window.getSelection();if(a.current&&x){let g=document.createRange();g.selectNodeContents(a.current),x.removeAllRanges(),x.addRange(g)}p("selected")},w=()=>{if(!navigator.clipboard)return h();navigator.clipboard.writeText(l).then(()=>p("copied"),h)};return(0,t.jsxs)("div",{className:"stb-code",children:[(0,t.jsxs)("div",{className:"stb-codebar",children:[(0,t.jsx)("span",{className:"stb-lang",children:i||s("example")}),(0,t.jsx)("span",{className:"stb-copystate","aria-live":"polite",children:m==="selected"?s("selectedToCopy"):""}),(0,t.jsxs)("button",{type:"button",className:`stb-copy${m==="copied"?" is-done":""}`,"aria-label":s("copyLabel",{name:b}),onClick:w,children:[m==="copied"?(0,t.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M3.5 8.5l3 3 6-6.5"})}):(0,t.jsxs)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"5.5",y:"5.5",width:"8",height:"8",rx:"1.6"}),(0,t.jsx)("path",{d:"M10.5 3.5v-.4A1.6 1.6 0 0 0 8.9 1.5H4.1A1.6 1.6 0 0 0 2.5 3.1v4.8a1.6 1.6 0 0 0 1.6 1.6h.4"})]}),s(m==="copied"?"copied":"copy")]})]}),(0,t.jsx)("pre",{className:"stb-pre",children:(0,t.jsx)("code",{ref:a,children:l})})]})}function $({items:l,roots:i},b){let s=new Set;for(let k of l.values())k.node.open&&k.children.length&&s.add(k.path);let a=b?I(b):"",d=l.has(a)?a:null,m=d??i[0]??null;if(d)for(let k=d;k;k=l.get(k).parent)l.get(k).children.length&&s.add(k);else!s.size&&m&&l.get(m).children.length&&s.add(m);return{selected:m,open:s}}function F({paths:l,outline:i}){return(0,t.jsx)("ul",{children:l.map(b=>{let s=i.items.get(b);return(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"stb-print-name",children:s.node.name}),s.node.type&&(0,t.jsx)("span",{className:"stb-type",children:s.node.type}),s.node.badge&&(0,t.jsx)("span",{className:"stb-badge",children:s.node.badge}),s.node.summary&&(0,t.jsxs)("span",{className:"stb-print-summary",children:[" \u2014 ",(0,t.jsx)(y,{source:s.node.summary,links:!1})]}),s.children.length>0&&(0,t.jsx)(F,{paths:s.children,outline:i})]},b)})})}function et({data:l}){let i=T(B),b=l,s=(0,c.useMemo)(()=>O(b.nodes??[]),[b.nodes]),{items:a,roots:d}=s,[m,k]=(0,c.useState)(()=>$(s,b.initial));(0,c.useEffect)(()=>k($(s,b.initial)),[s,b.initial]);let{selected:p,open:h}=m,w=(e,o)=>k(u=>{let r=new Set(u.open);return o==="open"||o==="flip"&&!r.has(e)?r.add(e):(o==="close"||o==="flip")&&r.delete(e),{selected:e,open:r}}),x=e=>k(o=>{let u=new Set(o.open);for(let r=a.get(e)?.parent??null;r;r=a.get(r).parent)u.add(r);return{selected:e,open:u}}),g=(0,c.useMemo)(()=>{let e=[],o=u=>{for(let r of u){let f=a.get(r);e.push(f),f.children.length&&h.has(r)&&o(f.children)}};return o(d),e},[a,d,h]),z=(0,c.useRef)(new Map),C=(0,c.useRef)(!1);(0,c.useLayoutEffect)(()=>{C.current&&p&&z.current.get(p)?.focus(),C.current=!1},[p,g]);let H=e=>{if(!p)return;let o=a.get(p),u=g.findIndex(f=>f.path===p),r=(f,v)=>{e.preventDefault(),f&&(C.current=!0,w(f,v))};switch(e.key){case"ArrowDown":return r(g[u+1]?.path);case"ArrowUp":return r(g[u-1]?.path);case"Home":return r(g[0]?.path);case"End":return r(g[g.length-1]?.path);case"ArrowRight":return o.children.length?h.has(p)?r(o.children[0]):r(p,"open"):e.preventDefault();case"ArrowLeft":return o.children.length&&h.has(p)?r(p,"close"):r(o.parent);case"Enter":case" ":return o.children.length?r(p,"flip"):e.preventDefault()}},n=p?a.get(p):void 0,S=[];for(let e=p;e;e=a.get(e).parent)S.unshift(a.get(e));let R=e=>e.parent?a.get(e.parent).children:d;return(0,t.jsxs)("section",{className:"sb-block stb-block","aria-label":K(b.title,i("title")),children:[b.title&&(0,t.jsx)("h3",{className:"stb-heading",children:b.title}),(0,t.jsxs)("div",{className:"stb-frame",children:[(0,t.jsx)("div",{className:"stb-nav",children:(0,t.jsx)("div",{className:"stb-tree",role:"tree","aria-label":i("tree"),onKeyDown:H,children:g.map(e=>{let o=h.has(e.path),u=e.path===p,r=R(e);return(0,t.jsxs)("div",{ref:f=>{f?z.current.set(e.path,f):z.current.delete(e.path)},role:"treeitem","aria-level":e.depth+1,"aria-setsize":r.length,"aria-posinset":r.indexOf(e.path)+1,"aria-selected":u,"aria-expanded":e.children.length?o:void 0,tabIndex:u?0:-1,className:`stb-row${u?" is-selected":""}`,style:{"--depth":e.depth},onClick:()=>w(e.path,e.children.length&&(!o||u)?"flip":void 0),children:[Array.from({length:e.depth},(f,v)=>(0,t.jsx)("i",{className:"stb-guide",style:{"--level":v},"aria-hidden":"true"},v)),(0,t.jsx)("span",{className:`stb-chevron${e.children.length?"":" is-none"}${o?" is-open":""}`,"aria-hidden":"true",title:e.children.length?i("toggle",{name:e.node.name}):void 0,onClick:f=>{e.children.length&&(f.stopPropagation(),k(v=>{let N=new Set(v.open);return N.has(e.path)?N.delete(e.path):N.add(e.path),{...v,open:N}}))},children:e.children.length>0&&(0,t.jsx)("svg",{viewBox:"0 0 12 12",children:(0,t.jsx)("path",{d:"M4.5 2.75L7.75 6 4.5 9.25"})})}),(0,t.jsx)(L,{kind:e.kind,open:o}),(0,t.jsx)("span",{className:"stb-name",children:e.node.name}),e.node.type&&(0,t.jsx)("span",{className:"stb-type",children:e.node.type}),e.node.badge&&(0,t.jsx)("span",{className:"stb-badge",children:e.node.badge})]},e.path)})})}),(0,t.jsx)("div",{className:"stb-detail","aria-live":"polite",children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("nav",{className:"stb-crumbs","aria-label":i("path"),children:S.map((e,o)=>(0,t.jsxs)(c.Fragment,{children:[o>0&&(0,t.jsx)("span",{className:"stb-sep","aria-hidden":"true",children:"/"}),o<S.length-1?(0,t.jsx)("button",{type:"button",onClick:()=>w(e.path),children:M(e.node.name)}):(0,t.jsx)("span",{"aria-current":"location",children:M(e.node.name)})]},e.path))}),(0,t.jsxs)("div",{className:"stb-title",children:[(0,t.jsx)(L,{kind:n.kind}),(0,t.jsx)("h4",{children:n.node.name}),n.node.type&&(0,t.jsx)("span",{className:"stb-dtype",children:n.node.type}),n.node.badge&&(0,t.jsx)("span",{className:"stb-badge",children:n.node.badge})]}),(0,t.jsxs)("div",{className:"stb-meta",children:[i(`kind.${n.kind}`),n.children.length>0&&` \xB7 ${i("childCount",{count:n.children.length})}`]}),n.node.summary&&(0,t.jsx)("p",{className:"stb-summary",children:(0,t.jsx)(y,{source:n.node.summary})}),n.node.detail&&(0,t.jsx)("div",{className:"stb-body",children:(0,t.jsx)(U,{source:n.node.detail})}),n.node.example&&(0,t.jsx)(_,{code:n.node.example,lang:n.node.exampleLang,name:n.node.name},n.path),n.children.length>0&&(0,t.jsxs)("div",{className:"stb-kids",children:[(0,t.jsx)("div",{className:"stb-kidshead",children:i("contains")}),n.children.map(e=>{let o=a.get(e);return(0,t.jsxs)("button",{type:"button",className:"stb-kid",onClick:()=>x(e),children:[(0,t.jsx)(L,{kind:o.kind}),(0,t.jsx)("span",{className:"stb-kidname",children:o.node.name}),o.node.summary&&(0,t.jsx)("span",{className:"stb-kidsum",children:E(o.node.summary)})]},e)})]}),!n.node.summary&&!n.node.detail&&!n.node.example&&!n.children.length&&(0,t.jsx)("p",{className:"stb-empty",children:i("noDetail")})]}):(0,t.jsx)("p",{className:"stb-empty",children:i("empty")})})]}),(0,t.jsx)("div",{className:"stb-print",children:(0,t.jsx)(F,{paths:d,outline:s})}),b.caption&&(0,t.jsx)("p",{className:"stb-caption",children:(0,t.jsx)(y,{source:b.caption})})]})}export{et as StructureBrowserBlock};
@@ -0,0 +1,2 @@
1
+ import{f as P,g as j}from"./chunk-3RZMLHCB.js";import{d as X}from"./chunk-I2YI7JTH.js";import{a as H,c as be,ib as C,kb as V,lb as q}from"./chunk-HFI3ZB2W.js";import{a as O}from"./chunk-J6IRWTF7.js";import{c as A}from"./chunk-DCANE7XH.js";var c=A(be(),1);H(`.sb-block.wf-block :is(h3,h4,p,ul,ol,li,pre):not(svg){margin:0}.sb-block.wf-block li:not(svg){padding:0}.sb-block.wf-block pre:not(svg){border:0;border-radius:0;background:none;color:inherit}.sb-block.wf-block{--wf-text: var(--text, #222222);--wf-muted: var(--muted, #6a6a6a);--wf-line: var(--line, #dddddd);--wf-paper: var(--paper, #ffffff);--wf-surface: var(--surface, #fafafa);--wf-accent: var(--accent, #120a8f);--wf-accent-soft: var(--accent-soft, #eeedf9);--wf-good: #1d5fc4;--wf-bad: #c4402f;color:var(--wf-text);font-family:inherit;font-size:14px;line-height:1.5;padding:8px 0;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;container-type:inline-size}:root[data-theme=dark] .sb-block.wf-block,[data-theme=dark] .sb-block.wf-block{--wf-good: #7fb0f0;--wf-bad: #ef8a7c}.sb-block.wf-block *{box-sizing:border-box}.sb-block.wf-block .wf-tone-total{--wf-tone: var(--wf-text)}.sb-block.wf-block .wf-tone-good{--wf-tone: var(--wf-good)}.sb-block.wf-block .wf-tone-bad{--wf-tone: var(--wf-bad)}.sb-block.wf-block .wf-eyebrow{font-size:11.5px;letter-spacing:.06em;color:var(--wf-muted);font-weight:600}.sb-block.wf-block .wf-title{font-size:17px;font-weight:700;margin:2px 0 0}.sb-block.wf-block .wf-story{margin:6px 0 14px;font-size:18px;line-height:1.42;font-weight:650;max-width:44em}.sb-block.wf-block .wf-heads{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));margin:0;border-top:2px solid var(--wf-text);border-bottom:1px solid var(--wf-line)}.sb-block.wf-block .wf-head{display:flex;flex-direction:column;gap:2px;padding:10px 14px 11px 0;min-width:0}.sb-block.wf-block .wf-head+.wf-head{padding-left:16px;border-left:1px solid var(--wf-line)}.sb-block.wf-block .wf-head dt{font-size:12px;color:var(--wf-muted);font-weight:600}.sb-block.wf-block .wf-head dd{margin:0;display:flex;flex-direction:column;gap:2px}.sb-block.wf-block .wf-head b{font-size:26px;line-height:1.1;font-weight:750;letter-spacing:-.02em;white-space:nowrap}.sb-block.wf-block .wf-head dd span{font-size:12.5px;font-weight:600;color:var(--wf-tone)}.sb-block.wf-block .wf-head dd .wf-tone-total{color:var(--wf-muted)}.sb-block.wf-block .wf-body{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(240px,1fr);gap:20px;margin-top:14px;align-items:stretch}.sb-block.wf-block .wf-chart{margin:0;min-width:0}.sb-block.wf-block .wf-scroll{overflow-x:auto}.sb-block.wf-block .wf-canvas{position:relative}.sb-block.wf-block .wf-canvas svg{display:block;overflow:visible}.sb-block.wf-block .wf-gridline{stroke:var(--wf-line)}.sb-block.wf-block .wf-zero{stroke:var(--wf-muted)}.sb-block.wf-block .wf-tick{font-size:11px;fill:var(--wf-muted)}.sb-block.wf-block .wf-break path{fill:none;stroke:var(--wf-muted);stroke-width:1.4}.sb-block.wf-block .wf-bar{cursor:pointer;outline:none}.sb-block.wf-block .wf-slot{fill:transparent}.sb-block.wf-block .wf-bar.is-active .wf-slot{fill:var(--wf-accent-soft)}.sb-block.wf-block .wf-bar:focus-visible .wf-slot{stroke:var(--wf-accent);stroke-width:2}.sb-block.wf-block .wf-fill{fill:var(--wf-tone);opacity:.78;transition:opacity .15s}.sb-block.wf-block .wf-bar:hover .wf-fill,.sb-block.wf-block .wf-bar.is-active .wf-fill{opacity:1}.sb-block.wf-block .wf-connector{stroke:var(--wf-muted);stroke-dasharray:3 3}.sb-block.wf-block .wf-value{font-size:12.5px;font-weight:700;fill:var(--wf-tone)}.sb-block.wf-block .wf-labels{position:absolute;left:0;right:0;height:44px}.sb-block.wf-block .wf-labels span{position:absolute;top:4px;padding:0 4px;text-align:center;font-size:12px;font-weight:600;line-height:1.3;color:var(--wf-muted);cursor:pointer}.sb-block.wf-block .wf-labels span.is-active{color:var(--wf-text);font-weight:750}.sb-block.wf-block .wf-chart figcaption{font-size:11.5px;color:var(--wf-muted);margin-top:4px;display:flex;flex-direction:column;gap:2px}.sb-block.wf-block .wf-warn{color:var(--wf-bad);font-weight:600}.sb-block.wf-block .wf-side{border-radius:12px;background:var(--wf-surface);border:1px solid var(--wf-line);padding:14px 16px;display:flex;flex-direction:column;min-width:0}.sb-block.wf-block .wf-side-top{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.sb-block.wf-block .wf-side-top span{font-size:13px;font-weight:700}.sb-block.wf-block .wf-side-top b{font-size:23px;font-weight:750;letter-spacing:-.02em;color:var(--wf-tone);white-space:nowrap}.sb-block.wf-block .wf-side-title{font-size:12px;color:var(--wf-muted);margin:2px 0 10px;font-weight:600}.sb-block.wf-block .wf-side ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:9px}.sb-block.wf-block .wf-row{display:flex;justify-content:space-between;gap:8px;font-size:13px;font-weight:600}.sb-block.wf-block .wf-row span:first-child{min-width:0}.sb-block.wf-block .wf-num{white-space:nowrap}.sb-block.wf-block .wf-num em{font-style:normal;color:var(--wf-muted);margin-left:6px;font-size:12px}.sb-block.wf-block .wf-track{height:7px;border-radius:4px;background:color-mix(in srgb,var(--wf-line) 70%,transparent);margin-top:4px;overflow:hidden}.sb-block.wf-block .wf-track span{display:block;height:100%;border-radius:4px;background:var(--wf-tone);transition:width .3s ease}.sb-block.wf-block .wf-muted{color:var(--wf-muted);font-size:12px;margin:8px 0 0}.sb-block.wf-block .wf-note{font-size:12.5px;line-height:1.45;margin:12px 0 0;padding-top:10px;border-top:1px solid var(--wf-line)}.sb-block.wf-block .wf-hint{margin:auto 0 0;padding-top:10px;font-size:11.5px;color:var(--wf-muted)}.sb-block.wf-block .wf-static{margin-top:12px;font-size:13px}.sb-block.wf-block .wf-static summary{cursor:pointer;color:var(--wf-muted)}.sb-block.wf-block .wf-static table{border-collapse:collapse;width:100%;margin-top:8px}.sb-block.wf-block .wf-static th,.sb-block.wf-block .wf-static td{border-bottom:1px solid var(--wf-line);padding:4px 6px;text-align:left;vertical-align:top}@container (max-width: 760px){.sb-block.wf-block .wf-body{grid-template-columns:minmax(0,1fr)}.sb-block.wf-block .wf-head b{font-size:22px}.sb-block.wf-block .wf-story{font-size:16px}}@container (max-width: 420px){.sb-block.wf-block .wf-head+.wf-head{padding-left:0;border-left:0}}@media(prefers-reduced-motion:reduce){.sb-block.wf-block .wf-fill,.sb-block.wf-block .wf-track span{transition:none}}@media print{.sb-block.wf-block .wf-hint{display:none}.sb-block.wf-block .wf-scroll{overflow:visible}}
2
+ `);var _=O("waterfall",{"zh-CN":{title:"\u7011\u5E03\u6865\u56FE","kind.total":"\u5408\u8BA1","kind.up":"\u589E\u52A0","kind.down":"\u51CF\u5C11",chart:"\u4ECE\u671F\u521D\u5230\u671F\u672B\u7684\u9010\u9879\u53D8\u52A8",step:"{label}\uFF0C{kind} {value}",hint:"\u70B9\u51FB\u67F1\u5B50\u6216\u7528\u65B9\u5411\u952E\u5207\u6362\uFF0C\u67E5\u770B\u8FD9\u4E00\u6B65\u7684\u6784\u6210\u3002",axisFloor:"\u7EB5\u8F74\u4ECE {value} \u8D77\uFF0C\u4EE5\u4FBF\u770B\u6E05\u53D8\u52A8\u3002",mismatch:"\u300C{label}\u300D\u5199\u7684\u662F {stated}\uFF0C\u5404\u9879\u7D2F\u8BA1\u4E3A {computed}\uFF0C\u4E24\u8005\u5BF9\u4E0D\u4E0A\u3002",share:"\u5360\u6BD4",noBreakdown:"\u8FD9\u4E00\u6B65\u6CA1\u6709\u5217\u51FA\u6784\u6210\u3002",breakdownGap:"\u660E\u7EC6\u5408\u8BA1 {sum}\uFF0C\u4E0E\u8FD9\u4E00\u6B65\u7684 {value} \u76F8\u5DEE {gap}\u3002",readAll:"\u4EE5\u8868\u683C\u9605\u8BFB\u5168\u90E8\u6B65\u9AA4\uFF08{count}\uFF09","column.step":"\u6B65\u9AA4","column.kind":"\u7C7B\u578B","column.value":"\u53D8\u52A8","column.level":"\u7D2F\u8BA1"},en:{title:"Waterfall","kind.total":"Total","kind.up":"Increase","kind.down":"Decrease",chart:"Step-by-step change from opening to closing value",step:"{label}, {kind} {value}",hint:"Click a bar or use the arrow keys to see what makes up that step.",axisFloor:"The axis starts at {value} so the changes stay visible.",mismatch:"\u201C{label}\u201D states {stated}, but the steps add up to {computed}.",share:"Share",noBreakdown:"No breakdown is listed for this step.",breakdownGap:"Items add up to {sum}, {gap} away from this step's {value}.",readAll:"Read every step as a table ({count})","column.step":"Step","column.kind":"Kind","column.value":"Change","column.level":"Running total"}});var t=A(C(),1),u=300,s={left:52,right:8,top:28,bottom:12},de=64;function we(){let m=(0,c.useRef)(null),[i,b]=(0,c.useState)(640);return(0,c.useEffect)(()=>{let l=m.current;if(!l)return;let a=new ResizeObserver(([n])=>b(n.contentRect.width));return a.observe(l),()=>a.disconnect()},[]),[m,i]}function pe(m,i){let b=(i-m)/4,l=10**Math.floor(Math.log10(b)),a=[1,2,2.5,5,10].map(d=>d*l).find(d=>d>=b)??b,n=[];for(let d=Math.ceil(m/a)*a;d<=i+a*1e-6;d+=a)n.push(Number(d.toPrecision(12)));return n}function Ne({data:m}){let i=q(_),b=V(),l=m,a=l.steps,n=l.format??{},d=l.upIsGood??!0,J=(0,c.useMemo)(()=>new Intl.NumberFormat(b,{minimumFractionDigits:n.decimals??0,maximumFractionDigits:n.decimals??0}),[b,n.decimals]),Q=(0,c.useMemo)(()=>new Intl.NumberFormat(b,{maximumFractionDigits:n.decimals??0}),[b,n.decimals]),f=(e,o=!1,h=!1)=>{let D=(h?Q:J).format(Math.abs(e)/(n.divisor??1));return`${e<0?"\u2212":o&&e>0?"+":""}${n.prefix??""}${D}${n.suffix??""}`},y=e=>e.kind==="total"?f(e.value):f(e.kind==="down"?-e.value:e.value,!0),F=e=>e==="total"||e==="neutral"?"total":e==="up"===d?"good":"bad",{spans:N}=P(a),E=N.map((e,o)=>a[o].kind==="total"?a[o].value:a[o].kind==="down"?e[0]:e[1]),U=j(l),[Y,M]=(0,c.useState)(()=>l.initialStep??a[1]?.id??a[0].id),r=a.find(e=>e.id===Y)??a[0],[Z,ee]=we(),K=(0,c.useRef)(null),G=(0,c.useRef)(null);(0,c.useEffect)(()=>{let e=()=>{G.current&&(G.current.open=!0)};return window.addEventListener("beforeprint",e),()=>window.removeEventListener("beforeprint",e)},[]);let g=Math.max(ee,s.left+s.right+a.length*de),z=Math.max(...N.map(e=>e[1])),te=Math.min(...N.map(e=>e[0])),w=l.axisFloor??Math.min(0,te),I=pe(w,z>w?z:w+1),oe=Math.max(z,I[I.length-1]??z),p=e=>s.top+(1-(Math.max(e,w)-w)/(oe-w||1))*(u-s.top-s.bottom),k=(g-s.left-s.right)/a.length,S=Math.min(k*.6,72),L=e=>s.left+e*k+(k-S)/2,T=w>0,ae=e=>{let o=a[(e+a.length)%a.length];M(o.id),K.current?.querySelector(`[data-step="${CSS.escape(o.id)}"]`)?.focus()},le=(e,o)=>{e.key==="Enter"||e.key===" "?(e.preventDefault(),M(a[o].id)):(e.key==="ArrowRight"||e.key==="ArrowLeft")&&(e.preventDefault(),ae(o+(e.key==="ArrowRight"?1:-1)))},v=r.breakdown?.items??[],x=v.reduce((e,o)=>e+o.value,0),se=Math.max(1e-9,...v.map(e=>Math.abs(e.value))),ie=.5*(n.divisor??1)/10**(n.decimals??0),ne=v.length>0&&Math.abs(x-Math.abs(r.value))>ie,B=e=>i(`kind.${e}`);return(0,t.jsxs)("section",{className:"sb-block wf-block","aria-label":X(l.title,i("title")),children:[l.eyebrow&&(0,t.jsx)("div",{className:"wf-eyebrow",children:l.eyebrow}),l.title&&(0,t.jsx)("h3",{className:"wf-title",children:l.title}),l.narrative&&(0,t.jsx)("p",{className:"wf-story",children:l.narrative}),l.headlines&&l.headlines.length>0&&(0,t.jsx)("dl",{className:"wf-heads",children:l.headlines.map((e,o)=>(0,t.jsxs)("div",{className:"wf-head",children:[(0,t.jsx)("dt",{children:e.label}),(0,t.jsxs)("dd",{children:[(0,t.jsx)("b",{children:e.value}),e.detail&&(0,t.jsx)("span",{className:`wf-tone-${F(e.tone??"neutral")}`,children:e.detail})]})]},o))}),(0,t.jsxs)("div",{className:"wf-body",children:[(0,t.jsxs)("figure",{className:"wf-chart",children:[(0,t.jsx)("div",{className:"wf-scroll",ref:Z,children:(0,t.jsxs)("div",{className:"wf-canvas",style:{width:g,height:u+44},children:[(0,t.jsxs)("svg",{width:g,height:u,role:"group","aria-label":i("chart"),children:[I.map(e=>(0,t.jsxs)("g",{"aria-hidden":"true",children:[(0,t.jsx)("line",{className:"wf-gridline",x1:s.left,x2:g-s.right,y1:p(e),y2:p(e)}),(0,t.jsx)("text",{className:"wf-tick",x:s.left-8,y:p(e)+4,textAnchor:"end",children:f(e,!1,!0)})]},e)),w<0&&(0,t.jsx)("line",{className:"wf-zero","aria-hidden":"true",x1:s.left,x2:g-s.right,y1:p(0),y2:p(0)}),T&&(0,t.jsxs)("g",{className:"wf-break","aria-hidden":"true",children:[(0,t.jsx)("path",{d:`M${s.left-5} ${u-s.bottom+2} l5 -5 l5 5`}),(0,t.jsx)("path",{d:`M${s.left-5} ${u-s.bottom+8} l5 -5 l5 5`})]}),(0,t.jsx)("g",{ref:K,children:a.map((e,o)=>{let[h,D]=N[o],$=L(o),R=p(D),re=Math.max(2,p(h)-R),W=e.id===r.id,ce=o<a.length-1;return(0,t.jsxs)("g",{className:`wf-bar wf-tone-${F(e.kind)}${W?" is-active":""}`,"data-step":e.id,tabIndex:0,role:"button","aria-pressed":W,"aria-label":i("step",{label:e.label,kind:B(e.kind),value:y(e)}),onClick:()=>M(e.id),onKeyDown:fe=>le(fe,o),children:[(0,t.jsx)("rect",{className:"wf-slot",x:s.left+o*k+2,y:s.top-24,width:k-4,height:u-s.top+22,rx:8}),(0,t.jsx)("rect",{className:"wf-fill",x:$,y:R,width:S,height:re,rx:3}),ce&&(0,t.jsx)("line",{className:"wf-connector",x1:$+S,x2:L(o+1),y1:p(E[o]),y2:p(E[o])}),(0,t.jsx)("text",{className:"wf-value",x:$+S/2,y:R-7,textAnchor:"middle",children:y(e)})]},e.id)})})]}),(0,t.jsx)("div",{className:"wf-labels",style:{top:u},"aria-hidden":"true",children:a.map((e,o)=>(0,t.jsx)("span",{className:e.id===r.id?"is-active":void 0,style:{left:s.left+o*k,width:k},onClick:()=>M(e.id),children:e.label},e.id))})]})}),(0,t.jsxs)("figcaption",{children:[l.axisNote??(T?i("axisFloor",{value:f(w)}):null),U.map(e=>(0,t.jsx)("span",{className:"wf-warn",role:"status",children:i("mismatch",{label:a.find(o=>o.id===e.id).label,stated:f(e.stated),computed:f(e.computed)})},e.id))]})]}),(0,t.jsxs)("aside",{className:`wf-side wf-tone-${F(r.kind)}`,"aria-live":"polite",children:[(0,t.jsxs)("div",{className:"wf-side-top",children:[(0,t.jsx)("span",{children:r.label}),(0,t.jsx)("b",{children:y(r)})]}),r.breakdown?.title&&(0,t.jsx)("div",{className:"wf-side-title",children:r.breakdown.title}),v.length>0?(0,t.jsx)("ul",{children:v.map((e,o)=>(0,t.jsxs)("li",{children:[(0,t.jsxs)("div",{className:"wf-row",children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsxs)("span",{className:"wf-num",children:[f(e.value),(0,t.jsx)("em",{"aria-label":i("share"),children:x?`${Math.round(e.value/x*100)}%`:"\u2013"})]})]}),(0,t.jsx)("div",{className:"wf-track","aria-hidden":"true",children:(0,t.jsx)("span",{style:{width:`${Math.abs(e.value)/se*100}%`}})})]},o))}):(0,t.jsx)("p",{className:"wf-muted",children:i("noBreakdown")}),ne&&(0,t.jsx)("p",{className:"wf-muted",children:i("breakdownGap",{sum:f(x),value:f(Math.abs(r.value)),gap:f(Math.abs(x-Math.abs(r.value)))})}),r.breakdown?.note&&(0,t.jsx)("p",{className:"wf-note",children:r.breakdown.note}),(0,t.jsx)("p",{className:"wf-hint",children:i("hint")})]})]}),(0,t.jsxs)("details",{className:"wf-static",ref:G,children:[(0,t.jsx)("summary",{children:i("readAll",{count:a.length})}),(0,t.jsxs)("table",{children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:i("column.step")}),(0,t.jsx)("th",{children:i("column.kind")}),(0,t.jsx)("th",{children:i("column.value")}),(0,t.jsx)("th",{children:i("column.level")})]})}),(0,t.jsx)("tbody",{children:a.map((e,o)=>(0,t.jsxs)("tr",{children:[(0,t.jsxs)("td",{children:[e.label,e.breakdown&&e.breakdown.items.length>0&&(0,t.jsx)("div",{className:"wf-muted",children:e.breakdown.items.map(h=>`${h.label} ${f(h.value)}`).join(" \xB7 ")})]}),(0,t.jsx)("td",{children:B(e.kind)}),(0,t.jsx)("td",{children:y(e)}),(0,t.jsx)("td",{children:f(E[o])})]},e.id))})]})]})]})}export{Ne as WaterfallBlock};
@@ -0,0 +1 @@
1
+ var r=e=>{throw new Error(e)},y=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function m(e,s,n=400){(typeof e!="string"||!e.trim())&&r(`${s} must be non-empty text.`),e.length>n&&r(`${s} must be at most ${n} characters.`)}function u(e,s,n){e!==void 0&&m(e,s,n)}function h(e,s){(typeof e!="number"||!Number.isFinite(e))&&r(`${s} must be a finite number.`)}function $(e,s,n,i=0){return(!Array.isArray(e)||e.length<i||e.length>n)&&r(`${s} must be an array of ${i} to ${n} items.`),e.forEach((o,d)=>{y(o)||r(`${s}[${d}] must be an object.`)}),e}function w(e,s){let n=new Set;return e.forEach((i,o)=>{m(i.id,`${s}[${o}].id`,60),n.has(i.id)&&r(`${s} contains duplicate id ${i.id}.`),n.add(i.id)}),n}function D(e,s){e!==void 0&&!/^#[0-9a-fA-F]{6}$/.test(e)&&r(`${s} must be a six-digit hex color.`)}function g(e,s,n){s.includes(e)||r(`${n} must be one of ${s.join(", ")}.`)}var v=864e5;function c(e){let s=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e??"");if(!s)return Number.NaN;let[n,i,o]=s.slice(1).map(Number),d=Date.UTC(n,i-1,o),a=new Date(d);return a.getUTCFullYear()===n&&a.getUTCMonth()===i-1&&a.getUTCDate()===o?d/v:Number.NaN}function A(e){return new Date(e*v).toISOString().slice(0,10)}function b(e,s){return Number.isNaN(c(e))&&r(`${s} must be a calendar date written YYYY-MM-DD.`),c(e)}var F=["done","active","todo","blocked"],M=[{id:"done",label:"\u5DF2\u5B8C\u6210",tone:"done"},{id:"active",label:"\u8FDB\u884C\u4E2D",tone:"active"},{id:"todo",label:"\u672A\u5F00\u59CB",tone:"todo"},{id:"blocked",label:"\u53D7\u963B",tone:"blocked"}],E=400;function T(e){return c(e.end)-c(e.start)+1}function I(e){if(e.start&&e.end)return{start:c(e.start),end:c(e.end)};let s=[...e.items.flatMap(n=>[c(n.start),c(n.end)]),...(e.milestones??[]).map(n=>c(n.date)),...e.deadline?[c(e.deadline.date)]:[]];return{start:e.start?c(e.start):Math.min(...s),end:e.end?c(e.end):Math.max(...s)}}function W(e){let s=new Map((e.statuses??M).map(i=>[i.id,i.tone])),n={};for(let i of e.items){let o=i.owner??"",d=n[o]??={scheduled:0,open:0,items:0},a=T(i);d.scheduled+=a,d.items+=1,s.get(i.status)!=="done"&&(d.open+=a*(1-(i.progress??0)))}return n}function j(e){u(e.description,"description",400);for(let t of["start","end","today"])e[t]!==void 0&&b(e[t],t);e.start!==void 0&&e.end!==void 0&&c(e.end)<c(e.start)&&r("end must be on or after start."),e.groupBy!==void 0&&g(e.groupBy,["lane","owner"],"groupBy");let s=new Set;if(e.owners!==void 0){$(e.owners,"owners",8,1);for(let t of w(e.owners,"owners"))s.add(t);e.owners.forEach((t,l)=>{m(t.label,`owners[${l}].label`,40),D(t.color,`owners[${l}].color`)})}let n=w($(e.lanes,"lanes",12,1),"lanes");e.lanes.forEach((t,l)=>{m(t.label,`lanes[${l}].label`,40),u(t.summary,`lanes[${l}].summary`,120)}),e.statuses!==void 0&&($(e.statuses,"statuses",6,1),w(e.statuses,"statuses"),e.statuses.forEach((t,l)=>{m(t.label,`statuses[${l}].label`,30),g(t.tone,F,`statuses[${l}].tone`)}));let i=new Set((e.statuses??M).map(t=>t.id)),o=w($(e.items,"items",80,1),"items");e.items.forEach((t,l)=>{let f=`items[${l}]`;m(t.title,`${f}.title`,80),n.has(t.lane)||r(`${f}.lane ${t.lane} does not match a lane id.`),t.owner!==void 0&&!s.has(t.owner)&&r(`${f}.owner ${t.owner} does not match an owner id.`),i.has(t.status)||r(`${f}.status ${t.status} is not a defined status.`);let S=b(t.start,`${f}.start`);b(t.end,`${f}.end`)<S&&r(`${f}.end must be on or after ${f}.start.`),t.progress!==void 0&&(h(t.progress,`${f}.progress`),(t.progress<0||t.progress>1)&&r(`${f}.progress must be between 0 and 1.`)),u(t.detail,`${f}.detail`,600),u(t.doneWhen,`${f}.doneWhen`,240),u(t.basis,`${f}.basis`,300),t.tags!==void 0&&((!Array.isArray(t.tags)||t.tags.length>12)&&r(`${f}.tags must be an array of at most 12 labels.`),t.tags.forEach((p,k)=>m(p,`${f}.tags[${k}]`,30))),t.depends!==void 0&&((!Array.isArray(t.depends)||t.depends.length>12)&&r(`${f}.depends must be an array of at most 12 item ids.`),t.depends.forEach((p,k)=>{let x=`${f}.depends[${k}]`;o.has(p)||r(`${x} ${p} does not match an item id.`),p===t.id&&r(`${x} points to the item itself.`)}),new Set(t.depends).size!==t.depends.length&&r(`${f}.depends lists the same item twice.`))}),O(e.items),e.milestones!==void 0&&($(e.milestones,"milestones",12),e.milestones.forEach((t,l)=>{b(t.date,`milestones[${l}].date`),m(t.label,`milestones[${l}].label`,30)})),e.deadline!==void 0&&(y(e.deadline)||r("deadline must be an object."),b(e.deadline.date,"deadline.date"),u(e.deadline.label,"deadline.label",40)),e.initialItem!==void 0&&!o.has(e.initialItem)&&r(`initialItem ${e.initialItem} does not match an item id.`);let d=I(e);d.end-d.start+1>E&&r(`The roadmap spans more than ${E} days.`);let a=(t,l)=>{let f=c(t);(f<d.start||f>d.end)&&r(`${l} ${t} is outside the roadmap from ${A(d.start)} to ${A(d.end)}.`)};e.items.forEach((t,l)=>{a(t.start,`items[${l}].start`),a(t.end,`items[${l}].end`)}),(e.milestones??[]).forEach((t,l)=>a(t.date,`milestones[${l}].date`)),e.deadline&&a(e.deadline.date,"deadline.date")}function O(e){let s=new Map(e.map(o=>[o.id,o])),n=new Map,i=(o,d)=>{if(n.get(o)!=="done"){n.get(o)==="visiting"&&r(`items.depends form a cycle: ${[...d.slice(d.indexOf(o)),o].join(" \u2192 ")}.`),n.set(o,"visiting");for(let a of s.get(o).depends??[])i(a,[...d,o]);n.set(o,"done")}};for(let o of e)i(o.id,[])}var U=["total","up","down"];function N(e){let s=0,n=[];return{spans:e.map((o,d)=>{if(o.kind==="total")return d>0&&o.value!==s&&n.push({id:o.id,stated:o.value,computed:s}),s=o.value,[Math.min(0,s),Math.max(0,s)];let a=s;return s+=o.kind==="up"?o.value:-o.value,[Math.min(a,s),Math.max(a,s)]}),end:s,mismatches:n}}function _(e){let s=e.format??{},n=.5*(s.divisor??1)/10**(s.decimals??0);return N(e.steps).mismatches.filter(i=>Math.abs(i.stated-i.computed)>n)}function Y(e){if(u(e.eyebrow,"eyebrow",160),u(e.narrative,"narrative",400),u(e.axisNote,"axisNote",200),e.upIsGood!==void 0&&typeof e.upIsGood!="boolean"&&r("upIsGood must be true or false."),e.headlines!==void 0&&($(e.headlines,"headlines",5),e.headlines.forEach((n,i)=>{m(n.label,`headlines[${i}].label`,40),m(n.value,`headlines[${i}].value`,24),u(n.detail,`headlines[${i}].detail`,80),n.tone!==void 0&&g(n.tone,["up","down","neutral"],`headlines[${i}].tone`)})),e.format!==void 0){let n=e.format;y(n)||r("format must be an object.");for(let[i,o]of[["prefix",6],["suffix",10]])n[i]!==void 0&&(typeof n[i]!="string"||n[i].length>o)&&r(`format.${i} must be text of at most ${o} characters.`);n.divisor!==void 0&&(h(n.divisor,"format.divisor"),n.divisor<=0&&r("format.divisor must be greater than 0.")),n.decimals!==void 0&&(!Number.isInteger(n.decimals)||n.decimals<0||n.decimals>4)&&r("format.decimals must be an integer from 0 to 4.")}let s=w($(e.steps,"steps",16,2),"steps");if(e.steps.forEach((n,i)=>{let o=`steps[${i}]`;if(m(n.label,`${o}.label`,24),g(n.kind,U,`${o}.kind`),h(n.value,`${o}.value`),n.kind!=="total"&&n.value<0&&r(`${o}.value must be a positive magnitude; use kind down for decreases.`),n.breakdown!==void 0){let d=n.breakdown;y(d)||r(`${o}.breakdown must be an object.`),u(d.title,`${o}.breakdown.title`,80),u(d.note,`${o}.breakdown.note`,300),$(d.items,`${o}.breakdown.items`,12),d.items.forEach((a,t)=>{m(a.label,`${o}.breakdown.items[${t}].label`,60),h(a.value,`${o}.breakdown.items[${t}].value`)})}}),e.initialStep!==void 0&&!s.has(e.initialStep)&&r(`initialStep ${e.initialStep} does not match a step id.`),e.axisFloor!==void 0){h(e.axisFloor,"axisFloor");let{spans:n}=N(e.steps);e.steps.forEach((i,o)=>{let[d,a]=n[o];(i.kind==="total"?a<=e.axisFloor:d<e.axisFloor)&&r(`axisFloor ${e.axisFloor} cuts steps[${o}] (${i.label}); lower it below ${i.kind==="total"?a:d}.`)})}}function B(e,s){return y(s)||r("Component data must be an object."),u(s.title,"title",120),e==="roadmap"?j(s):e==="waterfall"?Y(s):r(`Unknown plan component ${e}.`),s}export{c as a,M as b,T as c,I as d,W as e,N as f,_ as g,B as h};
@@ -1 +1 @@
1
- import{d as e}from"./chunk-DUIGVKKG.js";var t=e("blockHelpers",{"zh-CN":{"viewportLock.readFailed":"\u65E0\u6CD5\u8BFB\u53D6\u9605\u8BFB\u9501\u72B6\u6001\uFF1A{error}","viewportLock.saveFailed":"\u65E0\u6CD5\u4FDD\u5B58\u9605\u8BFB\u9501\u72B6\u6001\uFF1A{error}","viewportLock.unlockDescription":"\u5141\u8BB8\u7F29\u653E\u548C\u79FB\u52A8","viewportLock.unlock":"\u89E3\u9501{target}","viewportLock.lock":"\u9501\u5B9A{target}","viewportLock.unlockTitle":"\u89E3\u9501{target}\uFF1A{description}","viewportLock.lockTitle":"\u9501\u5B9A{target}\uFF1A\u4FDD\u6301\u89C6\u56FE\uFF0C\u6B63\u5E38\u6EDA\u52A8\u9605\u8BFB","align.tableGroup":"\u8868\u683C\u5BF9\u9F50","align.tableLeft":"\u8868\u683C\u5DE6\u5BF9\u9F50","align.tableCenter":"\u8868\u683C\u5C45\u4E2D","align.tableRight":"\u8868\u683C\u53F3\u5BF9\u9F50","align.columnGroup":"\u7B2C {column} \u5217\u5BF9\u9F50","align.columnLeft":"\u7B2C {column} \u5217\u5DE6\u5BF9\u9F50","align.columnCenter":"\u7B2C {column} \u5217\u5C45\u4E2D","align.columnRight":"\u7B2C {column} \u5217\u53F3\u5BF9\u9F50","align.scopeGroup":"{scope}\u5BF9\u9F50","align.scopeLeft":"{scope}\u5DE6\u5BF9\u9F50","align.scopeCenter":"{scope}\u5C45\u4E2D","align.scopeRight":"{scope}\u53F3\u5BF9\u9F50","align.settings":"\u8868\u683C\u5BF9\u9F50\u8BBE\u7F6E","chartData.notObject":"\u8BF7\u586B\u5199\u5305\u542B labels \u548C series \u7684 JSON \u5BF9\u8C61\u3002","chartData.labels":"labels \u5FC5\u987B\u662F\u6587\u5B57\u6570\u7EC4\u3002","chartData.series":"series \u5FC5\u987B\u662F\u6570\u636E\u7CFB\u5217\u6570\u7EC4\u3002","chartData.tooLarge":"\u5355\u4E2A\u56FE\u8868\u6700\u591A\u652F\u6301 500 \u4E2A\u6A2A\u8F74\u6807\u7B7E\u300120 \u4E2A\u6570\u636E\u7CFB\u5217\u3002","chartData.seriesShape":"\u6BCF\u4E2A\u7CFB\u5217\u9700\u8981 name \u548C values\u3002","chartData.length":"\u300C{name}\u300D\u7684\u6570\u636E\u6570\u91CF\u5FC5\u987B\u4E0E labels \u4E00\u81F4\u3002","chartData.finite":"\u300C{name}\u300D\u53EA\u80FD\u5305\u542B\u6709\u9650\u6570\u5B57\u3002","chartData.color":"\u300C{name}\u300D\u7684\u989C\u8272\u9700\u8981\u6709\u6548\u7684\u5341\u516D\u8FDB\u5236\u989C\u8272\uFF0C\u4F8B\u5982 #44745a\u3002"},en:{"viewportLock.readFailed":"Couldn't read the reading lock state: {error}","viewportLock.saveFailed":"Couldn't save the reading lock state: {error}","viewportLock.unlockDescription":"allow zooming and panning","viewportLock.unlock":"Unlock {target}","viewportLock.lock":"Lock {target}","viewportLock.unlockTitle":"Unlock {target}: {description}","viewportLock.lockTitle":"Lock {target}: keep the view fixed and scroll normally","align.tableGroup":"Table alignment","align.tableLeft":"Align table left","align.tableCenter":"Center table","align.tableRight":"Align table right","align.columnGroup":"Column {column} alignment","align.columnLeft":"Align column {column} left","align.columnCenter":"Center column {column}","align.columnRight":"Align column {column} right","align.scopeGroup":"{scope} alignment","align.scopeLeft":"Align {scope} left","align.scopeCenter":"Center {scope}","align.scopeRight":"Align {scope} right","align.settings":"Table alignment settings","chartData.notObject":"Enter a JSON object with labels and series.","chartData.labels":"labels must be an array of strings.","chartData.series":"series must be an array of data series.","chartData.tooLarge":"A chart supports up to 500 axis labels and 20 data series.","chartData.seriesShape":"Each series needs a name and values.","chartData.length":"\u201C{name}\u201D must have as many values as labels.","chartData.finite":"\u201C{name}\u201D can only contain finite numbers.","chartData.color":"\u201C{name}\u201D needs a valid hex color, such as #44745a."}});export{t as a};
1
+ import{a as e}from"./chunk-J6IRWTF7.js";var t=e("blockHelpers",{"zh-CN":{"viewportLock.readFailed":"\u65E0\u6CD5\u8BFB\u53D6\u9605\u8BFB\u9501\u72B6\u6001\uFF1A{error}","viewportLock.saveFailed":"\u65E0\u6CD5\u4FDD\u5B58\u9605\u8BFB\u9501\u72B6\u6001\uFF1A{error}","viewportLock.unlockDescription":"\u5141\u8BB8\u7F29\u653E\u548C\u79FB\u52A8","viewportLock.unlock":"\u89E3\u9501{target}","viewportLock.lock":"\u9501\u5B9A{target}","viewportLock.unlockTitle":"\u89E3\u9501{target}\uFF1A{description}","viewportLock.lockTitle":"\u9501\u5B9A{target}\uFF1A\u4FDD\u6301\u89C6\u56FE\uFF0C\u6B63\u5E38\u6EDA\u52A8\u9605\u8BFB","align.tableGroup":"\u8868\u683C\u5BF9\u9F50","align.tableLeft":"\u8868\u683C\u5DE6\u5BF9\u9F50","align.tableCenter":"\u8868\u683C\u5C45\u4E2D","align.tableRight":"\u8868\u683C\u53F3\u5BF9\u9F50","align.columnGroup":"\u7B2C {column} \u5217\u5BF9\u9F50","align.columnLeft":"\u7B2C {column} \u5217\u5DE6\u5BF9\u9F50","align.columnCenter":"\u7B2C {column} \u5217\u5C45\u4E2D","align.columnRight":"\u7B2C {column} \u5217\u53F3\u5BF9\u9F50","align.scopeGroup":"{scope}\u5BF9\u9F50","align.scopeLeft":"{scope}\u5DE6\u5BF9\u9F50","align.scopeCenter":"{scope}\u5C45\u4E2D","align.scopeRight":"{scope}\u53F3\u5BF9\u9F50","align.settings":"\u8868\u683C\u5BF9\u9F50\u8BBE\u7F6E","chartData.notObject":"\u8BF7\u586B\u5199\u5305\u542B labels \u548C series \u7684 JSON \u5BF9\u8C61\u3002","chartData.labels":"labels \u5FC5\u987B\u662F\u6587\u5B57\u6570\u7EC4\u3002","chartData.series":"series \u5FC5\u987B\u662F\u6570\u636E\u7CFB\u5217\u6570\u7EC4\u3002","chartData.tooLarge":"\u5355\u4E2A\u56FE\u8868\u6700\u591A\u652F\u6301 500 \u4E2A\u6A2A\u8F74\u6807\u7B7E\u300120 \u4E2A\u6570\u636E\u7CFB\u5217\u3002","chartData.seriesShape":"\u6BCF\u4E2A\u7CFB\u5217\u9700\u8981 name \u548C values\u3002","chartData.length":"\u300C{name}\u300D\u7684\u6570\u636E\u6570\u91CF\u5FC5\u987B\u4E0E labels \u4E00\u81F4\u3002","chartData.finite":"\u300C{name}\u300D\u53EA\u80FD\u5305\u542B\u6709\u9650\u6570\u5B57\u3002","chartData.color":"\u300C{name}\u300D\u7684\u989C\u8272\u9700\u8981\u6709\u6548\u7684\u5341\u516D\u8FDB\u5236\u989C\u8272\uFF0C\u4F8B\u5982 #44745a\u3002"},en:{"viewportLock.readFailed":"Couldn't read the reading lock state: {error}","viewportLock.saveFailed":"Couldn't save the reading lock state: {error}","viewportLock.unlockDescription":"allow zooming and panning","viewportLock.unlock":"Unlock {target}","viewportLock.lock":"Lock {target}","viewportLock.unlockTitle":"Unlock {target}: {description}","viewportLock.lockTitle":"Lock {target}: keep the view fixed and scroll normally","align.tableGroup":"Table alignment","align.tableLeft":"Align table left","align.tableCenter":"Center table","align.tableRight":"Align table right","align.columnGroup":"Column {column} alignment","align.columnLeft":"Align column {column} left","align.columnCenter":"Center column {column}","align.columnRight":"Align column {column} right","align.scopeGroup":"{scope} alignment","align.scopeLeft":"Align {scope} left","align.scopeCenter":"Center {scope}","align.scopeRight":"Align {scope} right","align.settings":"Table alignment settings","chartData.notObject":"Enter a JSON object with labels and series.","chartData.labels":"labels must be an array of strings.","chartData.series":"series must be an array of data series.","chartData.tooLarge":"A chart supports up to 500 axis labels and 20 data series.","chartData.seriesShape":"Each series needs a name and values.","chartData.length":"\u201C{name}\u201D must have as many values as labels.","chartData.finite":"\u201C{name}\u201D can only contain finite numbers.","chartData.color":"\u201C{name}\u201D needs a valid hex color, such as #44745a."}});export{t as a};
@@ -0,0 +1,9 @@
1
+ function I(i){this.content=i}I.prototype={constructor:I,find:function(i){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===i)return e;return-1},get:function(i){var e=this.find(i);return e==-1?void 0:this.content[e+1]},update:function(i,e,t){var n=t&&t!=i?this.remove(t):this,r=n.find(i),s=n.content.slice();return r==-1?s.push(t||i,e):(s[r+1]=e,t&&(s[r]=t)),new I(s)},remove:function(i){var e=this.find(i);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new I(t)},addToStart:function(i,e){return new I([i,e].concat(this.remove(i).content))},addToEnd:function(i,e){var t=this.remove(i).content.slice();return t.push(i,e),new I(t)},addBefore:function(i,e,t){var n=this.remove(e),r=n.content.slice(),s=n.find(i);return r.splice(s==-1?r.length:s,0,e,t),new I(r)},forEach:function(i){for(var e=0;e<this.content.length;e+=2)i(this.content[e],this.content[e+1])},prepend:function(i){return i=I.from(i),i.size?new I(i.content.concat(this.subtract(i).content)):this},append:function(i){return i=I.from(i),i.size?new I(this.subtract(i).content.concat(i.content)):this},subtract:function(i){var e=this;i=I.from(i);for(var t=0;t<i.content.length;t+=2)e=e.remove(i.content[t]);return e},toObject:function(){var i={};return this.forEach(function(e,t){i[e]=t}),i},get size(){return this.content.length>>1}};I.from=function(i){if(i instanceof I)return i;var e=[];if(i)for(var t in i)e.push(t,i[t]);return new I(e)};var Ae=I;function vt(i,e,t){for(let n=0;;n++){if(n==i.childCount||n==e.childCount)return i.childCount==e.childCount?null:t;let r=i.child(n),s=e.child(n);if(r==s){t+=r.nodeSize;continue}if(!r.sameMarkup(s))return t;if(r.isText&&r.text!=s.text){let o=r.text,a=s.text,l=0;for(;o[l]==a[l];l++)t++;return l&&l<o.length&&l<a.length&&Tt(o.charCodeAt(l-1))&&Mt(o.charCodeAt(l))&&t--,t}if(r.content.size||s.content.size){let o=vt(r.content,s.content,t+1);if(o!=null)return o}t+=r.nodeSize}}function bt(i,e,t,n){for(let r=i.childCount,s=e.childCount;;){if(r==0||s==0)return r==s?null:{a:t,b:n};let o=i.child(--r),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,n-=l;continue}if(!o.sameMarkup(a))return{a:t,b:n};if(o.isText&&o.text!=a.text){let h=o.text,c=a.text,u=h.length,f=c.length;for(;u>0&&f>0&&h[u-1]==c[f-1];)u--,f--,t--,n--;return u&&f&&u<h.length&&Tt(h.charCodeAt(u-1))&&Mt(h.charCodeAt(u))&&(t++,n++),{a:t,b:n}}if(o.content.size||a.content.size){let h=bt(o.content,a.content,t-1,n-1);if(h)return h}t-=l,n-=l}}function Mt(i){return i>=56320&&i<57344}function Tt(i){return i>=55296&&i<56320}var g=class i{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],h=a+l.nodeSize;if(h>e&&n(l,r+a,s||null,o)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,t-c),n,r+c)}a=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let h=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?r?typeof r=="function"?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&h||a.isTextblock)&&n&&(o?o=!1:s+=n),s+=h},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)r.push(e.content[s]);return new i(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],r=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),r+=a.nodeSize),o=l}return new i(n,r)}cutByIndex(e,t){return e==t?i.empty:e==0&&t==this.content.length?this:new i(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new i(r,s)}addToStart(e){return new i([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new i(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return vt(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return bt(this,e,t,n)}findIndex(e){if(e==0)return ge(0,e);if(e==this.size)return ge(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),s=n+r.nodeSize;if(s>=e)return s==e?ge(t+1,s):ge(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return i.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return i.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return i.empty;let t,n=0;for(let r=0;r<e.length;r++){let s=e[r];n+=s.nodeSize,r&&s.isText&&e[r-1].sameMarkup(s)?(t||(t=e.slice(0,r)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new i(t||e,n)}static from(e){if(!e)return i.empty;if(e instanceof i)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new i([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};g.empty=new g([],0);var Fe={index:0,offset:0};function ge(i,e){return Fe.index=i,Fe.offset=e,Fe}function we(i,e){if(i===e)return!0;if(!(i&&typeof i=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(i);if(Array.isArray(e)!=t)return!1;if(t){if(i.length!=e.length)return!1;for(let n=0;n<i.length;n++)if(!we(i[n],e[n]))return!1}else{for(let n in i)if(!(n in e)||!we(i[n],e[n]))return!1;for(let n in e)if(!(n in i))return!1}return!0}var E=class i{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,r));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&we(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return i.none;if(e instanceof i)return[e];let t=e.slice();return t.sort((n,r)=>n.type.rank-r.type.rank),t}};E.none=[];var W=class extends Error{},y=class i{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Rt(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new i(n,this.openStart,this.openEnd)}removeBetween(e,t){return new i(Ct(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return i.empty;let n=t.openStart||0,r=t.openEnd||0;if(typeof n!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new i(g.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)r++;return new i(e,n,r)}};y.empty=new y(g.empty,0,0);function Ct(i,e,t){let{index:n,offset:r}=i.findIndex(e),s=i.maybeChild(n),{index:o,offset:a}=i.findIndex(t);if(r==e||s.isText){if(a!=t&&!i.child(o).isText)throw new RangeError("Removing non-flat range");return i.cut(0,e).append(i.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return i.replaceChild(n,s.copy(Ct(s.content,e-r-1,t-r-1)))}function Rt(i,e,t,n,r,s){let{index:o,offset:a}=i.findIndex(e),l=i.maybeChild(o);if(a==e||l.isText)return s&&n<=0&&r<=0&&!s.canReplace(o,o,t)?null:i.cut(0,e).append(t).append(i.cut(e));let h=Rt(l.content,e-a-1,t,o==0?n-1:0,o==i.childCount-1?r-1:0,l);return h&&i.replaceChild(o,l.copy(h))}function En(i,e,t){if(t.openStart>i.depth)throw new W("Inserted content deeper than insertion position");if(i.depth-t.openStart!=e.depth-t.openEnd)throw new W("Inconsistent open depths");return Ot(i,e,t,0)}function Ot(i,e,t,n){let r=i.index(n),s=i.node(n);if(r==e.index(n)&&n<i.depth-t.openStart){let o=Ot(i,e,t,n+1);return s.copy(s.content.replaceChild(r,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&i.depth==n&&e.depth==n){let o=i.parent,a=o.content;return X(o,a.cut(0,i.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=vn(t,i);return X(s,It(i,o,a,e,n))}else return X(s,ke(i,e,n))}function Nt(i,e){if(!e.type.compatibleContent(i.type))throw new W("Cannot join "+e.type.name+" onto "+i.type.name)}function ze(i,e,t){let n=i.node(t);return Nt(n,e.node(t)),n}function V(i,e){let t=e.length-1;t>=0&&i.isText&&i.sameMarkup(e[t])?e[t]=i.withText(e[t].text+i.text):e.push(i)}function re(i,e,t,n){let r=(e||i).node(t),s=0,o=e?e.index(t):r.childCount;i&&(s=i.index(t),i.depth>t?s++:i.textOffset&&(V(i.nodeAfter,n),s++));for(let a=s;a<o;a++)V(r.child(a),n);e&&e.depth==t&&e.textOffset&&V(e.nodeBefore,n)}function X(i,e){if(!i.type.validContent(e))throw new W("Invalid content for node "+i.type.name);return i.copy(e)}function It(i,e,t,n,r){let s=i.depth>r&&ze(i,e,r+1),o=n.depth>r&&ze(t,n,r+1),a=[];return re(null,i,r,a),s&&o&&e.index(r)==t.index(r)?(Nt(s,o),V(X(s,It(i,e,t,n,r+1)),a)):(s&&V(X(s,ke(i,e,r+1)),a),re(e,t,r,a),o&&V(X(o,ke(t,n,r+1)),a)),re(n,null,r,a),new g(a)}function ke(i,e,t){let n=[];if(re(null,i,t,n),i.depth>t){let r=ze(i,e,t+1);V(X(r,ke(i,e,t+1)),n)}return re(e,null,t,n),new g(n)}function vn(i,e){let t=e.depth-i.openStart,r=e.node(t).copy(i.content);for(let s=t-1;s>=0;s--)r=e.node(s).copy(g.from(r));return{start:r.resolveNoCache(i.openStart+t),end:r.resolveNoCache(r.content.size-i.openEnd-t)}}var Se=class i{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)r+=n.child(s).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return E.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let a=n;n=r,r=a}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!r||!s[o].isInSet(r.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!r||!n[s].isInSet(r.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new De(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),h=s-l;if(n.push(o,a,r+l),!h||(o=o.child(a),o.isText))break;s=h-1,r+=l+1}return new i(t,n,s)}static resolveCached(e,t){let n=ct.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else ct.set(e,n=new Le);let r=n.elts[n.i]=i.resolve(e,t);return n.i=(n.i+1)%bn,r}},Le=class{constructor(){this.elts=[],this.i=0}},bn=12,ct=new WeakMap,De=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Mn=Object.create(null),D=class i{constructor(e,t,n,r=E.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||g.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&we(this.attrs,t||e.defaultAttrs||Mn)&&E.sameSet(this.marks,n||E.none)}copy(e=null){return e==this.content?this:new i(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new i(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return y.empty;let r=this.resolve(e),s=this.resolve(t),o=n?0:r.sharedDepth(t),a=r.start(o),h=r.node(o).content.cut(r.pos-a,s.pos-a);return new y(h,r.depth-o,s.depth-o)}replace(e,t,n){return En(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Se.resolveCached(this,e)}resolveNoCache(e){return Se.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),At(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=g.empty,r=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,r,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=r;l<s;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),ft(this.type.attrs,this.attrs,"node",this.type.name);let e=E.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];ft(n.type.attrs,n.attrs,"mark",n.type.name),e=n.addToSet(e)}if(!E.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=g.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}};D.prototype.text=void 0;var Be=class i extends D{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):At(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new i(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new i(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function At(i,e){for(let t=i.length-1;t>=0;t--)e=i[t].type.name+"("+e+")";return e}function ft(i,e,t,n){for(let r in e)if(!(r in i))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${n}`);for(let r in i)i[r].validate&&i[r].validate(e[r])}var K=class i{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Je(e,t);if(n.next==null)return i.empty;let r=Ft(n);n.next&&n.err("Unexpected trailing text");let s=An(In(r));return Fn(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let s=t;r&&s<n;s++)r=r.matchType(e.child(s).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function s(o,a){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return g.from(a.map(h=>h.createAndFill()));for(let h=0;h<o.next.length;h++){let{type:c,next:u}=o.next[h];if(!(c.isText||c.hasRequiredAttrs())&&r.indexOf(u)==-1){r.push(u);let f=s(u,a.concat(c));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),s=r.match;if(s.matchType(e)){let o=[];for(let a=r;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||l.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((n,r)=>{let s=r+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
2
+ `)}};K.empty=new K(!0);var Je=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function Ft(i){let e=[];do e.push(Tn(i));while(i.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Tn(i){let e=[];do e.push(Cn(i));while(i.next&&i.next!=")"&&i.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Cn(i){let e=Nn(i);for(;;)if(i.eat("+"))e={type:"plus",expr:e};else if(i.eat("*"))e={type:"star",expr:e};else if(i.eat("?"))e={type:"opt",expr:e};else if(i.eat("{"))e=Rn(i,e);else break;return e}function ut(i){/\D/.test(i.next)&&i.err("Expected number, got '"+i.next+"'");let e=Number(i.next);return i.pos++,e}function Rn(i,e){let t=ut(i),n=t;return i.eat(",")&&(i.next!="}"?n=ut(i):n=-1),i.eat("}")||i.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function On(i,e){let t=i.nodeTypes,n=t[e];if(n)return[n];let r=[];for(let s in t){let o=t[s];o.isInGroup(e)&&r.push(o)}return r.length==0&&i.err("No node type or group '"+e+"' found"),r}function Nn(i){if(i.eat("(")){let e=Ft(i);return i.eat(")")||i.err("Missing closing paren"),e}else if(/\W/.test(i.next))i.err("Unexpected token '"+i.next+"'");else{let e=On(i,i.next).map(t=>(i.inline==null?i.inline=t.isInline:i.inline!=t.isInline&&i.err("Mixing inline and block content"),{type:"name",value:t}));return i.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function In(i){let e=[[]];return r(s(i,0),t()),e;function t(){return e.push([])-1}function n(o,a,l){let h={term:l,to:a};return e[o].push(h),h}function r(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,h)=>l.concat(s(h,a)),[]);if(o.type=="seq")for(let l=0;;l++){let h=s(o.exprs[l],a);if(l==o.exprs.length-1)return h;r(h,a=t())}else if(o.type=="star"){let l=t();return n(a,l),r(s(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return r(s(o.expr,a),l),r(s(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let h=0;h<o.min;h++){let c=t();r(s(o.expr,l),c),l=c}if(o.max==-1)r(s(o.expr,l),l);else for(let h=o.min;h<o.max;h++){let c=t();n(l,c),r(s(o.expr,l),c),l=c}return[n(l)]}else{if(o.type=="name")return[n(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function zt(i,e){return e-i}function pt(i,e){let t=[];return n(e),t.sort(zt);function n(r){let s=i[r];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(r);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&n(l)}}}function An(i){let e=Object.create(null);return t(pt(i,0));function t(n){let r=[];n.forEach(o=>{i[o].forEach(({term:a,to:l})=>{if(!a)return;let h;for(let c=0;c<r.length;c++)r[c][0]==a&&(h=r[c][1]);pt(i,l).forEach(c=>{h||r.push([a,h=[]]),h.indexOf(c)==-1&&h.push(c)})})});let s=e[n.join(",")]=new K(n.indexOf(i.length-1)>-1);for(let o=0;o<r.length;o++){let a=r[o][1].sort(zt);s.next.push({type:r[o][0],next:e[a.join(",")]||t(a)})}return s}}function Fn(i,e){for(let t=0,n=[i];t<n.length;t++){let r=n[t],s=!r.validEnd,o=[];for(let a=0;a<r.next.length;a++){let{type:l,next:h}=r.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),n.indexOf(h)==-1&&n.push(h)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Lt(i){let e=Object.create(null);for(let t in i){let n=i[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function Dt(i,e){let t=Object.create(null);for(let n in i){let r=i[n],s=e&&e[n];if(s===void 0)if(r.hasDefault)s=r.default;else throw new RangeError("No value supplied for attribute "+n);else r.validate&&r.validate(s);t[n]=s}return t}function Bt(i,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Pe(i,n,e[n]);return t}var Ee=class i{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Bt(e,n.attrs),this.defaultAttrs=Lt(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==K.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Dt(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new D(this,this.computeAttrs(e),g.from(t),E.setFrom(n))}createChecked(e=null,t,n){return t=g.from(t),this.checkContent(t),new D(this,this.computeAttrs(e),t,E.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=g.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let r=this.contentMatch.matchFragment(t),s=r&&r.fillBefore(g.empty,!0);return s?new D(this,e,t.append(s),E.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:E.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new i(s,t,o));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function zn(i,e,t){let n=t.split("|");return r=>{let s=r===null?"null":typeof r;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${i}, got ${s}`)}}var Pe=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?zn(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},se=class i{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Bt(e,r.attrs),this.excluded=null;let s=Lt(this.attrs);this.instance=s?new E(this,s):null}create(e=null){return!e&&this.instance?this.instance:new E(this,Dt(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((s,o)=>n[s]=new i(s,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}},dt=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=Ae.from(e.nodes),t.marks=Ae.from(e.marks||{}),this.nodes=Ee.compile(this.spec.nodes,this),this.marks=se.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let s=this.nodes[r],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=K.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?mt(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let r in this.marks){let s=this.marks[r],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:mt(this,o.split(" "))}this.nodeFromJSON=r=>D.fromJSON(this,r),this.markFromJSON=r=>E.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ee){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Be(n,n.defaultAttrs,e,E.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function mt(i,e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],s=i.marks[r],o=s;if(s)t.push(s);else for(let a in i.marks){let l=i.marks[a];(r=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(r)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Ln(i){return i.tag!=null}function Dn(i){return i.style!=null}var gt=class i{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(r=>{if(Ln(r))this.tags.push(r);else if(Dn(r)){let s=/[^=]*/.exec(r.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let s=e.nodes[r.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new ve(this,t,!1);return n.addAll(e,E.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ve(this,t,!0);return n.addAll(e,E.none,t.from,t.to),y.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let s=this.tags[r];if(Pn(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,r){for(let s=r?this.styles.indexOf(r)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(r){let s=r.priority==null?50:r.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,r)}for(let r in e.marks){let s=e.marks[r].spec.parseDOM;s&&s.forEach(o=>{n(o=xt(o)),o.mark||o.ignore||o.clearMark||(o.mark=r)})}for(let r in e.nodes){let s=e.nodes[r].spec.parseDOM;s&&s.forEach(o=>{n(o=xt(o)),o.node||o.ignore||o.mark||(o.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new i(e,i.schemaRules(e)))}},Jt={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Bn={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Pt={ol:!0,ul:!0},oe=1,We=2,ie=4;function yt(i,e,t){return e!=null?(e?oe:0)|(e==="full"?We:0):i&&i.whitespace=="pre"?oe|We:t&~ie}var _=class{constructor(e,t,n,r,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=E.none,this.match=s||(o&ie?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(g.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,r;return(r=n.findWrapping(e.type))?(this.match=n,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&oe)){let n=this.content[this.content.length-1],r;if(n&&n.isText&&(r=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-r[0].length))}}let t=g.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(g.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Jt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ve=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,s,o=yt(null,t.preserveWhitespace,0)|(n?ie:0);r?s=new _(r.type,r.attrs,E.none,!0,t.topMatch||r.type.contentMatch,o):n?s=new _(null,null,E.none,!0,null,o):s=new _(e.schema.topNodeType,null,E.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,s=r.options&We?"full":this.localPreserveWS||(r.options&oe)>0,{schema:o}=this.parser;if(s==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if(s==="full")n=n.replace(/\r\n?/g,`
3
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=n.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let a=r.content[r.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Pt.hasOwnProperty(o)&&this.parser.normalizeLists&&Jn(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:Bn.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let h,c=this.needsBlock;if(Jt.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),h=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=l&&l.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),h&&this.sync(s),this.needsBlock=c}else{let h=this.readStyles(e,t);h&&this.addElementByRule(e,l,h,l.consuming===!1?a:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let s=this.parser.matchedStyles[r],o=n.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(h=>!l.clearMark(h)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,n,r){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(s=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,n,r){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,a=r==null?null:e.childNodes[r];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let r,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],h=l.findWrapping(e);if(h&&(!r||r.length>h.length+a)&&(r=h,s=l,!h.length))break;if(l.solid){if(n)break;a+=2}}if(!r)return null;this.sync(s);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=E.none;for(let a of r.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):wt(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,r){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,r)),s}enterInner(e,t,n,r=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=yt(e,s,o.options);o.options&ie&&o.content.length==0&&(a|=ie);let l=E.none;return n=n.filter(h=>(o.type?o.type.allowsMarkType(h.type):wt(h.type,e))?(l=h.addToSet(l),!1):!0),this.nodes.push(new _(e,t,l,r,null,a)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=oe)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(r?0:1),o=(a,l)=>{for(;a>=0;a--){let h=t[a];if(h==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let c=l>0||l==0&&r?this.nodes[l].type:n&&l>=s?n.node(l-s).type:null;if(!c||c.name!=h&&!c.isInGroup(h))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}};function Jn(i){for(let e=i.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&Pt.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function Pn(i,e){return(i.matches||i.msMatchesSelector||i.webkitMatchesSelector||i.mozMatchesSelector).call(i,e)}function xt(i){let e={};for(let t in i)e[t]=i[t];return e}function wt(i,e){let t=e.schema.nodes;for(let n in t){let r=t[n];if(!r.allowsMarkType(i))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:h,next:c}=a.edge(l);if(h==e||s.indexOf(c)<0&&o(c))return!0}};if(o(r.contentMatch))return!0}}var kt=class i{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ye(t).createDocumentFragment());let r=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let h=o.marks[l];if(!this.marks[h.type.name]){l++;continue}if(!h.eq(s[a][0])||h.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)r=s.pop()[1];for(;l<o.marks.length;){let h=o.marks[l++],c=this.serializeMark(h,o.isInline,t);c&&(s.push([h,r]),r.appendChild(c.dom),r=c.contentDOM||c.dom)}}r.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){if(e.isText)return ye(t).createTextNode(e.text);let{dom:n,contentDOM:r}=xe(ye(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let s=this.serializeMark(e.marks[r],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&xe(ye(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t=="string"?{dom:e.createTextNode(t)}:xe(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new i(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=St(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return St(e.marks)}};function St(i){let e={};for(let t in i){let n=i[t].spec.toDOM;n&&(e[t]=n)}return e}function ye(i){return i.document||window.document}var Et=new WeakMap;function Wn(i){let e=Et.get(i);return e===void 0&&Et.set(i,e=Hn(i)),e}function Hn(i){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let r=0;r<n.length;r++)t(n[r]);else for(let r in n)t(n[r])}return t(i),e}function xe(i,e,t,n){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let r=e[0],s;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=Wn(n))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=r.indexOf(" ");o>0&&(t=r.slice(0,o),r=r.slice(o+1));let a,l=t?i.createElementNS(t,r):i.createElement(r),h=e[1],c=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){c=2;for(let u in h)if(h[u]!=null){let f=u.indexOf(" ");f>0?l.setAttributeNS(u.slice(0,f),u.slice(f+1),h[u]):u=="style"&&l.style?l.style.cssText=h[u]:l.setAttribute(u,h[u])}}for(let u=c;u<e.length;u++){let f=e[u];if(f===0){if(u<e.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof f=="string")l.appendChild(i.createTextNode(f));else{let{dom:d,contentDOM:m}=xe(i,f,t,n);if(l.appendChild(d),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}var Vt=65535,Xt=Math.pow(2,16);function qn(i,e){return i+e*Xt}function Wt(i){return i&Vt}function Un(i){return(i-(i&Vt))/Xt}var Kt=1,Yt=2,be=4,Gt=8,he=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Gt)>0}get deletedBefore(){return(this.delInfo&(Kt|be))>0}get deletedAfter(){return(this.delInfo&(Yt|be))>0}get deletedAcross(){return(this.delInfo&be)>0}},J=class i{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&i.empty)return i.empty}recover(e){let t=0,n=Wt(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[n*3]+t+Un(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let h=this.ranges[a+s],c=this.ranges[a+o],u=l+h;if(e<=u){let f=h?e==l?-1:e==u?1:t:t,d=l+r+(f<0?0:c);if(n)return d;let m=e==(t<0?l:u)?null:qn(a/3,e-l),x=0;return h&&(x|=e==l?Yt:e==u?Kt:be,(t<0?e!=l:e!=u)&&(x|=Gt)),new he(d,x,m)}r+=c-h}return n?e+r:new he(e+r,0,null)}touches(e,t){let n=0,r=Wt(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;let h=this.ranges[a+s],c=l+h;if(e<=c&&a==r*3)return!0;n+=this.ranges[a+o]-h}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),h=this.ranges[r+t],c=this.ranges[r+n];e(a,a+h,l,l+c),s+=c-h}}invert(){return new i(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?i.empty:new i(e<0?[0,-e,0]:[0,0,e])}};J.empty=new J([]);var Ue=class i{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new i(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let e=new i;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}r|=a.delInfo,e=a.pos}return n?e:new he(e,r,null)}},He=Object.create(null),O=class{getMap(){return J.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=He[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in He)throw new RangeError("Duplicate use of step JSON ID "+e);return He[e]=t,t.prototype.jsonID=e,t}},N=class i{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new i(e,null)}static fail(e){return new i(null,e)}static fromReplace(e,t,n,r){try{return i.ok(e.replace(t,n,r))}catch(s){if(s instanceof W)return i.fail(s.message);throw s}}};function Ke(i,e,t){let n=[];for(let r=0;r<i.childCount;r++){let s=i.child(r);s.content.size&&(s=s.copy(Ke(s.content,e,s))),s.isInline&&(s=e(s,t,r)),n.push(s)}return g.fromArray(n)}var ce=class i extends O{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),s=new y(Ke(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),t.openStart,t.openEnd);return N.fromReplace(e,this.from,this.to,s)}invert(){return new Y(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new i(t.pos,n.pos,this.mark)}merge(e){return e instanceof i&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new i(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new i(t.from,t.to,e.markFromJSON(t.mark))}};O.jsonID("addMark",ce);var Y=class i extends O{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new y(Ke(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return N.fromReplace(e,this.from,this.to,n)}invert(){return new ce(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new i(t.pos,n.pos,this.mark)}merge(e){return e instanceof i&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new i(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new i(t.from,t.to,e.markFromJSON(t.mark))}};O.jsonID("removeMark",Y);var fe=class i extends O{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return N.fromReplace(e,this.pos,this.pos+1,new y(g.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(n))return new i(this.pos,t.marks[r]);return new i(this.pos,this.mark)}}return new ee(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new i(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new i(t.pos,e.markFromJSON(t.mark))}};O.jsonID("addNodeMark",fe);var ee=class i extends O{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return N.fromReplace(e,this.pos,this.pos+1,new y(g.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new fe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new i(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new i(t.pos,e.markFromJSON(t.mark))}};O.jsonID("removeNodeMark",ee);var z=class i extends O{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Ve(e,this.from,this.to)?N.fail("Structure replace would overwrite content"):N.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new J([this.from,this.to-this.from,this.slice.size])}invert(e){return new i(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&i.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new i(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof i)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?y.empty:new y(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new i(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?y.empty:new y(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new i(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new i(t.from,t.to,y.fromJSON(e,t.slice),!!t.structure)}};z.MAP_BIAS=1;O.jsonID("replace",z);var B=class i extends O{constructor(e,t,n,r,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Ve(e,this.from,this.gapFrom)||Ve(e,this.gapTo,this.to)))return N.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return N.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?N.fromReplace(e,this.from,this.to,n):N.fail("Content does not fit in gap")}getMap(){return new J([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new i(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||s>n.pos?null:new i(t.pos,n.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new i(t.from,t.to,t.gapFrom,t.gapTo,y.fromJSON(e,t.slice),t.insert,!!t.structure)}};O.jsonID("replaceAround",B);function Ve(i,e,t){let n=i.resolve(e),r=t-e,s=n.depth;for(;r>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,r--;if(r>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function Vn(i,e,t,n){let r=[],s=[],o,a;i.doc.nodesBetween(e,t,(l,h,c)=>{if(!l.isInline)return;let u=l.marks;if(!n.isInSet(u)&&c.type.allowsMarkType(n.type)){let f=Math.max(h,e),d=Math.min(h+l.nodeSize,t),m=n.addToSet(u);for(let x=0;x<u.length;x++)u[x].isInSet(m)||(o&&o.to==f&&o.mark.eq(u[x])?o.to=d:r.push(o=new Y(f,d,u[x])));a&&a.to==f?a.to=d:s.push(a=new ce(f,d,n))}}),r.forEach(l=>i.step(l)),s.forEach(l=>i.step(l))}function Xn(i,e,t,n){let r=[],s=0;i.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(n instanceof se){let h=o.marks,c;for(;c=n.isInSet(h);)(l||(l=[])).push(c),h=c.removeFromSet(h)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let h=Math.min(a+o.nodeSize,t);for(let c=0;c<l.length;c++){let u=l[c],f;for(let d=0;d<r.length;d++){let m=r[d];m.step==s-1&&u.eq(r[d].style)&&(f=m)}f?(f.to=h,f.step=s):r.push({style:u,from:Math.max(a,e),to:h,step:s})}}}),r.forEach(o=>i.step(new Y(o.from,o.to,o.style)))}function Ye(i,e,t,n=t.contentMatch,r=!0){let s=i.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let h=s.child(l),c=a+h.nodeSize,u=n.matchType(h.type);if(!u)o.push(new z(a,c,y.empty));else{n=u;for(let f=0;f<h.marks.length;f++)t.allowsMarkType(h.marks[f].type)||i.step(new Y(a,c,h.marks[f]));if(r&&h.isText&&t.whitespace!="pre"){let f,d=/\r?\n|\r/g,m;for(;f=d.exec(h.text);)m||(m=new y(g.from(t.schema.text(" ",t.allowedMarks(h.marks))),0,0)),o.push(new z(a+f.index,a+f.index+f[0].length,m))}}a=c}if(!n.validEnd){let l=n.fillBefore(g.empty,!0);i.replace(a,a,new y(l,0,0))}for(let l=o.length-1;l>=0;l--)i.step(o[l])}function Kn(i,e,t){return(e==0||i.canReplace(e,i.childCount))&&(t==i.childCount||i.canReplace(0,t))}function wr(i){let t=i.parent.content.cutByIndex(i.startIndex,i.endIndex);for(let n=i.depth,r=0,s=0;;--n){let o=i.$from.node(n),a=i.$from.index(n)+r,l=i.$to.indexAfter(n)-s;if(n<i.depth&&o.canReplace(a,l,t))return n;if(n==0||o.type.spec.isolating||!Kn(o,a,l))break;a&&(r=1),l<o.childCount&&(s=1)}return null}function Yn(i,e,t){let{$from:n,$to:r,depth:s}=e,o=n.before(s+1),a=r.after(s+1),l=o,h=a,c=g.empty,u=0;for(let m=s,x=!1;m>t;m--)x||n.index(m)>0?(x=!0,c=g.from(n.node(m).copy(c)),u++):l--;let f=g.empty,d=0;for(let m=s,x=!1;m>t;m--)x||r.after(m+1)<r.end(m)?(x=!0,f=g.from(r.node(m).copy(f)),d++):h++;i.step(new B(l,h,o,a,new y(c.append(f),u,d),c.size-u,!0))}function kr(i,e,t=null,n=i){let r=Gn(i,e),s=r&&Qn(n,e);return s?r.map(Ht).concat({type:e,attrs:t}).concat(s.map(Ht)):null}function Ht(i){return{type:i,attrs:null}}function Gn(i,e){let{parent:t,startIndex:n,endIndex:r}=i,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,r,o)?s:null}function Qn(i,e){let{parent:t,startIndex:n,endIndex:r}=i,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let h=n;l&&h<r;h++)l=l.matchType(t.child(h).type);return!l||!l.validEnd?null:o}function Zn(i,e,t){let n=g.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let a=t[o].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=g.from(t[o].type.create(t[o].attrs,n))}let r=e.start,s=e.end;i.step(new B(r,s,r,s,new y(n,0,0),t.length,!0))}function jn(i,e,t,n,r){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=i.steps.length;i.doc.nodesBetween(e,t,(o,a)=>{let l=typeof r=="function"?r(o):r;if(o.isTextblock&&!o.hasMarkup(n,l)&&$n(i.doc,i.mapping.slice(s).map(a),n)){let h=null;if(n.schema.linebreakReplacement){let d=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);d&&!m?h=!1:!d&&m&&(h=!0)}h===!1&&Zt(i,o,a,s),Ye(i,i.mapping.slice(s).map(a,1),n,void 0,h===null);let c=i.mapping.slice(s),u=c.map(a,1),f=c.map(a+o.nodeSize,1);return i.step(new B(u,f,u+1,f-1,new y(g.from(n.create(l,null,o.marks)),0,0),1,!0)),h===!0&&Qt(i,o,a,s),!1}})}function Qt(i,e,t,n){e.forEach((r,s)=>{if(r.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(r.text);){let l=i.mapping.slice(n).map(t+1+s+o.index);i.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Zt(i,e,t,n){e.forEach((r,s)=>{if(r.type==r.type.schema.linebreakReplacement){let o=i.mapping.slice(n).map(t+1+s);i.replaceWith(o,o+1,e.type.schema.text(`
5
+ `))}})}function $n(i,e,t){let n=i.resolve(e),r=n.index();return n.parent.canReplaceWith(r,r+1,t)}function _n(i,e,t,n,r){let s=i.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,r||s.marks);if(s.isLeaf)return i.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);i.step(new B(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new y(g.from(o),0,0),1,!0))}function Sr(i,e,t=1,n){let r=i.resolve(e),s=r.depth-t,o=n&&n[n.length-1]||r.parent;if(s<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!o.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let h=r.depth-1,c=t-2;h>s;h--,c--){let u=r.node(h),f=r.index(h);if(u.type.spec.isolating)return!1;let d=u.content.cutByIndex(f,u.childCount),m=n&&n[c+1];m&&(d=d.replaceChild(0,m.type.create(m.attrs)));let x=n&&n[c]||u;if(!u.canReplace(f+1,u.childCount)||!x.type.validContent(d))return!1}let a=r.indexAfter(s),l=n&&n[0];return r.node(s).canReplaceWith(a,a,l?l.type:r.node(s+1).type)}function er(i,e,t=1,n){let r=i.doc.resolve(e),s=g.empty,o=g.empty;for(let a=r.depth,l=r.depth-t,h=t-1;a>l;a--,h--){s=g.from(r.node(a).copy(s));let c=n&&n[h];o=g.from(c?c.type.create(c.attrs,o):r.node(a).copy(o))}i.step(new z(e,e,new y(s.append(o),t,t),!0))}function Er(i,e){let t=i.resolve(e),n=t.index();return jt(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function tr(i,e){e.content.size||i.type.compatibleContent(e.type);let t=i.contentMatchAt(i.childCount),{linebreakReplacement:n}=i.type.schema;for(let r=0;r<e.childCount;r++){let s=e.child(r),o=s.type==n?i.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!i.type.allowsMarks(s.marks))return!1}return t.validEnd}function jt(i,e){return!!(i&&e&&!i.isLeaf&&tr(i,e))}function vr(i,e,t=-1){let n=i.resolve(e);for(let r=n.depth;;r--){let s,o,a=n.index(r);if(r==n.depth?(s=n.nodeBefore,o=n.nodeAfter):t>0?(s=n.node(r+1),a++,o=n.node(r).maybeChild(a)):(s=n.node(r).maybeChild(a-1),o=n.node(r+1)),s&&!s.isTextblock&&jt(s,o)&&n.node(r).canReplace(a,a+1))return e;if(r==0)break;e=t<0?n.before(r):n.after(r)}}function nr(i,e,t){let n=null,{linebreakReplacement:r}=i.doc.type.schema,s=i.doc.resolve(e-t),o=s.node().type;if(r&&o.inlineContent){let c=o.whitespace=="pre",u=!!o.contentMatch.matchType(r);c&&!u?n=!1:!c&&u&&(n=!0)}let a=i.steps.length;if(n===!1){let c=i.doc.resolve(e+t);Zt(i,c.node(),c.before(),a)}o.inlineContent&&Ye(i,e+t-1,o,s.node().contentMatchAt(s.index()),n==null);let l=i.mapping.slice(a),h=l.map(e-t);if(i.step(new z(h,l.map(e+t,-1),y.empty,!0)),n===!0){let c=i.doc.resolve(h);Qt(i,c.node(),c.before(),i.steps.length)}return i}function rr(i,e,t){let n=i.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let r=n.depth-1;r>=0;r--){let s=n.index(r);if(n.node(r).canReplaceWith(s,s,t))return n.before(r+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let r=n.depth-1;r>=0;r--){let s=n.indexAfter(r);if(n.node(r).canReplaceWith(s,s,t))return n.after(r+1);if(s<n.node(r).childCount)return null}return null}function br(i,e,t){let n=i.resolve(e);if(!t.content.size)return e;let r=t.content;for(let s=0;s<t.openStart;s++)r=r.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=n.depth;o>=0;o--){let a=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,l=n.index(o)+(a>0?1:0),h=n.node(o),c=!1;if(s==1)c=h.canReplace(l,l,r);else{let u=h.contentMatchAt(l).findWrapping(r.firstChild.type);c=u&&h.canReplaceWith(l,l,u[0])}if(c)return a==0?n.pos:a<0?n.before(o+1):n.after(o+1)}return null}function ir(i,e,t=e,n=y.empty){if(e==t&&!n.size)return null;let r=i.resolve(e),s=i.resolve(t);return $t(r,s,n)?new z(e,t,n):new Xe(r,s,n).fit()}function $t(i,e,t){return!t.openStart&&!t.openEnd&&i.start()==e.start()&&i.parent.canReplace(i.index(),e.index(),t.content)}var Xe=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=g.empty;for(let r=0;r<=e.depth;r++){let s=e.node(r);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=g.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let s=this.placed,o=n.depth,a=r.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new y(s,o,a);return e>-1?new B(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new z(n.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(r=0),s.type.spec.isolating&&r<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let r,s=null;n?(s=qt(this.unplaced.content,n-1).firstChild,r=s.content):r=this.unplaced.content;let o=r.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:h}=this.frontier[a],c,u=null;if(t==1&&(o?h.matchType(o.type)||(u=h.fillBefore(g.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:a,parent:s,inject:u};if(t==2&&o&&(c=h.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:a,parent:s,wrap:c};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced;return Ut(e,-1)<=t?!1:(this.unplaced.size>1&&Ut(e,1)>n&&n++,this.unplaced=new y(e,t+1,n),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=qt(e,t);if(r.childCount<=1&&t>0){let s=e.size-t<=t+r.size;this.unplaced=new y(le(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new y(le(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let x=0;x<s.length;x++)this.openFrontierNode(s[x]);let o=this.unplaced,a=n?n.content:o.content,l=o.openStart-e,h=0,c=[],{match:u,type:f}=this.frontier[t];if(r){for(let x=0;x<r.childCount;x++)c.push(r.child(x));u=u.matchFragment(r)}let d=a.size+e-(o.content.size-o.openEnd);for(;h<a.childCount;){let x=a.child(h),A=u.matchType(x.type);if(!A)break;h++,(h>1||l==0||x.content.size)&&(u=A,c.push(_t(x.mark(f.allowedMarks(x.marks)),h==1?l:0,h==a.childCount?d:-1)))}let m=h==a.childCount;m||(d=-1),this.placed=ae(this.placed,t,g.from(c)),this.frontier[t].match=u,m&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let x=0,A=a;x<d;x++){let L=A.lastChild;this.frontier.push({type:L.type,match:L.contentMatchAt(L.childCount)}),A=L.content}this.unplaced=m?e==0?y.empty:new y(le(o.content,e-1,1),e-1,d<0?o.openEnd:e-1):new y(le(o.content,e,h),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!qe(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=qe(e,t,r,n,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:h}=this.frontier[a],c=qe(e,a,h,l,!0);if(!c||c.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ae(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let r=e.node(n),s=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,s)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=ae(this.placed,this.depth,g.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(g.empty,!0);t.childCount&&(this.placed=ae(this.placed,this.frontier.length,t))}};function le(i,e,t){return e==0?i.cutByIndex(t,i.childCount):i.replaceChild(0,i.firstChild.copy(le(i.firstChild.content,e-1,t)))}function ae(i,e,t){return e==0?i.append(t):i.replaceChild(i.childCount-1,i.lastChild.copy(ae(i.lastChild.content,e-1,t)))}function qt(i,e){for(let t=0;t<e;t++)i=i.firstChild.content;return i}function _t(i,e,t){if(e<=0)return i;let n=i.content;return e>1&&(n=n.replaceChild(0,_t(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=i.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(i.type.contentMatch.matchFragment(n).fillBefore(g.empty,!0)))),i.copy(n)}function qe(i,e,t,n,r){let s=i.node(e),o=r?i.indexAfter(e):i.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=n.fillBefore(s.content,!0,o);return a&&!sr(t,s.content,o)?a:null}function sr(i,e,t){for(let n=t;n<e.childCount;n++)if(!i.allowsMarks(e.child(n).marks))return!0;return!1}function or(i){return i.spec.defining||i.spec.definingForContent}function Ut(i,e){for(let t=0;;t++){let n=e<0?i.firstChild:i.lastChild;if(!n||n.isAtom)return t;i=n.content}}function lr(i,e,t,n){if(!n.size)return i.deleteRange(e,t);let r=i.doc.resolve(e),s=i.doc.resolve(t);if($t(r,s,n))return i.step(new z(e,t,n));let o=tn(r,s);o[o.length-1]==0&&o.pop();let a=-(r.depth+1);o.unshift(a);for(let f=r.depth,d=r.pos-1;f>0;f--,d--){let m=r.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?a=f:r.before(f)==d&&o.splice(1,0,-f)}let l=o.indexOf(a),h=[],c=n.openStart;for(let f=n.content,d=0;;d++){let m=f.firstChild;if(h.push(m),d==n.openStart)break;f=m.content}for(let f=c-1;f>=0;f--){let d=h[f],m=or(d.type);if(m&&!d.sameMarkup(r.node(Math.abs(a)-1)))c=f;else if(m||!d.type.isTextblock)break}for(let f=n.openStart;f>=0;f--){let d=(f+c+1)%(n.openStart+1),m=h[d];if(m)for(let x=0;x<o.length;x++){let A=o[(x+l)%o.length],L=!0;A<0&&(L=!1,A=-A);let q=r.node(A-1),Z=r.index(A-1);if(q.canReplaceWith(Z,Z,m.type,m.marks))return i.replace(r.before(A),L?s.after(A):t,new y(en(n.content,0,n.openStart,d),d,n.openEnd))}}let u=i.steps.length;for(let f=o.length-1;f>=0&&(i.replace(e,t,n),!(i.steps.length>u));f--){let d=o[f];d<0||(e=r.before(d),t=s.after(d))}}function en(i,e,t,n,r){if(e<t){let s=i.firstChild;i=i.replaceChild(0,s.copy(en(s.content,e+1,t,n,s)))}if(e>n){let s=r.contentMatchAt(0),o=s.fillBefore(i).append(i);i=o.append(s.matchFragment(o).fillBefore(g.empty,!0))}return i}function ar(i,e,t,n){if(!n.isInline&&e==t&&i.doc.resolve(e).parent.content.size){let r=rr(i.doc,e,n.type);r!=null&&(e=t=r)}i.replaceRange(e,t,new y(g.from(n),0,0))}function hr(i,e,t){let n=i.doc.resolve(e),r=i.doc.resolve(t);if(n.parent.isTextblock&&r.parent.isTextblock&&n.start()!=r.start()&&n.parentOffset==0&&r.parentOffset==0){let o=n.sharedDepth(t),a=!1;for(let l=n.depth;l>o;l--)n.node(l).type.spec.isolating&&(a=!0);for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=n.depth;l>0&&e==n.start(l);l--)e=n.before(l);for(let l=r.depth;l>0&&t==r.start(l);l--)t=r.before(l);n=i.doc.resolve(e),r=i.doc.resolve(t)}}let s=tn(n,r);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||n.node(a).type.contentMatch.validEnd)return i.delete(n.start(a),r.end(a));if(a>0&&(l||n.node(a-1).canReplace(n.index(a-1),r.indexAfter(a-1))))return i.delete(n.before(a),r.after(a))}for(let o=1;o<=n.depth&&o<=r.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&r.end(o)-t!=r.depth-o&&n.start(o-1)==r.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),r.index(o-1)))return i.delete(n.before(o),t);i.delete(e,t)}function tn(i,e){let t=[],n=Math.min(i.depth,e.depth);for(let r=n;r>=0;r--){let s=i.start(r);if(s<i.pos-(i.depth-r)||e.end(r)>e.pos+(e.depth-r)||i.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(s==e.start(r)||r==i.depth&&r==e.depth&&i.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==s-1)&&t.push(r)}return t}var Me=class i extends O{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return N.fromReplace(e,this.pos,this.pos+1,new y(g.from(r),0,t.isLeaf?0:1))}getMap(){return J.empty}invert(e){return new i(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new i(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new i(t.pos,t.attr,t.value)}};O.jsonID("attr",Me);var Te=class i extends O{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return N.ok(n)}getMap(){return J.empty}invert(e){return new i(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new i(t.attr,t.value)}};O.jsonID("docAttr",Te);var te=class extends Error{};te=function i(e){let t=Error.call(this,e);return t.__proto__=i.prototype,t};te.prototype=Object.create(Error.prototype);te.prototype.constructor=te;te.prototype.name="TransformError";var Ce=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ue}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new te(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((s,o,a,l)=>{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=y.empty){let r=ir(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new y(g.from(n),0,0))}delete(e,t){return this.replace(e,t,y.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return lr(this,e,t,n),this}replaceRangeWith(e,t,n){return ar(this,e,t,n),this}deleteRange(e,t){return hr(this,e,t),this}lift(e,t){return Yn(this,e,t),this}join(e,t=1){return nr(this,e,t),this}wrap(e,t){return Zn(this,e,t),this}setBlockType(e,t=e,n,r=null){return jn(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return _n(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Me(e,t,n)),this}setDocAttribute(e,t){return this.step(new Te(e,t)),this}addNodeMark(e,t){return this.step(new fe(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof E)t.isInSet(n.marks)&&this.step(new ee(e,t));else{let r=n.marks,s,o=[];for(;s=t.isInSet(r);)o.push(new ee(e,s)),r=s.removeFromSet(r);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,n){return er(this,e,t,n),this}addMark(e,t,n){return Vn(this,e,t,n),this}removeMark(e,t,n){return Xn(this,e,t,n),this}clearIncompatible(e,t,n){return Ye(this,e,t,n),this}};var Ge=Object.create(null),R=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Ze(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=y.empty){let n=t.content.lastChild,r=null;for(let a=0;a<t.openEnd;a++)r=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:h}=o[a],c=e.mapping.slice(s);e.replaceRange(c.map(l.pos),c.map(h.pos),a?y.empty:t),a==0&&sn(e,s,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){let{$from:o,$to:a}=r[s],l=e.mapping.slice(n),h=l.map(o.pos),c=l.map(a.pos);s?e.deleteRange(h,c):(e.replaceRangeWith(h,c,t),sn(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new P(e):ne(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let s=e.depth-1;s>=0;s--){let o=t<0?ne(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):ne(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Q(e.node(0))}static atStart(e){return ne(e,e,0,0,1)||new Q(e)}static atEnd(e){return ne(e,e,e.content.size,e.childCount,-1)||new Q(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Ge[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ge)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ge[e]=t,t.prototype.jsonID=e,t}getBookmark(){return P.between(this.$anchor,this.$head).getBookmark()}};R.prototype.visible=!0;var Ze=class{constructor(e,t){this.$from=e,this.$to=t}},nn=!1;function rn(i){!nn&&!i.parent.inlineContent&&(nn=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+i.parent.type.name+")"))}var P=class i extends R{constructor(e,t=e){rn(e),rn(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return R.near(n);let r=e.resolve(t.map(this.anchor));return new i(r.parent.inlineContent?r:n,n)}replace(e,t=y.empty){if(super.replace(e,t),t==y.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof i&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Oe(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new i(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let s=R.findFrom(t,n,!0)||R.findFrom(t,-n,!0);if(s)t=s.$head;else return R.near(t,n)}return e.parent.inlineContent||(r==0?e=t:(e=(R.findFrom(e,-n,!0)||R.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new i(e,t)}};R.jsonID("text",P);var Oe=class i{constructor(e,t){this.anchor=e,this.head=t}map(e){return new i(e.map(this.anchor),e.map(this.head))}resolve(e){return P.between(e.resolve(this.anchor),e.resolve(this.head))}},H=class i extends R{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),s=e.resolve(r);return n?R.near(s):new i(s)}content(){return new y(g.from(this.node),0,0)}eq(e){return e instanceof i&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new je(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new i(e.resolve(t.anchor))}static create(e,t){return new i(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};H.prototype.visible=!1;R.jsonID("node",H);var je=class i{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Oe(n,n):new i(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&H.isSelectable(n)?new H(t):R.near(t)}},Q=class i extends R{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=y.empty){if(t==y.empty){e.delete(0,e.doc.content.size);let n=R.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new i(e)}map(e){return new i(e)}eq(e){return e instanceof i}getBookmark(){return cr}};R.jsonID("all",Q);var cr={map(){return this},resolve(i){return new Q(i)}};function ne(i,e,t,n,r,s=!1){if(e.inlineContent)return P.create(i,t);for(let o=n-(r>0?0:1);r>0?o<e.childCount:o>=0;o+=r){let a=e.child(o);if(a.isAtom){if(!s&&H.isSelectable(a))return H.create(i,t-(r<0?a.nodeSize:0))}else{let l=ne(i,a,t+r,r<0?a.childCount:0,r,s);if(l)return l}t+=a.nodeSize*r}return null}function sn(i,e,t){let n=i.steps.length-1;if(n<e)return;let r=i.steps[n];if(!(r instanceof z||r instanceof B))return;let s=i.mapping.maps[n],o;s.forEach((a,l,h,c)=>{o==null&&(o=c)}),i.setSelection(R.near(i.doc.resolve(o),t))}var on=1,Re=2,ln=4,$e=class extends Ce{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|on)&~Re,this.storedMarks=null,this}get selectionSet(){return(this.updated&on)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Re,this}ensureMarks(e){return E.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Re)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Re,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||E.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),!e)return this.deleteRange(t,n);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(R.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=ln,this}get scrolledIntoView(){return(this.updated&ln)>0}};function an(i,e){return!e||!i?i:i.bind(e)}var G=class{constructor(e,t,n){this.name=e,this.init=an(t.init,n),this.apply=an(t.apply,n)}},fr=[new G("doc",{init(i){return i.doc||i.schema.topNodeType.createAndFill()},apply(i){return i.doc}}),new G("selection",{init(i,e){return i.selection||R.atStart(e.doc)},apply(i){return i.selection}}),new G("storedMarks",{init(i){return i.storedMarks||null},apply(i,e,t,n){return n.selection.$cursor?i.storedMarks:null}}),new G("scrollToSelection",{init(){return 0},apply(i,e){return i.scrolledIntoView?e+1:e}})],ue=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=fr.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new G(n.key,n.spec.state,n))})}},hn=class i{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=r?r[o].n:0,h=r?r[o].state:this,c=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,h,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let u=0;u<this.config.plugins.length;u++)r.push(u<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),s=!0}r&&(r[o]={state:n,n:t.length})}}if(!s)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new i(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let s=n[r];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new $e(this)}static create(e){let t=new ue(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new i(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new ue(this.schema,e.plugins),n=t.fields,r=new i(t);for(let s=0;s<n.length;s++){let o=n[s].name;r[o]=this.hasOwnProperty(o)?this[o]:n[s].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],s=r.spec.state;s&&s.toJSON&&(t[n]=s.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new ue(e.schema,e.plugins),s=new i(r);return r.fields.forEach(o=>{if(o.name=="doc")s.doc=D.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=R.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let a in n){let l=n[a],h=l.spec.state;if(l.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=h.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}};function un(i,e,t){for(let n in i){let r=i[n];r instanceof Function?r=r.bind(e):n=="handleDOMEvents"&&(r=un(r,e,{})),t[n]=r}return t}var cn=class{constructor(e){this.spec=e,this.props={},e.props&&un(e.props,this,this.props),this.key=e.key?e.key.key:pn("plugin")}getState(e){return e[this.key]}},Qe=Object.create(null);function pn(i){return i in Qe?i+"$"+ ++Qe[i]:(Qe[i]=0,i+"$")}var fn=class{constructor(e="key"){this.key=pn(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var dn="showaiTextRangeEdit";function mn(i,e,t,n=!0){let r=e.filter(h=>h.to>h.from).sort((h,c)=>h.from-c.from);if(!r.length)return null;let s=[];for(let h of r){let c=!0;if(i.doc.nodesBetween(h.from,h.to,f=>{!f.isText&&f.isLeaf&&f.type.name!=="hardBreak"&&(c=!1)}),!c||!i.doc.resolve(h.from).sameParent(i.doc.resolve(h.to)))throw new Error("A text edit must stay inside a single text block.");let u=s.at(-1);u&&h.from<=u.to?u.to=Math.max(u.to,h.to):s.push({...h})}let o=i.tr;for(let h of[...s].reverse())o.delete(h.from,h.to);let a=o.mapping.map(s[0].from,-1),l=0;if(n&&t){let h=o.doc.resolve(a),c=i.doc.resolve(s[0].from).marks();if(h.parent.type.spec.code||!t.includes(`
6
+ `))o.insertText(t,a),l=t.length;else{let u=t.split(/\r?\n/).flatMap((d,m)=>[...m?[i.schema.nodes.hardBreak.create()]:[],...d?[i.schema.text(d,c)]:[]]),f=g.fromArray(u);l=f.size,o.insert(a,f)}}return o.setSelection(P.near(o.doc.resolve(a+l))),o}function gn(i,e=()=>""){let t=i.ownerDocument,n='button,input,textarea,select,summary,[role="button"],[role="slider"],[data-surface-ui],.editor-toolbar,.editor-bubble,.block-handle,.block-menu,[data-surface-handle],script,style,[hidden],svg[aria-hidden="true"],.katex-mathml',r=[],s="",o=null,a=t.createTreeWalker(i,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode(c){if(c instanceof Element){let d=getComputedStyle(c);return c.matches(n)||d.display==="none"||d.visibility==="hidden"?NodeFilter.FILTER_REJECT:c instanceof HTMLIFrameElement||c instanceof HTMLBRElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}let u=c.parentElement;if(!c.textContent||getComputedStyle(u).userSelect==="none"||!c.textContent.trim()&&/[\n\r]/.test(c.textContent)&&!getComputedStyle(u).whiteSpace.startsWith("pre"))return NodeFilter.FILTER_REJECT;let f=t.createRange();return f.selectNodeContents(c),f.getClientRects().length?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});for(;a.nextNode();){let c=a.currentNode,u=c instanceof HTMLIFrameElement?e(c):c instanceof HTMLBRElement?`
7
+ `:c.data,f=(c instanceof Element?c:c.parentElement)?.closest("p,div,section,article,li,pre,td,th,h1,h2,h3,h4,h5,h6,blockquote");r.length&&f!==o&&(s+=f?.closest("tr")&&f.closest("tr")===o?.closest("tr")?" ":`
8
+ `),o=f??null;let d=s.length;s+=u,r.push({node:c,start:d,end:s.length})}return{entries:r,text:s,offsetAt:(c,u)=>{let f=r.find(d=>d.node===c);return f?f.start+Math.max(0,Math.min(f.end-f.start,u)):null},ranges:(c,u)=>r.flatMap(f=>{if(f.node instanceof HTMLIFrameElement||f.end<=c||f.start>=u)return[];let d=t.createRange();return f.node instanceof HTMLBRElement?d.selectNode(f.node):(d.setStart(f.node,Math.min(f.node.length,Math.max(c-f.start,0))),d.setEnd(f.node,Math.min(f.node.length,u-f.start,f.end-f.start))),[d]})}}var pe=new WeakMap,de=new WeakMap,_e=new WeakMap;function Wr(i){for(let e=i.closest("*");e;e=e.parentElement){let t=_e.get(e);if(t)return t()}return null}var ur=".document-widget,.portable-widget,.page-document-module,.rich-text-component,[data-surface-id],pre,table,.document-callout,.document-toggle";function Hr(i){return pe.set(i.view.dom,i),()=>{pe.delete(i.view.dom)}}function qr(i,e){return de.set(i,{channel:e,text:""}),()=>{de.delete(i)}}function Ur(i,e){let t=de.get(i);t&&typeof e=="string"&&e.length<=256e3&&(t.text=e)}function Vr(i,e){if(!["down","move","up","cancel"].includes(String(e.phase))||![e.x,e.y,e.width,e.height,e.buttons,e.offset].every(n=>typeof n=="number"&&Number.isFinite(n))||Number(e.width)<=0||Number(e.height)<=0)return;let t=i.getBoundingClientRect();i.dispatchEvent(new CustomEvent("showai:text-selection-pointer",{bubbles:!0,detail:{phase:e.phase,buttons:e.buttons,point:{x:t.left+Number(e.x)/Number(e.width)*t.width,y:t.top+Number(e.y)/Number(e.height)*t.height},caret:{node:i,offset:Number(e.offset)}}}))}function Ne(i,e){if(i.caretRangeFromPoint){let n=i.caretRangeFromPoint(e.x,e.y);return n?{node:n.startContainer,offset:n.startOffset}:null}let t=i.caretPositionFromPoint?.(e.x,e.y);return t?{node:t.offsetNode,offset:t.offset}:null}function yn(i){return(i instanceof Element?i:i.parentElement)?.closest(".document-widget,.portable-widget,.page-document-module,.rich-text-component,[data-surface-id]")}function pr(i,e,t){let n=Ne(i.ownerDocument,{x:e,y:t});return!!n&&n.node.nodeType===Node.TEXT_NODE&&i.contains(n.node)&&getComputedStyle(i).userSelect!=="none"}function xn(i,e,t){let n=Math.min(40,(t-e)/3);return n<=0?0:i<e+n?-18*Math.min(1,(e+n-i)/n):i>t-n?18*Math.min(1,(i-t+n)/n):0}function dr(i,e,t){let n=!1,r=!1,s=!1,o=e.getBoundingClientRect();for(let a=i;a&&e.contains(a);a=a.parentElement){if(!(a instanceof HTMLElement))continue;let l=getComputedStyle(a),h=a.getBoundingClientRect(),c=!r&&/auto|scroll/.test(l.overflowX)?xn(t.x,Math.max(0,h.left,o.left),Math.min(innerWidth,h.right,o.right)):0,u=!s&&/auto|scroll/.test(l.overflowY)?xn(t.y,Math.max(0,h.top,o.top),Math.min(innerHeight,h.bottom,o.bottom)):0,f=a.scrollLeft,d=a.scrollTop;if(c&&(a.scrollLeft+=c),u&&(a.scrollTop+=u),(a.scrollLeft!==f||a.scrollTop!==d)&&(n=!0,r||=a.scrollLeft!==f,s||=a.scrollTop!==d,r&&s)||a===e)break}return n}function Xr(i,e="Text selection"){let t=i.ownerDocument,n=t.defaultView,r="showai-text-"+crypto.randomUUID(),s=t.createElement("style");s.textContent=`::highlight(${r}){background:Highlight;color:HighlightText}`,i.append(s);let o=t.createElement("textarea");o.tabIndex=-1,o.hidden=!0,o.dataset.textSelectionInput="true",o.setAttribute("aria-label",e),o.style.cssText="position:fixed;left:-10000px;top:0;width:1px;height:1px;opacity:0;pointer-events:none",i.append(o);let a=n,l=null,h=null,c=0,u=!1,f=!1,d=(p,S,w={})=>{let v=de.get(p);v&&p.contentWindow?.postMessage({channel:v.channel,type:S,...w},"*")},m=()=>{n.cancelAnimationFrame(c),c=0,l=null},x=()=>{a.CSS.highlights?.delete(r);for(let p of i.querySelectorAll("iframe"))d(p,"showai:text-selection-range",{from:0,to:0});h=null,o.value="",t.activeElement===o&&o.blur(),o.hidden=!0,delete i.dataset.textSelection},A=(p,S,w)=>{let v=gn(p,C=>de.get(C)?.text??""),M=v.offsetAt(S.node,S.offset),b=v.offsetAt(w.node,w.offset);if(M===null||b===null)return;let T=Math.min(M,b),k=Math.max(M,b);h={page:p,anchor:S,head:w,model:v,from:T,to:k},o.value=v.text.slice(T,k),o.setSelectionRange(0,o.value.length),a.Highlight&&a.CSS.highlights?a.CSS.highlights.set(r,new a.Highlight(...v.ranges(T,k))):t.getSelection()?.setBaseAndExtent(S.node,S.offset,w.node,w.offset);for(let C of v.entries)C.node instanceof HTMLIFrameElement&&d(C.node,"showai:text-selection-range",{from:Math.max(0,T-C.start),to:Math.min(C.end-C.start,k-C.start)})},L=(p,S,w=Ne(t,S),v)=>{if(!w||p.closest('button,input,textarea,select,summary,[role="button"],[role="slider"],[data-surface-ui],[data-surface-handle],.block-handle,.react-flow,[data-surface-gesture="own"]')||!(w.node instanceof HTMLIFrameElement)&&!pr(p,S.x,S.y))return;let M=p.closest(".container-page");if(!M||!i.contains(M))return;for(let k=M.parentElement?.closest(".container-page");k&&i.contains(k);k=k.parentElement?.closest(".container-page"))M=k;m(),x();for(let k of M.querySelectorAll("iframe"))d(k,"showai:text-selection-content-request");let b=(w.node instanceof Element?w.node:w.node.parentElement)?.closest("[contenteditable]"),T=!b||!pe.get(b)?.isEditable;T&&t.activeElement instanceof HTMLElement&&t.activeElement.blur(),l={page:M,target:p,anchor:w,start:S,point:S,cross:!1,moved:!1,pointer:v,readOnlyStart:T,boundaries:[...M.querySelectorAll(ur)],table:p.closest("table")}},q=p=>{if(!l||!l.moved||!l.anchor.node.isConnected)return;let{page:S,anchor:w,point:v}=l,M=S.getBoundingClientRect(),b={x:Math.max(M.left+2,Math.min(M.right-2,v.x)),y:Math.max(M.top+2,Math.min(innerHeight-2,M.bottom-2,v.y))},T=t.elementFromPoint(b.x,b.y);if(!T||!S.contains(T))return;if(T instanceof HTMLIFrameElement&&!p){let F=T.getBoundingClientRect();d(T,"showai:text-selection-hit",{x:(b.x-F.left)/F.width*T.clientWidth,y:(b.y-F.top)/F.height*T.clientHeight,buttons:1});return}let k=p??Ne(t,b);if(!k||!S.contains(k.node))return;let C=l.cross||l.readOnlyStart||yn(w.node)!==yn(k.node)||!!(l.table&&T.closest("table")!==l.table);if(!C&&!(w.node instanceof HTMLIFrameElement)&&!(k.node instanceof HTMLIFrameElement)){let F=t.createRange(),$=t.createRange();F.setStart(w.node,w.offset),F.collapse(!0),$.setStart(k.node,k.offset),$.collapse(!0),F.compareBoundaryPoints(Range.START_TO_START,$)>0?(F.setStart(k.node,k.offset),F.setEnd(w.node,w.offset)):F.setEnd(k.node,k.offset),C=l.boundaries.some(U=>U.isConnected&&!U.contains(w.node)&&!U.contains(k.node)&&F.intersectsNode(U))}C&&(l.cross||(l.cross=!0,i.dataset.textSelection="true",o.hidden=!1,o.focus({preventScroll:!0}),t.getSelection()?.removeAllRanges()),l.head=k,A(S,w,k))},Z=()=>{if(l){if(l.moved){let p=t.elementFromPoint(Math.max(0,Math.min(innerWidth-1,l.point.x)),Math.max(0,Math.min(innerHeight-1,l.point.y)));if(dr(p&&l.page.contains(p)?p:l.target,l.page,l.point))if(l.cross)q();else if(l.page.querySelector(".selectedCell")){let w=l.page.getBoundingClientRect();t.dispatchEvent(new MouseEvent("mousemove",{bubbles:!0,buttons:1,clientX:l.point.x,clientY:Math.max(w.top+2,Math.min(w.bottom-2,innerHeight-2,l.point.y))}))}else{let w=l.page.getBoundingClientRect(),v=Ne(t,{x:Math.max(w.left+2,Math.min(w.right-2,l.point.x)),y:Math.max(w.top+2,Math.min(innerHeight-2,w.bottom-2,l.point.y))});v&&l.anchor.node instanceof Text&&l.page.contains(v.node)&&t.getSelection()?.setBaseAndExtent(l.anchor.node,Math.min(l.anchor.offset,l.anchor.node.length),v.node,v.offset),q()}}c=n.requestAnimationFrame(Z)}},et=p=>{p.button===0&&p.pointerType==="mouse"&&!p.shiftKey&&!p.metaKey&&!p.ctrlKey&&p.target instanceof Element&&L(p.target,{x:p.clientX,y:p.clientY},void 0,p.pointerId)},tt=p=>{if(!(!l||l.pointer!==void 0&&l.pointer!==p.pointerId)){if(!(p.buttons&1)){m();return}l.point={x:p.clientX,y:p.clientY},l.moved||=Math.hypot(l.point.x-l.start.x,l.point.y-l.start.y)>4,q(),l?.cross&&(p.preventDefault(),p.stopPropagation()),c||(c=n.requestAnimationFrame(Z))}},Ie=()=>{l?.cross&&(q(l.head),u=!0),m()},nt=p=>{l?.cross&&(p.preventDefault(),p.stopImmediatePropagation())},rt=p=>{u&&(u=!1,p.preventDefault(),p.stopPropagation())},j=p=>{if(!h||h.from===h.to)return;if(!h.anchor.node.isConnected||!h.head.node.isConnected){x();return}let S=new Map,w;for(let b of h.model.ranges(h.from,h.to)){let k=(b.startContainer instanceof Element?b.startContainer:b.startContainer.parentElement).closest("[contenteditable]"),C=k&&pe.get(k);if(!C?.isEditable||C.isDestroyed||!C.view.dom.isConnected)continue;let F=C.view.posAtDOM(b.startContainer,b.startOffset),$=C.view.posAtDOM(b.endContainer,b.endOffset);if(F>=$)continue;w??=C;let U=S.get(C)??[];U.push({from:F,to:$}),S.set(C,U)}if(!w){o.value=h.model.text.slice(h.from,h.to),o.setSelectionRange(0,o.value.length);return}let v="text-selection:"+crypto.randomUUID(),M=[...S].sort(([b],[T])=>b.view.dom.contains(T.view.dom)?-1:T.view.dom.contains(b.view.dom)?1:0);x();for(let[b,T]of M){let k=mn(b.state,T,p,b===w);k&&b.view.dispatch(k.setMeta(dn,v))}w.view.focus()},me=p=>{!h||t.activeElement!==o||!p.clipboardData||(p.clipboardData.setData("text/plain",h.model.text.slice(h.from,h.to)),p.preventDefault(),p.stopPropagation(),p.type==="cut"&&j(""))},it=p=>{if(!(!h||t.activeElement!==o)){if((p.metaKey||p.ctrlKey)&&["z","y"].includes(p.key.toLowerCase())){x(),m();return}if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(p.key)){p.preventDefault(),p.stopPropagation();let S=["ArrowLeft","ArrowUp","Home"].includes(p.key),w=h.model.ranges(h.from,h.to);S||w.reverse();for(let v of w){let M=S?v.startContainer:v.endContainer,T=(M instanceof Element?M:M.parentElement)?.closest("[contenteditable]"),k=T&&pe.get(T);if(!k?.isEditable||k.isDestroyed||!k.view.dom.isConnected)continue;let C=k.view.posAtDOM(M,S?v.startOffset:v.endOffset);x(),m(),k.commands.focus(C,{scrollIntoView:!1});return}x(),m();return}if(p.key==="Escape"){p.preventDefault(),x(),m();return}p.key==="Backspace"||p.key==="Delete"?(p.preventDefault(),p.stopPropagation(),j("")):p.key==="Enter"&&!p.isComposing&&(p.preventDefault(),p.stopPropagation(),j(`
9
+ `))}},wn=p=>{if(!f){let S=p;j(S.inputType.startsWith("delete")?"":S.data??o.value)}},kn=()=>{f=!0},Sn=()=>{f=!1,j(o.value)},st=p=>{h&&t.activeElement===o&&(p.preventDefault(),p.stopPropagation(),j(p.clipboardData?.getData("text/plain")??""))},ot=p=>{h&&p.target!==o&&(x(),m())},lt=p=>{p.button===0&&(m(),x(),u=!1)},at=p=>{if(!(p.target instanceof Element))return;let{phase:S,point:w,caret:v,buttons:M}=p.detail;S==="down"?L(p.target,w,v):S==="move"&&l&&M&1?(l.point=w,l.moved||=Math.hypot(w.x-l.start.x,w.y-l.start.y)>4,q(v),c||(c=n.requestAnimationFrame(Z))):S==="up"?Ie():S==="cancel"&&m()},ht=()=>m();return t.addEventListener("focusin",ot,!0),t.addEventListener("pointerdown",lt,!0),i.addEventListener("pointerdown",et,!0),t.addEventListener("pointermove",tt,!0),t.addEventListener("mousemove",nt,!0),t.addEventListener("pointerup",Ie,!0),t.addEventListener("pointercancel",m,!0),i.addEventListener("click",rt,!0),t.addEventListener("copy",me,!0),t.addEventListener("cut",me,!0),t.addEventListener("keydown",it,!0),t.addEventListener("paste",st,!0),o.addEventListener("input",wn),o.addEventListener("compositionstart",kn),o.addEventListener("compositionend",Sn),i.addEventListener("showai:text-selection-pointer",at),n.addEventListener("blur",ht),_e.set(i,()=>h&&h.to>h.from?{ranges:h.model.ranges(h.from,h.to),text:h.model.text.slice(h.from,h.to)}:null),()=>{_e.delete(i),m(),x(),s.remove(),o.remove(),t.removeEventListener("focusin",ot,!0),t.removeEventListener("pointerdown",lt,!0),i.removeEventListener("pointerdown",et,!0),t.removeEventListener("pointermove",tt,!0),t.removeEventListener("mousemove",nt,!0),t.removeEventListener("pointerup",Ie,!0),t.removeEventListener("pointercancel",m,!0),i.removeEventListener("click",rt,!0),t.removeEventListener("copy",me,!0),t.removeEventListener("cut",me,!0),t.removeEventListener("keydown",it,!0),t.removeEventListener("paste",st,!0),i.removeEventListener("showai:text-selection-pointer",at),n.removeEventListener("blur",ht)}}export{gn as a,g as b,E as c,y as d,De as e,dt as f,gt as g,kt as h,Ue as i,Y as j,z as k,B as l,wr as m,kr as n,Sr as o,Er as p,vr as q,br as r,ir as s,Ce as t,R as u,Ze as v,P as w,H as x,Q as y,hn as z,cn as A,fn as B,dn as C,Wr as D,Hr as E,qr as F,Ur as G,Vr as H,pr as I,Xr as J};
@@ -0,0 +1,2 @@
1
+ import{a as g,c as C,ib as x,jb as H,lb as w}from"./chunk-HFI3ZB2W.js";import{a as v}from"./chunk-J6IRWTF7.js";import{c as l}from"./chunk-DCANE7XH.js";g(`.editor-tool{display:inline-flex;align-items:center;justify-content:center;width:28px;height:29px;padding:0;flex-shrink:0;color:var(--muted);border:0;border-radius:4px;background:transparent}.editor-tool svg{stroke-width:1.65}.editor-tool:hover,.editor-tool.is-active{color:var(--accent);background:var(--editor-soft)}.editor-tool:disabled{opacity:.32}.editor-bubble{--editor-line: var(--line, #e8ece5);--editor-soft: var(--accent-soft, #edf2e9);position:fixed;z-index:80;display:flex;align-items:center;gap:2px;padding:5px;border:1px solid var(--line, #e8ece5);border-radius:6px;background:var(--paper, #fff);color:var(--text, #343a35);font-family:var(--font-ui, system-ui, sans-serif);font-size:12px;font-weight:400;line-height:1.2;letter-spacing:normal;box-shadow:0 5px 20px #2434291c;animation:editor-menu-appear .13s ease;max-width:calc(100vw - 16px);overflow-x:auto}@keyframes editor-menu-appear{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.editor-bubble{animation:none!important;transition:none!important}}@media print{.editor-bubble{display:none!important}}
2
+ `);var i=l(C(),1),h=l(H(),1);var y=v("editor",{"zh-CN":{selectionToolbar:"\u9009\u4E2D\u6587\u5B57\u683C\u5F0F"},en:{selectionToolbar:"Selected text formatting"}});var k=l(x(),1);function O({id:M,anchor:n,anchorElement:t,children:L,onEscape:E,label:T,keyboardScope:z,viewportTop:d=8,className:b}){let R=w(y),u=(0,i.useRef)(null),[D,S]=(0,i.useState)(n);return(0,i.useLayoutEffect)(()=>{let e=u.current,r=()=>{let{width:o,height:c}=e.getBoundingClientRect(),a=t?.isConnected?t.getBoundingClientRect():null,s=a?{left:(a.left+a.right)/2,top:a.top,bottom:a.bottom}:n,m={left:Math.max(8,Math.min(s.left-o/2,window.innerWidth-o-8)),top:Math.max(d,Math.min(s.top-c-8>=d?s.top-c-8:(s.bottom??s.top)+8,window.innerHeight-c-8))};S(f=>f.left===m.left&&f.top===m.top?f:m)};r();let p=new ResizeObserver(r);if(p.observe(e),t)for(let o=t;o;o=o.parentElement)p.observe(o);return window.addEventListener("resize",r),t&&window.addEventListener("scroll",r,!0),()=>{p.disconnect(),window.removeEventListener("resize",r),t&&window.removeEventListener("scroll",r,!0)}},[n.left,n.top,n.bottom,t,d]),(0,h.createPortal)((0,k.jsx)("div",{ref:u,id:M,className:`editor-bubble${b?` ${b}`:""}`,"data-editor-menu-trigger":"selection","data-editor-keyboard-scope":z,role:"toolbar","aria-label":T??R("selectionToolbar"),style:D,onMouseDown:e=>{e.target.closest("input,select,textarea")||e.preventDefault()},onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),E())},children:L}),document.body)}export{O as a};