@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.
@@ -2,254 +2,9 @@ const NAMESPACE = 'authhero-widget';
2
2
  const BUILD = /* authhero-widget */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.41.1 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.41.3 | MIT Licensed | https://stenciljs.com
6
6
  */
7
- var __create = Object.create;
8
- var __defProp = Object.defineProperty;
9
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
- var __getOwnPropNames = Object.getOwnPropertyNames;
11
- var __getProtoOf = Object.getPrototypeOf;
12
- var __hasOwnProp = Object.prototype.hasOwnProperty;
13
- var __typeError = (msg) => {
14
- throw TypeError(msg);
15
- };
16
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
- var __commonJS = (cb, mod) => function __require() {
18
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, { get: all[name], enumerable: true });
23
- };
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (let key of __getOwnPropNames(from))
27
- if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
- }
30
- return to;
31
- };
32
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
33
- // If the importer is in node compatibility mode or this is not an ESM
34
- // file that has been converted to a CommonJS file using a Babel-
35
- // compatible transform (i.e. "__esModule" has not been set), then set
36
- // "default" to the CommonJS "module.exports" for node compatibility.
37
- __defProp(target, "default", { value: mod, enumerable: true }) ,
38
- mod
39
- ));
40
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
41
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
42
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
43
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
44
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
45
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
46
-
47
- // node_modules/balanced-match/index.js
48
- var require_balanced_match = __commonJS({
49
- "node_modules/balanced-match/index.js"(exports, module) {
50
- module.exports = balanced;
51
- function balanced(a, b, str) {
52
- if (a instanceof RegExp) a = maybeMatch(a, str);
53
- if (b instanceof RegExp) b = maybeMatch(b, str);
54
- var r = range(a, b, str);
55
- return r && {
56
- start: r[0],
57
- end: r[1],
58
- pre: str.slice(0, r[0]),
59
- body: str.slice(r[0] + a.length, r[1]),
60
- post: str.slice(r[1] + b.length)
61
- };
62
- }
63
- function maybeMatch(reg, str) {
64
- var m = str.match(reg);
65
- return m ? m[0] : null;
66
- }
67
- balanced.range = range;
68
- function range(a, b, str) {
69
- var begs, beg, left, right, result;
70
- var ai = str.indexOf(a);
71
- var bi = str.indexOf(b, ai + 1);
72
- var i2 = ai;
73
- if (ai >= 0 && bi > 0) {
74
- if (a === b) {
75
- return [ai, bi];
76
- }
77
- begs = [];
78
- left = str.length;
79
- while (i2 >= 0 && !result) {
80
- if (i2 == ai) {
81
- begs.push(i2);
82
- ai = str.indexOf(a, i2 + 1);
83
- } else if (begs.length == 1) {
84
- result = [begs.pop(), bi];
85
- } else {
86
- beg = begs.pop();
87
- if (beg < left) {
88
- left = beg;
89
- right = bi;
90
- }
91
- bi = str.indexOf(b, i2 + 1);
92
- }
93
- i2 = ai < bi && ai >= 0 ? ai : bi;
94
- }
95
- if (begs.length) {
96
- result = [left, right];
97
- }
98
- }
99
- return result;
100
- }
101
- }
102
- });
103
7
 
104
- // node_modules/brace-expansion/index.js
105
- var require_brace_expansion = __commonJS({
106
- "node_modules/brace-expansion/index.js"(exports, module) {
107
- var balanced = require_balanced_match();
108
- module.exports = expandTop;
109
- var escSlash = "\0SLASH" + Math.random() + "\0";
110
- var escOpen = "\0OPEN" + Math.random() + "\0";
111
- var escClose = "\0CLOSE" + Math.random() + "\0";
112
- var escComma = "\0COMMA" + Math.random() + "\0";
113
- var escPeriod = "\0PERIOD" + Math.random() + "\0";
114
- function numeric(str) {
115
- return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
116
- }
117
- function escapeBraces(str) {
118
- return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
119
- }
120
- function unescapeBraces(str) {
121
- return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
122
- }
123
- function parseCommaParts(str) {
124
- if (!str)
125
- return [""];
126
- var parts = [];
127
- var m = balanced("{", "}", str);
128
- if (!m)
129
- return str.split(",");
130
- var pre = m.pre;
131
- var body = m.body;
132
- var post = m.post;
133
- var p = pre.split(",");
134
- p[p.length - 1] += "{" + body + "}";
135
- var postParts = parseCommaParts(post);
136
- if (post.length) {
137
- p[p.length - 1] += postParts.shift();
138
- p.push.apply(p, postParts);
139
- }
140
- parts.push.apply(parts, p);
141
- return parts;
142
- }
143
- function expandTop(str) {
144
- if (!str)
145
- return [];
146
- if (str.substr(0, 2) === "{}") {
147
- str = "\\{\\}" + str.substr(2);
148
- }
149
- return expand2(escapeBraces(str), true).map(unescapeBraces);
150
- }
151
- function embrace(str) {
152
- return "{" + str + "}";
153
- }
154
- function isPadded(el) {
155
- return /^-?0\d/.test(el);
156
- }
157
- function lte(i2, y) {
158
- return i2 <= y;
159
- }
160
- function gte(i2, y) {
161
- return i2 >= y;
162
- }
163
- function expand2(str, isTop) {
164
- var expansions = [];
165
- var m = balanced("{", "}", str);
166
- if (!m) return [str];
167
- var pre = m.pre;
168
- var post = m.post.length ? expand2(m.post, false) : [""];
169
- if (/\$$/.test(m.pre)) {
170
- for (var k = 0; k < post.length; k++) {
171
- var expansion = pre + "{" + m.body + "}" + post[k];
172
- expansions.push(expansion);
173
- }
174
- } else {
175
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
176
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
177
- var isSequence = isNumericSequence || isAlphaSequence;
178
- var isOptions = m.body.indexOf(",") >= 0;
179
- if (!isSequence && !isOptions) {
180
- if (m.post.match(/,(?!,).*\}/)) {
181
- str = m.pre + "{" + m.body + escClose + m.post;
182
- return expand2(str);
183
- }
184
- return [str];
185
- }
186
- var n;
187
- if (isSequence) {
188
- n = m.body.split(/\.\./);
189
- } else {
190
- n = parseCommaParts(m.body);
191
- if (n.length === 1) {
192
- n = expand2(n[0], false).map(embrace);
193
- if (n.length === 1) {
194
- return post.map(function(p) {
195
- return m.pre + n[0] + p;
196
- });
197
- }
198
- }
199
- }
200
- var N;
201
- if (isSequence) {
202
- var x = numeric(n[0]);
203
- var y = numeric(n[1]);
204
- var width = Math.max(n[0].length, n[1].length);
205
- var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
206
- var test = lte;
207
- var reverse = y < x;
208
- if (reverse) {
209
- incr *= -1;
210
- test = gte;
211
- }
212
- var pad = n.some(isPadded);
213
- N = [];
214
- for (var i2 = x; test(i2, y); i2 += incr) {
215
- var c;
216
- if (isAlphaSequence) {
217
- c = String.fromCharCode(i2);
218
- if (c === "\\")
219
- c = "";
220
- } else {
221
- c = String(i2);
222
- if (pad) {
223
- var need = width - c.length;
224
- if (need > 0) {
225
- var z = new Array(need + 1).join("0");
226
- if (i2 < 0)
227
- c = "-" + z + c.slice(1);
228
- else
229
- c = z + c;
230
- }
231
- }
232
- }
233
- N.push(c);
234
- }
235
- } else {
236
- N = [];
237
- for (var j = 0; j < n.length; j++) {
238
- N.push.apply(N, expand2(n[j], false));
239
- }
240
- }
241
- for (var j = 0; j < N.length; j++) {
242
- for (var k = 0; k < post.length; k++) {
243
- var expansion = pre + N[j] + post[k];
244
- if (!isTop || isSequence || expansion)
245
- expansions.push(expansion);
246
- }
247
- }
248
- }
249
- return expansions;
250
- }
251
- }
252
- });
253
8
 
254
9
  // src/utils/constants.ts
255
10
  var SVG_NS = "http://www.w3.org/2000/svg";
@@ -453,1526 +208,6 @@ var flush = () => {
453
208
  };
454
209
  var nextTick = (cb) => promiseResolve().then(cb);
455
210
  var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
