31 lines
173 KiB
JavaScript
Raw Normal View History

2024-12-12 21:37:21 +01:00
"use strict";var dl=e=>{throw TypeError(e)};var gl=(e,l,t)=>l.has(e)||dl("Cannot "+t);var bl=(e,l,t)=>(gl(e,l,"read from private field"),t?t.call(e):l.get(e)),Zl=(e,l,t)=>l.has(e)?dl("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(e):l.set(e,t),ml=(e,l,t,n)=>(gl(e,l,"write to private field"),n?n.call(e,t):l.set(e,t),t);/*!
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository https://github.com/mokeyish/obsidian-enhancing-export .
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Ie=require("obsidian"),Sn=require("child_process"),pt=require("process"),Pl=require("electron"),Dl=require("fs"),ae=require("path"),wn=require("util");function Dt(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const En=Dt(Ie),Be=Dt(Pl),yt=Dt(Dl),dt={Markdown:{name:"Markdown",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -s -o "${outputPath}" -t commonmark_x-attributes',extension:".md"},"Markdown (Hugo)":{name:"Markdown (Hugo)",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown+hugo.lua" -s -o "${outputPath}" -t commonmark_x-attributes',extension:".md"},Html:{name:"Html",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/math_block.lua" --embed-resources --standalone --metadata title="${currentFileName}" -s -o "${outputPath}" -t html',customArguments:'--mathjax="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg-full.js"',extension:".html"},TextBundle:{name:"TextBundle",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -V media_dir="${outputDir}/${outputFileName}.textbundle/assets" -s -o "${outputDir}/${outputFileName}.textbundle/text.md" -t commonmark_x-attributes',extension:".md"},Typst:{name:"Typst",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -s -o "${outputPath}" -t typst',extension:".typ"},PDF:{name:"PDF",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/pdf.lua" ${ options.textemplate ? `--resource-path="${pluginDir}/textemplate" --template="${options.textemplate}"` : ` ` } -o "${outputPath}" -t pdf',customArguments:"--pdf-engine=pdflatex",optionsMeta:{textemplate:"preset:textemplate"},extension:".pdf"},"Word (.docx)":{name:"Word (.docx)",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t docx',extension:".docx"},OpenOffice:{name:"OpenOffice",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t odt',extension:".odt"},RTF:{name:"RTF",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t rtf',extension:".rtf"},Epub:{name:"Epub",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t epub',extension:".epub"},Latex:{name:"Latex",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" ${ options.textemplate ? `--resource-path="${pluginDir}/textemplate" --template="${options.textemplate}"` : ` ` } --extract-media="${outputDir}" -s -o "${outputPath}" -t latex',optionsMeta:{textemplate:"preset:textemplate"},extension:".tex"},"Media Wiki":{name:"Media Wiki",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t mediawiki',extension:".mediawiki"},reStructuredText:{name:"reStructuredText",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t rst',extension:".rst"},Textile:{name:"Textile",type:"pandoc",arguments:'-f ${fromFormat} --resource-path="${currentDir}" --resou
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/function Te(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let t="",n=!1;const c=e.match(/^-+/);for(let i=c?c[0].length:0;i<e.length;i++){let o=e.charAt(i);n&&(n=!1,o=o.toUpperCase()),i!==0&&(o==="-"||o==="_")?n=!0:o!=="-"&&o!=="_"&&(t+=o)}return t}}function Zn(e,l){const t=e.toLowerCase();l=l||"-";let n="";for(let c=0;c<e.length;c++){const i=t.charAt(c),o=e.charAt(c);i!==o&&c>0?n+=`${l}${t.charAt(c)}`:n+=o}return n}function mn(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/function Xc(e){if(Array.isArray(e))return e.map(o=>typeof o!="string"?o+"":o);e=e.trim();let l=0,t=null,n=null,c=null;const i=[];for(let o=0;o<e.length;o++){if(t=n,n=e.charAt(o),n===" "&&!c){t!==" "&&l++;continue}n===c?c=null:(n==="'"||n==='"')&&!c&&(c=n),i[l]||(i[l]=""),i[l]+=n}return i}/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/var ue;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(ue||(ue={}));/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/let Re;class fc{constructor(l){Re=l}parse(l,t){const n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),c=Xc(l),i=typeof l=="string",o=Rc(Object.assign(Object.create(null),n.alias)),s=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),a=Object.assign(Object.create(null),n.default),Z=n.configObjects||[],g=n.envPrefix,I=s["populate--"],x=I?"--":"_",p=Object.create(null),Y=Object.create(null),L=n.__||Re.format,m={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},K=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,w=new RegExp("^--"+s["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(r){const b=typeof r=="object"?r.key:r,h=Object.keys(r).map(function(u){return{boolean:"bools",string:"strings",number:"numbers"}[u]}).filter(Boolean).pop();h&&(m[h][b]=!0),m.arrays[b]=!0,m.keys.push(b)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(r){m.bools[r]=!0,m.keys.push(r)}),[].concat(n.string||[]).filter(Boolean).forEach(function(r){m.strings[r]=!0,m.keys.push(r)}),[].concat(n.number||[]).filter(Boolean).forEach(function(r){m.numbers[r]=!0,m.keys.push(r)}),[].concat(n.count||[]).filter(Boolean).forEach(function(r){m.counts[r]=!0,m.keys.push(r)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(r){m.normalize[r]=!0,m.keys.push(r)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([r,b])=>{typeof b=="number"&&(m.nargs[r]=b,m.keys.push(r))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([r,b])=>{typeof b=="function"&&(m.coercions[r]=b,m.keys.push(r))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(r){m.configs[r]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([r,b])=>{(typeof b=="boolean"||typeof b=="function")&&(m.configs[r]=b)})),q(n.key,o,n.default,m.arrays),Object.keys(a).forEach(function(r){(m.aliases[r]||[]).forEach(function(b){a[b]=a[r]})});let E=null;kn();let M=[];const Q=Object.assign(Object.create(null),{_:[]}),ge={};for(let r=0;r<c.length;r++){const b=c[r],h=b.replace(/^-{3,}/,"---");let u,d,y,A,B,_;if(b!=="--"&&/^-/.test(b)&&He(b))be(b);else if(h.match(/^---+(=|$)/)){be(b);continue}else if(b.match(/^--.+=/)||!s["short-option-groups"]&&b.match(/^-.+=/))A=b.match(/^--?([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=3&&(V(A[1],m.arrays)?r=f(r,A[1],c,A[2]):V(A[1],m.nargs)!==!1?r=X(r,A[1],c,A[2]):R(A[1],A[2],!0));else if(b.match(w)&&s["boolean-negation"])A=b.match(w),A!==null&&Array.isArray(A)&&A.length>=2&&(d=A[1],R(d,V(d,m.arrays)?[!1]:!1));else if(b.match(/^--.+/)||!s["short-option-groups"]&&b.match(/^-[^-]+/))A=b.match(/^--?(.+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(d=A[1],V(d,m.arrays)?r=f(r,d,c):V(d,m.nargs)!==!1?r=X(r,d,c):(B=c[r+1],B!==void 0&&(!B.match(/^-/)||B.match(K))&&!V(d,m.bools)&&!V(d,m.counts)||/^(true|false)$/.test(B)?(R(d,B),r++):R(d,Ne(d))));else if(b.match(/^-.\..+=/))A=b.match(/^-([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=3&&R(A[1],A[2]);else if(b.match(/^-.\..+/)&&!b.match(K))B=c[r+1],A=b.match(/^-(.\..+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(d=A[1],B!==void 0&&!B.match(/^-/)&&!V(d,m.bools)&&!V(d,m.counts)?(R(d,B),r++):R(d,Ne(d)));else if(b.match(/^-[^-]+/)&&!b.match(K)){y=b.slice(1,
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
* CJS and ESM environments.
*
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/var Ht,Nt,vt;const fl=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Rl=(Nt=(Ht=process==null?void 0:process.versions)===null||Ht===void 0?void 0:Ht.node)!==null&&Nt!==void 0?Nt:(vt=process==null?void 0:process.version)===null||vt===void 0?void 0:vt.slice(1);if(Rl&&Number(Rl.match(/^([^.]+)/)[1])<fl)throw Error(`yargs parser supports a minimum Node.js version of ${fl}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Ac=process?process.env:{},un=new fc({cwd:process.cwd,env:()=>Ac,format:wn.format,normalize:ae.normalize,resolve:ae.resolve,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Dl.readFileSync(e,"utf8"));throw Error("only .json config files are supported in ESM")}}),lt=function(l,t){return un.parse(l.slice(),t).argv};lt.detailed=function(e,l){return un.parse(e.slice(),l)};lt.camelCase=Te;lt.decamelize=Zn;lt.looksLikeNumber=mn;const Yc={exportToOo:"导出为......",exportWithPrevious:"使用上一次设置导出",exportSuccessNotice:$`导出文件 ${0} 成功!`,exportCommandOutputMessage:$`命令:${0}`,exportErrorOutputMessage:$`命令 ${0},错误:${1}`,pleaseOpenFile:"请打开一个文件先。",preparing:$`正在生成 "${0}" ......`,exportDialog:{fileName:"文件名",type:"类型",exportTo:"导出到",title:$`导出为 ${0}`,export:"导出",selectExportFolder:"请选择导出文件夹",overwriteConfirmation:"覆盖提示"},messageBox:{yes:"是",no:"否",ok:"确认",cancel:"取消"},overwriteConfirmationDialog:{replace:"替换",title:$`"${0}" 已经存在。您要替换它吗?`,message:$`"${0}" 文件夹中已有相同的文件或文件夹,若替换,则会覆盖其当前内容。`},settingTab:{title:"导出设置",general:"通用",name:"名称",customLocation:"自定义",pandocVersion:$`版本: ${0}`,pandocVersionWithWarning:$`Version: ${0}, 请升级版本到 ${1}`,pandocNotFound:"找不到 Pandoc请填写 Pandoc 文件路径,或者将其添加到系统环境变量中。",pandocPath:"Pandoc 路径",defaultFolderForExportedFile:"默认的导出文件夹",openExportedFileLocation:"打开导出文件所在目录",sameFolderWithCurrentFile:"与原文件同一目录下",openExportedFile:"打开导出文件",pandocPathPlaceholder:"(自动检测)",editCommandTemplate:"编辑命令模板",chooseCommandTemplate:"选择模板",afterExport:"导出后",command:"命令",arguments:"参数",auto:"自动",reset:"重置",add:"添加",remove:"移除",rename:"重命名",targetFileExtensions:"目标文件扩展名",targetFileExtensionsTip:"(用空格分开)",showCommandOutput:"显示命令行输出",runCommand:"运行自定义命令",extraArguments:"自定义参数",save:"保存",new:"新建",template:"模板",advanced:"高级",environmentVariables:"环境变量",environmentVariablesDesc:"定义导出的环境变量.",ShowExportProgressBar:"显示导出进度条"}},Jc={exportToOo:"Export to...",exportSuccessNotice:$`Export file ${0} success!`,exportCommandOutputMessage:$`Command: ${0}`,exportErrorOutputMessage:$`Command: ${0}Error:${1}`,exportWithPrevious:"Export with Previous",pleaseOpenFile:"Please open a file first.",preparing:$`generating "${0}"...`,exportDialog:{exportTo:"Export to",fileName:"File Name",title:$`Export to ${0}`,export:"Export",selectExportFolder:"Please select an export folder.",overwriteConfirmation:"Overwrite confirmation",type:"Type"},messageBox:{yes:"Yes",no:"No",ok:"Ok",cancel:"Cancel"},overwriteConfirmationDialog:{replace:"Replace",title:$`"${0}" already exists. Do you want to replace it?`,message:$`A file or folder with the same name already exists in the folder "${0}". Replacing it will overwrite its current contents.`},settingTab:{general:"General",name:"Name",title:"Export Settings",pandocVersion:$`Version: ${0}`,pandocVersionWithWarning:$`Version: ${0}, please upgrade version to ${1}`,pandocNotFound:"Pandoc not found, please fill in the Pandoc file path, or add it to the system environment variables.",defaultFold
`)).replace("pandoc.exe","").replace("pandoc","").trim();let n=[...t].filter(c=>c===".").length;if(n===1)t=`${t}.0`;else for(;n>2;)t=t.substring(0,t.lastIndexOf(".")),n-=1;return xo.parse(t,!0)}const Bo="3.1.7",Zt={normalizePath:Rn,getVersion:yo,requiredVersion:Bo};async function Vn(e,l,t,n,c,i,o,s,a,Z){const{settings:g,lang:I,manifest:x,app:{vault:{adapter:p,config:Y},metadataCache:L}}=e;if(!n){const ce=_l(c);n=`${l.basename}${ce}`}i==null&&(i=g.showOverwriteConfirmation);const m=g.showExportProgressBar,K=p.getBasePath(),w=`${K}/${x.dir}`,E=`${w}/lua`,M=t,Q=`${M}/${n}`,ge=n.substring(0,n.lastIndexOf(".")),be=n,X=p.getFullPath(l.path),f=ae.dirname(X),R=l.basename,v=l.name;let D=Y.attachmentFolderPath??"/";D==="/"?D=K:D.startsWith(".")?D=ae.join(f,D.substring(1)):D=ae.join(K,D);let W=null;try{W=L.getCache(l.path).frontmatter}catch(ce){console.error(ce)}const C={pluginDir:w,luaDir:E,outputDir:M,outputPath:Q,outputFileName:ge,outputFileFullName:be,currentDir:f,currentPath:X,currentFileName:R,currentFileFullName:v,attachmentFolderPath:D,vaultDir:K,metadata:W,options:o,fromFormat:app.vault.config.useMarkdownLinks?"markdown":"markdown+wikilinks_title_after_pipe"},N=c.type==="custom"&&c.showCommandOutput,F=c.openExportedFileLocation??g.openExportedFileLocation,H=c.openExportedFile??g.openExportedFile;if(i&&yt.existsSync(Q)){const ce=await Be.remote.dialog.showSaveDialog({title:I.overwriteConfirmationDialog.title(be),defaultPath:Q,properties:["showOverwriteConfirmation","createDirectory"]});if(ce.canceled)return;C.outputPath=ce.filePath,C.outputDir=ae.dirname(C.outputPath),C.outputFileFullName=ae.basename(C.outputPath),C.outputFileName=ae.basename(C.outputFileFullName,ae.extname(C.outputFileFullName))}let J;m&&(J=Hc.show(I.preparing(C.outputFileFullName)));const k=C.env=ql(de(g.env)??{},C);let z=Zt.normalizePath(de(g.pandocPath));if(pt.platform==="win32"){z=z.replaceAll("\\","/");const ce=["pluginDir","luaDir","outputDir","outputPath","currentDir","currentPath","attachmentFolderPath","vaultDir"];for(const Xe of ce){const He=C[Xe];C[Xe]=He.replaceAll("\\","/")}}const S=c.type==="pandoc"?`${z} "\${currentPath}" ${c.arguments??""} ${c.customArguments??""}`:c.command,U=Ut(S,C),q=lt(U.match(/(?:[^\s"]+|"[^"]*")+/g),{alias:{output:["o"]}}),V=ae.normalize(Kn(q.output)),me=ae.dirname(V);yt.existsSync(me)||yt.mkdirSync(me);try{console.log(`[${e.manifest.name}]: export command and options:`,{cmd:U,options:{cwd:C.currentDir,env:k}}),await zt(U,{cwd:C.currentDir,env:k}),J==null||J();const ce=async()=>{if(F&&setTimeout(()=>{Be.remote.shell.showItemInFolder(V)},1e3),H&&await Be.remote.shell.openPath(V),c.type==="pandoc"&&c.runCommand===!0&&c.command){const Xe=Ut(c.command,C);await zt(Xe,{cwd:C.currentDir,env:k})}s&&s()};if(N){const Xe=new Vl(app,I.exportCommandOutputMessage(U));Xe.onClose=ce,Xe.open()}else new Ie.Notice(I.exportSuccessNotice(C.outputFileFullName),1500),await ce()}catch(ce){J==null||J(),new Vl(app,I.exportErrorOutputMessage(U,ce)).open(),a&&a()}}const Ot=e=>{const l=new Ie.Modal(e.app);let t=[],n=!1;return Ye(()=>{ne(l.titleEl,()=>e.title)}),Ye(()=>{ne(l.contentEl,()=>e.children)}),Ye(()=>{const c=Object.entries(e.classList??{}).filter(([,i])=>i).map(([i])=>i);t.length>0&&l.containerEl.removeClasses(t),c.length>0&&l.containerEl.addClasses(c),t=c}),Ye(()=>{l.containerEl.style.display=e.hidden?"None":""}),l.onClose=()=>{n||(n=!0,e.onClose())},ln(()=>l.open()),ze(()=>{n||l.close()}),document.createTextNode("")};var Fo=Ze("<button>");const Pt=e=>(()=>{var l=Fo();return el(l,"click",e.onClick,!0),ne(l,()=>e.children),te(()=>l.classList.toggle("mod-cta",!!e.cta)),l})();qt(["click"]);var Ho=Ze("<div><div class=setting-item-info><div class=setting-item-name></div><div class=setting-item-description></div></div><div class=setting-item-control>"),No=Ze("<div class=checkbox-container><input type=checkbox>"),vo=Ze("<div class=setting-editor-extra-setting-button>"),ko=Ze("<input type=text>"),So=Ze("<textarea>"),wo=Ze("<select class=dropdown>"),Eo=Ze("<option>");const An=$n(),Ko=()=>Tn(An),j=e=>{const l={settingEl:null};return G(An.Provide
`)),a=(...X)=>{c(...X),l.saveSettings()},Z=X=>{try{const f={};for(let R of X.split(`
`)){R=R.trim();const v=R.indexOf("=");if(v>0){const D=R.substring(0,v);let W=R.substring(v+1).trim();W.startsWith('"')&&W.endsWith('"')&&(W=W.substring(1,W.length-1)),f[D]=W}}a("env",Ae(n.env??{},f))}catch(f){alert(f)}},g=ee(()=>n.items.find(X=>X.name===n.lastEditName)??n.items.first()),I=X=>{const f=g();return X===void 0||X===f.type?f:void 0},x=ee(()=>de(n.customDefaultExportDirectory)),p=X=>{const f=n.items.findIndex(R=>R.name===n.lastEditName);a("items",f===-1?0:f,qo(R=>(X(R),R)))},Y=ee(()=>{const X=i();return X?app.vault.config.useMarkdownLinks&&X.compare(Zt.requiredVersion)===-1?t.settingTab.pandocVersionWithWarning(Zt.requiredVersion):t.settingTab.pandocVersion(X):t.settingTab.pandocNotFound}),[L,m]=oe(),K=()=>{const[X,f]=oe(Object.keys(dt)[0]),[R,v]=oe(),D=()=>{const W=JSON.parse(JSON.stringify(dt[X()]));W.name=R(),gt(()=>{a("items",C=>[...C,W]),a("lastEditName",W.name)}),m(void 0)};return G(Ot,{app,get title(){return t.settingTab.new},onClose:()=>m(void 0),get children(){return[G(j,{get name(){return t.settingTab.template},get children(){return G(Pe,{get options(){return Object.entries(dt).map(([W,C])=>({name:C.name,value:W}))},get selected(){return R()??X()},onChange:W=>f(W)})}}),G(j,{get name(){return t.settingTab.name},get children(){return G(re,{get value(){return R()??""},onChange:W=>v(W)})}}),(()=>{var W=Tl();return ne(W,G(Pt,{cta:!0,onClick:D,get children(){return t.settingTab.save}})),W})()]}})},w=()=>{const[X,f]=oe(I().name),R=()=>{gt(()=>{p(v=>v.name=X()),a("lastEditName",X())}),m(void 0)};return G(Ot,{app,get title(){return t.settingTab.rename},onClose:()=>m(void 0),get children(){return[G(j,{get name(){return t.settingTab.name},get children(){return G(re,{get value(){return X()??""},onChange:v=>f(v)})}}),(()=>{var v=Tl();return ne(v,G(Pt,{cta:!0,onClick:R,get children(){return t.settingTab.add}})),v})()]}})},E=()=>{const X=()=>I("pandoc"),f=R=>{p(v=>v.type==="pandoc"?R(v):void 0)};return[G(j,{get name(){return t.settingTab.arguments},get children(){return G(re,{style:"width: 100%",get value(){return X().arguments??""},onChange:R=>f(v=>v.arguments=R)})}}),G(j,{get name(){return t.settingTab.extraArguments},get children(){return G(re,{style:"width: 100%",get value(){return X().customArguments??""},get title(){return X().customArguments},onChange:R=>f(v=>v.customArguments=R)})}}),G(j,{get name(){return t.settingTab.afterExport},heading:!0}),G(j,{get name(){return t.settingTab.openExportedFileLocation},get children(){return G(Ge,{get checked(){return X().openExportedFileLocation??!1},onChange:R=>f(v=>v.openExportedFileLocation=R)})}}),G(j,{get name(){return t.settingTab.openExportedFile},get children(){return G(Ge,{get checked(){return X().openExportedFile??!1},onChange:R=>f(v=>v.openExportedFile=R)})}}),G(j,{get name(){return t.settingTab.runCommand},get children(){return G(Ge,{get checked(){return X().runCommand},onChange:R=>f(v=>v.runCommand=R)})}}),G(bt,{get when(){return X().runCommand},get children(){return G(j,{get children(){return G(re,{style:"width: 100%",get value(){return X().command??""},onChange:R=>f(v=>v.command=R)})}})}})]},M=()=>{const X=()=>I("custom"),f=R=>{p(v=>v.type==="custom"?R(v):void 0)};return[G(j,{get name(){return t.settingTab.command},get children(){return G(re,{style:"width: 100%",get value(){return X().command},onChange:R=>f(v=>v.command=R)})}}),G(j,{get name(){return t.settingTab.targetFileExtensions},get children(){return G(re,{get value(){return X().targetFileExtensions??""},onChange:R=>f(v=>v.targetFileExtensions=R)})}}),G(j,{get name(){return t.settingTab.afterExport},heading:!0}),G(j,{get name(){return t.settingTab.showCommandOutput},get children(){return G(Ge,{get checked(){return X().showCommandOutput??!1},onChange:R=>f(v=>v.showCommandOutput=R)})}}),G(j,{get name(){return t.settingTab.openExportedFileLocation},get children(){return G(Ge,{get checked(){return X().openExportedFileLocation??!1},onChange:R=>f(v=>v.openExportedFileLocation=R)})}}),G(j,{get name(){return t.settingTab.openExportedFile},get children(){return G(Ge,{get checked(){return X().openExportedFile?