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