@authhero/widget 0.7.0 → 0.7.2

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.
@@ -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.41.1 | MIT Licensed | https://stenciljs.com
7
+ Stencil Client Platform v4.41.3 | 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
-
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
9
 
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";
@@ -455,1526 +210,6 @@ var flush = () => {
455
210
  };
456
211
  var nextTick = (cb) => promiseResolve().then(cb);
457
212
  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) {
1913
- return false;
1914
- }
1915
- if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1916
- return obj.hasOwnProperty(VALUE_CONSTANT);
1917
- }
1918
- return true;
1919
- }
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));
1946
- } else {
1947
- return ok(val);
1948
- }
1949
- }
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
- };
1963
- var unwrapErr = (result) => {
1964
- if (result.isErr) {
1965
- return result.value;
1966
- } else {
1967
- throw result.value;
1968
- }
1969
- };
1970
-
1971
- // src/utils/serialize.ts
1972
- function deserializeProperty(value) {
1973
- if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1974
- return value;
1975
- }
1976
- return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
1977
- }
1978
213
 
1979
214
  // src/utils/style.ts
1980
215
  function createStyleSheetIfNeededAndSupported(styles2) {
@@ -2006,20 +241,6 @@ var getSlottedChildNodes = (childNodes) => {
2006
241
  }
2007
242
  return result;
2008
243
  };
2009
- function getHostSlotNodes(childNodes, hostName, slotName) {
2010
- let i2 = 0;
2011
- let slottedNodes = [];
2012
- let childNode;
2013
- for (; i2 < childNodes.length; i2++) {
2014
- childNode = childNodes[i2];
2015
- if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
2016
- slottedNodes.push(childNode);
2017
- if (typeof slotName !== "undefined") return slottedNodes;
2018
- }
2019
- slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
2020
- }
2021
- return slottedNodes;
2022
- }
2023
244
  var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
2024
245
  if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
2025
246
  return;
@@ -2076,18 +297,6 @@ function patchSlotNode(node) {
2076
297
  node.assignedElements = assignedFactory(true);
2077
298
  node.assignedNodes = assignedFactory(false);
2078
299
  }
2079
- function dispatchSlotChangeEvent(elm) {
2080
- elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
2081
- }
2082
- function findSlotFromSlottedNode(slottedNode, parentHost) {
2083
- var _a;
2084
- parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
2085
- if (!parentHost) return { slotNode: null, slotName: "" };
2086
- const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
2087
- const childNodes = internalCall(parentHost, "childNodes");
2088
- const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
2089
- return { slotNode, slotName };
2090
- }
2091
300
  function internalCall(node, method) {
2092
301
  if ("__" + method in node) {
2093
302
  const toReturn = node["__" + method];
@@ -2112,6 +321,14 @@ var uniqueTime = (key, measureText) => {
2112
321
  };
2113
322
  }
2114
323
  };
324
+
325
+ // src/utils/query-nonce-meta-tag-content.ts
326
+ function queryNonceMetaTagContent(doc) {
327
+ var _a, _b, _c;
328
+ 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;
329
+ }
330
+
331
+ // src/runtime/styles.ts
2115
332
  var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2116
333
  var registerStyle = (scopeId2, cssText, allowCS) => {
2117
334
  let style = styles.get(scopeId2);
@@ -2145,10 +362,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2145
362
  }
2146
363
  const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
2147
364
  if (existingStyleElm) {
2148
- existingStyleElm.innerHTML = style;
365
+ existingStyleElm.textContent = style;
2149
366
  } else if (!appliedStyles.has(scopeId2)) {
2150
367
  styleElm = win.document.createElement("style");
2151
- styleElm.innerHTML = style;
368
+ styleElm.textContent = style;
2152
369
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2153
370
  if (nonce != null) {
2154
371
  styleElm.setAttribute("nonce", nonce);
@@ -2174,7 +391,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2174
391
  } else {
2175
392
  const existingStyleContainer = styleContainerNode.querySelector("style");
2176
393
  if (existingStyleContainer) {
2177
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
394
+ existingStyleContainer.textContent = style + existingStyleContainer.textContent;
2178
395
  } else {
2179
396
  styleContainerNode.prepend(styleElm);
2180
397
  }
@@ -2187,7 +404,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2187
404
  styleContainerNode.insertBefore(styleElm, null);
2188
405
  }
2189
406
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2190
- styleElm.innerHTML += SLOT_FB_CSS;
407
+ styleElm.textContent += SLOT_FB_CSS;
2191
408
  }