456
- var isComplexType = (o) => {
457
- o = typeof o;
458
- return o === "object" || o === "function";
459
- };
460
-
461
- // node_modules/minimatch/dist/esm/index.js
462
- var import_brace_expansion = __toESM(require_brace_expansion());
463
-
464
- // node_modules/minimatch/dist/esm/assert-valid-pattern.js
465
- var MAX_PATTERN_LENGTH = 1024 * 64;
466
- var assertValidPattern = (pattern) => {
467
- if (typeof pattern !== "string") {
468
- throw new TypeError("invalid pattern");
469
- }
470
- if (pattern.length > MAX_PATTERN_LENGTH) {
471
- throw new TypeError("pattern is too long");
472
- }
473
- };
474
-
475
- // node_modules/minimatch/dist/esm/brace-expressions.js
476
- var posixClasses = {
477
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
478
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
479
- "[:ascii:]": ["\\x00-\\x7f", false],
480
- "[:blank:]": ["\\p{Zs}\\t", true],
481
- "[:cntrl:]": ["\\p{Cc}", true],
482
- "[:digit:]": ["\\p{Nd}", true],
483
- "[:graph:]": ["\\p{Z}\\p{C}", true, true],
484
- "[:lower:]": ["\\p{Ll}", true],
485
- "[:print:]": ["\\p{C}", true],
486
- "[:punct:]": ["\\p{P}", true],
487
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
488
- "[:upper:]": ["\\p{Lu}", true],
489
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
490
- "[:xdigit:]": ["A-Fa-f0-9", false]
491
- };
492
- var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
493
- var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
494
- var rangesToString = (ranges) => ranges.join("");
495
- var parseClass = (glob, position) => {
496
- const pos = position;
497
- if (glob.charAt(pos) !== "[") {
498
- throw new Error("not in a brace expression");
499
- }
500
- const ranges = [];
501
- const negs = [];
502
- let i2 = pos + 1;
503
- let sawStart = false;
504
- let uflag = false;
505
- let escaping = false;
506
- let negate = false;
507
- let endPos = pos;
508
- let rangeStart = "";
509
- WHILE: while (i2 < glob.length) {
510
- const c = glob.charAt(i2);
511
- if ((c === "!" || c === "^") && i2 === pos + 1) {
512
- negate = true;
513
- i2++;
514
- continue;
515
- }
516
- if (c === "]" && sawStart && !escaping) {
517
- endPos = i2 + 1;
518
- break;
519
- }
520
- sawStart = true;
521
- if (c === "\\") {
522
- if (!escaping) {
523
- escaping = true;
524
- i2++;
525
- continue;
526
- }
527
- }
528
- if (c === "[" && !escaping) {
529
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
530
- if (glob.startsWith(cls, i2)) {
531
- if (rangeStart) {
532
- return ["$.", false, glob.length - pos, true];
533
- }
534
- i2 += cls.length;
535
- if (neg)
536
- negs.push(unip);
537
- else
538
- ranges.push(unip);
539
- uflag = uflag || u;
540
- continue WHILE;
541
- }
542
- }
543
- }
544
- escaping = false;
545
- if (rangeStart) {
546
- if (c > rangeStart) {
547
- ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
548
- } else if (c === rangeStart) {
549
- ranges.push(braceEscape(c));
550
- }
551
- rangeStart = "";
552
- i2++;
553
- continue;
554
- }
555
- if (glob.startsWith("-]", i2 + 1)) {
556
- ranges.push(braceEscape(c + "-"));
557
- i2 += 2;
558
- continue;
559
- }
560
- if (glob.startsWith("-", i2 + 1)) {
561
- rangeStart = c;
562
- i2 += 2;
563
- continue;
564
- }
565
- ranges.push(braceEscape(c));
566
- i2++;
567
- }
568
- if (endPos < i2) {
569
- return ["", false, 0, false];
570
- }
571
- if (!ranges.length && !negs.length) {
572
- return ["$.", false, glob.length - pos, true];
573
- }
574
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
575
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
576
- return [regexpEscape(r), false, endPos - pos, false];
577
- }
578
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
579
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
580
- const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
581
- return [comb, uflag, endPos - pos, true];
582
- };
583
-
584
- // node_modules/minimatch/dist/esm/unescape.js
585
- var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
586
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
587
- };
588
-
589
- // node_modules/minimatch/dist/esm/ast.js
590
- var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
591
- var isExtglobType = (c) => types.has(c);
592
- var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
593
- var startNoDot = "(?!\\.)";
594
- var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
595
- var justDots = /* @__PURE__ */ new Set(["..", "."]);
596
- var reSpecials = new Set("().*{}+?[]^$\\!");
597
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
598
- var qmark = "[^/]";
599
- var star = qmark + "*?";
600
- var starNoEmpty = qmark + "+?";
601
- var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
602
- var _AST = class _AST {
603
- constructor(type, parent, options = {}) {
604
- __privateAdd(this, _AST_instances);
605
- __publicField(this, "type");
606
- __privateAdd(this, _root);
607
- __privateAdd(this, _hasMagic);
608
- __privateAdd(this, _uflag, false);
609
- __privateAdd(this, _parts, []);
610
- __privateAdd(this, _parent);
611
- __privateAdd(this, _parentIndex);
612
- __privateAdd(this, _negs);
613
- __privateAdd(this, _filledNegs, false);
614
- __privateAdd(this, _options);
615
- __privateAdd(this, _toString);
616
- // set to true if it's an extglob with no children
617
- // (which really means one child of '')
618
- __privateAdd(this, _emptyExt, false);
619
- this.type = type;
620
- if (type)
621
- __privateSet(this, _hasMagic, true);
622
- __privateSet(this, _parent, parent);
623
- __privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
624
- __privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
625
- __privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
626
- if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
627
- __privateGet(this, _negs).push(this);
628
- __privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
629
- }
630
- get hasMagic() {
631
- if (__privateGet(this, _hasMagic) !== void 0)
632
- return __privateGet(this, _hasMagic);
633
- for (const p of __privateGet(this, _parts)) {
634
- if (typeof p === "string")
635
- continue;
636
- if (p.type || p.hasMagic)
637
- return __privateSet(this, _hasMagic, true);
638
- }
639
- return __privateGet(this, _hasMagic);
640
- }
641
- // reconstructs the pattern
642
- toString() {
643
- if (__privateGet(this, _toString) !== void 0)
644
- return __privateGet(this, _toString);
645
- if (!this.type) {
646
- return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
647
- } else {
648
- return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
649
- }
650
- }
651
- push(...parts) {
652
- for (const p of parts) {
653
- if (p === "")
654
- continue;
655
- if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
656
- throw new Error("invalid part: " + p);
657
- }
658
- __privateGet(this, _parts).push(p);
659
- }
660
- }
661
- toJSON() {
662
- var _a;
663
- const ret = this.type === null ? __privateGet(this, _parts).slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...__privateGet(this, _parts).map((p) => p.toJSON())];
664
- if (this.isStart() && !this.type)
665
- ret.unshift([]);
666
- if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
667
- ret.push({});
668
- }
669
- return ret;
670
- }
671
- isStart() {
672
- var _a;
673
- if (__privateGet(this, _root) === this)
674
- return true;
675
- if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
676
- return false;
677
- if (__privateGet(this, _parentIndex) === 0)
678
- return true;
679
- const p = __privateGet(this, _parent);
680
- for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
681
- const pp = __privateGet(p, _parts)[i2];
682
- if (!(pp instanceof _AST && pp.type === "!")) {
683
- return false;
684
- }
685
- }
686
- return true;
687
- }
688
- isEnd() {
689
- var _a, _b, _c;
690
- if (__privateGet(this, _root) === this)
691
- return true;
692
- if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
693
- return true;
694
- if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
695
- return false;
696
- if (!this.type)
697
- return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
698
- const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
699
- return __privateGet(this, _parentIndex) === pl - 1;
700
- }
701
- copyIn(part) {
702
- if (typeof part === "string")
703
- this.push(part);
704
- else
705
- this.push(part.clone(this));
706
- }
707
- clone(parent) {
708
- const c = new _AST(this.type, parent);
709
- for (const p of __privateGet(this, _parts)) {
710
- c.copyIn(p);
711
- }
712
- return c;
713
- }
714
- static fromGlob(pattern, options = {}) {
715
- var _a;
716
- const ast = new _AST(null, void 0, options);
717
- __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
718
- return ast;
719
- }
720
- // returns the regular expression if there's magic, or the unescaped
721
- // string if not.
722
- toMMPattern() {
723
- if (this !== __privateGet(this, _root))
724
- return __privateGet(this, _root).toMMPattern();
725
- const glob = this.toString();
726
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
727
- const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
728
- if (!anyMagic) {
729
- return body;
730
- }
731
- const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
732
- return Object.assign(new RegExp(`^${re}$`, flags), {
733
- _src: re,
734
- _glob: glob
735
- });
736
- }
737
- get options() {
738
- return __privateGet(this, _options);
739
- }
740
- // returns the string match, the regexp source, whether there's magic
741
- // in the regexp (so a regular expression is required) and whether or
742
- // not the uflag is needed for the regular expression (for posix classes)
743
- // TODO: instead of injecting the start/end at this point, just return
744
- // the BODY of the regexp, along with the start/end portions suitable
745
- // for binding the start/end in either a joined full-path makeRe context
746
- // (where we bind to (^|/), or a standalone matchPart context (where
747
- // we bind to ^, and not /). Otherwise slashes get duped!
748
- //
749
- // In part-matching mode, the start is:
750
- // - if not isStart: nothing
751
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
752
- // - if dots allowed or not possible: ^
753
- // - if dots possible and not allowed: ^(?!\.)
754
- // end is:
755
- // - if not isEnd(): nothing
756
- // - else: $
757
- //
758
- // In full-path matching mode, we put the slash at the START of the
759
- // pattern, so start is:
760
- // - if first pattern: same as part-matching mode
761
- // - if not isStart(): nothing
762
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
763
- // - if dots allowed or not possible: /
764
- // - if dots possible and not allowed: /(?!\.)
765
- // end is:
766
- // - if last pattern, same as part-matching mode
767
- // - else nothing
768
- //
769
- // Always put the (?:$|/) on negated tails, though, because that has to be
770
- // there to bind the end of the negated pattern portion, and it's easier to
771
- // just stick it in now rather than try to inject it later in the middle of
772
- // the pattern.
773
- //
774
- // We can just always return the same end, and leave it up to the caller
775
- // to know whether it's going to be used joined or in parts.
776
- // And, if the start is adjusted slightly, can do the same there:
777
- // - if not isStart: nothing
778
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
779
- // - if dots allowed or not possible: (?:/|^)
780
- // - if dots possible and not allowed: (?:/|^)(?!\.)
781
- //
782
- // But it's better to have a simpler binding without a conditional, for
783
- // performance, so probably better to return both start options.
784
- //
785
- // Then the caller just ignores the end if it's not the first pattern,
786
- // and the start always gets applied.
787
- //
788
- // But that's always going to be $ if it's the ending pattern, or nothing,
789
- // so the caller can just attach $ at the end of the pattern when building.
790
- //
791
- // So the todo is:
792
- // - better detect what kind of start is needed
793
- // - return both flavors of starting pattern
794
- // - attach $ at the end of the pattern when creating the actual RegExp
795
- //
796
- // Ah, but wait, no, that all only applies to the root when the first pattern
797
- // is not an extglob. If the first pattern IS an extglob, then we need all
798
- // that dot prevention biz to live in the extglob portions, because eg
799
- // +(*|.x*) can match .xy but not .yx.
800
- //
801
- // So, return the two flavors if it's #root and the first child is not an
802
- // AST, otherwise leave it to the child AST to handle it, and there,
803
- // use the (?:^|/) style of start binding.
804
- //
805
- // Even simplified further:
806
- // - Since the start for a join is eg /(?!\.) and the start for a part
807
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
808
- // or start or whatever) and prepend ^ or / at the Regexp construction.
809
- toRegExpSource(allowDot) {
810
- var _a;
811
- const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
812
- if (__privateGet(this, _root) === this)
813
- __privateMethod(this, _AST_instances, fillNegs_fn).call(this);
814
- if (!this.type) {
815
- const noEmpty = this.isStart() && this.isEnd();
816
- const src = __privateGet(this, _parts).map((p) => {
817
- var _a2;
818
- const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
819
- __privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
820
- __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
821
- return re;
822
- }).join("");
823
- let start2 = "";
824
- if (this.isStart()) {
825
- if (typeof __privateGet(this, _parts)[0] === "string") {
826
- const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
827
- if (!dotTravAllowed) {
828
- const aps = addPatternStart;
829
- const needNoTrav = (
830
- // dots are allowed, and the pattern starts with [ or .
831
- dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
832
- src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
833
- src.startsWith("\\.\\.") && aps.has(src.charAt(4))
834
- );
835
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
836
- start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
837
- }
838
- }
839
- }
840
- let end = "";
841
- if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
842
- end = "(?:$|\\/)";
843
- }
844
- const final2 = start2 + src + end;
845
- return [
846
- final2,
847
- unescape(src),
848
- __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
849
- __privateGet(this, _uflag)
850
- ];
851
- }
852
- const repeated = this.type === "*" || this.type === "+";
853
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
854
- let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
855
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
856
- const s = this.toString();
857
- __privateSet(this, _parts, [s]);
858
- this.type = null;
859
- __privateSet(this, _hasMagic, void 0);
860
- return [s, unescape(this.toString()), false, false];
861
- }
862
- let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
863
- if (bodyDotAllowed === body) {
864
- bodyDotAllowed = "";
865
- }
866
- if (bodyDotAllowed) {
867
- body = `(?:${body})(?:${bodyDotAllowed})*?`;
868
- }
869
- let final = "";
870
- if (this.type === "!" && __privateGet(this, _emptyExt)) {
871
- final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
872
- } else {
873
- const close = this.type === "!" ? (
874
- // !() must match something,but !(x) can match ''
875
- "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
876
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
877
- final = start + body + close;
878
- }
879
- return [
880
- final,
881
- unescape(body),
882
- __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
883
- __privateGet(this, _uflag)
884
- ];
885
- }
886
- };
887
- _root = new WeakMap();
888
- _hasMagic = new WeakMap();
889
- _uflag = new WeakMap();
890
- _parts = new WeakMap();
891
- _parent = new WeakMap();
892
- _parentIndex = new WeakMap();
893
- _negs = new WeakMap();
894
- _filledNegs = new WeakMap();
895
- _options = new WeakMap();
896
- _toString = new WeakMap();
897
- _emptyExt = new WeakMap();
898
- _AST_instances = new WeakSet();
899
- fillNegs_fn = function() {
900
- if (this !== __privateGet(this, _root))
901
- throw new Error("should only call on root");
902
- if (__privateGet(this, _filledNegs))
903
- return this;
904
- this.toString();
905
- __privateSet(this, _filledNegs, true);
906
- let n;
907
- while (n = __privateGet(this, _negs).pop()) {
908
- if (n.type !== "!")
909
- continue;
910
- let p = n;
911
- let pp = __privateGet(p, _parent);
912
- while (pp) {
913
- for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
914
- for (const part of __privateGet(n, _parts)) {
915
- if (typeof part === "string") {
916
- throw new Error("string part in extglob AST??");
917
- }
918
- part.copyIn(__privateGet(pp, _parts)[i2]);
919
- }
920
- }
921
- p = pp;
922
- pp = __privateGet(p, _parent);
923
- }
924
- }
925
- return this;
926
- };
927
- _AST_static = new WeakSet();
928
- parseAST_fn = function(str, ast, pos, opt) {
929
- var _a, _b;
930
- let escaping = false;
931
- let inBrace = false;
932
- let braceStart = -1;
933
- let braceNeg = false;
934
- if (ast.type === null) {
935
- let i3 = pos;
936
- let acc2 = "";
937
- while (i3 < str.length) {
938
- const c = str.charAt(i3++);
939
- if (escaping || c === "\\") {
940
- escaping = !escaping;
941
- acc2 += c;
942
- continue;
943
- }
944
- if (inBrace) {
945
- if (i3 === braceStart + 1) {
946
- if (c === "^" || c === "!") {
947
- braceNeg = true;
948
- }
949
- } else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
950
- inBrace = false;
951
- }
952
- acc2 += c;
953
- continue;
954
- } else if (c === "[") {
955
- inBrace = true;
956
- braceStart = i3;
957
- braceNeg = false;
958
- acc2 += c;
959
- continue;
960
- }
961
- if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
962
- ast.push(acc2);
963
- acc2 = "";
964
- const ext2 = new _AST(c, ast);
965
- i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
966
- ast.push(ext2);
967
- continue;
968
- }
969
- acc2 += c;
970
- }
971
- ast.push(acc2);
972
- return i3;
973
- }
974
- let i2 = pos + 1;
975
- let part = new _AST(null, ast);
976
- const parts = [];
977
- let acc = "";
978
- while (i2 < str.length) {
979
- const c = str.charAt(i2++);
980
- if (escaping || c === "\\") {
981
- escaping = !escaping;
982
- acc += c;
983
- continue;
984
- }
985
- if (inBrace) {
986
- if (i2 === braceStart + 1) {
987
- if (c === "^" || c === "!") {
988
- braceNeg = true;
989
- }
990
- } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
991
- inBrace = false;
992
- }
993
- acc += c;
994
- continue;
995
- } else if (c === "[") {
996
- inBrace = true;
997
- braceStart = i2;
998
- braceNeg = false;
999
- acc += c;
1000
- continue;
1001
- }
1002
- if (isExtglobType(c) && str.charAt(i2) === "(") {
1003
- part.push(acc);
1004
- acc = "";
1005
- const ext2 = new _AST(c, part);
1006
- part.push(ext2);
1007
- i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
1008
- continue;
1009
- }
1010
- if (c === "|") {
1011
- part.push(acc);
1012
- acc = "";
1013
- parts.push(part);
1014
- part = new _AST(null, ast);
1015
- continue;
1016
- }
1017
- if (c === ")") {
1018
- if (acc === "" && __privateGet(ast, _parts).length === 0) {
1019
- __privateSet(ast, _emptyExt, true);
1020
- }
1021
- part.push(acc);
1022
- acc = "";
1023
- ast.push(...parts, part);
1024
- return i2;
1025
- }
1026
- acc += c;
1027
- }
1028
- ast.type = null;
1029
- __privateSet(ast, _hasMagic, void 0);
1030
- __privateSet(ast, _parts, [str.substring(pos - 1)]);
1031
- return i2;
1032
- };
1033
- partsToRegExp_fn = function(dot) {
1034
- return __privateGet(this, _parts).map((p) => {
1035
- if (typeof p === "string") {
1036
- throw new Error("string type in extglob ast??");
1037
- }
1038
- const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
1039
- __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
1040
- return re;
1041
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
1042
- };
1043
- parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
1044
- let escaping = false;
1045
- let re = "";
1046
- let uflag = false;
1047
- for (let i2 = 0; i2 < glob.length; i2++) {
1048
- const c = glob.charAt(i2);
1049
- if (escaping) {
1050
- escaping = false;
1051
- re += (reSpecials.has(c) ? "\\" : "") + c;
1052
- continue;
1053
- }
1054
- if (c === "\\") {
1055
- if (i2 === glob.length - 1) {
1056
- re += "\\\\";
1057
- } else {
1058
- escaping = true;
1059
- }
1060
- continue;
1061
- }
1062
- if (c === "[") {
1063
- const [src, needUflag, consumed, magic] = parseClass(glob, i2);
1064
- if (consumed) {
1065
- re += src;
1066
- uflag = uflag || needUflag;
1067
- i2 += consumed - 1;
1068
- hasMagic = hasMagic || magic;
1069
- continue;
1070
- }
1071
- }
1072
- if (c === "*") {
1073
- if (noEmpty && glob === "*")
1074
- re += starNoEmpty;
1075
- else
1076
- re += star;
1077
- hasMagic = true;
1078
- continue;
1079
- }
1080
- if (c === "?") {
1081
- re += qmark;
1082
- hasMagic = true;
1083
- continue;
1084
- }
1085
- re += regExpEscape(c);
1086
- }
1087
- return [re, unescape(glob), !!hasMagic, uflag];
1088
- };
1089
- __privateAdd(_AST, _AST_static);
1090
- var AST = _AST;
1091
-
1092
- // node_modules/minimatch/dist/esm/escape.js
1093
- var escape = (s, { windowsPathsNoEscape = false } = {}) => {
1094
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
1095
- };
1096
-
1097
- // node_modules/minimatch/dist/esm/index.js
1098
- var minimatch = (p, pattern, options = {}) => {
1099
- assertValidPattern(pattern);
1100
- if (!options.nocomment && pattern.charAt(0) === "#") {
1101
- return false;
1102
- }
1103
- return new Minimatch(pattern, options).match(p);
1104
- };
1105
- var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
1106
- var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
1107
- var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
1108
- var starDotExtTestNocase = (ext2) => {
1109
- ext2 = ext2.toLowerCase();
1110
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
1111
- };
1112
- var starDotExtTestNocaseDot = (ext2) => {
1113
- ext2 = ext2.toLowerCase();
1114
- return (f) => f.toLowerCase().endsWith(ext2);
1115
- };
1116
- var starDotStarRE = /^\*+\.\*+$/;
1117
- var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
1118
- var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
1119
- var dotStarRE = /^\.\*+$/;
1120
- var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
1121
- var starRE = /^\*+$/;
1122
- var starTest = (f) => f.length !== 0 && !f.startsWith(".");
1123
- var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
1124
- var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
1125
- var qmarksTestNocase = ([$0, ext2 = ""]) => {
1126
- const noext = qmarksTestNoExt([$0]);
1127
- if (!ext2)
1128
- return noext;
1129
- ext2 = ext2.toLowerCase();
1130
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
1131
- };
1132
- var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
1133
- const noext = qmarksTestNoExtDot([$0]);
1134
- if (!ext2)
1135
- return noext;
1136
- ext2 = ext2.toLowerCase();
1137
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
1138
- };
1139
- var qmarksTestDot = ([$0, ext2 = ""]) => {
1140
- const noext = qmarksTestNoExtDot([$0]);
1141
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
1142
- };
1143
- var qmarksTest = ([$0, ext2 = ""]) => {
1144
- const noext = qmarksTestNoExt([$0]);
1145
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
1146
- };
1147
- var qmarksTestNoExt = ([$0]) => {
1148
- const len = $0.length;
1149
- return (f) => f.length === len && !f.startsWith(".");
1150
- };
1151
- var qmarksTestNoExtDot = ([$0]) => {
1152
- const len = $0.length;
1153
- return (f) => f.length === len && f !== "." && f !== "..";
1154
- };
1155
- var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
1156
- var path = {
1157
- win32: { sep: "\\" },
1158
- posix: { sep: "/" }
1159
- };
1160
- var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
1161
- minimatch.sep = sep;
1162
- var GLOBSTAR = Symbol("globstar **");
1163
- minimatch.GLOBSTAR = GLOBSTAR;
1164
- var qmark2 = "[^/]";
1165
- var star2 = qmark2 + "*?";
1166
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
1167
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
1168
- var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
1169
- minimatch.filter = filter;
1170
- var ext = (a, b = {}) => Object.assign({}, a, b);
1171
- var defaults = (def) => {
1172
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
1173
- return minimatch;
1174
- }
1175
- const orig = minimatch;
1176
- const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
1177
- return Object.assign(m, {
1178
- Minimatch: class Minimatch extends orig.Minimatch {
1179
- constructor(pattern, options = {}) {
1180
- super(pattern, ext(def, options));
1181
- }
1182
- static defaults(options) {
1183
- return orig.defaults(ext(def, options)).Minimatch;
1184
- }
1185
- },
1186
- AST: class AST extends orig.AST {
1187
- /* c8 ignore start */
1188
- constructor(type, parent, options = {}) {
1189
- super(type, parent, ext(def, options));
1190
- }
1191
- /* c8 ignore stop */
1192
- static fromGlob(pattern, options = {}) {
1193
- return orig.AST.fromGlob(pattern, ext(def, options));
1194
- }
1195
- },
1196
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
1197
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
1198
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
1199
- defaults: (options) => orig.defaults(ext(def, options)),
1200
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
1201
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
1202
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
1203
- sep: orig.sep,
1204
- GLOBSTAR
1205
- });
1206
- };
1207
- minimatch.defaults = defaults;
1208
- var braceExpand = (pattern, options = {}) => {
1209
- assertValidPattern(pattern);
1210
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
1211
- return [pattern];
1212
- }
1213
- return (0, import_brace_expansion.default)(pattern);
1214
- };
1215
- minimatch.braceExpand = braceExpand;
1216
- var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
1217
- minimatch.makeRe = makeRe;
1218
- var match = (list, pattern, options = {}) => {
1219
- const mm = new Minimatch(pattern, options);
1220
- list = list.filter((f) => mm.match(f));
1221
- if (mm.options.nonull && !list.length) {
1222
- list.push(pattern);
1223
- }
1224
- return list;
1225
- };
1226
- minimatch.match = match;
1227
- var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
1228
- var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1229
- var Minimatch = class {
1230
- options;
1231
- set;
1232
- pattern;
1233
- windowsPathsNoEscape;
1234
- nonegate;
1235
- negate;
1236
- comment;
1237
- empty;
1238
- preserveMultipleSlashes;
1239
- partial;
1240
- globSet;
1241
- globParts;
1242
- nocase;
1243
- isWindows;
1244
- platform;
1245
- windowsNoMagicRoot;
1246
- regexp;
1247
- constructor(pattern, options = {}) {
1248
- assertValidPattern(pattern);
1249
- options = options || {};
1250
- this.options = options;
1251
- this.pattern = pattern;
1252
- this.platform = options.platform || defaultPlatform;
1253
- this.isWindows = this.platform === "win32";
1254
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
1255
- if (this.windowsPathsNoEscape) {
1256
- this.pattern = this.pattern.replace(/\\/g, "/");
1257
- }
1258
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
1259
- this.regexp = null;
1260
- this.negate = false;
1261
- this.nonegate = !!options.nonegate;
1262
- this.comment = false;
1263
- this.empty = false;
1264
- this.partial = !!options.partial;
1265
- this.nocase = !!this.options.nocase;
1266
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
1267
- this.globSet = [];
1268
- this.globParts = [];
1269
- this.set = [];
1270
- this.make();
1271
- }
1272
- hasMagic() {
1273
- if (this.options.magicalBraces && this.set.length > 1) {
1274
- return true;
1275
- }
1276
- for (const pattern of this.set) {
1277
- for (const part of pattern) {
1278
- if (typeof part !== "string")
1279
- return true;
1280
- }
1281
- }
1282
- return false;
1283
- }
1284
- debug(..._) {
1285
- }
1286
- make() {
1287
- const pattern = this.pattern;
1288
- const options = this.options;
1289
- if (!options.nocomment && pattern.charAt(0) === "#") {
1290
- this.comment = true;
1291
- return;
1292
- }
1293
- if (!pattern) {
1294
- this.empty = true;
1295
- return;
1296
- }
1297
- this.parseNegate();
1298
- this.globSet = [...new Set(this.braceExpand())];
1299
- if (options.debug) {
1300
- this.debug = (...args) => console.error(...args);
1301
- }
1302
- this.debug(this.pattern, this.globSet);
1303
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
1304
- this.globParts = this.preprocess(rawGlobParts);
1305
- this.debug(this.pattern, this.globParts);
1306
- let set = this.globParts.map((s, _, __) => {
1307
- if (this.isWindows && this.windowsNoMagicRoot) {
1308
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
1309
- const isDrive = /^[a-z]:/i.test(s[0]);
1310
- if (isUNC) {
1311
- return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
1312
- } else if (isDrive) {
1313
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
1314
- }
1315
- }
1316
- return s.map((ss) => this.parse(ss));
1317
- });
1318
- this.debug(this.pattern, set);
1319
- this.set = set.filter((s) => s.indexOf(false) === -1);
1320
- if (this.isWindows) {
1321
- for (let i2 = 0; i2 < this.set.length; i2++) {
1322
- const p = this.set[i2];
1323
- if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
1324
- p[2] = "?";
1325
- }
1326
- }
1327
- }
1328
- this.debug(this.pattern, this.set);
1329
- }
1330
- // various transforms to equivalent pattern sets that are
1331
- // faster to process in a filesystem walk. The goal is to
1332
- // eliminate what we can, and push all ** patterns as far
1333
- // to the right as possible, even if it increases the number
1334
- // of patterns that we have to process.
1335
- preprocess(globParts) {
1336
- if (this.options.noglobstar) {
1337
- for (let i2 = 0; i2 < globParts.length; i2++) {
1338
- for (let j = 0; j < globParts[i2].length; j++) {
1339
- if (globParts[i2][j] === "**") {
1340
- globParts[i2][j] = "*";
1341
- }
1342
- }
1343
- }
1344
- }
1345
- const { optimizationLevel = 1 } = this.options;
1346
- if (optimizationLevel >= 2) {
1347
- globParts = this.firstPhasePreProcess(globParts);
1348
- globParts = this.secondPhasePreProcess(globParts);
1349
- } else if (optimizationLevel >= 1) {
1350
- globParts = this.levelOneOptimize(globParts);
1351
- } else {
1352
- globParts = this.adjascentGlobstarOptimize(globParts);
1353
- }
1354
- return globParts;
1355
- }
1356
- // just get rid of adjascent ** portions
1357
- adjascentGlobstarOptimize(globParts) {
1358
- return globParts.map((parts) => {
1359
- let gs = -1;
1360
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1361
- let i2 = gs;
1362
- while (parts[i2 + 1] === "**") {
1363
- i2++;
1364
- }
1365
- if (i2 !== gs) {
1366
- parts.splice(gs, i2 - gs);
1367
- }
1368
- }
1369
- return parts;
1370
- });
1371
- }
1372
- // get rid of adjascent ** and resolve .. portions
1373
- levelOneOptimize(globParts) {
1374
- return globParts.map((parts) => {
1375
- parts = parts.reduce((set, part) => {
1376
- const prev = set[set.length - 1];
1377
- if (part === "**" && prev === "**") {
1378
- return set;
1379
- }
1380
- if (part === "..") {
1381
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
1382
- set.pop();
1383
- return set;
1384
- }
1385
- }
1386
- set.push(part);
1387
- return set;
1388
- }, []);
1389
- return parts.length === 0 ? [""] : parts;
1390
- });
1391
- }
1392
- levelTwoFileOptimize(parts) {
1393
- if (!Array.isArray(parts)) {
1394
- parts = this.slashSplit(parts);
1395
- }
1396
- let didSomething = false;
1397
- do {
1398
- didSomething = false;
1399
- if (!this.preserveMultipleSlashes) {
1400
- for (let i2 = 1; i2 < parts.length - 1; i2++) {
1401
- const p = parts[i2];
1402
- if (i2 === 1 && p === "" && parts[0] === "")
1403
- continue;
1404
- if (p === "." || p === "") {
1405
- didSomething = true;
1406
- parts.splice(i2, 1);
1407
- i2--;
1408
- }
1409
- }
1410
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1411
- didSomething = true;
1412
- parts.pop();
1413
- }
1414
- }
1415
- let dd = 0;
1416
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1417
- const p = parts[dd - 1];
1418
- if (p && p !== "." && p !== ".." && p !== "**") {
1419
- didSomething = true;
1420
- parts.splice(dd - 1, 2);
1421
- dd -= 2;
1422
- }
1423
- }
1424
- } while (didSomething);
1425
- return parts.length === 0 ? [""] : parts;
1426
- }
1427
- // First phase: single-pattern processing
1428
- // <pre> is 1 or more portions
1429
- // <rest> is 1 or more portions
1430
- // <p> is any portion other than ., .., '', or **
1431
- // <e> is . or ''
1432
- //
1433
- // **/.. is *brutal* for filesystem walking performance, because
1434
- // it effectively resets the recursive walk each time it occurs,
1435
- // and ** cannot be reduced out by a .. pattern part like a regexp
1436
- // or most strings (other than .., ., and '') can be.
1437
- //
1438
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
1439
- // <pre>/<e>/<rest> -> <pre>/<rest>
1440
- // <pre>/<p>/../<rest> -> <pre>/<rest>
1441
- // **/**/<rest> -> **/<rest>
1442
- //
1443
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
1444
- // this WOULD be allowed if ** did follow symlinks, or * didn't
1445
- firstPhasePreProcess(globParts) {
1446
- let didSomething = false;
1447
- do {
1448
- didSomething = false;
1449
- for (let parts of globParts) {
1450
- let gs = -1;
1451
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1452
- let gss = gs;
1453
- while (parts[gss + 1] === "**") {
1454
- gss++;
1455
- }
1456
- if (gss > gs) {
1457
- parts.splice(gs + 1, gss - gs);
1458
- }
1459
- let next = parts[gs + 1];
1460
- const p = parts[gs + 2];
1461
- const p2 = parts[gs + 3];
1462
- if (next !== "..")
1463
- continue;
1464
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
1465
- continue;
1466
- }
1467
- didSomething = true;
1468
- parts.splice(gs, 1);
1469
- const other = parts.slice(0);
1470
- other[gs] = "**";
1471
- globParts.push(other);
1472
- gs--;
1473
- }
1474
- if (!this.preserveMultipleSlashes) {
1475
- for (let i2 = 1; i2 < parts.length - 1; i2++) {
1476
- const p = parts[i2];
1477
- if (i2 === 1 && p === "" && parts[0] === "")
1478
- continue;
1479
- if (p === "." || p === "") {
1480
- didSomething = true;
1481
- parts.splice(i2, 1);
1482
- i2--;
1483
- }
1484
- }
1485
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1486
- didSomething = true;
1487
- parts.pop();
1488
- }
1489
- }
1490
- let dd = 0;
1491
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1492
- const p = parts[dd - 1];
1493
- if (p && p !== "." && p !== ".." && p !== "**") {
1494
- didSomething = true;
1495
- const needDot = dd === 1 && parts[dd + 1] === "**";
1496
- const splin = needDot ? ["."] : [];
1497
- parts.splice(dd - 1, 2, ...splin);
1498
- if (parts.length === 0)
1499
- parts.push("");
1500
- dd -= 2;
1501
- }
1502
- }
1503
- }
1504
- } while (didSomething);
1505
- return globParts;
1506
- }
1507
- // second phase: multi-pattern dedupes
1508
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
1509
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
1510
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
1511
- //
1512
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
1513
- // ^-- not valid because ** doens't follow symlinks
1514
- secondPhasePreProcess(globParts) {
1515
- for (let i2 = 0; i2 < globParts.length - 1; i2++) {
1516
- for (let j = i2 + 1; j < globParts.length; j++) {
1517
- const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
1518
- if (!matched)
1519
- continue;
1520
- globParts[i2] = matched;
1521
- globParts[j] = [];
1522
- }
1523
- }
1524
- return globParts.filter((gs) => gs.length);
1525
- }
1526
- partsMatch(a, b, emptyGSMatch = false) {
1527
- let ai = 0;
1528
- let bi = 0;
1529
- let result = [];
1530
- let which = "";
1531
- while (ai < a.length && bi < b.length) {
1532
- if (a[ai] === b[bi]) {
1533
- result.push(which === "b" ? b[bi] : a[ai]);
1534
- ai++;
1535
- bi++;
1536
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
1537
- result.push(a[ai]);
1538
- ai++;
1539
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
1540
- result.push(b[bi]);
1541
- bi++;
1542
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
1543
- if (which === "b")
1544
- return false;
1545
- which = "a";
1546
- result.push(a[ai]);
1547
- ai++;
1548
- bi++;
1549
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
1550
- if (which === "a")
1551
- return false;
1552
- which = "b";
1553
- result.push(b[bi]);
1554
- ai++;
1555
- bi++;
1556
- } else {
1557
- return false;
1558
- }
1559
- }
1560
- return a.length === b.length && result;
1561
- }
1562
- parseNegate() {
1563
- if (this.nonegate)
1564
- return;
1565
- const pattern = this.pattern;
1566
- let negate = false;
1567
- let negateOffset = 0;
1568
- for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
1569
- negate = !negate;
1570
- negateOffset++;
1571
- }
1572
- if (negateOffset)
1573
- this.pattern = pattern.slice(negateOffset);
1574
- this.negate = negate;
1575
- }
1576
- // set partial to true to test if, for example,
1577
- // "/a/b" matches the start of "/*/b/*/d"
1578
- // Partial means, if you run out of file before you run
1579
- // out of pattern, then that's fine, as long as all
1580
- // the parts match.
1581
- matchOne(file, pattern, partial = false) {
1582
- const options = this.options;
1583
- if (this.isWindows) {
1584
- const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
1585
- const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
1586
- const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
1587
- const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
1588
- const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
1589
- const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
1590
- if (typeof fdi === "number" && typeof pdi === "number") {
1591
- const [fd, pd] = [file[fdi], pattern[pdi]];
1592
- if (fd.toLowerCase() === pd.toLowerCase()) {
1593
- pattern[pdi] = fd;
1594
- if (pdi > fdi) {
1595
- pattern = pattern.slice(pdi);
1596
- } else if (fdi > pdi) {
1597
- file = file.slice(fdi);
1598
- }
1599
- }
1600
- }
1601
- }
1602
- const { optimizationLevel = 1 } = this.options;
1603
- if (optimizationLevel >= 2) {
1604
- file = this.levelTwoFileOptimize(file);
1605
- }
1606
- this.debug("matchOne", this, { file, pattern });
1607
- this.debug("matchOne", file.length, pattern.length);
1608
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
1609
- this.debug("matchOne loop");
1610
- var p = pattern[pi];
1611
- var f = file[fi];
1612
- this.debug(pattern, p, f);
1613
- if (p === false) {
1614
- return false;
1615
- }
1616
- if (p === GLOBSTAR) {
1617
- this.debug("GLOBSTAR", [pattern, p, f]);
1618
- var fr = fi;
1619
- var pr = pi + 1;
1620
- if (pr === pl) {
1621
- this.debug("** at the end");
1622
- for (; fi < fl; fi++) {
1623
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
1624
- return false;
1625
- }
1626
- return true;
1627
- }
1628
- while (fr < fl) {
1629
- var swallowee = file[fr];
1630
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
1631
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
1632
- this.debug("globstar found match!", fr, fl, swallowee);
1633
- return true;
1634
- } else {
1635
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
1636
- this.debug("dot detected!", file, fr, pattern, pr);
1637
- break;
1638
- }
1639
- this.debug("globstar swallow a segment, and continue");
1640
- fr++;
1641
- }
1642
- }
1643
- if (partial) {
1644
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
1645
- if (fr === fl) {
1646
- return true;
1647
- }
1648
- }
1649
- return false;
1650
- }
1651
- let hit;
1652
- if (typeof p === "string") {
1653
- hit = f === p;
1654
- this.debug("string match", p, f, hit);
1655
- } else {
1656
- hit = p.test(f);
1657
- this.debug("pattern match", p, f, hit);
1658
- }
1659
- if (!hit)
1660
- return false;
1661
- }
1662
- if (fi === fl && pi === pl) {
1663
- return true;
1664
- } else if (fi === fl) {
1665
- return partial;
1666
- } else if (pi === pl) {
1667
- return fi === fl - 1 && file[fi] === "";
1668
- } else {
1669
- throw new Error("wtf?");
1670
- }
1671
- }
1672
- braceExpand() {
1673
- return braceExpand(this.pattern, this.options);
1674
- }
1675
- parse(pattern) {
1676
- assertValidPattern(pattern);
1677
- const options = this.options;
1678
- if (pattern === "**")
1679
- return GLOBSTAR;
1680
- if (pattern === "")
1681
- return "";
1682
- let m;
1683
- let fastTest = null;
1684
- if (m = pattern.match(starRE)) {
1685
- fastTest = options.dot ? starTestDot : starTest;
1686
- } else if (m = pattern.match(starDotExtRE)) {
1687
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
1688
- } else if (m = pattern.match(qmarksRE)) {
1689
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
1690
- } else if (m = pattern.match(starDotStarRE)) {
1691
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
1692
- } else if (m = pattern.match(dotStarRE)) {
1693
- fastTest = dotStarTest;
1694
- }
1695
- const re = AST.fromGlob(pattern, this.options).toMMPattern();
1696
- if (fastTest && typeof re === "object") {
1697
- Reflect.defineProperty(re, "test", { value: fastTest });
1698
- }
1699
- return re;
1700
- }
1701
- makeRe() {
1702
- if (this.regexp || this.regexp === false)
1703
- return this.regexp;
1704
- const set = this.set;
1705
- if (!set.length) {
1706
- this.regexp = false;
1707
- return this.regexp;
1708
- }
1709
- const options = this.options;
1710
- const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
1711
- const flags = new Set(options.nocase ? ["i"] : []);
1712
- let re = set.map((pattern) => {
1713
- const pp = pattern.map((p) => {
1714
- if (p instanceof RegExp) {
1715
- for (const f of p.flags.split(""))
1716
- flags.add(f);
1717
- }
1718
- return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
1719
- });
1720
- pp.forEach((p, i2) => {
1721
- const next = pp[i2 + 1];
1722
- const prev = pp[i2 - 1];
1723
- if (p !== GLOBSTAR || prev === GLOBSTAR) {
1724
- return;
1725
- }
1726
- if (prev === void 0) {
1727
- if (next !== void 0 && next !== GLOBSTAR) {
1728
- pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
1729
- } else {
1730
- pp[i2] = twoStar;
1731
- }
1732
- } else if (next === void 0) {
1733
- pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
1734
- } else if (next !== GLOBSTAR) {
1735
- pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
1736
- pp[i2 + 1] = GLOBSTAR;
1737
- }
1738
- });
1739
- return pp.filter((p) => p !== GLOBSTAR).join("/");
1740
- }).join("|");
1741
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
1742
- re = "^" + open + re + close + "$";
1743
- if (this.negate)
1744
- re = "^(?!" + re + ").+$";
1745
- try {
1746
- this.regexp = new RegExp(re, [...flags].join(""));
1747
- } catch (ex) {
1748
- this.regexp = false;
1749
- }
1750
- return this.regexp;
1751
- }
1752
- slashSplit(p) {
1753
- if (this.preserveMultipleSlashes) {
1754
- return p.split("/");
1755
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
1756
- return ["", ...p.split(/\/+/)];
1757
- } else {
1758
- return p.split(/\/+/);
1759
- }
1760
- }
1761
- match(f, partial = this.partial) {
1762
- this.debug("match", f, this.pattern);
1763
- if (this.comment) {
1764
- return false;
1765
- }
1766
- if (this.empty) {
1767
- return f === "";
1768
- }
1769
- if (f === "/" && partial) {
1770
- return true;
1771
- }
1772
- const options = this.options;
1773
- if (this.isWindows) {
1774
- f = f.split("\\").join("/");
1775
- }
1776
- const ff = this.slashSplit(f);
1777
- this.debug(this.pattern, "split", ff);
1778
- const set = this.set;
1779
- this.debug(this.pattern, "set", set);
1780
- let filename = ff[ff.length - 1];
1781
- if (!filename) {
1782
- for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
1783
- filename = ff[i2];
1784
- }
1785
- }
1786
- for (let i2 = 0; i2 < set.length; i2++) {
1787
- const pattern = set[i2];
1788
- let file = ff;
1789
- if (options.matchBase && pattern.length === 1) {
1790
- file = [filename];
1791
- }
1792
- const hit = this.matchOne(file, pattern, partial);
1793
- if (hit) {
1794
- if (options.flipNegate) {
1795
- return true;
1796
- }
1797
- return !this.negate;
1798
- }
1799
- }
1800
- if (options.flipNegate) {
1801
- return false;
1802
- }
1803
- return this.negate;
1804
- }
1805
- static defaults(def) {
1806
- return minimatch.defaults(def).Minimatch;
1807
- }
1808
- };
1809
- minimatch.AST = AST;
1810
- minimatch.Minimatch = Minimatch;
1811
- minimatch.escape = escape;
1812
- minimatch.unescape = unescape;
1813
-
1814
- // src/utils/query-nonce-meta-tag-content.ts
1815
- function queryNonceMetaTagContent(doc) {
1816
- var _a, _b, _c;
1817
- return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
1818
- }
1819
-
1820
- // src/utils/regular-expression.ts
1821
- var escapeRegExpSpecialCharacters = (text) => {
1822
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1823
- };
1824
-
1825
- // src/utils/remote-value.ts
1826
- var RemoteValue = class _RemoteValue {
1827
- /**
1828
- * Deserializes a LocalValue serialized object back to its original JavaScript representation
1829
- *
1830
- * @param serialized The serialized LocalValue object
1831
- * @returns The original JavaScript value/object
1832
- */
1833
- static fromLocalValue(serialized) {
1834
- const type = serialized[TYPE_CONSTANT];
1835
- const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
1836
- switch (type) {
1837
- case "string" /* String */:
1838
- return value;
1839
- case "boolean" /* Boolean */:
1840
- return value;
1841
- case "bigint" /* BigInt */:
1842
- return BigInt(value);
1843
- case "undefined" /* Undefined */:
1844
- return void 0;
1845
- case "null" /* Null */:
1846
- return null;
1847
- case "number" /* Number */:
1848
- if (value === "NaN") return NaN;
1849
- if (value === "-0") return -0;
1850
- if (value === "Infinity") return Infinity;
1851
- if (value === "-Infinity") return -Infinity;
1852
- return value;
1853
- case "array" /* Array */:
1854
- return value.map((item) => _RemoteValue.fromLocalValue(item));
1855
- case "date" /* Date */:
1856
- return new Date(value);
1857
- case "map" /* Map */:
1858
- const map2 = /* @__PURE__ */ new Map();
1859
- for (const [key, val] of value) {
1860
- const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
1861
- const deserializedValue = _RemoteValue.fromLocalValue(val);
1862
- map2.set(deserializedKey, deserializedValue);
1863
- }
1864
- return map2;
1865
- case "object" /* Object */:
1866
- const obj = {};
1867
- for (const [key, val] of value) {
1868
- obj[key] = _RemoteValue.fromLocalValue(val);
1869
- }
1870
- return obj;
1871
- case "regexp" /* RegularExpression */:
1872
- const { pattern, flags } = value;
1873
- return new RegExp(pattern, flags);
1874
- case "set" /* Set */:
1875
- const set = /* @__PURE__ */ new Set();
1876
- for (const item of value) {
1877
- set.add(_RemoteValue.fromLocalValue(item));
1878
- }
1879
- return set;
1880
- case "symbol" /* Symbol */:
1881
- return Symbol(value);
1882
- default:
1883
- throw new Error(`Unsupported type: ${type}`);
1884
- }
1885
- }
1886
- /**
1887
- * Utility method to deserialize multiple LocalValues at once
1888
- *
1889
- * @param serializedValues Array of serialized LocalValue objects
1890
- * @returns Array of deserialized JavaScript values
1891
- */
1892
- static fromLocalValueArray(serializedValues) {
1893
- return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
1894
- }
1895
- /**
1896
- * Verifies if the given object matches the structure of a serialized LocalValue
1897
- *
1898
- * @param obj Object to verify
1899
- * @returns boolean indicating if the object has LocalValue structure
1900
- */
1901
- static isLocalValueObject(obj) {
1902
- if (typeof obj !== "object" || obj === null) {
1903
- return false;
1904
- }
1905
- if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1906
- return false;
1907
- }
1908
- const type = obj[TYPE_CONSTANT];
1909
- const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1910
- if (!hasTypeProperty) {
1911
- return false;
1912
- }
1913
- if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1914
- return obj.hasOwnProperty(VALUE_CONSTANT);
1915
- }
1916
- return true;
1917
- }
1918
- };
1919
-
1920
- // src/utils/result.ts
1921
- var result_exports = {};
1922
- __export(result_exports, {
1923
- err: () => err,
1924
- map: () => map,
1925
- ok: () => ok,
1926
- unwrap: () => unwrap,
1927
- unwrapErr: () => unwrapErr
1928
- });
1929
- var ok = (value) => ({
1930
- isOk: true,
1931
- isErr: false,
1932
- value
1933
- });
1934
- var err = (value) => ({
1935
- isOk: false,
1936
- isErr: true,
1937
- value
1938
- });
1939
- function map(result, fn) {
1940
- if (result.isOk) {
1941
- const val = fn(result.value);
1942
- if (val instanceof Promise) {
1943
- return val.then((newVal) => ok(newVal));
1944
- } else {
1945
- return ok(val);
1946
- }
1947
- }
1948
- if (result.isErr) {
1949
- const value = result.value;
1950
- return err(value);
1951
- }
1952
- throw "should never get here";
1953
- }
1954
- var unwrap = (result) => {
1955
- if (result.isOk) {
1956
- return result.value;
1957
- } else {
1958
- throw result.value;
1959
- }
1960
- };
1961
- var unwrapErr = (result) => {
1962
- if (result.isErr) {
1963
- return result.value;
1964
- } else {
1965
- throw result.value;
1966
- }
1967
- };
1968
-
1969
- // src/utils/serialize.ts
1970
- function deserializeProperty(value) {
1971
- if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1972
- return value;
1973
- }
1974
- return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
1975
- }
1976
211
 
