diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..46f90a9b --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +## registry=https://registry.npmjs.com +registry=https://registry.npmmirror.com \ No newline at end of file diff --git a/apps/zhi-core/.gitignore b/apps/zhi-core/.gitignore new file mode 100644 index 00000000..53c37a16 --- /dev/null +++ b/apps/zhi-core/.gitignore @@ -0,0 +1 @@ +dist \ No newline at end of file diff --git a/apps/zhi-core/esbuild.config.ts b/apps/zhi-core/esbuild.config.ts index d08c9c1a..9c731958 100644 --- a/apps/zhi-core/esbuild.config.ts +++ b/apps/zhi-core/esbuild.config.ts @@ -23,4 +23,19 @@ * questions. */ -console.log("hello, esbuild") \ No newline at end of file +import { BuildOptions } from "esbuild" +import path from "path" + +const outDir = "dist" +const outFile = "theme.js" + +/** + * 构建配置 + */ +export const esbuildConfig: BuildOptions = { + entryPoints: ["src/index.ts"], + outfile: path.join(outDir, outFile), + bundle: true, + format: "cjs", + platform: "node", +} diff --git a/apps/zhi-core/package.json b/apps/zhi-core/package.json index af4e19d9..f63cf9c2 100644 --- a/apps/zhi-core/package.json +++ b/apps/zhi-core/package.json @@ -14,11 +14,15 @@ "theme" ], "scripts": { - "dev": "node --experimental-specifier-resolution=node --loader ts-node/esm esbuild.config.ts" + "dev": "node --experimental-specifier-resolution=node --loader ts-node/esm scripts/build.ts --watch", + "build": "node --experimental-specifier-resolution=node --loader ts-node/esm scripts/build.ts --production" }, "devDependencies": { - "esbuild": "^0.17.16", - "esbuild-dev-server": "^0.3.0", - "ts-node": "^10.9.1" + "@types/minimist": "^1.2.2", + "@types/node": "^18.15.11", + "esbuild": "^0.16.9", + "minimist": "^1.2.8", + "ts-node": "^10.9.1", + "tsconfig": "workspace:*" } } \ No newline at end of file diff --git a/apps/zhi-core/public/plugin.js b/apps/zhi-core/public/plugin.js new file mode 100644 index 00000000..dc76d8df --- /dev/null +++ b/apps/zhi-core/public/plugin.js @@ -0,0 +1,2 @@ +!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode(".command.svelte-1bq7axd{padding:8px 12px}.command.svelte-1bq7axd:hover{cursor:pointer;background-color:#0003;color:var(--b3-theme-primary)}.command-selected.svelte-1bq7axd{color:var(--b3-theme-primary);background-color:#0003}.command-plugin.svelte-1bq7axd{font-size:14px}.command-shortcut.svelte-1bq7axd{font-size:12px;color:var(--color-text-3)}.plugin.svelte-bwhxpp span.remove.svelte-bwhxpp{display:none;color:var(--b3-theme-error);margin-left:4px}.plugin.svelte-bwhxpp:hover span.remove.svelte-bwhxpp{display:inline;cursor:pointer}.plugin.svelte-bwhxpp:hover span.remove.svelte-bwhxpp:hover{text-decoration:underline}.plugin-info.svelte-bj9chc{display:flex;align-items:center}.plugin-detail.svelte-bj9chc{margin-top:12px;width:100%}.plugin-name.svelte-bj9chc{display:inline;margin-right:6px;font-size:24px}.plugin-key.svelte-bj9chc{display:inline;font-size:16px}.plugin-manifest.svelte-bj9chc{margin-top:12px}.plugin-readme.svelte-bj9chc{margin-top:20px}.go-back.svelte-bj9chc{margin-left:12px;font-size:12px;height:24px}.go-back-icon.svelte-bj9chc{height:12px;width:12px;margin-right:4px}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}(); +(function(){var _a,_b,_c,commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Reflect$1,Reflect2;Reflect2=Reflect$1||(Reflect$1={}),function(t){var n="object"==typeof commonjsGlobal?commonjsGlobal:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),r=i(Reflect2);function i(e,t){return function(n,r){"function"!=typeof e[n]&&Object.defineProperty(e,n,{configurable:!0,writable:!0,value:r}),t&&t(n,r)}}void 0===n.Reflect?n.Reflect=Reflect2:r=i(n.Reflect,r),function(t){var n=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,i=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",a="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!a&&!s,l={create:a?function(){return ie(Object.create(null))}:s?function(){return ie({__proto__:null})}:function(){return ie({})},has:c?function(e,t){return n.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return n.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},u=Object.getPrototypeOf(Function),p="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=p||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?te():Map,h=p||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?ne():Set,f=new(p||"function"!=typeof WeakMap?re():WeakMap);function g(e,t,n,r){if(D(n)){if(!H(e))throw new TypeError;if(!Y(t))throw new TypeError;return $(e,t)}if(!H(e))throw new TypeError;if(!F(t))throw new TypeError;if(!F(r)&&!D(r)&&!B(r))throw new TypeError;return B(r)&&(r=void 0),T(e,t,n=V(n),r)}function m(e,t){function n(n,r){if(!F(n))throw new TypeError;if(!D(r)&&!W(r))throw new TypeError;k(e,t,n,r)}return n}function _(e,t,n,r){if(!F(n))throw new TypeError;return D(r)||(r=V(r)),k(e,t,n,r)}function y(e,t,n){if(!F(t))throw new TypeError;return D(n)||(n=V(n)),P(e,t,n)}function v(e,t,n){if(!F(t))throw new TypeError;return D(n)||(n=V(n)),I(e,t,n)}function b(e,t,n){if(!F(t))throw new TypeError;return D(n)||(n=V(n)),N(e,t,n)}function w(e,t,n){if(!F(t))throw new TypeError;return D(n)||(n=V(n)),R(e,t,n)}function E(e,t){if(!F(e))throw new TypeError;return D(t)||(t=V(t)),C(e,t)}function S(e,t){if(!F(e))throw new TypeError;return D(t)||(t=V(t)),x(e,t)}function A(e,t,n){if(!F(t))throw new TypeError;D(n)||(n=V(n));var r=O(t,n,!1);if(D(r))return!1;if(!r.delete(e))return!1;if(r.size>0)return!0;var i=f.get(t);return i.delete(n),i.size>0||f.delete(t),!0}function $(e,t){for(var n=e.length-1;n>=0;--n){var r=(0,e[n])(t);if(!D(r)&&!B(r)){if(!Y(r))throw new TypeError;t=r}}return t}function T(e,t,n,r){for(var i=e.length-1;i>=0;--i){var o=(0,e[i])(t,n,r);if(!D(o)&&!B(o)){if(!F(o))throw new TypeError;r=o}}return r}function O(e,t,n){var r=f.get(e);if(D(r)){if(!n)return;r=new d,f.set(e,r)}var i=r.get(t);if(D(i)){if(!n)return;i=new d,r.set(t,i)}return i}function P(e,t,n){if(I(e,t,n))return!0;var r=ee(t);return!B(r)&&P(e,r,n)}function I(e,t,n){var r=O(t,n,!1);return!D(r)&&q(r.has(e))}function N(e,t,n){if(I(e,t,n))return R(e,t,n);var r=ee(t);return B(r)?void 0:N(e,r,n)}function R(e,t,n){var r=O(t,n,!1);if(!D(r))return r.get(e)}function k(e,t,n,r){O(n,r,!0).set(e,t)}function C(e,t){var n=x(e,t),r=ee(e);if(null===r)return n;var i=C(r,t);if(i.length<=0)return n;if(n.length<=0)return i;for(var o=new h,a=[],s=0,c=n;s=0&&e=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var n=this._find(e,!0);return this._values[n]=t,this},t.prototype.delete=function(t){var n=this._find(t,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i({token:window.siyuan.config.api.token}),TYPES={StorageManager:"StorageManager",PluginSystem:"PluginSystem",SystemManager:"PluginSystemLocalManager",PluginLoader:"PluginLoader",PluginFileManager:"PluginFileManager",EventBus:"EventBus",Shortcut:"Shortcut",CommandManager:"CommandManager",Store:"Store"};async function request(e,t){let n=null;return await fetch(e,{body:JSON.stringify(t),method:"POST",headers:{Authorization:`Token ${config().token}`}}).then((function(e){n=e.json()})),n}async function parseBody(e){let t=await e;return 0===t.code?t.data:null}async function transactions(e,t=[]){const n=new URL(e.ws.ws.url);return parseBody(request("/api/transactions",{app:n.searchParams.get("app"),session:n.searchParams.get("id"),transactions:t}))}async function sql(e){return parseBody(request("/api/query/sql",{stmt:e}))}async function lsNotebooks(e){return parseBody(request("/api/notebook/lsNotebooks",{stmt:e}))}async function getAnchor(t,n){let r=`select * from blocks where id = '${t=t.replace("((","").replace("))","")}'`,i=await sql(r),o="";if(i)try{o=i[0][n]?i[0][n]:i[0].content?i[0].content:t}catch(e){o="解析错误"}return o}async function openNotebook(e){return parseBody(request("/api/notebook/openNotebook",{notebook:e}))}async function closeNotebook(e){return parseBody(request("/api/notebook/closeNotebook",{notebook:e}))}async function renameNotebook(e,t){return parseBody(request("/api/notebook/renameNotebook",{notebook:e,name:t}))}async function createNotebook(e){return parseBody(request("/api/notebook/createNotebook",{name:e}))}async function removeNotebook(e){return parseBody(request("/api/notebook/removeNotebook",{notebook:e}))}async function getNotebookConf(e){return parseBody(request("/api/notebook/getNotebookConf",{notebook:e}))}async function setNotebookConf(e){return parseBody(request("/api/notebook/setNotebookConf",{notebook:e}))}async function renameDoc(e,t,n){return parseBody(request("/api/filetree/renameDoc",{notebook:e,path:t,title:n}))}async function removeDoc(e,t){return parseBody(request("/api/filetree/removeDoc",{notebook:e,path:t}))}async function moveDoc(e,t,n,r){return parseBody(request("/api/filetree/moveDoc",{fromNotebook:e,fromPath:t,toNotebook:n,toPath:r}))}async function getHPathByPath(e,t){return parseBody(request("/api/filetree/getHPathByPath",{Notebook:e,Path:t}))}async function getHPathByID(e){return parseBody(request("/api/filetree/getHPathByID",{id:e}))}async function getBlockAttrs(e){return parseBody(request("/api/attr/getBlockAttrs",{id:e}))}async function getBlockByID(e){let t=`select * from blocks where id ='${e}'`;return(await sql(t))[0]}async function getBlockKramdown(e){return parseBody(request("/api/block/getBlockKramdown",{id:e}))}async function getBlockBreadcrumb(e){return parseBody(request("/api/block/getBlockBreadcrumb",{id:e}))}async function setBlockAttrs(e,t){return parseBody(request("/api/attr/setBlockAttrs",{id:e,attrs:t}))}async function exportMdContent(e){return parseBody(request("/api/export/exportMdContent",{id:e}))}async function getDocOutline(e){return parseBody(request("/api/outline/getDocOutline",{id:e}))}async function listDocsByPath(e){return parseBody(request("/api/filetree/listDocsByPath",{path:e}))}async function getBacklink(e){return parseBody(request("/api/ref/getBacklink",{id:e,beforeLen:10,k:"",mk:""}))}async function searchEmbedBlock(e,t){return parseBody(request("/api/search/searchEmbedBlock",{stmt:t,excludeIDs:e}))}async function getDoc(e){return parseBody(request("/api/filetree/getDoc",{id:e,k:"",mode:2,size:36}))}async function getFocusedDoc(e){return parseBody(request("/api/filetree/getDoc",{id:e,k:"",mode:0,size:36}))}async function getTag(){return parseBody(request("/api/tag/getTag",{}))}async function getLocalGraph(e,t,n,r){return parseBody(request("/api/graph/getLocalGraph",{id:t,k:e,conf:n,reqId:r}))}async function getGraph(e,t,n){return parseBody(request("/api/graph/getGraph",{k:e,conf:t,reqId:n}))}async function searchDocs(e){return parseBody(request("/api/filetree/searchDocs",{k:e}))}async function searchBlock(e){return parseBody(request("/api/search/searchBlock",{query:e}))}async function searchTemplate(e){return parseBody(request("/api/search/searchTemplate",{k:e}))}async function createDocWithMd(e,t,n){return parseBody(request("/api/filetree/createDocWithMd",{notebook:e,path:t,markdown:n}))}async function docSaveAsTemplate(e,t=!1){return parseBody(request("/api/template/docSaveAsTemplate",{id:e,overwrite:t}))}async function render(e){return parseBody(request("/api/template/render",e))}async function insertBlock(e,t,n){let r="/api/block/insertBlock";return parseBody(request(r,n={previousID:e,dataType:t,data:n}))}async function prependBlock(e,t,n){let r="/api/block/prependBlock";return parseBody(request(r,n={parentID:e,dataType:t,data:n}))}async function appendBlock(e,t,n){let r="/api/block/appendBlock";return parseBody(request(r,n={parentID:e,dataType:t,data:n}))}async function updateBlock(e,t,n){let r="/api/block/updateBlock";return parseBody(request(r,n={id:e,dataType:t,data:n}))}async function deleteBlock(e){return parseBody(request("/api/block/deleteBlock",{id:e}))}async function getSysFonts(){return parseBody(request("/api/system/getSysFonts",null))}async function getFile(e,t="text"){const n=await fetch("/api/file/getFile",{method:"POST",headers:{Authorization:`Token ${config().token}`},body:JSON.stringify({path:e})});if(200===n.status){if("text"===t)return await n.text();if("json"===t)return(await n.json()).data}return null}async function putFile(e,t,n=!1,r=Date.now()){let i=new Blob([t]),o=new File([i],e.split("/").pop()),a=new FormData;a.append("path",e),a.append("file",o),a.append("isDir",String(n)),a.append("modTime",String(r));const s=await fetch("/api/file/putFile",{body:a,method:"POST",headers:{Authorization:`Token ${config().token}`}});return 200===s.status?await s.json():null}async function readDir(e){const t=await fetch("/api/file/readDir",{method:"POST",headers:{Authorization:`Token ${config().token}`},body:JSON.stringify({path:e})});return 200===t.status?(await t.json()).data:null}async function removeFile(e){return 200===(await fetch("/api/file/removeFile",{method:"POST",headers:{Authorization:`Token ${config().token}`},body:JSON.stringify({path:e})})).status?void 0:null}const language=null==(_a=window.theme)?void 0:_a.languageMode;async function pushMsg(e=null,t=null,n=7e3){return parseBody(request("/api/notification/pushMsg",{msg:e?e[language]||e.other:t,timeout:n}))}async function pushErrMsg(e=null,t=null,n=7e3){return parseBody(request("/api/notification/pushErrMsg",{msg:e?e[language]||e.other:t,timeout:n}))}async function setStorageVal(e,t){return parseBody(request("/api/storage/setLocalStorageVal",{app:genUUID(),key:e,val:t}))}async function getLocalStorage(){return parseBody(request("/api/storage/getLocalStorage",null))}const serverApi=Object.freeze(Object.defineProperty({__proto__:null,appendBlock:appendBlock,closeNotebook:closeNotebook,createDocWithMd:createDocWithMd,createNotebook:createNotebook,deleteBlock:deleteBlock,docSaveAsTemplate:docSaveAsTemplate,exportMdContent:exportMdContent,getAnchor:getAnchor,getBacklink:getBacklink,getBlockAttrs:getBlockAttrs,getBlockBreadcrumb:getBlockBreadcrumb,getBlockByID:getBlockByID,getBlockKramdown:getBlockKramdown,getDoc:getDoc,getDocOutline:getDocOutline,getFile:getFile,getFocusedDoc:getFocusedDoc,getGraph:getGraph,getHPathByID:getHPathByID,getHPathByPath:getHPathByPath,getLocalGraph:getLocalGraph,getLocalStorage:getLocalStorage,getNotebookConf:getNotebookConf,getSysFonts:getSysFonts,getTag:getTag,insertBlock:insertBlock,listDocsByPath:listDocsByPath,lsNotebooks:lsNotebooks,moveDoc:moveDoc,openNotebook:openNotebook,parseBody:parseBody,prependBlock:prependBlock,pushErrMsg:pushErrMsg,pushMsg:pushMsg,putFile:putFile,readDir:readDir,removeDoc:removeDoc,removeFile:removeFile,removeNotebook:removeNotebook,renameDoc:renameDoc,renameNotebook:renameNotebook,render:render,request:request,searchBlock:searchBlock,searchDocs:searchDocs,searchEmbedBlock:searchEmbedBlock,searchTemplate:searchTemplate,setBlockAttrs:setBlockAttrs,setNotebookConf:setNotebookConf,setStorageVal:setStorageVal,sql:sql,transactions:transactions,updateBlock:updateBlock},Symbol.toStringTag,{value:"Module"}));function insertBefore(e,t){return e.insertAdjacentElement("beforebegin",t)}function insertAfter(e,t){return e.insertAdjacentElement("afterend",t)}function addToolbarLeft(e){var t;const n=null==(t=document.getElementById("toolbar"))?void 0:t.getElementsByClassName("fn__ellipsis");n&&insertBefore(n[0],e)}function addToolbarRight(e){var t;const n=null==(t=document.getElementById("toolbar"))?void 0:t.getElementsByClassName("fn__ellipsis");n&&insertAfter(n[0],e)}const createLogger=e=>getLogger(e),clientApi=Object.freeze(Object.defineProperty({__proto__:null,addToolbarLeft:addToolbarLeft,addToolbarRight:addToolbarRight,createLogger:createLogger},Symbol.toStringTag,{value:"Module"})),menu=null==(_c=null==(_b=window.siyuan)?void 0:_b.menus)?void 0:_c.menu;class Menu{constructor(e){if(!menu)throw Error("Siyuan internal menu not found!");if(!e)throw Error("Menu must has an id, got empty or undefined!");menu.remove(),menu.element.setAttribute("data-name",e)}addItem(e){return menu.append(e.element),this}addSeparator(){return this.addItem(new MenuItem({type:"separator"})),this}showAtMouseEvent(e){return menu.popup({x:e.clientX,y:e.clientY}),this}showAtPosition(e){return menu.popup({x:e.x,y:e.y}),this}close(){menu.remove()}}class MenuItem{constructor(e){if(this.element=document.createElement("button"),e.disabled&&this.element.setAttribute("disabled","disabled"),"separator"===e.type)return void this.element.classList.add("b3-menu__separator");this.element.classList.add("b3-menu__item"),e.current&&this.element.classList.add("b3-menu__item--selected"),e.click&&this.element.addEventListener("click",(t=>{this.element.getAttribute("disabled")||(e.click(this.element),t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),window.siyuan.menus.menu.remove())}));let t=`${e.label}`;if(t=e.iconHTML?e.iconHTML+t:`${t}`,e.action&&(t+=``),e.id&&this.element.setAttribute("data-id",e.id),"readonly"===e.type&&this.element.classList.add("b3-menu__item--readonly"),this.element.innerHTML=t,e.bind&&(this.element.classList.add("b3-menu__item--custom"),e.bind(this.element)),e.submenu){const t=document.createElement("div");t.classList.add("b3-menu__submenu"),e.submenu.forEach((e=>{t.append(new MenuItem(e).element)})),this.element.insertAdjacentHTML("beforeend",''),this.element.append(t)}}}class Dialog{constructor(e){this.disableClose=e.disableClose,this.id=genUUID(),window.siyuan.dialogs.push(this),this.destroyCallback=e.destroyCallback,this.element=document.createElement("div"),this.element.innerHTML=`
\n
\n
\n \n
${e.title||""}
\n
${e.content}
\n
`,this.element.querySelector(".b3-dialog__scrim").addEventListener("click",(e=>{this.disableClose||this.destroy(),e.preventDefault(),e.stopPropagation(),window.siyuan.menus.menu.remove()})),this.disableClose||this.element.querySelector(".b3-dialog__close").addEventListener("click",(e=>{this.destroy(),e.preventDefault(),e.stopPropagation()})),document.body.append(this.element),e.disableAnimation?this.element.classList.add("b3-dialog--open"):setTimeout((()=>{this.element.classList.add("b3-dialog--open")})),window.siyuan.menus.menu.remove()}static destroyAll(){window.siyuan.dialogs.forEach((e=>e.destroy()))}destroy(){this.element.remove(),window.siyuan.menus.menu.remove(),this.destroyCallback&&this.destroyCallback(),window.siyuan.dialogs.find(((e,t)=>{if(e.id===this.id)return window.siyuan.dialogs.splice(t,1),!0}))}bindInput(e,t){e.focus(),e.addEventListener("keydown",(e=>{if(!e.isComposing)return"Escape"===e.key?(this.destroy(),e.preventDefault(),void e.stopPropagation()):void("Enter"===e.key&&t&&(t(),e.preventDefault()));e.preventDefault()}))}}class Plugin{onload(){}onunload(){}registerCommand(e){}async loadStorage(e){return null}async writeStorage(e,t){}}const api={clientApi:clientApi,serverApi:serverApi,Plugin:Plugin,Menu:Menu,Dialog:Dialog};class Notification{constructor(e){this.option=e}show(){"error"===this.option.type?pushErrMsg(null,this.option.message,this.option.timeout):pushMsg(null,this.option.message,this.option.timeout)}}var z=Object.defineProperty,D=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_$1=(e,t,n)=>(D(e,"symbol"!=typeof t?t+"":t,n),n),P=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},b={},W={get exports(){return b},set exports(e){b=e}},i,e,t2;i=W,e=P,t2=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function i(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch{return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(t,n){for(var i=0;i=0&&n<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(o=n,!1!==i&&function(e){var n=(r[e]||"silent").toUpperCase();if(typeof window!==t&&l){try{return void(window.localStorage[l]=n)}catch{}try{window.document.cookie=encodeURIComponent(l)+"="+n+";"}catch{}}}(n),a.call(s,n,e),typeof console===t&&n(e.LOG_LEVEL_DEBUG="DEBUG",e.LOG_LEVEL_INFO="INFO",e.LOG_LEVEL_WARN="WARN",e.LOG_LEVEL_ERROR="ERROR",e))(S||{});function K(){const e=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const t=(new Error).stack.slice(1);return Error.prepareStackTrace=e,t}class I{static stringToEnumValue(e,t){return e[Object.keys(e).filter((n=>e[n].toString()===t))[0]]}static getEnvLevel(e){if(!e)return;const t=e.getEnvOrDefault(T.LOG_LEVEL_KEY,S.LOG_LEVEL_INFO),n=I.stringToEnumValue(S,t.toUpperCase());return n||console.warn("[zhi-log] LOG_LEVEL is invalid in you .env file.Must be either debug, info, warn or error, fallback to default info level"),n}static getEnvLogger(e){if(e)return e.getEnv(T.LOG_PREFIX_KEY)}}class Y{constructor(e,t,n){let r;_$1(this,"consoleLogger","console"),_$1(this,"stackSize",1),_$1(this,"getLogger",(e=>{let t;if(e)t=e;else{const e=this.getCallStack(),n=[],r=[];for(let t=0;tthis.stackSize-1)break;const o=i+"-"+r.getLineNumber()+":"+r.getColumnNumber();n.push(o)}r.length>0&&(t=n.join(" -> "))}return(!t||0===t.trim().length)&&(t=this.consoleLogger),b.getLogger(t)})),this.stackSize=1,r=e||I.getEnvLevel(n),r=r??S.LOG_LEVEL_INFO,b.setLevel(r);const i=e=>e.toString(),o=e=>e.toString(),a=e=>e.toString(),s=e=>e.toString();R.reg(b),R.apply(b,{format(e,r,c){const l=["["+(t??I.getEnvLogger(n)??"zhi")+"]"];switch(l.push(i("[")+o(c).toString()+i("]")),e){case S.LOG_LEVEL_DEBUG:l.push(i(e.toUpperCase().toString()));break;case S.LOG_LEVEL_INFO:l.push(o(e.toUpperCase().toString()));break;case S.LOG_LEVEL_WARN:l.push(a(e.toUpperCase().toString()));break;case S.LOG_LEVEL_ERROR:l.push(s(e.toUpperCase().toString()))}return l.push(o(r).toString()),l.push(i(":")),l.join(" ")}})}setStackSize(e){this.stackSize=e??1}getCallStack(){let e;try{e=K()}catch{e=[]}return e}}class X{constructor(e,t,n){_$1(this,"logger"),this.logger=new Y(e,t,n)}getLogger(e,t){return this.logger.setStackSize(t),this.logger.getLogger(e)}}class N extends X{constructor(e,t,n){super(e,t,n)}getLogger(e,t){return super.getLogger(e,t)}}class M{static defaultLogger(e,t){return M.customLogFactory(void 0,void 0,e).getLogger(void 0,t)}static customLogFactory(e,t,n){return new N(e,t,n)}static customSignLogFactory(e,t){return new N(void 0,e,t)}}var reExports={},re$3={get exports(){return reExports},set exports(e){reExports=e}};const SEMVER_SPEC_VERSION="2.0.0",MAX_LENGTH$2=256,MAX_SAFE_INTEGER$1=Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH=16;var constants$1={SEMVER_SPEC_VERSION:SEMVER_SPEC_VERSION,MAX_LENGTH:MAX_LENGTH$2,MAX_SAFE_INTEGER:MAX_SAFE_INTEGER$1,MAX_SAFE_COMPONENT_LENGTH:MAX_SAFE_COMPONENT_LENGTH};const debug$1="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var debug_1=debug$1;!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n}=constants$1,r=debug_1,i=(t=e.exports={}).re=[],o=t.src=[],a=t.t={};let s=0;const c=(e,t,n)=>{const c=s++;r(e,c,t),a[e]=c,o[c]=t,i[c]=new RegExp(t,n?"g":void 0)};c("NUMERICIDENTIFIER","0|[1-9]\\d*"),c("NUMERICIDENTIFIERLOOSE","[0-9]+"),c("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),c("MAINVERSION",`(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})`),c("MAINVERSIONLOOSE",`(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})`),c("PRERELEASEIDENTIFIER",`(?:${o[a.NUMERICIDENTIFIER]}|${o[a.NONNUMERICIDENTIFIER]})`),c("PRERELEASEIDENTIFIERLOOSE",`(?:${o[a.NUMERICIDENTIFIERLOOSE]}|${o[a.NONNUMERICIDENTIFIER]})`),c("PRERELEASE",`(?:-(${o[a.PRERELEASEIDENTIFIER]}(?:\\.${o[a.PRERELEASEIDENTIFIER]})*))`),c("PRERELEASELOOSE",`(?:-?(${o[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[a.PRERELEASEIDENTIFIERLOOSE]})*))`),c("BUILDIDENTIFIER","[0-9A-Za-z-]+"),c("BUILD",`(?:\\+(${o[a.BUILDIDENTIFIER]}(?:\\.${o[a.BUILDIDENTIFIER]})*))`),c("FULLPLAIN",`v?${o[a.MAINVERSION]}${o[a.PRERELEASE]}?${o[a.BUILD]}?`),c("FULL",`^${o[a.FULLPLAIN]}$`),c("LOOSEPLAIN",`[v=\\s]*${o[a.MAINVERSIONLOOSE]}${o[a.PRERELEASELOOSE]}?${o[a.BUILD]}?`),c("LOOSE",`^${o[a.LOOSEPLAIN]}$`),c("GTLT","((?:<|>)?=?)"),c("XRANGEIDENTIFIERLOOSE",`${o[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),c("XRANGEIDENTIFIER",`${o[a.NUMERICIDENTIFIER]}|x|X|\\*`),c("XRANGEPLAIN",`[v=\\s]*(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:${o[a.PRERELEASE]})?${o[a.BUILD]}?)?)?`),c("XRANGEPLAINLOOSE",`[v=\\s]*(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:${o[a.PRERELEASELOOSE]})?${o[a.BUILD]}?)?)?`),c("XRANGE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAIN]}$`),c("XRANGELOOSE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAINLOOSE]}$`),c("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),c("COERCERTL",o[a.COERCE],!0),c("LONETILDE","(?:~>?)"),c("TILDETRIM",`(\\s*)${o[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",c("TILDE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAIN]}$`),c("TILDELOOSE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAINLOOSE]}$`),c("LONECARET","(?:\\^)"),c("CARETTRIM",`(\\s*)${o[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",c("CARET",`^${o[a.LONECARET]}${o[a.XRANGEPLAIN]}$`),c("CARETLOOSE",`^${o[a.LONECARET]}${o[a.XRANGEPLAINLOOSE]}$`),c("COMPARATORLOOSE",`^${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]})$|^$`),c("COMPARATOR",`^${o[a.GTLT]}\\s*(${o[a.FULLPLAIN]})$|^$`),c("COMPARATORTRIM",`(\\s*)${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]}|${o[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",c("HYPHENRANGE",`^\\s*(${o[a.XRANGEPLAIN]})\\s+-\\s+(${o[a.XRANGEPLAIN]})\\s*$`),c("HYPHENRANGELOOSE",`^\\s*(${o[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[a.XRANGEPLAINLOOSE]})\\s*$`),c("STAR","(<|>)?=?\\s*\\*"),c("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),c("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(re$3,reExports);const opts=["includePrerelease","loose","rtl"],parseOptions$2=e=>e?"object"!=typeof e?{loose:!0}:opts.filter((t=>e[t])).reduce(((e,t)=>(e[t]=!0,e)),{}):{};var parseOptions_1=parseOptions$2;const numeric=/^[0-9]+$/,compareIdentifiers$1=(e,t)=>{const n=numeric.test(e),r=numeric.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:ecompareIdentifiers$1(t,e);var identifiers$1={compareIdentifiers:compareIdentifiers$1,rcompareIdentifiers:rcompareIdentifiers};const debug=debug_1,{MAX_LENGTH:MAX_LENGTH$1,MAX_SAFE_INTEGER:MAX_SAFE_INTEGER}=constants$1,{re:re$2,t:t$2}=reExports,parseOptions$1=parseOptions_1,{compareIdentifiers:compareIdentifiers}=identifiers$1;let SemVer$d=class e{constructor(t,n){if(n=parseOptions$1(n),t instanceof e){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid Version: ${t}`);if(t.length>MAX_LENGTH$1)throw new TypeError(`version is longer than ${MAX_LENGTH$1} characters`);debug("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?re$2[t$2.LOOSE]:re$2[t$2.FULL]);if(!r)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>MAX_SAFE_INTEGER||this.major<0)throw new TypeError("Invalid major version");if(this.minor>MAX_SAFE_INTEGER||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>MAX_SAFE_INTEGER||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(0===compareIdentifiers(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};var semver$1=SemVer$d;const{MAX_LENGTH:MAX_LENGTH}=constants$1,{re:re$1,t:t$1}=reExports,SemVer$c=semver$1,parseOptions=parseOptions_1,parse$6=(e,t)=>{if(t=parseOptions(t),e instanceof SemVer$c)return e;if("string"!=typeof e)return null;if(e.length>MAX_LENGTH)return null;if(!(t.loose?re$1[t$1.LOOSE]:re$1[t$1.FULL]).test(e))return null;try{return new SemVer$c(e,t)}catch(n){return null}};var parse_1=parse$6;const parse$5=parse_1,valid$2=(e,t)=>{const n=parse$5(e,t);return n?n.version:null};var valid_1=valid$2;const parse$4=parse_1,clean$1=(e,t)=>{const n=parse$4(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null};var clean_1=clean$1;const SemVer$b=semver$1,inc$1=(e,t,n,r)=>{"string"==typeof n&&(r=n,n=void 0);try{return new SemVer$b(e instanceof SemVer$b?e.version:e,n).inc(t,r).version}catch(i){return null}};var inc_1=inc$1;const SemVer$a=semver$1,compare$b=(e,t,n)=>new SemVer$a(e,n).compare(new SemVer$a(t,n));var compare_1=compare$b;const compare$a=compare_1,eq$3=(e,t,n)=>0===compare$a(e,t,n);var eq_1=eq$3;const parse$3=parse_1,eq$2=eq_1,diff$1=(e,t)=>{if(eq$2(e,t))return null;{const n=parse$3(e),r=parse$3(t),i=n.prerelease.length||r.prerelease.length,o=i?"pre":"",a=i?"prerelease":"";for(const e in n)if(("major"===e||"minor"===e||"patch"===e)&&n[e]!==r[e])return o+e;return a}};var diff_1=diff$1;const SemVer$9=semver$1,major$1=(e,t)=>new SemVer$9(e,t).major;var major_1=major$1;const SemVer$8=semver$1,minor$1=(e,t)=>new SemVer$8(e,t).minor;var minor_1=minor$1;const SemVer$7=semver$1,patch$1=(e,t)=>new SemVer$7(e,t).patch;var patch_1=patch$1;const parse$2=parse_1,prerelease$1=(e,t)=>{const n=parse$2(e,t);return n&&n.prerelease.length?n.prerelease:null};var prerelease_1=prerelease$1;const compare$9=compare_1,rcompare$1=(e,t,n)=>compare$9(t,e,n);var rcompare_1=rcompare$1;const compare$8=compare_1,compareLoose$1=(e,t)=>compare$8(e,t,!0);var compareLoose_1=compareLoose$1;const SemVer$6=semver$1,compareBuild$3=(e,t,n)=>{const r=new SemVer$6(e,n),i=new SemVer$6(t,n);return r.compare(i)||r.compareBuild(i)};var compareBuild_1=compareBuild$3;const compareBuild$2=compareBuild_1,sort$1=(e,t)=>e.sort(((e,n)=>compareBuild$2(e,n,t)));var sort_1=sort$1;const compareBuild$1=compareBuild_1,rsort$1=(e,t)=>e.sort(((e,n)=>compareBuild$1(n,e,t)));var rsort_1=rsort$1;const compare$7=compare_1,gt$4=(e,t,n)=>compare$7(e,t,n)>0;var gt_1=gt$4;const compare$6=compare_1,lt$3=(e,t,n)=>compare$6(e,t,n)<0;var lt_1=lt$3;const compare$5=compare_1,neq$2=(e,t,n)=>0!==compare$5(e,t,n);var neq_1=neq$2;const compare$4=compare_1,gte$3=(e,t,n)=>compare$4(e,t,n)>=0;var gte_1=gte$3;const compare$3=compare_1,lte$3=(e,t,n)=>compare$3(e,t,n)<=0;var lte_1=lte$3;const eq$1=eq_1,neq$1=neq_1,gt$3=gt_1,gte$2=gte_1,lt$2=lt_1,lte$2=lte_1,cmp$1=(e,t,n,r)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return eq$1(e,n,r);case"!=":return neq$1(e,n,r);case">":return gt$3(e,n,r);case">=":return gte$2(e,n,r);case"<":return lt$2(e,n,r);case"<=":return lte$2(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};var cmp_1=cmp$1;const SemVer$5=semver$1,parse$1=parse_1,{re:re,t:t}=reExports,coerce$1=(e,n)=>{if(e instanceof SemVer$5)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((n=n||{}).rtl){let n;for(;(n=re[t.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&n.index+n[0].length===r.index+r[0].length||(r=n),re[t.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;re[t.COERCERTL].lastIndex=-1}else r=e.match(re[t.COERCE]);return null===r?null:parse$1(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,n)};var coerce_1=coerce$1,iterator,hasRequiredIterator,yallist,hasRequiredYallist,lruCache,hasRequiredLruCache,range,hasRequiredRange,comparator,hasRequiredComparator;function requireIterator(){return hasRequiredIterator?iterator:(hasRequiredIterator=1,iterator=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}})}function requireYallist(){if(hasRequiredYallist)return yallist;function e(t){var n=this;if(n instanceof e||(n=new e),n.tail=null,n.head=null,n.length=0,t&&"function"==typeof t.forEach)t.forEach((function(e){n.push(e)}));else if(arguments.length>0)for(var r=0,i=arguments.length;r1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},e.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},e.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},e.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},e.prototype.slice=function(t,n){(n=n||this.length)<0&&(n+=this.length),(t=t||0)<0&&(t+=this.length);var r=new e;if(nthis.length&&(n=this.length);for(var i=0,o=this.head;null!==o&&ithis.length&&(n=this.length);for(var i=this.length,o=this.tail;null!==o&&i>n;i--)o=o.prev;for(;null!==o&&i>t;i--,o=o.prev)r.push(o.value);return r},e.prototype.splice=function(e,n,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,o=this.head;null!==o&&i1;const d=(e,t,n)=>{const r=e[l].get(t);if(r){const t=r.value;if(h(e,t)){if(g(e,r),!e[i])return}else n&&(e[u]&&(r.value.now=Date.now()),e[c].unshiftNode(r));return t.value}},h=(e,t)=>{if(!t||!t.maxAge&&!e[o])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[o]&&n>e[o]},f=e=>{if(e[n]>e[t])for(let r=e[c].tail;e[n]>e[t]&&null!==r;){const t=r.prev;g(e,r),r=t}},g=(e,t)=>{if(t){const r=t.value;e[a]&&e[a](r.key,r.value),e[n]-=r.length,e[l].delete(r.key),e[c].removeNode(t)}};class m{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const _=(e,t,n,r)=>{let o=n.value;h(e,o)&&(g(e,n),e[i]||(o=void 0)),o&&t.call(r,o.value,o.key,e)};return lruCache=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[t]=e.max||1/0;const n=e.length||p;if(this[r]="function"!=typeof n?p:n,this[i]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[o]=e.maxAge||0,this[a]=e.dispose,this[s]=e.noDisposeOnSet||!1,this[u]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[t]=e||1/0,f(this)}get max(){return this[t]}set allowStale(e){this[i]=!!e}get allowStale(){return this[i]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[o]=e,f(this)}get maxAge(){return this[o]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[r]&&(this[r]=e,this[n]=0,this[c].forEach((e=>{e.length=this[r](e.value,e.key),this[n]+=e.length}))),f(this)}get lengthCalculator(){return this[r]}get length(){return this[n]}get itemCount(){return this[c].length}rforEach(e,t){t=t||this;for(let n=this[c].tail;null!==n;){const r=n.prev;_(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[c].head;null!==n;){const r=n.next;_(this,e,n,t),n=r}}keys(){return this[c].toArray().map((e=>e.key))}values(){return this[c].toArray().map((e=>e.value))}reset(){this[a]&&this[c]&&this[c].length&&this[c].forEach((e=>this[a](e.key,e.value))),this[l]=new Map,this[c]=new e,this[n]=0}dump(){return this[c].map((e=>!h(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[c]}set(e,i,u){if((u=u||this[o])&&"number"!=typeof u)throw new TypeError("maxAge must be a number");const p=u?Date.now():0,d=this[r](i,e);if(this[l].has(e)){if(d>this[t])return g(this,this[l].get(e)),!1;const r=this[l].get(e).value;return this[a]&&(this[s]||this[a](e,r.value)),r.now=p,r.maxAge=u,r.value=i,this[n]+=d-r.length,r.length=d,this.get(e),f(this),!0}const h=new m(e,i,d,p,u);return h.length>this[t]?(this[a]&&this[a](e,i),!1):(this[n]+=h.length,this[c].unshift(h),this[l].set(e,this[c].head),f(this),!0)}has(e){if(!this[l].has(e))return!1;const t=this[l].get(e).value;return!h(this,t)}get(e){return d(this,e,!0)}peek(e){return d(this,e,!1)}pop(){const e=this[c].tail;return e?(g(this,e),e.value):null}del(e){g(this,this[l].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[l].forEach(((e,t)=>d(this,t,!1)))}}}function requireRange(){if(hasRequiredRange)return range;hasRequiredRange=1;class e{constructor(t,i){if(i=n(i),t instanceof e)return t.loose===!!i.loose&&t.includePrerelease===!!i.includePrerelease?t:new e(t.raw,i);if(t instanceof r)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=t,this.set=t.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${t}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const t of this.set)if(1===t.length&&d(t[0])){this.set=[t];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const n=`parseRange:${Object.keys(this.options).join(",")}:${e}`,o=t.get(n);if(o)return o;const d=this.options.loose,h=d?a[s.HYPHENRANGELOOSE]:a[s.HYPHENRANGE];e=e.replace(h,A(this.options.includePrerelease)),i("hyphen replace",e),e=e.replace(a[s.COMPARATORTRIM],c),i("comparator trim",e);let g=(e=(e=(e=e.replace(a[s.TILDETRIM],l)).replace(a[s.CARETTRIM],u)).split(/\s+/).join(" ")).split(" ").map((e=>f(e,this.options))).join(" ").split(/\s+/).map((e=>S(e,this.options)));d&&(g=g.filter((e=>(i("loose invalid filter",e,this.options),!!e.match(a[s.COMPARATORLOOSE]))))),i("range list",g);const m=new Map,_=g.map((e=>new r(e,this.options)));for(const t of _){if(p(t))return[t];m.set(t.value,t)}m.size>1&&m.has("")&&m.delete("");const y=[...m.values()];return t.set(n,y),y}intersects(t,n){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some((e=>h(e,n)&&t.set.some((t=>h(t,n)&&e.every((e=>t.every((t=>e.intersects(t,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new o(e,this.options)}catch(t){return!1}for(let n=0;n"<0.0.0-0"===e.value,d=e=>""===e.value,h=(e,t)=>{let n=!0;const r=e.slice();let i=r.pop();for(;n&&r.length;)n=r.every((e=>i.intersects(e,t))),i=r.pop();return n},f=(e,t)=>(i("comp",e,t),e=y(e,t),i("caret",e),e=m(e,t),i("tildes",e),e=b(e,t),i("xrange",e),e=E(e,t),i("stars",e),e),g=e=>!e||"x"===e.toLowerCase()||"*"===e,m=(e,t)=>e.trim().split(/\s+/).map((e=>_(e,t))).join(" "),_=(e,t)=>{const n=t.loose?a[s.TILDELOOSE]:a[s.TILDE];return e.replace(n,((t,n,r,o,a)=>{let s;return i("tilde",e,t,n,r,o,a),g(n)?s="":g(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:g(o)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(i("replaceTilde pr",a),s=`>=${n}.${r}.${o}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${o} <${n}.${+r+1}.0-0`,i("tilde return",s),s}))},y=(e,t)=>e.trim().split(/\s+/).map((e=>v(e,t))).join(" "),v=(e,t)=>{i("caret",e,t);const n=t.loose?a[s.CARETLOOSE]:a[s.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,((t,n,o,a,s)=>{let c;return i("caret",e,t,n,o,a,s),g(n)?c="":g(o)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:g(a)?c="0"===n?`>=${n}.${o}.0${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.0${r} <${+n+1}.0.0-0`:s?(i("replaceCaret pr",s),c="0"===n?"0"===o?`>=${n}.${o}.${a}-${s} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}-${s} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a}-${s} <${+n+1}.0.0-0`):(i("no pr"),c="0"===n?"0"===o?`>=${n}.${o}.${a}${r} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a} <${+n+1}.0.0-0`),i("caret return",c),c}))},b=(e,t)=>(i("replaceXRanges",e,t),e.split(/\s+/).map((e=>w(e,t))).join(" ")),w=(e,t)=>{e=e.trim();const n=t.loose?a[s.XRANGELOOSE]:a[s.XRANGE];return e.replace(n,((n,r,o,a,s,c)=>{i("xRange",e,n,r,o,a,s,c);const l=g(o),u=l||g(a),p=u||g(s),d=p;return"="===r&&d&&(r=""),c=t.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&d?(u&&(a=0),s=0,">"===r?(r=">=",u?(o=+o+1,a=0,s=0):(a=+a+1,s=0)):"<="===r&&(r="<",u?o=+o+1:a=+a+1),"<"===r&&(c="-0"),n=`${r+o}.${a}.${s}${c}`):u?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:p&&(n=`>=${o}.${a}.0${c} <${o}.${+a+1}.0-0`),i("xRange return",n),n}))},E=(e,t)=>(i("replaceStars",e,t),e.trim().replace(a[s.STAR],"")),S=(e,t)=>(i("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?s.GTE0PRE:s.GTE0],"")),A=e=>(t,n,r,i,o,a,s,c,l,u,p,d,h)=>`${n=g(r)?"":g(i)?`>=${r}.0.0${e?"-0":""}`:g(o)?`>=${r}.${i}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${c=g(l)?"":g(u)?`<${+l+1}.0.0-0`:g(p)?`<${l}.${+u+1}.0-0`:d?`<=${l}.${u}.${p}-${d}`:e?`<${l}.${u}.${+p+1}-0`:`<=${c}`}`.trim(),$=(e,t,n)=>{for(let r=0;r0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return range}function requireComparator(){if(hasRequiredComparator)return comparator;hasRequiredComparator=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(r.loose===!!i.loose)return r;r=r.value}a("comparator",r,i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],o=t.match(n);if(!o)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new s(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new s(t,this.options)}catch(n){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");if(n&&"object"==typeof n||(n={loose:!!n,includePrerelease:!1}),""===this.operator)return""===this.value||new c(e.value,n).test(this.value);if(""===e.operator)return""===e.value||new c(this.value,n).test(e.semver);const r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),a=this.semver.version===e.semver.version,s=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),l=o(this.semver,"<",e.semver,n)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),u=o(this.semver,">",e.semver,n)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||i||a&&s||l||u}}comparator=t;const n=parseOptions_1,{re:r,t:i}=reExports,o=cmp_1,a=debug_1,s=semver$1,c=requireRange();return comparator}const Range$9=requireRange(),satisfies$4=(e,t,n)=>{try{t=new Range$9(t,n)}catch(r){return!1}return t.test(e)};var satisfies_1=satisfies$4;const Range$8=requireRange(),toComparators$1=(e,t)=>new Range$8(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));var toComparators_1=toComparators$1;const SemVer$4=semver$1,Range$7=requireRange(),maxSatisfying$1=(e,t,n)=>{let r=null,i=null,o=null;try{o=new Range$7(t,n)}catch(a){return null}return e.forEach((e=>{o.test(e)&&(r&&-1!==i.compare(e)||(r=e,i=new SemVer$4(r,n)))})),r};var maxSatisfying_1=maxSatisfying$1;const SemVer$3=semver$1,Range$6=requireRange(),minSatisfying$1=(e,t,n)=>{let r=null,i=null,o=null;try{o=new Range$6(t,n)}catch(a){return null}return e.forEach((e=>{o.test(e)&&(r&&1!==i.compare(e)||(r=e,i=new SemVer$3(r,n)))})),r};var minSatisfying_1=minSatisfying$1;const SemVer$2=semver$1,Range$5=requireRange(),gt$2=gt_1,minVersion$1=(e,t)=>{e=new Range$5(e,t);let n=new SemVer$2("0.0.0");if(e.test(n))return n;if(n=new SemVer$2("0.0.0-0"),e.test(n))return n;n=null;for(let r=0;r{const t=new SemVer$2(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":i&&!gt$2(t,i)||(i=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!i||n&&!gt$2(n,i)||(n=i)}return n&&e.test(n)?n:null};var minVersion_1=minVersion$1;const Range$4=requireRange(),validRange$1=(e,t)=>{try{return new Range$4(e,t).range||"*"}catch(n){return null}};var valid$1=validRange$1;const SemVer$1=semver$1,Comparator$2=requireComparator(),{ANY:ANY$1}=Comparator$2,Range$3=requireRange(),satisfies$3=satisfies_1,gt$1=gt_1,lt$1=lt_1,lte$1=lte_1,gte$1=gte_1,outside$3=(e,t,n,r)=>{let i,o,a,s,c;switch(e=new SemVer$1(e,r),t=new Range$3(t,r),n){case">":i=gt$1,o=lte$1,a=lt$1,s=">",c=">=";break;case"<":i=lt$1,o=gte$1,a=gt$1,s="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies$3(e,t,r))return!1;for(let l=0;l{e.semver===ANY$1&&(e=new Comparator$2(">=0.0.0")),u=u||e,p=p||e,i(e.semver,u.semver,r)?u=e:a(e.semver,p.semver,r)&&(p=e)})),u.operator===s||u.operator===c)return!1;if((!p.operator||p.operator===s)&&o(e,p.semver))return!1;if(p.operator===c&&a(e,p.semver))return!1}return!0};var outside_1=outside$3;const outside$2=outside_1,gtr$1=(e,t,n)=>outside$2(e,t,">",n);var gtr_1=gtr$1;const outside$1=outside_1,ltr$1=(e,t,n)=>outside$1(e,t,"<",n);var ltr_1=ltr$1;const Range$2=requireRange(),intersects$1=(e,t,n)=>(e=new Range$2(e,n),t=new Range$2(t,n),e.intersects(t));var intersects_1=intersects$1;const satisfies$2=satisfies_1,compare$2=compare_1;var simplify=(e,t,n)=>{const r=[];let i=null,o=null;const a=e.sort(((e,t)=>compare$2(e,t,n)));for(const u of a){satisfies$2(u,t,n)?(o=u,i||(i=u)):(o&&r.push([i,o]),o=null,i=null)}i&&r.push([i,null]);const s=[];for(const[u,p]of r)u===p?s.push(u):p||u!==a[0]?p?u===a[0]?s.push(`<=${p}`):s.push(`${u} - ${p}`):s.push(`>=${u}`):s.push("*");const c=s.join(" || "),l="string"==typeof t.raw?t.raw:String(t);return c.length{if(e===t)return!0;e=new Range$1(e,n),t=new Range$1(t,n);let r=!1;e:for(const i of e.set){for(const e of t.set){const t=simpleSubset(i,e,n);if(r=r||null!==t,t)continue e}if(r)return!1}return!0},simpleSubset=(e,t,n)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===ANY){if(1===t.length&&t[0].semver===ANY)return!0;e=n.includePrerelease?[new Comparator$1(">=0.0.0-0")]:[new Comparator$1(">=0.0.0")]}if(1===t.length&&t[0].semver===ANY){if(n.includePrerelease)return!0;t=[new Comparator$1(">=0.0.0")]}const r=new Set;let i,o,a,s,c,l,u;for(const h of e)">"===h.operator||">="===h.operator?i=higherGT(i,h,n):"<"===h.operator||"<="===h.operator?o=lowerLT(o,h,n):r.add(h.semver);if(r.size>1)return null;if(i&&o){if(a=compare$1(i.semver,o.semver,n),a>0)return null;if(0===a&&(">="!==i.operator||"<="!==o.operator))return null}for(const h of r){if(i&&!satisfies$1(h,String(i),n))return null;if(o&&!satisfies$1(h,String(o),n))return null;for(const e of t)if(!satisfies$1(h,String(e),n))return!1;return!0}let p=!(!o||n.includePrerelease||!o.semver.prerelease.length)&&o.semver,d=!(!i||n.includePrerelease||!i.semver.prerelease.length)&&i.semver;p&&1===p.prerelease.length&&"<"===o.operator&&0===p.prerelease[0]&&(p=!1);for(const h of t){if(u=u||">"===h.operator||">="===h.operator,l=l||"<"===h.operator||"<="===h.operator,i)if(d&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===d.major&&h.semver.minor===d.minor&&h.semver.patch===d.patch&&(d=!1),">"===h.operator||">="===h.operator){if(s=higherGT(i,h,n),s===h&&s!==i)return!1}else if(">="===i.operator&&!satisfies$1(i.semver,String(h),n))return!1;if(o)if(p&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===p.major&&h.semver.minor===p.minor&&h.semver.patch===p.patch&&(p=!1),"<"===h.operator||"<="===h.operator){if(c=lowerLT(o,h,n),c===h&&c!==o)return!1}else if("<="===o.operator&&!satisfies$1(o.semver,String(h),n))return!1;if(!h.operator&&(o||i)&&0!==a)return!1}return!(i&&l&&!o&&0!==a)&&(!(o&&u&&!i&&0!==a)&&(!d&&!p))},higherGT=(e,t,n)=>{if(!e)return t;const r=compare$1(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},lowerLT=(e,t,n)=>{if(!e)return t;const r=compare$1(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};var subset_1=subset$1;const internalRe=reExports,constants=constants$1,SemVer=semver$1,identifiers=identifiers$1,parse=parse_1,valid=valid_1,clean=clean_1,inc=inc_1,diff=diff_1,major=major_1,minor=minor_1,patch=patch_1,prerelease=prerelease_1,compare=compare_1,rcompare=rcompare_1,compareLoose=compareLoose_1,compareBuild=compareBuild_1,sort=sort_1,rsort=rsort_1,gt=gt_1,lt=lt_1,eq=eq_1,neq=neq_1,gte=gte_1,lte=lte_1,cmp=cmp_1,coerce=coerce_1,Comparator=requireComparator(),Range=requireRange(),satisfies=satisfies_1,toComparators=toComparators_1,maxSatisfying=maxSatisfying_1,minSatisfying=minSatisfying_1,minVersion=minVersion_1,validRange=valid$1,outside=outside_1,gtr=gtr_1,ltr=ltr_1,intersects=intersects_1,simplifyRange=simplify,subset=subset_1;var semver={parse:parse,valid:valid,clean:clean,inc:inc,diff:diff,major:major,minor:minor,patch:patch,prerelease:prerelease,compare:compare,rcompare:rcompare,compareLoose:compareLoose,compareBuild:compareBuild,sort:sort,rsort:rsort,gt:gt,lt:lt,eq:eq,neq:neq,gte:gte,lte:lte,cmp:cmp,coerce:coerce,Comparator:Comparator,Range:Range,satisfies:satisfies,toComparators:toComparators,maxSatisfying:maxSatisfying,minSatisfying:minSatisfying,minVersion:minVersion,validRange:validRange,outside:outside,gtr:gtr,ltr:ltr,intersects:intersects,simplifyRange:simplifyRange,subset:subset,SemVer:SemVer,re:internalRe.re,src:internalRe.src,tokens:internalRe.t,SEMVER_SPEC_VERSION:constants.SEMVER_SPEC_VERSION,compareIdentifiers:identifiers.compareIdentifiers,rcompareIdentifiers:identifiers.rcompareIdentifiers};class FileClient{constructor(){this.electronApi={readDir(e){const t=window.require("fs"),n=window.require("path"),r=n.join(window.siyuan.config.system.dataDir,"..");return new Promise((i=>{t.readdir(n.join(r,e),((o,a)=>{if(o)return void i([]);const s=a.map((i=>({isDir:t.statSync(n.join(r,e,i)).isDirectory(),name:i})));i(s)}))}))},getFile:(t,n="text")=>new Promise(((r,i)=>{const o=window.require("fs"),a=window.require("path"),s=a.join(window.siyuan.config.system.dataDir,"..");o.readFile(a.join(s,t),((t,o)=>{if(t)return i(t);const a=o.toString("utf8");if("json"===n)try{return r(JSON.parse(a))}catch(e){return void i(e)}return r(a)}))})),putFile:putFile,removeFile:e=>new Promise(((t,n)=>{const r=window.require("fs"),i=window.require("path"),o=i.join(window.siyuan.config.system.dataDir,".."),a=i.join(o,e);log("Remove files from",a),r.rm(a,{recursive:!0,force:!0},(e=>{if(e)return n(e);t(null)}))}))},this.serverApi={readDir:readDir,getFile:getFile,putFile:putFile,removeFile:removeFile};const t=this.getVersion();semver.compare(t,"2.8.1")<0?this.fileApi=this.electronApi:this.fileApi=this.serverApi}getVersion(){return window.siyuan.config.system.kernelVersion}static getInstanceApi(){return this.fileClient||(this.fileClient=new FileClient),this.fileClient}}const author$1="作者",version$1="版本",description$1="描述",goBack$1="返回",url$1="地址",readme$1="README",loading$1="加载中",downloading$1="下载中",downloaded$1="已下载",download$1="下载",upgrade$1="升级",nodescription$1="无描述内容",safemode$1="安全模式",safemodetip$1="关闭安全模式允许第三方插件加载",autoupgrade$1="自动更新",autoupgradetip$1="从固定位置获取版本并更新本地存储的插件系统脚本",store_url$1="插件商店地址",store_url_tip$1="线上插件系统仓库地址, 默认为",menu_common$1="通用配置",menu_list$1="插件列表",menu_store$1="插件商店",plugin_system$1="插件系统",plugin_system_setting$1="插件系统设置",reload$1="重载",show_plugin_system_config$1="显示插件系统配置",reload_window$1="重载当前窗口",shortcut$1="快捷键",show_command_panel$1="显示控制面板",uninstall$1="卸载",zh_CN={author:author$1,version:version$1,description:description$1,goBack:goBack$1,url:url$1,readme:readme$1,loading:loading$1,downloading:downloading$1,downloaded:downloaded$1,download:download$1,upgrade:upgrade$1,nodescription:nodescription$1,safemode:safemode$1,safemodetip:safemodetip$1,autoupgrade:autoupgrade$1,autoupgradetip:autoupgradetip$1,store_url:store_url$1,store_url_tip:store_url_tip$1,menu_common:menu_common$1,menu_list:menu_list$1,menu_store:menu_store$1,plugin_system:plugin_system$1,plugin_system_setting:plugin_system_setting$1,reload:reload$1,show_plugin_system_config:show_plugin_system_config$1,reload_window:reload_window$1,shortcut:shortcut$1,show_command_panel:show_command_panel$1,uninstall:uninstall$1},author="Author",version="Version",description="Description",goBack="Go Back",url="URL",readme="README",loading="Loading",downloading="Downloading",downloaded="Downloaded",download="Download",upgrade="Upgrade",nodescription="No Description content",safemode="Safe Mode",safemodetip="Turn off safe mode to enable third party plugins.",autoupgrade="Auto Upgrade",autoupgradetip="Auto upgrade plugin system online.",store_url="Plugin Store URL",store_url_tip="Plugin Store URL, default is",menu_common="Common Setting",menu_list="Plugins",menu_store="Store",plugin_system="Plugin System",plugin_system_setting="Plugin System Setting",reload="Reload",show_plugin_system_config="Show plugin system config",reload_window="Reload current window",shortcut="Shortcut",show_command_panel="Show command panel",uninstall="Uninstall",en_US={author:author,version:version,description:description,goBack:goBack,url:url,readme:readme,loading:loading,downloading:downloading,downloaded:downloaded,download:download,upgrade:upgrade,nodescription:nodescription,safemode:safemode,safemodetip:safemodetip,autoupgrade:autoupgrade,autoupgradetip:autoupgradetip,store_url:store_url,store_url_tip:store_url_tip,menu_common:menu_common,menu_list:menu_list,menu_store:menu_store,plugin_system:plugin_system,plugin_system_setting:plugin_system_setting,reload:reload,show_plugin_system_config:show_plugin_system_config,reload_window:reload_window,shortcut:shortcut,show_command_panel:show_command_panel,uninstall:uninstall},factory=M.customLogFactory(S.LOG_LEVEL_INFO,"PluginSystem"),pluginSystemLogger=factory.getLogger("plugin system"),log=(...e)=>{pluginSystemLogger.info(...e)},sleep=async e=>new Promise((t=>{setTimeout((()=>t(null)),e)})),error=(...e)=>pluginSystemLogger.error(...e),reloadWindow=()=>window.location.reload(),genUUID=()=>([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(parseInt(e,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(e,10)/4).toString(16)));async function isExists(e){try{return null!==await FileClient.getInstanceApi().fileApi.getFile(e)}catch{return!1}}let Error$1=class{constructor(e){this.message=e}};class Warning{constructor(e){this.message=e}}const showInfoMessage=(e,t)=>new Notification({type:"info",message:e,timeout:t}).show(),showErrorMessage=(e,t)=>new Notification({type:"error",message:e,timeout:t}).show(),getLogger=e=>factory.getLogger(e),langs={zh_CN:zh_CN,en_US:en_US},currentLang=window.siyuan.config.lang,lang=langs[currentLang]||en_US,_=e=>lang[e]||"not defined";var NAMED_TAG="named",NAME_TAG="name",UNMANAGED_TAG="unmanaged",OPTIONAL_TAG="optional",INJECT_TAG="inject",MULTI_INJECT_TAG="multi_inject",TAGGED="inversify:tagged",TAGGED_PROP="inversify:tagged_props",PARAM_TYPES="inversify:paramtypes",DESIGN_PARAM_TYPES="design:paramtypes",POST_CONSTRUCT="post_construct",PRE_DESTROY="pre_destroy";function getNonCustomTagKeys(){return[INJECT_TAG,MULTI_INJECT_TAG,NAME_TAG,UNMANAGED_TAG,NAMED_TAG,OPTIONAL_TAG]}var NON_CUSTOM_TAG_KEYS=getNonCustomTagKeys(),BindingScopeEnum={Request:"Request",Singleton:"Singleton",Transient:"Transient"},BindingTypeEnum={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"},TargetTypeEnum={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"},idCounter=0;function id(){return idCounter++}var Binding=function(){function e(e,t){this.id=id(),this.activated=!1,this.serviceIdentifier=e,this.scope=t,this.type=BindingTypeEnum.Invalid,this.constraint=function(e){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.onDeactivation=null,this.dynamicValue=null}return e.prototype.clone=function(){var t=new e(this.serviceIdentifier,this.scope);return t.activated=t.scope===BindingScopeEnum.Singleton&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.factory=this.factory,t.provider=this.provider,t.constraint=this.constraint,t.onActivation=this.onActivation,t.onDeactivation=this.onDeactivation,t.cache=this.cache,t},e}(),DUPLICATED_INJECTABLE_DECORATOR="Cannot apply @injectable decorator multiple times.",DUPLICATED_METADATA="Metadata key was used more than once in a parameter:",NULL_ARGUMENT="NULL argument",KEY_NOT_FOUND="Key Not Found",AMBIGUOUS_MATCH="Ambiguous match found for serviceIdentifier:",CANNOT_UNBIND="Could not unbind serviceIdentifier:",NOT_REGISTERED="No matching bindings found for serviceIdentifier:",MISSING_INJECTABLE_ANNOTATION="Missing required @injectable annotation in:",MISSING_INJECT_ANNOTATION="Missing required @inject or @multiInject annotation in:",UNDEFINED_INJECT_ANNOTATION=function(e){return"@inject called with undefined this could mean that the class "+e+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."},CIRCULAR_DEPENDENCY="Circular dependency found:",INVALID_BINDING_TYPE="Invalid binding type:",NO_MORE_SNAPSHOTS_AVAILABLE="No snapshot available to restore.",INVALID_MIDDLEWARE_RETURN="Invalid return type in middleware. Middleware must return!",INVALID_FUNCTION_BINDING="Value provided to function binding must be a function!",LAZY_IN_SYNC=function(e){return"You are attempting to construct '"+e+"' in a synchronous way\n but it has asynchronous dependencies."},INVALID_TO_SELF_VALUE="The toSelf function can only be applied when a constructor is used as service identifier",INVALID_DECORATOR_OPERATION="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.",ARGUMENTS_LENGTH_MISMATCH=function(){for(var e=[],t=0;t= than the number of constructor arguments of its base class."},CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.",CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE="Invalid Container option. Default scope must be a string ('singleton' or 'transient').",CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean",CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean",ASYNC_UNBIND_REQUIRED="Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)",POST_CONSTRUCT_ERROR=function(e,t){return"@postConstruct error in class "+e+": "+t},PRE_DESTROY_ERROR=function(e,t){return"@preDestroy error in class "+e+": "+t},ON_DEACTIVATION_ERROR=function(e,t){return"onDeactivation() error in class "+e+": "+t},CIRCULAR_DEPENDENCY_IN_FACTORY=function(e,t){return"It looks like there is a circular dependency in one of the '"+e+"' bindings. Please investigate bindings withservice identifier '"+t+"'."},STACK_OVERFLOW="Maximum call stack size exceeded",MetadataReader=function(){function e(){}return e.prototype.getConstructorMetadata=function(e){return{compilerGeneratedMetadata:Reflect.getMetadata(PARAM_TYPES,e),userGeneratedMetadata:Reflect.getMetadata(TAGGED,e)||{}}},e.prototype.getPropertiesMetadata=function(e){return Reflect.getMetadata(TAGGED_PROP,e)||[]},e}(),BindingCount={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function isStackOverflowExeption(e){return e instanceof RangeError||e.message===STACK_OVERFLOW}var tryAndThrowErrorIfStackOverflow=function(e,t){try{return e()}catch(n){throw isStackOverflowExeption(n)&&(n=t()),n}};function getServiceIdentifierAsString(e){return"function"==typeof e?e.name:"symbol"==typeof e?e.toString():e}function listRegisteredBindingsForServiceIdentifier(e,t,n){var r="",i=n(e,t);return 0!==i.length&&(r="\nRegistered bindings:",i.forEach((function(e){var t="Object";null!==e.implementationType&&(t=getFunctionName(e.implementationType)),r=r+"\n "+t,e.constraint.metaData&&(r=r+" - "+e.constraint.metaData)}))),r}function alreadyDependencyChain(e,t){return null!==e.parentRequest&&(e.parentRequest.serviceIdentifier===t||alreadyDependencyChain(e.parentRequest,t))}function dependencyChainToString(e){var t=function e(t,n){void 0===n&&(n=[]);var r=getServiceIdentifierAsString(t.serviceIdentifier);return n.push(r),null!==t.parentRequest?e(t.parentRequest,n):n}(e);return t.reverse().join(" --\x3e ")}function circularDependencyToException(e){e.childRequests.forEach((function(e){if(alreadyDependencyChain(e,e.serviceIdentifier)){var t=dependencyChainToString(e);throw new Error(CIRCULAR_DEPENDENCY+" "+t)}circularDependencyToException(e)}))}function listMetadataForTarget(e,t){if(t.isTagged()||t.isNamed()){var n="",r=t.getNamedTag(),i=t.getCustomTags();return null!==r&&(n+=r.toString()+"\n"),null!==i&&i.forEach((function(e){n+=e.toString()+"\n"}))," "+e+"\n "+e+" - "+n}return" "+e}function getFunctionName(e){if(e.name)return e.name;var t=e.toString(),n=t.match(/^function\s*([^\s(]+)/);return n?n[1]:"Anonymous function: "+t}function getSymbolDescription(e){return e.toString().slice(7,-1)}var Context=function(){function e(e){this.id=id(),this.container=e}return e.prototype.addPlan=function(e){this.plan=e},e.prototype.setCurrentRequest=function(e){this.currentRequest=e},e}(),Metadata=function(){function e(e,t){this.key=e,this.value=t}return e.prototype.toString=function(){return this.key===NAMED_TAG?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},e}(),Plan=function(e,t){this.parentContext=e,this.rootRequest=t},LazyServiceIdentifer=function(){function e(e){this._cb=e}return e.prototype.unwrap=function(){return this._cb()},e}(),QueryableString=function(){function e(e){this.str=e}return e.prototype.startsWith=function(e){return 0===this.str.indexOf(e)},e.prototype.endsWith=function(e){var t,n=e.split("").reverse().join("");return t=this.str.split("").reverse().join(""),this.startsWith.call({str:t},n)},e.prototype.contains=function(e){return-1!==this.str.indexOf(e)},e.prototype.equals=function(e){return this.str===e},e.prototype.value=function(){return this.str},e}(),Target=function(){function e(e,t,n,r){this.id=id(),this.type=e,this.serviceIdentifier=n;var i="symbol"==typeof t?getSymbolDescription(t):t;this.name=new QueryableString(i||""),this.identifier=t,this.metadata=new Array;var o=null;"string"==typeof r?o=new Metadata(NAMED_TAG,r):r instanceof Metadata&&(o=r),null!==o&&this.metadata.push(o)}return e.prototype.hasTag=function(e){for(var t=0,n=this.metadata;t0,l=s.length>n.length,u=getConstructorArgsAsTargets(r,t,o,a,c||l?s.length:n.length),p=getClassPropsAsTargets(e,n,t);return __spreadArray$2(__spreadArray$2([],u,!0),p,!0)}function getConstructorArgsAsTarget(e,t,n,r,i){var o=i[e.toString()]||[],a=formatTargetMetadata(o),s=!0!==a.unmanaged,c=r[e],l=a.inject||a.multiInject;if((c=l||c)instanceof LazyServiceIdentifer&&(c=c.unwrap()),s){if(!t&&(c===Object||c===Function||void 0===c))throw new Error(MISSING_INJECT_ANNOTATION+" argument "+e+" in class "+n+".");var u=new Target(TargetTypeEnum.ConstructorArgument,a.targetName,c);return u.metadata=o,u}return null}function getConstructorArgsAsTargets(e,t,n,r,i){for(var o=[],a=0;a0?a:getBaseClassDependencyCount(e,n)}return 0}function formatTargetMetadata(e){var t={};return e.forEach((function(e){t[e.key.toString()]=e.value})),{inject:t[INJECT_TAG],multiInject:t[MULTI_INJECT_TAG],targetName:t[NAME_TAG],unmanaged:t[UNMANAGED_TAG]}}var Request=function(){function e(e,t,n,r,i){this.id=id(),this.serviceIdentifier=e,this.parentContext=t,this.parentRequest=n,this.target=i,this.childRequests=[],this.bindings=Array.isArray(r)?r:[r],this.requestScope=null===n?new Map:null}return e.prototype.addChildRequest=function(t,n,r){var i=new e(t,this.parentContext,this,n,r);return this.childRequests.push(i),i},e}();function getBindingDictionary(e){return e._bindingDictionary}function _createTarget(e,t,n,r,i,o){var a=new Metadata(e?MULTI_INJECT_TAG:INJECT_TAG,n),s=new Target(t,r,n,a);if(void 0!==i){var c=new Metadata(i,o);s.metadata.push(c)}return s}function _getActiveBindings(e,t,n,r,i){var o=getBindings(n.container,i.serviceIdentifier),a=[];return o.length===BindingCount.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof i.serviceIdentifier&&e.getConstructorMetadata(i.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(i.serviceIdentifier).toSelf(),o=getBindings(n.container,i.serviceIdentifier)),a=t?o:o.filter((function(e){var t=new Request(e.serviceIdentifier,n,r,e,i);return e.constraint(t)})),_validateActiveBindingCount(i.serviceIdentifier,a,i,n.container),a}function _validateActiveBindingCount(e,t,n,r){switch(t.length){case BindingCount.NoBindingsAvailable:if(n.isOptional())return t;var i=getServiceIdentifierAsString(e),o=NOT_REGISTERED;throw o+=listMetadataForTarget(i,n),o+=listRegisteredBindingsForServiceIdentifier(r,i,getBindings),new Error(o);case BindingCount.OnlyOneBindingAvailable:return t;case BindingCount.MultipleBindingsAvailable:default:if(n.isArray())return t;i=getServiceIdentifierAsString(e),o=AMBIGUOUS_MATCH+" "+i;throw o+=listRegisteredBindingsForServiceIdentifier(r,i,getBindings),new Error(o)}}function _createSubRequests(e,t,n,r,i,o){var a,s;if(null===i){a=_getActiveBindings(e,t,r,null,o),s=new Request(n,r,null,a,o);var c=new Plan(r,s);r.addPlan(c)}else a=_getActiveBindings(e,t,r,i,o),s=i.addChildRequest(o.serviceIdentifier,a,o);a.forEach((function(t){var n=null;if(o.isArray())n=s.addChildRequest(t.serviceIdentifier,t,o);else{if(t.cache)return;n=s}if(t.type===BindingTypeEnum.Instance&&null!==t.implementationType){var i=getDependencies(e,t.implementationType);if(!r.container.options.skipBaseClassChecks){var a=getBaseClassDependencyCount(e,t.implementationType);if(i.length0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0){var i=_resolveRequests(t,n),o=__assign$1(__assign$1({},i),{constr:e});r=i.isAsync?createInstanceWithInjectionsAsync(o):createInstanceWithInjections(o)}else r=new e;return r}function createInstanceWithInjections(e){var t,n=new((t=e.constr).bind.apply(t,__spreadArray$1([void 0],e.constructorInjections,!1)));return e.propertyRequests.forEach((function(t,r){var i=t.target.identifier,o=e.propertyInjections[r];n[i]=o})),n}function createInstanceWithInjectionsAsync(e){return __awaiter$2(this,void 0,void 0,(function(){var t,n;return __generator$2(this,(function(r){switch(r.label){case 0:return[4,possiblyWaitInjections(e.constructorInjections)];case 1:return t=r.sent(),[4,possiblyWaitInjections(e.propertyInjections)];case 2:return n=r.sent(),[2,createInstanceWithInjections(__assign$1(__assign$1({},e),{constructorInjections:t,propertyInjections:n}))]}}))}))}function possiblyWaitInjections(e){return __awaiter$2(this,void 0,void 0,(function(){var t,n,r,i;return __generator$2(this,(function(o){for(t=[],n=0,r=e;n0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0?this._map.set(e,t):this._map.delete(e)},e}(),ModuleActivationStore=function(){function e(){this._map=new Map}return e.prototype.remove=function(e){if(this._map.has(e)){var t=this._map.get(e);return this._map.delete(e),t}return this._getEmptyHandlersStore()},e.prototype.addDeactivation=function(e,t,n){this._getModuleActivationHandlers(e).onDeactivations.add(t,n)},e.prototype.addActivation=function(e,t,n){this._getModuleActivationHandlers(e).onActivations.add(t,n)},e.prototype.clone=function(){var t=new e;return this._map.forEach((function(e,n){t._map.set(n,{onActivations:e.onActivations.clone(),onDeactivations:e.onDeactivations.clone()})})),t},e.prototype._getModuleActivationHandlers=function(e){var t=this._map.get(e);return void 0===t&&(t=this._getEmptyHandlersStore(),this._map.set(e,t)),t},e.prototype._getEmptyHandlersStore=function(){return{onActivations:new Lookup,onDeactivations:new Lookup}},e}(),__assign=globalThis&&globalThis.__assign||function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]32){const t=[],n=e.ctx.length/32;for(let e=0;ee.removeEventListener(t,n,r)}function attr(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function xlink_attr(e,t,n){e.setAttributeNS("http://www.w3.org/1999/xlink",t,n)}function children(e){return Array.from(e.childNodes)}function set_data(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function set_input_value(e,t){e.value=null==t?"":t}function set_style(e,t,n,r){null===n?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function custom_event(e,t,{bubbles:n=!1,cancelable:r=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n,r,t),i}class HtmlTag{constructor(e=!1){this.is_svg=!1,this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=svg_element(t.nodeName):this.e=element(t.nodeName),this.t=t,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t{const i=e.$$.callbacks[t];if(i){const o=custom_event(t,n,{cancelable:r});return i.slice().forEach((t=>{t.call(e,o)})),!o.defaultPrevented}return!0}}const dirty_components=[],binding_callbacks=[],render_callbacks=[],flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function add_render_callback(e){render_callbacks.push(e)}const seen_callbacks=new Set;let flushidx=0;function flush(){if(0!==flushidx)return;const t=current_component;do{try{for(;flushidx{outroing.delete(e),r&&(n&&e.d(1),r())})),e.o(t)}else r&&r()}function create_component(e){e&&e.c()}function mount_component(e,t,n,r){const{fragment:i,after_update:o}=e.$$;i&&i.m(t,n),r||add_render_callback((()=>{const t=e.$$.on_mount.map(run).filter(is_function);e.$$.on_destroy?e.$$.on_destroy.push(...t):run_all(t),e.$$.on_mount=[]})),o.forEach(add_render_callback)}function destroy_component(e,t){const n=e.$$;null!==n.fragment&&(run_all(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function make_dirty(e,t){-1===e.$$.dirty[0]&&(dirty_components.push(e),schedule_update(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const o=r.length?r[0]:n;return l.ctx&&i(l.ctx[t],l.ctx[t]=o)&&(!l.skip_bound&&l.bound[t]&&l.bound[t](o),u&&make_dirty(e,t)),n})):[],l.update(),u=!0,run_all(l.before_update),l.fragment=!!r&&r(l.ctx),t.target){if(t.hydrate){const e=children(t.target);l.fragment&&l.fragment.l(e),e.forEach(detach)}else l.fragment&&l.fragment.c();t.intro&&transition_in(e.$$.fragment),mount_component(e,t.target,t.anchor,t.customElement),flush()}set_current_component(c)}class SvelteComponent{$destroy(){destroy_component(this,1),this.$destroy=noop$1}$on(e,t){if(!is_function(t))return noop$1;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){this.$$set&&!is_empty(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const commandPanel_svelte_svelte_type_style_lang="";function get_each_context$4(e,t,n){const r=e.slice();return r[11]=t[n],r[13]=n,r}function create_if_block$4(e){let t,n=e[2],r=[];for(let i=0;i{const e=s[a];Dialog.destroyAll(),e.callback()},l=e=>{n(1,a=e),c()},u=(e,t)=>e&&e.toLowerCase().indexOf(t.toLowerCase())>=0;onMount((()=>{n(5,i=r.getCommands());document.getElementById("commandPanelInput").focus()}));return e.$$.update=()=>{33&e.$$.dirty&&(n(1,a=0),n(2,s=o?i.filter((e=>u(e.plugin,o)||u(e.pluginName,o)||u(e.command,o)||u(e.description,o))):i))},[o,a,s,e=>{if(13!==e.keyCode)if(38!==e.keyCode){if(40===e.keyCode){const t=s.length;if(e.preventDefault(),a>=t-1)return;n(1,a++,a)}}else{if(e.preventDefault(),0===a)return;n(1,a--,a)}else c()},l,i,function(){o=this.value,n(0,o)},e=>l(e)]}class Command_panel extends SvelteComponent{constructor(e){super(),init(this,e,instance$6,create_fragment$6,safe_not_equal,{})}}class CommandPanelPlugin extends Plugin{onload(){this.registerCommand({command:"Show command panel",description:_("show_command_panel"),shortcut:"ctrl+shift+o,command+shift+o",callback:()=>{this.showPanel()}})}showPanel(){Dialog.destroyAll(),new Dialog({content:'
'}),setImmediate((()=>{new Command_panel({target:document.getElementById("command-panel")})}))}}function get_each_context$3(e,t,n){const r=e.slice();return r[5]=t[n],r[6]=t,r[7]=n,r}function create_if_block_1$2(e){let t,n,r;function i(){e[2].call(t,e[6],e[7])}return{c(){t=element("input"),attr(t,"class","b3-text-field fn__flex-center fn__size200"),attr(t,"type","input")},m(o,a){insert(o,t,a),set_input_value(t,e[5].value),n||(r=[listen(t,"input",i),listen(t,"change",(function(){is_function(e[5].onChange)&&e[5].onChange.apply(this,arguments)}))],n=!0)},p(n,r){e=n,1&r&&set_input_value(t,e[5].value)},d(e){e&&detach(t),n=!1,run_all(r)}}}function create_if_block$3(e){let t,n,r;function i(){e[1].call(t,e[6],e[7])}return{c(){t=element("input"),attr(t,"class","b3-switch fn__flex-center"),attr(t,"type","checkbox")},m(o,a){insert(o,t,a),t.checked=e[5].checked,n||(r=[listen(t,"change",i),listen(t,"change",(function(){is_function(e[5].onChange)&&e[5].onChange.apply(this,arguments)}))],n=!0)},p(n,r){e=n,1&r&&(t.checked=e[5].checked)},d(e){e&&detach(t),n=!1,run_all(r)}}}function create_each_block$3(e){let t,n,r,i,o,a,s,c,l,u,p=e[5].label+"",d=e[5].tip+"";function h(e,t){return"checkbox"===e[5].type?create_if_block$3:"input"===e[5].type?create_if_block_1$2:void 0}let f=h(e),g=f&&f(e);return{c(){t=element("label"),n=element("div"),r=text(p),i=space(),o=element("div"),a=text(d),s=space(),c=element("span"),l=space(),g&&g.c(),u=space(),attr(o,"class","b3-label__text"),attr(n,"class","fn__flex-1"),attr(c,"class","fn__space"),attr(t,"class","fn__flex b3-label config__item")},m(e,p){insert(e,t,p),append(t,n),append(n,r),append(n,i),append(n,o),append(o,a),append(t,s),append(t,c),append(t,l),g&&g.m(t,null),append(t,u)},p(e,n){1&n&&p!==(p=e[5].label+"")&&set_data(r,p),1&n&&d!==(d=e[5].tip+"")&&set_data(a,d),f===(f=h(e))&&g?g.p(e,n):(g&&g.d(1),g=f&&f(e),g&&(g.c(),g.m(t,u)))},d(e){e&&detach(t),g&&g.d()}}}function create_fragment$5(e){let t,n=e[0],r=[];for(let i=0;i{e.target.checked?i.turnOnSafeMode():i.turnOffSafeMode()}},{label:_("autoupgrade"),tip:_("autoupgradetip"),checked:!0,type:"checkbox",onChange:e=>{r.set(PLUGIN_SYSTEM_AUTO_UPDATE,e.target.checked)}},{label:_("store_url"),tip:`${_("store_url_tip")} ${defaultConfig.PLUGIN_STORE_URL}`,type:"input",value:r.get(PLUGIN_STORE_URL),onChange:e=>{r.set(PLUGIN_STORE_URL,e.target.value)}}];return onMount((()=>{const e=r.get(PLUGIN_SYSTEM_SAFE_MODE_ENABLED);n(0,o[0].checked=e,o);const t=r.get(PLUGIN_SYSTEM_AUTO_UPDATE);n(0,o[1].checked=t,o)})),[o,function(e,t){e[t].checked=this.checked,n(0,o)},function(e,t){e[t].value=this.value,n(0,o)}]}class Setting_common extends SvelteComponent{constructor(e){super(),init(this,e,instance$5,create_fragment$5,safe_not_equal,{})}}const settingList_svelte_svelte_type_style_lang="";function get_each_context$2(e,t,n){const r=e.slice();return r[9]=t[n],r[10]=t,r[11]=n,r}function create_if_block$2(e){let t,n,r,i,o,a,s,c,l,u,p,d,h,f,g,m,y,v=e[9].name+"",b=e[9].version+"",w=(e[9].description||_("nodescription"))+"";function E(...t){return e[4](e[9],...t)}function S(){e[5].call(f,e[10],e[11])}return{c(){t=element("label"),n=element("div"),r=text(v),i=space(),o=text(b),a=space(),s=element("span"),s.textContent=`${_("uninstall")}`,c=space(),l=element("div"),u=text(w),p=space(),d=element("span"),h=space(),f=element("input"),g=space(),attr(s,"class","remove svelte-bwhxpp"),attr(l,"class","b3-label__text"),attr(n,"class","plugin fn__flex-1 svelte-bwhxpp"),attr(d,"class","fn__space"),attr(f,"class","b3-switch fn__flex-center"),attr(f,"id","fullWidth"),attr(f,"type","checkbox"),attr(t,"class","fn__flex b3-label")},m(_,v){insert(_,t,v),append(t,n),append(n,r),append(n,i),append(n,o),append(n,a),append(n,s),append(n,c),append(n,l),append(l,u),append(t,p),append(t,d),append(t,h),append(t,f),f.checked=e[9].enabled,append(t,g),m||(y=[listen(s,"click",E),listen(f,"change",S),listen(f,"change",(function(){is_function(e[1](e[9].key))&&e[1](e[9].key).apply(this,arguments)}))],m=!0)},p(t,n){e=t,1&n&&v!==(v=e[9].name+"")&&set_data(r,v),1&n&&b!==(b=e[9].version+"")&&set_data(o,b),1&n&&w!==(w=(e[9].description||_("nodescription"))+"")&&set_data(u,w),1&n&&(f.checked=e[9].enabled)},d(e){e&&detach(t),m=!1,run_all(y)}}}function create_each_block$2(e){let t,n=!e[9].hidden&&create_if_block$2(e);return{c(){n&&n.c(),t=empty()},m(e,r){n&&n.m(e,r),insert(e,t,r)},p(e,r){e[9].hidden?n&&(n.d(1),n=null):n?n.p(e,r):(n=create_if_block$2(e),n.c(),n.m(t.parentNode,t))},d(e){n&&n.d(e),e&&detach(t)}}}function create_fragment$4(e){let t,n,r=e[0],i=[];for(let o=0;o{n(3,a=i.getPlugins())},c=async(e,t)=>{t.preventDefault(),t.stopPropagation(),await o.unloadPlugin(e),await i.uninstallPlugin(e),await i.initStorage(),s()};onMount((async()=>{await i.initStorage(),s()}));return e.$$.update=()=>{8&e.$$.dirty&&n(0,r=a.filter((e=>e.script)))},[r,e=>async t=>{const n=i.get(PLUGIN_SYSTEM_SAFE_MODE_ENABLED),r=t.target.checked;await i.setPluginEnabled(e,r),n||(r?o.loadPlugin(e):o.unloadPlugin(e))},c,a,(e,t)=>c(e.key,t),function(e,t){e[t].enabled=this.checked,n(0,r),n(3,a)}]}class Setting_list extends SvelteComponent{constructor(e){super(),init(this,e,instance$4,create_fragment$4,safe_not_equal,{})}}function bind(e,t){return function(){return e.apply(t,arguments)}}const{toString:toString}=Object.prototype,{getPrototypeOf:getPrototypeOf}=Object,kindOf=(cache=Object.create(null),e=>{const t=toString.call(e);return cache[t]||(cache[t]=t.slice(8,-1).toLowerCase())});var cache;const kindOfTest=e=>(e=e.toLowerCase(),t=>kindOf(t)===e),typeOfTest=e=>t=>typeof t===e,{isArray:isArray}=Array,isUndefined=typeOfTest("undefined");function isBuffer(e){return null!==e&&!isUndefined(e)&&null!==e.constructor&&!isUndefined(e.constructor)&&isFunction(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&isArrayBuffer(e.buffer),t}const isString=typeOfTest("string"),isFunction=typeOfTest("function"),isNumber=typeOfTest("number"),isObject=e=>null!==e&&"object"==typeof e,isBoolean=e=>!0===e||!1===e,isPlainObject=e=>{if("object"!==kindOf(e))return!1;const t=getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},isDate=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=e=>isObject(e)&&isFunction(e.pipe),isFormData=e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||toString.call(e)===t||isFunction(e.toString)&&e.toString()===t)},isURLSearchParams=kindOfTest("URLSearchParams"),trim=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,i;if("object"!=typeof e&&(e=[e]),isArray(e))for(r=0,i=e.length;r0;)if(r=n[i],t===r.toLowerCase())return r;return null}const _global="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,isContextDefined=e=>!isUndefined(e)&&e!==_global;function merge(){const{caseless:e}=isContextDefined(this)&&this||{},t={},n=(n,r)=>{const i=e&&findKey(t,r)||r;isPlainObject(t[i])&&isPlainObject(n)?t[i]=merge(t[i],n):isPlainObject(n)?t[i]=merge({},n):isArray(n)?t[i]=n.slice():t[i]=n};for(let r=0,i=arguments.length;r(forEach(t,((t,r)=>{n&&isFunction(t)?e[r]=bind(t,n):e[r]=t}),{allOwnKeys:r}),e),stripBOM=e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject=(e,t,n,r)=>{let i,o,a;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)a=i[o],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},endsWith=(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray=e=>{if(!e)return null;if(isArray(e))return e;let t=e.length;if(!isNumber(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},isTypedArray=(TypedArray="undefined"!=typeof Uint8Array&&getPrototypeOf(Uint8Array),e=>TypedArray&&e instanceof TypedArray);var TypedArray;const forEachEntry=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll=(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),hasOwnProperty=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};forEach(n,((n,i)=>{!1!==t(n,i,e)&&(r[i]=n)})),Object.defineProperties(e,r)},freezeMethods=e=>{reduceDescriptors(e,((t,n)=>{if(isFunction(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];isFunction(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet=(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return isArray(e)?r(e):r(String(e).split(t)),n},noop=()=>{},toFiniteNumber=(e,t)=>(e=+e,Number.isFinite(e)?e:t),ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET={DIGIT:DIGIT,ALPHA:ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(e=16,t=ALPHABET.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function isSpecCompliantForm(e){return!!(e&&isFunction(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])}const toJSONObject=e=>{const t=new Array(10),n=(e,r)=>{if(isObject(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const i=isArray(e)?[]:{};return forEach(e,((e,t)=>{const o=n(e,r+1);!isUndefined(o)&&(i[t]=o)})),t[r]=void 0,i}}return e};return n(e,0)},utils={isArray:isArray,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString,isNumber:isNumber,isBoolean:isBoolean,isObject:isObject,isPlainObject:isPlainObject,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isRegExp:isRegExp,isFunction:isFunction,isStream:isStream,isURLSearchParams:isURLSearchParams,isTypedArray:isTypedArray,isFileList:isFileList,forEach:forEach,merge:merge,extend:extend,trim:trim,stripBOM:stripBOM,inherits:inherits,toFlatObject:toFlatObject,kindOf:kindOf,kindOfTest:kindOfTest,endsWith:endsWith,toArray:toArray,forEachEntry:forEachEntry,matchAll:matchAll,isHTMLForm:isHTMLForm,hasOwnProperty:hasOwnProperty,hasOwnProp:hasOwnProperty,reduceDescriptors:reduceDescriptors,freezeMethods:freezeMethods,toObjectSet:toObjectSet,toCamelCase:toCamelCase,noop:noop,toFiniteNumber:toFiniteNumber,findKey:findKey,global:_global,isContextDefined:isContextDefined,ALPHABET:ALPHABET,generateString:generateString,isSpecCompliantForm:isSpecCompliantForm,toJSONObject:toJSONObject};function AxiosError(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}utils.inherits(AxiosError,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const prototype$1=AxiosError.prototype,descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{descriptors[e]={value:e}})),Object.defineProperties(AxiosError,descriptors),Object.defineProperty(prototype$1,"isAxiosError",{value:!0}),AxiosError.from=(e,t,n,r,i,o)=>{const a=Object.create(prototype$1);return utils.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),AxiosError.call(a,e.message,t,n,r,i),a.cause=e,a.name=e.name,o&&Object.assign(a,o),a};const httpAdapter=null;function isVisitable(e){return utils.isPlainObject(e)||utils.isArray(e)}function removeBrackets(e){return utils.endsWith(e,"[]")?e.slice(0,-2):e}function renderKey(e,t,n){return e?e.concat(t).map((function(e,t){return e=removeBrackets(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}function isFlatArray(e){return utils.isArray(e)&&!e.some(isVisitable)}const predicates=utils.toFlatObject(utils,{},null,(function(e){return/^is[A-Z]/.test(e)}));function toFormData(e,t,n){if(!utils.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=utils.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!utils.isUndefined(t[e])}))).metaTokens,i=n.visitor||l,o=n.dots,a=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&utils.isSpecCompliantForm(t);if(!utils.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(utils.isDate(e))return e.toISOString();if(!s&&utils.isBlob(e))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return utils.isArrayBuffer(e)||utils.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,i){let s=e;if(e&&!i&&"object"==typeof e)if(utils.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(utils.isArray(e)&&isFlatArray(e)||(utils.isFileList(e)||utils.endsWith(n,"[]"))&&(s=utils.toArray(e)))return n=removeBrackets(n),s.forEach((function(e,r){!utils.isUndefined(e)&&null!==e&&t.append(!0===a?renderKey([n],r,o):null===a?n:n+"[]",c(e))})),!1;return!!isVisitable(e)||(t.append(renderKey(i,n,o),c(e)),!1)}const u=[],p=Object.assign(predicates,{defaultVisitor:l,convertValue:c,isVisitable:isVisitable});if(!utils.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!utils.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),utils.forEach(n,(function(n,o){!0===(!(utils.isUndefined(n)||null===n)&&i.call(t,n,utils.isString(o)?o.trim():o,r,p))&&e(n,r?r.concat(o):[o])})),u.pop()}}(e),t}function encode$1(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function AxiosURLSearchParams(e,t){this._pairs=[],e&&toFormData(e,this,t)}const prototype=AxiosURLSearchParams.prototype;function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(e,t,n){if(!t)return e;const r=n&&n.encode||encode,i=n&&n.serialize;let o;if(o=i?i(t,n):utils.isURLSearchParams(t)?t.toString():new AxiosURLSearchParams(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}prototype.append=function(e,t){this._pairs.push([e,t])},prototype.toString=function(e){const t=e?function(t){return e.call(this,t,encode$1)}:encode$1;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class InterceptorManager{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){utils.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}const InterceptorManager$1=InterceptorManager,transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1="undefined"!=typeof URLSearchParams?URLSearchParams:AxiosURLSearchParams,FormData$1="undefined"!=typeof FormData?FormData:null,Blob$1="undefined"!=typeof Blob?Blob:null,isStandardBrowserEnv=(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,platform={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$1},isStandardBrowserEnv:isStandardBrowserEnv,isStandardBrowserWebWorkerEnv:isStandardBrowserWebWorkerEnv,protocols:["http","https","file","blob","url","data"]};function toURLEncodedForm(e,t){return toFormData(e,new platform.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return platform.isNode&&utils.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function parsePropPath(e){return utils.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}function arrayToObject(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r=e.length;if(o=!o&&utils.isArray(r)?r.length:o,s)return utils.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!a;r[o]&&utils.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],i)&&utils.isArray(r[o])&&(r[o]=arrayToObject(r[o])),!a}if(utils.isFormData(e)&&utils.isFunction(e.entries)){const n={};return utils.forEachEntry(e,((e,r)=>{t(parsePropPath(e),r,n,0)})),n}return null}const DEFAULT_CONTENT_TYPE={"Content-Type":void 0};function stringifySafely(t,n,r){if(utils.isString(t))try{return(n||JSON.parse)(t),utils.trim(t)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(t)}const defaults={transitional:transitionalDefaults,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,i=utils.isObject(e);i&&utils.isHTMLForm(e)&&(e=new FormData(e));if(utils.isFormData(e))return r&&r?JSON.stringify(formDataToJSON(e)):e;if(utils.isArrayBuffer(e)||utils.isBuffer(e)||utils.isStream(e)||utils.isFile(e)||utils.isBlob(e))return e;if(utils.isArrayBufferView(e))return e.buffer;if(utils.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(e,this.formSerializer).toString();if((o=utils.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return toFormData(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),stringifySafely(e)):e}],transformResponse:[function(t){const n=this.transitional||defaults.transitional,r=n&&n.forcedJSONParsing,i="json"===this.responseType;if(t&&utils.isString(t)&&(r&&!this.responseType||i)){const r=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(e){if(r){if("SyntaxError"===e.name)throw AxiosError.from(e,AxiosError.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform.classes.FormData,Blob:platform.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};utils.forEach(["delete","get","head"],(function(e){defaults.headers[e]={}})),utils.forEach(["post","put","patch"],(function(e){defaults.headers[e]=utils.merge(DEFAULT_CONTENT_TYPE)}));const defaults$1=defaults,ignoreDuplicateOf=utils.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders=e=>{const t={};let n,r,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!n||t[n]&&ignoreDuplicateOf[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t},$internals=Symbol("internals");function normalizeHeader(e){return e&&String(e).trim().toLowerCase()}function normalizeValue(e){return!1===e||null==e?e:utils.isArray(e)?e.map(normalizeValue):String(e)}function parseTokens(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}function isValidHeaderName(e){return/^[-_a-zA-Z]+$/.test(e.trim())}function matchHeaderValue(e,t,n,r,i){return utils.isFunction(r)?r.call(this,t,n):(i&&(t=n),utils.isString(t)?utils.isString(r)?-1!==t.indexOf(r):utils.isRegExp(r)?r.test(t):void 0:void 0)}function formatHeader(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}function buildAccessors(e,t){const n=utils.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})}))}class AxiosHeaders{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function i(e,t,n){const i=normalizeHeader(t);if(!i)throw new Error("header name must be a non-empty string");const o=utils.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=normalizeValue(e))}const o=(e,t)=>utils.forEach(e,((e,n)=>i(e,n,t)));return utils.isPlainObject(e)||e instanceof this.constructor?o(e,t):utils.isString(e)&&(e=e.trim())&&!isValidHeaderName(e)?o(parseHeaders(e),t):null!=e&&i(t,e,n),this}get(e,t){if(e=normalizeHeader(e)){const n=utils.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return parseTokens(e);if(utils.isFunction(t))return t.call(this,e,n);if(utils.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=normalizeHeader(e)){const n=utils.findKey(this,e);return!(!n||void 0===this[n]||t&&!matchHeaderValue(this,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function i(e){if(e=normalizeHeader(e)){const i=utils.findKey(n,e);!i||t&&!matchHeaderValue(n,n[i],i,t)||(delete n[i],r=!0)}}return utils.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const i=t[n];e&&!matchHeaderValue(this,this[i],i,e,!0)||(delete this[i],r=!0)}return r}normalize(e){const t=this,n={};return utils.forEach(this,((r,i)=>{const o=utils.findKey(n,i);if(o)return t[o]=normalizeValue(r),void delete t[i];const a=e?formatHeader(i):String(i).trim();a!==i&&delete t[i],t[a]=normalizeValue(r),n[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return utils.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&utils.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[$internals]=this[$internals]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=normalizeHeader(e);t[r]||(buildAccessors(n,e),t[r]=!0)}return utils.isArray(e)?e.forEach(r):r(e),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),utils.freezeMethods(AxiosHeaders.prototype),utils.freezeMethods(AxiosHeaders);const AxiosHeaders$1=AxiosHeaders;function transformData(e,t){const n=this||defaults$1,r=t||n,i=AxiosHeaders$1.from(r.headers);let o=r.data;return utils.forEach(e,(function(e){o=e.call(n,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function isCancel(e){return!(!e||!e.__CANCEL__)}function CanceledError(e,t,n){AxiosError.call(this,null==e?"canceled":e,AxiosError.ERR_CANCELED,t,n),this.name="CanceledError"}function settle(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new AxiosError("Request failed with status code "+n.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}utils.inherits(CanceledError,AxiosError,{__CANCEL__:!0});const cookies=platform.isStandardBrowserEnv?{write:function(e,t,n,r,i,o){const a=[];a.push(e+"="+encodeURIComponent(t)),utils.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),utils.isString(r)&&a.push("path="+r),utils.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function isAbsoluteURL(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function combineURLs(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function buildFullPath(e,t){return e&&!isAbsoluteURL(t)?combineURLs(e,t):t}const isURLSameOrigin=platform.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=utils.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function parseProtocol(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function speedometer(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i,o=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),l=r[a];i||(i=c),n[o]=s,r[o]=c;let u=a,p=0;for(;u!==o;)p+=n[u++],u%=e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),c-i{const o=i.loaded,a=i.lengthComputable?i.total:void 0,s=o-n,c=r(s);n=o;const l={loaded:o,total:a,progress:a?o/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&o<=a?(a-o)/c:void 0,event:i};l[t?"download":"upload"]=!0,e(l)}}const isXHRAdapterSupported="undefined"!=typeof XMLHttpRequest,xhrAdapter=isXHRAdapterSupported&&function(e){return new Promise((function(t,n){let r=e.data;const i=AxiosHeaders$1.from(e.headers).normalize(),o=e.responseType;let a;function s(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}utils.isFormData(r)&&(platform.isStandardBrowserEnv||platform.isStandardBrowserWebWorkerEnv)&&i.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+n))}const l=buildFullPath(e.baseURL,e.url);function u(){if(!c)return;const r=AxiosHeaders$1.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());settle((function(e){t(e),s()}),(function(e){n(e),s()}),{data:o&&"text"!==o&&"json"!==o?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:r,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),buildURL(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=u:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=function(){c&&(n(new AxiosError("Request aborted",AxiosError.ECONNABORTED,e,c)),c=null)},c.onerror=function(){n(new AxiosError("Network Error",AxiosError.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||transitionalDefaults;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new AxiosError(t,r.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,e,c)),c=null},platform.isStandardBrowserEnv){const t=(e.withCredentials||isURLSameOrigin(l))&&e.xsrfCookieName&&cookies.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===r&&i.setContentType(null),"setRequestHeader"in c&&utils.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),utils.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),o&&"json"!==o&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",progressEventReducer(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",progressEventReducer(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=t=>{c&&(n(!t||t.type?new CanceledError(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const p=parseProtocol(l);p&&-1===platform.protocols.indexOf(p)?n(new AxiosError("Unsupported protocol "+p+":",AxiosError.ERR_BAD_REQUEST,e)):c.send(r||null)}))},knownAdapters={http:httpAdapter,xhr:xhrAdapter};utils.forEach(knownAdapters,((t,n)=>{if(t){try{Object.defineProperty(t,"name",{value:n})}catch(e){}Object.defineProperty(t,"adapterName",{value:n})}}));const adapters={getAdapter:e=>{e=utils.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let i=0;ie instanceof AxiosHeaders$1?e.toJSON():e;function mergeConfig(e,t){t=t||{};const n={};function r(e,t,n){return utils.isPlainObject(e)&&utils.isPlainObject(t)?utils.merge.call({caseless:n},e,t):utils.isPlainObject(t)?utils.merge({},t):utils.isArray(t)?t.slice():t}function i(e,t,n){return utils.isUndefined(t)?utils.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function o(e,t){if(!utils.isUndefined(t))return r(void 0,t)}function a(e,t){return utils.isUndefined(t)?utils.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,i,o){return o in t?r(n,i):o in e?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t)=>i(headersToObject(e),headersToObject(t),!0)};return utils.forEach(Object.keys(e).concat(Object.keys(t)),(function(r){const o=c[r]||i,a=o(e[r],t[r],r);utils.isUndefined(a)&&o!==s||(n[r]=a)})),n}const VERSION="1.3.4",validators$1={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{validators$1[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const deprecatedWarnings={};function assertOptions(e,t,n){if("object"!=typeof e)throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],a=t[o];if(a){const t=e[o],n=void 0===t||a(t,o,e);if(!0!==n)throw new AxiosError("option "+o+" must be "+n,AxiosError.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new AxiosError("Unknown option "+o,AxiosError.ERR_BAD_OPTION)}}validators$1.transitional=function(e,t,n){function r(e,t){return"[Axios v"+VERSION+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,i,o)=>{if(!1===e)throw new AxiosError(r(i," has been removed"+(t?" in "+t:"")),AxiosError.ERR_DEPRECATED);return t&&!deprecatedWarnings[i]&&(deprecatedWarnings[i]=!0,console.warn(r(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,o)}};const validator={assertOptions:assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(e){this.defaults=e,this.interceptors={request:new InterceptorManager$1,response:new InterceptorManager$1}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=mergeConfig(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:i}=t;let o;void 0!==n&&validator.assertOptions(n,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),void 0!==r&&validator.assertOptions(r,{encode:validators.function,serialize:validators.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),o=i&&utils.merge(i.common,i[t.method]),o&&utils.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=AxiosHeaders$1.concat(o,i);const a=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,p=0;if(!s){const e=[dispatchRequest.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,c),u=e.length,l=Promise.resolve(t);p{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,i){n.reason||(n.reason=new CanceledError(e,r,i),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new CancelToken((function(t){e=t})),cancel:e}}}const CancelToken$1=CancelToken;function spread(e){return function(t){return e.apply(null,t)}}function isAxiosError(e){return utils.isObject(e)&&!0===e.isAxiosError}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach((([e,t])=>{HttpStatusCode[t]=e}));const HttpStatusCode$1=HttpStatusCode;function createInstance(e){const t=new Axios$1(e),n=bind(Axios$1.prototype.request,t);return utils.extend(n,Axios$1.prototype,t,{allOwnKeys:!0}),utils.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return createInstance(mergeConfig(e,t))},n}const axios=createInstance(defaults$1);axios.Axios=Axios$1,axios.CanceledError=CanceledError,axios.CancelToken=CancelToken$1,axios.isCancel=isCancel,axios.VERSION=VERSION,axios.toFormData=toFormData,axios.AxiosError=AxiosError,axios.Cancel=axios.CanceledError,axios.all=function(e){return Promise.all(e)},axios.spread=spread,axios.isAxiosError=isAxiosError,axios.mergeConfig=mergeConfig,axios.AxiosHeaders=AxiosHeaders$1,axios.formToJSON=e=>formDataToJSON(utils.isHTMLForm(e)?new FormData(e):e),axios.HttpStatusCode=HttpStatusCode$1,axios.default=axios;const axios$1=axios;var __defProp$8=Object.defineProperty,__getOwnPropDesc$8=Object.getOwnPropertyDescriptor,__decorateClass$8=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?__getOwnPropDesc$8(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&__defProp$8(t,n,o),o},__decorateParam$6=(e,t)=>(n,r)=>t(n,r,e);let Store=class{constructor(e){this.storageManager=e,this.plugins=[],this.pluginStatus=[]}async init(){this.plugins=[],this.pluginStatus=[],await this.loadPluginsFromUrl(),await this.storageManager.initStorage();const e=this.storageManager.getPlugins(),t=[];for(const n of this.plugins){const r={...n,isExist:!1,needUpgrade:!1},i=e.find((e=>e.key===n.key));if(i){r.isExist=!0;const e=new semver.SemVer(r.version),t=new semver.SemVer(i.version);1===e.compare(t)&&(r.needUpgrade=!0)}t.push(r)}this.pluginStatus=t}getStoreUrl(){return this.storageManager.get(PLUGIN_STORE_URL)}getPlugins(){return this.plugins}async loadPlugins(){return await this.init(),this.getPluginsWithStatus()}getPluginsWithStatus(){return this.pluginStatus}async loadPluginsFromUrl(){var t,n;const r=this.getStoreUrl();if(!r)return;let i;try{i=await axios$1.get(r+"/plugins.json",{headers:{"Cache-Control":"no-cache"}})}catch(e){return void console.error(e)}if(Array.isArray(null==(t=i.data)?void 0:t.plugins))for(const e of(null==(n=i.data)?void 0:n.plugins)||{}){const t=await this.getPluginManifest(`${r}/${e}`);this.plugins.push(t)}}async getPluginByUrl(e){return Promise.all([this.getPluginManifest(e),this.getPluginMainJs(e)]).then((e=>({manifest:e[0],mainJs:e[1]})))}async getPluginManifest(t){try{return(await axios$1.get(`${t}/manifest.json`,{headers:{"Content-Type":"application/json","Cache-Control":"no-cache"}})).data}catch(e){return console.error(e),null}}async getPluginMainJs(t){window.axios=axios$1;try{return(await axios$1.get(`${t}/main.js`,{headers:{"Content-Type":"text/plain","Cache-Control":"no-cache"}})).data}catch(e){return console.error(e),null}}async getPluginReadme(t){window.axios=axios$1;const n=`${this.getStoreUrl()}/${t}`;try{return(await axios$1.get(`${n}/README.md`,{headers:{"Content-Type":"text/plain","Cache-Control":"no-cache"}})).data}catch(e){return console.error(e),null}}async downloadPlugin(e){await sleep(500);const t=await this.getPluginByUrl(`${this.getStoreUrl()}/${e}`),n=t.manifest,r=t.mainJs;return await Promise.all([FileClient.getInstanceApi().fileApi.putFile(`/data/plugins/${e}`,null,!0),FileClient.getInstanceApi().fileApi.putFile(`/data/plugins/${e}/manifest.json`,JSON.stringify(n),!1),FileClient.getInstanceApi().fileApi.putFile(`/data/plugins/${e}/main.js`,r,!1)])}};function create_fragment$3(e){let t,n,r,i;const o=e[3].default,a=create_slot(o,e,e[2],null);return{c(){t=element("button"),a&&a.c(),t.disabled=e[1],attr(t,"class","b3-button")},m(o,s){insert(o,t,s),a&&a.m(t,null),n=!0,r||(i=listen(t,"click",(function(){is_function(e[0])&&e[0].apply(this,arguments)})),r=!0)},p(r,[i]){e=r,a&&a.p&&(!n||4&i)&&update_slot_base(a,o,e,e[2],n?get_slot_changes(o,e[2],i,null):get_all_dirty_from_scope(e[2]),null),(!n||2&i)&&(t.disabled=e[1])},i(e){n||(transition_in(a,e),n=!0)},o(e){transition_out(a,e),n=!1},d(e){e&&detach(t),a&&a.d(e),r=!1,i()}}}function instance$3(e,t,n){let{$$slots:r={},$$scope:i}=t,{onClick:o=null}=t,{disabled:a=!1}=t;return e.$$set=e=>{"onClick"in e&&n(0,o=e.onClick),"disabled"in e&&n(1,a=e.disabled),"$$scope"in e&&n(2,i=e.$$scope)},[o,a,i,r]}Store=__decorateClass$8([injectable(),__decorateParam$6(0,inject(TYPES.StorageManager))],Store);class Button extends SvelteComponent{constructor(e){super(),init(this,e,instance$3,create_fragment$3,safe_not_equal,{onClick:0,disabled:1})}}const settingPreview_svelte_svelte_type_style_lang="";function create_if_block_4$1(e){let t,n,r,i,o,a,s=_("url")+"",c=e[0].url+"";return{c(){t=element("div"),n=text(s),r=text(": "),i=element("a"),o=text(c),attr(i,"href",a=e[0].url),attr(i,"target","_blank"),attr(i,"rel","noreferrer"),attr(t,"class","plugin-item")},m(e,a){insert(e,t,a),append(t,n),append(t,r),append(t,i),append(i,o)},p(e,t){1&t&&c!==(c=e[0].url+"")&&set_data(o,c),1&t&&a!==(a=e[0].url)&&attr(i,"href",a)},d(e){e&&detach(t)}}}function create_if_block_3$1(e){let t,n,r,i,o=_("author")+"",a=e[0].author+"";return{c(){t=element("div"),n=text(o),r=text(": "),i=text(a),attr(t,"class","plugin-item")},m(e,o){insert(e,t,o),append(t,n),append(t,r),append(t,i)},p(e,t){1&t&&a!==(a=e[0].author+"")&&set_data(i,a)},d(e){e&&detach(t)}}}function create_if_block_2$1(e){let t,n,r,i,o=_("version")+"",a=e[0].version+"";return{c(){t=element("div"),n=text(o),r=text(": "),i=text(a),attr(t,"class","plugin-item")},m(e,o){insert(e,t,o),append(t,n),append(t,r),append(t,i)},p(e,t){1&t&&a!==(a=e[0].version+"")&&set_data(i,a)},d(e){e&&detach(t)}}}function create_if_block_1$1(e){let t,n,r,i,o=_("description")+"",a=e[0].description+"";return{c(){t=element("div"),n=text(o),r=text(": "),i=text(a),attr(t,"class","plugin-item")},m(e,o){insert(e,t,o),append(t,n),append(t,r),append(t,i)},p(e,t){1&t&&a!==(a=e[0].description+"")&&set_data(i,a)},d(e){e&&detach(t)}}}function create_else_block$1(e){let t,n,r=e[2]()+"";return{c(){t=new HtmlTag(!1),n=empty(),t.a=n},m(e,i){t.m(r,e,i),insert(e,n,i)},p(e,n){4&n&&r!==(r=e[2]()+"")&&t.p(r)},d(e){e&&detach(n),e&&t.d()}}}function create_if_block$1(e){let t;return{c(){t=element("span"),t.textContent=`${_("readme")}`},m(e,n){insert(e,t,n)},p:noop$1,d(e){e&&detach(t)}}}function create_fragment$2(e){let t,n,r,i,o,a,s,c,l,u,p,d,h,f,g,m,y,v,b,w,E,S,A,$,T,O,P=e[0].name+"",I=e[0].key+"",N=_("goBack")+"",R=e[0].url&&create_if_block_4$1(e),k=e[0].author&&create_if_block_3$1(e),C=e[0].version&&create_if_block_2$1(e),x=e[0].description&&create_if_block_1$1(e);function L(e,t){return e[1]?create_if_block$1:create_else_block$1}let D=L(e),B=D(e);return{c(){t=element("div"),n=element("div"),r=element("div"),i=element("div"),o=text(P),a=space(),s=element("div"),c=text("("),l=text(I),u=text(")"),p=space(),d=element("button"),h=svg_element("svg"),f=svg_element("use"),g=text(N),m=space(),y=element("div"),R&&R.c(),v=space(),k&&k.c(),b=space(),C&&C.c(),w=space(),x&&x.c(),E=space(),S=element("hr"),A=space(),$=element("div"),B.c(),attr(i,"class","plugin-name svelte-bj9chc"),attr(s,"class","plugin-key svelte-bj9chc"),xlink_attr(f,"xlink:href","#iconBack"),attr(h,"class","go-back-icon svelte-bj9chc"),attr(d,"class","go-back b3-button svelte-bj9chc"),attr(r,"class","plugin-info svelte-bj9chc"),attr(y,"class","plugin-manifest svelte-bj9chc"),attr(n,"class","plugin-basic"),attr($,"class","plugin-readme b3-typography svelte-bj9chc"),attr(t,"class","plugin-detail svelte-bj9chc")},m(_,P){insert(_,t,P),append(t,n),append(n,r),append(r,i),append(i,o),append(r,a),append(r,s),append(s,c),append(s,l),append(s,u),append(r,p),append(r,d),append(d,h),append(h,f),append(d,g),append(n,m),append(n,y),R&&R.m(y,null),append(y,v),k&&k.m(y,null),append(y,b),C&&C.m(y,null),append(y,w),x&&x.m(y,null),append(t,E),append(t,S),append(t,A),append(t,$),B.m($,null),T||(O=listen(d,"click",e[5]),T=!0)},p(e,[t]){1&t&&P!==(P=e[0].name+"")&&set_data(o,P),1&t&&I!==(I=e[0].key+"")&&set_data(l,I),e[0].url?R?R.p(e,t):(R=create_if_block_4$1(e),R.c(),R.m(y,v)):R&&(R.d(1),R=null),e[0].author?k?k.p(e,t):(k=create_if_block_3$1(e),k.c(),k.m(y,b)):k&&(k.d(1),k=null),e[0].version?C?C.p(e,t):(C=create_if_block_2$1(e),C.c(),C.m(y,w)):C&&(C.d(1),C=null),e[0].description?x?x.p(e,t):(x=create_if_block_1$1(e),x.c(),x.m(y,null)):x&&(x.d(1),x=null),D===(D=L(e))&&B?B.p(e,t):(B.d(1),B=D(e),B&&(B.c(),B.m($,null)))},i:noop$1,o:noop$1,d(e){e&&detach(t),R&&R.d(),k&&k.d(),C&&C.d(),x&&x.d(),B.d(),T=!1,O()}}}function instance$2(e,t,n){let r;const i=createEventDispatcher();let o=!0,{plugin:a}=t;let s;const c=window.Lute.New();onMount((()=>{(async()=>{n(4,s=await container.get("Store").getPluginReadme(a.key)),n(1,o=!1)})()}));const l=()=>{i("goback")};return e.$$set=e=>{"plugin"in e&&n(0,a=e.plugin)},e.$$.update=()=>{16&e.$$.dirty&&n(2,r=()=>s?c.Md2HTML(s):"")},[a,o,r,l,s,()=>l()]}class Setting_preview extends SvelteComponent{constructor(e){super(),init(this,e,instance$2,create_fragment$2,safe_not_equal,{plugin:0})}}function get_each_context$1(e,t,n){const r=e.slice();return r[11]=t[n],r}function create_else_block_2(e){let t,n;return t=new Setting_preview({props:{plugin:e[3]}}),t.$on("goback",e[9]),{c(){create_component(t.$$.fragment)},m(e,r){mount_component(t,e,r),n=!0},p(e,n){const r={};8&n&&(r.plugin=e[3]),t.$set(r)},i(e){n||(transition_in(t.$$.fragment,e),n=!0)},o(e){transition_out(t.$$.fragment,e),n=!1},d(e){destroy_component(t,e)}}}function create_if_block_1(e){let t,n,r=e[0],i=[];for(let a=0;atransition_out(i[e],1,1,(()=>{i[e]=null}));return{c(){t=element("div");for(let e=0;e{a[c]=null})),check_outros(),n=a[t],n?n.p(e,i):(n=a[t]=o[t](e),n.c()),transition_in(n,1),n.m(r.parentNode,r))},i(e){i||(transition_in(n),i=!0)},o(e){transition_out(n),i=!1},d(e){a[t].d(e),e&&detach(r)}}}function create_if_block_2(e){let t,n;return t=new Button({props:{disabled:!0,$$slots:{default:[create_default_slot]},$$scope:{ctx:e}}}),{c(){create_component(t.$$.fragment)},m(e,r){mount_component(t,e,r),n=!0},p(e,n){const r={};16384&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(transition_in(t.$$.fragment,e),n=!0)},o(e){transition_out(t.$$.fragment,e),n=!1},d(e){destroy_component(t,e)}}}function create_default_slot_3(e){let t,n=_("download")+"";return{c(){t=text(n)},m(e,n){insert(e,t,n)},p:noop$1,d(e){e&&detach(t)}}}function create_else_block(e){let t,n;return t=new Button({props:{disabled:!0,$$slots:{default:[create_default_slot_2]},$$scope:{ctx:e}}}),{c(){create_component(t.$$.fragment)},m(e,r){mount_component(t,e,r),n=!0},p(e,n){const r={};16384&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(transition_in(t.$$.fragment,e),n=!0)},o(e){transition_out(t.$$.fragment,e),n=!1},d(e){destroy_component(t,e)}}}function create_if_block_4(e){let t,n;function r(){return e[7](e[11])}return t=new Button({props:{onClick:r,$$slots:{default:[create_default_slot_1]},$$scope:{ctx:e}}}),{c(){create_component(t.$$.fragment)},m(e,r){mount_component(t,e,r),n=!0},p(n,i){e=n;const o={};1&i&&(o.onClick=r),16384&i&&(o.$$scope={dirty:i,ctx:e}),t.$set(o)},i(e){n||(transition_in(t.$$.fragment,e),n=!0)},o(e){transition_out(t.$$.fragment,e),n=!1},d(e){destroy_component(t,e)}}}function create_default_slot_2(e){let t,n=_("downloaded")+"";return{c(){t=text(n)},m(e,n){insert(e,t,n)},p:noop$1,d(e){e&&detach(t)}}}function create_default_slot_1(e){let t,n=_("upgrade")+"";return{c(){t=text(n)},m(e,n){insert(e,t,n)},p:noop$1,d(e){e&&detach(t)}}}function create_default_slot(e){let t,n=_("downloading")+"";return{c(){t=text(n)},m(e,n){insert(e,t,n)},p:noop$1,d(e){e&&detach(t)}}}function create_each_block$1(e){let t,n,r,i,o,a,s,c,l,u,p,d,h,f,g,m,_,y,v=e[11].name+"",b=e[11].version+"",w=(e[11].description||"")+"";function E(...t){return e[6](e[11],...t)}const S=[create_if_block_2,create_if_block_3,create_else_block_1],A=[];function $(e,t){return e[2][e[11].key]?0:e[11].isExist?1:2}return h=$(e),f=A[h]=S[h](e),{c(){t=element("label"),n=element("div"),r=element("a"),i=text(v),o=space(),a=text(b),s=space(),c=element("div"),l=text(w),u=space(),p=element("span"),d=space(),f.c(),g=space(),attr(r,"href","javascript:void(0)"),attr(r,"class",""),attr(c,"class","b3-label__text"),attr(n,"class","fn__flex-1"),attr(p,"class","fn__space"),attr(t,"class","fn__flex b3-label")},m(e,f){insert(e,t,f),append(t,n),append(n,r),append(r,i),append(n,o),append(n,a),append(n,s),append(n,c),append(c,l),append(t,u),append(t,p),append(t,d),A[h].m(t,null),append(t,g),m=!0,_||(y=listen(r,"click",E),_=!0)},p(n,r){e=n,(!m||1&r)&&v!==(v=e[11].name+"")&&set_data(i,v),(!m||1&r)&&b!==(b=e[11].version+"")&&set_data(a,b),(!m||1&r)&&w!==(w=(e[11].description||"")+"")&&set_data(l,w);let o=h;h=$(e),h===o?A[h].p(e,r):(group_outros(),transition_out(A[o],1,1,(()=>{A[o]=null})),check_outros(),f=A[h],f?f.p(e,r):(f=A[h]=S[h](e),f.c()),transition_in(f,1),f.m(t,g))},i(e){m||(transition_in(f),m=!0)},o(e){transition_out(f),m=!1},d(e){e&&detach(t),A[h].d(),_=!1,y()}}}function create_fragment$1(e){let t,n,r,i;const o=[create_if_block,create_if_block_1,create_else_block_2],a=[];function s(e,t){return e[1]?0:e[3]?2:1}return n=s(e),r=a[n]=o[n](e),{c(){t=element("div"),r.c(),attr(t,"class","b3-label fn__flex")},m(e,r){insert(e,t,r),a[n].m(t,null),i=!0},p(e,[i]){let c=n;n=s(e),n===c?a[n].p(e,i):(group_outros(),transition_out(a[c],1,1,(()=>{a[c]=null})),check_outros(),r=a[n],r?r.p(e,i):(r=a[n]=o[n](e),r.c()),transition_in(r,1),r.m(t,null))},i(e){i||(transition_in(r),i=!0)},o(e){transition_out(r),i=!1},d(e){e&&detach(t),a[n].d()}}}function instance$1(e,t,n){const r=container.get(TYPES.Store);let i=[],o=!0;const a={};onMount((async()=>{n(0,i=await r.loadPlugins()),n(1,o=!1)}));const s=async e=>{if(!a[e])try{n(2,a[e]=!0,a),await r.downloadPlugin(e);const t=i.find((t=>t.key===e));t&&(t.isExist=!0,t.needUpgrade=!1)}finally{n(2,a[e]=!1,a)}};let c=null;const l=(e,t)=>{n(3,c=t),e.stopPropagation(),e.preventDefault()};return[i,o,a,c,s,l,(e,t)=>l(t,e),e=>s(e.key),e=>s(e.key),()=>n(3,c=null)]}class Setting_store extends SvelteComponent{constructor(e){super(),init(this,e,instance$1,create_fragment$1,safe_not_equal,{})}}function get_each_context(e,t,n){const r=e.slice();return r[4]=t[n],r}function create_each_block(e){let t,n,r,i,o,a,s,c,l,u=e[4].name+"";function p(){return e[3](e[4])}return{c(){t=element("li"),n=svg_element("svg"),r=svg_element("use"),i=element("span"),o=text(u),a=space(),xlink_attr(r,"xlink:href",e[4].icon),attr(n,"class","b3-list-item__graphic"),attr(i,"class","b3-list-item__text"),attr(t,"data-name",e[4].key),attr(t,"class",s=e[0].key===e[4].key?"b3-list-item--focus b3-list-item b3-list-item--big":"b3-list-item b3-list-item--big")},m(e,s){insert(e,t,s),append(t,n),append(n,r),append(t,i),append(i,o),append(t,a),c||(l=listen(t,"click",p),c=!0)},p(n,r){e=n,1&r&&s!==(s=e[0].key===e[4].key?"b3-list-item--focus b3-list-item b3-list-item--big":"b3-list-item b3-list-item--big")&&attr(t,"class",s)},d(e){e&&detach(t),c=!1,l()}}}function create_fragment(e){let t,n,r,i,o,a,s,c,l=e[1],u=[];for(let d=0;d{destroy_component(e,1)})),check_outros()}p?(a=construct_svelte_component(p,{}),create_component(a.$$.fragment),transition_in(a.$$.fragment,1),mount_component(a,o,null)):a=null}(!c||1&t&&s!==(s=e[0].key))&&attr(o,"data-name",s)},i(e){c||(a&&transition_in(a.$$.fragment,e),c=!0)},o(e){a&&transition_out(a.$$.fragment,e),c=!1},d(e){e&&detach(t),destroy_each(u,e),a&&destroy_component(a)}}}function instance(e,t,n){const r=[{key:"common",name:_("menu_common"),icon:"#iconSettings",component:Setting_common},{key:"list",name:_("menu_list"),icon:"#iconSettings",component:Setting_list},{key:"store",name:_("menu_store"),icon:"#iconSettings",component:Setting_store}],i=e=>n(0,o=e);let o=r[0];return[o,r,i,e=>i(e)]}class Setting extends SvelteComponent{constructor(e){super(),init(this,e,instance,create_fragment,safe_not_equal,{})}}class InternalSettingPlugin extends Plugin{constructor(){super(),this.svg=''}onload(){const e=document.createElement("button");e.setAttribute("aria-label",_("plugin_system")),e.classList.add("toolbar__item","b3-tooltips","b3-tooltips__sw"),e.insertAdjacentHTML("beforeend",this.svg),e.addEventListener("click",(e=>{new Menu("internalSettingButton").addItem(new MenuItem({label:_("plugin_system_setting"),icon:"iconEdit",click:()=>showSettingDialog()})).addSeparator().addItem(new MenuItem({label:_("reload"),icon:"iconRefresh",click:()=>window.location.reload()})).showAtMouseEvent(e),e.stopPropagation()})),addToolbarRight(e),this.registerCommand({command:"Show plugin system conifg",description:_("show_plugin_system_config"),shortcut:"command+option+p",callback:()=>showSettingDialog()}),this.registerCommand({command:"Reload Window",description:_("reload_window"),callback:()=>window.location.reload()})}onunload(){console.log("InternalSettingPluginUnload")}}function showSettingDialog(){new Dialog({title:_("plugin_system_setting"),content:'
',width:"90vw",height:"50vh"}),setTimeout((()=>{new Setting({target:document.getElementById("plugin-settings")})}))}const internalPlugins=[{key:"setting",name:"setting",plugin:InternalSettingPlugin,enabled:!0,hidden:!0,version:"1.0.0"},{key:"commandPanel",name:"commandPanel",plugin:CommandPanelPlugin,enabled:!0,hidden:!0,version:"1.0.0"}];function isHighSurrogate$1(e){return e>=55296&&e<=56319}function isLowSurrogate$1(e){return e>=56320&&e<=57343}var truncate$2=function(e,t,n){if("string"!=typeof t)throw new Error("Input must be string");for(var r,i,o=t.length,a=0,s=0;sn)return t.slice(0,s-i.length+1)}return t};function isHighSurrogate(e){return e>=55296&&e<=56319}function isLowSurrogate(e){return e>=56320&&e<=57343}var browser$1=function(e){if("string"!=typeof e)throw new Error("Input must be string");for(var t=e.length,n=0,r=null,i=null,o=0;o=128&&r<=2047?n+=2:r>=2048&&r<=65535&&(n+=3),i=r;return n},truncate$1=truncate$2,getLength=browser$1,browser=truncate$1.bind(null,getLength),truncate=browser,illegalRe=/[\/\?<>\\:\*\|"]/g,controlRe=/[\x00-\x1f\x80-\x9f]/g,reservedRe=/^\.+$/,windowsReservedRe=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,windowsTrailingRe=/[\. ]+$/;function sanitize(e,t){if("string"!=typeof e)throw new Error("Input must be string");var n=e.replace(illegalRe,t).replace(controlRe,t).replace(reservedRe,t).replace(windowsReservedRe,t).replace(windowsTrailingRe,t);return truncate(n,255)}var sanitizeFilename=function(e,t){var n=t&&t.replacement||"",r=sanitize(e,n);return""===n?r:sanitize(r,"")},__defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?__getOwnPropDesc$7(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&__defProp$7(t,n,o),o},__decorateParam$5=(e,t)=>(n,r)=>t(n,r,e);let StorageManager=class{constructor(e){this.config=Object.assign({},defaultConfig),this.pluginFileManager=e}get(e){return this.config[e]}async set(e,t){return this.config[e]=t,setStorageVal(e,t)}async initStorage(){const e=await getLocalStorage(),t=Object.keys(defaultConfig);for(const n of t)void 0!==e[n]?this.config[n]=e[n]:await setStorageVal(n,defaultConfig[n]);return this.thirdPartyPlugins=await this.pluginFileManager.getAllPlugins(),this.internalPlugins=[...internalPlugins],this.init3rdPartyEnabled(),this.initInternalEnabled(),await this.savePluginsEnabled(),this}init3rdPartyEnabled(){const e=this.get(PLUGIN_SYSTEM_THIRD_PARTY_PLUGIN);for(const t of e)for(const e of this.thirdPartyPlugins)if(e.key===t.key){e.enabled=t.enabled||!1;break}}initInternalEnabled(){const e=this.get(PLUGIN_SYSTEM_PLUGIN);for(const t of e)for(const e of this.internalPlugins)if(e.key===t.key){e.enabled=t.enabled||!1;break}}getPlugins(){return[...this.internalPlugins,...this.thirdPartyPlugins]}getInternalPlugins(){return this.internalPlugins}getThirdPartyPlugins(){return this.thirdPartyPlugins}getPluginByKey(e){return this.getPlugins().find((t=>t.key===e))}async setPluginEnabled(e,t){for(const n of[...this.internalPlugins,...this.thirdPartyPlugins])if(n.key===e){n.enabled=t;break}await this.savePluginsEnabled()}async setSafeModeEnabled(e){return this.set(PLUGIN_SYSTEM_SAFE_MODE_ENABLED,e)}async savePluginsEnabled(){return await this.set(PLUGIN_SYSTEM_PLUGIN,this.internalPlugins.map((e=>({key:e.key,enabled:e.enabled})))),this.set(PLUGIN_SYSTEM_THIRD_PARTY_PLUGIN,this.thirdPartyPlugins.map((e=>({key:e.key,enabled:e.enabled}))))}async setPluginStorage(t,n,r){try{if(this.isFileNameIllegal(n))return void showErrorMessage(`插件${t}存储文件名不合法`);await this.addPluginStorageFolderIfNotExist(t),await FileClient.getInstanceApi().fileApi.putFile(`/data/plugins/.storage/${t}/${n}`,r)}catch(e){showErrorMessage(`插件${t}存储保存失败`,2e3)}}async getPluginStorage(t,n){try{return await FileClient.getInstanceApi().fileApi.getFile(`/data/plugins/.storage/${t}/${n}`)}catch(e){return showErrorMessage(`插件${t}存储保存失败`,2e3),null}}async uninstallPlugin(e){await FileClient.getInstanceApi().fileApi.removeFile(`/data/plugins/${e}`),await FileClient.getInstanceApi().fileApi.removeFile(`/data/plugins//.storage/${e}`)}async addPluginStorageFolderIfNotExist(e){const t=`/data/plugins/.storage/${e}`;await FileClient.getInstanceApi().fileApi.putFile(t,null,!0)}isFileNameIllegal(e){return e!==sanitizeFilename(e)}};StorageManager=__decorateClass$7([injectable(),__decorateParam$5(0,inject(TYPES.PluginFileManager))],StorageManager);var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?__getOwnPropDesc$6(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&__defProp$6(t,n,o),o},__decorateParam$4=(e,t)=>(n,r)=>t(n,r,e);let PluginSystem=class{constructor(e,t,n,r,i){this.pluginLoader=e,this.pslm=t,this.storageManager=n,this.commandManager=r,this.store=i,this.version=VERSION$1}async init(){await this.storageManager.initStorage();const e=this.storageManager.getInternalPlugins();this.pluginLoader.loadEnabledPlugins(e),log(`Loading internal enabled plugins: ${e.map((e=>e.key)).join(",")}`);if(!this.storageManager.get(PLUGIN_SYSTEM_SAFE_MODE_ENABLED)){const e=this.storageManager.getThirdPartyPlugins();log(`Loading 3rd party enabled plugins: ${e.map((e=>e.key)).join(",")}`),this.pluginLoader.loadEnabledPlugins(e)}return this.pslm.localCacheInit(),this}async loadPlugin(e){this.storageManager.setPluginEnabled(e,!0);const t=this.storageManager.getPluginByKey(e);this.pluginLoader.loadPlugin(t)}async unloadPlugin(e){this.storageManager.setPluginEnabled(e,!1),this.pluginLoader.unloadPlugin(e)}async turnOffSafeMode(){this.storageManager.setSafeModeEnabled(!1);const e=this.storageManager.getThirdPartyPlugins();return this.pluginLoader.loadEnabledPlugins(e)}async turnOnSafeMode(){this.storageManager.setSafeModeEnabled(!0);const e=this.storageManager.getThirdPartyPlugins();return this.pluginLoader.unloadThirdPartyPlugins(e)}};PluginSystem=__decorateClass$6([injectable(),__decorateParam$4(0,inject(TYPES.PluginLoader)),__decorateParam$4(1,inject(TYPES.SystemManager)),__decorateParam$4(2,inject(TYPES.StorageManager)),__decorateParam$4(3,inject(TYPES.CommandManager)),__decorateParam$4(4,inject(TYPES.Store))],PluginSystem);const migrate=async()=>{const e="plugin-system-bazzar",t="(async () => {\n window.pluginSystemSource = 'bazzar';\n const response = await fetch('/api/file/getFile', {\n method: 'POST',\n mode: 'cors',\n cache: 'no-cache',\n credentials: 'same-origin',\n headers: {\n 'Content-Type': 'application/json',\n },\n redirect: 'follow',\n referrerPolicy: 'no-referrer',\n body: JSON.stringify({ path: '/data/widgets/插件系统/plugin.js' }),\n });\n const js = await response.text();\n eval(js);\n })()",n=async(e,t)=>(await fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify(t)})).json(),r=(await n("/api/snippet/getSnippet",{enabled:2,type:"all"})).data.snippets;for(const i of r)if("js"===i.type&&(-1!==i.content.indexOf("https://gitee.com/zuoez02/siyuan-plugin-system/raw/main/main.js")&&(i.enabled=!1),i.name===e))return i.enabled=!0,i.content=t,void(await n("/api/snippet/setSnippet",{snippets:r}));r.splice(0,0,{id:"20230324100959-plugind",name:e,type:"js",enabled:!0,content:t}),await n("/api/snippet/setSnippet",{snippets:r}),setTimeout((()=>window.parent.location.reload()),1e3)};var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?__getOwnPropDesc$5(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&__defProp$5(t,n,o),o},__decorateParam$3=(e,t)=>(n,r)=>t(n,r,e);const pluginScriptPosition=PLUGIN_SYS_ABS_PATH;let SystemManager=class{constructor(e){this.storageMangager=e}async saveToLocal(e,t){FileClient.getInstanceApi().fileApi.putFile(e,t)}async localCacheInit(){try{return void(null!==FileClient.getInstanceApi().fileApi.getFile(pluginScriptPosition)&&this.delayAutoUpgrade())}catch(e){log("Plugin system not found")}const t=window.siyuanPluginScript;t&&(await this.saveToLocal(pluginScriptPosition,t),this.delayAutoUpgrade())}delayAutoUpgrade(){setTimeout((()=>{this.storageMangager.get(PLUGIN_SYSTEM_AUTO_UPDATE)?this.tryUpgrade():log("Auto Update skipped")}),1e3)}async tryUpgrade(){if("bazzar"===window.pluginSystemSource)return void log("Plugin installed from bazzar version, upgrade skip");log("Try getting online version");const e=await this.getOnlineVersion();e!==VERSION$1?(showInfoMessage(`插件系统获取到最新版本 ${e},即将自动更新`),log("Online Version: "+e+", local version: "+VERSION$1),log("Downloading new version of Plugin System"),this.upgrade()):log("Version is "+VERSION$1+", OK")}async getOnlineVersion(){return fetch(VERSION_URL,{cache:"no-cache"}).then((e=>e.text()))}async upgrade(){const e=await fetch(SCRIPT_URL,{cache:"no-cache"}).then((e=>e.text()));e&&(migrate(),showInfoMessage("插件系统升级中,即将自动重载..."),await this.saveToLocal(pluginScriptPosition,e),log("Plugin system upgraded, reloading..."),setTimeout((()=>reloadWindow()),3e3))}};SystemManager=__decorateClass$5([injectable(),__decorateParam$3(0,inject(TYPES.StorageManager))],SystemManager);var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?__getOwnPropDesc$4(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&__defProp$4(t,n,o),o},__decorateParam$2=(e,t)=>(n,r)=>t(n,r,e);let components,PluginLoader=class{constructor(e){this.pluginFileManager=e,this.loadedPlugins=new Map}async loadEnabledPlugins(e){if(e&&e.length)for(const t of e)t.enabled&&await this.loadPlugin(t)}async loadAllInternalPlugins(){internalPlugins.forEach((async e=>{const t=new e.plugin;if(!(t instanceof Plugin))throw new Error(`Failed to load plugin ${e.name}`);log(`Load internal plugin: ${e.key}(${e.name})`),this.addAdditionalMethod(t,e.key,e.name),await t.onload(),this.loadedPlugins.set(e.key,t)}))}async loadAllLocalPlugins(){const e=await this.pluginFileManager.getAllPlugins();if(e)for(const t of e)await this.loadPlugin(t)}async loadPlugin(plugin){if(components||this.generateRequiredModules(),!plugin.enabled||!plugin.plugin&&!plugin.script)return;if(plugin.plugin){const e=new plugin.plugin;if(!(e instanceof Plugin))throw new Error(`Failed to load plugin ${plugin.name}`);return log(`Load internal plugin: ${plugin.key}(${plugin.name})`),this.addAdditionalMethod(e,plugin.key,plugin.name),await e.onload(),void this.loadedPlugins.set(plugin.key,e)}const exports={},module={exports:exports};function run(script,name){return eval("(function anonymous(require,module,exports){".concat(script,"\n})\n//# sourceURL=").concat(name,"\n"))}const __require=e=>{if(components[e])return components[e];throw new Error(`module ${e} not found`)},pluginName=plugin.key;try{run(plugin.script,plugin.key)(__require,module,exports)}catch(e){return void error("Error plugin:"+plugin.key+" ->",e)}let pluginConstructor;if(!(pluginConstructor=(module.exports||exports).default||module.exports))throw new Error(`Failed to load plugin ${pluginName}. No exports detected.`);const plug=new pluginConstructor;if(!(plug instanceof Plugin))throw new Error(`Failed to load plugin ${pluginName}`);this.addAdditionalMethod(plug,plugin.key,pluginName);try{await plug.onload(),this.loadedPlugins.set(plugin.key,plug)}catch(e){error("Error plugin:"+plugin.key+" ->",e)}}async unloadPlugin(e){const t=this.loadedPlugins.get(e);t&&(t.onunload(),container.get(TYPES.CommandManager).unregisterCommandByPlugin(e),this.loadedPlugins.delete(e))}async unloadThirdPartyPlugins(e){const t=e.filter((e=>e.enabled)).map((e=>e.key));for(const n of t)log(`unload third party plugin: ${n}`),await this.unloadPlugin(n)}async loadThirdPartyEnabledPlugins(e){return this.loadEnabledPlugins(e)}generateRequiredModules(){components={siyuan:api,axios:axios$1}}addAdditionalMethod(e,t,n){e.registerCommand=e=>{container.get(TYPES.CommandManager).registerCommand({...e,plugin:t,pluginName:n})};const r=container.get(TYPES.StorageManager);e.writeStorage=async(e,n)=>await r.setPluginStorage(t,e,n),e.loadStorage=async e=>await r.getPluginStorage(t,e)}};PluginLoader=__decorateClass$4([injectable(),__decorateParam$2(0,inject(TYPES.PluginFileManager))],PluginLoader);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?__getOwnPropDesc$3(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&__defProp$3(t,n,o),o};let PluginFileManager=class{async scanPlugins(e){const t=await FileClient.getInstanceApi().fileApi.readDir(e);if(!t)return[];const n=t,r=[];for(const i of n)i.name.startsWith(".")||i.isDir&&await isExists(`/data/plugins/${i.name}/manifest.json`)&&await isExists(`/data/plugins/${i.name}/main.js`)&&r.push(`/data/plugins/${i.name}`);return r}async getFileContent(e){return await FileClient.getInstanceApi().fileApi.getFile(e)||""}async getManifest(t){const n=await this.getFileContent(t);try{return JSON.parse(n)}catch(e){return error("loading manifest: "+t,e),null}}async getScript(e){return await this.getFileContent(e)}async getAllPlugins(){const e=await this.scanPlugins("/data/plugins");if(!e||!e.length)return log("No plugin found in /data/plugins"),[];const t=[];for(const n of e){log("Reading plugin from filesystem: "+n);const[e,r]=await Promise.all([this.getManifest(`${n}/manifest.json`),this.getScript(`${n}/main.js`)]);t.push({...e,script:r,enabled:!1,key:this.getFolderName(n)})}return t||[]}getFolderName(e){const t=e.split("/");for(let n=t.length-1;n>=0;n--)if(t[n])return t[n];return""}};PluginFileManager=__decorateClass$3([injectable()],PluginFileManager);var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?__getOwnPropDesc$2(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&__defProp$2(t,n,o),o};let EventBus=class{constructor(){this.eventListeners={}}destroy(){delete this.eventListeners}on(e,t){return this.eventListeners[e]||(this.eventListeners[e]=[]),this.eventListeners[e].push(t),()=>this.off(e,t)}off(e,t){if(t){for(let n=0;n{e(...t)}))}};EventBus=__decorateClass$2([injectable()],EventBus);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?__getOwnPropDesc$1(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&__defProp$1(t,n,o),o},__decorateParam$1=(e,t)=>(n,r)=>t(n,r,e);let CommandManager=class{constructor(e){this.commandList=[],this.shortcut=e}registerCommand(e){return this.commandList.some((t=>{t.plugin===e.plugin&&(t.command,e.command)}))?new Error$1("Command is already registered, do not register command repeatly"):e.shortcut&&this.commandList.some((t=>{t.shortcut,e.shortcut}))?new Warning("shortcut has already registered"):(this.commandList.push(e),this.shortcut.registerKeyboardEventFromPlugin(e),void log(`Register plugin: ${e.plugin} command: ${e.command}`))}unregisterCommandByPlugin(e){for(let t=0;t0;function addEvent(e,t,n,r){e.addEventListener?e.addEventListener(t,n,r):e.attachEvent&&e.attachEvent("on".concat(t),(function(){n(window.event)}))}function getMods(e,t){for(var n=t.slice(0,t.length-1),r=0;r=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function compareArray(e,t){for(var n=e.length>=t.length?e:t,r=e.length>=t.length?t:e,i=!0,o=0;o=0&&_downKeys.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&_downKeys.splice(0,_downKeys.length),93!==t&&224!==t||(t=91),t in _mods)for(var r in _mods[t]=!1,_modifier)_modifier[r]===t&&(hotkeys[r]=!1)}function unbind(e){if(void 0===e)Object.keys(_handlers).forEach((function(e){return delete _handlers[e]}));else if(Array.isArray(e))e.forEach((function(e){e.key&&eachUnbind(e)}));else if("object"==typeof e)e.key&&eachUnbind(e);else if("string"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?getMods(_modifier,t):[];_handlers[s]=_handlers[s].filter((function(e){return!((!r||e.method===r)&&e.scope===n&&compareArray(e.mods,c))}))}}))};function eventHandler(e,t,n,r){var i;if(t.element===r&&(t.scope===n||"all"===t.scope)){for(var o in i=t.mods.length>0,_mods)Object.prototype.hasOwnProperty.call(_mods,o)&&(!_mods[o]&&t.mods.indexOf(+o)>-1||_mods[o]&&-1===t.mods.indexOf(+o))&&(i=!1);(0!==t.mods.length||_mods[16]||_mods[18]||_mods[17]||_mods[91])&&!i&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function dispatch(e,t){var n=_handlers["*"],r=e.keyCode||e.which||e.charCode;if(hotkeys.filter.call(this,e)){if(93!==r&&224!==r||(r=91),-1===_downKeys.indexOf(r)&&229!==r&&_downKeys.push(r),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(t){var n=modifierMap[t];e[t]&&-1===_downKeys.indexOf(n)?_downKeys.push(n):!e[t]&&_downKeys.indexOf(n)>-1?_downKeys.splice(_downKeys.indexOf(n),1):"metaKey"===t&&e[t]&&3===_downKeys.length&&(e.ctrlKey||e.shiftKey||e.altKey||(_downKeys=_downKeys.slice(_downKeys.indexOf(n))))})),r in _mods){for(var i in _mods[r]=!0,_modifier)_modifier[i]===r&&(hotkeys[i]=!0);if(!n)return}for(var o in _mods)Object.prototype.hasOwnProperty.call(_mods,o)&&(_mods[o]=e[modifierMap[o]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(-1===_downKeys.indexOf(17)&&_downKeys.push(17),-1===_downKeys.indexOf(18)&&_downKeys.push(18),_mods[17]=!0,_mods[18]=!0);var a=getScope();if(n)for(var s=0;s-1}function hotkeys(e,t,n){_downKeys=[];var r=getKeys(e),i=[],o="all",a=document,s=0,c=!1,l=!0,u="+",p=!1;for(void 0===n&&"function"==typeof t&&(n=t),"[object Object]"===Object.prototype.toString.call(t)&&(t.scope&&(o=t.scope),t.element&&(a=t.element),t.keyup&&(c=t.keyup),void 0!==t.keydown&&(l=t.keydown),void 0!==t.capture&&(p=t.capture),"string"==typeof t.splitKey&&(u=t.splitKey)),"string"==typeof t&&(o=t);s1&&(i=getMods(_modifier,e)),(e="*"===(e=e[e.length-1])?"*":code(e))in _handlers||(_handlers[e]=[]),_handlers[e].push({keyup:c,keydown:l,scope:o,mods:i,shortcut:r[s],method:n,key:r[s],splitKey:u,element:a});void 0!==a&&!isElementBind(a)&&window&&(elementHasBindEvent.push(a),addEvent(a,"keydown",(function(e){dispatch(e,a)}),p),winListendFocus||(winListendFocus=!0,addEvent(window,"focus",(function(){_downKeys=[]}),p)),addEvent(a,"keyup",(function(e){dispatch(e,a),clearModifier(e)}),p))}function trigger(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";Object.keys(_handlers).forEach((function(n){_handlers[n].filter((function(n){return n.scope===t&&n.shortcut===e})).forEach((function(e){e&&e.method&&e.method()}))}))}var _api={getPressedKeyString:getPressedKeyString,setScope:setScope,getScope:getScope,deleteScope:deleteScope,getPressedKeyCodes:getPressedKeyCodes,isPressed:isPressed,filter:filter,trigger:trigger,unbind:unbind,keyMap:_keyMap,modifier:_modifier,modifierMap:modifierMap};for(var a in _api)Object.prototype.hasOwnProperty.call(_api,a)&&(hotkeys[a]=_api[a]);if("undefined"!=typeof window){var _hotkeys=window.hotkeys;hotkeys.noConflict=function(e){return e&&window.hotkeys===hotkeys&&(window.hotkeys=_hotkeys),hotkeys},window.hotkeys=hotkeys}var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?__getOwnPropDesc(t,n):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&__defProp(t,n,o),o},__decorateParam=(e,t)=>(n,r)=>t(n,r,e);hotkeys.filter=function(){return!0};let Shortcut=class{constructor(e){this.option={capture:!0},log("Initialize shortcut subsystem"),this.eventBus=e}registerKeyboardEvent(e,t){hotkeys(e,this.option,t),this.eventBus.on(e.toString(),t)}unregisterKeyboardEvent(e){hotkeys.unbind(e),this.eventBus.off(e.toString())}registerKeyboardEventFromPlugin(e){e.shortcut&&e.callback&&this.registerKeyboardEvent(e.shortcut,e.callback)}unregisterKeyboardEventFromPlugin(e){e.shortcut&&e.callback&&this.unregisterKeyboardEvent(e.shortcut)}};Shortcut=__decorateClass([injectable(),__decorateParam(0,inject(TYPES.EventBus))],Shortcut);const container=new Container;container.bind(TYPES.StorageManager).to(StorageManager).inSingletonScope(),container.bind(TYPES.SystemManager).to(SystemManager).inSingletonScope(),container.bind(TYPES.PluginSystem).to(PluginSystem).inSingletonScope(),container.bind(TYPES.PluginLoader).to(PluginLoader).inSingletonScope(),container.bind(TYPES.PluginFileManager).to(PluginFileManager).inSingletonScope(),container.bind(TYPES.EventBus).to(EventBus),container.bind(TYPES.Shortcut).to(Shortcut).inSingletonScope(),container.bind(TYPES.CommandManager).to(CommandManager).inSingletonScope(),container.bind(TYPES.Store).to(Store).inSingletonScope(),window.pluginSystem||(log("Siyuan Plugin System loading..."),window.pluginSystemVersion=VERSION$1,window.pluginSystem=container.get(TYPES.PluginSystem).init(),window.pluginSystemIocContainer=container)})(); diff --git a/apps/zhi-core/public/theme.json b/apps/zhi-core/public/theme.json new file mode 100644 index 00000000..aa99acb9 --- /dev/null +++ b/apps/zhi-core/public/theme.json @@ -0,0 +1,7 @@ +{ + "name": "zhi", + "author": "terwer", + "url": "https://github.com/terwer/zhi", + "version": "1.0.0", + "modes": ["dark", "light", "green"] +} diff --git a/apps/zhi-core/public/update-plugin-system.md b/apps/zhi-core/public/update-plugin-system.md new file mode 100644 index 00000000..2681b97e --- /dev/null +++ b/apps/zhi-core/public/update-plugin-system.md @@ -0,0 +1,4 @@ +## How to update plugin system + +- Download the latest `插件系统` widget in the siyuan-note bazaar +- Copy `plugin.js` to `zhi/plugin.js` \ No newline at end of file diff --git a/apps/zhi-core/scripts/build.ts b/apps/zhi-core/scripts/build.ts new file mode 100644 index 00000000..2f3445c7 --- /dev/null +++ b/apps/zhi-core/scripts/build.ts @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2023, Terwer . All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Terwer designates this + * particular file as subject to the "Classpath" exception as provided + * by Terwer in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com + * or visit www.terwer.space if you need additional information or have any + * questions. + */ + +import esbuild from "esbuild" +import { esbuildConfig } from "../esbuild.config" +import minimist from "minimist" + +/** + * zhi 主题构建 + * + * @author terwer + * @since 1.0.0 + */ +class ZhiBuild { + /** + * 构建过程 + * + * @param isWatch - 是否监视 + * @param isProduction - 是否生产模式 + */ + public static async processBuild(isWatch: boolean, isProduction: boolean) { + // dev + if (isWatch) { + const firstBuildFinished = new Set() + let buildStartTime: number + + // Following the log format of https://github.com/connor4312/esbuild-problem-matchers + const status = (msg: any) => console.log(`${isWatch ? "[watch] " : ""}${msg}`) + const watchPlugin = (type: any) => ({ + name: "watcher", + setup(build: any) { + build.onStart(() => { + buildStartTime = Date.now() + status(`${type} build started.`) + }) + build.onEnd((result: any) => { + result.errors.forEach((error: any) => + console.error( + `> ${error.location.file}:${error.location.line}:${error.location.column}: error: ${error.text}` + ) + ) + firstBuildFinished.add(type) + status(`${type} build finished in ${Date.now() - buildStartTime} ms.`) + if (firstBuildFinished.size === 2) { + // esbuild problem matcher extension is listening for this log, once this is logged, it will open the Extension Host + // So we have to assure only printing this when both extension and webview have been built + status(`build finished in ${Date.now() - buildStartTime} ms.`) + } + }) + }, + }) + + if (!esbuildConfig.plugins) { + esbuildConfig.plugins = [] + } + esbuildConfig.plugins.push(watchPlugin("extension")) + esbuildConfig.watch = true + } + + // 是否压缩 + esbuildConfig.minify = isProduction + esbuildConfig.sourcemap = isProduction ? false : "inline" + + // define + if (!esbuildConfig.define) { + esbuildConfig.define = {} + } + esbuildConfig.define = { + ...esbuildConfig.define, + "process.env.NODE_ENV": isProduction ? '"production"' : '"development"', + } + + // hande result + const resultHandler = async (result: any) => { + result.metafile && + console.log( + await esbuild.analyzeMetafile(result.metafile, { + verbose: true, + }) + ) + } + + // do build + esbuild + .build(esbuildConfig) + .then(resultHandler) + .catch(() => { + process.exit(1) + }) + } +} + +;(async function () { + console.log("Zhi plugins is building...") + + const args = minimist(process.argv.slice(2)) + const isWatch = args.watch || args.w + const isProduction = args.production + console.log("isWatch=>", isWatch) + console.log("isProduction=>", isProduction) + + try { + const buildResult = await ZhiBuild.processBuild(isWatch, isProduction) + console.log("Zhi build success.") + } catch (e) { + console.error("Zhi build error=>", e) + } +})() diff --git a/apps/zhi-core/src/index.ts b/apps/zhi-core/src/index.ts new file mode 100644 index 00000000..3f2475b9 --- /dev/null +++ b/apps/zhi-core/src/index.ts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023, Terwer . All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Terwer designates this + * particular file as subject to the "Classpath" exception as provided + * by Terwer in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com + * or visit www.terwer.space if you need additional information or have any + * questions. + */ +console.log("hello, zhi theme") diff --git a/apps/zhi-core/tsconfig.json b/apps/zhi-core/tsconfig.json new file mode 100644 index 00000000..0646e1d7 --- /dev/null +++ b/apps/zhi-core/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "tsconfig/base.json", + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "isolatedModules": false, + "esModuleInterop": true + }, + "include": ["env.d.ts", "**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b151ab33..af05bd55 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -102,15 +102,24 @@ importers: apps/zhi-core: devDependencies: + '@types/minimist': + specifier: ^1.2.2 + version: 1.2.2 + '@types/node': + specifier: ^18.15.11 + version: 18.15.11 esbuild: - specifier: ^0.17.16 - version: 0.17.16 - esbuild-dev-server: - specifier: ^0.3.0 - version: 0.3.0 + specifier: ^0.16.9 + version: 0.16.9 + minimist: + specifier: ^1.2.8 + version: 1.2.8 ts-node: specifier: ^10.9.1 - version: 10.9.1(@types/node@17.0.12)(typescript@4.7.4) + version: 10.9.1(@types/node@18.15.11)(typescript@4.7.4) + tsconfig: + specifier: workspace:* + version: link:../../packages/tsconfig packages/eslint-config-custom: dependencies: @@ -521,12 +530,31 @@ packages: resolution: {integrity: sha512-1ESCGgXRgn1r29hRmz8K0G4Ywr5jDWezMgRnICComBCWmg3znLWU8+tmakuM1og1Vn4W/sauvlABl/oq2pve8w==} dev: false + /@esbuild/android-arm64@0.16.9: + resolution: {integrity: sha512-ndIAZJUeLx4O+4AJbFQCurQW4VRUXjDsUvt1L+nP8bVELOWdmdCEOtlIweCUE6P+hU0uxYbEK2AEP0n5IVQvhg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm64@0.17.16: resolution: {integrity: sha512-QX48qmsEZW+gcHgTmAj+x21mwTz8MlYQBnzF6861cNdQGvj2jzzFjqH0EBabrIa/WVZ2CHolwMoqxVryqKt8+Q==} engines: {node: '>=12'} cpu: [arm64] os: [android] requiresBuild: true + dev: false + optional: true + + /@esbuild/android-arm@0.16.9: + resolution: {integrity: sha512-kW5ccqWHVOOTGUkkJbtfoImtqu3kA1PFkivM+9QPFSHphPfPBlBalX9eDRqPK+wHCqKhU48/78T791qPgC9e9A==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true optional: true /@esbuild/android-arm@0.17.16: @@ -535,6 +563,16 @@ packages: cpu: [arm] os: [android] requiresBuild: true + dev: false + optional: true + + /@esbuild/android-x64@0.16.9: + resolution: {integrity: sha512-UbMcJB4EHrAVOnknQklREPgclNU2CPet2h+sCBCXmF2mfoYWopBn/CfTfeyOkb/JglOcdEADqAljFndMKnFtOw==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true optional: true /@esbuild/android-x64@0.17.16: @@ -543,6 +581,16 @@ packages: cpu: [x64] os: [android] requiresBuild: true + dev: false + optional: true + + /@esbuild/darwin-arm64@0.16.9: + resolution: {integrity: sha512-d7D7/nrt4CxPul98lx4PXhyNZwTYtbdaHhOSdXlZuu5zZIznjqtMqLac8Bv+IuT6SVHiHUwrkL6ywD7mOgLW+A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true optional: true /@esbuild/darwin-arm64@0.17.16: @@ -551,6 +599,16 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true + dev: false + optional: true + + /@esbuild/darwin-x64@0.16.9: + resolution: {integrity: sha512-LZc+Wlz06AkJYtwWsBM3x2rSqTG8lntDuftsUNQ3fCx9ZttYtvlDcVtgb+NQ6t9s6K5No5zutN3pcjZEC2a4iQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true optional: true /@esbuild/darwin-x64@0.17.16: @@ -559,6 +617,16 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true + dev: false + optional: true + + /@esbuild/freebsd-arm64@0.16.9: + resolution: {integrity: sha512-gIj0UQZlQo93CHYouHKkpzP7AuruSaMIm1etcWIxccFEVqCN1xDr6BWlN9bM+ol/f0W9w3hx3HDuEwcJVtGneQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true optional: true /@esbuild/freebsd-arm64@0.17.16: @@ -567,6 +635,16 @@ packages: cpu: [arm64] os: [freebsd] requiresBuild: true + dev: false + optional: true + + /@esbuild/freebsd-x64@0.16.9: + resolution: {integrity: sha512-GNors4vaMJ7lzGOuhzNc7jvgsQZqErGA8rsW+nck8N1nYu86CvsJW2seigVrQQWOV4QzEP8Zf3gm+QCjA2hnBQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true optional: true /@esbuild/freebsd-x64@0.17.16: @@ -575,6 +653,16 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true + dev: false + optional: true + + /@esbuild/linux-arm64@0.16.9: + resolution: {integrity: sha512-YPxQunReYp8RQ1FvexFrOEqqf+nLbS3bKVZF5FRT2uKM7Wio7BeATqAwO02AyrdSEntt3I5fhFsujUChIa8CZg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true optional: true /@esbuild/linux-arm64@0.17.16: @@ -583,6 +671,16 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true + dev: false + optional: true + + /@esbuild/linux-arm@0.16.9: + resolution: {integrity: sha512-cNx1EF99c2t1Ztn0lk9N+MuwBijGF8mH6nx9GFsB3e0lpUpPkCE/yt5d+7NP9EwJf5uzqdjutgVYoH1SNqzudA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true optional: true /@esbuild/linux-arm@0.17.16: @@ -591,6 +689,16 @@ packages: cpu: [arm] os: [linux] requiresBuild: true + dev: false + optional: true + + /@esbuild/linux-ia32@0.16.9: + resolution: {integrity: sha512-zb12ixDIKNwFpIqR00J88FFitVwOEwO78EiUi8wi8FXlmSc3GtUuKV/BSO+730Kglt0B47+ZrJN1BhhOxZaVrw==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true optional: true /@esbuild/linux-ia32@0.17.16: @@ -599,6 +707,16 @@ packages: cpu: [ia32] os: [linux] requiresBuild: true + dev: false + optional: true + + /@esbuild/linux-loong64@0.16.9: + resolution: {integrity: sha512-X8te4NLxtHiNT6H+4Pfm5RklzItA1Qy4nfyttihGGX+Koc53Ar20ViC+myY70QJ8PDEOehinXZj/F7QK3A+MKQ==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true optional: true /@esbuild/linux-loong64@0.17.16: @@ -607,6 +725,16 @@ packages: cpu: [loong64] os: [linux] requiresBuild: true + dev: false + optional: true + + /@esbuild/linux-mips64el@0.16.9: + resolution: {integrity: sha512-ZqyMDLt02c5smoS3enlF54ndK5zK4IpClLTxF0hHfzHJlfm4y8IAkIF8LUW0W7zxcKy7oAwI7BRDqeVvC120SA==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true optional: true /@esbuild/linux-mips64el@0.17.16: @@ -615,6 +743,16 @@ packages: cpu: [mips64el] os: [linux] requiresBuild: true + dev: false + optional: true + + /@esbuild/linux-ppc64@0.16.9: + resolution: {integrity: sha512-k+ca5W5LDBEF3lfDwMV6YNXwm4wEpw9krMnNvvlNz3MrKSD2Eb2c861O0MaKrZkG/buTQAP4vkavbLwgIe6xjg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true optional: true /@esbuild/linux-ppc64@0.17.16: @@ -623,6 +761,16 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true + dev: false + optional: true + + /@esbuild/linux-riscv64@0.16.9: + resolution: {integrity: sha512-GuInVdogjmg9DhgkEmNipHkC+3tzkanPJzgzTC2ihsvrruLyFoR1YrTGixblNSMPudQLpiqkcwGwwe0oqfrvfA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true optional: true /@esbuild/linux-riscv64@0.17.16: @@ -631,6 +779,16 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true + dev: false + optional: true + + /@esbuild/linux-s390x@0.16.9: + resolution: {integrity: sha512-49wQ0aYkvwXonGsxc7LuuLNICMX8XtO92Iqmug5Qau0kpnV6SP34jk+jIeu4suHwAbSbRhVFtDv75yRmyfQcHw==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true optional: true /@esbuild/linux-s390x@0.17.16: @@ -639,6 +797,16 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true + dev: false + optional: true + + /@esbuild/linux-x64@0.16.9: + resolution: {integrity: sha512-Nx4oKEAJ6EcQlt4dK7qJyuZUoXZG7CAeY22R7rqZijFzwFfMOD+gLP56uV7RrV86jGf8PeRY8TBsRmOcZoG42w==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true optional: true /@esbuild/linux-x64@0.17.16: @@ -647,6 +815,16 @@ packages: cpu: [x64] os: [linux] requiresBuild: true + dev: false + optional: true + + /@esbuild/netbsd-x64@0.16.9: + resolution: {integrity: sha512-d0WnpgJ+FTiMZXEQ1NOv9+0gvEhttbgKEvVqWWAtl1u9AvlspKXbodKHzQ5MLP6YV1y52Xp+p8FMYqj8ykTahg==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true optional: true /@esbuild/netbsd-x64@0.17.16: @@ -655,6 +833,16 @@ packages: cpu: [x64] os: [netbsd] requiresBuild: true + dev: false + optional: true + + /@esbuild/openbsd-x64@0.16.9: + resolution: {integrity: sha512-jccK11278dvEscHFfMk5EIPjF4wv1qGD0vps7mBV1a6TspdR36O28fgPem/SA/0pcsCPHjww5ouCLwP+JNAFlw==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true optional: true /@esbuild/openbsd-x64@0.17.16: @@ -663,6 +851,16 @@ packages: cpu: [x64] os: [openbsd] requiresBuild: true + dev: false + optional: true + + /@esbuild/sunos-x64@0.16.9: + resolution: {integrity: sha512-OetwTSsv6mIDLqN7I7I2oX9MmHGwG+AP+wKIHvq+6sIHwcPPJqRx+DJB55jy9JG13CWcdcQno/7V5MTJ5a0xfQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true optional: true /@esbuild/sunos-x64@0.17.16: @@ -671,6 +869,16 @@ packages: cpu: [x64] os: [sunos] requiresBuild: true + dev: false + optional: true + + /@esbuild/win32-arm64@0.16.9: + resolution: {integrity: sha512-tKSSSK6unhxbGbHg+Cc+JhRzemkcsX0tPBvG0m5qsWbkShDK9c+/LSb13L18LWVdOQZwuA55Vbakxmt6OjBDOQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true optional: true /@esbuild/win32-arm64@0.17.16: @@ -679,6 +887,16 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true + dev: false + optional: true + + /@esbuild/win32-ia32@0.16.9: + resolution: {integrity: sha512-ZTQ5vhNS5gli0KK8I6/s6+LwXmNEfq1ftjnSVyyNm33dBw8zDpstqhGXYUbZSWWLvkqiRRjgxgmoncmi6Yy7Ng==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true optional: true /@esbuild/win32-ia32@0.17.16: @@ -687,6 +905,16 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true + dev: false + optional: true + + /@esbuild/win32-x64@0.16.9: + resolution: {integrity: sha512-C4ZX+YFIp6+lPrru3tpH6Gaapy8IBRHw/e7l63fzGDhn/EaiGpQgbIlT5paByyy+oMvRFQoxxyvC4LE0AjJMqQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true optional: true /@esbuild/win32-x64@0.17.16: @@ -695,6 +923,7 @@ packages: cpu: [x64] os: [win32] requiresBuild: true + dev: false optional: true /@eslint/eslintrc@0.4.3: @@ -834,6 +1063,7 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [glibc] requiresBuild: true dev: false optional: true @@ -843,6 +1073,7 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [musl] requiresBuild: true dev: false optional: true @@ -852,6 +1083,7 @@ packages: engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [glibc] requiresBuild: true dev: false optional: true @@ -861,6 +1093,7 @@ packages: engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [musl] requiresBuild: true dev: false optional: true @@ -1010,6 +1243,10 @@ packages: '@types/unist': 2.0.6 dev: false + /@types/minimist@1.2.2: + resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} + dev: true + /@types/ms@0.7.31: resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==} dev: false @@ -1024,6 +1261,10 @@ packages: resolution: {integrity: sha512-4YpbAsnJXWYK/fpTVFlMIcUIho2AYCi4wg5aNPrG1ng7fn/1/RZfCIpRCiBX+12RVa34RluilnvCqD+g3KiSiA==} dev: true + /@types/node@18.15.11: + resolution: {integrity: sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==} + dev: true + /@types/parse5@6.0.3: resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} dev: false @@ -1847,90 +2088,34 @@ packages: is-symbol: 1.0.4 dev: false - /esbuild-dev-server-darwin-arm64@0.3.0: - resolution: {integrity: sha512-HvKg1JfBhooY/pR60LaXkV2b1Pf2sWjjVn8lLCzxOMPh/DT28y3m/CmktT8Xdi7AUsvdh+7IGTzQwR/jZ1bYNw==} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /esbuild-dev-server-darwin-x64@0.3.0: - resolution: {integrity: sha512-QKph7OPuZZyyEK7Ehvvdqik2jm8iipBGTOjNsA3RgA6r6tQbqChA0ICkKQlLG6U2IUMj/eqc6ZGk/fdDJgckPw==} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /esbuild-dev-server-linux-arm64@0.3.0: - resolution: {integrity: sha512-4sZG6oDyLaS/Jo2Kdsh/Z7OPsmvxXgFu1umaJOyCkJ27WAY+l7LBbPiDRIV1ANIEce/puQ9nU3qTCWRYoSQiWA==} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-dev-server-linux-arm@0.3.0: - resolution: {integrity: sha512-OdtPE5SkukZ1DYvA2l/ZjPY79Qj4Wjk93EO5aYWQRcZoeQgt//Nrll3hV144ObP32s4it/dGVkE3yiyaxeJ8gg==} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-dev-server-linux-x32@0.3.0: - resolution: {integrity: sha512-zvIKHcEpNs8G2F1HPkB13e9B0aE1ccY5KU4jCbBTKrZCvp1k4cgjuQI6E9wQUdmS5KFq5dvOteidqF9agddZFg==} - cpu: [x32] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-dev-server-linux-x64@0.3.0: - resolution: {integrity: sha512-aweybli47+13S8Y1KdAHkkHCbEr4EDKzGCuAHlU1BAeeCaarBjPnldvKPUuHRKzUTYTnAXXnbni9OFJCh0C9OA==} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-dev-server-win32-arm64@0.3.0: - resolution: {integrity: sha512-BVcg9b1lXIJg7uftFJWfX2r93RYZndK6AqsMurjoc+l7QU4B0Cc+X9Z2xxMYyDlWH95YF+CckE8Hu5mXlbV7Rw==} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild-dev-server-win32-x32@0.3.0: - resolution: {integrity: sha512-RTyBIGayeH1M6HpXMrwXfTllayflp9jingV5SGg1ca6fSlt6Q3HGTBwcfIFgPdS5MsUWaqDF3X3D1NO2lVRJfA==} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild-dev-server-win32-x64@0.3.0: - resolution: {integrity: sha512-t3SU0rdXbkfBtmrNxeq1IShTyaCDzZg5HIUnVphJT2DUjVsF4ndJk9vJ6JvN/bPCt+XH6SvuAWvdMoUemLu7Bw==} - cpu: [x64] - os: [win32] + /esbuild@0.16.9: + resolution: {integrity: sha512-gkH83yHyijMSZcZFs1IWew342eMdFuWXmQo3zkDPTre25LIPBJsXryg02M3u8OpTwCJdBkdaQwqKkDLnAsAeLQ==} + engines: {node: '>=12'} + hasBin: true requiresBuild: true - dev: true - optional: true - - /esbuild-dev-server@0.3.0: - resolution: {integrity: sha512-2oYnryt+Yoqx6iADcuJ5/tC3/xptZf+x5sCus86VkUrjq0gny9nx7oL/eUkopxNIjygIm2SYGysQOdyAx3I7qQ==} optionalDependencies: - esbuild-dev-server-darwin-arm64: 0.3.0 - esbuild-dev-server-darwin-x64: 0.3.0 - esbuild-dev-server-linux-arm: 0.3.0 - esbuild-dev-server-linux-arm64: 0.3.0 - esbuild-dev-server-linux-x32: 0.3.0 - esbuild-dev-server-linux-x64: 0.3.0 - esbuild-dev-server-win32-arm64: 0.3.0 - esbuild-dev-server-win32-x32: 0.3.0 - esbuild-dev-server-win32-x64: 0.3.0 + '@esbuild/android-arm': 0.16.9 + '@esbuild/android-arm64': 0.16.9 + '@esbuild/android-x64': 0.16.9 + '@esbuild/darwin-arm64': 0.16.9 + '@esbuild/darwin-x64': 0.16.9 + '@esbuild/freebsd-arm64': 0.16.9 + '@esbuild/freebsd-x64': 0.16.9 + '@esbuild/linux-arm': 0.16.9 + '@esbuild/linux-arm64': 0.16.9 + '@esbuild/linux-ia32': 0.16.9 + '@esbuild/linux-loong64': 0.16.9 + '@esbuild/linux-mips64el': 0.16.9 + '@esbuild/linux-ppc64': 0.16.9 + '@esbuild/linux-riscv64': 0.16.9 + '@esbuild/linux-s390x': 0.16.9 + '@esbuild/linux-x64': 0.16.9 + '@esbuild/netbsd-x64': 0.16.9 + '@esbuild/openbsd-x64': 0.16.9 + '@esbuild/sunos-x64': 0.16.9 + '@esbuild/win32-arm64': 0.16.9 + '@esbuild/win32-ia32': 0.16.9 + '@esbuild/win32-x64': 0.16.9 dev: true /esbuild@0.17.16: @@ -1961,6 +2146,7 @@ packages: '@esbuild/win32-arm64': 0.17.16 '@esbuild/win32-ia32': 0.17.16 '@esbuild/win32-x64': 0.17.16 + dev: false /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} @@ -3527,7 +3713,6 @@ packages: /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - dev: false /mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} @@ -4493,7 +4678,7 @@ packages: resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} dev: false - /ts-node@10.9.1(@types/node@17.0.12)(typescript@4.7.4): + /ts-node@10.9.1(@types/node@18.15.11)(typescript@4.7.4): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -4512,7 +4697,7 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 - '@types/node': 17.0.12 + '@types/node': 18.15.11 acorn: 8.8.2 acorn-walk: 8.2.0 arg: 4.1.3