@authhero/widget 0.32.28 → 0.32.29

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.
Files changed (32) hide show
  1. package/dist/authhero-widget/authhero-widget.esm.js +1 -1
  2. package/dist/authhero-widget/index.esm.js +1 -1
  3. package/dist/authhero-widget/p-FUW5zvoZ.js +2 -0
  4. package/dist/authhero-widget/{p-e91b632f.entry.js → p-aa120307.entry.js} +1 -1
  5. package/dist/authhero-widget/{p-f63fd386.entry.js → p-f0f9eca3.entry.js} +1 -1
  6. package/dist/cjs/authhero-node.cjs.entry.js +2 -2
  7. package/dist/cjs/authhero-widget.cjs.entry.js +1 -1
  8. package/dist/cjs/authhero-widget.cjs.js +2 -2
  9. package/dist/cjs/{index-CUBT14z-.js → index-4OcMRinY.js} +378 -1944
  10. package/dist/cjs/index.cjs.js +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/collection/collection-manifest.json +2 -1
  13. package/dist/collection/components/authhero-node/authhero-node.js +4 -2
  14. package/dist/collection/components/authhero-widget/authhero-widget.js +8 -4
  15. package/dist/components/authhero-node.js +1 -1
  16. package/dist/components/authhero-widget.js +1 -1
  17. package/dist/components/index.js +1 -1
  18. package/dist/components/{p-DqexL9yF.js → p-Bwng5l4l.js} +1 -1
  19. package/dist/components/p-cKZ5hFj1.js +1 -0
  20. package/dist/esm/authhero-node.entry.js +2 -2
  21. package/dist/esm/authhero-widget.entry.js +1 -1
  22. package/dist/esm/authhero-widget.js +3 -3
  23. package/dist/esm/{index-BFP_5sHV.js → index-FUW5zvoZ.js} +378 -1944
  24. package/dist/esm/index.js +1 -1
  25. package/dist/esm/loader.js +2 -2
  26. package/dist/types/components.d.ts +27 -6
  27. package/dist/types/stencil-public-runtime.d.ts +52 -2
  28. package/hydrate/index.js +11730 -11056
  29. package/hydrate/index.mjs +11730 -11056
  30. package/package.json +5 -5
  31. package/dist/authhero-widget/p-BFP_5sHV.js +0 -2
  32. package/dist/components/p-DpfoRsj0.js +0 -1
@@ -2,254 +2,9 @@ const NAMESPACE = 'authhero-widget';
2
2
  const BUILD = /* authhero-widget */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.40.1 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.43.4 | MIT Licensed | https://stenciljs.com
6
6
  */
7
- var __create = Object.create;
8
- var __defProp = Object.defineProperty;
9
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
- var __getOwnPropNames = Object.getOwnPropertyNames;
11
- var __getProtoOf = Object.getPrototypeOf;
12
- var __hasOwnProp = Object.prototype.hasOwnProperty;
13
- var __typeError = (msg) => {
14
- throw TypeError(msg);
15
- };
16
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
- var __commonJS = (cb, mod) => function __require() {
18
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, { get: all[name], enumerable: true });
23
- };
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (let key of __getOwnPropNames(from))
27
- if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
- }
30
- return to;
31
- };
32
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
33
- // If the importer is in node compatibility mode or this is not an ESM
34
- // file that has been converted to a CommonJS file using a Babel-
35
- // compatible transform (i.e. "__esModule" has not been set), then set
36
- // "default" to the CommonJS "module.exports" for node compatibility.
37
- __defProp(target, "default", { value: mod, enumerable: true }) ,
38
- mod
39
- ));
40
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
41
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
42
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
43
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
44
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
45
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
46
7
 
47
- // node_modules/balanced-match/index.js
48
- var require_balanced_match = __commonJS({
49
- "node_modules/balanced-match/index.js"(exports, module) {
50
- module.exports = balanced;
51
- function balanced(a, b, str) {
52
- if (a instanceof RegExp) a = maybeMatch(a, str);
53
- if (b instanceof RegExp) b = maybeMatch(b, str);
54
- var r = range(a, b, str);
55
- return r && {
56
- start: r[0],
57
- end: r[1],
58
- pre: str.slice(0, r[0]),
59
- body: str.slice(r[0] + a.length, r[1]),
60
- post: str.slice(r[1] + b.length)
61
- };
62
- }
63
- function maybeMatch(reg, str) {
64
- var m = str.match(reg);
65
- return m ? m[0] : null;
66
- }
67
- balanced.range = range;
68
- function range(a, b, str) {
69
- var begs, beg, left, right, result;
70
- var ai = str.indexOf(a);
71
- var bi = str.indexOf(b, ai + 1);
72
- var i2 = ai;
73
- if (ai >= 0 && bi > 0) {
74
- if (a === b) {
75
- return [ai, bi];
76
- }
77
- begs = [];
78
- left = str.length;
79
- while (i2 >= 0 && !result) {
80
- if (i2 == ai) {
81
- begs.push(i2);
82
- ai = str.indexOf(a, i2 + 1);
83
- } else if (begs.length == 1) {
84
- result = [begs.pop(), bi];
85
- } else {
86
- beg = begs.pop();
87
- if (beg < left) {
88
- left = beg;
89
- right = bi;
90
- }
91
- bi = str.indexOf(b, i2 + 1);
92
- }
93
- i2 = ai < bi && ai >= 0 ? ai : bi;
94
- }
95
- if (begs.length) {
96
- result = [left, right];
97
- }
98
- }
99
- return result;
100
- }
101
- }
102
- });
103
-
104
- // node_modules/brace-expansion/index.js
105
- var require_brace_expansion = __commonJS({
106
- "node_modules/brace-expansion/index.js"(exports, module) {
107
- var balanced = require_balanced_match();
108
- module.exports = expandTop;
109
- var escSlash = "\0SLASH" + Math.random() + "\0";
110
- var escOpen = "\0OPEN" + Math.random() + "\0";
111
- var escClose = "\0CLOSE" + Math.random() + "\0";
112
- var escComma = "\0COMMA" + Math.random() + "\0";
113
- var escPeriod = "\0PERIOD" + Math.random() + "\0";
114
- function numeric(str) {
115
- return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
116
- }
117
- function escapeBraces(str) {
118
- return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
119
- }
120
- function unescapeBraces(str) {
121
- return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
122
- }
123
- function parseCommaParts(str) {
124
- if (!str)
125
- return [""];
126
- var parts = [];
127
- var m = balanced("{", "}", str);
128
- if (!m)
129
- return str.split(",");
130
- var pre = m.pre;
131
- var body = m.body;
132
- var post = m.post;
133
- var p = pre.split(",");
134
- p[p.length - 1] += "{" + body + "}";
135
- var postParts = parseCommaParts(post);
136
- if (post.length) {
137
- p[p.length - 1] += postParts.shift();
138
- p.push.apply(p, postParts);
139
- }
140
- parts.push.apply(parts, p);
141
- return parts;
142
- }
143
- function expandTop(str) {
144
- if (!str)
145
- return [];
146
- if (str.substr(0, 2) === "{}") {
147
- str = "\\{\\}" + str.substr(2);
148
- }
149
- return expand2(escapeBraces(str), true).map(unescapeBraces);
150
- }
151
- function embrace(str) {
152
- return "{" + str + "}";
153
- }
154
- function isPadded(el) {
155
- return /^-?0\d/.test(el);
156
- }
157
- function lte(i2, y) {
158
- return i2 <= y;
159
- }
160
- function gte(i2, y) {
161
- return i2 >= y;
162
- }
163
- function expand2(str, isTop) {
164
- var expansions = [];
165
- var m = balanced("{", "}", str);
166
- if (!m) return [str];
167
- var pre = m.pre;
168
- var post = m.post.length ? expand2(m.post, false) : [""];
169
- if (/\$$/.test(m.pre)) {
170
- for (var k = 0; k < post.length; k++) {
171
- var expansion = pre + "{" + m.body + "}" + post[k];
172
- expansions.push(expansion);
173
- }
174
- } else {
175
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
176
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
177
- var isSequence = isNumericSequence || isAlphaSequence;
178
- var isOptions = m.body.indexOf(",") >= 0;
179
- if (!isSequence && !isOptions) {
180
- if (m.post.match(/,(?!,).*\}/)) {
181
- str = m.pre + "{" + m.body + escClose + m.post;
182
- return expand2(str);
183
- }
184
- return [str];
185
- }
186
- var n;
187
- if (isSequence) {
188
- n = m.body.split(/\.\./);
189
- } else {
190
- n = parseCommaParts(m.body);
191
- if (n.length === 1) {
192
- n = expand2(n[0], false).map(embrace);
193
- if (n.length === 1) {
194
- return post.map(function(p) {
195
- return m.pre + n[0] + p;
196
- });
197
- }
198
- }
199
- }
200
- var N;
201
- if (isSequence) {
202
- var x = numeric(n[0]);
203
- var y = numeric(n[1]);
204
- var width = Math.max(n[0].length, n[1].length);
205
- var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
206
- var test = lte;
207
- var reverse = y < x;
208
- if (reverse) {
209
- incr *= -1;
210
- test = gte;
211
- }
212
- var pad = n.some(isPadded);
213
- N = [];
214
- for (var i2 = x; test(i2, y); i2 += incr) {
215
- var c;
216
- if (isAlphaSequence) {
217
- c = String.fromCharCode(i2);
218
- if (c === "\\")
219
- c = "";
220
- } else {
221
- c = String(i2);
222
- if (pad) {
223
- var need = width - c.length;
224
- if (need > 0) {
225
- var z = new Array(need + 1).join("0");
226
- if (i2 < 0)
227
- c = "-" + z + c.slice(1);
228
- else
229
- c = z + c;
230
- }
231
- }
232
- }
233
- N.push(c);
234
- }
235
- } else {
236
- N = [];
237
- for (var j = 0; j < n.length; j++) {
238
- N.push.apply(N, expand2(n[j], false));
239
- }
240
- }
241
- for (var j = 0; j < N.length; j++) {
242
- for (var k = 0; k < post.length; k++) {
243
- var expansion = pre + N[j] + post[k];
244
- if (!isTop || isSequence || expansion)
245
- expansions.push(expansion);
246
- }
247
- }
248
- }
249
- return expansions;
250
- }
251
- }
252
- });
253
8
 
254
9
  // src/utils/constants.ts
255
10
  var SVG_NS = "http://www.w3.org/2000/svg";
@@ -278,6 +33,19 @@ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
278
33
  var TYPE_CONSTANT = "type";
279
34
  var VALUE_CONSTANT = "value";
280
35
  var SERIALIZED_PREFIX = "serialized:";