2192
409
  if (appliedStyles) {
2193
410
  appliedStyles.add(scopeId2);
@@ -2246,6 +463,12 @@ var hydrateScopedToShadow = () => {
2246
463
  registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2247
464
  }
2248
465
  };
466
+ var isComplexType = (o) => {
467
+ o = typeof o;
468
+ return o === "object" || o === "function";
469
+ };
470
+
471
+ // src/runtime/vdom/h.ts
2249
472
  var h = (nodeName, vnodeData, ...children) => {
2250
473
  if (typeof nodeName === "string") {
2251
474
  nodeName = transformTag(nodeName);
@@ -2299,7 +522,8 @@ var newVNode = (tag, text) => {
2299
522
  const vnode = {
2300
523
  $flags$: 0,
2301
524
  $tag$: tag,
2302
- $text$: text,
525
+ // Normalize undefined to null to prevent rendering "undefined" as text
526
+ $text$: text != null ? text : null,
2303
527
  $elm$: null,
2304
528
  $children$: null
2305
529
  };
@@ -2360,7 +584,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
2360
584
  cmpMeta.$cmpMeta$);
2361
585
  const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
2362
586
  if (styleSheet) {
2363
- hostElm.shadowRoot.append(styleSheet.cloneNode(true));
587
+ shadowRootNodes.unshift(styleSheet.cloneNode(true));
2364
588
  }
2365
589
  }
2366
590
  }
@@ -2430,7 +654,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
2430
654
  currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
2431
655
  }
2432
656
  }