1977
212
  // src/utils/style.ts
1978
213
  function createStyleSheetIfNeededAndSupported(styles2) {
@@ -2004,20 +239,6 @@ var getSlottedChildNodes = (childNodes) => {
2004
239
  }
2005
240
  return result;
2006
241
  };
2007
- function getHostSlotNodes(childNodes, hostName, slotName) {
2008
- let i2 = 0;
2009
- let slottedNodes = [];
2010
- let childNode;
2011
- for (; i2 < childNodes.length; i2++) {
2012
- childNode = childNodes[i2];
2013
- if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
2014
- slottedNodes.push(childNode);
2015
- if (typeof slotName !== "undefined") return slottedNodes;
2016
- }
2017
- slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
2018
- }
2019
- return slottedNodes;
2020
- }
2021
242
  var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
2022
243
  if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
2023
244
  return;
@@ -2074,18 +295,6 @@ function patchSlotNode(node) {
2074
295
  node.assignedElements = assignedFactory(true);
2075
296
  node.assignedNodes = assignedFactory(false);
2076
297
  }
2077
- function dispatchSlotChangeEvent(elm) {
2078
- elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
2079
- }
2080
- function findSlotFromSlottedNode(slottedNode, parentHost) {
2081
- var _a;
2082
- parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
2083
- if (!parentHost) return { slotNode: null, slotName: "" };
2084
- const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
2085
- const childNodes = internalCall(parentHost, "childNodes");
2086
- const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
2087
- return { slotNode, slotName };
2088
- }
2089
298
  function internalCall(node, method) {
2090
299
  if ("__" + method in node) {
2091
300
  const toReturn = node["__" + method];
@@ -2110,6 +319,14 @@ var uniqueTime = (key, measureText) => {
2110
319
  };
2111
320
  }
2112
321
  };
