aitu-app 0.5.14 → 0.5.15

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.

Potentially problematic release.


This version of aitu-app might be problematic. Click here for more details.

Files changed (110) hide show
  1. package/README.md +3 -2
  2. package/assets/{ChatMessagesArea-CkUX81uB.js → ChatMessagesArea-CJPMwgOQ.js} +3 -3
  3. package/assets/{ToolboxDrawer-By1XMh8B.js → ToolboxDrawer-BZkRey45.js} +1 -1
  4. package/assets/{ai-analyze-Db-iXol6.js → ai-analyze-CKKkojLn.js} +1 -1
  5. package/assets/{arc-ajYHRRnk.js → arc-DpZjyIR9.js} +1 -1
  6. package/assets/{arc-BZXVqUcI.js → arc-amy12ZHI.js} +1 -1
  7. package/assets/{batch-image-generation-Baqb01Lm.js → batch-image-generation-CqSButZp.js} +1 -1
  8. package/assets/{blockDiagram-38ab4fdb-BT3H_WVv.js → blockDiagram-38ab4fdb-Bb_sM5Hm.js} +1 -1
  9. package/assets/{blockDiagram-38ab4fdb-u0xYP3Lt.js → blockDiagram-38ab4fdb-DO5SLxgD.js} +1 -1
  10. package/assets/{c4Diagram-3d4e48cf-CBvM6zjM.js → c4Diagram-3d4e48cf-D1hzTotE.js} +1 -1
  11. package/assets/{c4Diagram-3d4e48cf-WOIEVidH.js → c4Diagram-3d4e48cf-IYlxbdWH.js} +1 -1
  12. package/assets/channel-DuH6cax_.js +1 -0
  13. package/assets/channel-V941kNNl.js +1 -0
  14. package/assets/{classDiagram-70f12bd4-Cl9U1r5F.js → classDiagram-70f12bd4-CMCkiBrF.js} +1 -1
  15. package/assets/{classDiagram-70f12bd4-BMutcvFi.js → classDiagram-70f12bd4-C_DG-_VE.js} +1 -1
  16. package/assets/{classDiagram-v2-f2320105-C0agtbR4.js → classDiagram-v2-f2320105-DdbTRsFm.js} +1 -1
  17. package/assets/{classDiagram-v2-f2320105-tCBzATK6.js → classDiagram-v2-f2320105-Y5yPoT7w.js} +1 -1
  18. package/assets/clone-BoLnjeh7.js +1 -0
  19. package/assets/clone-DufRhyQM.js +1 -0
  20. package/assets/{createText-2e5e7dd3-CZ9_fscE.js → createText-2e5e7dd3-DWMoiN14.js} +1 -1
  21. package/assets/{createText-2e5e7dd3-idrqgJjU.js → createText-2e5e7dd3-Q_TpnKHS.js} +1 -1
  22. package/assets/{edges-e0da2a9e-C-RyePMV.js → edges-e0da2a9e-Br_hn5Hn.js} +1 -1
  23. package/assets/{edges-e0da2a9e-DJXAjJSL.js → edges-e0da2a9e-DMfYzMhl.js} +1 -1
  24. package/assets/{erDiagram-9861fffd-x2Kcy95-.js → erDiagram-9861fffd-8s6fny9G.js} +1 -1
  25. package/assets/{erDiagram-9861fffd-DWJR_3zL.js → erDiagram-9861fffd-CslzjwB2.js} +1 -1
  26. package/assets/{flowDb-956e92f1-CF6y18Tn.js → flowDb-956e92f1-BsxQxnaW.js} +1 -1
  27. package/assets/{flowDb-956e92f1-BgKjOIdz.js → flowDb-956e92f1-Bsz7tEUu.js} +1 -1
  28. package/assets/{flowDiagram-66a62f08-CSAllSFf.js → flowDiagram-66a62f08-C0iQ7Eg0.js} +1 -1
  29. package/assets/{flowDiagram-66a62f08-BPPw0wPU.js → flowDiagram-66a62f08-DLXaK0x0.js} +1 -1
  30. package/assets/flowDiagram-v2-96b9c2cf-Be_fSVIi.js +1 -0
  31. package/assets/flowDiagram-v2-96b9c2cf-C-_-kXrI.js +1 -0
  32. package/assets/{flowchart-elk-definition-4a651766-DWFN9DN3.js → flowchart-elk-definition-4a651766-2JQap1Bs.js} +1 -1
  33. package/assets/{flowchart-elk-definition-4a651766-9XSRJbsr.js → flowchart-elk-definition-4a651766-UQLaW6cl.js} +1 -1
  34. package/assets/{ganttDiagram-c361ad54-D9tbz9tQ.js → ganttDiagram-c361ad54-Cfdrec1H.js} +1 -1
  35. package/assets/{ganttDiagram-c361ad54-ot5pUYpT.js → ganttDiagram-c361ad54-hShkYpY_.js} +1 -1
  36. package/assets/{gitGraphDiagram-72cf32ee-C6qFzgGh.js → gitGraphDiagram-72cf32ee-CJw4loHZ.js} +1 -1
  37. package/assets/{gitGraphDiagram-72cf32ee-BFV3Mt8C.js → gitGraphDiagram-72cf32ee-D6obWSUI.js} +1 -1
  38. package/assets/{graph-BxwlF7JS.js → graph-CUK2kA3Q.js} +1 -1
  39. package/assets/{graph-D-2Ldvxg.js → graph-DvHs9g2k.js} +1 -1
  40. package/assets/{grid-image-cM9AmYC8.js → grid-image-DioDaenp.js} +1 -1
  41. package/assets/{has-CgdIPiQG.js → has-C9yYx3eK.js} +1 -1
  42. package/assets/{hasIn-4iY02rGN.js → hasIn-DZErb2GY.js} +1 -1
  43. package/assets/{index-3862675e-CVZnpwDN.js → index-3862675e-CmpgM8FI.js} +1 -1
  44. package/assets/{index-3862675e-DqdI9cab.js → index-3862675e-DIpatAx8.js} +1 -1
  45. package/assets/{index-DBWqXBIQ.js → index-6dh_xpWk.js} +1 -1
  46. package/assets/{index-DWUAFoZG.js → index-BBCAc4Al.js} +9 -9
  47. package/assets/{index-BicRPzXC.js → index-BENzx6Jm.js} +1 -1
  48. package/assets/{index-BwSGXyRr.js → index-CMnHM-d8.js} +4 -4
  49. package/assets/{index-e05Rs4M6.js → index-D6IbVyW6.js} +1 -1
  50. package/assets/{index-CkpXFt8n.js → index-DDjAsbde.js} +1 -1
  51. package/assets/{index-Dn0YtZ2R.js → index-Dg-P8uA3.js} +1 -1
  52. package/assets/{index-CrxF9gFe.js → index-JzVvCLEO.js} +1 -1
  53. package/assets/{infoDiagram-f8f76790-FKC1Sy9Y.js → infoDiagram-f8f76790-DVba3P4U.js} +1 -1
  54. package/assets/{infoDiagram-f8f76790-CnrpwoOt.js → infoDiagram-f8f76790-n-jV57cF.js} +1 -1
  55. package/assets/{inspiration-board-B_-BBBHt.js → inspiration-board--PQTKq9U.js} +1 -1
  56. package/assets/{isEmpty-Dj2GV0v-.js → isEmpty-CRiX5iwN.js} +1 -1
  57. package/assets/{journeyDiagram-49397b02-B7fP21sU.js → journeyDiagram-49397b02-DxSFNQYs.js} +1 -1
  58. package/assets/{journeyDiagram-49397b02-Dp3X9XWq.js → journeyDiagram-49397b02-WGL-3jNv.js} +1 -1
  59. package/assets/{layout-BD3yCK_X.js → layout-25V5jGUW.js} +1 -1
  60. package/assets/{layout-DHHYqX7p.js → layout-CawIP_cF.js} +1 -1
  61. package/assets/{line-B3bNrkzn.js → line-D5ZQcCU6.js} +1 -1
  62. package/assets/{line-B86HLuqu.js → line-DuKdCx_E.js} +1 -1
  63. package/assets/{linear-wCAlMhOS.js → linear-3V_n7zlW.js} +1 -1
  64. package/assets/{linear-DU2Ciymb.js → linear-BlVhwFrV.js} +1 -1
  65. package/assets/{mermaid.core-DfVvnpgz.js → mermaid.core--Np12uGY.js} +4 -4
  66. package/assets/{mindmap-definition-fc14e90a-D1sxE3xG.js → mindmap-definition-fc14e90a-C96nL64E.js} +1 -1
  67. package/assets/{mindmap-definition-fc14e90a-YuSOJC7P.js → mindmap-definition-fc14e90a-UZifAYnn.js} +1 -1
  68. package/assets/{photo-wall-splitter-BVU2e0aS.js → photo-wall-splitter-DZyQuDUg.js} +1 -1
  69. package/assets/{pick-Cvlwra4g.js → pick-B51S9oWq.js} +1 -1
  70. package/assets/{pieDiagram-8a3498a8-B6mJUqro.js → pieDiagram-8a3498a8-B_UU-v6b.js} +1 -1
  71. package/assets/{pieDiagram-8a3498a8-B91bWgo_.js → pieDiagram-8a3498a8-DXEMg8-z.js} +1 -1
  72. package/assets/{quadrantDiagram-120e2f19-BxS8fQEz.js → quadrantDiagram-120e2f19-BpCIEZWH.js} +1 -1
  73. package/assets/{quadrantDiagram-120e2f19-DwudONqx.js → quadrantDiagram-120e2f19-THiHerb8.js} +1 -1
  74. package/assets/{requirementDiagram-deff3bca-DygaMIoy.js → requirementDiagram-deff3bca-BLEvJckC.js} +1 -1
  75. package/assets/{requirementDiagram-deff3bca-v9xlgfS8.js → requirementDiagram-deff3bca-qJ4hHh6O.js} +1 -1
  76. package/assets/{sankeyDiagram-04a897e0-BXCiXiyw.js → sankeyDiagram-04a897e0-C5moR6iD.js} +1 -1
  77. package/assets/{sankeyDiagram-04a897e0-BV23dp4l.js → sankeyDiagram-04a897e0-Clk-gmpQ.js} +1 -1
  78. package/assets/{sequenceDiagram-704730f1-CObRpNi4.js → sequenceDiagram-704730f1-Ch9GmBP7.js} +1 -1
  79. package/assets/{sequenceDiagram-704730f1-Ck69A6wI.js → sequenceDiagram-704730f1-DRHB_a_K.js} +1 -1
  80. package/assets/{settings-dialog-BlCO49C4.js → settings-dialog-Cgmye4jO.js} +1 -1
  81. package/assets/{stateDiagram-587899a1-J_G6I0oo.js → stateDiagram-587899a1-Bu42pkUv.js} +1 -1
  82. package/assets/{stateDiagram-587899a1-z-tKclr3.js → stateDiagram-587899a1-bnuzZWVC.js} +1 -1
  83. package/assets/{stateDiagram-v2-d93cdb3a-DsThtOzP.js → stateDiagram-v2-d93cdb3a-3bX_yI1j.js} +1 -1
  84. package/assets/{stateDiagram-v2-d93cdb3a-XIvq5t8a.js → stateDiagram-v2-d93cdb3a-DLzO3ON3.js} +1 -1
  85. package/assets/{styles-6aaf32cf-1fjuNMUk.js → styles-6aaf32cf-CyzTJ9FB.js} +1 -1
  86. package/assets/{styles-6aaf32cf-DT2rVNfQ.js → styles-6aaf32cf-qL7GgrGp.js} +1 -1
  87. package/assets/{styles-9a916d00-fLeUSina.js → styles-9a916d00-DYu1WXui.js} +1 -1
  88. package/assets/{styles-9a916d00-q64Umkis.js → styles-9a916d00-Dv_u24Fv.js} +1 -1
  89. package/assets/{styles-c10674c1-CtYpjMYU.js → styles-c10674c1-C8mVn82x.js} +1 -1
  90. package/assets/{styles-c10674c1-BWlxVc3Q.js → styles-c10674c1-CBAvChyC.js} +1 -1
  91. package/assets/{svgDrawCommon-08f97a94-C_DhKfny.js → svgDrawCommon-08f97a94-Cma2KGuK.js} +1 -1
  92. package/assets/{svgDrawCommon-08f97a94-DSBqmUv2.js → svgDrawCommon-08f97a94-p3hABH7b.js} +1 -1
  93. package/assets/{timeline-definition-85554ec2-dTkYwoLF.js → timeline-definition-85554ec2-SwmuytFv.js} +1 -1
  94. package/assets/{timeline-definition-85554ec2-AKpzwLPN.js → timeline-definition-85554ec2-XppLsb9g.js} +1 -1
  95. package/assets/{ttd-dialog-CxiaIUuJ.js → ttd-dialog-DeYFjfFN.js} +5 -5
  96. package/assets/{upload-4sxUU7q_.js → upload-B0RQ9yYL.js} +1 -1
  97. package/assets/{video-recovery-service-BckHbSyK.js → video-recovery-service-XnlUYAOr.js} +1 -1
  98. package/assets/{xychartDiagram-e933f94c-DCmvL0ag.js → xychartDiagram-e933f94c-C8xFRDll.js} +1 -1
  99. package/assets/{xychartDiagram-e933f94c-aqOiXp_u.js → xychartDiagram-e933f94c-CedgK1zZ.js} +1 -1
  100. package/index.html +2 -2
  101. package/package.json +1 -1
  102. package/sw.js +1 -1
  103. package/version.json +3 -7
  104. package/versions.html +374 -0
  105. package/assets/channel-BP25wTsw.js +0 -1
  106. package/assets/channel-HzrLNFUg.js +0 -1
  107. package/assets/clone-B69pF7Y_.js +0 -1
  108. package/assets/clone-oX7o-l4R.js +0 -1
  109. package/assets/flowDiagram-v2-96b9c2cf-B-UGyXRi.js +0 -1
  110. package/assets/flowDiagram-v2-96b9c2cf-Cm596kxZ.js +0 -1
