code-inspector-plugin 0.14.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +227 -155
- package/package.json +5 -4
- package/types/index.d.ts +1 -1
- package/dist/.eslintrc.js +0 -7
- package/dist/append-code-5685.js +0 -2
package/README.md
CHANGED
|
@@ -40,6 +40,8 @@ The following are which compilers, web frameworks and editors we supported now:
|
|
|
40
40
|
✅ webpack<br />
|
|
41
41
|
✅ vite<br />
|
|
42
42
|
✅ rspack / rsbuild<br />
|
|
43
|
+
✅ farm<br />
|
|
44
|
+
✅ esbuild<br />
|
|
43
45
|
✅ nextjs / nuxt / umijs eg.<br />
|
|
44
46
|
- The following Web frameworks are currently supported:<br />
|
|
45
47
|
✅ vue2<br />
|
|
@@ -149,6 +151,43 @@ Please check here for more usage information: [code-inspector-plugin configurati
|
|
|
149
151
|
|
|
150
152
|
</details>
|
|
151
153
|
|
|
154
|
+
<details>
|
|
155
|
+
<summary>Click to expand configuration about: <b>esbuild</b></summary>
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
// esbuild.config.js
|
|
159
|
+
const esbuild = require('esbuild');
|
|
160
|
+
const { codeInspectorPlugin } = require('code-inspector-plugin');
|
|
161
|
+
|
|
162
|
+
esbuild.build({
|
|
163
|
+
// other configs...
|
|
164
|
+
// [注意] esbuild 中使用时,dev 函数的返回值需自己根据环境判断,本地开发的环境返回 true,线上打包返回 false
|
|
165
|
+
plugins: [codeInspectorPlugin({ bundler: 'esbuild', dev: () => true })],
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
</details>
|
|
170
|
+
|
|
171
|
+
<details>
|
|
172
|
+
<summary>Click to expand configuration about: <b>farm</b></summary>
|
|
173
|
+
|
|
174
|
+
```js
|
|
175
|
+
// farm.config.js
|
|
176
|
+
import { defineConfig } from '@farmfe/core';
|
|
177
|
+
import { codeInspectorPlugin } from 'code-inspector-plugin';
|
|
178
|
+
|
|
179
|
+
export default defineConfig({
|
|
180
|
+
vitePlugins: [
|
|
181
|
+
codeInspectorPlugin({
|
|
182
|
+
bundler: 'vite',
|
|
183
|
+
}),
|
|
184
|
+
// ...other code
|
|
185
|
+
],
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
</details>
|
|
190
|
+
|
|
152
191
|
<details>
|
|
153
192
|
<summary>Click to expand configuration about: <b>vue-cli</b></summary>
|
|
154
193
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var P=Object.defineProperty,k=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var b=(e,t,n)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||(t={}))x.call(t,n)&&b(e,n,t[n]);if(_)for(var n of _(t))R.call(t,n)&&b(e,n,t[n]);return e},D=(e,t)=>k(e,C(t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("vite-code-inspector-plugin"),L=require("webpack-code-inspector-plugin"),f=require("code-inspector-core"),g=require("fs"),v=require("path"),F=require("chalk");var K=(e,t,n)=>new Promise((s,c)=>{var r=a=>{try{i(n.next(a))}catch(u){c(u)}},o=a=>{try{i(n.throw(a))}catch(u){c(u)}},i=a=>a.done?s(a.value):Promise.resolve(a.value).then(r,o);i((n=n.apply(e,t)).next())});const A="esbuild-code-inspector-plugin";function Y(e){let t;return typeof e=="function"?t=e():t=e,!!t}function M(e){return{name:A,setup(t){if(e.close||!Y(e.dev))return;const n={port:0,entry:"",output:e.output},{escapeTags:s=[]}=e,c=new Map;t.onLoad({filter:e.match||/\.(jsx|tsx|js|ts|mjs|mts)?$/},r=>K(this,null,function*(){const o=r.path;let i=yield g.promises.readFile(o,"utf8"),a=c.get(o);if(!a||a.originCode!==i){let u=yield f.getCodeWithWebComponent(e,o,i,n),d="";if(f.isJsTypeFile(o)?d="jsx":o.endsWith(".svelte")&&(d="svelte"),d)u=f.transformCode({content:u,filePath:o,fileType:d,escapeTags:s});else if(o.endsWith(".vue")){d="vue";const{descriptor:E}=f.parseSFC(u,{sourceMap:!1}),V=f.transformCode({content:E.template.content,filePath:o,fileType:d,escapeTags:s});u=u.replace(E.template.content,V)}const $=v.extname(o).replace(".","");a={originCode:i,output:{contents:u,loader:$}},c.set(o,a)}return a.output}))}}}function U(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function s(){if(this instanceof s){var c=[null];c.push.apply(c,arguments);var r=Function.bind.apply(t,c);return new r}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var c=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,c.get?c:{enumerable:!0,get:function(){return e[s]}})}),n}var p={},q={get exports(){return p},set exports(e){p=e}};const B={},W=Object.freeze(Object.defineProperty({__proto__:null,default:B},Symbol.toStringTag,{value:"Module"})),I=U(W),J="dotenv",G="16.3.1",Q="Loads environment variables from .env file",z="lib/main.js",H="lib/main.d.ts",X={".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},Z={"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec",prerelease:"npm test",release:"standard-version"},ee={type:"git",url:"git://github.com/motdotla/dotenv.git"},te="https://github.com/motdotla/dotenv?sponsor=1",ne=["dotenv","env",".env","environment","variables","config","settings"],re="README.md",oe="BSD-2-Clause",se={"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3",decache:"^4.6.1",sinon:"^14.0.1",standard:"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0",tap:"^16.3.0",tar:"^6.1.11",typescript:"^4.8.4"},ce={node:">=12"},ie={fs:!1},ae={name:J,version:G,description:Q,main:z,types:H,exports:X,scripts:Z,repository:ee,funding:te,keywords:ne,readmeFilename:re,license:oe,devDependencies:se,engines:ce,browser:ie},O=g,h=v,le=I,ue=I,de=ae,y=de.version,pe=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function fe(e){const t={};let n=e.toString();n=n.replace(/\r\n?/mg,"\n");let s;for(;(s=pe.exec(n))!=null;){const c=s[1];let r=s[2]||"";r=r.trim();const o=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(r=r.replace(/\\n/g,"\n"),r=r.replace(/\\r/g,"\r")),t[c]=r}return t}function ve(e){const t=j(e),n=l.configDotenv({path:t});if(!n.parsed)throw new Error("MISSING_DATA: Cannot parse ".concat(t," for an unknown reason"));const s=T(e).split(","),c=s.length;let r;for(let o=0;o<c;o++)try{const i=s[o].trim(),a=he(n,i);r=l.decrypt(a.ciphertext,a.key);break}catch(i){if(o+1>=c)throw i}return l.parse(r)}function ge(e){console.log("[dotenv@".concat(y,"][INFO] ").concat(e))}function me(e){console.log("[dotenv@".concat(y,"][WARN] ").concat(e))}function m(e){console.log("[dotenv@".concat(y,"][DEBUG] ").concat(e))}function T(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function he(e,t){let n;try{n=new URL(t)}catch(i){throw i.code==="ERR_INVALID_URL"?new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development"):i}const s=n.password;if(!s)throw new Error("INVALID_DOTENV_KEY: Missing key part");const c=n.searchParams.get("environment");if(!c)throw new Error("INVALID_DOTENV_KEY: Missing environment part");const r="DOTENV_VAULT_".concat(c.toUpperCase()),o=e.parsed[r];if(!o)throw new Error("NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ".concat(r," in your .env.vault file."));return{ciphertext:o,key:s}}function j(e){let t=h.resolve(process.cwd(),".env");return e&&e.path&&e.path.length>0&&(t=e.path),t.endsWith(".vault")?t:"".concat(t,".vault")}function ye(e){return e[0]==="~"?h.join(le.homedir(),e.slice(1)):e}function Ee(e){ge("Loading env from encrypted .env.vault");const t=l._parseVault(e);let n=process.env;return e&&e.processEnv!=null&&(n=e.processEnv),l.populate(n,t,e),{parsed:t}}function _e(e){let t=h.resolve(process.cwd(),".env"),n="utf8";const s=!!(e&&e.debug);e&&(e.path!=null&&(t=ye(e.path)),e.encoding!=null&&(n=e.encoding));try{const c=l.parse(O.readFileSync(t,{encoding:n}));let r=process.env;return e&&e.processEnv!=null&&(r=e.processEnv),l.populate(r,c,e),{parsed:c}}catch(c){return s&&m("Failed to load ".concat(t," ").concat(c.message)),{error:c}}}function be(e){const t=j(e);return T(e).length===0?l.configDotenv(e):O.existsSync(t)?l._configVault(e):(me("You set DOTENV_KEY but you are missing a .env.vault file at ".concat(t,". Did you forget to build it?")),l.configDotenv(e))}function we(e,t){const n=Buffer.from(t.slice(-64),"hex");let s=Buffer.from(e,"base64");const c=s.slice(0,12),r=s.slice(-16);s=s.slice(12,-16);try{const o=ue.createDecipheriv("aes-256-gcm",n,c);return o.setAuthTag(r),"".concat(o.update(s)).concat(o.final())}catch(o){const i=o instanceof RangeError,a=o.message==="Invalid key length",u=o.message==="Unsupported state or unable to authenticate data";if(i||a){const d="INVALID_DOTENV_KEY: It must be 64 characters long (or more)";throw new Error(d)}else if(u){const d="DECRYPTION_FAILED: Please check your DOTENV_KEY";throw new Error(d)}else throw console.error("Error: ",o.code),console.error("Error: ",o.message),o}}function De(e,t,n={}){const s=!!(n&&n.debug),c=!!(n&&n.override);if(typeof t!="object")throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");for(const r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(c===!0&&(e[r]=t[r]),s&&m(c===!0?'"'.concat(r,'" is already defined and WAS overwritten'):'"'.concat(r,'" is already defined and was NOT overwritten'))):e[r]=t[r]}const l={configDotenv:_e,_configVault:Ee,_parseVault:ve,config:be,decrypt:we,parse:fe,populate:De};p.configDotenv=l.configDotenv;p._configVault=l._configVault;p._parseVault=l._parseVault;p.config=l.config;p.decrypt=l.decrypt;p.parse=l.parse;p.populate=l.populate;q.exports=l;function N(e){if(!(e!=null&&e.bundler)){console.log(F.red("Please specify the bundler in the options of code-inspector-plugin."));return}let t=!1;if(e.needEnvInspector)if(t=!0,process.env.CODE_INSPECTOR==="true")t=!1;else{const r=v.resolve(process.cwd(),".env.local");if(g.existsSync(r)){const o=g.readFileSync(r,"utf-8"),i=p.parse(o||"");(i==null?void 0:i.CODE_INSPECTOR)==="true"&&(t=!1)}}let n="";typeof __dirname!="undefined"?n=__dirname:n=v.dirname(f.fileURLToPath(typeof document=="undefined"?require("url").pathToFileURL(__filename).href:document.currentScript&&document.currentScript.src||new URL("index.js",document.baseURI).href));const s=D(w({},e),{close:t,output:v.resolve(n,"./")});return e.bundler==="webpack"||e.bundler==="rspack"?new L(s):e.bundler==="esbuild"?M(s):S.ViteCodeInspectorPlugin(s)}const Ie=N;exports.CodeInspectorPlugin=N;exports.codeInspectorPlugin=Ie;
|
package/dist/index.mjs
CHANGED
|
@@ -1,31 +1,103 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var V = Object.defineProperty, k = Object.defineProperties;
|
|
2
|
+
var P = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var E = Object.getOwnPropertySymbols;
|
|
4
|
+
var x = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var _ = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, b = (e, t) => {
|
|
6
6
|
for (var n in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var n of
|
|
10
|
-
|
|
7
|
+
x.call(t, n) && _(e, n, t[n]);
|
|
8
|
+
if (E)
|
|
9
|
+
for (var n of E(t))
|
|
10
|
+
C.call(t, n) && _(e, n, t[n]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
13
|
-
import { ViteCodeInspectorPlugin as
|
|
14
|
-
import
|
|
15
|
-
import { fileURLToPath as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
12
|
+
}, w = (e, t) => k(e, P(t));
|
|
13
|
+
import { ViteCodeInspectorPlugin as R } from "vite-code-inspector-plugin";
|
|
14
|
+
import K from "webpack-code-inspector-plugin";
|
|
15
|
+
import { getCodeWithWebComponent as L, isJsTypeFile as S, parseSFC as A, transformCode as D, fileURLToPath as F } from "code-inspector-core";
|
|
16
|
+
import f from "fs";
|
|
17
|
+
import v, { dirname as Y } from "path";
|
|
18
|
+
import M from "chalk";
|
|
19
|
+
var B = (e, t, n) => new Promise((s, c) => {
|
|
20
|
+
var r = (a) => {
|
|
21
|
+
try {
|
|
22
|
+
i(n.next(a));
|
|
23
|
+
} catch (u) {
|
|
24
|
+
c(u);
|
|
25
|
+
}
|
|
26
|
+
}, o = (a) => {
|
|
27
|
+
try {
|
|
28
|
+
i(n.throw(a));
|
|
29
|
+
} catch (u) {
|
|
30
|
+
c(u);
|
|
31
|
+
}
|
|
32
|
+
}, i = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(r, o);
|
|
33
|
+
i((n = n.apply(e, t)).next());
|
|
34
|
+
});
|
|
35
|
+
const W = "esbuild-code-inspector-plugin";
|
|
36
|
+
function U(e) {
|
|
37
|
+
let t;
|
|
38
|
+
return typeof e == "function" ? t = e() : t = e, !!t;
|
|
39
|
+
}
|
|
40
|
+
function q(e) {
|
|
41
|
+
return {
|
|
42
|
+
name: W,
|
|
43
|
+
setup(t) {
|
|
44
|
+
if (e.close || !U(e.dev))
|
|
45
|
+
return;
|
|
46
|
+
const n = {
|
|
47
|
+
port: 0,
|
|
48
|
+
entry: "",
|
|
49
|
+
output: e.output
|
|
50
|
+
}, { escapeTags: s = [] } = e, c = /* @__PURE__ */ new Map();
|
|
51
|
+
t.onLoad(
|
|
52
|
+
{ filter: e.match || /\.(jsx|tsx|js|ts|mjs|mts)?$/ },
|
|
53
|
+
(r) => B(this, null, function* () {
|
|
54
|
+
const o = r.path;
|
|
55
|
+
let i = yield f.promises.readFile(o, "utf8"), a = c.get(o);
|
|
56
|
+
if (!a || a.originCode !== i) {
|
|
57
|
+
let u = yield L(
|
|
58
|
+
e,
|
|
59
|
+
o,
|
|
60
|
+
i,
|
|
61
|
+
n
|
|
62
|
+
), p = "";
|
|
63
|
+
if (S(o) ? p = "jsx" : o.endsWith(".svelte") && (p = "svelte"), p)
|
|
64
|
+
u = D({
|
|
65
|
+
content: u,
|
|
66
|
+
filePath: o,
|
|
67
|
+
fileType: p,
|
|
68
|
+
escapeTags: s
|
|
69
|
+
});
|
|
70
|
+
else if (o.endsWith(".vue")) {
|
|
71
|
+
p = "vue";
|
|
72
|
+
const { descriptor: y } = A(u, {
|
|
73
|
+
sourceMap: !1
|
|
74
|
+
}), $ = D({
|
|
75
|
+
content: y.template.content,
|
|
76
|
+
filePath: o,
|
|
77
|
+
fileType: p,
|
|
78
|
+
escapeTags: s
|
|
79
|
+
});
|
|
80
|
+
u = u.replace(y.template.content, $);
|
|
81
|
+
}
|
|
82
|
+
const I = v.extname(o).replace(".", "");
|
|
83
|
+
a = { originCode: i, output: { contents: u, loader: I } }, c.set(o, a);
|
|
84
|
+
}
|
|
85
|
+
return a.output;
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function J(e) {
|
|
20
92
|
if (e.__esModule)
|
|
21
93
|
return e;
|
|
22
94
|
var t = e.default;
|
|
23
95
|
if (typeof t == "function") {
|
|
24
|
-
var n = function
|
|
25
|
-
if (this instanceof
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
var r = Function.bind.apply(t,
|
|
96
|
+
var n = function s() {
|
|
97
|
+
if (this instanceof s) {
|
|
98
|
+
var c = [null];
|
|
99
|
+
c.push.apply(c, arguments);
|
|
100
|
+
var r = Function.bind.apply(t, c);
|
|
29
101
|
return new r();
|
|
30
102
|
}
|
|
31
103
|
return t.apply(this, arguments);
|
|
@@ -33,28 +105,28 @@ function K(e) {
|
|
|
33
105
|
n.prototype = t.prototype;
|
|
34
106
|
} else
|
|
35
107
|
n = {};
|
|
36
|
-
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(
|
|
37
|
-
var
|
|
38
|
-
Object.defineProperty(n,
|
|
108
|
+
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(s) {
|
|
109
|
+
var c = Object.getOwnPropertyDescriptor(e, s);
|
|
110
|
+
Object.defineProperty(n, s, c.get ? c : {
|
|
39
111
|
enumerable: !0,
|
|
40
112
|
get: function() {
|
|
41
|
-
return e[
|
|
113
|
+
return e[s];
|
|
42
114
|
}
|
|
43
115
|
});
|
|
44
116
|
}), n;
|
|
45
117
|
}
|
|
46
|
-
var
|
|
118
|
+
var d = {}, G = {
|
|
47
119
|
get exports() {
|
|
48
|
-
return
|
|
120
|
+
return d;
|
|
49
121
|
},
|
|
50
122
|
set exports(e) {
|
|
51
|
-
|
|
123
|
+
d = e;
|
|
52
124
|
}
|
|
53
125
|
};
|
|
54
|
-
const
|
|
126
|
+
const Q = {}, z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
55
127
|
__proto__: null,
|
|
56
|
-
default:
|
|
57
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
128
|
+
default: Q
|
|
129
|
+
}, Symbol.toStringTag, { value: "Module" })), O = /* @__PURE__ */ J(z), H = "dotenv", X = "16.3.1", Z = "Loads environment variables from .env file", ee = "lib/main.js", te = "lib/main.d.ts", ne = {
|
|
58
130
|
".": {
|
|
59
131
|
types: "./lib/main.d.ts",
|
|
60
132
|
require: "./lib/main.js",
|
|
@@ -67,7 +139,7 @@ const L = {}, S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
67
139
|
"./lib/cli-options": "./lib/cli-options.js",
|
|
68
140
|
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
69
141
|
"./package.json": "./package.json"
|
|
70
|
-
},
|
|
142
|
+
}, re = {
|
|
71
143
|
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
72
144
|
lint: "standard",
|
|
73
145
|
"lint-readme": "standard-markdown",
|
|
@@ -75,10 +147,10 @@ const L = {}, S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
75
147
|
test: "tap tests/*.js --100 -Rspec",
|
|
76
148
|
prerelease: "npm test",
|
|
77
149
|
release: "standard-version"
|
|
78
|
-
},
|
|
150
|
+
}, oe = {
|
|
79
151
|
type: "git",
|
|
80
152
|
url: "git://github.com/motdotla/dotenv.git"
|
|
81
|
-
},
|
|
153
|
+
}, se = "https://github.com/motdotla/dotenv?sponsor=1", ce = [
|
|
82
154
|
"dotenv",
|
|
83
155
|
"env",
|
|
84
156
|
".env",
|
|
@@ -86,7 +158,7 @@ const L = {}, S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
86
158
|
"variables",
|
|
87
159
|
"config",
|
|
88
160
|
"settings"
|
|
89
|
-
],
|
|
161
|
+
], ie = "README.md", ae = "BSD-2-Clause", le = {
|
|
90
162
|
"@definitelytyped/dtslint": "^0.0.133",
|
|
91
163
|
"@types/node": "^18.11.3",
|
|
92
164
|
decache: "^4.6.1",
|
|
@@ -97,165 +169,165 @@ const L = {}, S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
97
169
|
tap: "^16.3.0",
|
|
98
170
|
tar: "^6.1.11",
|
|
99
171
|
typescript: "^4.8.4"
|
|
100
|
-
},
|
|
172
|
+
}, ue = {
|
|
101
173
|
node: ">=12"
|
|
102
|
-
},
|
|
174
|
+
}, pe = {
|
|
103
175
|
fs: !1
|
|
104
|
-
},
|
|
105
|
-
name:
|
|
106
|
-
version:
|
|
107
|
-
description:
|
|
108
|
-
main:
|
|
109
|
-
types:
|
|
110
|
-
exports:
|
|
111
|
-
scripts:
|
|
112
|
-
repository:
|
|
113
|
-
funding:
|
|
114
|
-
keywords:
|
|
115
|
-
readmeFilename:
|
|
116
|
-
license:
|
|
117
|
-
devDependencies:
|
|
118
|
-
engines:
|
|
119
|
-
browser:
|
|
120
|
-
},
|
|
121
|
-
function
|
|
176
|
+
}, de = {
|
|
177
|
+
name: H,
|
|
178
|
+
version: X,
|
|
179
|
+
description: Z,
|
|
180
|
+
main: ee,
|
|
181
|
+
types: te,
|
|
182
|
+
exports: ne,
|
|
183
|
+
scripts: re,
|
|
184
|
+
repository: oe,
|
|
185
|
+
funding: se,
|
|
186
|
+
keywords: ce,
|
|
187
|
+
readmeFilename: ie,
|
|
188
|
+
license: ae,
|
|
189
|
+
devDependencies: le,
|
|
190
|
+
engines: ue,
|
|
191
|
+
browser: pe
|
|
192
|
+
}, T = f, m = v, fe = O, ve = O, ge = de, h = ge.version, me = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
193
|
+
function he(e) {
|
|
122
194
|
const t = {};
|
|
123
195
|
let n = e.toString();
|
|
124
196
|
n = n.replace(/\r\n?/mg, "\n");
|
|
125
|
-
let
|
|
126
|
-
for (; (
|
|
127
|
-
const
|
|
128
|
-
let r =
|
|
197
|
+
let s;
|
|
198
|
+
for (; (s = me.exec(n)) != null; ) {
|
|
199
|
+
const c = s[1];
|
|
200
|
+
let r = s[2] || "";
|
|
129
201
|
r = r.trim();
|
|
130
|
-
const
|
|
131
|
-
r = r.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"),
|
|
202
|
+
const o = r[0];
|
|
203
|
+
r = r.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"), o === '"' && (r = r.replace(/\\n/g, "\n"), r = r.replace(/\\r/g, "\r")), t[c] = r;
|
|
132
204
|
}
|
|
133
205
|
return t;
|
|
134
206
|
}
|
|
135
|
-
function
|
|
136
|
-
const t =
|
|
207
|
+
function ye(e) {
|
|
208
|
+
const t = j(e), n = l.configDotenv({ path: t });
|
|
137
209
|
if (!n.parsed)
|
|
138
210
|
throw new Error("MISSING_DATA: Cannot parse ".concat(t, " for an unknown reason"));
|
|
139
|
-
const
|
|
211
|
+
const s = N(e).split(","), c = s.length;
|
|
140
212
|
let r;
|
|
141
|
-
for (let
|
|
213
|
+
for (let o = 0; o < c; o++)
|
|
142
214
|
try {
|
|
143
|
-
const
|
|
144
|
-
r =
|
|
215
|
+
const i = s[o].trim(), a = be(n, i);
|
|
216
|
+
r = l.decrypt(a.ciphertext, a.key);
|
|
145
217
|
break;
|
|
146
|
-
} catch (
|
|
147
|
-
if (
|
|
148
|
-
throw
|
|
218
|
+
} catch (i) {
|
|
219
|
+
if (o + 1 >= c)
|
|
220
|
+
throw i;
|
|
149
221
|
}
|
|
150
|
-
return
|
|
222
|
+
return l.parse(r);
|
|
151
223
|
}
|
|
152
|
-
function
|
|
153
|
-
console.log("[dotenv@".concat(
|
|
224
|
+
function Ee(e) {
|
|
225
|
+
console.log("[dotenv@".concat(h, "][INFO] ").concat(e));
|
|
154
226
|
}
|
|
155
|
-
function
|
|
156
|
-
console.log("[dotenv@".concat(
|
|
227
|
+
function _e(e) {
|
|
228
|
+
console.log("[dotenv@".concat(h, "][WARN] ").concat(e));
|
|
157
229
|
}
|
|
158
|
-
function
|
|
159
|
-
console.log("[dotenv@".concat(
|
|
230
|
+
function g(e) {
|
|
231
|
+
console.log("[dotenv@".concat(h, "][DEBUG] ").concat(e));
|
|
160
232
|
}
|
|
161
|
-
function
|
|
233
|
+
function N(e) {
|
|
162
234
|
return e && e.DOTENV_KEY && e.DOTENV_KEY.length > 0 ? e.DOTENV_KEY : process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0 ? process.env.DOTENV_KEY : "";
|
|
163
235
|
}
|
|
164
|
-
function
|
|
236
|
+
function be(e, t) {
|
|
165
237
|
let n;
|
|
166
238
|
try {
|
|
167
239
|
n = new URL(t);
|
|
168
|
-
} catch (
|
|
169
|
-
throw
|
|
240
|
+
} catch (i) {
|
|
241
|
+
throw i.code === "ERR_INVALID_URL" ? new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development") : i;
|
|
170
242
|
}
|
|
171
|
-
const
|
|
172
|
-
if (!o)
|
|
173
|
-
throw new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
174
|
-
const s = n.searchParams.get("environment");
|
|
243
|
+
const s = n.password;
|
|
175
244
|
if (!s)
|
|
176
|
-
throw new Error("INVALID_DOTENV_KEY: Missing
|
|
177
|
-
const
|
|
245
|
+
throw new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
246
|
+
const c = n.searchParams.get("environment");
|
|
178
247
|
if (!c)
|
|
248
|
+
throw new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
249
|
+
const r = "DOTENV_VAULT_".concat(c.toUpperCase()), o = e.parsed[r];
|
|
250
|
+
if (!o)
|
|
179
251
|
throw new Error("NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ".concat(r, " in your .env.vault file."));
|
|
180
|
-
return { ciphertext:
|
|
252
|
+
return { ciphertext: o, key: s };
|
|
181
253
|
}
|
|
182
|
-
function
|
|
183
|
-
let t =
|
|
254
|
+
function j(e) {
|
|
255
|
+
let t = m.resolve(process.cwd(), ".env");
|
|
184
256
|
return e && e.path && e.path.length > 0 && (t = e.path), t.endsWith(".vault") ? t : "".concat(t, ".vault");
|
|
185
257
|
}
|
|
186
|
-
function
|
|
187
|
-
return e[0] === "~" ?
|
|
258
|
+
function we(e) {
|
|
259
|
+
return e[0] === "~" ? m.join(fe.homedir(), e.slice(1)) : e;
|
|
188
260
|
}
|
|
189
|
-
function
|
|
190
|
-
|
|
191
|
-
const t =
|
|
261
|
+
function De(e) {
|
|
262
|
+
Ee("Loading env from encrypted .env.vault");
|
|
263
|
+
const t = l._parseVault(e);
|
|
192
264
|
let n = process.env;
|
|
193
|
-
return e && e.processEnv != null && (n = e.processEnv),
|
|
265
|
+
return e && e.processEnv != null && (n = e.processEnv), l.populate(n, t, e), { parsed: t };
|
|
194
266
|
}
|
|
195
|
-
function
|
|
196
|
-
let t =
|
|
197
|
-
const
|
|
198
|
-
e && (e.path != null && (t =
|
|
267
|
+
function Oe(e) {
|
|
268
|
+
let t = m.resolve(process.cwd(), ".env"), n = "utf8";
|
|
269
|
+
const s = !!(e && e.debug);
|
|
270
|
+
e && (e.path != null && (t = we(e.path)), e.encoding != null && (n = e.encoding));
|
|
199
271
|
try {
|
|
200
|
-
const
|
|
272
|
+
const c = l.parse(T.readFileSync(t, { encoding: n }));
|
|
201
273
|
let r = process.env;
|
|
202
|
-
return e && e.processEnv != null && (r = e.processEnv),
|
|
203
|
-
} catch (
|
|
204
|
-
return
|
|
274
|
+
return e && e.processEnv != null && (r = e.processEnv), l.populate(r, c, e), { parsed: c };
|
|
275
|
+
} catch (c) {
|
|
276
|
+
return s && g("Failed to load ".concat(t, " ").concat(c.message)), { error: c };
|
|
205
277
|
}
|
|
206
278
|
}
|
|
207
|
-
function
|
|
208
|
-
const t =
|
|
209
|
-
return
|
|
279
|
+
function Te(e) {
|
|
280
|
+
const t = j(e);
|
|
281
|
+
return N(e).length === 0 ? l.configDotenv(e) : T.existsSync(t) ? l._configVault(e) : (_e("You set DOTENV_KEY but you are missing a .env.vault file at ".concat(t, ". Did you forget to build it?")), l.configDotenv(e));
|
|
210
282
|
}
|
|
211
|
-
function
|
|
283
|
+
function Ne(e, t) {
|
|
212
284
|
const n = Buffer.from(t.slice(-64), "hex");
|
|
213
|
-
let
|
|
214
|
-
const
|
|
215
|
-
|
|
285
|
+
let s = Buffer.from(e, "base64");
|
|
286
|
+
const c = s.slice(0, 12), r = s.slice(-16);
|
|
287
|
+
s = s.slice(12, -16);
|
|
216
288
|
try {
|
|
217
|
-
const
|
|
218
|
-
return
|
|
219
|
-
} catch (
|
|
220
|
-
const
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
223
|
-
throw new Error(
|
|
224
|
-
} else if (
|
|
225
|
-
const
|
|
226
|
-
throw new Error(
|
|
289
|
+
const o = ve.createDecipheriv("aes-256-gcm", n, c);
|
|
290
|
+
return o.setAuthTag(r), "".concat(o.update(s)).concat(o.final());
|
|
291
|
+
} catch (o) {
|
|
292
|
+
const i = o instanceof RangeError, a = o.message === "Invalid key length", u = o.message === "Unsupported state or unable to authenticate data";
|
|
293
|
+
if (i || a) {
|
|
294
|
+
const p = "INVALID_DOTENV_KEY: It must be 64 characters long (or more)";
|
|
295
|
+
throw new Error(p);
|
|
296
|
+
} else if (u) {
|
|
297
|
+
const p = "DECRYPTION_FAILED: Please check your DOTENV_KEY";
|
|
298
|
+
throw new Error(p);
|
|
227
299
|
} else
|
|
228
|
-
throw console.error("Error: ",
|
|
300
|
+
throw console.error("Error: ", o.code), console.error("Error: ", o.message), o;
|
|
229
301
|
}
|
|
230
302
|
}
|
|
231
|
-
function
|
|
232
|
-
const
|
|
303
|
+
function je(e, t, n = {}) {
|
|
304
|
+
const s = !!(n && n.debug), c = !!(n && n.override);
|
|
233
305
|
if (typeof t != "object")
|
|
234
306
|
throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
235
307
|
for (const r of Object.keys(t))
|
|
236
|
-
Object.prototype.hasOwnProperty.call(e, r) ? (
|
|
308
|
+
Object.prototype.hasOwnProperty.call(e, r) ? (c === !0 && (e[r] = t[r]), s && g(c === !0 ? '"'.concat(r, '" is already defined and WAS overwritten') : '"'.concat(r, '" is already defined and was NOT overwritten'))) : e[r] = t[r];
|
|
237
309
|
}
|
|
238
|
-
const
|
|
239
|
-
configDotenv:
|
|
240
|
-
_configVault:
|
|
241
|
-
_parseVault:
|
|
242
|
-
config:
|
|
243
|
-
decrypt:
|
|
244
|
-
parse:
|
|
245
|
-
populate:
|
|
310
|
+
const l = {
|
|
311
|
+
configDotenv: Oe,
|
|
312
|
+
_configVault: De,
|
|
313
|
+
_parseVault: ye,
|
|
314
|
+
config: Te,
|
|
315
|
+
decrypt: Ne,
|
|
316
|
+
parse: he,
|
|
317
|
+
populate: je
|
|
246
318
|
};
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
function
|
|
319
|
+
d.configDotenv = l.configDotenv;
|
|
320
|
+
d._configVault = l._configVault;
|
|
321
|
+
d._parseVault = l._parseVault;
|
|
322
|
+
d.config = l.config;
|
|
323
|
+
d.decrypt = l.decrypt;
|
|
324
|
+
d.parse = l.parse;
|
|
325
|
+
d.populate = l.populate;
|
|
326
|
+
G.exports = l;
|
|
327
|
+
function Ie(e) {
|
|
256
328
|
if (!(e != null && e.bundler)) {
|
|
257
329
|
console.log(
|
|
258
|
-
|
|
330
|
+
M.red(
|
|
259
331
|
"Please specify the bundler in the options of code-inspector-plugin."
|
|
260
332
|
)
|
|
261
333
|
);
|
|
@@ -266,22 +338,22 @@ function he(e) {
|
|
|
266
338
|
if (t = !0, process.env.CODE_INSPECTOR === "true")
|
|
267
339
|
t = !1;
|
|
268
340
|
else {
|
|
269
|
-
const r =
|
|
270
|
-
if (
|
|
271
|
-
const
|
|
272
|
-
(
|
|
341
|
+
const r = v.resolve(process.cwd(), ".env.local");
|
|
342
|
+
if (f.existsSync(r)) {
|
|
343
|
+
const o = f.readFileSync(r, "utf-8"), i = d.parse(o || "");
|
|
344
|
+
(i == null ? void 0 : i.CODE_INSPECTOR) === "true" && (t = !1);
|
|
273
345
|
}
|
|
274
346
|
}
|
|
275
347
|
let n = "";
|
|
276
|
-
typeof __dirname != "undefined" ? n = __dirname : n =
|
|
277
|
-
const
|
|
348
|
+
typeof __dirname != "undefined" ? n = __dirname : n = Y(F(import.meta.url));
|
|
349
|
+
const s = w(b({}, e), {
|
|
278
350
|
close: t,
|
|
279
|
-
output:
|
|
351
|
+
output: v.resolve(n, "./")
|
|
280
352
|
});
|
|
281
|
-
return e.bundler === "webpack" || e.bundler === "rspack" ? new
|
|
353
|
+
return e.bundler === "webpack" || e.bundler === "rspack" ? new K(s) : e.bundler === "esbuild" ? q(s) : R(s);
|
|
282
354
|
}
|
|
283
|
-
const
|
|
355
|
+
const Ke = Ie;
|
|
284
356
|
export {
|
|
285
|
-
|
|
286
|
-
|
|
357
|
+
Ie as CodeInspectorPlugin,
|
|
358
|
+
Ke as codeInspectorPlugin
|
|
287
359
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-inspector-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./types/index.d.ts",
|
|
@@ -47,9 +47,10 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"chalk": "4.1.1",
|
|
50
|
-
"code-inspector-core": "0.
|
|
51
|
-
"
|
|
52
|
-
"
|
|
50
|
+
"code-inspector-core": "0.15.0",
|
|
51
|
+
"vite-code-inspector-plugin": "0.15.0",
|
|
52
|
+
"webpack-code-inspector-plugin": "0.15.0",
|
|
53
|
+
"esbuild-code-inspector-plugin": "0.15.0"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@types/node": "^16.0.1",
|
package/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface CodeInspectorPluginOptions extends CodeOptions {
|
|
|
4
4
|
* @zh 指定项目的打包器
|
|
5
5
|
* @en specify the bundler of the project
|
|
6
6
|
*/
|
|
7
|
-
bundler: 'vite' | 'webpack' | 'rspack';
|
|
7
|
+
bundler: 'vite' | 'webpack' | 'rspack' | 'esbuild';
|
|
8
8
|
/**
|
|
9
9
|
* @zh 设置为 true 时,仅当 .env.local 文件存在且其包含 CODE_INSPECTOR=true 时插件生效;默认值为 false
|
|
10
10
|
* @en When set the value to true, only if the .env.local file exists and it contains CODE_INSPECTOR=true, the plugin takes effect; The default value is false
|
package/dist/.eslintrc.js
DELETED
package/dist/append-code-5685.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
'use client'; ;(function(){ if (globalThis.__code_inspector_warning) { return; }; var originWarn = console.warn; var warning = "Extraneous non-props attributes"; var path = "data-insp-path"; console.warn = function () { globalThis.__code_inspector_warning = true; var args = Array.prototype.slice.call(arguments); var firstParam = args && args[0]; if (typeof firstParam === 'string' && firstParam.indexOf(warning) !== -1 && firstParam.indexOf(path) !== -1) { return; } else { originWarn.apply(null, args); }; }; })(); ;(function(){ if (typeof window === 'undefined' || globalThis.__code_inspector_observed) { return; }; function observe() { document.querySelectorAll("[data-insp-path]").forEach((node) => { node["data-insp-path"] = node.getAttribute("data-insp-path"); node.removeAttribute("data-insp-path"); }); setTimeout(observe, 1000); } observe(); globalThis.__code_inspector_observed = true; })(); ;(function (){ if (typeof window !== 'undefined') { if (!document.documentElement.querySelector('code-inspector-component')) { var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.textContent = (function(v,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((v=typeof globalThis!="undefined"?globalThis:v||self).vueInspectorClient={})})(this,function(v){"use strict";var At=Object.freeze,Et=Object.defineProperty,qt=Object.defineProperties;var Gt=Object.getOwnPropertyDescriptors;var St=Object.getOwnPropertySymbols;var Jt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable;var xt=(v,p,f)=>p in v?Et(v,p,{enumerable:!0,configurable:!0,writable:!0,value:f}):v[p]=f,q=(v,p)=>{for(var f in p||(p={}))Jt.call(p,f)&&xt(v,f,p[f]);if(St)for(var f of St(p))Qt.call(p,f)&&xt(v,f,p[f]);return v},G=(v,p)=>qt(v,Gt(p));var I=(v,p)=>At(Et(v,"raw",{value:At(p||v.slice())})),Ct=(v,p,f)=>new Promise((z,N)=>{var K=b=>{try{S(f.next(b))}catch(C){N(C)}},X=b=>{try{S(f.throw(b))}catch(C){N(C)}},S=b=>b.done?z(b.value):Promise.resolve(b.value).then(K,X);S((f=f.apply(v,p)).next())});var Pt,Mt,kt,Tt;const p=window,f=p.ShadowRoot&&(p.ShadyCSS===void 0||p.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,z=Symbol(),N=new WeakMap;let K=class{constructor(i,t,e){if(this._$cssResult$=!0,e!==z)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=t}get styleSheet(){let i=this.o;const t=this.t;if(f&&i===void 0){const e=t!==void 0&&t.length===1;e&&(i=N.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&N.set(t,i))}return i}toString(){return this.cssText}};const X=f?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const o of t.cssRules)e+=o.cssText;return(o=>new K(typeof o=="string"?o:o+"",void 0,z))(e)})(i):i;var S;const b=window,C=b.trustedTypes,Ut=C?C.emptyScript:"",rt=b.reactiveElementPolyfillSupport,J={toAttribute(i,t){switch(t){case Boolean:i=i?Ut:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch(o){e=null}}return e}},lt=(i,t)=>t!==i&&(t==t||i==i),Q={attribute:!0,type:String,converter:J,reflect:!1,hasChanged:lt};let P=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(i){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(i)}static get observedAttributes(){this.finalize();const i=[];return this.elementProperties.forEach((t,e)=>{const o=this._$Ep(e,t);o!==void 0&&(this._$Ev.set(o,e),i.push(o))}),i}static createProperty(i,t=Q){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(i,t),!t.noAccessor&&!this.prototype.hasOwnProperty(i)){const e=typeof i=="symbol"?Symbol():"__"+i,o=this.getPropertyDescriptor(i,e,t);o!==void 0&&Object.defineProperty(this.prototype,i,o)}}static getPropertyDescriptor(i,t,e){return{get(){return this[t]},set(o){const s=this[i];this[t]=o,this.requestUpdate(i,s,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(i){return this.elementProperties.get(i)||Q}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const i=Object.getPrototypeOf(this);if(i.finalize(),i.h!==void 0&&(this.h=[...i.h]),this.elementProperties=new Map(i.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const o of e)this.createProperty(o,t[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const t=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const o of e)t.unshift(X(o))}else i!==void 0&&t.push(X(i));return t}static _$Ep(i,t){const e=t.attribute;return e===!1?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}u(){var i;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(i=this.constructor.h)===null||i===void 0||i.forEach(t=>t(this))}addController(i){var t,e;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(i),this.renderRoot!==void 0&&this.isConnected&&((e=i.hostConnected)===null||e===void 0||e.call(i))}removeController(i){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(i)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((i,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var i;const t=(i=this.shadowRoot)!==null&&i!==void 0?i:this.attachShadow(this.constructor.shadowRootOptions);return((e,o)=>{f?e.adoptedStyleSheets=o.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet):o.forEach(s=>{const n=document.createElement("style"),r=p.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=s.cssText,e.appendChild(n)})})(t,this.constructor.elementStyles),t}connectedCallback(){var i;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(i=this._$ES)===null||i===void 0||i.forEach(t=>{var e;return(e=t.hostConnected)===null||e===void 0?void 0:e.call(t)})}enableUpdating(i){}disconnectedCallback(){var i;(i=this._$ES)===null||i===void 0||i.forEach(t=>{var e;return(e=t.hostDisconnected)===null||e===void 0?void 0:e.call(t)})}attributeChangedCallback(i,t,e){this._$AK(i,e)}_$EO(i,t,e=Q){var o;const s=this.constructor._$Ep(i,e);if(s!==void 0&&e.reflect===!0){const n=(((o=e.converter)===null||o===void 0?void 0:o.toAttribute)!==void 0?e.converter:J).toAttribute(t,e.type);this._$El=i,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$El=null}}_$AK(i,t){var e;const o=this.constructor,s=o._$Ev.get(i);if(s!==void 0&&this._$El!==s){const n=o.getPropertyOptions(s),r=typeof n.converter=="function"?{fromAttribute:n.converter}:((e=n.converter)===null||e===void 0?void 0:e.fromAttribute)!==void 0?n.converter:J;this._$El=s,this[s]=r.fromAttribute(t,n.type),this._$El=null}}requestUpdate(i,t,e){let o=!0;i!==void 0&&(((e=e||this.constructor.getPropertyOptions(i)).hasChanged||lt)(this[i],t)?(this._$AL.has(i)||this._$AL.set(i,t),e.reflect===!0&&this._$El!==i&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(i,e))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}_$Ej(){return Ct(this,null,function*(){this.isUpdatePending=!0;try{yield this._$E_}catch(t){Promise.reject(t)}const i=this.scheduleUpdate();return i!=null&&(yield i),!this.isUpdatePending})}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((o,s)=>this[s]=o),this._$Ei=void 0);let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$ES)===null||i===void 0||i.forEach(o=>{var s;return(s=o.hostUpdate)===null||s===void 0?void 0:s.call(o)}),this.update(e)):this._$Ek()}catch(o){throw t=!1,this._$Ek(),o}t&&this._$AE(e)}willUpdate(i){}_$AE(i){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var o;return(o=e.hostUpdated)===null||o===void 0?void 0:o.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(i)),this.updated(i)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(i){return!0}update(i){this._$EC!==void 0&&(this._$EC.forEach((t,e)=>this._$EO(e,this[e],t)),this._$EC=void 0),this._$Ek()}updated(i){}firstUpdated(i){}};var tt;P.finalized=!0,P.elementProperties=new Map,P.elementStyles=[],P.shadowRootOptions={mode:"open"},rt==null||rt({ReactiveElement:P}),((S=b.reactiveElementVersions)!==null&&S!==void 0?S:b.reactiveElementVersions=[]).push("1.6.1");const F=window,M=F.trustedTypes,ht=M?M.createPolicy("lit-html",{createHTML:i=>i}):void 0,A="lit$".concat((Math.random()+"").slice(9),"$"),at="?"+A,Ht="<".concat(at,">"),k=document,D=(i="")=>k.createComment(i),O=i=>i===null||typeof i!="object"&&typeof i!="function",dt=Array.isArray,V=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pt=/-->/g,ct=/>/g,x=RegExp(">|[ \n\f\r](?:([^\\s\"'>=/]+)([ \n\f\r]*=[ \n\f\r]*(?:[^ \n\f\r\"'`<>=]|(\"|')|))|$)","g"),ut=/'/g,mt=/"/g,vt=/^(?:script|style|textarea|title)$/i,et=(i=>(t,...e)=>({_$litType$:i,strings:t,values:e}))(1),E=Symbol.for("lit-noChange"),y=Symbol.for("lit-nothing"),gt=new WeakMap,T=k.createTreeWalker(k,129,null,!1),Rt=(i,t)=>{const e=i.length-1,o=[];let s,n=t===2?"<svg>":"",r=V;for(let l=0;l<e;l++){const h=i[l];let $,d,u=-1,g=0;for(;g<h.length&&(r.lastIndex=g,d=r.exec(h),d!==null);)g=r.lastIndex,r===V?d[1]==="!--"?r=pt:d[1]!==void 0?r=ct:d[2]!==void 0?(vt.test(d[2])&&(s=RegExp("</"+d[2],"g")),r=x):d[3]!==void 0&&(r=x):r===x?d[0]===">"?(r=s!=null?s:V,u=-1):d[1]===void 0?u=-2:(u=r.lastIndex-d[2].length,$=d[1],r=d[3]===void 0?x:d[3]==='"'?mt:ut):r===mt||r===ut?r=x:r===pt||r===ct?r=V:(r=x,s=void 0);const R=r===x&&i[l+1].startsWith("/>")?" ":"";n+=r===V?h+Ht:u>=0?(o.push($),h.slice(0,u)+"$lit$"+h.slice(u)+A+R):h+A+(u===-2?(o.push(void 0),l):R)}const a=n+(i[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return[ht!==void 0?ht.createHTML(a):a,o]};class j{constructor({strings:t,_$litType$:e},o){let s;this.parts=[];let n=0,r=0;const a=t.length-1,l=this.parts,[h,$]=Rt(t,e);if(this.el=j.createElement(h,o),T.currentNode=this.el.content,e===2){const d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(s=T.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes()){const d=[];for(const u of s.getAttributeNames())if(u.endsWith("$lit$")||u.startsWith(A)){const g=$[r++];if(d.push(u),g!==void 0){const R=s.getAttribute(g.toLowerCase()+"$lit$").split(A),L=/([.?@])?(.*)/.exec(g);l.push({type:1,index:n,name:L[2],strings:R,ctor:L[1]==="."?zt:L[1]==="?"?Dt:L[1]==="@"?Ot:Y})}else l.push({type:6,index:n})}for(const u of d)s.removeAttribute(u)}if(vt.test(s.tagName)){const d=s.textContent.split(A),u=d.length-1;if(u>0){s.textContent=M?M.emptyScript:"";for(let g=0;g<u;g++)s.append(d[g],D()),T.nextNode(),l.push({type:2,index:++n});s.append(d[u],D())}}}else if(s.nodeType===8)if(s.data===at)l.push({type:2,index:n});else{let d=-1;for(;(d=s.data.indexOf(A,d+1))!==-1;)l.push({type:7,index:n}),d+=A.length-1}n++}}static createElement(t,e){const o=k.createElement("template");return o.innerHTML=t,o}}function U(i,t,e=i,o){var s,n,r,a;if(t===E)return t;let l=o!==void 0?(s=e._$Co)===null||s===void 0?void 0:s[o]:e._$Cl;const h=O(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==h&&((n=l==null?void 0:l._$AO)===null||n===void 0||n.call(l,!1),h===void 0?l=void 0:(l=new h(i),l._$AT(i,e,o)),o!==void 0?((r=(a=e)._$Co)!==null&&r!==void 0?r:a._$Co=[])[o]=l:e._$Cl=l),l!==void 0&&(t=U(i,l._$AS(i,t.values),l,o)),t}class Lt{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:o},parts:s}=this._$AD,n=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:k).importNode(o,!0);T.currentNode=n;let r=T.nextNode(),a=0,l=0,h=s[0];for(;h!==void 0;){if(a===h.index){let $;h.type===2?$=new W(r,r.nextSibling,this,t):h.type===1?$=new h.ctor(r,h.name,h.strings,this,t):h.type===6&&($=new Vt(r,this,t)),this.u.push($),h=s[++l]}a!==(h==null?void 0:h.index)&&(r=T.nextNode(),a++)}return n}p(t){let e=0;for(const o of this.u)o!==void 0&&(o.strings!==void 0?(o._$AI(t,o,e),e+=o.strings.length-2):o._$AI(t[e])),e++}}class W{constructor(t,e,o,s){var n;this.type=2,this._$AH=y,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=o,this.options=s,this._$Cm=(n=s==null?void 0:s.isConnected)===null||n===void 0||n}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=U(this,t,e),O(t)?t===y||t==null||t===""?(this._$AH!==y&&this._$AR(),this._$AH=y):t!==this._$AH&&t!==E&&this.g(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):(o=>dt(o)||typeof(o==null?void 0:o[Symbol.iterator])=="function")(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==y&&O(this._$AH)?this._$AA.nextSibling.data=t:this.T(k.createTextNode(t)),this._$AH=t}$(t){var e;const{values:o,_$litType$:s}=t,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=j.createElement(s.h,this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===n)this._$AH.p(o);else{const r=new Lt(n,this),a=r.v(this.options);r.p(o),this.T(a),this._$AH=r}}_$AC(t){let e=gt.get(t.strings);return e===void 0&>.set(t.strings,e=new j(t)),e}k(t){dt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let o,s=0;for(const n of t)s===e.length?e.push(o=new W(this.O(D()),this.O(D()),this,this.options)):o=e[s],o._$AI(n),s++;s<e.length&&(this._$AR(o&&o._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var o;for((o=this._$AP)===null||o===void 0||o.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cm=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class Y{constructor(t,e,o,s,n){this.type=1,this._$AH=y,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=y}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,o,s){const n=this.strings;let r=!1;if(n===void 0)t=U(this,t,e,0),r=!O(t)||t!==this._$AH&&t!==E,r&&(this._$AH=t);else{const a=t;let l,h;for(t=n[0],l=0;l<n.length-1;l++)h=U(this,a[o+l],e,l),h===E&&(h=this._$AH[l]),r||(r=!O(h)||h!==this._$AH[l]),h===y?t=y:t!==y&&(t+=(h!=null?h:"")+n[l+1]),this._$AH[l]=h}r&&!s&&this.j(t)}j(t){t===y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}}class zt extends Y{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===y?void 0:t}}const Nt=M?M.emptyScript:"";class Dt extends Y{constructor(){super(...arguments),this.type=4}j(t){t&&t!==y?this.element.setAttribute(this.name,Nt):this.element.removeAttribute(this.name)}}class Ot extends Y{constructor(t,e,o,s,n){super(t,e,o,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=U(this,t,e,0))!==null&&o!==void 0?o:y)===E)return;const s=this._$AH,n=t===y&&s!==y||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==y&&(s===y||n);n&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,o;typeof this._$AH=="function"?this._$AH.call((o=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&o!==void 0?o:this.element,t):this._$AH.handleEvent(t)}}class Vt{constructor(t,e,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){U(this,t)}}const ft=F.litHtmlPolyfillSupport;ft==null||ft(j,W),((tt=F.litHtmlVersions)!==null&&tt!==void 0?tt:F.litHtmlVersions=[]).push("2.6.1");var it,ot;class B extends P{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const o=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=o.firstChild),o}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((o,s,n)=>{var r,a;const l=(r=n==null?void 0:n.renderBefore)!==null&&r!==void 0?r:s;let h=l._$litPart$;if(h===void 0){const $=(a=n==null?void 0:n.renderBefore)!==null&&a!==void 0?a:null;l._$litPart$=h=new W(s.insertBefore(D(),$),$,void 0,n!=null?n:{})}return h._$AI(o),h})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return E}}B.finalized=!0,B._$litElement$=!0,(it=globalThis.litElementHydrateSupport)===null||it===void 0||it.call(globalThis,{LitElement:B});const yt=globalThis.litElementPolyfillSupport;yt==null||yt({LitElement:B}),((ot=globalThis.litElementVersions)!==null&&ot!==void 0?ot:globalThis.litElementVersions=[]).push("3.2.2");const jt=(i,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?G(q({},t),{finisher(e){e.createProperty(t.key,i)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,i)}};function _(i){return(t,e)=>e!==void 0?((o,s,n)=>{s.constructor.createProperty(n,o)})(i,t,e):jt(i,t)}function w(i){return _(G(q({},i),{state:!0}))}var st;(st=window.HTMLSlotElement)===null||st===void 0||st.prototype.assignedElements;const Wt=1;let Bt=class{constructor(i){}get _$AU(){return this._$AM._$AU}_$AT(i,t,e){this._$Ct=i,this._$AM=t,this._$Ci=e}_$AS(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};const H=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends Bt{constructor(i){var t;if(super(i),i.type!==Wt||i.name!=="style"||((t=i.strings)===null||t===void 0?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(i){return Object.keys(i).reduce((t,e)=>{const o=i[e];return o==null?t:t+"".concat(e=e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase(),":").concat(o,";")},"")}update(i,[t]){const{style:e}=i.element;if(this.vt===void 0){this.vt=new Set;for(const o in t)this.vt.add(o);return this.render(t)}this.vt.forEach(o=>{t[o]==null&&(this.vt.delete(o),o.includes("-")?e.removeProperty(o):e[o]="")});for(const o in t){const s=t[o];s!=null&&(this.vt.add(o),o.includes("-")?e.setProperty(o,s):e[o]=s)}return E}});function $t(i){if(i.path)return i.path;let t=i.target;for(i.path=[];t.parentNode!==null;)i.path.push(t),t=t.parentNode;return i.path.push(document,window),i.path}const Z="data-insp-path",bt="{file}",wt="{line}",_t="{column}";var It=Object.defineProperty,Kt=Object.getOwnPropertyDescriptor,m=(i,t,e,o)=>{for(var s,n=o>1?void 0:o?Kt(t,e):t,r=i.length-1;r>=0;r--)(s=i[r])&&(n=(o?s(t,e,n):s(n))||n);return o&&n&&It(t,e,n),n};const nt="__code-inspector-unique-id",Xt={ctrlKey:"^control",altKey:"⌥option",metaKey:"⌘command",shiftKey:"shift"},Ft={ctrlKey:"Ctrl",altKey:"Alt",metaKey:"⊞Windows",shiftKey:"⇧Shift"};class c extends B{constructor(){super(...arguments),this.hotKeys="shiftKey,altKey",this.port=5678,this.showSwitch=!1,this.autoToggle=!1,this.hideConsole=!1,this.locate=!0,this.copy=!1,this.ip="localhost",this.position={top:0,right:0,bottom:0,left:0,padding:{top:0,right:0,bottom:0,left:0},border:{top:0,right:0,bottom:0,left:0},margin:{top:0,right:0,bottom:0,left:0}},this.element={name:"",line:0,column:0,path:""},this.infoClassName={vertical:"",horizon:""},this.infoWidth="300px",this.show=!1,this.dragging=!1,this.mousePosition={baseX:0,baseY:0,moveX:0,moveY:0},this.open=!1,this.moved=!1,this.hoverSwitch=!1,this.preUserSelect="",this.sendType="xhr",this.isTracking=t=>this.hotKeys&&this.hotKeys.split(",").every(e=>t[e.trim()]),this.getDomPropertyValue=(t,e)=>{const o=window.getComputedStyle(t);return Number(o.getPropertyValue(e).replace("px",""))},this.renderCover=t=>{const{top:e,right:o,bottom:s,left:n}=t.getBoundingClientRect();this.position={top:e,right:o,bottom:s,left:n,border:{top:this.getDomPropertyValue(t,"border-top-width"),right:this.getDomPropertyValue(t,"border-right-width"),bottom:this.getDomPropertyValue(t,"border-bottom-width"),left:this.getDomPropertyValue(t,"border-left-width")},padding:{top:this.getDomPropertyValue(t,"padding-top"),right:this.getDomPropertyValue(t,"padding-right"),bottom:this.getDomPropertyValue(t,"padding-bottom"),left:this.getDomPropertyValue(t,"padding-left")},margin:{top:this.getDomPropertyValue(t,"margin-top"),right:this.getDomPropertyValue(t,"margin-right"),bottom:this.getDomPropertyValue(t,"margin-bottom"),left:this.getDomPropertyValue(t,"margin-left")}};const r=document.documentElement.clientHeight,a=document.documentElement.clientWidth,l=r-s-this.getDomPropertyValue(t,"margin-bottom"),h=a-o-this.getDomPropertyValue(t,"margin-right"),$=e-this.getDomPropertyValue(t,"margin-top"),d=n-this.getDomPropertyValue(t,"margin-left");this.infoClassName={vertical:$>l?$<100?"element-info-top-inner":"element-info-top":l<100?"element-info-bottom-inner":"element-info-bottom",horizon:d>=h?"element-info-right":"element-info-left"},this.infoWidth=Math.max(o-n+this.getDomPropertyValue(t,"margin-right")+this.getDomPropertyValue(t,"margin-left"),300)+"px",this.addGlobalCursorStyle(),this.preUserSelect||(this.preUserSelect=getComputedStyle(document.body).userSelect),document.body.style.userSelect="none";let u=t.getAttribute(Z)||t[Z]||"";!u&&t.getAttribute("data-astro-source-file")&&(u="".concat(t.getAttribute("data-astro-source-file"),":").concat(t.getAttribute("data-astro-source-loc"),":").concat(t.tagName.toLowerCase()));const g=u.split(":"),R=g[g.length-1],L=Number(g[g.length-2]),Yt=Number(g[g.length-3]),Zt=g.slice(0,g.length-3).join(":");this.element={name:R,path:Zt,line:Yt,column:L},this.show=!0},this.removeCover=()=>{this.show=!1,this.removeGlobalCursorStyle(),document.body.style.userSelect=this.preUserSelect,this.preUserSelect=""},this.addGlobalCursorStyle=()=>{if(!document.getElementById(nt)){const t=document.createElement("style");t.setAttribute("id",nt),t.innerText="body * {\n cursor: pointer !important;\n }",document.body.appendChild(t)}},this.removeGlobalCursorStyle=()=>{const t=document.getElementById(nt);t&&t.remove()},this.sendXHR=()=>{const t=encodeURIComponent(this.element.path),e="http://".concat(this.ip,":").concat(this.port,"/?file=").concat(t,"&line=").concat(this.element.line,"&column=").concat(this.element.column),o=new XMLHttpRequest;o.open("GET",e,!0),o.send(),o.addEventListener("error",()=>{this.sendType="img",this.sendImg()})},this.sendImg=()=>{const t=encodeURIComponent(this.element.path),e="http://".concat(this.ip,":").concat(this.port,"/?file=").concat(t,"&line=").concat(this.element.line,"&column=").concat(this.element.column);document.createElement("img").src=e},this.trackCode=()=>{if(this.locate&&(this.sendType==="xhr"?this.sendXHR():this.sendImg()),this.copy){const t=function(e,o,s,n){let r="".concat(e,":").concat(o,":").concat(s);if(typeof n=="string")r=n.replace(bt,e).replace(wt,o).replace(_t,s);else if(n instanceof Array)return n.map(a=>a.replace(bt,e).replace(wt,o).replace(_t,s));return[r]}(this.element.path,String(this.element.line),String(this.element.column),this.copy);this.copyToClipboard(t[0])}},this.moveSwitch=t=>{if($t(t).includes(this)?this.hoverSwitch=!0:this.hoverSwitch=!1,this.dragging)return this.moved=!0,this.inspectorSwitchRef.style.left=this.mousePosition.baseX+(t.pageX-this.mousePosition.moveX)+"px",void(this.inspectorSwitchRef.style.top=this.mousePosition.baseY+(t.pageY-this.mousePosition.moveY)+"px")},this.handleMouseup=()=>{this.hoverSwitch=!1},this.handleMouseMove=t=>{if((this.isTracking(t)&&!this.dragging||this.open)&&!this.hoverSwitch){const e=$t(t);let o;for(let s=0;s<e.length;s++){const n=e[s];if(n.hasAttribute&&n.hasAttribute(Z)||n[Z]){o=n;break}if(n.hasAttribute&&n.hasAttribute("data-astro-source-file")){o=n;break}}o&&this.renderCover(o)}else this.removeCover()},this.handleMouseClick=t=>{(this.isTracking(t)||this.open)&&this.show&&(t.stopPropagation(),t.preventDefault(),this.trackCode(),this.removeCover(),this.autoToggle&&(this.open=!1))},this.handlePointerDown=t=>{var e;(e=t.target)!=null&&e.disabled&&(this.isTracking(t)||this.open)&&this.show&&(t.stopPropagation(),t.preventDefault(),this.trackCode(),this.removeCover(),this.autoToggle&&(this.open=!1))},this.handleKeyUp=t=>{this.isTracking(t)||this.open||this.removeCover()},this.printTip=()=>{const t=navigator.userAgent.toLowerCase(),e=["windows","win32","wow32","win64","wow64"].some(r=>t.match(r))?Ft:Xt,o=this.hotKeys.split(",").map(r=>"%c"+e[r.trim()]),s=2*o.length+1,n=Array(s).fill("").map((r,a)=>a%2==0?"color: #42b983; font-weight: bold; font-family: PingFang SC;":"color: #006aff; font-weight: bold; font-family: PingFang SC;");console.log("%c同时按住 [".concat(o.join(" %c+ "),"%c] 时启用 inspector 功能(点击页面元素可定位至编辑器源代码)"),...n)},this.recordMousePosition=t=>{this.mousePosition={baseX:this.inspectorSwitchRef.offsetLeft,baseY:this.inspectorSwitchRef.offsetTop,moveX:t.pageX,moveY:t.pageY},this.dragging=!0,t.preventDefault()},this.handleMouseUp=()=>{this.dragging=!1},this.switch=t=>{this.moved||(this.open=!this.open,t.preventDefault(),t.stopPropagation()),this.moved=!1}}copyToClipboard(t){var e;if(typeof((e=navigator==null?void 0:navigator.clipboard)==null?void 0:e.writeText)=="function")navigator.clipboard.writeText(t);else{const o=document.createElement("textarea");o.value=t,document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}}firstUpdated(){this.hideConsole||this.printTip(),window.addEventListener("mousemove",this.handleMouseMove),window.addEventListener("mousemove",this.moveSwitch),window.addEventListener("mouseup",this.handleMouseup),window.addEventListener("click",this.handleMouseClick,!0),window.addEventListener("pointerdown",this.handlePointerDown,!0),document.addEventListener("keyup",this.handleKeyUp),document.addEventListener("mouseleave",this.removeCover),document.addEventListener("mouseup",this.handleMouseUp),this.inspectorSwitchRef.addEventListener("mousedown",this.recordMousePosition),this.inspectorSwitchRef.addEventListener("click",this.switch)}disconnectedCallback(){window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("mousemove",this.moveSwitch),window.removeEventListener("mouseup",this.handleMouseup),window.removeEventListener("click",this.handleMouseClick,!0),window.removeEventListener("pointerdown",this.handlePointerDown,!0),document.removeEventListener("keyup",this.handleKeyUp),document.removeEventListener("mouseleave",this.removeCover),document.removeEventListener("mouseup",this.handleMouseUp),this.inspectorSwitchRef&&this.inspectorSwitchRef.removeEventListener("mousedown",this.recordMousePosition),this.inspectorSwitchRef.removeEventListener("click",this.switch)}render(){const t={display:this.show?"block":"none",top:this.position.top-this.position.margin.top+"px",left:this.position.left-this.position.margin.left+"px",height:"".concat(this.position.bottom-this.position.top+this.position.margin.bottom+this.position.margin.top,"px"),width:"".concat(this.position.right-this.position.left+this.position.margin.right+this.position.margin.left,"px")},e={borderTopWidth:"".concat(this.position.margin.top,"px"),borderRightWidth:"".concat(this.position.margin.right,"px"),borderBottomWidth:"".concat(this.position.margin.bottom,"px"),borderLeftWidth:"".concat(this.position.margin.left,"px")},o={borderTopWidth:"".concat(this.position.border.top,"px"),borderRightWidth:"".concat(this.position.border.right,"px"),borderBottomWidth:"".concat(this.position.border.bottom,"px"),borderLeftWidth:"".concat(this.position.border.left,"px")},s={borderTopWidth:"".concat(this.position.padding.top,"px"),borderRightWidth:"".concat(this.position.padding.right,"px"),borderBottomWidth:"".concat(this.position.padding.bottom,"px"),borderLeftWidth:"".concat(this.position.padding.left,"px")};return et(kt||(kt=I(['\n <div\n class="code-inspector-container"\n id="code-inspector-container"\n style=','\n >\n <div class="margin-overlay" style=','>\n <div class="border-overlay" style=','>\n <div class="padding-overlay" style=','>\n <div class="content-overlay"></div>\n </div>\n </div>\n </div>\n <div\n id="element-info"\n class="element-info '," ",'"\n style=','\n >\n <div class="element-info-content">\n <div class="name-line">\n <div class="element-name">\n <span class="element-title"><','></span>\n <span class="element-tip">click to open IDE</span>\n </div>\n </div>\n <div class="path-line">','</div>\n </div>\n </div>\n </div>\n <div\n id="inspector-switch"\n class="inspector-switch '," ",'"\n style=',"\n >\n ","\n </div>\n "])),H(t),H(e),H(o),H(s),this.infoClassName.vertical,this.infoClassName.horizon,H({width:this.infoWidth}),this.element.name,this.element.path,this.open?"active-inspector-switch":"",this.moved?"move-inspector-switch":"",H({display:this.showSwitch?"flex":"none"}),this.open?et(Pt||(Pt=I(['\n <svg\n t="1677801709811"\n class="icon"\n viewBox="0 0 1024 1024"\n version="1.1"\n xmlns="http://www.w3.org/2000/svg"\n p-id="1110"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n width="1em"\n height="1em"\n >\n <path\n d="M546.56 704H128c-19.2 0-32-12.8-32-32V256h704v194.56c10.928 1.552 21.648 3.76 32 6.832V128c0-35.2-28.8-64-64-64H128C92.8 64 64 92.8 64 128v544c0 35.2 28.8 64 64 64h425.392a221.936 221.936 0 0 1-6.848-32zM96 128c0-19.2 12.8-32 32-32h640c19.2 0 32 12.8 32 32v96H96V128z"\n fill="#34495E"\n p-id="1111"\n ></path>\n <path\n d="M416 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="#00B42A"\n p-id="1112"\n ></path>\n <path\n d="M288 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="#F7BA1E"\n p-id="1113"\n ></path>\n <path\n d="M160 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="#F53F3F"\n p-id="1114"\n ></path>\n <path\n d="M382.848 658.928l99.376-370.88 30.912 8.272-99.36 370.88zM318.368 319.2L160 477.6l158.4 158.4 22.64-22.624-135.792-135.776 135.776-135.776zM768 480c-13.088 0-25.888 1.344-38.24 3.84l6.24-6.24-158.4-158.4-22.64 22.624 135.792 135.776-135.776 135.776 22.656 22.624 2.208-2.224a190.768 190.768 0 0 0 30.928 148.08l-116.672 116.656c-10.24 10.24-10.24 26.896 0 37.136l27.76 27.76c5.12 5.12 11.84 7.68 18.56 7.68s13.456-2.56 18.56-7.68l120.992-120.96A190.56 190.56 0 0 0 768 864c105.872 0 192-86.128 192-192s-86.128-192-192-192z m-159.12 193.136c0-88.224 71.776-160 160-160 10.656 0 21.04 1.152 31.12 3.152V672c0 19.2-12.8 32-32 32h-156a160.144 160.144 0 0 1-3.12-30.864z m-68.464 263.584l-19.632-19.632 110.336-110.336c6.464 6.656 13.392 12.848 20.752 18.528l-111.456 111.44z m228.464-103.584c-65.92 0-122.576-40.096-147.056-97.136H768c35.2 0 64-28.8 64-64v-145.776c56.896 24.544 96.88 81.12 96.88 146.912 0 88.224-71.776 160-160 160z"\n fill="#006AFF"\n p-id="1115"\n ></path>\n <path\n d="M864.576 672c0 52.928-43.072 96-96 96v32a128 128 0 0 0 128-128h-32z"\n fill="#34495E"\n p-id="1116"\n ></path>\n </svg>\n ']))):et(Mt||(Mt=I(['<svg\n t="1677801709811"\n class="icon"\n viewBox="0 0 1024 1024"\n version="1.1"\n xmlns="http://www.w3.org/2000/svg"\n p-id="1110"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n width="1em"\n height="1em"\n >\n <path\n d="M546.56 704H128c-19.2 0-32-12.8-32-32V256h704v194.56c10.928 1.552 21.648 3.76 32 6.832V128c0-35.2-28.8-64-64-64H128C92.8 64 64 92.8 64 128v544c0 35.2 28.8 64 64 64h425.392a221.936 221.936 0 0 1-6.848-32zM96 128c0-19.2 12.8-32 32-32h640c19.2 0 32 12.8 32 32v96H96V128z"\n fill="currentColor"\n p-id="1111"\n ></path>\n <path\n d="M416 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="currentColor"\n p-id="1112"\n ></path>\n <path\n d="M288 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="currentColor"\n p-id="1113"\n ></path>\n <path\n d="M160 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="currentColor"\n p-id="1114"\n ></path>\n <path\n d="M382.848 658.928l99.376-370.88 30.912 8.272-99.36 370.88zM318.368 319.2L160 477.6l158.4 158.4 22.64-22.624-135.792-135.776 135.776-135.776zM768 480c-13.088 0-25.888 1.344-38.24 3.84l6.24-6.24-158.4-158.4-22.64 22.624 135.792 135.776-135.776 135.776 22.656 22.624 2.208-2.224a190.768 190.768 0 0 0 30.928 148.08l-116.672 116.656c-10.24 10.24-10.24 26.896 0 37.136l27.76 27.76c5.12 5.12 11.84 7.68 18.56 7.68s13.456-2.56 18.56-7.68l120.992-120.96A190.56 190.56 0 0 0 768 864c105.872 0 192-86.128 192-192s-86.128-192-192-192z m-159.12 193.136c0-88.224 71.776-160 160-160 10.656 0 21.04 1.152 31.12 3.152V672c0 19.2-12.8 32-32 32h-156a160.144 160.144 0 0 1-3.12-30.864z m-68.464 263.584l-19.632-19.632 110.336-110.336c6.464 6.656 13.392 12.848 20.752 18.528l-111.456 111.44z m228.464-103.584c-65.92 0-122.576-40.096-147.056-97.136H768c35.2 0 64-28.8 64-64v-145.776c56.896 24.544 96.88 81.12 96.88 146.912 0 88.224-71.776 160-160 160z"\n fill="currentColor"\n p-id="1115"\n ></path>\n <path\n d="M864.576 672c0 52.928-43.072 96-96 96v32a128 128 0 0 0 128-128h-32z"\n fill="currentColor"\n p-id="1116"\n ></path>\n </svg>']))))}}c.styles=((i,...t)=>{const e=i.length===1?i[0]:t.reduce((o,s,n)=>o+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[n+1],i[0]);return new K(e,i,z)})(Tt||(Tt=I(["\n .code-inspector-container {\n position: fixed;\n pointer-events: none;\n z-index: 999999;\n font-family: 'PingFang SC';\n .margin-overlay {\n position: absolute;\n inset: 0;\n border-style: solid;\n border-color: rgba(255, 155, 0, 0.3);\n .border-overlay {\n position: absolute;\n inset: 0;\n border-style: solid;\n border-color: rgba(255, 200, 50, 0.3);\n .padding-overlay {\n position: absolute;\n inset: 0;\n border-style: solid;\n border-color: rgba(77, 200, 0, 0.3);\n .content-overlay {\n position: absolute;\n inset: 0;\n background: rgba(120, 170, 210, 0.7);\n }\n }\n }\n }\n }\n .element-info {\n position: absolute;\n }\n .element-info-content {\n max-width: 100%;\n font-size: 12px;\n color: #000;\n background-color: #fff;\n word-break: break-all;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);\n box-sizing: border-box;\n padding: 4px 8px;\n border-radius: 4px;\n }\n .element-info-top {\n top: -4px;\n transform: translateY(-100%);\n }\n .element-info-bottom {\n top: calc(100% + 4px);\n }\n .element-info-top-inner {\n top: 4px;\n }\n .element-info-bottom-inner {\n bottom: 4px;\n }\n .element-info-left {\n left: 0;\n display: flex;\n justify-content: flex-start;\n }\n .element-info-right {\n right: 0;\n display: flex;\n justify-content: flex-end;\n }\n .element-name .element-title {\n color: coral;\n font-weight: bold;\n }\n .element-name .element-tip {\n color: #006aff;\n }\n .path-line {\n color: #333;\n line-height: 12px;\n margin-top: 4px;\n }\n .inspector-switch {\n position: fixed;\n z-index: 9999999;\n top: 16px;\n left: 50%;\n font-size: 22px;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(255, 255, 255, 0.8);\n color: #555;\n height: 32px;\n width: 32px;\n border-radius: 50%;\n box-shadow: 0px 1px 2px -2px rgba(0, 0, 0, 0.2),\n 0px 3px 6px 0px rgba(0, 0, 0, 0.16),\n 0px 5px 12px 4px rgba(0, 0, 0, 0.12);\n cursor: pointer;\n }\n .active-inspector-switch {\n color: #006aff;\n }\n .move-inspector-switch {\n cursor: move;\n }\n "]))),m([_()],c.prototype,"hotKeys",2),m([_()],c.prototype,"port",2),m([_()],c.prototype,"showSwitch",2),m([_()],c.prototype,"autoToggle",2),m([_()],c.prototype,"hideConsole",2),m([_()],c.prototype,"locate",2),m([_()],c.prototype,"copy",2),m([_()],c.prototype,"ip",2),m([w()],c.prototype,"position",2),m([w()],c.prototype,"element",2),m([w()],c.prototype,"infoClassName",2),m([w()],c.prototype,"infoWidth",2),m([w()],c.prototype,"show",2),m([w()],c.prototype,"dragging",2),m([w()],c.prototype,"mousePosition",2),m([w()],c.prototype,"open",2),m([w()],c.prototype,"moved",2),m([w()],c.prototype,"hoverSwitch",2),m([w()],c.prototype,"preUserSelect",2),m([w()],c.prototype,"sendType",2),m([function(i,t){return(({finisher:e,descriptor:o})=>(s,n)=>{var r;if(n===void 0){const a=(r=s.originalKey)!==null&&r!==void 0?r:s.key,l=o!=null?{kind:"method",placement:"prototype",key:a,descriptor:o(s.key)}:G(q({},s),{key:a});return e!=null&&(l.finisher=function(h){e(h,a)}),l}{const a=s.constructor;o!==void 0&&Object.defineProperty(s,n,o(n)),e==null||e(a,n)}})({descriptor:e=>{const o={get(){var s,n;return(n=(s=this.renderRoot)===null||s===void 0?void 0:s.querySelector(i))!==null&&n!==void 0?n:null},enumerable:!0,configurable:!0};if(t){const s=typeof e=="symbol"?Symbol():"__"+e;o.get=function(){var n,r;return this[s]===void 0&&(this[s]=(r=(n=this.renderRoot)===null||n===void 0?void 0:n.querySelector(i))!==null&&r!==void 0?r:null),this[s]}}return o}})}("#inspector-switch")],c.prototype,"inspectorSwitchRef",2),customElements.get("code-inspector-component")||customElements.define("code-inspector-component",c),v.CodeInspectorComponent=c,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});; var inspector = document.createElement('code-inspector-component'); inspector.port = 5685; inspector.hotKeys = 'shiftKey,altKey'; inspector.showSwitch = !!false; inspector.autoToggle = !!true; inspector.hideConsole = !!false; inspector.locate = !!true; inspector.copy = '{file}'; inspector.ip = 'localhost'; document.documentElement.append(inspector); } }})();
|