36
+
37
+ // src/utils/get-prop-descriptor.ts
38
+ function getPropertyDescriptor(obj, memberName, getOnly) {
39
+ const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
40
+ while (obj && obj !== stopAt) {
41
+ const desc = Object.getOwnPropertyDescriptor(obj, memberName);
42
+ if (desc && (!getOnly || desc.get)) return desc;
43
+ obj = Object.getPrototypeOf(obj);
44
+ }
45
+ return void 0;
46
+ }
47
+
48
+ // src/utils/es2022-rewire-class-members.ts
281
49
  var reWireGetterSetter = (instance, hostRef) => {
282
50
  var _a;
283
51
  const cmpMeta = hostRef.$cmpMeta$;
@@ -285,7 +53,7 @@ var reWireGetterSetter = (instance, hostRef) => {
285
53
  members.map(([memberName, [memberFlags]]) => {
286
54
  if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
287
55
  const ogValue = instance[memberName];
288
- const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
56
+ const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName, true) || Object.getOwnPropertyDescriptor(instance, memberName);
289
57
  if (ogDescriptor) {
290
58
  Object.defineProperty(instance, memberName, {
291
59
  get() {
@@ -298,18 +66,14 @@ var reWireGetterSetter = (instance, hostRef) => {
298
66
  enumerable: true
299
67
  });
300
68
  }
301
- instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
69
+ if (hostRef.$instanceValues$.has(memberName)) {
70
+ instance[memberName] = hostRef.$instanceValues$.get(memberName);
71
+ } else if (ogValue !== void 0) {
72
+ instance[memberName] = ogValue;
73
+ }
302
74
  }
303
75
  });
304
76
  };
305
- function getPropertyDescriptor(obj, memberName) {
306
- while (obj) {
307
- const desc = Object.getOwnPropertyDescriptor(obj, memberName);
308
- if (desc == null ? void 0 : desc.get) return desc;
309
- obj = Object.getPrototypeOf(obj);
310
- }
311
- return void 0;
312
- }
313
77
 
314
78
  // src/client/client-host-ref.ts
315
79
  var getHostRef = (ref) => {
@@ -383,1596 +147,76 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
383
147
 
384
148
  // src/client/client-style.ts
385
149
  var styles = /* @__PURE__ */ new Map();
386
-
387
- // src/runtime/runtime-constants.ts
388
- var CONTENT_REF_ID = "r";
389
- var ORG_LOCATION_ID = "o";
390
- var SLOT_NODE_ID = "s";
391
- var TEXT_NODE_ID = "t";
392
- var COMMENT_NODE_ID = "c";
393
- var HYDRATE_ID = "s-id";
394
- var HYDRATED_STYLE_ID = "sty-id";
395
- var HYDRATE_CHILD_ID = "c-id";
396
- var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
397
- var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
398
- var win = typeof window !== "undefined" ? window : {};
399
- var plt = {
400
- $flags$: 0,
401
- $resourcesUrl$: "",
402
- jmp: (h2) => h2(),
403
- raf: (h2) => requestAnimationFrame(h2),
404
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
405
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
406
- ce: (eventName, opts) => new CustomEvent(eventName, opts)
407
- };
408
- var promiseResolve = (v) => Promise.resolve(v);
409
- var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
410
- try {
411
- if (!win.document.adoptedStyleSheets) {
412
- return false;
413
- }
414
- new CSSStyleSheet();
415
- return typeof new CSSStyleSheet().replaceSync === "function";
416
- } catch (e) {
417
- }
418
- return false;
419
- })() ;
420
- var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
421
- var queuePending = false;
422
- var queueDomReads = [];
423
- var queueDomWrites = [];
424
- var queueTask = (queue, write) => (cb) => {
425
- queue.push(cb);
426
- if (!queuePending) {
427
- queuePending = true;
428
- if (write && plt.$flags$ & 4 /* queueSync */) {
429
- nextTick(flush);
430
- } else {
431
- plt.raf(flush);
432
- }
433
- }
434
- };
435
- var consume = (queue) => {
436
- for (let i2 = 0; i2 < queue.length; i2++) {
437
- try {
438
- queue[i2](performance.now());
439
- } catch (e) {
440
- consoleError(e);
441
- }
442
- }
443
- queue.length = 0;
444
- };
445
- var flush = () => {
446
- consume(queueDomReads);
447
- {
448
- consume(queueDomWrites);
449
- if (queuePending = queueDomReads.length > 0) {
450
- plt.raf(flush);
451
- }
452
- }
453
- };
454
- var nextTick = (cb) => promiseResolve().then(cb);
455
- var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
456
- var isComplexType = (o) => {
457
- o = typeof o;
458
- return o === "object" || o === "function";
459
- };
460
-
461
- // node_modules/minimatch/dist/esm/index.js
462
- var import_brace_expansion = __toESM(require_brace_expansion());
463
-
464
- // node_modules/minimatch/dist/esm/assert-valid-pattern.js
465
- var MAX_PATTERN_LENGTH = 1024 * 64;
466
- var assertValidPattern = (pattern) => {
467
- if (typeof pattern !== "string") {
468
- throw new TypeError("invalid pattern");
469
- }
470
- if (pattern.length > MAX_PATTERN_LENGTH) {
471
- throw new TypeError("pattern is too long");
472
- }
473
- };
474
-
475
- // node_modules/minimatch/dist/esm/brace-expressions.js
476
- var posixClasses = {
477
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
478
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
479
- "[:ascii:]": ["\\x00-\\x7f", false],
480
- "[:blank:]": ["\\p{Zs}\\t", true],
481
- "[:cntrl:]": ["\\p{Cc}", true],
482
- "[:digit:]": ["\\p{Nd}", true],
483
- "[:graph:]": ["\\p{Z}\\p{C}", true, true],
484
- "[:lower:]": ["\\p{Ll}", true],
485
- "[:print:]": ["\\p{C}", true],
486
- "[:punct:]": ["\\p{P}", true],
487
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
488
- "[:upper:]": ["\\p{Lu}", true],
489
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
490
- "[:xdigit:]": ["A-Fa-f0-9", false]
491
- };
492
- var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
493
- var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
494
- var rangesToString = (ranges) => ranges.join("");
495
- var parseClass = (glob, position) => {
496
- const pos = position;
497
- if (glob.charAt(pos) !== "[") {
498
- throw new Error("not in a brace expression");
499
- }
500
- const ranges = [];
501
- const negs = [];
502
- let i2 = pos + 1;
503
- let sawStart = false;
504
- let uflag = false;
505
- let escaping = false;
506
- let negate = false;
507
- let endPos = pos;
508
- let rangeStart = "";
509
- WHILE: while (i2 < glob.length) {
510
- const c = glob.charAt(i2);
511
- if ((c === "!" || c === "^") && i2 === pos + 1) {
512
- negate = true;
513
- i2++;
514
- continue;
515
- }
516
- if (c === "]" && sawStart && !escaping) {
517
- endPos = i2 + 1;
518
- break;
519
- }
520
- sawStart = true;
521
- if (c === "\\") {
522
- if (!escaping) {
523
- escaping = true;
524
- i2++;
525
- continue;
526
- }
527
- }
528
- if (c === "[" && !escaping) {
529
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
530
- if (glob.startsWith(cls, i2)) {
531
- if (rangeStart) {
532
- return ["$.", false, glob.length - pos, true];
533
- }
534
- i2 += cls.length;
535
- if (neg)
536
- negs.push(unip);
537
- else
538
- ranges.push(unip);
539
- uflag = uflag || u;
540
- continue WHILE;
541
- }
542
- }
543
- }
544
- escaping = false;
545
- if (rangeStart) {
546
- if (c > rangeStart) {
547
- ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
548
- } else if (c === rangeStart) {
549
- ranges.push(braceEscape(c));
550
- }
551
- rangeStart = "";
552
- i2++;
553
- continue;
554
- }
555
- if (glob.startsWith("-]", i2 + 1)) {
556
- ranges.push(braceEscape(c + "-"));
557
- i2 += 2;
558
- continue;
559
- }
560
- if (glob.startsWith("-", i2 + 1)) {
561
- rangeStart = c;
562
- i2 += 2;
563
- continue;
564
- }
565
- ranges.push(braceEscape(c));
566
- i2++;
567
- }
568
- if (endPos < i2) {
569
- return ["", false, 0, false];
570
- }
571
- if (!ranges.length && !negs.length) {
572
- return ["$.", false, glob.length - pos, true];
573
- }
574
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
575
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
576
- return [regexpEscape(r), false, endPos - pos, false];
577
- }
578
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
579
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
580
- const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
581
- return [comb, uflag, endPos - pos, true];
582
- };
583
-
584
- // node_modules/minimatch/dist/esm/unescape.js
585
- var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
586
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
587
- };
588
-
589
- // node_modules/minimatch/dist/esm/ast.js
590
- var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
591
- var isExtglobType = (c) => types.has(c);
592
- var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
593
- var startNoDot = "(?!\\.)";
594
- var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
595
- var justDots = /* @__PURE__ */ new Set(["..", "."]);
596
- var reSpecials = new Set("().*{}+?[]^$\\!");
597
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
598
- var qmark = "[^/]";
599
- var star = qmark + "*?";
600
- var starNoEmpty = qmark + "+?";
601
- var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
602
- var _AST = class _AST {
603
- constructor(type, parent, options = {}) {
604
- __privateAdd(this, _AST_instances);
605
- __publicField(this, "type");
606
- __privateAdd(this, _root);
607
- __privateAdd(this, _hasMagic);
608
- __privateAdd(this, _uflag, false);
609
- __privateAdd(this, _parts, []);
610
- __privateAdd(this, _parent);
611
- __privateAdd(this, _parentIndex);
612
- __privateAdd(this, _negs);
613
- __privateAdd(this, _filledNegs, false);
614
- __privateAdd(this, _options);
615
- __privateAdd(this, _toString);
616
- // set to true if it's an extglob with no children
617
- // (which really means one child of '')
618
- __privateAdd(this, _emptyExt, false);
619
- this.type = type;
620
- if (type)
621
- __privateSet(this, _hasMagic, true);
622
- __privateSet(this, _parent, parent);
623
- __privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
624
- __privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
625
- __privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
626
- if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
627
- __privateGet(this, _negs).push(this);
628
- __privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
629
- }
630
- get hasMagic() {
631
- if (__privateGet(this, _hasMagic) !== void 0)
632
- return __privateGet(this, _hasMagic);
633
- for (const p of __privateGet(this, _parts)) {
634
- if (typeof p === "string")
635
- continue;
636
- if (p.type || p.hasMagic)
637
- return __privateSet(this, _hasMagic, true);
638
- }
639
- return __privateGet(this, _hasMagic);
640
- }
641
- // reconstructs the pattern
642
- toString() {
643
- if (__privateGet(this, _toString) !== void 0)
644
- return __privateGet(this, _toString);
645
- if (!this.type) {
646
- return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
647
- } else {
648
- return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
649
- }
650
- }
651
- push(...parts) {
652
- for (const p of parts) {
653
- if (p === "")
654
- continue;
655
- if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
656
- throw new Error("invalid part: " + p);
657
- }
658
- __privateGet(this, _parts).push(p);
659
- }
660
- }
661
- toJSON() {
662
- var _a;
663
- const ret = this.type === null ? __privateGet(this, _parts).slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...__privateGet(this, _parts).map((p) => p.toJSON())];
664
- if (this.isStart() && !this.type)
665
- ret.unshift([]);
666
- if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
667
- ret.push({});
668
- }
669
- return ret;
670
- }
671
- isStart() {
672
- var _a;
673
- if (__privateGet(this, _root) === this)
674
- return true;
675
- if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
676
- return false;
677
- if (__privateGet(this, _parentIndex) === 0)
678
- return true;
679
- const p = __privateGet(this, _parent);
680
- for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
681
- const pp = __privateGet(p, _parts)[i2];
682
- if (!(pp instanceof _AST && pp.type === "!")) {
683
- return false;
684
- }
685
- }
686
- return true;
687
- }
688
- isEnd() {
689
- var _a, _b, _c;
690
- if (__privateGet(this, _root) === this)
691
- return true;
692
- if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
693
- return true;
694
- if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
695
- return false;
696
- if (!this.type)
697
- return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
698
- const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
699
- return __privateGet(this, _parentIndex) === pl - 1;
700
- }
701
- copyIn(part) {
702
- if (typeof part === "string")
703
- this.push(part);
704
- else
705
- this.push(part.clone(this));
706
- }
707
- clone(parent) {
708
- const c = new _AST(this.type, parent);
709
- for (const p of __privateGet(this, _parts)) {
710
- c.copyIn(p);
711
- }
712
- return c;
713
- }
714
- static fromGlob(pattern, options = {}) {
715
- var _a;
716
- const ast = new _AST(null, void 0, options);
717
- __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
718
- return ast;
719
- }
720
- // returns the regular expression if there's magic, or the unescaped
721
- // string if not.
722
- toMMPattern() {
723
- if (this !== __privateGet(this, _root))
724
- return __privateGet(this, _root).toMMPattern();
725
- const glob = this.toString();
726
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
727
- const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
728
- if (!anyMagic) {
729
- return body;
730
- }
731
- const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
732
- return Object.assign(new RegExp(`^${re}$`, flags), {
733
- _src: re,
734
- _glob: glob
735
- });
736
- }
737
- get options() {
738
- return __privateGet(this, _options);
739
- }
740
- // returns the string match, the regexp source, whether there's magic
741
- // in the regexp (so a regular expression is required) and whether or
742
- // not the uflag is needed for the regular expression (for posix classes)
743
- // TODO: instead of injecting the start/end at this point, just return
744
- // the BODY of the regexp, along with the start/end portions suitable
745
- // for binding the start/end in either a joined full-path makeRe context
746
- // (where we bind to (^|/), or a standalone matchPart context (where
747
- // we bind to ^, and not /). Otherwise slashes get duped!
748
- //
749
- // In part-matching mode, the start is:
750
- // - if not isStart: nothing
751
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
752
- // - if dots allowed or not possible: ^
753
- // - if dots possible and not allowed: ^(?!\.)
754
- // end is:
755
- // - if not isEnd(): nothing
756
- // - else: $
757
- //
758
- // In full-path matching mode, we put the slash at the START of the
759
- // pattern, so start is:
760
- // - if first pattern: same as part-matching mode
761
- // - if not isStart(): nothing
762
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
763
- // - if dots allowed or not possible: /
764
- // - if dots possible and not allowed: /(?!\.)
765
- // end is:
766
- // - if last pattern, same as part-matching mode
767
- // - else nothing
768
- //
769
- // Always put the (?:$|/) on negated tails, though, because that has to be
770
- // there to bind the end of the negated pattern portion, and it's easier to
771
- // just stick it in now rather than try to inject it later in the middle of
772
- // the pattern.
773
- //
774
- // We can just always return the same end, and leave it up to the caller
775
- // to know whether it's going to be used joined or in parts.
776
- // And, if the start is adjusted slightly, can do the same there:
777
- // - if not isStart: nothing
778
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
779
- // - if dots allowed or not possible: (?:/|^)
780
- // - if dots possible and not allowed: (?:/|^)(?!\.)
781
- //
782
- // But it's better to have a simpler binding without a conditional, for
783
- // performance, so probably better to return both start options.
784
- //
785
- // Then the caller just ignores the end if it's not the first pattern,
786
- // and the start always gets applied.
787
- //
788
- // But that's always going to be $ if it's the ending pattern, or nothing,
789
- // so the caller can just attach $ at the end of the pattern when building.
790
- //
791
- // So the todo is:
792
- // - better detect what kind of start is needed
793
- // - return both flavors of starting pattern
794
- // - attach $ at the end of the pattern when creating the actual RegExp
795
- //
796
- // Ah, but wait, no, that all only applies to the root when the first pattern
797
- // is not an extglob. If the first pattern IS an extglob, then we need all
798
- // that dot prevention biz to live in the extglob portions, because eg
799
- // +(*|.x*) can match .xy but not .yx.
800
- //
801
- // So, return the two flavors if it's #root and the first child is not an
802
- // AST, otherwise leave it to the child AST to handle it, and there,
803
- // use the (?:^|/) style of start binding.
804
- //
805
- // Even simplified further:
806
- // - Since the start for a join is eg /(?!\.) and the start for a part
807
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
808
- // or start or whatever) and prepend ^ or / at the Regexp construction.
809
- toRegExpSource(allowDot) {
810
- var _a;
811
- const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
812
- if (__privateGet(this, _root) === this)
813
- __privateMethod(this, _AST_instances, fillNegs_fn).call(this);
814
- if (!this.type) {
815
- const noEmpty = this.isStart() && this.isEnd();
816
- const src = __privateGet(this, _parts).map((p) => {
817
- var _a2;
818
- const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
819
- __privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
820
- __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
821
- return re;
822
- }).join("");
823
- let start2 = "";
824
- if (this.isStart()) {
825
- if (typeof __privateGet(this, _parts)[0] === "string") {
826
- const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
827
- if (!dotTravAllowed) {
828
- const aps = addPatternStart;
829
- const needNoTrav = (
830
- // dots are allowed, and the pattern starts with [ or .
831
- dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
832
- src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
833
- src.startsWith("\\.\\.") && aps.has(src.charAt(4))
834
- );
835
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
836
- start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
837
- }
838
- }
839
- }
840
- let end = "";
841
- if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
842
- end = "(?:$|\\/)";
843
- }
844
- const final2 = start2 + src + end;
845
- return [
846
- final2,
847
- unescape(src),
848
- __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
849
- __privateGet(this, _uflag)
850
- ];
851
- }
852
- const repeated = this.type === "*" || this.type === "+";
853
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
854
- let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
855
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
856
- const s = this.toString();
857
- __privateSet(this, _parts, [s]);
858
- this.type = null;
859
- __privateSet(this, _hasMagic, void 0);
860
- return [s, unescape(this.toString()), false, false];
861
- }
862
- let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
863
- if (bodyDotAllowed === body) {
864
- bodyDotAllowed = "";
865
- }
866
- if (bodyDotAllowed) {
867
- body = `(?:${body})(?:${bodyDotAllowed})*?`;
868
- }
869
- let final = "";
870
- if (this.type === "!" && __privateGet(this, _emptyExt)) {
871
- final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
872
- } else {
873
- const close = this.type === "!" ? (
874
- // !() must match something,but !(x) can match ''
875
- "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
876
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
877
- final = start + body + close;
878
- }
879
- return [
880
- final,
881
- unescape(body),
882
- __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
883
- __privateGet(this, _uflag)
884
- ];
885
- }
886
- };
887
- _root = new WeakMap();
888
- _hasMagic = new WeakMap();
889
- _uflag = new WeakMap();
890
- _parts = new WeakMap();
891
- _parent = new WeakMap();
892
- _parentIndex = new WeakMap();
893
- _negs = new WeakMap();
894
- _filledNegs = new WeakMap();
895
- _options = new WeakMap();
896
- _toString = new WeakMap();
897
- _emptyExt = new WeakMap();
898
- _AST_instances = new WeakSet();
899
- fillNegs_fn = function() {
900
- if (this !== __privateGet(this, _root))
901
- throw new Error("should only call on root");
902
- if (__privateGet(this, _filledNegs))
903
- return this;
904
- this.toString();
905
- __privateSet(this, _filledNegs, true);
906
- let n;
907
- while (n = __privateGet(this, _negs).pop()) {
908
- if (n.type !== "!")
909
- continue;
910
- let p = n;
911
- let pp = __privateGet(p, _parent);
912
- while (pp) {
913
- for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
914
- for (const part of __privateGet(n, _parts)) {
915
- if (typeof part === "string") {
916
- throw new Error("string part in extglob AST??");
917
- }
918
- part.copyIn(__privateGet(pp, _parts)[i2]);
919
- }
920
- }
921
- p = pp;
922
- pp = __privateGet(p, _parent);
923
- }
924
- }
925
- return this;
926
- };
927
- _AST_static = new WeakSet();
928
- parseAST_fn = function(str, ast, pos, opt) {
929
- var _a, _b;
930
- let escaping = false;
931
- let inBrace = false;
932
- let braceStart = -1;
933
- let braceNeg = false;
934
- if (ast.type === null) {
935
- let i3 = pos;
936
- let acc2 = "";
937
- while (i3 < str.length) {
938
- const c = str.charAt(i3++);
939
- if (escaping || c === "\\") {
940
- escaping = !escaping;
941
- acc2 += c;
942
- continue;
943
- }
944
- if (inBrace) {
945
- if (i3 === braceStart + 1) {
946
- if (c === "^" || c === "!") {
947
- braceNeg = true;
948
- }
949
- } else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
950
- inBrace = false;
951
- }
952
- acc2 += c;
953
- continue;
954
- } else if (c === "[") {
955
- inBrace = true;
956
- braceStart = i3;
957
- braceNeg = false;
958
- acc2 += c;
959
- continue;
960
- }
961
- if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
962
- ast.push(acc2);
963
- acc2 = "";
964
- const ext2 = new _AST(c, ast);
965
- i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
966
- ast.push(ext2);
967
- continue;
968
- }
969
- acc2 += c;
970
- }
971
- ast.push(acc2);
972
- return i3;
973
- }
974
- let i2 = pos + 1;
975
- let part = new _AST(null, ast);
976
- const parts = [];
977
- let acc = "";
978
- while (i2 < str.length) {
979
- const c = str.charAt(i2++);
980
- if (escaping || c === "\\") {
981
- escaping = !escaping;
982
- acc += c;
983
- continue;
984
- }
985
- if (inBrace) {
986
- if (i2 === braceStart + 1) {
987
- if (c === "^" || c === "!") {
988
- braceNeg = true;
989
- }
990
- } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
991
- inBrace = false;
992
- }
993
- acc += c;
994
- continue;
995
- } else if (c === "[") {
996
- inBrace = true;
997
- braceStart = i2;
998
- braceNeg = false;
999
- acc += c;
1000
- continue;
1001
- }
1002
- if (isExtglobType(c) && str.charAt(i2) === "(") {
1003
- part.push(acc);
1004
- acc = "";
1005
- const ext2 = new _AST(c, part);
1006
- part.push(ext2);
1007
- i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
1008
- continue;
1009
- }
1010
- if (c === "|") {
1011
- part.push(acc);
1012
- acc = "";
1013
- parts.push(part);
1014
- part = new _AST(null, ast);
1015
- continue;
1016
- }
1017
- if (c === ")") {
1018
- if (acc === "" && __privateGet(ast, _parts).length === 0) {
1019
- __privateSet(ast, _emptyExt, true);
1020
- }
1021
- part.push(acc);
1022
- acc = "";
1023
- ast.push(...parts, part);
1024
- return i2;
1025
- }
1026
- acc += c;
1027
- }
1028
- ast.type = null;
1029
- __privateSet(ast, _hasMagic, void 0);
1030
- __privateSet(ast, _parts, [str.substring(pos - 1)]);
1031
- return i2;
1032
- };
1033
- partsToRegExp_fn = function(dot) {
1034
- return __privateGet(this, _parts).map((p) => {
1035
- if (typeof p === "string") {
1036
- throw new Error("string type in extglob ast??");
1037
- }
1038
- const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
1039
- __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
1040
- return re;
1041
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
1042
- };
1043
- parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
1044
- let escaping = false;
1045
- let re = "";
1046
- let uflag = false;
1047
- for (let i2 = 0; i2 < glob.length; i2++) {
1048
- const c = glob.charAt(i2);
1049
- if (escaping) {
1050
- escaping = false;
1051
- re += (reSpecials.has(c) ? "\\" : "") + c;
1052
- continue;
1053
- }
1054
- if (c === "\\") {
1055
- if (i2 === glob.length - 1) {
1056
- re += "\\\\";
1057
- } else {
1058
- escaping = true;
1059
- }
1060
- continue;
1061
- }
1062
- if (c === "[") {
1063
- const [src, needUflag, consumed, magic] = parseClass(glob, i2);
1064
- if (consumed) {
1065
- re += src;
1066
- uflag = uflag || needUflag;
1067
- i2 += consumed - 1;
1068
- hasMagic = hasMagic || magic;
1069
- continue;
1070
- }
1071
- }
1072
- if (c === "*") {
1073
- if (noEmpty && glob === "*")
1074
- re += starNoEmpty;
1075
- else
1076
- re += star;
1077
- hasMagic = true;
1078
- continue;
1079
- }
1080
- if (c === "?") {
1081
- re += qmark;
1082
- hasMagic = true;
1083
- continue;
1084
- }
1085
- re += regExpEscape(c);
1086
- }
1087
- return [re, unescape(glob), !!hasMagic, uflag];
1088
- };
1089
- __privateAdd(_AST, _AST_static);
1090
- var AST = _AST;
1091
-
1092
- // node_modules/minimatch/dist/esm/escape.js
1093
- var escape = (s, { windowsPathsNoEscape = false } = {}) => {
1094
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
1095
- };
1096
-
1097
- // node_modules/minimatch/dist/esm/index.js
1098
- var minimatch = (p, pattern, options = {}) => {
1099
- assertValidPattern(pattern);
1100
- if (!options.nocomment && pattern.charAt(0) === "#") {
1101
- return false;
1102
- }
1103
- return new Minimatch(pattern, options).match(p);
1104
- };
1105
- var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
1106
- var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
1107
- var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
1108
- var starDotExtTestNocase = (ext2) => {
1109
- ext2 = ext2.toLowerCase();
1110
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
1111
- };
1112
- var starDotExtTestNocaseDot = (ext2) => {
1113
- ext2 = ext2.toLowerCase();
1114
- return (f) => f.toLowerCase().endsWith(ext2);
1115
- };
1116
- var starDotStarRE = /^\*+\.\*+$/;
1117
- var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
1118
- var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
1119
- var dotStarRE = /^\.\*+$/;
1120
- var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
1121
- var starRE = /^\*+$/;
1122
- var starTest = (f) => f.length !== 0 && !f.startsWith(".");
1123
- var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
1124
- var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
1125
- var qmarksTestNocase = ([$0, ext2 = ""]) => {
1126
- const noext = qmarksTestNoExt([$0]);
1127
- if (!ext2)
1128
- return noext;
1129
- ext2 = ext2.toLowerCase();
1130
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
1131
- };
1132
- var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
1133
- const noext = qmarksTestNoExtDot([$0]);
1134
- if (!ext2)
1135
- return noext;
1136
- ext2 = ext2.toLowerCase();
1137
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
1138
- };
1139
- var qmarksTestDot = ([$0, ext2 = ""]) => {
1140
- const noext = qmarksTestNoExtDot([$0]);
1141
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
1142
- };
1143
- var qmarksTest = ([$0, ext2 = ""]) => {
1144
- const noext = qmarksTestNoExt([$0]);
1145
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
1146
- };
1147
- var qmarksTestNoExt = ([$0]) => {
1148
- const len = $0.length;
1149
- return (f) => f.length === len && !f.startsWith(".");
1150
- };
1151
- var qmarksTestNoExtDot = ([$0]) => {
1152
- const len = $0.length;
1153
- return (f) => f.length === len && f !== "." && f !== "..";
1154
- };
1155
- var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
1156
- var path = {
1157
- win32: { sep: "\\" },
1158
- posix: { sep: "/" }
1159
- };
1160
- var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
1161
- minimatch.sep = sep;
1162
- var GLOBSTAR = Symbol("globstar **");
1163
- minimatch.GLOBSTAR = GLOBSTAR;
1164
- var qmark2 = "[^/]";
1165
- var star2 = qmark2 + "*?";
1166
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
1167
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
1168
- var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
1169
- minimatch.filter = filter;
1170
- var ext = (a, b = {}) => Object.assign({}, a, b);
1171
- var defaults = (def) => {
1172
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
1173
- return minimatch;
1174
- }
1175
- const orig = minimatch;
1176
- const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
1177
- return Object.assign(m, {
1178
- Minimatch: class Minimatch extends orig.Minimatch {
1179
- constructor(pattern, options = {}) {
1180
- super(pattern, ext(def, options));
1181
- }
1182
- static defaults(options) {
1183
- return orig.defaults(ext(def, options)).Minimatch;
1184
- }
1185
- },
1186
- AST: class AST extends orig.AST {
1187
- /* c8 ignore start */
1188
- constructor(type, parent, options = {}) {
1189
- super(type, parent, ext(def, options));
1190
- }
1191
- /* c8 ignore stop */
1192
- static fromGlob(pattern, options = {}) {
1193
- return orig.AST.fromGlob(pattern, ext(def, options));
1194
- }
1195
- },
1196
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
1197
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
1198
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
1199
- defaults: (options) => orig.defaults(ext(def, options)),
1200
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
1201
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
1202
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
1203
- sep: orig.sep,
1204
- GLOBSTAR
1205
- });
1206
- };
1207
- minimatch.defaults = defaults;
1208
- var braceExpand = (pattern, options = {}) => {
1209
- assertValidPattern(pattern);
1210
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
1211
- return [pattern];
1212
- }
1213
- return (0, import_brace_expansion.default)(pattern);
1214
- };
1215
- minimatch.braceExpand = braceExpand;
1216
- var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
1217
- minimatch.makeRe = makeRe;
1218
- var match = (list, pattern, options = {}) => {
1219
- const mm = new Minimatch(pattern, options);
1220
- list = list.filter((f) => mm.match(f));
1221
- if (mm.options.nonull && !list.length) {
1222
- list.push(pattern);
1223
- }
1224
- return list;
1225
- };
1226
- minimatch.match = match;
1227
- var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
1228
- var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1229
- var Minimatch = class {
1230
- options;
1231
- set;
1232
- pattern;
1233
- windowsPathsNoEscape;
1234
- nonegate;
1235
- negate;
1236
- comment;
1237
- empty;
1238
- preserveMultipleSlashes;
1239
- partial;
1240
- globSet;
1241
- globParts;
1242
- nocase;
1243
- isWindows;
1244
- platform;
1245
- windowsNoMagicRoot;
1246
- regexp;
1247
- constructor(pattern, options = {}) {
1248
- assertValidPattern(pattern);
1249
- options = options || {};
1250
- this.options = options;
1251
- this.pattern = pattern;
1252
- this.platform = options.platform || defaultPlatform;
1253
- this.isWindows = this.platform === "win32";
1254
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
1255
- if (this.windowsPathsNoEscape) {
1256
- this.pattern = this.pattern.replace(/\\/g, "/");
1257
- }
1258
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
1259
- this.regexp = null;
1260
- this.negate = false;
1261
- this.nonegate = !!options.nonegate;
1262
- this.comment = false;
1263
- this.empty = false;
1264
- this.partial = !!options.partial;
1265
- this.nocase = !!this.options.nocase;
1266
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
1267
- this.globSet = [];
1268
- this.globParts = [];
1269
- this.set = [];
1270
- this.make();
1271
- }
1272
- hasMagic() {
1273
- if (this.options.magicalBraces && this.set.length > 1) {
1274
- return true;
1275
- }
1276
- for (const pattern of this.set) {
1277
- for (const part of pattern) {
1278
- if (typeof part !== "string")
1279
- return true;
1280
- }
1281
- }
1282
- return false;
1283
- }
1284
- debug(..._) {
1285
- }
1286
- make() {
1287
- const pattern = this.pattern;
1288
- const options = this.options;
1289
- if (!options.nocomment && pattern.charAt(0) === "#") {
1290
- this.comment = true;
1291
- return;
1292
- }
1293
- if (!pattern) {
1294
- this.empty = true;
1295
- return;
1296
- }
1297
- this.parseNegate();
1298
- this.globSet = [...new Set(this.braceExpand())];
1299
- if (options.debug) {
1300
- this.debug = (...args) => console.error(...args);
1301
- }
1302
- this.debug(this.pattern, this.globSet);
1303
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
1304
- this.globParts = this.preprocess(rawGlobParts);
1305
- this.debug(this.pattern, this.globParts);
1306
- let set = this.globParts.map((s, _, __) => {
1307
- if (this.isWindows && this.windowsNoMagicRoot) {
1308
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
1309
- const isDrive = /^[a-z]:/i.test(s[0]);
1310
- if (isUNC) {
1311
- return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
1312
- } else if (isDrive) {
1313
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
1314
- }
1315
- }
1316
- return s.map((ss) => this.parse(ss));
1317
- });
1318
- this.debug(this.pattern, set);
1319
- this.set = set.filter((s) => s.indexOf(false) === -1);
1320
- if (this.isWindows) {
1321
- for (let i2 = 0; i2 < this.set.length; i2++) {
1322
- const p = this.set[i2];
1323
- if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
1324
- p[2] = "?";
1325
- }
1326
- }
1327
- }
1328
- this.debug(this.pattern, this.set);
1329
- }
1330
- // various transforms to equivalent pattern sets that are
1331
- // faster to process in a filesystem walk. The goal is to
1332
- // eliminate what we can, and push all ** patterns as far
1333
- // to the right as possible, even if it increases the number
1334
- // of patterns that we have to process.
1335
- preprocess(globParts) {
1336
- if (this.options.noglobstar) {
1337
- for (let i2 = 0; i2 < globParts.length; i2++) {
1338
- for (let j = 0; j < globParts[i2].length; j++) {
1339
- if (globParts[i2][j] === "**") {
1340
- globParts[i2][j] = "*";
1341
- }
1342
- }
1343
- }
1344
- }
1345
- const { optimizationLevel = 1 } = this.options;
1346
- if (optimizationLevel >= 2) {
1347
- globParts = this.firstPhasePreProcess(globParts);
1348
- globParts = this.secondPhasePreProcess(globParts);
1349
- } else if (optimizationLevel >= 1) {
1350
- globParts = this.levelOneOptimize(globParts);
1351
- } else {
1352
- globParts = this.adjascentGlobstarOptimize(globParts);
1353
- }
1354
- return globParts;
1355
- }
1356
- // just get rid of adjascent ** portions
1357
- adjascentGlobstarOptimize(globParts) {
1358
- return globParts.map((parts) => {
1359
- let gs = -1;
1360
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1361
- let i2 = gs;
1362
- while (parts[i2 + 1] === "**") {
1363
- i2++;
1364
- }
1365
- if (i2 !== gs) {
1366
- parts.splice(gs, i2 - gs);
1367
- }
1368
- }
1369
- return parts;
1370
- });
1371
- }
1372
- // get rid of adjascent ** and resolve .. portions
1373
- levelOneOptimize(globParts) {
1374
- return globParts.map((parts) => {
1375
- parts = parts.reduce((set, part) => {
1376
- const prev = set[set.length - 1];
1377
- if (part === "**" && prev === "**") {
1378
- return set;
1379
- }
1380
- if (part === "..") {
1381
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
1382
- set.pop();
1383
- return set;
1384
- }
1385
- }
1386
- set.push(part);
1387
- return set;
1388
- }, []);
1389
- return parts.length === 0 ? [""] : parts;
1390
- });
1391
- }
1392
- levelTwoFileOptimize(parts) {
1393
- if (!Array.isArray(parts)) {
1394
- parts = this.slashSplit(parts);
1395
- }
1396
- let didSomething = false;
1397
- do {
1398
- didSomething = false;
1399
- if (!this.preserveMultipleSlashes) {
1400
- for (let i2 = 1; i2 < parts.length - 1; i2++) {
1401
- const p = parts[i2];
1402
- if (i2 === 1 && p === "" && parts[0] === "")
1403
- continue;
1404
- if (p === "." || p === "") {
1405
- didSomething = true;
1406
- parts.splice(i2, 1);
1407
- i2--;
1408
- }
1409
- }
1410
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1411
- didSomething = true;
1412
- parts.pop();
1413
- }
1414
- }
1415
- let dd = 0;
1416
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1417
- const p = parts[dd - 1];
1418
- if (p && p !== "." && p !== ".." && p !== "**") {
1419
- didSomething = true;
1420
- parts.splice(dd - 1, 2);
1421
- dd -= 2;
1422
- }
1423
- }
1424
- } while (didSomething);
1425
- return parts.length === 0 ? [""] : parts;
1426
- }
1427
- // First phase: single-pattern processing
1428
- // <pre> is 1 or more portions
1429
- // <rest> is 1 or more portions
1430
- // <p> is any portion other than ., .., '', or **
1431
- // <e> is . or ''
1432
- //
1433
- // **/.. is *brutal* for filesystem walking performance, because
1434
- // it effectively resets the recursive walk each time it occurs,
1435
- // and ** cannot be reduced out by a .. pattern part like a regexp
1436
- // or most strings (other than .., ., and '') can be.
1437
- //
1438
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
1439
- // <pre>/<e>/<rest> -> <pre>/<rest>
1440
- // <pre>/<p>/../<rest> -> <pre>/<rest>
1441
- // **/**/<rest> -> **/<rest>
1442
- //
1443
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
1444
- // this WOULD be allowed if ** did follow symlinks, or * didn't
1445
- firstPhasePreProcess(globParts) {
1446
- let didSomething = false;
1447
- do {
1448
- didSomething = false;
1449
- for (let parts of globParts) {
1450
- let gs = -1;
1451
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1452
- let gss = gs;
1453
- while (parts[gss + 1] === "**") {
1454
- gss++;
1455
- }
1456
- if (gss > gs) {
1457
- parts.splice(gs + 1, gss - gs);
1458
- }
1459
- let next = parts[gs + 1];
1460
- const p = parts[gs + 2];
1461
- const p2 = parts[gs + 3];
1462
- if (next !== "..")
1463
- continue;
1464
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
1465
- continue;
1466
- }
1467
- didSomething = true;
1468
- parts.splice(gs, 1);
1469
- const other = parts.slice(0);
1470
- other[gs] = "**";
1471
- globParts.push(other);
1472
- gs--;
1473
- }
1474
- if (!this.preserveMultipleSlashes) {
1475
- for (let i2 = 1; i2 < parts.length - 1; i2++) {
1476
- const p = parts[i2];
1477
- if (i2 === 1 && p === "" && parts[0] === "")
1478
- continue;
1479
- if (p === "." || p === "") {
1480
- didSomething = true;
1481
- parts.splice(i2, 1);
1482
- i2--;
1483
- }
1484
- }
1485
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1486
- didSomething = true;
1487
- parts.pop();
1488
- }
1489
- }
1490
- let dd = 0;
1491
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1492
- const p = parts[dd - 1];
1493
- if (p && p !== "." && p !== ".." && p !== "**") {
1494
- didSomething = true;
1495
- const needDot = dd === 1 && parts[dd + 1] === "**";
1496
- const splin = needDot ? ["."] : [];
1497
- parts.splice(dd - 1, 2, ...splin);
1498
- if (parts.length === 0)
1499
- parts.push("");
1500
- dd -= 2;
1501
- }
1502
- }
1503
- }
1504
- } while (didSomething);
1505
- return globParts;
1506
- }
1507
- // second phase: multi-pattern dedupes
1508
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
1509
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
1510
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
1511
- //
1512
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
1513
- // ^-- not valid because ** doens't follow symlinks
1514
- secondPhasePreProcess(globParts) {
1515
- for (let i2 = 0; i2 < globParts.length - 1; i2++) {
1516
- for (let j = i2 + 1; j < globParts.length; j++) {
1517
- const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
1518
- if (!matched)
1519
- continue;
1520
- globParts[i2] = matched;
1521
- globParts[j] = [];
1522
- }
1523
- }
1524
- return globParts.filter((gs) => gs.length);
1525
- }
1526
- partsMatch(a, b, emptyGSMatch = false) {
1527
- let ai = 0;
1528
- let bi = 0;
1529
- let result = [];
1530
- let which = "";
1531
- while (ai < a.length && bi < b.length) {
1532
- if (a[ai] === b[bi]) {
1533
- result.push(which === "b" ? b[bi] : a[ai]);
1534
- ai++;
1535
- bi++;
1536
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
1537
- result.push(a[ai]);
1538
- ai++;
1539
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
1540
- result.push(b[bi]);
1541
- bi++;
1542
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
1543
- if (which === "b")
1544
- return false;
1545
- which = "a";
1546
- result.push(a[ai]);
1547
- ai++;
1548
- bi++;
1549
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
1550
- if (which === "a")
1551
- return false;
1552
- which = "b";
1553
- result.push(b[bi]);
1554
- ai++;
1555
- bi++;
1556
- } else {
1557
- return false;
1558
- }
1559
- }
1560
- return a.length === b.length && result;
1561
- }
1562
- parseNegate() {
1563
- if (this.nonegate)
1564
- return;
1565
- const pattern = this.pattern;
1566
- let negate = false;
1567
- let negateOffset = 0;
1568
- for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
1569
- negate = !negate;
1570
- negateOffset++;
1571
- }
1572
- if (negateOffset)
1573
- this.pattern = pattern.slice(negateOffset);
1574
- this.negate = negate;
1575
- }
1576
- // set partial to true to test if, for example,
1577
- // "/a/b" matches the start of "/*/b/*/d"
1578
- // Partial means, if you run out of file before you run
1579
- // out of pattern, then that's fine, as long as all
1580
- // the parts match.
1581
- matchOne(file, pattern, partial = false) {
1582
- const options = this.options;
1583
- if (this.isWindows) {
1584
- const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
1585
- const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
1586
- const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
1587
- const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
1588
- const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
1589
- const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
1590
- if (typeof fdi === "number" && typeof pdi === "number") {
1591
- const [fd, pd] = [file[fdi], pattern[pdi]];
1592
- if (fd.toLowerCase() === pd.toLowerCase()) {
1593
- pattern[pdi] = fd;
1594
- if (pdi > fdi) {
1595
- pattern = pattern.slice(pdi);
1596
- } else if (fdi > pdi) {
1597
- file = file.slice(fdi);
1598
- }
1599
- }
1600
- }
1601
- }
1602
- const { optimizationLevel = 1 } = this.options;
1603
- if (optimizationLevel >= 2) {
1604
- file = this.levelTwoFileOptimize(file);
1605
- }
1606
- this.debug("matchOne", this, { file, pattern });
1607
- this.debug("matchOne", file.length, pattern.length);
1608
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
1609
- this.debug("matchOne loop");
1610
- var p = pattern[pi];
1611
- var f = file[fi];
1612
- this.debug(pattern, p, f);
1613
- if (p === false) {
1614
- return false;
1615
- }
1616
- if (p === GLOBSTAR) {
1617
- this.debug("GLOBSTAR", [pattern, p, f]);
1618
- var fr = fi;
1619
- var pr = pi + 1;
1620
- if (pr === pl) {
1621
- this.debug("** at the end");
1622
- for (; fi < fl; fi++) {
1623
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
1624
- return false;
1625
- }
1626
- return true;
1627
- }
1628
- while (fr < fl) {
1629
- var swallowee = file[fr];
1630
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
1631
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
1632
- this.debug("globstar found match!", fr, fl, swallowee);
1633
- return true;
1634
- } else {
1635
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
1636
- this.debug("dot detected!", file, fr, pattern, pr);
1637
- break;
1638
- }
1639
- this.debug("globstar swallow a segment, and continue");
1640
- fr++;
1641
- }
1642
- }
1643
- if (partial) {
1644
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
1645
- if (fr === fl) {
1646
- return true;
1647
- }
1648
- }
1649
- return false;
1650
- }
1651
- let hit;
1652
- if (typeof p === "string") {
1653
- hit = f === p;
1654
- this.debug("string match", p, f, hit);
1655
- } else {
1656
- hit = p.test(f);
1657
- this.debug("pattern match", p, f, hit);
1658
- }
1659
- if (!hit)
1660
- return false;
1661
- }
1662
- if (fi === fl && pi === pl) {
1663
- return true;
1664
- } else if (fi === fl) {
1665
- return partial;
1666
- } else if (pi === pl) {
1667
- return fi === fl - 1 && file[fi] === "";
1668
- } else {
1669
- throw new Error("wtf?");
1670
- }
1671
- }
1672
- braceExpand() {
1673
- return braceExpand(this.pattern, this.options);
1674
- }
1675
- parse(pattern) {
1676
- assertValidPattern(pattern);
1677
- const options = this.options;
1678
- if (pattern === "**")
1679
- return GLOBSTAR;
1680
- if (pattern === "")
1681
- return "";
1682
- let m;
1683
- let fastTest = null;
1684
- if (m = pattern.match(starRE)) {
1685
- fastTest = options.dot ? starTestDot : starTest;
1686
- } else if (m = pattern.match(starDotExtRE)) {
1687
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
1688
- } else if (m = pattern.match(qmarksRE)) {
1689
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
1690
- } else if (m = pattern.match(starDotStarRE)) {
1691
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
1692
- } else if (m = pattern.match(dotStarRE)) {
1693
- fastTest = dotStarTest;
1694
- }
1695
- const re = AST.fromGlob(pattern, this.options).toMMPattern();
1696
- if (fastTest && typeof re === "object") {
1697
- Reflect.defineProperty(re, "test", { value: fastTest });
1698
- }
1699
- return re;
1700
- }
1701
- makeRe() {
1702
- if (this.regexp || this.regexp === false)
1703
- return this.regexp;
1704
- const set = this.set;
1705
- if (!set.length) {
1706
- this.regexp = false;
1707
- return this.regexp;
1708
- }
1709
- const options = this.options;
1710
- const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
1711
- const flags = new Set(options.nocase ? ["i"] : []);
1712
- let re = set.map((pattern) => {
1713
- const pp = pattern.map((p) => {
1714
- if (p instanceof RegExp) {
1715
- for (const f of p.flags.split(""))
1716
- flags.add(f);
1717
- }
1718
- return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
1719
- });
1720
- pp.forEach((p, i2) => {
1721
- const next = pp[i2 + 1];
1722
- const prev = pp[i2 - 1];
1723
- if (p !== GLOBSTAR || prev === GLOBSTAR) {
1724
- return;
1725
- }
1726
- if (prev === void 0) {
1727
- if (next !== void 0 && next !== GLOBSTAR) {
1728
- pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
1729
- } else {
1730
- pp[i2] = twoStar;
1731
- }
1732
- } else if (next === void 0) {
1733
- pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
1734
- } else if (next !== GLOBSTAR) {
1735
- pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
1736
- pp[i2 + 1] = GLOBSTAR;
1737
- }
1738
- });
1739
- return pp.filter((p) => p !== GLOBSTAR).join("/");
1740
- }).join("|");
1741
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
1742
- re = "^" + open + re + close + "$";
1743
- if (this.negate)
1744
- re = "^(?!" + re + ").+$";
1745
- try {
1746
- this.regexp = new RegExp(re, [...flags].join(""));
1747
- } catch (ex) {
1748
- this.regexp = false;
1749
- }
1750
- return this.regexp;
1751
- }
1752
- slashSplit(p) {
1753
- if (this.preserveMultipleSlashes) {
1754
- return p.split("/");
1755
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
1756
- return ["", ...p.split(/\/+/)];
1757
- } else {
1758
- return p.split(/\/+/);
1759
- }
1760
- }
1761
- match(f, partial = this.partial) {
1762
- this.debug("match", f, this.pattern);
1763
- if (this.comment) {
1764
- return false;
1765
- }
1766
- if (this.empty) {
1767
- return f === "";
1768
- }
1769
- if (f === "/" && partial) {
1770
- return true;
1771
- }
1772
- const options = this.options;
1773
- if (this.isWindows) {
1774
- f = f.split("\\").join("/");
1775
- }
1776
- const ff = this.slashSplit(f);
1777
- this.debug(this.pattern, "split", ff);
1778
- const set = this.set;
1779
- this.debug(this.pattern, "set", set);
1780
- let filename = ff[ff.length - 1];
1781
- if (!filename) {
1782
- for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
1783
- filename = ff[i2];
1784
- }
1785
- }
1786
- for (let i2 = 0; i2 < set.length; i2++) {
1787
- const pattern = set[i2];
1788
- let file = ff;
1789
- if (options.matchBase && pattern.length === 1) {
1790
- file = [filename];
1791
- }
1792
- const hit = this.matchOne(file, pattern, partial);
1793
- if (hit) {
1794
- if (options.flipNegate) {
1795
- return true;
1796
- }
1797
- return !this.negate;
1798
- }
1799
- }
1800
- if (options.flipNegate) {
1801
- return false;
1802
- }
1803
- return this.negate;
1804
- }
1805
- static defaults(def) {
1806
- return minimatch.defaults(def).Minimatch;
1807
- }
1808
- };
1809
- minimatch.AST = AST;
1810
- minimatch.Minimatch = Minimatch;
1811
- minimatch.escape = escape;
1812
- minimatch.unescape = unescape;
1813
-
1814
- // src/utils/query-nonce-meta-tag-content.ts
1815
- function queryNonceMetaTagContent(doc) {
1816
- var _a, _b, _c;
1817
- return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
1818
- }
1819
-
1820
- // src/utils/regular-expression.ts
1821
- var escapeRegExpSpecialCharacters = (text) => {
1822
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1823
- };
1824
-
1825
- // src/utils/remote-value.ts
1826
- var RemoteValue = class _RemoteValue {
1827
- /**
1828
- * Deserializes a LocalValue serialized object back to its original JavaScript representation
1829
- *
1830
- * @param serialized The serialized LocalValue object
1831
- * @returns The original JavaScript value/object
1832
- */
1833
- static fromLocalValue(serialized) {
1834
- const type = serialized[TYPE_CONSTANT];
1835
- const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
1836
- switch (type) {
1837
- case "string" /* String */:
1838
- return value;
1839
- case "boolean" /* Boolean */:
1840
- return value;
1841
- case "bigint" /* BigInt */:
1842
- return BigInt(value);
1843
- case "undefined" /* Undefined */:
1844
- return void 0;
1845
- case "null" /* Null */:
1846
- return null;
1847
- case "number" /* Number */:
1848
- if (value === "NaN") return NaN;
1849
- if (value === "-0") return -0;
1850
- if (value === "Infinity") return Infinity;
1851
- if (value === "-Infinity") return -Infinity;
1852
- return value;
1853
- case "array" /* Array */:
1854
- return value.map((item) => _RemoteValue.fromLocalValue(item));
1855
- case "date" /* Date */:
1856
- return new Date(value);
1857
- case "map" /* Map */:
1858
- const map2 = /* @__PURE__ */ new Map();
1859
- for (const [key, val] of value) {
1860
- const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
1861
- const deserializedValue = _RemoteValue.fromLocalValue(val);
1862
- map2.set(deserializedKey, deserializedValue);
1863
- }
1864
- return map2;
1865
- case "object" /* Object */:
1866
- const obj = {};
1867
- for (const [key, val] of value) {
1868
- obj[key] = _RemoteValue.fromLocalValue(val);
1869
- }
1870
- return obj;
1871
- case "regexp" /* RegularExpression */:
1872
- const { pattern, flags } = value;
1873
- return new RegExp(pattern, flags);
1874
- case "set" /* Set */:
1875
- const set = /* @__PURE__ */ new Set();
1876
- for (const item of value) {
1877
- set.add(_RemoteValue.fromLocalValue(item));
1878
- }
1879
- return set;
1880
- case "symbol" /* Symbol */:
1881
- return Symbol(value);
1882
- default:
1883
- throw new Error(`Unsupported type: ${type}`);
1884
- }
1885
- }
1886
- /**
1887
- * Utility method to deserialize multiple LocalValues at once
1888
- *
1889
- * @param serializedValues Array of serialized LocalValue objects
1890
- * @returns Array of deserialized JavaScript values
1891
- */
1892
- static fromLocalValueArray(serializedValues) {
1893
- return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
1894
- }
1895
- /**
1896
- * Verifies if the given object matches the structure of a serialized LocalValue
1897
- *
1898
- * @param obj Object to verify
1899
- * @returns boolean indicating if the object has LocalValue structure
1900
- */
1901
- static isLocalValueObject(obj) {
1902
- if (typeof obj !== "object" || obj === null) {
1903
- return false;
1904
- }
1905
- if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1906
- return false;
1907
- }
1908
- const type = obj[TYPE_CONSTANT];
1909
- const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1910
- if (!hasTypeProperty) {
150
+
151
+ // src/runtime/runtime-constants.ts
152
+ var CONTENT_REF_ID = "r";
153
+ var ORG_LOCATION_ID = "o";
154
+ var SLOT_NODE_ID = "s";
155
+ var TEXT_NODE_ID = "t";
156
+ var COMMENT_NODE_ID = "c";
157
+ var HYDRATE_ID = "s-id";
158
+ var HYDRATED_STYLE_ID = "sty-id";
159
+ var HYDRATE_CHILD_ID = "c-id";
160
+ var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
161
+ var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
162
+ var win = typeof window !== "undefined" ? window : {};
163
+ var plt = {
164
+ $flags$: 0,
165
+ $resourcesUrl$: "",
166
+ jmp: (h2) => h2(),
167
+ raf: (h2) => requestAnimationFrame(h2),
168
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
169
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
170
+ ce: (eventName, opts) => new CustomEvent(eventName, opts)
171
+ };
172
+ var promiseResolve = (v) => Promise.resolve(v);
173
+ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
174
+ try {
175
+ if (!win.document.adoptedStyleSheets) {
1911
176
  return false;
1912
177
  }
1913
- if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1914
- return obj.hasOwnProperty(VALUE_CONSTANT);
1915
- }
1916
- return true;
178
+ new CSSStyleSheet();
179
+ return typeof new CSSStyleSheet().replaceSync === "function";
180
+ } catch (e) {
1917
181
  }
1918
- };
1919
-
1920
- // src/utils/result.ts
1921
- var result_exports = {};
1922
- __export(result_exports, {
1923
- err: () => err,
1924
- map: () => map,
1925
- ok: () => ok,
1926
- unwrap: () => unwrap,
1927
- unwrapErr: () => unwrapErr
1928
- });
1929
- var ok = (value) => ({
1930
- isOk: true,
1931
- isErr: false,
1932
- value
1933
- });
1934
- var err = (value) => ({
1935
- isOk: false,
1936
- isErr: true,
1937
- value
1938
- });
1939
- function map(result, fn) {
1940
- if (result.isOk) {
1941
- const val = fn(result.value);
1942
- if (val instanceof Promise) {
1943
- return val.then((newVal) => ok(newVal));
182
+ return false;
183
+ })() ;
184
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
185
+ var queuePending = false;
186
+ var queueDomReads = [];
187
+ var queueDomWrites = [];
188
+ var queueTask = (queue, write) => (cb) => {
189
+ queue.push(cb);
190
+ if (!queuePending) {
191
+ queuePending = true;
192
+ if (write && plt.$flags$ & 4 /* queueSync */) {
193
+ nextTick(flush);
1944
194
  } else {
1945
- return ok(val);
195
+ plt.raf(flush);
1946
196
  }
1947
197
  }
1948
- if (result.isErr) {
1949
- const value = result.value;
1950
- return err(value);
1951
- }
1952
- throw "should never get here";
1953
- }
1954
- var unwrap = (result) => {
1955
- if (result.isOk) {
1956
- return result.value;
1957
- } else {
1958
- throw result.value;
1959
- }
1960
198
  };
1961
- var unwrapErr = (result) => {
1962
- if (result.isErr) {
1963
- return result.value;
1964
- } else {
1965
- throw result.value;
199
+ var consume = (queue) => {
200
+ for (let i2 = 0; i2 < queue.length; i2++) {
201
+ try {
202
+ queue[i2](performance.now());
203
+ } catch (e) {
204
+ consoleError(e);
205
+ }
1966
206
  }
207
+ queue.length = 0;
1967
208
  };
1968
-
1969
- // src/utils/serialize.ts
1970
- function deserializeProperty(value) {
1971
- if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1972
- return value;
209
+ var flush = () => {
210
+ consume(queueDomReads);
211
+ {
212
+ consume(queueDomWrites);
213
+ if (queuePending = queueDomReads.length > 0) {
214
+ plt.raf(flush);
215
+ }
1973
216
  }
1974
- return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
1975
- }
217
+ };
218
+ var nextTick = (cb) => promiseResolve().then(cb);
219
+ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
1976
220
 
1977
221
  // src/utils/style.ts
1978
222
  function createStyleSheetIfNeededAndSupported(styles2) {
@@ -2084,6 +328,14 @@ var uniqueTime = (key, measureText) => {
2084
328
  };
2085
329
  }
2086
330
  };
331
+
332
+ // src/utils/query-nonce-meta-tag-content.ts
333
+ function queryNonceMetaTagContent(doc) {
334
+ var _a, _b, _c;
335
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
336
+ }
337
+
338
+ // src/runtime/styles.ts
2087
339
  var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2088
340
  var registerStyle = (scopeId2, cssText, allowCS) => {
2089
341
  let style = styles.get(scopeId2);
@@ -2117,10 +369,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2117
369
  }
2118
370
  const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
2119
371
  if (existingStyleElm) {
2120
- existingStyleElm.innerHTML = style;
372
+ existingStyleElm.textContent = style;
2121
373
  } else if (!appliedStyles.has(scopeId2)) {
2122
374
  styleElm = win.document.createElement("style");
2123
- styleElm.innerHTML = style;
375
+ styleElm.textContent = style;
2124
376
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2125
377
  if (nonce != null) {
2126
378
  styleElm.setAttribute("nonce", nonce);
@@ -2145,8 +397,8 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2145
397
  }
2146
398
  } else {
2147
399
  const existingStyleContainer = styleContainerNode.querySelector("style");
2148
- if (existingStyleContainer) {
2149
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
400
+ if (existingStyleContainer && true) {
401
+ existingStyleContainer.textContent = style + existingStyleContainer.textContent;
2150
402
  } else {
2151
403
  styleContainerNode.prepend(styleElm);
2152
404
  }
@@ -2159,7 +411,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2159
411
  styleContainerNode.insertBefore(styleElm, null);
2160
412
  }
2161
413
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2162
- styleElm.innerHTML += SLOT_FB_CSS;
414
+ styleElm.textContent += SLOT_FB_CSS;
2163
415
  }
2164
416
  if (appliedStyles) {
2165
417
  appliedStyles.add(scopeId2);
@@ -2187,6 +439,12 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2187
439
  styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
2188
440
  }
2189
441
  appliedStyles.add(scopeId2);
442
+ if ("host" in styleContainerNode) {
443
+ const ssrStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
444
+ if (ssrStyleElm) {
445
+ writeTask(() => ssrStyleElm.remove());
446
+ }
447
+ }
2190
448
  }
2191
449
  }
