prettier-plugin-embed 0.2.4 → 0.3.0-rc.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/dist/index.js CHANGED
@@ -1,356 +1,342 @@
1
- import rt from "prettier/parser-babel";
2
- import it from "prettier/parser-espree";
3
- import ot from "prettier/parser-flow";
4
- import at from "prettier/parser-typescript";
5
- import dt from "prettier/parser-meriyah";
6
- import { utils as re, builders as k } from "prettier/doc";
7
- import { parse as lt } from "@xml-tools/parser";
8
- import { printers as ct } from "prettier/plugins/estree.mjs";
9
- const We = "embeddedCss";
10
- function ut(e) {
11
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1
+ import Qe from "prettier/parser-babel";
2
+ import Ze from "prettier/parser-espree";
3
+ import et from "prettier/parser-flow";
4
+ import tt from "prettier/parser-typescript";
5
+ import nt from "prettier/parser-meriyah";
6
+ import { utils as X, builders as $ } from "prettier/doc";
7
+ import { isAbsolute as rt } from "node:path";
8
+ import { readFileSync as st } from "node:fs";
9
+ import { printers as ot } from "prettier/plugins/estree.mjs";
10
+ const Ce = "embeddedCss";
11
+ var it = {
12
+ isEqual: !0,
13
+ isMatchingKey: !0,
14
+ isPromise: !0,
15
+ maxSize: !0,
16
+ onCacheAdd: !0,
17
+ onCacheChange: !0,
18
+ onCacheHit: !0,
19
+ transformKey: !0
20
+ }, at = Array.prototype.slice;
21
+ function W(t) {
22
+ var n = t.length;
23
+ return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : at.call(t, 0) : [];
12
24
  }
13
- var Ge = { exports: {} };
14
- (function(e) {
15
- var n = (() => {
16
- var r = Object.defineProperty, t = Object.getOwnPropertyDescriptor, s = Object.getOwnPropertyNames, o = Object.getOwnPropertySymbols, h = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable, d = (p, a, c) => a in p ? r(p, a, { enumerable: !0, configurable: !0, writable: !0, value: c }) : p[a] = c, f = (p, a) => {
17
- for (var c in a || (a = {}))
18
- h.call(a, c) && d(p, c, a[c]);
19
- if (o)
20
- for (var c of o(a))
21
- g.call(a, c) && d(p, c, a[c]);
22
- return p;
23
- }, u = (p, a) => {
24
- for (var c in a)
25
- r(p, c, { get: a[c], enumerable: !0 });
26
- }, $ = (p, a, c, I) => {
27
- if (a && typeof a == "object" || typeof a == "function")
28
- for (let E of s(a))
29
- !h.call(p, E) && E !== c && r(p, E, { get: () => a[E], enumerable: !(I = t(a, E)) || I.enumerable });
30
- return p;
31
- }, S = (p) => $(r({}, "__esModule", { value: !0 }), p), i = (p, a, c) => (d(p, typeof a != "symbol" ? a + "" : a, c), c), _ = {};
32
- u(_, {
33
- DEFAULT_OPTIONS: () => L,
34
- DEFAULT_UUID_LENGTH: () => v,
35
- default: () => y
36
- });
37
- var b = "5.0.3", v = 6, L = {
38
- dictionary: "alphanum",
39
- shuffle: !0,
40
- debug: !1,
41
- length: v,
42
- counter: 0
43
- }, m = class {
44
- constructor(a = {}) {
45
- i(this, "counter"), i(this, "debug"), i(this, "dict"), i(this, "version"), i(this, "dictIndex", 0), i(this, "dictRange", []), i(this, "lowerBound", 0), i(this, "upperBound", 0), i(this, "dictLength", 0), i(this, "uuidLength"), i(this, "_digit_first_ascii", 48), i(this, "_digit_last_ascii", 58), i(this, "_alpha_lower_first_ascii", 97), i(this, "_alpha_lower_last_ascii", 123), i(this, "_hex_last_ascii", 103), i(this, "_alpha_upper_first_ascii", 65), i(this, "_alpha_upper_last_ascii", 91), i(this, "_number_dict_ranges", {
46
- digits: [this._digit_first_ascii, this._digit_last_ascii]
47
- }), i(this, "_alpha_dict_ranges", {
48
- lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
49
- upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
50
- }), i(this, "_alpha_lower_dict_ranges", {
51
- lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
52
- }), i(this, "_alpha_upper_dict_ranges", {
53
- upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
54
- }), i(this, "_alphanum_dict_ranges", {
55
- digits: [this._digit_first_ascii, this._digit_last_ascii],
56
- lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
57
- upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
58
- }), i(this, "_alphanum_lower_dict_ranges", {
59
- digits: [this._digit_first_ascii, this._digit_last_ascii],
60
- lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
61
- }), i(this, "_alphanum_upper_dict_ranges", {
62
- digits: [this._digit_first_ascii, this._digit_last_ascii],
63
- upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
64
- }), i(this, "_hex_dict_ranges", {
65
- decDigits: [this._digit_first_ascii, this._digit_last_ascii],
66
- alphaDigits: [this._alpha_lower_first_ascii, this._hex_last_ascii]
67
- }), i(this, "_dict_ranges", {
68
- _number_dict_ranges: this._number_dict_ranges,
69
- _alpha_dict_ranges: this._alpha_dict_ranges,
70
- _alpha_lower_dict_ranges: this._alpha_lower_dict_ranges,
71
- _alpha_upper_dict_ranges: this._alpha_upper_dict_ranges,
72
- _alphanum_dict_ranges: this._alphanum_dict_ranges,
73
- _alphanum_lower_dict_ranges: this._alphanum_lower_dict_ranges,
74
- _alphanum_upper_dict_ranges: this._alphanum_upper_dict_ranges,
75
- _hex_dict_ranges: this._hex_dict_ranges
76
- }), i(this, "log", (...l) => {
77
- const x = [...l];
78
- if (x[0] = `[short-unique-id] ${l[0]}`, this.debug === !0 && typeof console < "u" && console !== null)
79
- return console.log(...x);
80
- }), i(this, "setDictionary", (l, x) => {
81
- let w;
82
- if (l && Array.isArray(l) && l.length > 1)
83
- w = l;
84
- else {
85
- w = [];
86
- let T;
87
- this.dictIndex = T = 0;
88
- const P = `_${l}_dict_ranges`, U = this._dict_ranges[P];
89
- Object.keys(U).forEach((N) => {
90
- const te = N;
91
- for (this.dictRange = U[te], this.lowerBound = this.dictRange[0], this.upperBound = this.dictRange[1], this.dictIndex = T = this.lowerBound; this.lowerBound <= this.upperBound ? T < this.upperBound : T > this.upperBound; this.dictIndex = this.lowerBound <= this.upperBound ? T += 1 : T -= 1)
92
- w.push(String.fromCharCode(this.dictIndex));
93
- });
25
+ function dt(t) {
26
+ var n = {};
27
+ for (var r in t)
28
+ it[r] || (n[r] = t[r]);
29
+ return n;
30
+ }
31
+ function ct(t) {
32
+ return typeof t == "function" && t.isMemoized;
33
+ }
34
+ function lt(t, n) {
35
+ return t === n || t !== t && n !== n;
36
+ }
37
+ function Z(t, n) {
38
+ var r = {};
39
+ for (var e in t)
40
+ r[e] = t[e];
41
+ for (var e in n)
42
+ r[e] = n[e];
43
+ return r;
44
+ }
45
+ var ut = (
46
+ /** @class */
47
+ function() {
48
+ function t(n) {
49
+ this.keys = [], this.values = [], this.options = n;
50
+ var r = typeof n.isMatchingKey == "function";
51
+ r ? this.getKeyIndex = this._getKeyIndexFromMatchingKey : n.maxSize > 1 ? this.getKeyIndex = this._getKeyIndexForMany : this.getKeyIndex = this._getKeyIndexForSingle, this.canTransformKey = typeof n.transformKey == "function", this.shouldCloneArguments = this.canTransformKey || r, this.shouldUpdateOnAdd = typeof n.onCacheAdd == "function", this.shouldUpdateOnChange = typeof n.onCacheChange == "function", this.shouldUpdateOnHit = typeof n.onCacheHit == "function";
52
+ }
53
+ return Object.defineProperty(t.prototype, "size", {
54
+ /**
55
+ * The number of cached [key,value] results.
56
+ */
57
+ get: function() {
58
+ return this.keys.length;
59
+ },
60
+ enumerable: !1,
61
+ configurable: !0
62
+ }), Object.defineProperty(t.prototype, "snapshot", {
63
+ /**
64
+ * A copy of the cache at a moment in time. This is useful
65
+ * to compare changes over time, since the cache mutates
66
+ * internally for performance reasons.
67
+ */
68
+ get: function() {
69
+ return {
70
+ keys: W(this.keys),
71
+ size: this.size,
72
+ values: W(this.values)
73
+ };
74
+ },
75
+ enumerable: !1,
76
+ configurable: !0
77
+ }), t.prototype._getKeyIndexFromMatchingKey = function(n) {
78
+ var r = this.options, e = r.isMatchingKey, s = r.maxSize, o = this.keys, d = o.length;
79
+ if (!d)
80
+ return -1;
81
+ if (e(o[0], n))
82
+ return 0;
83
+ if (s > 1) {
84
+ for (var i = 1; i < d; i++)
85
+ if (e(o[i], n))
86
+ return i;
87
+ }
88
+ return -1;
89
+ }, t.prototype._getKeyIndexForMany = function(n) {
90
+ var r = this.options.isEqual, e = this.keys, s = e.length;
91
+ if (!s)
92
+ return -1;
93
+ if (s === 1)
94
+ return this._getKeyIndexForSingle(n);
95
+ var o = n.length, d, i;
96
+ if (o > 1) {
97
+ for (var a = 0; a < s; a++)
98
+ if (d = e[a], d.length === o) {
99
+ for (i = 0; i < o && r(d[i], n[i]); i++)
100
+ ;
101
+ if (i === o)
102
+ return a;
94
103
  }
95
- x && (w = w.sort(() => Math.random() - 0.5)), this.dict = w, this.dictLength = this.dict.length, this.setCounter(0);
96
- }), i(this, "seq", () => this.sequentialUUID()), i(this, "sequentialUUID", () => {
97
- let l, x, w = "";
98
- l = this.counter;
99
- do
100
- x = l % this.dictLength, l = Math.trunc(l / this.dictLength), w += this.dict[x];
101
- while (l !== 0);
102
- return this.counter += 1, w;
103
- }), i(this, "rnd", (l = this.uuidLength || v) => this.randomUUID(l)), i(this, "randomUUID", (l = this.uuidLength || v) => {
104
- let x, w, T;
105
- if (l === null || typeof l > "u" || l < 1)
106
- throw new Error("Invalid UUID Length Provided");
107
- for (x = "", T = 0; T < l; T += 1)
108
- w = parseInt(
109
- (Math.random() * this.dictLength).toFixed(0),
110
- 10
111
- ) % this.dictLength, x += this.dict[w];
112
- return x;
113
- }), i(this, "fmt", (l, x) => this.formattedUUID(l, x)), i(this, "formattedUUID", (l, x) => {
114
- const w = {
115
- $r: this.randomUUID,
116
- $s: this.sequentialUUID,
117
- $t: this.stamp
118
- };
119
- return l.replace(
120
- /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
121
- (P) => {
122
- const U = P.slice(0, 2), N = parseInt(P.slice(2), 10);
123
- return U === "$s" ? w[U]().padStart(N, "0") : U === "$t" && x ? w[U](N, x) : w[U](N);
124
- }
125
- );
126
- }), i(this, "availableUUIDs", (l = this.uuidLength) => parseFloat(
127
- Math.pow([...new Set(this.dict)].length, l).toFixed(0)
128
- )), i(this, "approxMaxBeforeCollision", (l = this.availableUUIDs(this.uuidLength)) => parseFloat(
129
- Math.sqrt(Math.PI / 2 * l).toFixed(20)
130
- )), i(this, "collisionProbability", (l = this.availableUUIDs(this.uuidLength), x = this.uuidLength) => parseFloat(
131
- (this.approxMaxBeforeCollision(l) / this.availableUUIDs(x)).toFixed(20)
132
- )), i(this, "uniqueness", (l = this.availableUUIDs(this.uuidLength)) => {
133
- const x = parseFloat(
134
- (1 - this.approxMaxBeforeCollision(l) / l).toFixed(20)
135
- );
136
- return x > 1 ? 1 : x < 0 ? 0 : x;
137
- }), i(this, "getVersion", () => this.version), i(this, "stamp", (l, x) => {
138
- const w = Math.floor(+(x || /* @__PURE__ */ new Date()) / 1e3).toString(16);
139
- if (typeof l == "number" && l === 0)
140
- return w;
141
- if (typeof l != "number" || l < 10)
142
- throw new Error(
143
- [
144
- "Param finalLength must be a number greater than or equal to 10,",
145
- "or 0 if you want the raw hexadecimal timestamp"
146
- ].join(`
147
- `)
148
- );
149
- const T = l - 9, P = Math.round(Math.random() * (T > 15 ? 15 : T)), U = this.randomUUID(T);
150
- return `${U.substring(0, P)}${w}${U.substring(P)}${P.toString(16)}`;
151
- }), i(this, "parseStamp", (l, x) => {
152
- if (x && !/t0|t[1-9]\d{1,}/.test(x))
153
- throw new Error("Cannot extract date from a formated UUID with no timestamp in the format");
154
- const w = x ? x.replace(
155
- /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
156
- (P) => {
157
- const U = {
158
- $r: (Y) => [...Array(Y)].map(() => "r").join(""),
159
- $s: (Y) => [...Array(Y)].map(() => "s").join(""),
160
- $t: (Y) => [...Array(Y)].map(() => "t").join("")
161
- }, N = P.slice(0, 2), te = parseInt(P.slice(2), 10);
162
- return U[N](te);
163
- }
164
- ).replace(
165
- /^(.*?)(t{8,})(.*)$/g,
166
- (P, U, N) => l.substring(U.length, U.length + N.length)
167
- ) : l;
168
- if (w.length === 8)
169
- return new Date(parseInt(w, 16) * 1e3);
170
- if (w.length < 10)
171
- throw new Error("Stamp length invalid");
172
- const T = parseInt(w.substring(w.length - 1), 16);
173
- return new Date(parseInt(w.substring(T, T + 8), 16) * 1e3);
174
- }), i(this, "setCounter", (l) => {
175
- this.counter = l;
176
- });
177
- const c = f(f({}, L), a);
178
- this.counter = 0, this.debug = !1, this.dict = [], this.version = b;
179
- const {
180
- dictionary: I,
181
- shuffle: E,
182
- length: D,
183
- counter: O
184
- } = c;
185
- return this.uuidLength = D, this.setDictionary(I, E), this.setCounter(O), this.debug = c.debug, this.log(this.dict), this.log(
186
- `Generator instantiated with Dictionary Size ${this.dictLength} and counter set to ${this.counter}`
187
- ), this.log = this.log.bind(this), this.setDictionary = this.setDictionary.bind(this), this.setCounter = this.setCounter.bind(this), this.seq = this.seq.bind(this), this.sequentialUUID = this.sequentialUUID.bind(this), this.rnd = this.rnd.bind(this), this.randomUUID = this.randomUUID.bind(this), this.fmt = this.fmt.bind(this), this.formattedUUID = this.formattedUUID.bind(this), this.availableUUIDs = this.availableUUIDs.bind(this), this.approxMaxBeforeCollision = this.approxMaxBeforeCollision.bind(this), this.collisionProbability = this.collisionProbability.bind(this), this.uniqueness = this.uniqueness.bind(this), this.getVersion = this.getVersion.bind(this), this.stamp = this.stamp.bind(this), this.parseStamp = this.parseStamp.bind(this), this;
104
+ } else
105
+ for (var a = 0; a < s; a++)
106
+ if (d = e[a], d.length === o && r(d[0], n[0]))
107
+ return a;
108
+ return -1;
109
+ }, t.prototype._getKeyIndexForSingle = function(n) {
110
+ var r = this.keys;
111
+ if (!r.length)
112
+ return -1;
113
+ var e = r[0], s = e.length;
114
+ if (n.length !== s)
115
+ return -1;
116
+ var o = this.options.isEqual;
117
+ if (s > 1) {
118
+ for (var d = 0; d < s; d++)
119
+ if (!o(e[d], n[d]))
120
+ return -1;
121
+ return 0;
188
122
  }
189
- };
190
- i(m, "default", m);
191
- var y = m;
192
- return S(_);
193
- })();
194
- e.exports = n.default, typeof window < "u" && (n = n.default);
195
- })(Ge);
196
- var pt = Ge.exports;
197
- const ht = /* @__PURE__ */ ut(pt), { group: gt, indent: mt, softline: le, lineSuffixBoundary: _t } = k, { mapDoc: ft } = re;
198
- function bt(e, n) {
199
- var s;
200
- const { node: r } = e;
201
- let t = n();
202
- return (s = r == null ? void 0 : r.comments) != null && s.length && (t = gt([mt([le, t]), le])), ["${", t, _t, "}"];
123
+ return o(e[0], n[0]) ? 0 : -1;
124
+ }, t.prototype.orderByLru = function(n, r, e) {
125
+ for (var s = this.keys, o = this.values, d = s.length, i = e; i--; )
126
+ s[i + 1] = s[i], o[i + 1] = o[i];
127
+ s[0] = n, o[0] = r;
128
+ var a = this.options.maxSize;
129
+ d === a && e === d ? (s.pop(), o.pop()) : e >= a && (s.length = o.length = a);
130
+ }, t.prototype.updateAsyncCache = function(n) {
131
+ var r = this, e = this.options, s = e.onCacheChange, o = e.onCacheHit, d = this.keys[0], i = this.values[0];
132
+ this.values[0] = i.then(function(a) {
133
+ return r.shouldUpdateOnHit && o(r, r.options, n), r.shouldUpdateOnChange && s(r, r.options, n), a;
134
+ }, function(a) {
135
+ var l = r.getKeyIndex(d);
136
+ throw l !== -1 && (r.keys.splice(l, 1), r.values.splice(l, 1)), a;
137
+ });
138
+ }, t;
139
+ }()
140
+ );
141
+ function Y(t, n) {
142
+ if (n === void 0 && (n = {}), ct(t))
143
+ return Y(t.fn, Z(t.options, n));
144
+ if (typeof t != "function")
145
+ throw new TypeError("You must pass a function to `memoize`.");
146
+ var r = n.isEqual, e = r === void 0 ? lt : r, s = n.isMatchingKey, o = n.isPromise, d = o === void 0 ? !1 : o, i = n.maxSize, a = i === void 0 ? 1 : i, l = n.onCacheAdd, g = n.onCacheChange, y = n.onCacheHit, h = n.transformKey, u = Z({
147
+ isEqual: e,
148
+ isMatchingKey: s,
149
+ isPromise: d,
150
+ maxSize: a,
151
+ onCacheAdd: l,
152
+ onCacheChange: g,
153
+ onCacheHit: y,
154
+ transformKey: h
155
+ }, dt(n)), c = new ut(u), b = c.keys, m = c.values, p = c.canTransformKey, f = c.shouldCloneArguments, _ = c.shouldUpdateOnAdd, v = c.shouldUpdateOnChange, x = c.shouldUpdateOnHit, E = function() {
156
+ var S = f ? W(arguments) : arguments;
157
+ p && (S = h(S));
158
+ var O = b.length ? c.getKeyIndex(S) : -1;
159
+ if (O !== -1)
160
+ x && y(c, u, E), O && (c.orderByLru(b[O], m[O], O), v && g(c, u, E));
161
+ else {
162
+ var Ve = t.apply(this, arguments), Je = f ? S : W(arguments);
163
+ c.orderByLru(Je, Ve, b.length), d && c.updateAsyncCache(E), _ && l(c, u, E), v && g(c, u, E);
164
+ }
165
+ return m[0];
166
+ };
167
+ return E.cache = c, E.fn = t, E.isMemoized = !0, E.options = u, E;
203
168
  }
204
- function M(e, n) {
205
- return e.map(
206
- (r) => bt(r, n),
169
+ const { group: gt, indent: mt, softline: ee, lineSuffixBoundary: pt } = $, { mapDoc: ft } = X;
170
+ function ht(t, n) {
171
+ const { node: r } = t;
172
+ let e = n();
173
+ return r?.comments?.length && (e = gt([mt([ee, e]), ee])), ["${", e, pt, "}"];
174
+ }
175
+ function L(t, n) {
176
+ return t.map(
177
+ (r) => ht(r, n),
207
178
  "expressions"
208
179
  );
209
180
  }
210
- function q(e, n, r) {
211
- return ft(e, (s) => {
181
+ function D(t, n, r) {
182
+ return ft(t, (s) => {
212
183
  if (typeof s != "string")
213
184
  return s;
214
- const o = [], h = s.split(n);
215
- for (let g = 0; g < h.length; g++) {
216
- let d = h[g];
217
- if (g % 2 == 0) {
218
- if (!d)
185
+ const o = [], d = s.split(n);
186
+ for (let i = 0; i < d.length; i++) {
187
+ let a = d[i];
188
+ if (i % 2 == 0) {
189
+ if (!a)
219
190
  continue;
220
- d = d.replaceAll(/([\\`]|\${)/g, "\\$1"), o.push(d);
191
+ a = a.replaceAll(/([\\`]|\${)/g, "\\$1"), o.push(a);
221
192
  } else {
222
- const f = Number(d);
223
- o.push(r[f]);
193
+ const l = Number(a);
194
+ o.push(r[l]);
224
195
  }
225
196
  }
226
197
  return o;
227
198
  });
228
199
  }
229
- function Q(e, n, r) {
230
- var t;
231
- if (!(((t = n.plugins) == null ? void 0 : t.some(
232
- (s) => {
233
- var o;
234
- return ((o = s.name) == null ? void 0 : o.includes(e)) ?? !1;
235
- }
236
- )) ?? !1))
200
+ function B(t, n, r) {
201
+ if (!(n.plugins?.some(
202
+ (e) => e.name?.includes(t) ?? !1
203
+ ) ?? !1))
237
204
  throw new Error(
238
- `Cannot format embedded language identified by "${r}", because plugin "${e}" is not loaded.`
205
+ `Cannot format embedded language identified by "${r}", because plugin "${t}" is not loaded.`
239
206
  );
240
207
  }
241
- function yt(e, n, r) {
208
+ function bt(t, n, r) {
242
209
  if (n === r) {
243
- e.unshift(n);
210
+ t.unshift(n);
244
211
  return;
245
212
  }
246
- let t = 0, s = e.length;
247
- for (; t < s; ) {
248
- const o = t + s >>> 1;
249
- if (e[o] === r) {
250
- e.push(n);
213
+ let e = 0, s = t.length;
214
+ for (; e < s; ) {
215
+ const o = e + s >>> 1;
216
+ if (t[o] === r) {
217
+ t.push(n);
251
218
  return;
252
219
  }
253
- e[o] < n ? t = o + 1 : s = o;
220
+ t[o] < n ? e = o + 1 : s = o;
254
221
  }
255
- e.splice(t, 0, n);
222
+ t.splice(e, 0, n);
256
223
  }
257
- const { randomUUID: ce } = new ht({
258
- length: 16,
259
- dictionary: "alphanum_lower"
260
- });
261
- function j(e = "p", n = "") {
262
- const r = ce(), t = ce(), s = ue(e), o = ue(n), h = (d) => `${e}${r}${d}${t}${n}`, g = new RegExp(
263
- `${s}${r}(\\d+)${t}${o}`,
224
+ const te = (() => {
225
+ const t = [...Array(26).keys()].map((n) => String.fromCharCode(n + 97)).concat([...Array(10).keys()].map((n) => `${n}`));
226
+ return () => {
227
+ let r = "";
228
+ for (let e = 0; e < 16; ++e)
229
+ r += t[parseInt((Math.random() * t.length).toFixed(0), 10) % t.length];
230
+ return r;
231
+ };
232
+ })();
233
+ function k(t = "p", n = "") {
234
+ const r = te(), e = te(), s = ne(t), o = ne(n), d = (a) => `${t}${r}${a}${e}${n}`, i = new RegExp(
235
+ `${s}${r}(\\d+)${e}${o}`,
264
236
  "g"
265
237
  );
266
238
  return {
267
- createPlaceholder: h,
268
- placeholderRegex: g
239
+ createPlaceholder: d,
240
+ placeholderRegex: i
269
241
  };
270
242
  }
271
- function ue(e) {
272
- return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
243
+ function ne(t) {
244
+ return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
273
245
  }
274
- function R(e) {
275
- return `${e}Identifiers`;
246
+ function I(t) {
247
+ return `${t}Identifiers`;
276
248
  }
277
- function It(e) {
278
- return `${e}Parser`;
249
+ function yt(t) {
250
+ return `${t}Parser`;
279
251
  }
280
- const { line: pe, group: B, indent: he, softline: ge } = k, Et = async (e, n, r, t, s) => {
281
- var o, h, g, d, f;
252
+ const vt = Y((t) => {
253
+ const n = rt(t) ? st(t, { encoding: "utf-8" }) : t;
282
254
  try {
283
- const { node: u } = r, { createPlaceholder: $, placeholderRegex: S } = j("@p"), i = u.quasis.map(
284
- (a, c, { length: I }) => c === I - 1 ? a.value.cooked : a.value.cooked + $(c)
285
- ).join(""), _ = ((o = i.match(/^\s+/)) == null ? void 0 : o[0]) ?? "", b = ((h = i.match(/\s+$/)) == null ? void 0 : h[0]) ?? "", v = M(r, n), L = await e(i, {
286
- parser: "scss"
287
- }), m = q(
288
- L,
289
- S,
290
- v
291
- );
292
- if ((g = t.preserveEmbeddedExteriorWhitespaces) != null && g.includes(s))
293
- return B([
294
- "`",
295
- _,
296
- (d = t.noEmbeddedMultiLineIndentation) != null && d.includes(s) ? [B(m)] : he([B(m)]),
297
- b,
298
- "`"
299
- ]);
300
- const y = _.length ? pe : ge, p = b.length ? pe : ge;
301
- return B([
255
+ return JSON.parse(n);
256
+ } catch {
257
+ console.error("Error parsing embedded overrides.");
258
+ }
259
+ }), T = Y(
260
+ (t, n) => {
261
+ if (typeof t == "string") {
262
+ const r = vt(t);
263
+ if (typeof r > "u")
264
+ return;
265
+ try {
266
+ for (const { identifiers: e, options: s } of r)
267
+ if (e.includes(n))
268
+ return s;
269
+ } catch {
270
+ console.error("Error parsing embedded override options.");
271
+ }
272
+ }
273
+ }
274
+ ), { line: re, group: R, indent: se, softline: oe } = $, _t = async (t, n, r, e, s) => {
275
+ e = {
276
+ ...e,
277
+ ...T(e.embeddedOverrides, s)
278
+ };
279
+ const { node: o } = r, { createPlaceholder: d, placeholderRegex: i } = k("@p"), a = o.quasis.map(
280
+ (m, p, { length: f }) => p === f - 1 ? m.value.cooked : m.value.cooked + d(p)
281
+ ).join(""), l = a.match(/^\s+/)?.[0] ?? "", g = a.match(/\s+$/)?.[0] ?? "", y = L(r, n), h = await t(a, {
282
+ ...e,
283
+ parser: "scss"
284
+ }), u = D(h, i, y);
285
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
286
+ return R([
302
287
  "`",
303
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [y, B(m)] : he([y, B(m)]),
304
- p,
288
+ l,
289
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [R(u)] : se([R(u)]),
290
+ g,
305
291
  "`"
306
292
  ]);
307
- } catch (u) {
308
- throw console.error(u), u;
309
- }
310
- }, xt = ["css"], $t = R(We), vt = {
311
- [$t]: {
293
+ const c = l.length ? re : oe, b = g.length ? re : oe;
294
+ return R([
295
+ "`",
296
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [c, R(u)] : se([c, R(u)]),
297
+ b,
298
+ "`"
299
+ ]);
300
+ }, Et = ["css"], xt = I(Ce), $t = {
301
+ [xt]: {
312
302
  category: "Global",
313
303
  type: "string",
314
304
  array: !0,
315
- default: [{ value: [...xt] }],
305
+ default: [{ value: [...Et] }],
316
306
  description: "Specify embedded CSS language identifiers."
317
307
  }
318
- }, wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
308
+ }, It = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
319
309
  __proto__: null,
320
- embeddedLanguage: We,
321
- embedder: Et,
322
- options: vt
323
- }, Symbol.toStringTag, { value: "Module" })), ie = "embeddedEs", { line: me, group: F, indent: _e, softline: fe } = k, Dt = async (e, n, r, t, s) => {
324
- var o, h, g, d, f;
325
- try {
326
- const { node: u } = r, { createPlaceholder: $, placeholderRegex: S } = j(), i = u.quasis.map(
327
- (a, c, { length: I }) => c === I - 1 ? a.value.cooked : a.value.cooked + $(c)
328
- ).join(""), _ = ((o = i.match(/^\s+/)) == null ? void 0 : o[0]) ?? "", b = ((h = i.match(/\s+$/)) == null ? void 0 : h[0]) ?? "", v = M(r, n), L = await e(i, {
329
- parser: t.embeddedEsParser ?? "babel"
330
- }), m = q(
331
- L,
332
- S,
333
- v
334
- );
335
- if ((g = t.preserveEmbeddedExteriorWhitespaces) != null && g.includes(s))
336
- return F([
337
- "`",
338
- _,
339
- (d = t.noEmbeddedMultiLineIndentation) != null && d.includes(s) ? [F(m)] : _e([F(m)]),
340
- b,
341
- "`"
342
- ]);
343
- const y = _.length ? me : fe, p = b.length ? me : fe;
344
- return F([
310
+ embeddedLanguage: Ce,
311
+ embedder: _t,
312
+ options: $t
313
+ }, Symbol.toStringTag, { value: "Module" })), V = "embeddedEs", { line: ie, group: P, indent: ae, softline: de } = $, St = async (t, n, r, e, s) => {
314
+ e = {
315
+ ...e,
316
+ ...T(e.embeddedOverrides, s)
317
+ };
318
+ const { node: o } = r, { createPlaceholder: d, placeholderRegex: i } = k(), a = o.quasis.map(
319
+ (m, p, { length: f }) => p === f - 1 ? m.value.cooked : m.value.cooked + d(p)
320
+ ).join(""), l = a.match(/^\s+/)?.[0] ?? "", g = a.match(/\s+$/)?.[0] ?? "", y = L(r, n), h = await t(a, {
321
+ ...e,
322
+ parser: e.embeddedEsParser ?? "babel"
323
+ }), u = D(h, i, y);
324
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
325
+ return P([
345
326
  "`",
346
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [y, F(m)] : _e([y, F(m)]),
347
- p,
327
+ l,
328
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [P(u)] : ae([P(u)]),
329
+ g,
348
330
  "`"
349
331
  ]);
350
- } catch (u) {
351
- throw console.error(u), u;
352
- }
353
- }, Lt = [
332
+ const c = l.length ? ie : de, b = g.length ? ie : de;
333
+ return P([
334
+ "`",
335
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [c, P(u)] : ae([c, P(u)]),
336
+ b,
337
+ "`"
338
+ ]);
339
+ }, Ot = [
354
340
  "js",
355
341
  "jsx",
356
342
  "es",
@@ -359,61 +345,56 @@ const { line: pe, group: B, indent: he, softline: ge } = k, Et = async (e, n, r,
359
345
  "cjs",
360
346
  "pac",
361
347
  "javascript"
362
- ], St = R(ie), Tt = It(ie), Ot = {
363
- [St]: {
348
+ ], Lt = I(V), kt = yt(V), Tt = {
349
+ [Lt]: {
364
350
  category: "Global",
365
351
  type: "string",
366
352
  array: !0,
367
- default: [{ value: [...Lt] }],
353
+ default: [{ value: [...Ot] }],
368
354
  description: "Specify embedded ES language identifiers."
369
355
  },
370
- [Tt]: {
356
+ [kt]: {
371
357
  category: "Global",
372
358
  type: "string",
373
359
  array: !1,
374
360
  default: "babel",
375
361
  description: "Specify the embedded ES language parser."
376
362
  }
377
- }, Ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
363
+ }, Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
378
364
  __proto__: null,
379
- embeddedLanguage: ie,
380
- embedder: Dt,
381
- options: Ot
382
- }, Symbol.toStringTag, { value: "Module" })), ze = "embeddedGlsl", { line: be, group: A, indent: ye, softline: Ie } = k, Pt = async (e, n, r, t, s) => {
383
- var o, h, g, d, f;
384
- try {
385
- Q("prettier-plugin-glsl", t, s);
386
- const { node: u } = r, { createPlaceholder: $, placeholderRegex: S } = j(), i = u.quasis.map(
387
- (c, I, { length: E }) => I === E - 1 ? c.value.cooked : c.value.cooked + $(I)
388
- ).join(""), _ = ((o = i.match(/^\s+/)) == null ? void 0 : o[0]) ?? "", b = ((h = i.match(/\s+$/)) == null ? void 0 : h[0]) ?? "", v = i.slice(
389
- _.length,
390
- -b.length || void 0
391
- ), L = M(r, n), m = await e(v, {
392
- parser: "glsl-parser"
393
- }), y = q(
394
- m,
395
- S,
396
- L
397
- );
398
- if ((g = t.preserveEmbeddedExteriorWhitespaces) != null && g.includes(s))
399
- return A([
400
- "`",
401
- _,
402
- (d = t.noEmbeddedMultiLineIndentation) != null && d.includes(s) ? [A(y)] : ye([A(y)]),
403
- b,
404
- "`"
405
- ]);
406
- const p = _.length ? be : Ie, a = b.length ? be : Ie;
407
- return A([
365
+ embeddedLanguage: V,
366
+ embedder: St,
367
+ options: Tt
368
+ }, Symbol.toStringTag, { value: "Module" })), Ne = "embeddedGlsl", { line: ce, group: M, indent: le, softline: ue } = $, Rt = async (t, n, r, e, s) => {
369
+ B("prettier-plugin-glsl", e, s), e = {
370
+ ...e,
371
+ ...T(e.embeddedOverrides, s)
372
+ };
373
+ const { node: o } = r, { createPlaceholder: d, placeholderRegex: i } = k(), a = o.quasis.map(
374
+ (p, f, { length: _ }) => f === _ - 1 ? p.value.cooked : p.value.cooked + d(f)
375
+ ).join(""), l = a.match(/^\s+/)?.[0] ?? "", g = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
376
+ l.length,
377
+ -g.length || void 0
378
+ ), h = L(r, n), u = await t(y, {
379
+ ...e,
380
+ parser: "glsl-parser"
381
+ }), c = D(u, i, h);
382
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
383
+ return M([
408
384
  "`",
409
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [p, A(y)] : ye([p, A(y)]),
410
- a,
385
+ l,
386
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [M(c)] : le([M(c)]),
387
+ g,
411
388
  "`"
412
389
  ]);
413
- } catch (u) {
414
- throw console.error(u), u;
415
- }
416
- }, kt = [
390
+ const b = l.length ? ce : ue, m = g.length ? ce : ue;
391
+ return M([
392
+ "`",
393
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [b, M(c)] : le([b, M(c)]),
394
+ m,
395
+ "`"
396
+ ]);
397
+ }, Pt = [
417
398
  "glsl",
418
399
  "fp",
419
400
  "frag",
@@ -436,63 +417,63 @@ const { line: pe, group: B, indent: he, softline: ge } = k, Et = async (e, n, r,
436
417
  "vrx",
437
418
  "vsh",
438
419
  "vshader"
439
- ], Rt = R(ze), Mt = {
440
- [Rt]: {
420
+ ], Mt = I(Ne), Ct = {
421
+ [Mt]: {
441
422
  category: "Global",
442
423
  type: "string",
443
424
  array: !0,
444
- default: [{ value: [...kt] }],
425
+ default: [{ value: [...Pt] }],
445
426
  description: 'Specify embedded GLSL language identifiers. This requires "prettier-plugin-glsl".'
446
427
  }
447
- }, jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
428
+ }, Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
448
429
  __proto__: null,
449
- embeddedLanguage: ze,
450
- embedder: Pt,
451
- options: Mt
452
- }, Symbol.toStringTag, { value: "Module" })), Xe = "embeddedHtml", { line: Ee, group: C, indent: xe, softline: $e } = k, { mapDoc: Nt } = re, qt = async (e, n, r, t, s) => {
453
- var o, h, g, d, f;
454
- try {
455
- const { node: u } = r, { createPlaceholder: $, placeholderRegex: S } = j(), i = u.quasis.map(
456
- (a, c, { length: I }) => c === I - 1 ? a.value.cooked : a.value.cooked + $(c)
457
- ).join(""), _ = ((o = i.match(/^\s+/)) == null ? void 0 : o[0]) ?? "", b = ((h = i.match(/\s+$/)) == null ? void 0 : h[0]) ?? "", v = M(r, n), L = await e(i, {
458
- parser: "html"
459
- }), m = Nt(L, (a) => {
460
- if (typeof a != "string")
461
- return a;
462
- const c = [], I = a.split(S);
463
- for (let E = 0; E < I.length; E++) {
464
- let D = I[E];
465
- if (E % 2 == 0) {
466
- if (!D)
467
- continue;
468
- D = D.replaceAll(/([\\`]|\${)/g, "\\$1"), t.__embeddedInHtml && (D = D.replaceAll(/<\/(?=script\b)/gi, "<\\/")), c.push(D);
469
- } else {
470
- const O = Number(D);
471
- c.push(v[O]);
472
- }
430
+ embeddedLanguage: Ne,
431
+ embedder: Rt,
432
+ options: Ct
433
+ }, Symbol.toStringTag, { value: "Module" })), we = "embeddedHtml", { line: ge, group: C, indent: me, softline: pe } = $, { mapDoc: wt } = X, Ft = async (t, n, r, e, s) => {
434
+ e = {
435
+ ...e,
436
+ ...T(e.embeddedOverrides, s)
437
+ };
438
+ const { node: o } = r, { createPlaceholder: d, placeholderRegex: i } = k(), a = o.quasis.map(
439
+ (m, p, { length: f }) => p === f - 1 ? m.value.cooked : m.value.cooked + d(p)
440
+ ).join(""), l = a.match(/^\s+/)?.[0] ?? "", g = a.match(/\s+$/)?.[0] ?? "", y = L(r, n), h = await t(a, {
441
+ ...e,
442
+ parser: "html"
443
+ }), u = wt(h, (m) => {
444
+ if (typeof m != "string")
445
+ return m;
446
+ const p = [], f = m.split(i);
447
+ for (let _ = 0; _ < f.length; _++) {
448
+ let v = f[_];
449
+ if (_ % 2 == 0) {
450
+ if (!v)
451
+ continue;
452
+ v = v.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (v = v.replaceAll(/<\/(?=script\b)/gi, "<\\/")), p.push(v);
453
+ } else {
454
+ const x = Number(v);
455
+ p.push(y[x]);
473
456
  }
474
- return c;
475
- });
476
- if (t.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here?
477
- t.htmlWhitespaceSensitivity === "css" || (g = t.preserveEmbeddedExteriorWhitespaces) != null && g.includes(s))
478
- return C([
479
- "`",
480
- _,
481
- (d = t.noEmbeddedMultiLineIndentation) != null && d.includes(s) ? [C(m)] : xe([C(m)]),
482
- b,
483
- "`"
484
- ]);
485
- const y = _.length ? Ee : $e, p = b.length ? Ee : $e;
457
+ }
458
+ return p;
459
+ });
460
+ if (e.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here?
461
+ e.htmlWhitespaceSensitivity === "css" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
486
462
  return C([
487
463
  "`",
488
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [y, C(m)] : xe([y, C(m)]),
489
- p,
464
+ l,
465
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [C(u)] : me([C(u)]),
466
+ g,
490
467
  "`"
491
468
  ]);
492
- } catch (u) {
493
- throw console.error(u), u;
494
- }
495
- }, Bt = [
469
+ const c = l.length ? ge : pe, b = g.length ? ge : pe;
470
+ return C([
471
+ "`",
472
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [c, C(u)] : me([c, C(u)]),
473
+ b,
474
+ "`"
475
+ ]);
476
+ }, At = [
496
477
  "html",
497
478
  "htm",
498
479
  "shtml",
@@ -505,51 +486,47 @@ const { line: pe, group: B, indent: he, softline: ge } = k, Et = async (e, n, r,
505
486
  "jshtm",
506
487
  "volt",
507
488
  "rhtml"
508
- ], Ft = R(Xe), At = {
509
- [Ft]: {
489
+ ], jt = I(we), qt = {
490
+ [jt]: {
510
491
  category: "Global",
511
492
  type: "string",
512
493
  array: !0,
513
- default: [{ value: [...Bt] }],
494
+ default: [{ value: [...At] }],
514
495
  description: "Specify embedded HTML language identifiers."
515
496
  }
516
- }, Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
497
+ }, Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
517
498
  __proto__: null,
518
- embeddedLanguage: Xe,
519
- embedder: qt,
520
- options: At
521
- }, Symbol.toStringTag, { value: "Module" })), He = "embeddedMarkdown", { line: ve, group: W, indent: we, softline: De } = k, Wt = async (e, n, r, t, s) => {
522
- var o, h, g, d, f;
523
- try {
524
- const { node: u } = r, { createPlaceholder: $, placeholderRegex: S } = j(), i = u.quasis.map(
525
- (a, c, { length: I }) => c === I - 1 ? a.value.cooked : a.value.cooked + $(c)
526
- ).join(""), _ = ((o = i.match(/^\s+/)) == null ? void 0 : o[0]) ?? "", b = ((h = i.match(/\s+$/)) == null ? void 0 : h[0]) ?? "", v = M(r, n), L = await e(i, {
527
- parser: "markdown",
528
- __inJsTemplate: !0
529
- }), m = q(
530
- L,
531
- S,
532
- v
533
- );
534
- if ((g = t.preserveEmbeddedExteriorWhitespaces) != null && g.includes(s))
535
- return W([
536
- "`",
537
- _,
538
- (d = t.noEmbeddedMultiLineIndentation) != null && d.includes(s) ? [W(m)] : we([W(m)]),
539
- b,
540
- "`"
541
- ]);
542
- const y = _.length ? ve : De, p = b.length ? ve : De;
543
- return W([
499
+ embeddedLanguage: we,
500
+ embedder: Ft,
501
+ options: qt
502
+ }, Symbol.toStringTag, { value: "Module" })), Fe = "embeddedMarkdown", { line: fe, group: N, indent: he, softline: be } = $, Wt = async (t, n, r, e, s) => {
503
+ e = {
504
+ ...e,
505
+ ...T(e.embeddedOverrides, s)
506
+ };
507
+ const { node: o } = r, { createPlaceholder: d, placeholderRegex: i } = k(), a = o.quasis.map(
508
+ (m, p, { length: f }) => p === f - 1 ? m.value.cooked : m.value.cooked + d(p)
509
+ ).join(""), l = a.match(/^\s+/)?.[0] ?? "", g = a.match(/\s+$/)?.[0] ?? "", y = L(r, n), h = await t(a, {
510
+ ...e,
511
+ parser: "markdown",
512
+ __inJsTemplate: !0
513
+ }), u = D(h, i, y);
514
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
515
+ return N([
544
516
  "`",
545
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [y, W(m)] : we([y, W(m)]),
546
- p,
517
+ l,
518
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(u)] : he([N(u)]),
519
+ g,
547
520
  "`"
548
521
  ]);
549
- } catch (u) {
550
- throw console.error(u), u;
551
- }
552
- }, Gt = [
522
+ const c = l.length ? fe : be, b = g.length ? fe : be;
523
+ return N([
524
+ "`",
525
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [c, N(u)] : he([c, N(u)]),
526
+ b,
527
+ "`"
528
+ ]);
529
+ }, Kt = [
553
530
  "md",
554
531
  "livemd",
555
532
  "markdown",
@@ -561,79 +538,74 @@ const { line: pe, group: B, indent: he, softline: ge } = k, Et = async (e, n, r,
561
538
  "ronn",
562
539
  "scd",
563
540
  "workbook"
564
- ], zt = R(He), Xt = {
541
+ ], zt = I(Fe), Ut = {
565
542
  [zt]: {
566
543
  category: "Global",
567
544
  type: "string",
568
545
  array: !0,
569
- default: [{ value: [...Gt] }],
546
+ default: [{ value: [...Kt] }],
570
547
  description: "Specify embedded Markdown language identifiers."
571
548
  }
572
- }, Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
549
+ }, Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
573
550
  __proto__: null,
574
- embeddedLanguage: He,
551
+ embeddedLanguage: Fe,
575
552
  embedder: Wt,
576
- options: Xt
577
- }, Symbol.toStringTag, { value: "Module" })), oe = "embeddedNoop", Vt = R(oe), Yt = {
578
- [Vt]: {
553
+ options: Ut
554
+ }, Symbol.toStringTag, { value: "Module" })), J = "embeddedNoop", Ht = I(J), Xt = {
555
+ [Ht]: {
579
556
  category: "Global",
580
557
  type: "string",
581
558
  array: !0,
582
559
  default: [{ value: [] }],
583
560
  description: "Specify embedded language identifiers that will not be formatted."
584
561
  }
585
- }, Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
562
+ }, Yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
586
563
  __proto__: null,
587
- embeddedLanguage: oe,
588
- options: Yt
589
- }, Symbol.toStringTag, { value: "Module" })), Ve = "embeddedPhp", { line: Le, group: G, indent: Se, softline: Te } = k, Jt = async (e, n, r, t, s) => {
590
- var o, h, g, d, f;
591
- try {
592
- Q("@prettier/plugin-php", t, s);
593
- const { node: u } = r, { createPlaceholder: $, placeholderRegex: S } = j("$p"), i = u.quasis.map(
594
- (c, I, { length: E }) => I === E - 1 ? c.value.cooked : c.value.cooked + $(I)
595
- ).join(""), _ = ((o = i.match(/^\s+/)) == null ? void 0 : o[0]) ?? "", b = ((h = i.match(/\s+$/)) == null ? void 0 : h[0]) ?? "", v = i.slice(
596
- _.length,
597
- -b.length || void 0
598
- ), L = M(r, n), m = await e(v, {
599
- parser: "php"
600
- }), y = q(
601
- m,
602
- S,
603
- L
604
- );
605
- if ((g = t.preserveEmbeddedExteriorWhitespaces) != null && g.includes(s))
606
- return G([
607
- "`",
608
- _,
609
- (d = t.noEmbeddedMultiLineIndentation) != null && d.includes(s) ? [G(y)] : Se([G(y)]),
610
- b,
611
- "`"
612
- ]);
613
- const p = _.length ? Le : Te, a = b.length ? Le : Te;
614
- return G([
564
+ embeddedLanguage: J,
565
+ options: Xt
566
+ }, Symbol.toStringTag, { value: "Module" })), Ae = "embeddedPhp", { line: ye, group: w, indent: ve, softline: _e } = $, Vt = async (t, n, r, e, s) => {
567
+ B("@prettier/plugin-php", e, s), e = {
568
+ ...e,
569
+ ...T(e.embeddedOverrides, s)
570
+ };
571
+ const { node: o } = r, { createPlaceholder: d, placeholderRegex: i } = k("$p"), a = o.quasis.map(
572
+ (p, f, { length: _ }) => f === _ - 1 ? p.value.cooked : p.value.cooked + d(f)
573
+ ).join(""), l = a.match(/^\s+/)?.[0] ?? "", g = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
574
+ l.length,
575
+ -g.length || void 0
576
+ ), h = L(r, n), u = await t(y, {
577
+ ...e,
578
+ parser: "php"
579
+ }), c = D(u, i, h);
580
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
581
+ return w([
615
582
  "`",
616
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [p, G(y)] : Se([p, G(y)]),
617
- a,
583
+ l,
584
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [w(c)] : ve([w(c)]),
585
+ g,
618
586
  "`"
619
587
  ]);
620
- } catch (u) {
621
- throw console.error(u), u;
622
- }
623
- }, Kt = ["php", "php5", "phtml", "ctp"], Zt = R(Ve), en = {
624
- [Zt]: {
588
+ const b = l.length ? ye : _e, m = g.length ? ye : _e;
589
+ return w([
590
+ "`",
591
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [b, w(c)] : ve([b, w(c)]),
592
+ m,
593
+ "`"
594
+ ]);
595
+ }, Jt = ["php", "php5", "phtml", "ctp"], Qt = I(Ae), Zt = {
596
+ [Qt]: {
625
597
  category: "Global",
626
598
  type: "string",
627
599
  array: !0,
628
- default: [{ value: [...Kt] }],
600
+ default: [{ value: [...Jt] }],
629
601
  description: 'Specify embedded PHP language identifiers. This requires "@prettier/plugin-php".'
630
602
  }
631
- }, tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
603
+ }, en = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
632
604
  __proto__: null,
633
- embeddedLanguage: Ve,
634
- embedder: Jt,
635
- options: en
636
- }, Symbol.toStringTag, { value: "Module" })), Ye = "embeddedRuby", K = [
605
+ embeddedLanguage: Ae,
606
+ embedder: Vt,
607
+ options: Zt
608
+ }, Symbol.toStringTag, { value: "Module" })), je = "embeddedRuby", K = [
637
609
  "ruby",
638
610
  "arb",
639
611
  "axlsx",
@@ -659,109 +631,106 @@ const { line: pe, group: B, indent: he, softline: ge } = k, Et = async (e, n, r,
659
631
  "ru",
660
632
  "thor",
661
633
  "watchr"
662
- ], Z = ["rbs"], ee = ["haml"], nn = [
634
+ ], z = ["rbs"], U = ["haml"], tn = [
663
635
  ...K,
664
- ...Z,
665
- ...ee
666
- ], sn = "embeddedRubyParser", rn = R(Ye), on = {
636
+ ...z,
637
+ ...U
638
+ ], nn = "embeddedRubyParser", rn = I(je), sn = {
667
639
  [rn]: {
668
640
  category: "Global",
669
641
  type: "string",
670
642
  array: !0,
671
- default: [{ value: [...nn] }],
643
+ default: [{ value: [...tn] }],
672
644
  description: 'Specify embedded Ruby language identifiers. This requires "@prettier/plugin-ruby".'
673
645
  },
674
- [sn]: {
646
+ [nn]: {
675
647
  category: "Global",
676
648
  type: "string",
677
649
  array: !1,
678
650
  default: void 0,
679
651
  description: "Specify the embedded Ruby language parser."
680
652
  }
681
- }, { line: Oe, group: z, indent: Ue, softline: Pe } = k, an = async (e, n, r, t, s, o) => {
682
- var h, g, d, f, u;
683
- try {
684
- Q("@prettier/plugin-ruby", t, s);
685
- const { node: $ } = r, { createPlaceholder: S, placeholderRegex: i } = j(), _ = $.quasis.map(
686
- (E, D, { length: O }) => D === O - 1 ? E.value.cooked : E.value.cooked + S(D)
687
- ).join(""), b = ((h = _.match(/^\s+/)) == null ? void 0 : h[0]) ?? "", v = ((g = _.match(/\s+$/)) == null ? void 0 : g[0]) ?? "", L = _.slice(
688
- b.length,
689
- -v.length || void 0
690
- ), m = M(r, n), y = dn(t, s, o), p = await e(L, {
691
- parser: y
692
- }), a = q(
693
- p,
694
- i,
695
- m
696
- );
697
- if ((d = t.preserveEmbeddedExteriorWhitespaces) != null && d.includes(s))
698
- return z([
699
- "`",
700
- b,
701
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [z(a)] : Ue([z(a)]),
702
- v,
703
- "`"
704
- ]);
705
- const c = b.length ? Oe : Pe, I = v.length ? Oe : Pe;
706
- return z([
653
+ }, { line: Ee, group: F, indent: xe, softline: $e } = $, on = async (t, n, r, e, s, o) => {
654
+ B("@prettier/plugin-ruby", e, s), e = {
655
+ ...e,
656
+ ...T(e.embeddedOverrides, s)
657
+ };
658
+ const { node: d } = r, { createPlaceholder: i, placeholderRegex: a } = k(), l = d.quasis.map(
659
+ (_, v, { length: x }) => v === x - 1 ? _.value.cooked : _.value.cooked + i(v)
660
+ ).join(""), g = l.match(/^\s+/)?.[0] ?? "", y = l.match(/\s+$/)?.[0] ?? "", h = l.slice(
661
+ g.length,
662
+ -y.length || void 0
663
+ ), u = L(r, n), c = an(e, s, o), b = await t(h, {
664
+ ...e,
665
+ parser: c
666
+ }), m = D(b, a, u);
667
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
668
+ return F([
707
669
  "`",
708
- (u = t.noEmbeddedMultiLineIndentation) != null && u.includes(s) ? [c, z(a)] : Ue([c, z(a)]),
709
- I,
670
+ g,
671
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [F(m)] : xe([F(m)]),
672
+ y,
710
673
  "`"
711
674
  ]);
712
- } catch ($) {
713
- throw console.error($), $;
714
- }
675
+ const p = g.length ? Ee : $e, f = y.length ? Ee : $e;
676
+ return F([
677
+ "`",
678
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [p, F(m)] : xe([p, F(m)]),
679
+ f,
680
+ "`"
681
+ ]);
715
682
  };
716
- function dn(e, n, r) {
717
- if (typeof e.embeddedRubyParser == "string")
718
- return e.embeddedRubyParser;
719
- const t = r.indexOf(n);
720
- for (let s = t; s >= 0; --s) {
721
- if (ln(n))
683
+ function an(t, n, r) {
684
+ if (typeof t.embeddedRubyParser == "string")
685
+ return t.embeddedRubyParser;
686
+ const e = r.indexOf(n);
687
+ for (let s = e; s >= 0; --s) {
688
+ if (dn(n))
722
689
  return K[0];
723
690
  if (cn(n))
724
- return Z[0];
725
- if (un(n))
726
- return ee[0];
691
+ return z[0];
692
+ if (ln(n))
693
+ return U[0];
727
694
  }
728
695
  throw new SyntaxError(`Unrecognized ruby identifier: ${n}`);
729
696
  }
730
- function ln(e) {
731
- return K.includes(e);
697
+ function dn(t) {
698
+ return K.includes(t);
732
699
  }
733
- function cn(e) {
734
- return Z.includes(e);
700
+ function cn(t) {
701
+ return z.includes(t);
735
702
  }
736
- function un(e) {
737
- return ee.includes(e);
703
+ function ln(t) {
704
+ return U.includes(t);
738
705
  }
739
- const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
706
+ const un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
740
707
  __proto__: null,
741
- HAML_PARSER_IDENTIFIERS: ee,
742
- RBS_PARSER_IDENTIFIERS: Z,
708
+ HAML_PARSER_IDENTIFIERS: U,
709
+ RBS_PARSER_IDENTIFIERS: z,
743
710
  RUBY_PARSER_IDENTIFIERS: K,
744
- embeddedLanguage: Ye,
745
- embedder: an,
746
- options: on
747
- }, Symbol.toStringTag, { value: "Module" })), Qe = "embeddedSql", ae = [
711
+ embeddedLanguage: je,
712
+ embedder: on,
713
+ options: sn
714
+ }, Symbol.toStringTag, { value: "Module" })), qe = "embeddedSql", Be = [
748
715
  "sql",
749
716
  "bigquery",
717
+ "db2",
718
+ "db2i",
750
719
  "hive",
751
720
  "mariadb",
752
721
  "mysql",
722
+ "n1ql",
753
723
  "postgresql",
754
- "db2",
755
724
  "plsql",
756
- "n1ql",
757
725
  "redshift",
758
726
  "singlestoredb",
727
+ "snowflake",
759
728
  "spark",
760
729
  "sqlite",
761
730
  "transactsql",
762
731
  "tsql",
763
732
  "trino"
764
- ], Je = [
733
+ ], We = [
765
734
  "bigquery",
766
735
  "db2",
767
736
  "hive",
@@ -769,348 +738,339 @@ const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
769
738
  "mysql",
770
739
  "postgresql",
771
740
  "transactsql",
772
- "flinksql"
773
- ], hn = R(Qe), gn = {
774
- [hn]: {
741
+ "flinksql",
742
+ "snowflake"
743
+ ], gn = I(qe), mn = {
744
+ [gn]: {
775
745
  category: "Global",
776
746
  type: "string",
777
747
  array: !0,
778
- default: [{ value: [...ae] }],
748
+ // TODO: remove these hardcoded defaults once supported diacts are exported from prettier-plugin-sql
749
+ default: [{ value: ["sql", "mysql", "mariadb", "postgresql"] }],
779
750
  description: 'Specify embedded SQL language identifiers. This requires "prettier-plugin-sql".'
780
751
  }
781
- }, { hardline: mn, group: X, line: ke, softline: Re, indent: Me } = k, { mapDoc: _n } = re, fn = async (e, n, r, t, s, o) => {
782
- var h, g, d, f, u;
783
- try {
784
- Q("prettier-plugin-sql", t, s);
785
- const { node: $ } = r, { createPlaceholder: S, placeholderRegex: i } = j(), _ = $.quasis.map(
786
- (I, E, { length: D }) => E === D - 1 ? I.value.cooked : I.value.cooked + S(E)
787
- ).join(""), b = ((h = _.match(/^\s+/)) == null ? void 0 : h[0]) ?? "", v = ((g = _.match(/\s+$/)) == null ? void 0 : g[0]) ?? "", L = M(r, n), m = yn(
788
- t,
789
- s,
790
- o
791
- );
792
- if (typeof m > "u")
793
- throw new SyntaxError(`Unrecognized identifier: ${s}`);
794
- const y = await e(_, {
795
- parser: "sql",
796
- ...m
797
- }), p = _n(y, (I) => {
798
- if (typeof I != "string")
799
- return I;
800
- const E = [], D = I.split(i);
801
- for (let O = 0; O < D.length; O++) {
802
- let l = D[O];
803
- if (O % 2 == 0) {
804
- if (!l)
805
- continue;
806
- l = l.replaceAll(/([\\`]|\${)/g, "\\$1"), l.split(/(\n)/).forEach(
807
- (x) => x === `
808
- ` ? E.push(mn) : E.push(x)
809
- );
810
- } else {
811
- const x = Number(l);
812
- E.push(L[x]);
813
- }
752
+ }, { hardline: pn, group: A, line: Ie, softline: Se, indent: Oe } = $, { mapDoc: fn } = X, hn = async (t, n, r, e, s, o) => {
753
+ B("prettier-plugin-sql", e, s);
754
+ const d = T(
755
+ e.embeddedOverrides,
756
+ s
757
+ );
758
+ e = {
759
+ ...e,
760
+ ...d
761
+ };
762
+ const { node: i } = r, { createPlaceholder: a, placeholderRegex: l } = k(), g = i.quasis.map(
763
+ (_, v, { length: x }) => v === x - 1 ? _.value.cooked : _.value.cooked + a(v)
764
+ ).join(""), y = g.match(/^\s+/)?.[0] ?? "", h = g.match(/\s+$/)?.[0] ?? "", u = L(r, n), c = yn(e, s, o);
765
+ if (typeof c > "u")
766
+ throw new SyntaxError(`Unrecognized identifier: ${s}`);
767
+ const b = await t(g, {
768
+ ...e,
769
+ parser: "sql",
770
+ ...c,
771
+ ...d
772
+ }), m = fn(b, (_) => {
773
+ if (typeof _ != "string")
774
+ return _;
775
+ const v = [], x = _.split(l);
776
+ for (let E = 0; E < x.length; E++) {
777
+ let S = x[E];
778
+ if (E % 2 == 0) {
779
+ if (!S)
780
+ continue;
781
+ S = S.replaceAll(/([\\`]|\${)/g, "\\$1"), S.split(/(\n)/).forEach((O) => O === `
782
+ ` ? v.push(pn) : v.push(O));
783
+ } else {
784
+ const O = Number(S);
785
+ v.push(u[O]);
814
786
  }
815
- return E;
816
- });
817
- if ((d = t.preserveEmbeddedExteriorWhitespaces) != null && d.includes(s))
818
- return X([
819
- "`",
820
- b,
821
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [X(p)] : Me([X(p)]),
822
- v,
823
- "`"
824
- ]);
825
- const a = b.length ? ke : Re, c = v.length ? ke : Re;
826
- return X([
787
+ }
788
+ return v;
789
+ });
790
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
791
+ return A([
827
792
  "`",
828
- (u = t.noEmbeddedMultiLineIndentation) != null && u.includes(s) ? [a, X(p)] : Me([a, X(p)]),
829
- c,
793
+ y,
794
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [A(m)] : Oe([A(m)]),
795
+ h,
830
796
  "`"
831
797
  ]);
832
- } catch ($) {
833
- throw console.error($), $;
834
- }
798
+ const p = y.length ? Ie : Se, f = h.length ? Ie : Se;
799
+ return A([
800
+ "`",
801
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [p, A(m)] : Oe([p, A(m)]),
802
+ f,
803
+ "`"
804
+ ]);
835
805
  }, bn = {
836
- "sql-formatter": (e) => ae.includes(e),
837
- "node-sql-parser": (e) => Je.includes(e)
806
+ "sql-formatter": (t) => Be.includes(t),
807
+ "node-sql-parser": (t) => We.includes(t)
838
808
  };
839
- function je(e, n) {
809
+ function Le(t, n) {
840
810
  for (const r of n)
841
- if (bn[r](e))
811
+ if (bn[r](t))
842
812
  switch (r) {
843
813
  case "sql-formatter":
844
814
  return {
845
815
  formatter: r,
846
- language: e
816
+ language: t
847
817
  };
848
818
  case "node-sql-parser":
849
819
  return {
850
820
  formatter: r,
851
- database: e
821
+ database: t
852
822
  };
853
823
  }
854
824
  }
855
- function ne(e, n, r) {
856
- let t = je(e, r);
857
- if (t)
858
- return t;
859
- const s = n.indexOf(e);
825
+ function G(t, n, r) {
826
+ let e = Le(t, r);
827
+ if (e)
828
+ return e;
829
+ const s = n.indexOf(t);
860
830
  for (let o = s - 1; o >= 0; --o)
861
- if (t = je(
831
+ if (e = Le(
862
832
  n[o],
863
833
  r
864
- ), t)
865
- return t;
834
+ ), e)
835
+ return e;
866
836
  }
867
- function yn(e, n, r) {
868
- switch (e.formatter ?? "sql-formatter") {
837
+ function yn(t, n, r) {
838
+ switch (t.formatter ?? "sql-formatter") {
869
839
  case "sql-formatter":
870
- return ne(
840
+ return G(
871
841
  n,
872
842
  r,
873
843
  ["sql-formatter", "node-sql-parser"]
874
844
  );
875
845
  case "node-sql-parser":
876
- return ne(
846
+ return G(
877
847
  n,
878
848
  r,
879
849
  ["node-sql-parser", "sql-formatter"]
880
850
  );
881
851
  default:
882
- return ne(
852
+ return G(
883
853
  n,
884
854
  r,
885
855
  ["sql-formatter", "node-sql-parser"]
886
856
  );
887
857
  }
888
858
  }
889
- const In = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
859
+ const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
890
860
  __proto__: null,
891
- NODE_SQL_PARSER_DATABASES: Je,
892
- SQL_FORMATTER_LANGUAGES: ae,
893
- embeddedLanguage: Qe,
894
- embedder: fn,
895
- options: gn
896
- }, Symbol.toStringTag, { value: "Module" })), Ke = "embeddedTs", { line: Ne, group: H, indent: qe, softline: Be } = k, En = async (e, n, r, t, s) => {
897
- var o, h, g, d, f;
898
- try {
899
- const { node: u } = r, { createPlaceholder: $, placeholderRegex: S } = j(), i = u.quasis.map(
900
- (a, c, { length: I }) => c === I - 1 ? a.value.cooked : a.value.cooked + $(c)
901
- ).join(""), _ = ((o = i.match(/^\s+/)) == null ? void 0 : o[0]) ?? "", b = ((h = i.match(/\s+$/)) == null ? void 0 : h[0]) ?? "", v = M(r, n), L = await e(i, {
902
- parser: t.embeddedTsParser ?? "typescript",
903
- // set filepath to undefined to enable jsx auto detection:
904
- // https://github.com/prettier/prettier/blob/427a84d24203e2d54160cde153a1e6a6390fe65a/src/language-js/parse/typescript.js#L49-L53
905
- filepath: void 0
906
- }), m = q(
907
- L,
908
- S,
909
- v
910
- );
911
- if ((g = t.preserveEmbeddedExteriorWhitespaces) != null && g.includes(s))
912
- return H([
913
- "`",
914
- _,
915
- (d = t.noEmbeddedMultiLineIndentation) != null && d.includes(s) ? [H(m)] : qe([H(m)]),
916
- b,
917
- "`"
918
- ]);
919
- const y = _.length ? Ne : Be, p = b.length ? Ne : Be;
920
- return H([
861
+ NODE_SQL_PARSER_DATABASES: We,
862
+ SQL_FORMATTER_LANGUAGES: Be,
863
+ embeddedLanguage: qe,
864
+ embedder: hn,
865
+ options: mn
866
+ }, Symbol.toStringTag, { value: "Module" })), Ke = "embeddedTs", { line: ke, group: j, indent: Te, softline: De } = $, _n = async (t, n, r, e, s) => {
867
+ e = {
868
+ ...e,
869
+ ...T(e.embeddedOverrides, s)
870
+ };
871
+ const { node: o } = r, { createPlaceholder: d, placeholderRegex: i } = k(), a = o.quasis.map(
872
+ (m, p, { length: f }) => p === f - 1 ? m.value.cooked : m.value.cooked + d(p)
873
+ ).join(""), l = a.match(/^\s+/)?.[0] ?? "", g = a.match(/\s+$/)?.[0] ?? "", y = L(r, n), h = await t(a, {
874
+ ...e,
875
+ parser: e.embeddedTsParser ?? "typescript",
876
+ // set filepath to undefined to enable jsx auto detection:
877
+ // https://github.com/prettier/prettier/blob/427a84d24203e2d54160cde153a1e6a6390fe65a/src/language-js/parse/typescript.js#L49-L53
878
+ filepath: void 0
879
+ }), u = D(h, i, y);
880
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
881
+ return j([
921
882
  "`",
922
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [y, H(m)] : qe([y, H(m)]),
923
- p,
883
+ l,
884
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [j(u)] : Te([j(u)]),
885
+ g,
924
886
  "`"
925
887
  ]);
926
- } catch (u) {
927
- throw console.error(u), u;
928
- }
929
- }, xn = ["ts", "tsx", "cts", "mts", "typescript"], $n = "embeddedTsParser", vn = R(Ke), wn = {
930
- [vn]: {
888
+ const c = l.length ? ke : De, b = g.length ? ke : De;
889
+ return j([
890
+ "`",
891
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [c, j(u)] : Te([c, j(u)]),
892
+ b,
893
+ "`"
894
+ ]);
895
+ }, En = ["ts", "tsx", "cts", "mts", "typescript"], xn = "embeddedTsParser", $n = I(Ke), In = {
896
+ [$n]: {
931
897
  category: "Global",
932
898
  type: "string",
933
899
  array: !0,
934
- default: [{ value: [...xn] }],
900
+ default: [{ value: [...En] }],
935
901
  description: "Specify embedded TS language parsers."
936
902
  },
937
- [$n]: {
903
+ [xn]: {
938
904
  category: "Global",
939
905
  type: "string",
940
906
  array: !1,
941
907
  default: "typescript",
942
908
  description: "Specify the embedded TS language parser."
943
909
  }
944
- }, Dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
910
+ }, Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
945
911
  __proto__: null,
946
912
  embeddedLanguage: Ke,
947
- embedder: En,
948
- options: wn
949
- }, Symbol.toStringTag, { value: "Module" })), de = "embeddedXml";
950
- function Ln(e) {
913
+ embedder: _n,
914
+ options: In
915
+ }, Symbol.toStringTag, { value: "Module" })), Q = "embeddedXml";
916
+ function On(t) {
951
917
  const n = {
952
918
  loc: {
953
919
  start: {
954
- line: e.line,
955
- column: e.column
920
+ line: t.line,
921
+ column: t.column
956
922
  },
957
923
  end: {
958
- line: e.line,
959
- column: e.column + e.length
924
+ line: t.line,
925
+ column: t.column + t.length
960
926
  }
961
927
  }
962
928
  }, r = new SyntaxError(
963
- `${e.message} (${n.loc.start.line}:${n.loc.start.column})`,
929
+ `${t.message} (${n.loc.start.line}:${n.loc.start.column})`,
964
930
  {
965
- cause: e
931
+ cause: t
966
932
  }
967
933
  );
968
934
  return Object.assign(r, n), r;
969
935
  }
970
- function Fe(e) {
936
+ function Re(t) {
971
937
  const n = {
972
938
  loc: {
973
939
  start: {
974
- line: e.token.startLine ?? NaN,
975
- column: e.token.startColumn ?? NaN
940
+ line: t.token.startLine ?? NaN,
941
+ column: t.token.startColumn ?? NaN
976
942
  },
977
943
  end: {
978
- line: e.token.endLine ?? NaN,
979
- column: e.token.endColumn ?? NaN
944
+ line: t.token.endLine ?? NaN,
945
+ column: t.token.endColumn ?? NaN
980
946
  }
981
947
  }
982
948
  }, r = new SyntaxError(
983
- `${e.message} (${n.loc.start.line}:${n.loc.start.column})`,
949
+ `${t.message} (${n.loc.start.line}:${n.loc.start.column})`,
984
950
  {
985
- cause: e
951
+ cause: t
986
952
  }
987
953
  );
988
954
  return Object.assign(r, n), r;
989
955
  }
990
- const Sn = {
991
- parse(e, n) {
992
- var o, h;
993
- const { lexErrors: r, parseErrors: t, cst: s } = lt(e);
994
- if (r.length > 0) {
995
- const g = r[0];
996
- throw Ln(g);
956
+ const Ln = {
957
+ async parse(t, n) {
958
+ const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: s, cst: o } = r(t);
959
+ if (e.length > 0) {
960
+ const d = e[0];
961
+ throw On(d);
997
962
  }
998
- if (t.length > 0) {
999
- let g = !1;
1000
- for (const d of t) {
963
+ if (s.length > 0) {
964
+ let d = !1;
965
+ for (const i of s) {
1001
966
  if (!["MismatchedTokenException", "NotAllInputParsedException"].includes(
1002
- d.name
967
+ i.name
1003
968
  ))
1004
- throw Fe(d);
1005
- if (d.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
1006
- g = !0;
969
+ throw Re(i);
970
+ if (i.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
971
+ d = !0;
1007
972
  continue;
1008
973
  }
1009
- if (/Expecting token of type --> EOF <-- but found --> '.+' <--/.test(
1010
- d.message
1011
- ) || /Redundant input, expecting EOF but found: /.test(d.message)) {
1012
- (o = n.__embeddedXmlFragmentRecoverIndex) == null || o.splice(
974
+ if (/Expecting token of type --> EOF <-- but found --> '[\s\S]+' <--/.test(
975
+ i.message
976
+ ) || /Redundant input, expecting EOF but found: /.test(i.message)) {
977
+ n.__embeddedXmlFragmentRecoverIndex?.splice(
1013
978
  0,
1014
979
  n.__embeddedXmlFragmentRecoverIndex.length,
1015
- d.token.startOffset
980
+ i.token.startOffset
1016
981
  );
1017
982
  break;
1018
983
  }
1019
- if (/Expecting token of type --> OPEN <-- but found --> '.+' <--/.test(
1020
- d.message
984
+ if (/Expecting token of type --> OPEN <-- but found --> '[\s\S]+' <--/.test(
985
+ i.message
1021
986
  )) {
1022
- if (d.token.endOffset === void 0 || Number.isNaN(d.token.endOffset))
987
+ if (i.token.endOffset === void 0 || Number.isNaN(i.token.endOffset))
1023
988
  break;
1024
- (h = n.__embeddedXmlFragmentRecoverIndex) == null || h.splice(
989
+ n.__embeddedXmlFragmentRecoverIndex?.splice(
1025
990
  0,
1026
991
  n.__embeddedXmlFragmentRecoverIndex.length,
1027
- d.token.startOffset,
1028
- d.token.endOffset
1029
- ), g = !0;
992
+ i.token.startOffset,
993
+ i.token.endOffset
994
+ ), d = !0;
1030
995
  break;
1031
996
  }
1032
- throw Fe(d);
997
+ throw Re(i);
1033
998
  }
1034
- g && Ze(s);
999
+ d && ze(o);
1035
1000
  }
1036
- return s;
1001
+ return o;
1037
1002
  },
1038
1003
  astFormat: "xml",
1039
- locStart(e) {
1040
- return e.location.startOffset;
1004
+ locStart(t) {
1005
+ return t.location.startOffset;
1041
1006
  },
1042
- locEnd(e) {
1043
- return e.location.endOffset ?? NaN;
1007
+ locEnd(t) {
1008
+ return t.location.endOffset ?? NaN;
1044
1009
  }
1045
1010
  };
1046
- function Ze(e) {
1047
- const n = e.children;
1011
+ function ze(t) {
1012
+ const n = t.children;
1048
1013
  for (const r in n) {
1049
- const t = n[r] ?? [];
1050
- for (let s = t.length - 1; s >= 0; --s) {
1051
- const o = t[s];
1052
- if (Tn(o)) {
1014
+ const e = n[r] ?? [];
1015
+ for (let s = e.length - 1; s >= 0; --s) {
1016
+ const o = e[s];
1017
+ if (kn(o)) {
1053
1018
  if (Object.keys(o.children).length === 0) {
1054
- t.splice(s, 1), t.length === 0 && delete n[r];
1019
+ e.splice(s, 1), e.length === 0 && delete n[r];
1055
1020
  continue;
1056
1021
  }
1057
- Ze(o);
1022
+ ze(o);
1058
1023
  }
1059
1024
  }
1060
1025
  }
1061
1026
  }
1062
- function Tn(e) {
1063
- return "name" in e && "children" in e && "location" in e;
1027
+ function kn(t) {
1028
+ return "name" in t && "children" in t && "location" in t;
1064
1029
  }
1065
- const { line: Ae, group: V, indent: Ce, softline: se } = k, On = async (e, n, r, t, s) => {
1066
- var o, h, g, d, f, u;
1067
- try {
1068
- Q("@prettier/plugin-xml", t, s);
1069
- const { node: $ } = r, { createPlaceholder: S, placeholderRegex: i } = j(), _ = $.quasis.map(
1070
- (E, D, { length: O }) => D === O - 1 ? E.value.cooked : E.value.cooked + S(D)
1071
- ).join(""), b = ((o = _.match(/^\s+/)) == null ? void 0 : o[0]) ?? "", v = ((h = _.match(/\s+$/)) == null ? void 0 : h[0]) ?? "", L = _.slice(
1072
- b.length,
1073
- -v.length || void 0
1074
- ), m = M(r, n), y = [];
1075
- let p = 0;
1076
- for (; p !== void 0; ) {
1077
- const E = L.slice(p);
1078
- if (E.length === 0)
1079
- break;
1080
- p > 0 && t.xmlWhitespaceSensitivity !== "strict" && y.push(se), (g = t.__embeddedXmlFragmentRecoverIndex) == null || g.splice(
1081
- 0,
1082
- t.__embeddedXmlFragmentRecoverIndex.length
1083
- );
1084
- let D = await e(E, {
1085
- parser: de
1086
- });
1087
- const [O, l] = t.__embeddedXmlFragmentRecoverIndex ?? [];
1088
- O === void 0 ? p = void 0 : l === void 0 ? p += O : (D = E.slice(O, l + 1), p += l + 1), y.push(D);
1089
- }
1090
- const a = q(
1091
- y,
1092
- i,
1093
- m
1030
+ const { line: Pe, group: q, indent: Me, softline: H } = $, Tn = async (t, n, r, e, s) => {
1031
+ B("@prettier/plugin-xml", e, s), e = {
1032
+ ...e,
1033
+ ...T(e.embeddedOverrides, s)
1034
+ };
1035
+ const { node: o } = r, { createPlaceholder: d, placeholderRegex: i } = k(), a = o.quasis.map(
1036
+ (f, _, { length: v }) => _ === v - 1 ? f.value.cooked : f.value.cooked + d(_)
1037
+ ).join(""), l = a.match(/^\s+/)?.[0] ?? "", g = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
1038
+ l.length,
1039
+ -g.length || void 0
1040
+ ), h = L(r, n), u = [];
1041
+ let c = 0;
1042
+ for (; c !== void 0; ) {
1043
+ const f = y.slice(c);
1044
+ if (f.length === 0)
1045
+ break;
1046
+ c > 0 && e.xmlWhitespaceSensitivity !== "strict" && u.push(H), e.__embeddedXmlFragmentRecoverIndex?.splice(
1047
+ 0,
1048
+ e.__embeddedXmlFragmentRecoverIndex.length
1094
1049
  );
1095
- if (t.xmlWhitespaceSensitivity === "strict" || (d = t.preserveEmbeddedExteriorWhitespaces) != null && d.includes(s))
1096
- return V([
1097
- "`",
1098
- b,
1099
- (f = t.noEmbeddedMultiLineIndentation) != null && f.includes(s) ? [V(a)] : Ce([V(a)]),
1100
- v,
1101
- "`"
1102
- ]);
1103
- const c = b.length ? Ae : se, I = v.length ? Ae : se;
1104
- return V([
1050
+ let _ = await t(f, {
1051
+ ...e,
1052
+ parser: Q
1053
+ });
1054
+ const [v, x] = e.__embeddedXmlFragmentRecoverIndex ?? [];
1055
+ v === void 0 ? c = void 0 : x === void 0 ? c += v : (_ = f.slice(v, x + 1), c += x + 1), u.push(_);
1056
+ }
1057
+ const b = D(u, i, h);
1058
+ if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
1059
+ return q([
1105
1060
  "`",
1106
- (u = t.noEmbeddedMultiLineIndentation) != null && u.includes(s) ? [c, V(a)] : Ce([c, V(a)]),
1107
- I,
1061
+ l,
1062
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [q(b)] : Me([q(b)]),
1063
+ g,
1108
1064
  "`"
1109
1065
  ]);
1110
- } catch ($) {
1111
- throw console.error($), $;
1112
- }
1113
- }, Un = [
1066
+ const m = l.length ? Pe : H, p = g.length ? Pe : H;
1067
+ return q([
1068
+ "`",
1069
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, q(b)] : Me([m, q(b)]),
1070
+ p,
1071
+ "`"
1072
+ ]);
1073
+ }, Dn = [
1114
1074
  "xml",
1115
1075
  "xsd",
1116
1076
  "ascx",
@@ -1167,12 +1127,12 @@ const { line: Ae, group: V, indent: Ce, softline: se } = k, On = async (e, n, r,
1167
1127
  "xpdl",
1168
1128
  "xul",
1169
1129
  "xoml"
1170
- ], Pn = R(de), kn = {
1171
- [Pn]: {
1130
+ ], Rn = I(Q), Pn = {
1131
+ [Rn]: {
1172
1132
  category: "Global",
1173
1133
  type: "string",
1174
1134
  array: !0,
1175
- default: [{ value: [...Un] }],
1135
+ default: [{ value: [...Dn] }],
1176
1136
  description: 'Specify embedded XML language identifiers. This requires "@prettier/plugin-xml".'
1177
1137
  },
1178
1138
  /** @internal */
@@ -1183,77 +1143,87 @@ const { line: Ae, group: V, indent: Ce, softline: se } = k, On = async (e, n, r,
1183
1143
  default: [{ value: [] }],
1184
1144
  description: "This option is read only and used as a workaround to support xml fragments"
1185
1145
  }
1186
- }, Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1146
+ }, Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1187
1147
  __proto__: null,
1188
- embeddedLanguage: de,
1189
- embedder: On,
1190
- options: kn,
1191
- parser: Sn
1192
- }, Symbol.toStringTag, { value: "Module" })), et = [], tt = {}, nt = {}, st = {}, Mn = /* @__PURE__ */ Object.assign({
1193
- "./css/index.ts": wt,
1194
- "./es/index.ts": Ut,
1195
- "./glsl/index.ts": jt,
1196
- "./html/index.ts": Ct,
1197
- "./markdown/index.ts": Ht,
1198
- "./noop/index.ts": Qt,
1199
- "./php/index.ts": tn,
1200
- "./ruby/index.ts": pn,
1201
- "./sql/index.ts": In,
1202
- "./ts/index.ts": Dn,
1203
- "./xml/index.ts": Rn
1148
+ embeddedLanguage: Q,
1149
+ embedder: Tn,
1150
+ options: Pn,
1151
+ parser: Ln
1152
+ }, Symbol.toStringTag, { value: "Module" })), Ue = [], Ge = {}, He = {}, Xe = {}, Cn = /* @__PURE__ */ Object.assign({
1153
+ "./css/index.ts": It,
1154
+ "./es/index.ts": Dt,
1155
+ "./glsl/index.ts": Nt,
1156
+ "./html/index.ts": Bt,
1157
+ "./markdown/index.ts": Gt,
1158
+ "./noop/index.ts": Yt,
1159
+ "./php/index.ts": en,
1160
+ "./ruby/index.ts": un,
1161
+ "./sql/index.ts": vn,
1162
+ "./ts/index.ts": Sn,
1163
+ "./xml/index.ts": Mn
1204
1164
  });
1205
- Object.values(Mn).forEach(
1206
- ({ embeddedLanguage: e, parser: n, embedder: r, options: t }) => {
1207
- yt(et, e, oe), n && (tt[e] = n), r && (nt[e] = r), Object.assign(st, t);
1165
+ Object.values(Cn).forEach(
1166
+ ({ embeddedLanguage: t, parser: n, embedder: r, options: e }) => {
1167
+ bt(Ue, t, J), n && (Ge[t] = n), r && (He[t] = r), Object.assign(Xe, e);
1208
1168
  }
1209
1169
  );
1210
- const Kn = {
1170
+ const Qn = {
1211
1171
  // parsers from internal
1212
- ...rt.parsers,
1213
- ...it.parsers,
1214
- ...ot.parsers,
1215
- ...at.parsers,
1216
- ...dt.parsers,
1172
+ ...Qe.parsers,
1173
+ ...Ze.parsers,
1174
+ ...et.parsers,
1175
+ ...tt.parsers,
1176
+ ...nt.parsers,
1217
1177
  // parsers from this plugin
1218
- ...tt
1219
- }, { estree: J } = ct, jn = function(e, n) {
1220
- var t;
1221
- const { node: r } = e;
1222
- if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: s } }) => s === null))
1178
+ ...Ge
1179
+ }, { estree: Ye } = ot, Nn = function(t, n) {
1180
+ const { node: r } = t;
1181
+ if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: e } }) => e === null))
1223
1182
  return null;
1224
- for (const s of et) {
1225
- const o = n[R(s)];
1226
- if (!o)
1183
+ for (const e of Ue) {
1184
+ const s = n[I(e)];
1185
+ if (!s)
1227
1186
  continue;
1228
- const h = Nn(
1229
- e,
1230
- o,
1187
+ const o = wn(
1188
+ t,
1189
+ s,
1231
1190
  n.noEmbeddedIdentificationByComment ?? []
1232
- ) ?? qn(
1233
- e,
1234
- o,
1191
+ ) ?? Fn(
1192
+ t,
1193
+ s,
1235
1194
  n.noEmbeddedIdentificationByTag ?? []
1236
1195
  );
1237
- if (h === void 0)
1196
+ if (o === void 0)
1238
1197
  continue;
1239
- const g = nt[s];
1240
- if (!g)
1198
+ const d = He[e];
1199
+ if (!d)
1241
1200
  return null;
1242
- const d = e.node;
1243
- return d.quasis.length === 1 && d.quasis[0].value.raw.trim() === "" ? "``" : async (...f) => {
1244
- const u = await g(...f, h, o);
1245
- return k.label(
1246
- { embed: !0, ...u.label },
1247
- u
1248
- );
1201
+ const i = t.node;
1202
+ return i.quasis.length === 1 && i.quasis[0].value.raw.trim() === "" ? "``" : async (a, l, g, y) => {
1203
+ try {
1204
+ const h = await d(
1205
+ a,
1206
+ l,
1207
+ g,
1208
+ y,
1209
+ o,
1210
+ s
1211
+ );
1212
+ return $.label(
1213
+ { embed: !0, ...h.label },
1214
+ h
1215
+ );
1216
+ } catch (h) {
1217
+ throw console.error(h), h;
1218
+ }
1249
1219
  };
1250
1220
  }
1251
- return ((t = J.embed) == null ? void 0 : t.call(J, e, n)) ?? null;
1221
+ return Ye.embed?.(t, n) ?? null;
1252
1222
  };
1253
- function Nn({ node: e, parent: n }, r, t) {
1254
- if (r.length === 0 || e.type !== "TemplateLiteral")
1223
+ function wn({ node: t, parent: n }, r, e) {
1224
+ if (r.length === 0 || t.type !== "TemplateLiteral")
1255
1225
  return;
1256
- const s = e.comments ?? (n == null ? void 0 : n.comments);
1226
+ const s = t.comments ?? n?.comments;
1257
1227
  if (!s)
1258
1228
  return;
1259
1229
  const o = s[s.length - 1];
@@ -1265,61 +1235,68 @@ function Nn({ node: e, parent: n }, r, t) {
1265
1235
  "CommentBlock"
1266
1236
  // babel, babel-flow, babel-ts
1267
1237
  ].includes(o.type) || !o.leading)) {
1268
- for (const h of r)
1269
- if (` ${h} ` === o.value && !t.includes(h))
1270
- return h;
1238
+ for (const d of r)
1239
+ if (` ${d} ` === o.value && !e.includes(d))
1240
+ return d;
1271
1241
  }
1272
1242
  }
1273
- function qn({ node: e, parent: n }, r, t) {
1274
- if (r.length !== 0 && !(e.type !== "TemplateLiteral" || (n == null ? void 0 : n.type) !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) {
1243
+ function Fn({ node: t, parent: n }, r, e) {
1244
+ if (r.length !== 0 && !(t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) {
1275
1245
  for (const s of r)
1276
- if (n.tag.name === s && !t.includes(s))
1246
+ if (n.tag.name === s && !e.includes(s))
1277
1247
  return s;
1278
1248
  }
1279
1249
  }
1280
1250
  const Zn = {
1281
1251
  estree: {
1282
- ...J,
1283
- embed: jn
1252
+ ...Ye,
1253
+ embed: Nn
1284
1254
  }
1285
- }, Bn = "noEmbeddedIdentificationByComment", Fn = "noEmbeddedIdentificationByTag", An = "preserveEmbeddedExteriorWhitespaces", Cn = "noEmbeddedMultiLineIndentation", es = {
1286
- ...st,
1287
- [Bn]: {
1255
+ }, An = "noEmbeddedIdentificationByComment", jn = "noEmbeddedIdentificationByTag", qn = "preserveEmbeddedExteriorWhitespaces", Bn = "noEmbeddedMultiLineIndentation", Wn = "embeddedOverrides", er = {
1256
+ ...Xe,
1257
+ [An]: {
1288
1258
  category: "Global",
1289
1259
  type: "string",
1290
1260
  array: !0,
1291
1261
  default: [{ value: [] }],
1292
1262
  description: 'This option turns off "/* identifier */ `...`" comment-based language identification for the specified identifiers.'
1293
1263
  },
1294
- [Fn]: {
1264
+ [jn]: {
1295
1265
  category: "Global",
1296
1266
  type: "string",
1297
1267
  array: !0,
1298
1268
  default: [{ value: [] }],
1299
1269
  description: 'This option turns off "identifier`...`" tag-based language identification for the specified identifiers.'
1300
1270
  },
1301
- [An]: {
1271
+ [qn]: {
1302
1272
  category: "Config",
1303
1273
  type: "string",
1304
1274
  array: !0,
1305
1275
  default: [{ value: [] }],
1306
1276
  description: "This option preserves leading and trailing whitespaces in the formatting results for the specified identifiers."
1307
1277
  },
1308
- [Cn]: {
1278
+ [Bn]: {
1309
1279
  category: "Global",
1310
1280
  type: "string",
1311
1281
  array: !0,
1312
1282
  default: [{ value: [] }],
1313
1283
  description: "This option turns off auto indentation in the formatting results for the specified identifiers when they are formatted to span multi lines."
1284
+ },
1285
+ [Wn]: {
1286
+ category: "Global",
1287
+ type: "string",
1288
+ array: !1,
1289
+ default: void 0,
1290
+ description: "This option accepts option overrides for the specified identifiers. It should either be a stringified JSON or an absolute filepath to the option overrides file."
1314
1291
  }
1315
1292
  };
1316
1293
  export {
1317
- nt as embeddedEmbedders,
1318
- et as embeddedLanguages,
1319
- st as embeddedOptions,
1320
- tt as embeddedParsers,
1321
- R as makeIdentifiersName,
1322
- es as options,
1323
- Kn as parsers,
1294
+ He as embeddedEmbedders,
1295
+ Ue as embeddedLanguages,
1296
+ Xe as embeddedOptions,
1297
+ Ge as embeddedParsers,
1298
+ I as makeIdentifiersOptionName,
1299
+ er as options,
1300
+ Qn as parsers,
1324
1301
  Zn as printers
1325
1302
  };