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