@@ -1 +1 @@
1
- import{a5 as L,a6 as G,a7 as $,a8 as ne,a9 as re,aa as K,ab as P,u as B,ac as H,W as Y,m as V,ad as Q,ae as q,af as X,ag as ee,O,P as R,ah as oe,r as I,Q as T,Z as ce,C as l,E as le,F as de,ai as Z,aj as te}from"./index-DWUAFoZG.js";import{U as pe}from"./upload-4sxUU7q_.js";const me=2,se="aitu-backup";function ae(E){return E.map(n=>n.id?n:{...n,id:`imported-${Date.now()}-${Math.random().toString(36).slice(2,9)}`})}function z(E){return{"image/jpeg":".jpg","image/jpg":".jpg","image/png":".png","image/gif":".gif","image/webp":".webp","image/svg+xml":".svg","video/mp4":".mp4","video/webm":".webm","video/quicktime":".mov"}[E]||""}function ie(E){return E.replace(/[<>:"/\\|?*]/g,"_").replace(/\s+/g," ").trim()||"unnamed"}class ue{async exportToZip(n,e){const t=new L;e==null||e(5,"正在准备数据...");const s=G.getCurrentBoard(),o={currentBoardId:(s==null?void 0:s.id)||null,currentBoardName:s==null?void 0:s.name,viewport:s==null?void 0:s.viewport},m={signature:se,version:me,createdAt:Date.now(),includes:{prompts:n.includePrompts,projects:n.includeProjects,assets:n.includeAssets},stats:{promptCount:0,videoPromptCount:0,imagePromptCount:0,folderCount:0,boardCount:0,assetCount:0,taskCount:0},workspaceState:o};if(n.includePrompts){e==null||e(10,"正在导出提示词...");const p=await this.collectPromptData();t.file("prompts.json",JSON.stringify(p,null,2)),m.stats.promptCount=p.promptHistory.length,m.stats.videoPromptCount=p.videoPromptHistory.length,m.stats.imagePromptCount=p.imagePromptHistory.length}n.includeProjects&&(e==null||e(25,"正在导出项目..."),await this.exportProjects(t,m,e)),n.includeAssets&&(e==null||e(50,"正在导出素材..."),await this.exportAssets(t,m,e)),e==null||e(80,"正在写入清单..."),t.file("manifest.json",JSON.stringify(m,null,2)),e==null||e(85,"正在压缩文件...");const u=await t.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}},p=>{const i=85+Math.round(p.percent*.14);e==null||e(i,"正在压缩...")});return e==null||e(100,"导出完成"),u}async exportProjects(n,e,t){const s=n.folder("projects");if(!s)return;const[o,m]=await Promise.all([$.loadAllFolders(),$.loadAllBoards()]),u=this.buildFolderPathMap(o);for(const p of o){const i=u.get(p.id)||p.name;s.folder(i)}e.stats.folderCount=o.length;for(let p=0;p<m.length;p++){const i=m[p],b=i.folderId?u.get(i.folderId):null,j=ie(i.name),c=b?`${b}/${j}.drawnix`:`${j}.drawnix`,x={type:ne.drawnix,version:re.drawnix,source:"backup",elements:i.elements||[],viewport:i.viewport||{zoom:1},theme:i.theme,boardMeta:{id:i.id,name:i.name,folderId:i.folderId,order:i.order,createdAt:i.createdAt,updatedAt:i.updatedAt}};if(s.file(c,JSON.stringify(x,null,2)),t&&m.length>0){const f=25+Math.round((p+1)/m.length*20);t(f,`正在导出画板 (${p+1}/${m.length})...`)}}e.stats.boardCount=m.length}buildFolderPathMap(n){const e=new Map,t=new Map;for(const o of n)t.set(o.id,o);const s=o=>{if(e.has(o))return e.get(o);const m=t.get(o);if(!m)return"";const u=ie(m.name);if(m.parentId){const p=s(m.parentId),i=p?`${p}/${u}`:u;return e.set(o,i),i}return e.set(o,u),u};for(const o of n)s(o.id);return e}async exportAssets(n,e,t){var a;const s=n.folder("assets");if(!s)return;const o=new Set;let m=0;const u=K.createInstance({name:P.STORAGE_NAME,storeName:P.STORE_NAME}),p=await u.keys(),i=p.length;for(let r=0;r<p.length;r++){try{const d=await u.getItem(p[r]);if(d){s.file(`${d.id}.meta.json`,JSON.stringify(d,null,2));const h=await B.getCachedBlob(d.url);if(h){const g=z(d.mimeType);s.file(`${d.id}${g}`,h),o.add(d.url),m++}}}catch(d){console.warn(`[BackupRestore] Failed to load asset ${p[r]}:`,d)}if(t&&i>0){const d=50+Math.round((r+1)/i*15);t(d,`正在导出本地素材 (${r+1}/${i})...`)}}const j=(await B.getAllCacheMetadata()).filter(r=>!o.has(r.url)),c=j.length;for(let r=0;r<j.length;r++){const d=j[r];try{const h=((a=d.metadata)==null?void 0:a.taskId)||this.generateIdFromUrl(d.url),g={id:h,url:d.url,type:d.type==="video"?"VIDEO":"IMAGE",mimeType:d.mimeType,size:d.size,source:"AI_GENERATED",createdAt:d.cachedAt,updatedAt:d.lastUsed,metadata:d.metadata};s.file(`${h}.meta.json`,JSON.stringify(g,null,2));const v=await B.getCachedBlob(d.url);if(v){const _=z(d.mimeType);s.file(`${h}${_}`,v),o.add(d.url),m++}}catch(h){console.warn(`[BackupRestore] Failed to export cached media ${d.url}:`,h)}if(t&&c>0){const h=65+Math.round((r+1)/c*10);t(h,`正在导出缓存媒体 (${r+1}/${c})...`)}}e.stats.assetCount=m,t==null||t(75,"正在导出任务数据...");const f=H.getAllTasks().filter(r=>{var d;return r.status===Y.COMPLETED&&(r.type===V.IMAGE||r.type===V.VIDEO)&&((d=r.result)==null?void 0:d.url)});f.length>0&&(n.file("tasks.json",JSON.stringify(f,null,2)),e.stats.taskCount=f.length)}generateIdFromUrl(n){let e=0;for(let t=0;t<n.length;t++){const s=n.charCodeAt(t);e=(e<<5)-e+s,e=e&e}return`cache-${Math.abs(e).toString(36)}`}async importFromZip(n,e){const t={success:!1,prompts:{imported:0,skipped:0},projects:{folders:0,boards:0,merged:0,skipped:0},assets:{imported:0,skipped:0},tasks:{imported:0,skipped:0},errors:[]};try{e==null||e(5,"正在读取文件...");const s=await L.loadAsync(n);e==null||e(10,"正在验证文件格式...");const o=s.file("manifest.json");if(!o)throw new Error("无效的备份文件:未找到 manifest.json");const m=await o.async("string"),u=JSON.parse(m);if(u.signature!==se)throw new Error("无效的备份文件:签名不匹配");if(u.includes.prompts){e==null||e(20,"正在导入提示词...");const p=s.file("prompts.json");if(p){const i=await p.async("string"),b=JSON.parse(i);t.prompts=await this.importPromptData(b)}}u.includes.projects&&(e==null||e(40,"正在导入项目..."),t.projects=await this.importProjects(s,e)),u.includes.assets&&(e==null||e(60,"正在导入素材..."),t.assets=await this.importAssets(s,e),e==null||e(85,"正在导入任务数据..."),t.tasks=await this.importTasks(s)),(t.projects.folders>0||t.projects.boards>0)&&await G.reload(),u.workspaceState&&(t.workspaceState=u.workspaceState),t.success=t.errors.length===0,e==null||e(100,"导入完成")}catch(s){const o=s instanceof Error?s.message:String(s);t.errors.push(o)}return t}downloadZip(n,e){const t=new Date,s=t.toISOString().split("T")[0],o=t.toTimeString().split(" ")[0].replace(/:/g,""),m=`aitu_backup_${s}_${o}.zip`,u=URL.createObjectURL(n),p=document.createElement("a");p.href=u,p.download=e||m,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(u)}async collectPromptData(){await Q();const n=q();let e=X(),t=ee();const s=H.getTasksByStatus(Y.COMPLETED),o=s.filter(c=>{var x;return c.type===V.IMAGE&&((x=c.params)==null?void 0:x.prompt)}).map(c=>({id:`task_${c.id}`,content:c.params.prompt.trim(),timestamp:c.completedAt||c.createdAt})).filter(c=>c.content.length>0),m=s.filter(c=>{var x;return c.type===V.VIDEO&&((x=c.params)==null?void 0:x.prompt)}).map(c=>({id:`task_${c.id}`,content:c.params.prompt.trim(),timestamp:c.completedAt||c.createdAt})).filter(c=>c.content.length>0),u=new Set(t.map(c=>c.content)),p=o.filter(c=>!u.has(c.content));t=[...t,...p];const i=new Set(e.map(c=>c.content)),b=m.filter(c=>!i.has(c.content));e=[...e,...b];const j=await O.get(R.PRESET_SETTINGS);return{promptHistory:n,videoPromptHistory:e,imagePromptHistory:t,presetSettings:j||{image:{pinnedPrompts:[],deletedPrompts:[]},video:{pinnedPrompts:[],deletedPrompts:[]}}}}async importPromptData(n){let e=0,t=0;const s=n.promptHistory||[],o=n.videoPromptHistory||[],m=n.imagePromptHistory||[];await Q();const u=q(),p=X(),i=ee(),b=new Set(u.map(k=>k.id)),j=new Set(u.map(k=>k.content)),c=s.filter(k=>b.has(k.id)||j.has(k.content)?(t++,!1):(e++,!0)),x=new Set(p.map(k=>k.id)),f=new Set(p.map(k=>k.content)),a=o.filter(k=>x.has(k.id)||f.has(k.content)?(t++,!1):(e++,!0)),r=new Set(i.map(k=>k.id)),d=new Set(i.map(k=>k.content)),h=m.filter(k=>r.has(k.id)||d.has(k.content)?(t++,!1):(e++,!0)),g=[...u,...c],v=[...p,...a],_=[...i,...h];await O.set(R.PROMPT_HISTORY,g),await O.set(R.VIDEO_PROMPT_HISTORY,v),await O.set(R.IMAGE_PROMPT_HISTORY,_);const S=await O.get(R.PRESET_SETTINGS);if(S&&n.presetSettings){const k={image:{pinnedPrompts:[...new Set([...S.image.pinnedPrompts,...n.presetSettings.image.pinnedPrompts])],deletedPrompts:[...new Set([...S.image.deletedPrompts,...n.presetSettings.image.deletedPrompts])]},video:{pinnedPrompts:[...new Set([...S.video.pinnedPrompts,...n.presetSettings.video.pinnedPrompts])],deletedPrompts:[...new Set([...S.video.deletedPrompts,...n.presetSettings.video.deletedPrompts])]}};await O.set(R.PRESET_SETTINGS,k)}else n.presetSettings&&await O.set(R.PRESET_SETTINGS,n.presetSettings);return await oe(),{imported:e,skipped:t}}async importProjects(n,e){let t=0,s=0,o=0,m=0;const u=await $.loadAllFolders(),p=await $.loadAllBoards(),i=new Set(p.map(f=>f.id)),b=Object.keys(n.files).filter(f=>f.startsWith("projects/")&&f.endsWith(".drawnix")&&!f.includes("/_"));if(b.length===0)return{folders:0,boards:0,merged:0,skipped:0};const j=new Set,c=new Map;for(const f of b){const r=f.replace(/^projects\//,"").split("/");if(r.length>1){let d="";for(let h=0;h<r.length-1;h++)d=d?`${d}/${r[h]}`:r[h],j.add(d)}}const x=Array.from(j).sort((f,a)=>{const r=f.split("/").length,d=a.split("/").length;return r-d||f.localeCompare(a)});for(let f=0;f<x.length;f++){const a=x[f],r=a.split("/"),d=r[r.length-1],h=r.length>1?r.slice(0,-1).join("/"):null,g=h&&c.get(h)||null,v=this.generateId();c.set(a,v);const _=u.find(k=>k.name===d&&k.parentId===g);if(_){c.set(a,_.id),m++;continue}const S={id:v,name:d,parentId:g,order:f,isExpanded:!0,createdAt:Date.now(),updatedAt:Date.now()};await $.saveFolder(S),t++}for(let f=0;f<b.length;f++){const a=b[f];try{const r=n.file(a);if(r){const d=await r.async("string"),h=JSON.parse(d),g=h.boardMeta,_=a.replace(/^projects\//,"").split("/"),S=_.length>1?_.slice(0,-1).join("/"):null,k=S&&(c.get(S)||(g==null?void 0:g.folderId))||null,U=_[_.length-1]||"unnamed.drawnix",D=(g==null?void 0:g.name)||U.replace(".drawnix","");if(g!=null&&g.id&&i.has(g.id)){const w=p.find(y=>y.id===g.id);if(w){const y=new Set((w.elements||[]).map(A=>A.id).filter(A=>!!A)),F=(h.elements||[]).filter(A=>A.id?!y.has(A.id):!0),N=[...w.elements||[],...ae(F)],J={...w,elements:N,viewport:h.viewport||w.viewport,theme:h.theme||w.theme,updatedAt:Date.now()};await $.saveBoard(J),o++;continue}}const M={id:(g==null?void 0:g.id)||this.generateId(),name:D,folderId:k,order:(g==null?void 0:g.order)??f,elements:ae(h.elements||[]),viewport:h.viewport,theme:h.theme,createdAt:(g==null?void 0:g.createdAt)||Date.now(),updatedAt:(g==null?void 0:g.updatedAt)||Date.now()};await $.saveBoard(M),s++}}catch(r){console.warn(`[BackupRestore] Failed to import board ${a}:`,r)}if(e&&b.length>0){const r=40+Math.round((f+1)/b.length*15);e(r,`正在导入画板 (${f+1}/${b.length})...`)}}return{folders:t,boards:s,merged:o,skipped:m}}async importAssets(n,e){var b,j,c;let t=0,s=0;const o=Object.keys(n.files).filter(x=>x.startsWith("assets/")&&x.endsWith(".meta.json"));if(o.length===0)return{imported:0,skipped:0};const m=K.createInstance({name:P.STORAGE_NAME,storeName:P.STORE_NAME}),u=await m.keys(),p=new Set(u),i=new Set(await B.getAllCachedUrls());for(let x=0;x<o.length;x++){const f=o[x],a=f.replace("assets/","").replace(".meta.json","");try{const r=n.file(f);if(!r){s++;continue}const d=await r.async("string"),h=JSON.parse(d),g=h.source==="AI_GENERATED";if(g){if(i.has(h.url)){s++;continue}}else if(p.has(a)){s++;continue}const v=[".jpg",".png",".gif",".webp",".mp4",".webm",".mov",".svg"];let _=null;for(const S of v){const k=n.file(`assets/${a}${S}`);if(k){_=await k.async("blob");break}}if(!_&&h.mimeType){const S=z(h.mimeType);if(S){const k=n.file(`assets/${a}${S}`);k&&(_=await k.async("blob"))}}if(_){const S=h.type==="VIDEO"?"video":"image";await B.cacheMediaFromBlob(h.url,_,S,{taskId:((b=h.metadata)==null?void 0:b.taskId)||a,prompt:(j=h.metadata)==null?void 0:j.prompt,model:(c=h.metadata)==null?void 0:c.model}),g||await m.setItem(a,h),t++}else console.warn(`[BackupRestore] No media file found for asset ${a}, skipping`),s++}catch(r){console.warn(`[BackupRestore] Failed to import asset ${a}:`,r),s++}if(e&&o.length>0){const r=60+Math.round((x+1)/o.length*35);e(r,`正在导入素材 (${x+1}/${o.length})...`)}}return{imported:t,skipped:s}}async importTasks(n){let e=0,t=0;const s=n.file("tasks.json");if(!s)return{imported:0,skipped:0};try{const o=await s.async("string"),m=JSON.parse(o);if(!Array.isArray(m)||m.length===0)return{imported:0,skipped:0};const u=H.getAllTasks(),p=new Set(u.map(b=>b.id)),i=m.filter(b=>p.has(b.id)?(t++,!1):!0);i.length>0&&(await H.restoreTasks(i),e=i.length)}catch(o){console.warn("[BackupRestore] Failed to import tasks:",o)}return{imported:e,skipped:t}}generateId(){return`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}}const W=new ue,ge=({open:E,onOpenChange:n,container:e,onSwitchBoard:t,onBeforeImport:s})=>{var M;const[o,m]=I.useState("backup"),[u,p]=I.useState({includePrompts:!0,includeProjects:!0,includeAssets:!0}),[i,b]=I.useState(!1),[j,c]=I.useState(0),[x,f]=I.useState(""),[a,r]=I.useState(null),[d,h]=I.useState(null),g=I.useRef(null),v=I.useCallback(async w=>{if(!w.currentBoardId||!t)return;const y=G.getBoard(w.currentBoardId);if(!y)return;const C=G.getCurrentBoard();if(!C||!C.elements||C.elements.length===0)await t(w.currentBoardId,w.viewport),T.success(`已切换到画板「${y.name}」`);else{const N=ce.confirm({header:"恢复画布状态",body:`备份时正在编辑画板「${w.currentBoardName||y.name}」,是否切换到该画板?`,confirmBtn:"切换",cancelBtn:"取消",onConfirm:async()=>{await t(w.currentBoardId,w.viewport),T.success(`已切换到画板「${y.name}」`),N.destroy()},onCancel:()=>{N.destroy()}})}},[t]),_=I.useCallback(async()=>{if(!i){if(d&&(await v(d),h(null)),a&&a.tasks&&a.tasks.imported>0){window.location.reload();return}n(!1),c(0),f(""),r(null)}},[i,n,a,d,v]),S=I.useCallback(async()=>{if(!u.includePrompts&&!u.includeProjects&&!u.includeAssets){T.warning("请至少选择一项要备份的内容");return}b(!0),c(0),f("正在准备...");try{const w=await W.exportToZip(u,(y,C)=>{c(y),f(C)});W.downloadZip(w),T.success("备份成功!"),_()}catch(w){console.error("[BackupRestore] Export failed:",w),T.error("备份失败,请重试")}finally{b(!1)}},[u,_]),k=I.useCallback(()=>{var w;(w=g.current)==null||w.click()},[]),U=I.useCallback(async w=>{var C,F;const y=(C=w.target.files)==null?void 0:C[0];if(y){if(!y.name.endsWith(".zip")){T.warning("请选择 ZIP 格式的备份文件");return}b(!0),c(0),f("正在保存当前画板..."),r(null);try{s&&await s(),f("正在读取文件...");const N=await W.importFromZip(y,(J,A)=>{c(J),f(A)});r(N),(F=N.workspaceState)!=null&&F.currentBoardId&&h(N.workspaceState),N.success?T.success("导入成功!"):N.errors.length>0&&T.warning("导入完成,但有部分错误")}catch(N){console.error("[BackupRestore] Import failed:",N),T.error("导入失败,请检查文件格式")}finally{b(!1),g.current&&(g.current.value="")}}},[s]),D=I.useCallback((w,y)=>{p(C=>({...C,[w]:y}))},[]);return l.jsx(le,{open:E,onOpenChange:_,children:l.jsxs(de,{className:"backup-restore-dialog",container:e,children:[l.jsx("h2",{className:"backup-restore-dialog__title",children:"备份 / 恢复"}),l.jsxs("div",{className:"backup-restore-dialog__tabs",children:[l.jsx("button",{className:`backup-restore-dialog__tab ${o==="backup"?"backup-restore-dialog__tab--active":""}`,onClick:()=>m("backup"),disabled:i,children:"备份"}),l.jsx("button",{className:`backup-restore-dialog__tab ${o==="restore"?"backup-restore-dialog__tab--active":""}`,onClick:()=>m("restore"),disabled:i,children:"恢复"})]}),o==="backup"&&l.jsxs("div",{className:"backup-restore-dialog__panel",children:[l.jsx("p",{className:"backup-restore-dialog__description",children:"选择要备份的内容,将导出为 ZIP 压缩包:"}),l.jsxs("div",{className:"backup-restore-dialog__options",children:[l.jsx(Z,{checked:u.includePrompts,onChange:w=>D("includePrompts",w),disabled:i,children:l.jsxs("div",{className:"backup-restore-dialog__option-content",children:[l.jsx("span",{className:"backup-restore-dialog__option-title",children:"提示词"}),l.jsx("span",{className:"backup-restore-dialog__option-desc",children:"包含图片和视频生成的历史提示词"})]})}),l.jsx(Z,{checked:u.includeProjects,onChange:w=>D("includeProjects",w),disabled:i,children:l.jsxs("div",{className:"backup-restore-dialog__option-content",children:[l.jsx("span",{className:"backup-restore-dialog__option-title",children:"项目"}),l.jsx("span",{className:"backup-restore-dialog__option-desc",children:"包含所有文件夹和画板"})]})}),l.jsx(Z,{checked:u.includeAssets,onChange:w=>D("includeAssets",w),disabled:i,children:l.jsxs("div",{className:"backup-restore-dialog__option-content",children:[l.jsx("span",{className:"backup-restore-dialog__option-title",children:"素材库"}),l.jsx("span",{className:"backup-restore-dialog__option-desc",children:"包含所有本地上传的图片和视频"})]})})]}),i&&l.jsxs("div",{className:"backup-restore-dialog__progress",children:[l.jsx(te,{percentage:j,theme:"line"}),l.jsx("span",{className:"backup-restore-dialog__progress-text",children:x})]}),l.jsxs("div",{className:"backup-restore-dialog__actions",children:[l.jsx("button",{className:"backup-restore-dialog__button backup-restore-dialog__button--cancel",onClick:_,disabled:i,children:"取消"}),l.jsx("button",{className:"backup-restore-dialog__button backup-restore-dialog__button--primary",onClick:S,disabled:i,children:i?"正在备份...":"开始备份"})]})]}),o==="restore"&&l.jsxs("div",{className:"backup-restore-dialog__panel",children:[l.jsx("p",{className:"backup-restore-dialog__description",children:"选择备份文件进行恢复,数据将增量导入(不会覆盖现有内容):"}),l.jsxs("div",{className:"backup-restore-dialog__dropzone",onClick:k,children:[l.jsx(pe,{className:"backup-restore-dialog__dropzone-icon"}),l.jsx("span",{className:"backup-restore-dialog__dropzone-text",children:"点击选择备份文件 (.zip)"}),l.jsx("input",{ref:g,type:"file",accept:".zip",onChange:U,style:{display:"none"}})]}),i&&l.jsxs("div",{className:"backup-restore-dialog__progress",children:[l.jsx(te,{percentage:j,theme:"line"}),l.jsx("span",{className:"backup-restore-dialog__progress-text",children:x})]}),a&&l.jsxs("div",{className:"backup-restore-dialog__result",children:[l.jsx("h4",{className:"backup-restore-dialog__result-title",children:a.success?"导入完成":"导入完成(有错误)"}),l.jsxs("ul",{className:"backup-restore-dialog__result-list",children:[(a.prompts.imported>0||a.prompts.skipped>0)&&l.jsxs("li",{children:["提示词:导入 ",a.prompts.imported," 条,跳过 ",a.prompts.skipped," 条"]}),(a.projects.folders>0||a.projects.boards>0||a.projects.merged>0)&&l.jsxs("li",{children:["项目:导入 ",a.projects.folders," 个文件夹,",a.projects.boards," 个画板",a.projects.merged>0&&`,合并 ${a.projects.merged} 个画板`]}),(a.assets.imported>0||a.assets.skipped>0)&&l.jsxs("li",{children:["素材:导入 ",a.assets.imported," 个,跳过 ",a.assets.skipped," 个"]}),a.tasks&&(a.tasks.imported>0||a.tasks.skipped>0)&&l.jsxs("li",{children:["任务:导入 ",a.tasks.imported," 个,跳过 ",a.tasks.skipped," 个"]})]}),a.errors.length>0&&l.jsxs("div",{className:"backup-restore-dialog__result-errors",children:[l.jsx("strong",{children:"错误信息:"}),l.jsx("ul",{children:a.errors.map((w,y)=>l.jsx("li",{children:w},y))})]})]}),l.jsx("div",{className:"backup-restore-dialog__actions",children:l.jsx("button",{className:"backup-restore-dialog__button backup-restore-dialog__button--cancel",onClick:_,disabled:i,children:a?((M=a.tasks)==null?void 0:M.imported)>0?"完成并刷新":"完成":"取消"})})]})]})})};export{ge as BackupRestoreDialog};
1
+ import{a5 as L,a6 as G,a7 as $,a8 as ne,a9 as re,aa as K,ab as P,u as B,ac as H,W as Y,m as V,ad as Q,ae as q,af as X,ag as ee,O,P as R,ah as oe,r as I,Q as T,Z as ce,C as l,E as le,F as de,ai as Z,aj as te}from"./index-BBCAc4Al.js";import{U as pe}from"./upload-B0RQ9yYL.js";const me=2,se="aitu-backup";function ae(E){return E.map(n=>n.id?n:{...n,id:`imported-${Date.now()}-${Math.random().toString(36).slice(2,9)}`})}function z(E){return{"image/jpeg":".jpg","image/jpg":".jpg","image/png":".png","image/gif":".gif","image/webp":".webp","image/svg+xml":".svg","video/mp4":".mp4","video/webm":".webm","video/quicktime":".mov"}[E]||""}function ie(E){return E.replace(/[<>:"/\\|?*]/g,"_").replace(/\s+/g," ").trim()||"unnamed"}class ue{async exportToZip(n,e){const t=new L;e==null||e(5,"正在准备数据...");const s=G.getCurrentBoard(),o={currentBoardId:(s==null?void 0:s.id)||null,currentBoardName:s==null?void 0:s.name,viewport:s==null?void 0:s.viewport},m={signature:se,version:me,createdAt:Date.now(),includes:{prompts:n.includePrompts,projects:n.includeProjects,assets:n.includeAssets},stats:{promptCount:0,videoPromptCount:0,imagePromptCount:0,folderCount:0,boardCount:0,assetCount:0,taskCount:0},workspaceState:o};if(n.includePrompts){e==null||e(10,"正在导出提示词...");const p=await this.collectPromptData();t.file("prompts.json",JSON.stringify(p,null,2)),m.stats.promptCount=p.promptHistory.length,m.stats.videoPromptCount=p.videoPromptHistory.length,m.stats.imagePromptCount=p.imagePromptHistory.length}n.includeProjects&&(e==null||e(25,"正在导出项目..."),await this.exportProjects(t,m,e)),n.includeAssets&&(e==null||e(50,"正在导出素材..."),await this.exportAssets(t,m,e)),e==null||e(80,"正在写入清单..."),t.file("manifest.json",JSON.stringify(m,null,2)),e==null||e(85,"正在压缩文件...");const u=await t.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}},p=>{const i=85+Math.round(p.percent*.14);e==null||e(i,"正在压缩...")});return e==null||e(100,"导出完成"),u}async exportProjects(n,e,t){const s=n.folder("projects");if(!s)return;const[o,m]=await Promise.all([$.loadAllFolders(),$.loadAllBoards()]),u=this.buildFolderPathMap(o);for(const p of o){const i=u.get(p.id)||p.name;s.folder(i)}e.stats.folderCount=o.length;for(let p=0;p<m.length;p++){const i=m[p],b=i.folderId?u.get(i.folderId):null,j=ie(i.name),c=b?`${b}/${j}.drawnix`:`${j}.drawnix`,x={type:ne.drawnix,version:re.drawnix,source:"backup",elements:i.elements||[],viewport:i.viewport||{zoom:1},theme:i.theme,boardMeta:{id:i.id,name:i.name,folderId:i.folderId,order:i.order,createdAt:i.createdAt,updatedAt:i.updatedAt}};if(s.file(c,JSON.stringify(x,null,2)),t&&m.length>0){const f=25+Math.round((p+1)/m.length*20);t(f,`正在导出画板 (${p+1}/${m.length})...`)}}e.stats.boardCount=m.length}buildFolderPathMap(n){const e=new Map,t=new Map;for(const o of n)t.set(o.id,o);const s=o=>{if(e.has(o))return e.get(o);const m=t.get(o);if(!m)return"";const u=ie(m.name);if(m.parentId){const p=s(m.parentId),i=p?`${p}/${u}`:u;return e.set(o,i),i}return e.set(o,u),u};for(const o of n)s(o.id);return e}async exportAssets(n,e,t){var a;const s=n.folder("assets");if(!s)return;const o=new Set;let m=0;const u=K.createInstance({name:P.STORAGE_NAME,storeName:P.STORE_NAME}),p=await u.keys(),i=p.length;for(let r=0;r<p.length;r++){try{const d=await u.getItem(p[r]);if(d){s.file(`${d.id}.meta.json`,JSON.stringify(d,null,2));const h=await B.getCachedBlob(d.url);if(h){const g=z(d.mimeType);s.file(`${d.id}${g}`,h),o.add(d.url),m++}}}catch(d){console.warn(`[BackupRestore] Failed to load asset ${p[r]}:`,d)}if(t&&i>0){const d=50+Math.round((r+1)/i*15);t(d,`正在导出本地素材 (${r+1}/${i})...`)}}const j=(await B.getAllCacheMetadata()).filter(r=>!o.has(r.url)),c=j.length;for(let r=0;r<j.length;r++){const d=j[r];try{const h=((a=d.metadata)==null?void 0:a.taskId)||this.generateIdFromUrl(d.url),g={id:h,url:d.url,type:d.type==="video"?"VIDEO":"IMAGE",mimeType:d.mimeType,size:d.size,source:"AI_GENERATED",createdAt:d.cachedAt,updatedAt:d.lastUsed,metadata:d.metadata};s.file(`${h}.meta.json`,JSON.stringify(g,null,2));const v=await B.getCachedBlob(d.url);if(v){const _=z(d.mimeType);s.file(`${h}${_}`,v),o.add(d.url),m++}}catch(h){console.warn(`[BackupRestore] Failed to export cached media ${d.url}:`,h)}if(t&&c>0){const h=65+Math.round((r+1)/c*10);t(h,`正在导出缓存媒体 (${r+1}/${c})...`)}}e.stats.assetCount=m,t==null||t(75,"正在导出任务数据...");const f=H.getAllTasks().filter(r=>{var d;return r.status===Y.COMPLETED&&(r.type===V.IMAGE||r.type===V.VIDEO)&&((d=r.result)==null?void 0:d.url)});f.length>0&&(n.file("tasks.json",JSON.stringify(f,null,2)),e.stats.taskCount=f.length)}generateIdFromUrl(n){let e=0;for(let t=0;t<n.length;t++){const s=n.charCodeAt(t);e=(e<<5)-e+s,e=e&e}return`cache-${Math.abs(e).toString(36)}`}async importFromZip(n,e){const t={success:!1,prompts:{imported:0,skipped:0},projects:{folders:0,boards:0,merged:0,skipped:0},assets:{imported:0,skipped:0},tasks:{imported:0,skipped:0},errors:[]};try{e==null||e(5,"正在读取文件...");const s=await L.loadAsync(n);e==null||e(10,"正在验证文件格式...");const o=s.file("manifest.json");if(!o)throw new Error("无效的备份文件:未找到 manifest.json");const m=await o.async("string"),u=JSON.parse(m);if(u.signature!==se)throw new Error("无效的备份文件:签名不匹配");if(u.includes.prompts){e==null||e(20,"正在导入提示词...");const p=s.file("prompts.json");if(p){const i=await p.async("string"),b=JSON.parse(i);t.prompts=await this.importPromptData(b)}}u.includes.projects&&(e==null||e(40,"正在导入项目..."),t.projects=await this.importProjects(s,e)),u.includes.assets&&(e==null||e(60,"正在导入素材..."),t.assets=await this.importAssets(s,e),e==null||e(85,"正在导入任务数据..."),t.tasks=await this.importTasks(s)),(t.projects.folders>0||t.projects.boards>0)&&await G.reload(),u.workspaceState&&(t.workspaceState=u.workspaceState),t.success=t.errors.length===0,e==null||e(100,"导入完成")}catch(s){const o=s instanceof Error?s.message:String(s);t.errors.push(o)}return t}downloadZip(n,e){const t=new Date,s=t.toISOString().split("T")[0],o=t.toTimeString().split(" ")[0].replace(/:/g,""),m=`aitu_backup_${s}_${o}.zip`,u=URL.createObjectURL(n),p=document.createElement("a");p.href=u,p.download=e||m,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(u)}async collectPromptData(){await Q();const n=q();let e=X(),t=ee();const s=H.getTasksByStatus(Y.COMPLETED),o=s.filter(c=>{var x;return c.type===V.IMAGE&&((x=c.params)==null?void 0:x.prompt)}).map(c=>({id:`task_${c.id}`,content:c.params.prompt.trim(),timestamp:c.completedAt||c.createdAt})).filter(c=>c.content.length>0),m=s.filter(c=>{var x;return c.type===V.VIDEO&&((x=c.params)==null?void 0:x.prompt)}).map(c=>({id:`task_${c.id}`,content:c.params.prompt.trim(),timestamp:c.completedAt||c.createdAt})).filter(c=>c.content.length>0),u=new Set(t.map(c=>c.content)),p=o.filter(c=>!u.has(c.content));t=[...t,...p];const i=new Set(e.map(c=>c.content)),b=m.filter(c=>!i.has(c.content));e=[...e,...b];const j=await O.get(R.PRESET_SETTINGS);return{promptHistory:n,videoPromptHistory:e,imagePromptHistory:t,presetSettings:j||{image:{pinnedPrompts:[],deletedPrompts:[]},video:{pinnedPrompts:[],deletedPrompts:[]}}}}async importPromptData(n){let e=0,t=0;const s=n.promptHistory||[],o=n.videoPromptHistory||[],m=n.imagePromptHistory||[];await Q();const u=q(),p=X(),i=ee(),b=new Set(u.map(k=>k.id)),j=new Set(u.map(k=>k.content)),c=s.filter(k=>b.has(k.id)||j.has(k.content)?(t++,!1):(e++,!0)),x=new Set(p.map(k=>k.id)),f=new Set(p.map(k=>k.content)),a=o.filter(k=>x.has(k.id)||f.has(k.content)?(t++,!1):(e++,!0)),r=new Set(i.map(k=>k.id)),d=new Set(i.map(k=>k.content)),h=m.filter(k=>r.has(k.id)||d.has(k.content)?(t++,!1):(e++,!0)),g=[...u,...c],v=[...p,...a],_=[...i,...h];await O.set(R.PROMPT_HISTORY,g),await O.set(R.VIDEO_PROMPT_HISTORY,v),await O.set(R.IMAGE_PROMPT_HISTORY,_);const S=await O.get(R.PRESET_SETTINGS);if(S&&n.presetSettings){const k={image:{pinnedPrompts:[...new Set([...S.image.pinnedPrompts,...n.presetSettings.image.pinnedPrompts])],deletedPrompts:[...new Set([...S.image.deletedPrompts,...n.presetSettings.image.deletedPrompts])]},video:{pinnedPrompts:[...new Set([...S.video.pinnedPrompts,...n.presetSettings.video.pinnedPrompts])],deletedPrompts:[...new Set([...S.video.deletedPrompts,...n.presetSettings.video.deletedPrompts])]}};await O.set(R.PRESET_SETTINGS,k)}else n.presetSettings&&await O.set(R.PRESET_SETTINGS,n.presetSettings);return await oe(),{imported:e,skipped:t}}async importProjects(n,e){let t=0,s=0,o=0,m=0;const u=await $.loadAllFolders(),p=await $.loadAllBoards(),i=new Set(p.map(f=>f.id)),b=Object.keys(n.files).filter(f=>f.startsWith("projects/")&&f.endsWith(".drawnix")&&!f.includes("/_"));if(b.length===0)return{folders:0,boards:0,merged:0,skipped:0};const j=new Set,c=new Map;for(const f of b){const r=f.replace(/^projects\//,"").split("/");if(r.length>1){let d="";for(let h=0;h<r.length-1;h++)d=d?`${d}/${r[h]}`:r[h],j.add(d)}}const x=Array.from(j).sort((f,a)=>{const r=f.split("/").length,d=a.split("/").length;return r-d||f.localeCompare(a)});for(let f=0;f<x.length;f++){const a=x[f],r=a.split("/"),d=r[r.length-1],h=r.length>1?r.slice(0,-1).join("/"):null,g=h&&c.get(h)||null,v=this.generateId();c.set(a,v);const _=u.find(k=>k.name===d&&k.parentId===g);if(_){c.set(a,_.id),m++;continue}const S={id:v,name:d,parentId:g,order:f,isExpanded:!0,createdAt:Date.now(),updatedAt:Date.now()};await $.saveFolder(S),t++}for(let f=0;f<b.length;f++){const a=b[f];try{const r=n.file(a);if(r){const d=await r.async("string"),h=JSON.parse(d),g=h.boardMeta,_=a.replace(/^projects\//,"").split("/"),S=_.length>1?_.slice(0,-1).join("/"):null,k=S&&(c.get(S)||(g==null?void 0:g.folderId))||null,U=_[_.length-1]||"unnamed.drawnix",D=(g==null?void 0:g.name)||U.replace(".drawnix","");if(g!=null&&g.id&&i.has(g.id)){const w=p.find(y=>y.id===g.id);if(w){const y=new Set((w.elements||[]).map(A=>A.id).filter(A=>!!A)),F=(h.elements||[]).filter(A=>A.id?!y.has(A.id):!0),N=[...w.elements||[],...ae(F)],J={...w,elements:N,viewport:h.viewport||w.viewport,theme:h.theme||w.theme,updatedAt:Date.now()};await $.saveBoard(J),o++;continue}}const M={id:(g==null?void 0:g.id)||this.generateId(),name:D,folderId:k,order:(g==null?void 0:g.order)??f,elements:ae(h.elements||[]),viewport:h.viewport,theme:h.theme,createdAt:(g==null?void 0:g.createdAt)||Date.now(),updatedAt:(g==null?void 0:g.updatedAt)||Date.now()};await $.saveBoard(M),s++}}catch(r){console.warn(`[BackupRestore] Failed to import board ${a}:`,r)}if(e&&b.length>0){const r=40+Math.round((f+1)/b.length*15);e(r,`正在导入画板 (${f+1}/${b.length})...`)}}return{folders:t,boards:s,merged:o,skipped:m}}async importAssets(n,e){var b,j,c;let t=0,s=0;const o=Object.keys(n.files).filter(x=>x.startsWith("assets/")&&x.endsWith(".meta.json"));if(o.length===0)return{imported:0,skipped:0};const m=K.createInstance({name:P.STORAGE_NAME,storeName:P.STORE_NAME}),u=await m.keys(),p=new Set(u),i=new Set(await B.getAllCachedUrls());for(let x=0;x<o.length;x++){const f=o[x],a=f.replace("assets/","").replace(".meta.json","");try{const r=n.file(f);if(!r){s++;continue}const d=await r.async("string"),h=JSON.parse(d),g=h.source==="AI_GENERATED";if(g){if(i.has(h.url)){s++;continue}}else if(p.has(a)){s++;continue}const v=[".jpg",".png",".gif",".webp",".mp4",".webm",".mov",".svg"];let _=null;for(const S of v){const k=n.file(`assets/${a}${S}`);if(k){_=await k.async("blob");break}}if(!_&&h.mimeType){const S=z(h.mimeType);if(S){const k=n.file(`assets/${a}${S}`);k&&(_=await k.async("blob"))}}if(_){const S=h.type==="VIDEO"?"video":"image";await B.cacheMediaFromBlob(h.url,_,S,{taskId:((b=h.metadata)==null?void 0:b.taskId)||a,prompt:(j=h.metadata)==null?void 0:j.prompt,model:(c=h.metadata)==null?void 0:c.model}),g||await m.setItem(a,h),t++}else console.warn(`[BackupRestore] No media file found for asset ${a}, skipping`),s++}catch(r){console.warn(`[BackupRestore] Failed to import asset ${a}:`,r),s++}if(e&&o.length>0){const r=60+Math.round((x+1)/o.length*35);e(r,`正在导入素材 (${x+1}/${o.length})...`)}}return{imported:t,skipped:s}}async importTasks(n){let e=0,t=0;const s=n.file("tasks.json");if(!s)return{imported:0,skipped:0};try{const o=await s.async("string"),m=JSON.parse(o);if(!Array.isArray(m)||m.length===0)return{imported:0,skipped:0};const u=H.getAllTasks(),p=new Set(u.map(b=>b.id)),i=m.filter(b=>p.has(b.id)?(t++,!1):!0);i.length>0&&(await H.restoreTasks(i),e=i.length)}catch(o){console.warn("[BackupRestore] Failed to import tasks:",o)}return{imported:e,skipped:t}}generateId(){return`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}}const W=new ue,ge=({open:E,onOpenChange:n,container:e,onSwitchBoard:t,onBeforeImport:s})=>{var M;const[o,m]=I.useState("backup"),[u,p]=I.useState({includePrompts:!0,includeProjects:!0,includeAssets:!0}),[i,b]=I.useState(!1),[j,c]=I.useState(0),[x,f]=I.useState(""),[a,r]=I.useState(null),[d,h]=I.useState(null),g=I.useRef(null),v=I.useCallback(async w=>{if(!w.currentBoardId||!t)return;const y=G.getBoard(w.currentBoardId);if(!y)return;const C=G.getCurrentBoard();if(!C||!C.elements||C.elements.length===0)await t(w.currentBoardId,w.viewport),T.success(`已切换到画板「${y.name}」`);else{const N=ce.confirm({header:"恢复画布状态",body:`备份时正在编辑画板「${w.currentBoardName||y.name}」,是否切换到该画板?`,confirmBtn:"切换",cancelBtn:"取消",onConfirm:async()=>{await t(w.currentBoardId,w.viewport),T.success(`已切换到画板「${y.name}」`),N.destroy()},onCancel:()=>{N.destroy()}})}},[t]),_=I.useCallback(async()=>{if(!i){if(d&&(await v(d),h(null)),a&&a.tasks&&a.tasks.imported>0){window.location.reload();return}n(!1),c(0),f(""),r(null)}},[i,n,a,d,v]),S=I.useCallback(async()=>{if(!u.includePrompts&&!u.includeProjects&&!u.includeAssets){T.warning("请至少选择一项要备份的内容");return}b(!0),c(0),f("正在准备...");try{const w=await W.exportToZip(u,(y,C)=>{c(y),f(C)});W.downloadZip(w),T.success("备份成功!"),_()}catch(w){console.error("[BackupRestore] Export failed:",w),T.error("备份失败,请重试")}finally{b(!1)}},[u,_]),k=I.useCallback(()=>{var w;(w=g.current)==null||w.click()},[]),U=I.useCallback(async w=>{var C,F;const y=(C=w.target.files)==null?void 0:C[0];if(y){if(!y.name.endsWith(".zip")){T.warning("请选择 ZIP 格式的备份文件");return}b(!0),c(0),f("正在保存当前画板..."),r(null);try{s&&await s(),f("正在读取文件...");const N=await W.importFromZip(y,(J,A)=>{c(J),f(A)});r(N),(F=N.workspaceState)!=null&&F.currentBoardId&&h(N.workspaceState),N.success?T.success("导入成功!"):N.errors.length>0&&T.warning("导入完成,但有部分错误")}catch(N){console.error("[BackupRestore] Import failed:",N),T.error("导入失败,请检查文件格式")}finally{b(!1),g.current&&(g.current.value="")}}},[s]),D=I.useCallback((w,y)=>{p(C=>({...C,[w]:y}))},[]);return l.jsx(le,{open:E,onOpenChange:_,children:l.jsxs(de,{className:"backup-restore-dialog",container:e,children:[l.jsx("h2",{className:"backup-restore-dialog__title",children:"备份 / 恢复"}),l.jsxs("div",{className:"backup-restore-dialog__tabs",children:[l.jsx("button",{className:`backup-restore-dialog__tab ${o==="backup"?"backup-restore-dialog__tab--active":""}`,onClick:()=>m("backup"),disabled:i,children:"备份"}),l.jsx("button",{className:`backup-restore-dialog__tab ${o==="restore"?"backup-restore-dialog__tab--active":""}`,onClick:()=>m("restore"),disabled:i,children:"恢复"})]}),o==="backup"&&l.jsxs("div",{className:"backup-restore-dialog__panel",children:[l.jsx("p",{className:"backup-restore-dialog__description",children:"选择要备份的内容,将导出为 ZIP 压缩包:"}),l.jsxs("div",{className:"backup-restore-dialog__options",children:[l.jsx(Z,{checked:u.includePrompts,onChange:w=>D("includePrompts",w),disabled:i,children:l.jsxs("div",{className:"backup-restore-dialog__option-content",children:[l.jsx("span",{className:"backup-restore-dialog__option-title",children:"提示词"}),l.jsx("span",{className:"backup-restore-dialog__option-desc",children:"包含图片和视频生成的历史提示词"})]})}),l.jsx(Z,{checked:u.includeProjects,onChange:w=>D("includeProjects",w),disabled:i,children:l.jsxs("div",{className:"backup-restore-dialog__option-content",children:[l.jsx("span",{className:"backup-restore-dialog__option-title",children:"项目"}),l.jsx("span",{className:"backup-restore-dialog__option-desc",children:"包含所有文件夹和画板"})]})}),l.jsx(Z,{checked:u.includeAssets,onChange:w=>D("includeAssets",w),disabled:i,children:l.jsxs("div",{className:"backup-restore-dialog__option-content",children:[l.jsx("span",{className:"backup-restore-dialog__option-title",children:"素材库"}),l.jsx("span",{className:"backup-restore-dialog__option-desc",children:"包含所有本地上传的图片和视频"})]})})]}),i&&l.jsxs("div",{className:"backup-restore-dialog__progress",children:[l.jsx(te,{percentage:j,theme:"line"}),l.jsx("span",{className:"backup-restore-dialog__progress-text",children:x})]}),l.jsxs("div",{className:"backup-restore-dialog__actions",children:[l.jsx("button",{className:"backup-restore-dialog__button backup-restore-dialog__button--cancel",onClick:_,disabled:i,children:"取消"}),l.jsx("button",{className:"backup-restore-dialog__button backup-restore-dialog__button--primary",onClick:S,disabled:i,children:i?"正在备份...":"开始备份"})]})]}),o==="restore"&&l.jsxs("div",{className:"backup-restore-dialog__panel",children:[l.jsx("p",{className:"backup-restore-dialog__description",children:"选择备份文件进行恢复,数据将增量导入(不会覆盖现有内容):"}),l.jsxs("div",{className:"backup-restore-dialog__dropzone",onClick:k,children:[l.jsx(pe,{className:"backup-restore-dialog__dropzone-icon"}),l.jsx("span",{className:"backup-restore-dialog__dropzone-text",children:"点击选择备份文件 (.zip)"}),l.jsx("input",{ref:g,type:"file",accept:".zip",onChange:U,style:{display:"none"}})]}),i&&l.jsxs("div",{className:"backup-restore-dialog__progress",children:[l.jsx(te,{percentage:j,theme:"line"}),l.jsx("span",{className:"backup-restore-dialog__progress-text",children:x})]}),a&&l.jsxs("div",{className:"backup-restore-dialog__result",children:[l.jsx("h4",{className:"backup-restore-dialog__result-title",children:a.success?"导入完成":"导入完成(有错误)"}),l.jsxs("ul",{className:"backup-restore-dialog__result-list",children:[(a.prompts.imported>0||a.prompts.skipped>0)&&l.jsxs("li",{children:["提示词:导入 ",a.prompts.imported," 条,跳过 ",a.prompts.skipped," 条"]}),(a.projects.folders>0||a.projects.boards>0||a.projects.merged>0)&&l.jsxs("li",{children:["项目:导入 ",a.projects.folders," 个文件夹,",a.projects.boards," 个画板",a.projects.merged>0&&`,合并 ${a.projects.merged} 个画板`]}),(a.assets.imported>0||a.assets.skipped>0)&&l.jsxs("li",{children:["素材:导入 ",a.assets.imported," 个,跳过 ",a.assets.skipped," 个"]}),a.tasks&&(a.tasks.imported>0||a.tasks.skipped>0)&&l.jsxs("li",{children:["任务:导入 ",a.tasks.imported," 个,跳过 ",a.tasks.skipped," 个"]})]}),a.errors.length>0&&l.jsxs("div",{className:"backup-restore-dialog__result-errors",children:[l.jsx("strong",{children:"错误信息:"}),l.jsx("ul",{children:a.errors.map((w,y)=>l.jsx("li",{children:w},y))})]})]}),l.jsx("div",{className:"backup-restore-dialog__actions",children:l.jsx("button",{className:"backup-restore-dialog__button backup-restore-dialog__button--cancel",onClick:_,disabled:i,children:a?((M=a.tasks)==null?void 0:M.imported)>0?"完成并刷新":"完成":"取消"})})]})]})})};export{ge as BackupRestoreDialog};
@@ -1,3 +1,3 @@
1
- import{cW as Cn,cX as Tn,cY as Fn,cZ as jt}from"./index-DWUAFoZG.js";import{t as Qt,e as Bn,b as rt,i as jn}from"./index-BicRPzXC.js";import{d as Zn}from"./index.dom-C3-224fz.js";function Sn(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?it(n.position):"start"in n||"end"in n?it(n):"line"in n||"column"in n?Qn(n):""}function Qn(n){return ut(n&&n.line)+":"+ut(n&&n.column)}function it(n){return Qn(n&&n.start)+"-"+Qn(n&&n.end)}function ut(n){return n&&typeof n=="number"?n:1}class $ extends Error{constructor(e,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let u="",i={},l=!1;if(t&&("line"in t&&"column"in t?i={place:t}:"start"in t&&"end"in t?i={place:t}:"type"in t?i={ancestors:[t],place:t.position}:i={...t}),typeof e=="string"?u=e:!i.cause&&e&&(l=!0,u=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const p=r.indexOf(":");p===-1?i.ruleId=r:(i.source=r.slice(0,p),i.ruleId=r.slice(p+1))}if(!i.place&&i.ancestors&&i.ancestors){const p=i.ancestors[i.ancestors.length-1];p&&(i.place=p.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=u,this.line=a?a.line:void 0,this.name=Sn(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}$.prototype.file="";$.prototype.name="";$.prototype.reason="";$.prototype.message="";$.prototype.stack="";$.prototype.column=void 0;$.prototype.line=void 0;$.prototype.ancestors=void 0;$.prototype.cause=void 0;$.prototype.fatal=void 0;$.prototype.place=void 0;$.prototype.ruleId=void 0;$.prototype.source=void 0;const tn={basename:Ut,dirname:Wt,extname:Yt,join:$t,sep:"/"};function Ut(n,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');En(n);let t=0,r=-1,u=n.length,i;if(e===void 0||e.length===0||e.length>n.length){for(;u--;)if(n.codePointAt(u)===47){if(i){t=u+1;break}}else r<0&&(i=!0,r=u+1);return r<0?"":n.slice(t,r)}if(e===n)return"";let l=-1,a=e.length-1;for(;u--;)if(n.codePointAt(u)===47){if(i){t=u+1;break}}else l<0&&(i=!0,l=u+1),a>-1&&(n.codePointAt(u)===e.codePointAt(a--)?a<0&&(r=u):(a=-1,r=l));return t===r?r=l:r<0&&(r=n.length),n.slice(t,r)}function Wt(n){if(En(n),n.length===0)return".";let e=-1,t=n.length,r;for(;--t;)if(n.codePointAt(t)===47){if(r){e=t;break}}else r||(r=!0);return e<0?n.codePointAt(0)===47?"/":".":e===1&&n.codePointAt(0)===47?"//":n.slice(0,e)}function Yt(n){En(n);let e=n.length,t=-1,r=0,u=-1,i=0,l;for(;e--;){const a=n.codePointAt(e);if(a===47){if(l){r=e+1;break}continue}t<0&&(l=!0,t=e+1),a===46?u<0?u=e:i!==1&&(i=1):u>-1&&(i=-1)}return u<0||t<0||i===0||i===1&&u===t-1&&u===r+1?"":n.slice(u,t)}function $t(...n){let e=-1,t;for(;++e<n.length;)En(n[e]),n[e]&&(t=t===void 0?n[e]:t+"/"+n[e]);return t===void 0?".":Zt(t)}function Zt(n){En(n);const e=n.codePointAt(0)===47;let t=Gt(n,!e);return t.length===0&&!e&&(t="."),t.length>0&&n.codePointAt(n.length-1)===47&&(t+="/"),e?"/"+t:t}function Gt(n,e){let t="",r=0,u=-1,i=0,l=-1,a,p;for(;++l<=n.length;){if(l<n.length)a=n.codePointAt(l);else{if(a===47)break;a=47}if(a===47){if(!(u===l-1||i===1))if(u!==l-1&&i===2){if(t.length<2||r!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(p=t.lastIndexOf("/"),p!==t.length-1){p<0?(t="",r=0):(t=t.slice(0,p),r=t.length-1-t.lastIndexOf("/")),u=l,i=0;continue}}else if(t.length>0){t="",r=0,u=l,i=0;continue}}e&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+n.slice(u+1,l):t=n.slice(u+1,l),r=l-u-1;u=l,i=0}else a===46&&i>-1?i++:i=-1}return t}function En(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const Jt={cwd:Xt};function Xt(){return"/"}function Un(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function Kt(n){if(typeof n=="string")n=new URL(n);else if(!Un(n)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(n.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return vt(n)}function vt(n){if(n.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=n.pathname;let t=-1;for(;++t<e.length;)if(e.codePointAt(t)===37&&e.codePointAt(t+1)===50){const r=e.codePointAt(t+2);if(r===70||r===102){const u=new TypeError("File URL path must not include encoded / characters");throw u.code="ERR_INVALID_FILE_URL_PATH",u}}return decodeURIComponent(e)}const Mn=["history","path","basename","stem","extname","dirname"];class ne{constructor(e){let t;e?Un(e)?t={path:e}:typeof e=="string"||te(e)?t={value:e}:t=e:t={},this.cwd="cwd"in t?"":Jt.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Mn.length;){const i=Mn[r];i in t&&t[i]!==void 0&&t[i]!==null&&(this[i]=i==="history"?[...t[i]]:t[i])}let u;for(u in t)Mn.includes(u)||(this[u]=t[u])}get basename(){return typeof this.path=="string"?tn.basename(this.path):void 0}set basename(e){Rn(e,"basename"),Nn(e,"basename"),this.path=tn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?tn.dirname(this.path):void 0}set dirname(e){lt(this.basename,"dirname"),this.path=tn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?tn.extname(this.path):void 0}set extname(e){if(Nn(e,"extname"),lt(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=tn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Un(e)&&(e=Kt(e)),Rn(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?tn.basename(this.path,this.extname):void 0}set stem(e){Rn(e,"stem"),Nn(e,"stem"),this.path=tn.join(this.dirname||"",e+(this.extname||""))}fail(e,t,r){const u=this.message(e,t,r);throw u.fatal=!0,u}info(e,t,r){const u=this.message(e,t,r);return u.fatal=void 0,u}message(e,t,r){const u=new $(e,t,r);return this.path&&(u.name=this.path+":"+u.name,u.file=this.path),u.fatal=!1,this.messages.push(u),u}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Nn(n,e){if(n&&n.includes(tn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+tn.sep+"`")}function Rn(n,e){if(!n)throw new Error("`"+e+"` cannot be empty")}function lt(n,e){if(!n)throw new Error("Setting `"+e+"` requires `path` to be set too")}function te(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const ee=(function(n){const r=this.constructor.prototype,u=r[n],i=function(){return u.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),re={}.hasOwnProperty;class Gn extends ee{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Qt()}copy(){const e=new Gn;let t=-1;for(;++t<this.attachers.length;){const r=this.attachers[t];e.use(...r)}return e.data(Bn(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(On("data",this.frozen),this.namespace[e]=t,this):re.call(this.namespace,e)&&this.namespace[e]||void 0:e?(On("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const u=t.call(e,...r);typeof u=="function"&&this.transformers.use(u)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=An(e),r=this.parser||this.Parser;return Dn("parse",r),r(String(t),t)}process(e,t){const r=this;return this.freeze(),Dn("process",this.parser||this.Parser),Vn("process",this.compiler||this.Compiler),t?u(void 0,t):new Promise(u);function u(i,l){const a=An(e),p=r.parse(a);r.run(p,a,function(m,f,g){if(m||!f||!g)return s(m);const h=f,C=r.stringify(h,g);le(C)?g.value=C:g.result=C,s(m,g)});function s(m,f){m||!f?l(m):i?i(f):t(void 0,f)}}}processSync(e){let t=!1,r;return this.freeze(),Dn("processSync",this.parser||this.Parser),Vn("processSync",this.compiler||this.Compiler),this.process(e,u),st("processSync","process",t),r;function u(i,l){t=!0,rt(i),r=l}}run(e,t,r){at(e),this.freeze();const u=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?i(void 0,r):new Promise(i);function i(l,a){const p=An(t);u.run(e,p,s);function s(m,f,g){const h=f||e;m?a(m):l?l(h):r(void 0,h,g)}}}runSync(e,t){let r=!1,u;return this.run(e,t,i),st("runSync","run",r),u;function i(l,a){rt(l),u=a,r=!0}}stringify(e,t){this.freeze();const r=An(t),u=this.compiler||this.Compiler;return Vn("stringify",u),at(e),u(e,r)}use(e,...t){const r=this.attachers,u=this.namespace;if(On("use",this.frozen),e!=null)if(typeof e=="function")p(e,t);else if(typeof e=="object")Array.isArray(e)?a(e):l(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(s){if(typeof s=="function")p(s,[]);else if(typeof s=="object")if(Array.isArray(s)){const[m,...f]=s;p(m,f)}else l(s);else throw new TypeError("Expected usable value, not `"+s+"`")}function l(s){if(!("plugins"in s)&&!("settings"in s))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(s.plugins),s.settings&&(u.settings=Bn(!0,u.settings,s.settings))}function a(s){let m=-1;if(s!=null)if(Array.isArray(s))for(;++m<s.length;){const f=s[m];i(f)}else throw new TypeError("Expected a list of plugins, not `"+s+"`")}function p(s,m){let f=-1,g=-1;for(;++f<r.length;)if(r[f][0]===s){g=f;break}if(g===-1)r.push([s,...m]);else if(m.length>0){let[h,...C]=m;const F=r[g][1];jn(F)&&jn(h)&&(h=Bn(!0,F,h)),r[g]=[s,h,...C]}}}}const ie=new Gn().freeze();function Dn(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function Vn(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function On(n,e){if(e)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function at(n){if(!jn(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function st(n,e,t){if(!t)throw new Error("`"+n+"` finished async. Use `"+e+"` instead")}function An(n){return ue(n)?n:new ne(n)}function ue(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function le(n){return typeof n=="string"||ae(n)}function ae(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const se={};function oe(n,e){const t=se,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,u=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return bt(n,r,u)}function bt(n,e,t){if(ce(n)){if("value"in n)return n.type==="html"&&!t?"":n.value;if(e&&"alt"in n&&n.alt)return n.alt;if("children"in n)return ot(n.children,e,t)}return Array.isArray(n)?ot(n,e,t):""}function ot(n,e,t){const r=[];let u=-1;for(;++u<n.length;)r[u]=bt(n[u],e,t);return r.join("")}function ce(n){return!!(n&&typeof n=="object")}function rn(n,e,t,r){const u=n.length;let i=0,l;if(e<0?e=-e>u?0:u+e:e=e>u?u:e,t=t>0?t:0,r.length<1e4)l=Array.from(r),l.unshift(e,t),n.splice(...l);else for(t&&n.splice(e,t);i<r.length;)l=r.slice(i,i+1e4),l.unshift(e,0),n.splice(...l),i+=1e4,e+=1e4}function G(n,e){return n.length>0?(rn(n,n.length,0,e),n):e}const ct={}.hasOwnProperty;function he(n){const e={};let t=-1;for(;++t<n.length;)fe(e,n[t]);return e}function fe(n,e){let t;for(t in e){const u=(ct.call(n,t)?n[t]:void 0)||(n[t]={}),i=e[t];let l;if(i)for(l in i){ct.call(u,l)||(u[l]=[]);const a=i[l];pe(u[l],Array.isArray(a)?a:a?[a]:[])}}}function pe(n,e){let t=-1;const r=[];for(;++t<e.length;)(e[t].add==="after"?n:r).push(e[t]);rn(n,0,0,r)}function wt(n,e){const t=Number.parseInt(n,e);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function xn(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const en=hn(/[A-Za-z]/),nn=hn(/[\dA-Za-z]/),me=hn(/[#-'*+\--9=?A-Z^-~]/);function Wn(n){return n!==null&&(n<32||n===127)}const Yn=hn(/\d/),ge=hn(/[\dA-Fa-f]/),de=hn(/[!-/:-@[-`{-~]/);function I(n){return n!==null&&n<-2}function Y(n){return n!==null&&(n<0||n===32)}function P(n){return n===-2||n===-1||n===32}const xe=hn(new RegExp("\\p{P}|\\p{S}","u")),ke=hn(/\s/);function hn(n){return e;function e(t){return t!==null&&t>-1&&n.test(String.fromCharCode(t))}}function R(n,e,t,r){const u=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(p){return P(p)?(n.enter(t),a(p)):e(p)}function a(p){return P(p)&&i++<u?(n.consume(p),a):(n.exit(t),e(p))}}const ye={tokenize:be};function be(n){const e=n.attempt(this.parser.constructs.contentInitial,r,u);let t;return e;function r(a){if(a===null){n.consume(a);return}return n.enter("lineEnding"),n.consume(a),n.exit("lineEnding"),R(n,e,"linePrefix")}function u(a){return n.enter("paragraph"),i(a)}function i(a){const p=n.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=p),t=p,l(a)}function l(a){if(a===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(a);return}return I(a)?(n.consume(a),n.exit("chunkText"),i):(n.consume(a),l)}}const we={tokenize:Se},ht={tokenize:Ie};function Se(n){const e=this,t=[];let r=0,u,i,l;return a;function a(b){if(r<t.length){const L=t[r];return e.containerState=L[1],n.attempt(L[0].continuation,p,s)(b)}return s(b)}function p(b){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,u&&D();const L=e.events.length;let B=L,x;for(;B--;)if(e.events[B][0]==="exit"&&e.events[B][1].type==="chunkFlow"){x=e.events[B][1].end;break}y(r);let A=L;for(;A<e.events.length;)e.events[A][1].end={...x},A++;return rn(e.events,B+1,0,e.events.slice(L)),e.events.length=A,s(b)}return a(b)}function s(b){if(r===t.length){if(!u)return g(b);if(u.currentConstruct&&u.currentConstruct.concrete)return C(b);e.interrupt=!!(u.currentConstruct&&!u._gfmTableDynamicInterruptHack)}return e.containerState={},n.check(ht,m,f)(b)}function m(b){return u&&D(),y(r),g(b)}function f(b){return e.parser.lazy[e.now().line]=r!==t.length,l=e.now().offset,C(b)}function g(b){return e.containerState={},n.attempt(ht,h,C)(b)}function h(b){return r++,t.push([e.currentConstruct,e.containerState]),g(b)}function C(b){if(b===null){u&&D(),y(0),n.consume(b);return}return u=u||e.parser.flow(e.now()),n.enter("chunkFlow",{_tokenizer:u,contentType:"flow",previous:i}),F(b)}function F(b){if(b===null){E(n.exit("chunkFlow"),!0),y(0),n.consume(b);return}return I(b)?(n.consume(b),E(n.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(n.consume(b),F)}function E(b,L){const B=e.sliceStream(b);if(L&&B.push(null),b.previous=i,i&&(i.next=b),i=b,u.defineSkip(b.start),u.write(B),e.parser.lazy[b.start.line]){let x=u.events.length;for(;x--;)if(u.events[x][1].start.offset<l&&(!u.events[x][1].end||u.events[x][1].end.offset>l))return;const A=e.events.length;let q=A,M,V;for(;q--;)if(e.events[q][0]==="exit"&&e.events[q][1].type==="chunkFlow"){if(M){V=e.events[q][1].end;break}M=!0}for(y(r),x=A;x<e.events.length;)e.events[x][1].end={...V},x++;rn(e.events,q+1,0,e.events.slice(A)),e.events.length=x}}function y(b){let L=t.length;for(;L-- >b;){const B=t[L];e.containerState=B[1],B[0].exit.call(e,n)}t.length=b}function D(){u.write([null]),i=void 0,u=void 0,e.containerState._closeFlow=void 0}}function Ie(n,e,t){return R(n,n.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ft(n){if(n===null||Y(n)||ke(n))return 1;if(xe(n))return 2}function Jn(n,e,t){const r=[];let u=-1;for(;++u<n.length;){const i=n[u].resolveAll;i&&!r.includes(i)&&(e=i(e,t),r.push(i))}return e}const $n={name:"attention",resolveAll:Ee,tokenize:ze};function Ee(n,e){let t=-1,r,u,i,l,a,p,s,m;for(;++t<n.length;)if(n[t][0]==="enter"&&n[t][1].type==="attentionSequence"&&n[t][1]._close){for(r=t;r--;)if(n[r][0]==="exit"&&n[r][1].type==="attentionSequence"&&n[r][1]._open&&e.sliceSerialize(n[r][1]).charCodeAt(0)===e.sliceSerialize(n[t][1]).charCodeAt(0)){if((n[r][1]._close||n[t][1]._open)&&(n[t][1].end.offset-n[t][1].start.offset)%3&&!((n[r][1].end.offset-n[r][1].start.offset+n[t][1].end.offset-n[t][1].start.offset)%3))continue;p=n[r][1].end.offset-n[r][1].start.offset>1&&n[t][1].end.offset-n[t][1].start.offset>1?2:1;const f={...n[r][1].end},g={...n[t][1].start};pt(f,-p),pt(g,p),l={type:p>1?"strongSequence":"emphasisSequence",start:f,end:{...n[r][1].end}},a={type:p>1?"strongSequence":"emphasisSequence",start:{...n[t][1].start},end:g},i={type:p>1?"strongText":"emphasisText",start:{...n[r][1].end},end:{...n[t][1].start}},u={type:p>1?"strong":"emphasis",start:{...l.start},end:{...a.end}},n[r][1].end={...l.start},n[t][1].start={...a.end},s=[],n[r][1].end.offset-n[r][1].start.offset&&(s=G(s,[["enter",n[r][1],e],["exit",n[r][1],e]])),s=G(s,[["enter",u,e],["enter",l,e],["exit",l,e],["enter",i,e]]),s=G(s,Jn(e.parser.constructs.insideSpan.null,n.slice(r+1,t),e)),s=G(s,[["exit",i,e],["enter",a,e],["exit",a,e],["exit",u,e]]),n[t][1].end.offset-n[t][1].start.offset?(m=2,s=G(s,[["enter",n[t][1],e],["exit",n[t][1],e]])):m=0,rn(n,r-1,t-r+3,s),t=r+s.length-m-2;break}}for(t=-1;++t<n.length;)n[t][1].type==="attentionSequence"&&(n[t][1].type="data");return n}function ze(n,e){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,u=ft(r);let i;return l;function l(p){return i=p,n.enter("attentionSequence"),a(p)}function a(p){if(p===i)return n.consume(p),a;const s=n.exit("attentionSequence"),m=ft(p),f=!m||m===2&&u||t.includes(p),g=!u||u===2&&m||t.includes(r);return s._open=!!(i===42?f:f&&(u||!g)),s._close=!!(i===42?g:g&&(m||!f)),e(p)}}function pt(n,e){n.column+=e,n.offset+=e,n._bufferIndex+=e}const Ce={name:"autolink",tokenize:Te};function Te(n,e,t){let r=0;return u;function u(h){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(h),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),i}function i(h){return en(h)?(n.consume(h),l):h===64?t(h):s(h)}function l(h){return h===43||h===45||h===46||nn(h)?(r=1,a(h)):s(h)}function a(h){return h===58?(n.consume(h),r=0,p):(h===43||h===45||h===46||nn(h))&&r++<32?(n.consume(h),a):(r=0,s(h))}function p(h){return h===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(h),n.exit("autolinkMarker"),n.exit("autolink"),e):h===null||h===32||h===60||Wn(h)?t(h):(n.consume(h),p)}function s(h){return h===64?(n.consume(h),m):me(h)?(n.consume(h),s):t(h)}function m(h){return nn(h)?f(h):t(h)}function f(h){return h===46?(n.consume(h),r=0,m):h===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(h),n.exit("autolinkMarker"),n.exit("autolink"),e):g(h)}function g(h){if((h===45||nn(h))&&r++<63){const C=h===45?g:f;return n.consume(h),C}return t(h)}}const Pn={partial:!0,tokenize:Fe};function Fe(n,e,t){return r;function r(i){return P(i)?R(n,u,"linePrefix")(i):u(i)}function u(i){return i===null||I(i)?e(i):t(i)}}const St={continuation:{tokenize:_e},exit:Le,name:"blockQuote",tokenize:Ae};function Ae(n,e,t){const r=this;return u;function u(l){if(l===62){const a=r.containerState;return a.open||(n.enter("blockQuote",{_container:!0}),a.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(l),n.exit("blockQuoteMarker"),i}return t(l)}function i(l){return P(l)?(n.enter("blockQuotePrefixWhitespace"),n.consume(l),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),e):(n.exit("blockQuotePrefix"),e(l))}}function _e(n,e,t){const r=this;return u;function u(l){return P(l)?R(n,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):i(l)}function i(l){return n.attempt(St,e,t)(l)}}function Le(n){n.exit("blockQuote")}const It={name:"characterEscape",tokenize:Pe};function Pe(n,e,t){return r;function r(i){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(i),n.exit("escapeMarker"),u}function u(i){return de(i)?(n.enter("characterEscapeValue"),n.consume(i),n.exit("characterEscapeValue"),n.exit("characterEscape"),e):t(i)}}const Et={name:"characterReference",tokenize:Be};function Be(n,e,t){const r=this;let u=0,i,l;return a;function a(f){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(f),n.exit("characterReferenceMarker"),p}function p(f){return f===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(f),n.exit("characterReferenceMarkerNumeric"),s):(n.enter("characterReferenceValue"),i=31,l=nn,m(f))}function s(f){return f===88||f===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(f),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),i=6,l=ge,m):(n.enter("characterReferenceValue"),i=7,l=Yn,m(f))}function m(f){if(f===59&&u){const g=n.exit("characterReferenceValue");return l===nn&&!Zn(r.sliceSerialize(g))?t(f):(n.enter("characterReferenceMarker"),n.consume(f),n.exit("characterReferenceMarker"),n.exit("characterReference"),e)}return l(f)&&u++<i?(n.consume(f),m):t(f)}}const mt={partial:!0,tokenize:Ne},gt={concrete:!0,name:"codeFenced",tokenize:Me};function Me(n,e,t){const r=this,u={partial:!0,tokenize:B};let i=0,l=0,a;return p;function p(x){return s(x)}function s(x){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,a=x,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),m(x)}function m(x){return x===a?(l++,n.consume(x),m):l<3?t(x):(n.exit("codeFencedFenceSequence"),P(x)?R(n,f,"whitespace")(x):f(x))}function f(x){return x===null||I(x)?(n.exit("codeFencedFence"),r.interrupt?e(x):n.check(mt,F,L)(x)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||I(x)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),f(x)):P(x)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),R(n,h,"whitespace")(x)):x===96&&x===a?t(x):(n.consume(x),g)}function h(x){return x===null||I(x)?f(x):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),C(x))}function C(x){return x===null||I(x)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),f(x)):x===96&&x===a?t(x):(n.consume(x),C)}function F(x){return n.attempt(u,L,E)(x)}function E(x){return n.enter("lineEnding"),n.consume(x),n.exit("lineEnding"),y}function y(x){return i>0&&P(x)?R(n,D,"linePrefix",i+1)(x):D(x)}function D(x){return x===null||I(x)?n.check(mt,F,L)(x):(n.enter("codeFlowValue"),b(x))}function b(x){return x===null||I(x)?(n.exit("codeFlowValue"),D(x)):(n.consume(x),b)}function L(x){return n.exit("codeFenced"),e(x)}function B(x,A,q){let M=0;return V;function V(_){return x.enter("lineEnding"),x.consume(_),x.exit("lineEnding"),S}function S(_){return x.enter("codeFencedFence"),P(_)?R(x,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):w(_)}function w(_){return _===a?(x.enter("codeFencedFenceSequence"),O(_)):q(_)}function O(_){return _===a?(M++,x.consume(_),O):M>=l?(x.exit("codeFencedFenceSequence"),P(_)?R(x,H,"whitespace")(_):H(_)):q(_)}function H(_){return _===null||I(_)?(x.exit("codeFencedFence"),A(_)):q(_)}}}function Ne(n,e,t){const r=this;return u;function u(l){return l===null?t(l):(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?t(l):e(l)}}const qn={name:"codeIndented",tokenize:De},Re={partial:!0,tokenize:Ve};function De(n,e,t){const r=this;return u;function u(s){return n.enter("codeIndented"),R(n,i,"linePrefix",5)(s)}function i(s){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(s):t(s)}function l(s){return s===null?p(s):I(s)?n.attempt(Re,l,p)(s):(n.enter("codeFlowValue"),a(s))}function a(s){return s===null||I(s)?(n.exit("codeFlowValue"),l(s)):(n.consume(s),a)}function p(s){return n.exit("codeIndented"),e(s)}}function Ve(n,e,t){const r=this;return u;function u(l){return r.parser.lazy[r.now().line]?t(l):I(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),u):R(n,i,"linePrefix",5)(l)}function i(l){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(l):I(l)?u(l):t(l)}}const Oe={name:"codeText",previous:He,resolve:qe,tokenize:je};function qe(n){let e=n.length-4,t=3,r,u;if((n[t][1].type==="lineEnding"||n[t][1].type==="space")&&(n[e][1].type==="lineEnding"||n[e][1].type==="space")){for(r=t;++r<e;)if(n[r][1].type==="codeTextData"){n[t][1].type="codeTextPadding",n[e][1].type="codeTextPadding",t+=2,e-=2;break}}for(r=t-1,e++;++r<=e;)u===void 0?r!==e&&n[r][1].type!=="lineEnding"&&(u=r):(r===e||n[r][1].type==="lineEnding")&&(n[u][1].type="codeTextData",r!==u+2&&(n[u][1].end=n[r-1][1].end,n.splice(u+2,r-u-2),e-=r-u-2,r=u+2),u=void 0);return n}function He(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function je(n,e,t){let r=0,u,i;return l;function l(f){return n.enter("codeText"),n.enter("codeTextSequence"),a(f)}function a(f){return f===96?(n.consume(f),r++,a):(n.exit("codeTextSequence"),p(f))}function p(f){return f===null?t(f):f===32?(n.enter("space"),n.consume(f),n.exit("space"),p):f===96?(i=n.enter("codeTextSequence"),u=0,m(f)):I(f)?(n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),p):(n.enter("codeTextData"),s(f))}function s(f){return f===null||f===32||f===96||I(f)?(n.exit("codeTextData"),p(f)):(n.consume(f),s)}function m(f){return f===96?(n.consume(f),u++,m):u===r?(n.exit("codeTextSequence"),n.exit("codeText"),e(f)):(i.type="codeTextData",s(f))}}class Qe{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const r=t??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,t,r){const u=t||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-u,Number.POSITIVE_INFINITY);return r&&wn(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),wn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);wn(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);wn(this.left,t.reverse())}}}function wn(n,e){let t=0;if(e.length<1e4)n.push(...e);else for(;t<e.length;)n.push(...e.slice(t,t+1e4)),t+=1e4}function zt(n){const e={};let t=-1,r,u,i,l,a,p,s;const m=new Qe(n);for(;++t<m.length;){for(;t in e;)t=e[t];if(r=m.get(t),t&&r[1].type==="chunkFlow"&&m.get(t-1)[1].type==="listItemPrefix"&&(p=r[1]._tokenizer.events,i=0,i<p.length&&p[i][1].type==="lineEndingBlank"&&(i+=2),i<p.length&&p[i][1].type==="content"))for(;++i<p.length&&p[i][1].type!=="content";)p[i][1].type==="chunkText"&&(p[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,Ue(m,t)),t=e[t],s=!0);else if(r[1]._container){for(i=t,u=void 0;i--;)if(l=m.get(i),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(u&&(m.get(u)[1].type="lineEndingBlank"),l[1].type="lineEnding",u=i);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;u&&(r[1].end={...m.get(u)[1].start},a=m.slice(u,t),a.unshift(r),m.splice(u,t-u+1,a))}}return rn(n,0,Number.POSITIVE_INFINITY,m.slice(0)),!s}function Ue(n,e){const t=n.get(e)[1],r=n.get(e)[2];let u=e-1;const i=[];let l=t._tokenizer;l||(l=r.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const a=l.events,p=[],s={};let m,f,g=-1,h=t,C=0,F=0;const E=[F];for(;h;){for(;n.get(++u)[1]!==h;);i.push(u),h._tokenizer||(m=r.sliceStream(h),h.next||m.push(null),f&&l.defineSkip(h.start),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(m),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=t;++g<a.length;)a[g][0]==="exit"&&a[g-1][0]==="enter"&&a[g][1].type===a[g-1][1].type&&a[g][1].start.line!==a[g][1].end.line&&(F=g+1,E.push(F),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(l.events=[],h?(h._tokenizer=void 0,h.previous=void 0):E.pop(),g=E.length;g--;){const y=a.slice(E[g],E[g+1]),D=i.pop();p.push([D,D+y.length-1]),n.splice(D,2,y)}for(p.reverse(),g=-1;++g<p.length;)s[C+p[g][0]]=C+p[g][1],C+=p[g][1]-p[g][0]-1;return s}const We={resolve:$e,tokenize:Ze},Ye={partial:!0,tokenize:Ge};function $e(n){return zt(n),n}function Ze(n,e){let t;return r;function r(a){return n.enter("content"),t=n.enter("chunkContent",{contentType:"content"}),u(a)}function u(a){return a===null?i(a):I(a)?n.check(Ye,l,i)(a):(n.consume(a),u)}function i(a){return n.exit("chunkContent"),n.exit("content"),e(a)}function l(a){return n.consume(a),n.exit("chunkContent"),t.next=n.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,u}}function Ge(n,e,t){const r=this;return u;function u(l){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),R(n,i,"linePrefix")}function i(l){if(l===null||I(l))return t(l);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(l):n.interrupt(r.parser.constructs.flow,t,e)(l)}}function Ct(n,e,t,r,u,i,l,a,p){const s=p||Number.POSITIVE_INFINITY;let m=0;return f;function f(y){return y===60?(n.enter(r),n.enter(u),n.enter(i),n.consume(y),n.exit(i),g):y===null||y===32||y===41||Wn(y)?t(y):(n.enter(r),n.enter(l),n.enter(a),n.enter("chunkString",{contentType:"string"}),F(y))}function g(y){return y===62?(n.enter(i),n.consume(y),n.exit(i),n.exit(u),n.exit(r),e):(n.enter(a),n.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(n.exit("chunkString"),n.exit(a),g(y)):y===null||y===60||I(y)?t(y):(n.consume(y),y===92?C:h)}function C(y){return y===60||y===62||y===92?(n.consume(y),h):h(y)}function F(y){return!m&&(y===null||y===41||Y(y))?(n.exit("chunkString"),n.exit(a),n.exit(l),n.exit(r),e(y)):m<s&&y===40?(n.consume(y),m++,F):y===41?(n.consume(y),m--,F):y===null||y===32||y===40||Wn(y)?t(y):(n.consume(y),y===92?E:F)}function E(y){return y===40||y===41||y===92?(n.consume(y),F):F(y)}}function Tt(n,e,t,r,u,i){const l=this;let a=0,p;return s;function s(h){return n.enter(r),n.enter(u),n.consume(h),n.exit(u),n.enter(i),m}function m(h){return a>999||h===null||h===91||h===93&&!p||h===94&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?t(h):h===93?(n.exit(i),n.enter(u),n.consume(h),n.exit(u),n.exit(r),e):I(h)?(n.enter("lineEnding"),n.consume(h),n.exit("lineEnding"),m):(n.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||I(h)||a++>999?(n.exit("chunkString"),m(h)):(n.consume(h),p||(p=!P(h)),h===92?g:f)}function g(h){return h===91||h===92||h===93?(n.consume(h),a++,f):f(h)}}function Ft(n,e,t,r,u,i){let l;return a;function a(g){return g===34||g===39||g===40?(n.enter(r),n.enter(u),n.consume(g),n.exit(u),l=g===40?41:g,p):t(g)}function p(g){return g===l?(n.enter(u),n.consume(g),n.exit(u),n.exit(r),e):(n.enter(i),s(g))}function s(g){return g===l?(n.exit(i),p(l)):g===null?t(g):I(g)?(n.enter("lineEnding"),n.consume(g),n.exit("lineEnding"),R(n,s,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===l||g===null||I(g)?(n.exit("chunkString"),s(g)):(n.consume(g),g===92?f:m)}function f(g){return g===l||g===92?(n.consume(g),m):m(g)}}function In(n,e){let t;return r;function r(u){return I(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),t=!0,r):P(u)?R(n,r,t?"linePrefix":"lineSuffix")(u):e(u)}}const Je={name:"definition",tokenize:Ke},Xe={partial:!0,tokenize:ve};function Ke(n,e,t){const r=this;let u;return i;function i(h){return n.enter("definition"),l(h)}function l(h){return Tt.call(r,n,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return u=xn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(n.enter("definitionMarker"),n.consume(h),n.exit("definitionMarker"),p):t(h)}function p(h){return Y(h)?In(n,s)(h):s(h)}function s(h){return Ct(n,m,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function m(h){return n.attempt(Xe,f,f)(h)}function f(h){return P(h)?R(n,g,"whitespace")(h):g(h)}function g(h){return h===null||I(h)?(n.exit("definition"),r.parser.defined.push(u),e(h)):t(h)}}function ve(n,e,t){return r;function r(a){return Y(a)?In(n,u)(a):t(a)}function u(a){return Ft(n,i,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return P(a)?R(n,l,"whitespace")(a):l(a)}function l(a){return a===null||I(a)?e(a):t(a)}}const nr={name:"hardBreakEscape",tokenize:tr};function tr(n,e,t){return r;function r(i){return n.enter("hardBreakEscape"),n.consume(i),u}function u(i){return I(i)?(n.exit("hardBreakEscape"),e(i)):t(i)}}const er={name:"headingAtx",resolve:rr,tokenize:ir};function rr(n,e){let t=n.length-2,r=3,u,i;return n[r][1].type==="whitespace"&&(r+=2),t-2>r&&n[t][1].type==="whitespace"&&(t-=2),n[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&n[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(u={type:"atxHeadingText",start:n[r][1].start,end:n[t][1].end},i={type:"chunkText",start:n[r][1].start,end:n[t][1].end,contentType:"text"},rn(n,r,t-r+1,[["enter",u,e],["enter",i,e],["exit",i,e],["exit",u,e]])),n}function ir(n,e,t){let r=0;return u;function u(m){return n.enter("atxHeading"),i(m)}function i(m){return n.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(n.consume(m),l):m===null||Y(m)?(n.exit("atxHeadingSequence"),a(m)):t(m)}function a(m){return m===35?(n.enter("atxHeadingSequence"),p(m)):m===null||I(m)?(n.exit("atxHeading"),e(m)):P(m)?R(n,a,"whitespace")(m):(n.enter("atxHeadingText"),s(m))}function p(m){return m===35?(n.consume(m),p):(n.exit("atxHeadingSequence"),a(m))}function s(m){return m===null||m===35||Y(m)?(n.exit("atxHeadingText"),a(m)):(n.consume(m),s)}}const ur=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],dt=["pre","script","style","textarea"],lr={concrete:!0,name:"htmlFlow",resolveTo:or,tokenize:cr},ar={partial:!0,tokenize:fr},sr={partial:!0,tokenize:hr};function or(n){let e=n.length;for(;e--&&!(n[e][0]==="enter"&&n[e][1].type==="htmlFlow"););return e>1&&n[e-2][1].type==="linePrefix"&&(n[e][1].start=n[e-2][1].start,n[e+1][1].start=n[e-2][1].start,n.splice(e-2,2)),n}function cr(n,e,t){const r=this;let u,i,l,a,p;return s;function s(c){return m(c)}function m(c){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(c),f}function f(c){return c===33?(n.consume(c),g):c===47?(n.consume(c),i=!0,F):c===63?(n.consume(c),u=3,r.interrupt?e:o):en(c)?(n.consume(c),l=String.fromCharCode(c),E):t(c)}function g(c){return c===45?(n.consume(c),u=2,h):c===91?(n.consume(c),u=5,a=0,C):en(c)?(n.consume(c),u=4,r.interrupt?e:o):t(c)}function h(c){return c===45?(n.consume(c),r.interrupt?e:o):t(c)}function C(c){const K="CDATA[";return c===K.charCodeAt(a++)?(n.consume(c),a===K.length?r.interrupt?e:w:C):t(c)}function F(c){return en(c)?(n.consume(c),l=String.fromCharCode(c),E):t(c)}function E(c){if(c===null||c===47||c===62||Y(c)){const K=c===47,fn=l.toLowerCase();return!K&&!i&&dt.includes(fn)?(u=1,r.interrupt?e(c):w(c)):ur.includes(l.toLowerCase())?(u=6,K?(n.consume(c),y):r.interrupt?e(c):w(c)):(u=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(c):i?D(c):b(c))}return c===45||nn(c)?(n.consume(c),l+=String.fromCharCode(c),E):t(c)}function y(c){return c===62?(n.consume(c),r.interrupt?e:w):t(c)}function D(c){return P(c)?(n.consume(c),D):V(c)}function b(c){return c===47?(n.consume(c),V):c===58||c===95||en(c)?(n.consume(c),L):P(c)?(n.consume(c),b):V(c)}function L(c){return c===45||c===46||c===58||c===95||nn(c)?(n.consume(c),L):B(c)}function B(c){return c===61?(n.consume(c),x):P(c)?(n.consume(c),B):b(c)}function x(c){return c===null||c===60||c===61||c===62||c===96?t(c):c===34||c===39?(n.consume(c),p=c,A):P(c)?(n.consume(c),x):q(c)}function A(c){return c===p?(n.consume(c),p=null,M):c===null||I(c)?t(c):(n.consume(c),A)}function q(c){return c===null||c===34||c===39||c===47||c===60||c===61||c===62||c===96||Y(c)?B(c):(n.consume(c),q)}function M(c){return c===47||c===62||P(c)?b(c):t(c)}function V(c){return c===62?(n.consume(c),S):t(c)}function S(c){return c===null||I(c)?w(c):P(c)?(n.consume(c),S):t(c)}function w(c){return c===45&&u===2?(n.consume(c),U):c===60&&u===1?(n.consume(c),j):c===62&&u===4?(n.consume(c),X):c===63&&u===3?(n.consume(c),o):c===93&&u===5?(n.consume(c),un):I(c)&&(u===6||u===7)?(n.exit("htmlFlowData"),n.check(ar,ln,O)(c)):c===null||I(c)?(n.exit("htmlFlowData"),O(c)):(n.consume(c),w)}function O(c){return n.check(sr,H,ln)(c)}function H(c){return n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),_}function _(c){return c===null||I(c)?O(c):(n.enter("htmlFlowData"),w(c))}function U(c){return c===45?(n.consume(c),o):w(c)}function j(c){return c===47?(n.consume(c),l="",J):w(c)}function J(c){if(c===62){const K=l.toLowerCase();return dt.includes(K)?(n.consume(c),X):w(c)}return en(c)&&l.length<8?(n.consume(c),l+=String.fromCharCode(c),J):w(c)}function un(c){return c===93?(n.consume(c),o):w(c)}function o(c){return c===62?(n.consume(c),X):c===45&&u===2?(n.consume(c),o):w(c)}function X(c){return c===null||I(c)?(n.exit("htmlFlowData"),ln(c)):(n.consume(c),X)}function ln(c){return n.exit("htmlFlow"),e(c)}}function hr(n,e,t){const r=this;return u;function u(l){return I(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),i):t(l)}function i(l){return r.parser.lazy[r.now().line]?t(l):e(l)}}function fr(n,e,t){return r;function r(u){return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),n.attempt(Pn,e,t)}}const pr={name:"htmlText",tokenize:mr};function mr(n,e,t){const r=this;let u,i,l;return a;function a(o){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(o),p}function p(o){return o===33?(n.consume(o),s):o===47?(n.consume(o),B):o===63?(n.consume(o),b):en(o)?(n.consume(o),q):t(o)}function s(o){return o===45?(n.consume(o),m):o===91?(n.consume(o),i=0,C):en(o)?(n.consume(o),D):t(o)}function m(o){return o===45?(n.consume(o),h):t(o)}function f(o){return o===null?t(o):o===45?(n.consume(o),g):I(o)?(l=f,j(o)):(n.consume(o),f)}function g(o){return o===45?(n.consume(o),h):f(o)}function h(o){return o===62?U(o):o===45?g(o):f(o)}function C(o){const X="CDATA[";return o===X.charCodeAt(i++)?(n.consume(o),i===X.length?F:C):t(o)}function F(o){return o===null?t(o):o===93?(n.consume(o),E):I(o)?(l=F,j(o)):(n.consume(o),F)}function E(o){return o===93?(n.consume(o),y):F(o)}function y(o){return o===62?U(o):o===93?(n.consume(o),y):F(o)}function D(o){return o===null||o===62?U(o):I(o)?(l=D,j(o)):(n.consume(o),D)}function b(o){return o===null?t(o):o===63?(n.consume(o),L):I(o)?(l=b,j(o)):(n.consume(o),b)}function L(o){return o===62?U(o):b(o)}function B(o){return en(o)?(n.consume(o),x):t(o)}function x(o){return o===45||nn(o)?(n.consume(o),x):A(o)}function A(o){return I(o)?(l=A,j(o)):P(o)?(n.consume(o),A):U(o)}function q(o){return o===45||nn(o)?(n.consume(o),q):o===47||o===62||Y(o)?M(o):t(o)}function M(o){return o===47?(n.consume(o),U):o===58||o===95||en(o)?(n.consume(o),V):I(o)?(l=M,j(o)):P(o)?(n.consume(o),M):U(o)}function V(o){return o===45||o===46||o===58||o===95||nn(o)?(n.consume(o),V):S(o)}function S(o){return o===61?(n.consume(o),w):I(o)?(l=S,j(o)):P(o)?(n.consume(o),S):M(o)}function w(o){return o===null||o===60||o===61||o===62||o===96?t(o):o===34||o===39?(n.consume(o),u=o,O):I(o)?(l=w,j(o)):P(o)?(n.consume(o),w):(n.consume(o),H)}function O(o){return o===u?(n.consume(o),u=void 0,_):o===null?t(o):I(o)?(l=O,j(o)):(n.consume(o),O)}function H(o){return o===null||o===34||o===39||o===60||o===61||o===96?t(o):o===47||o===62||Y(o)?M(o):(n.consume(o),H)}function _(o){return o===47||o===62||Y(o)?M(o):t(o)}function U(o){return o===62?(n.consume(o),n.exit("htmlTextData"),n.exit("htmlText"),e):t(o)}function j(o){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),J}function J(o){return P(o)?R(n,un,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):un(o)}function un(o){return n.enter("htmlTextData"),l(o)}}const Xn={name:"labelEnd",resolveAll:kr,resolveTo:yr,tokenize:br},gr={tokenize:wr},dr={tokenize:Sr},xr={tokenize:Ir};function kr(n){let e=-1;const t=[];for(;++e<n.length;){const r=n[e][1];if(t.push(n[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const u=r.type==="labelImage"?4:2;r.type="data",e+=u}}return n.length!==t.length&&rn(n,0,n.length,t),n}function yr(n,e){let t=n.length,r=0,u,i,l,a;for(;t--;)if(u=n[t][1],i){if(u.type==="link"||u.type==="labelLink"&&u._inactive)break;n[t][0]==="enter"&&u.type==="labelLink"&&(u._inactive=!0)}else if(l){if(n[t][0]==="enter"&&(u.type==="labelImage"||u.type==="labelLink")&&!u._balanced&&(i=t,u.type!=="labelLink")){r=2;break}}else u.type==="labelEnd"&&(l=t);const p={type:n[i][1].type==="labelLink"?"link":"image",start:{...n[i][1].start},end:{...n[n.length-1][1].end}},s={type:"label",start:{...n[i][1].start},end:{...n[l][1].end}},m={type:"labelText",start:{...n[i+r+2][1].end},end:{...n[l-2][1].start}};return a=[["enter",p,e],["enter",s,e]],a=G(a,n.slice(i+1,i+r+3)),a=G(a,[["enter",m,e]]),a=G(a,Jn(e.parser.constructs.insideSpan.null,n.slice(i+r+4,l-3),e)),a=G(a,[["exit",m,e],n[l-2],n[l-1],["exit",s,e]]),a=G(a,n.slice(l+1)),a=G(a,[["exit",p,e]]),rn(n,i,n.length,a),n}function br(n,e,t){const r=this;let u=r.events.length,i,l;for(;u--;)if((r.events[u][1].type==="labelImage"||r.events[u][1].type==="labelLink")&&!r.events[u][1]._balanced){i=r.events[u][1];break}return a;function a(g){return i?i._inactive?f(g):(l=r.parser.defined.includes(xn(r.sliceSerialize({start:i.end,end:r.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(g),n.exit("labelMarker"),n.exit("labelEnd"),p):t(g)}function p(g){return g===40?n.attempt(gr,m,l?m:f)(g):g===91?n.attempt(dr,m,l?s:f)(g):l?m(g):f(g)}function s(g){return n.attempt(xr,m,f)(g)}function m(g){return e(g)}function f(g){return i._balanced=!0,t(g)}}function wr(n,e,t){return r;function r(f){return n.enter("resource"),n.enter("resourceMarker"),n.consume(f),n.exit("resourceMarker"),u}function u(f){return Y(f)?In(n,i)(f):i(f)}function i(f){return f===41?m(f):Ct(n,l,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function l(f){return Y(f)?In(n,p)(f):m(f)}function a(f){return t(f)}function p(f){return f===34||f===39||f===40?Ft(n,s,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):m(f)}function s(f){return Y(f)?In(n,m)(f):m(f)}function m(f){return f===41?(n.enter("resourceMarker"),n.consume(f),n.exit("resourceMarker"),n.exit("resource"),e):t(f)}}function Sr(n,e,t){const r=this;return u;function u(a){return Tt.call(r,n,i,l,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(xn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):t(a)}function l(a){return t(a)}}function Ir(n,e,t){return r;function r(i){return n.enter("reference"),n.enter("referenceMarker"),n.consume(i),n.exit("referenceMarker"),u}function u(i){return i===93?(n.enter("referenceMarker"),n.consume(i),n.exit("referenceMarker"),n.exit("reference"),e):t(i)}}const Er={name:"labelStartImage",resolveAll:Xn.resolveAll,tokenize:zr};function zr(n,e,t){const r=this;return u;function u(a){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(a),n.exit("labelImageMarker"),i}function i(a){return a===91?(n.enter("labelMarker"),n.consume(a),n.exit("labelMarker"),n.exit("labelImage"),l):t(a)}function l(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(a):e(a)}}const Cr={name:"labelStartLink",resolveAll:Xn.resolveAll,tokenize:Tr};function Tr(n,e,t){const r=this;return u;function u(l){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(l),n.exit("labelMarker"),n.exit("labelLink"),i}function i(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(l):e(l)}}const Hn={name:"lineEnding",tokenize:Fr};function Fr(n,e){return t;function t(r){return n.enter("lineEnding"),n.consume(r),n.exit("lineEnding"),R(n,e,"linePrefix")}}const Ln={name:"thematicBreak",tokenize:Ar};function Ar(n,e,t){let r=0,u;return i;function i(s){return n.enter("thematicBreak"),l(s)}function l(s){return u=s,a(s)}function a(s){return s===u?(n.enter("thematicBreakSequence"),p(s)):r>=3&&(s===null||I(s))?(n.exit("thematicBreak"),e(s)):t(s)}function p(s){return s===u?(n.consume(s),r++,p):(n.exit("thematicBreakSequence"),P(s)?R(n,a,"whitespace")(s):a(s))}}const W={continuation:{tokenize:Br},exit:Nr,name:"list",tokenize:Pr},_r={partial:!0,tokenize:Rr},Lr={partial:!0,tokenize:Mr};function Pr(n,e,t){const r=this,u=r.events[r.events.length-1];let i=u&&u[1].type==="linePrefix"?u[2].sliceSerialize(u[1],!0).length:0,l=0;return a;function a(h){const C=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Yn(h)){if(r.containerState.type||(r.containerState.type=C,n.enter(C,{_container:!0})),C==="listUnordered")return n.enter("listItemPrefix"),h===42||h===45?n.check(Ln,t,s)(h):s(h);if(!r.interrupt||h===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),p(h)}return t(h)}function p(h){return Yn(h)&&++l<10?(n.consume(h),p):(!r.interrupt||l<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(n.exit("listItemValue"),s(h)):t(h)}function s(h){return n.enter("listItemMarker"),n.consume(h),n.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,n.check(Pn,r.interrupt?t:m,n.attempt(_r,g,f))}function m(h){return r.containerState.initialBlankLine=!0,i++,g(h)}function f(h){return P(h)?(n.enter("listItemPrefixWhitespace"),n.consume(h),n.exit("listItemPrefixWhitespace"),g):t(h)}function g(h){return r.containerState.size=i+r.sliceSerialize(n.exit("listItemPrefix"),!0).length,e(h)}}function Br(n,e,t){const r=this;return r.containerState._closeFlow=void 0,n.check(Pn,u,i);function u(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,R(n,e,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!P(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,n.attempt(Lr,e,l)(a))}function l(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,R(n,n.attempt(W,e,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Mr(n,e,t){const r=this;return R(n,u,"listItemIndent",r.containerState.size+1);function u(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):t(i)}}function Nr(n){n.exit(this.containerState.type)}function Rr(n,e,t){const r=this;return R(n,u,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function u(i){const l=r.events[r.events.length-1];return!P(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):t(i)}}const xt={name:"setextUnderline",resolveTo:Dr,tokenize:Vr};function Dr(n,e){let t=n.length,r,u,i;for(;t--;)if(n[t][0]==="enter"){if(n[t][1].type==="content"){r=t;break}n[t][1].type==="paragraph"&&(u=t)}else n[t][1].type==="content"&&n.splice(t,1),!i&&n[t][1].type==="definition"&&(i=t);const l={type:"setextHeading",start:{...n[r][1].start},end:{...n[n.length-1][1].end}};return n[u][1].type="setextHeadingText",i?(n.splice(u,0,["enter",l,e]),n.splice(i+1,0,["exit",n[r][1],e]),n[r][1].end={...n[i][1].end}):n[r][1]=l,n.push(["exit",l,e]),n}function Vr(n,e,t){const r=this;let u;return i;function i(s){let m=r.events.length,f;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){f=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(n.enter("setextHeadingLine"),u=s,l(s)):t(s)}function l(s){return n.enter("setextHeadingLineSequence"),a(s)}function a(s){return s===u?(n.consume(s),a):(n.exit("setextHeadingLineSequence"),P(s)?R(n,p,"lineSuffix")(s):p(s))}function p(s){return s===null||I(s)?(n.exit("setextHeadingLine"),e(s)):t(s)}}const Or={tokenize:qr};function qr(n){const e=this,t=n.attempt(Pn,r,n.attempt(this.parser.constructs.flowInitial,u,R(n,n.attempt(this.parser.constructs.flow,u,n.attempt(We,u)),"linePrefix")));return t;function r(i){if(i===null){n.consume(i);return}return n.enter("lineEndingBlank"),n.consume(i),n.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function u(i){if(i===null){n.consume(i);return}return n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),e.currentConstruct=void 0,t}}const Hr={resolveAll:_t()},jr=At("string"),Qr=At("text");function At(n){return{resolveAll:_t(n==="text"?Ur:void 0),tokenize:e};function e(t){const r=this,u=this.parser.constructs[n],i=t.attempt(u,l,a);return l;function l(m){return s(m)?i(m):a(m)}function a(m){if(m===null){t.consume(m);return}return t.enter("data"),t.consume(m),p}function p(m){return s(m)?(t.exit("data"),i(m)):(t.consume(m),p)}function s(m){if(m===null)return!0;const f=u[m];let g=-1;if(f)for(;++g<f.length;){const h=f[g];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function _t(n){return e;function e(t,r){let u=-1,i;for(;++u<=t.length;)i===void 0?t[u]&&t[u][1].type==="data"&&(i=u,u++):(!t[u]||t[u][1].type!=="data")&&(u!==i+2&&(t[i][1].end=t[u-1][1].end,t.splice(i+2,u-i-2),u=i+2),i=void 0);return n?n(t,r):t}}function Ur(n,e){let t=0;for(;++t<=n.length;)if((t===n.length||n[t][1].type==="lineEnding")&&n[t-1][1].type==="data"){const r=n[t-1][1],u=e.sliceStream(r);let i=u.length,l=-1,a=0,p;for(;i--;){const s=u[i];if(typeof s=="string"){for(l=s.length;s.charCodeAt(l-1)===32;)a++,l--;if(l)break;l=-1}else if(s===-2)p=!0,a++;else if(s!==-1){i++;break}}if(e._contentTypeTextTrailing&&t===n.length&&(a=0),a){const s={type:t===n.length||p||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:r.start._bufferIndex+l,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...s.start},r.start.offset===r.end.offset?Object.assign(r,s):(n.splice(t,0,["enter",s,e],["exit",s,e]),t+=2)}t++}return n}const Wr={42:W,43:W,45:W,48:W,49:W,50:W,51:W,52:W,53:W,54:W,55:W,56:W,57:W,62:St},Yr={91:Je},$r={[-2]:qn,[-1]:qn,32:qn},Zr={35:er,42:Ln,45:[xt,Ln],60:lr,61:xt,95:Ln,96:gt,126:gt},Gr={38:Et,92:It},Jr={[-5]:Hn,[-4]:Hn,[-3]:Hn,33:Er,38:Et,42:$n,60:[Ce,pr],91:Cr,92:[nr,It],93:Xn,95:$n,96:Oe},Xr={null:[$n,Hr]},Kr={null:[42,95]},vr={null:[]},ni=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Kr,contentInitial:Yr,disable:vr,document:Wr,flow:Zr,flowInitial:$r,insideSpan:Xr,string:Gr,text:Jr},Symbol.toStringTag,{value:"Module"}));function ti(n,e,t){let r={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0};const u={},i=[];let l=[],a=[];const p={attempt:A(B),check:A(x),consume:D,enter:b,exit:L,interrupt:A(x,{interrupt:!0})},s={code:null,containerState:{},defineSkip:F,events:[],now:C,parser:n,previous:null,sliceSerialize:g,sliceStream:h,write:f};let m=e.tokenize.call(s,p);return e.resolveAll&&i.push(e),s;function f(S){return l=G(l,S),E(),l[l.length-1]!==null?[]:(q(e,0),s.events=Jn(i,s.events,s),s.events)}function g(S,w){return ri(h(S),w)}function h(S){return ei(l,S)}function C(){const{_bufferIndex:S,_index:w,line:O,column:H,offset:_}=r;return{_bufferIndex:S,_index:w,line:O,column:H,offset:_}}function F(S){u[S.line]=S.column,V()}function E(){let S;for(;r._index<l.length;){const w=l[r._index];if(typeof w=="string")for(S=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===S&&r._bufferIndex<w.length;)y(w.charCodeAt(r._bufferIndex));else y(w)}}function y(S){m=m(S)}function D(S){I(S)?(r.line++,r.column=1,r.offset+=S===-3?2:1,V()):S!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),s.previous=S}function b(S,w){const O=w||{};return O.type=S,O.start=C(),s.events.push(["enter",O,s]),a.push(O),O}function L(S){const w=a.pop();return w.end=C(),s.events.push(["exit",w,s]),w}function B(S,w){q(S,w.from)}function x(S,w){w.restore()}function A(S,w){return O;function O(H,_,U){let j,J,un,o;return Array.isArray(H)?ln(H):"tokenize"in H?ln([H]):X(H);function X(Q){return kn;function kn(on){const mn=on!==null&&Q[on],gn=on!==null&&Q.null,zn=[...Array.isArray(mn)?mn:mn?[mn]:[],...Array.isArray(gn)?gn:gn?[gn]:[]];return ln(zn)(on)}}function ln(Q){return j=Q,J=0,Q.length===0?U:c(Q[J])}function c(Q){return kn;function kn(on){return o=M(),un=Q,Q.partial||(s.currentConstruct=Q),Q.name&&s.parser.constructs.disable.null.includes(Q.name)?fn():Q.tokenize.call(w?Object.assign(Object.create(s),w):s,p,K,fn)(on)}}function K(Q){return S(un,o),_}function fn(Q){return o.restore(),++J<j.length?c(j[J]):U}}}function q(S,w){S.resolveAll&&!i.includes(S)&&i.push(S),S.resolve&&rn(s.events,w,s.events.length-w,S.resolve(s.events.slice(w),s)),S.resolveTo&&(s.events=S.resolveTo(s.events,s))}function M(){const S=C(),w=s.previous,O=s.currentConstruct,H=s.events.length,_=Array.from(a);return{from:H,restore:U};function U(){r=S,s.previous=w,s.currentConstruct=O,s.events.length=H,a=_,V()}}function V(){r.line in u&&r.column<2&&(r.column=u[r.line],r.offset+=u[r.line]-1)}}function ei(n,e){const t=e.start._index,r=e.start._bufferIndex,u=e.end._index,i=e.end._bufferIndex;let l;if(t===u)l=[n[t].slice(r,i)];else{if(l=n.slice(t,u),r>-1){const a=l[0];typeof a=="string"?l[0]=a.slice(r):l.shift()}i>0&&l.push(n[u].slice(0,i))}return l}function ri(n,e){let t=-1;const r=[];let u;for(;++t<n.length;){const i=n[t];let l;if(typeof i=="string")l=i;else switch(i){case-5:{l="\r";break}case-4:{l=`
1
+ import{cW as Cn,cX as Tn,cY as Fn,cZ as jt}from"./index-BBCAc4Al.js";import{t as Qt,e as Bn,b as rt,i as jn}from"./index-BENzx6Jm.js";import{d as Zn}from"./index.dom-C3-224fz.js";function Sn(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?it(n.position):"start"in n||"end"in n?it(n):"line"in n||"column"in n?Qn(n):""}function Qn(n){return ut(n&&n.line)+":"+ut(n&&n.column)}function it(n){return Qn(n&&n.start)+"-"+Qn(n&&n.end)}function ut(n){return n&&typeof n=="number"?n:1}class $ extends Error{constructor(e,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let u="",i={},l=!1;if(t&&("line"in t&&"column"in t?i={place:t}:"start"in t&&"end"in t?i={place:t}:"type"in t?i={ancestors:[t],place:t.position}:i={...t}),typeof e=="string"?u=e:!i.cause&&e&&(l=!0,u=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const p=r.indexOf(":");p===-1?i.ruleId=r:(i.source=r.slice(0,p),i.ruleId=r.slice(p+1))}if(!i.place&&i.ancestors&&i.ancestors){const p=i.ancestors[i.ancestors.length-1];p&&(i.place=p.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=u,this.line=a?a.line:void 0,this.name=Sn(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}$.prototype.file="";$.prototype.name="";$.prototype.reason="";$.prototype.message="";$.prototype.stack="";$.prototype.column=void 0;$.prototype.line=void 0;$.prototype.ancestors=void 0;$.prototype.cause=void 0;$.prototype.fatal=void 0;$.prototype.place=void 0;$.prototype.ruleId=void 0;$.prototype.source=void 0;const tn={basename:Ut,dirname:Wt,extname:Yt,join:$t,sep:"/"};function Ut(n,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');En(n);let t=0,r=-1,u=n.length,i;if(e===void 0||e.length===0||e.length>n.length){for(;u--;)if(n.codePointAt(u)===47){if(i){t=u+1;break}}else r<0&&(i=!0,r=u+1);return r<0?"":n.slice(t,r)}if(e===n)return"";let l=-1,a=e.length-1;for(;u--;)if(n.codePointAt(u)===47){if(i){t=u+1;break}}else l<0&&(i=!0,l=u+1),a>-1&&(n.codePointAt(u)===e.codePointAt(a--)?a<0&&(r=u):(a=-1,r=l));return t===r?r=l:r<0&&(r=n.length),n.slice(t,r)}function Wt(n){if(En(n),n.length===0)return".";let e=-1,t=n.length,r;for(;--t;)if(n.codePointAt(t)===47){if(r){e=t;break}}else r||(r=!0);return e<0?n.codePointAt(0)===47?"/":".":e===1&&n.codePointAt(0)===47?"//":n.slice(0,e)}function Yt(n){En(n);let e=n.length,t=-1,r=0,u=-1,i=0,l;for(;e--;){const a=n.codePointAt(e);if(a===47){if(l){r=e+1;break}continue}t<0&&(l=!0,t=e+1),a===46?u<0?u=e:i!==1&&(i=1):u>-1&&(i=-1)}return u<0||t<0||i===0||i===1&&u===t-1&&u===r+1?"":n.slice(u,t)}function $t(...n){let e=-1,t;for(;++e<n.length;)En(n[e]),n[e]&&(t=t===void 0?n[e]:t+"/"+n[e]);return t===void 0?".":Zt(t)}function Zt(n){En(n);const e=n.codePointAt(0)===47;let t=Gt(n,!e);return t.length===0&&!e&&(t="."),t.length>0&&n.codePointAt(n.length-1)===47&&(t+="/"),e?"/"+t:t}function Gt(n,e){let t="",r=0,u=-1,i=0,l=-1,a,p;for(;++l<=n.length;){if(l<n.length)a=n.codePointAt(l);else{if(a===47)break;a=47}if(a===47){if(!(u===l-1||i===1))if(u!==l-1&&i===2){if(t.length<2||r!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(p=t.lastIndexOf("/"),p!==t.length-1){p<0?(t="",r=0):(t=t.slice(0,p),r=t.length-1-t.lastIndexOf("/")),u=l,i=0;continue}}else if(t.length>0){t="",r=0,u=l,i=0;continue}}e&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+n.slice(u+1,l):t=n.slice(u+1,l),r=l-u-1;u=l,i=0}else a===46&&i>-1?i++:i=-1}return t}function En(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const Jt={cwd:Xt};function Xt(){return"/"}function Un(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function Kt(n){if(typeof n=="string")n=new URL(n);else if(!Un(n)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(n.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return vt(n)}function vt(n){if(n.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=n.pathname;let t=-1;for(;++t<e.length;)if(e.codePointAt(t)===37&&e.codePointAt(t+1)===50){const r=e.codePointAt(t+2);if(r===70||r===102){const u=new TypeError("File URL path must not include encoded / characters");throw u.code="ERR_INVALID_FILE_URL_PATH",u}}return decodeURIComponent(e)}const Mn=["history","path","basename","stem","extname","dirname"];class ne{constructor(e){let t;e?Un(e)?t={path:e}:typeof e=="string"||te(e)?t={value:e}:t=e:t={},this.cwd="cwd"in t?"":Jt.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Mn.length;){const i=Mn[r];i in t&&t[i]!==void 0&&t[i]!==null&&(this[i]=i==="history"?[...t[i]]:t[i])}let u;for(u in t)Mn.includes(u)||(this[u]=t[u])}get basename(){return typeof this.path=="string"?tn.basename(this.path):void 0}set basename(e){Rn(e,"basename"),Nn(e,"basename"),this.path=tn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?tn.dirname(this.path):void 0}set dirname(e){lt(this.basename,"dirname"),this.path=tn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?tn.extname(this.path):void 0}set extname(e){if(Nn(e,"extname"),lt(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=tn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Un(e)&&(e=Kt(e)),Rn(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?tn.basename(this.path,this.extname):void 0}set stem(e){Rn(e,"stem"),Nn(e,"stem"),this.path=tn.join(this.dirname||"",e+(this.extname||""))}fail(e,t,r){const u=this.message(e,t,r);throw u.fatal=!0,u}info(e,t,r){const u=this.message(e,t,r);return u.fatal=void 0,u}message(e,t,r){const u=new $(e,t,r);return this.path&&(u.name=this.path+":"+u.name,u.file=this.path),u.fatal=!1,this.messages.push(u),u}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Nn(n,e){if(n&&n.includes(tn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+tn.sep+"`")}function Rn(n,e){if(!n)throw new Error("`"+e+"` cannot be empty")}function lt(n,e){if(!n)throw new Error("Setting `"+e+"` requires `path` to be set too")}function te(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const ee=(function(n){const r=this.constructor.prototype,u=r[n],i=function(){return u.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),re={}.hasOwnProperty;class Gn extends ee{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Qt()}copy(){const e=new Gn;let t=-1;for(;++t<this.attachers.length;){const r=this.attachers[t];e.use(...r)}return e.data(Bn(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(On("data",this.frozen),this.namespace[e]=t,this):re.call(this.namespace,e)&&this.namespace[e]||void 0:e?(On("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const u=t.call(e,...r);typeof u=="function"&&this.transformers.use(u)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=An(e),r=this.parser||this.Parser;return Dn("parse",r),r(String(t),t)}process(e,t){const r=this;return this.freeze(),Dn("process",this.parser||this.Parser),Vn("process",this.compiler||this.Compiler),t?u(void 0,t):new Promise(u);function u(i,l){const a=An(e),p=r.parse(a);r.run(p,a,function(m,f,g){if(m||!f||!g)return s(m);const h=f,C=r.stringify(h,g);le(C)?g.value=C:g.result=C,s(m,g)});function s(m,f){m||!f?l(m):i?i(f):t(void 0,f)}}}processSync(e){let t=!1,r;return this.freeze(),Dn("processSync",this.parser||this.Parser),Vn("processSync",this.compiler||this.Compiler),this.process(e,u),st("processSync","process",t),r;function u(i,l){t=!0,rt(i),r=l}}run(e,t,r){at(e),this.freeze();const u=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?i(void 0,r):new Promise(i);function i(l,a){const p=An(t);u.run(e,p,s);function s(m,f,g){const h=f||e;m?a(m):l?l(h):r(void 0,h,g)}}}runSync(e,t){let r=!1,u;return this.run(e,t,i),st("runSync","run",r),u;function i(l,a){rt(l),u=a,r=!0}}stringify(e,t){this.freeze();const r=An(t),u=this.compiler||this.Compiler;return Vn("stringify",u),at(e),u(e,r)}use(e,...t){const r=this.attachers,u=this.namespace;if(On("use",this.frozen),e!=null)if(typeof e=="function")p(e,t);else if(typeof e=="object")Array.isArray(e)?a(e):l(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(s){if(typeof s=="function")p(s,[]);else if(typeof s=="object")if(Array.isArray(s)){const[m,...f]=s;p(m,f)}else l(s);else throw new TypeError("Expected usable value, not `"+s+"`")}function l(s){if(!("plugins"in s)&&!("settings"in s))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(s.plugins),s.settings&&(u.settings=Bn(!0,u.settings,s.settings))}function a(s){let m=-1;if(s!=null)if(Array.isArray(s))for(;++m<s.length;){const f=s[m];i(f)}else throw new TypeError("Expected a list of plugins, not `"+s+"`")}function p(s,m){let f=-1,g=-1;for(;++f<r.length;)if(r[f][0]===s){g=f;break}if(g===-1)r.push([s,...m]);else if(m.length>0){let[h,...C]=m;const F=r[g][1];jn(F)&&jn(h)&&(h=Bn(!0,F,h)),r[g]=[s,h,...C]}}}}const ie=new Gn().freeze();function Dn(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function Vn(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function On(n,e){if(e)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function at(n){if(!jn(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function st(n,e,t){if(!t)throw new Error("`"+n+"` finished async. Use `"+e+"` instead")}function An(n){return ue(n)?n:new ne(n)}function ue(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function le(n){return typeof n=="string"||ae(n)}function ae(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const se={};function oe(n,e){const t=se,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,u=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return bt(n,r,u)}function bt(n,e,t){if(ce(n)){if("value"in n)return n.type==="html"&&!t?"":n.value;if(e&&"alt"in n&&n.alt)return n.alt;if("children"in n)return ot(n.children,e,t)}return Array.isArray(n)?ot(n,e,t):""}function ot(n,e,t){const r=[];let u=-1;for(;++u<n.length;)r[u]=bt(n[u],e,t);return r.join("")}function ce(n){return!!(n&&typeof n=="object")}function rn(n,e,t,r){const u=n.length;let i=0,l;if(e<0?e=-e>u?0:u+e:e=e>u?u:e,t=t>0?t:0,r.length<1e4)l=Array.from(r),l.unshift(e,t),n.splice(...l);else for(t&&n.splice(e,t);i<r.length;)l=r.slice(i,i+1e4),l.unshift(e,0),n.splice(...l),i+=1e4,e+=1e4}function G(n,e){return n.length>0?(rn(n,n.length,0,e),n):e}const ct={}.hasOwnProperty;function he(n){const e={};let t=-1;for(;++t<n.length;)fe(e,n[t]);return e}function fe(n,e){let t;for(t in e){const u=(ct.call(n,t)?n[t]:void 0)||(n[t]={}),i=e[t];let l;if(i)for(l in i){ct.call(u,l)||(u[l]=[]);const a=i[l];pe(u[l],Array.isArray(a)?a:a?[a]:[])}}}function pe(n,e){let t=-1;const r=[];for(;++t<e.length;)(e[t].add==="after"?n:r).push(e[t]);rn(n,0,0,r)}function wt(n,e){const t=Number.parseInt(n,e);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function xn(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const en=hn(/[A-Za-z]/),nn=hn(/[\dA-Za-z]/),me=hn(/[#-'*+\--9=?A-Z^-~]/);function Wn(n){return n!==null&&(n<32||n===127)}const Yn=hn(/\d/),ge=hn(/[\dA-Fa-f]/),de=hn(/[!-/:-@[-`{-~]/);function I(n){return n!==null&&n<-2}function Y(n){return n!==null&&(n<0||n===32)}function P(n){return n===-2||n===-1||n===32}const xe=hn(new RegExp("\\p{P}|\\p{S}","u")),ke=hn(/\s/);function hn(n){return e;function e(t){return t!==null&&t>-1&&n.test(String.fromCharCode(t))}}function R(n,e,t,r){const u=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(p){return P(p)?(n.enter(t),a(p)):e(p)}function a(p){return P(p)&&i++<u?(n.consume(p),a):(n.exit(t),e(p))}}const ye={tokenize:be};function be(n){const e=n.attempt(this.parser.constructs.contentInitial,r,u);let t;return e;function r(a){if(a===null){n.consume(a);return}return n.enter("lineEnding"),n.consume(a),n.exit("lineEnding"),R(n,e,"linePrefix")}function u(a){return n.enter("paragraph"),i(a)}function i(a){const p=n.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=p),t=p,l(a)}function l(a){if(a===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(a);return}return I(a)?(n.consume(a),n.exit("chunkText"),i):(n.consume(a),l)}}const we={tokenize:Se},ht={tokenize:Ie};function Se(n){const e=this,t=[];let r=0,u,i,l;return a;function a(b){if(r<t.length){const L=t[r];return e.containerState=L[1],n.attempt(L[0].continuation,p,s)(b)}return s(b)}function p(b){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,u&&D();const L=e.events.length;let B=L,x;for(;B--;)if(e.events[B][0]==="exit"&&e.events[B][1].type==="chunkFlow"){x=e.events[B][1].end;break}y(r);let A=L;for(;A<e.events.length;)e.events[A][1].end={...x},A++;return rn(e.events,B+1,0,e.events.slice(L)),e.events.length=A,s(b)}return a(b)}function s(b){if(r===t.length){if(!u)return g(b);if(u.currentConstruct&&u.currentConstruct.concrete)return C(b);e.interrupt=!!(u.currentConstruct&&!u._gfmTableDynamicInterruptHack)}return e.containerState={},n.check(ht,m,f)(b)}function m(b){return u&&D(),y(r),g(b)}function f(b){return e.parser.lazy[e.now().line]=r!==t.length,l=e.now().offset,C(b)}function g(b){return e.containerState={},n.attempt(ht,h,C)(b)}function h(b){return r++,t.push([e.currentConstruct,e.containerState]),g(b)}function C(b){if(b===null){u&&D(),y(0),n.consume(b);return}return u=u||e.parser.flow(e.now()),n.enter("chunkFlow",{_tokenizer:u,contentType:"flow",previous:i}),F(b)}function F(b){if(b===null){E(n.exit("chunkFlow"),!0),y(0),n.consume(b);return}return I(b)?(n.consume(b),E(n.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(n.consume(b),F)}function E(b,L){const B=e.sliceStream(b);if(L&&B.push(null),b.previous=i,i&&(i.next=b),i=b,u.defineSkip(b.start),u.write(B),e.parser.lazy[b.start.line]){let x=u.events.length;for(;x--;)if(u.events[x][1].start.offset<l&&(!u.events[x][1].end||u.events[x][1].end.offset>l))return;const A=e.events.length;let q=A,M,V;for(;q--;)if(e.events[q][0]==="exit"&&e.events[q][1].type==="chunkFlow"){if(M){V=e.events[q][1].end;break}M=!0}for(y(r),x=A;x<e.events.length;)e.events[x][1].end={...V},x++;rn(e.events,q+1,0,e.events.slice(A)),e.events.length=x}}function y(b){let L=t.length;for(;L-- >b;){const B=t[L];e.containerState=B[1],B[0].exit.call(e,n)}t.length=b}function D(){u.write([null]),i=void 0,u=void 0,e.containerState._closeFlow=void 0}}function Ie(n,e,t){return R(n,n.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ft(n){if(n===null||Y(n)||ke(n))return 1;if(xe(n))return 2}function Jn(n,e,t){const r=[];let u=-1;for(;++u<n.length;){const i=n[u].resolveAll;i&&!r.includes(i)&&(e=i(e,t),r.push(i))}return e}const $n={name:"attention",resolveAll:Ee,tokenize:ze};function Ee(n,e){let t=-1,r,u,i,l,a,p,s,m;for(;++t<n.length;)if(n[t][0]==="enter"&&n[t][1].type==="attentionSequence"&&n[t][1]._close){for(r=t;r--;)if(n[r][0]==="exit"&&n[r][1].type==="attentionSequence"&&n[r][1]._open&&e.sliceSerialize(n[r][1]).charCodeAt(0)===e.sliceSerialize(n[t][1]).charCodeAt(0)){if((n[r][1]._close||n[t][1]._open)&&(n[t][1].end.offset-n[t][1].start.offset)%3&&!((n[r][1].end.offset-n[r][1].start.offset+n[t][1].end.offset-n[t][1].start.offset)%3))continue;p=n[r][1].end.offset-n[r][1].start.offset>1&&n[t][1].end.offset-n[t][1].start.offset>1?2:1;const f={...n[r][1].end},g={...n[t][1].start};pt(f,-p),pt(g,p),l={type:p>1?"strongSequence":"emphasisSequence",start:f,end:{...n[r][1].end}},a={type:p>1?"strongSequence":"emphasisSequence",start:{...n[t][1].start},end:g},i={type:p>1?"strongText":"emphasisText",start:{...n[r][1].end},end:{...n[t][1].start}},u={type:p>1?"strong":"emphasis",start:{...l.start},end:{...a.end}},n[r][1].end={...l.start},n[t][1].start={...a.end},s=[],n[r][1].end.offset-n[r][1].start.offset&&(s=G(s,[["enter",n[r][1],e],["exit",n[r][1],e]])),s=G(s,[["enter",u,e],["enter",l,e],["exit",l,e],["enter",i,e]]),s=G(s,Jn(e.parser.constructs.insideSpan.null,n.slice(r+1,t),e)),s=G(s,[["exit",i,e],["enter",a,e],["exit",a,e],["exit",u,e]]),n[t][1].end.offset-n[t][1].start.offset?(m=2,s=G(s,[["enter",n[t][1],e],["exit",n[t][1],e]])):m=0,rn(n,r-1,t-r+3,s),t=r+s.length-m-2;break}}for(t=-1;++t<n.length;)n[t][1].type==="attentionSequence"&&(n[t][1].type="data");return n}function ze(n,e){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,u=ft(r);let i;return l;function l(p){return i=p,n.enter("attentionSequence"),a(p)}function a(p){if(p===i)return n.consume(p),a;const s=n.exit("attentionSequence"),m=ft(p),f=!m||m===2&&u||t.includes(p),g=!u||u===2&&m||t.includes(r);return s._open=!!(i===42?f:f&&(u||!g)),s._close=!!(i===42?g:g&&(m||!f)),e(p)}}function pt(n,e){n.column+=e,n.offset+=e,n._bufferIndex+=e}const Ce={name:"autolink",tokenize:Te};function Te(n,e,t){let r=0;return u;function u(h){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(h),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),i}function i(h){return en(h)?(n.consume(h),l):h===64?t(h):s(h)}function l(h){return h===43||h===45||h===46||nn(h)?(r=1,a(h)):s(h)}function a(h){return h===58?(n.consume(h),r=0,p):(h===43||h===45||h===46||nn(h))&&r++<32?(n.consume(h),a):(r=0,s(h))}function p(h){return h===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(h),n.exit("autolinkMarker"),n.exit("autolink"),e):h===null||h===32||h===60||Wn(h)?t(h):(n.consume(h),p)}function s(h){return h===64?(n.consume(h),m):me(h)?(n.consume(h),s):t(h)}function m(h){return nn(h)?f(h):t(h)}function f(h){return h===46?(n.consume(h),r=0,m):h===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(h),n.exit("autolinkMarker"),n.exit("autolink"),e):g(h)}function g(h){if((h===45||nn(h))&&r++<63){const C=h===45?g:f;return n.consume(h),C}return t(h)}}const Pn={partial:!0,tokenize:Fe};function Fe(n,e,t){return r;function r(i){return P(i)?R(n,u,"linePrefix")(i):u(i)}function u(i){return i===null||I(i)?e(i):t(i)}}const St={continuation:{tokenize:_e},exit:Le,name:"blockQuote",tokenize:Ae};function Ae(n,e,t){const r=this;return u;function u(l){if(l===62){const a=r.containerState;return a.open||(n.enter("blockQuote",{_container:!0}),a.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(l),n.exit("blockQuoteMarker"),i}return t(l)}function i(l){return P(l)?(n.enter("blockQuotePrefixWhitespace"),n.consume(l),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),e):(n.exit("blockQuotePrefix"),e(l))}}function _e(n,e,t){const r=this;return u;function u(l){return P(l)?R(n,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):i(l)}function i(l){return n.attempt(St,e,t)(l)}}function Le(n){n.exit("blockQuote")}const It={name:"characterEscape",tokenize:Pe};function Pe(n,e,t){return r;function r(i){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(i),n.exit("escapeMarker"),u}function u(i){return de(i)?(n.enter("characterEscapeValue"),n.consume(i),n.exit("characterEscapeValue"),n.exit("characterEscape"),e):t(i)}}const Et={name:"characterReference",tokenize:Be};function Be(n,e,t){const r=this;let u=0,i,l;return a;function a(f){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(f),n.exit("characterReferenceMarker"),p}function p(f){return f===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(f),n.exit("characterReferenceMarkerNumeric"),s):(n.enter("characterReferenceValue"),i=31,l=nn,m(f))}function s(f){return f===88||f===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(f),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),i=6,l=ge,m):(n.enter("characterReferenceValue"),i=7,l=Yn,m(f))}function m(f){if(f===59&&u){const g=n.exit("characterReferenceValue");return l===nn&&!Zn(r.sliceSerialize(g))?t(f):(n.enter("characterReferenceMarker"),n.consume(f),n.exit("characterReferenceMarker"),n.exit("characterReference"),e)}return l(f)&&u++<i?(n.consume(f),m):t(f)}}const mt={partial:!0,tokenize:Ne},gt={concrete:!0,name:"codeFenced",tokenize:Me};function Me(n,e,t){const r=this,u={partial:!0,tokenize:B};let i=0,l=0,a;return p;function p(x){return s(x)}function s(x){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,a=x,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),m(x)}function m(x){return x===a?(l++,n.consume(x),m):l<3?t(x):(n.exit("codeFencedFenceSequence"),P(x)?R(n,f,"whitespace")(x):f(x))}function f(x){return x===null||I(x)?(n.exit("codeFencedFence"),r.interrupt?e(x):n.check(mt,F,L)(x)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||I(x)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),f(x)):P(x)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),R(n,h,"whitespace")(x)):x===96&&x===a?t(x):(n.consume(x),g)}function h(x){return x===null||I(x)?f(x):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),C(x))}function C(x){return x===null||I(x)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),f(x)):x===96&&x===a?t(x):(n.consume(x),C)}function F(x){return n.attempt(u,L,E)(x)}function E(x){return n.enter("lineEnding"),n.consume(x),n.exit("lineEnding"),y}function y(x){return i>0&&P(x)?R(n,D,"linePrefix",i+1)(x):D(x)}function D(x){return x===null||I(x)?n.check(mt,F,L)(x):(n.enter("codeFlowValue"),b(x))}function b(x){return x===null||I(x)?(n.exit("codeFlowValue"),D(x)):(n.consume(x),b)}function L(x){return n.exit("codeFenced"),e(x)}function B(x,A,q){let M=0;return V;function V(_){return x.enter("lineEnding"),x.consume(_),x.exit("lineEnding"),S}function S(_){return x.enter("codeFencedFence"),P(_)?R(x,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):w(_)}function w(_){return _===a?(x.enter("codeFencedFenceSequence"),O(_)):q(_)}function O(_){return _===a?(M++,x.consume(_),O):M>=l?(x.exit("codeFencedFenceSequence"),P(_)?R(x,H,"whitespace")(_):H(_)):q(_)}function H(_){return _===null||I(_)?(x.exit("codeFencedFence"),A(_)):q(_)}}}function Ne(n,e,t){const r=this;return u;function u(l){return l===null?t(l):(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?t(l):e(l)}}const qn={name:"codeIndented",tokenize:De},Re={partial:!0,tokenize:Ve};function De(n,e,t){const r=this;return u;function u(s){return n.enter("codeIndented"),R(n,i,"linePrefix",5)(s)}function i(s){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(s):t(s)}function l(s){return s===null?p(s):I(s)?n.attempt(Re,l,p)(s):(n.enter("codeFlowValue"),a(s))}function a(s){return s===null||I(s)?(n.exit("codeFlowValue"),l(s)):(n.consume(s),a)}function p(s){return n.exit("codeIndented"),e(s)}}function Ve(n,e,t){const r=this;return u;function u(l){return r.parser.lazy[r.now().line]?t(l):I(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),u):R(n,i,"linePrefix",5)(l)}function i(l){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(l):I(l)?u(l):t(l)}}const Oe={name:"codeText",previous:He,resolve:qe,tokenize:je};function qe(n){let e=n.length-4,t=3,r,u;if((n[t][1].type==="lineEnding"||n[t][1].type==="space")&&(n[e][1].type==="lineEnding"||n[e][1].type==="space")){for(r=t;++r<e;)if(n[r][1].type==="codeTextData"){n[t][1].type="codeTextPadding",n[e][1].type="codeTextPadding",t+=2,e-=2;break}}for(r=t-1,e++;++r<=e;)u===void 0?r!==e&&n[r][1].type!=="lineEnding"&&(u=r):(r===e||n[r][1].type==="lineEnding")&&(n[u][1].type="codeTextData",r!==u+2&&(n[u][1].end=n[r-1][1].end,n.splice(u+2,r-u-2),e-=r-u-2,r=u+2),u=void 0);return n}function He(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function je(n,e,t){let r=0,u,i;return l;function l(f){return n.enter("codeText"),n.enter("codeTextSequence"),a(f)}function a(f){return f===96?(n.consume(f),r++,a):(n.exit("codeTextSequence"),p(f))}function p(f){return f===null?t(f):f===32?(n.enter("space"),n.consume(f),n.exit("space"),p):f===96?(i=n.enter("codeTextSequence"),u=0,m(f)):I(f)?(n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),p):(n.enter("codeTextData"),s(f))}function s(f){return f===null||f===32||f===96||I(f)?(n.exit("codeTextData"),p(f)):(n.consume(f),s)}function m(f){return f===96?(n.consume(f),u++,m):u===r?(n.exit("codeTextSequence"),n.exit("codeText"),e(f)):(i.type="codeTextData",s(f))}}class Qe{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const r=t??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,t,r){const u=t||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-u,Number.POSITIVE_INFINITY);return r&&wn(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),wn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);wn(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);wn(this.left,t.reverse())}}}function wn(n,e){let t=0;if(e.length<1e4)n.push(...e);else for(;t<e.length;)n.push(...e.slice(t,t+1e4)),t+=1e4}function zt(n){const e={};let t=-1,r,u,i,l,a,p,s;const m=new Qe(n);for(;++t<m.length;){for(;t in e;)t=e[t];if(r=m.get(t),t&&r[1].type==="chunkFlow"&&m.get(t-1)[1].type==="listItemPrefix"&&(p=r[1]._tokenizer.events,i=0,i<p.length&&p[i][1].type==="lineEndingBlank"&&(i+=2),i<p.length&&p[i][1].type==="content"))for(;++i<p.length&&p[i][1].type!=="content";)p[i][1].type==="chunkText"&&(p[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,Ue(m,t)),t=e[t],s=!0);else if(r[1]._container){for(i=t,u=void 0;i--;)if(l=m.get(i),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(u&&(m.get(u)[1].type="lineEndingBlank"),l[1].type="lineEnding",u=i);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;u&&(r[1].end={...m.get(u)[1].start},a=m.slice(u,t),a.unshift(r),m.splice(u,t-u+1,a))}}return rn(n,0,Number.POSITIVE_INFINITY,m.slice(0)),!s}function Ue(n,e){const t=n.get(e)[1],r=n.get(e)[2];let u=e-1;const i=[];let l=t._tokenizer;l||(l=r.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const a=l.events,p=[],s={};let m,f,g=-1,h=t,C=0,F=0;const E=[F];for(;h;){for(;n.get(++u)[1]!==h;);i.push(u),h._tokenizer||(m=r.sliceStream(h),h.next||m.push(null),f&&l.defineSkip(h.start),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(m),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=t;++g<a.length;)a[g][0]==="exit"&&a[g-1][0]==="enter"&&a[g][1].type===a[g-1][1].type&&a[g][1].start.line!==a[g][1].end.line&&(F=g+1,E.push(F),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(l.events=[],h?(h._tokenizer=void 0,h.previous=void 0):E.pop(),g=E.length;g--;){const y=a.slice(E[g],E[g+1]),D=i.pop();p.push([D,D+y.length-1]),n.splice(D,2,y)}for(p.reverse(),g=-1;++g<p.length;)s[C+p[g][0]]=C+p[g][1],C+=p[g][1]-p[g][0]-1;return s}const We={resolve:$e,tokenize:Ze},Ye={partial:!0,tokenize:Ge};function $e(n){return zt(n),n}function Ze(n,e){let t;return r;function r(a){return n.enter("content"),t=n.enter("chunkContent",{contentType:"content"}),u(a)}function u(a){return a===null?i(a):I(a)?n.check(Ye,l,i)(a):(n.consume(a),u)}function i(a){return n.exit("chunkContent"),n.exit("content"),e(a)}function l(a){return n.consume(a),n.exit("chunkContent"),t.next=n.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,u}}function Ge(n,e,t){const r=this;return u;function u(l){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),R(n,i,"linePrefix")}function i(l){if(l===null||I(l))return t(l);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(l):n.interrupt(r.parser.constructs.flow,t,e)(l)}}function Ct(n,e,t,r,u,i,l,a,p){const s=p||Number.POSITIVE_INFINITY;let m=0;return f;function f(y){return y===60?(n.enter(r),n.enter(u),n.enter(i),n.consume(y),n.exit(i),g):y===null||y===32||y===41||Wn(y)?t(y):(n.enter(r),n.enter(l),n.enter(a),n.enter("chunkString",{contentType:"string"}),F(y))}function g(y){return y===62?(n.enter(i),n.consume(y),n.exit(i),n.exit(u),n.exit(r),e):(n.enter(a),n.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(n.exit("chunkString"),n.exit(a),g(y)):y===null||y===60||I(y)?t(y):(n.consume(y),y===92?C:h)}function C(y){return y===60||y===62||y===92?(n.consume(y),h):h(y)}function F(y){return!m&&(y===null||y===41||Y(y))?(n.exit("chunkString"),n.exit(a),n.exit(l),n.exit(r),e(y)):m<s&&y===40?(n.consume(y),m++,F):y===41?(n.consume(y),m--,F):y===null||y===32||y===40||Wn(y)?t(y):(n.consume(y),y===92?E:F)}function E(y){return y===40||y===41||y===92?(n.consume(y),F):F(y)}}function Tt(n,e,t,r,u,i){const l=this;let a=0,p;return s;function s(h){return n.enter(r),n.enter(u),n.consume(h),n.exit(u),n.enter(i),m}function m(h){return a>999||h===null||h===91||h===93&&!p||h===94&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?t(h):h===93?(n.exit(i),n.enter(u),n.consume(h),n.exit(u),n.exit(r),e):I(h)?(n.enter("lineEnding"),n.consume(h),n.exit("lineEnding"),m):(n.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||I(h)||a++>999?(n.exit("chunkString"),m(h)):(n.consume(h),p||(p=!P(h)),h===92?g:f)}function g(h){return h===91||h===92||h===93?(n.consume(h),a++,f):f(h)}}function Ft(n,e,t,r,u,i){let l;return a;function a(g){return g===34||g===39||g===40?(n.enter(r),n.enter(u),n.consume(g),n.exit(u),l=g===40?41:g,p):t(g)}function p(g){return g===l?(n.enter(u),n.consume(g),n.exit(u),n.exit(r),e):(n.enter(i),s(g))}function s(g){return g===l?(n.exit(i),p(l)):g===null?t(g):I(g)?(n.enter("lineEnding"),n.consume(g),n.exit("lineEnding"),R(n,s,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===l||g===null||I(g)?(n.exit("chunkString"),s(g)):(n.consume(g),g===92?f:m)}function f(g){return g===l||g===92?(n.consume(g),m):m(g)}}function In(n,e){let t;return r;function r(u){return I(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),t=!0,r):P(u)?R(n,r,t?"linePrefix":"lineSuffix")(u):e(u)}}const Je={name:"definition",tokenize:Ke},Xe={partial:!0,tokenize:ve};function Ke(n,e,t){const r=this;let u;return i;function i(h){return n.enter("definition"),l(h)}function l(h){return Tt.call(r,n,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return u=xn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(n.enter("definitionMarker"),n.consume(h),n.exit("definitionMarker"),p):t(h)}function p(h){return Y(h)?In(n,s)(h):s(h)}function s(h){return Ct(n,m,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function m(h){return n.attempt(Xe,f,f)(h)}function f(h){return P(h)?R(n,g,"whitespace")(h):g(h)}function g(h){return h===null||I(h)?(n.exit("definition"),r.parser.defined.push(u),e(h)):t(h)}}function ve(n,e,t){return r;function r(a){return Y(a)?In(n,u)(a):t(a)}function u(a){return Ft(n,i,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return P(a)?R(n,l,"whitespace")(a):l(a)}function l(a){return a===null||I(a)?e(a):t(a)}}const nr={name:"hardBreakEscape",tokenize:tr};function tr(n,e,t){return r;function r(i){return n.enter("hardBreakEscape"),n.consume(i),u}function u(i){return I(i)?(n.exit("hardBreakEscape"),e(i)):t(i)}}const er={name:"headingAtx",resolve:rr,tokenize:ir};function rr(n,e){let t=n.length-2,r=3,u,i;return n[r][1].type==="whitespace"&&(r+=2),t-2>r&&n[t][1].type==="whitespace"&&(t-=2),n[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&n[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(u={type:"atxHeadingText",start:n[r][1].start,end:n[t][1].end},i={type:"chunkText",start:n[r][1].start,end:n[t][1].end,contentType:"text"},rn(n,r,t-r+1,[["enter",u,e],["enter",i,e],["exit",i,e],["exit",u,e]])),n}function ir(n,e,t){let r=0;return u;function u(m){return n.enter("atxHeading"),i(m)}function i(m){return n.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(n.consume(m),l):m===null||Y(m)?(n.exit("atxHeadingSequence"),a(m)):t(m)}function a(m){return m===35?(n.enter("atxHeadingSequence"),p(m)):m===null||I(m)?(n.exit("atxHeading"),e(m)):P(m)?R(n,a,"whitespace")(m):(n.enter("atxHeadingText"),s(m))}function p(m){return m===35?(n.consume(m),p):(n.exit("atxHeadingSequence"),a(m))}function s(m){return m===null||m===35||Y(m)?(n.exit("atxHeadingText"),a(m)):(n.consume(m),s)}}const ur=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],dt=["pre","script","style","textarea"],lr={concrete:!0,name:"htmlFlow",resolveTo:or,tokenize:cr},ar={partial:!0,tokenize:fr},sr={partial:!0,tokenize:hr};function or(n){let e=n.length;for(;e--&&!(n[e][0]==="enter"&&n[e][1].type==="htmlFlow"););return e>1&&n[e-2][1].type==="linePrefix"&&(n[e][1].start=n[e-2][1].start,n[e+1][1].start=n[e-2][1].start,n.splice(e-2,2)),n}function cr(n,e,t){const r=this;let u,i,l,a,p;return s;function s(c){return m(c)}function m(c){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(c),f}function f(c){return c===33?(n.consume(c),g):c===47?(n.consume(c),i=!0,F):c===63?(n.consume(c),u=3,r.interrupt?e:o):en(c)?(n.consume(c),l=String.fromCharCode(c),E):t(c)}function g(c){return c===45?(n.consume(c),u=2,h):c===91?(n.consume(c),u=5,a=0,C):en(c)?(n.consume(c),u=4,r.interrupt?e:o):t(c)}function h(c){return c===45?(n.consume(c),r.interrupt?e:o):t(c)}function C(c){const K="CDATA[";return c===K.charCodeAt(a++)?(n.consume(c),a===K.length?r.interrupt?e:w:C):t(c)}function F(c){return en(c)?(n.consume(c),l=String.fromCharCode(c),E):t(c)}function E(c){if(c===null||c===47||c===62||Y(c)){const K=c===47,fn=l.toLowerCase();return!K&&!i&&dt.includes(fn)?(u=1,r.interrupt?e(c):w(c)):ur.includes(l.toLowerCase())?(u=6,K?(n.consume(c),y):r.interrupt?e(c):w(c)):(u=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(c):i?D(c):b(c))}return c===45||nn(c)?(n.consume(c),l+=String.fromCharCode(c),E):t(c)}function y(c){return c===62?(n.consume(c),r.interrupt?e:w):t(c)}function D(c){return P(c)?(n.consume(c),D):V(c)}function b(c){return c===47?(n.consume(c),V):c===58||c===95||en(c)?(n.consume(c),L):P(c)?(n.consume(c),b):V(c)}function L(c){return c===45||c===46||c===58||c===95||nn(c)?(n.consume(c),L):B(c)}function B(c){return c===61?(n.consume(c),x):P(c)?(n.consume(c),B):b(c)}function x(c){return c===null||c===60||c===61||c===62||c===96?t(c):c===34||c===39?(n.consume(c),p=c,A):P(c)?(n.consume(c),x):q(c)}function A(c){return c===p?(n.consume(c),p=null,M):c===null||I(c)?t(c):(n.consume(c),A)}function q(c){return c===null||c===34||c===39||c===47||c===60||c===61||c===62||c===96||Y(c)?B(c):(n.consume(c),q)}function M(c){return c===47||c===62||P(c)?b(c):t(c)}function V(c){return c===62?(n.consume(c),S):t(c)}function S(c){return c===null||I(c)?w(c):P(c)?(n.consume(c),S):t(c)}function w(c){return c===45&&u===2?(n.consume(c),U):c===60&&u===1?(n.consume(c),j):c===62&&u===4?(n.consume(c),X):c===63&&u===3?(n.consume(c),o):c===93&&u===5?(n.consume(c),un):I(c)&&(u===6||u===7)?(n.exit("htmlFlowData"),n.check(ar,ln,O)(c)):c===null||I(c)?(n.exit("htmlFlowData"),O(c)):(n.consume(c),w)}function O(c){return n.check(sr,H,ln)(c)}function H(c){return n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),_}function _(c){return c===null||I(c)?O(c):(n.enter("htmlFlowData"),w(c))}function U(c){return c===45?(n.consume(c),o):w(c)}function j(c){return c===47?(n.consume(c),l="",J):w(c)}function J(c){if(c===62){const K=l.toLowerCase();return dt.includes(K)?(n.consume(c),X):w(c)}return en(c)&&l.length<8?(n.consume(c),l+=String.fromCharCode(c),J):w(c)}function un(c){return c===93?(n.consume(c),o):w(c)}function o(c){return c===62?(n.consume(c),X):c===45&&u===2?(n.consume(c),o):w(c)}function X(c){return c===null||I(c)?(n.exit("htmlFlowData"),ln(c)):(n.consume(c),X)}function ln(c){return n.exit("htmlFlow"),e(c)}}function hr(n,e,t){const r=this;return u;function u(l){return I(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),i):t(l)}function i(l){return r.parser.lazy[r.now().line]?t(l):e(l)}}function fr(n,e,t){return r;function r(u){return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),n.attempt(Pn,e,t)}}const pr={name:"htmlText",tokenize:mr};function mr(n,e,t){const r=this;let u,i,l;return a;function a(o){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(o),p}function p(o){return o===33?(n.consume(o),s):o===47?(n.consume(o),B):o===63?(n.consume(o),b):en(o)?(n.consume(o),q):t(o)}function s(o){return o===45?(n.consume(o),m):o===91?(n.consume(o),i=0,C):en(o)?(n.consume(o),D):t(o)}function m(o){return o===45?(n.consume(o),h):t(o)}function f(o){return o===null?t(o):o===45?(n.consume(o),g):I(o)?(l=f,j(o)):(n.consume(o),f)}function g(o){return o===45?(n.consume(o),h):f(o)}function h(o){return o===62?U(o):o===45?g(o):f(o)}function C(o){const X="CDATA[";return o===X.charCodeAt(i++)?(n.consume(o),i===X.length?F:C):t(o)}function F(o){return o===null?t(o):o===93?(n.consume(o),E):I(o)?(l=F,j(o)):(n.consume(o),F)}function E(o){return o===93?(n.consume(o),y):F(o)}function y(o){return o===62?U(o):o===93?(n.consume(o),y):F(o)}function D(o){return o===null||o===62?U(o):I(o)?(l=D,j(o)):(n.consume(o),D)}function b(o){return o===null?t(o):o===63?(n.consume(o),L):I(o)?(l=b,j(o)):(n.consume(o),b)}function L(o){return o===62?U(o):b(o)}function B(o){return en(o)?(n.consume(o),x):t(o)}function x(o){return o===45||nn(o)?(n.consume(o),x):A(o)}function A(o){return I(o)?(l=A,j(o)):P(o)?(n.consume(o),A):U(o)}function q(o){return o===45||nn(o)?(n.consume(o),q):o===47||o===62||Y(o)?M(o):t(o)}function M(o){return o===47?(n.consume(o),U):o===58||o===95||en(o)?(n.consume(o),V):I(o)?(l=M,j(o)):P(o)?(n.consume(o),M):U(o)}function V(o){return o===45||o===46||o===58||o===95||nn(o)?(n.consume(o),V):S(o)}function S(o){return o===61?(n.consume(o),w):I(o)?(l=S,j(o)):P(o)?(n.consume(o),S):M(o)}function w(o){return o===null||o===60||o===61||o===62||o===96?t(o):o===34||o===39?(n.consume(o),u=o,O):I(o)?(l=w,j(o)):P(o)?(n.consume(o),w):(n.consume(o),H)}function O(o){return o===u?(n.consume(o),u=void 0,_):o===null?t(o):I(o)?(l=O,j(o)):(n.consume(o),O)}function H(o){return o===null||o===34||o===39||o===60||o===61||o===96?t(o):o===47||o===62||Y(o)?M(o):(n.consume(o),H)}function _(o){return o===47||o===62||Y(o)?M(o):t(o)}function U(o){return o===62?(n.consume(o),n.exit("htmlTextData"),n.exit("htmlText"),e):t(o)}function j(o){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),J}function J(o){return P(o)?R(n,un,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):un(o)}function un(o){return n.enter("htmlTextData"),l(o)}}const Xn={name:"labelEnd",resolveAll:kr,resolveTo:yr,tokenize:br},gr={tokenize:wr},dr={tokenize:Sr},xr={tokenize:Ir};function kr(n){let e=-1;const t=[];for(;++e<n.length;){const r=n[e][1];if(t.push(n[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const u=r.type==="labelImage"?4:2;r.type="data",e+=u}}return n.length!==t.length&&rn(n,0,n.length,t),n}function yr(n,e){let t=n.length,r=0,u,i,l,a;for(;t--;)if(u=n[t][1],i){if(u.type==="link"||u.type==="labelLink"&&u._inactive)break;n[t][0]==="enter"&&u.type==="labelLink"&&(u._inactive=!0)}else if(l){if(n[t][0]==="enter"&&(u.type==="labelImage"||u.type==="labelLink")&&!u._balanced&&(i=t,u.type!=="labelLink")){r=2;break}}else u.type==="labelEnd"&&(l=t);const p={type:n[i][1].type==="labelLink"?"link":"image",start:{...n[i][1].start},end:{...n[n.length-1][1].end}},s={type:"label",start:{...n[i][1].start},end:{...n[l][1].end}},m={type:"labelText",start:{...n[i+r+2][1].end},end:{...n[l-2][1].start}};return a=[["enter",p,e],["enter",s,e]],a=G(a,n.slice(i+1,i+r+3)),a=G(a,[["enter",m,e]]),a=G(a,Jn(e.parser.constructs.insideSpan.null,n.slice(i+r+4,l-3),e)),a=G(a,[["exit",m,e],n[l-2],n[l-1],["exit",s,e]]),a=G(a,n.slice(l+1)),a=G(a,[["exit",p,e]]),rn(n,i,n.length,a),n}function br(n,e,t){const r=this;let u=r.events.length,i,l;for(;u--;)if((r.events[u][1].type==="labelImage"||r.events[u][1].type==="labelLink")&&!r.events[u][1]._balanced){i=r.events[u][1];break}return a;function a(g){return i?i._inactive?f(g):(l=r.parser.defined.includes(xn(r.sliceSerialize({start:i.end,end:r.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(g),n.exit("labelMarker"),n.exit("labelEnd"),p):t(g)}function p(g){return g===40?n.attempt(gr,m,l?m:f)(g):g===91?n.attempt(dr,m,l?s:f)(g):l?m(g):f(g)}function s(g){return n.attempt(xr,m,f)(g)}function m(g){return e(g)}function f(g){return i._balanced=!0,t(g)}}function wr(n,e,t){return r;function r(f){return n.enter("resource"),n.enter("resourceMarker"),n.consume(f),n.exit("resourceMarker"),u}function u(f){return Y(f)?In(n,i)(f):i(f)}function i(f){return f===41?m(f):Ct(n,l,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function l(f){return Y(f)?In(n,p)(f):m(f)}function a(f){return t(f)}function p(f){return f===34||f===39||f===40?Ft(n,s,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):m(f)}function s(f){return Y(f)?In(n,m)(f):m(f)}function m(f){return f===41?(n.enter("resourceMarker"),n.consume(f),n.exit("resourceMarker"),n.exit("resource"),e):t(f)}}function Sr(n,e,t){const r=this;return u;function u(a){return Tt.call(r,n,i,l,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(xn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):t(a)}function l(a){return t(a)}}function Ir(n,e,t){return r;function r(i){return n.enter("reference"),n.enter("referenceMarker"),n.consume(i),n.exit("referenceMarker"),u}function u(i){return i===93?(n.enter("referenceMarker"),n.consume(i),n.exit("referenceMarker"),n.exit("reference"),e):t(i)}}const Er={name:"labelStartImage",resolveAll:Xn.resolveAll,tokenize:zr};function zr(n,e,t){const r=this;return u;function u(a){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(a),n.exit("labelImageMarker"),i}function i(a){return a===91?(n.enter("labelMarker"),n.consume(a),n.exit("labelMarker"),n.exit("labelImage"),l):t(a)}function l(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(a):e(a)}}const Cr={name:"labelStartLink",resolveAll:Xn.resolveAll,tokenize:Tr};function Tr(n,e,t){const r=this;return u;function u(l){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(l),n.exit("labelMarker"),n.exit("labelLink"),i}function i(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(l):e(l)}}const Hn={name:"lineEnding",tokenize:Fr};function Fr(n,e){return t;function t(r){return n.enter("lineEnding"),n.consume(r),n.exit("lineEnding"),R(n,e,"linePrefix")}}const Ln={name:"thematicBreak",tokenize:Ar};function Ar(n,e,t){let r=0,u;return i;function i(s){return n.enter("thematicBreak"),l(s)}function l(s){return u=s,a(s)}function a(s){return s===u?(n.enter("thematicBreakSequence"),p(s)):r>=3&&(s===null||I(s))?(n.exit("thematicBreak"),e(s)):t(s)}function p(s){return s===u?(n.consume(s),r++,p):(n.exit("thematicBreakSequence"),P(s)?R(n,a,"whitespace")(s):a(s))}}const W={continuation:{tokenize:Br},exit:Nr,name:"list",tokenize:Pr},_r={partial:!0,tokenize:Rr},Lr={partial:!0,tokenize:Mr};function Pr(n,e,t){const r=this,u=r.events[r.events.length-1];let i=u&&u[1].type==="linePrefix"?u[2].sliceSerialize(u[1],!0).length:0,l=0;return a;function a(h){const C=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Yn(h)){if(r.containerState.type||(r.containerState.type=C,n.enter(C,{_container:!0})),C==="listUnordered")return n.enter("listItemPrefix"),h===42||h===45?n.check(Ln,t,s)(h):s(h);if(!r.interrupt||h===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),p(h)}return t(h)}function p(h){return Yn(h)&&++l<10?(n.consume(h),p):(!r.interrupt||l<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(n.exit("listItemValue"),s(h)):t(h)}function s(h){return n.enter("listItemMarker"),n.consume(h),n.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,n.check(Pn,r.interrupt?t:m,n.attempt(_r,g,f))}function m(h){return r.containerState.initialBlankLine=!0,i++,g(h)}function f(h){return P(h)?(n.enter("listItemPrefixWhitespace"),n.consume(h),n.exit("listItemPrefixWhitespace"),g):t(h)}function g(h){return r.containerState.size=i+r.sliceSerialize(n.exit("listItemPrefix"),!0).length,e(h)}}function Br(n,e,t){const r=this;return r.containerState._closeFlow=void 0,n.check(Pn,u,i);function u(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,R(n,e,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!P(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,n.attempt(Lr,e,l)(a))}function l(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,R(n,n.attempt(W,e,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Mr(n,e,t){const r=this;return R(n,u,"listItemIndent",r.containerState.size+1);function u(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):t(i)}}function Nr(n){n.exit(this.containerState.type)}function Rr(n,e,t){const r=this;return R(n,u,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function u(i){const l=r.events[r.events.length-1];return!P(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):t(i)}}const xt={name:"setextUnderline",resolveTo:Dr,tokenize:Vr};function Dr(n,e){let t=n.length,r,u,i;for(;t--;)if(n[t][0]==="enter"){if(n[t][1].type==="content"){r=t;break}n[t][1].type==="paragraph"&&(u=t)}else n[t][1].type==="content"&&n.splice(t,1),!i&&n[t][1].type==="definition"&&(i=t);const l={type:"setextHeading",start:{...n[r][1].start},end:{...n[n.length-1][1].end}};return n[u][1].type="setextHeadingText",i?(n.splice(u,0,["enter",l,e]),n.splice(i+1,0,["exit",n[r][1],e]),n[r][1].end={...n[i][1].end}):n[r][1]=l,n.push(["exit",l,e]),n}function Vr(n,e,t){const r=this;let u;return i;function i(s){let m=r.events.length,f;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){f=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(n.enter("setextHeadingLine"),u=s,l(s)):t(s)}function l(s){return n.enter("setextHeadingLineSequence"),a(s)}function a(s){return s===u?(n.consume(s),a):(n.exit("setextHeadingLineSequence"),P(s)?R(n,p,"lineSuffix")(s):p(s))}function p(s){return s===null||I(s)?(n.exit("setextHeadingLine"),e(s)):t(s)}}const Or={tokenize:qr};function qr(n){const e=this,t=n.attempt(Pn,r,n.attempt(this.parser.constructs.flowInitial,u,R(n,n.attempt(this.parser.constructs.flow,u,n.attempt(We,u)),"linePrefix")));return t;function r(i){if(i===null){n.consume(i);return}return n.enter("lineEndingBlank"),n.consume(i),n.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function u(i){if(i===null){n.consume(i);return}return n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),e.currentConstruct=void 0,t}}const Hr={resolveAll:_t()},jr=At("string"),Qr=At("text");function At(n){return{resolveAll:_t(n==="text"?Ur:void 0),tokenize:e};function e(t){const r=this,u=this.parser.constructs[n],i=t.attempt(u,l,a);return l;function l(m){return s(m)?i(m):a(m)}function a(m){if(m===null){t.consume(m);return}return t.enter("data"),t.consume(m),p}function p(m){return s(m)?(t.exit("data"),i(m)):(t.consume(m),p)}function s(m){if(m===null)return!0;const f=u[m];let g=-1;if(f)for(;++g<f.length;){const h=f[g];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function _t(n){return e;function e(t,r){let u=-1,i;for(;++u<=t.length;)i===void 0?t[u]&&t[u][1].type==="data"&&(i=u,u++):(!t[u]||t[u][1].type!=="data")&&(u!==i+2&&(t[i][1].end=t[u-1][1].end,t.splice(i+2,u-i-2),u=i+2),i=void 0);return n?n(t,r):t}}function Ur(n,e){let t=0;for(;++t<=n.length;)if((t===n.length||n[t][1].type==="lineEnding")&&n[t-1][1].type==="data"){const r=n[t-1][1],u=e.sliceStream(r);let i=u.length,l=-1,a=0,p;for(;i--;){const s=u[i];if(typeof s=="string"){for(l=s.length;s.charCodeAt(l-1)===32;)a++,l--;if(l)break;l=-1}else if(s===-2)p=!0,a++;else if(s!==-1){i++;break}}if(e._contentTypeTextTrailing&&t===n.length&&(a=0),a){const s={type:t===n.length||p||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:r.start._bufferIndex+l,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...s.start},r.start.offset===r.end.offset?Object.assign(r,s):(n.splice(t,0,["enter",s,e],["exit",s,e]),t+=2)}t++}return n}const Wr={42:W,43:W,45:W,48:W,49:W,50:W,51:W,52:W,53:W,54:W,55:W,56:W,57:W,62:St},Yr={91:Je},$r={[-2]:qn,[-1]:qn,32:qn},Zr={35:er,42:Ln,45:[xt,Ln],60:lr,61:xt,95:Ln,96:gt,126:gt},Gr={38:Et,92:It},Jr={[-5]:Hn,[-4]:Hn,[-3]:Hn,33:Er,38:Et,42:$n,60:[Ce,pr],91:Cr,92:[nr,It],93:Xn,95:$n,96:Oe},Xr={null:[$n,Hr]},Kr={null:[42,95]},vr={null:[]},ni=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Kr,contentInitial:Yr,disable:vr,document:Wr,flow:Zr,flowInitial:$r,insideSpan:Xr,string:Gr,text:Jr},Symbol.toStringTag,{value:"Module"}));function ti(n,e,t){let r={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0};const u={},i=[];let l=[],a=[];const p={attempt:A(B),check:A(x),consume:D,enter:b,exit:L,interrupt:A(x,{interrupt:!0})},s={code:null,containerState:{},defineSkip:F,events:[],now:C,parser:n,previous:null,sliceSerialize:g,sliceStream:h,write:f};let m=e.tokenize.call(s,p);return e.resolveAll&&i.push(e),s;function f(S){return l=G(l,S),E(),l[l.length-1]!==null?[]:(q(e,0),s.events=Jn(i,s.events,s),s.events)}function g(S,w){return ri(h(S),w)}function h(S){return ei(l,S)}function C(){const{_bufferIndex:S,_index:w,line:O,column:H,offset:_}=r;return{_bufferIndex:S,_index:w,line:O,column:H,offset:_}}function F(S){u[S.line]=S.column,V()}function E(){let S;for(;r._index<l.length;){const w=l[r._index];if(typeof w=="string")for(S=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===S&&r._bufferIndex<w.length;)y(w.charCodeAt(r._bufferIndex));else y(w)}}function y(S){m=m(S)}function D(S){I(S)?(r.line++,r.column=1,r.offset+=S===-3?2:1,V()):S!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),s.previous=S}function b(S,w){const O=w||{};return O.type=S,O.start=C(),s.events.push(["enter",O,s]),a.push(O),O}function L(S){const w=a.pop();return w.end=C(),s.events.push(["exit",w,s]),w}function B(S,w){q(S,w.from)}function x(S,w){w.restore()}function A(S,w){return O;function O(H,_,U){let j,J,un,o;return Array.isArray(H)?ln(H):"tokenize"in H?ln([H]):X(H);function X(Q){return kn;function kn(on){const mn=on!==null&&Q[on],gn=on!==null&&Q.null,zn=[...Array.isArray(mn)?mn:mn?[mn]:[],...Array.isArray(gn)?gn:gn?[gn]:[]];return ln(zn)(on)}}function ln(Q){return j=Q,J=0,Q.length===0?U:c(Q[J])}function c(Q){return kn;function kn(on){return o=M(),un=Q,Q.partial||(s.currentConstruct=Q),Q.name&&s.parser.constructs.disable.null.includes(Q.name)?fn():Q.tokenize.call(w?Object.assign(Object.create(s),w):s,p,K,fn)(on)}}function K(Q){return S(un,o),_}function fn(Q){return o.restore(),++J<j.length?c(j[J]):U}}}function q(S,w){S.resolveAll&&!i.includes(S)&&i.push(S),S.resolve&&rn(s.events,w,s.events.length-w,S.resolve(s.events.slice(w),s)),S.resolveTo&&(s.events=S.resolveTo(s.events,s))}function M(){const S=C(),w=s.previous,O=s.currentConstruct,H=s.events.length,_=Array.from(a);return{from:H,restore:U};function U(){r=S,s.previous=w,s.currentConstruct=O,s.events.length=H,a=_,V()}}function V(){r.line in u&&r.column<2&&(r.column=u[r.line],r.offset+=u[r.line]-1)}}function ei(n,e){const t=e.start._index,r=e.start._bufferIndex,u=e.end._index,i=e.end._bufferIndex;let l;if(t===u)l=[n[t].slice(r,i)];else{if(l=n.slice(t,u),r>-1){const a=l[0];typeof a=="string"?l[0]=a.slice(r):l.shift()}i>0&&l.push(n[u].slice(0,i))}return l}function ri(n,e){let t=-1;const r=[];let u;for(;++t<n.length;){const i=n[t];let l;if(typeof i=="string")l=i;else switch(i){case-5:{l="\r";break}case-4:{l=`
2
2
  `;break}case-3:{l=`\r
3
3
  `;break}case-2:{l=e?" ":" ";break}case-1:{if(!e&&u)continue;l=" ";break}default:l=String.fromCharCode(i)}u=i===-2,r.push(l)}return r.join("")}function ii(n){const r={constructs:he([ni,...(n||{}).extensions||[]]),content:u(ye),defined:[],document:u(we),flow:u(Or),lazy:{},string:u(jr),text:u(Qr)};return r;function u(i){return l;function l(a){return ti(r,i,a)}}}function ui(n){for(;!zt(n););return n}const kt=/[\0\t\n\r]/g;function li(){let n=1,e="",t=!0,r;return u;function u(i,l,a){const p=[];let s,m,f,g,h;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(l||void 0).decode(i)),f=0,e="",t&&(i.charCodeAt(0)===65279&&f++,t=void 0);f<i.length;){if(kt.lastIndex=f,s=kt.exec(i),g=s&&s.index!==void 0?s.index:i.length,h=i.charCodeAt(g),!s){e=i.slice(f);break}if(h===10&&f===g&&r)p.push(-3),r=void 0;else switch(r&&(p.push(-5),r=void 0),f<g&&(p.push(i.slice(f,g)),n+=g-f),h){case 0:{p.push(65533),n++;break}case 9:{for(m=Math.ceil(n/4)*4,p.push(-2);n++<m;)p.push(-1);break}case 10:{p.push(-4),n=1;break}default:r=!0,n=1}f=g+1}return a&&(r&&p.push(-5),e&&p.push(e),p.push(null)),p}}const ai=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function si(n){return n.replace(ai,oi)}function oi(n,e,t){if(e)return e;if(t.charCodeAt(0)===35){const u=t.charCodeAt(1),i=u===120||u===88;return wt(t.slice(i?2:1),i?16:10)}return Zn(t)||n}const Lt={}.hasOwnProperty;function ci(n,e,t){return typeof e!="string"&&(t=e,e=void 0),hi(t)(ui(ii(t).document().write(li()(n,e,!0))))}function hi(n){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(tt),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(Kn),blockQuote:i(gn),characterEscape:M,characterReference:M,codeFenced:i(zn),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:i(zn,l),codeText:i(Bt,l),codeTextData:M,data:M,codeFlowValue:M,definition:i(Mt),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:i(Nt),hardBreakEscape:i(vn),hardBreakTrailing:i(vn),htmlFlow:i(nt,l),htmlFlowData:M,htmlText:i(nt,l),htmlTextData:M,image:i(Rt),label:l,link:i(tt),listItem:i(Dt),listItemValue:g,listOrdered:i(et,f),listUnordered:i(et),paragraph:i(Vt),reference:c,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:i(Kn),strong:i(Ot),thematicBreak:i(Ht)},exit:{atxHeading:p(),atxHeadingSequence:B,autolink:p(),autolinkEmail:mn,autolinkProtocol:on,blockQuote:p(),characterEscapeValue:V,characterReferenceMarkerHexadecimal:fn,characterReferenceMarkerNumeric:fn,characterReferenceValue:Q,characterReference:kn,codeFenced:p(E),codeFencedFence:F,codeFencedFenceInfo:h,codeFencedFenceMeta:C,codeFlowValue:V,codeIndented:p(y),codeText:p(_),codeTextData:V,data:V,definition:p(),definitionDestinationString:L,definitionLabelString:D,definitionTitleString:b,emphasis:p(),hardBreakEscape:p(w),hardBreakTrailing:p(w),htmlFlow:p(O),htmlFlowData:V,htmlText:p(H),htmlTextData:V,image:p(j),label:un,labelText:J,lineEnding:S,link:p(U),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:K,resourceDestinationString:o,resourceTitleString:X,resource:ln,setextHeading:p(q),setextHeadingLineSequence:A,setextHeadingText:x,strong:p(),thematicBreak:p()}};Pt(e,(n||{}).mdastExtensions||[]);const t={};return r;function r(d){let k={type:"root",children:[]};const z={stack:[k],tokenStack:[],config:e,enter:a,exit:s,buffer:l,resume:m,data:t},T=[];let N=-1;for(;++N<d.length;)if(d[N][1].type==="listOrdered"||d[N][1].type==="listUnordered")if(d[N][0]==="enter")T.push(N);else{const v=T.pop();N=u(d,v,N)}for(N=-1;++N<d.length;){const v=e[d[N][0]];Lt.call(v,d[N][1].type)&&v[d[N][1].type].call(Object.assign({sliceSerialize:d[N][2].sliceSerialize},z),d[N][1])}if(z.tokenStack.length>0){const v=z.tokenStack[z.tokenStack.length-1];(v[1]||yt).call(z,void 0,v[0])}for(k.position={start:cn(d.length>0?d[0][1].start:{line:1,column:1,offset:0}),end:cn(d.length>0?d[d.length-2][1].end:{line:1,column:1,offset:0})},N=-1;++N<e.transforms.length;)k=e.transforms[N](k)||k;return k}function u(d,k,z){let T=k-1,N=-1,v=!1,pn,an,yn,bn;for(;++T<=z;){const Z=d[T];switch(Z[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Z[0]==="enter"?N++:N--,bn=void 0;break}case"lineEndingBlank":{Z[0]==="enter"&&(pn&&!bn&&!N&&!yn&&(yn=T),bn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:bn=void 0}if(!N&&Z[0]==="enter"&&Z[1].type==="listItemPrefix"||N===-1&&Z[0]==="exit"&&(Z[1].type==="listUnordered"||Z[1].type==="listOrdered")){if(pn){let dn=T;for(an=void 0;dn--;){const sn=d[dn];if(sn[1].type==="lineEnding"||sn[1].type==="lineEndingBlank"){if(sn[0]==="exit")continue;an&&(d[an][1].type="lineEndingBlank",v=!0),sn[1].type="lineEnding",an=dn}else if(!(sn[1].type==="linePrefix"||sn[1].type==="blockQuotePrefix"||sn[1].type==="blockQuotePrefixWhitespace"||sn[1].type==="blockQuoteMarker"||sn[1].type==="listItemIndent"))break}yn&&(!an||yn<an)&&(pn._spread=!0),pn.end=Object.assign({},an?d[an][1].start:Z[1].end),d.splice(an||T,0,["exit",pn,Z[2]]),T++,z++}if(Z[1].type==="listItemPrefix"){const dn={type:"listItem",_spread:!1,start:Object.assign({},Z[1].start),end:void 0};pn=dn,d.splice(T,0,["enter",dn,Z[2]]),T++,z++,yn=void 0,bn=!0}}}return d[k][1]._spread=v,z}function i(d,k){return z;function z(T){a.call(this,d(T),T),k&&k.call(this,T)}}function l(){this.stack.push({type:"fragment",children:[]})}function a(d,k,z){this.stack[this.stack.length-1].children.push(d),this.stack.push(d),this.tokenStack.push([k,z||void 0]),d.position={start:cn(k.start),end:void 0}}function p(d){return k;function k(z){d&&d.call(this,z),s.call(this,z)}}function s(d,k){const z=this.stack.pop(),T=this.tokenStack.pop();if(T)T[0].type!==d.type&&(k?k.call(this,d,T[0]):(T[1]||yt).call(this,d,T[0]));else throw new Error("Cannot close `"+d.type+"` ("+Sn({start:d.start,end:d.end})+"): it’s not open");z.position.end=cn(d.end)}function m(){return oe(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function g(d){if(this.data.expectingFirstListItemValue){const k=this.stack[this.stack.length-2];k.start=Number.parseInt(this.sliceSerialize(d),10),this.data.expectingFirstListItemValue=void 0}}function h(){const d=this.resume(),k=this.stack[this.stack.length-1];k.lang=d}function C(){const d=this.resume(),k=this.stack[this.stack.length-1];k.meta=d}function F(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const d=this.resume(),k=this.stack[this.stack.length-1];k.value=d.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const d=this.resume(),k=this.stack[this.stack.length-1];k.value=d.replace(/(\r?\n|\r)$/g,"")}function D(d){const k=this.resume(),z=this.stack[this.stack.length-1];z.label=k,z.identifier=xn(this.sliceSerialize(d)).toLowerCase()}function b(){const d=this.resume(),k=this.stack[this.stack.length-1];k.title=d}function L(){const d=this.resume(),k=this.stack[this.stack.length-1];k.url=d}function B(d){const k=this.stack[this.stack.length-1];if(!k.depth){const z=this.sliceSerialize(d).length;k.depth=z}}function x(){this.data.setextHeadingSlurpLineEnding=!0}function A(d){const k=this.stack[this.stack.length-1];k.depth=this.sliceSerialize(d).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function M(d){const z=this.stack[this.stack.length-1].children;let T=z[z.length-1];(!T||T.type!=="text")&&(T=qt(),T.position={start:cn(d.start),end:void 0},z.push(T)),this.stack.push(T)}function V(d){const k=this.stack.pop();k.value+=this.sliceSerialize(d),k.position.end=cn(d.end)}function S(d){const k=this.stack[this.stack.length-1];if(this.data.atHardBreak){const z=k.children[k.children.length-1];z.position.end=cn(d.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(k.type)&&(M.call(this,d),V.call(this,d))}function w(){this.data.atHardBreak=!0}function O(){const d=this.resume(),k=this.stack[this.stack.length-1];k.value=d}function H(){const d=this.resume(),k=this.stack[this.stack.length-1];k.value=d}function _(){const d=this.resume(),k=this.stack[this.stack.length-1];k.value=d}function U(){const d=this.stack[this.stack.length-1];if(this.data.inReference){const k=this.data.referenceType||"shortcut";d.type+="Reference",d.referenceType=k,delete d.url,delete d.title}else delete d.identifier,delete d.label;this.data.referenceType=void 0}function j(){const d=this.stack[this.stack.length-1];if(this.data.inReference){const k=this.data.referenceType||"shortcut";d.type+="Reference",d.referenceType=k,delete d.url,delete d.title}else delete d.identifier,delete d.label;this.data.referenceType=void 0}function J(d){const k=this.sliceSerialize(d),z=this.stack[this.stack.length-2];z.label=si(k),z.identifier=xn(k).toLowerCase()}function un(){const d=this.stack[this.stack.length-1],k=this.resume(),z=this.stack[this.stack.length-1];if(this.data.inReference=!0,z.type==="link"){const T=d.children;z.children=T}else z.alt=k}function o(){const d=this.resume(),k=this.stack[this.stack.length-1];k.url=d}function X(){const d=this.resume(),k=this.stack[this.stack.length-1];k.title=d}function ln(){this.data.inReference=void 0}function c(){this.data.referenceType="collapsed"}function K(d){const k=this.resume(),z=this.stack[this.stack.length-1];z.label=k,z.identifier=xn(this.sliceSerialize(d)).toLowerCase(),this.data.referenceType="full"}function fn(d){this.data.characterReferenceType=d.type}function Q(d){const k=this.sliceSerialize(d),z=this.data.characterReferenceType;let T;z?(T=wt(k,z==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):T=Zn(k);const N=this.stack[this.stack.length-1];N.value+=T}function kn(d){const k=this.stack.pop();k.position.end=cn(d.end)}function on(d){V.call(this,d);const k=this.stack[this.stack.length-1];k.url=this.sliceSerialize(d)}function mn(d){V.call(this,d);const k=this.stack[this.stack.length-1];k.url="mailto:"+this.sliceSerialize(d)}function gn(){return{type:"blockquote",children:[]}}function zn(){return{type:"code",lang:null,meta:null,value:""}}function Bt(){return{type:"inlineCode",value:""}}function Mt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Nt(){return{type:"emphasis",children:[]}}function Kn(){return{type:"heading",depth:0,children:[]}}function vn(){return{type:"break"}}function nt(){return{type:"html",value:""}}function Rt(){return{type:"image",title:null,url:"",alt:null}}function tt(){return{type:"link",title:null,url:"",children:[]}}function et(d){return{type:"list",ordered:d.type==="listOrdered",start:null,spread:d._spread,children:[]}}function Dt(d){return{type:"listItem",spread:d._spread,checked:null,children:[]}}function Vt(){return{type:"paragraph",children:[]}}function Ot(){return{type:"strong",children:[]}}function qt(){return{type:"text",value:""}}function Ht(){return{type:"thematicBreak"}}}function cn(n){return{line:n.line,column:n.column,offset:n.offset}}function Pt(n,e){let t=-1;for(;++t<e.length;){const r=e[t];Array.isArray(r)?Pt(n,r):fi(n,r)}}function fi(n,e){let t;for(t in e)if(Lt.call(e,t))switch(t){case"canContainEols":{const r=e[t];r&&n[t].push(...r);break}case"transforms":{const r=e[t];r&&n[t].push(...r);break}case"enter":case"exit":{const r=e[t];r&&Object.assign(n[t],r);break}}}function yt(n,e){throw n?new Error("Cannot close `"+n.type+"` ("+Sn({start:n.start,end:n.end})+"): a different token (`"+e.type+"`, "+Sn({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Sn({start:e.start,end:e.end})+") is still open")}function pi(n){const e=this;e.parser=t;function t(r){return ci(r,{...e.data("settings"),...n,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}const _n=n=>{let e="";const t=r=>{if(r.type==="text"||r.type==="inlineCode"||r.type==="code"){e+=r.value;return}if(r.type==="link"){e+=`${r.url}`;return}r.children&&r.children.length>0&&r.children.forEach(u=>{t(u)})};return t(n),e},mi=(n,e)=>{if(n.type==="heading"){const t=n.depth;for(let r=t-1;r>=0;r--)if(e[`${r}`])return e[`${r}`]}return e[0]},ki=(n,e)=>{var h,C,F;const r=ie().use(pi).parse(n);let u=!1;const i=(h=r.children)==null?void 0:h.find(E=>{if(E.type==="heading")return E});i&&((C=r.children)==null?void 0:C.filter(E=>E.type==="heading"&&i&&E.depth===i.depth).length)===1&&(u=!0);const l=_n(i),a=e||u&&l||"中心主题",p=Cn(null,!0,!1,Tn(a)),s=Fn(a,p.width,p.height,{layout:jt.right});s.isRoot=!0,s.type="mindmap";const m={0:s};let f=s;const g=(E,y=!1)=>{var D;if(!(u&&!e&&E===i))if(E.type==="heading"){const b=mi(E,m),L=_n(E);if(!L)return;const{width:B,height:x}=Cn(null,!1,!1,Tn(L)),A=Fn(L,B,x,{});b.children.push(A),m[`${E.depth}`]=A,f=A}else if(E.type==="list")(D=E.children)==null||D.forEach(b=>{g(b)});else if(E.type==="listItem"){if(E.children&&E.children.length>1){const A=f;E.children.forEach((q,M)=>{g(q,M===0)}),f=A;return}const b=_n(E);if(!b)return;const{width:L,height:B}=Cn(null,!1,!1,Tn(b)),x=Fn(b,L,B,{});f.children.push(x)}else{const b=_n(E);if(!b)return;const{width:L,height:B}=Cn(null,!1,!1,Tn(b)),x=Fn(b,L,B,{});f.children.push(x),y&&(f=x)}};return(F=r.children)==null||F.forEach(E=>{g(E)}),s};export{mi as getParentMindNode,_n as getTextFromNode,ki as parseMarkdownToDrawnix};
@@ -1,4 +1,4 @@
1
- import{ax as Se,ay as bt,az as be,aA as ee,aB as Z,r as l,aC as ve,aD as L,aE as wt,aF as ue,aG as yt,aH as jt,aI as Ot,aJ as xt,aK as _t,aL as Ct,I as se,_ as le,a5 as Ae,a7 as ae,a8 as Dt,a9 as Pt,aM as Et,aN as ge,aa as $e,ab as me,aO as It,Q as J,C as o,aP as St,aQ as q,$ as xe,aR as Le,aS as Nt,aT as Pe,aU as kt,aV as nt,aW as At,aX as Fe,aY as Me,aZ as $t}from"./index-DWUAFoZG.js";import{U as Lt}from"./upload-4sxUU7q_.js";/**
1
+ import{ax as Se,ay as bt,az as be,aA as ee,aB as Z,r as l,aC as ve,aD as L,aE as wt,aF as ue,aG as yt,aH as jt,aI as Ot,aJ as xt,aK as _t,aL as Ct,I as se,_ as le,a5 as Ae,a7 as ae,a8 as Dt,a9 as Pt,aM as Et,aN as ge,aa as $e,ab as me,aO as It,Q as J,C as o,aP as St,aQ as q,$ as xe,aR as Le,aS as Nt,aT as Pe,aU as kt,aV as nt,aW as At,aX as Fe,aY as Me,aZ as $t}from"./index-BBCAc4Al.js";import{U as Lt}from"./upload-B0RQ9yYL.js";/**
2
2
  * tdesign v1.16.3
3
3
  * (c) 2026 tdesign
4
4
  * @license MIT
@@ -1,4 +1,4 @@
1
- import{l as Y,B,e as D}from"./mermaid.core-DfVvnpgz.js";import"./index-DWUAFoZG.js";var O=(function(){var a=function(u,t,e,n){for(e=e||{},n=u.length;n--;e[u[n]]=t);return e},f=[6,9,10],m={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,s,r,i,d){switch(i.length-1,r){case 1:return s;case 4:break;case 6:s.setInfo(!0);break}},table:[{3:1,4:[1,2]},{1:[3]},a(f,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},a(f,[2,3]),a(f,[2,4]),a(f,[2,5]),a(f,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(e.recoverable)this.trace(t);else{var n=new Error(t);throw n.hash=e,n}},parse:function(t){var e=this,n=[0],s=[],r=[null],i=[],d=this.table,P="",v=0,L=0,N=2,T=1,R=i.slice.call(arguments,1),o=Object.create(this.lexer),p={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(p.yy[E]=this.yy[E]);o.setInput(t,p.yy),p.yy.lexer=o,p.yy.parser=this,typeof o.yylloc>"u"&&(o.yylloc={});var I=o.yylloc;i.push(I);var z=o.options&&o.options.ranges;typeof p.yy.parseError=="function"?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(){var y;return y=s.pop()||o.lex()||T,typeof y!="number"&&(y instanceof Array&&(s=y,y=s.pop()),y=e.symbols_[y]||y),y}for(var l,g,h,w,_={},b,c,F,S;;){if(g=n[n.length-1],this.defaultActions[g]?h=this.defaultActions[g]:((l===null||typeof l>"u")&&(l=U()),h=d[g]&&d[g][l]),typeof h>"u"||!h.length||!h[0]){var A="";S=[];for(b in d[g])this.terminals_[b]&&b>N&&S.push("'"+this.terminals_[b]+"'");o.showPosition?A="Parse error on line "+(v+1)+`:
1
+ import{l as Y,B,e as D}from"./mermaid.core--Np12uGY.js";import"./index-BBCAc4Al.js";var O=(function(){var a=function(u,t,e,n){for(e=e||{},n=u.length;n--;e[u[n]]=t);return e},f=[6,9,10],m={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,s,r,i,d){switch(i.length-1,r){case 1:return s;case 4:break;case 6:s.setInfo(!0);break}},table:[{3:1,4:[1,2]},{1:[3]},a(f,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},a(f,[2,3]),a(f,[2,4]),a(f,[2,5]),a(f,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(e.recoverable)this.trace(t);else{var n=new Error(t);throw n.hash=e,n}},parse:function(t){var e=this,n=[0],s=[],r=[null],i=[],d=this.table,P="",v=0,L=0,N=2,T=1,R=i.slice.call(arguments,1),o=Object.create(this.lexer),p={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(p.yy[E]=this.yy[E]);o.setInput(t,p.yy),p.yy.lexer=o,p.yy.parser=this,typeof o.yylloc>"u"&&(o.yylloc={});var I=o.yylloc;i.push(I);var z=o.options&&o.options.ranges;typeof p.yy.parseError=="function"?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(){var y;return y=s.pop()||o.lex()||T,typeof y!="number"&&(y instanceof Array&&(s=y,y=s.pop()),y=e.symbols_[y]||y),y}for(var l,g,h,w,_={},b,c,F,S;;){if(g=n[n.length-1],this.defaultActions[g]?h=this.defaultActions[g]:((l===null||typeof l>"u")&&(l=U()),h=d[g]&&d[g][l]),typeof h>"u"||!h.length||!h[0]){var A="";S=[];for(b in d[g])this.terminals_[b]&&b>N&&S.push("'"+this.terminals_[b]+"'");o.showPosition?A="Parse error on line "+(v+1)+`:
2
2
  `+o.showPosition()+`
3
3
  Expecting `+S.join(", ")+", got '"+(this.terminals_[l]||l)+"'":A="Parse error on line "+(v+1)+": Unexpected "+(l==T?"end of input":"'"+(this.terminals_[l]||l)+"'"),this.parseError(A,{text:o.match,token:this.terminals_[l]||l,line:o.yylineno,loc:I,expected:S})}if(h[0]instanceof Array&&h.length>1)throw new Error("Parse Error: multiple actions possible at state: "+g+", token: "+l);switch(h[0]){case 1:n.push(l),r.push(o.yytext),i.push(o.yylloc),n.push(h[1]),l=null,L=o.yyleng,P=o.yytext,v=o.yylineno,I=o.yylloc;break;case 2:if(c=this.productions_[h[1]][1],_.$=r[r.length-c],_._$={first_line:i[i.length-(c||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(c||1)].first_column,last_column:i[i.length-1].last_column},z&&(_._$.range=[i[i.length-(c||1)].range[0],i[i.length-1].range[1]]),w=this.performAction.apply(_,[P,L,v,p.yy,h[1],r,i].concat(R)),typeof w<"u")return w;c&&(n=n.slice(0,-1*c*2),r=r.slice(0,-1*c),i=i.slice(0,-1*c)),n.push(this.productions_[h[1]][0]),r.push(_.$),i.push(_._$),F=d[n[n.length-2]][n[n.length-1]],n.push(F);break;case 3:return!0}}return!0}},k=(function(){var u={EOF:1,parseError:function(e,n){if(this.yy.parser)this.yy.parser.parseError(e,n);else throw new Error(e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===s.length?this.yylloc.first_column:0)+s[s.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{l as U,D as Y,e as M}from"./index-BwSGXyRr.js";import"./index-DWUAFoZG.js";import"./isEmpty-Dj2GV0v-.js";var O=(function(){var a=function(u,t,e,n){for(e=e||{},n=u.length;n--;e[u[n]]=t);return e},f=[6,9,10],m={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,s,r,i,d){switch(i.length-1,r){case 1:return s;case 4:break;case 6:s.setInfo(!0);break}},table:[{3:1,4:[1,2]},{1:[3]},a(f,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},a(f,[2,3]),a(f,[2,4]),a(f,[2,5]),a(f,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(e.recoverable)this.trace(t);else{var n=new Error(t);throw n.hash=e,n}},parse:function(t){var e=this,n=[0],s=[],r=[null],i=[],d=this.table,P="",v=0,L=0,N=2,T=1,R=i.slice.call(arguments,1),o=Object.create(this.lexer),p={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(p.yy[E]=this.yy[E]);o.setInput(t,p.yy),p.yy.lexer=o,p.yy.parser=this,typeof o.yylloc>"u"&&(o.yylloc={});var I=o.yylloc;i.push(I);var z=o.options&&o.options.ranges;typeof p.yy.parseError=="function"?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function D(){var y;return y=s.pop()||o.lex()||T,typeof y!="number"&&(y instanceof Array&&(s=y,y=s.pop()),y=e.symbols_[y]||y),y}for(var l,g,h,w,_={},b,c,F,S;;){if(g=n[n.length-1],this.defaultActions[g]?h=this.defaultActions[g]:((l===null||typeof l>"u")&&(l=D()),h=d[g]&&d[g][l]),typeof h>"u"||!h.length||!h[0]){var A="";S=[];for(b in d[g])this.terminals_[b]&&b>N&&S.push("'"+this.terminals_[b]+"'");o.showPosition?A="Parse error on line "+(v+1)+`:
1
+ import{l as U,D as Y,e as M}from"./index-CMnHM-d8.js";import"./index-BBCAc4Al.js";import"./isEmpty-CRiX5iwN.js";var O=(function(){var a=function(u,t,e,n){for(e=e||{},n=u.length;n--;e[u[n]]=t);return e},f=[6,9,10],m={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,s,r,i,d){switch(i.length-1,r){case 1:return s;case 4:break;case 6:s.setInfo(!0);break}},table:[{3:1,4:[1,2]},{1:[3]},a(f,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},a(f,[2,3]),a(f,[2,4]),a(f,[2,5]),a(f,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(e.recoverable)this.trace(t);else{var n=new Error(t);throw n.hash=e,n}},parse:function(t){var e=this,n=[0],s=[],r=[null],i=[],d=this.table,P="",v=0,L=0,N=2,T=1,R=i.slice.call(arguments,1),o=Object.create(this.lexer),p={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(p.yy[E]=this.yy[E]);o.setInput(t,p.yy),p.yy.lexer=o,p.yy.parser=this,typeof o.yylloc>"u"&&(o.yylloc={});var I=o.yylloc;i.push(I);var z=o.options&&o.options.ranges;typeof p.yy.parseError=="function"?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function D(){var y;return y=s.pop()||o.lex()||T,typeof y!="number"&&(y instanceof Array&&(s=y,y=s.pop()),y=e.symbols_[y]||y),y}for(var l,g,h,w,_={},b,c,F,S;;){if(g=n[n.length-1],this.defaultActions[g]?h=this.defaultActions[g]:((l===null||typeof l>"u")&&(l=D()),h=d[g]&&d[g][l]),typeof h>"u"||!h.length||!h[0]){var A="";S=[];for(b in d[g])this.terminals_[b]&&b>N&&S.push("'"+this.terminals_[b]+"'");o.showPosition?A="Parse error on line "+(v+1)+`:
2
2
  `+o.showPosition()+`
3
3
  Expecting `+S.join(", ")+", got '"+(this.terminals_[l]||l)+"'":A="Parse error on line "+(v+1)+": Unexpected "+(l==T?"end of input":"'"+(this.terminals_[l]||l)+"'"),this.parseError(A,{text:o.match,token:this.terminals_[l]||l,line:o.yylineno,loc:I,expected:S})}if(h[0]instanceof Array&&h.length>1)throw new Error("Parse Error: multiple actions possible at state: "+g+", token: "+l);switch(h[0]){case 1:n.push(l),r.push(o.yytext),i.push(o.yylloc),n.push(h[1]),l=null,L=o.yyleng,P=o.yytext,v=o.yylineno,I=o.yylloc;break;case 2:if(c=this.productions_[h[1]][1],_.$=r[r.length-c],_._$={first_line:i[i.length-(c||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(c||1)].first_column,last_column:i[i.length-1].last_column},z&&(_._$.range=[i[i.length-(c||1)].range[0],i[i.length-1].range[1]]),w=this.performAction.apply(_,[P,L,v,p.yy,h[1],r,i].concat(R)),typeof w<"u")return w;c&&(n=n.slice(0,-1*c*2),r=r.slice(0,-1*c),i=i.slice(0,-1*c)),n.push(this.productions_[h[1]][0]),r.push(_.$),i.push(_._$),F=d[n[n.length-2]][n[n.length-1]],n.push(F);break;case 3:return!0}}return!0}},k=(function(){var u={EOF:1,parseError:function(e,n){if(this.yy.parser)this.yy.parser.parseError(e,n);else throw new Error(e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===s.length?this.yylloc.first_column:0)+s[s.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
@@ -1 +1 @@
1
- import{q as l,t as d,m as T,n as k,o as y,s as h}from"./index-DWUAFoZG.js";function f(){var e;return k.get().imageModelName||((e=y[0])==null?void 0:e.id)||"gemini-2.5-flash-image-vip"}function M(t,e){const r=h.zh;return r(t,e)}function A(t,e){const{theme:r,imageCount:u=l.imageCount,imageSize:o="16x9",referenceImages:s,model:I}=t;if(!r||typeof r!="string")return{success:!1,error:"缺少必填参数 theme(主题描述)",type:"error"};const n=Math.min(Math.max(1,u),16),m=M(r,n),c=I||f(),i=s==null?void 0:s.map((a,g)=>({type:"url",url:a,name:`reference-${g+1}`}));try{let a;if(e!=null&&e.retryTaskId){if(d.retryTask(e.retryTaskId),a=d.getTask(e.retryTaskId),!a)throw new Error(`重试任务不存在: ${e.retryTaskId}`)}else a=d.createTask({prompt:m,size:o,model:c,uploadedImages:i&&i.length>0?i:void 0,isInspirationBoard:!0,inspirationBoardImageCount:n,inspirationBoardLayoutStyle:"inspiration-board",originalTheme:r,batchId:e==null?void 0:e.batchId,globalIndex:(e==null?void 0:e.globalIndex)||1,autoInsertToCanvas:!0},T.IMAGE);return{success:!0,data:{taskId:a.id,theme:r,imageCount:n,prompt:m.substring(0,100)+"..."},type:"image",taskId:a.id,task:a}}catch(a){return console.error("[InspirationBoard] Failed to create task:",a),{success:!1,error:a.message||"创建灵感图任务失败",type:"error"}}}export{A as createInspirationBoardTask};
1
+ import{q as l,t as d,m as T,n as k,o as y,s as h}from"./index-BBCAc4Al.js";function f(){var e;return k.get().imageModelName||((e=y[0])==null?void 0:e.id)||"gemini-2.5-flash-image-vip"}function M(t,e){const r=h.zh;return r(t,e)}function A(t,e){const{theme:r,imageCount:u=l.imageCount,imageSize:o="16x9",referenceImages:s,model:I}=t;if(!r||typeof r!="string")return{success:!1,error:"缺少必填参数 theme(主题描述)",type:"error"};const n=Math.min(Math.max(1,u),16),m=M(r,n),c=I||f(),i=s==null?void 0:s.map((a,g)=>({type:"url",url:a,name:`reference-${g+1}`}));try{let a;if(e!=null&&e.retryTaskId){if(d.retryTask(e.retryTaskId),a=d.getTask(e.retryTaskId),!a)throw new Error(`重试任务不存在: ${e.retryTaskId}`)}else a=d.createTask({prompt:m,size:o,model:c,uploadedImages:i&&i.length>0?i:void 0,isInspirationBoard:!0,inspirationBoardImageCount:n,inspirationBoardLayoutStyle:"inspiration-board",originalTheme:r,batchId:e==null?void 0:e.batchId,globalIndex:(e==null?void 0:e.globalIndex)||1,autoInsertToCanvas:!0},T.IMAGE);return{success:!0,data:{taskId:a.id,theme:r,imageCount:n,prompt:m.substring(0,100)+"..."},type:"image",taskId:a.id,task:a}}catch(a){return console.error("[InspirationBoard] Failed to create task:",a),{success:!1,error:a.message||"创建灵感图任务失败",type:"error"}}}export{A as createInspirationBoardTask};
@@ -1 +1 @@
1
- import{c as i,d as e,e as o,f as n,g as f,h as a,j as p,k as y}from"./index-DWUAFoZG.js";var g="[object Map]",c="[object Set]",b=Object.prototype,h=b.hasOwnProperty;function m(r){if(r==null)return!0;if(i(r)&&(e(r)||typeof r=="string"||typeof r.splice=="function"||o(r)||n(r)||f(r)))return!r.length;var t=a(r);if(t==g||t==c)return!r.size;if(p(r))return!y(r).length;for(var s in r)if(h.call(r,s))return!1;return!0}export{m as i};
1
+ import{c as i,d as e,e as o,f as n,g as f,h as a,j as p,k as y}from"./index-BBCAc4Al.js";var g="[object Map]",c="[object Set]",b=Object.prototype,h=b.hasOwnProperty;function m(r){if(r==null)return!0;if(i(r)&&(e(r)||typeof r=="string"||typeof r.splice=="function"||o(r)||n(r)||f(r)))return!r.length;var t=a(r);if(t==g||t==c)return!r.size;if(p(r))return!y(r).length;for(var s in r)if(h.call(r,s))return!1;return!0}export{m as i};
@@ -1,4 +1,4 @@
1
- import{a as yt,s as ft,b as dt,c as pt,o as gt,p as mt,g as I,d as H,e as xt,r as kt}from"./index-BwSGXyRr.js";import{a as _t,g as it,f as bt,d as vt}from"./svgDrawCommon-08f97a94-C_DhKfny.js";import{a as Q}from"./arc-ajYHRRnk.js";import"./index-DWUAFoZG.js";import"./isEmpty-Dj2GV0v-.js";import"./path-CbwjOpE9.js";var X=(function(){var t=function(p,s,r,a){for(r=r||{},a=p.length;a--;r[p[a]]=s);return r},e=[6,8,10,11,12,14,16,17,18],i=[1,9],l=[1,10],n=[1,11],h=[1,12],c=[1,13],f=[1,14],y={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:function(s,r,a,u,d,o,w){var k=o.length-1;switch(d){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:u.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),u.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),u.setAccDescription(this.$);break;case 12:u.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:u.addTask(o[k-1],o[k]),this.$="task";break}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:i,12:l,14:n,16:h,17:c,18:f},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:i,12:l,14:n,16:h,17:c,18:f},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:function(s,r){if(r.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=r,a}},parse:function(s){var r=this,a=[0],u=[],d=[null],o=[],w=this.table,k="",R=0,Z=0,lt=2,J=1,ct=o.slice.call(arguments,1),x=Object.create(this.lexer),S={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(S.yy[z]=this.yy[z]);x.setInput(s,S.yy),S.yy.lexer=x,S.yy.parser=this,typeof x.yylloc>"u"&&(x.yylloc={});var Y=x.yylloc;o.push(Y);var ht=x.options&&x.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ut(){var T;return T=u.pop()||x.lex()||J,typeof T!="number"&&(T instanceof Array&&(u=T,T=u.pop()),T=r.symbols_[T]||T),T}for(var _,E,b,O,A={},N,$,K,B;;){if(E=a[a.length-1],this.defaultActions[E]?b=this.defaultActions[E]:((_===null||typeof _>"u")&&(_=ut()),b=w[E]&&w[E][_]),typeof b>"u"||!b.length||!b[0]){var q="";B=[];for(N in w[E])this.terminals_[N]&&N>lt&&B.push("'"+this.terminals_[N]+"'");x.showPosition?q="Parse error on line "+(R+1)+`:
1
+ import{a as yt,s as ft,b as dt,c as pt,o as gt,p as mt,g as I,d as H,e as xt,r as kt}from"./index-CMnHM-d8.js";import{a as _t,g as it,f as bt,d as vt}from"./svgDrawCommon-08f97a94-Cma2KGuK.js";import{a as Q}from"./arc-DpZjyIR9.js";import"./index-BBCAc4Al.js";import"./isEmpty-CRiX5iwN.js";import"./path-CbwjOpE9.js";var X=(function(){var t=function(p,s,r,a){for(r=r||{},a=p.length;a--;r[p[a]]=s);return r},e=[6,8,10,11,12,14,16,17,18],i=[1,9],l=[1,10],n=[1,11],h=[1,12],c=[1,13],f=[1,14],y={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:function(s,r,a,u,d,o,w){var k=o.length-1;switch(d){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:u.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),u.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),u.setAccDescription(this.$);break;case 12:u.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:u.addTask(o[k-1],o[k]),this.$="task";break}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:i,12:l,14:n,16:h,17:c,18:f},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:i,12:l,14:n,16:h,17:c,18:f},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:function(s,r){if(r.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=r,a}},parse:function(s){var r=this,a=[0],u=[],d=[null],o=[],w=this.table,k="",R=0,Z=0,lt=2,J=1,ct=o.slice.call(arguments,1),x=Object.create(this.lexer),S={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(S.yy[z]=this.yy[z]);x.setInput(s,S.yy),S.yy.lexer=x,S.yy.parser=this,typeof x.yylloc>"u"&&(x.yylloc={});var Y=x.yylloc;o.push(Y);var ht=x.options&&x.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ut(){var T;return T=u.pop()||x.lex()||J,typeof T!="number"&&(T instanceof Array&&(u=T,T=u.pop()),T=r.symbols_[T]||T),T}for(var _,E,b,O,A={},N,$,K,B;;){if(E=a[a.length-1],this.defaultActions[E]?b=this.defaultActions[E]:((_===null||typeof _>"u")&&(_=ut()),b=w[E]&&w[E][_]),typeof b>"u"||!b.length||!b[0]){var q="";B=[];for(N in w[E])this.terminals_[N]&&N>lt&&B.push("'"+this.terminals_[N]+"'");x.showPosition?q="Parse error on line "+(R+1)+`:
2
2
  `+x.showPosition()+`
3
3
  Expecting `+B.join(", ")+", got '"+(this.terminals_[_]||_)+"'":q="Parse error on line "+(R+1)+": Unexpected "+(_==J?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(q,{text:x.match,token:this.terminals_[_]||_,line:x.yylineno,loc:Y,expected:B})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+E+", token: "+_);switch(b[0]){case 1:a.push(_),d.push(x.yytext),o.push(x.yylloc),a.push(b[1]),_=null,Z=x.yyleng,k=x.yytext,R=x.yylineno,Y=x.yylloc;break;case 2:if($=this.productions_[b[1]][1],A.$=d[d.length-$],A._$={first_line:o[o.length-($||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-($||1)].first_column,last_column:o[o.length-1].last_column},ht&&(A._$.range=[o[o.length-($||1)].range[0],o[o.length-1].range[1]]),O=this.performAction.apply(A,[k,Z,R,S.yy,b[1],d,o].concat(ct)),typeof O<"u")return O;$&&(a=a.slice(0,-1*$*2),d=d.slice(0,-1*$),o=o.slice(0,-1*$)),a.push(this.productions_[b[1]][0]),d.push(A.$),o.push(A._$),K=w[a[a.length-2]][a[a.length-1]],a.push(K);break;case 3:return!0}}return!0}},m=(function(){var p={EOF:1,parseError:function(r,a){if(this.yy.parser)this.yy.parser.parseError(r,a);else throw new Error(r)},setInput:function(s,r){return this.yy=r||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var r=s.match(/(?:\r\n?|\n).*/g);return r?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},unput:function(s){var r=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-r),this.offset-=r;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===u.length?this.yylloc.first_column:0)+u[u.length-a.length].length-a[0].length:this.yylloc.first_column-r},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-r]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(s){this.unput(this.match.slice(s))},pastInput:function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var s=this.pastInput(),r=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{a as yt,s as ft,b as dt,c as pt,o as gt,p as mt,g as I,d as H,e as xt,r as kt}from"./mermaid.core-DfVvnpgz.js";import{a as _t,g as it,f as bt,d as vt}from"./svgDrawCommon-08f97a94-DSBqmUv2.js";import{a as Q}from"./arc-BZXVqUcI.js";import"./index-DWUAFoZG.js";import"./path-CY0bYimO.js";var X=(function(){var t=function(p,s,r,a){for(r=r||{},a=p.length;a--;r[p[a]]=s);return r},e=[6,8,10,11,12,14,16,17,18],i=[1,9],l=[1,10],n=[1,11],h=[1,12],c=[1,13],f=[1,14],y={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:function(s,r,a,u,d,o,w){var k=o.length-1;switch(d){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:u.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),u.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),u.setAccDescription(this.$);break;case 12:u.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:u.addTask(o[k-1],o[k]),this.$="task";break}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:i,12:l,14:n,16:h,17:c,18:f},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:i,12:l,14:n,16:h,17:c,18:f},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:function(s,r){if(r.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=r,a}},parse:function(s){var r=this,a=[0],u=[],d=[null],o=[],w=this.table,k="",R=0,Z=0,lt=2,J=1,ct=o.slice.call(arguments,1),x=Object.create(this.lexer),S={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(S.yy[z]=this.yy[z]);x.setInput(s,S.yy),S.yy.lexer=x,S.yy.parser=this,typeof x.yylloc>"u"&&(x.yylloc={});var Y=x.yylloc;o.push(Y);var ht=x.options&&x.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ut(){var T;return T=u.pop()||x.lex()||J,typeof T!="number"&&(T instanceof Array&&(u=T,T=u.pop()),T=r.symbols_[T]||T),T}for(var _,E,b,O,A={},N,$,K,B;;){if(E=a[a.length-1],this.defaultActions[E]?b=this.defaultActions[E]:((_===null||typeof _>"u")&&(_=ut()),b=w[E]&&w[E][_]),typeof b>"u"||!b.length||!b[0]){var q="";B=[];for(N in w[E])this.terminals_[N]&&N>lt&&B.push("'"+this.terminals_[N]+"'");x.showPosition?q="Parse error on line "+(R+1)+`:
1
+ import{a as yt,s as ft,b as dt,c as pt,o as gt,p as mt,g as I,d as H,e as xt,r as kt}from"./mermaid.core--Np12uGY.js";import{a as _t,g as it,f as bt,d as vt}from"./svgDrawCommon-08f97a94-p3hABH7b.js";import{a as Q}from"./arc-amy12ZHI.js";import"./index-BBCAc4Al.js";import"./path-CY0bYimO.js";var X=(function(){var t=function(p,s,r,a){for(r=r||{},a=p.length;a--;r[p[a]]=s);return r},e=[6,8,10,11,12,14,16,17,18],i=[1,9],l=[1,10],n=[1,11],h=[1,12],c=[1,13],f=[1,14],y={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:function(s,r,a,u,d,o,w){var k=o.length-1;switch(d){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:u.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),u.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),u.setAccDescription(this.$);break;case 12:u.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:u.addTask(o[k-1],o[k]),this.$="task";break}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:i,12:l,14:n,16:h,17:c,18:f},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:i,12:l,14:n,16:h,17:c,18:f},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:function(s,r){if(r.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=r,a}},parse:function(s){var r=this,a=[0],u=[],d=[null],o=[],w=this.table,k="",R=0,Z=0,lt=2,J=1,ct=o.slice.call(arguments,1),x=Object.create(this.lexer),S={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(S.yy[z]=this.yy[z]);x.setInput(s,S.yy),S.yy.lexer=x,S.yy.parser=this,typeof x.yylloc>"u"&&(x.yylloc={});var Y=x.yylloc;o.push(Y);var ht=x.options&&x.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ut(){var T;return T=u.pop()||x.lex()||J,typeof T!="number"&&(T instanceof Array&&(u=T,T=u.pop()),T=r.symbols_[T]||T),T}for(var _,E,b,O,A={},N,$,K,B;;){if(E=a[a.length-1],this.defaultActions[E]?b=this.defaultActions[E]:((_===null||typeof _>"u")&&(_=ut()),b=w[E]&&w[E][_]),typeof b>"u"||!b.length||!b[0]){var q="";B=[];for(N in w[E])this.terminals_[N]&&N>lt&&B.push("'"+this.terminals_[N]+"'");x.showPosition?q="Parse error on line "+(R+1)+`:
2
2
  `+x.showPosition()+`
3
3
  Expecting `+B.join(", ")+", got '"+(this.terminals_[_]||_)+"'":q="Parse error on line "+(R+1)+": Unexpected "+(_==J?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(q,{text:x.match,token:this.terminals_[_]||_,line:x.yylineno,loc:Y,expected:B})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+E+", token: "+_);switch(b[0]){case 1:a.push(_),d.push(x.yytext),o.push(x.yylloc),a.push(b[1]),_=null,Z=x.yyleng,k=x.yytext,R=x.yylineno,Y=x.yylloc;break;case 2:if($=this.productions_[b[1]][1],A.$=d[d.length-$],A._$={first_line:o[o.length-($||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-($||1)].first_column,last_column:o[o.length-1].last_column},ht&&(A._$.range=[o[o.length-($||1)].range[0],o[o.length-1].range[1]]),O=this.performAction.apply(A,[k,Z,R,S.yy,b[1],d,o].concat(ct)),typeof O<"u")return O;$&&(a=a.slice(0,-1*$*2),d=d.slice(0,-1*$),o=o.slice(0,-1*$)),a.push(this.productions_[b[1]][0]),d.push(A.$),o.push(A._$),K=w[a[a.length-2]][a[a.length-1]],a.push(K);break;case 3:return!0}}return!0}},m=(function(){var p={EOF:1,parseError:function(r,a){if(this.yy.parser)this.yy.parser.parseError(r,a);else throw new Error(r)},setInput:function(s,r){return this.yy=r||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var r=s.match(/(?:\r\n?|\n).*/g);return r?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},unput:function(s){var r=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-r),this.offset-=r;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===u.length?this.yylloc.first_column:0)+u[u.length-a.length].length-a[0].length:this.yylloc.first_column-r},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-r]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(s){this.unput(this.match.slice(s))},pastInput:function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var s=this.pastInput(),r=new Array(s.length+1).join("-");return s+this.upcomingInput()+`