2192
450
  }
@@ -2218,6 +476,12 @@ var hydrateScopedToShadow = () => {
2218
476
  registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2219
477
  }
2220
478
  };
479
+ var isComplexType = (o) => {
480
+ o = typeof o;
481
+ return o === "object" || o === "function";
482
+ };
483
+
484
+ // src/runtime/vdom/h.ts
2221
485
  var h = (nodeName, vnodeData, ...children) => {
2222
486
  if (typeof nodeName === "string") {
2223
487
  nodeName = transformTag(nodeName);
@@ -2271,7 +535,8 @@ var newVNode = (tag, text) => {
2271
535
  const vnode = {
2272
536
  $flags$: 0,
2273
537
  $tag$: tag,
2274
- $text$: text,
538
+ // Normalize undefined to null to prevent rendering "undefined" as text
539
+ $text$: text != null ? text : null,
2275
540
  $elm$: null,
2276
541
  $children$: null
2277
542
  };
@@ -2332,7 +597,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
2332
597
  cmpMeta.$cmpMeta$);
2333
598
  const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
2334
599
  if (styleSheet) {
2335
- hostElm.shadowRoot.append(styleSheet.cloneNode(true));
600
+ shadowRootNodes.unshift(styleSheet.cloneNode(true));
2336
601
  }
2337
602
  }
2338
603
  }