2433
- if (shadowRoot) {
657
+ if (shadowRoot && !shadowRoot.childNodes.length) {
2434
658
  let rnIdex = 0;
2435
659
  const rnLen = shadowRootNodes.length;
2436
660
  if (rnLen) {
@@ -2701,18 +925,111 @@ var findCorrespondingNode = (node, type) => {
2701
925
  } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
2702
926
  return sibling;
2703
927
  };
2704
- var createSupportsRuleRe = (selector) => {
2705
- const safeSelector2 = escapeRegExpSpecialCharacters(selector);
2706
- return new RegExp(
2707
- // First capture group: match any context before the selector that's not inside @supports selector()
2708
- // Using negative lookahead to avoid matching inside @supports selector(...) condition
2709
- `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
2710
- "g"
2711
- );
928
+
929
+ // src/utils/remote-value.ts
930
+ var RemoteValue = class _RemoteValue {
931
+ /**
932
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
933
+ *
934
+ * @param serialized The serialized LocalValue object
935
+ * @returns The original JavaScript value/object
936
+ */
937
+ static fromLocalValue(serialized) {
938
+ const type = serialized[TYPE_CONSTANT];
939
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
940
+ switch (type) {
941
+ case "string" /* String */:
942
+ return value;
943
+ case "boolean" /* Boolean */:
944
+ return value;
945
+ case "bigint" /* BigInt */:
946
+ return BigInt(value);
947
+ case "undefined" /* Undefined */:
948
+ return void 0;
949
+ case "null" /* Null */:
950
+ return null;
951
+ case "number" /* Number */:
952
+ if (value === "NaN") return NaN;
953
+ if (value === "-0") return -0;
954
+ if (value === "Infinity") return Infinity;
955
+ if (value === "-Infinity") return -Infinity;
956
+ return value;
957
+ case "array" /* Array */:
958
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
959
+ case "date" /* Date */:
960
+ return new Date(value);
961
+ case "map" /* Map */:
962
+ const map = /* @__PURE__ */ new Map();
963
+ for (const [key, val] of value) {
964
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
965
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
966
+ map.set(deserializedKey, deserializedValue);
967
+ }
968
+ return map;
969
+ case "object" /* Object */:
970
+ const obj = {};
971
+ for (const [key, val] of value) {
972
+ obj[key] = _RemoteValue.fromLocalValue(val);
973
+ }
974
+ return obj;
975
+ case "regexp" /* RegularExpression */:
976
+ const { pattern, flags } = value;
977
+ return new RegExp(pattern, flags);
978
+ case "set" /* Set */:
979
+ const set = /* @__PURE__ */ new Set();
980
+ for (const item of value) {
981
+ set.add(_RemoteValue.fromLocalValue(item));
982
+ }
983
+ return set;
984
+ case "symbol" /* Symbol */:
985
+ return Symbol(value);
986
+ default:
987
+ throw new Error(`Unsupported type: ${type}`);
988
+ }
989
+ }
990
+ /**
991
+ * Utility method to deserialize multiple LocalValues at once
992
+ *
993
+ * @param serializedValues Array of serialized LocalValue objects
994
+ * @returns Array of deserialized JavaScript values
995
+ */
996
+ static fromLocalValueArray(serializedValues) {
997
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
998
+ }
999
+ /**
1000
+ * Verifies if the given object matches the structure of a serialized LocalValue
1001
+ *
1002
+ * @param obj Object to verify
1003
+ * @returns boolean indicating if the object has LocalValue structure
1004
+ */
1005
+ static isLocalValueObject(obj) {
1006
+ if (typeof obj !== "object" || obj === null) {
1007
+ return false;
1008
+ }
1009
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1010
+ return false;
1011
+ }
1012
+ const type = obj[TYPE_CONSTANT];
1013
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1014
+ if (!hasTypeProperty) {
1015
+ return false;
1016
+ }
1017
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1018
+ return obj.hasOwnProperty(VALUE_CONSTANT);
1019
+ }
1020
+ return true;
1021
+ }
2712
1022
  };
2713
- createSupportsRuleRe("::slotted");
2714
- createSupportsRuleRe(":host");
2715
- createSupportsRuleRe(":host-context");
1023
+
1024
+ // src/utils/serialize.ts
1025
+ function deserializeProperty(value) {
1026
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1027
+ return value;
1028
+ }
1029
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
1030
+ }
1031
+
1032
+ // src/runtime/parse-property-value.ts
2716
1033
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2717
1034
  if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2718
1035
  propValue = deserializeProperty(propValue);
@@ -2891,16 +1208,14 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2891
1208
  let i2 = 0;
2892
1209
  let elm;
2893
1210
  let childNode;
2894
- if (newVNode2.$text$ !== null) {
1211
+ if (newVNode2.$text$ != null) {
2895
1212
  elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
2896
1213
  } else {
2897
1214
  if (!isSvgMode) {
2898
1215
  isSvgMode = newVNode2.$tag$ === "svg";
2899
1216
  }
2900
1217
  if (!win.document) {
2901
- throw new Error(
2902
- "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."
2903
- );
1218
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
2904
1219
  }
2905
1220
  elm = newVNode2.$elm$ = win.document.createElementNS(
2906
1221
  isSvgMode ? SVG_NS : HTML_NS,
@@ -3065,7 +1380,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
3065
1380
  const newChildren = newVNode2.$children$;
3066
1381
  const tag = newVNode2.$tag$;
3067
1382
  const text = newVNode2.$text$;
3068
- if (text === null) {
1383
+ if (text == null) {
3069
1384
  {
3070
1385
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
3071
1386
  }
@@ -3095,12 +1410,6 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
3095
1410
  }
3096
1411
  };
3097
1412
  var insertBefore = (parent, newNode, reference, isInitialLoad) => {
3098
- if (typeof newNode["s-sn"] === "string") {
3099
- parent.insertBefore(newNode, reference);
3100
- const { slotNode } = findSlotFromSlottedNode(newNode);
3101
- if (slotNode && true) dispatchSlotChangeEvent(slotNode);
3102
- return newNode;
3103
- }
3104
1413
  if (parent.__insertBefore) {
3105
1414
  return parent.__insertBefore(newNode, reference);
3106
1415
  } else {
@@ -3182,8 +1491,8 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
3182
1491
  endSchedule();
3183
1492
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
3184
1493
  };
3185
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
3186
- console.error(err2);
1494
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
1495
+ console.error(err);
3187
1496
  fn();
3188
1497
  }) : fn();
3189
1498
  var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
@@ -3676,7 +1985,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3676
1985
  {
3677
1986
  hydrateScopedToShadow();
3678
1987
  }
3679
- let hasSlotRelocation = false;
3680
1988
  lazyBundles.map((lazyBundle) => {
3681
1989
  lazyBundle[1].map((compactMeta) => {
3682
1990
  var _a2, _b, _c;
@@ -3686,9 +1994,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3686
1994
  $members$: compactMeta[2],
3687
1995
  $listeners$: compactMeta[3]
3688
1996
  };
3689
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
3690
- hasSlotRelocation = true;
3691
- }
3692
1997
  {
3693
1998
  cmpMeta.$members$ = compactMeta[2];
3694
1999
  }
@@ -3772,9 +2077,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3772
2077
  });
3773
2078
  });
3774
2079
  if (cmpTags.length > 0) {
3775
- if (hasSlotRelocation) {
3776
- dataStyles.textContent += SLOT_FB_CSS;
3777
- }
3778
2080
  {
3779
2081
  dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
3780
2082
  }