322
+
323
+ // src/utils/query-nonce-meta-tag-content.ts
324
+ function queryNonceMetaTagContent(doc) {
325
+ var _a, _b, _c;
326
+ 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;
327
+ }
328
+
329
+ // src/runtime/styles.ts
2113
330
  var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2114
331
  var registerStyle = (scopeId2, cssText, allowCS) => {
2115
332
  let style = styles.get(scopeId2);
@@ -2143,10 +360,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2143
360
  }
2144
361
  const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
2145
362
  if (existingStyleElm) {
2146
- existingStyleElm.innerHTML = style;
363
+ existingStyleElm.textContent = style;
2147
364
  } else if (!appliedStyles.has(scopeId2)) {
2148
365
  styleElm = win.document.createElement("style");
2149
- styleElm.innerHTML = style;
366
+ styleElm.textContent = style;
2150
367
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2151
368
  if (nonce != null) {
2152
369
  styleElm.setAttribute("nonce", nonce);
@@ -2172,7 +389,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2172
389
  } else {
2173
390
  const existingStyleContainer = styleContainerNode.querySelector("style");
2174
391
  if (existingStyleContainer) {
2175
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
392
+ existingStyleContainer.textContent = style + existingStyleContainer.textContent;
2176
393
  } else {
2177
394
  styleContainerNode.prepend(styleElm);
2178
395
  }
@@ -2185,7 +402,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2185
402
  styleContainerNode.insertBefore(styleElm, null);
2186
403
  }
2187
404
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2188
- styleElm.innerHTML += SLOT_FB_CSS;
405
+ styleElm.textContent += SLOT_FB_CSS;
2189
406
  }