@@ -2402,7 +667,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
2402
667
  currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
2403
668
  }
2404
669
  }
2405
- if (shadowRoot) {
670
+ if (shadowRoot && !shadowRoot.childNodes.length) {
2406
671
  let rnIdex = 0;
2407
672
  const rnLen = shadowRootNodes.length;
2408
673
  if (rnLen) {
@@ -2673,18 +938,144 @@ var findCorrespondingNode = (node, type) => {
2673
938
  } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
2674
939
  return sibling;
2675
940
  };
2676
- var createSupportsRuleRe = (selector) => {
2677
- const safeSelector2 = escapeRegExpSpecialCharacters(selector);
2678
- return new RegExp(
2679
- // First capture group: match any context before the selector that's not inside @supports selector()
2680
- // Using negative lookahead to avoid matching inside @supports selector(...) condition
2681
- `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
2682
- "g"
2683
- );
941
+
942
+ // src/runtime/normalize-watchers.ts
943
+ var normalizeWatchers = (raw) => {
944
+ if (!raw) return void 0;
945
+ const keys = Object.keys(raw);
946
+ if (keys.length === 0) return void 0;
947
+ let hasLegacy = false;
948
+ for (const propName of keys) {
949
+ if (hasLegacy) break;
950
+ for (const h2 of raw[propName]) {
951
+ if (typeof h2 === "string") {
952
+ hasLegacy = true;
953
+ break;
954
+ }
955
+ }
956
+ }
957
+ if (!hasLegacy) return raw;
958
+ const out = {};
959
+ for (const propName of keys) {
960
+ out[propName] = raw[propName].map(
961
+ (h2) => typeof h2 === "string" ? { [h2]: 0 } : h2
962
+ );
963
+ }
964
+ return out;
965
+ };
966
+
967
+ // src/utils/remote-value.ts
968
+ var RemoteValue = class _RemoteValue {
969
+ /**
970
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
971
+ *
972
+ * @param serialized The serialized LocalValue object
973
+ * @returns The original JavaScript value/object
974
+ */
975
+ static fromLocalValue(serialized) {
976
+ const type = serialized[TYPE_CONSTANT];
977
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
978
+ switch (type) {
979
+ case "string" /* String */:
980
+ return value;
981
+ case "boolean" /* Boolean */:
982
+ return value;
983
+ case "bigint" /* BigInt */:
984
+ return BigInt(value);
985
+ case "undefined" /* Undefined */:
986
+ return void 0;
987
+ case "null" /* Null */:
988
+ return null;
989
+ case "number" /* Number */:
990
+ if (value === "NaN") return NaN;
991
+ if (value === "-0") return -0;
992
+ if (value === "Infinity") return Infinity;
993
+ if (value === "-Infinity") return -Infinity;
994
+ return value;
995
+ case "array" /* Array */:
996
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
997
+ case "date" /* Date */:
998
+ return new Date(value);
999
+ case "map" /* Map */:
1000
+ const map = /* @__PURE__ */ new Map();
1001
+ for (const [key, val] of value) {
1002
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
1003
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
1004
+ map.set(deserializedKey, deserializedValue);
1005
+ }
1006
+ return map;
1007
+ case "object" /* Object */:
1008
+ const obj = {};
1009
+ for (const [key, val] of value) {
1010
+ obj[key] = _RemoteValue.fromLocalValue(val);
1011
+ }
1012
+ return obj;
1013
+ case "regexp" /* RegularExpression */:
1014
+ const { pattern, flags } = value;
1015
+ return new RegExp(pattern, flags);
1016
+ case "set" /* Set */:
1017
+ const set = /* @__PURE__ */ new Set();
1018
+ for (const item of value) {
1019
+ set.add(_RemoteValue.fromLocalValue(item));
1020
+ }
1021
+ return set;
1022
+ case "symbol" /* Symbol */:
1023
+ return Symbol(value);
1024
+ default:
1025
+ throw new Error(`Unsupported type: ${type}`);
1026
+ }
1027
+ }
1028
+ /**
1029
+ * Utility method to deserialize multiple LocalValues at once
1030
+ *
1031
+ * @param serializedValues Array of serialized LocalValue objects
1032
+ * @returns Array of deserialized JavaScript values
1033
+ */
1034
+ static fromLocalValueArray(serializedValues) {
1035
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
1036
+ }
1037
+ /**
1038
+ * Verifies if the given object matches the structure of a serialized LocalValue
1039
+ *
1040
+ * @param obj Object to verify
1041
+ * @returns boolean indicating if the object has LocalValue structure
1042
+ */
1043
+ static isLocalValueObject(obj) {
1044
+ if (typeof obj !== "object" || obj === null) {
1045
+ return false;
1046
+ }
1047
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1048
+ return false;
1049
+ }
1050
+ const type = obj[TYPE_CONSTANT];
1051
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1052
+ if (!hasTypeProperty) {
1053
+ return false;
1054
+ }
1055
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1056
+ return obj.hasOwnProperty(VALUE_CONSTANT);
1057
+ }
1058
+ return true;
1059
+ }
2684
1060
  };
2685
- createSupportsRuleRe("::slotted");
2686
- createSupportsRuleRe(":host");
2687
- createSupportsRuleRe(":host-context");
1061
+
1062
+ // src/utils/serialize.ts
1063
+ function decodeBase64Unicode(base64) {
1064
+ const binary = atob(base64);
1065
+ const bytes = new Uint8Array(binary.length);
1066
+ for (let i2 = 0; i2 < binary.length; i2++) {
1067
+ bytes[i2] = binary.charCodeAt(i2);
1068
+ }
1069
+ return new TextDecoder().decode(bytes);
1070
+ }
1071
+ function deserializeProperty(value) {
1072
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1073
+ return value;
1074
+ }
1075
+ return RemoteValue.fromLocalValue(JSON.parse(decodeBase64Unicode(value.slice(SERIALIZED_PREFIX.length))));
1076
+ }
1077
+
1078
+ // src/runtime/parse-property-value.ts
2688
1079
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2689
1080
  if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2690
1081
  propValue = deserializeProperty(propValue);
@@ -2788,6 +1179,36 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2788
1179
  plt.ael(elm, memberName, newValue, capture);
2789
1180
  }
2790
1181
  }
1182
+ } else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
1183
+ const propName = memberName.slice(5);
1184
+ let attrName;
1185
+ {
1186
+ const hostRef = getHostRef(elm);
1187
+ if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
1188
+ const memberMeta = hostRef.$cmpMeta$.$members$[propName];
1189
+ if (memberMeta && memberMeta[1]) {
1190
+ attrName = memberMeta[1];
1191
+ }
1192
+ }
1193
+ }
1194
+ if (!attrName) {
1195
+ attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1196
+ }
1197
+ if (newValue == null || newValue === false) {
1198
+ if (newValue !== false || elm.getAttribute(attrName) === "") {
1199
+ elm.removeAttribute(attrName);
1200
+ }
1201
+ } else {
1202
+ elm.setAttribute(attrName, newValue === true ? "" : newValue);
1203
+ }
1204
+ return;
1205
+ } else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
1206
+ const propName = memberName.slice(5);
1207
+ try {
1208
+ elm[propName] = newValue;
1209
+ } catch (e) {
1210
+ }
1211
+ return;
2791
1212
  } else {
2792
1213
  const isComplex = isComplexType(newValue);
2793
1214
  if ((isProp || isComplex && newValue !== null) && !isSvg) {
@@ -2796,7 +1217,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2796
1217
  const n = newValue == null ? "" : newValue;
2797
1218
  if (memberName === "list") {
2798
1219
  isProp = false;
2799
- } else if (oldValue == null || elm[memberName] != n) {
1220
+ } else if (oldValue == null || elm[memberName] !== n) {
2800
1221
  if (typeof elm.__lookupSetter__(memberName) === "function") {
2801
1222
  elm[memberName] = n;
2802
1223
  } else {
@@ -2884,16 +1305,14 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2884
1305
  let i2 = 0;
2885
1306
  let elm;
2886
1307
  let childNode;
2887
- if (newVNode2.$text$ !== null) {
1308
+ if (newVNode2.$text$ != null) {
2888
1309
  elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
2889
1310
  } else {
2890
1311
  if (!isSvgMode) {
2891
1312
  isSvgMode = newVNode2.$tag$ === "svg";
2892
1313
  }
2893
1314
  if (!win.document) {
2894
- throw new Error(
2895
- "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
2896
- );
1315
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
2897
1316
  }
2898
1317
  elm = newVNode2.$elm$ = win.document.createElementNS(
2899
1318
  isSvgMode ? SVG_NS : HTML_NS,
@@ -3058,7 +1477,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
3058
1477
  const newChildren = newVNode2.$children$;
3059
1478
  const tag = newVNode2.$tag$;
3060
1479
  const text = newVNode2.$text$;
3061
- if (text === null) {
1480
+ if (text == null) {
3062
1481
  {
3063
1482
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
3064
1483
  }
@@ -3087,8 +1506,10 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
3087
1506
  elm.data = text;
3088
1507
  }
3089
1508
  };
3090
- var insertBefore = (parent, newNode, reference) => {
3091
- {
1509
+ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
1510
+ if (parent.__insertBefore) {
1511
+ return parent.__insertBefore(newNode, reference);
1512
+ } else {
3092
1513
  return parent == null ? void 0 : parent.insertBefore(newNode, reference);
3093
1514
  }
3094
1515
  };
@@ -3167,8 +1588,8 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
3167
1588
  endSchedule();
3168
1589
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
3169
1590
  };
3170
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
3171
- console.error(err2);
1591
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
1592
+ console.error(err);
3172
1593
  fn();
3173
1594
  }) : fn();
3174
1595
  var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
@@ -3196,7 +1617,7 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
3196
1617
  if (childrenPromises.length === 0) {
3197
1618
  postUpdate();
3198
1619
  } else {
3199
- Promise.all(childrenPromises).then(postUpdate);
1620
+ Promise.all(childrenPromises).then(postUpdate).catch(postUpdate);
3200
1621
  hostRef.$flags$ |= 4 /* isWaitingForChildren */;
3201
1622
  childrenPromises.length = 0;
3202
1623
  }
@@ -3326,13 +1747,16 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
3326
1747
  });
3327
1748
  }
3328
1749
  }
3329
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1750
+ if (flags & 2 /* hasRendered */) {
3330
1751
  if (instance.componentShouldUpdate) {
3331
- if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1752
+ const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
1753
+ if (shouldUpdate === false && !(flags & 16 /* isQueuedForUpdate */)) {
3332
1754
  return;
3333
1755
  }
3334
1756
  }
3335
- scheduleUpdate(hostRef, false);
1757
+ if (!(flags & 16 /* isQueuedForUpdate */)) {
1758
+ scheduleUpdate(hostRef, false);
1759
+ }
3336
1760
  }
3337
1761
  }
3338
1762
  };
@@ -3344,7 +1768,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
3344
1768
  if (cmpMeta.$members$ || BUILD.propChangeCallback) {
3345
1769
  {
3346
1770
  if (Cstr.watchers && !cmpMeta.$watchers$) {
3347
- cmpMeta.$watchers$ = Cstr.watchers;
1771
+ cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
3348
1772
  }
3349
1773
  if (Cstr.deserializers && !cmpMeta.$deserializers$) {
3350
1774
  cmpMeta.$deserializers$ = Cstr.deserializers;
@@ -3356,7 +1780,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
3356
1780
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
3357
1781
  members.map(([memberName, [memberFlags]]) => {
3358
1782
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
3359
- const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
1783
+ const { get: origGetter, set: origSetter } = getPropertyDescriptor(prototype, memberName) || {};
3360
1784
  if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
3361
1785
  if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
3362
1786
  if (flags & 1 /* isElementConstructor */ || !origGetter) {
@@ -3459,11 +1883,13 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
3459
1883
  return;
3460
1884
  }
3461
1885
  const propFlags = members.find(([m]) => m === propName);
3462
- if (propFlags && propFlags[1][0] & 4 /* Boolean */) {
1886
+ const isBooleanTarget = propFlags && propFlags[1][0] & 4 /* Boolean */;
1887
+ const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
1888
+ if (isBooleanTarget) {
3463
1889
  newValue = newValue === null || newValue === "false" ? false : true;
3464
1890
  }
3465
1891
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
3466
- if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
1892
+ if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
3467
1893
  this[propName] = newValue;
3468
1894
  }
3469
1895
  });
@@ -3486,71 +1912,84 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
3486
1912
  // src/runtime/initialize-component.ts
3487
1913
  var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3488
1914
  let Cstr;
3489
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
3490
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
3491
- const bundleId = cmpMeta.$lazyBundleId$;
3492
- if (bundleId) {
3493
- const CstrImport = loadModule(cmpMeta, hostRef);
3494
- if (CstrImport && "then" in CstrImport) {
3495
- const endLoad = uniqueTime();
3496
- Cstr = await CstrImport;
3497
- endLoad();
3498
- } else {
3499
- Cstr = CstrImport;
3500
- }
3501
- if (!Cstr) {
3502
- throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
3503
- }
3504
- if (!Cstr.isProxied) {
1915
+ try {
1916
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1917
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1918
+ const bundleId = cmpMeta.$lazyBundleId$;
1919
+ if (bundleId) {
1920
+ const CstrImport = loadModule(cmpMeta, hostRef);
1921
+ if (CstrImport && "then" in CstrImport) {
1922
+ const endLoad = uniqueTime();
1923
+ Cstr = await CstrImport;
1924
+ endLoad();
1925
+ } else {
1926
+ Cstr = CstrImport;
1927
+ }
1928
+ if (!Cstr) {
1929
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
1930
+ }
1931
+ if (!Cstr.isProxied) {
1932
+ {
1933
+ cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
1934
+ cmpMeta.$serializers$ = Cstr.serializers;
1935
+ cmpMeta.$deserializers$ = Cstr.deserializers;
1936
+ }
1937
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1938
+ Cstr.isProxied = true;
1939
+ }
1940
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
3505
1941
  {
3506
- cmpMeta.$watchers$ = Cstr.watchers;
3507
- cmpMeta.$serializers$ = Cstr.serializers;
3508
- cmpMeta.$deserializers$ = Cstr.deserializers;
1942
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
3509
1943
  }
3510
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
3511
- Cstr.isProxied = true;
3512
- }
3513
- const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
3514
- {
3515
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
3516
- }
3517
- try {
3518
- new Cstr(hostRef);
3519
- } catch (e) {
3520
- consoleError(e, elm);
3521
- }
3522
- {
3523
- hostRef.$flags$ &= -9 /* isConstructingInstance */;
1944
+ try {
1945
+ new Cstr(hostRef);
1946
+ } catch (e) {
1947
+ consoleError(e, elm);
1948
+ }
1949
+ {
1950
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
1951
+ }
1952
+ {
1953
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1954
+ }
1955
+ endNewInstance();
1956
+ {
1957
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1958
+ }
1959
+ } else {
1960
+ Cstr = elm.constructor;
1961
+ const cmpTag = elm.localName;
1962
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
3524
1963
  }
3525
- {
3526
- hostRef.$flags$ |= 128 /* isWatchReady */;
1964
+ if (Cstr && Cstr.style) {
1965
+ let style;
1966
+ if (typeof Cstr.style === "string") {
1967
+ style = Cstr.style;
1968
+ }
1969
+ const scopeId2 = getScopeId(cmpMeta);
1970
+ if (!styles.has(scopeId2) || BUILD.hotModuleReplacement) {
1971
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1972
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1973
+ endRegisterStyles();
1974
+ }
3527
1975
  }
3528
- endNewInstance();
3529
- fireConnectedCallback(hostRef.$lazyInstance$, elm);
1976
+ }
1977
+ const ancestorComponent = hostRef.$ancestorComponent$;
1978
+ const schedule = () => scheduleUpdate(hostRef, true);
1979
+ if (ancestorComponent && ancestorComponent["s-rc"]) {
1980
+ ancestorComponent["s-rc"].push(schedule);
3530
1981
  } else {
3531
- Cstr = elm.constructor;
3532
- const cmpTag = elm.localName;
3533
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1982
+ schedule();
3534
1983
  }
3535
- if (Cstr && Cstr.style) {
3536
- let style;
3537
- if (typeof Cstr.style === "string") {
3538
- style = Cstr.style;
3539
- }
3540
- const scopeId2 = getScopeId(cmpMeta);
3541
- if (!styles.has(scopeId2) || BUILD.hotModuleReplacement) {
3542
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
3543
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
3544
- endRegisterStyles();
3545
- }
1984
+ } catch (e) {
1985
+ consoleError(e, elm);
1986
+ if (hostRef.$onRenderResolve$) {
1987
+ hostRef.$onRenderResolve$();
1988
+ hostRef.$onRenderResolve$ = void 0;
1989
+ }
1990
+ if (hostRef.$onReadyResolve$) {
1991
+ hostRef.$onReadyResolve$(elm);
3546
1992
  }
3547
- }
3548
- const ancestorComponent = hostRef.$ancestorComponent$;
3549
- const schedule = () => scheduleUpdate(hostRef, true);
3550
- if (ancestorComponent && ancestorComponent["s-rc"]) {
3551
- ancestorComponent["s-rc"].push(schedule);
3552
- } else {
3553
- schedule();
3554
1993
  }
3555
1994
  };
3556
1995
  var fireConnectedCallback = (instance, elm) => {
@@ -3592,7 +2031,7 @@ var connectedCallback = (elm) => {
3592
2031
  }
3593
2032
  if (cmpMeta.$members$) {
3594
2033
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
3595
- if (memberFlags & 31 /* Prop */ && memberName in elm && elm[memberName] !== Object.prototype[memberName]) {
2034
+ if (memberFlags & 31 /* Prop */ && Object.prototype.hasOwnProperty.call(elm, memberName)) {
3596
2035
  const value = elm[memberName];
3597
2036
  delete elm[memberName];
3598
2037
  elm[memberName] = value;
@@ -3659,33 +2098,31 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3659
2098
  {
3660
2099
  hydrateScopedToShadow();
3661
2100
  }
3662
- let hasSlotRelocation = false;
3663
2101
  lazyBundles.map((lazyBundle) => {
3664
2102
  lazyBundle[1].map((compactMeta) => {
3665
- var _a2, _b, _c;
2103
+ var _a2, _b;
3666
2104
  const cmpMeta = {
3667
2105
  $flags$: compactMeta[0],
3668
2106
  $tagName$: compactMeta[1],
3669
2107
  $members$: compactMeta[2],
3670
2108
  $listeners$: compactMeta[3]
3671
2109
  };
3672
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
3673
- hasSlotRelocation = true;
3674
- }
3675
2110
  {
3676
2111
  cmpMeta.$members$ = compactMeta[2];
3677
2112
  }
3678
2113
  {
3679
- cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
3680
- cmpMeta.$serializers$ = (_b = compactMeta[5]) != null ? _b : {};
3681
- cmpMeta.$deserializers$ = (_c = compactMeta[6]) != null ? _c : {};
2114
+ cmpMeta.$watchers$ = normalizeWatchers(compactMeta[4]);
2115
+ cmpMeta.$serializers$ = (_a2 = compactMeta[5]) != null ? _a2 : {};
2116
+ cmpMeta.$deserializers$ = (_b = compactMeta[6]) != null ? _b : {};
3682
2117
  }
3683
2118
  const tagName = transformTag(cmpMeta.$tagName$);
3684
2119
  const HostElement = class extends HTMLElement {
2120
+ ["s-p"];
2121
+ ["s-rc"];
2122
+ hasRegisteredEventListeners = false;
3685
2123
  // StencilLazyHost
3686
2124
  constructor(self) {
3687
2125
  super(self);
3688
- this.hasRegisteredEventListeners = false;
3689
2126
  self = this;
3690
2127
  registerHost(self, cmpMeta);
3691
2128
  if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
@@ -3753,9 +2190,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3753
2190
  });
3754
2191
  });
3755
2192
  if (cmpTags.length > 0) {
3756
- if (hasSlotRelocation) {
3757
- dataStyles.textContent += SLOT_FB_CSS;
3758
- }
3759
2193
  {
3760
2194
  dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
3761
2195
  }