2 lines
89 KiB
JavaScript
2 lines
89 KiB
JavaScript
System.register(["./vue-core-legacy-Cn1vuJ3s.js?v=1773287522785","./index-legacy-DQdImDha.js?v=1773287522785","./files-legacy-D8sMT3Kb.js?v=1773287522785","./naive-ui-legacy-BW82sq8q.js?v=1773287522785","./ace-legacy-ConAV8RQ.js?v=1773287522785","./index.vue_vue_type_script_setup_true_lang-legacy-IFFYkvEY.js?v=1773287522785","./useTableColumns-legacy-DP6ypvsQ.js?v=1773287522785","./prismjs-legacy-BN0FEcG9.js?v=1773287522785","./data-legacy-B9xdUIE5.js?v=1773287522785","./index-legacy-hh1mlQOF.js?v=1773287522785","./copy-legacy-CoXPjkKf.js?v=1773287522785","./index-legacy-DgZ0-E4f.js?v=1773287522785","./index.vue_vue_type_script_setup_true_lang-legacy-B9P08_gB.js?v=1773287522785","./index-legacy-BFkuWVH1.js?v=1773287522785"],(function(e,t){"use strict";var i,o,n,a,l,r,s,d,c,f,u,h,p,g,m,b,v,x,y,w,C,k,E,S,L,_,T,$,z,M,F,A,O,I,H,N,P,j,D,R,G,U,V,B,q,W,K,J,Y,Q,X,Z,ee,te,ie,oe,ne,ae,le,re,se,de,ce,fe,ue,he,pe,ge,me;return{setters:[e=>{i=e.a4,o=e.r,n=e.c,a=e.k,l=e.aw,r=e.l,s=e.$,d=e.Z,c=e._,f=e.aa,u=e.ak,h=e.n,p=e.o,g=e.a0,m=e.ai,b=e.X,v=e.S,x=e.a9,y=e.j,w=e.F,C=e.P,k=e.L,E=e.R,S=e.a6,L=e.m,_=e.al,T=e.w,$=e.an,z=e.aj,M=e.ao,F=e.G,A=e.y,O=e.b,I=e.ax,H=e.e,N=e.a8,P=e.K,j=e.v},e=>{D=e.i,R=e.m,G=e.h,U=e.a3,V=e.co,B=e.c,q=e.h8,W=e.w,K=e._,J=e.h9},e=>{Y=e.b,Q=e.r,X=e.d,Z=e.c,ee=e.a,te=e.e,ie=e.f,oe=e.h},e=>{ne=e.p,ae=e._,le=e.B,re=e.ay,se=e.n,de=e.ai,ce=e.b,fe=e.al,ue=e.b5,he=e.aI},e=>{pe=e.a},e=>{ge=e._},e=>{me=e.u},null,null,null,null,null,null,null],execute:function(){var t=document.createElement("style");t.textContent='.editor-title[data-v-319eda2d]{position:relative;display:flex;align-items:center;justify-content:space-between;height:42px;padding-left:16px;background-color:#fff;color:#333;box-shadow:0 1px 4px rgba(0,0,0,.1);z-index:1;cursor:move}.editor-title .title-left[data-v-319eda2d]{font-size:14px}.editor-title .title-right[data-v-319eda2d]{display:flex;align-items:center;height:100%}.editor-title .title-right .action-btn[data-v-319eda2d]{width:48px;height:100%;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background-color .2s}.editor-title .title-right .action-btn div[data-v-319eda2d]{font-size:18px;color:#555}.editor-title .title-right .action-btn[data-v-319eda2d]:hover{background-color:#e5e5e5}.editor-title .title-right .action-btn.close-btn[data-v-319eda2d]:hover{background-color:var(--color-error)}.editor-title .title-right .action-btn.close-btn:hover div[data-v-319eda2d]{color:#fff}.toolbar-dialog[data-v-cd363012]{background-color:#444}.toolbar-dialog .toolbar-title[data-v-cd363012]{border-bottom:1px solid #666666;color:#9e9e9e;font-size:14px;padding:12px 16px}.toolbar-dialog .fontsize-content[data-v-cd363012]{padding:16px}.toolbar-dialog .fontsize-input[data-v-cd363012]{flex:1}.toolbar-dialog .fontsize-input[data-v-cd363012] .n-input{--n-color: transparent;--n-color-focus: transparent;--n-border: 1px solid #fff;--n-border-hover: 1px solid #fff;--n-border-active: 1px solid #fff;--n-border-focus: 1px solid #fff;--n-text-color: #fff;--n-caret-color: #fff}.line-ending-select[data-v-3b563599]{padding:16px}.line-ending-item[data-v-3b563599]{height:30px;display:flex;cursor:pointer;align-items:center;justify-content:space-between;font-size:14px;--un-text-opacity:1;color:rgb(255 255 255 / var(--un-text-opacity))}.line-ending-item[data-v-3b563599]:hover,.line-ending-item.active[data-v-3b563599]{background-color:#333}.toolbar-dialog[data-v-fd78c99a]{background-color:#444}.toolbar-dialog .toolbar-title[data-v-fd78c99a]{border-bottom:1px solid #666666;color:#9e9e9e;font-size:14px;padding:12px 16px}.toolbar-dialog[data-v-0f74f1f1]{background-color:#444}.toolbar-dialog .toolbar-title[data-v-0f74f1f1]{border-bottom:1px solid #666666;color:#9e9e9e;font-size:14px;padding:12px 16px}.setting-list[data-v-0f74f1f1]{padding:16px}.setting-item[data-v-0f74f1f1]{height:30px;display:flex;cursor:pointer;align-items:center;justify-content:space-between;font-size:14px;--un-text-opacity:1;color:rgb(255 255 255 / var(--un-text-opacity))}.setting-item[data-v-0f74f1f1]:hover{background-color:#333}.toolbar-list[data-v-ebc2c2ac]{display:flex;align-items:center;height:32px;min-height:32px;background-color:#565656;color:#fff}.tools-btn[data-v-ebc2c2ac]{position:relative;display:flex;align-items:center;justify-content:center;gap:4px;height:32px;padding:0 16px;font-size:13px;border-right:1px solid #4c4c4c;cursor:pointer}.tools-btn[data-v-ebc2c2ac]:hover{background-color:#2f2f2f}.breadcrumb-wrapper[data-v-54af520c]{display:flex;align-items:center;height:40px;padding:0 16px;background-color:#383838;font-size:14px;color:#fff}.action-wrapper[data-v-e49ff329]{display:flex;align-items:center;justify-content:space-between;width:100%;height:32px;min-height:32px;background-color:#565656;color:#fff}.action-wrapper.is-search-mode[data-v-e49ff329]{display:block;height:auto;min-height:auto}.action-btn[data-v-e49ff329]{position:relative;display:flex;align-items:center;justify-content:center;gap:4px;height:32px;padding:0 8px;font-size:12px;line-height:1.1;cursor:pointer;color:#fff;transition:all .2s}.action-btn[data-v-e49ff329]:hover{background-color:#2f2f2f}.action-btn i[data-v-e49ff329]{font-size:13px}.action-btn i.is-loading[data-v-e49ff329]{animation:rotate-e49ff329 1s linear infinite}@keyframes rotate-e49ff329{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.search-panel[data-v-e49ff329]{padding:12px;display:flex;flex-direction:column}.search-title[data-v-e49ff329]{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;font-size:13px;color:#aaa}.search-title .close-btn[data-v-e49ff329]{color:#f44336;cursor:pointer;display:flex;align-items:center;gap:4px}.search-title .close-btn[data-v-e49ff329]:hover{opacity:.8}.search-input-wrap[data-v-e49ff329]{margin-bottom:12px}.search-input-wrap[data-v-e49ff329] .n-input{background-color:#fff;border:none;border-radius:4px;--n-text-color: #333;--n-caret-color: #333;--n-border: 1px solid transparent;--n-border-hover: 1px solid transparent;--n-border-focus: 1px solid transparent;--n-padding-right: 0}.search-input-wrap[data-v-e49ff329] .n-input .n-input__suffix{color:#666;height:100%;margin-left:0;display:flex;align-items:center}.search-input-wrap[data-v-e49ff329] .n-input .search-icon-btn{padding:0 10px;border-left:1px solid #eee;height:28px;display:flex;align-items:center;justify-content:center;cursor:pointer}.search-input-wrap[data-v-e49ff329] .n-input .search-icon-btn:hover{background-color:#f5f5f5}.search-input-wrap[data-v-e49ff329] .n-input .search-icon-btn i{font-size:16px}.search-options .n-checkbox[data-v-e49ff329]{--n-text-color: #fff;--n-font-size: 13px}.tree-wrapper[data-v-8adcf4ca]{flex:1;overflow:hidden;background-color:#222}.n-tree[data-v-8adcf4ca]{padding:6px;height:100%;overflow:auto;background-color:transparent;--n-node-text-color: #cccccc;--n-node-color-hover: #37373D;--n-node-color-active: transparent;--n-arrow-color: #cccccc;--n-loading-color: #cccccc;--n-line-height: 1.2;--n-bezier: cubic-bezier(.4, 0, .2, 1);--n-font-size: 13px}.n-tree[data-v-8adcf4ca] .n-tree-node{border-radius:4px}.n-tree[data-v-8adcf4ca] .n-tree-node.n-tree-node--selected:hover{background-color:var(--n-node-color-hover)}.n-tree[data-v-8adcf4ca] .n-tree-node .tree-icon{display:inline-flex;align-items:center;font-size:16px;font-style:normal}.n-tree[data-v-8adcf4ca] .n-tree-node .n-tree-node-content__text{width:0;border-bottom:none}.n-tree[data-v-8adcf4ca] .n-tree-node .n-tree-node-content{padding:0}.n-tree[data-v-8adcf4ca] .n-tree-node .creating-node{display:flex;align-items:center;width:100%}.n-tree[data-v-8adcf4ca] .n-tree-node .creating-node .creating-input{flex:1;outline:none;border:1px solid #4CAF50;background-color:#fff;color:#000;padding:0 4px;height:22px;line-height:22px;border-radius:2px;width:120px}.n-tree[data-v-8adcf4ca] .n-tree-node .creating-node i{font-size:16px;cursor:pointer;margin-left:4px;font-weight:700}.sidebar-wrapper[data-v-4a4cb5df]{position:relative;width:260px;height:100%;transition:width .3s cubic-bezier(.25,.8,.25,1);flex-shrink:0}.sidebar-wrapper.is-collapsed[data-v-4a4cb5df]{width:0}.sidebar-wrapper.is-collapsed .sidebar-content[data-v-4a4cb5df]{display:none}.sidebar-wrapper.is-collapsed .toggle-btn[data-v-4a4cb5df]:after{margin-left:-7px;transform:rotate(45deg)}.sidebar-content[data-v-4a4cb5df]{display:flex;flex-direction:column;width:260px;height:100%;overflow:hidden;background-color:#2f2f2f}.toggle-btn[data-v-4a4cb5df]{position:absolute;top:40%;right:-14px;display:flex;align-items:center;justify-content:center;width:14px;height:50px;background-color:#222;border-radius:0 9999px 9999px 0;border:1px solid #525252;border-left:none;cursor:pointer;z-index:998;transition:all .2s}.toggle-btn[data-v-4a4cb5df]:hover{background-color:#888}.toggle-btn[data-v-4a4cb5df]:after{content:"";display:block;width:10px;height:10px;margin-left:2px;border:2px solid #fff;border-bottom:none;border-left:none;transform:rotate(-135deg)}.editor-header-wrapper[data-v-d03633e2]{height:40px;width:100%;overflow:hidden;--un-bg-opacity:1;background-color:rgb(0 0 0 / var(--un-bg-opacity))}.editor-header[data-v-d03633e2]{height:40px;display:flex;align-items:center}[data-v-d03633e2] .n-scrollbar{--n-scrollbar-color: #444;--n-scrollbar-color-hover: #444}.editor-tab[data-v-d03633e2]{position:relative;height:100%;max-width:300px;display:flex;flex-shrink:0;cursor:pointer;align-items:center;padding-left:10px;padding-right:36px;font-size:15px;--un-text-opacity:1;color:rgb(153 153 153 / var(--un-text-opacity));border-right:1px solid #222222}.editor-tab[data-v-d03633e2]:hover,.editor-tab.active[data-v-d03633e2]{--un-bg-opacity:1;background-color:rgb(34 34 34 / var(--un-bg-opacity));--un-text-opacity:1;color:rgb(236 236 236 / var(--un-text-opacity))}.editor-tab.active[data-v-d03633e2]:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--color-primary)}.editor-tab .tab-close[data-v-d03633e2]{position:absolute;right:10px}.editor-tab .tab-dirty[data-v-d03633e2]{position:absolute;right:10px;top:50%;width:8px;height:8px;background-color:#f4c26b;border-radius:50%;transform:translateY(-50%)}.editor-tab .tree-icon[data-v-d03633e2]{display:inline-flex;align-items:center;font-size:16px;font-style:normal;margin-right:4px}.ace-editor[data-v-2b76de93] .ace_scrollbar::-webkit-scrollbar{width:14px;height:10px}.ace-editor[data-v-2b76de93] .ace_scrollbar::-webkit-scrollbar-thumb{box-shadow:inset 0 0 5px rgba(0,0,0,.2);background:#777;border-radius:0}.ace-editor[data-v-2b76de93] .ace_scrollbar::-webkit-scrollbar-track{box-shadow:inset 0 0 5px rgba(0,0,0,.2);background:#333;border-radius:0}.file-history[data-v-654b4dcd]{width:550px;padding:20px}.toolbar-dialog[data-v-34b64179]{background-color:#444}.toolbar-dialog .toolbar-title[data-v-34b64179]{border-bottom:1px solid #666666;color:#9e9e9e;font-size:14px;padding:12px 16px}.toolbar-dialog[data-v-9b2e7d57]{background-color:#444}.toolbar-dialog .toolbar-title[data-v-9b2e7d57]{border-bottom:1px solid #666666;color:#9e9e9e;font-size:14px;padding:12px 16px}.toolbar-dialog[data-v-60c1d667]{background-color:#444}.toolbar-dialog .toolbar-title[data-v-60c1d667]{border-bottom:1px solid #666666;color:#9e9e9e;font-size:14px;padding:12px 16px}.toolbar-dialog[data-v-aaadbccb]{background-color:#444}.toolbar-dialog .toolbar-title[data-v-aaadbccb]{border-bottom:1px solid #666666;color:#9e9e9e;font-size:14px;padding:12px 16px}.toolbar-dialog .goto-content[data-v-aaadbccb]{padding:16px}.toolbar-dialog .goto-input[data-v-aaadbccb]{width:100%}.toolbar-dialog .goto-input[data-v-aaadbccb] .n-input{--n-color: transparent;--n-color-focus: transparent;--n-border: 1px solid #fff;--n-border-hover: 1px solid #fff;--n-border-active: 1px solid #fff;--n-border-focus: 1px solid #fff;--n-text-color: #fff;--n-caret-color: #fff}.toolbar-dialog .goto-hint[data-v-aaadbccb]{margin-top:12px;color:#fff;font-size:14px}.editor-footer[data-v-cd20a3bc]{height:36px;display:flex;align-items:center;justify-content:space-between;gap:16px;--un-bg-opacity:1;background-color:rgb(86 86 86 / var(--un-bg-opacity));padding-left:16px;padding-right:16px;font-size:14px;--un-text-opacity:1;color:rgb(255 255 255 / var(--un-text-opacity))}.editor-footer .footer-path[data-v-cd20a3bc]{max-width:50%;min-width:0;flex:1}.editor-footer .footer-tools[data-v-cd20a3bc]{height:100%;display:flex;align-items:center}.editor-footer .footer-item[data-v-cd20a3bc]{height:100%;display:flex;cursor:pointer;align-items:center;padding-left:16px;padding-right:16px;border-right:1px solid #4C4C4C}.editor-footer .footer-item[data-v-cd20a3bc]:hover{background-color:#2f2f2f}.editor-footer .readonly-badge[data-v-cd20a3bc]{background-color:#eb7c20;border-right:none;cursor:default}.editor-footer .readonly-badge[data-v-cd20a3bc]:hover{background-color:#eb7c20}.editor-footer.diff-footer[data-v-cd20a3bc]{background-color:#eb7c20;color:#fff}.editor-footer.diff-footer .footer-tools .footer-item[data-v-cd20a3bc]{border-right:none;background-color:transparent}.editor-footer.diff-footer .footer-tools .footer-item[data-v-cd20a3bc]:hover{background-color:transparent}.editor-footer.diff-footer .diff-path[data-v-cd20a3bc]{max-width:80%}.acediff{--acediff-gutter-bg: #efefef;--acediff-gutter-border: #bcbcbc;--acediff-diff-bg: #d8f2ff;--acediff-diff-border: #a2d7f2;--acediff-diff-char-bg: #b8e2f5;--acediff-arrow-color: #000;--acediff-arrow-shadow: rgba(255, 255, 255, .7);--acediff-arrow-hover-left: #004ea0;--acediff-arrow-hover-right: #c98100}.acediff__wrap{display:flex;flex-direction:row;position:absolute;bottom:0;width:100%;top:0;left:0;height:100%;overflow:auto}.acediff__gutter{flex:0 0 60px;border-left:1px solid var(--acediff-gutter-border);border-right:1px solid var(--acediff-gutter-border);background-color:var(--acediff-gutter-bg);overflow:hidden}.acediff__gutter svg{background-color:var(--acediff-gutter-bg)}.acediff__left,.acediff__right{height:100%;flex:1}.acediff__diffLine{background-color:var(--acediff-diff-bg);border-top:1px solid var(--acediff-diff-border);border-bottom:1px solid var(--acediff-diff-border);position:absolute;z-index:4}.acediff__diffLine.targetOnly{height:0px!important;border-top:1px solid var(--acediff-diff-border);border-bottom:0px;position:absolute}.acediff__diffChar{background-color:var(--acediff-diff-char-bg);position:absolute;z-index:5}.acediff__diffGutter{background-color:var(--acediff-diff-bg)!important}.acediff__connector{fill:var(--acediff-diff-bg);stroke:var(--acediff-diff-border)}.acediff__copy--right,.acediff__copy--left{position:relative}.acediff__copy--right div,.acediff__copy--left div{color:var(--acediff-arrow-color);text-shadow:1px 1px var(--acediff-arrow-shadow);position:absolute;margin:2px 3px;cursor:pointer}.acediff__copy--right div:hover{color:var(--acediff-arrow-hover-left)}.acediff__copy--left{float:right}.acediff__copy--left div{right:0}.acediff__copy--left div:hover{color:var(--acediff-arrow-hover-right)}.acediff{--acediff-gutter-bg: #1a1a1a;--acediff-gutter-border: #333333;--acediff-diff-bg: #004d7a;--acediff-diff-border: #003554;--acediff-diff-char-bg: #006699;--acediff-arrow-color: #f8f8f8;--acediff-arrow-shadow: rgba(0, 0, 0, .7);--acediff-arrow-hover-left: #61a2e7;--acediff-arrow-hover-right: #f7b742}.ace-diff-container[data-v-4b286035]{height:100%;width:100%}.ace-diff-container[data-v-4b286035] .ace_scrollbar::-webkit-scrollbar{width:14px;height:10px}.ace-diff-container[data-v-4b286035] .ace_scrollbar::-webkit-scrollbar-thumb{box-shadow:inset 0 0 5px rgba(0,0,0,.2);background:#777;border-radius:0}.ace-diff-container[data-v-4b286035] .ace_scrollbar::-webkit-scrollbar-track{box-shadow:inset 0 0 5px rgba(0,0,0,.2);background:#333;border-radius:0}.ace-diff-container[data-v-4b286035] .acediff__gutter{background-color:#333}.ace-diff-container[data-v-4b286035] .acediff__left .ace_content{background-color:rgba(255,0,0,.05)}.ace-diff-container[data-v-4b286035] .acediff__right .ace_content{background-color:rgba(0,255,0,.05)}kbd[data-v-fccb0a32]{display:inline-block;border-width:1px;--un-border-opacity:1;border-color:rgb(119 119 119 / var(--un-border-opacity));border-radius:2px;border-style:solid;background-color:transparent;padding:4px 10px;font-size:13px;--un-text-opacity:1;color:rgb(255 255 255 / var(--un-text-opacity));line-height:1;font-family:inherit}.editor-container[data-v-23722196]{display:flex;flex-direction:column;height:100%;background-color:#292929;color:#fff}.editor-body[data-v-23722196]{flex:1;display:flex;overflow:hidden}\n/*$vite$:1*/',document.head.appendChild(t);const be={supportedModes:{Apache_Conf:["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],CSS:["css"],HTML:["html|htm|xhtml|vue|we|wpy"],Java:["java"],JavaScript:["js|jsm|jsx"],JSON:["json"],JSP:["jsp"],Makefile:["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],Markdown:["md|markdown"],MySQL:["mysql"],Nginx:["nginx|conf"],PHP:["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],Powershell:["ps1"],Python:["py"],SQL:["sql"],SQLServer:["sqlserver"],Text:["txt"],XML:["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],YAML:["yaml|yml"],images:["icon|jpg|jpeg|png|bmp|gif|tif|emf"]},nameOverrides:{PHP_Laravel_blade:"PHP (Blade Template)"},encodingList:["ASCII","UTF-8","GBK","GB2312","BIG5"],themeList:["chrome","monokai","tomorrow_night_bright"],aceEditor:{editorTheme:"monokai",fontSize:14,softLabel:!1,useSoftTabs:!0,tabSize:4,wrap:!0,enableSnippets:!0,enableLiveAutocompletion:!0,highlightActiveLine:!0,highlightSelectedWord:!0,animatedScroll:!1,showInvisibles:!0,showFoldWidgets:!0,showLineNumbers:!0,showGutter:!0,displayIndentGuides:!1},fontFamily:"12px/normal 'Consolas', 'Menlo', 'Monaco', 'Ubuntu Mono', 'source-code-pro', 'Courier New', monospace",encoding:"utf-8"},ve="/www/server/panel/YakPanel/static/ace/ace.editor.config.json",{t:xe}=U.global,ye=i("fileEditor",(()=>{const e=o([]),t=o(-1),i=o("/www"),a=o(0),l=o(!1),r=o(ne(be)),s=o(null),d=o(!1),c=o(""),f=o(!1),u=n((()=>t.value>=0&&t.value<e.value.length?e.value[t.value]:null)),h=async t=>{const{message:i}=await Y({path:t});if(D(i)){const o=e.value.findIndex((e=>e.path===t));if(-1!==o){const t=e.value[o];t.content=i.data,t.originalContent=i.data,t.encoding=i.encoding,t.st_mtime=Number(i.st_mtime),t.history=i.historys||[]}}},p=i=>{e.value.splice(i,1),t.value>=e.value.length&&(t.value=Math.max(0,e.value.length-1)),0===e.value.length&&(t.value=-1)},g=()=>{a.value++},m=async()=>{await X({data:JSON.stringify({supportedModes:r.value.supportedModes,nameOverrides:r.value.nameOverrides,encodingList:r.value.encodingList,themeList:r.value.themeList,aceEditor:r.value.aceEditor,fontFamily:r.value.fontFamily,encoding:r.value.encoding}),path:ve,encoding:r.value.encoding||"UTF-8",force:1})},b=(t,i=!0,o=!0)=>new Promise((async(n,a)=>{const l=e.value[t];if("shortcut"!==l.type)try{const{message:e}=await X({data:l.content,path:l.path,encoding:l.encoding,st_mtime:l.st_mtime,force:0},i);D(e)&&(e.status?(l.originalContent=l.content,l.history=e.historys||[],l.st_mtime=Number(e.st_mtime),o&&R.success(e.msg),n()):G({title:xe("fileEditor.store.conflictTitle"),content:e.result||xe("fileEditor.store.conflictContentFallback"),confirmText:xe("fileEditor.store.forceSave"),confirmType:"warning",onConfirm:async()=>{try{const{message:e}=await X({data:l.content,path:l.path,encoding:l.encoding,st_mtime:l.st_mtime,force:1},!0);D(e)&&(l.originalContent=l.content,l.history=e.historys||[],l.st_mtime=Number(e.st_mtime),o&&R.success(e.msg),n())}catch(e){a(e)}},onCancel:()=>a(new Error("User cancelled override."))}))}catch(r){a(r)}else n()})),v=async()=>{u.value&&u.value.content!==u.value.originalContent&&await b(t.value)};return{currentPath:i,fileList:e,currentFileIndex:t,currentFile:u,refreshKey:a,isLoading:l,editorConfig:r,creatingType:s,isSearchMode:d,searchWord:c,searchAll:f,openFile:async i=>{const o=e.value.findIndex((e=>e.path===i));if(-1!==o)return void(t.value=o);const n=(e=>{const t=e.split("/").pop()||xe("fileEditor.store.untitled"),i=e.split(".").pop()||"text";return{path:e,type:i,name:t,loading:!1,lineEnding:"LF",content:"",originalContent:"",encoding:"",st_mtime:0,onlyRead:!1,history:[]}})(i),a=t.value+1;e.value.splice(a,0,n),t.value=a;const{message:l}=await Y({path:i});if(D(l)){const t=e.value[a];t.content=l.data,t.originalContent=l.data,t.encoding=l.encoding,t.st_mtime=Number(l.st_mtime),t.onlyRead=l.only_read,t.history=l.historys||[],t.onlyRead&&R.warning(xe("fileEditor.store.fileTooLarge"))}},openShortcutTab:()=>{const i="__shortcut__",o=e.value.findIndex((e=>e.path===i));if(-1!==o)return void(t.value=o);const n={path:i,type:"shortcut",name:xe("fileEditor.store.shortcutTabName"),loading:!1,lineEnding:"LF",content:"",originalContent:"",encoding:"UTF-8",st_mtime:0,onlyRead:!1,history:[]},a=t.value+1;e.value.splice(a,0,n),t.value=a},openDiffTab:async(i,o)=>{const n=i.split("/").pop()||"Untitled",a=`__diff__${i}__${o}`,l=e.value.findIndex((e=>e.path===a));if(-1!==l)return void(t.value=l);const r={path:a,type:"diff",name:`${n} <-> ${n}`,loading:!0,lineEnding:"LF",content:"",originalContent:"",encoding:"UTF-8",st_mtime:0,onlyRead:!0,history:[],originalPath:i,historyTime:o},s=t.value+1;e.value.splice(s,0,r),t.value=s;try{const[n,a]=await Promise.all([Y({path:i}),Q({filename:i,history:o})]),l=e.value[t.value];n.message&&D(n.message)&&(l.rightContent=n.message.data,l.encoding=n.message.encoding),a.message&&D(a.message),l.leftContent="string"==typeof a.message?a.message:a.message?.data??"",l.loading=!1}catch{const i=e.value[t.value];i&&(i.loading=!1)}},closeTab:p,updateTabContent:(t,i)=>{const o=e.value[t];o&&(o.content=i)},setCurrentPath:e=>{i.value=e},goToParent:()=>{const e=i.value,t=e.lastIndexOf("/");i.value=t>0?e.substring(0,t):"/"},refreshFileList:g,setLoading:e=>{l.value=e},getEditorConfig:async()=>{const{message:e}=await Y({path:ve});if(D(e)){const t=JSON.parse(e.data);Object.assign(r.value,{...be,...t})}},saveEditorConfig:m,saveFileContent:b,saveFileContentAndClose:async(e,t=!0,i=!0)=>{await b(e,t,i),p(e)},saveCurrentFileContent:v,saveAllFile:async()=>{const t=R.loading(xe("fileEditor.store.saveAllLoading"));try{const t=e.value.map(((e,t)=>e.content!==e.originalContent&&"shortcut"!==e.type?b(t,!1,!1):null)).filter(Boolean);t.length>0&&(await Promise.all(t),R.success(xe("fileEditor.store.saveAllSuccess")))}finally{t.close()}},getFileContent:h,changeLineEnding:async e=>{var t,i;u.value&&"shortcut"!==u.value.type&&(u.value.content=(t=u.value.content,"CRLF"===(i=e)?t.replace(/\r?\n/g,"\r\n"):"LF"===i?t.replace(/\r\n/g,"\n"):t),await v(),u.value.lineEnding=e)},changeEncoding:async e=>{if(!u.value||"shortcut"===u.value.type)return;const i=u.value.path;r.value.aceEditor.encoding=e,await m(),u.value.encoding=e,await b(t.value,!0,!0),h(i)},changeTheme:async e=>{r.value.aceEditor.editorTheme=e,await m()},toggleSetting:async e=>{const t=r.value.aceEditor;t[e]=!t[e],await m()},updateTabSettings:async(e,t)=>{r.value.aceEditor.useSoftTabs="tab"===e,r.value.aceEditor.tabSize=t,await m(),R.success(xe("fileEditor.store.tabSettingsRefreshed"))},getCurrentFileContent:async()=>{u.value&&"shortcut"!==u.value.type&&await h(u.value.path)},startCreateNewItem:e=>{s.value=e},cancelCreateNewItem:()=>{s.value=null},confirmCreateNewItem:async e=>{if(!e.trim())return void R.warning(xe("fileEditor.store.nameRequired"));const t=s.value;"file"===t?await Z({path:`${i.value}/${e}`}):"folder"===t&&await ee({path:`${i.value}/${e}`,name:e}),R.success(xe("fileEditor.store.createSuccess",{type:xe("file"===t?"fileEditor.store.newFile":"fileEditor.store.newFolder")})),s.value=null,g()},toggleSearchMode:e=>{d.value=e,e||(c.value="",g())},executeSearch:(e,t)=>{c.value=e,f.value=t,g()}}})),we={class:"title-left"},Ce={class:"title-right"},ke=["title"],Ee=["title"],Se={key:0,class:"i-ant-design-switcher-outlined"},Le={key:1,class:"i-ant-design-border-outlined"},_e=["title"],Te=a({__name:"index",props:{isMinimize:{type:Boolean},isMaximize:{type:Boolean}},emits:["minimize","maximize","close"],setup(e,{emit:t}){const i=e,n=t,a=o(null),p=()=>{n("minimize");const e=!i.isMinimize;a.value&&h((()=>{const t=V(a.value,"n-dialog");if(t)if(e){const e=216,i=document.documentElement.clientHeight-t.offsetHeight-68;t.style.left=e-t.offsetLeft+"px",t.style.top=i-t.offsetTop+"px"}else t.style.left="",t.style.top=""}))},g=()=>{n("close")};return(e,t)=>{const o=l("modal-drag");return r((s(),d("div",{ref_key:"titleRef",ref:a,class:"editor-title"},[c("div",we,[c("span",null,f(e.$t("fileEditor.title.onlineTextEditor")),1)]),c("div",Ce,[e.isMaximize||e.isMinimize?u("",!0):(s(),d("div",{key:0,class:"action-btn",title:e.$t("fileEditor.title.minimize"),onClick:p},t[1]||(t[1]=[c("div",{class:"i-ant-design-minus-outlined"},null,-1)]),8,ke)),c("div",{class:"action-btn",title:e.isMinimize?e.$t("fileEditor.title.restore"):e.isMaximize?e.$t("fileEditor.title.restoreDown"):e.$t("fileEditor.title.maximize"),onClick:t[0]||(t[0]=t=>e.isMinimize?p():(n("maximize"),void(!i.isMaximize&&a.value&&h((()=>{const e=V(a.value,"n-dialog");e&&(e.style.left="",e.style.top="")})))))},[e.isMinimize||e.isMaximize?(s(),d("div",Se)):(s(),d("div",Le))],8,Ee),c("div",{class:"action-btn close-btn",onClick:g,title:e.$t("fileEditor.title.close")},t[2]||(t[2]=[c("div",{class:"i-ant-design-close-outlined"},null,-1)]),8,_e)])])),[[o]])}}}),$e=B(Te,[["__scopeId","data-v-319eda2d"]]),ze={class:"toolbar-dialog"},Me={class:"toolbar-title"},Fe={class:"fontsize-content flex items-center gap-16px"},Ae=B(a({__name:"index",props:{currentSize:{type:Number,default:14},onChange:{type:Function}},emits:["close"],setup(e,{emit:t}){const i=e,n=t,a=o(i.currentSize),l=o(null),r=()=>{const e=Number(a.value);!isNaN(e)&&e>0&&(i.onChange?.(e),n("close"))};return p((()=>{l.value?.focus()})),(e,t)=>{const i=ae,o=le;return s(),d("div",ze,[c("div",Me,f(e.$t("fileEditor.dialogs.fontSizeTitle")),1),c("div",Fe,[g(i,{ref_key:"inputRef",ref:l,value:v(a),"onUpdate:value":t[0]||(t[0]=e=>b(a)?a.value=e:null),"show-button":!1,class:"fontsize-input",onKeyup:m(r,["enter"])},null,8,["value"]),g(o,{type:"primary",class:"fontsize-btn",onClick:r},{default:x((()=>[y(f(e.$t("fileEditor.common.save")),1)])),_:1})])])}}}),[["__scopeId","data-v-cd363012"]]),Oe={class:"line-ending-select"},Ie=["onClick"],He={key:0,class:"i-fa6-solid-check"},Ne=B(a({__name:"LineSelect",props:{value:{type:[String,Number,Array],default:""},options:{type:Array,default:()=>[]},onUpdateValue:[Function,Array],"onUpdate:value":[Function,Array]},setup(e){const t=e;return(i,o)=>(s(),d("div",Oe,[(s(!0),d(w,null,C(e.options,(i=>(s(),d("div",{key:i.value,class:k(["line-ending-item",{active:e.value===i.value}]),onClick:e=>((e,i)=>{const{onUpdateValue:o,"onUpdate:value":n}=t;o&&re(o,e,i),n&&re(n,e,i)})(i.value,i)},[c("span",null,f(i.label),1),e.value===i.value?(s(),d("i",He)):u("",!0)],10,Ie)))),128))]))}}),[["__scopeId","data-v-3b563599"]]),Pe={class:"toolbar-dialog"},je={class:"toolbar-title"},De=a({__name:"index",props:{theme:{type:String,default:"monokai"},onChange:{type:Function}},setup(e){const{t:t}=E(),i=ye(),{editorConfig:a}=S(i),l=e,r=o(l.theme||"monokai"),u=n((()=>({chrome:t("fileEditor.dialogs.theme.chrome"),monokai:t("fileEditor.dialogs.theme.monokai")}))),h=n((()=>a.value.themeList.map((e=>({label:u.value[e]||e,value:e}))))),p=e=>{l.onChange?.(e)};return(e,t)=>(s(),d("div",Pe,[c("div",je,f(e.$t("fileEditor.dialogs.themeTitle")),1),g(Ne,{value:v(r),"onUpdate:value":[t[0]||(t[0]=e=>b(r)?r.value=e:null),p],options:v(h)},null,8,["value","options"])]))}}),Re=B(De,[["__scopeId","data-v-fd78c99a"]]),Ge={class:"toolbar-dialog"},Ue={class:"toolbar-title"},Ve={class:"setting-list"},Be=["onClick"],qe={key:0,class:"i-fa6-solid-check"},We=a({__name:"index",setup(e){const{t:t}=E(),i=ye(),{editorConfig:o}=S(i),a=n((()=>o.value.aceEditor)),l=n((()=>[{key:"wrap",label:t("fileEditor.dialogs.setting.wrap")},{key:"enableLiveAutocompletion",label:t("fileEditor.dialogs.setting.enableLiveAutocompletion")},{key:"enableSnippets",label:t("fileEditor.dialogs.setting.enableSnippets")},{key:"showInvisibles",label:t("fileEditor.dialogs.setting.showInvisibles")},{key:"showLineNumbers",label:t("fileEditor.dialogs.setting.showLineNumbers")}]));return(e,t)=>(s(),d("div",Ge,[c("div",Ue,f(e.$t("fileEditor.dialogs.settingTitle")),1),c("div",Ve,[(s(!0),d(w,null,C(l.value,(e=>(s(),d("div",{key:e.key,class:"setting-item",onClick:t=>(async e=>{await i.toggleSetting(e)})(e.key)},[c("span",null,f(e.label),1),a.value[e.key]?(s(),d("i",qe)):u("",!0)],8,Be)))),128))])]))}}),Ke=B(We,[["__scopeId","data-v-0f74f1f1"]]),Je={class:"toolbar-list"},Ye=["onClick"],Qe=a({__name:"index",emits:["action"],setup(e,{emit:t}){const{t:i}=E(),o=ye(),{editorConfig:a}=S(o),l=t,r=n((()=>[{key:"save",label:i("fileEditor.toolbar.save"),icon:"i-ep-select"},{key:"saveAll",label:i("fileEditor.toolbar.saveAll"),icon:"i-ep-document-copy"},{key:"refresh",label:i("fileEditor.toolbar.refresh"),icon:"i-ep-refresh-right"},{key:"search",label:i("fileEditor.toolbar.search"),icon:"i-ep-search"},{key:"replace",label:i("fileEditor.toolbar.replace"),icon:"i-ep-document"},{key:"jumpLine",label:i("fileEditor.toolbar.jumpLine"),icon:"i-ep-location"},{key:"fontSize",label:i("fileEditor.toolbar.fontSize"),icon:"i-ep-monitor"},{key:"theme",label:i("fileEditor.toolbar.theme"),icon:"i-ep-operation"},{key:"setting",label:i("fileEditor.toolbar.setting"),icon:"i-ep-setting"},{key:"shortcut",label:i("fileEditor.toolbar.shortcut"),icon:"i-ep-question-filled"}])),u=async()=>{const e=R.loading(i("fileEditor.toolbar.refreshing"));try{await o.getCurrentFileContent(),R.success(i("fileEditor.toolbar.refreshed"))}finally{e.close()}},h=()=>{q({width:420,footer:!1,showMask:!1,data:{currentSize:Number(a.value.aceEditor.fontSize),onChange:async e=>{a.value.aceEditor.fontSize=e,await o.saveEditorConfig(),R.success(i("fileEditor.toolbar.fontSizeSaved"))}},component:Ae})},p=()=>{q({width:420,footer:!1,showMask:!1,data:{theme:a.value.aceEditor.editorTheme,onChange:async e=>{await o.changeTheme(e)}},component:Re})},g=()=>{q({width:420,footer:!1,showMask:!1,component:Ke})},m=()=>{o.openShortcutTab()};return(e,t)=>(s(),d("div",Je,[(s(!0),d(w,null,C(v(r),(e=>(s(),d("div",{key:e.key,class:"tools-btn",onClick:t=>(e=>{switch(e){case"save":o.saveCurrentFileContent();break;case"saveAll":o.saveAllFile();break;case"refresh":u();break;case"search":case"replace":case"jumpLine":l("action",e);break;case"fontSize":h();break;case"theme":p();break;case"setting":g();break;case"shortcut":m()}})(e.key)},[c("i",{class:k(e.icon)},null,2),c("span",null,f(e.label),1)],8,Ye)))),128))]))}}),Xe=B(Qe,[["__scopeId","data-v-ebc2c2ac"]]),Ze={class:"breadcrumb-wrapper"},et={class:"flex-1 w-0"},tt=B(a({__name:"Breadcrumb",setup(e){const t=ye(),{currentPath:i}=S(t);return(e,t)=>{const o=se;return s(),d("div",Ze,[c("div",null,f(e.$t("fileEditor.fileExplorer.directory"))+":",1),c("div",et,[g(o,null,{default:x((()=>[y(f(v(i)),1)])),_:1})])])}}}),[["__scopeId","data-v-54af520c"]]),it={class:"action-btn"},ot={key:1,class:"search-panel"},nt={class:"search-title"},at={class:"title-text"},lt={class:"search-input-wrap"},rt={class:"search-options"},st=a({__name:"Action",setup(e){const{t:t}=E(),i=ye(),{isLoading:a,creatingType:l}=S(i),r=e=>()=>L("i",{class:["tree-icon",e],style:"font-size: 16px; font-style: normal; display: inline-flex; align-items: center;"}),u=n((()=>[{label:t("fileEditor.fileExplorer.newFolder"),key:"folder",icon:r("folder-icon")},{label:t("fileEditor.fileExplorer.newFile"),key:"file",icon:r("text-icon")}])),h=e=>{i.startCreateNewItem(e)},p=()=>{const e=i.currentPath,t=e.substring(0,e.lastIndexOf("/"))||"/";i.setCurrentPath(""===t?"/":t)},C=()=>{i.refreshFileList()},_=o(i.searchWord),T=o(i.searchAll),$=()=>{_.value=i.searchWord,T.value=i.searchAll,i.toggleSearchMode(!0)},z=()=>{i.toggleSearchMode(!1),_.value="",T.value=!1},M=()=>{i.executeSearch(_.value,T.value)};return(e,t)=>{const o=de,n=ce,r=fe;return s(),d("div",{class:k(["action-wrapper",{"is-search-mode":v(i).isSearchMode}])},[v(i).isSearchMode?(s(),d("div",ot,[c("div",nt,[c("span",at,f(e.$t("fileEditor.fileExplorer.searchPanelTitle")),1),c("span",{class:"close-btn",onClick:z},[t[5]||(t[5]=c("i",{class:"i-ep-close"},null,-1)),y(" "+f(e.$t("fileEditor.fileExplorer.close")),1)])]),c("div",lt,[g(n,{value:v(_),"onUpdate:value":t[0]||(t[0]=e=>b(_)?_.value=e:null),placeholder:e.$t("fileEditor.fileExplorer.searchPlaceholder"),onKeydown:m(M,["enter"])},{suffix:x((()=>[c("div",{class:"search-icon-btn",onClick:M},t[6]||(t[6]=[c("i",{class:"i-ep-search"},null,-1)]))])),_:1},8,["value","placeholder"])]),c("div",rt,[g(r,{checked:v(T),"onUpdate:checked":t[1]||(t[1]=e=>b(T)?T.value=e:null)},{default:x((()=>[y(f(e.$t("fileEditor.fileExplorer.includeSubdir")),1)])),_:1},8,["checked"])])])):(s(),d(w,{key:0},[c("div",{class:"action-btn",onClick:p},[t[2]||(t[2]=c("i",{class:"i-ep-top"},null,-1)),c("span",null,f(e.$t("fileEditor.fileExplorer.up")),1)]),c("div",{class:"action-btn",onClick:C},[c("i",{class:k(["i-ep-refresh-right",{"is-loading":v(a)}])},null,2),c("span",null,f(e.$t("fileEditor.fileExplorer.refresh")),1)]),g(o,{trigger:"click",disabled:null!==v(l),options:v(u),placement:"bottom","show-arrow":!0,"arrow-point-to-center":!0,onSelect:h},{default:x((()=>[c("div",it,[t[3]||(t[3]=c("i",{class:"i-ep-plus"},null,-1)),c("span",null,f(e.$t("fileEditor.fileExplorer.new")),1)])])),_:1},8,["disabled","options"]),c("div",{class:"action-btn",onClick:$},[t[4]||(t[4]=c("i",{class:"i-ep-search"},null,-1)),c("span",null,f(e.$t("fileEditor.fileExplorer.search")),1)])],64))],2)}}}),dt=B(st,[["__scopeId","data-v-e49ff329"]]),ct={Apache_Conf:["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],BatchFile:["bat|cmd"],C_Cpp:["cpp|c|cc|cxx|h|hh|hpp|ino"],CSharp:["cs"],CSS:["css"],Dockerfile:["^Dockerfile"],golang:["go"],HTML:["html|htm|xhtml|vue|we|wpy"],Java:["java"],JavaScript:["js|jsm|jsx"],JSON:["json"],JSP:["jsp"],LESS:["less"],Lua:["lua"],Makefile:["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],Markdown:["md|markdown"],MySQL:["mysql"],Nginx:["nginx|conf"],INI:["ini|conf|cfg|prefs"],ObjectiveC:["m|mm"],Perl:["pl|pm"],Perl6:["p6|pl6|pm6"],pgSQL:["pgsql"],PHP_Laravel_blade:["blade.php"],PHP:["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],Powershell:["ps1"],Python:["py"],R:["r"],Ruby:["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],Rust:["rs"],SASS:["sass"],SCSS:["scss"],SH:["sh|bash|^.bashrc"],SQL:["sql"],SQLServer:["sqlserver"],Swift:["swift"],Text:["txt"],Typescript:["ts|typescript|str"],VBScript:["vbs|vb"],Verilog:["v|vh|sv|svh"],XML:["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],YAML:["yaml|yml"],Compress:["tar|zip|7z|rar|gz|arj|z"],images:["icon|jpg|jpeg|png|bmp|gif|tif|emf"]},ft=e=>{const t=e.match(/\.([0-9A-z]*)$/),i=Array.isArray(t)?t[1]:"text";for(const o in ct){const e=ct[o][0].split("|"),t=o.toLowerCase();for(let n=0;n<e.length;n++)if(i.toLowerCase()==e[n].toLowerCase())return{name:o,mode:t}}return{name:"Text",mode:"text"}},ut={class:"tree-wrapper"},ht=a({__name:"Tree",setup(e){const{t:t}=E(),i=ye(),{currentPath:a,refreshKey:l,fileList:r,creatingType:c,isSearchMode:f,searchWord:u,searchAll:m,currentFile:b}=S(i),x=o([]),y=o(""),w=_("treeInstRef"),C=n((()=>r.value.map((e=>e.path)))),k=(e,t,i)=>[...(e||[]).map((e=>{const t=("/"!==i?`${i}/`:"/")+e.nm;return{label:e.nm,key:t,type:"dir",isLeaf:!1}})),...(t||[]).map((e=>{const t=("/"!==i?`${i}/`:"/")+e.nm;return{label:e.nm,key:t,type:"file",isLeaf:!0}}))],L=({option:e})=>{if("dir"===e.type||"folder"===e.type)return g("i",{class:"tree-icon folder-icon"},null);const t=e.isCreating?y.value:e.label,{mode:i}=ft(`${t}`);return g("i",{class:["tree-icon",`${i}-icon`]},null)},$=({option:e,selected:o})=>e.isCreating?g("div",{class:"creating-node"},[g("input",{class:"creating-input",value:y.value,onInput:e=>y.value=e.target.value,onKeyup:e=>{"Enter"===e.key?(e.stopPropagation(),i.confirmCreateNewItem(y.value)):"Escape"===e.key&&(e.stopPropagation(),i.cancelCreateNewItem())},onClick:e=>e.stopPropagation(),placeholder:"file"===e.type?t("fileEditor.tree.newFilePlaceholder"):t("fileEditor.tree.newFolderPlaceholder"),ref:e=>{e&&setTimeout((()=>e.focus()),50)}},null),g("i",{class:"i-ep-check text-primary",onClick:e=>{e.stopPropagation(),i.confirmCreateNewItem(y.value)}},null),g("i",{class:"i-ep-close text-error",onClick:e=>{e.stopPropagation(),i.cancelCreateNewItem()}},null)]):g(se,{class:o?"text-[#cca700]":""},{default:()=>[e.label]}),z=({option:e})=>"dir"===e.type?"toggleExpand":"default",M=({option:e})=>({onClick(){"file"!==e.type||e.isCreating||i.openFile(e.key)}}),F=async e=>{const t=e.key,{message:i}=await te({path:t,p:1,showRow:99999,sort:"name",reverse:"False"});return D(i)&&(e.children=k(i.dir,i.files,i.path),i.dir&&0!==i.dir.length||(e.hideSwitcher=!0)),Promise.resolve()},A=async()=>{i.setLoading(!0);try{const e={path:a.value,p:1,showRow:99999,sort:"name",reverse:"False"};f.value&&u.value&&(e.search=u.value,m.value&&(e.all="True"));const{message:t}=await te(e);D(t)&&(x.value=k(t.dir,t.files,t.path),c.value&&O())}finally{i.setLoading(!1)}},O=()=>{if(!c.value)return;const e=x.value.find((e=>"__creating__"===e.key));if(!e){y.value="";const e={key:"__creating__",label:"",type:c.value,isLeaf:!0,isCreating:!0};x.value.unshift(e)}};return T(c,(e=>{e?O():x.value=x.value.filter((e=>"__creating__"!==e.key))})),T([a,l],(()=>{A()})),T(f,(e=>{e&&(x.value=[])})),p((async()=>{await A(),await h(),b.value&&h((()=>{setTimeout((()=>{const e=document.querySelector(".tree-wrapper .n-tree-node--selected");e&&e.scrollIntoView({behavior:"smooth",block:"center"})}),500)}))})),(e,t)=>{const i=ue;return s(),d("div",ut,[g(i,{ref_key:"treeInstRef",ref:w,"block-line":"",data:v(x),"on-load":F,"expand-on-click":"",selectable:"","render-prefix":L,"render-label":$,"override-default-node-click-behavior":z,"selected-keys":v(C),"node-props":M},null,8,["data","selected-keys"])])}}}),pt=B(ht,[["__scopeId","data-v-8adcf4ca"]]),gt={class:"sidebar-content"},mt=B(a({__name:"index",setup(e){const t=o(!1),i=()=>{t.value=!t.value};return(e,o)=>(s(),d("aside",{class:k(["sidebar-wrapper",{"is-collapsed":v(t)}])},[c("div",gt,[g(tt),g(dt),g(pt)]),c("div",{class:"toggle-btn",onClick:i})],2))}}),[["__scopeId","data-v-4a4cb5df"]]),bt={class:"editor-header-wrapper"},vt=["title","onClick"],xt=["onClick"],yt=["onClick"],wt=a({__name:"header",props:M({data:{default:()=>[]},save:{}},{value:{},valueModifiers:{}}),emits:M(["select","close"],["update:value"]),setup(e,{emit:t}){const i=e,o=$(e,"value"),{t:n}=E(),a=t,l=_("headerRef"),r=()=>{h((()=>{setTimeout((()=>{if(l.value){const e=l.value.querySelector(".editor-tab.active");e&&e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})}}),100)}))};T(o,(()=>{r()})),p((()=>{r()}));const u=e=>{const{mode:t}=ft(e);return`${t}-icon`},m=e=>{void 0!==o.value&&e<o.value&&(o.value-=1),a("close",e)},b=e=>"shortcut"!==e.type&&"diff"!==e.type&&!e.onlyRead&&e.content!==e.originalContent;return(e,t)=>{const r=se,h=he;return s(),d("div",bt,[g(h,{"x-scrollable":"",trigger:"none"},{default:x((()=>[c("div",{class:"editor-header",ref_key:"headerRef",ref:l},[(s(!0),d(w,null,C(e.data,((e,t)=>(s(),d("div",{key:t,class:k(["editor-tab",{active:o.value===t}]),title:e.path,onClick:e=>(e=>{o.value=e,a("select",e)})(t)},[c("div",{class:k(["tree-icon tab-icon",u(e.name)])},null,2),g(r,{class:"mx-10px"},{default:x((()=>[c("span",null,f(e.name),1)])),_:2},1024),b(e)?(s(),d("div",{key:0,class:"tab-dirty",onClick:z((e=>(e=>{G({title:n("fileEditor.editorHeader.tipTitle"),content:n("fileEditor.editorHeader.modifiedSaveConfirm"),confirmText:n("fileEditor.common.save"),cancelText:n("fileEditor.editorHeader.dontSave"),onConfirm:async()=>{await i.save(e),m(e)},onCancel:()=>{m(e)}})})(t)),["stop"])},null,8,xt)):(s(),d("div",{key:1,class:"tab-close i-mdi-close",onClick:z((e=>m(t)),["stop"])},null,8,yt))],10,vt)))),128))],512)])),_:1})])}}}),Ct=B(wt,[["__scopeId","data-v-d03633e2"]]),kt=B(a({__name:"main",props:M({mode:{type:String,default:"Text"}},{value:{},valueModifiers:{}}),emits:M(["cursor-change","show-goto-line"],["update:value"]),setup(e,{expose:t,emit:i}){const o=e,n=i,a=ye(),{editorConfig:l,currentFile:r}=S(a),c=$(e,"value"),f=_("editorRef");let u=null;const h=e=>new Promise((t=>{pe.config.loadModule(e,(()=>t()))})),g=e=>{e.commands.addCommand({name:"saveFile",bindKey:{win:"Ctrl-S",mac:"Command-S"},readOnly:!0,exec:()=>{a.saveCurrentFileContent()}}),e.commands.addCommand({name:"saveAllFile",bindKey:{win:"Ctrl-Shift-S",mac:"Command-Shift-S"},readOnly:!0,exec:()=>{a.saveAllFile()}}),e.commands.addCommand({name:"closeFile",bindKey:{win:"Alt-W",mac:"Option-W"},readOnly:!0,exec:()=>{a.closeTab(a.currentFileIndex)}}),e.commands.addCommand({name:"goToLine",bindKey:{win:"Ctrl-I",mac:"Command-I"},readOnly:!0,exec:()=>{n("show-goto-line")}}),e.commands.addCommand({name:"undo",bindKey:{win:"Ctrl-Z",mac:"Command-Z"},readOnly:!0,exec:()=>{e.undo()}})};return F((()=>{if(!u)return;u.setOptions({mode:`ace/mode/${o.mode?.toLocaleLowerCase()}`});const e=c.value??"";u.getValue()!==e&&(u.setValue(e,-1),u.getSession().setUndoManager(new pe.UndoManager))})),A((()=>{const{editorTheme:e,fontSize:t,fontFamily:i,showInvisibles:o,showLineNumbers:n,useSoftTabs:a,tabSize:s,keyboardHandler:d,enableLiveAutocompletion:c,enableSnippets:f,enableBasicAutocompletion:h}=l.value.aceEditor;u&&(u.setTheme(`ace/theme/${e}`),u.setOptions({fontSize:t,fontFamily:i,showInvisibles:o,showLineNumbers:n,useSoftTabs:a,tabSize:s,keyboardHandler:d,enableLiveAutocompletion:c,enableSnippets:f,enableBasicAutocompletion:h,readOnly:r.value?.onlyRead||!1}))})),p((()=>{(async()=>{if(pe.config.set("basePath","/static/ace"),await h("ace/ext/language_tools"),!f.value)return;const{editorTheme:e}=l.value.aceEditor,t=`ace/theme/${e}`;if(await h(t),!f.value)return;const{fontSize:i,fontFamily:a,showInvisibles:s,showLineNumbers:d,useSoftTabs:p,tabSize:m,keyboardHandler:b,enableLiveAutocompletion:v,enableSnippets:x,enableBasicAutocompletion:y}=l.value.aceEditor;u=pe.edit(f.value,{value:c.value,theme:t,mode:`ace/mode/${o.mode?.toLocaleLowerCase()}`,fontSize:i,fontFamily:a,showInvisibles:s,showLineNumbers:d,useSoftTabs:p,tabSize:m,showPrintMargin:!1,keyboardHandler:b,enableLiveAutocompletion:v,enableSnippets:x,enableBasicAutocompletion:y,wrap:!0,indentedSoftWrap:!0,readOnly:r.value?.onlyRead||!1});const w=()=>{if(!u)return;const e=u.getCursorPosition();n("cursor-change",{line:e.row+1,column:e.column+1})};w(),u.selection.on("changeCursor",w),u.on("change",(()=>{c.value=u?.getValue()})),g(u)})()})),t({gotoLine:e=>{u&&(u.gotoLine(e,0,!0),u.focus())},execCommand:e=>{u&&u.execCommand(e)}}),(e,t)=>(s(),d("div",{ref_key:"editorRef",ref:f,class:"ace-editor w-full h-full"},null,512))}}),[["__scopeId","data-v-2b76de93"]]),Et={class:"file-history"},St=a({__name:"index",emits:["close"],setup(e,{emit:t}){const{t:i}=E(),a=t,l=ye(),{currentFile:r}=S(l),c=n((()=>{const e=r.value;return e?e.history.map((t=>({time:t,path:e.path}))):[]})),f=[{key:"time",title:i("fileEditor.dialogs.fileHistory.time"),render:e=>W(e.time)},me({title:i("fileEditor.dialogs.fileHistory.actions"),width:210,options:e=>[{label:i("fileEditor.dialogs.fileHistory.diff"),onClick:()=>{a("close"),l.openDiffTab(e.path,e.time)}},{label:i("fileEditor.dialogs.fileHistory.recover"),onClick:()=>{G({title:i("fileEditor.dialogs.fileHistory.recoverTitle"),content:i("fileEditor.dialogs.fileHistory.recoverContent",{time:W(e.time)}),onConfirm:async()=>{await ie({filename:e.path,history:e.time}),R.success(i("fileEditor.dialogs.fileHistory.fileContentUpdated")),l.getFileContent(e.path)}})}},{label:i("fileEditor.dialogs.fileHistory.delete"),onClick:()=>{G({title:i("fileEditor.dialogs.fileHistory.deleteTitle"),content:i("fileEditor.dialogs.fileHistory.deleteContent",{time:W(e.time)}),onConfirm:async()=>{await oe({filename:e.path,history:e.time}),h(e.path)}})}}]})],u=o(!1),h=async e=>{try{u.value=!0,await l.getFileContent(e)}finally{u.value=!1}};return(e,t)=>{const i=ge;return s(),d("div",Et,[g(i,{loading:v(u),columns:f,data:v(c),"max-height":400},null,8,["loading","data"])])}}}),Lt=B(St,[["__scopeId","data-v-654b4dcd"]]),_t={class:"toolbar-dialog"},Tt={class:"toolbar-title"},$t=a({__name:"index",props:{fileName:{type:String,default:""},lineEnding:{type:String,default:"LF"},onChange:{type:Function}},emits:["close"],setup(e,{emit:t}){const i=e,{t:n}=E(),a=t,l=o(i.lineEnding),r=[{label:"CRLF",value:"CRLF"},{label:"LF",value:"LF"}],u=e=>{G({title:n("fileEditor.dialogs.lineEndingChangeTitle"),confirmText:n("fileEditor.common.save"),content:()=>g(w,null,[g("div",null,[n("fileEditor.dialogs.lineEndingChangeContent1",{file:i.fileName||"",from:l.value,to:e})]),g("div",{class:"mt-8px"},[n("fileEditor.dialogs.lineEndingChangeContent2",{save:n("fileEditor.common.save")})])]),onConfirm:async()=>{await(i.onChange?.(e)),a("close")}})};return(e,t)=>(s(),d("div",_t,[c("div",Tt,f(e.$t("fileEditor.dialogs.lineEndingTitle")),1),g(Ne,{value:v(l),options:r,"onUpdate:value":u},null,8,["value"])]))}}),zt=B($t,[["__scopeId","data-v-34b64179"]]),Mt={class:"toolbar-dialog"},Ft={class:"toolbar-title"},At={class:"toolbar-title"},Ot=a({__name:"index",props:{useSoftTabs:{type:String,default:"tab"},tabSize:{type:Number,default:4},onChange:{type:Function}},setup(e){const{t:t}=E(),i=e,a=o(i.useSoftTabs),l=o(i.tabSize),r=n((()=>[{label:t("fileEditor.dialogs.tabSize.useSpaces"),value:"space"},{label:t("fileEditor.dialogs.tabSize.useTabs"),value:"tab"}])),u=[{label:"1",value:1},{label:"2",value:2},{label:"3",value:3},{label:"4",value:4},{label:"5",value:5},{label:"6",value:6}],h=()=>{m()},p=()=>{m()},m=()=>{i.onChange?.(a.value,l.value)};return(e,t)=>(s(),d("div",Mt,[c("div",Ft,f(e.$t("fileEditor.dialogs.tabSizeTitle")),1),g(Ne,{value:v(a),"onUpdate:value":[t[0]||(t[0]=e=>b(a)?a.value=e:null),h],options:v(r)},null,8,["value","options"]),c("div",At,f(e.$t("fileEditor.dialogs.tabSizeLengthTitle")),1),g(Ne,{value:v(l),"onUpdate:value":[t[1]||(t[1]=e=>b(l)?l.value=e:null),p],options:u},null,8,["value"])]))}}),It=B(Ot,[["__scopeId","data-v-9b2e7d57"]]),Ht={class:"toolbar-dialog"},Nt={class:"toolbar-title"},Pt=B(a({__name:"index",props:{encoding:{type:String,default:"UTF-8"},onChange:{type:Function}},setup(e){const t=ye(),{editorConfig:i}=S(t),a=e,l=o(a.encoding?.toUpperCase()||"UTF-8"),r=n((()=>i.value.encodingList.map((e=>({label:e.toUpperCase(),value:e.toUpperCase()}))))),u=e=>{a.onChange?.(e)};return(e,t)=>(s(),d("div",Ht,[c("div",Nt,f(e.$t("fileEditor.dialogs.encodingTitle")),1),g(Ne,{value:v(l),"onUpdate:value":[t[0]||(t[0]=e=>b(l)?l.value=e:null),u],options:v(r)},null,8,["value","options"])]))}}),[["__scopeId","data-v-60c1d667"]]),jt={class:"toolbar-dialog"},Dt={class:"toolbar-title"},Rt={class:"goto-content"},Gt={class:"goto-hint"},Ut=B(a({__name:"index",props:{currentLine:{type:Number,default:1},currentColumn:{type:Number,default:1},maxLine:{type:Number,default:1},onChange:{type:Function}},emits:["close"],setup(e,{emit:t}){const i=e,n=t,a=o(null),l=o(null),r=()=>{const e=Number(a.value);!isNaN(e)&&e>=1&&e<=i.maxLine&&(i.onChange?.(e),n("close"))};return p((()=>{l.value?.focus()})),(t,i)=>(s(),d("div",jt,[c("div",Dt,f(t.$t("fileEditor.dialogs.goToLineTitle")),1),c("div",Rt,[g(v(ae),{value:a.value,"onUpdate:value":i[0]||(i[0]=e=>a.value=e),ref_key:"inputRef",ref:l,"show-button":!1,class:"goto-input",placeholder:"",onKeyup:m(r,["enter"])},null,8,["value"]),c("div",Gt,f(t.$t("fileEditor.dialogs.goToLineHint",{line:e.currentLine,column:e.currentColumn,max:e.maxLine})),1)])]))}}),[["__scopeId","data-v-aaadbccb"]]),Vt={key:0,class:"footer-path"},Bt={key:1,class:"footer-path diff-path"},qt={class:"mr-6px"},Wt={key:2,class:"footer-tools"},Kt={class:"footer-item"},Jt={key:0,class:"footer-item readonly-badge"},Yt=a({__name:"footer",props:{filePath:{default:""},encoding:{default:"UTF-8"},lineEnding:{default:"LF"},cursor:{default:()=>({line:1,column:1})},tabSize:{default:4},useSoftTabs:{type:Boolean,default:!0},language:{default:"Text"}},emits:["jump-line"],setup(e,{emit:t}){const i=e,o=t,a=ye(),{currentFile:l,editorConfig:r}=S(a),{t:h}=E(),p=n((()=>l.value?l.value.history.length:0)),m=n((()=>l.value?.onlyRead||!1)),b=()=>{q({title:h("fileEditor.dialogs.fileHistory.title"),component:Lt})},w=()=>{q({width:420,footer:!1,showMask:!1,data:{lineEnding:i.lineEnding,onChange:async e=>{await a.changeLineEnding(e)}},component:zt})},C=()=>{q({width:420,footer:!1,showMask:!1,data:{useSoftTabs:i.useSoftTabs?"tab":"space",tabSize:i.tabSize,onChange:(e,t)=>{a.updateTabSettings(e,t)}},component:It})},L=()=>{q({width:420,footer:!1,showMask:!1,data:{encoding:r.value.aceEditor.encoding,onChange:async e=>{await a.changeEncoding(e)}},component:Pt})},_=()=>{q({width:420,footer:!1,showMask:!1,data:{currentLine:i.cursor?.line,currentColumn:i.cursor?.column,maxLine:l.value?.content?l.value.content.split("\n").length:1,onChange:e=>{o("jump-line",e)}},component:Ut})},T=()=>{if(!l.value||"diff"!==l.value.type)return;const e={path:l.value.originalPath,time:l.value.historyTime};G({title:h("fileEditor.dialogs.fileHistory.recoverTitle"),content:h("fileEditor.dialogs.fileHistory.recoverContent",{time:W(e.time)}),onConfirm:async()=>{await ie({filename:e.path,history:e.time}),R.success(h("fileEditor.dialogs.fileHistory.fileContentUpdated")),a.getFileContent(e.path),a.closeTab(a.currentFileIndex)}})};return(e,t)=>{const i=se,o=K;return s(),d("div",{class:k(["editor-footer",{"diff-footer":"diff"===v(l)?.type}])},["diff"!==v(l)?.type?(s(),d("div",Vt,[g(i,null,{default:x((()=>[y(f(e.$t("fileEditor.editorFooter.fileLocation",{path:e.filePath})),1)])),_:1})])):(s(),d("div",Bt,[c("span",qt,f(e.$t("fileEditor.editorFooter.readOnlyHistory",{path:v(l)?.originalPath,time:v(W)(v(l)?.historyTime)})),1),g(o,{onClick:T},{default:x((()=>[y(f(e.$t("fileEditor.editorFooter.clickRecoverLeft")),1)])),_:1})])),"diff"!==v(l)?.type?(s(),d("div",Wt,[c("span",{class:"footer-item",onClick:w},f(e.lineEnding),1),c("span",{class:"footer-item",onClick:_},f(e.$t("fileEditor.editorFooter.lineColumn",{line:e.cursor.line,column:e.cursor.column})),1),c("span",{class:"footer-item",onClick:b},f(e.$t("fileEditor.editorFooter.historyCount",{count:v(p)})),1),c("span",{class:"footer-item",onClick:C},f(e.$t("fileEditor.editorFooter.tabSize",{size:e.tabSize})),1),c("span",{class:"footer-item",onClick:L},f(e.$t("fileEditor.editorFooter.encoding",{encoding:e.encoding})),1),c("span",Kt,f(e.$t("fileEditor.editorFooter.language",{language:e.language})),1),v(m)?(s(),d("span",Jt,f(e.$t("fileEditor.editorFooter.readOnlyMode")),1)):u("",!0)])):u("",!0)],2)}}}),Qt=B(Yt,[["__scopeId","data-v-cd20a3bc"]]);function Xt(e){let[t,i]=e;return[t,i]}function Zt(e,t){let i=e,o=t,n=i.length,a=o.length;if(0===n||0===a)return 0;n>a?i=i.substring(n-a):n<a&&(o=o.substring(0,n));let l=Math.min(n,a);if(i===o)return l;let r=0,s=1;for(let d=0;-1!==d;){let e=i.substring(l-s);if(d=o.indexOf(e),-1===d)return r;s+=d,(0===d||i.substring(l-s)===o.substring(0,s))&&(r=s,s++)}return r}function ei(e,t){if(!e||!t||e[0]!==t[0])return 0;let i=0,o=Math.min(e.length,t.length),n=o,a=0;for(;i<n;)e.substring(a,n)===t.substring(a,n)?(i=n,a=i):o=n,n=Math.floor((o-i)/2+i);return n}function ti(e,t){if(!e||!t||e[e.length-1]!==t[t.length-1])return 0;let i=0,o=Math.min(e.length,t.length),n=o,a=0;for(;i<n;)e.substring(e.length-n,e.length-a)===t.substring(t.length-n,t.length-a)?(i=n,a=i):o=n,n=Math.floor((o-i)/2+i);return n}function ii(e){let t=e.charCodeAt(0);return t>=55296&&t<=56319}function oi(e){let t=e.charCodeAt(0);return t>=56320&&t<=57343}function ni(e,t,i){let o=e.length,n=t.length,a=Math.ceil((o+n)/2),l=a,r=2*a,s=Array(r),d=Array(r);for(let m=0;m<r;m++)s[m]=-1,d[m]=-1;s[l+1]=0,d[l+1]=0;let c=o-n,f=c%2!=0,u=0,h=0,p=0,g=0;for(let m=0;m<a&&!(Date.now()>i);m++){for(let a=-m+u;a<=m-h;a+=2){let p,g=l+a;p=a===-m||a!==m&&s[g-1]<s[g+1]?s[g+1]:s[g-1]+1;let b=p-a;for(;p<o&&b<n&&e.charAt(p)===t.charAt(b);)p++,b++;if(s[g]=p,p>o)h+=2;else if(b>n)u+=2;else if(f){let n=l+c-a;if(n>=0&&n<r&&-1!==d[n]&&p>=o-d[n])return ai(e,t,p,b,i)}}for(let a=-m+p;a<=m-g;a+=2){let u,h=l+a;u=a===-m||a!==m&&d[h-1]<d[h+1]?d[h+1]:d[h-1]+1;let b=u-a;for(;u<o&&b<n&&e.charAt(o-u-1)===t.charAt(n-b-1);)u++,b++;if(d[h]=u,u>o)g+=2;else if(b>n)p+=2;else if(!f){let n=l+c-a;if(n>=0&&n<r&&-1!==s[n]){let a=s[n];if(u=o-u,a>=u)return ai(e,t,a,l+a-n,i)}}}}return[[gi,e],[mi,t]]}function ai(e,t,i,o,n){let a=e.substring(0,i),l=t.substring(0,o),r=e.substring(i),s=t.substring(o),d=xi(a,l,{checkLines:!1,deadline:n}),c=xi(r,s,{checkLines:!1,deadline:n});return d.concat(c)}function li(e,t,i=1){if(i<=0)return null;let o=e.length>t.length?e:t,n=e.length>t.length?t:e;if(o.length<4||2*n.length<o.length)return null;let a,l,r,s,d,c=ri(o,n,Math.ceil(o.length/4)),f=ri(o,n,Math.ceil(o.length/2));if(c&&f)a=c[4].length>f[4].length?c:f;else{if(!c&&!f)return null;f?c||(a=f):a=c}if(!a)throw Error("Unable to find a half match.");return e.length>t.length?(l=a[0],r=a[1],s=a[2],d=a[3]):(s=a[0],d=a[1],l=a[2],r=a[3]),[l,r,s,d,a[4]]}function ri(e,t,i){let o,n,a,l,r=e.slice(i,i+Math.floor(e.length/4)),s=-1,d="";for(;-1!==(s=t.indexOf(r,s+1));){let r=ei(e.slice(i),t.slice(s)),c=ti(e.slice(0,i),t.slice(0,s));d.length<c+r&&(d=t.slice(s-c,s)+t.slice(s,s+r),o=e.slice(0,i-c),n=e.slice(i+r),a=t.slice(0,s-c),l=t.slice(s+r))}return 2*d.length>=e.length?[o||"",n||"",a||"",l||"",d||""]:null}function si(e,t,i){let o=e,n=t,a=function(e,t){let i=[],o={};function n(e){let t="",n=0,l=-1,r=i.length;for(;l<e.length-1;){l=e.indexOf("\n",n),-1===l&&(l=e.length-1);let s=e.slice(n,l+1);(o.hasOwnProperty?o.hasOwnProperty(s):void 0!==o[s])?t+=String.fromCharCode(o[s]):(r===a&&(s=e.slice(n),l=e.length),t+=String.fromCharCode(r),o[s]=r,i[r++]=s),n=l+1}return t}i[0]="";let a=4e4,l=n(e);return a=65535,{chars1:l,chars2:n(t),lineArray:i}}(o,n);o=a.chars1,n=a.chars2;let l=a.lineArray,r=xi(o,n,{checkLines:!1,deadline:i.deadline});(function(e,t){for(let i=0;i<e.length;i++){let o=e[i][1],n=[];for(let e=0;e<o.length;e++)n[e]=t[o.charCodeAt(e)];e[i][1]=n.join("")}})(r,l),r=Ei(r),r.push([bi,""]);let s=0,d=0,c=0,f="",u="";for(;s<r.length;){switch(r[s][0]){case mi:c++,u+=r[s][1];break;case gi:d++,f+=r[s][1];break;case bi:if(d>=1&&c>=1){r.splice(s-d-c,d+c),s=s-d-c;let e=xi(f,u,{checkLines:!1,deadline:i.deadline});for(let t=e.length-1;t>=0;t--)r.splice(s,0,e[t]);s+=e.length}c=0,d=0,f="",u="";break;default:throw Error("Unknown diff operation.")}s++}return r.pop(),r}function di(e,t,i){let o;if(!e)return[[mi,t]];if(!t)return[[gi,e]];let n=e.length>t.length?e:t,a=e.length>t.length?t:e,l=n.indexOf(a);if(-1!==l)return o=[[mi,n.substring(0,l)],[bi,a],[mi,n.substring(l+a.length)]],e.length>t.length&&(o[0][0]=gi,o[2][0]=gi),o;if(1===a.length)return[[gi,e],[mi,t]];let r=li(e,t);if(r){let e=r[0],t=r[1],o=r[2],n=r[3],a=r[4],l=xi(e,o,i),s=xi(t,n,i);return l.concat([[bi,a]],s)}return i.checkLines&&e.length>100&&t.length>100?si(e,t,i):ni(e,t,i.deadline)}var ci=Object.defineProperty,fi=Object.getOwnPropertySymbols,ui=Object.prototype.hasOwnProperty,hi=Object.prototype.propertyIsEnumerable,pi=(e,t,i)=>t in e?ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;const gi=-1,mi=1,bi=0;function vi(e,t,i){if(null===e||null===t)throw Error("Null input. (diff)");let o=xi(e,t,function(e){return((e,t)=>{for(var i in t||={})ui.call(t,i)&&pi(e,i,t[i]);if(fi)for(var i of fi(t))hi.call(t,i)&&pi(e,i,t[i]);return e})({checkLines:!0,deadline:yi(e.timeout||1)},e)}({}));return function(e){for(let t=0;t<e.length;t++){let[i,o]=e[t];if(0===o.length)continue;let n=o[0];ii(o[o.length-1])&&0===i&&ki(e,t,1),oi(n)&&0===i&&ki(e,t,-1)}for(let t=0;t<e.length;t++)0===e[t][1].length&&e.splice(t,1)}(o),o}function xi(e,t,i){let o=e,n=t;if(o===n)return o?[[0,o]]:[];let a=ei(o,n),l=o.substring(0,a);o=o.substring(a),n=n.substring(a),a=ti(o,n);let r=o.substring(o.length-a);o=o.substring(0,o.length-a),n=n.substring(0,n.length-a);let s=di(o,n,i);return l&&s.unshift([0,l]),r&&s.push([0,r]),s=Mi(s),s}function yi(e){let t=1;return typeof e<"u"&&(t=e<=0?Number.MAX_VALUE:e),Date.now()+1e3*t}function wi(e,t,i){return 1===i?e+t:t+e}function Ci(e,t){return 1===t?[e.substring(0,e.length-1),e[e.length-1]]:[e.substring(1),e[0]]}function ki(e,t,i){let o=1===i?-1:1,n=null,a=null,l=t+i;for(;l>=0&&l<e.length&&(null===n||null===a);l+=i){let[r,s]=e[l];if(0!==s.length){if(1===r){null===n&&(n=l);continue}if(-1===r){null===a&&(a=l);continue}if(0===r){if(null===n&&null===a){let[n,a]=Ci(e[t][1],i);return e[t][1]=n,void(e[l][1]=wi(e[l][1],a,o))}break}}}if(null!==n&&null!==a&&function(e,t,i,o){return 1===o?e[t][1][e[t][1].length-1]===e[i][1][e[i][1].length-1]:e[t][1][0]===e[i][1][0]}(e,n,a,i)){let[l,r]=Ci(e[n][1],o),[s]=Ci(e[a][1],o);return e[n][1]=l,e[a][1]=s,void(e[t][1]=wi(e[t][1],r,i))}let[r,s]=Ci(e[t][1],i);e[t][1]=r,null===n?(e.splice(l,0,[1,s]),null!==a&&a>=l&&a++):e[n][1]=wi(e[n][1],s,o),null===a?e.splice(l,0,[-1,s]):e[a][1]=wi(e[a][1],s,o)}function Ei(e){let t=e.map((e=>Xt(e))),i=!1,o=[],n=0,a=null,l=0,r=0,s=0,d=0,c=0;for(;l<t.length;)0===t[l][0]?(o[n++]=l,r=d,s=c,d=0,c=0,a=t[l][1]):(1===t[l][0]?d+=t[l][1].length:c+=t[l][1].length,a&&a.length<=Math.max(r,s)&&a.length<=Math.max(d,c)&&(t.splice(o[n-1],0,[-1,a]),t[o[n-1]+1][0]=1,n--,n--,l=n>0?o[n-1]:-1,r=0,s=0,d=0,c=0,a=null,i=!0)),l++;for(i&&(t=Mi(t)),t=zi(t),l=1;l<t.length;){if(-1===t[l-1][0]&&1===t[l][0]){let e=t[l-1][1],i=t[l][1],o=Zt(e,i),n=Zt(i,e);o>=n?(o>=e.length/2||o>=i.length/2)&&(t.splice(l,0,[0,i.substring(0,o)]),t[l-1][1]=e.substring(0,e.length-o),t[l+1][1]=i.substring(o),l++):(n>=e.length/2||n>=i.length/2)&&(t.splice(l,0,[0,e.substring(0,n)]),t[l-1][0]=1,t[l-1][1]=i.substring(0,i.length-n),t[l+1][0]=-1,t[l+1][1]=e.substring(n),l++),l++}l++}return t}const Si=/[^a-zA-Z0-9]/,Li=/\s/,_i=/[\r\n]/,Ti=/\n\r?\n$/,$i=/^\r?\n\r?\n/;function zi(e){let t=e.map((e=>Xt(e)));function i(e,t){if(!e||!t)return 6;let i=e.charAt(e.length-1),o=t.charAt(0),n=i.match(Si),a=o.match(Si),l=n&&i.match(Li),r=a&&o.match(Li),s=l&&i.match(_i),d=r&&o.match(_i),c=s&&e.match(Ti),f=d&&t.match($i);return c||f?5:s||d?4:n&&!l&&r?3:l||r?2:n||a?1:0}let o=1;for(;o<t.length-1;){if(0===t[o-1][0]&&0===t[o+1][0]){let e=t[o-1][1],n=t[o][1],a=t[o+1][1],l=ti(e,n);if(l){let t=n.substring(n.length-l);e=e.substring(0,e.length-l),n=t+n.substring(0,n.length-l),a=t+a}let r=e,s=n,d=a,c=i(e,n)+i(n,a);for(;n.charAt(0)===a.charAt(0);){e+=n.charAt(0),n=n.substring(1)+a.charAt(0),a=a.substring(1);let t=i(e,n)+i(n,a);t>=c&&(c=t,r=e,s=n,d=a)}t[o-1][1]!==r&&(r?t[o-1][1]=r:(t.splice(o-1,1),o--),t[o][1]=s,d?t[o+1][1]=d:(t.splice(o+1,1),o--))}o++}return t}function Mi(e){let t=e.map((e=>Xt(e)));t.push([0,""]);let i,o=0,n=0,a=0,l="",r="";for(;o<t.length;)switch(t[o][0]){case 1:a++,r+=t[o][1],o++;break;case-1:n++,l+=t[o][1],o++;break;case 0:n+a>1?(0!==n&&0!==a&&(i=ei(r,l),0!==i&&(o-n-a>0&&0===t[o-n-a-1][0]?t[o-n-a-1][1]+=r.substring(0,i):(t.splice(0,0,[0,r.substring(0,i)]),o++),r=r.substring(i),l=l.substring(i)),i=ti(r,l),0!==i&&(t[o][1]=r.substring(r.length-i)+t[o][1],r=r.substring(0,r.length-i),l=l.substring(0,l.length-i))),o-=n+a,t.splice(o,n+a),l.length&&(t.splice(o,0,[-1,l]),o++),r.length&&(t.splice(o,0,[1,r]),o++),o++):0!==o&&0===t[o-1][0]?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,a=0,n=0,l="",r="";break;default:throw Error("Unknown diff operation")}""===t[t.length-1][1]&&t.pop();let s=!1;for(o=1;o<t.length-1;)0===t[o-1][0]&&0===t[o+1][0]&&(t[o][1].substring(t[o][1].length-t[o-1][1].length)===t[o-1][1]?(t[o][1]=t[o-1][1]+t[o][1].substring(0,t[o][1].length-t[o-1][1].length),t[o+1][1]=t[o-1][1]+t[o+1][1],t.splice(o-1,1),s=!0):t[o][1].substring(0,t[o+1][1].length)===t[o+1][1]&&(t[o-1][1]+=t[o+1][1],t[o][1]=t[o][1].substring(t[o+1][1].length)+t[o+1][1],t.splice(o+1,1),s=!0)),o++;return s&&(t=Mi(t)),t}function Fi(e,t,i=!1){let o=null,n=!0;return function(...a){let l=()=>{e.apply(this,a),o=null};i&&n&&(n=!1,l()),o||=setTimeout(l,t)}}function Ai(e=""){return(e??"").replace(/\r\n/g,"\n")}function Oi(e,t,i,o){let n=e+(i-e)/2;return`M ${e} ${t} C ${n},${t} ${n},${o} ${i},${o}`}const Ii="right",Hi="left";var Ni={SVG_NS:"http://www.w3.org/2000/svg"};function Pi(e,t){let{mode:i}=e.options;return t===Hi&&null!==e.options.left.mode&&(i=e.options.left.mode??i),t===Ii&&null!==e.options.right.mode&&(i=e.options.right.mode??i),i}function ji(e,t){let{theme:i}=e.options;return t===Hi&&null!==e.options.left.theme&&(i=e.options.left.theme??i),t===Ii&&null!==e.options.right.theme&&(i=e.options.right.theme??i),i}function Di(e){let t=document.createElement("div"),i={class:e.className,style:`top:${e.topOffset}px`,title:e.tooltip,"data-diff-index":e.diffIndex};for(let o in i)t.setAttribute(o,String(i[o]));return t.innerHTML=e.arrowContent,t}function Ri(e,t){let i=`js-${t}-${Math.random().toString(36).substr(2,5)}`,o=e.querySelector(`.${t}`);if(o)return o.id=o.id||i,o.id;let n=document.createElement("div");return e.appendChild(n),n.className=t,n.id=i,n.id}function Gi(e,t,i,o){let n="document"===e?document:document.querySelector(e);n&&n.addEventListener(t,(e=>{let t=n.querySelectorAll(i),a=e.target;for(let i=0,l=t.length;i<l;i+=1){let l=a,r=t[i];for(;l&&l!==n;)l===r&&o.call(r,e),l=l.parentNode}}))}let Ui=null;const Vi={ace:void 0,mode:null,theme:null,element:null,diffGranularity:"broad",lockScrolling:!0,showDiffs:!0,showConnectors:!0,charDiffs:!0,maxDiffs:5e3,left:{id:null,content:null,mode:null,theme:null,editable:!0,copyLinkEnabled:!0},right:{id:null,content:null,mode:null,theme:null,editable:!0,copyLinkEnabled:!0},classes:{gutterID:"acediff__gutter",diff:"acediff__diffLine",diffChar:"acediff__diffChar",diffGutter:"acediff__diffGutter",connector:"acediff__connector",newCodeConnectorLink:"acediff__newCodeConnector",newCodeConnectorLinkContent:"→",deletedCodeConnectorLink:"acediff__deletedCodeConnector",deletedCodeConnectorLinkContent:"←",copyRightContainer:"acediff__copy--right",copyLeftContainer:"acediff__copy--left"},connectorYOffset:0,onDiffReady:null};var Bi=class{options;el;editors;diffs=[];lineHeight=0;gutterSVG=null;gutterWidth=0;gutterHeight=0;copyLeftContainer=null;copyRightContainer=null;connectorYOffset=0;removeEventHandlers=null;constructor(e={}){let t=JSON.parse(JSON.stringify(Vi));this.options={...t,...e,left:{...t.left,...e.left},right:{...t.right,...e.right},classes:{...t.classes,...e.classes}},this.options.ace||(this.options.ace=typeof window<"u"?window.ace:void 0);let{ace:i}=this.options;if(!i){let e="No ace editor found nor supplied - `options.ace` or `window.ace` is missing";throw console.error(e),Error(e)}let o=function(e){if(e.Range)return e.Range;let t=e.acequire||e.require;return!!t&&t("ace/range")}(i);if(!o){let e="Could not require Range module for Ace. Depends on your bundling strategy, but it usually comes with Ace itself. See https://ace.c9.io/api/range.html, open an issue on GitHub ace-diff/ace-diff";throw console.error(e),Error(e)}if(Ui=o,null===this.options.element){let e="You need to specify an element for Ace-diff - `options.element` is missing";throw console.error(e),Error(e)}if(this.options.element instanceof HTMLElement)this.el=this.options.element;else{let e=document.body.querySelector(this.options.element);if(!e){let e=`Can't find the specified element ${this.options.element}`;throw console.error(e),Error(e)}this.el=e}this.options.left.id=Ri(this.el,"acediff__left"),this.options.classes.gutterID=Ri(this.el,"acediff__gutter"),this.options.right.id=Ri(this.el,"acediff__right"),this.el.innerHTML=`<div class="acediff acediff__wrap">${this.el.innerHTML}</div>`,this.editors={left:{ace:i.edit(this.options.left.id),markers:[],lineLengths:[],diffGutters:[]},right:{ace:i.edit(this.options.right.id),markers:[],lineLengths:[],diffGutters:[]},editorHeight:null},this.editors.left.ace.getSession().setMode(Pi(this,Hi)??""),this.editors.right.ace.getSession().setMode(Pi(this,Ii)??""),this.editors.left.ace.setReadOnly(!this.options.left.editable),this.editors.right.ace.setReadOnly(!this.options.right.editable),this.editors.left.ace.setShowFoldWidgets(!1),this.editors.right.ace.setShowFoldWidgets(!1),this.editors.left.ace.setTheme(ji(this,Hi)??""),this.editors.right.ace.setTheme(ji(this,Ii)??""),this.editors.left.ace.setValue(Ai(this.options.left.content??null),-1),this.editors.right.ace.setValue(Ai(this.options.right.content??null),-1),this.editors.editorHeight=function(e){let t=e.options.left.id;return t?document.getElementById(t)?.offsetHeight??0:0}(this),setTimeout((()=>{this.lineHeight=this.editors.left.ace.renderer.lineHeight,this.addEventHandlers(),this.createCopyContainers(),this.createGutter(),this.diff()}),1)}setOptions(e){this.options={...this.options,...e,left:{...this.options.left,...e.left},right:{...this.options.right,...e.right},classes:{...this.options.classes,...e.classes}},this.diff()}getNumDiffs(){return this.diffs.length}getEditors(){return{left:this.editors.left.ace,right:this.editors.right.ace}}diff(){let e=this.editors.left.ace.getSession().getValue(),t=Ei(vi(this.editors.right.ace.getSession().getValue(),e));this.editors.left.lineLengths=this.getLineLengths(this.editors.left),this.editors.right.lineLengths=this.getLineLengths(this.editors.right);let i=[],o={left:0,right:0};t.forEach((e=>{let t=e[0],n=e[1];0!==n.length&&(0===t?(o.left+=n.length,o.right+=n.length):-1===t?(i.push(this.computeDiff(-1,o.left,o.right,n)),o.right+=n.length):1===t&&(i.push(this.computeDiff(1,o.left,o.right,n)),o.left+=n.length))})),this.diffs=this.simplifyDiffs(i),!(this.diffs.length>this.options.maxDiffs)&&(this.clearDiffs(),this.decorate(),"function"==typeof this.options.onDiffReady&&this.options.onDiffReady(this.diffs))}clear(){this.clearDiffs(),this.clearGutter(),this.clearArrows()}destroy(){let e=this.editors.left.ace.getValue();this.editors.left.ace.destroy();let t=this.editors.left.ace.container,i=t.cloneNode(!1);i.textContent=e,t.parentNode?.replaceChild(i,t);let o=this.editors.right.ace.getValue();this.editors.right.ace.destroy(),t=this.editors.right.ace.container,i=t.cloneNode(!1),i.textContent=o,t.parentNode?.replaceChild(i,t);let n=document.getElementById(this.options.classes.gutterID);n&&(n.innerHTML=""),this.removeEventHandlers?.()}addEventHandlers(){let e=!1,t=(t,i)=>{if(!this.options.lockScrolling||e)return;let o=t.ace.getSession(),n=i.ace.getSession(),a=o.getScrollTop(),l=o.getLength()*this.lineHeight,r=t.ace.renderer.$size.scrollerHeight,s=Math.max(0,l-r),d=s>0?a/s:0,c=n.getLength()*this.lineHeight,f=i.ace.renderer.$size.scrollerHeight,u=d*Math.max(0,c-f);e=!0,n.setScrollTop(u),e=!1};this.editors.left.ace.getSession().on("changeScrollTop",Fi((()=>{t(this.editors.left,this.editors.right),this.updateGap()}),16)),this.editors.right.ace.getSession().on("changeScrollTop",Fi((()=>{t(this.editors.right,this.editors.left),this.updateGap()}),16));let i=this.diff.bind(this);this.editors.left.ace.on("change",i),this.editors.right.ace.on("change",i),this.options.left.copyLinkEnabled&&Gi(`#${this.options.classes.gutterID}`,"click",`.${this.options.classes.newCodeConnectorLink}`,(e=>this.copy(e,"ltr"))),this.options.right.copyLinkEnabled&&Gi(`#${this.options.classes.gutterID}`,"click",`.${this.options.classes.deletedCodeConnectorLink}`,(e=>this.copy(e,"rtl")));let o=function(e,t){let i;return function(...o){clearTimeout(i),i=setTimeout((()=>e.apply(this,o)),t)}}((()=>{let e=document.getElementById(this.options.left.id);e&&(this.editors.availableHeight=e.offsetHeight),this.diff()}),250);window.addEventListener("resize",o),this.removeEventHandlers=()=>{window.removeEventListener("resize",o)}}copy(e,t){let i,o,n,a,l,r,s=e.target,d=parseInt(s.getAttribute("data-diff-index")??"0",10),c=this.diffs[d];if(!c||"ltr"===t&&!this.options.right.editable||"rtl"===t&&!this.options.left.editable)return;"ltr"===t?(i=this.editors.left,o=this.editors.right,n=c.leftStartOffset,a=c.leftEndOffset,l=c.rightStartOffset,r=c.rightEndOffset):(i=this.editors.right,o=this.editors.left,n=c.rightStartOffset,a=c.rightEndOffset,l=c.leftStartOffset,r=c.leftEndOffset);let f=i.ace.getValue().substring(n,a),u=o.ace.getSession().doc,h=u.indexToPosition(l,0),p=u.indexToPosition(r,0),g=o.ace.getSession().getScrollTop();Ui&&o.ace.getSession().replace(new Ui(h.row,h.column,p.row,p.column),f),o.ace.getSession().setScrollTop(parseInt(String(g),10)),this.diff()}getLineLengths(e){return e.ace.getSession().doc.getAllLines().map((e=>e.length+1))}showDiff(e,t,i,o,n){let a=this.editors[e],l=i;l<t&&(l=t);let r=`${n} ${l>t?"lines":"targetOnly"} ${e}`,s=l;if(s>t&&--s,Ui&&a.markers.push(a.ace.session.addMarker(new Ui(t,0,s,1),r,"fullLine")),this.options.charDiffs&&o&&o.length>0){let t=`${this.options.classes.diffChar} ${e}`;o.forEach((e=>{Ui&&a.markers.push(a.ace.session.addMarker(new Ui(e.lineStart,e.start,e.lineEnd-1,e.end),t,"text"))}))}let d=`${this.options.classes.diffGutter} ${e}`;for(let c=t;c<l;c+=1)a.ace.session.addGutterDecoration(c,d),a.diffGutters.push({line:c,className:d})}updateGap(){this.clearDiffs(),this.decorate(),this.positionCopyContainers()}clearDiffs(){this.editors.left.markers.forEach((e=>{this.editors.left.ace.getSession().removeMarker(e)})),this.editors.right.markers.forEach((e=>{this.editors.right.ace.getSession().removeMarker(e)})),this.editors.left.markers=[],this.editors.right.markers=[],this.editors.left.diffGutters.forEach((e=>{this.editors.left.ace.session.removeGutterDecoration(e.line,e.className)})),this.editors.right.diffGutters.forEach((e=>{this.editors.right.ace.session.removeGutterDecoration(e.line,e.className)})),this.editors.left.diffGutters=[],this.editors.right.diffGutters=[]}addConnector(e,t,i,o){let n=this.editors.left.ace.getSession().getScrollTop(),a=this.editors.right.ace.getSession().getScrollTop();this.connectorYOffset=1;let l=e*this.lineHeight-n+.5,r=this.gutterWidth+1,s=i*this.lineHeight-a+.5,d=t*this.lineHeight-n+this.connectorYOffset+.5,c=this.gutterWidth+1,f=o*this.lineHeight-a+this.connectorYOffset+.5,u=`${Oi(-1,l,r,s)} L${r},${s} ${c},${f} ${Oi(c,f,-1,d)} L-1,${d} -1,${l}`,h=document.createElementNS(Ni.SVG_NS,"path");h.setAttribute("d",u),h.setAttribute("class",this.options.classes.connector??""),this.gutterSVG?.appendChild(h)}addCopyArrows(e,t){if(e.leftEndLine>e.leftStartLine&&this.options.left.copyLinkEnabled&&this.options.right.editable){let i=Di({className:this.options.classes.newCodeConnectorLink??"",topOffset:e.leftStartLine*this.lineHeight,tooltip:"Copy to right",diffIndex:t,arrowContent:this.options.classes.newCodeConnectorLinkContent??""});this.copyRightContainer?.appendChild(i)}if(e.rightEndLine>e.rightStartLine&&this.options.right.copyLinkEnabled&&this.options.left.editable){let i=Di({className:this.options.classes.deletedCodeConnectorLink??"",topOffset:e.rightStartLine*this.lineHeight,tooltip:"Copy to left",diffIndex:t,arrowContent:this.options.classes.deletedCodeConnectorLinkContent??""});this.copyLeftContainer?.appendChild(i)}}positionCopyContainers(){let e=this.editors.left.ace.getSession().getScrollTop(),t=this.editors.right.ace.getSession().getScrollTop();this.copyRightContainer&&(this.copyRightContainer.style.cssText=`top: ${-e}px`),this.copyLeftContainer&&(this.copyLeftContainer.style.cssText=`top: ${-t}px`)}computeDiff(e,t,i,o){let n={};if(1===e){let e=this.getSingleDiffInfo(this.editors.left,t,o),a=this.getLineForCharPosition(this.editors.right,i),l=this.getCharsOnLine(this.editors.right,a),r=this.getCharsOnLine(this.editors.left,e.startLine),s=a,d=e.startLine===e.endLine,c=0;(e.startChar>0||d&&o.length<r)&&l>0&&e.startChar<r&&c++,n={leftStartLine:e.startLine,leftEndLine:e.endLine+1,rightStartLine:s,rightEndLine:s+c,leftStartOffset:t,leftEndOffset:t+o.length,rightStartOffset:i,rightEndOffset:i,leftStartChar:e.startChar,leftEndChar:e.endChar}}else{let e=this.getSingleDiffInfo(this.editors.right,i,o),a=this.getLineForCharPosition(this.editors.left,t),l=this.getCharsOnLine(this.editors.left,a),r=this.getCharsOnLine(this.editors.right,e.startLine),s=a,d=e.startLine===e.endLine,c=0;(e.startChar>0||d&&o.length<r)&&l>0&&e.startChar<r&&c++,n={leftStartLine:s,leftEndLine:s+c,rightStartLine:e.startLine,rightEndLine:e.endLine+1,leftStartOffset:t,leftEndOffset:t,rightStartOffset:i,rightEndOffset:i+o.length,rightStartChar:e.startChar,rightEndChar:e.endChar}}return n}getSingleDiffInfo(e,t,i){let o={startLine:0,startChar:0,endLine:0,endChar:0},n=t+i.length,a=0,l=!1,r=!1;e.lineLengths.forEach(((e,i)=>{a+=e,!l&&t<a&&(o.startLine=i,o.startChar=t-a+e,l=!0),!r&&n<=a&&(o.endLine=i,o.endChar=n-a+e,r=!0)})),o.startChar>0&&this.getCharsOnLine(e,o.startLine)===o.startChar&&(o.startLine++,o.startChar=0),0===o.endChar&&o.endLine--;let s=/\n$/.test(i);return o.startChar>0&&s&&o.endLine++,o}getCharsOnLine(e,t){return function(e,t){return e.ace.getSession().doc.getLine(t)}(e,t).length}getLineForCharPosition(e,t){let i=e.ace.getSession().doc.getAllLines(),o=0,n=0;for(let a=0;a<i.length;a+=1){let e=i[a];if(void 0!==e&&(n+=e.length+1),t<=n){o=a,t===n&&a<i.length-1&&(o+=1);break}}return n>=e.ace.getSession().getValue().length&&(o+=1),o}createGutter(){let e=document.getElementById(this.options.classes.gutterID);if(!e)return;this.gutterHeight=e.clientHeight,this.gutterWidth=e.clientWidth;let t=this.getTotalHeight(Hi),i=this.getTotalHeight(Ii),o=Math.max(t,i,this.gutterHeight);this.gutterSVG=document.createElementNS(Ni.SVG_NS,"svg"),this.gutterSVG.setAttribute("width",String(this.gutterWidth)),this.gutterSVG.setAttribute("height",String(o)),e.appendChild(this.gutterSVG)}getTotalHeight(e){return(e===Hi?this.editors.left:this.editors.right).ace.getSession().getLength()*this.lineHeight}createCopyContainers(){this.copyRightContainer=document.createElement("div"),this.copyRightContainer.setAttribute("class",this.options.classes.copyRightContainer??""),this.copyLeftContainer=document.createElement("div"),this.copyLeftContainer.setAttribute("class",this.options.classes.copyLeftContainer??"");let e=document.getElementById(this.options.classes.gutterID);e&&(e.appendChild(this.copyRightContainer),e.appendChild(this.copyLeftContainer))}clearGutter(){let e=document.getElementById(this.options.classes.gutterID);e&&this.gutterSVG&&e.removeChild(this.gutterSVG),this.createGutter()}clearArrows(){this.copyLeftContainer&&(this.copyLeftContainer.innerHTML=""),this.copyRightContainer&&(this.copyRightContainer.innerHTML="")}simplifyDiffs(e){let t=[],i=e=>"specific"===this.options.diffGranularity?e<1:e<=1,o=e=>{let t={...e,leftChars:[],rightChars:[]};return void 0!==e.leftEndChar&&t.leftChars.push({start:e.leftStartChar??0,end:e.leftEndChar,lineStart:e.leftStartLine??0,lineEnd:e.leftEndLine??0}),void 0!==e.rightEndChar&&t.rightChars.push({start:e.rightStartChar??0,end:e.rightEndChar,lineStart:e.rightStartLine??0,lineEnd:e.rightEndLine??0}),t};return e.forEach(((e,n)=>{if(0===n)return void t.push(o(e));let a=!1;for(let o=0;o<t.length;o+=1)if(i(Math.abs(e.leftStartLine-t[o].leftEndLine))&&i(Math.abs(e.rightStartLine-t[o].rightEndLine))){t[o].leftStartLine=Math.min(e.leftStartLine,t[o].leftStartLine),t[o].rightStartLine=Math.min(e.rightStartLine,t[o].rightStartLine),t[o].leftEndLine=Math.max(e.leftEndLine,t[o].leftEndLine),t[o].rightEndLine=Math.max(e.rightEndLine,t[o].rightEndLine),t[o].leftStartOffset=Math.min(e.leftStartOffset,t[o].leftStartOffset),t[o].leftEndOffset=Math.max(e.leftEndOffset,t[o].leftEndOffset),t[o].rightStartOffset=Math.min(e.rightStartOffset,t[o].rightStartOffset),t[o].rightEndOffset=Math.max(e.rightEndOffset,t[o].rightEndOffset),void 0!==e.leftEndChar&&t[o].leftChars.push({start:e.leftStartChar??0,end:e.leftEndChar,lineStart:e.leftStartLine,lineEnd:e.leftEndLine}),void 0!==e.rightEndChar&&t[o].rightChars.push({start:e.rightStartChar??0,end:e.rightEndChar,lineStart:e.rightStartLine,lineEnd:e.rightEndLine}),a=!0;break}a||t.push(o(e))})),t.filter((e=>!(e.leftStartLine===e.leftEndLine&&e.rightStartLine===e.rightEndLine)))}decorate(){this.clearGutter(),this.clearArrows(),this.diffs.forEach(((e,t)=>{this.options.showDiffs&&(this.showDiff(Hi,e.leftStartLine,e.leftEndLine,e.leftChars,this.options.classes.diff??""),this.showDiff(Ii,e.rightStartLine,e.rightEndLine,e.rightChars,this.options.classes.diff??""),this.options.showConnectors&&this.addConnector(e.leftStartLine,e.leftEndLine,e.rightStartLine,e.rightEndLine),this.addCopyArrows(e,t))}))}};const qi=B(a({__name:"diff",props:{mode:{type:String,default:"Text"}},setup(e){const t=e,i=ye(),{editorConfig:o,currentFile:n}=S(i),a=_("diffRef");let l=null;const r=e=>new Promise((t=>{pe.config.loadModule(e,(()=>t()))}));return p((()=>{(async()=>{if(pe.config.set("basePath","/static/ace"),await r("ace/ext/language_tools"),!a.value)return;const{editorTheme:e}=o.value.aceEditor,i=`ace/theme/${e}`;if(await r(i),!a.value)return;const{fontSize:s,fontFamily:d,showInvisibles:c,showLineNumbers:f,useSoftTabs:u,tabSize:h}=o.value.aceEditor,p=`ace/mode/${t.mode?.toLocaleLowerCase()}`;l=new Bi({ace:pe,element:a.value,theme:i,mode:p,left:{content:n.value?.leftContent||"",editable:!1,copyLinkEnabled:!1},right:{content:n.value?.rightContent||"",editable:!1,copyLinkEnabled:!1}});const g=l.getEditors();[g.left,g.right].forEach((e=>{e.setOptions({fontSize:s,fontFamily:d,showInvisibles:c,showLineNumbers:f,useSoftTabs:u,tabSize:h,showPrintMargin:!1,wrap:!0,indentedSoftWrap:!0})})),T((()=>n.value?.leftContent),(e=>{l&&l.getEditors().left.setValue(e||"",-1)})),T((()=>n.value?.rightContent),(e=>{l&&l.getEditors().right.setValue(e||"",-1)}))})()})),O((()=>{l&&l.destroy()})),A((()=>{const{editorTheme:e,fontSize:t,fontFamily:i,showInvisibles:n,showLineNumbers:a,useSoftTabs:r,tabSize:s}=o.value.aceEditor;if(l){const o=l.getEditors();[o.left,o.right].forEach((o=>{o.setTheme(`ace/theme/${e}`),o.setOptions({fontSize:t,fontFamily:i,showInvisibles:n,showLineNumbers:a,useSoftTabs:r,tabSize:s})}))}})),(e,t)=>(s(),d("div",{ref_key:"diffRef",ref:a,class:"ace-diff-container w-full h-full"},null,512))}}),[["__scopeId","data-v-4b286035"]]),Wi={class:"flex-1 bg-[#262626] overflow-y-auto w-full h-full text-[#ccc]"},Ki={class:"flex gap-60px max-w-[1200px] mx-auto py-30px px-50px justify-center"},Ji={class:"flex-1"},Yi={class:"text-[20px] text-[#e0e0e0] mb-[24px] pl-[12px] border-l-[3px] border-l-solid border-l-primary"},Qi={class:"flex flex-col gap-[14px] text-[14px]"},Xi={class:"flex items-center"},Zi={class:"text-[#a4a4a4] ml-[16px]"},eo={class:"flex items-center"},to={class:"text-[#a4a4a4] ml-[16px]"},io={class:"flex items-center"},oo={class:"text-[#a4a4a4] ml-[16px]"},no={class:"flex items-center"},ao={class:"text-[#a4a4a4] ml-[16px]"},lo={class:"flex items-center"},ro={class:"text-[#a4a4a4] ml-[16px]"},so={class:"flex items-center"},co={class:"text-[#a4a4a4] ml-[16px]"},fo={class:"flex items-center"},uo={class:"text-[#a4a4a4] ml-[16px]"},ho={class:"flex items-center"},po={class:"text-[#a4a4a4] ml-[16px]"},go={class:"flex items-center"},mo={class:"text-[#a4a4a4] ml-[16px]"},bo={class:"flex items-center"},vo={class:"text-[#a4a4a4] ml-[16px]"},xo={class:"mt-[40px]"},yo={class:"text-[20px] text-[#e0e0e0] mb-[24px] pl-[12px] border-l-[3px] border-l-solid border-l-primary"},wo={class:"flex flex-col gap-[14px] text-[14px]"},Co={class:"flex items-center"},ko={class:"text-[#a4a4a4] ml-[16px]"},Eo={class:"flex items-center"},So={class:"text-[#a4a4a4] ml-[16px]"},Lo={class:"flex items-center"},_o={class:"text-[#a4a4a4] ml-[16px]"},To={class:"flex items-center"},$o={class:"text-[#a4a4a4] ml-[16px]"},zo={class:"flex-1"},Mo={class:"text-[20px] text-[#e0e0e0] mb-[24px] pl-[12px] border-l-[3px] border-l-solid border-l-primary"},Fo={class:"flex flex-col gap-[14px] text-[14px]"},Ao={class:"flex items-center"},Oo={class:"flex items-center gap-[6px] min-w-[260px] text-white"},Io={class:"flex items-center"},Ho={class:"text-[#a4a4a4] ml-[16px]"},No={class:"flex items-center"},Po={class:"text-[#a4a4a4] ml-[16px]"},jo={class:"flex items-center"},Do={class:"flex items-center gap-[6px] min-w-[260px] text-white"},Ro={class:"text-[#a4a4a4] ml-[16px]"},Go={class:"mt-[40px]"},Uo={class:"text-[20px] text-[#e0e0e0] mb-[24px] pl-[12px] border-l-[3px] border-l-solid border-l-primary"},Vo={class:"flex flex-col gap-[14px] text-[14px]"},Bo={class:"flex items-center"},qo={class:"text-[#a4a4a4] ml-[16px]"},Wo={class:"flex items-center"},Ko={class:"text-[#a4a4a4] ml-[16px]"},Jo={class:"flex items-center"},Yo={class:"text-[#a4a4a4] ml-[16px]"},Qo={class:"flex items-center"},Xo={class:"text-[#a4a4a4] ml-[16px]"},Zo={class:"flex items-center"},en={class:"text-[#a4a4a4] ml-[16px]"},tn={class:"flex items-center"},on={class:"text-[#a4a4a4] ml-[16px]"},nn={class:"flex items-center"},an={class:"text-[#a4a4a4] ml-[16px]"},ln={class:"flex items-center"},rn={class:"text-[#a4a4a4] ml-[16px]"},sn={class:"flex items-center"},dn={class:"text-[#a4a4a4] ml-[16px]"},cn=B({},[["render",function(e,t){return s(),d("div",Wi,[c("div",Ki,[c("div",Ji,[c("div",null,[c("div",Yi,f(e.$t("fileEditor.shortcut.common.title")),1),c("div",Qi,[c("div",Xi,[t[0]||(t[0]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"S")],-1)),c("div",Zi,f(e.$t("fileEditor.shortcut.common.saveFile")),1)]),c("div",eo,[t[1]||(t[1]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"C")],-1)),c("div",to,f(e.$t("fileEditor.shortcut.common.copy")),1)]),c("div",io,[t[2]||(t[2]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"X")],-1)),c("div",oo,f(e.$t("fileEditor.shortcut.common.cut")),1)]),c("div",no,[t[3]||(t[3]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"V")],-1)),c("div",ao,f(e.$t("fileEditor.shortcut.common.paste")),1)]),c("div",lo,[t[4]||(t[4]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"A")],-1)),c("div",ro,f(e.$t("fileEditor.shortcut.common.selectAll")),1)]),c("div",so,[t[5]||(t[5]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"Z")],-1)),c("div",co,f(e.$t("fileEditor.shortcut.common.undo")),1)]),c("div",fo,[t[6]||(t[6]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"Y")],-1)),c("div",uo,f(e.$t("fileEditor.shortcut.common.redo")),1)]),c("div",ho,[t[7]||(t[7]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"F")],-1)),c("div",po,f(e.$t("fileEditor.shortcut.common.find")),1)]),c("div",go,[t[8]||(t[8]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"H")],-1)),c("div",mo,f(e.$t("fileEditor.shortcut.common.replace")),1)]),c("div",bo,[t[9]||(t[9]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Esc")],-1)),c("div",vo,f(e.$t("fileEditor.shortcut.common.esc")),1)])])]),c("div",xo,[c("div",yo,f(e.$t("fileEditor.shortcut.cursorMove.title")),1),c("div",wo,[t[14]||(t[14]=c("div",{class:"flex items-center"},[c("div",{class:"flex items-center flex-wrap gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Home"),y(" / "),c("kbd",null,"End"),y(" / "),c("kbd",null,"Up"),y(" / "),c("kbd",null,"Left"),y(" / "),c("kbd",null,"Down"),y(" / "),c("kbd",null,"Right")])],-1)),c("div",Co,[t[10]||(t[10]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"Home"),y(" / "),c("kbd",null,"End")],-1)),c("div",ko,f(e.$t("fileEditor.shortcut.cursorMove.docStartEnd")),1)]),c("div",Eo,[t[11]||(t[11]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"P")],-1)),c("div",So,f(e.$t("fileEditor.shortcut.cursorMove.matchingTag")),1)]),c("div",Lo,[t[12]||(t[12]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"PageUp"),y(" / "),c("kbd",null,"PageDown")],-1)),c("div",_o,f(e.$t("fileEditor.shortcut.cursorMove.pageUpDown")),1)]),c("div",To,[t[13]||(t[13]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Alt"),y(" + "),c("kbd",null,"Left"),y(" / "),c("kbd",null,"Right")],-1)),c("div",$o,f(e.$t("fileEditor.shortcut.cursorMove.lineStartEnd")),1)])])])]),c("div",zo,[c("div",null,[c("div",Mo,f(e.$t("fileEditor.shortcut.selection.title")),1),c("div",Fo,[c("div",Ao,[c("div",Oo,[c("kbd",null,f(e.$t("fileEditor.shortcut.selection.mouseBox")),1),t[15]||(t[15]=y(" —— ")),c("kbd",null,f(e.$t("fileEditor.shortcut.selection.drag")),1)])]),t[20]||(t[20]=I('<div class="flex items-center" data-v-fccb0a32><div class="flex items-center flex-wrap gap-[6px] min-w-[260px] text-white" data-v-fccb0a32><kbd data-v-fccb0a32>Shift</kbd> + <kbd data-v-fccb0a32>Home</kbd> / <kbd data-v-fccb0a32>End</kbd> / <kbd data-v-fccb0a32>Up</kbd> / <kbd data-v-fccb0a32>Left</kbd> / <kbd data-v-fccb0a32>Down</kbd> / <kbd data-v-fccb0a32>Right</kbd></div></div>',1)),c("div",Io,[t[16]||(t[16]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Shift"),y(" + "),c("kbd",null,"PageUp"),y(" / "),c("kbd",null,"PageDown")],-1)),c("div",Ho,f(e.$t("fileEditor.shortcut.selection.pageSelect")),1)]),c("div",No,[t[17]||(t[17]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"Shift"),y(" + "),c("kbd",null,"Home"),y(" / "),c("kbd",null,"End")],-1)),c("div",Po,f(e.$t("fileEditor.shortcut.selection.cursorToStartEnd")),1)]),c("div",jo,[c("div",Do,[t[18]||(t[18]=c("kbd",null,"Alt",-1)),t[19]||(t[19]=y(" + ")),c("kbd",null,f(e.$t("fileEditor.shortcut.selection.mouseDrag")),1)]),c("div",Ro,f(e.$t("fileEditor.shortcut.selection.blockSelect")),1)])])]),c("div",Go,[c("div",Uo,f(e.$t("fileEditor.shortcut.edit.title")),1),c("div",Vo,[c("div",Bo,[t[21]||(t[21]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"/")],-1)),c("div",qo,f(e.$t("fileEditor.shortcut.edit.toggleComment")),1)]),c("div",Wo,[t[22]||(t[22]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Tab")],-1)),c("div",Ko,f(e.$t("fileEditor.shortcut.edit.indent")),1)]),c("div",Jo,[t[23]||(t[23]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Shift"),y(" + "),c("kbd",null,"Tab")],-1)),c("div",Yo,f(e.$t("fileEditor.shortcut.edit.outdent")),1)]),c("div",Qo,[t[24]||(t[24]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Delete")],-1)),c("div",Xo,f(e.$t("fileEditor.shortcut.edit.delete")),1)]),c("div",Zo,[t[25]||(t[25]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"D")],-1)),c("div",en,f(e.$t("fileEditor.shortcut.edit.deleteLine")),1)]),c("div",tn,[t[26]||(t[26]=c("div",{class:"flex items-center flex-wrap gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Alt"),y(" + "),c("kbd",null,"Shift"),y(" + "),c("kbd",null,"Up"),y(" / "),c("kbd",null,"Down")],-1)),c("div",on,f(e.$t("fileEditor.shortcut.edit.copyLineUpDown")),1)]),c("div",nn,[t[27]||(t[27]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Alt"),y(" + "),c("kbd",null,"Delete")],-1)),c("div",an,f(e.$t("fileEditor.shortcut.edit.deleteRight")),1)]),c("div",ln,[t[28]||(t[28]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Alt"),y(" + "),c("kbd",null,"Up"),y(" / "),c("kbd",null,"Down")],-1)),c("div",rn,f(e.$t("fileEditor.shortcut.edit.swapLineUpDown")),1)]),c("div",sn,[t[29]||(t[29]=c("div",{class:"flex items-center gap-[6px] min-w-[260px] text-white"},[c("kbd",null,"Ctrl"),y(" + "),c("kbd",null,"Shift"),y(" + "),c("kbd",null,"D")],-1)),c("div",dn,f(e.$t("fileEditor.shortcut.edit.copyLineDown")),1)])])])])])])}],["__scopeId","data-v-fccb0a32"]]),fn={class:"flex-1 flex flex-col h-full bg-[#1e1e1e] overflow-hidden"},un={class:"flex-1 overflow-hidden relative"},hn=a({__name:"index",setup(e,{expose:t}){const i=ye(),{fileList:o,currentFileIndex:a,currentFile:l,editorConfig:r}=S(i),{saveFileContentAndClose:f,closeTab:h,updateTabContent:p}=i,m=_("editorMainRef"),x=n({get:()=>l.value?.content||"",set:e=>{-1!==a.value&&p(a.value,e)}}),y=H({line:1,column:1}),C=n((()=>Number(r.value.aceEditor.tabSize))),k=n((()=>r.value.aceEditor.useSoftTabs)),E=n((()=>l.value?.encoding||"")),L=n((()=>{const e=new Map,t=Object.entries(r.value.supportedModes||{});for(const[i,o]of t){const t=o[0].split("|");for(const o of t)e.set(o,i)}return e})),T=n((()=>{const e=l.value?.type;return e&&L.value.get(e)||"Text"})),$=n((()=>{const e=T.value;return r.value.nameOverrides?.[e]??e})),z=async e=>{await f(e)},M=e=>{h(e)},F=e=>{y.line=e.line,y.column=e.column},A=e=>{m.value?.gotoLine(e)},O=()=>{q({width:420,footer:!1,showMask:!1,data:{currentLine:y?.line,currentColumn:y?.column,maxLine:l.value?.content?l.value.content.split("\n").length:1,onChange:e=>{A(e)}},component:Ut})};return t({handleToolbarAction:e=>{"search"===e?m.value?.execCommand("find"):"replace"===e?m.value?.execCommand("replace"):"jumpLine"===e&&l.value&&O()}}),i.getEditorConfig(),(e,t)=>(s(),d("div",fn,[g(Ct,{value:v(a),"onUpdate:value":t[0]||(t[0]=e=>b(a)?a.value=e:null),data:v(o),save:z,onClose:M},null,8,["value","data"]),v(l)?(s(),d(w,{key:0},[c("div",un,["shortcut"===v(l).type?(s(),N(cn,{key:0})):"diff"===v(l).type?(s(),N(qi,{key:1,mode:v(T)},null,8,["mode"])):(s(),N(kt,{key:2,ref_key:"editorMainRef",ref:m,value:v(x),"onUpdate:value":t[1]||(t[1]=e=>b(x)?x.value=e:null),mode:v(T),onCursorChange:F,onShowGotoLine:O},null,8,["value","mode"]))]),"shortcut"!==v(l).type?(s(),N(Qt,{key:0,"file-path":v(l).path,encoding:v(E),"line-ending":v(l).lineEnding,cursor:v(y),"tab-size":v(C),"use-soft-tabs":v(k),language:v($),onJumpLine:A},null,8,["file-path","encoding","line-ending","cursor","tab-size","use-soft-tabs","language"])):u("",!0)],64)):u("",!0)]))}}),pn={class:"editor-container"},gn={class:"editor-body"},mn=a({__name:"index",props:{filePath:{type:String,required:!0},currentPath:{type:String,required:!0},onClose:{type:Function,required:!0},onMaximize:{type:Function,required:!0},onMinimize:{type:Function,required:!0}},setup(e){const t=e,i=_("codeEditorRef"),{t:n}=E(),a=ye(),l=e=>{if("F5"===e.key||"r"===e.key&&(e.metaKey||e.ctrlKey))return e.preventDefault(),void R.info(n("fileEditor.messages.noRefresh"))};a.setCurrentPath(t.currentPath),p((()=>{window.addEventListener("keydown",l,{capture:!0}),a.openFile(t.filePath)})),P((()=>{window.removeEventListener("keydown",l,{capture:!0}),a.fileList=[],a.currentFileIndex=-1,a.currentPath="",a.creatingType=null,a.isSearchMode=!1}));const f=o(!1),u=o(!1),h=e=>{i.value&&i.value.handleToolbarAction(e)},m=()=>{f.value=!f.value,t.onMinimize()},b=()=>{u.value=!u.value,t.onMaximize()},x=()=>{const e=a.fileList.some((e=>e.content!==e.originalContent&&"shortcut"!==e.type)),i=()=>{J(),t.onClose&&t.onClose()};e?G({title:n("fileEditor.editorHeader.tipTitle"),content:n("fileEditor.editorHeader.modifiedSaveConfirm"),confirmText:n("fileEditor.common.save"),cancelText:n("fileEditor.editorHeader.dontSave"),onConfirm:async()=>{await a.saveAllFile(),i()},onCancel:()=>{i()}}):i()};return(e,t)=>(s(),d("div",pn,[g($e,{"is-minimize":v(f),"is-maximize":v(u),onMinimize:m,onMaximize:b,onClose:x},null,8,["is-minimize","is-maximize"]),r(g(Xe,{onAction:h},null,512),[[j,!v(f)]]),r(c("main",gn,[g(mt),g(hn,{ref_key:"codeEditorRef",ref:i},null,512)],512),[[j,!v(f)]])]))}});e("default",B(mn,[["__scopeId","data-v-23722196"]]))}}}));
|