2190
407
  if (appliedStyles) {
2191
408
  appliedStyles.add(scopeId2);
@@ -2244,6 +461,12 @@ var hydrateScopedToShadow = () => {
2244
461
  registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2245
462
  }
2246
463
  };
464
+ var isComplexType = (o) => {
465
+ o = typeof o;
466
+ return o === "object" || o === "function";
467
+ };
468
+
469
+ // src/runtime/vdom/h.ts
2247
470
  var h = (nodeName, vnodeData, ...children) => {
2248
471
  if (typeof nodeName === "string") {
2249
472
  nodeName = transformTag(nodeName);
@@ -2297,7 +520,8 @@ var newVNode = (tag, text) => {
2297
520
  const vnode = {
2298
521
  $flags$: 0,
2299
522
  $tag$: tag,
2300
- $text$: text,
523
+ // Normalize undefined to null to prevent rendering "undefined" as text
524
+ $text$: text != null ? text : null,
2301
525
  $elm$: null,
2302
526
  $children$: null
2303
527
  };
@@ -2358,7 +582,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
2358
582
  cmpMeta.$cmpMeta$);
2359
583
  const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
2360
584
  if (styleSheet) {
2361
- hostElm.shadowRoot.append(styleSheet.cloneNode(true));
585
+ shadowRootNodes.unshift(styleSheet.cloneNode(true));
2362
586
  }
2363
587
  }
2364
588
  }
