digital-garden/.obsidian/plugins/obsidian-enhancing-export/main.js

31 lines
178 KiB
JavaScript
Raw Normal View History

2024-06-18 08:24:14 +03:00
"use strict";var Al=(e,t,l)=>{if(!t.has(e))throw TypeError("Cannot "+l)};var Yl=(e,t,l)=>(Al(e,t,"read from private field"),l?l.call(e):t.get(e)),xl=(e,t,l)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,l)},yl=(e,t,l,n)=>(Al(e,t,"write to private field"),n?n.call(e,l):t.set(e,l),l);/*!
2024-06-13 21:01:37 +03:00
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 .
2024-06-18 08:24:14 +03:00
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const We=require("obsidian"),tc=require("child_process"),Nt=require("process"),mn=require("electron"),Gn=require("fs"),de=require("path"),lc=require("util");function bl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const n=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,n.get?n:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const nc=bl(We),Se=bl(mn),Ut=bl(Gn),ft={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
2024-06-13 21:01:37 +03:00
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
2024-06-18 08:24:14 +03:00
*/function ct(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let l="",n=!1;const c=e.match(/^-+/);for(let i=c?c[0].length:0;i<e.length;i++){let s=e.charAt(i);n&&(n=!1,s=s.toUpperCase()),i!==0&&(s==="-"||s==="_")?n=!0:s!=="-"&&s!=="_"&&(l+=s)}return l}}function Bn(e,t){const l=e.toLowerCase();t=t||"-";let n="";for(let c=0;c<e.length;c++){const i=l.charAt(c),s=e.charAt(c);i!==s&&c>0?n+=`${t}${l.charAt(c)}`:n+=s}return n}function Fn(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)}/**
2024-06-13 21:01:37 +03:00
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
2024-06-18 08:24:14 +03:00
*/function Kc(e){if(Array.isArray(e))return e.map(s=>typeof s!="string"?s+"":s);e=e.trim();let t=0,l=null,n=null,c=null;const i=[];for(let s=0;s<e.length;s++){if(l=n,n=e.charAt(s),n===" "&&!c){l!==" "&&t++;continue}n===c?c=null:(n==="'"||n==='"')&&!c&&(c=n),i[t]||(i[t]=""),i[t]+=n}return i}/**
2024-06-13 21:01:37 +03:00
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
2024-06-18 08:24:14 +03:00
*/var he;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(he||(he={}));/**
2024-06-13 21:01:37 +03:00
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
2024-06-18 08:24:14 +03:00
*/let Ye;class Qc{constructor(t){Ye=t}parse(t,l){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},l),c=Kc(t),i=typeof t=="string",s=zc(Object.assign(Object.create(null),n.alias)),a=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),r=Object.assign(Object.create(null),n.default),C=n.configObjects||[],u=n.envPrefix,h=a["populate--"],Y=h?"--":"_",X=Object.create(null),M=Object.create(null),O=n.__||Ye.format,b={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:[]},j=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,k=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(o){const g=typeof o=="object"?o.key:o,W=Object.keys(o).map(function(Z){return{boolean:"bools",string:"strings",number:"numbers"}[Z]}).filter(Boolean).pop();W&&(b[W][g]=!0),b.arrays[g]=!0,b.keys.push(g)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(o){b.bools[o]=!0,b.keys.push(o)}),[].concat(n.string||[]).filter(Boolean).forEach(function(o){b.strings[o]=!0,b.keys.push(o)}),[].concat(n.number||[]).filter(Boolean).forEach(function(o){b.numbers[o]=!0,b.keys.push(o)}),[].concat(n.count||[]).filter(Boolean).forEach(function(o){b.counts[o]=!0,b.keys.push(o)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(o){b.normalize[o]=!0,b.keys.push(o)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([o,g])=>{typeof g=="number"&&(b.nargs[o]=g,b.keys.push(o))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([o,g])=>{typeof g=="function"&&(b.coercions[o]=g,b.keys.push(o))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(o){b.configs[o]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([o,g])=>{(typeof g=="boolean"||typeof g=="function")&&(b.configs[o]=g)})),te(n.key,s,n.default,b.arrays),Object.keys(r).forEach(function(o){(b.aliases[o]||[]).forEach(function(g){r[g]=r[o]})});let z=null;ec();let $=[];const w=Object.assign(Object.create(null),{_:[]}),be={};for(let o=0;o<c.length;o++){const g=c[o],W=g.replace(/^-{3,}/,"---");let Z,d,y,A,J,q;if(g!=="--"&&/^-/.test(g)&&Qe(g))Ze(g);else if(W.match(/^---+(=|$)/)){Ze(g);continue}else if(g.match(/^--.+=/)||!a["short-option-groups"]&&g.match(/^-.+=/))A=g.match(/^--?([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=3&&(V(A[1],b.arrays)?o=f(o,A[1],c,A[2]):V(A[1],b.nargs)!==!1?o=p(o,A[1],c,A[2]):R(A[1],A[2],!0));else if(g.match(k)&&a["boolean-negation"])A=g.match(k),A!==null&&Array.isArray(A)&&A.length>=2&&(d=A[1],R(d,V(d,b.arrays)?[!1]:!1));else if(g.match(/^--.+/)||!a["short-option-groups"]&&g.match(/^-[^-]+/))A=g.match(/^--?(.+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(d=A[1],V(d,b.arrays)?o=f(o,d,c):V(d,b.nargs)!==!1?o=p(o,d,c):(J=c[o+1],J!==void 0&&(!J.match(/^-/)||J.match(j))&&!V(d,b.bools)&&!V(d,b.counts)||/^(true|false)$/.test(J)?(R(d,J),o++):R(d,ze(d))));else if(g.match(/^-.\..+=/))A=g.match(/^-([^=]+)=([\s\S]*)$/),A!==null&&Array.isArray(A)&&A.length>=3&&R(A[1],A[2]);else if(g.match(/^-.\..+/)&&!g.match(j))J=c[o+1],A=g.match(/^-(.\..+)/),A!==null&&Array.isArray(A)&&A.length>=2&&(d=A[1],J!==void 0&&!J.match(/^-/)&&!V(d,b.bools)&&!V(d,b.counts)?(R(d,J),o++):R(d,ze(d)));else if(g.match(/^-[^-]+/)&&!g.match(j)){y=g.slice(1
2024-06-13 21:01:37 +03:00
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
* CJS and ESM environments.
*
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
2024-06-18 08:24:14 +03:00
*/var Tt,$t,Mt;const wl=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,El=($t=(Tt=process==null?void 0:process.versions)===null||Tt===void 0?void 0:Tt.node)!==null&&$t!==void 0?$t:(Mt=process==null?void 0:process.version)===null||Mt===void 0?void 0:Mt.slice(1);if(El&&Number(El.match(/^([^.]+)/)[1])<wl)throw Error(`yargs parser supports a minimum Node.js version of ${wl}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const jc=process?process.env:{},Hn=new Qc({cwd:process.cwd,env:()=>jc,format:lc.format,normalize:de.normalize,resolve:de.resolve,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Gn.readFileSync(e,"utf8"));throw Error("only .json config files are supported in ESM")}}),Zt=function(t,l){return Hn.parse(t.slice(),l).argv};Zt.detailed=function(e,t){return Hn.parse(e.slice(),t)};Zt.camelCase=ct;Zt.decamelize=Bn;Zt.looksLikeNumber=Fn;const Lc={exportToOo:"导出为......",exportWithPrevious:"使用上一次设置导出",exportSuccessNotice:L`导出文件 ${0} 成功!`,exportCommandOutputMessage:L`命令:${0}`,exportErrorOutputMessage:L`命令 ${0},错误:${1}`,pleaseOpenFile:"请打开一个文件先。",preparing:L`正在生成 "${0}" ......`,exportDialog:{fileName:"文件名",type:"类型",exportTo:"导出到",title:L`导出为 ${0}`,export:"导出",selectExportFolder:"请选择导出文件夹",overwriteConfirmation:"覆盖提示"},messageBox:{yes:"是",no:"否",ok:"确认",cancel:"取消"},overwriteConfirmationDialog:{replace:"替换",title:L`"${0}" 已经存在。您要替换它吗?`,message:L`"${0}" 文件夹中已有相同的文件或文件夹,若替换,则会覆盖其当前内容。`},settingTab:{title:"导出设置",general:"通用",name:"名称",customLocation:"自定义",pandocVersion:L`版本: ${0}`,pandocVersionWithWarning:L`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:"显示导出进度条"}},Tc={exportToOo:"Export to...",exportSuccessNotice:L`Export file ${0} success!`,exportCommandOutputMessage:L`Command: ${0}`,exportErrorOutputMessage:L`Command: ${0}Error:${1}`,exportWithPrevious:"Export with Previous",pleaseOpenFile:"Please open a file first.",preparing:L`generating "${0}"...`,exportDialog:{exportTo:"Export to",fileName:"File Name",title:L`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:L`"${0}" already exists. Do you want to replace it?`,message:L`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:L`Version: ${0}`,pandocVersionWithWarning:L`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=[...l].filter(c=>c===".").length;if(n===1)l=`${l}.0`;else for(;n>2;)l=l.substring(0,l.lastIndexOf(".")),n-=1;return qa.parse(l,!0)}const tr="3.1.7",Vt={normalizePath:zn,getVersion:er,requiredVersion:tr};async function Un(e,t,l,n,c,i,s,a,r,C){const{settings:u,lang:h,manifest:Y,app:{vault:{adapter:X,config:M},metadataCache:O}}=e;if(!n){const ce=hn(c);n=`${t.basename}${ce}`}i==null&&(i=u.showOverwriteConfirmation);const b=u.showExportProgressBar,j=X.getBasePath(),k=`${j}/${Y.dir}`,z=`${k}/lua`,$=l,w=`${$}/${n}`,be=n.substring(0,n.lastIndexOf(".")),Ze=n,p=X.getFullPath(t.path),f=de.dirname(p),R=t.basename,N=t.name;let _=M.attachmentFolderPath??"/";_==="/"?_=j:_.startsWith(".")?_=de.join(f,_.substring(1)):_=de.join(j,_);let I=null;try{I=O.getCache(t.path).frontmatter}catch(ce){console.error(ce)}const m={pluginDir:k,luaDir:z,outputDir:$,outputPath:w,outputFileName:be,outputFileFullName:Ze,currentDir:f,currentPath:p,currentFileName:R,currentFileFullName:N,attachmentFolderPath:_,vaultDir:j,metadata:I,options:s,fromFormat:app.vault.config.useMarkdownLinks?"markdown":"markdown+wikilinks_title_after_pipe"},H=c.type==="custom"&&c.showCommandOutput,B=c.openExportedFileLocation??u.openExportedFileLocation,F=c.openExportedFile??u.openExportedFile;if(i&&Ut.existsSync(w)){const ce=await Se.remote.dialog.showSaveDialog({title:h.overwriteConfirmationDialog.title(Ze),defaultPath:w,properties:["showOverwriteConfirmation","createDirectory"]});if(ce.canceled)return;m.outputPath=ce.filePath,m.outputDir=de.dirname(m.outputPath),m.outputFileFullName=de.basename(m.outputPath),m.outputFileName=de.basename(m.outputFileFullName,de.extname(m.outputFileFullName))}let x;b&&(x=Dc.show(h.preparing(m.outputFileFullName)));const v=m.env=In(ue(u.env)??{},m);let E=Vt.normalizePath(ue(u.pandocPath));if(Nt.platform==="win32"){E=E.replaceAll("\\","/");const ce=["pluginDir","luaDir","outputDir","outputPath","currentDir","currentPath","attachmentFolderPath","vaultDir"];for(const Ve of ce){const Qe=m[Ve];m[Ve]=Qe.replaceAll("\\","/")}}const S=c.type==="pandoc"?`${E} "\${currentPath}" ${c.arguments??""} ${c.customArguments??""}`:c.command,K=il(S,m),te=Zt(K.match(/(?:[^\s"]+|"[^"]*")+/g),{alias:{output:["o"]}}),V=de.normalize(cc(te.output)),Ge=de.dirname(V);Ut.existsSync(Ge)||Ut.mkdirSync(Ge);try{console.log(`[${e.manifest.name}]: export command and options:`,{cmd:K,options:{cwd:m.currentDir,env:v}}),await cl(K,{cwd:m.currentDir,env:v}),x==null||x();const ce=async()=>{if(B&&setTimeout(()=>{Se.remote.shell.showItemInFolder(V)},1e3),F&&await Se.remote.shell.openPath(V),c.type==="pandoc"&&c.runCommand===!0&&c.command){const Ve=il(c.command,m);await cl(Ve,{cwd:m.currentDir,env:v})}a&&a()};if(H){const Ve=new Kl(app,h.exportCommandOutputMessage(K));Ve.onClose=ce,Ve.open()}else new We.Notice(h.exportSuccessNotice(m.outputFileFullName),1500),await ce()}catch(ce){x==null||x(),new Kl(app,h.exportErrorOutputMessage(K,ce)).open(),r&&r()}}const gl=e=>{const t=new We.Modal(e.app);let l=[],n=!1;return Fe(()=>{se(t.titleEl,()=>e.title)}),Fe(()=>{se(t.contentEl,()=>e.children)}),Fe(()=>{const c=Object.entries(e.classList??{}).filter(([,i])=>i).map(([i])=>i);l.length>0&&t.containerEl.removeClasses(l),c.length>0&&t.containerEl.addClasses(c),l=c}),Fe(()=>{t.containerEl.style.display=e.hidden?"None":""}),t.onClose=()=>{n||(n=!0,e.onClose())},pn(()=>t.open()),_e(()=>{n||t.close()}),document.createTextNode("")};var lr=me("<button>");const ul=e=>(()=>{var t=lr();return Gl(t,"click",e.onClick,!0),se(t,()=>e.children),ne(()=>t.classList.toggle("mod-cta",!!e.cta)),t})();ml(["click"]);var nr=me("<div><div class=setting-item-info><div class=setting-item-name></div><div class=setting-item-description></div></div><div class=setting-item-control>"),cr=me("<div class=checkbox-container><input type=checkbox>"),ir=me("<div class=setting-editor-extra-setting-button>"),sr=me("<input type=text>"),ar=me("<textarea>"),rr=me("<select class=dropdown>"),or=me("<option>");const jn=dc(),dr=()=>gc(jn),Q=e=>{const t={settingEl:null};return G(jn.Provi
`)),r=(...p)=>{c(...p),t.saveSettings()},C=p=>{try{const f={};for(let R of p.split(`
`)){R=R.trim();const N=R.indexOf("=");if(N>0){const _=R.substring(0,N);let I=R.substring(N+1).trim();I.startsWith('"')&&I.endsWith('"')&&(I=I.substring(1,I.length-1)),f[_]=I}}r("env",Be(n.env??{},f))}catch(f){alert(f)}},u=le(()=>n.items.find(p=>p.name===n.lastEditName)??n.items.first()),h=p=>{const f=u();return p===void 0||p===f.type?f:void 0},Y=le(()=>ue(n.customDefaultExportDirectory)),X=p=>{const f=n.items.findIndex(R=>R.name===n.lastEditName);r("items",f===-1?0:f,Xr(R=>(p(R),R)))},M=le(()=>{const p=i();return p?app.vault.config.useMarkdownLinks&&p.compare(Vt.requiredVersion)===-1?l.settingTab.pandocVersionWithWarning(Vt.requiredVersion):l.settingTab.pandocVersion(p):l.settingTab.pandocNotFound}),[O,b]=oe(),j=()=>{const[p,f]=oe(Object.keys(ft)[0]),[R,N]=oe(),_=()=>{const I=JSON.parse(JSON.stringify(ft[p()]));I.name=R(),Xt(()=>{r("items",m=>[...m,I]),r("lastEditName",I.name)}),b(void 0)};return G(gl,{app,get title(){return l.settingTab.new},onClose:()=>b(void 0),get children(){return[G(Q,{get name(){return l.settingTab.template},get children(){return G(rt,{get options(){return Object.entries(ft).map(([I,m])=>({name:m.name,value:I}))},get selected(){return R()??p()},onChange:I=>f(I)})}}),G(Q,{get name(){return l.settingTab.name},get children(){return G(ge,{get value(){return R()??""},onChange:I=>N(I)})}}),(()=>{var I=un();return se(I,G(ul,{cta:!0,onClick:_,get children(){return l.settingTab.save}})),I})()]}})},k=()=>{const[p,f]=oe(h().name),R=()=>{Xt(()=>{X(N=>N.name=p()),r("lastEditName",p())}),b(void 0)};return G(gl,{app,get title(){return l.settingTab.rename},onClose:()=>b(void 0),get children(){return[G(Q,{get name(){return l.settingTab.name},get children(){return G(ge,{get value(){return p()??""},onChange:N=>f(N)})}}),(()=>{var N=un();return se(N,G(ul,{cta:!0,onClick:R,get children(){return l.settingTab.add}})),N})()]}})},z=()=>{const p=()=>h("pandoc"),f=R=>{X(N=>N.type==="pandoc"?R(N):void 0)};return[G(Q,{get name(){return l.settingTab.arguments},get children(){return G(ge,{style:"width: 100%",get value(){return p().arguments??""},onChange:R=>f(N=>N.arguments=R)})}}),G(Q,{get name(){return l.settingTab.extraArguments},get children(){return G(ge,{style:"width: 100%",get value(){return p().customArguments??""},get title(){return p().customArguments},onChange:R=>f(N=>N.customArguments=R)})}}),G(Q,{get name(){return l.settingTab.afterExport},heading:!0}),G(Q,{get name(){return l.settingTab.openExportedFileLocation},get children(){return G(Ce,{get checked(){return p().openExportedFileLocation??!1},onChange:R=>f(N=>N.openExportedFileLocation=R)})}}),G(Q,{get name(){return l.settingTab.openExportedFile},get children(){return G(Ce,{get checked(){return p().openExportedFile??!1},onChange:R=>f(N=>N.openExportedFile=R)})}}),G(Q,{get name(){return l.settingTab.runCommand},get children(){return G(Ce,{get checked(){return p().runCommand},onChange:R=>f(N=>N.runCommand=R)})}}),G(Rt,{get when(){return p().runCommand},get children(){return G(Q,{get children(){return G(ge,{style:"width: 100%",get value(){return p().command??""},onChange:R=>f(N=>N.command=R)})}})}})]},$=()=>{const p=()=>h("custom"),f=R=>{X(N=>N.type==="custom"?R(N):void 0)};return[G(Q,{get name(){return l.settingTab.command},get children(){return G(ge,{style:"width: 100%",get value(){return p().command},onChange:R=>f(N=>N.command=R)})}}),G(Q,{get name(){return l.settingTab.targetFileExtensions},get children(){return G(ge,{get value(){return p().targetFileExtensions??""},onChange:R=>f(N=>N.targetFileExtensions=R)})}}),G(Q,{get name(){return l.settingTab.afterExport},heading:!0}),G(Q,{get name(){return l.settingTab.showCommandOutput},get children(){return G(Ce,{get checked(){return p().showCommandOutput??!1},onChange:R=>f(N=>N.showCommandOutput=R)})}}),G(Q,{get name(){return l.settingTab.openExportedFileLocation},get children(){return G(Ce,{get checked(){return p().openExportedFileLocation??!1},onChange:R=>f(N=>N.openExportedFileLocation=R)})}}),G(Q,{get name(){return l.settingTab.openExportedFile},get children(){return G(Ce,{get checked(){return p().openExportedFile?