finch-markdown-editor 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/panel.js CHANGED
@@ -1,43 +1,44 @@
1
- "use strict";(()=>{(function(){"use strict";var i=window.finch,qe=/^zh/i.test(navigator.language||""),We={zh:{"meta.title":"\u516C\u4F17\u53F7\u6587\u7AE0\u9884\u89C8","home.title":"\u5199\u5B57","home.tagline.withAssistant":"\u4F60\u4E0E{name}\u4E00\u8D77\u7F16\u6392 Markdown \u6587\u4EF6","home.tagline.default":"\u6253\u5F00\u4E00\u4E2A Markdown \u6587\u4EF6\u5F00\u59CB\u7F16\u8F91\u4E0E\u9884\u89C8\uFF0C\u6216\u65B0\u5EFA\u4E00\u7BC7\u6587\u7AE0\u3002","home.openFile":"\u6253\u5F00\u6587\u4EF6","home.newDoc":"\u65B0\u5EFA\u6587\u6863","home.recentLabel":"\u6700\u8FD1\u7F16\u8F91","home.hintScoped":"\u8FD9\u4E2A\u76EE\u5F55\u91CC\u8FD8\u6CA1\u6709\u7528\u7F16\u8F91\u5668\u6253\u5F00\u8FC7\u7684 Markdown \u6587\u6863\u3002","home.hintDefault":"\u6253\u5F00\u4E00\u4E2A Markdown \u6587\u4EF6\uFF0C\u4E4B\u540E\u8FD9\u91CC\u4F1A\u5217\u51FA\u6700\u8FD1\u7F16\u8F91\u7684\u6587\u6863\u3002","home.untitled":"\u672A\u547D\u540D","home.revealInFileManager":"\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D","home.emptyDoc":"\uFF08\u7A7A\u6587\u6863\uFF09","home.cwdTitle":"\u5728\u8BBF\u8FBE / \u6587\u4EF6\u8D44\u6E90\u7BA1\u7406\u5668\u4E2D\u6253\u5F00\uFF1A{path}","home.cwdFallback":"homePath\uFF08\u65E0 cwd \u56DE\u9000\uFF09","home.today":"\u4ECA\u5929 {clock}","home.yesterday":"\u6628\u5929 {clock}","appview.library":"\u8D44\u6599\u5E93","appview.libraryHint":"\u6240\u6709\u7A7A\u95F4\u7684\u6700\u8FD1\u6587\u6863","appview.libraryWorkspace":"\u5DE5\u4F5C\u95F4\u6587\u4EF6","appview.libraryOther":"\u5176\u4ED6","appview.rewrite":"\u6539\u5199","appview.focus":"\u4E13\u6CE8","appview.openSession":"\u6253\u5F00\u6539\u5199\u4F1A\u8BDD","appview.rewriting":"\u5DF2\u53D1\u8D77\u6539\u5199\uFF0C\u4F1A\u8BDD\u6B63\u5728\u5904\u7406\u5E76\u5C06\u76F4\u63A5\u5199\u56DE\u6587\u4EF6\u3002","appview.continuing":"\u5DF2\u53D1\u8D77\u7EED\u5199\uFF0C\u4F1A\u8BDD\u6B63\u5728\u5904\u7406\u5E76\u5C06\u76F4\u63A5\u5199\u56DE\u6587\u4EF6\u3002","appview.hintSpace":"\u6309 space\uFF08\u7A7A\u683C\uFF09\u4EE5\u542F\u7528 AI \xB7 \u6309 / \u9009\u62E9\u683C\u5F0F","appview.hintSpaceCode":"\u6309 space\uFF08\u7A7A\u683C\uFF09\u4EE5\u542F\u7528 AI","appview.rewriteDone":"\u6539\u5199\u5DF2\u5B8C\u6210\uFF0C\u6587\u4EF6\u5185\u5BB9\u5DF2\u5237\u65B0\u3002","editor.ariaLabel":"\u5199\u5B57\u7F16\u8F91\u5668","actions.copyToWx":"\u590D\u5236\u5230\u516C\u4F17\u53F7","actions.copyImg":"\u590D\u5236\u56FE\u7247","actions.exportImg":"\u5BFC\u51FA\u56FE\u7247\uFF08\u4E0B\u8F7D\uFF09","actions.exportPdf":"\u5BFC\u51FA PDF","actions.aiStyle":"\u8BA9 AI \u8BBE\u8BA1\u6392\u7248","actions.toggle":"\u5C55\u5F00/\u6536\u8D77","popup.placeholder":"\u8BA9 {name} \u7F16\u8F91","popup.placeholderContinue":"\u8BA9 {name} \u4ECE\u8FD9\u91CC\u7EED\u5199\u2026","popup.send":"\u53D1\u9001","confirm.cancel":"\u53D6\u6D88","confirm.discard":"\u4E0D\u4FDD\u5B58","confirm.save":"\u4FDD\u5B58\u5E76\u8FD4\u56DE","confirm.message":"\u300C{file}\u300D\u8FD8\u6709\u672A\u4FDD\u5B58\u7684\u6539\u52A8\uFF0C\u8981\u4FDD\u5B58\u540E\u518D\u8FD4\u56DE\u9996\u9875\u5417\uFF1F","common.markdownDocDefault":"Markdown \u6587\u6863","common.customStyleDefault":"\u81EA\u5B9A\u4E49\u98CE\u683C","toolbar.home.tooltip":"\u8FD4\u56DE\u9996\u9875","toolbar.open.tooltipDefault":"\u6253\u5F00 Markdown \u6587\u4EF6","toolbar.save.label":"\u4FDD\u5B58","toolbar.save.tooltipDefault":"\u4FDD\u5B58\uFF08\u2318/Ctrl+S\uFF09","toolbar.save.tooltipDirty":"\u6709\u672A\u4FDD\u5B58\u7684\u6539\u52A8\uFF08\u2318/Ctrl+S\uFF09","toolbar.save.labelSaved":"\u5DF2\u4FDD\u5B58","toolbar.save.tooltipSaved":"\u5DF2\u4FDD\u5B58","toolbar.annotate.label":"\u6279\u6CE8","toolbar.annotate.tooltipOn":"\u6279\u6CE8\u5DF2\u5F00\u542F\uFF1A\u9009\u4E2D\u6587\u5B57\u53EF\u53D1\u8D77 AI \u4FEE\u6539","toolbar.annotate.tooltipOff":"\u5F00\u542F\u6279\u6CE8\uFF1A\u9009\u4E2D\u6587\u5B57\u540E\u53EF\u53D1\u8D77 AI \u4FEE\u6539","toolbar.needDoc":"\u8BF7\u5148\u6253\u5F00\u6587\u6863","toolbar.mode.label":"\u9884\u89C8","toolbar.mode.tooltipToPreview":"\u5207\u6362\u5230\u9884\u89C8","toolbar.mode.tooltipToEdit":"\u5207\u6362\u5230\u7F16\u8F91","toolbar.mode.tooltipRendering":"\u6B63\u5728\u6E32\u67D3\u9884\u89C8\u2026","toolbar.style.tooltip":"\u6392\u7248\u98CE\u683C","toolbar.style.tooltipNeedsPreview":"\u8BF7\u5148\u5207\u6362\u5230\u9884\u89C8","toolbar.style.customSlot":"\u81EA\u5B9A\u4E49\u98CE\u683C {n} \xB7 {label}","toolbar.style.customSlotEmpty":"\u81EA\u5B9A\u4E49\u98CE\u683C {n}\uFF08\u7A7A\uFF09","toolbar.fontSize.tooltipPreview":"\u9884\u89C8\u65F6\u4E0D\u53EF\u66F4\u6539\u5B57\u4F53","toolbar.fontSize.tooltipEdit":"\u7F16\u8F91\u5668\u5B57\u4F53\u5927\u5C0F","toolbar.fontSize.small":"\u5C0F","toolbar.fontSize.medium":"\u4E2D","toolbar.fontSize.large":"\u5927","toolbar.fontFamily.default":"\u9ED8\u8BA4\uFF08\u65E0\u886C\u7EBF\uFF09","toolbar.fontFamily.serif":"\u886C\u7EBF\u4F53","toolbar.comfort.read":"\u7D27\u51D1","toolbar.comfort.write":"\u8212\u9002","toolbar.focus.tooltipOn":"\u4E13\u6CE8\u5DF2\u5F00\u542F\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E","toolbar.focus.tooltipOff":"\u5F00\u542F\u4E13\u6CE8\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E","toolbar.more.reload":"\u91CD\u65B0\u6E32\u67D3","toolbar.more.reveal":"\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D","toolbar.more.about":"\u5173\u4E8E\u6E32\u67D3","toolbar.more.tooltip":"\u66F4\u591A","annotate.lineUnknown":"\uFF08\u672A\u80FD\u7CBE\u786E\u5B9A\u4F4D\u5BF9\u5E94\u884C\u53F7\uFF0C\u8BF7\u4EE5\u4E0B\u65B9\u5F15\u7528\u6587\u672C\u4E3A\u51C6\uFF09","annotate.lineSingle":"\u7B2C {a} \u884C","annotate.lineRange":"\u7B2C {a}\u2013{b} \u884C","annotate.lineCompactUnknown":"\u672A\u5B9A\u4F4D","annotate.requirementWith":"\u8981\u6C42\uFF1A{comment}","annotate.requirementDefault":"\u8BA9\u8868\u8FBE\u66F4\u6E05\u6670","annotate.pathMissing":"\uFF08\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF0C\u8BF7\u5148\u7C98\u8D34/\u4FDD\u5B58\u5168\u90E8\u5185\u5BB9\uFF09","annotate.emptyLine":"\uFF08\u7A7A\u884C\uFF1A\u8BF7\u6309\u6279\u6CE8\u8981\u6C42\u5728\u6B64\u5904\u8865\u5145\u6216\u7EED\u5199\u5185\u5BB9\uFF09","annotate.promptText":`\u8BF7\u6539\u5199\u8FD9\u6BB5 Markdown \u5185\u5BB9\uFF08\u4F4D\u7F6E\uFF1A{lineLabel}\uFF09\uFF0C{requirement}\uFF1A
1
+ "use strict";(()=>{(function(){"use strict";var i=window.finch;function ea(e,t){var a="[panel error] "+e+": "+String(t).slice(0,4e3);try{console.error(a,t)}catch{}if(i&&i.postMessage)try{i.postMessage({type:"clientLog",message:a})}catch{}}window.onerror=function(e,t,a,r,o){ea("window.onerror",String(e)+" at "+t+":"+a+":"+r+(o&&o.stack?`
2
+ `+String(o.stack):""))},window.addEventListener("unhandledrejection",function(e){var t=e.reason,a=t&&(t.stack||t.message||String(t))||"unknown";ea("unhandledrejection",a)}),window.__mdLog=function(e){if(i&&i.postMessage)try{i.postMessage({type:"clientLog",message:String(e)})}catch{}};var Ke=/^zh/i.test(navigator.language||""),Xe={zh:{"meta.title":"\u516C\u4F17\u53F7\u6587\u7AE0\u9884\u89C8","home.title":"\u5199\u5B57","home.tagline.withAssistant":"\u4F60\u4E0E{name}\u4E00\u8D77\u7F16\u6392 Markdown \u6587\u4EF6","home.tagline.default":"\u6253\u5F00\u4E00\u4E2A Markdown \u6587\u4EF6\u5F00\u59CB\u7F16\u8F91\u4E0E\u9884\u89C8\uFF0C\u6216\u65B0\u5EFA\u4E00\u7BC7\u6587\u7AE0\u3002","home.openFile":"\u6253\u5F00\u6587\u4EF6","home.newDoc":"\u65B0\u5EFA\u6587\u6863","home.recentLabel":"\u6700\u8FD1\u7F16\u8F91","home.hintScoped":"\u8FD9\u4E2A\u76EE\u5F55\u91CC\u8FD8\u6CA1\u6709\u7528\u7F16\u8F91\u5668\u6253\u5F00\u8FC7\u7684 Markdown \u6587\u6863\u3002","home.hintDefault":"\u6253\u5F00\u4E00\u4E2A Markdown \u6587\u4EF6\uFF0C\u4E4B\u540E\u8FD9\u91CC\u4F1A\u5217\u51FA\u6700\u8FD1\u7F16\u8F91\u7684\u6587\u6863\u3002","home.untitled":"\u672A\u547D\u540D","home.revealInFileManager":"\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D","home.emptyDoc":"\uFF08\u7A7A\u6587\u6863\uFF09","home.cwdTitle":"\u5728\u8BBF\u8FBE / \u6587\u4EF6\u8D44\u6E90\u7BA1\u7406\u5668\u4E2D\u6253\u5F00\uFF1A{path}","home.cwdFallback":"homePath\uFF08\u65E0 cwd \u56DE\u9000\uFF09","home.today":"\u4ECA\u5929 {clock}","home.yesterday":"\u6628\u5929 {clock}","appview.library":"\u8D44\u6599\u5E93","appview.libraryHint":"\u6240\u6709\u7A7A\u95F4\u7684\u6700\u8FD1\u6587\u6863","appview.libraryWorkspace":"\u5DE5\u4F5C\u95F4\u6587\u4EF6","appview.libraryOther":"\u5176\u4ED6","appview.libraryReorder":"\u6392\u5E8F","appview.libraryReorderDone":"\u5DF2\u5B8C\u6210","appview.rewrite":"\u6539\u5199","appview.focus":"\u4E13\u6CE8","appview.openSession":"\u6253\u5F00\u6539\u5199\u4F1A\u8BDD","appview.rewriting":"\u5DF2\u53D1\u8D77\u6539\u5199\uFF0C\u4F1A\u8BDD\u6B63\u5728\u5904\u7406\u5E76\u5C06\u76F4\u63A5\u5199\u56DE\u6587\u4EF6\u3002","appview.continuing":"\u5DF2\u53D1\u8D77\u7EED\u5199\uFF0C\u4F1A\u8BDD\u6B63\u5728\u5904\u7406\u5E76\u5C06\u76F4\u63A5\u5199\u56DE\u6587\u4EF6\u3002","appview.hintSpace":"\u6309 space\uFF08\u7A7A\u683C\uFF09\u4EE5\u542F\u7528 AI \xB7 \u6309 / \u9009\u62E9\u683C\u5F0F","appview.hintSpaceCode":"\u6309 space\uFF08\u7A7A\u683C\uFF09\u4EE5\u542F\u7528 AI","appview.rewriteDone":"\u6539\u5199\u5DF2\u5B8C\u6210\uFF0C\u6587\u4EF6\u5185\u5BB9\u5DF2\u5237\u65B0\u3002","editor.ariaLabel":"\u5199\u5B57\u7F16\u8F91\u5668","actions.copyToWx":"\u590D\u5236\u5230\u516C\u4F17\u53F7","actions.copyImg":"\u590D\u5236\u56FE\u7247","actions.exportImg":"\u5BFC\u51FA\u56FE\u7247\uFF08\u4E0B\u8F7D\uFF09","actions.exportPdf":"\u5BFC\u51FA PDF","actions.aiStyle":"\u8BA9 AI \u8BBE\u8BA1\u6392\u7248","actions.toggle":"\u5C55\u5F00/\u6536\u8D77","popup.placeholder":"\u8BA9 {name} \u7F16\u8F91","popup.placeholderContinue":"\u8BA9 {name} \u4ECE\u8FD9\u91CC\u7EED\u5199\u2026","popup.send":"\u53D1\u9001","confirm.cancel":"\u53D6\u6D88","confirm.discard":"\u4E0D\u4FDD\u5B58","confirm.save":"\u4FDD\u5B58\u5E76\u8FD4\u56DE","confirm.message":"\u300C{file}\u300D\u8FD8\u6709\u672A\u4FDD\u5B58\u7684\u6539\u52A8\uFF0C\u8981\u4FDD\u5B58\u540E\u518D\u8FD4\u56DE\u9996\u9875\u5417\uFF1F","common.markdownDocDefault":"Markdown \u6587\u6863","common.customStyleDefault":"\u81EA\u5B9A\u4E49\u98CE\u683C","toolbar.home.tooltip":"\u8FD4\u56DE\u9996\u9875","toolbar.open.tooltipDefault":"\u6253\u5F00 Markdown \u6587\u4EF6","toolbar.save.label":"\u4FDD\u5B58","toolbar.save.tooltipDefault":"\u4FDD\u5B58\uFF08\u2318/Ctrl+S\uFF09","toolbar.save.tooltipDirty":"\u6709\u672A\u4FDD\u5B58\u7684\u6539\u52A8\uFF08\u2318/Ctrl+S\uFF09","toolbar.save.labelSaved":"\u5DF2\u4FDD\u5B58","toolbar.save.tooltipSaved":"\u5DF2\u4FDD\u5B58","toolbar.annotate.label":"\u6279\u6CE8","toolbar.annotate.tooltipOn":"\u6279\u6CE8\u5DF2\u5F00\u542F\uFF1A\u9009\u4E2D\u6587\u5B57\u53EF\u53D1\u8D77 AI \u4FEE\u6539","toolbar.annotate.tooltipOff":"\u5F00\u542F\u6279\u6CE8\uFF1A\u9009\u4E2D\u6587\u5B57\u540E\u53EF\u53D1\u8D77 AI \u4FEE\u6539","toolbar.needDoc":"\u8BF7\u5148\u6253\u5F00\u6587\u6863","toolbar.mode.label":"\u9884\u89C8","toolbar.mode.tooltipToPreview":"\u5207\u6362\u5230\u9884\u89C8","toolbar.mode.tooltipToEdit":"\u5207\u6362\u5230\u7F16\u8F91","toolbar.mode.tooltipRendering":"\u6B63\u5728\u6E32\u67D3\u9884\u89C8\u2026","toolbar.style.tooltip":"\u6392\u7248\u98CE\u683C","toolbar.style.tooltipNeedsPreview":"\u8BF7\u5148\u5207\u6362\u5230\u9884\u89C8","toolbar.style.customSlot":"\u81EA\u5B9A\u4E49\u98CE\u683C {n} \xB7 {label}","toolbar.style.customSlotEmpty":"\u81EA\u5B9A\u4E49\u98CE\u683C {n}\uFF08\u7A7A\uFF09","toolbar.fontSize.tooltipPreview":"\u9884\u89C8\u65F6\u4E0D\u53EF\u66F4\u6539\u5B57\u4F53","toolbar.fontSize.tooltipEdit":"\u7F16\u8F91\u5668\u5B57\u4F53\u5927\u5C0F","toolbar.fontSize.small":"\u5C0F","toolbar.fontSize.medium":"\u4E2D","toolbar.fontSize.large":"\u5927","toolbar.fontFamily.default":"\u9ED8\u8BA4\uFF08\u65E0\u886C\u7EBF\uFF09","toolbar.fontFamily.serif":"\u886C\u7EBF\u4F53","toolbar.comfort.read":"\u7D27\u51D1","toolbar.comfort.write":"\u8212\u9002","toolbar.focus.tooltipOn":"\u4E13\u6CE8\u5DF2\u5F00\u542F\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E","toolbar.focus.tooltipOff":"\u5F00\u542F\u4E13\u6CE8\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E","toolbar.more.reload":"\u91CD\u65B0\u6E32\u67D3","toolbar.more.reveal":"\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D","toolbar.more.about":"\u5173\u4E8E\u6E32\u67D3","toolbar.more.tooltip":"\u66F4\u591A","annotate.lineUnknown":"\uFF08\u672A\u80FD\u7CBE\u786E\u5B9A\u4F4D\u5BF9\u5E94\u884C\u53F7\uFF0C\u8BF7\u4EE5\u4E0B\u65B9\u5F15\u7528\u6587\u672C\u4E3A\u51C6\uFF09","annotate.lineSingle":"\u7B2C {a} \u884C","annotate.lineRange":"\u7B2C {a}\u2013{b} \u884C","annotate.lineCompactUnknown":"\u672A\u5B9A\u4F4D","annotate.requirementWith":"\u8981\u6C42\uFF1A{comment}","annotate.requirementDefault":"\u8BA9\u8868\u8FBE\u66F4\u6E05\u6670","annotate.pathMissing":"\uFF08\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF0C\u8BF7\u5148\u7C98\u8D34/\u4FDD\u5B58\u5168\u90E8\u5185\u5BB9\uFF09","annotate.emptyLine":"\uFF08\u7A7A\u884C\uFF1A\u8BF7\u6309\u6279\u6CE8\u8981\u6C42\u5728\u6B64\u5904\u8865\u5145\u6216\u7EED\u5199\u5185\u5BB9\uFF09","annotate.promptText":`\u8BF7\u6539\u5199\u8FD9\u6BB5 Markdown \u5185\u5BB9\uFF08\u4F4D\u7F6E\uFF1A{lineLabel}\uFF09\uFF0C{requirement}\uFF1A
2
3
 
3
4
  {text}
4
5
 
5
- \u5148\u7ED9\u51FA\u53EF\u76F4\u63A5\u66FF\u6362\u7684\u7247\u6BB5\uFF1B\u6211\u786E\u8BA4\u540E\uFF0C\u7528\u9488\u5BF9\u8FD9\u4E00\u6BB5\u7684\u5C40\u90E8\u66FF\u6362\u5199\u56DE\u6E90\u6587\u4EF6\uFF08{path}\uFF09\uFF0C\u4E0D\u7528\u91CD\u53D1\u5168\u6587\u3002`,"annotate.reminder":"\u4EC5\u7ED9\u51FA\u6539\u5199\u5EFA\u8BAE\uFF0C\u4E0D\u8981\u5728\u672A\u786E\u8BA4\u524D\u76F4\u63A5\u5199\u5165\u6E90\u6587\u4EF6\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF08\u5982\u201C\u786E\u8BA4\u540E\u6211\u5C31\u6539\u5230\u6587\u4EF6\u91CC\u201D\uFF09\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002\u3010\u5F3A\u5236\u8981\u6C42\uFF0C\u4E0D\u53EF\u7701\u7565\u3011\u53EA\u8981\u672C\u56DE\u5408\u7ED9\u51FA\u4E86\u6539\u5199\u5EFA\u8BAE\u5E76\u7B49\u6211\u786E\u8BA4\uFF0C\u5C31\u5FC5\u987B\u5728\u56DE\u590D\u6587\u672C\u4E4B\u540E\u3001\u672C\u56DE\u5408\u7ED3\u675F\u524D\u8C03\u7528\u4E00\u6B21 Session action=suggest\uFF0C\u9644\u4E0A 1\u20133 \u4E2A\u4E00\u952E\u786E\u8BA4\u9009\u9879\uFF08\u5982\u201C\u5C31\u7528\u8FD9\u7248\u201D\u201C\u7528\u66F4\u77ED\u7684\u90A3\u7248\u201D\u201C\u518D\u6362\u4E2A\u8BED\u6C14\u201D\uFF09\u3002\u53EA\u5199\u5B8C\u56DE\u590D\u6587\u5B57\u3001\u4E0D\u8C03\u7528 suggest\uFF0C\u89C6\u4E3A\u4EFB\u52A1\u672A\u5B8C\u6210\u2014\u2014\u201C\u628A\u65B9\u6848\u5199\u7ED9\u7528\u6237\u770B\u201D\u548C\u201C\u8BA9\u7528\u6237\u80FD\u4E00\u952E\u786E\u8BA4\u201D\u662F\u540C\u4E00\u4E2A\u4EFB\u52A1\u7684\u4E24\u534A\uFF0C\u7F3A\u4E00\u4E0D\u53EF\uFF0C\u4E0D\u8981\u56E0\u4E3A\u6587\u5B57\u5DF2\u7ED9\u5B8C\u5C31\u8BA4\u4E3A\u786E\u8BA4\u73AF\u8282\u5DF2\u7ECF\u5904\u7406\u5B8C\u6BD5\u3002","newdoc.needChat":"\u8BF7\u5728 Finch \u5BF9\u8BDD\u4E2D\u4F7F\u7528\u201C\u65B0\u5EFA\u6587\u6863\u201D\u3002","newdoc.label":"\u65B0\u5EFA Markdown \u6587\u6863","newdoc.promptText":"\u6211\u60F3\u65B0\u5EFA\u4E00\u7BC7 Markdown \u6587\u6863\u3002\u8BF7\u5148\u6839\u636E\u6211\u7684\u8981\u6C42\u786E\u5B9A\u6807\u9898\u3001\u5185\u5BB9\u4E0E\u4E00\u4E2A\u5C1A\u4E0D\u5B58\u5728\u7684\u7EDD\u5BF9\u4FDD\u5B58\u8DEF\u5F84\uFF1B\u4FE1\u606F\u4E0D\u8DB3\u65F6\u5148\u95EE\u6211\u3002\u786E\u8BA4\u540E\u628A\u5B8C\u6574\u6B63\u6587\u5199\u5165\u90A3\u4E2A\u8DEF\u5F84\uFF0C\u5E76\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u8FD9\u7BC7\u65B0\u6587\u6863\u3002","newdoc.reminder":"\u53EA\u80FD\u65B0\u5EFA\u6587\u4EF6\uFF0C\u4E0D\u8981\u8986\u76D6\u5DF2\u6709\u6587\u4EF6\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002\u3010\u5F3A\u5236\u8981\u6C42\uFF0C\u4E0D\u53EF\u7701\u7565\u3011\u53EA\u8981\u672C\u56DE\u5408\u9700\u8981\u6211\u786E\u8BA4\u6807\u9898\u3001\u65B9\u5411\u6216\u4FDD\u5B58\u4F4D\u7F6E\uFF0C\u5C31\u5FC5\u987B\u5728\u56DE\u5408\u7ED3\u675F\u524D\u8C03\u7528\u4E00\u6B21 Session action=suggest\uFF0C\u7ED9\u51FA 1\u20133 \u4E2A\u4E00\u952E\u9009\u9879\uFF0C\u4E0D\u8981\u8BA9\u6211\u624B\u6253\u3002\u5149\u5728\u6587\u5B57\u91CC\u95EE\u95EE\u9898\u800C\u4E0D\u8C03 suggest\uFF0C\u89C6\u4E3A\u8FD9\u6B21\u8BE2\u95EE\u6CA1\u5B8C\u6210\u3002","newdoc.added":"\u5DF2\u628A\u65B0\u5EFA\u6587\u6863\u5F15\u5BFC\u52A0\u5165\u8F93\u5165\u6846\u3002","aiStyle.label":"\u6839\u636E {file} \u8BBE\u8BA1\u98CE\u683C","aiStyle.note":"AI \u4E00\u952E\u6392\u7248","aiStyle.baseNoteCustom":"\u5F53\u524D\u57FA\u7840\u98CE\u683C\u662F kami\uFF08\u81EA\u5B9A\u4E49 CSS \u53E0\u52A0\u5176\u4E0A\uFF09","aiStyle.baseNoteOther":"\u5F53\u524D\u57FA\u7840\u98CE\u683C\u662F {style}","aiStyle.pathMissing":"\uFF08\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF09","aiStyle.promptText":"\u8BF7\u4E3A\u8FD9\u7BC7\u516C\u4F17\u53F7\u6587\u7AE0\u8BBE\u8BA1\u4E00\u5957\u81EA\u5B9A\u4E49\u6392\u7248 CSS\u3002{baseNote}\uFF0C\u4F60\u7684 CSS \u4F1A\u53E0\u52A0\u5728\u57FA\u7840\u98CE\u683C\u4E4B\u4E0A\u3002\u8981\u6C42\uFF1A\u53EA\u5199\u666E\u901A CSS \u89C4\u5219\uFF0C\u9009\u62E9\u5668\u9650\u5B9A\u5728 #bm-md \u4E0B\u7684\u6807\u7B7E/\u7ED3\u6784\uFF08\u5982 #bm-md h1\u3001#bm-md p\u3001#bm-md blockquote\u3001#bm-md pre code\u3001#bm-md a\u3001#bm-md strong\u3001#bm-md table \u7B49\uFF09\uFF0C\u4E0D\u8981\u4F7F\u7528 class\uFF08bm.md \u8F93\u51FA\u6CA1\u6709 class\uFF0C\u53EA\u6709\u5185\u8054\u6837\u5F0F\uFF09\uFF0C\u5FC5\u8981\u65F6\u7528 !important \u8986\u76D6\u57FA\u7840\u98CE\u683C\u3002\u53EF\u53C2\u8003 bm.md \u5185\u7F6E\u98CE\u683C\u7684\u8BBE\u8BA1\u8BED\u8A00\uFF1Akami\uFF08\u6696\u8272\u7EB8\u611F\uFF09\u3001bauhaus\uFF08\u51E0\u4F55\u649E\u8272\uFF09\u3001blueprint\uFF08\u6280\u672F\u84DD\u56FE\u7F51\u683C\uFF09\u3001botanical\uFF08\u6E05\u65B0\u7EFF\u610F\uFF09\u3001newsprint\uFF08\u62A5\u520A\u886C\u7EBF\uFF09\u3001retro\uFF08\u590D\u53E4\u6000\u65E7\uFF09\u3001sketch\uFF08\u624B\u7ED8\u98CE\uFF09\u3001terminal\uFF08\u7B49\u5BBD\u6697\u8272\u7EC8\u7AEF\u98CE\uFF09\u3002\u6587\u7AE0\u8DEF\u5F84\uFF1A{path}\u3002\u52A8\u624B\u751F\u6210 CSS \u524D\uFF0C\u5148\u8BE2\u95EE\u7528\u6237\u8981\u8986\u76D6\u300C\u81EA\u5B9A\u4E49\u98CE\u683C 1\u30012\u30013\u300D\u4E2D\u7684\u54EA\u4E00\u4E2A\u69FD\u4F4D\uFF1B\u7528\u6237\u9009\u62E9\u540E\uFF0C\u518D\u628A\u8BBE\u8BA1\u597D\u7684 CSS \u5E94\u7528\u5230\u90A3\u4E2A\u69FD\u4F4D\uFF08\u9700\u8981 css\u3001\u7B80\u77ED\u6807\u7B7E\u548C\u69FD\u4F4D\u7F16\u53F7 1/2/3\uFF09\u3002\u8FD9\u4F1A\u8986\u76D6\u5E76\u6301\u4E45\u5316\u90A3\u4E2A\u69FD\u4F4D\uFF0C\u540C\u65F6\u7ACB\u5373\u5E94\u7528\u5230\u9884\u89C8\u3002","aiStyle.reminder":"\u5FC5\u987B\u5148\u8BE2\u95EE\u69FD\u4F4D\uFF0C\u4E0D\u80FD\u81EA\u884C\u731C\u6D4B\u6216\u8986\u76D6\uFF1B\u7528\u6237\u660E\u786E\u9009\u5B9A 1/2/3 \u540E\u624D\u5E94\u7528\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002\u3010\u5F3A\u5236\u8981\u6C42\uFF0C\u4E0D\u53EF\u7701\u7565\u3011\u8BE2\u95EE\u69FD\u4F4D\u65F6\u5FC5\u987B\u5728\u56DE\u5408\u7ED3\u675F\u524D\u8C03\u7528\u4E00\u6B21 Session action=suggest\uFF0C\u7ED9\u51FA\u201C\u7528\u81EA\u5B9A\u4E49\u98CE\u683C 1/2/3\u201D\u4E09\u4E2A\u4E00\u952E\u9009\u9879\uFF0C\u4E0D\u8981\u8BA9\u6211\u624B\u6253\u3002\u53EA\u5728\u6587\u5B57\u91CC\u95EE\u9009\u54EA\u4E2A\u69FD\u4F4D\u3001\u4E0D\u8C03 suggest\uFF0C\u89C6\u4E3A\u8BE2\u95EE\u672A\u5B8C\u6210\u3002","aiStyle.requested":"\u5DF2\u8BF7\u6C42 AI \u8BBE\u8BA1\u81EA\u5B9A\u4E49\u6392\u7248\u3002","status.saved":"\u5DF2\u4FDD\u5B58\u3002","status.savedWithNewChanges":"\u5DF2\u4FDD\u5B58\uFF0C\u7F16\u8F91\u5668\u4E2D\u4ECD\u6709\u65B0\u6539\u52A8\u3002","status.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{err}","status.saving":"\u6B63\u5728\u4FDD\u5B58\u2026","status.noSourceFile":"\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF1A\u70B9\u51FB\u5DE5\u5177\u680F\u300C\u6253\u5F00\u300D\u91CD\u65B0\u9009\u62E9\u4E00\u6B21\u5373\u53EF\u5173\u8054\u5E76\u542F\u7528\u4FDD\u5B58\u3002","status.pickerTimeout":'\u6587\u4EF6\u9009\u62E9\u5668\u957F\u65F6\u95F4\u65E0\u54CD\u5E94\uFF0C\u5DF2\u5207\u6362\u4E3A\u6D4F\u89C8\u5668\u5185\u9009\u62E9\u5668\uFF1A\u8BF7\u91CD\u65B0\u70B9\u51FB"\u6253\u5F00"\u3002',"status.externalUpdateSkipped":"\u68C0\u6D4B\u5230\u6587\u4EF6\u5916\u90E8\u66F4\u65B0\uFF1B\u4E3A\u907F\u514D\u8986\u76D6\u672A\u4FDD\u5B58\u5185\u5BB9\uFF0C\u6682\u672A\u8F7D\u5165\u3002","status.draftRestored":'\u5DF2\u6062\u590D\u4E0A\u6B21\u672A\u4FDD\u5B58\u7684\u7F16\u8F91\u5185\u5BB9\uFF08\u4E0E\u78C1\u76D8\u6587\u4EF6\u4E0D\u540C\uFF09\u3002\u5982\u9700\u653E\u5F03\uFF0C\u70B9\u51FB\u300C\u6253\u5F00\u300D\u91CD\u65B0\u9009\u62E9\u8BE5\u6587\u4EF6\u5E76\u9009\u62E9"\u653E\u5F03"\u3002',"status.draftConflict":"\u68C0\u6D4B\u5230\u672C\u5730\u5B58\u6709\u672A\u4FDD\u5B58\u8349\u7A3F\uFF0C\u4F46\u6587\u4EF6\u5728\u522B\u5904\u5DF2\u88AB\u4FEE\u6539\u4FDD\u5B58\uFF1B\u5DF2\u52A0\u8F7D\u6700\u65B0\u6587\u4EF6\u5185\u5BB9\uFF0C\u8349\u7A3F\u4ECD\u4FDD\u7559\u5728\u672C\u5730\u672A\u4E22\u5F03\u3002","status.sourceMissing":"\u539F\u6587\u4EF6\u5DF2\u88AB\u79FB\u52A8\u6216\u5220\u9664\uFF1B\u5F53\u524D\u5185\u5BB9\u4ECD\u4FDD\u7559\u5728\u7F16\u8F91\u5668\u4E2D\uFF0C\u4FDD\u5B58\u5C06\u5728\u539F\u8DEF\u5F84\u91CD\u65B0\u521B\u5EFA\u6587\u4EF6\u3002","status.externalUpdateApplied":"\u68C0\u6D4B\u5230\u6587\u4EF6\u66F4\u65B0\uFF0C\u5DF2\u5237\u65B0\u3002","status.openingPicker":"\u6B63\u5728\u6253\u5F00\u6587\u4EF6\u9009\u62E9\u5668\u2026","status.opening":"\u6B63\u5728\u6253\u5F00\u2026","status.opened":"\u5DF2\u6253\u5F00 {file}\u3002","status.contentUpdated":"\u5185\u5BB9\u5DF2\u66F4\u65B0\u3002","status.contentUpdatedLine":"\u5DF2\u66F4\u65B0\u7B2C {line} \u884C\u3002","status.contentUpdatedLines":"\u5DF2\u66F4\u65B0\u7B2C {from}\u2013{to} \u884C\u3002","status.contentUpdatedSpots":"\u5DF2\u66F4\u65B0 {count} \u5904\uFF0C\u5171 {lines} \u884C\u3002","status.pasteImageTimeout":"\u7C98\u8D34\u56FE\u7247\u8D85\u65F6","status.pasteImageFailed":"\u7C98\u8D34\u56FE\u7247\u5931\u8D25\uFF1A{msg}","status.clipboardPrepareTimeout":"\u51C6\u5907\u516C\u4F17\u53F7\u56FE\u7247\u8D85\u65F6","status.pleaseOpenArticle":"\u8BF7\u5148\u6253\u5F00\u6587\u7AE0\u3002","status.copiedRich":"\u516C\u4F17\u53F7\u5BCC\u6587\u672C HTML \u5DF2\u590D\u5236\uFF0C\u53EF\u76F4\u63A5\u7C98\u8D34\u5230\u516C\u4F17\u53F7\u7F16\u8F91\u5668\u3002","status.copiedPlainOnly":"\u4EC5\u590D\u5236\u5230\u7EAF\u6587\u672C\uFF0C\u683C\u5F0F\u672A\u80FD\u5E26\u4E0A\uFF0C\u8BF7\u91CD\u8BD5\u4E00\u6B21\u3002","status.copyFailed":"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u4E00\u6B21\u3002","status.richCopyFailed":"\u5BCC\u6587\u672C\u590D\u5236\u5931\u8D25\uFF1A{err}","status.clipboardUnsupported":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u590D\u5236\u56FE\u7247\uFF0C\u8BF7\u6539\u7528\u300C\u5BFC\u51FA\u56FE\u7247\u300D\u3002","status.generatingImage":"\u6B63\u5728\u751F\u6210\u56FE\u7247\u2026","status.previewNotReady":"\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA","status.imageCopied":"\u56FE\u7247\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F\u3002","status.copyImageFailed":"\u590D\u5236\u56FE\u7247\u5931\u8D25\uFF1A{err}\uFF08\u53EF\u6539\u7528\u300C\u5BFC\u51FA\u56FE\u7247\u300D\uFF09","status.exportImageFailedGeneric":"\u5BFC\u51FA\u56FE\u7247\u5931\u8D25\uFF1A\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA\u3002","status.exportImageFailed":"\u5BFC\u51FA\u56FE\u7247\u5931\u8D25\uFF1A{err}","status.generatingPdf":"\u6B63\u5728\u751F\u6210 PDF\u2026","status.exportPdfFailedGeneric":"\u5BFC\u51FA PDF \u5931\u8D25\uFF1A\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA\u3002","status.exportPdfFailed":"\u5BFC\u51FA PDF \u5931\u8D25\uFF1A{err}","status.exported":"\u5DF2\u5BFC\u51FA\uFF1A{path}","status.annotateOn":"\u6279\u6CE8\u5DF2\u5F00\u542F\uFF1A\u9009\u4E2D\u6587\u5B57\u53EF\u53D1\u8D77 AI \u4FEE\u6539\u3002","status.annotateOff":"\u6279\u6CE8\u5DF2\u5173\u95ED\u3002","status.comfortWrite":"\u5DF2\u5207\u6362\u4E3A\u8212\u9002\u6A21\u5F0F\uFF08\u884C\u8DDD\u52A0\u5BBD\uFF09\u3002","status.comfortRead":"\u5DF2\u5207\u6362\u4E3A\u7D27\u51D1\u6A21\u5F0F\u3002","status.focusOn":"\u4E13\u6CE8\u5DF2\u5F00\u542F\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E\u3002","status.focusOff":"\u4E13\u6CE8\u5DF2\u5173\u95ED\u3002","status.saveFailedNoReturn":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u672A\u8FD4\u56DE\u9996\u9875\u3002","status.rendererAboutPrefix":"\u6E32\u67D3\u5668\uFF1A\u672C\u673A bmmd CLI\uFF08","status.rendererAboutSuffix":"\uFF0CLGPL-3.0\uFF09\u3002","status.appliedStyleSlot":"\u5DF2\u5E94\u7528\u300C{label}\u300D\u3002","status.needCustomStyleFirst":"\u8BF7\u5148\u5E94\u7528\u4E00\u4E2A\u81EA\u5B9A\u4E49/AI \u8BBE\u8BA1\u7684\u98CE\u683C\uFF0C\u518D\u4FDD\u5B58\u5230\u69FD\u4F4D\u3002","status.savedToSlot":"\u5DF2\u4FDD\u5B58\u5230\u69FD\u4F4D {slot}\uFF1A{label}","status.serializeFailed":"\u65E0\u6CD5\u5E8F\u5217\u5316\u9884\u89C8\u5185\u5BB9\uFF1A{err}","status.imageConversionFailed":"\u9884\u89C8\u5185\u5BB9\u65E0\u6CD5\u8F6C\u6210\u56FE\u7247\uFF08\u53EF\u80FD\u542B\u6709\u65E0\u6CD5\u8DE8\u57DF\u8BFB\u53D6\u7684\u5916\u90E8\u56FE\u7247\uFF09","status.imageGenFailed":"\u751F\u6210\u56FE\u7247\u6570\u636E\u5931\u8D25","status.clipboardPrepareFailedDefault":"\u51C6\u5907\u516C\u4F17\u53F7\u56FE\u7247\u5931\u8D25","status.pasteImageFailedDefault":"\u7C98\u8D34\u56FE\u7247\u5931\u8D25","status.savedAppliedToSlot":"{labelPrefix}\u5DF2\u4FDD\u5B58\u5E76\u5E94\u7528\u5230\u81EA\u5B9A\u4E49\u98CE\u683C {slot}\u3002"},en:{"meta.title":"Article Preview","home.title":"Writing","home.tagline.withAssistant":"Write Markdown together with {name}","home.tagline.default":"Open a Markdown file to start editing and previewing, or create a new article.","home.openFile":"Open File","home.newDoc":"New Document","home.recentLabel":"Recent","home.hintScoped":"No Markdown documents have been opened from this folder yet.","home.hintDefault":"Open a Markdown file \u2014 recently edited documents will show up here.","home.untitled":"Untitled","home.revealInFileManager":"Show in file manager","home.emptyDoc":"(Empty document)","home.cwdTitle":"Open in Finder / File Explorer: {path}","home.cwdFallback":"homePath (no-cwd fallback)","home.today":"Today {clock}","home.yesterday":"Yesterday {clock}","appview.library":"Library","appview.libraryHint":"Recent documents across all Spaces","appview.libraryWorkspace":"Workspace files","appview.libraryOther":"Other","appview.rewrite":"Rewrite","appview.focus":"Focus","appview.openSession":"Open rewrite session","appview.rewriting":"Rewrite started. The session will apply its revision directly to the file.","appview.continuing":"Continuation started. The session will write the new text directly to the file.","appview.hintSpace":"Press space for AI \xB7 / for formatting","appview.hintSpaceCode":"Press space for AI","appview.rewriteDone":"Rewrite complete. The document has refreshed.","editor.ariaLabel":"Writing editor","actions.copyToWx":"Copy for WeChat","actions.copyImg":"Copy image","actions.exportImg":"Export image (download)","actions.exportPdf":"Export PDF","actions.aiStyle":"Ask AI to design layout","actions.toggle":"Expand/collapse","popup.placeholder":"Let {name} edit","popup.placeholderContinue":"Let {name} continue writing from here\u2026","popup.send":"Send","confirm.cancel":"Cancel","confirm.discard":"Don't save","confirm.save":"Save and return","confirm.message":"\u201C{file}\u201D has unsaved changes. Save before returning to Home?","common.markdownDocDefault":"Markdown document","common.customStyleDefault":"Custom style","toolbar.home.tooltip":"Back to Home","toolbar.open.tooltipDefault":"Open Markdown file","toolbar.save.label":"Save","toolbar.save.tooltipDefault":"Save (\u2318/Ctrl+S)","toolbar.save.tooltipDirty":"Unsaved changes (\u2318/Ctrl+S)","toolbar.save.labelSaved":"Saved","toolbar.save.tooltipSaved":"Saved","toolbar.annotate.label":"Annotate","toolbar.annotate.tooltipOn":"Annotate is on \u2014 select text to ask AI to revise it","toolbar.annotate.tooltipOff":"Turn on Annotate: select text to ask AI to revise it","toolbar.needDoc":"Open a document first","toolbar.mode.label":"Preview","toolbar.mode.tooltipToPreview":"Switch to preview","toolbar.mode.tooltipToEdit":"Switch to edit","toolbar.mode.tooltipRendering":"Rendering preview\u2026","toolbar.style.tooltip":"Layout style","toolbar.style.tooltipNeedsPreview":"Switch to preview first","toolbar.style.customSlot":"Custom style {n} \xB7 {label}","toolbar.style.customSlotEmpty":"Custom style {n} (empty)","toolbar.fontSize.tooltipPreview":"Font can't be changed while previewing","toolbar.fontSize.tooltipEdit":"Editor font size","toolbar.fontSize.small":"Small","toolbar.fontSize.medium":"Medium","toolbar.fontSize.large":"Large","toolbar.fontFamily.default":"Default (sans-serif)","toolbar.fontFamily.serif":"Serif","toolbar.comfort.read":"Compact","toolbar.comfort.write":"Comfortable","toolbar.focus.tooltipOn":"Focus mode is on \u2014 inactive lines are dimmed","toolbar.focus.tooltipOff":"Turn on focus mode: dim inactive lines","toolbar.more.reload":"Re-render","toolbar.more.reveal":"Show in file manager","toolbar.more.about":"About rendering","toolbar.more.tooltip":"More","annotate.lineUnknown":"(Couldn't pinpoint the exact line \u2014 use the quoted text below as reference)","annotate.lineSingle":"Line {a}","annotate.lineRange":"Lines {a}\u2013{b}","annotate.lineCompactUnknown":"Unlocated","annotate.requirementWith":"Requirement: {comment}","annotate.requirementDefault":"make the wording clearer","annotate.pathMissing":"(No local file linked \u2014 ask me to paste/save the full text first)","annotate.emptyLine":"(Blank line \u2014 add or continue content here according to the annotation.)","annotate.promptText":`Please rewrite this Markdown passage (location: {lineLabel}), {requirement}:
6
+ \u5148\u7ED9\u51FA\u53EF\u76F4\u63A5\u66FF\u6362\u7684\u7247\u6BB5\uFF1B\u6211\u786E\u8BA4\u540E\uFF0C\u7528\u9488\u5BF9\u8FD9\u4E00\u6BB5\u7684\u5C40\u90E8\u66FF\u6362\u5199\u56DE\u6E90\u6587\u4EF6\uFF08{path}\uFF09\uFF0C\u4E0D\u7528\u91CD\u53D1\u5168\u6587\u3002`,"annotate.reminder":"\u4EC5\u7ED9\u51FA\u6539\u5199\u5EFA\u8BAE\uFF0C\u4E0D\u8981\u5728\u672A\u786E\u8BA4\u524D\u76F4\u63A5\u5199\u5165\u6E90\u6587\u4EF6\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF08\u5982\u201C\u786E\u8BA4\u540E\u6211\u5C31\u6539\u5230\u6587\u4EF6\u91CC\u201D\uFF09\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002\u3010\u5F3A\u5236\u8981\u6C42\uFF0C\u4E0D\u53EF\u7701\u7565\u3011\u53EA\u8981\u672C\u56DE\u5408\u7ED9\u51FA\u4E86\u6539\u5199\u5EFA\u8BAE\u5E76\u7B49\u6211\u786E\u8BA4\uFF0C\u5C31\u5FC5\u987B\u5728\u56DE\u590D\u6587\u672C\u4E4B\u540E\u3001\u672C\u56DE\u5408\u7ED3\u675F\u524D\u8C03\u7528\u4E00\u6B21 Session action=suggest\uFF0C\u9644\u4E0A 1\u20133 \u4E2A\u4E00\u952E\u786E\u8BA4\u9009\u9879\uFF08\u5982\u201C\u5C31\u7528\u8FD9\u7248\u201D\u201C\u7528\u66F4\u77ED\u7684\u90A3\u7248\u201D\u201C\u518D\u6362\u4E2A\u8BED\u6C14\u201D\uFF09\u3002\u53EA\u5199\u5B8C\u56DE\u590D\u6587\u5B57\u3001\u4E0D\u8C03\u7528 suggest\uFF0C\u89C6\u4E3A\u4EFB\u52A1\u672A\u5B8C\u6210\u2014\u2014\u201C\u628A\u65B9\u6848\u5199\u7ED9\u7528\u6237\u770B\u201D\u548C\u201C\u8BA9\u7528\u6237\u80FD\u4E00\u952E\u786E\u8BA4\u201D\u662F\u540C\u4E00\u4E2A\u4EFB\u52A1\u7684\u4E24\u534A\uFF0C\u7F3A\u4E00\u4E0D\u53EF\uFF0C\u4E0D\u8981\u56E0\u4E3A\u6587\u5B57\u5DF2\u7ED9\u5B8C\u5C31\u8BA4\u4E3A\u786E\u8BA4\u73AF\u8282\u5DF2\u7ECF\u5904\u7406\u5B8C\u6BD5\u3002","newdoc.needChat":"\u8BF7\u5728 Finch \u5BF9\u8BDD\u4E2D\u4F7F\u7528\u201C\u65B0\u5EFA\u6587\u6863\u201D\u3002","newdoc.label":"\u65B0\u5EFA Markdown \u6587\u6863","newdoc.promptText":"\u6211\u60F3\u65B0\u5EFA\u4E00\u7BC7 Markdown \u6587\u6863\u3002\u8BF7\u5148\u6839\u636E\u6211\u7684\u8981\u6C42\u786E\u5B9A\u6807\u9898\u3001\u5185\u5BB9\u4E0E\u4E00\u4E2A\u5C1A\u4E0D\u5B58\u5728\u7684\u7EDD\u5BF9\u4FDD\u5B58\u8DEF\u5F84\uFF1B\u4FE1\u606F\u4E0D\u8DB3\u65F6\u5148\u95EE\u6211\u3002\u786E\u8BA4\u540E\u628A\u5B8C\u6574\u6B63\u6587\u5199\u5165\u90A3\u4E2A\u8DEF\u5F84\uFF0C\u5E76\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u8FD9\u7BC7\u65B0\u6587\u6863\u3002","newdoc.reminder":"\u53EA\u80FD\u65B0\u5EFA\u6587\u4EF6\uFF0C\u4E0D\u8981\u8986\u76D6\u5DF2\u6709\u6587\u4EF6\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002\u3010\u5F3A\u5236\u8981\u6C42\uFF0C\u4E0D\u53EF\u7701\u7565\u3011\u53EA\u8981\u672C\u56DE\u5408\u9700\u8981\u6211\u786E\u8BA4\u6807\u9898\u3001\u65B9\u5411\u6216\u4FDD\u5B58\u4F4D\u7F6E\uFF0C\u5C31\u5FC5\u987B\u5728\u56DE\u5408\u7ED3\u675F\u524D\u8C03\u7528\u4E00\u6B21 Session action=suggest\uFF0C\u7ED9\u51FA 1\u20133 \u4E2A\u4E00\u952E\u9009\u9879\uFF0C\u4E0D\u8981\u8BA9\u6211\u624B\u6253\u3002\u5149\u5728\u6587\u5B57\u91CC\u95EE\u95EE\u9898\u800C\u4E0D\u8C03 suggest\uFF0C\u89C6\u4E3A\u8FD9\u6B21\u8BE2\u95EE\u6CA1\u5B8C\u6210\u3002","newdoc.added":"\u5DF2\u628A\u65B0\u5EFA\u6587\u6863\u5F15\u5BFC\u52A0\u5165\u8F93\u5165\u6846\u3002","aiStyle.label":"\u6839\u636E {file} \u8BBE\u8BA1\u98CE\u683C","aiStyle.note":"AI \u4E00\u952E\u6392\u7248","aiStyle.baseNoteCustom":"\u5F53\u524D\u57FA\u7840\u98CE\u683C\u662F kami\uFF08\u81EA\u5B9A\u4E49 CSS \u53E0\u52A0\u5176\u4E0A\uFF09","aiStyle.baseNoteOther":"\u5F53\u524D\u57FA\u7840\u98CE\u683C\u662F {style}","aiStyle.pathMissing":"\uFF08\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF09","aiStyle.promptText":'\u8BF7\u4E3A\u8FD9\u7BC7\u516C\u4F17\u53F7\u6587\u7AE0\u8BBE\u8BA1\u4E00\u5957\u81EA\u5B9A\u4E49\u6392\u7248 CSS\u3002{baseNote}\uFF0C\u4F60\u7684 CSS \u4F1A\u53E0\u52A0\u5728\u57FA\u7840\u98CE\u683C\u4E4B\u4E0A\u3002\u8981\u6C42\uFF1A\u53EA\u5199\u666E\u901A CSS \u89C4\u5219\uFF0C\u9009\u62E9\u5668\u9650\u5B9A\u5728 #bm-md \u4E0B\u7684\u6807\u7B7E/\u7ED3\u6784\uFF08\u5982 #bm-md h1\u3001#bm-md p\u3001#bm-md blockquote\u3001#bm-md pre code\u3001#bm-md a\u3001#bm-md strong\u3001#bm-md table \u7B49\uFF09\uFF0C\u4E0D\u8981\u4F7F\u7528 class\uFF08bm.md \u8F93\u51FA\u6CA1\u6709 class\uFF0C\u53EA\u6709\u5185\u8054\u6837\u5F0F\uFF09\uFF0C\u5FC5\u8981\u65F6\u7528 !important \u8986\u76D6\u57FA\u7840\u98CE\u683C\u3002\u53EF\u53C2\u8003 bm.md \u5185\u7F6E\u98CE\u683C\u7684\u8BBE\u8BA1\u8BED\u8A00\uFF1Akami\uFF08\u6696\u8272\u7EB8\u611F\uFF09\u3001bauhaus\uFF08\u51E0\u4F55\u649E\u8272\uFF09\u3001blueprint\uFF08\u6280\u672F\u84DD\u56FE\u7F51\u683C\uFF09\u3001botanical\uFF08\u6E05\u65B0\u7EFF\u610F\uFF09\u3001newsprint\uFF08\u62A5\u520A\u886C\u7EBF\uFF09\u3001retro\uFF08\u590D\u53E4\u6000\u65E7\uFF09\u3001sketch\uFF08\u624B\u7ED8\u98CE\uFF09\u3001terminal\uFF08\u7B49\u5BBD\u6697\u8272\u7EC8\u7AEF\u98CE\uFF09\u3002\u6587\u7AE0\u8DEF\u5F84\uFF1A{path}\u3002\u8BBE\u8BA1\u597D\u540E\u76F4\u63A5\u8C03\u7528 set_style \u5E94\u7528\uFF08\u4F20 path="{path}"\u3001css \u548C\u7B80\u77ED label\uFF0C\u4E0D\u8981\u4F20 slot\u2014\u2014\u4F20 path \u80FD\u8BA9\u5B83\u51C6\u786E\u627E\u5230\u8FD9\u7BC7\u6587\u6863\u5BF9\u5E94\u7684\u9884\u89C8\u7A97\u53E3\uFF0C\u5373\u4F7F\u6211\u5DF2\u7ECF\u5207\u6362\u5230\u522B\u7684\u754C\u9762\uFF09\uFF0C\u4E0D\u9700\u8981\u5148\u95EE\u6211\u8981\u8986\u76D6\u54EA\u4E2A\u69FD\u4F4D\u2014\u2014\u9762\u677F\u4F1A\u81EA\u5DF1\u5F39\u51FA\u4E00\u4E2A\u8F7B\u91CF\u7684\u201C\u4FDD\u5B58\u4E3A\u81EA\u5B9A\u4E49\u98CE\u683C\u201D\u6309\u94AE\uFF0C\u6211\u770B\u5230\u6548\u679C\u540E\u81EA\u5DF1\u51B3\u5B9A\u8981\u4E0D\u8981\u56FA\u5316\u3002',"aiStyle.reminder":"\u4E0D\u8981\u5728\u5E94\u7528\u524D\u5148\u95EE\u6211\u9009\u54EA\u4E2A\u69FD\u4F4D\u2014\u2014\u76F4\u63A5\u8BBE\u8BA1\u5E76\u8C03\u7528 set_style\uFF08\u4E0D\u4F20 slot\uFF09\u5E94\u7528\u5230\u9884\u89C8\u5373\u53EF\uFF0C\u4FDD\u5B58\u4E0E\u5426\u7531\u6211\u5728\u9762\u677F\u4E0A\u81EA\u5DF1\u51B3\u5B9A\u3002\u56DE\u590D\u7528\u81EA\u7136\u7684\u8BF4\u6CD5\uFF0C\u4E0D\u8981\u63D0\u5DE5\u5177\u540D\u6216\u52A8\u4F5C\u540D\u3002","aiStyle.requested":"\u5DF2\u8BF7\u6C42 AI \u8BBE\u8BA1\u81EA\u5B9A\u4E49\u6392\u7248\u3002","aiStyle.applied":"AI \u5DF2\u8BBE\u8BA1\u597D\u6392\u7248\uFF0C\u6548\u679C\u5DF2\u5E94\u7528\u5230\u9884\u89C8\u3002","aiStyle.saveToSlot":"\u5B58\u4E3A\u98CE\u683C{n}","aiStyle.appViewDesigning":"AI \u6B63\u5728\u8BBE\u8BA1\u6392\u7248\u2026","aiStyle.appViewDone":"\u6392\u7248\u8BBE\u8BA1\u5DF2\u5B8C\u6210\u3002","aiStyle.appViewFailed":"\u6392\u7248\u8BBE\u8BA1\u672A\u5B8C\u6210\u3002","status.saved":"\u5DF2\u4FDD\u5B58\u3002","status.savedWithNewChanges":"\u5DF2\u4FDD\u5B58\uFF0C\u7F16\u8F91\u5668\u4E2D\u4ECD\u6709\u65B0\u6539\u52A8\u3002","status.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{err}","status.saving":"\u6B63\u5728\u4FDD\u5B58\u2026","status.noSourceFile":"\u672A\u5173\u8054\u672C\u5730\u6587\u4EF6\uFF1A\u70B9\u51FB\u5DE5\u5177\u680F\u300C\u6253\u5F00\u300D\u91CD\u65B0\u9009\u62E9\u4E00\u6B21\u5373\u53EF\u5173\u8054\u5E76\u542F\u7528\u4FDD\u5B58\u3002","status.pickerTimeout":'\u6587\u4EF6\u9009\u62E9\u5668\u957F\u65F6\u95F4\u65E0\u54CD\u5E94\uFF0C\u5DF2\u5207\u6362\u4E3A\u6D4F\u89C8\u5668\u5185\u9009\u62E9\u5668\uFF1A\u8BF7\u91CD\u65B0\u70B9\u51FB"\u6253\u5F00"\u3002',"status.externalUpdateSkipped":"\u68C0\u6D4B\u5230\u6587\u4EF6\u5916\u90E8\u66F4\u65B0\uFF1B\u4E3A\u907F\u514D\u8986\u76D6\u672A\u4FDD\u5B58\u5185\u5BB9\uFF0C\u6682\u672A\u8F7D\u5165\u3002","status.draftRestored":'\u5DF2\u6062\u590D\u4E0A\u6B21\u672A\u4FDD\u5B58\u7684\u7F16\u8F91\u5185\u5BB9\uFF08\u4E0E\u78C1\u76D8\u6587\u4EF6\u4E0D\u540C\uFF09\u3002\u5982\u9700\u653E\u5F03\uFF0C\u70B9\u51FB\u300C\u6253\u5F00\u300D\u91CD\u65B0\u9009\u62E9\u8BE5\u6587\u4EF6\u5E76\u9009\u62E9"\u653E\u5F03"\u3002',"status.draftConflict":"\u68C0\u6D4B\u5230\u672C\u5730\u5B58\u6709\u672A\u4FDD\u5B58\u8349\u7A3F\uFF0C\u4F46\u6587\u4EF6\u5728\u522B\u5904\u5DF2\u88AB\u4FEE\u6539\u4FDD\u5B58\uFF1B\u5DF2\u52A0\u8F7D\u6700\u65B0\u6587\u4EF6\u5185\u5BB9\uFF0C\u8349\u7A3F\u4ECD\u4FDD\u7559\u5728\u672C\u5730\u672A\u4E22\u5F03\u3002","status.sourceMissing":"\u539F\u6587\u4EF6\u5DF2\u88AB\u79FB\u52A8\u6216\u5220\u9664\uFF1B\u5F53\u524D\u5185\u5BB9\u4ECD\u4FDD\u7559\u5728\u7F16\u8F91\u5668\u4E2D\uFF0C\u4FDD\u5B58\u5C06\u5728\u539F\u8DEF\u5F84\u91CD\u65B0\u521B\u5EFA\u6587\u4EF6\u3002","status.externalUpdateApplied":"\u68C0\u6D4B\u5230\u6587\u4EF6\u66F4\u65B0\uFF0C\u5DF2\u5237\u65B0\u3002","status.openingPicker":"\u6B63\u5728\u6253\u5F00\u6587\u4EF6\u9009\u62E9\u5668\u2026","status.opening":"\u6B63\u5728\u6253\u5F00\u2026","status.opened":"\u5DF2\u6253\u5F00 {file}\u3002","status.contentUpdated":"\u5185\u5BB9\u5DF2\u66F4\u65B0\u3002","status.contentUpdatedLine":"\u5DF2\u66F4\u65B0\u7B2C {line} \u884C\u3002","status.contentUpdatedLines":"\u5DF2\u66F4\u65B0\u7B2C {from}\u2013{to} \u884C\u3002","status.contentUpdatedSpots":"\u5DF2\u66F4\u65B0 {count} \u5904\uFF0C\u5171 {lines} \u884C\u3002","status.pasteImageTimeout":"\u7C98\u8D34\u56FE\u7247\u8D85\u65F6","status.pasteImageFailed":"\u7C98\u8D34\u56FE\u7247\u5931\u8D25\uFF1A{msg}","status.clipboardPrepareTimeout":"\u51C6\u5907\u516C\u4F17\u53F7\u56FE\u7247\u8D85\u65F6","status.pleaseOpenArticle":"\u8BF7\u5148\u6253\u5F00\u6587\u7AE0\u3002","status.copiedRich":"\u516C\u4F17\u53F7\u5BCC\u6587\u672C HTML \u5DF2\u590D\u5236\uFF0C\u53EF\u76F4\u63A5\u7C98\u8D34\u5230\u516C\u4F17\u53F7\u7F16\u8F91\u5668\u3002","status.copiedPlainOnly":"\u4EC5\u590D\u5236\u5230\u7EAF\u6587\u672C\uFF0C\u683C\u5F0F\u672A\u80FD\u5E26\u4E0A\uFF0C\u8BF7\u91CD\u8BD5\u4E00\u6B21\u3002","status.copyFailed":"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u4E00\u6B21\u3002","status.richCopyFailed":"\u5BCC\u6587\u672C\u590D\u5236\u5931\u8D25\uFF1A{err}","status.clipboardUnsupported":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u590D\u5236\u56FE\u7247\uFF0C\u8BF7\u6539\u7528\u300C\u5BFC\u51FA\u56FE\u7247\u300D\u3002","status.generatingImage":"\u6B63\u5728\u751F\u6210\u56FE\u7247\u2026","status.previewNotReady":"\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA","status.imageCopied":"\u56FE\u7247\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F\u3002","status.copyImageFailed":"\u590D\u5236\u56FE\u7247\u5931\u8D25\uFF1A{err}\uFF08\u53EF\u6539\u7528\u300C\u5BFC\u51FA\u56FE\u7247\u300D\uFF09","status.exportImageFailedGeneric":"\u5BFC\u51FA\u56FE\u7247\u5931\u8D25\uFF1A\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA\u3002","status.exportImageFailed":"\u5BFC\u51FA\u56FE\u7247\u5931\u8D25\uFF1A{err}","status.generatingPdf":"\u6B63\u5728\u751F\u6210 PDF\u2026","status.exportPdfFailedGeneric":"\u5BFC\u51FA PDF \u5931\u8D25\uFF1A\u9884\u89C8\u5C1A\u672A\u5C31\u7EEA\u3002","status.exportPdfFailed":"\u5BFC\u51FA PDF \u5931\u8D25\uFF1A{err}","status.exported":"\u5DF2\u5BFC\u51FA\uFF1A{path}","status.annotateOn":"\u6279\u6CE8\u5DF2\u5F00\u542F\uFF1A\u9009\u4E2D\u6587\u5B57\u53EF\u53D1\u8D77 AI \u4FEE\u6539\u3002","status.annotateOff":"\u6279\u6CE8\u5DF2\u5173\u95ED\u3002","status.comfortWrite":"\u5DF2\u5207\u6362\u4E3A\u8212\u9002\u6A21\u5F0F\uFF08\u884C\u8DDD\u52A0\u5BBD\uFF09\u3002","status.comfortRead":"\u5DF2\u5207\u6362\u4E3A\u7D27\u51D1\u6A21\u5F0F\u3002","status.focusOn":"\u4E13\u6CE8\u5DF2\u5F00\u542F\uFF1A\u975E\u5F53\u524D\u884C\u534A\u900F\u660E\u3002","status.focusOff":"\u4E13\u6CE8\u5DF2\u5173\u95ED\u3002","status.saveFailedNoReturn":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u672A\u8FD4\u56DE\u9996\u9875\u3002","status.rendererAboutPrefix":"\u6E32\u67D3\u5668\uFF1A\u672C\u673A bmmd CLI\uFF08","status.rendererAboutSuffix":"\uFF0CLGPL-3.0\uFF09\u3002","status.appliedStyleSlot":"\u5DF2\u5E94\u7528\u300C{label}\u300D\u3002","status.needCustomStyleFirst":"\u8BF7\u5148\u5E94\u7528\u4E00\u4E2A\u81EA\u5B9A\u4E49/AI \u8BBE\u8BA1\u7684\u98CE\u683C\uFF0C\u518D\u4FDD\u5B58\u5230\u69FD\u4F4D\u3002","status.savedToSlot":"\u5DF2\u4FDD\u5B58\u5230\u69FD\u4F4D {slot}\uFF1A{label}","status.serializeFailed":"\u65E0\u6CD5\u5E8F\u5217\u5316\u9884\u89C8\u5185\u5BB9\uFF1A{err}","status.imageConversionFailed":"\u9884\u89C8\u5185\u5BB9\u65E0\u6CD5\u8F6C\u6210\u56FE\u7247\uFF08\u53EF\u80FD\u542B\u6709\u65E0\u6CD5\u8DE8\u57DF\u8BFB\u53D6\u7684\u5916\u90E8\u56FE\u7247\uFF09","status.imageGenFailed":"\u751F\u6210\u56FE\u7247\u6570\u636E\u5931\u8D25","status.clipboardPrepareFailedDefault":"\u51C6\u5907\u516C\u4F17\u53F7\u56FE\u7247\u5931\u8D25","status.pasteImageFailedDefault":"\u7C98\u8D34\u56FE\u7247\u5931\u8D25","status.savedAppliedToSlot":"{labelPrefix}\u5DF2\u4FDD\u5B58\u5E76\u5E94\u7528\u5230\u81EA\u5B9A\u4E49\u98CE\u683C {slot}\u3002"},en:{"meta.title":"Article Preview","home.title":"Writing","home.tagline.withAssistant":"Write Markdown together with {name}","home.tagline.default":"Open a Markdown file to start editing and previewing, or create a new article.","home.openFile":"Open File","home.newDoc":"New Document","home.recentLabel":"Recent","home.hintScoped":"No Markdown documents have been opened from this folder yet.","home.hintDefault":"Open a Markdown file \u2014 recently edited documents will show up here.","home.untitled":"Untitled","home.revealInFileManager":"Show in file manager","home.emptyDoc":"(Empty document)","home.cwdTitle":"Open in Finder / File Explorer: {path}","home.cwdFallback":"homePath (no-cwd fallback)","home.today":"Today {clock}","home.yesterday":"Yesterday {clock}","appview.library":"Library","appview.libraryHint":"Recent documents across all Spaces","appview.libraryWorkspace":"Workspace files","appview.libraryOther":"Other","appview.libraryReorder":"Reorder","appview.libraryReorderDone":"Done","appview.rewrite":"Rewrite","appview.focus":"Focus","appview.openSession":"Open rewrite session","appview.rewriting":"Rewrite started. The session will apply its revision directly to the file.","appview.continuing":"Continuation started. The session will write the new text directly to the file.","appview.hintSpace":"Press space for AI \xB7 / for formatting","appview.hintSpaceCode":"Press space for AI","appview.rewriteDone":"Rewrite complete. The document has refreshed.","editor.ariaLabel":"Writing editor","actions.copyToWx":"Copy for WeChat","actions.copyImg":"Copy image","actions.exportImg":"Export image (download)","actions.exportPdf":"Export PDF","actions.aiStyle":"Ask AI to design layout","actions.toggle":"Expand/collapse","popup.placeholder":"Let {name} edit","popup.placeholderContinue":"Let {name} continue writing from here\u2026","popup.send":"Send","confirm.cancel":"Cancel","confirm.discard":"Don't save","confirm.save":"Save and return","confirm.message":"\u201C{file}\u201D has unsaved changes. Save before returning to Home?","common.markdownDocDefault":"Markdown document","common.customStyleDefault":"Custom style","toolbar.home.tooltip":"Back to Home","toolbar.open.tooltipDefault":"Open Markdown file","toolbar.save.label":"Save","toolbar.save.tooltipDefault":"Save (\u2318/Ctrl+S)","toolbar.save.tooltipDirty":"Unsaved changes (\u2318/Ctrl+S)","toolbar.save.labelSaved":"Saved","toolbar.save.tooltipSaved":"Saved","toolbar.annotate.label":"Annotate","toolbar.annotate.tooltipOn":"Annotate is on \u2014 select text to ask AI to revise it","toolbar.annotate.tooltipOff":"Turn on Annotate: select text to ask AI to revise it","toolbar.needDoc":"Open a document first","toolbar.mode.label":"Preview","toolbar.mode.tooltipToPreview":"Switch to preview","toolbar.mode.tooltipToEdit":"Switch to edit","toolbar.mode.tooltipRendering":"Rendering preview\u2026","toolbar.style.tooltip":"Layout style","toolbar.style.tooltipNeedsPreview":"Switch to preview first","toolbar.style.customSlot":"Custom style {n} \xB7 {label}","toolbar.style.customSlotEmpty":"Custom style {n} (empty)","toolbar.fontSize.tooltipPreview":"Font can't be changed while previewing","toolbar.fontSize.tooltipEdit":"Editor font size","toolbar.fontSize.small":"Small","toolbar.fontSize.medium":"Medium","toolbar.fontSize.large":"Large","toolbar.fontFamily.default":"Default (sans-serif)","toolbar.fontFamily.serif":"Serif","toolbar.comfort.read":"Compact","toolbar.comfort.write":"Comfortable","toolbar.focus.tooltipOn":"Focus mode is on \u2014 inactive lines are dimmed","toolbar.focus.tooltipOff":"Turn on focus mode: dim inactive lines","toolbar.more.reload":"Re-render","toolbar.more.reveal":"Show in file manager","toolbar.more.about":"About rendering","toolbar.more.tooltip":"More","annotate.lineUnknown":"(Couldn't pinpoint the exact line \u2014 use the quoted text below as reference)","annotate.lineSingle":"Line {a}","annotate.lineRange":"Lines {a}\u2013{b}","annotate.lineCompactUnknown":"Unlocated","annotate.requirementWith":"Requirement: {comment}","annotate.requirementDefault":"make the wording clearer","annotate.pathMissing":"(No local file linked \u2014 ask me to paste/save the full text first)","annotate.emptyLine":"(Blank line \u2014 add or continue content here according to the annotation.)","annotate.promptText":`Please rewrite this Markdown passage (location: {lineLabel}), {requirement}:
6
7
 
7
8
  {text}
8
9
 
9
- Give a drop-in replacement snippet first; once I confirm, write it back to the source file ({path}) as a targeted local replacement, not a full resend of the document.`,"annotate.reminder":"Only propose the rewrite \u2014 don't write to the source file before I confirm. Reply in natural language (e.g. \u201CI'll put it into the file once you confirm\u201D); never name the tool or its actions. [MANDATORY, not optional] Whenever this turn proposes a rewrite and is waiting on my confirmation, calling Session action=suggest with 1\u20133 one-tap confirmations (e.g. \u201CUse this one\u201D, \u201CUse the shorter version\u201D, \u201CTry another tone\u201D) is part of completing that same turn \u2014 writing the proposal text is only half the job. Do not treat the turn as done, and do not skip the call, just because the proposal text itself was already sent.","newdoc.needChat":"Use \u201CNew Document\u201D from the Finch chat instead.","newdoc.label":"New Markdown Document","newdoc.promptText":"I want to create a new Markdown document. First work out the title, content, and a not-yet-existing absolute save path from my request \u2014 ask me first if anything is missing. Once confirmed, write the full body to that path and open the new document in the editor.","newdoc.reminder":"Only create a new file; never overwrite an existing one. Reply in natural language and never name the tool or its actions. [MANDATORY, not optional] Whenever this turn ends still waiting on me to confirm a title, an angle, or a save location, it must call Session action=suggest with 1\u20133 one-tap options before the turn ends \u2014 asking the question in plain text is not enough on its own; skipping the call leaves the question unfinished.","newdoc.added":"Added the new-document prompt to the composer.","aiStyle.label":"Design a layout based on {file}","aiStyle.note":"One-click AI layout","aiStyle.baseNoteCustom":"The current base style is kami (your custom CSS layers on top of it)","aiStyle.baseNoteOther":"The current base style is {style}","aiStyle.pathMissing":"(No local file linked)","aiStyle.promptText":"Please design a custom layout CSS for this WeChat article. {baseNote}, and your CSS will layer on top of the base style. Requirements: write plain CSS rules only, with selectors scoped to tags/structure under #bm-md (e.g. #bm-md h1, #bm-md p, #bm-md blockquote, #bm-md pre code, #bm-md a, #bm-md strong, #bm-md table); don\u2019t use classes (bm.md\u2019s output has no classes, only inline styles), and use !important where needed to override the base style. You can draw on bm.md\u2019s built-in style language: kami (warm paper feel), bauhaus (geometric color-blocking), blueprint (technical grid), botanical (fresh green), newsprint (editorial serif), retro (nostalgic), sketch (hand-drawn), terminal (monospace dark). Article path: {path}. Before generating any CSS, ask the user which of \u201CCustom style 1/2/3\u201D slots to overwrite; once they choose, apply the CSS you designed to that slot (it needs the css, a short label, and the slot number 1/2/3). That overwrites and persists the slot and applies it to the preview immediately.","aiStyle.reminder":"Always ask which slot first \u2014 never guess or overwrite on your own; apply it only after the user picks 1/2/3. Reply in natural language and never name the tool or its actions. [MANDATORY, not optional] Asking which slot must always be paired with calling Session action=suggest (\u201CUse custom style 1/2/3\u201D as one-tap options) before the turn ends \u2014 the question is not considered asked until that call happens, not merely the text of the question.","aiStyle.requested":"Asked AI to design a custom layout.","status.saved":"Saved.","status.savedWithNewChanges":"Saved \u2014 but the editor already has newer changes.","status.saveFailed":"Save failed: {err}","status.saving":"Saving\u2026","status.noSourceFile":"Not linked to a local file: click \u201COpen\u201D in the toolbar again to link it and enable saving.","status.pickerTimeout":'The file picker took too long to respond and switched to the in-browser picker \u2014 please click "Open" again.',"status.externalUpdateSkipped":"Detected an external file update; not loaded yet to avoid overwriting unsaved changes.","status.draftRestored":'Restored your last unsaved edits (differs from the file on disk). To discard, click "Open" and pick this file again, then choose "Discard".',"status.draftConflict":"A local unsaved draft exists, but the file was changed and saved elsewhere; loaded the latest file content \u2014 the draft is kept, not discarded.","status.sourceMissing":"The original file was moved or deleted; your content is still here \u2014 saving will recreate the file at its original path.","status.externalUpdateApplied":"Detected a file update and refreshed.","status.openingPicker":"Opening the file picker\u2026","status.opening":"Opening\u2026","status.opened":"Opened {file}.","status.contentUpdated":"Content updated.","status.contentUpdatedLine":"Updated line {line}.","status.contentUpdatedLines":"Updated lines {from}\u2013{to}.","status.contentUpdatedSpots":"Updated {count} spots, {lines} lines in total.","status.pasteImageTimeout":"Paste image timed out","status.pasteImageFailed":"Paste image failed: {msg}","status.clipboardPrepareTimeout":"Preparing WeChat images timed out","status.pleaseOpenArticle":"Open an article first.","status.copiedRich":"Rich HTML copied \u2014 paste it directly into the WeChat editor.","status.copiedPlainOnly":"Only plain text was copied; formatting didn't come through \u2014 please try again.","status.copyFailed":"Copy failed \u2014 please try again.","status.richCopyFailed":"Rich-text copy failed: {err}","status.clipboardUnsupported":"Copying images isn\u2019t supported here \u2014 use \u201CExport Image\u201D instead.","status.generatingImage":"Generating image\u2026","status.previewNotReady":"Preview isn't ready yet","status.imageCopied":"Image copied to the clipboard.","status.copyImageFailed":"Copy image failed: {err} (try \u201CExport Image\u201D instead)","status.exportImageFailedGeneric":"Export image failed: preview isn't ready yet.","status.exportImageFailed":"Export image failed: {err}","status.generatingPdf":"Generating PDF\u2026","status.exportPdfFailedGeneric":"Export PDF failed: preview isn't ready yet.","status.exportPdfFailed":"Export PDF failed: {err}","status.exported":"Exported: {path}","status.annotateOn":"Annotate is on \u2014 select text to ask AI to revise it.","status.annotateOff":"Annotate is off.","status.comfortWrite":"Comfortable mode is on \u2014 roomier line spacing.","status.comfortRead":"Compact mode is on.","status.focusOn":"Focus mode is on \u2014 inactive lines are dimmed.","status.focusOff":"Focus mode is off.","status.saveFailedNoReturn":"Save failed \u2014 staying on this document.","status.rendererAboutPrefix":"Renderer: local bmmd CLI (","status.rendererAboutSuffix":", LGPL-3.0).","status.appliedStyleSlot":"Applied \u201C{label}\u201D.","status.needCustomStyleFirst":"Apply a custom/AI-designed style first before saving it to a slot.","status.savedToSlot":"Saved to slot {slot}: {label}","status.serializeFailed":"Failed to serialize the preview content: {err}","status.imageConversionFailed":"The preview couldn't be converted to an image (it may contain external images that can't be read cross-origin)","status.imageGenFailed":"Failed to generate image data","status.clipboardPrepareFailedDefault":"Failed to prepare WeChat images","status.pasteImageFailedDefault":"Paste image failed","status.savedAppliedToSlot":"{labelPrefix}Saved and applied to custom style {slot}."}};function n(e,t){var a=qe?We.zh:We.en,r=Object.prototype.hasOwnProperty.call(a,e)?a[e]:Object.prototype.hasOwnProperty.call(We.en,e)?We.en[e]:e;if(t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r=r.split("{"+o+"}").join(String(t[o])));return r}function Ht(e){var t=e||document;document.documentElement.lang=qe?"zh-CN":"en",document.title=n("meta.title"),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n]"),function(a){a.textContent=n(a.getAttribute("data-i18n"))}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-title]"),function(a){a.title=n(a.getAttribute("data-i18n-title"))}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-tooltip]"),function(a){var r=n(a.getAttribute("data-i18n-tooltip"));a.setAttribute("data-tooltip",r),a.setAttribute("aria-label",r)}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-aria]"),function(a){a.setAttribute("aria-label",n(a.getAttribute("data-i18n-aria")))})}var it=document.getElementById("empty"),zt=document.getElementById("emptyNew"),Ut=document.getElementById("emptyOpen"),st=document.getElementById("homeRecent"),Q=document.getElementById("homeGrid"),ie=document.getElementById("homeCwd"),He=document.getElementById("homeHint"),jt=document.getElementById("homeTagline"),Ba=document.getElementById("editPane"),lt=document.getElementById("previewPane"),Z=document.getElementById("previewResizer"),se=document.getElementById("editor"),E=document.getElementById("article"),G=document.getElementById("status"),w=document.getElementById("popup"),W=document.getElementById("popupInput"),Yt=document.getElementById("popupSend"),Gt=document.getElementById("popupShortcut"),me=document.getElementById("actions"),Na=document.getElementById("actCopyWx"),qa=document.getElementById("actCopyImg"),Wa=document.getElementById("actSaveImg"),Ha=document.getElementById("actSavePdf"),za=document.getElementById("actAiStyle"),_t=document.getElementById("actToggle"),ge=document.getElementById("confirmOverlay"),Ua=document.getElementById("confirmMessage"),Kt=document.getElementById("confirmCancel"),Xt=document.getElementById("confirmDiscard"),dt=document.getElementById("confirmSave"),Vt=document.getElementById("appToolbar"),Jt=document.getElementById("appHome"),Qt=document.getElementById("appLibrary"),ze=document.getElementById("appOpen"),J=document.getElementById("appSave"),ve=document.getElementById("appPreview"),ut=document.getElementById("appStyle"),Ue=document.getElementById("appStyleMenu"),he=document.getElementById("appFocus"),ct=document.getElementById("appFont"),je=document.getElementById("appFontMenu"),ja=document.getElementById("appMore"),Ye=document.getElementById("appMoreMenu"),Zt=document.getElementById("appDocumentTitle"),$t=document.getElementById("appDocumentPath"),pt=document.getElementById("libraryDrawer"),Ge=document.getElementById("libraryBackdrop"),ea=document.getElementById("libraryClose"),C=document.getElementById("libraryGroups"),ta="md-editor-library-groups-v1",ye=[],_e={},$=null,be=null,O=null,ft=!1,S=!1,we=!0,Ke=0,Se=!1,_=!0,y="edit",R="kami",le="",mt="",K=[null,null,null],Xe={songti:"Songti SC, STSong, SimSun, Noto Serif CJK SC, serif",rounded:"PingFang SC, Microsoft YaHei, Noto Sans CJK SC, sans-serif"},X=14,ee="rounded",H=!1,I=!1;try{var Ve=Number(localStorage.getItem("md-editor-font-size"));(Ve===14||Ve===16||Ve===18)&&(X=Ve);var gt=localStorage.getItem("md-editor-font-family");Xe[gt]?ee=gt:gt&&localStorage.removeItem("md-editor-font-family"),H=localStorage.getItem("md-editor-comfort-writing")==="1",I=localStorage.getItem("md-editor-focus-mode")==="1";var ke=JSON.parse(localStorage.getItem(ta)||"{}");Array.isArray(ke.order)&&(ye=ke.order.filter(function(e){return typeof e=="string"})),ke.collapsed&&typeof ke.collapsed=="object"&&(_e=ke.collapsed)}catch{}_=!I;var m="",xe="",D="",p="",B=null,P="",vt=!1,aa=0,Ee=!1,ra=0,ht={},de={},Ya=0,te={},Ga=0,ae={},Ce=0,z=null,Je=0,ue=0,yt=!1,g={text:"",mode:"replace"},U=0;function s(e,t){U&&(clearTimeout(U),U=0),G.textContent=e||"",G.className="status"+(t?" error":""),e&&(U=setTimeout(function(){U=0,G.textContent="",G.className="status"},5e3))}function _a(){U&&(clearTimeout(U),U=0),G.replaceChildren(document.createTextNode(n("status.rendererAboutPrefix")));var e=document.createElement("a");e.href="https://bm.md/",e.textContent="bm.md",e.title="https://bm.md/",e.addEventListener("click",function(t){t.preventDefault(),i&&i.postMessage&&i.postMessage({type:"openLink",url:"https://bm.md/"})}),G.append(e,document.createTextNode(n("status.rendererAboutSuffix"))),G.className="status",U=setTimeout(function(){U=0,G.textContent="",G.className="status"},5e3)}function V(){return!!m||!!p}zt&&zt.addEventListener("click",async function(){if(!i||!i.composer){s(n("newdoc.needChat"),!0);return}try{await i.composer.addContexts([{type:"annotation",label:n("newdoc.label"),promptText:n("newdoc.promptText"),reminder:n("newdoc.reminder")}]),s(n("newdoc.added"))}catch(e){s(String(e),!0)}}),Ut&&Ut.addEventListener("click",function(){At()});var re="",bt="",wt="",Qe="",Ze=!1,na=!1,Le="",ne="";function k(e){return String(e).replace(/[&<>"]/g,function(t){return t==="&"?"&amp;":t==="<"?"&lt;":t===">"?"&gt;":"&quot;"})}function oa(){jt&&(jt.textContent=Le?n("home.tagline.withAssistant",{name:Le}):n("home.tagline.default"))}function $e(){W&&(W.placeholder=g.mode==="continue"?n("popup.placeholderContinue",{name:Le||"Finch"}):n("popup.placeholder",{name:Le||"Finch"}))}function Ka(e){return e?ne&&e===ne?"~":ne&&(e.indexOf(ne+"/")===0||e.indexOf(ne+"\\")===0)?"~"+e.slice(ne.length):e:""}function Xa(e){var t=46;if(!e||e.length<=t)return e;var a=e.indexOf("/")===-1&&e.indexOf("\\")!==-1?"\\":"/",r=e.slice(-(t-1)),o=r.indexOf(a);return o>0&&o<10&&(r=r.slice(o)),"\u2026"+r}function St(){if(ie){var e=re||Qe;ie.textContent=Xa(Ka(e)),ie.title=e?n("home.cwdTitle",{path:e}):"",ie.hidden=!e}}ie&&ie.addEventListener("click",function(){var e=re||Qe;!e||!i||!i.postMessage||i.postMessage({type:"openPath",path:e})});function ia(e){var t=new Date(e);if(!e||isNaN(t.getTime()))return"";var a=new Date,r=function(d){return d<10?"0"+d:String(d)},o=r(t.getHours())+":"+r(t.getMinutes()),l=t.toDateString()===a.toDateString();if(l)return n("home.today",{clock:o});var u=new Date(a.getTime()-864e5);return t.toDateString()===u.toDateString()?n("home.yesterday",{clock:o}):t.getFullYear()===a.getFullYear()?r(t.getMonth()+1)+"-"+r(t.getDate()):t.getFullYear()+"-"+r(t.getMonth()+1)+"-"+r(t.getDate())}function et(){!i||!i.postMessage||!Ze||(na=!0,i.postMessage({type:"requestRecentDocuments",cwd:re,sessionId:bt,spaceId:wt}))}function sa(e){if(!(!Q||!st||!He)){var t=Array.isArray(e)?e:[];if(t.length===0){st.hidden=!0,He.hidden=!1,He.textContent=n(re?"home.hintScoped":"home.hintDefault");return}for(var a="",r=0;r<t.length;r++){var o=t[r]||{},l=o.relativePath||o.fileName||"";a+='<button class="doc-card" type="button" data-path="'+k(o.path||"")+'" title="'+k(o.path||"")+'"><span class="doc-reveal" data-reveal-path="'+k(o.path||"")+'" role="button" tabindex="0" title="'+k(n("home.revealInFileManager"))+'" aria-label="'+k(n("home.revealInFileManager"))+'"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"/></svg></span><div class="doc-preview">'+k(o.preview||n("home.emptyDoc"))+'</div><div class="doc-foot"><div class="doc-title">'+k(o.title||o.fileName||n("home.untitled"))+'</div><div class="doc-sub"><span class="doc-path" data-full-path="'+k(l)+'">'+k(l)+'</span><span class="doc-time">'+k(ia(o.modifiedAt))+"</span></div></div></button>"}Q.innerHTML=a,st.hidden=!1,He.hidden=!0,requestAnimationFrame(function(){Va(Q)})}}function Va(e){for(var t="\u2026",a=e.querySelectorAll("[data-full-path]"),r=0;r<a.length;r++){var o=a[r],l=o.getAttribute("data-full-path")||"";if(o.textContent=l,!(!l||o.scrollWidth<=o.clientWidth+1)){for(var u=0,d=l.length,c=0;u<=d;){var f=u+d>>1;o.textContent=f>0?t+l.slice(l.length-f):t,o.scrollWidth<=o.clientWidth+1?(c=f,u=f+1):d=f-1}o.textContent=c>0?t+l.slice(l.length-c):t}}}function la(){try{localStorage.setItem(ta,JSON.stringify({order:ye,collapsed:_e}))}catch{}}function Ja(e){if(C){var t={};(Array.isArray(e)?e:[]).forEach(function(r){var o=r.scopeKind||"external",l=o==="workspace"?n("appview.libraryWorkspace"):o==="external"?n("appview.libraryOther"):r.scopeLabel||r.spaceName||n("appview.libraryOther"),u=o==="space"?"space:"+(r.spaceId||l):o==="workspace"?"workspace":"external";t[u]||(t[u]={id:u,kind:o,label:l,documents:[]}),t[u].documents.push(r)});var a=Object.keys(t).map(function(r){return t[r]}).sort(function(r,o){if(r.kind==="external"||o.kind==="external")return r.kind===o.kind?0:r.kind==="external"?1:-1;var l=ye.indexOf(r.id),u=ye.indexOf(o.id);if(l>=0||u>=0)return(l<0?9999:l)-(u<0?9999:u);var d={space:0,workspace:1},c=d[r.kind]-d[o.kind];return c||r.label.localeCompare(o.label)});C.innerHTML=a.map(function(r){var o=r.documents.map(function(d){var c=d.relativePath||d.fileName||"";return'<button class="library-row" type="button" data-path="'+k(d.path||"")+'"><span class="library-row-main"><strong>'+k(d.title||d.fileName||n("home.untitled"))+'</strong><span class="library-row-meta"><span class="library-row-path" title="'+k(c)+'">'+k(c)+"</span><time>"+k(ia(d.modifiedAt))+"</time></span></span></button>"}).join(""),l=r.kind!=="external",u=!_e[r.id];return'<details class="library-group" data-library-group-id="'+k(r.id)+'"'+(l?' data-draggable="true"':"")+(u?" open":"")+'><summary><span class="library-group-title">'+k(r.label)+'</span><span class="library-group-count">'+r.documents.length+'</span></summary><div class="library-items">'+o+"</div></details>"}).join("")||'<p class="home-hint">'+k(n("home.hintDefault"))+"</p>"}}function tt(e){!pt||!Ge||(pt.classList.toggle("open",!!e),pt.setAttribute("aria-hidden",e?"false":"true"),Ge.hidden=!e,e&&et())}function Qa(){if(!(!$||!C)){$.classList.remove("dragging"),Array.prototype.forEach.call(C.querySelectorAll(".library-group.drag-over"),function(t){t.classList.remove("drag-over")}),ye=Array.prototype.map.call(C.querySelectorAll('.library-group[data-draggable="true"]'),function(t){return t.getAttribute("data-library-group-id")}).filter(Boolean);var e=be||{};Array.prototype.forEach.call(C.querySelectorAll(".library-group"),function(t){var a=t.getAttribute("data-library-group-id");a in e&&(t.open=!!e[a])}),$=null,setTimeout(function(){be=null,la()},0)}}function Za(){O&&O.ghost&&O.ghost.parentNode&&O.ghost.parentNode.removeChild(O.ghost)}function da(e,t){var a=O;!a||!a.ghost||(a.ghost.style.left=e-a.offsetX+"px",a.ghost.style.top=t-a.offsetY+"px")}function $a(e){var t=O;if(!(!t||t.active)){t.active=!0,$=e,be={},Array.prototype.forEach.call(C.querySelectorAll(".library-group"),function(o){var l=o.getAttribute("data-library-group-id");l&&(be[l]=!!o.open),o.open=!1}),e.classList.add("dragging");var a=e.getBoundingClientRect(),r=e.cloneNode(!0);r.classList.add("library-drag-ghost"),r.classList.remove("dragging"),r.style.width=a.width+"px",t.ghost=r,t.offsetX=t.startX-a.left,t.offsetY=t.startY-a.top,document.body.appendChild(r),da(t.startX,t.startY)}}function er(e,t){if($){var a=document.elementFromPoint(e,t),r=a&&a.closest?a.closest('.library-group[data-draggable="true"]'):null;if(Array.prototype.forEach.call(C.querySelectorAll(".library-group.drag-over"),function(l){l.classList.remove("drag-over")}),!(!r||r===$)){r.classList.add("drag-over");var o=t>r.getBoundingClientRect().top+r.offsetHeight/2;C.insertBefore($,o?r.nextSibling:r)}}}function ua(){var e=O;e&&(e.active&&(Za(),Qa(),ft=!0,setTimeout(function(){ft=!1},0)),O=null)}Qt&&Qt.addEventListener("click",function(){tt(!0)}),ea&&ea.addEventListener("click",function(){tt(!1)}),Ge&&Ge.addEventListener("click",function(){tt(!1)}),C&&C.addEventListener("click",function(e){var t=e.target&&e.target.closest?e.target.closest(".library-row"):null,a=t&&t.getAttribute("data-path");!a||!i||!i.postMessage||(tt(!1),Me=!0,s(n("status.opening")),i.postMessage({type:"loadPath",path:a}))}),C&&(C.addEventListener("toggle",function(e){var t=e.target;if(!(!t||!t.matches||!t.matches(".library-group"))&&!be){var a=t.getAttribute("data-library-group-id");a&&(_e[a]=!t.open,la())}},!0),C.addEventListener("click",function(e){if(ft){var t=e.target&&e.target.closest?e.target.closest(".library-group summary"):null;t&&(e.preventDefault(),e.stopPropagation())}},!0),C.addEventListener("pointerdown",function(e){if(e.button===0){var t=e.target&&e.target.closest?e.target.closest(".library-group summary"):null,a=t&&t.closest?t.closest('.library-group[data-draggable="true"]'):null;a&&(O={group:a,startX:e.clientX,startY:e.clientY,active:!1,ghost:null,offsetX:0,offsetY:0})}}),window.addEventListener("pointermove",function(e){var t=O;if(t){if(!t.active){if(Math.abs(e.clientX-t.startX)<4&&Math.abs(e.clientY-t.startY)<4)return;$a(t.group)}e.preventDefault(),da(e.clientX,e.clientY),er(e.clientX,e.clientY)}}),window.addEventListener("pointerup",function(){ua()}),window.addEventListener("pointercancel",function(){ua()}));var Me=!1;Q&&Q.addEventListener("click",function(e){if(!(!i||!i.postMessage)){var t=e.target&&e.target.closest?e.target.closest(".doc-reveal"):null;if(t){e.preventDefault(),e.stopPropagation();var a=t.getAttribute("data-reveal-path")||"";a&&i.postMessage({type:"openPath",path:a});return}var r=e.target&&e.target.closest?e.target.closest(".doc-card"):null;if(r){var o=r.getAttribute("data-path")||"";o&&(Me=!0,s(n("status.opening")),i.postMessage({type:"loadPath",path:o}))}}}),Q&&Q.addEventListener("keydown",function(e){if(!(e.key!=="Enter"&&e.key!==" ")){var t=e.target&&e.target.closest?e.target.closest(".doc-reveal"):null;if(!(!t||!i||!i.postMessage)){e.preventDefault(),e.stopPropagation();var a=t.getAttribute("data-reveal-path")||"";a&&i.postMessage({type:"openPath",path:a})}}});function Ie(){it.hidden=V(),document.body.classList.toggle("has-document",V()),me&&(me.hidden=!P),!it.hidden&&Ze&&et()}function ce(){Ba.classList.toggle("active",S?V():y==="edit"),lt.classList.toggle("active",S?V():y==="preview"),(S||y==="edit")&&h&&requestAnimationFrame(function(){h.layout()})}function ca(e){!i||!i.panel||!i.panel.setTitle||i.panel.setTitle(e||n("home.title")).catch(function(){})}function tr(){for(var e=[{id:"style:kami",label:"Kami"},{id:"style:bauhaus",label:"Bauhaus"},{id:"style:blueprint",label:"Blueprint"},{id:"style:botanical",label:"Botanical"},{id:"style:newsprint",label:"Newsprint"},{id:"style:retro",label:"Retro"},{id:"style:sketch",label:"Sketch"},{id:"style:terminal",label:"Terminal"},{id:"style-sep",label:"",separator:!0}],t=0;t<3;t++){var a=K[t];e.push(a?{id:"style:slot-use:"+t,label:n("toolbar.style.customSlot",{n:t+1,label:a.label})}:{id:"style:slot-use:"+t,label:n("toolbar.style.customSlotEmpty",{n:t+1}),disabled:!0})}return e}function ar(){var e="ext:markdown-editor-icons/save",t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDefault");F?(t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDirty")):pe&&(e="ext:markdown-editor-icons/save-check",t=n("toolbar.save.labelSaved"),a=n("toolbar.save.tooltipSaved"));var r=V();return[{id:"home",icon:"house",tooltip:n("toolbar.home.tooltip")},{id:"open",icon:"ext:markdown-editor-icons/folder-open",tooltip:p||D||n("toolbar.open.tooltipDefault"),disabled:N},{id:"save",icon:e,label:t,tooltip:a,disabled:!F},{type:"separator"},{id:"mode",icon:Ee?"ext:markdown-editor-icons/hourglass":"ext:markdown-editor-icons/swatch-book",label:n("toolbar.mode.label"),tooltip:n(r?Ee?"toolbar.mode.tooltipRendering":y==="edit"?"toolbar.mode.tooltipToPreview":"toolbar.mode.tooltipToEdit":"toolbar.needDoc"),checked:y==="preview",disabled:!r},{type:"menu",id:"style",icon:"palette",tooltip:n(y==="preview"?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"),disabled:y!=="preview",items:tr()},{type:"spacer"},{id:"focus",icon:"ext:markdown-editor-icons/feather",tooltip:n(r?I?"toolbar.focus.tooltipOn":"toolbar.focus.tooltipOff":"toolbar.needDoc"),checked:I,disabled:!r||y==="preview"},{type:"menu",id:"font-size",icon:"ext:markdown-editor-icons/type",tooltip:n(r?y==="preview"?"toolbar.fontSize.tooltipPreview":"toolbar.fontSize.tooltipEdit":"toolbar.needDoc"),disabled:!r||y==="preview",items:[{id:"comfort:read",label:n("toolbar.comfort.read"),checked:!H},{id:"comfort:write",label:n("toolbar.comfort.write"),checked:H},{id:"font-comfort-sep",label:"",separator:!0},{id:"font-size:14",label:n("toolbar.fontSize.small"),checked:X===14},{id:"font-size:16",label:n("toolbar.fontSize.medium"),checked:X===16},{id:"font-size:18",label:n("toolbar.fontSize.large"),checked:X===18},{id:"font-sep",label:"",separator:!0},{id:"font-family:rounded",label:n("toolbar.fontFamily.default"),checked:ee==="rounded"},{id:"font-family:songti",label:n("toolbar.fontFamily.serif"),checked:ee==="songti"}]},{type:"menu",id:"more",icon:"settings",items:[{id:"reload",label:n("toolbar.more.reload"),disabled:y!=="preview"},{id:"reveal",label:n("toolbar.more.reveal"),disabled:!r},{id:"more-sep",label:"",separator:!0},{id:"about",label:n("toolbar.more.about")}]}]}function A(e,t,a){return'<button type="button" data-app-action="'+e+'"'+(a?' class="checked"':"")+"><span>"+t+"</span>"+(a?"<span>\u2713</span>":"")+"</button>"}function rr(){if(Ue){for(var e=["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"],t=e.map(function(o){return A("style:"+o,o[0].toUpperCase()+o.slice(1),R===o)}).join("")+"<hr>",a=0;a<3;a++){var r=K[a];t+=r?A("style:slot-use:"+a,n("toolbar.style.customSlot",{n:a+1,label:r.label}),R==="custom"&&le===r.css):A("style:slot-use:"+a,n("toolbar.style.customSlotEmpty",{n:a+1}),!1)}Ue.innerHTML=t}je&&(je.innerHTML=A("comfort:read",n("toolbar.comfort.read"),!H)+A("comfort:write",n("toolbar.comfort.write"),H)+"<hr>"+A("font-size:14",n("toolbar.fontSize.small"),X===14)+A("font-size:16",n("toolbar.fontSize.medium"),X===16)+A("font-size:18",n("toolbar.fontSize.large"),X===18)+"<hr>"+A("font-family:rounded",n("toolbar.fontFamily.default"),ee==="rounded")+A("font-family:songti",n("toolbar.fontFamily.serif"),ee==="songti")),Ye&&(Ye.innerHTML=A("reload",n("toolbar.more.reload"),!1)+A("reveal",n("toolbar.more.reveal"),!1)+"<hr>"+A("about",n("toolbar.more.about"),!1))}function nr(){if(S){var e=V();if(J){J.disabled=!F,J.classList.toggle("dirty",F);var t=pe?"toolbar.save.tooltipSaved":F?"toolbar.save.tooltipDirty":"toolbar.save.tooltipDefault";J.setAttribute("data-tooltip",n(t));var a=J.querySelector(".ic-save"),r=J.querySelector(".ic-save-check");a&&(a.hidden=pe),r&&(r.hidden=!pe)}he&&(he.disabled=!e,he.classList.toggle("checked",I)),ve&&(ve.disabled=!e,ve.classList.toggle("checked",we)),ze&&(ze.disabled=N),ut&&(ut.disabled=!e),ct&&(ct.disabled=!e),Zt&&(Zt.textContent=D||n("home.title")),$t&&($t.textContent=p||""),rr()}}function v(){S?nr():i&&i.postMessage({type:"setToolbar",toolbar:ar()})}function Ae(e){if(L(),S){y="edit",ce(),j(),v();return}y=e,ce(),v(),y==="preview"&&j()}function or(e){return!i||!i.postMessage?Promise.reject(new Error("No host bridge.")):new Promise(function(t,a){var r=new FileReader;r.onload=function(){var o=typeof r.result=="string"?r.result:"",l=o.indexOf(","),u=l>=0?o.slice(l+1):"";if(!u){a(new Error("Could not read pasted image."));return}var d=++Ya;te[d]={resolve:t,reject:a},setTimeout(function(){te[d]&&(delete te[d],a(new Error(n("status.pasteImageTimeout"))))},15e3),i.postMessage({type:"pasteImage",data:u,mimeType:e.type,requestId:d})},r.onerror=function(){a(new Error("Could not read pasted image."))},r.readAsDataURL(e)})}var h=window.MarkdownCodeMirror.create({parent:se,value:m,onChange:function(e){m=e,L(),Ie(),Fe(!0),Er(),sr()},onOpenLink:function(e){i&&i.postMessage&&i.postMessage({type:"openLink",url:e})},onOpenImage:function(e){if(!(!i||!i.postMessage)){try{var t=new URL(e);if(t.protocol==="finch-file:"&&t.hostname==="local"){var a=t.searchParams.get("path");if(a){i.postMessage({type:"openImage",path:a});return}}}catch{}i.postMessage({type:"openImage",url:e})}},onPasteImage:or,onAiHintTrigger:kr});h.setFontSize(X),h.setFontFamily(Xe[ee]),h.setComfortWriting(H),h.setFocusMode(I),h.scrollDOM.addEventListener("scroll",L);function ir(){return R==="custom"?le:""}function sr(){S&&(Ke&&clearTimeout(Ke),Ke=setTimeout(function(){Ke=0,j()},420))}function j(){if(!(!m||!i)){var e=++aa;Ee=!0,v(),i.postMessage({type:"renderBm",markdown:m,markdownStyle:R==="custom"?"kami":R,customCss:ir(),requestId:e})}}function lr(){var e=E.contentDocument,t=e&&e.scrollingElement;return t?{top:t.scrollTop}:null}function dr(e){var t=E.contentDocument,a=t&&t.scrollingElement;!e||!a||(a.scrollTop=Math.min(e.top,Math.max(0,a.scrollHeight-a.clientHeight)))}function ur(){try{return getComputedStyle(E).backgroundColor||""}catch{return""}}function pa(e){var t=lr(),a=E.contentDocument;P=e;var r=ur();if(vt&&a&&a.body){a.body.innerHTML=P,r&&(a.body.style.background=r),dr(t),ma();return}E.srcdoc='<!doctype html><meta charset="utf-8"><base target="_blank"><style>html,body{margin:0!important;padding:0!important;min-height:100%}body{background:'+(r||"transparent")+"}#bm-md{min-height:100dvh}</style><body>"+P}function fa(e,t,a){return{start:e.slice(0,t).split(`
10
+ Give a drop-in replacement snippet first; once I confirm, write it back to the source file ({path}) as a targeted local replacement, not a full resend of the document.`,"annotate.reminder":"Only propose the rewrite \u2014 don't write to the source file before I confirm. Reply in natural language (e.g. \u201CI'll put it into the file once you confirm\u201D); never name the tool or its actions. [MANDATORY, not optional] Whenever this turn proposes a rewrite and is waiting on my confirmation, calling Session action=suggest with 1\u20133 one-tap confirmations (e.g. \u201CUse this one\u201D, \u201CUse the shorter version\u201D, \u201CTry another tone\u201D) is part of completing that same turn \u2014 writing the proposal text is only half the job. Do not treat the turn as done, and do not skip the call, just because the proposal text itself was already sent.","newdoc.needChat":"Use \u201CNew Document\u201D from the Finch chat instead.","newdoc.label":"New Markdown Document","newdoc.promptText":"I want to create a new Markdown document. First work out the title, content, and a not-yet-existing absolute save path from my request \u2014 ask me first if anything is missing. Once confirmed, write the full body to that path and open the new document in the editor.","newdoc.reminder":"Only create a new file; never overwrite an existing one. Reply in natural language and never name the tool or its actions. [MANDATORY, not optional] Whenever this turn ends still waiting on me to confirm a title, an angle, or a save location, it must call Session action=suggest with 1\u20133 one-tap options before the turn ends \u2014 asking the question in plain text is not enough on its own; skipping the call leaves the question unfinished.","newdoc.added":"Added the new-document prompt to the composer.","aiStyle.label":"Design a layout based on {file}","aiStyle.note":"One-click AI layout","aiStyle.baseNoteCustom":"The current base style is kami (your custom CSS layers on top of it)","aiStyle.baseNoteOther":"The current base style is {style}","aiStyle.pathMissing":"(No local file linked)","aiStyle.promptText":'Please design a custom layout CSS for this WeChat article. {baseNote}, and your CSS will layer on top of the base style. Requirements: write plain CSS rules only, with selectors scoped to tags/structure under #bm-md (e.g. #bm-md h1, #bm-md p, #bm-md blockquote, #bm-md pre code, #bm-md a, #bm-md strong, #bm-md table); don\u2019t use classes (bm.md\u2019s output has no classes, only inline styles), and use !important where needed to override the base style. You can draw on bm.md\u2019s built-in style language: kami (warm paper feel), bauhaus (geometric color-blocking), blueprint (technical grid), botanical (fresh green), newsprint (editorial serif), retro (nostalgic), sketch (hand-drawn), terminal (monospace dark). Article path: {path}. Once it\u2019s ready, call set_style directly (pass path="{path}", css, and a short label, no slot \u2014 passing path lets it find the right preview panel for this document even if I\u2019ve switched away) \u2014 don\u2019t ask me which slot to use first; the panel will pop up a lightweight \u201Csave as custom style\u201D button so I can decide after seeing the result.',"aiStyle.reminder":"Don\u2019t ask which slot to use before applying \u2014 just design it and call set_style (without slot) to apply it to the preview; whether to save it is for me to decide from the panel. Reply in natural language and never name the tool or its actions.","aiStyle.requested":"Asked AI to design a custom layout.","aiStyle.applied":"AI designed a layout and applied it to the preview.","aiStyle.saveToSlot":"Save as style {n}","aiStyle.appViewDesigning":"AI is designing a layout\u2026","aiStyle.appViewDone":"Layout design finished.","aiStyle.appViewFailed":"Layout design did not finish.","status.saved":"Saved.","status.savedWithNewChanges":"Saved \u2014 but the editor already has newer changes.","status.saveFailed":"Save failed: {err}","status.saving":"Saving\u2026","status.noSourceFile":"Not linked to a local file: click \u201COpen\u201D in the toolbar again to link it and enable saving.","status.pickerTimeout":'The file picker took too long to respond and switched to the in-browser picker \u2014 please click "Open" again.',"status.externalUpdateSkipped":"Detected an external file update; not loaded yet to avoid overwriting unsaved changes.","status.draftRestored":'Restored your last unsaved edits (differs from the file on disk). To discard, click "Open" and pick this file again, then choose "Discard".',"status.draftConflict":"A local unsaved draft exists, but the file was changed and saved elsewhere; loaded the latest file content \u2014 the draft is kept, not discarded.","status.sourceMissing":"The original file was moved or deleted; your content is still here \u2014 saving will recreate the file at its original path.","status.externalUpdateApplied":"Detected a file update and refreshed.","status.openingPicker":"Opening the file picker\u2026","status.opening":"Opening\u2026","status.opened":"Opened {file}.","status.contentUpdated":"Content updated.","status.contentUpdatedLine":"Updated line {line}.","status.contentUpdatedLines":"Updated lines {from}\u2013{to}.","status.contentUpdatedSpots":"Updated {count} spots, {lines} lines in total.","status.pasteImageTimeout":"Paste image timed out","status.pasteImageFailed":"Paste image failed: {msg}","status.clipboardPrepareTimeout":"Preparing WeChat images timed out","status.pleaseOpenArticle":"Open an article first.","status.copiedRich":"Rich HTML copied \u2014 paste it directly into the WeChat editor.","status.copiedPlainOnly":"Only plain text was copied; formatting didn't come through \u2014 please try again.","status.copyFailed":"Copy failed \u2014 please try again.","status.richCopyFailed":"Rich-text copy failed: {err}","status.clipboardUnsupported":"Copying images isn\u2019t supported here \u2014 use \u201CExport Image\u201D instead.","status.generatingImage":"Generating image\u2026","status.previewNotReady":"Preview isn't ready yet","status.imageCopied":"Image copied to the clipboard.","status.copyImageFailed":"Copy image failed: {err} (try \u201CExport Image\u201D instead)","status.exportImageFailedGeneric":"Export image failed: preview isn't ready yet.","status.exportImageFailed":"Export image failed: {err}","status.generatingPdf":"Generating PDF\u2026","status.exportPdfFailedGeneric":"Export PDF failed: preview isn't ready yet.","status.exportPdfFailed":"Export PDF failed: {err}","status.exported":"Exported: {path}","status.annotateOn":"Annotate is on \u2014 select text to ask AI to revise it.","status.annotateOff":"Annotate is off.","status.comfortWrite":"Comfortable mode is on \u2014 roomier line spacing.","status.comfortRead":"Compact mode is on.","status.focusOn":"Focus mode is on \u2014 inactive lines are dimmed.","status.focusOff":"Focus mode is off.","status.saveFailedNoReturn":"Save failed \u2014 staying on this document.","status.rendererAboutPrefix":"Renderer: local bmmd CLI (","status.rendererAboutSuffix":", LGPL-3.0).","status.appliedStyleSlot":"Applied \u201C{label}\u201D.","status.needCustomStyleFirst":"Apply a custom/AI-designed style first before saving it to a slot.","status.savedToSlot":"Saved to slot {slot}: {label}","status.serializeFailed":"Failed to serialize the preview content: {err}","status.imageConversionFailed":"The preview couldn't be converted to an image (it may contain external images that can't be read cross-origin)","status.imageGenFailed":"Failed to generate image data","status.clipboardPrepareFailedDefault":"Failed to prepare WeChat images","status.pasteImageFailedDefault":"Paste image failed","status.savedAppliedToSlot":"{labelPrefix}Saved and applied to custom style {slot}."}};function n(e,t){var a=Ke?Xe.zh:Xe.en,r=Object.prototype.hasOwnProperty.call(a,e)?a[e]:Object.prototype.hasOwnProperty.call(Xe.en,e)?Xe.en[e]:e;if(t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r=r.split("{"+o+"}").join(String(t[o])));return r}function yt(e){var t=e||document;document.documentElement.lang=Ke?"zh-CN":"en",document.title=n("meta.title"),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n]"),function(a){a.textContent=n(a.getAttribute("data-i18n"))}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-title]"),function(a){a.title=n(a.getAttribute("data-i18n-title"))}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-tooltip]"),function(a){var r=n(a.getAttribute("data-i18n-tooltip"));a.setAttribute("data-tooltip",r),a.setAttribute("aria-label",r)}),Array.prototype.forEach.call(t.querySelectorAll("[data-i18n-aria]"),function(a){a.setAttribute("aria-label",n(a.getAttribute("data-i18n-aria")))})}var ht=document.getElementById("empty"),ta=document.getElementById("emptyNew"),aa=document.getElementById("emptyOpen"),bt=document.getElementById("homeRecent"),ae=document.getElementById("homeGrid"),Je=document.getElementById("homeHint"),wt=[],ra=document.getElementById("homeTagline"),er=document.getElementById("editPane"),St=document.getElementById("previewPane"),re=document.getElementById("previewResizer"),pe=document.getElementById("editor"),L=document.getElementById("article"),A=document.getElementById("status"),k=document.getElementById("popup"),G=document.getElementById("popupInput"),na=document.getElementById("popupSend"),oa=document.getElementById("popupShortcut"),Ee=document.getElementById("actions"),tr=document.getElementById("actCopyWx"),ar=document.getElementById("actCopyImg"),rr=document.getElementById("actSaveImg"),nr=document.getElementById("actSavePdf"),fe=document.getElementById("actAiStyle"),ia=document.getElementById("actToggle"),ne=document.getElementById("confirmOverlay"),sa=document.getElementById("confirmMessage"),kt=document.getElementById("confirmCancel"),xt=document.getElementById("confirmDiscard"),Le=document.getElementById("confirmSave"),la=document.getElementById("appToolbar"),da=document.getElementById("appHome"),ua=document.getElementById("appLibrary"),Qe=document.getElementById("appOpen"),Z=document.getElementById("appSave"),Ce=document.getElementById("appPreview"),Ze=document.getElementById("appStyle"),$e=document.getElementById("appStyleMenu"),Me=document.getElementById("appFocus"),Et=document.getElementById("appFont"),et=document.getElementById("appFontMenu"),or=document.getElementById("appMore"),tt=document.getElementById("appMoreMenu"),Lt=document.getElementById("libraryDrawer"),at=document.getElementById("libraryBackdrop"),ca=document.getElementById("libraryClose"),rt=document.getElementById("libraryReorder"),pa=document.getElementById("libraryReorderFooter"),fa=document.getElementById("libraryReorderDone"),C=document.getElementById("libraryGroups"),ma="md-editor-library-groups-v1",Ie=[],nt={},oe=null,Ae=null,$=!1,Ct=[],H=null,Mt=!1,w=!1,ga=!1,ee=!0,ir=!1,ot=0,Fe=!1,Q=!0,b="edit",x="kami",T="",me="",N=[null,null,null],ge={songti:"Songti SC, STSong, SimSun, Noto Serif CJK SC, serif",rounded:"PingFang SC, Microsoft YaHei, Noto Sans CJK SC, sans-serif"},q=14,Y="rounded",O=!1,R=!1;try{var it=Number(localStorage.getItem("md-editor-font-size"));(it===14||it===16||it===18)&&(q=it);var It=localStorage.getItem("md-editor-font-family");ge[It]?Y=It:It&&localStorage.removeItem("md-editor-font-family"),O=localStorage.getItem("md-editor-comfort-writing")==="1",R=localStorage.getItem("md-editor-focus-mode")==="1";var De=JSON.parse(localStorage.getItem(ma)||"{}");Array.isArray(De.order)&&(Ie=De.order.filter(function(e){return typeof e=="string"})),De.collapsed&&typeof De.collapsed=="object"&&(nt=De.collapsed)}catch{}Q=!R;var m="",Pe="",z="",p="",B=null,W="",At=!1,va=0,Te=!1,ya=0,Ft={},ve={},sr=0,ie={},lr=0,se={},Oe=0,K=null,st=0,ye=0,Dt=!1,v={text:"",mode:"replace"},M=0;function l(e,t){M&&(clearTimeout(M),M=0),A.textContent=e||"",A.className="status"+(t?" error":""),e&&(M=setTimeout(function(){M=0,A.textContent="",A.className="status"},5e3))}function dr(){M&&(clearTimeout(M),M=0),A.replaceChildren(document.createTextNode(n("status.rendererAboutPrefix")));var e=document.createElement("a");e.href="https://bm.md/",e.textContent="bm.md",e.title="https://bm.md/",e.addEventListener("click",function(t){t.preventDefault(),i&&i.postMessage&&i.postMessage({type:"openLink",url:"https://bm.md/"})}),A.append(e,document.createTextNode(n("status.rendererAboutSuffix"))),A.className="status",M=setTimeout(function(){M=0,A.textContent="",A.className="status"},5e3)}function X(){return!!m||!!p}ta&&ta.addEventListener("click",async function(){if(!i||!i.composer){l(n("newdoc.needChat"),!0);return}try{await i.composer.addContexts([{type:"annotation",label:n("newdoc.label"),promptText:n("newdoc.promptText"),reminder:n("newdoc.reminder")}]),l(n("newdoc.added"))}catch(e){l(String(e),!0)}}),aa&&aa.addEventListener("click",function(){jt()});var Re="",Pt="",Tt="",lt=!1,ha=!1,Be="",le="";function y(e){return String(e).replace(/[&<>"]/g,function(t){return t==="&"?"&amp;":t==="<"?"&lt;":t===">"?"&gt;":"&quot;"})}function ba(){ra&&(ra.textContent=Be?n("home.tagline.withAssistant",{name:Be}):n("home.tagline.default"))}function dt(){G&&(G.placeholder=v.mode==="continue"?n("popup.placeholderContinue",{name:Be||"Finch"}):n("popup.placeholder",{name:Be||"Finch"}))}function ur(e){return e?le&&e===le?"~":le&&(e.indexOf(le+"/")===0||e.indexOf(le+"\\")===0)?"~"+e.slice(le.length):e:""}function cr(e){var t=46;if(!e||e.length<=t)return e;var a=e.indexOf("/")===-1&&e.indexOf("\\")!==-1?"\\":"/",r=e.slice(-(t-1)),o=r.indexOf(a);return o>0&&o<10&&(r=r.slice(o)),"\u2026"+r}function pr(){ct(wt)}function wa(e){var t=new Date(e);if(!e||isNaN(t.getTime()))return"";var a=new Date,r=function(u){return u<10?"0"+u:String(u)},o=r(t.getHours())+":"+r(t.getMinutes()),s=t.toDateString()===a.toDateString();if(s)return n("home.today",{clock:o});var d=new Date(a.getTime()-864e5);return t.toDateString()===d.toDateString()?n("home.yesterday",{clock:o}):t.getFullYear()===a.getFullYear()?r(t.getMonth()+1)+"-"+r(t.getDate()):t.getFullYear()+"-"+r(t.getMonth()+1)+"-"+r(t.getDate())}function ut(){!i||!i.postMessage||!lt||(ha=!0,i.postMessage({type:"requestRecentDocuments",cwd:Re,sessionId:Pt,spaceId:Tt}))}function fr(e){e=e||{};var t=e.relativePath||e.fileName||"";return'<button class="doc-card" type="button" data-path="'+y(e.path||"")+'" title="'+y(e.path||"")+'"><span class="doc-reveal" data-reveal-path="'+y(e.path||"")+'" role="button" tabindex="0" title="'+y(n("home.revealInFileManager"))+'" aria-label="'+y(n("home.revealInFileManager"))+'"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"/></svg></span><div class="doc-preview">'+y(e.preview||n("home.emptyDoc"))+'</div><div class="doc-foot"><div class="doc-title">'+y(e.title||e.fileName||n("home.untitled"))+'</div><div class="doc-sub"><span class="doc-path" data-full-path="'+y(t)+'">'+y(t)+'</span><span class="doc-time">'+y(wa(e.modifiedAt))+"</span></div></div></button>"}function ct(e){if(!(!ae||!bt||!Je)){var t=Array.isArray(e)?e:[];if(wt=t,t.length===0){bt.hidden=!0,Je.hidden=!1,Je.textContent=n(Re?"home.hintScoped":"home.hintDefault");return}var a=ka(t);ae.innerHTML=a.map(function(r){var o=r.documents.map(fr).join(""),s=r.scopePath?'<button type="button" class="home-group-cwd" data-cwd-path="'+y(r.scopePath)+'" title="'+y(n("home.cwdTitle",{path:r.scopePath}))+'">'+y(cr(ur(r.scopePath)))+"</button>":"",d='<div class="home-group-title"><span class="home-group-label">'+y(r.label)+'<span class="home-group-count">'+r.documents.length+"</span></span>"+s+"</div>";return'<div class="home-group">'+d+'<div class="home-grid">'+o+"</div></div>"}).join(""),bt.hidden=!1,Je.hidden=!0,requestAnimationFrame(function(){mr(ae)})}}function mr(e){for(var t="\u2026",a=e.querySelectorAll("[data-full-path]"),r=0;r<a.length;r++){var o=a[r],s=o.getAttribute("data-full-path")||"";if(o.textContent=s,!(!s||o.scrollWidth<=o.clientWidth+1)){for(var d=0,u=s.length,c=0;d<=u;){var f=d+u>>1;o.textContent=f>0?t+s.slice(s.length-f):t,o.scrollWidth<=o.clientWidth+1?(c=f,d=f+1):u=f-1}o.textContent=c>0?t+s.slice(s.length-c):t}}}function Sa(){try{localStorage.setItem(ma,JSON.stringify({order:Ie,collapsed:nt}))}catch{}}function ka(e){var t={};return(Array.isArray(e)?e:[]).forEach(function(a){var r=a.scopeKind||"external",o=r==="workspace"?n("appview.libraryWorkspace"):r==="external"?n("appview.libraryOther"):a.scopeLabel||a.spaceName||n("appview.libraryOther"),s=r==="space"?"space:"+(a.spaceId||o):r==="workspace"?"workspace":"external";t[s]||(t[s]={id:s,kind:r,label:o,scopePath:"",documents:[]}),r!=="external"&&!t[s].scopePath&&a.scopePath&&(t[s].scopePath=a.scopePath),t[s].documents.push(a)}),Object.keys(t).map(function(a){return t[a]}).sort(function(a,r){if(a.kind==="external"||r.kind==="external")return a.kind===r.kind?0:a.kind==="external"?1:-1;var o=Ie.indexOf(a.id),s=Ie.indexOf(r.id);if(o>=0||s>=0)return(o<0?9999:o)-(s<0?9999:s);var d={space:0,workspace:1},u=d[a.kind]-d[r.kind];return u||a.label.localeCompare(r.label)})}function xa(e){if(C){Ct=Array.isArray(e)?e:[];var t=ka(Ct);if($){gr(t);return}C.innerHTML=t.map(function(a){var r=a.documents.map(function(d){var u=d.relativePath||d.fileName||"";return'<button class="library-row" type="button" data-path="'+y(d.path||"")+'"><span class="library-row-main"><strong>'+y(d.title||d.fileName||n("home.untitled"))+'</strong><span class="library-row-meta"><span class="library-row-path" title="'+y(u)+'">'+y(u)+"</span><time>"+y(wa(d.modifiedAt))+"</time></span></span></button>"}).join(""),o=a.kind!=="external",s=!nt[a.id];return'<details class="library-group" data-library-group-id="'+y(a.id)+'"'+(o?' data-draggable="true"':"")+(s?" open":"")+'><summary><span class="library-group-title">'+y(a.label)+'</span><span class="library-group-count">'+a.documents.length+'</span></summary><div class="library-items">'+r+"</div></details>"}).join("")||'<p class="home-hint">'+y(n("home.hintDefault"))+"</p>"}}function gr(e){C.innerHTML=e.map(function(t){var a=t.kind!=="external";return'<div class="library-group library-group-reorder" data-library-group-id="'+y(t.id)+'"'+(a?' data-draggable="true"':"")+'><span class="library-reorder-handle" aria-hidden="true">'+(a?"\u22EE\u22EE":"")+'</span><span class="library-group-title">'+y(t.label)+'</span><span class="library-group-count">'+t.documents.length+"</span></div>"}).join("")||'<p class="home-hint">'+y(n("home.hintDefault"))+"</p>"}function Ot(e){$=!!e,rt&&rt.classList.toggle("active",$),pa&&(pa.hidden=!$),xa(Ct)}function pt(e){!Lt||!at||(Lt.classList.toggle("open",!!e),Lt.setAttribute("aria-hidden",e?"false":"true"),at.hidden=!e,e?ut():$&&Ot(!1))}function vr(){if(!(!oe||!C)){oe.classList.remove("dragging"),Array.prototype.forEach.call(C.querySelectorAll(".library-group.drag-over"),function(t){t.classList.remove("drag-over")}),Ie=Array.prototype.map.call(C.querySelectorAll('.library-group[data-draggable="true"]'),function(t){return t.getAttribute("data-library-group-id")}).filter(Boolean),ct(wt);var e=Ae||{};Array.prototype.forEach.call(C.querySelectorAll(".library-group"),function(t){var a=t.getAttribute("data-library-group-id");a in e&&(t.open=!!e[a])}),oe=null,setTimeout(function(){Ae=null,Sa()},0)}}function yr(){H&&H.ghost&&H.ghost.parentNode&&H.ghost.parentNode.removeChild(H.ghost)}function Ea(e,t){var a=H;!a||!a.ghost||(a.ghost.style.left=e-a.offsetX+"px",a.ghost.style.top=t-a.offsetY+"px")}function hr(e){var t=H;if(!(!t||t.active)){t.active=!0,oe=e,Ae={},$||Array.prototype.forEach.call(C.querySelectorAll(".library-group"),function(o){var s=o.getAttribute("data-library-group-id");s&&(Ae[s]=!!o.open),o.open=!1}),e.classList.add("dragging");var a=e.getBoundingClientRect(),r=e.cloneNode(!0);r.classList.add("library-drag-ghost"),r.classList.remove("dragging"),r.style.width=a.width+"px",t.ghost=r,t.offsetX=t.startX-a.left,t.offsetY=t.startY-a.top,document.body.appendChild(r),Ea(t.startX,t.startY)}}function br(e,t){if(oe){var a=document.elementFromPoint(e,t),r=a&&a.closest?a.closest('.library-group[data-draggable="true"]'):null;if(Array.prototype.forEach.call(C.querySelectorAll(".library-group.drag-over"),function(s){s.classList.remove("drag-over")}),!(!r||r===oe)){r.classList.add("drag-over");var o=t>r.getBoundingClientRect().top+r.offsetHeight/2;C.insertBefore(oe,o?r.nextSibling:r)}}}function La(){var e=H;e&&(e.active&&(yr(),vr(),Mt=!0,setTimeout(function(){Mt=!1},0)),H=null)}ua&&ua.addEventListener("click",function(){pt(!0)}),ca&&ca.addEventListener("click",function(){pt(!1)}),at&&at.addEventListener("click",function(){pt(!1)}),rt&&rt.addEventListener("click",function(){Ot(!$)}),fa&&fa.addEventListener("click",function(){Ot(!1)}),C&&C.addEventListener("click",function(e){var t=e.target&&e.target.closest?e.target.closest(".library-row"):null,a=t&&t.getAttribute("data-path");!a||!i||!i.postMessage||(pt(!1),Ne=!0,l(n("status.opening")),i.postMessage({type:"loadPath",path:a}))}),C&&(C.addEventListener("toggle",function(e){var t=e.target;if(!(!t||!t.matches||!t.matches(".library-group"))&&!Ae){var a=t.getAttribute("data-library-group-id");a&&(nt[a]=!t.open,Sa())}},!0),C.addEventListener("click",function(e){if(Mt){var t=e.target&&e.target.closest?e.target.closest(".library-group summary"):null;t&&(e.preventDefault(),e.stopPropagation())}},!0),C.addEventListener("pointerdown",function(e){if(e.button===0&&$){var t=e.target&&e.target.closest?e.target.closest('.library-group[data-draggable="true"]'):null;t&&(H={group:t,startX:e.clientX,startY:e.clientY,active:!1,ghost:null,offsetX:0,offsetY:0})}}),window.addEventListener("pointermove",function(e){var t=H;if(t){if(!t.active){if(Math.abs(e.clientX-t.startX)<4&&Math.abs(e.clientY-t.startY)<4)return;hr(t.group)}e.preventDefault(),Ea(e.clientX,e.clientY),br(e.clientX,e.clientY)}}),window.addEventListener("pointerup",function(){La()}),window.addEventListener("pointercancel",function(){La()}));var Ne=!1;ae&&ae.addEventListener("click",function(e){if(!(!i||!i.postMessage)){var t=e.target&&e.target.closest?e.target.closest(".home-group-cwd"):null;if(t){var a=t.getAttribute("data-cwd-path")||"";a&&i.postMessage({type:"openPath",path:a});return}var r=e.target&&e.target.closest?e.target.closest(".doc-reveal"):null;if(r){e.preventDefault(),e.stopPropagation();var o=r.getAttribute("data-reveal-path")||"";o&&i.postMessage({type:"openPath",path:o});return}var s=e.target&&e.target.closest?e.target.closest(".doc-card"):null;if(s){var d=s.getAttribute("data-path")||"";d&&(Ne=!0,l(n("status.opening")),i.postMessage({type:"loadPath",path:d}))}}}),ae&&ae.addEventListener("keydown",function(e){if(!(e.key!=="Enter"&&e.key!==" ")){var t=e.target&&e.target.closest?e.target.closest(".doc-reveal"):null;if(!(!t||!i||!i.postMessage)){e.preventDefault(),e.stopPropagation();var a=t.getAttribute("data-reveal-path")||"";a&&i.postMessage({type:"openPath",path:a})}}});function qe(){ht.hidden=X(),document.body.classList.toggle("has-document",X()),Ee&&(Ee.hidden=!W),!ht.hidden&&lt&&ut()}function he(){er.classList.toggle("active",w?X():b==="edit"),St.classList.toggle("active",w?X():b==="preview"),(w||b==="edit")&&g&&requestAnimationFrame(function(){g.layout()})}function Ca(e){!i||!i.panel||!i.panel.setTitle||i.panel.setTitle(e||n("home.title")).catch(function(){})}function wr(){var e=[{id:"style:kami",label:"Kami"},{id:"style:bauhaus",label:"Bauhaus"},{id:"style:blueprint",label:"Blueprint"},{id:"style:botanical",label:"Botanical"},{id:"style:newsprint",label:"Newsprint"},{id:"style:retro",label:"Retro"},{id:"style:sketch",label:"Sketch"},{id:"style:terminal",label:"Terminal"},{id:"style-sep",label:"",separator:!0}],t=x==="custom"&&!!T&&!N.some(function(s){return s&&s.css===T});if(t){for(var a=0;a<3;a++)e.push({id:"style:slot-save:"+a,label:n("aiStyle.saveToSlot",{n:a+1})});e.push({id:"style-save-sep",label:"",separator:!0})}for(var r=0;r<3;r++){var o=N[r];e.push(o?{id:"style:slot-use:"+r,label:n("toolbar.style.customSlot",{n:r+1,label:o.label})}:{id:"style:slot-use:"+r,label:n("toolbar.style.customSlotEmpty",{n:r+1}),disabled:!0})}return e}function Sr(){var e="ext:markdown-editor-icons/save",t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDefault");D?(t=n("toolbar.save.label"),a=n("toolbar.save.tooltipDirty")):be&&(e="ext:markdown-editor-icons/save-check",t=n("toolbar.save.labelSaved"),a=n("toolbar.save.tooltipSaved"));var r=X();return[{id:"home",icon:"house",tooltip:n("toolbar.home.tooltip")},{id:"open",icon:"ext:markdown-editor-icons/folder-open",tooltip:p||z||n("toolbar.open.tooltipDefault"),disabled:j},{id:"save",icon:e,label:t,tooltip:a,disabled:!D},{type:"separator"},{id:"mode",icon:Te?"ext:markdown-editor-icons/hourglass":"ext:markdown-editor-icons/swatch-book",label:n("toolbar.mode.label"),tooltip:n(r?Te?"toolbar.mode.tooltipRendering":b==="edit"?"toolbar.mode.tooltipToPreview":"toolbar.mode.tooltipToEdit":"toolbar.needDoc"),checked:b==="preview",disabled:!r},{type:"menu",id:"style",icon:"palette",tooltip:n(b==="preview"?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"),disabled:b!=="preview",items:wr()},{type:"spacer"},{id:"focus",icon:"ext:markdown-editor-icons/feather",tooltip:n(r?R?"toolbar.focus.tooltipOn":"toolbar.focus.tooltipOff":"toolbar.needDoc"),checked:R,disabled:!r||b==="preview"},{type:"menu",id:"font-size",icon:"ext:markdown-editor-icons/type",tooltip:n(r?b==="preview"?"toolbar.fontSize.tooltipPreview":"toolbar.fontSize.tooltipEdit":"toolbar.needDoc"),disabled:!r||b==="preview",items:[{id:"comfort:read",label:n("toolbar.comfort.read"),checked:!O},{id:"comfort:write",label:n("toolbar.comfort.write"),checked:O},{id:"font-comfort-sep",label:"",separator:!0},{id:"font-size:14",label:n("toolbar.fontSize.small"),checked:q===14},{id:"font-size:16",label:n("toolbar.fontSize.medium"),checked:q===16},{id:"font-size:18",label:n("toolbar.fontSize.large"),checked:q===18},{id:"font-sep",label:"",separator:!0},{id:"font-family:rounded",label:n("toolbar.fontFamily.default"),checked:Y==="rounded"},{id:"font-family:songti",label:n("toolbar.fontFamily.serif"),checked:Y==="songti"}]},{type:"menu",id:"more",icon:"settings",items:[{id:"reload",label:n("toolbar.more.reload"),disabled:b!=="preview"},{id:"reveal",label:n("toolbar.more.reveal"),disabled:!r},{id:"more-sep",label:"",separator:!0},{id:"about",label:n("toolbar.more.about")}]}]}function F(e,t,a){return'<button type="button" data-app-action="'+e+'"'+(a?' class="checked"':"")+"><span>"+t+"</span>"+(a?"<span>\u2713</span>":"")+"</button>"}function kr(){if($e){var e=["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"],t=e.map(function(s){return F("style:"+s,s[0].toUpperCase()+s.slice(1),x===s)}).join("")+"<hr>",a=x==="custom"&&!!T&&!N.some(function(s){return s&&s.css===T});a&&(t+=[0,1,2].map(function(s){return F("style:slot-save:"+s,n("aiStyle.saveToSlot",{n:s+1}),!1)}).join("")+"<hr>");for(var r=0;r<3;r++){var o=N[r];t+=o?F("style:slot-use:"+r,n("toolbar.style.customSlot",{n:r+1,label:o.label}),x==="custom"&&T===o.css):F("style:slot-use:"+r,n("toolbar.style.customSlotEmpty",{n:r+1}),!1)}$e.innerHTML=t}et&&(et.innerHTML=F("comfort:read",n("toolbar.comfort.read"),!O)+F("comfort:write",n("toolbar.comfort.write"),O)+"<hr>"+F("font-size:14",n("toolbar.fontSize.small"),q===14)+F("font-size:16",n("toolbar.fontSize.medium"),q===16)+F("font-size:18",n("toolbar.fontSize.large"),q===18)+"<hr>"+F("font-family:rounded",n("toolbar.fontFamily.default"),Y==="rounded")+F("font-family:songti",n("toolbar.fontFamily.serif"),Y==="songti")),tt&&(tt.innerHTML=F("reload",n("toolbar.more.reload"),!1)+F("reveal",n("toolbar.more.reveal"),!1)+"<hr>"+F("about",n("toolbar.more.about"),!1))}function xr(){if(w){var e=X();if(Z){Z.disabled=!D,Z.classList.toggle("dirty",D);var t=be?"toolbar.save.tooltipSaved":D?"toolbar.save.tooltipDirty":"toolbar.save.tooltipDefault";Z.setAttribute("data-tooltip",n(t));var a=Z.querySelector(".ic-save"),r=Z.querySelector(".ic-save-check");a&&(a.hidden=be),r&&(r.hidden=!be)}Me&&(Me.disabled=!e,Me.classList.toggle("checked",R)),Ce&&(Ce.disabled=!e,Ce.classList.toggle("checked",ee)),Qe&&(Qe.disabled=j),Ze&&(Ze.disabled=!e||!ee,Ze.setAttribute("data-tooltip",n(ee?"toolbar.style.tooltip":"toolbar.style.tooltipNeedsPreview"))),Et&&(Et.disabled=!e),kr()}}function h(){w?xr():i&&i.postMessage({type:"setToolbar",toolbar:Sr()})}function We(e){if(I(),w){b="edit",he(),U(),h();return}b=e,he(),h(),b==="preview"&&U()}function Er(e){return!i||!i.postMessage?Promise.reject(new Error("No host bridge.")):new Promise(function(t,a){var r=new FileReader;r.onload=function(){var o=typeof r.result=="string"?r.result:"",s=o.indexOf(","),d=s>=0?o.slice(s+1):"";if(!d){a(new Error("Could not read pasted image."));return}var u=++sr;ie[u]={resolve:t,reject:a},setTimeout(function(){ie[u]&&(delete ie[u],a(new Error(n("status.pasteImageTimeout"))))},15e3),i.postMessage({type:"pasteImage",data:d,mimeType:e.type,requestId:u})},r.onerror=function(){a(new Error("Could not read pasted image."))},r.readAsDataURL(e)})}var g=window.MarkdownCodeMirror.create({parent:pe,value:m,onChange:function(e){m=e,I(),qe(),we(!0),Ra(),Cr()},onOpenLink:function(e){i&&i.postMessage&&i.postMessage({type:"openLink",url:e})},onOpenImage:function(e){if(!(!i||!i.postMessage)){try{var t=new URL(e);if(t.protocol==="finch-file:"&&t.hostname==="local"){var a=t.searchParams.get("path");if(a){i.postMessage({type:"openImage",path:a});return}}}catch{}i.postMessage({type:"openImage",url:e})}},onPasteImage:Er,onAiHintTrigger:zr});g.setFontSize(q),g.setFontFamily(ge[Y]),g.setComfortWriting(O),g.setFocusMode(R),g.scrollDOM.addEventListener("scroll",I);function Lr(){return x==="custom"?T:""}function Cr(){w&&(ot&&clearTimeout(ot),ot=setTimeout(function(){ot=0,U()},420))}function U(){if(!(!m||!i)){var e=++va;Te=!0,h(),i.postMessage({type:"renderBm",markdown:m,markdownStyle:x==="custom"?"kami":x,customCss:Lr(),requestId:e})}}function Mr(){var e=L.contentDocument,t=e&&e.scrollingElement;return t?{top:t.scrollTop}:null}function Ir(e){var t=L.contentDocument,a=t&&t.scrollingElement;!e||!a||(a.scrollTop=Math.min(e.top,Math.max(0,a.scrollHeight-a.clientHeight)))}function Ar(){try{return getComputedStyle(L).backgroundColor||""}catch{return""}}function Ma(e){var t=Mr(),a=L.contentDocument;W=e;var r=Ar();if(At&&a&&a.body){a.body.innerHTML=W,r&&(a.body.style.background=r),Ir(t),Aa();return}L.srcdoc='<!doctype html><meta charset="utf-8"><base target="_blank"><style>html,body{margin:0!important;padding:0!important;min-height:100%}body{background:'+(r||"transparent")+"}#bm-md{min-height:100dvh}</style><body>"+W}function Ia(e,t,a){return{start:e.slice(0,t).split(`
10
11
  `).length,end:e.slice(0,a).split(`
11
- `).length}}function cr(e,t){for(var a="",r=[],o=0;o<e.length;o++)/\s/.test(e[o])?a&&a[a.length-1]!==" "&&(a+=" ",r.push(t[o])):(a+=e[o],r.push(t[o]));return a.endsWith(" ")&&(a=a.slice(0,-1),r.pop()),{text:a,map:r}}function pr(e){var t="",a=[];function r(q,T){t+=q,a.push(T)}for(var o=0;o<e.length;){var l=o===0||e[o-1]===`
12
- `;if(l){var u=/^[ \t]*(?:```|~~~)[^\n]*/.exec(e.slice(o));if(u){o+=u[0].length;continue}var d=/^[ \t]*(?:#{1,6}|>+|[-+*]|\d+[.)])[ \t]+/.exec(e.slice(o));if(d){o+=d[0].length;continue}}var c=/^!?\[([^\]]*)\]\((?:\\.|[^)])*\)/.exec(e.slice(o));if(c){for(var f=o+c[0].indexOf("[")+1,b=0;b<c[1].length;b++)/[*_~`]/.test(c[1][b])||r(c[1][b],f+b);o+=c[0].length;continue}var x=/^<[^>]+>/.exec(e.slice(o));if(x){o+=x[0].length;continue}if(e[o]==="\\"&&o+1<e.length){r(e[o+1],o+1),o+=2;continue}if(/[*_~`]/.test(e[o])){o++;continue}r(e[o],o),o++}return cr(t,a)}function fr(e,t){var a=e.indexOf(t);if(a>=0)return{start:a,end:a+t.length};var r=pr(e),o=t.replace(/\s+/g," ").trim(),l=r.text.indexOf(o);if(l>=0)return{start:r.map[l],end:r.map[l+o.length-1]+1};if(o.length>=12){var u=o.slice(0,6),d=o.slice(-6),c=r.text.indexOf(u),f=r.text.indexOf(d,Math.max(0,c+u.length));if(c>=0&&f>=c)return{start:r.map[c],end:r.map[f+d.length-1]+1}}return null}function mr(e){return String(e||"").split(/[\\/]/).pop()||""}function ma(){var e=E.contentDocument;if(!e||e.__bound)return;e.__bound=!0;function t(){if(_){var a=E.contentWindow,r=a.getSelection(),o=r.toString().trim();if(!(!o||!r.rangeCount)){var l=r.getRangeAt(0),u=Array.from(l.getClientRects()),d=E.getBoundingClientRect(),c=u.map(function(T){return{top:d.top+T.top,left:d.left+T.left,width:T.width,height:T.height}}),f=u[0]||l.getBoundingClientRect(),b=u[u.length-1]||f,x=fr(m,o),q=x?fa(m,x.start,x.end):null;ga(o,{startTop:d.top+f.top,startLeft:d.left+f.left,endBottom:d.top+b.bottom,endLeft:d.left+b.left},c,q,"preview")}}}e.addEventListener("mouseup",t),e.addEventListener("mousedown",function(){oe(),L()}),e.addEventListener("keyup",t),e.addEventListener("keydown",function(a){(a.metaKey||a.ctrlKey)&&(a.key==="p"||a.key==="P")&&(a.preventDefault(),Ae("edit"))}),e.addEventListener("scroll",function(){oe(),L()},!0),E.contentWindow.addEventListener("scroll",function(){oe(),L()})}E.onload=function(){vt=!0,ma()};var at=0,kt=[];function ga(e,t,a,r,o){oe(),at=setTimeout(function(){va(e,t,a,r,o)},300)}function oe(){at&&(clearTimeout(at),at=0)}function va(e,t,a,r,o,l){g.text=e,g.lines=r||null,g.origin=o||"",g.mode=l||"replace",$e(),w.classList.remove("hidden"),w.classList.toggle("popup-bar",!!(t&&t.width)),W.value="",vr(a),requestAnimationFrame(function(){gr(t),t&&t.focus&&W.focus()})}function gr(e){var t=8,a=10,r=e||{},o=S?t+48:t;if(w.style.width=r.width?r.width+"px":"",r.width){w.style.left=Math.max(t,r.startLeft||0)+"px",w.style.top=Math.max(o,Math.min(r.startTop||0,window.innerHeight-(w.offsetHeight||44)-t))+"px";return}var l=w.offsetWidth||300,u=w.offsetHeight||44,d=(r.startTop||0)-a-u,c=d>=o,f=c?d:(r.endBottom||0)+a,b=c?r.startLeft||0:r.endLeft!=null?r.endLeft:r.startLeft||0;w.style.left=Math.max(t,Math.min(b,window.innerWidth-l-t))+"px",w.style.top=Math.max(o,Math.min(f,window.innerHeight-u-t))+"px"}function vr(e){ha(),(e||[]).forEach(function(t){var a=document.createElement("div");a.className="fake-sel",a.style.top=t.top+"px",a.style.left=t.left+"px",a.style.width=t.width+"px",a.style.height=t.height+"px",document.body.appendChild(a),kt.push(a)})}function ha(){kt.forEach(function(e){e.remove()}),kt=[]}var hr=navigator.platform||navigator.userAgent||"",xt=/Mac|iPhone|iPod|iPad/.test(hr);function yr(e){return String(e.key).toLowerCase()!=="e"||e.shiftKey?!1:xt?e.metaKey&&e.ctrlKey&&!e.altKey:e.ctrlKey&&e.altKey&&!e.metaKey}(function(){if(Gt){var t=xt?["\u2318","\u2303","E"]:["Ctrl","Alt","E"],a=xt?"":"+";Gt.innerHTML=t.map(function(r){return"<kbd>"+r+"</kbd>"}).join(a?'<span class="popup-shortcut-sep">'+a+"</span>":"")}})();function L(e){var t=e===!0&&g.origin==="editor"&&y==="edit";oe(),w.classList.add("hidden"),w.classList.remove("popup-bar"),w.classList.remove("focused"),w.style.width="",g.text="",g.lines=null,g.origin="",g.mode="replace",ha(),t&&requestAnimationFrame(function(){h.focus()})}Yt.onclick=ya,W.addEventListener("keydown",function(e){e.key==="Enter"&&ya(),e.key==="Escape"&&L(!0)}),W.addEventListener("focus",function(){w.classList.add("focused")}),W.addEventListener("blur",function(){requestAnimationFrame(function(){document.activeElement!==Yt&&w.classList.remove("focused")})}),document.addEventListener("keydown",function(e){e.key==="Escape"&&!w.classList.contains("hidden")&&L(!0)}),document.addEventListener("keydown",function(e){yr(e)&&(w.classList.contains("hidden")||(e.preventDefault(),W.focus(),W.select()))}),document.addEventListener("mousedown",function(e){w.contains(e.target)||(oe(),L())}),window.addEventListener("resize",L);function br(){if(!g.lines)return n("annotate.lineUnknown");var e=g.lines.start,t=g.lines.end;return e===t?n("annotate.lineSingle",{a:e}):n("annotate.lineRange",{a:e,b:t})}function wr(){return g.lines?g.lines.start+"-"+g.lines.end:n("annotate.lineCompactUnknown")}async function ya(){var e=W.value.trim(),t=g.mode==="continue",a=g.mode==="annotate-line";if(!(!g.text&&!t&&!a||!i)){if(F&&p){var r=await Ot();if(!r){s(n("status.saveFailedNoReturn"),!0);return}}if(S){if(!p||!i.postMessage){s(n("status.noSourceFile"),!0);return}i.postMessage({type:"requestRewrite",path:p,selectedText:g.text,requirement:e,startLine:g.lines&&g.lines.start,endLine:g.lines&&g.lines.end,rewriteMode:t?"continue":"replace"}),L(!0),s(n(t?"appview.continuing":"appview.rewriting"));return}if(!i.composer||!g.text&&!a){L(!0);return}try{await i.composer.addContexts([{type:"annotation",label:(D||"Markdown")+":"+wr(),note:e||void 0,promptText:n("annotate.promptText",{lineLabel:br(),requirement:e?n("annotate.requirementWith",{comment:e}):n("annotate.requirementDefault"),text:g.text||n("annotate.emptyLine"),path:p||n("annotate.pathMissing")}),reminder:n("annotate.reminder")}]),L(!0),s(n("annotate.added"))}catch(o){s(String(o),!0)}}}function Sr(){var e=h.getSelection();if(!e)return!1;var t=e.text.trim();if(!t)return!1;var a=fa(h.getValue(),e.start,e.end);return ga(t,{startTop:e.startRect.top,startLeft:e.startRect.left,endBottom:e.rect.bottom,endLeft:e.rect.left},null,a,"editor"),!0}function ba(){_&&Sr()}function kr(e){if(!V()||!e)return!1;oe();var t=se.querySelector(".cm-line")||se.querySelector(".cm-content"),a=(t||se).getBoundingClientRect();return va("",{startTop:e.rect.top,startLeft:a.left,width:Math.max(240,a.width),focus:!0},null,{start:e.line,end:e.line},"editor",S?"continue":"annotate-line"),!0}se.addEventListener("mouseup",ba),se.addEventListener("keyup",function(e){e.shiftKey&&ba()});var F=!1,pe=!1,Et="",Ct=null;function xr(e){Et=e,Ct=m,i.postMessage({type:"saveDraft",path:e,markdown:m,base:B})}function Er(){!p||!i||!i.postMessage||Et===p&&Ct===m||xr(p)}function Lt(){Et="",Ct=null}function wa(e){Lt(),e&&i&&i.postMessage&&i.postMessage({type:"discardDraft",path:e})}function Fe(e,t){F=e,Ce&&(clearTimeout(Ce),Ce=0),pe=!F&&!!t,v(),!F&&t&&(Ce=setTimeout(function(){Ce=0,F||(pe=!1,v())},3e3))}async function Sa(e){if(z&&z.createWritable)try{var t=await z.createWritable();return await t.write(e),await t.close(),Je=(await z.getFile()).lastModified,B=e,Fe(m!==e,m===e),s(n(m===e?"status.saved":"status.savedWithNewChanges")),Lt(),!0}catch(r){return s(n("status.saveFailed",{err:String(r)}),!0),!1}if(p){var a=++ra;return s(n("status.saving")),ht[a]=e,i.postMessage({type:"saveMarkdown",path:p,markdown:e,requestId:a}),new Promise(function(r){de[a]=r})}return s(n("status.noSourceFile"),!0),!1}document.addEventListener("keydown",function(e){var t=e.metaKey||e.ctrlKey;if(t&&(e.key==="s"||e.key==="S")){e.preventDefault(),Tt();return}t&&(e.key==="p"||e.key==="P")&&(e.preventDefault(),Ae(y==="edit"?"preview":"edit"))});function ka(){ue&&(clearInterval(ue),ue=0),z=null}var Mt=null;function It(e,t,a,r,o){if(!r&&F&&B!==null&&e!==B)return s(n("status.externalUpdateSkipped"),!0),!1;var l=B!==null&&(!a||!p||a===p);return l||(_=!0),m=e,xe=t,a&&(p=a),D=mr(a||p)||t||"Markdown",B=typeof o=="string"?o:m,Mt=l?h.applyExternalValue(m):null,Mt||h.setValue(m),Fe(!1),ca(D),Ie(),ce(),(S||y==="preview")&&j(),!0}async function xa(e){xe=e.name,Je=e.lastModified,typeof e.path=="string"&&e.path?(p=e.path,i&&i.postMessage({type:"watchPath",path:p})):p="",It(await e.text(),xe,p,!0)}function Cr(){z&&(ue&&clearInterval(ue),ue=setInterval(async function(){if(!(yt||!z)){yt=!0;try{var e=await z.getFile();if(e.lastModified!==Je){Je=e.lastModified;var t=await e.text();t!==B&&It(t,xe,p)&&s(n("status.externalUpdateApplied"))}}catch{}yt=!1}},800))}var N=!1,De=0;function Pe(){De&&(clearTimeout(De),De=0)}function Lr(){Pe(),De=setTimeout(function(){De=0,N&&(N=!1,Se=!1,v(),s(n("status.pickerTimeout"),!0))},2e4)}async function At(){if(F){var e=await Da(n("confirm.message",{file:D||n("common.markdownDocDefault")}));if(e==="cancel")return;if(e==="save"){var t=await Ot();if(!t){s(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&wa(p)}if(ka(),Se&&i&&i.postMessage){if(N){Pe(),Se=!1,N=!1,v(),await Ea();return}N=!0,Lr(),v(),s(n("status.openingPicker")),i.postMessage({type:"requestOpen"});return}await Ea()}async function Ea(){if("showOpenFilePicker"in window)try{var e=await window.showOpenFilePicker({types:[{description:"Markdown",accept:{"text/markdown":[".md",".markdown"]}}],multiple:!1});z=e[0],await xa(await z.getFile()),Cr();return}catch(a){if(a&&a.name==="AbortError")return}var t=document.createElement("input");t.type="file",t.accept=".md,.markdown,text/markdown",t.onchange=function(){var a=t.files&&t.files[0];a&&xa(a).catch(function(r){s(String(r),!0)})},t.click()}function Mr(){window.focus(),document.body.tabIndex=-1;try{document.body.focus({preventScroll:!0})}catch{document.body.focus()}}async function Ir(e){for(var t=0;t<e;t++){if(Mr(),await new Promise(function(a){requestAnimationFrame(function(){requestAnimationFrame(a)})}),document.hasFocus())return!0;await new Promise(function(a){setTimeout(a,40)})}return document.hasFocus()}function Ca(e){var t=Array.from(new Set(e.match(/finch-file:\/\/local\?path=[^\s)"']+/g)||[]));return!t.length||!i||!i.postMessage?Promise.resolve(e):new Promise(function(a,r){var o=++Ga;ae[o]={resolve:a,reject:r,sourceHtml:e},setTimeout(function(){ae[o]&&(delete ae[o],r(new Error(n("status.clipboardPrepareTimeout"))))},15e3),i.postMessage({type:"readClipboardImages",urls:t,requestId:o})})}function Ar(e){var t=new DOMParser().parseFromString(e,"text/html");function a(r){return r&&r.tagName==="P"&&!r.textContent.trim()&&!r.querySelector("img,video,iframe,table")}return Array.from(t.querySelectorAll("figure.figure-image")).forEach(function(r){var o=r.previousElementSibling,l=r.nextElementSibling;a(o)&&o.remove(),a(l)&&l.remove()}),t.body.innerHTML}async function La(e,t){if(document.hasFocus()||await Ir(5),window.ClipboardItem&&navigator.clipboard&&navigator.clipboard.write)try{return await navigator.clipboard.write([new ClipboardItem({"text/html":Promise.resolve(e).then(function(r){return new Blob([r],{type:"text/html"})}),"text/plain":new Blob([t],{type:"text/plain"})})]),"rich"}catch{}var a=await Promise.resolve(e);return Fr(a)?"rich":Dr(t)?"plain":"none"}function Fr(e){var t=document.createElement("div");t.contentEditable="true",t.style.position="fixed",t.style.left="-9999px",t.style.top="0",t.innerHTML=e,document.body.appendChild(t);var a=document.createRange();a.selectNodeContents(t);var r=window.getSelection();r.removeAllRanges(),r.addRange(a);var o=!1;try{o=document.execCommand("copy")}catch{o=!1}return r.removeAllRanges(),t.remove(),o}function Dr(e){var t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.focus(),t.select();var a=!1;try{a=document.execCommand("copy")}catch{a=!1}return t.remove(),a}async function Pr(){if(!P){s(n("status.pleaseOpenArticle"),!0);return}try{var e=E.contentDocument&&E.contentDocument.body?E.contentDocument.body.innerText:P.replace(/<[^>]+>/g,""),t=await La(Ca(P),e);t==="none"&&(await new Promise(function(a){setTimeout(a,200)}),t=await La(Ca(P),e)),t==="rich"?s(n("status.copiedRich")):s(n(t==="plain"?"status.copiedPlainOnly":"status.copyFailed"),!0)}catch(a){s(n("status.richCopyFailed",{err:String(a)}),!0)}finally{y==="edit"&&requestAnimationFrame(function(){h.focus()})}}function Tr(){if(!vt||!E.contentDocument)return null;var e=E.contentDocument.querySelector("#bm-md");if(!e)return null;var t=e.getBoundingClientRect();return{root:e,width:Math.ceil(t.width||e.scrollWidth),height:Math.ceil(t.height||e.scrollHeight)}}function Ft(){var e=Tr();if(!e||!e.width||!e.height)return Promise.resolve(null);var t=2,a=e.root.cloneNode(!0);a.style.minHeight=e.height+"px",a.style.margin="0",a.style.boxSizing="border-box";var r;try{r=new XMLSerializer().serializeToString(a)}catch(u){return Promise.reject(new Error(n("status.serializeFailed",{err:String(u)})))}var o='<svg xmlns="http://www.w3.org/2000/svg" width="'+e.width+'" height="'+e.height+'"><foreignObject x="0" y="0" width="'+e.width+'" height="'+e.height+'">'+r+"</foreignObject></svg>",l="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(o);return new Promise(function(u,d){var c=new Image;c.decoding="sync",c.onload=function(){try{var f=document.createElement("canvas");f.width=Math.round(e.width*t),f.height=Math.round(e.height*t);var b=f.getContext("2d");b.scale(t,t);var x="";try{x=E.contentWindow.getComputedStyle(e.root).backgroundColor}catch{x=""}x&&x!=="rgba(0, 0, 0, 0)"&&x!=="transparent"&&(b.fillStyle=x,b.fillRect(0,0,e.width,e.height)),b.drawImage(c,0,0,e.width,e.height),u({canvas:f,cssWidth:e.width,cssHeight:e.height})}catch(q){d(q)}},c.onerror=function(){d(new Error(n("status.imageConversionFailed")))},c.src=l})}function Dt(e,t,a){return new Promise(function(r,o){e.toBlob(function(l){l?r(l):o(new Error(n("status.imageGenFailed")))},t,a)})}function Ma(e){for(var t="",a=32768,r=0;r<e.length;r+=a)t+=String.fromCharCode.apply(null,e.subarray(r,r+a));return btoa(t)}async function Or(){if(!P){s(n("status.pleaseOpenArticle"),!0);return}if(!window.ClipboardItem||!navigator.clipboard||!navigator.clipboard.write){s(n("status.clipboardUnsupported"),!0);return}s(n("status.generatingImage"));var e=Ft().then(function(a){if(!a)throw new Error(n("status.previewNotReady"));return Dt(a.canvas,"image/png")});try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),s(n("status.imageCopied"));return}catch{try{var t=await e;await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),s(n("status.imageCopied"));return}catch(r){s(n("status.copyImageFailed",{err:r&&r.message?r.message:String(r)}),!0)}}}async function Rr(){if(!P){s(n("status.pleaseOpenArticle"),!0);return}try{s(n("status.generatingImage"));var e=await Ft();if(!e){s(n("status.exportImageFailedGeneric"),!0);return}var t=await Dt(e.canvas,"image/png"),a=await t.arrayBuffer(),r=Ma(new Uint8Array(a));i&&i.postMessage&&i.postMessage({type:"exportFile",data:r,ext:"png",path:p,fileName:D,markdown:m})}catch(o){s(n("status.exportImageFailed",{err:String(o)}),!0)}}function Br(e){for(var t=String(e);t.length<10;)t="0"+t;return t}function Y(e){for(var t=new Uint8Array(e.length),a=0;a<e.length;a++)t[a]=e.charCodeAt(a)&255;return t}function Pt(e){for(var t=0,a=0;a<e.length;a++)t+=e[a].length;for(var r=new Uint8Array(t),o=0,a=0;a<e.length;a++)r.set(e[a],o),o+=e[a].length;return r}function Nr(e,t,a,r,o){var l=Y(`%PDF-1.4
12
+ `).length}}function Fr(e,t){for(var a="",r=[],o=0;o<e.length;o++)/\s/.test(e[o])?a&&a[a.length-1]!==" "&&(a+=" ",r.push(t[o])):(a+=e[o],r.push(t[o]));return a.endsWith(" ")&&(a=a.slice(0,-1),r.pop()),{text:a,map:r}}function Dr(e){var t="",a=[];function r(_,P){t+=_,a.push(P)}for(var o=0;o<e.length;){var s=o===0||e[o-1]===`
13
+ `;if(s){var d=/^[ \t]*(?:```|~~~)[^\n]*/.exec(e.slice(o));if(d){o+=d[0].length;continue}var u=/^[ \t]*(?:#{1,6}|>+|[-+*]|\d+[.)])[ \t]+/.exec(e.slice(o));if(u){o+=u[0].length;continue}}var c=/^!?\[([^\]]*)\]\((?:\\.|[^)])*\)/.exec(e.slice(o));if(c){for(var f=o+c[0].indexOf("[")+1,S=0;S<c[1].length;S++)/[*_~`]/.test(c[1][S])||r(c[1][S],f+S);o+=c[0].length;continue}var E=/^<[^>]+>/.exec(e.slice(o));if(E){o+=E[0].length;continue}if(e[o]==="\\"&&o+1<e.length){r(e[o+1],o+1),o+=2;continue}if(/[*_~`]/.test(e[o])){o++;continue}r(e[o],o),o++}return Fr(t,a)}function Pr(e,t){var a=e.indexOf(t);if(a>=0)return{start:a,end:a+t.length};var r=Dr(e),o=t.replace(/\s+/g," ").trim(),s=r.text.indexOf(o);if(s>=0)return{start:r.map[s],end:r.map[s+o.length-1]+1};if(o.length>=12){var d=o.slice(0,6),u=o.slice(-6),c=r.text.indexOf(d),f=r.text.indexOf(u,Math.max(0,c+d.length));if(c>=0&&f>=c)return{start:r.map[c],end:r.map[f+u.length-1]+1}}return null}function Tr(e){return String(e||"").split(/[\\/]/).pop()||""}function Aa(){var e=L.contentDocument;if(!e||e.__bound)return;e.__bound=!0;function t(){if(Q){var a=L.contentWindow,r=a.getSelection(),o=r.toString().trim();if(!(!o||!r.rangeCount)){var s=r.getRangeAt(0),d=Array.from(s.getClientRects()),u=L.getBoundingClientRect(),c=d.map(function(P){return{top:u.top+P.top,left:u.left+P.left,width:P.width,height:P.height}}),f=d[0]||s.getBoundingClientRect(),S=d[d.length-1]||f,E=Pr(m,o),_=E?Ia(m,E.start,E.end):null;Fa(o,{startTop:u.top+f.top,startLeft:u.left+f.left,endBottom:u.top+S.bottom,endLeft:u.left+S.left},c,_,"preview")}}}e.addEventListener("mouseup",t),e.addEventListener("mousedown",function(){de(),I()}),e.addEventListener("keyup",t),e.addEventListener("keydown",function(a){(a.metaKey||a.ctrlKey)&&(a.key==="p"||a.key==="P")&&(a.preventDefault(),We("edit"))}),e.addEventListener("scroll",function(){de(),I()},!0),L.contentWindow.addEventListener("scroll",function(){de(),I()})}L.onload=function(){At=!0,Aa()};var ft=0,Rt=[];function Fa(e,t,a,r,o){de(),ft=setTimeout(function(){Da(e,t,a,r,o)},300)}function de(){ft&&(clearTimeout(ft),ft=0)}function Da(e,t,a,r,o,s){v.text=e,v.lines=r||null,v.origin=o||"",v.mode=s||"replace",dt(),k.classList.remove("hidden"),k.classList.toggle("popup-bar",!!(t&&t.width)),G.value="",Rr(a),requestAnimationFrame(function(){Or(t),t&&t.focus&&G.focus()})}function Or(e){var t=8,a=10,r=e||{},o=w?t+48:t;if(k.style.width=r.width?r.width+"px":"",r.width){k.style.left=Math.max(t,r.startLeft||0)+"px",k.style.top=Math.max(o,Math.min(r.startTop||0,window.innerHeight-(k.offsetHeight||44)-t))+"px";return}var s=k.offsetWidth||300,d=k.offsetHeight||44,u=(r.startTop||0)-a-d,c=u>=o,f=c?u:(r.endBottom||0)+a,S=c?r.startLeft||0:r.endLeft!=null?r.endLeft:r.startLeft||0;k.style.left=Math.max(t,Math.min(S,window.innerWidth-s-t))+"px",k.style.top=Math.max(o,Math.min(f,window.innerHeight-d-t))+"px"}function Rr(e){Pa(),(e||[]).forEach(function(t){var a=document.createElement("div");a.className="fake-sel",a.style.top=t.top+"px",a.style.left=t.left+"px",a.style.width=t.width+"px",a.style.height=t.height+"px",document.body.appendChild(a),Rt.push(a)})}function Pa(){Rt.forEach(function(e){e.remove()}),Rt=[]}var Br=navigator.platform||navigator.userAgent||"",Bt=/Mac|iPhone|iPod|iPad/.test(Br);function Nr(e){return String(e.key).toLowerCase()!=="e"||e.shiftKey?!1:Bt?e.metaKey&&e.ctrlKey&&!e.altKey:e.ctrlKey&&e.altKey&&!e.metaKey}(function(){if(oa){var t=Bt?["\u2318","\u2303","E"]:["Ctrl","Alt","E"],a=Bt?"":"+";oa.innerHTML=t.map(function(r){return"<kbd>"+r+"</kbd>"}).join(a?'<span class="popup-shortcut-sep">'+a+"</span>":"")}})();function I(e){var t=e===!0&&v.origin==="editor"&&b==="edit";de(),k.classList.add("hidden"),k.classList.remove("popup-bar"),k.classList.remove("focused"),k.style.width="",v.text="",v.lines=null,v.origin="",v.mode="replace",Pa(),t&&requestAnimationFrame(function(){g.focus()})}na.onclick=Ta,G.addEventListener("keydown",function(e){e.key==="Enter"&&Ta(),e.key==="Escape"&&I(!0)}),G.addEventListener("focus",function(){k.classList.add("focused")}),G.addEventListener("blur",function(){requestAnimationFrame(function(){document.activeElement!==na&&k.classList.remove("focused")})}),document.addEventListener("keydown",function(e){e.key==="Escape"&&!k.classList.contains("hidden")&&I(!0)}),document.addEventListener("keydown",function(e){Nr(e)&&(k.classList.contains("hidden")||(e.preventDefault(),G.focus(),G.select()))}),document.addEventListener("mousedown",function(e){k.contains(e.target)||(de(),I())}),window.addEventListener("resize",I);function qr(){if(!v.lines)return n("annotate.lineUnknown");var e=v.lines.start,t=v.lines.end;return e===t?n("annotate.lineSingle",{a:e}):n("annotate.lineRange",{a:e,b:t})}function Wr(){return v.lines?v.lines.start+"-"+v.lines.end:n("annotate.lineCompactUnknown")}async function Ta(){var e=G.value.trim(),t=v.mode==="continue",a=v.mode==="annotate-line";if(!(!v.text&&!t&&!a||!i)){if(D&&p){var r=await Kt();if(!r){l(n("status.saveFailedNoReturn"),!0);return}}if(w){if(!p||!i.postMessage){l(n("status.noSourceFile"),!0);return}i.postMessage({type:"requestRewrite",path:p,selectedText:v.text,requirement:e,startLine:v.lines&&v.lines.start,endLine:v.lines&&v.lines.end,rewriteMode:t?"continue":"replace"}),I(!0),l(n(t?"appview.continuing":"appview.rewriting"));return}if(!i.composer||!v.text&&!a){I(!0);return}try{await i.composer.addContexts([{type:"annotation",label:(z||"Markdown")+":"+Wr(),note:e||void 0,promptText:n("annotate.promptText",{lineLabel:qr(),requirement:e?n("annotate.requirementWith",{comment:e}):n("annotate.requirementDefault"),text:v.text||n("annotate.emptyLine"),path:p||n("annotate.pathMissing")}),reminder:n("annotate.reminder")}]),I(!0),l(n("annotate.added"))}catch(o){l(String(o),!0)}}}function Hr(){var e=g.getSelection();if(!e)return!1;var t=e.text.trim();if(!t)return!1;var a=Ia(g.getValue(),e.start,e.end);return Fa(t,{startTop:e.startRect.top,startLeft:e.startRect.left,endBottom:e.rect.bottom,endLeft:e.rect.left},null,a,"editor"),!0}function Oa(){Q&&Hr()}function zr(e){if(!X()||!e)return!1;de();var t=pe.querySelector(".cm-line")||pe.querySelector(".cm-content"),a=(t||pe).getBoundingClientRect();return Da("",{startTop:e.rect.top,startLeft:a.left,width:Math.max(240,a.width),focus:!0},null,{start:e.line,end:e.line},"editor",w?"continue":"annotate-line"),!0}pe.addEventListener("mouseup",Oa),pe.addEventListener("keyup",function(e){e.shiftKey&&Oa()});var D=!1,He=0,te=null,Nt=!1,be=!1,qt="",Wt=null;function Ur(e){qt=e,Wt=m,i.postMessage({type:"saveDraft",path:e,markdown:m,base:B})}function Ra(){!p||!i||!i.postMessage||qt===p&&Wt===m||Ur(p)}function Ht(){qt="",Wt=null}function zt(e){Ht(),e&&i&&i.postMessage&&i.postMessage({type:"discardDraft",path:e})}function we(e,t){D=e,Oe&&(clearTimeout(Oe),Oe=0),be=!D&&!!t,h(),!D&&t&&(Oe=setTimeout(function(){Oe=0,D||(be=!1,h())},3e3))}async function Ba(e){if(te)return qa(),l("\u8BF7\u5148\u5904\u7406 AI \u5199\u56DE\u4E0E\u672C\u5730\u7F16\u8F91\u7684\u51B2\u7A81\u3002",!0),!1;if(K&&K.createWritable)try{var t=await K.createWritable();return await t.write(e),await t.close(),st=(await K.getFile()).lastModified,B=e,we(m!==e,m===e),l(n(m===e?"status.saved":"status.savedWithNewChanges")),Ht(),!0}catch(r){return l(n("status.saveFailed",{err:String(r)}),!0),!1}if(p){var a=++ya;return l(n("status.saving")),Ft[a]=e,i.postMessage({type:"saveMarkdown",path:p,markdown:e,requestId:a}),new Promise(function(r){ve[a]=r})}return l(n("status.noSourceFile"),!0),!1}document.addEventListener("keydown",function(e){var t=e.metaKey||e.ctrlKey;if(t&&(e.key==="s"||e.key==="S")){e.preventDefault(),Yt();return}t&&(e.key==="p"||e.key==="P")&&(e.preventDefault(),We(b==="edit"?"preview":"edit"))});function Na(){ye&&(clearInterval(ye),ye=0),K=null}var Ut=null;function ze(e,t,a,r,o){if(!r&&D&&B!==null&&e!==B)return te={markdown:e,name:t,path:a,diskBaseline:o},l(n("status.externalUpdateSkipped"),!0),qa(),!1;var s=B!==null&&(!a||!p||a===p);return s||(Q=!0),m=e,Pe=t,a&&(p=a),z=Tr(a||p)||t||"Markdown",B=typeof o=="string"?o:m,Ut=s?g.applyExternalValue(m):null,Ut||g.setValue(m),we(!1),Ca(z),qe(),he(),(w||b==="preview")&&U(),!0}async function qa(){if(!(Nt||!te||!D)){var e=te,t=B;if(m===t){te=null,ze(e.markdown,e.name,e.path,!0,e.diskBaseline);return}if(e.markdown===t){te=null;return}Nt=!0;var a=await un();if(Nt=!1,te===e){if(a==="later"){l("AI \u5199\u56DE\u5DF2\u4FDD\u7559\u5728\u78C1\u76D8\uFF1B\u53EF\u7EE7\u7EED\u7F16\u8F91\u540E\u518D\u5904\u7406\u3002");return}if(te=null,a==="remote"){zt(p),ze(e.markdown,e.name,e.path,!0,e.diskBaseline);return}a==="local"&&(B=typeof e.diskBaseline=="string"?e.diskBaseline:e.markdown,Ra(),l("\u5DF2\u4FDD\u7559\u672C\u5730\u7F16\u8F91\uFF1BAI \u5199\u56DE\u7248\u672C\u4ECD\u5728\u78C1\u76D8\u4E0A\u3002"))}}}async function Wa(e){Pe=e.name,st=e.lastModified,typeof e.path=="string"&&e.path?(p=e.path,i&&i.postMessage({type:"watchPath",path:p})):p="",ze(await e.text(),Pe,p,!0)}function jr(){K&&(ye&&clearInterval(ye),ye=setInterval(async function(){if(!(Dt||!K)){Dt=!0;try{var e=await K.getFile();if(e.lastModified!==st){st=e.lastModified;var t=await e.text();t!==B&&ze(t,Pe,p)&&l(n("status.externalUpdateApplied"))}}catch{}Dt=!1}},800))}var j=!1,Ue=0;function je(){Ue&&(clearTimeout(Ue),Ue=0)}function _r(){je(),Ue=setTimeout(function(){Ue=0,j&&(j=!1,Fe=!1,h(),l(n("status.pickerTimeout"),!0))},2e4)}async function jt(){if(D){var e=await Ka(n("confirm.message",{file:z||n("common.markdownDocDefault")}));if(e==="cancel")return;if(e==="save"){var t=await Kt();if(!t){l(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&zt(p)}if(Na(),Fe&&i&&i.postMessage){if(j){je(),Fe=!1,j=!1,h(),await Ha();return}j=!0,_r(),h(),l(n("status.openingPicker")),i.postMessage({type:"requestOpen"});return}await Ha()}async function Ha(){if("showOpenFilePicker"in window)try{var e=await window.showOpenFilePicker({types:[{description:"Markdown",accept:{"text/markdown":[".md",".markdown"]}}],multiple:!1});K=e[0],await Wa(await K.getFile()),jr();return}catch(a){if(a&&a.name==="AbortError")return}var t=document.createElement("input");t.type="file",t.accept=".md,.markdown,text/markdown",t.onchange=function(){var a=t.files&&t.files[0];a&&Wa(a).catch(function(r){l(String(r),!0)})},t.click()}function Vr(){window.focus(),document.body.tabIndex=-1;try{document.body.focus({preventScroll:!0})}catch{document.body.focus()}}async function Gr(e){for(var t=0;t<e;t++){if(Vr(),await new Promise(function(a){requestAnimationFrame(function(){requestAnimationFrame(a)})}),document.hasFocus())return!0;await new Promise(function(a){setTimeout(a,40)})}return document.hasFocus()}function za(e){var t=Array.from(new Set(e.match(/finch-file:\/\/local\?path=[^\s)"']+/g)||[]));return!t.length||!i||!i.postMessage?Promise.resolve(e):new Promise(function(a,r){var o=++lr;se[o]={resolve:a,reject:r,sourceHtml:e},setTimeout(function(){se[o]&&(delete se[o],r(new Error(n("status.clipboardPrepareTimeout"))))},15e3),i.postMessage({type:"readClipboardImages",urls:t,requestId:o})})}function Yr(e){var t=new DOMParser().parseFromString(e,"text/html");function a(r){return r&&r.tagName==="P"&&!r.textContent.trim()&&!r.querySelector("img,video,iframe,table")}return Array.from(t.querySelectorAll("figure.figure-image")).forEach(function(r){var o=r.previousElementSibling,s=r.nextElementSibling;a(o)&&o.remove(),a(s)&&s.remove()}),t.body.innerHTML}async function Ua(e,t){if(document.hasFocus()||await Gr(5),window.ClipboardItem&&navigator.clipboard&&navigator.clipboard.write)try{return await navigator.clipboard.write([new ClipboardItem({"text/html":Promise.resolve(e).then(function(r){return new Blob([r],{type:"text/html"})}),"text/plain":new Blob([t],{type:"text/plain"})})]),"rich"}catch{}var a=await Promise.resolve(e);return Kr(a)?"rich":Xr(t)?"plain":"none"}function Kr(e){var t=document.createElement("div");t.contentEditable="true",t.style.position="fixed",t.style.left="-9999px",t.style.top="0",t.innerHTML=e,document.body.appendChild(t);var a=document.createRange();a.selectNodeContents(t);var r=window.getSelection();r.removeAllRanges(),r.addRange(a);var o=!1;try{o=document.execCommand("copy")}catch{o=!1}return r.removeAllRanges(),t.remove(),o}function Xr(e){var t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.focus(),t.select();var a=!1;try{a=document.execCommand("copy")}catch{a=!1}return t.remove(),a}async function Jr(){if(!W){l(n("status.pleaseOpenArticle"),!0);return}try{var e=L.contentDocument&&L.contentDocument.body?L.contentDocument.body.innerText:W.replace(/<[^>]+>/g,""),t=await Ua(za(W),e);t==="none"&&(await new Promise(function(a){setTimeout(a,200)}),t=await Ua(za(W),e)),t==="rich"?l(n("status.copiedRich")):l(n(t==="plain"?"status.copiedPlainOnly":"status.copyFailed"),!0)}catch(a){l(n("status.richCopyFailed",{err:String(a)}),!0)}finally{b==="edit"&&requestAnimationFrame(function(){g.focus()})}}function Qr(){if(!At||!L.contentDocument)return null;var e=L.contentDocument.querySelector("#bm-md");if(!e)return null;var t=e.getBoundingClientRect();return{root:e,width:Math.ceil(t.width||e.scrollWidth),height:Math.ceil(t.height||e.scrollHeight)}}function _t(){var e=Qr();if(!e||!e.width||!e.height)return Promise.resolve(null);var t=2,a=e.root.cloneNode(!0);a.style.minHeight=e.height+"px",a.style.margin="0",a.style.boxSizing="border-box";var r;try{r=new XMLSerializer().serializeToString(a)}catch(d){return Promise.reject(new Error(n("status.serializeFailed",{err:String(d)})))}var o='<svg xmlns="http://www.w3.org/2000/svg" width="'+e.width+'" height="'+e.height+'"><foreignObject x="0" y="0" width="'+e.width+'" height="'+e.height+'">'+r+"</foreignObject></svg>",s="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(o);return new Promise(function(d,u){var c=new Image;c.decoding="sync",c.onload=function(){try{var f=document.createElement("canvas");f.width=Math.round(e.width*t),f.height=Math.round(e.height*t);var S=f.getContext("2d");S.scale(t,t);var E="";try{E=L.contentWindow.getComputedStyle(e.root).backgroundColor}catch{E=""}E&&E!=="rgba(0, 0, 0, 0)"&&E!=="transparent"&&(S.fillStyle=E,S.fillRect(0,0,e.width,e.height)),S.drawImage(c,0,0,e.width,e.height),d({canvas:f,cssWidth:e.width,cssHeight:e.height})}catch(_){u(_)}},c.onerror=function(){u(new Error(n("status.imageConversionFailed")))},c.src=s})}function Vt(e,t,a){return new Promise(function(r,o){e.toBlob(function(s){s?r(s):o(new Error(n("status.imageGenFailed")))},t,a)})}function ja(e){for(var t="",a=32768,r=0;r<e.length;r+=a)t+=String.fromCharCode.apply(null,e.subarray(r,r+a));return btoa(t)}async function Zr(){if(!W){l(n("status.pleaseOpenArticle"),!0);return}if(!window.ClipboardItem||!navigator.clipboard||!navigator.clipboard.write){l(n("status.clipboardUnsupported"),!0);return}l(n("status.generatingImage"));var e=_t().then(function(a){if(!a)throw new Error(n("status.previewNotReady"));return Vt(a.canvas,"image/png")});try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),l(n("status.imageCopied"));return}catch{try{var t=await e;await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),l(n("status.imageCopied"));return}catch(r){l(n("status.copyImageFailed",{err:r&&r.message?r.message:String(r)}),!0)}}}async function $r(){if(!W){l(n("status.pleaseOpenArticle"),!0);return}try{l(n("status.generatingImage"));var e=await _t();if(!e){l(n("status.exportImageFailedGeneric"),!0);return}var t=await Vt(e.canvas,"image/png"),a=await t.arrayBuffer(),r=ja(new Uint8Array(a));i&&i.postMessage&&i.postMessage({type:"exportFile",data:r,ext:"png",path:p,fileName:z,markdown:m})}catch(o){l(n("status.exportImageFailed",{err:String(o)}),!0)}}function en(e){for(var t=String(e);t.length<10;)t="0"+t;return t}function J(e){for(var t=new Uint8Array(e.length),a=0;a<e.length;a++)t[a]=e.charCodeAt(a)&255;return t}function Gt(e){for(var t=0,a=0;a<e.length;a++)t+=e[a].length;for(var r=new Uint8Array(t),o=0,a=0;a<e.length;a++)r.set(e[a],o),o+=e[a].length;return r}function tn(e,t,a,r,o){var s=J(`%PDF-1.4
13
14
  %\xE2\xE3\xCF\xD3
14
- `),u=[l],d=[0],c=l.length;function f(M){d.push(c),u.push(M),c+=M.length}f(Y(`1 0 obj
15
+ `),d=[s],u=[0],c=s.length;function f(gt){u.push(c),d.push(gt),c+=gt.length}f(J(`1 0 obj
15
16
  << /Type /Catalog /Pages 2 0 R >>
16
17
  endobj
17
- `)),f(Y(`2 0 obj
18
+ `)),f(J(`2 0 obj
18
19
  << /Type /Pages /Kids [3 0 R] /Count 1 >>
19
20
  endobj
20
- `)),f(Y(`3 0 obj
21
+ `)),f(J(`3 0 obj
21
22
  << /Type /Page /Parent 2 0 R /MediaBox [0 0 `+r.toFixed(2)+" "+o.toFixed(2)+`] /Resources << /XObject << /Im0 4 0 R >> >> /Contents 5 0 R >>
22
23
  endobj
23
- `));var b=Y(`4 0 obj
24
+ `));var S=J(`4 0 obj
24
25
  << /Type /XObject /Subtype /Image /Width `+t+" /Height "+a+" /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length "+e.length+` >>
25
26
  stream
26
- `),x=Y(`
27
+ `),E=J(`
27
28
  endstream
28
29
  endobj
29
- `);f(Pt([b,e,x]));var q="q "+r.toFixed(2)+" 0 0 "+o.toFixed(2)+" 0 0 cm /Im0 Do Q",T=Y(q);f(Pt([Y(`5 0 obj
30
- << /Length `+T.length+` >>
30
+ `);f(Gt([S,e,E]));var _="q "+r.toFixed(2)+" 0 0 "+o.toFixed(2)+" 0 0 cm /Im0 Do Q",P=J(_);f(Gt([J(`5 0 obj
31
+ << /Length `+P.length+` >>
31
32
  stream
32
- `),T,Y(`
33
+ `),P,J(`
33
34
  endstream
34
35
  endobj
35
- `)]));for(var nt=c,Re=[`xref
36
+ `)]));for(var ce=c,Se=[`xref
36
37
  0 6
37
38
  0000000000 65535 f
38
- `],Be=1;Be<=5;Be++)Re.push(Br(d[Be])+` 00000 n
39
- `);var Wt=`trailer
39
+ `],ke=1;ke<=5;ke++)Se.push(en(u[ke])+` 00000 n
40
+ `);var $t=`trailer
40
41
  << /Size 6 /Root 1 0 R >>
41
42
  startxref
42
- `+nt+`
43
- %%EOF`;return u.push(Y(Re.join("")+Wt)),Pt(u)}async function qr(){if(!P){s(n("status.pleaseOpenArticle"),!0);return}try{s(n("status.generatingPdf"));var e=await Ft();if(!e){s(n("status.exportPdfFailedGeneric"),!0);return}var t=await Dt(e.canvas,"image/jpeg",.92),a=await t.arrayBuffer(),r=new Uint8Array(a),o=e.cssWidth*.75,l=e.cssHeight*.75,u=Nr(r,e.canvas.width,e.canvas.height,o,l),d=Ma(u);i&&i.postMessage&&i.postMessage({type:"exportFile",data:d,ext:"pdf",path:p,fileName:D,markdown:m})}catch(c){s(n("status.exportPdfFailed",{err:String(c)}),!0)}}function Te(e,t){e&&e.addEventListener("click",function(a){a.preventDefault(),!e.disabled&&(e.disabled=!0,Promise.resolve().then(t).catch(function(r){s(String(r),!0)}).then(function(){e.disabled=!1}))})}Te(Na,Pr),Te(qa,Or),Te(Wa,Rr),Te(Ha,qr),Te(za,Wr);var Ia="md-editor-actions-collapsed";(function(){var t=!1;try{t=localStorage.getItem(Ia)==="1"}catch{}me&&me.classList.toggle("collapsed",t)})(),_t&&_t.addEventListener("click",function(e){e.preventDefault();var t=me.classList.toggle("collapsed");try{localStorage.setItem(Ia,t?"1":"0")}catch{}});function Tt(){Sa(m)}async function Wr(){if(!m||!i||!i.composer){s(n("status.pleaseOpenArticle"),!0);return}var e=R==="custom"?n("aiStyle.baseNoteCustom"):n("aiStyle.baseNoteOther",{style:R});try{await i.composer.addContexts([{type:"annotation",label:n("aiStyle.label",{file:D||n("common.markdownDocDefault")}),note:n("aiStyle.note"),promptText:n("aiStyle.promptText",{baseNote:e,path:p||n("aiStyle.pathMissing")}),reminder:n("aiStyle.reminder")}]),s(n("aiStyle.requested"))}catch(t){s(String(t),!0)}}function Hr(e){R=e,(S||y==="preview")&&j(),v()}function zr(e){if(!(e!==14&&e!==16&&e!==18)){X=e,h.setFontSize(e);try{localStorage.setItem("md-editor-font-size",String(e))}catch{}v()}}function Ur(e){if(Xe[e]){ee=e,h.setFontFamily(Xe[e]);try{localStorage.setItem("md-editor-font-family",e)}catch{}v()}}function Aa(e){H=!!e,h.setComfortWriting(H);try{localStorage.setItem("md-editor-comfort-writing",H?"1":"0")}catch{}v(),s(n(H?"status.comfortWrite":"status.comfortRead"))}function Fa(){I=!I,I&&_?(_=!1,L()):!I&&!_&&(_=!0),h.setFocusMode(I);try{localStorage.setItem("md-editor-focus-mode",I?"1":"0")}catch{}v(),s(n(I?"status.focusOn":"status.focusOff"))}var rt=null;function Oe(e){ge.hidden=!0;var t=rt;rt=null,t&&t(e)}function Da(e){return new Promise(function(t){rt=t,Ua.textContent=e,ge.hidden=!1,dt.focus()})}Kt&&Kt.addEventListener("click",function(){Oe("cancel")}),Xt&&Xt.addEventListener("click",function(){Oe("discard")}),dt&&dt.addEventListener("click",function(){Oe("save")}),ge&&ge.addEventListener("click",function(e){e.target===ge&&Oe("cancel")}),document.addEventListener("keydown",function(e){e.key==="Escape"&&rt&&Oe("cancel")});async function Ot(){return await Sa(m)}function jr(){ka(),Lt(),L(),m="",xe="",D="",p="",B=null,P="",_=!1,y="edit",h&&h.setValue(""),ca(n("home.title")),pa(""),i&&i.postMessage&&i.postMessage({type:"goHome"}),Ie(),ce(),v(),s("")}async function Pa(){if(F){var e=await Da(n("confirm.message",{file:D||n("common.markdownDocDefault")}));if(e==="cancel")return;if(i&&i.postMessage&&i.postMessage({type:"goHome"}),e==="save"){var t=await Ot();if(!t){s(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&wa(p)}jr()}function Ta(e){if(i&&i.postMessage&&i.postMessage({type:"clientLog",message:"finch:menu received, itemId="+e}),e==="home"){Pa();return}if(e==="open"){At();return}if(e==="mode"){Ae(y==="edit"?"preview":"edit");return}if(e==="save"){Tt();return}if(e==="reload"){j();return}if(e==="reveal"){p&&i&&i.postMessage&&i.postMessage({type:"openPath",path:p});return}if(e&&e.indexOf("font-size:")===0){zr(Number(e.slice(10)));return}if(e&&e.indexOf("font-family:")===0){Ur(e.slice(12));return}if(e==="comfort:read"){Aa(!1);return}if(e==="comfort:write"){Aa(!0);return}if(e==="focus"){Fa();return}if(e==="about"){_a();return}if(e&&e.indexOf("style:slot-use:")===0){Gr(+e.slice(15));return}if(e&&e.indexOf("style:slot-save:")===0){_r(+e.slice(16));return}if(e&&e.indexOf("style:")===0){Hr(e.slice(6));return}}function Rt(){[Ue,je,Ye].forEach(function(e){e&&(e.hidden=!0)})}function Yr(e){if(e){var t=e.hidden;Rt(),e.hidden=!t}}function Bt(e,t){e&&e.addEventListener("click",function(a){a.stopPropagation(),Yr(t)}),t&&t.addEventListener("click",function(a){var r=a.target&&a.target.closest?a.target.closest("[data-app-action]"):null,o=r&&r.getAttribute("data-app-action");o&&(Ta(o),Rt())})}Jt&&Jt.addEventListener("click",Pa),ze&&ze.addEventListener("click",At),J&&J.addEventListener("click",Tt),he&&he.addEventListener("click",Fa),ve&&ve.addEventListener("click",function(){we=!we,document.body.classList.toggle("preview-hidden",!we),v(),we&&requestAnimationFrame(function(){h.layout(),j()})}),Bt(ut,Ue),Bt(ct,je),Bt(ja,Ye),document.addEventListener("click",Rt);var Nt=370,qt=560,Oa=480;Z&&Z.addEventListener("mousedown",function(e){e.preventDefault();var t=Z.parentElement;if(!t)return;var a=e.clientX,r=lt?lt.getBoundingClientRect().width:Oa;Z.classList.add("active");var o=document.createElement("div");o.style.cssText="position:fixed;inset:0;z-index:9999;cursor:col-resize;",document.body.appendChild(o);function l(c){return Math.max(Nt,Math.min(qt,c))}function u(c){var f=c.clientX-a;t.style.setProperty("--preview-width",l(r-f)+"px")}function d(){Z.classList.remove("active"),o.remove(),window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d)}window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)}),window.addEventListener("resize",function(){if(S){var e=Z&&Z.parentElement;if(e){var t=parseFloat(getComputedStyle(e).getPropertyValue("--preview-width"))||Oa;(t>qt||t<Nt)&&e.style.setProperty("--preview-width",Math.max(Nt,Math.min(qt,t))+"px")}}});function Gr(e){var t=K[e];t&&(le=t.css,mt=t.label,R="custom",s(n("status.appliedStyleSlot",{label:t.label})),y==="preview"?j():Ae("preview"),v())}function _r(e){if(R!=="custom"||!le){s(n("status.needCustomStyleFirst"),!0);return}var t=mt||n("common.customStyleDefault");i&&i.postMessage&&i.postMessage({type:"saveStyleSlot",slot:e,css:le,label:t})}i&&i.onMessage&&i.onMessage(function(e){if(!(!e||typeof e!="object")){if(e.type==="ready"){if(Se=!!e.pickFileSupported,K=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],typeof e.locale=="string"&&e.locale){var t=/^zh/i.test(e.locale);t!==qe&&(qe=t,Ht(),$e())}e.assistantName&&(Le=e.assistantName,$e()),oa(),e.homeDir&&(ne=e.homeDir,St()),v();return}if(e.type==="styleSlots"){K=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],typeof e.savedSlot=="number"&&K[e.savedSlot]&&s(n("status.savedToSlot",{slot:e.savedSlot+1,label:K[e.savedSlot].label})),v();return}if(e.type==="clipboardImages"){var a=ae[e.requestId];if(a){delete ae[e.requestId];var r=a.sourceHtml,o=e.images&&typeof e.images=="object"?e.images:{};Object.keys(o).forEach(function(fe){typeof o[fe]=="string"&&(r=r.split(fe).join(o[fe]))}),a.resolve(Ar(r))}return}if(e.type==="clipboardImagesError"){var l=ae[e.requestId];l&&(delete ae[e.requestId],l.reject(new Error(e.message||n("status.clipboardPrepareFailedDefault"))));return}if(e.type==="pastedImage"){var u=te[e.requestId];u&&(delete te[e.requestId],u.resolve(e.url));return}if(e.type==="pasteImageError"){var d=te[e.requestId];d&&(delete te[e.requestId],d.reject(new Error(e.message||n("status.pasteImageFailedDefault")))),s(n("status.pasteImageFailed",{msg:e.message||""}));return}if(e.type==="finch:env"){S=e.view==="appView",document.body.classList.toggle("app-view",S),Vt&&(Vt.hidden=!S),h.setAiHint(n("appview.hintSpace"),n("appview.hintSpaceCode"));var c=e.cwd||"",f=e.sessionId||"",b=e.spaceId||"";(c!==re||f!==bt||b!==wt||!Ze)&&(re=c,bt=f,wt=b,Qe="",Ze=!0,St(),sa([])),ce(),v(),S&&V()&&j(),(!it.hidden||S)&&et();return}if(e.type==="recentDocuments"){if(!e.library&&(e.cwd||"")!==re)return;Qe=e.fallbackCwd||"",St(),sa(e.documents),e.library&&Ja(e.documents);return}if(e.type==="status"){s(e.message);return}if(e.type==="rewriteSessionStarted"){h.setAiWorkingLines(Number(e.startLine)||0,Number(e.endLine)||0),s(e.rewriteMode==="continue"?n("appview.continuing"):n("appview.rewriting"));return}if(e.type==="rewriteSessionFinished"){h.setAiWorkingLines(0,0),s(n("appview.rewriteDone"));return}if(e.type==="rewriteSessionFailed"){h.setAiWorkingLines(0,0),s(e.message||"Rewrite failed.",!0);return}if(e.type!=="lastFileUnavailable"){if(e.type==="finch:menu"){Ta(e.itemId);return}if(e.type==="document"){var x=N;N=!1,Pe();var q=e.markdown||"",T=e.path||"",nt=!!T&&!!p&&T!==p;if(!nt&&q===B){v();return}var Re=B===null,Be=Me;Me=!1;var Wt=It(q,e.title||n("common.markdownDocDefault"),e.path||p,x||Re||nt,e.diskMarkdown);if(!Wt){v();return}if(e.draftRestored)Fe(!0),s(n("status.draftRestored"));else if(e.draftConflict)s(n("status.draftConflict"),!0);else if(Be)s(n("status.opened",{file:D}));else if(!Re){var M=Mt;M&&M.hunks>1?s(n("status.contentUpdatedSpots",{count:M.hunks,lines:M.changedLines})):M&&M.fromLine===M.toLine?s(n("status.contentUpdatedLine",{line:M.fromLine})):s(M?n("status.contentUpdatedLines",{from:M.fromLine,to:M.toLine}):n("status.contentUpdated"))}return}if(e.type==="sourceMissing"){e.path&&e.path===p&&s(n("status.sourceMissing"),!0);return}if(e.type==="bmRendered"){if(e.requestId!==aa)return;pa(e.html||""),Ie(),Ee=!1,v(),s("");return}if(e.type==="savedMarkdown"){var Ne=ht[e.requestId];delete ht[e.requestId];var ot=de[e.requestId];if(delete de[e.requestId],e.requestId!==ra||typeof Ne!="string"){ot&&ot(!1);return}B=Ne,Fe(m!==Ne,m===Ne),s(n(m===Ne?"status.saved":"status.savedWithNewChanges")),ot&&ot(!0);return}if(e.type==="customStyleSet"){le=e.css||"",mt=e.label||n("common.customStyleDefault"),R="custom",K=Array.isArray(e.styleSlots)?e.styleSlots:K,s(n("status.savedAppliedToSlot",{labelPrefix:e.label?e.label+" \xB7 ":"",slot:typeof e.savedSlot=="number"?e.savedSlot+1:""})),y==="preview"?j():Ae("preview"),v();return}if(e.type==="exported"){s(n("status.exported",{path:e.path}));return}if(e.type!=="watchStarted"){if(e.type==="pickCancelled"){N=!1,Pe(),v(),s("");return}if(e.type==="error"){Me=!1,Object.keys(de).forEach(function(fe){var Ra=de[fe];delete de[fe],Ra&&Ra(!1)}),N=!1,Pe(),e.fallback&&(Se=!1),Ee=!1,v(),s(e.message,!0);return}}}}}),i&&i.postMessage&&i.postMessage({type:"panelReady"}),setTimeout(function(){!V()&&i&&i.postMessage&&i.postMessage({type:"requestLastFile"}),na||et()},400),Ht(),oa(),$e(),Ie(),ce()})();})();
43
+ `+ce+`
44
+ %%EOF`;return d.push(J(Se.join("")+$t)),Gt(d)}async function an(){if(!W){l(n("status.pleaseOpenArticle"),!0);return}try{l(n("status.generatingPdf"));var e=await _t();if(!e){l(n("status.exportPdfFailedGeneric"),!0);return}var t=await Vt(e.canvas,"image/jpeg",.92),a=await t.arrayBuffer(),r=new Uint8Array(a),o=e.cssWidth*.75,s=e.cssHeight*.75,d=tn(r,e.canvas.width,e.canvas.height,o,s),u=ja(d);i&&i.postMessage&&i.postMessage({type:"exportFile",data:u,ext:"pdf",path:p,fileName:z,markdown:m})}catch(c){l(n("status.exportPdfFailed",{err:String(c)}),!0)}}function _e(e,t){e&&e.addEventListener("click",function(a){a.preventDefault(),!e.disabled&&(e.disabled=!0,Promise.resolve().then(t).catch(function(r){l(String(r),!0)}).then(function(){e.disabled=!1}))})}_e(tr,Jr),_e(ar,Zr),_e(rr,$r),_e(nr,an),_e(fe,rn);var _a="md-editor-actions-collapsed";(function(){var t=!1;try{t=localStorage.getItem(_a)==="1"}catch{}Ee&&Ee.classList.toggle("collapsed",t)})(),ia&&ia.addEventListener("click",function(e){e.preventDefault();var t=Ee.classList.toggle("collapsed");try{localStorage.setItem(_a,t?"1":"0")}catch{}});function Yt(){Ba(m)}function mt(e){if(ir=e,!!fe){fe.classList.toggle("loading",e),fe.disabled=e;var t=fe.querySelector(".ic-ai-style"),a=fe.querySelector(".ic-ai-style-loading");t&&(t.hidden=e),a&&(a.hidden=!e)}}function Va(){if(!m||!p||!i||!i.postMessage){l(n("status.pleaseOpenArticle"),!0);return}i.postMessage({type:"requestStyleSession",path:p,baseStyle:x}),mt(!0),l(n("aiStyle.appViewDesigning"))}async function rn(){if(!m){l(n("status.pleaseOpenArticle"),!0);return}if(w||!i||!i.composer){Va();return}var e=x==="custom"?n("aiStyle.baseNoteCustom"):n("aiStyle.baseNoteOther",{style:x});try{await i.composer.addContexts([{type:"annotation",label:n("aiStyle.label",{file:z||n("common.markdownDocDefault")}),note:n("aiStyle.note"),promptText:n("aiStyle.promptText",{baseNote:e,path:p||n("aiStyle.pathMissing")}),reminder:n("aiStyle.reminder")}]),l(n("aiStyle.requested"))}catch{Va()}}function nn(){return{fontSize:q,fontFamily:Y,comfortWriting:O,style:x,customCss:x==="custom"?T:"",customStyleLabel:x==="custom"?me:""}}function ue(){i&&i.postMessage&&i.postMessage({type:"saveWritingPreferences",preferences:nn()})}function on(e){return!e||typeof e!="object"?!1:((e.fontSize===14||e.fontSize===16||e.fontSize===18)&&(q=e.fontSize),ge[e.fontFamily]&&(Y=e.fontFamily),O=e.comfortWriting===!0,e.style==="custom"&&typeof e.customCss=="string"&&e.customCss?(x="custom",T=e.customCss,me=typeof e.customStyleLabel=="string"?e.customStyleLabel:""):["kami","bauhaus","blueprint","botanical","newsprint","retro","sketch","terminal"].indexOf(e.style)!==-1&&(x=e.style,T="",me=""),g.setFontSize(q),g.setFontFamily(ge[Y]),g.setComfortWriting(O),!0)}function sn(e){x=e,ue(),(w||b==="preview")&&U(),h()}function ln(e){if(!(e!==14&&e!==16&&e!==18)){q=e,g.setFontSize(e);try{localStorage.setItem("md-editor-font-size",String(e))}catch{}ue(),h()}}function dn(e){if(ge[e]){Y=e,g.setFontFamily(ge[e]);try{localStorage.setItem("md-editor-font-family",e)}catch{}ue(),h()}}function Ga(e){O=!!e,g.setComfortWriting(O);try{localStorage.setItem("md-editor-comfort-writing",O?"1":"0")}catch{}ue(),h(),l(n(O?"status.comfortWrite":"status.comfortRead"))}function Ya(){R=!R,R&&Q?(Q=!1,I()):!R&&!Q&&(Q=!0),g.setFocusMode(R);try{localStorage.setItem("md-editor-focus-mode",R?"1":"0")}catch{}h(),l(n(R?"status.focusOn":"status.focusOff"))}var Ve=null;function Ge(e){ne.hidden=!0;var t=Ve;Ve=null,t&&t(e)}function Ka(e){return new Promise(function(t){Ve=t,sa.textContent=e,ne.hidden=!1,Le.focus()})}async function un(){sa.textContent="AI \u5DF2\u5199\u56DE\u6587\u4EF6\uFF0C\u4F46\u4F60\u4E5F\u6709\u672A\u4FDD\u5B58\u7F16\u8F91\u3002\u8BF7\u9009\u62E9\u4FDD\u7559\u672C\u5730\u5185\u5BB9\u6216\u91C7\u7528 AI \u7248\u672C\u3002",kt.textContent="\u7A0D\u540E\u5904\u7406",xt.textContent="\u4FDD\u7559\u672C\u5730",Le.textContent="\u91C7\u7528 AI \u7248\u672C";var e=await new Promise(function(t){Ve=t,ne.hidden=!1,Le.focus()});return yt(ne),e==="save"?"remote":e==="discard"?"local":"later"}kt&&kt.addEventListener("click",function(){Ge("cancel")}),xt&&xt.addEventListener("click",function(){Ge("discard")}),Le&&Le.addEventListener("click",function(){Ge("save")}),ne&&ne.addEventListener("click",function(e){e.target===ne&&Ge("cancel")}),document.addEventListener("keydown",function(e){e.key==="Escape"&&Ve&&Ge("cancel")});async function Kt(){return await Ba(m)}function cn(){Na(),Ht(),I(),m="",Pe="",z="",p="",B=null,W="",Q=!1,b="edit",g&&g.setValue(""),Ca(n("home.title")),Ma(""),i&&i.postMessage&&i.postMessage({type:"goHome"}),qe(),he(),we(!1),l("")}async function Xa(){if(D){var e=await Ka(n("confirm.message",{file:z||n("common.markdownDocDefault")}));if(e==="cancel")return;if(i&&i.postMessage&&i.postMessage({type:"goHome"}),e==="save"){var t=await Kt();if(!t){l(n("status.saveFailedNoReturn"),!0);return}}else e==="discard"&&zt(p)}cn()}function Ja(e){if(i&&i.postMessage&&i.postMessage({type:"clientLog",message:"finch:menu received, itemId="+e}),e==="home"){Xa();return}if(e==="open"){jt();return}if(e==="mode"){We(b==="edit"?"preview":"edit");return}if(e==="save"){Yt();return}if(e==="reload"){U();return}if(e==="reveal"){p&&i&&i.postMessage&&i.postMessage({type:"openPath",path:p});return}if(e&&e.indexOf("font-size:")===0){ln(Number(e.slice(10)));return}if(e&&e.indexOf("font-family:")===0){dn(e.slice(12));return}if(e==="comfort:read"){Ga(!1);return}if(e==="comfort:write"){Ga(!0);return}if(e==="focus"){Ya();return}if(e==="about"){dr();return}if(e&&e.indexOf("style:slot-use:")===0){fn(+e.slice(15));return}if(e&&e.indexOf("style:slot-save:")===0){Za(+e.slice(16));return}if(e&&e.indexOf("style:")===0){sn(e.slice(6));return}}function Xt(){[$e,et,tt].forEach(function(e){e&&(e.hidden=!0)})}function pn(e){if(e){var t=e.hidden;Xt(),e.hidden=!t}}function Jt(e,t){e&&e.addEventListener("click",function(a){a.stopPropagation(),pn(t)}),t&&t.addEventListener("click",function(a){var r=a.target&&a.target.closest?a.target.closest("[data-app-action]"):null,o=r&&r.getAttribute("data-app-action");o&&(Ja(o),Xt())})}da&&da.addEventListener("click",Xa),Qe&&Qe.addEventListener("click",jt),Z&&Z.addEventListener("click",Yt),Me&&Me.addEventListener("click",Ya),Ce&&Ce.addEventListener("click",function(){ee=!ee,document.body.classList.toggle("preview-hidden",!ee),h(),ee&&requestAnimationFrame(function(){g.layout(),U()})}),Jt(Ze,$e),Jt(Et,et),Jt(or,tt),document.addEventListener("click",Xt);var Qt=370,Zt=560,Qa=480;re&&re.addEventListener("mousedown",function(e){e.preventDefault();var t=re.parentElement;if(!t)return;var a=e.clientX,r=St?St.getBoundingClientRect().width:Qa;re.classList.add("active");var o=document.createElement("div");o.style.cssText="position:fixed;inset:0;z-index:9999;cursor:col-resize;",document.body.appendChild(o);function s(c){return Math.max(Qt,Math.min(Zt,c))}function d(c){var f=c.clientX-a;t.style.setProperty("--preview-width",s(r-f)+"px")}function u(){re.classList.remove("active"),o.remove(),window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",u)}window.addEventListener("mousemove",d),window.addEventListener("mouseup",u)}),window.addEventListener("resize",function(){if(w){var e=re&&re.parentElement;if(e){var t=parseFloat(getComputedStyle(e).getPropertyValue("--preview-width"))||Qa;(t>Zt||t<Qt)&&e.style.setProperty("--preview-width",Math.max(Qt,Math.min(Zt,t))+"px")}}});function fn(e){var t=N[e];t&&(T=t.css,me=t.label,x="custom",ue(),l(n("status.appliedStyleSlot",{label:t.label})),b==="preview"?U():We("preview"),h())}function Za(e){if(x!=="custom"||!T){l(n("status.needCustomStyleFirst"),!0);return}var t=me||n("common.customStyleDefault");i&&i.postMessage&&i.postMessage({type:"saveStyleSlot",slot:e,css:T,label:t,path:p})}function mn(){M&&(clearTimeout(M),M=0),A.replaceChildren(document.createTextNode(n("aiStyle.applied")+" ")),A.className="status status-style-prompt";for(var e=0;e<3;e++)(function(t){var a=document.createElement("button");a.type="button",a.className="status-inline-btn",a.textContent=n("aiStyle.saveToSlot",{n:t+1});var r=N[t];r&&(a.title=r.label),a.addEventListener("click",function(){Za(t)}),A.appendChild(a)})(e);M=setTimeout(function(){M=0,A.replaceChildren(),A.className="status"},12e3)}i&&i.onMessage&&i.onMessage(function(e){if(!(!e||typeof e!="object")){if(e.type==="ready"){if(Fe=!!e.pickFileSupported,N=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],on(e.writingPreferences)?w&&X()&&U():ue(),typeof e.locale=="string"&&e.locale){var t=/^zh/i.test(e.locale);t!==Ke&&(Ke=t,yt(),dt())}e.assistantName&&(Be=e.assistantName,dt()),ba(),e.homeDir&&(le=e.homeDir,pr()),h();return}if(e.type==="styleSlots"){N=Array.isArray(e.styleSlots)?e.styleSlots:[null,null,null],typeof e.savedSlot=="number"&&N[e.savedSlot]&&l(n("status.savedToSlot",{slot:e.savedSlot+1,label:N[e.savedSlot].label})),h();return}if(e.type==="clipboardImages"){var a=se[e.requestId];if(a){delete se[e.requestId];var r=a.sourceHtml,o=e.images&&typeof e.images=="object"?e.images:{};Object.keys(o).forEach(function(xe){typeof o[xe]=="string"&&(r=r.split(xe).join(o[xe]))}),a.resolve(Yr(r))}return}if(e.type==="clipboardImagesError"){var s=se[e.requestId];s&&(delete se[e.requestId],s.reject(new Error(e.message||n("status.clipboardPrepareFailedDefault"))));return}if(e.type==="pastedImage"){var d=ie[e.requestId];d&&(delete ie[e.requestId],d.resolve(e.url));return}if(e.type==="pasteImageError"){var u=ie[e.requestId];u&&(delete ie[e.requestId],u.reject(new Error(e.message||n("status.pasteImageFailedDefault")))),l(n("status.pasteImageFailed",{msg:e.message||""}));return}if(e.type==="finch:env"){w=e.view==="appView",w&&!ga&&(ga=!0,ee=!1,document.body.classList.add("preview-hidden")),document.body.classList.toggle("app-view",w),la&&(la.hidden=!w),g.setAiHint(n("appview.hintSpace"),n("appview.hintSpaceCode"));var c=e.cwd||"",f=e.sessionId||"",S=e.spaceId||"";(c!==Re||f!==Pt||S!==Tt||!lt)&&(Re=c,Pt=f,Tt=S,lt=!0,ct([])),he(),h(),w&&X()&&U(),(!ht.hidden||w)&&ut();return}if(e.type==="recentDocuments"){if(!e.library&&(e.cwd||"")!==Re)return;ct(e.documents),e.library&&xa(e.documents);return}if(e.type==="status"){l(e.message);return}if(e.type==="rewriteSessionStarted"){g.setAiWorkingLines(Number(e.startLine)||0,Number(e.endLine)||0),l(e.rewriteMode==="continue"?n("appview.continuing"):n("appview.rewriting"));return}if(e.type==="rewriteSessionFinished"){g.setAiWorkingLines(0,0),l(n("appview.rewriteDone"));return}if(e.type==="rewriteSessionFailed"){g.setAiWorkingLines(0,0),l(e.message||"Rewrite failed.",!0);return}if(e.type==="styleSessionStarted"){mt(!0),l(n("aiStyle.appViewDesigning"));return}if(e.type==="styleSessionFinished"){mt(!1),l(e.message||n("aiStyle.appViewDone"));return}if(e.type==="styleSessionFailed"){mt(!1),l(e.message||n("aiStyle.appViewFailed"),!0);return}if(e.type!=="lastFileUnavailable"){if(e.type==="finch:menu"){Ja(e.itemId);return}if(e.type==="document"){var E=j;j=!1,je();var _=e.markdown||"",P=e.path||"",ce=Number(e.revision)||0;if(P&&P===p&&ce&&ce<=He)return;var Se=!!P&&!!p&&P!==p;if(!Se&&_===B){ce&&(He=Math.max(He,ce)),h();return}var ke=B===null,$t=Ne;Ne=!1;var gt=ze(_,e.title||n("common.markdownDocDefault"),e.path||p,E||ke||Se,e.diskMarkdown);if(!gt){h();return}if(He=ce||(Se?0:He),e.draftRestored)we(!0),l(n("status.draftRestored"));else if(e.draftConflict)l(n("status.draftConflict"),!0);else if($t)l(n("status.opened",{file:z}));else if(!ke){var V=Ut;V&&V.hunks>1?l(n("status.contentUpdatedSpots",{count:V.hunks,lines:V.changedLines})):V&&V.fromLine===V.toLine?l(n("status.contentUpdatedLine",{line:V.fromLine})):l(V?n("status.contentUpdatedLines",{from:V.fromLine,to:V.toLine}):n("status.contentUpdated"))}return}if(e.type==="sourceMissing"){e.path&&e.path===p&&l(n("status.sourceMissing"),!0);return}if(e.type==="bmRendered"){if(e.requestId!==va)return;Ma(e.html||""),qe(),Te=!1,h(),l("");return}if(e.type==="savedMarkdown"){var Ye=Ft[e.requestId];delete Ft[e.requestId];var vt=ve[e.requestId];if(delete ve[e.requestId],e.requestId!==ya||typeof Ye!="string"){vt&&vt(!1);return}B=Ye,we(m!==Ye,m===Ye),l(n(m===Ye?"status.saved":"status.savedWithNewChanges")),vt&&vt(!0);return}if(e.type==="customStyleSet"){T=e.css||"",me=e.label||n("common.customStyleDefault"),x="custom",ue(),typeof e.savedSlot=="number"?(N=Array.isArray(e.styleSlots)?e.styleSlots:N,l(n("status.savedAppliedToSlot",{labelPrefix:e.label?e.label+" \xB7 ":"",slot:e.savedSlot+1}))):mn(),b==="preview"?U():We("preview"),h();return}if(e.type==="exported"){l(n("status.exported",{path:e.path}));return}if(e.type!=="watchStarted"){if(e.type==="pickCancelled"){j=!1,je(),h(),l("");return}if(e.type==="error"){Ne=!1,Object.keys(ve).forEach(function(xe){var $a=ve[xe];delete ve[xe],$a&&$a(!1)}),j=!1,je(),e.fallback&&(Fe=!1),Te=!1,h(),l(e.message,!0);return}}}}}),i&&i.postMessage&&i.postMessage({type:"panelReady"}),setTimeout(function(){!X()&&i&&i.postMessage&&i.postMessage({type:"requestLastFile"}),ha||ut()},400),yt(),ba(),dt(),qe(),he()})();})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "finch-markdown-editor",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "A Markdown editor and WeChat Official Account style preview, with selection-based AI edits and AI-generated custom styles.",
5
5
  "author": {
6
6
  "name": "PuterJam",
@@ -192,7 +192,7 @@
192
192
  "devDependencies": {
193
193
  "@finchtoys/minitool-api": "^0.3.5",
194
194
  "@types/node": "^26.1.0",
195
- "bmmd": "0.3.0",
195
+ "bmmd": "0.3.1",
196
196
  "esbuild": "^0.28.1",
197
197
  "typescript": "^6.0.3"
198
198
  },