@@ -2428,7 +652,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
2428
652
  currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
2429
653
  }
2430
654
  }
2431
- if (shadowRoot) {
655
+ if (shadowRoot && !shadowRoot.childNodes.length) {
2432
656
  let rnIdex = 0;
2433
657
  const rnLen = shadowRootNodes.length;
2434
658
  if (rnLen) {
@@ -2699,18 +923,111 @@ var findCorrespondingNode = (node, type) => {
2699
923
  } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
2700
924
  return sibling;
2701
925
  };
2702
- var createSupportsRuleRe = (selector) => {
2703
- const safeSelector2 = escapeRegExpSpecialCharacters(selector);
2704
- return new RegExp(
2705
- // First capture group: match any context before the selector that's not inside @supports selector()
2706
- // Using negative lookahead to avoid matching inside @supports selector(...) condition
2707
- `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
2708
- "g"
2709
- );
926
+
927
+ // src/utils/remote-value.ts
928
+ var RemoteValue = class _RemoteValue {
929
+ /**
930
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
931
+ *
932
+ * @param serialized The serialized LocalValue object
933
+ * @returns The original JavaScript value/object
934
+ */
935
+ static fromLocalValue(serialized) {
936
+ const type = serialized[TYPE_CONSTANT];
937
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
938
+ switch (type) {
939
+ case "string" /* String */:
940
+ return value;
941
+ case "boolean" /* Boolean */:
942
+ return value;
943
+ case "bigint" /* BigInt */:
944
+ return BigInt(value);
945
+ case "undefined" /* Undefined */:
946
+ return void 0;
947
+ case "null" /* Null */:
948
+ return null;
949
+ case "number" /* Number */:
950
+ if (value === "NaN") return NaN;
951
+ if (value === "-0") return -0;
952
+ if (value === "Infinity") return Infinity;
953
+ if (value === "-Infinity") return -Infinity;
954
+ return value;
955
+ case "array" /* Array */:
956
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
957
+ case "date" /* Date */:
958
+ return new Date(value);
959
+ case "map" /* Map */:
960
+ const map = /* @__PURE__ */ new Map();
961
+ for (const [key, val] of value) {
962
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
963
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
964
+ map.set(deserializedKey, deserializedValue);
965
+ }
966
+ return map;
967
+ case "object" /* Object */:
968
+ const obj = {};
969
+ for (const [key, val] of value) {
970
+ obj[key] = _RemoteValue.fromLocalValue(val);
971
+ }
972
+ return obj;
973
+ case "regexp" /* RegularExpression */:
974
+ const { pattern, flags } = value;
975
+ return new RegExp(pattern, flags);
976
+ case "set" /* Set */:
977
+ const set = /* @__PURE__ */ new Set();
978
+ for (const item of value) {
979
+ set.add(_RemoteValue.fromLocalValue(item));
980
+ }
981
+ return set;
982
+ case "symbol" /* Symbol */:
983
+ return Symbol(value);
984
+ default:
985
+ throw new Error(`Unsupported type: ${type}`);
986
+ }
987
+ }
988
+ /**
989
+ * Utility method to deserialize multiple LocalValues at once
990
+ *
991
+ * @param serializedValues Array of serialized LocalValue objects
992
+ * @returns Array of deserialized JavaScript values
993
+ */
994
+ static fromLocalValueArray(serializedValues) {
995
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
996
+ }
997
+ /**
998
+ * Verifies if the given object matches the structure of a serialized LocalValue
999
+ *
1000
+ * @param obj Object to verify
1001
+ * @returns boolean indicating if the object has LocalValue structure
1002
+ */
1003
+ static isLocalValueObject(obj) {
1004
+ if (typeof obj !== "object" || obj === null) {
1005
+ return false;
1006
+ }
1007
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1008
+ return false;
1009
+ }
1010
+ const type = obj[TYPE_CONSTANT];
1011
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1012
+ if (!hasTypeProperty) {
1013
+ return false;
1014
+ }
1015
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1016
+ return obj.hasOwnProperty(VALUE_CONSTANT);
1017
+ }
1018
+ return true;
1019
+ }
2710
1020
  };
2711
- createSupportsRuleRe("::slotted");
2712
- createSupportsRuleRe(":host");
2713
- createSupportsRuleRe(":host-context");
1021
+
1022
+ // src/utils/serialize.ts
1023
+ function deserializeProperty(value) {
1024
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1025
+ return value;
1026
+ }
1027
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
1028
+ }
1029
+
1030
+ // src/runtime/parse-property-value.ts
2714
1031
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2715
1032
  if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2716
1033
  propValue = deserializeProperty(propValue);
@@ -2889,16 +1206,14 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2889
1206
  let i2 = 0;
2890
1207
  let elm;
2891
1208
  let childNode;
2892
- if (newVNode2.$text$ !== null) {
1209
+ if (newVNode2.$text$ != null) {
2893
1210
  elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
2894
1211
  } else {
2895
1212
  if (!isSvgMode) {
2896
1213
  isSvgMode = newVNode2.$tag$ === "svg";
2897
1214
  }
2898
1215
  if (!win.document) {
2899
- throw new Error(
2900
- "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."
2901
- );
1216
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
2902
1217
  }
2903
1218
  elm = newVNode2.$elm$ = win.document.createElementNS(
2904
1219
  isSvgMode ? SVG_NS : HTML_NS,
@@ -3063,7 +1378,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
3063
1378
  const newChildren = newVNode2.$children$;
3064
1379
  const tag = newVNode2.$tag$;
3065
1380
  const text = newVNode2.$text$;
3066
- if (text === null) {
1381
+ if (text == null) {
3067
1382
  {
3068
1383
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
3069
1384
  }
@@ -3093,12 +1408,6 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
3093
1408
  }
3094
1409
  };
3095
1410
  var insertBefore = (parent, newNode, reference, isInitialLoad) => {
3096
- if (typeof newNode["s-sn"] === "string") {
3097
- parent.insertBefore(newNode, reference);
3098
- const { slotNode } = findSlotFromSlottedNode(newNode);
3099
- if (slotNode && true) dispatchSlotChangeEvent(slotNode);
3100
- return newNode;
3101
- }
3102
1411
  if (parent.__insertBefore) {
3103
1412
  return parent.__insertBefore(newNode, reference);
3104
1413
  } else {
@@ -3180,8 +1489,8 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
3180
1489
  endSchedule();
3181
1490
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
3182
1491
  };
3183
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
3184
- console.error(err2);
1492
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
1493
+ console.error(err);
3185
1494
  fn();
3186
1495
  }) : fn();
3187
1496
  var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
@@ -3674,7 +1983,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3674
1983
  {
3675
1984
  hydrateScopedToShadow();
3676
1985
  }
3677
- let hasSlotRelocation = false;
3678
1986
  lazyBundles.map((lazyBundle) => {
3679
1987
  lazyBundle[1].map((compactMeta) => {
3680
1988
  var _a2, _b, _c;
@@ -3684,9 +1992,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3684
1992
  $members$: compactMeta[2],
3685
1993
  $listeners$: compactMeta[3]
3686
1994
  };
3687
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
3688
- hasSlotRelocation = true;
3689
- }
3690
1995
  {
3691
1996
  cmpMeta.$members$ = compactMeta[2];
3692
1997
  }
@@ -3770,9 +2075,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3770
2075
  });
3771
2076
  });
3772
2077
  if (cmpTags.length > 0) {
3773
- if (hasSlotRelocation) {
3774
- dataStyles.textContent += SLOT_FB_CSS;
3775
- }
3776
2078
  {
3777
2079
  dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
3778
2080
  }