0-0.4,0-0.4-0.1c-0.1-0.1-0.1-0.3-0.1-0.4 107
+			c0-0.3,0-0.5,0.8-0.5c0.3,0,0.6,0,0.7,0.1c0.1,0.1,0.1,0.2,0.1,0.6c0,0.1,0.1,0.3,0.3,0.3h1.8c0.1,0,0.3-0.1,0.3-0.3v-0.4
108
+			c0-2.7-1.7-2.7-3.1-2.7c-1.9,0-3.3,0.2-3.3,2.9c0,2.6,1.2,2.7,2.8,2.9l0.7,0.1c0.3,0,0.6,0,0.6,0.1c0,0,0.1,0.2,0.1,0.4
109
+			c0,0.4-0.1,0.4-0.1,0.4c-0.1,0.1-0.5,0.1-0.8,0.1c-0.4,0-0.7,0-0.8-0.1c-0.1,0-0.1-0.2-0.1-0.6c0-0.1-0.1-0.3-0.3-0.3h-1.8
110
+			c-0.1,0-0.3,0.1-0.3,0.3c0,3.2,1.5,3.2,3.3,3.2c1.5,0,2.4-0.3,2.9-1C228,29.8,228,29.1,228,28.3L228,28.3z"/>
111
+	</g>
112
+</g>
113
+</svg>

BIN
img/tmt-mma-afternoon-class.jpg


BIN
img/ufc-266-tmt-fighter-wins.jpg


Разница между файлами не показана из-за своего большого размера
+ 295 - 0
index.html


+ 3 - 0
input.css

@@ -0,0 +1,3 @@
1
+@tailwind base;
2
+@tailwind components;
3
+@tailwind utilities;

+ 40 - 0
js/main.js

@@ -0,0 +1,40 @@
1
+// Burger menus
2
+document.addEventListener('DOMContentLoaded', function() {
3
+    // open
4
+    const burger = document.querySelectorAll('.navbar-burger');
5
+    const menu = document.querySelectorAll('.navbar-menu');
6
+
7
+    if (burger.length && menu.length) {
8
+        for (var i = 0; i < burger.length; i++) {
9
+            burger[i].addEventListener('click', function() {
10
+                for (var j = 0; j < menu.length; j++) {
11
+                    menu[j].classList.toggle('hidden');
12
+                }
13
+            });
14
+        }
15
+    }
16
+
17
+    // close
18
+    const close = document.querySelectorAll('.navbar-close');
19
+    const backdrop = document.querySelectorAll('.navbar-backdrop');
20
+
21
+    if (close.length) {
22
+        for (var i = 0; i < close.length; i++) {
23
+            close[i].addEventListener('click', function() {
24
+                for (var j = 0; j < menu.length; j++) {
25
+                    menu[j].classList.toggle('hidden');
26
+                }
27
+            });
28
+        }
29
+    }
30
+
31
+    if (backdrop.length) {
32
+        for (var i = 0; i < backdrop.length; i++) {
33
+            backdrop[i].addEventListener('click', function() {
34
+                for (var j = 0; j < menu.length; j++) {
35
+                    menu[j].classList.toggle('hidden');
36
+                }
37
+            });
38
+        }
39
+    }
40
+});

+ 22 - 0
login.html

@@ -0,0 +1,22 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+
4
+<head>
5
+    <meta charset="UTF-8">
6
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+    <title>Tiger Muay Thai E Leaning</title>
9
+    <link rel="stylesheet" href="./css/main.css">
10
+    <link rel="preconnect" href="https://fonts.googleapis.com">
11
+    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
12
+    <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&family=Poppins&display=swap"
13
+        rel="stylesheet">
14
+    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"
15
+        integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A=="
16
+        crossorigin="anonymous" referrerpolicy="no-referrer" />
17
+</head>
18
+
19
+<body>
20
+</body>
21
+
22
+</html>

BIN
node_modules/.DS_Store


+ 1 - 0
node_modules/.bin/autoprefixer

@@ -0,0 +1 @@
1
+../autoprefixer/bin/autoprefixer

+ 1 - 0
node_modules/.bin/browserslist

@@ -0,0 +1 @@
1
+../browserslist/cli.js

+ 1 - 0
node_modules/.bin/cssesc

@@ -0,0 +1 @@
1
+../cssesc/bin/cssesc

+ 1 - 0
node_modules/.bin/jiti

@@ -0,0 +1 @@
1
+../jiti/bin/jiti.js

+ 1 - 0
node_modules/.bin/nanoid

@@ -0,0 +1 @@
1
+../nanoid/bin/nanoid.cjs

+ 1 - 0
node_modules/.bin/resolve

@@ -0,0 +1 @@
1
+../resolve/bin/resolve

+ 1 - 0
node_modules/.bin/sucrase

@@ -0,0 +1 @@
1
+../sucrase/bin/sucrase

+ 1 - 0
node_modules/.bin/sucrase-node

@@ -0,0 +1 @@
1
+../sucrase/bin/sucrase-node

+ 1 - 0
node_modules/.bin/tailwind

@@ -0,0 +1 @@
1
+../tailwindcss/lib/cli.js

+ 1 - 0
node_modules/.bin/tailwindcss

@@ -0,0 +1 @@
1
+../tailwindcss/lib/cli.js

+ 1 - 0
node_modules/.bin/update-browserslist-db

@@ -0,0 +1 @@
1
+../update-browserslist-db/cli.js

Разница между файлами не показана из-за своего большого размера
+ 1136 - 0
node_modules/.package-lock.json


+ 128 - 0
node_modules/@alloc/quick-lru/index.d.ts

@@ -0,0 +1,128 @@
1
+declare namespace QuickLRU {
2
+	interface Options<KeyType, ValueType> {
3
+		/**
4
+		The maximum number of milliseconds an item should remain in the cache.
5
+
6
+		@default Infinity
7
+
8
+		By default, `maxAge` will be `Infinity`, which means that items will never expire.
9
+		Lazy expiration upon the next write or read call.
10
+
11
+		Individual expiration of an item can be specified by the `set(key, value, maxAge)` method.
12
+		*/
13
+		readonly maxAge?: number;
14
+
15
+		/**
16
+		The maximum number of items before evicting the least recently used items.
17
+		*/
18
+		readonly maxSize: number;
19
+
20
+		/**
21
+		Called right before an item is evicted from the cache.
22
+
23
+		Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`).
24
+		*/
25
+		onEviction?: (key: KeyType, value: ValueType) => void;
26
+	}
27
+}
28
+
29
+declare class QuickLRU<KeyType, ValueType>
30
+	implements Iterable<[KeyType, ValueType]> {
31
+	/**
32
+	The stored item count.
33
+	*/
34
+	readonly size: number;
35
+
36
+	/**
37
+	Simple ["Least Recently Used" (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29).
38
+
39
+	The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop.
40
+
41
+	@example
42
+	```
43
+	import QuickLRU = require('quick-lru');
44
+
45
+	const lru = new QuickLRU({maxSize: 1000});
46
+
47
+	lru.set('🦄', '🌈');
48
+
49
+	lru.has('🦄');
50
+	//=> true
51
+
52
+	lru.get('🦄');
53
+	//=> '🌈'
54
+	```
55
+	*/
56
+	constructor(options: QuickLRU.Options<KeyType, ValueType>);
57
+
58
+	[Symbol.iterator](): IterableIterator<[KeyType, ValueType]>;
59
+
60
+	/**
61
+	Set an item. Returns the instance.
62
+
63
+	Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified in the constructor, otherwise the item will never expire.
64
+
65
+	@returns The list instance.
66
+	*/
67
+	set(key: KeyType, value: ValueType, options?: {maxAge?: number}): this;
68
+
69
+	/**
70
+	Get an item.
71
+
72
+	@returns The stored item or `undefined`.
73
+	*/
74
+	get(key: KeyType): ValueType | undefined;
75
+
76
+	/**
77
+	Check if an item exists.
78
+	*/
79
+	has(key: KeyType): boolean;
80
+
81
+	/**
82
+	Get an item without marking it as recently used.
83
+
84
+	@returns The stored item or `undefined`.
85
+	*/
86
+	peek(key: KeyType): ValueType | undefined;
87
+
88
+	/**
89
+	Delete an item.
90
+
91
+	@returns `true` if the item is removed or `false` if the item doesn't exist.
92
+	*/
93
+	delete(key: KeyType): boolean;
94
+
95
+	/**
96
+	Delete all items.
97
+	*/
98
+	clear(): void;
99
+
100
+	/**
101
+	Update the `maxSize` in-place, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee.
102
+
103
+	Useful for on-the-fly tuning of cache sizes in live systems.
104
+	*/
105
+	resize(maxSize: number): void;
106
+
107
+	/**
108
+	Iterable for all the keys.
109
+	*/
110
+	keys(): IterableIterator<KeyType>;
111
+
112
+	/**
113
+	Iterable for all the values.
114
+	*/
115
+	values(): IterableIterator<ValueType>;
116
+
117
+	/**
118
+	Iterable for all entries, starting with the oldest (ascending in recency).
119
+	*/
120
+	entriesAscending(): IterableIterator<[KeyType, ValueType]>;
121
+
122
+	/**
123
+	Iterable for all entries, starting with the newest (descending in recency).
124
+	*/
125
+	entriesDescending(): IterableIterator<[KeyType, ValueType]>;
126
+}
127
+
128
+export = QuickLRU;

+ 263 - 0
node_modules/@alloc/quick-lru/index.js

@@ -0,0 +1,263 @@
1
+'use strict';
2
+
3
+class QuickLRU {
4
+	constructor(options = {}) {
5
+		if (!(options.maxSize && options.maxSize > 0)) {
6
+			throw new TypeError('`maxSize` must be a number greater than 0');
7
+		}
8
+
9
+		if (typeof options.maxAge === 'number' && options.maxAge === 0) {
10
+			throw new TypeError('`maxAge` must be a number greater than 0');
11
+		}
12
+
13
+		this.maxSize = options.maxSize;
14
+		this.maxAge = options.maxAge || Infinity;
15
+		this.onEviction = options.onEviction;
16
+		this.cache = new Map();
17
+		this.oldCache = new Map();
18
+		this._size = 0;
19
+	}
20
+
21
+	_emitEvictions(cache) {
22
+		if (typeof this.onEviction !== 'function') {
23
+			return;
24
+		}
25
+
26
+		for (const [key, item] of cache) {
27
+			this.onEviction(key, item.value);
28
+		}
29
+	}
30
+
31
+	_deleteIfExpired(key, item) {
32
+		if (typeof item.expiry === 'number' && item.expiry <= Date.now()) {
33
+			if (typeof this.onEviction === 'function') {
34
+				this.onEviction(key, item.value);
35
+			}
36
+
37
+			return this.delete(key);
38
+		}
39
+
40
+		return false;
41
+	}
42
+
43
+	_getOrDeleteIfExpired(key, item) {
44
+		const deleted = this._deleteIfExpired(key, item);
45
+		if (deleted === false) {
46
+			return item.value;
47
+		}
48
+	}
49
+
50
+	_getItemValue(key, item) {
51
+		return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
52
+	}
53
+
54
+	_peek(key, cache) {
55
+		const item = cache.get(key);
56
+
57
+		return this._getItemValue(key, item);
58
+	}
59
+
60
+	_set(key, value) {
61
+		this.cache.set(key, value);
62
+		this._size++;
63
+
64
+		if (this._size >= this.maxSize) {
65
+			this._size = 0;
66
+			this._emitEvictions(this.oldCache);
67
+			this.oldCache = this.cache;
68
+			this.cache = new Map();
69
+		}
70
+	}
71
+
72
+	_moveToRecent(key, item) {
73
+		this.oldCache.delete(key);
74
+		this._set(key, item);
75
+	}
76
+
77
+	* _entriesAscending() {
78
+		for (const item of this.oldCache) {
79
+			const [key, value] = item;
80
+			if (!this.cache.has(key)) {
81
+				const deleted = this._deleteIfExpired(key, value);
82
+				if (deleted === false) {
83
+					yield item;
84
+				}
85
+			}
86
+		}
87
+
88
+		for (const item of this.cache) {
89
+			const [key, value] = item;
90
+			const deleted = this._deleteIfExpired(key, value);
91
+			if (deleted === false) {
92
+				yield item;
93
+			}
94
+		}
95
+	}
96
+
97
+	get(key) {
98
+		if (this.cache.has(key)) {
99
+			const item = this.cache.get(key);
100
+
101
+			return this._getItemValue(key, item);
102
+		}
103
+
104
+		if (this.oldCache.has(key)) {
105
+			const item = this.oldCache.get(key);
106
+			if (this._deleteIfExpired(key, item) === false) {
107
+				this._moveToRecent(key, item);
108
+				return item.value;
109
+			}
110
+		}
111
+	}
112
+
113
+	set(key, value, {maxAge = this.maxAge === Infinity ? undefined : Date.now() + this.maxAge} = {}) {
114
+		if (this.cache.has(key)) {
115
+			this.cache.set(key, {
116
+				value,
117
+				maxAge
118
+			});
119
+		} else {
120
+			this._set(key, {value, expiry: maxAge});
121
+		}
122
+	}
123
+
124
+	has(key) {
125
+		if (this.cache.has(key)) {
126
+			return !this._deleteIfExpired(key, this.cache.get(key));
127
+		}
128
+
129
+		if (this.oldCache.has(key)) {
130
+			return !this._deleteIfExpired(key, this.oldCache.get(key));
131
+		}
132
+
133
+		return false;
134
+	}
135
+
136
+	peek(key) {
137
+		if (this.cache.has(key)) {
138
+			return this._peek(key, this.cache);
139
+		}
140
+
141
+		if (this.oldCache.has(key)) {
142
+			return this._peek(key, this.oldCache);
143
+		}
144
+	}
145
+
146
+	delete(key) {
147
+		const deleted = this.cache.delete(key);
148
+		if (deleted) {
149
+			this._size--;
150
+		}
151
+
152
+		return this.oldCache.delete(key) || deleted;
153
+	}
154
+
155
+	clear() {
156
+		this.cache.clear();
157
+		this.oldCache.clear();
158
+		this._size = 0;
159
+	}
160
+	
161
+	resize(newSize) {
162
+		if (!(newSize && newSize > 0)) {
163
+			throw new TypeError('`maxSize` must be a number greater than 0');
164
+		}
165
+
166
+		const items = [...this._entriesAscending()];
167
+		const removeCount = items.length - newSize;
168
+		if (removeCount < 0) {
169
+			this.cache = new Map(items);
170
+			this.oldCache = new Map();
171
+			this._size = items.length;
172
+		} else {
173
+			if (removeCount > 0) {
174
+				this._emitEvictions(items.slice(0, removeCount));
175
+			}
176
+
177
+			this.oldCache = new Map(items.slice(removeCount));
178
+			this.cache = new Map();
179
+			this._size = 0;
180
+		}
181
+
182
+		this.maxSize = newSize;
183
+	}
184
+
185
+	* keys() {
186
+		for (const [key] of this) {
187
+			yield key;
188
+		}
189
+	}
190
+
191
+	* values() {
192
+		for (const [, value] of this) {
193
+			yield value;
194
+		}
195
+	}
196
+
197
+	* [Symbol.iterator]() {
198
+		for (const item of this.cache) {
199
+			const [key, value] = item;
200
+			const deleted = this._deleteIfExpired(key, value);
201
+			if (deleted === false) {
202
+				yield [key, value.value];
203
+			}
204
+		}
205
+
206
+		for (const item of this.oldCache) {
207
+			const [key, value] = item;
208
+			if (!this.cache.has(key)) {
209
+				const deleted = this._deleteIfExpired(key, value);
210
+				if (deleted === false) {
211
+					yield [key, value.value];
212
+				}
213
+			}
214
+		}
215
+	}
216
+
217
+	* entriesDescending() {
218
+		let items = [...this.cache];
219
+		for (let i = items.length - 1; i >= 0; --i) {
220
+			const item = items[i];
221
+			const [key, value] = item;
222
+			const deleted = this._deleteIfExpired(key, value);
223
+			if (deleted === false) {
224
+				yield [key, value.value];
225
+			}
226
+		}
227
+
228
+		items = [...this.oldCache];
229
+		for (let i = items.length - 1; i >= 0; --i) {
230
+			const item = items[i];
231
+			const [key, value] = item;
232
+			if (!this.cache.has(key)) {
233
+				const deleted = this._deleteIfExpired(key, value);
234
+				if (deleted === false) {
235
+					yield [key, value.value];
236
+				}
237
+			}
238
+		}
239
+	}
240
+
241
+	* entriesAscending() {
242
+		for (const [key, value] of this._entriesAscending()) {
243
+			yield [key, value.value];
244
+		}
245
+	}
246
+
247
+	get size() {
248
+		if (!this._size) {
249
+			return this.oldCache.size;
250
+		}
251
+
252
+		let oldCacheSize = 0;
253
+		for (const key of this.oldCache.keys()) {
254
+			if (!this.cache.has(key)) {
255
+				oldCacheSize++;
256
+			}
257
+		}
258
+
259
+		return Math.min(this._size + oldCacheSize, this.maxSize);
260
+	}
261
+}
262
+
263
+module.exports = QuickLRU;

+ 9 - 0
node_modules/@alloc/quick-lru/license

@@ -0,0 +1,9 @@
1
+MIT License
2
+
3
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 43 - 0
node_modules/@alloc/quick-lru/package.json

@@ -0,0 +1,43 @@
1
+{
2
+	"name": "@alloc/quick-lru",
3
+	"version": "5.2.0",
4
+	"description": "Simple “Least Recently Used” (LRU) cache",
5
+	"license": "MIT",
6
+	"repository": "sindresorhus/quick-lru",
7
+	"funding": "https://github.com/sponsors/sindresorhus",
8
+	"author": {
9
+		"name": "Sindre Sorhus",
10
+		"email": "sindresorhus@gmail.com",
11
+		"url": "https://sindresorhus.com"
12
+	},
13
+	"engines": {
14
+		"node": ">=10"
15
+	},
16
+	"scripts": {
17
+		"test": "xo && nyc ava && tsd"
18
+	},
19
+	"files": [
20
+		"index.js",
21
+		"index.d.ts"
22
+	],
23
+	"keywords": [
24
+		"lru",
25
+		"quick",
26
+		"cache",
27
+		"caching",
28
+		"least",
29
+		"recently",
30
+		"used",
31
+		"fast",
32
+		"map",
33
+		"hash",
34
+		"buffer"
35
+	],
36
+	"devDependencies": {
37
+		"ava": "^2.0.0",
38
+		"coveralls": "^3.0.3",
39
+		"nyc": "^15.0.0",
40
+		"tsd": "^0.11.0",
41
+		"xo": "^0.26.0"
42
+	}
43
+}

+ 139 - 0
node_modules/@alloc/quick-lru/readme.md

@@ -0,0 +1,139 @@
1
+# quick-lru [![Build Status](https://travis-ci.org/sindresorhus/quick-lru.svg?branch=master)](https://travis-ci.org/sindresorhus/quick-lru) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/quick-lru/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/quick-lru?branch=master)
2
+
3
+> Simple [“Least Recently Used” (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29)
4
+
5
+Useful when you need to cache something and limit memory usage.
6
+
7
+Inspired by the [`hashlru` algorithm](https://github.com/dominictarr/hashlru#algorithm), but instead uses [`Map`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map) to support keys of any type, not just strings, and values can be `undefined`.
8
+
9
+## Install
10
+
11
+```
12
+$ npm install quick-lru
13
+```
14
+
15
+## Usage
16
+
17
+```js
18
+const QuickLRU = require('quick-lru');
19
+
20
+const lru = new QuickLRU({maxSize: 1000});
21
+
22
+lru.set('🦄', '🌈');
23
+
24
+lru.has('🦄');
25
+//=> true
26
+
27
+lru.get('🦄');
28
+//=> '🌈'
29
+```
30
+
31
+## API
32
+
33
+### new QuickLRU(options?)
34
+
35
+Returns a new instance.
36
+
37
+### options
38
+
39
+Type: `object`
40
+
41
+#### maxSize
42
+
43
+*Required*\
44
+Type: `number`
45
+
46
+The maximum number of items before evicting the least recently used items.
47
+
48
+#### maxAge
49
+
50
+Type: `number`\
51
+Default: `Infinity`
52
+
53
+The maximum number of milliseconds an item should remain in cache.
54
+By default maxAge will be Infinity, which means that items will never expire.
55
+
56
+Lazy expiration happens upon the next `write` or `read` call.
57
+
58
+Individual expiration of an item can be specified by the `set(key, value, options)` method.
59
+
60
+#### onEviction
61
+
62
+*Optional*\
63
+Type: `(key, value) => void`
64
+
65
+Called right before an item is evicted from the cache.
66
+
67
+Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`).
68
+
69
+### Instance
70
+
71
+The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop.
72
+
73
+Both `key` and `value` can be of any type.
74
+
75
+#### .set(key, value, options?)
76
+
77
+Set an item. Returns the instance.
78
+
79
+Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified on the constructor, otherwise the item will never expire.
80
+
81
+#### .get(key)
82
+
83
+Get an item.
84
+
85
+#### .has(key)
86
+
87
+Check if an item exists.
88
+
89
+#### .peek(key)
90
+
91
+Get an item without marking it as recently used.
92
+
93
+#### .delete(key)
94
+
95
+Delete an item.
96
+
97
+Returns `true` if the item is removed or `false` if the item doesn't exist.
98
+
99
+#### .clear()
100
+
101
+Delete all items.
102
+
103
+#### .resize(maxSize)
104
+
105
+Update the `maxSize`, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee.
106
+
107
+Useful for on-the-fly tuning of cache sizes in live systems.
108
+
109
+#### .keys()
110
+
111
+Iterable for all the keys.
112
+
113
+#### .values()
114
+
115
+Iterable for all the values.
116
+
117
+#### .entriesAscending()
118
+
119
+Iterable for all entries, starting with the oldest (ascending in recency).
120
+
121
+#### .entriesDescending()
122
+
123
+Iterable for all entries, starting with the newest (descending in recency).
124
+
125
+#### .size
126
+
127
+The stored item count.
128
+
129
+---
130
+
131
+<div align="center">
132
+	<b>
133
+		<a href="https://tidelift.com/subscription/pkg/npm-quick-lru?utm_source=npm-quick-lru&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
134
+	</b>
135
+	<br>
136
+	<sub>
137
+		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
138
+	</sub>
139
+</div>

+ 19 - 0
node_modules/@jridgewell/gen-mapping/LICENSE

@@ -0,0 +1,19 @@
1
+Copyright 2022 Justin Ridgewell <jridgewell@google.com>
2
+
3
+Permission is hereby granted, free of charge, to any person obtaining a copy
4
+of this software and associated documentation files (the "Software"), to deal
5
+in the Software without restriction, including without limitation the rights
6
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+copies of the Software, and to permit persons to whom the Software is
8
+furnished to do so, subject to the following conditions:
9
+
10
+The above copyright notice and this permission notice shall be included in
11
+all copies or substantial portions of the Software.
12
+
13
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+SOFTWARE.

+ 227 - 0
node_modules/@jridgewell/gen-mapping/README.md

@@ -0,0 +1,227 @@
1
+# @jridgewell/gen-mapping
2
+
3
+> Generate source maps
4
+
5
+`gen-mapping` allows you to generate a source map during transpilation or minification.
6
+With a source map, you're able to trace the original location in the source file, either in Chrome's
7
+DevTools or using a library like [`@jridgewell/trace-mapping`][trace-mapping].
8
+
9
+You may already be familiar with the [`source-map`][source-map] package's `SourceMapGenerator`. This
10
+provides the same `addMapping` and `setSourceContent` API.
11
+
12
+## Installation
13
+
14
+```sh
15
+npm install @jridgewell/gen-mapping
16
+```
17
+
18
+## Usage
19
+
20
+```typescript
21
+import { GenMapping, addMapping, setSourceContent, toEncodedMap, toDecodedMap } from '@jridgewell/gen-mapping';
22
+
23
+const map = new GenMapping({
24
+  file: 'output.js',
25
+  sourceRoot: 'https://example.com/',
26
+});
27
+
28
+setSourceContent(map, 'input.js', `function foo() {}`);
29
+
30
+addMapping(map, {
31
+  // Lines start at line 1, columns at column 0.
32
+  generated: { line: 1, column: 0 },
33
+  source: 'input.js',
34
+  original: { line: 1, column: 0 },
35
+});
36
+
37
+addMapping(map, {
38
+  generated: { line: 1, column: 9 },
39
+  source: 'input.js',
40
+  original: { line: 1, column: 9 },
41
+  name: 'foo',
42
+});
43
+
44
+assert.deepEqual(toDecodedMap(map), {
45
+  version: 3,
46
+  file: 'output.js',
47
+  names: ['foo'],
48
+  sourceRoot: 'https://example.com/',
49
+  sources: ['input.js'],
50
+  sourcesContent: ['function foo() {}'],
51
+  mappings: [
52
+    [ [0, 0, 0, 0], [9, 0, 0, 9, 0] ]
53
+  ],
54
+});
55
+
56
+assert.deepEqual(toEncodedMap(map), {
57
+  version: 3,
58
+  file: 'output.js',
59
+  names: ['foo'],
60
+  sourceRoot: 'https://example.com/',
61
+  sources: ['input.js'],
62
+  sourcesContent: ['function foo() {}'],
63
+  mappings: 'AAAA,SAASA',
64
+});
65
+```
66
+
67
+### Smaller Sourcemaps
68
+
69
+Not everything needs to be added to a sourcemap, and needless markings can cause signficantly
70
+larger file sizes. `gen-mapping` exposes `maybeAddSegment`/`maybeAddMapping` APIs that will
71
+intelligently determine if this marking adds useful information. If not, the marking will be
72
+skipped.
73
+
74
+```typescript
75
+import { maybeAddMapping } from '@jridgewell/gen-mapping';
76
+
77
+const map = new GenMapping();
78
+
79
+// Adding a sourceless marking at the beginning of a line isn't useful.
80
+maybeAddMapping(map, {
81
+  generated: { line: 1, column: 0 },
82
+});
83
+
84
+// Adding a new source marking is useful.
85
+maybeAddMapping(map, {
86
+  generated: { line: 1, column: 0 },
87
+  source: 'input.js',
88
+  original: { line: 1, column: 0 },
89
+});
90
+
91
+// But adding another marking pointing to the exact same original location isn't, even if the
92
+// generated column changed.
93
+maybeAddMapping(map, {
94
+  generated: { line: 1, column: 9 },
95
+  source: 'input.js',
96
+  original: { line: 1, column: 0 },
97
+});
98
+
99
+assert.deepEqual(toEncodedMap(map), {
100
+  version: 3,
101
+  names: [],
102
+  sources: ['input.js'],
103
+  sourcesContent: [null],
104
+  mappings: 'AAAA',
105
+});
106
+```
107
+
108
+## Benchmarks
109
+
110
+```
111
+node v18.0.0
112
+
113
+amp.js.map
114
+Memory Usage:
115
+gen-mapping: addSegment      5852872 bytes
116
+gen-mapping: addMapping      7716042 bytes
117
+source-map-js                6143250 bytes
118
+source-map-0.6.1             6124102 bytes
119
+source-map-0.8.0             6121173 bytes
120
+Smallest memory usage is gen-mapping: addSegment
121
+
122
+Adding speed:
123
+gen-mapping:      addSegment x 441 ops/sec ±2.07% (90 runs sampled)
124
+gen-mapping:      addMapping x 350 ops/sec ±2.40% (86 runs sampled)
125
+source-map-js:    addMapping x 169 ops/sec ±2.42% (80 runs sampled)
126
+source-map-0.6.1: addMapping x 167 ops/sec ±2.56% (80 runs sampled)
127
+source-map-0.8.0: addMapping x 168 ops/sec ±2.52% (80 runs sampled)
128
+Fastest is gen-mapping:      addSegment
129
+
130
+Generate speed:
131
+gen-mapping:      decoded output x 150,824,370 ops/sec ±0.07% (102 runs sampled)
132
+gen-mapping:      encoded output x 663 ops/sec ±0.22% (98 runs sampled)
133
+source-map-js:    encoded output x 197 ops/sec ±0.45% (84 runs sampled)
134
+source-map-0.6.1: encoded output x 198 ops/sec ±0.33% (85 runs sampled)
135
+source-map-0.8.0: encoded output x 197 ops/sec ±0.06% (93 runs sampled)
136
+Fastest is gen-mapping:      decoded output
137
+
138
+
139
+***
140
+
141
+
142
+babel.min.js.map
143
+Memory Usage:
144
+gen-mapping: addSegment     37578063 bytes
145
+gen-mapping: addMapping     37212897 bytes
146
+source-map-js               47638527 bytes
147
+source-map-0.6.1            47690503 bytes
148
+source-map-0.8.0            47470188 bytes
149
+Smallest memory usage is gen-mapping: addMapping
150
+
151
+Adding speed:
152
+gen-mapping:      addSegment x 31.05 ops/sec ±8.31% (43 runs sampled)
153
+gen-mapping:      addMapping x 29.83 ops/sec ±7.36% (51 runs sampled)
154
+source-map-js:    addMapping x 20.73 ops/sec ±6.22% (38 runs sampled)
155
+source-map-0.6.1: addMapping x 20.03 ops/sec ±10.51% (38 runs sampled)
156
+source-map-0.8.0: addMapping x 19.30 ops/sec ±8.27% (37 runs sampled)
157
+Fastest is gen-mapping:      addSegment
158
+
159
+Generate speed:
160
+gen-mapping:      decoded output x 381,379,234 ops/sec ±0.29% (96 runs sampled)
161
+gen-mapping:      encoded output x 95.15 ops/sec ±2.98% (72 runs sampled)
162
+source-map-js:    encoded output x 15.20 ops/sec ±7.41% (33 runs sampled)
163
+source-map-0.6.1: encoded output x 16.36 ops/sec ±10.46% (31 runs sampled)
164
+source-map-0.8.0: encoded output x 16.06 ops/sec ±6.45% (31 runs sampled)
165
+Fastest is gen-mapping:      decoded output
166
+
167
+
168
+***
169
+
170
+
171
+preact.js.map
172
+Memory Usage:
173
+gen-mapping: addSegment       416247 bytes
174
+gen-mapping: addMapping       419824 bytes
175
+source-map-js                1024619 bytes
176
+source-map-0.6.1             1146004 bytes
177
+source-map-0.8.0             1113250 bytes
178
+Smallest memory usage is gen-mapping: addSegment
179
+
180
+Adding speed:
181
+gen-mapping:      addSegment x 13,755 ops/sec ±0.15% (98 runs sampled)
182
+gen-mapping:      addMapping x 13,013 ops/sec ±0.11% (101 runs sampled)
183
+source-map-js:    addMapping x 4,564 ops/sec ±0.21% (98 runs sampled)
184
+source-map-0.6.1: addMapping x 4,562 ops/sec ±0.11% (99 runs sampled)
185
+source-map-0.8.0: addMapping x 4,593 ops/sec ±0.11% (100 runs sampled)
186
+Fastest is gen-mapping:      addSegment
187
+
188
+Generate speed:
189
+gen-mapping:      decoded output x 379,864,020 ops/sec ±0.23% (93 runs sampled)
190
+gen-mapping:      encoded output x 14,368 ops/sec ±4.07% (82 runs sampled)
191
+source-map-js:    encoded output x 5,261 ops/sec ±0.21% (99 runs sampled)
192
+source-map-0.6.1: encoded output x 5,124 ops/sec ±0.58% (99 runs sampled)
193
+source-map-0.8.0: encoded output x 5,434 ops/sec ±0.33% (96 runs sampled)
194
+Fastest is gen-mapping:      decoded output
195
+
196
+
197
+***
198
+
199
+
200
+react.js.map
201
+Memory Usage:
202
+gen-mapping: addSegment       975096 bytes
203
+gen-mapping: addMapping      1102981 bytes
204
+source-map-js                2918836 bytes
205
+source-map-0.6.1             2885435 bytes
206
+source-map-0.8.0             2874336 bytes
207
+Smallest memory usage is gen-mapping: addSegment
208
+
209
+Adding speed:
210
+gen-mapping:      addSegment x 4,772 ops/sec ±0.15% (100 runs sampled)
211
+gen-mapping:      addMapping x 4,456 ops/sec ±0.13% (97 runs sampled)
212
+source-map-js:    addMapping x 1,618 ops/sec ±0.24% (97 runs sampled)
213
+source-map-0.6.1: addMapping x 1,622 ops/sec ±0.12% (99 runs sampled)
214
+source-map-0.8.0: addMapping x 1,631 ops/sec ±0.12% (100 runs sampled)
215
+Fastest is gen-mapping:      addSegment
216
+
217
+Generate speed:
218
+gen-mapping:      decoded output x 379,107,695 ops/sec ±0.07% (99 runs sampled)
219
+gen-mapping:      encoded output x 5,421 ops/sec ±1.60% (89 runs sampled)
220
+source-map-js:    encoded output x 2,113 ops/sec ±1.81% (98 runs sampled)
221
+source-map-0.6.1: encoded output x 2,126 ops/sec ±0.10% (100 runs sampled)
222
+source-map-0.8.0: encoded output x 2,176 ops/sec ±0.39% (98 runs sampled)
223
+Fastest is gen-mapping:      decoded output
224
+```
225
+
226
+[source-map]: https://www.npmjs.com/package/source-map
227
+[trace-mapping]: https://github.com/jridgewell/trace-mapping

+ 230 - 0
node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs

@@ -0,0 +1,230 @@
1
+import { SetArray, put } from '@jridgewell/set-array';
2
+import { encode } from '@jridgewell/sourcemap-codec';
3
+import { TraceMap, decodedMappings } from '@jridgewell/trace-mapping';
4
+
5
+const COLUMN = 0;
6
+const SOURCES_INDEX = 1;
7
+const SOURCE_LINE = 2;
8
+const SOURCE_COLUMN = 3;
9
+const NAMES_INDEX = 4;
10
+
11
+const NO_NAME = -1;
12
+/**
13
+ * A low-level API to associate a generated position with an original source position. Line and
14
+ * column here are 0-based, unlike `addMapping`.
15
+ */
16
+let addSegment;
17
+/**
18
+ * A high-level API to associate a generated position with an original source position. Line is
19
+ * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
20
+ */
21
+let addMapping;
22
+/**
23
+ * Same as `addSegment`, but will only add the segment if it generates useful information in the
24
+ * resulting map. This only works correctly if segments are added **in order**, meaning you should
25
+ * not add a segment with a lower generated line/column than one that came before.
26
+ */
27
+let maybeAddSegment;
28
+/**
29
+ * Same as `addMapping`, but will only add the mapping if it generates useful information in the
30
+ * resulting map. This only works correctly if mappings are added **in order**, meaning you should
31
+ * not add a mapping with a lower generated line/column than one that came before.
32
+ */
33
+let maybeAddMapping;
34
+/**
35
+ * Adds/removes the content of the source file to the source map.
36
+ */
37
+let setSourceContent;
38
+/**
39
+ * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
40
+ * a sourcemap, or to JSON.stringify.
41
+ */
42
+let toDecodedMap;
43
+/**
44
+ * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
45
+ * a sourcemap, or to JSON.stringify.
46
+ */
47
+let toEncodedMap;
48
+/**
49
+ * Constructs a new GenMapping, using the already present mappings of the input.
50
+ */
51
+let fromMap;
52
+/**
53
+ * Returns an array of high-level mapping objects for every recorded segment, which could then be
54
+ * passed to the `source-map` library.
55
+ */
56
+let allMappings;
57
+// This split declaration is only so that terser can elminiate the static initialization block.
58
+let addSegmentInternal;
59
+/**
60
+ * Provides the state to generate a sourcemap.
61
+ */
62
+class GenMapping {
63
+    constructor({ file, sourceRoot } = {}) {
64
+        this._names = new SetArray();
65
+        this._sources = new SetArray();
66
+        this._sourcesContent = [];
67
+        this._mappings = [];
68
+        this.file = file;
69
+        this.sourceRoot = sourceRoot;
70
+    }
71
+}
72
+(() => {
73
+    addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
74
+        return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
75
+    };
76
+    maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
77
+        return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
78
+    };
79
+    addMapping = (map, mapping) => {
80
+        return addMappingInternal(false, map, mapping);
81
+    };
82
+    maybeAddMapping = (map, mapping) => {
83
+        return addMappingInternal(true, map, mapping);
84
+    };
85
+    setSourceContent = (map, source, content) => {
86
+        const { _sources: sources, _sourcesContent: sourcesContent } = map;
87
+        sourcesContent[put(sources, source)] = content;
88
+    };
89
+    toDecodedMap = (map) => {
90
+        const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
91
+        removeEmptyFinalLines(mappings);
92
+        return {
93
+            version: 3,
94
+            file: file || undefined,
95
+            names: names.array,
96
+            sourceRoot: sourceRoot || undefined,
97
+            sources: sources.array,
98
+            sourcesContent,
99
+            mappings,
100
+        };
101
+    };
102
+    toEncodedMap = (map) => {
103
+        const decoded = toDecodedMap(map);
104
+        return Object.assign(Object.assign({}, decoded), { mappings: encode(decoded.mappings) });
105
+    };
106
+    allMappings = (map) => {
107
+        const out = [];
108
+        const { _mappings: mappings, _sources: sources, _names: names } = map;
109
+        for (let i = 0; i < mappings.length; i++) {
110
+            const line = mappings[i];
111
+            for (let j = 0; j < line.length; j++) {
112
+                const seg = line[j];
113
+                const generated = { line: i + 1, column: seg[COLUMN] };
114
+                let source = undefined;
115
+                let original = undefined;
116
+                let name = undefined;
117
+                if (seg.length !== 1) {
118
+                    source = sources.array[seg[SOURCES_INDEX]];
119
+                    original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
120
+                    if (seg.length === 5)
121
+                        name = names.array[seg[NAMES_INDEX]];
122
+                }
123
+                out.push({ generated, source, original, name });
124
+            }
125
+        }
126
+        return out;
127
+    };
128
+    fromMap = (input) => {
129
+        const map = new TraceMap(input);
130
+        const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });
131
+        putAll(gen._names, map.names);
132
+        putAll(gen._sources, map.sources);
133
+        gen._sourcesContent = map.sourcesContent || map.sources.map(() => null);
134
+        gen._mappings = decodedMappings(map);
135
+        return gen;
136
+    };
137
+    // Internal helpers
138
+    addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
139
+        const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
140
+        const line = getLine(mappings, genLine);
141
+        const index = getColumnIndex(line, genColumn);
142
+        if (!source) {
143
+            if (skipable && skipSourceless(line, index))
144
+                return;
145
+            return insert(line, index, [genColumn]);
146
+        }
147
+        const sourcesIndex = put(sources, source);
148
+        const namesIndex = name ? put(names, name) : NO_NAME;
149
+        if (sourcesIndex === sourcesContent.length)
150
+            sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null;
151
+        if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
152
+            return;
153
+        }
154
+        return insert(line, index, name
155
+            ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
156
+            : [genColumn, sourcesIndex, sourceLine, sourceColumn]);
157
+    };
158
+})();
159
+function getLine(mappings, index) {
160
+    for (let i = mappings.length; i <= index; i++) {
161
+        mappings[i] = [];
162
+    }
163
+    return mappings[index];
164
+}
165
+function getColumnIndex(line, genColumn) {
166
+    let index = line.length;
167
+    for (let i = index - 1; i >= 0; index = i--) {
168
+        const current = line[i];
169
+        if (genColumn >= current[COLUMN])
170
+            break;
171
+    }
172
+    return index;
173
+}
174
+function insert(array, index, value) {
175
+    for (let i = array.length; i > index; i--) {
176
+        array[i] = array[i - 1];
177
+    }
178
+    array[index] = value;
179
+}
180
+function removeEmptyFinalLines(mappings) {
181
+    const { length } = mappings;
182
+    let len = length;
183
+    for (let i = len - 1; i >= 0; len = i, i--) {
184
+        if (mappings[i].length > 0)
185
+            break;
186
+    }
187
+    if (len < length)
188
+        mappings.length = len;
189
+}
190
+function putAll(strarr, array) {
191
+    for (let i = 0; i < array.length; i++)
192
+        put(strarr, array[i]);
193
+}
194
+function skipSourceless(line, index) {
195
+    // The start of a line is already sourceless, so adding a sourceless segment to the beginning
196
+    // doesn't generate any useful information.
197
+    if (index === 0)
198
+        return true;
199
+    const prev = line[index - 1];
200
+    // If the previous segment is also sourceless, then adding another sourceless segment doesn't
201
+    // genrate any new information. Else, this segment will end the source/named segment and point to
202
+    // a sourceless position, which is useful.
203
+    return prev.length === 1;
204
+}
205
+function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
206
+    // A source/named segment at the start of a line gives position at that genColumn
207
+    if (index === 0)
208
+        return false;
209
+    const prev = line[index - 1];
210
+    // If the previous segment is sourceless, then we're transitioning to a source.
211
+    if (prev.length === 1)
212
+        return false;
213
+    // If the previous segment maps to the exact same source position, then this segment doesn't
214
+    // provide any new position information.
215
+    return (sourcesIndex === prev[SOURCES_INDEX] &&
216
+        sourceLine === prev[SOURCE_LINE] &&
217
+        sourceColumn === prev[SOURCE_COLUMN] &&
218
+        namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME));
219
+}
220
+function addMappingInternal(skipable, map, mapping) {
221
+    const { generated, source, original, name, content } = mapping;
222
+    if (!source) {
223
+        return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null);
224
+    }
225
+    const s = source;
226
+    return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content);
227
+}
228
+
229
+export { GenMapping, addMapping, addSegment, allMappings, fromMap, maybeAddMapping, maybeAddSegment, setSourceContent, toDecodedMap, toEncodedMap };
230
+//# sourceMappingURL=gen-mapping.mjs.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs.map


+ 236 - 0
node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js

@@ -0,0 +1,236 @@
1
+(function (global, factory) {
2
+    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/set-array'), require('@jridgewell/sourcemap-codec'), require('@jridgewell/trace-mapping')) :
3
+    typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/set-array', '@jridgewell/sourcemap-codec', '@jridgewell/trace-mapping'], factory) :
4
+    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.genMapping = {}, global.setArray, global.sourcemapCodec, global.traceMapping));
5
+})(this, (function (exports, setArray, sourcemapCodec, traceMapping) { 'use strict';
6
+
7
+    const COLUMN = 0;
8
+    const SOURCES_INDEX = 1;
9
+    const SOURCE_LINE = 2;
10
+    const SOURCE_COLUMN = 3;
11
+    const NAMES_INDEX = 4;
12
+
13
+    const NO_NAME = -1;
14
+    /**
15
+     * A low-level API to associate a generated position with an original source position. Line and
16
+     * column here are 0-based, unlike `addMapping`.
17
+     */
18
+    exports.addSegment = void 0;
19
+    /**
20
+     * A high-level API to associate a generated position with an original source position. Line is
21
+     * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
22
+     */
23
+    exports.addMapping = void 0;
24
+    /**
25
+     * Same as `addSegment`, but will only add the segment if it generates useful information in the
26
+     * resulting map. This only works correctly if segments are added **in order**, meaning you should
27
+     * not add a segment with a lower generated line/column than one that came before.
28
+     */
29
+    exports.maybeAddSegment = void 0;
30
+    /**
31
+     * Same as `addMapping`, but will only add the mapping if it generates useful information in the
32
+     * resulting map. This only works correctly if mappings are added **in order**, meaning you should
33
+     * not add a mapping with a lower generated line/column than one that came before.
34
+     */
35
+    exports.maybeAddMapping = void 0;
36
+    /**
37
+     * Adds/removes the content of the source file to the source map.
38
+     */
39
+    exports.setSourceContent = void 0;
40
+    /**
41
+     * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
42
+     * a sourcemap, or to JSON.stringify.
43
+     */
44
+    exports.toDecodedMap = void 0;
45
+    /**
46
+     * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
47
+     * a sourcemap, or to JSON.stringify.
48
+     */
49
+    exports.toEncodedMap = void 0;
50
+    /**
51
+     * Constructs a new GenMapping, using the already present mappings of the input.
52
+     */
53
+    exports.fromMap = void 0;
54
+    /**
55
+     * Returns an array of high-level mapping objects for every recorded segment, which could then be
56
+     * passed to the `source-map` library.
57
+     */
58
+    exports.allMappings = void 0;
59
+    // This split declaration is only so that terser can elminiate the static initialization block.
60
+    let addSegmentInternal;
61
+    /**
62
+     * Provides the state to generate a sourcemap.
63
+     */
64
+    class GenMapping {
65
+        constructor({ file, sourceRoot } = {}) {
66
+            this._names = new setArray.SetArray();
67
+            this._sources = new setArray.SetArray();
68
+            this._sourcesContent = [];
69
+            this._mappings = [];
70
+            this.file = file;
71
+            this.sourceRoot = sourceRoot;
72
+        }
73
+    }
74
+    (() => {
75
+        exports.addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
76
+            return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
77
+        };
78
+        exports.maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
79
+            return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
80
+        };
81
+        exports.addMapping = (map, mapping) => {
82
+            return addMappingInternal(false, map, mapping);
83
+        };
84
+        exports.maybeAddMapping = (map, mapping) => {
85
+            return addMappingInternal(true, map, mapping);
86
+        };
87
+        exports.setSourceContent = (map, source, content) => {
88
+            const { _sources: sources, _sourcesContent: sourcesContent } = map;
89
+            sourcesContent[setArray.put(sources, source)] = content;
90
+        };
91
+        exports.toDecodedMap = (map) => {
92
+            const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
93
+            removeEmptyFinalLines(mappings);
94
+            return {
95
+                version: 3,
96
+                file: file || undefined,
97
+                names: names.array,
98
+                sourceRoot: sourceRoot || undefined,
99
+                sources: sources.array,
100
+                sourcesContent,
101
+                mappings,
102
+            };
103
+        };
104
+        exports.toEncodedMap = (map) => {
105
+            const decoded = exports.toDecodedMap(map);
106
+            return Object.assign(Object.assign({}, decoded), { mappings: sourcemapCodec.encode(decoded.mappings) });
107
+        };
108
+        exports.allMappings = (map) => {
109
+            const out = [];
110
+            const { _mappings: mappings, _sources: sources, _names: names } = map;
111
+            for (let i = 0; i < mappings.length; i++) {
112
+                const line = mappings[i];
113
+                for (let j = 0; j < line.length; j++) {
114
+                    const seg = line[j];
115
+                    const generated = { line: i + 1, column: seg[COLUMN] };
116
+                    let source = undefined;
117
+                    let original = undefined;
118
+                    let name = undefined;
119
+                    if (seg.length !== 1) {
120
+                        source = sources.array[seg[SOURCES_INDEX]];
121
+                        original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
122
+                        if (seg.length === 5)
123
+                            name = names.array[seg[NAMES_INDEX]];
124
+                    }
125
+                    out.push({ generated, source, original, name });
126
+                }
127
+            }
128
+            return out;
129
+        };
130
+        exports.fromMap = (input) => {
131
+            const map = new traceMapping.TraceMap(input);
132
+            const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });
133
+            putAll(gen._names, map.names);
134
+            putAll(gen._sources, map.sources);
135
+            gen._sourcesContent = map.sourcesContent || map.sources.map(() => null);
136
+            gen._mappings = traceMapping.decodedMappings(map);
137
+            return gen;
138
+        };
139
+        // Internal helpers
140
+        addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
141
+            const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
142
+            const line = getLine(mappings, genLine);
143
+            const index = getColumnIndex(line, genColumn);
144
+            if (!source) {
145
+                if (skipable && skipSourceless(line, index))
146
+                    return;
147
+                return insert(line, index, [genColumn]);
148
+            }
149
+            const sourcesIndex = setArray.put(sources, source);
150
+            const namesIndex = name ? setArray.put(names, name) : NO_NAME;
151
+            if (sourcesIndex === sourcesContent.length)
152
+                sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null;
153
+            if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
154
+                return;
155
+            }
156
+            return insert(line, index, name
157
+                ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
158
+                : [genColumn, sourcesIndex, sourceLine, sourceColumn]);
159
+        };
160
+    })();
161
+    function getLine(mappings, index) {
162
+        for (let i = mappings.length; i <= index; i++) {
163
+            mappings[i] = [];
164
+        }
165
+        return mappings[index];
166
+    }
167
+    function getColumnIndex(line, genColumn) {
168
+        let index = line.length;
169
+        for (let i = index - 1; i >= 0; index = i--) {
170
+            const current = line[i];
171
+            if (genColumn >= current[COLUMN])
172
+                break;
173
+        }
174
+        return index;
175
+    }
176
+    function insert(array, index, value) {
177
+        for (let i = array.length; i > index; i--) {
178
+            array[i] = array[i - 1];
179
+        }
180
+        array[index] = value;
181
+    }
182
+    function removeEmptyFinalLines(mappings) {
183
+        const { length } = mappings;
184
+        let len = length;
185
+        for (let i = len - 1; i >= 0; len = i, i--) {
186
+            if (mappings[i].length > 0)
187
+                break;
188
+        }
189
+        if (len < length)
190
+            mappings.length = len;
191
+    }
192
+    function putAll(strarr, array) {
193
+        for (let i = 0; i < array.length; i++)
194
+            setArray.put(strarr, array[i]);
195
+    }
196
+    function skipSourceless(line, index) {
197
+        // The start of a line is already sourceless, so adding a sourceless segment to the beginning
198
+        // doesn't generate any useful information.
199
+        if (index === 0)
200
+            return true;
201
+        const prev = line[index - 1];
202
+        // If the previous segment is also sourceless, then adding another sourceless segment doesn't
203
+        // genrate any new information. Else, this segment will end the source/named segment and point to
204
+        // a sourceless position, which is useful.
205
+        return prev.length === 1;
206
+    }
207
+    function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
208
+        // A source/named segment at the start of a line gives position at that genColumn
209
+        if (index === 0)
210
+            return false;
211
+        const prev = line[index - 1];
212
+        // If the previous segment is sourceless, then we're transitioning to a source.
213
+        if (prev.length === 1)
214
+            return false;
215
+        // If the previous segment maps to the exact same source position, then this segment doesn't
216
+        // provide any new position information.
217
+        return (sourcesIndex === prev[SOURCES_INDEX] &&
218
+            sourceLine === prev[SOURCE_LINE] &&
219
+            sourceColumn === prev[SOURCE_COLUMN] &&
220
+            namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME));
221
+    }
222
+    function addMappingInternal(skipable, map, mapping) {
223
+        const { generated, source, original, name, content } = mapping;
224
+        if (!source) {
225
+            return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null);
226
+        }
227
+        const s = source;
228
+        return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content);
229
+    }
230
+
231
+    exports.GenMapping = GenMapping;
232
+
233
+    Object.defineProperty(exports, '__esModule', { value: true });
234
+
235
+}));
236
+//# sourceMappingURL=gen-mapping.umd.js.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js.map


+ 90 - 0
node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts

@@ -0,0 +1,90 @@
1
+import type { SourceMapInput } from '@jridgewell/trace-mapping';
2
+import type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types';
3
+export type { DecodedSourceMap, EncodedSourceMap, Mapping };
4
+export declare type Options = {
5
+    file?: string | null;
6
+    sourceRoot?: string | null;
7
+};
8
+/**
9
+ * A low-level API to associate a generated position with an original source position. Line and
10
+ * column here are 0-based, unlike `addMapping`.
11
+ */
12
+export declare let addSegment: {
13
+    (map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null, content?: null): void;
14
+    (map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name?: null, content?: string | null): void;
15
+    (map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name: string, content?: string | null): void;
16
+};
17
+/**
18
+ * A high-level API to associate a generated position with an original source position. Line is
19
+ * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
20
+ */
21
+export declare let addMapping: {
22
+    (map: GenMapping, mapping: {
23
+        generated: Pos;
24
+        source?: null;
25
+        original?: null;
26
+        name?: null;
27
+        content?: null;
28
+    }): void;
29
+    (map: GenMapping, mapping: {
30
+        generated: Pos;
31
+        source: string;
32
+        original: Pos;
33
+        name?: null;
34
+        content?: string | null;
35
+    }): void;
36
+    (map: GenMapping, mapping: {
37
+        generated: Pos;
38
+        source: string;
39
+        original: Pos;
40
+        name: string;
41
+        content?: string | null;
42
+    }): void;
43
+};
44
+/**
45
+ * Same as `addSegment`, but will only add the segment if it generates useful information in the
46
+ * resulting map. This only works correctly if segments are added **in order**, meaning you should
47
+ * not add a segment with a lower generated line/column than one that came before.
48
+ */
49
+export declare let maybeAddSegment: typeof addSegment;
50
+/**
51
+ * Same as `addMapping`, but will only add the mapping if it generates useful information in the
52
+ * resulting map. This only works correctly if mappings are added **in order**, meaning you should
53
+ * not add a mapping with a lower generated line/column than one that came before.
54
+ */
55
+export declare let maybeAddMapping: typeof addMapping;
56
+/**
57
+ * Adds/removes the content of the source file to the source map.
58
+ */
59
+export declare let setSourceContent: (map: GenMapping, source: string, content: string | null) => void;
60
+/**
61
+ * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
62
+ * a sourcemap, or to JSON.stringify.
63
+ */
64
+export declare let toDecodedMap: (map: GenMapping) => DecodedSourceMap;
65
+/**
66
+ * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
67
+ * a sourcemap, or to JSON.stringify.
68
+ */
69
+export declare let toEncodedMap: (map: GenMapping) => EncodedSourceMap;
70
+/**
71
+ * Constructs a new GenMapping, using the already present mappings of the input.
72
+ */
73
+export declare let fromMap: (input: SourceMapInput) => GenMapping;
74
+/**
75
+ * Returns an array of high-level mapping objects for every recorded segment, which could then be
76
+ * passed to the `source-map` library.
77
+ */
78
+export declare let allMappings: (map: GenMapping) => Mapping[];
79
+/**
80
+ * Provides the state to generate a sourcemap.
81
+ */
82
+export declare class GenMapping {
83
+    private _names;
84
+    private _sources;
85
+    private _sourcesContent;
86
+    private _mappings;
87
+    file: string | null | undefined;
88
+    sourceRoot: string | null | undefined;
89
+    constructor({ file, sourceRoot }?: Options);
90
+}

+ 12 - 0
node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts

@@ -0,0 +1,12 @@
1
+declare type GeneratedColumn = number;
2
+declare type SourcesIndex = number;
3
+declare type SourceLine = number;
4
+declare type SourceColumn = number;
5
+declare type NamesIndex = number;
6
+export declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];
7
+export declare const COLUMN = 0;
8
+export declare const SOURCES_INDEX = 1;
9
+export declare const SOURCE_LINE = 2;
10
+export declare const SOURCE_COLUMN = 3;
11
+export declare const NAMES_INDEX = 4;
12
+export {};

+ 35 - 0
node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts

@@ -0,0 +1,35 @@
1
+import type { SourceMapSegment } from './sourcemap-segment';
2
+export interface SourceMapV3 {
3
+    file?: string | null;
4
+    names: readonly string[];
5
+    sourceRoot?: string;
6
+    sources: readonly (string | null)[];
7
+    sourcesContent?: readonly (string | null)[];
8
+    version: 3;
9
+}
10
+export interface EncodedSourceMap extends SourceMapV3 {
11
+    mappings: string;
12
+}
13
+export interface DecodedSourceMap extends SourceMapV3 {
14
+    mappings: readonly SourceMapSegment[][];
15
+}
16
+export interface Pos {
17
+    line: number;
18
+    column: number;
19
+}
20
+export declare type Mapping = {
21
+    generated: Pos;
22
+    source: undefined;
23
+    original: undefined;
24
+    name: undefined;
25
+} | {
26
+    generated: Pos;
27
+    source: string;
28
+    original: Pos;
29
+    name: string;
30
+} | {
31
+    generated: Pos;
32
+    source: string;
33
+    original: Pos;
34
+    name: undefined;
35
+};

+ 77 - 0
node_modules/@jridgewell/gen-mapping/package.json

@@ -0,0 +1,77 @@
1
+{
2
+  "name": "@jridgewell/gen-mapping",
3
+  "version": "0.3.3",
4
+  "description": "Generate source maps",
5
+  "keywords": [
6
+    "source",
7
+    "map"
8
+  ],
9
+  "author": "Justin Ridgewell <justin@ridgewell.name>",
10
+  "license": "MIT",
11
+  "repository": "https://github.com/jridgewell/gen-mapping",
12
+  "main": "dist/gen-mapping.umd.js",
13
+  "module": "dist/gen-mapping.mjs",
14
+  "types": "dist/types/gen-mapping.d.ts",
15
+  "exports": {
16
+    ".": [
17
+      {
18
+        "types": "./dist/types/gen-mapping.d.ts",
19
+        "browser": "./dist/gen-mapping.umd.js",
20
+        "require": "./dist/gen-mapping.umd.js",
21
+        "import": "./dist/gen-mapping.mjs"
22
+      },
23
+      "./dist/gen-mapping.umd.js"
24
+    ],
25
+    "./package.json": "./package.json"
26
+  },
27
+  "files": [
28
+    "dist"
29
+  ],
30
+  "engines": {
31
+    "node": ">=6.0.0"
32
+  },
33
+  "scripts": {
34
+    "benchmark": "run-s build:rollup benchmark:*",
35
+    "benchmark:install": "cd benchmark && npm install",
36
+    "benchmark:only": "node benchmark/index.mjs",
37
+    "prebuild": "rm -rf dist",
38
+    "build": "run-s -n build:*",
39
+    "build:rollup": "rollup -c rollup.config.js",
40
+    "build:ts": "tsc --project tsconfig.build.json",
41
+    "lint": "run-s -n lint:*",
42
+    "lint:prettier": "npm run test:lint:prettier -- --write",
43
+    "lint:ts": "npm run test:lint:ts -- --fix",
44
+    "pretest": "run-s build:rollup",
45
+    "test": "run-s -n test:lint test:coverage",
46
+    "test:debug": "mocha --inspect-brk",
47
+    "test:lint": "run-s -n test:lint:*",
48
+    "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
49
+    "test:lint:ts": "eslint '{src,test}/**/*.ts'",
50
+    "test:only": "mocha",
51
+    "test:coverage": "c8 mocha",
52
+    "test:watch": "run-p 'build:rollup -- --watch' 'test:only -- --watch'",
53
+    "prepublishOnly": "npm run preversion",
54
+    "preversion": "run-s test build"
55
+  },
56
+  "devDependencies": {
57
+    "@rollup/plugin-typescript": "8.3.2",
58
+    "@types/mocha": "9.1.1",
59
+    "@types/node": "17.0.29",
60
+    "@typescript-eslint/eslint-plugin": "5.21.0",
61
+    "@typescript-eslint/parser": "5.21.0",
62
+    "benchmark": "2.1.4",
63
+    "c8": "7.11.2",
64
+    "eslint": "8.14.0",
65
+    "eslint-config-prettier": "8.5.0",
66
+    "mocha": "9.2.2",
67
+    "npm-run-all": "4.1.5",
68
+    "prettier": "2.6.2",
69
+    "rollup": "2.70.2",
70
+    "typescript": "4.6.3"
71
+  },
72
+  "dependencies": {
73
+    "@jridgewell/set-array": "^1.0.1",
74
+    "@jridgewell/sourcemap-codec": "^1.4.10",
75
+    "@jridgewell/trace-mapping": "^0.3.9"
76
+  }
77
+}

+ 19 - 0
node_modules/@jridgewell/resolve-uri/LICENSE

@@ -0,0 +1,19 @@
1
+Copyright 2019 Justin Ridgewell <jridgewell@google.com>
2
+
3
+Permission is hereby granted, free of charge, to any person obtaining a copy
4
+of this software and associated documentation files (the "Software"), to deal
5
+in the Software without restriction, including without limitation the rights
6
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+copies of the Software, and to permit persons to whom the Software is
8
+furnished to do so, subject to the following conditions:
9
+
10
+The above copyright notice and this permission notice shall be included in
11
+all copies or substantial portions of the Software.
12
+
13
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+SOFTWARE.

+ 40 - 0
node_modules/@jridgewell/resolve-uri/README.md

@@ -0,0 +1,40 @@
1
+# @jridgewell/resolve-uri
2
+
3
+> Resolve a URI relative to an optional base URI
4
+
5
+Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths.
6
+
7
+## Installation
8
+
9
+```sh
10
+npm install @jridgewell/resolve-uri
11
+```
12
+
13
+## Usage
14
+
15
+```typescript
16
+function resolve(input: string, base?: string): string;
17
+```
18
+
19
+```js
20
+import resolve from '@jridgewell/resolve-uri';
21
+
22
+resolve('foo', 'https://example.com'); // => 'https://example.com/foo'
23
+```
24
+
25
+| Input                 | Base                    | Resolution                     | Explanation                                                  |
26
+|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------|
27
+| `https://example.com` | _any_                   | `https://example.com/`         | Input is normalized only                                     |
28
+| `//example.com`       | `https://base.com/`     | `https://example.com/`         | Input inherits the base's protocol                           |
29
+| `//example.com`       | _rest_                  | `//example.com/`               | Input is normalized only                                     |
30
+| `/example`            | `https://base.com/`     | `https://base.com/example`     | Input inherits the base's origin                             |
31
+| `/example`            | `//base.com/`           | `//base.com/example`           | Input inherits the base's host and remains protocol relative |
32
+| `/example`            | _rest_                  | `/example`                     | Input is normalized only                                     |
33
+| `example`             | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base                                |
34
+| `example`             | `https://base.com/file` | `https://base.com/example`     | Input is joined with the base without its file               |
35
+| `example`             | `//base.com/dir/`       | `//base.com/dir/example`       | Input is joined with the base's last directory               |
36
+| `example`             | `//base.com/file`       | `//base.com/example`           | Input is joined with the base without its file               |
37
+| `example`             | `/base/dir/`            | `/base/dir/example`            | Input is joined with the base's last directory               |
38
+| `example`             | `/base/file`            | `/base/example`                | Input is joined with the base without its file               |
39
+| `example`             | `base/dir/`             | `base/dir/example`             | Input is joined with the base's last directory               |
40
+| `example`             | `base/file`             | `base/example`                 | Input is joined with the base without its file               |

+ 242 - 0
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs

@@ -0,0 +1,242 @@
1
+// Matches the scheme of a URL, eg "http://"
2
+const schemeRegex = /^[\w+.-]+:\/\//;
3
+/**
4
+ * Matches the parts of a URL:
5
+ * 1. Scheme, including ":", guaranteed.
6
+ * 2. User/password, including "@", optional.
7
+ * 3. Host, guaranteed.
8
+ * 4. Port, including ":", optional.
9
+ * 5. Path, including "/", optional.
10
+ * 6. Query, including "?", optional.
11
+ * 7. Hash, including "#", optional.
12
+ */
13
+const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
14
+/**
15
+ * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
16
+ * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
17
+ *
18
+ * 1. Host, optional.
19
+ * 2. Path, which may include "/", guaranteed.
20
+ * 3. Query, including "?", optional.
21
+ * 4. Hash, including "#", optional.
22
+ */
23
+const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
24
+var UrlType;
25
+(function (UrlType) {
26
+    UrlType[UrlType["Empty"] = 1] = "Empty";
27
+    UrlType[UrlType["Hash"] = 2] = "Hash";
28
+    UrlType[UrlType["Query"] = 3] = "Query";
29
+    UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
30
+    UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
31
+    UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
32
+    UrlType[UrlType["Absolute"] = 7] = "Absolute";
33
+})(UrlType || (UrlType = {}));
34
+function isAbsoluteUrl(input) {
35
+    return schemeRegex.test(input);
36
+}
37
+function isSchemeRelativeUrl(input) {
38
+    return input.startsWith('//');
39
+}
40
+function isAbsolutePath(input) {
41
+    return input.startsWith('/');
42
+}
43
+function isFileUrl(input) {
44
+    return input.startsWith('file:');
45
+}
46
+function isRelative(input) {
47
+    return /^[.?#]/.test(input);
48
+}
49
+function parseAbsoluteUrl(input) {
50
+    const match = urlRegex.exec(input);
51
+    return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
52
+}
53
+function parseFileUrl(input) {
54
+    const match = fileRegex.exec(input);
55
+    const path = match[2];
56
+    return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
57
+}
58
+function makeUrl(scheme, user, host, port, path, query, hash) {
59
+    return {
60
+        scheme,
61
+        user,
62
+        host,
63
+        port,
64
+        path,
65
+        query,
66
+        hash,
67
+        type: UrlType.Absolute,
68
+    };
69
+}
70
+function parseUrl(input) {
71
+    if (isSchemeRelativeUrl(input)) {
72
+        const url = parseAbsoluteUrl('http:' + input);
73
+        url.scheme = '';
74
+        url.type = UrlType.SchemeRelative;
75
+        return url;
76
+    }
77
+    if (isAbsolutePath(input)) {
78
+        const url = parseAbsoluteUrl('http://foo.com' + input);
79
+        url.scheme = '';
80
+        url.host = '';
81
+        url.type = UrlType.AbsolutePath;
82
+        return url;
83
+    }
84
+    if (isFileUrl(input))
85
+        return parseFileUrl(input);
86
+    if (isAbsoluteUrl(input))
87
+        return parseAbsoluteUrl(input);
88
+    const url = parseAbsoluteUrl('http://foo.com/' + input);
89
+    url.scheme = '';
90
+    url.host = '';
91
+    url.type = input
92
+        ? input.startsWith('?')
93
+            ? UrlType.Query
94
+            : input.startsWith('#')
95
+                ? UrlType.Hash
96
+                : UrlType.RelativePath
97
+        : UrlType.Empty;
98
+    return url;
99
+}
100
+function stripPathFilename(path) {
101
+    // If a path ends with a parent directory "..", then it's a relative path with excess parent
102
+    // paths. It's not a file, so we can't strip it.
103
+    if (path.endsWith('/..'))
104
+        return path;
105
+    const index = path.lastIndexOf('/');
106
+    return path.slice(0, index + 1);
107
+}
108
+function mergePaths(url, base) {
109
+    normalizePath(base, base.type);
110
+    // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
111
+    // path).
112
+    if (url.path === '/') {
113
+        url.path = base.path;
114
+    }
115
+    else {
116
+        // Resolution happens relative to the base path's directory, not the file.
117
+        url.path = stripPathFilename(base.path) + url.path;
118
+    }
119
+}
120
+/**
121
+ * The path can have empty directories "//", unneeded parents "foo/..", or current directory
122
+ * "foo/.". We need to normalize to a standard representation.
123
+ */
124
+function normalizePath(url, type) {
125
+    const rel = type <= UrlType.RelativePath;
126
+    const pieces = url.path.split('/');
127
+    // We need to preserve the first piece always, so that we output a leading slash. The item at
128
+    // pieces[0] is an empty string.
129
+    let pointer = 1;
130
+    // Positive is the number of real directories we've output, used for popping a parent directory.
131
+    // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
132
+    let positive = 0;
133
+    // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
134
+    // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
135
+    // real directory, we won't need to append, unless the other conditions happen again.
136
+    let addTrailingSlash = false;
137
+    for (let i = 1; i < pieces.length; i++) {
138
+        const piece = pieces[i];
139
+        // An empty directory, could be a trailing slash, or just a double "//" in the path.
140
+        if (!piece) {
141
+            addTrailingSlash = true;
142
+            continue;
143
+        }
144
+        // If we encounter a real directory, then we don't need to append anymore.
145
+        addTrailingSlash = false;
146
+        // A current directory, which we can always drop.
147
+        if (piece === '.')
148
+            continue;
149
+        // A parent directory, we need to see if there are any real directories we can pop. Else, we
150
+        // have an excess of parents, and we'll need to keep the "..".
151
+        if (piece === '..') {
152
+            if (positive) {
153
+                addTrailingSlash = true;
154
+                positive--;
155
+                pointer--;
156
+            }
157
+            else if (rel) {
158
+                // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
159
+                // URL, protocol relative URL, or an absolute path, we don't need to keep excess.
160
+                pieces[pointer++] = piece;
161
+            }
162
+            continue;
163
+        }
164
+        // We've encountered a real directory. Move it to the next insertion pointer, which accounts for
165
+        // any popped or dropped directories.
166
+        pieces[pointer++] = piece;
167
+        positive++;
168
+    }
169
+    let path = '';
170
+    for (let i = 1; i < pointer; i++) {
171
+        path += '/' + pieces[i];
172
+    }
173
+    if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
174
+        path += '/';
175
+    }
176
+    url.path = path;
177
+}
178
+/**
179
+ * Attempts to resolve `input` URL/path relative to `base`.
180
+ */
181
+function resolve(input, base) {
182
+    if (!input && !base)
183
+        return '';
184
+    const url = parseUrl(input);
185
+    let inputType = url.type;
186
+    if (base && inputType !== UrlType.Absolute) {
187
+        const baseUrl = parseUrl(base);
188
+        const baseType = baseUrl.type;
189
+        switch (inputType) {
190
+            case UrlType.Empty:
191
+                url.hash = baseUrl.hash;
192
+            // fall through
193
+            case UrlType.Hash:
194
+                url.query = baseUrl.query;
195
+            // fall through
196
+            case UrlType.Query:
197
+            case UrlType.RelativePath:
198
+                mergePaths(url, baseUrl);
199
+            // fall through
200
+            case UrlType.AbsolutePath:
201
+                // The host, user, and port are joined, you can't copy one without the others.
202
+                url.user = baseUrl.user;
203
+                url.host = baseUrl.host;
204
+                url.port = baseUrl.port;
205
+            // fall through
206
+            case UrlType.SchemeRelative:
207
+                // The input doesn't have a schema at least, so we need to copy at least that over.
208
+                url.scheme = baseUrl.scheme;
209
+        }
210
+        if (baseType > inputType)
211
+            inputType = baseType;
212
+    }
213
+    normalizePath(url, inputType);
214
+    const queryHash = url.query + url.hash;
215
+    switch (inputType) {
216
+        // This is impossible, because of the empty checks at the start of the function.
217
+        // case UrlType.Empty:
218
+        case UrlType.Hash:
219
+        case UrlType.Query:
220
+            return queryHash;
221
+        case UrlType.RelativePath: {
222
+            // The first char is always a "/", and we need it to be relative.
223
+            const path = url.path.slice(1);
224
+            if (!path)
225
+                return queryHash || '.';
226
+            if (isRelative(base || input) && !isRelative(path)) {
227
+                // If base started with a leading ".", or there is no base and input started with a ".",
228
+                // then we need to ensure that the relative path starts with a ".". We don't know if
229
+                // relative starts with a "..", though, so check before prepending.
230
+                return './' + path + queryHash;
231
+            }
232
+            return path + queryHash;
233
+        }
234
+        case UrlType.AbsolutePath:
235
+            return url.path + queryHash;
236
+        default:
237
+            return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
238
+    }
239
+}
240
+
241
+export { resolve as default };
242
+//# sourceMappingURL=resolve-uri.mjs.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map


+ 250 - 0
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js

@@ -0,0 +1,250 @@
1
+(function (global, factory) {
2
+    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+    typeof define === 'function' && define.amd ? define(factory) :
4
+    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory());
5
+})(this, (function () { 'use strict';
6
+
7
+    // Matches the scheme of a URL, eg "http://"
8
+    const schemeRegex = /^[\w+.-]+:\/\//;
9
+    /**
10
+     * Matches the parts of a URL:
11
+     * 1. Scheme, including ":", guaranteed.
12
+     * 2. User/password, including "@", optional.
13
+     * 3. Host, guaranteed.
14
+     * 4. Port, including ":", optional.
15
+     * 5. Path, including "/", optional.
16
+     * 6. Query, including "?", optional.
17
+     * 7. Hash, including "#", optional.
18
+     */
19
+    const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
20
+    /**
21
+     * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
22
+     * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
23
+     *
24
+     * 1. Host, optional.
25
+     * 2. Path, which may include "/", guaranteed.
26
+     * 3. Query, including "?", optional.
27
+     * 4. Hash, including "#", optional.
28
+     */
29
+    const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
30
+    var UrlType;
31
+    (function (UrlType) {
32
+        UrlType[UrlType["Empty"] = 1] = "Empty";
33
+        UrlType[UrlType["Hash"] = 2] = "Hash";
34
+        UrlType[UrlType["Query"] = 3] = "Query";
35
+        UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
36
+        UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
37
+        UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
38
+        UrlType[UrlType["Absolute"] = 7] = "Absolute";
39
+    })(UrlType || (UrlType = {}));
40
+    function isAbsoluteUrl(input) {
41
+        return schemeRegex.test(input);
42
+    }
43
+    function isSchemeRelativeUrl(input) {
44
+        return input.startsWith('//');
45
+    }
46
+    function isAbsolutePath(input) {
47
+        return input.startsWith('/');
48
+    }
49
+    function isFileUrl(input) {
50
+        return input.startsWith('file:');
51
+    }
52
+    function isRelative(input) {
53
+        return /^[.?#]/.test(input);
54
+    }
55
+    function parseAbsoluteUrl(input) {
56
+        const match = urlRegex.exec(input);
57
+        return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
58
+    }
59
+    function parseFileUrl(input) {
60
+        const match = fileRegex.exec(input);
61
+        const path = match[2];
62
+        return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
63
+    }
64
+    function makeUrl(scheme, user, host, port, path, query, hash) {
65
+        return {
66
+            scheme,
67
+            user,
68
+            host,
69
+            port,
70
+            path,
71
+            query,
72
+            hash,
73
+            type: UrlType.Absolute,
74
+        };
75
+    }
76
+    function parseUrl(input) {
77
+        if (isSchemeRelativeUrl(input)) {
78
+            const url = parseAbsoluteUrl('http:' + input);
79
+            url.scheme = '';
80
+            url.type = UrlType.SchemeRelative;
81
+            return url;
82
+        }
83
+        if (isAbsolutePath(input)) {
84
+            const url = parseAbsoluteUrl('http://foo.com' + input);
85
+            url.scheme = '';
86
+            url.host = '';
87
+            url.type = UrlType.AbsolutePath;
88
+            return url;
89
+        }
90
+        if (isFileUrl(input))
91
+            return parseFileUrl(input);
92
+        if (isAbsoluteUrl(input))
93
+            return parseAbsoluteUrl(input);
94
+        const url = parseAbsoluteUrl('http://foo.com/' + input);
95
+        url.scheme = '';
96
+        url.host = '';
97
+        url.type = input
98
+            ? input.startsWith('?')
99
+                ? UrlType.Query
100
+                : input.startsWith('#')
101
+                    ? UrlType.Hash
102
+                    : UrlType.RelativePath
103
+            : UrlType.Empty;
104
+        return url;
105
+    }
106
+    function stripPathFilename(path) {
107
+        // If a path ends with a parent directory "..", then it's a relative path with excess parent
108
+        // paths. It's not a file, so we can't strip it.
109
+        if (path.endsWith('/..'))
110
+            return path;
111
+        const index = path.lastIndexOf('/');
112
+        return path.slice(0, index + 1);
113
+    }
114
+    function mergePaths(url, base) {
115
+        normalizePath(base, base.type);
116
+        // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
117
+        // path).
118
+        if (url.path === '/') {
119
+            url.path = base.path;
120
+        }
121
+        else {
122
+            // Resolution happens relative to the base path's directory, not the file.
123
+            url.path = stripPathFilename(base.path) + url.path;
124
+        }
125
+    }
126
+    /**
127
+     * The path can have empty directories "//", unneeded parents "foo/..", or current directory
128
+     * "foo/.". We need to normalize to a standard representation.
129
+     */
130
+    function normalizePath(url, type) {
131
+        const rel = type <= UrlType.RelativePath;
132
+        const pieces = url.path.split('/');
133
+        // We need to preserve the first piece always, so that we output a leading slash. The item at
134
+        // pieces[0] is an empty string.
135
+        let pointer = 1;
136
+        // Positive is the number of real directories we've output, used for popping a parent directory.
137
+        // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
138
+        let positive = 0;
139
+        // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
140
+        // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
141
+        // real directory, we won't need to append, unless the other conditions happen again.
142
+        let addTrailingSlash = false;
143
+        for (let i = 1; i < pieces.length; i++) {
144
+            const piece = pieces[i];
145
+            // An empty directory, could be a trailing slash, or just a double "//" in the path.
146
+            if (!piece) {
147
+                addTrailingSlash = true;
148
+                continue;
149
+            }
150
+            // If we encounter a real directory, then we don't need to append anymore.
151
+            addTrailingSlash = false;
152
+            // A current directory, which we can always drop.
153
+            if (piece === '.')
154
+                continue;
155
+            // A parent directory, we need to see if there are any real directories we can pop. Else, we
156
+            // have an excess of parents, and we'll need to keep the "..".
157
+            if (piece === '..') {
158
+                if (positive) {
159
+                    addTrailingSlash = true;
160
+                    positive--;
161
+                    pointer--;
162
+                }
163
+                else if (rel) {
164
+                    // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
165
+                    // URL, protocol relative URL, or an absolute path, we don't need to keep excess.
166
+                    pieces[pointer++] = piece;
167
+                }
168
+                continue;
169
+            }
170
+            // We've encountered a real directory. Move it to the next insertion pointer, which accounts for
171
+            // any popped or dropped directories.
172
+            pieces[pointer++] = piece;
173
+            positive++;
174
+        }
175
+        let path = '';
176
+        for (let i = 1; i < pointer; i++) {
177
+            path += '/' + pieces[i];
178
+        }
179
+        if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
180
+            path += '/';
181
+        }
182
+        url.path = path;
183
+    }
184
+    /**
185
+     * Attempts to resolve `input` URL/path relative to `base`.
186
+     */
187
+    function resolve(input, base) {
188
+        if (!input && !base)
189
+            return '';
190
+        const url = parseUrl(input);
191
+        let inputType = url.type;
192
+        if (base && inputType !== UrlType.Absolute) {
193
+            const baseUrl = parseUrl(base);
194
+            const baseType = baseUrl.type;
195
+            switch (inputType) {
196
+                case UrlType.Empty:
197
+                    url.hash = baseUrl.hash;
198
+                // fall through
199
+                case UrlType.Hash:
200
+                    url.query = baseUrl.query;
201
+                // fall through
202
+                case UrlType.Query:
203
+                case UrlType.RelativePath:
204
+                    mergePaths(url, baseUrl);
205
+                // fall through
206
+                case UrlType.AbsolutePath:
207
+                    // The host, user, and port are joined, you can't copy one without the others.
208
+                    url.user = baseUrl.user;
209
+                    url.host = baseUrl.host;
210
+                    url.port = baseUrl.port;
211
+                // fall through
212
+                case UrlType.SchemeRelative:
213
+                    // The input doesn't have a schema at least, so we need to copy at least that over.
214
+                    url.scheme = baseUrl.scheme;
215
+            }
216
+            if (baseType > inputType)
217
+                inputType = baseType;
218
+        }
219
+        normalizePath(url, inputType);
220
+        const queryHash = url.query + url.hash;
221
+        switch (inputType) {
222
+            // This is impossible, because of the empty checks at the start of the function.
223
+            // case UrlType.Empty:
224
+            case UrlType.Hash:
225
+            case UrlType.Query:
226
+                return queryHash;
227
+            case UrlType.RelativePath: {
228
+                // The first char is always a "/", and we need it to be relative.
229
+                const path = url.path.slice(1);
230
+                if (!path)
231
+                    return queryHash || '.';
232
+                if (isRelative(base || input) && !isRelative(path)) {
233
+                    // If base started with a leading ".", or there is no base and input started with a ".",
234
+                    // then we need to ensure that the relative path starts with a ".". We don't know if
235
+                    // relative starts with a "..", though, so check before prepending.
236
+                    return './' + path + queryHash;
237
+                }
238
+                return path + queryHash;
239
+            }
240
+            case UrlType.AbsolutePath:
241
+                return url.path + queryHash;
242
+            default:
243
+                return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
244
+        }
245
+    }
246
+
247
+    return resolve;
248
+
249
+}));
250
+//# sourceMappingURL=resolve-uri.umd.js.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map


+ 4 - 0
node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts

@@ -0,0 +1,4 @@
1
+/**
2
+ * Attempts to resolve `input` URL/path relative to `base`.
3
+ */
4
+export default function resolve(input: string, base: string | undefined): string;

+ 69 - 0
node_modules/@jridgewell/resolve-uri/package.json

@@ -0,0 +1,69 @@
1
+{
2
+  "name": "@jridgewell/resolve-uri",
3
+  "version": "3.1.0",
4
+  "description": "Resolve a URI relative to an optional base URI",
5
+  "keywords": [
6
+    "resolve",
7
+    "uri",
8
+    "url",
9
+    "path"
10
+  ],
11
+  "author": "Justin Ridgewell <justin@ridgewell.name>",
12
+  "license": "MIT",
13
+  "repository": "https://github.com/jridgewell/resolve-uri",
14
+  "main": "dist/resolve-uri.umd.js",
15
+  "module": "dist/resolve-uri.mjs",
16
+  "typings": "dist/types/resolve-uri.d.ts",
17
+  "exports": {
18
+    ".": [
19
+      {
20
+        "types": "./dist/types/resolve-uri.d.ts",
21
+        "browser": "./dist/resolve-uri.umd.js",
22
+        "require": "./dist/resolve-uri.umd.js",
23
+        "import": "./dist/resolve-uri.mjs"
24
+      },
25
+      "./dist/resolve-uri.umd.js"
26
+    ],
27
+    "./package.json": "./package.json"
28
+  },
29
+  "files": [
30
+    "dist"
31
+  ],
32
+  "engines": {
33
+    "node": ">=6.0.0"
34
+  },
35
+  "scripts": {
36
+    "prebuild": "rm -rf dist",
37
+    "build": "run-s -n build:*",
38
+    "build:rollup": "rollup -c rollup.config.js",
39
+    "build:ts": "tsc --project tsconfig.build.json",
40
+    "lint": "run-s -n lint:*",
41
+    "lint:prettier": "npm run test:lint:prettier -- --write",
42
+    "lint:ts": "npm run test:lint:ts -- --fix",
43
+    "pretest": "run-s build:rollup",
44
+    "test": "run-s -n test:lint test:only",
45
+    "test:debug": "mocha --inspect-brk",
46
+    "test:lint": "run-s -n test:lint:*",
47
+    "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
48
+    "test:lint:ts": "eslint '{src,test}/**/*.ts'",
49
+    "test:only": "mocha",
50
+    "test:coverage": "c8 mocha",
51
+    "test:watch": "mocha --watch",
52
+    "prepublishOnly": "npm run preversion",
53
+    "preversion": "run-s test build"
54
+  },
55
+  "devDependencies": {
56
+    "@jridgewell/resolve-uri-latest": "npm:@jridgewell/resolve-uri@*",
57
+    "@rollup/plugin-typescript": "8.3.0",
58
+    "@typescript-eslint/eslint-plugin": "5.10.0",
59
+    "@typescript-eslint/parser": "5.10.0",
60
+    "c8": "7.11.0",
61
+    "eslint": "8.7.0",
62
+    "eslint-config-prettier": "8.3.0",
63
+    "mocha": "9.2.0",
64
+    "npm-run-all": "4.1.5",
65
+    "prettier": "2.5.1",
66
+    "rollup": "2.66.0",
67
+    "typescript": "4.5.5"
68
+  }
69
+}

+ 19 - 0
node_modules/@jridgewell/set-array/LICENSE

@@ -0,0 +1,19 @@
1
+Copyright 2022 Justin Ridgewell <jridgewell@google.com>
2
+
3
+Permission is hereby granted, free of charge, to any person obtaining a copy
4
+of this software and associated documentation files (the "Software"), to deal
5
+in the Software without restriction, including without limitation the rights
6
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+copies of the Software, and to permit persons to whom the Software is
8
+furnished to do so, subject to the following conditions:
9
+
10
+The above copyright notice and this permission notice shall be included in
11
+all copies or substantial portions of the Software.
12
+
13
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+SOFTWARE.

+ 37 - 0
node_modules/@jridgewell/set-array/README.md

@@ -0,0 +1,37 @@
1
+# @jridgewell/set-array
2
+
3
+> Like a Set, but provides the index of the `key` in the backing array
4
+
5
+This is designed to allow synchronizing a second array with the contents of the backing array, like
6
+how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, and there
7
+are never duplicates.
8
+
9
+## Installation
10
+
11
+```sh
12
+npm install @jridgewell/set-array
13
+```
14
+
15
+## Usage
16
+
17
+```js
18
+import { SetArray, get, put, pop } from '@jridgewell/set-array';
19
+
20
+const sa = new SetArray();
21
+
22
+let index = put(sa, 'first');
23
+assert.strictEqual(index, 0);
24
+
25
+index = put(sa, 'second');
26
+assert.strictEqual(index, 1);
27
+
28
+assert.deepEqual(sa.array, [ 'first', 'second' ]);
29
+
30
+index = get(sa, 'first');
31
+assert.strictEqual(index, 0);
32
+
33
+pop(sa);
34
+index = get(sa, 'second');
35
+assert.strictEqual(index, undefined);
36
+assert.deepEqual(sa.array, [ 'first' ]);
37
+```

+ 48 - 0
node_modules/@jridgewell/set-array/dist/set-array.mjs

@@ -0,0 +1,48 @@
1
+/**
2
+ * Gets the index associated with `key` in the backing array, if it is already present.
3
+ */
4
+let get;
5
+/**
6
+ * Puts `key` into the backing array, if it is not already present. Returns
7
+ * the index of the `key` in the backing array.
8
+ */
9
+let put;
10
+/**
11
+ * Pops the last added item out of the SetArray.
12
+ */
13
+let pop;
14
+/**
15
+ * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
16
+ * index of the `key` in the backing array.
17
+ *
18
+ * This is designed to allow synchronizing a second array with the contents of the backing array,
19
+ * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
20
+ * and there are never duplicates.
21
+ */
22
+class SetArray {
23
+    constructor() {
24
+        this._indexes = { __proto__: null };
25
+        this.array = [];
26
+    }
27
+}
28
+(() => {
29
+    get = (strarr, key) => strarr._indexes[key];
30
+    put = (strarr, key) => {
31
+        // The key may or may not be present. If it is present, it's a number.
32
+        const index = get(strarr, key);
33
+        if (index !== undefined)
34
+            return index;
35
+        const { array, _indexes: indexes } = strarr;
36
+        return (indexes[key] = array.push(key) - 1);
37
+    };
38
+    pop = (strarr) => {
39
+        const { array, _indexes: indexes } = strarr;
40
+        if (array.length === 0)
41
+            return;
42
+        const last = array.pop();
43
+        indexes[last] = undefined;
44
+    };
45
+})();
46
+
47
+export { SetArray, get, pop, put };
48
+//# sourceMappingURL=set-array.mjs.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/set-array/dist/set-array.mjs.map


+ 58 - 0
node_modules/@jridgewell/set-array/dist/set-array.umd.js

@@ -0,0 +1,58 @@
1
+(function (global, factory) {
2
+    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+    typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.setArray = {}));
5
+})(this, (function (exports) { 'use strict';
6
+
7
+    /**
8
+     * Gets the index associated with `key` in the backing array, if it is already present.
9
+     */
10
+    exports.get = void 0;
11
+    /**
12
+     * Puts `key` into the backing array, if it is not already present. Returns
13
+     * the index of the `key` in the backing array.
14
+     */
15
+    exports.put = void 0;
16
+    /**
17
+     * Pops the last added item out of the SetArray.
18
+     */
19
+    exports.pop = void 0;
20
+    /**
21
+     * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
22
+     * index of the `key` in the backing array.
23
+     *
24
+     * This is designed to allow synchronizing a second array with the contents of the backing array,
25
+     * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
26
+     * and there are never duplicates.
27
+     */
28
+    class SetArray {
29
+        constructor() {
30
+            this._indexes = { __proto__: null };
31
+            this.array = [];
32
+        }
33
+    }
34
+    (() => {
35
+        exports.get = (strarr, key) => strarr._indexes[key];
36
+        exports.put = (strarr, key) => {
37
+            // The key may or may not be present. If it is present, it's a number.
38
+            const index = exports.get(strarr, key);
39
+            if (index !== undefined)
40
+                return index;
41
+            const { array, _indexes: indexes } = strarr;
42
+            return (indexes[key] = array.push(key) - 1);
43
+        };
44
+        exports.pop = (strarr) => {
45
+            const { array, _indexes: indexes } = strarr;
46
+            if (array.length === 0)
47
+                return;
48
+            const last = array.pop();
49
+            indexes[last] = undefined;
50
+        };
51
+    })();
52
+
53
+    exports.SetArray = SetArray;
54
+
55
+    Object.defineProperty(exports, '__esModule', { value: true });
56
+
57
+}));
58
+//# sourceMappingURL=set-array.umd.js.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/set-array/dist/set-array.umd.js.map


+ 26 - 0
node_modules/@jridgewell/set-array/dist/types/set-array.d.ts

@@ -0,0 +1,26 @@
1
+/**
2
+ * Gets the index associated with `key` in the backing array, if it is already present.
3
+ */
4
+export declare let get: (strarr: SetArray, key: string) => number | undefined;
5
+/**
6
+ * Puts `key` into the backing array, if it is not already present. Returns
7
+ * the index of the `key` in the backing array.
8
+ */
9
+export declare let put: (strarr: SetArray, key: string) => number;
10
+/**
11
+ * Pops the last added item out of the SetArray.
12
+ */
13
+export declare let pop: (strarr: SetArray) => void;
14
+/**
15
+ * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
16
+ * index of the `key` in the backing array.
17
+ *
18
+ * This is designed to allow synchronizing a second array with the contents of the backing array,
19
+ * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
20
+ * and there are never duplicates.
21
+ */
22
+export declare class SetArray {
23
+    private _indexes;
24
+    array: readonly string[];
25
+    constructor();
26
+}

+ 66 - 0
node_modules/@jridgewell/set-array/package.json

@@ -0,0 +1,66 @@
1
+{
2
+  "name": "@jridgewell/set-array",
3
+  "version": "1.1.2",
4
+  "description": "Like a Set, but provides the index of the `key` in the backing array",
5
+  "keywords": [],
6
+  "author": "Justin Ridgewell <justin@ridgewell.name>",
7
+  "license": "MIT",
8
+  "repository": "https://github.com/jridgewell/set-array",
9
+  "main": "dist/set-array.umd.js",
10
+  "module": "dist/set-array.mjs",
11
+  "typings": "dist/types/set-array.d.ts",
12
+  "exports": {
13
+    ".": [
14
+      {
15
+        "types": "./dist/types/set-array.d.ts",
16
+        "browser": "./dist/set-array.umd.js",
17
+        "require": "./dist/set-array.umd.js",
18
+        "import": "./dist/set-array.mjs"
19
+      },
20
+      "./dist/set-array.umd.js"
21
+    ],
22
+    "./package.json": "./package.json"
23
+  },
24
+  "files": [
25
+    "dist",
26
+    "src"
27
+  ],
28
+  "engines": {
29
+    "node": ">=6.0.0"
30
+  },
31
+  "scripts": {
32
+    "prebuild": "rm -rf dist",
33
+    "build": "run-s -n build:*",
34
+    "build:rollup": "rollup -c rollup.config.js",
35
+    "build:ts": "tsc --project tsconfig.build.json",
36
+    "lint": "run-s -n lint:*",
37
+    "lint:prettier": "npm run test:lint:prettier -- --write",
38
+    "lint:ts": "npm run test:lint:ts -- --fix",
39
+    "pretest": "run-s build:rollup",
40
+    "test": "run-s -n test:lint test:only",
41
+    "test:debug": "mocha --inspect-brk",
42
+    "test:lint": "run-s -n test:lint:*",
43
+    "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
44
+    "test:lint:ts": "eslint '{src,test}/**/*.ts'",
45
+    "test:only": "mocha",
46
+    "test:coverage": "c8 mocha",
47
+    "test:watch": "mocha --watch",
48
+    "prepublishOnly": "npm run preversion",
49
+    "preversion": "run-s test build"
50
+  },
51
+  "devDependencies": {
52
+    "@rollup/plugin-typescript": "8.3.0",
53
+    "@types/mocha": "9.1.1",
54
+    "@types/node": "17.0.29",
55
+    "@typescript-eslint/eslint-plugin": "5.10.0",
56
+    "@typescript-eslint/parser": "5.10.0",
57
+    "c8": "7.11.0",
58
+    "eslint": "8.7.0",
59
+    "eslint-config-prettier": "8.3.0",
60
+    "mocha": "9.2.0",
61
+    "npm-run-all": "4.1.5",
62
+    "prettier": "2.5.1",
63
+    "rollup": "2.66.0",
64
+    "typescript": "4.5.5"
65
+  }
66
+}

+ 55 - 0
node_modules/@jridgewell/set-array/src/set-array.ts

@@ -0,0 +1,55 @@
1
+/**
2
+ * Gets the index associated with `key` in the backing array, if it is already present.
3
+ */
4
+export let get: (strarr: SetArray, key: string) => number | undefined;
5
+
6
+/**
7
+ * Puts `key` into the backing array, if it is not already present. Returns
8
+ * the index of the `key` in the backing array.
9
+ */
10
+export let put: (strarr: SetArray, key: string) => number;
11
+
12
+/**
13
+ * Pops the last added item out of the SetArray.
14
+ */
15
+export let pop: (strarr: SetArray) => void;
16
+
17
+/**
18
+ * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
19
+ * index of the `key` in the backing array.
20
+ *
21
+ * This is designed to allow synchronizing a second array with the contents of the backing array,
22
+ * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
23
+ * and there are never duplicates.
24
+ */
25
+export class SetArray {
26
+  private declare _indexes: { [key: string]: number | undefined };
27
+  declare array: readonly string[];
28
+
29
+  constructor() {
30
+    this._indexes = { __proto__: null } as any;
31
+    this.array = [];
32
+  }
33
+
34
+  static {
35
+    get = (strarr, key) => strarr._indexes[key];
36
+
37
+    put = (strarr, key) => {
38
+      // The key may or may not be present. If it is present, it's a number.
39
+      const index = get(strarr, key);
40
+      if (index !== undefined) return index;
41
+
42
+      const { array, _indexes: indexes } = strarr;
43
+
44
+      return (indexes[key] = (array as string[]).push(key) - 1);
45
+    };
46
+
47
+    pop = (strarr) => {
48
+      const { array, _indexes: indexes } = strarr;
49
+      if (array.length === 0) return;
50
+
51
+      const last = (array as string[]).pop()!;
52
+      indexes[last] = undefined;
53
+    };
54
+  }
55
+}

+ 21 - 0
node_modules/@jridgewell/sourcemap-codec/LICENSE

@@ -0,0 +1,21 @@
1
+The MIT License
2
+
3
+Copyright (c) 2015 Rich Harris
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in
13
+all copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+THE SOFTWARE.

+ 200 - 0
node_modules/@jridgewell/sourcemap-codec/README.md

@@ -0,0 +1,200 @@
1
+# @jridgewell/sourcemap-codec
2
+
3
+Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit).
4
+
5
+
6
+## Why?
7
+
8
+Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap.
9
+
10
+This package makes the process slightly easier.
11
+
12
+
13
+## Installation
14
+
15
+```bash
16
+npm install @jridgewell/sourcemap-codec
17
+```
18
+
19
+
20
+## Usage
21
+
22
+```js
23
+import { encode, decode } from '@jridgewell/sourcemap-codec';
24
+
25
+var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
26
+
27
+assert.deepEqual( decoded, [
28
+	// the first line (of the generated code) has no mappings,
29
+	// as shown by the starting semi-colon (which separates lines)
30
+	[],
31
+
32
+	// the second line contains four (comma-separated) segments
33
+	[
34
+		// segments are encoded as you'd expect:
35
+		// [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ]
36
+
37
+		// i.e. the first segment begins at column 2, and maps back to the second column
38
+		// of the second line (both zero-based) of the 0th source, and uses the 0th
39
+		// name in the `map.names` array
40
+		[ 2, 0, 2, 2, 0 ],
41
+
42
+		// the remaining segments are 4-length rather than 5-length,
43
+		// because they don't map a name
44
+		[ 4, 0, 2, 4 ],
45
+		[ 6, 0, 2, 5 ],
46
+		[ 7, 0, 2, 7 ]
47
+	],
48
+
49
+	// the final line contains two segments
50
+	[
51
+		[ 2, 1, 10, 19 ],
52
+		[ 12, 1, 11, 20 ]
53
+	]
54
+]);
55
+
56
+var encoded = encode( decoded );
57
+assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
58
+```
59
+
60
+## Benchmarks
61
+
62
+```
63
+node v18.0.0
64
+
65
+amp.js.map - 45120 segments
66
+
67
+Decode Memory Usage:
68
+@jridgewell/sourcemap-codec       5479160 bytes
69
+sourcemap-codec                   5659336 bytes
70
+source-map-0.6.1                 17144440 bytes
71
+source-map-0.8.0                  6867424 bytes
72
+Smallest memory usage is @jridgewell/sourcemap-codec
73
+
74
+Decode speed:
75
+decode: @jridgewell/sourcemap-codec x 502 ops/sec ±1.03% (90 runs sampled)
76
+decode: sourcemap-codec x 445 ops/sec ±0.97% (92 runs sampled)
77
+decode: source-map-0.6.1 x 36.01 ops/sec ±1.64% (49 runs sampled)
78
+decode: source-map-0.8.0 x 367 ops/sec ±0.04% (95 runs sampled)
79
+Fastest is decode: @jridgewell/sourcemap-codec
80
+
81
+Encode Memory Usage:
82
+@jridgewell/sourcemap-codec       1261620 bytes
83
+sourcemap-codec                   9119248 bytes
84
+source-map-0.6.1                  8968560 bytes
85
+source-map-0.8.0                  8952952 bytes
86
+Smallest memory usage is @jridgewell/sourcemap-codec
87
+
88
+Encode speed:
89
+encode: @jridgewell/sourcemap-codec x 738 ops/sec ±0.42% (98 runs sampled)
90
+encode: sourcemap-codec x 238 ops/sec ±0.73% (88 runs sampled)
91
+encode: source-map-0.6.1 x 162 ops/sec ±0.43% (84 runs sampled)
92
+encode: source-map-0.8.0 x 191 ops/sec ±0.34% (90 runs sampled)
93
+Fastest is encode: @jridgewell/sourcemap-codec
94
+
95
+
96
+***
97
+
98
+
99
+babel.min.js.map - 347793 segments
100
+
101
+Decode Memory Usage:
102
+@jridgewell/sourcemap-codec      35338184 bytes
103
+sourcemap-codec                  35922736 bytes
104
+source-map-0.6.1                 62366360 bytes
105
+source-map-0.8.0                 44337416 bytes
106
+Smallest memory usage is @jridgewell/sourcemap-codec
107
+
108
+Decode speed:
109
+decode: @jridgewell/sourcemap-codec x 40.35 ops/sec ±4.47% (54 runs sampled)
110
+decode: sourcemap-codec x 36.76 ops/sec ±3.67% (51 runs sampled)
111
+decode: source-map-0.6.1 x 4.44 ops/sec ±2.15% (16 runs sampled)
112
+decode: source-map-0.8.0 x 59.35 ops/sec ±0.05% (78 runs sampled)
113
+Fastest is decode: source-map-0.8.0
114
+
115
+Encode Memory Usage:
116
+@jridgewell/sourcemap-codec       7212604 bytes
117
+sourcemap-codec                  21421456 bytes
118
+source-map-0.6.1                 25286888 bytes
119
+source-map-0.8.0                 25498744 bytes
120
+Smallest memory usage is @jridgewell/sourcemap-codec
121
+
122
+Encode speed:
123
+encode: @jridgewell/sourcemap-codec x 112 ops/sec ±0.13% (84 runs sampled)
124
+encode: sourcemap-codec x 30.23 ops/sec ±2.76% (53 runs sampled)
125
+encode: source-map-0.6.1 x 19.43 ops/sec ±3.70% (37 runs sampled)
126
+encode: source-map-0.8.0 x 19.40 ops/sec ±3.26% (37 runs sampled)
127
+Fastest is encode: @jridgewell/sourcemap-codec
128
+
129
+
130
+***
131
+
132
+
133
+preact.js.map - 1992 segments
134
+
135
+Decode Memory Usage:
136
+@jridgewell/sourcemap-codec        500272 bytes
137
+sourcemap-codec                    516864 bytes
138
+source-map-0.6.1                  1596672 bytes
139
+source-map-0.8.0                   517272 bytes
140
+Smallest memory usage is @jridgewell/sourcemap-codec
141
+
142
+Decode speed:
143
+decode: @jridgewell/sourcemap-codec x 16,137 ops/sec ±0.17% (99 runs sampled)
144
+decode: sourcemap-codec x 12,139 ops/sec ±0.13% (99 runs sampled)
145
+decode: source-map-0.6.1 x 1,264 ops/sec ±0.12% (100 runs sampled)
146
+decode: source-map-0.8.0 x 9,894 ops/sec ±0.08% (101 runs sampled)
147
+Fastest is decode: @jridgewell/sourcemap-codec
148
+
149
+Encode Memory Usage:
150
+@jridgewell/sourcemap-codec        321026 bytes
151
+sourcemap-codec                    830832 bytes
152
+source-map-0.6.1                   586608 bytes
153
+source-map-0.8.0                   586680 bytes
154
+Smallest memory usage is @jridgewell/sourcemap-codec
155
+
156
+Encode speed:
157
+encode: @jridgewell/sourcemap-codec x 19,876 ops/sec ±0.78% (95 runs sampled)
158
+encode: sourcemap-codec x 6,983 ops/sec ±0.15% (100 runs sampled)
159
+encode: source-map-0.6.1 x 5,070 ops/sec ±0.12% (102 runs sampled)
160
+encode: source-map-0.8.0 x 5,641 ops/sec ±0.17% (100 runs sampled)
161
+Fastest is encode: @jridgewell/sourcemap-codec
162
+
163
+
164
+***
165
+
166
+
167
+react.js.map - 5726 segments
168
+
169
+Decode Memory Usage:
170
+@jridgewell/sourcemap-codec        734848 bytes
171
+sourcemap-codec                    954200 bytes
172
+source-map-0.6.1                  2276432 bytes
173
+source-map-0.8.0                   955488 bytes
174
+Smallest memory usage is @jridgewell/sourcemap-codec
175
+
176
+Decode speed:
177
+decode: @jridgewell/sourcemap-codec x 5,723 ops/sec ±0.12% (98 runs sampled)
178
+decode: sourcemap-codec x 4,555 ops/sec ±0.09% (101 runs sampled)
179
+decode: source-map-0.6.1 x 437 ops/sec ±0.11% (93 runs sampled)
180
+decode: source-map-0.8.0 x 3,441 ops/sec ±0.15% (100 runs sampled)
181
+Fastest is decode: @jridgewell/sourcemap-codec
182
+
183
+Encode Memory Usage:
184
+@jridgewell/sourcemap-codec        638672 bytes
185
+sourcemap-codec                   1109840 bytes
186
+source-map-0.6.1                  1321224 bytes
187
+source-map-0.8.0                  1324448 bytes
188
+Smallest memory usage is @jridgewell/sourcemap-codec
189
+
190
+Encode speed:
191
+encode: @jridgewell/sourcemap-codec x 6,801 ops/sec ±0.48% (98 runs sampled)
192
+encode: sourcemap-codec x 2,533 ops/sec ±0.13% (101 runs sampled)
193
+encode: source-map-0.6.1 x 2,248 ops/sec ±0.08% (100 runs sampled)
194
+encode: source-map-0.8.0 x 2,303 ops/sec ±0.15% (100 runs sampled)
195
+Fastest is encode: @jridgewell/sourcemap-codec
196
+```
197
+
198
+# License
199
+
200
+MIT

+ 164 - 0
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs

@@ -0,0 +1,164 @@
1
+const comma = ','.charCodeAt(0);
2
+const semicolon = ';'.charCodeAt(0);
3
+const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
4
+const intToChar = new Uint8Array(64); // 64 possible chars.
5
+const charToInt = new Uint8Array(128); // z is 122 in ASCII
6
+for (let i = 0; i < chars.length; i++) {
7
+    const c = chars.charCodeAt(i);
8
+    intToChar[i] = c;
9
+    charToInt[c] = i;
10
+}
11
+// Provide a fallback for older environments.
12
+const td = typeof TextDecoder !== 'undefined'
13
+    ? /* #__PURE__ */ new TextDecoder()
14
+    : typeof Buffer !== 'undefined'
15
+        ? {
16
+            decode(buf) {
17
+                const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
18
+                return out.toString();
19
+            },
20
+        }
21
+        : {
22
+            decode(buf) {
23
+                let out = '';
24
+                for (let i = 0; i < buf.length; i++) {
25
+                    out += String.fromCharCode(buf[i]);
26
+                }
27
+                return out;
28
+            },
29
+        };
30
+function decode(mappings) {
31
+    const state = new Int32Array(5);
32
+    const decoded = [];
33
+    let index = 0;
34
+    do {
35
+        const semi = indexOf(mappings, index);
36
+        const line = [];
37
+        let sorted = true;
38
+        let lastCol = 0;
39
+        state[0] = 0;
40
+        for (let i = index; i < semi; i++) {
41
+            let seg;
42
+            i = decodeInteger(mappings, i, state, 0); // genColumn
43
+            const col = state[0];
44
+            if (col < lastCol)
45
+                sorted = false;
46
+            lastCol = col;
47
+            if (hasMoreVlq(mappings, i, semi)) {
48
+                i = decodeInteger(mappings, i, state, 1); // sourcesIndex
49
+                i = decodeInteger(mappings, i, state, 2); // sourceLine
50
+                i = decodeInteger(mappings, i, state, 3); // sourceColumn
51
+                if (hasMoreVlq(mappings, i, semi)) {
52
+                    i = decodeInteger(mappings, i, state, 4); // namesIndex
53
+                    seg = [col, state[1], state[2], state[3], state[4]];
54
+                }
55
+                else {
56
+                    seg = [col, state[1], state[2], state[3]];
57
+                }
58
+            }
59
+            else {
60
+                seg = [col];
61
+            }
62
+            line.push(seg);
63
+        }
64
+        if (!sorted)
65
+            sort(line);
66
+        decoded.push(line);
67
+        index = semi + 1;
68
+    } while (index <= mappings.length);
69
+    return decoded;
70
+}
71
+function indexOf(mappings, index) {
72
+    const idx = mappings.indexOf(';', index);
73
+    return idx === -1 ? mappings.length : idx;
74
+}
75
+function decodeInteger(mappings, pos, state, j) {
76
+    let value = 0;
77
+    let shift = 0;
78
+    let integer = 0;
79
+    do {
80
+        const c = mappings.charCodeAt(pos++);
81
+        integer = charToInt[c];
82
+        value |= (integer & 31) << shift;
83
+        shift += 5;
84
+    } while (integer & 32);
85
+    const shouldNegate = value & 1;
86
+    value >>>= 1;
87
+    if (shouldNegate) {
88
+        value = -0x80000000 | -value;
89
+    }
90
+    state[j] += value;
91
+    return pos;
92
+}
93
+function hasMoreVlq(mappings, i, length) {
94
+    if (i >= length)
95
+        return false;
96
+    return mappings.charCodeAt(i) !== comma;
97
+}
98
+function sort(line) {
99
+    line.sort(sortComparator);
100
+}
101
+function sortComparator(a, b) {
102
+    return a[0] - b[0];
103
+}
104
+function encode(decoded) {
105
+    const state = new Int32Array(5);
106
+    const bufLength = 1024 * 16;
107
+    const subLength = bufLength - 36;
108
+    const buf = new Uint8Array(bufLength);
109
+    const sub = buf.subarray(0, subLength);
110
+    let pos = 0;
111
+    let out = '';
112
+    for (let i = 0; i < decoded.length; i++) {
113
+        const line = decoded[i];
114
+        if (i > 0) {
115
+            if (pos === bufLength) {
116
+                out += td.decode(buf);
117
+                pos = 0;
118
+            }
119
+            buf[pos++] = semicolon;
120
+        }
121
+        if (line.length === 0)
122
+            continue;
123
+        state[0] = 0;
124
+        for (let j = 0; j < line.length; j++) {
125
+            const segment = line[j];
126
+            // We can push up to 5 ints, each int can take at most 7 chars, and we
127
+            // may push a comma.
128
+            if (pos > subLength) {
129
+                out += td.decode(sub);
130
+                buf.copyWithin(0, subLength, pos);
131
+                pos -= subLength;
132
+            }
133
+            if (j > 0)
134
+                buf[pos++] = comma;
135
+            pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
136
+            if (segment.length === 1)
137
+                continue;
138
+            pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
139
+            pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
140
+            pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
141
+            if (segment.length === 4)
142
+                continue;
143
+            pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
144
+        }
145
+    }
146
+    return out + td.decode(buf.subarray(0, pos));
147
+}
148
+function encodeInteger(buf, pos, state, segment, j) {
149
+    const next = segment[j];
150
+    let num = next - state[j];
151
+    state[j] = next;
152
+    num = num < 0 ? (-num << 1) | 1 : num << 1;
153
+    do {
154
+        let clamped = num & 0b011111;
155
+        num >>>= 5;
156
+        if (num > 0)
157
+            clamped |= 0b100000;
158
+        buf[pos++] = intToChar[clamped];
159
+    } while (num > 0);
160
+    return pos;
161
+}
162
+
163
+export { decode, encode };
164
+//# sourceMappingURL=sourcemap-codec.mjs.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map


+ 175 - 0
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js

@@ -0,0 +1,175 @@
1
+(function (global, factory) {
2
+    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+    typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {}));
5
+})(this, (function (exports) { 'use strict';
6
+
7
+    const comma = ','.charCodeAt(0);
8
+    const semicolon = ';'.charCodeAt(0);
9
+    const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
10
+    const intToChar = new Uint8Array(64); // 64 possible chars.
11
+    const charToInt = new Uint8Array(128); // z is 122 in ASCII
12
+    for (let i = 0; i < chars.length; i++) {
13
+        const c = chars.charCodeAt(i);
14
+        intToChar[i] = c;
15
+        charToInt[c] = i;
16
+    }
17
+    // Provide a fallback for older environments.
18
+    const td = typeof TextDecoder !== 'undefined'
19
+        ? /* #__PURE__ */ new TextDecoder()
20
+        : typeof Buffer !== 'undefined'
21
+            ? {
22
+                decode(buf) {
23
+                    const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
24
+                    return out.toString();
25
+                },
26
+            }
27
+            : {
28
+                decode(buf) {
29
+                    let out = '';
30
+                    for (let i = 0; i < buf.length; i++) {
31
+                        out += String.fromCharCode(buf[i]);
32
+                    }
33
+                    return out;
34
+                },
35
+            };
36
+    function decode(mappings) {
37
+        const state = new Int32Array(5);
38
+        const decoded = [];
39
+        let index = 0;
40
+        do {
41
+            const semi = indexOf(mappings, index);
42
+            const line = [];
43
+            let sorted = true;
44
+            let lastCol = 0;
45
+            state[0] = 0;
46
+            for (let i = index; i < semi; i++) {
47
+                let seg;
48
+                i = decodeInteger(mappings, i, state, 0); // genColumn
49
+                const col = state[0];
50
+                if (col < lastCol)
51
+                    sorted = false;
52
+                lastCol = col;
53
+                if (hasMoreVlq(mappings, i, semi)) {
54
+                    i = decodeInteger(mappings, i, state, 1); // sourcesIndex
55
+                    i = decodeInteger(mappings, i, state, 2); // sourceLine
56
+                    i = decodeInteger(mappings, i, state, 3); // sourceColumn
57
+                    if (hasMoreVlq(mappings, i, semi)) {
58
+                        i = decodeInteger(mappings, i, state, 4); // namesIndex
59
+                        seg = [col, state[1], state[2], state[3], state[4]];
60
+                    }
61
+                    else {
62
+                        seg = [col, state[1], state[2], state[3]];
63
+                    }
64
+                }
65
+                else {
66
+                    seg = [col];
67
+                }
68
+                line.push(seg);
69
+            }
70
+            if (!sorted)
71
+                sort(line);
72
+            decoded.push(line);
73
+            index = semi + 1;
74
+        } while (index <= mappings.length);
75
+        return decoded;
76
+    }
77
+    function indexOf(mappings, index) {
78
+        const idx = mappings.indexOf(';', index);
79
+        return idx === -1 ? mappings.length : idx;
80
+    }
81
+    function decodeInteger(mappings, pos, state, j) {
82
+        let value = 0;
83
+        let shift = 0;
84
+        let integer = 0;
85
+        do {
86
+            const c = mappings.charCodeAt(pos++);
87
+            integer = charToInt[c];
88
+            value |= (integer & 31) << shift;
89
+            shift += 5;
90
+        } while (integer & 32);
91
+        const shouldNegate = value & 1;
92
+        value >>>= 1;
93
+        if (shouldNegate) {
94
+            value = -0x80000000 | -value;
95
+        }
96
+        state[j] += value;
97
+        return pos;
98
+    }
99
+    function hasMoreVlq(mappings, i, length) {
100
+        if (i >= length)
101
+            return false;
102
+        return mappings.charCodeAt(i) !== comma;
103
+    }
104
+    function sort(line) {
105
+        line.sort(sortComparator);
106
+    }
107
+    function sortComparator(a, b) {
108
+        return a[0] - b[0];
109
+    }
110
+    function encode(decoded) {
111
+        const state = new Int32Array(5);
112
+        const bufLength = 1024 * 16;
113
+        const subLength = bufLength - 36;
114
+        const buf = new Uint8Array(bufLength);
115
+        const sub = buf.subarray(0, subLength);
116
+        let pos = 0;
117
+        let out = '';
118
+        for (let i = 0; i < decoded.length; i++) {
119
+            const line = decoded[i];
120
+            if (i > 0) {
121
+                if (pos === bufLength) {
122
+                    out += td.decode(buf);
123
+                    pos = 0;
124
+                }
125
+                buf[pos++] = semicolon;
126
+            }
127
+            if (line.length === 0)
128
+                continue;
129
+            state[0] = 0;
130
+            for (let j = 0; j < line.length; j++) {
131
+                const segment = line[j];
132
+                // We can push up to 5 ints, each int can take at most 7 chars, and we
133
+                // may push a comma.
134
+                if (pos > subLength) {
135
+                    out += td.decode(sub);
136
+                    buf.copyWithin(0, subLength, pos);
137
+                    pos -= subLength;
138
+                }
139
+                if (j > 0)
140
+                    buf[pos++] = comma;
141
+                pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
142
+                if (segment.length === 1)
143
+                    continue;
144
+                pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
145
+                pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
146
+                pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
147
+                if (segment.length === 4)
148
+                    continue;
149
+                pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
150
+            }
151
+        }
152
+        return out + td.decode(buf.subarray(0, pos));
153
+    }
154
+    function encodeInteger(buf, pos, state, segment, j) {
155
+        const next = segment[j];
156
+        let num = next - state[j];
157
+        state[j] = next;
158
+        num = num < 0 ? (-num << 1) | 1 : num << 1;
159
+        do {
160
+            let clamped = num & 0b011111;
161
+            num >>>= 5;
162
+            if (num > 0)
163
+                clamped |= 0b100000;
164
+            buf[pos++] = intToChar[clamped];
165
+        } while (num > 0);
166
+        return pos;
167
+    }
168
+
169
+    exports.decode = decode;
170
+    exports.encode = encode;
171
+
172
+    Object.defineProperty(exports, '__esModule', { value: true });
173
+
174
+}));
175
+//# sourceMappingURL=sourcemap-codec.umd.js.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map


+ 6 - 0
node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts

@@ -0,0 +1,6 @@
1
+export declare type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number];
2
+export declare type SourceMapLine = SourceMapSegment[];
3
+export declare type SourceMapMappings = SourceMapLine[];
4
+export declare function decode(mappings: string): SourceMapMappings;
5
+export declare function encode(decoded: SourceMapMappings): string;
6
+export declare function encode(decoded: Readonly<SourceMapMappings>): string;

+ 74 - 0
node_modules/@jridgewell/sourcemap-codec/package.json

@@ -0,0 +1,74 @@
1
+{
2
+  "name": "@jridgewell/sourcemap-codec",
3
+  "version": "1.4.15",
4
+  "description": "Encode/decode sourcemap mappings",
5
+  "keywords": [
6
+    "sourcemap",
7
+    "vlq"
8
+  ],
9
+  "main": "dist/sourcemap-codec.umd.js",
10
+  "module": "dist/sourcemap-codec.mjs",
11
+  "types": "dist/types/sourcemap-codec.d.ts",
12
+  "files": [
13
+    "dist"
14
+  ],
15
+  "exports": {
16
+    ".": [
17
+      {
18
+        "types": "./dist/types/sourcemap-codec.d.ts",
19
+        "browser": "./dist/sourcemap-codec.umd.js",
20
+        "require": "./dist/sourcemap-codec.umd.js",
21
+        "import": "./dist/sourcemap-codec.mjs"
22
+      },
23
+      "./dist/sourcemap-codec.umd.js"
24
+    ],
25
+    "./package.json": "./package.json"
26
+  },
27
+  "scripts": {
28
+    "benchmark": "run-s build:rollup benchmark:*",
29
+    "benchmark:install": "cd benchmark && npm install",
30
+    "benchmark:only": "node --expose-gc benchmark/index.js",
31
+    "build": "run-s -n build:*",
32
+    "build:rollup": "rollup -c rollup.config.js",
33
+    "build:ts": "tsc --project tsconfig.build.json",
34
+    "lint": "run-s -n lint:*",
35
+    "lint:prettier": "npm run test:lint:prettier -- --write",
36
+    "lint:ts": "npm run test:lint:ts -- --fix",
37
+    "prebuild": "rm -rf dist",
38
+    "prepublishOnly": "npm run preversion",
39
+    "preversion": "run-s test build",
40
+    "pretest": "run-s build:rollup",
41
+    "test": "run-s -n test:lint test:only",
42
+    "test:debug": "mocha --inspect-brk",
43
+    "test:lint": "run-s -n test:lint:*",
44
+    "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
45
+    "test:lint:ts": "eslint '{src,test}/**/*.ts'",
46
+    "test:only": "mocha",
47
+    "test:coverage": "c8 mocha",
48
+    "test:watch": "mocha --watch"
49
+  },
50
+  "repository": {
51
+    "type": "git",
52
+    "url": "git+https://github.com/jridgewell/sourcemap-codec.git"
53
+  },
54
+  "author": "Rich Harris",
55
+  "license": "MIT",
56
+  "devDependencies": {
57
+    "@rollup/plugin-typescript": "8.3.0",
58
+    "@types/node": "17.0.15",
59
+    "@typescript-eslint/eslint-plugin": "5.10.0",
60
+    "@typescript-eslint/parser": "5.10.0",
61
+    "benchmark": "2.1.4",
62
+    "c8": "7.11.2",
63
+    "eslint": "8.7.0",
64
+    "eslint-config-prettier": "8.3.0",
65
+    "mocha": "9.2.0",
66
+    "npm-run-all": "4.1.5",
67
+    "prettier": "2.5.1",
68
+    "rollup": "2.64.0",
69
+    "source-map": "0.6.1",
70
+    "source-map-js": "1.0.2",
71
+    "sourcemap-codec": "1.4.8",
72
+    "typescript": "4.5.4"
73
+  }
74
+}

+ 19 - 0
node_modules/@jridgewell/trace-mapping/LICENSE

@@ -0,0 +1,19 @@
1
+Copyright 2022 Justin Ridgewell <justin@ridgewell.name>
2
+
3
+Permission is hereby granted, free of charge, to any person obtaining a copy
4
+of this software and associated documentation files (the "Software"), to deal
5
+in the Software without restriction, including without limitation the rights
6
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+copies of the Software, and to permit persons to whom the Software is
8
+furnished to do so, subject to the following conditions:
9
+
10
+The above copyright notice and this permission notice shall be included in
11
+all copies or substantial portions of the Software.
12
+
13
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+SOFTWARE.

+ 252 - 0
node_modules/@jridgewell/trace-mapping/README.md

@@ -0,0 +1,252 @@
1
+# @jridgewell/trace-mapping
2
+
3
+> Trace the original position through a source map
4
+
5
+`trace-mapping` allows you to take the line and column of an output file and trace it to the
6
+original location in the source file through a source map.
7
+
8
+You may already be familiar with the [`source-map`][source-map] package's `SourceMapConsumer`. This
9
+provides the same `originalPositionFor` and `generatedPositionFor` API, without requiring WASM.
10
+
11
+## Installation
12
+
13
+```sh
14
+npm install @jridgewell/trace-mapping
15
+```
16
+
17
+## Usage
18
+
19
+```typescript
20
+import {
21
+  TraceMap,
22
+  originalPositionFor,
23
+  generatedPositionFor,
24
+  sourceContentFor,
25
+} from '@jridgewell/trace-mapping';
26
+
27
+const tracer = new TraceMap({
28
+  version: 3,
29
+  sources: ['input.js'],
30
+  sourcesContent: ['content of input.js'],
31
+  names: ['foo'],
32
+  mappings: 'KAyCIA',
33
+});
34
+
35
+// Lines start at line 1, columns at column 0.
36
+const traced = originalPositionFor(tracer, { line: 1, column: 5 });
37
+assert.deepEqual(traced, {
38
+  source: 'input.js',
39
+  line: 42,
40
+  column: 4,
41
+  name: 'foo',
42
+});
43
+
44
+const content = sourceContentFor(tracer, traced.source);
45
+assert.strictEqual(content, 'content for input.js');
46
+
47
+const generated = generatedPositionFor(tracer, {
48
+  source: 'input.js',
49
+  line: 42,
50
+  column: 4,
51
+});
52
+assert.deepEqual(generated, {
53
+  line: 1,
54
+  column: 5,
55
+});
56
+```
57
+
58
+We also provide a lower level API to get the actual segment that matches our line and column. Unlike
59
+`originalPositionFor`, `traceSegment` uses a 0-base for `line`:
60
+
61
+```typescript
62
+import { traceSegment } from '@jridgewell/trace-mapping';
63
+
64
+// line is 0-base.
65
+const traced = traceSegment(tracer, /* line */ 0, /* column */ 5);
66
+
67
+// Segments are [outputColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
68
+// Again, line is 0-base and so is sourceLine
69
+assert.deepEqual(traced, [5, 0, 41, 4, 0]);
70
+```
71
+
72
+### SectionedSourceMaps
73
+
74
+The sourcemap spec defines a special `sections` field that's designed to handle concatenation of
75
+output code with associated sourcemaps. This type of sourcemap is rarely used (no major build tool
76
+produces it), but if you are hand coding a concatenation you may need it. We provide an `AnyMap`
77
+helper that can receive either a regular sourcemap or a `SectionedSourceMap` and returns a
78
+`TraceMap` instance:
79
+
80
+```typescript
81
+import { AnyMap } from '@jridgewell/trace-mapping';
82
+const fooOutput = 'foo';
83
+const barOutput = 'bar';
84
+const output = [fooOutput, barOutput].join('\n');
85
+
86
+const sectioned = new AnyMap({
87
+  version: 3,
88
+  sections: [
89
+    {
90
+      // 0-base line and column
91
+      offset: { line: 0, column: 0 },
92
+      // fooOutput's sourcemap
93
+      map: {
94
+        version: 3,
95
+        sources: ['foo.js'],
96
+        names: ['foo'],
97
+        mappings: 'AAAAA',
98
+      },
99
+    },
100
+    {
101
+      // barOutput's sourcemap will not affect the first line, only the second
102
+      offset: { line: 1, column: 0 },
103
+      map: {
104
+        version: 3,
105
+        sources: ['bar.js'],
106
+        names: ['bar'],
107
+        mappings: 'AAAAA',
108
+      },
109
+    },
110
+  ],
111
+});
112
+
113
+const traced = originalPositionFor(sectioned, {
114
+  line: 2,
115
+  column: 0,
116
+});
117
+
118
+assert.deepEqual(traced, {
119
+  source: 'bar.js',
120
+  line: 1,
121
+  column: 0,
122
+  name: 'bar',
123
+});
124
+```
125
+
126
+## Benchmarks
127
+
128
+```
129
+node v18.0.0
130
+
131
+amp.js.map - 45120 segments
132
+
133
+Memory Usage:
134
+trace-mapping decoded         562400 bytes
135
+trace-mapping encoded        5706544 bytes
136
+source-map-js               10717664 bytes
137
+source-map-0.6.1            17446384 bytes
138
+source-map-0.8.0             9701757 bytes
139
+Smallest memory usage is trace-mapping decoded
140
+
141
+Init speed:
142
+trace-mapping:    decoded JSON input x 180 ops/sec ±0.34% (85 runs sampled)
143
+trace-mapping:    encoded JSON input x 364 ops/sec ±1.77% (89 runs sampled)
144
+trace-mapping:    decoded Object input x 3,116 ops/sec ±0.50% (96 runs sampled)
145
+trace-mapping:    encoded Object input x 410 ops/sec ±2.62% (85 runs sampled)
146
+source-map-js:    encoded Object input x 84.23 ops/sec ±0.91% (73 runs sampled)
147
+source-map-0.6.1: encoded Object input x 37.21 ops/sec ±2.08% (51 runs sampled)
148
+Fastest is trace-mapping:    decoded Object input
149
+
150
+Trace speed:
151
+trace-mapping:    decoded originalPositionFor x 3,952,212 ops/sec ±0.17% (98 runs sampled)
152
+trace-mapping:    encoded originalPositionFor x 3,487,468 ops/sec ±1.58% (90 runs sampled)
153
+source-map-js:    encoded originalPositionFor x 827,730 ops/sec ±0.78% (97 runs sampled)
154
+source-map-0.6.1: encoded originalPositionFor x 748,991 ops/sec ±0.53% (94 runs sampled)
155
+source-map-0.8.0: encoded originalPositionFor x 2,532,894 ops/sec ±0.57% (95 runs sampled)
156
+Fastest is trace-mapping:    decoded originalPositionFor
157
+
158
+
159
+***
160
+
161
+
162
+babel.min.js.map - 347793 segments
163
+
164
+Memory Usage:
165
+trace-mapping decoded          89832 bytes
166
+trace-mapping encoded       35474640 bytes
167
+source-map-js               51257176 bytes
168
+source-map-0.6.1            63515664 bytes
169
+source-map-0.8.0            42933752 bytes
170
+Smallest memory usage is trace-mapping decoded
171
+
172
+Init speed:
173
+trace-mapping:    decoded JSON input x 15.41 ops/sec ±8.65% (34 runs sampled)
174
+trace-mapping:    encoded JSON input x 28.20 ops/sec ±12.87% (42 runs sampled)
175
+trace-mapping:    decoded Object input x 964 ops/sec ±0.36% (99 runs sampled)
176
+trace-mapping:    encoded Object input x 31.77 ops/sec ±13.79% (45 runs sampled)
177
+source-map-js:    encoded Object input x 6.45 ops/sec ±5.16% (21 runs sampled)
178
+source-map-0.6.1: encoded Object input x 4.07 ops/sec ±5.24% (15 runs sampled)
179
+Fastest is trace-mapping:    decoded Object input
180
+
181
+Trace speed:
182
+trace-mapping:    decoded originalPositionFor x 7,183,038 ops/sec ±0.58% (95 runs sampled)
183
+trace-mapping:    encoded originalPositionFor x 5,192,185 ops/sec ±0.41% (100 runs sampled)
184
+source-map-js:    encoded originalPositionFor x 4,259,489 ops/sec ±0.79% (94 runs sampled)
185
+source-map-0.6.1: encoded originalPositionFor x 3,742,629 ops/sec ±0.71% (95 runs sampled)
186
+source-map-0.8.0: encoded originalPositionFor x 6,270,211 ops/sec ±0.64% (94 runs sampled)
187
+Fastest is trace-mapping:    decoded originalPositionFor
188
+
189
+
190
+***
191
+
192
+
193
+preact.js.map - 1992 segments
194
+
195
+Memory Usage:
196
+trace-mapping decoded          37128 bytes
197
+trace-mapping encoded         247280 bytes
198
+source-map-js                1143536 bytes
199
+source-map-0.6.1             1290992 bytes
200
+source-map-0.8.0               96544 bytes
201
+Smallest memory usage is trace-mapping decoded
202
+
203
+Init speed:
204
+trace-mapping:    decoded JSON input x 3,483 ops/sec ±0.30% (98 runs sampled)
205
+trace-mapping:    encoded JSON input x 6,092 ops/sec ±0.18% (97 runs sampled)
206
+trace-mapping:    decoded Object input x 249,076 ops/sec ±0.24% (98 runs sampled)
207
+trace-mapping:    encoded Object input x 14,555 ops/sec ±0.48% (100 runs sampled)
208
+source-map-js:    encoded Object input x 2,447 ops/sec ±0.36% (99 runs sampled)
209
+source-map-0.6.1: encoded Object input x 1,201 ops/sec ±0.57% (96 runs sampled)
210
+Fastest is trace-mapping:    decoded Object input
211
+
212
+Trace speed:
213
+trace-mapping:    decoded originalPositionFor x 7,620,192 ops/sec ±0.09% (99 runs sampled)
214
+trace-mapping:    encoded originalPositionFor x 6,872,554 ops/sec ±0.30% (97 runs sampled)
215
+source-map-js:    encoded originalPositionFor x 2,489,570 ops/sec ±0.35% (94 runs sampled)
216
+source-map-0.6.1: encoded originalPositionFor x 1,698,633 ops/sec ±0.28% (98 runs sampled)
217
+source-map-0.8.0: encoded originalPositionFor x 4,015,644 ops/sec ±0.22% (98 runs sampled)
218
+Fastest is trace-mapping:    decoded originalPositionFor
219
+
220
+
221
+***
222
+
223
+
224
+react.js.map - 5726 segments
225
+
226
+Memory Usage:
227
+trace-mapping decoded          16176 bytes
228
+trace-mapping encoded         681552 bytes
229
+source-map-js                2418352 bytes
230
+source-map-0.6.1             2443672 bytes
231
+source-map-0.8.0              111768 bytes
232
+Smallest memory usage is trace-mapping decoded
233
+
234
+Init speed:
235
+trace-mapping:    decoded JSON input x 1,720 ops/sec ±0.34% (98 runs sampled)
236
+trace-mapping:    encoded JSON input x 4,406 ops/sec ±0.35% (100 runs sampled)
237
+trace-mapping:    decoded Object input x 92,122 ops/sec ±0.10% (99 runs sampled)
238
+trace-mapping:    encoded Object input x 5,385 ops/sec ±0.37% (99 runs sampled)
239
+source-map-js:    encoded Object input x 794 ops/sec ±0.40% (98 runs sampled)
240
+source-map-0.6.1: encoded Object input x 416 ops/sec ±0.54% (91 runs sampled)
241
+Fastest is trace-mapping:    decoded Object input
242
+
243
+Trace speed:
244
+trace-mapping:    decoded originalPositionFor x 32,759,519 ops/sec ±0.33% (100 runs sampled)
245
+trace-mapping:    encoded originalPositionFor x 31,116,306 ops/sec ±0.33% (97 runs sampled)
246
+source-map-js:    encoded originalPositionFor x 17,458,435 ops/sec ±0.44% (97 runs sampled)
247
+source-map-0.6.1: encoded originalPositionFor x 12,687,097 ops/sec ±0.43% (95 runs sampled)
248
+source-map-0.8.0: encoded originalPositionFor x 23,538,275 ops/sec ±0.38% (95 runs sampled)
249
+Fastest is trace-mapping:    decoded originalPositionFor
250
+```
251
+
252
+[source-map]: https://www.npmjs.com/package/source-map

+ 552 - 0
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs

@@ -0,0 +1,552 @@
1
+import { encode, decode } from '@jridgewell/sourcemap-codec';
2
+import resolveUri from '@jridgewell/resolve-uri';
3
+
4
+function resolve(input, base) {
5
+    // The base is always treated as a directory, if it's not empty.
6
+    // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
7
+    // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
8
+    if (base && !base.endsWith('/'))
9
+        base += '/';
10
+    return resolveUri(input, base);
11
+}
12
+
13
+/**
14
+ * Removes everything after the last "/", but leaves the slash.
15
+ */
16
+function stripFilename(path) {
17
+    if (!path)
18
+        return '';
19
+    const index = path.lastIndexOf('/');
20
+    return path.slice(0, index + 1);
21
+}
22
+
23
+const COLUMN = 0;
24
+const SOURCES_INDEX = 1;
25
+const SOURCE_LINE = 2;
26
+const SOURCE_COLUMN = 3;
27
+const NAMES_INDEX = 4;
28
+const REV_GENERATED_LINE = 1;
29
+const REV_GENERATED_COLUMN = 2;
30
+
31
+function maybeSort(mappings, owned) {
32
+    const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
33
+    if (unsortedIndex === mappings.length)
34
+        return mappings;
35
+    // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
36
+    // not, we do not want to modify the consumer's input array.
37
+    if (!owned)
38
+        mappings = mappings.slice();
39
+    for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
40
+        mappings[i] = sortSegments(mappings[i], owned);
41
+    }
42
+    return mappings;
43
+}
44
+function nextUnsortedSegmentLine(mappings, start) {
45
+    for (let i = start; i < mappings.length; i++) {
46
+        if (!isSorted(mappings[i]))
47
+            return i;
48
+    }
49
+    return mappings.length;
50
+}
51
+function isSorted(line) {
52
+    for (let j = 1; j < line.length; j++) {
53
+        if (line[j][COLUMN] < line[j - 1][COLUMN]) {
54
+            return false;
55
+        }
56
+    }
57
+    return true;
58
+}
59
+function sortSegments(line, owned) {
60
+    if (!owned)
61
+        line = line.slice();
62
+    return line.sort(sortComparator);
63
+}
64
+function sortComparator(a, b) {
65
+    return a[COLUMN] - b[COLUMN];
66
+}
67
+
68
+let found = false;
69
+/**
70
+ * A binary search implementation that returns the index if a match is found.
71
+ * If no match is found, then the left-index (the index associated with the item that comes just
72
+ * before the desired index) is returned. To maintain proper sort order, a splice would happen at
73
+ * the next index:
74
+ *
75
+ * ```js
76
+ * const array = [1, 3];
77
+ * const needle = 2;
78
+ * const index = binarySearch(array, needle, (item, needle) => item - needle);
79
+ *
80
+ * assert.equal(index, 0);
81
+ * array.splice(index + 1, 0, needle);
82
+ * assert.deepEqual(array, [1, 2, 3]);
83
+ * ```
84
+ */
85
+function binarySearch(haystack, needle, low, high) {
86
+    while (low <= high) {
87
+        const mid = low + ((high - low) >> 1);
88
+        const cmp = haystack[mid][COLUMN] - needle;
89
+        if (cmp === 0) {
90
+            found = true;
91
+            return mid;
92
+        }
93
+        if (cmp < 0) {
94
+            low = mid + 1;
95
+        }
96
+        else {
97
+            high = mid - 1;
98
+        }
99
+    }
100
+    found = false;
101
+    return low - 1;
102
+}
103
+function upperBound(haystack, needle, index) {
104
+    for (let i = index + 1; i < haystack.length; index = i++) {
105
+        if (haystack[i][COLUMN] !== needle)
106
+            break;
107
+    }
108
+    return index;
109
+}
110
+function lowerBound(haystack, needle, index) {
111
+    for (let i = index - 1; i >= 0; index = i--) {
112
+        if (haystack[i][COLUMN] !== needle)
113
+            break;
114
+    }
115
+    return index;
116
+}
117
+function memoizedState() {
118
+    return {
119
+        lastKey: -1,
120
+        lastNeedle: -1,
121
+        lastIndex: -1,
122
+    };
123
+}
124
+/**
125
+ * This overly complicated beast is just to record the last tested line/column and the resulting
126
+ * index, allowing us to skip a few tests if mappings are monotonically increasing.
127
+ */
128
+function memoizedBinarySearch(haystack, needle, state, key) {
129
+    const { lastKey, lastNeedle, lastIndex } = state;
130
+    let low = 0;
131
+    let high = haystack.length - 1;
132
+    if (key === lastKey) {
133
+        if (needle === lastNeedle) {
134
+            found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
135
+            return lastIndex;
136
+        }
137
+        if (needle >= lastNeedle) {
138
+            // lastIndex may be -1 if the previous needle was not found.
139
+            low = lastIndex === -1 ? 0 : lastIndex;
140
+        }
141
+        else {
142
+            high = lastIndex;
143
+        }
144
+    }
145
+    state.lastKey = key;
146
+    state.lastNeedle = needle;
147
+    return (state.lastIndex = binarySearch(haystack, needle, low, high));
148
+}
149
+
150
+// Rebuilds the original source files, with mappings that are ordered by source line/column instead
151
+// of generated line/column.
152
+function buildBySources(decoded, memos) {
153
+    const sources = memos.map(buildNullArray);
154
+    for (let i = 0; i < decoded.length; i++) {
155
+        const line = decoded[i];
156
+        for (let j = 0; j < line.length; j++) {
157
+            const seg = line[j];
158
+            if (seg.length === 1)
159
+                continue;
160
+            const sourceIndex = seg[SOURCES_INDEX];
161
+            const sourceLine = seg[SOURCE_LINE];
162
+            const sourceColumn = seg[SOURCE_COLUMN];
163
+            const originalSource = sources[sourceIndex];
164
+            const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = []));
165
+            const memo = memos[sourceIndex];
166
+            // The binary search either found a match, or it found the left-index just before where the
167
+            // segment should go. Either way, we want to insert after that. And there may be multiple
168
+            // generated segments associated with an original location, so there may need to move several
169
+            // indexes before we find where we need to insert.
170
+            const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine));
171
+            insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);
172
+        }
173
+    }
174
+    return sources;
175
+}
176
+function insert(array, index, value) {
177
+    for (let i = array.length; i > index; i--) {
178
+        array[i] = array[i - 1];
179
+    }
180
+    array[index] = value;
181
+}
182
+// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like
183
+// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations.
184
+// Numeric properties on objects are magically sorted in ascending order by the engine regardless of
185
+// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending
186
+// order when iterating with for-in.
187
+function buildNullArray() {
188
+    return { __proto__: null };
189
+}
190
+
191
+const AnyMap = function (map, mapUrl) {
192
+    const parsed = typeof map === 'string' ? JSON.parse(map) : map;
193
+    if (!('sections' in parsed))
194
+        return new TraceMap(parsed, mapUrl);
195
+    const mappings = [];
196
+    const sources = [];
197
+    const sourcesContent = [];
198
+    const names = [];
199
+    recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, 0, 0, Infinity, Infinity);
200
+    const joined = {
201
+        version: 3,
202
+        file: parsed.file,
203
+        names,
204
+        sources,
205
+        sourcesContent,
206
+        mappings,
207
+    };
208
+    return presortedDecodedMap(joined);
209
+};
210
+function recurse(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) {
211
+    const { sections } = input;
212
+    for (let i = 0; i < sections.length; i++) {
213
+        const { map, offset } = sections[i];
214
+        let sl = stopLine;
215
+        let sc = stopColumn;
216
+        if (i + 1 < sections.length) {
217
+            const nextOffset = sections[i + 1].offset;
218
+            sl = Math.min(stopLine, lineOffset + nextOffset.line);
219
+            if (sl === stopLine) {
220
+                sc = Math.min(stopColumn, columnOffset + nextOffset.column);
221
+            }
222
+            else if (sl < stopLine) {
223
+                sc = columnOffset + nextOffset.column;
224
+            }
225
+        }
226
+        addSection(map, mapUrl, mappings, sources, sourcesContent, names, lineOffset + offset.line, columnOffset + offset.column, sl, sc);
227
+    }
228
+}
229
+function addSection(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) {
230
+    if ('sections' in input)
231
+        return recurse(...arguments);
232
+    const map = new TraceMap(input, mapUrl);
233
+    const sourcesOffset = sources.length;
234
+    const namesOffset = names.length;
235
+    const decoded = decodedMappings(map);
236
+    const { resolvedSources, sourcesContent: contents } = map;
237
+    append(sources, resolvedSources);
238
+    append(names, map.names);
239
+    if (contents)
240
+        append(sourcesContent, contents);
241
+    else
242
+        for (let i = 0; i < resolvedSources.length; i++)
243
+            sourcesContent.push(null);
244
+    for (let i = 0; i < decoded.length; i++) {
245
+        const lineI = lineOffset + i;
246
+        // We can only add so many lines before we step into the range that the next section's map
247
+        // controls. When we get to the last line, then we'll start checking the segments to see if
248
+        // they've crossed into the column range. But it may not have any columns that overstep, so we
249
+        // still need to check that we don't overstep lines, too.
250
+        if (lineI > stopLine)
251
+            return;
252
+        // The out line may already exist in mappings (if we're continuing the line started by a
253
+        // previous section). Or, we may have jumped ahead several lines to start this section.
254
+        const out = getLine(mappings, lineI);
255
+        // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the
256
+        // map can be multiple lines), it doesn't.
257
+        const cOffset = i === 0 ? columnOffset : 0;
258
+        const line = decoded[i];
259
+        for (let j = 0; j < line.length; j++) {
260
+            const seg = line[j];
261
+            const column = cOffset + seg[COLUMN];
262
+            // If this segment steps into the column range that the next section's map controls, we need
263
+            // to stop early.
264
+            if (lineI === stopLine && column >= stopColumn)
265
+                return;
266
+            if (seg.length === 1) {
267
+                out.push([column]);
268
+                continue;
269
+            }
270
+            const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
271
+            const sourceLine = seg[SOURCE_LINE];
272
+            const sourceColumn = seg[SOURCE_COLUMN];
273
+            out.push(seg.length === 4
274
+                ? [column, sourcesIndex, sourceLine, sourceColumn]
275
+                : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]);
276
+        }
277
+    }
278
+}
279
+function append(arr, other) {
280
+    for (let i = 0; i < other.length; i++)
281
+        arr.push(other[i]);
282
+}
283
+function getLine(arr, index) {
284
+    for (let i = arr.length; i <= index; i++)
285
+        arr[i] = [];
286
+    return arr[index];
287
+}
288
+
289
+const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
290
+const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
291
+const LEAST_UPPER_BOUND = -1;
292
+const GREATEST_LOWER_BOUND = 1;
293
+/**
294
+ * Returns the encoded (VLQ string) form of the SourceMap's mappings field.
295
+ */
296
+let encodedMappings;
297
+/**
298
+ * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
299
+ */
300
+let decodedMappings;
301
+/**
302
+ * A low-level API to find the segment associated with a generated line/column (think, from a
303
+ * stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
304
+ */
305
+let traceSegment;
306
+/**
307
+ * A higher-level API to find the source/line/column associated with a generated line/column
308
+ * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
309
+ * `source-map` library.
310
+ */
311
+let originalPositionFor;
312
+/**
313
+ * Finds the generated line/column position of the provided source/line/column source position.
314
+ */
315
+let generatedPositionFor;
316
+/**
317
+ * Finds all generated line/column positions of the provided source/line/column source position.
318
+ */
319
+let allGeneratedPositionsFor;
320
+/**
321
+ * Iterates each mapping in generated position order.
322
+ */
323
+let eachMapping;
324
+/**
325
+ * Retrieves the source content for a particular source, if its found. Returns null if not.
326
+ */
327
+let sourceContentFor;
328
+/**
329
+ * A helper that skips sorting of the input map's mappings array, which can be expensive for larger
330
+ * maps.
331
+ */
332
+let presortedDecodedMap;
333
+/**
334
+ * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
335
+ * a sourcemap, or to JSON.stringify.
336
+ */
337
+let decodedMap;
338
+/**
339
+ * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
340
+ * a sourcemap, or to JSON.stringify.
341
+ */
342
+let encodedMap;
343
+class TraceMap {
344
+    constructor(map, mapUrl) {
345
+        const isString = typeof map === 'string';
346
+        if (!isString && map._decodedMemo)
347
+            return map;
348
+        const parsed = (isString ? JSON.parse(map) : map);
349
+        const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
350
+        this.version = version;
351
+        this.file = file;
352
+        this.names = names;
353
+        this.sourceRoot = sourceRoot;
354
+        this.sources = sources;
355
+        this.sourcesContent = sourcesContent;
356
+        const from = resolve(sourceRoot || '', stripFilename(mapUrl));
357
+        this.resolvedSources = sources.map((s) => resolve(s || '', from));
358
+        const { mappings } = parsed;
359
+        if (typeof mappings === 'string') {
360
+            this._encoded = mappings;
361
+            this._decoded = undefined;
362
+        }
363
+        else {
364
+            this._encoded = undefined;
365
+            this._decoded = maybeSort(mappings, isString);
366
+        }
367
+        this._decodedMemo = memoizedState();
368
+        this._bySources = undefined;
369
+        this._bySourceMemos = undefined;
370
+    }
371
+}
372
+(() => {
373
+    encodedMappings = (map) => {
374
+        var _a;
375
+        return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = encode(map._decoded)));
376
+    };
377
+    decodedMappings = (map) => {
378
+        return (map._decoded || (map._decoded = decode(map._encoded)));
379
+    };
380
+    traceSegment = (map, line, column) => {
381
+        const decoded = decodedMappings(map);
382
+        // It's common for parent source maps to have pointers to lines that have no
383
+        // mapping (like a "//# sourceMappingURL=") at the end of the child file.
384
+        if (line >= decoded.length)
385
+            return null;
386
+        const segments = decoded[line];
387
+        const index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
388
+        return index === -1 ? null : segments[index];
389
+    };
390
+    originalPositionFor = (map, { line, column, bias }) => {
391
+        line--;
392
+        if (line < 0)
393
+            throw new Error(LINE_GTR_ZERO);
394
+        if (column < 0)
395
+            throw new Error(COL_GTR_EQ_ZERO);
396
+        const decoded = decodedMappings(map);
397
+        // It's common for parent source maps to have pointers to lines that have no
398
+        // mapping (like a "//# sourceMappingURL=") at the end of the child file.
399
+        if (line >= decoded.length)
400
+            return OMapping(null, null, null, null);
401
+        const segments = decoded[line];
402
+        const index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
403
+        if (index === -1)
404
+            return OMapping(null, null, null, null);
405
+        const segment = segments[index];
406
+        if (segment.length === 1)
407
+            return OMapping(null, null, null, null);
408
+        const { names, resolvedSources } = map;
409
+        return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
410
+    };
411
+    allGeneratedPositionsFor = (map, { source, line, column, bias }) => {
412
+        // SourceMapConsumer uses LEAST_UPPER_BOUND for some reason, so we follow suit.
413
+        return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);
414
+    };
415
+    generatedPositionFor = (map, { source, line, column, bias }) => {
416
+        return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);
417
+    };
418
+    eachMapping = (map, cb) => {
419
+        const decoded = decodedMappings(map);
420
+        const { names, resolvedSources } = map;
421
+        for (let i = 0; i < decoded.length; i++) {
422
+            const line = decoded[i];
423
+            for (let j = 0; j < line.length; j++) {
424
+                const seg = line[j];
425
+                const generatedLine = i + 1;
426
+                const generatedColumn = seg[0];
427
+                let source = null;
428
+                let originalLine = null;
429
+                let originalColumn = null;
430
+                let name = null;
431
+                if (seg.length !== 1) {
432
+                    source = resolvedSources[seg[1]];
433
+                    originalLine = seg[2] + 1;
434
+                    originalColumn = seg[3];
435
+                }
436
+                if (seg.length === 5)
437
+                    name = names[seg[4]];
438
+                cb({
439
+                    generatedLine,
440
+                    generatedColumn,
441
+                    source,
442
+                    originalLine,
443
+                    originalColumn,
444
+                    name,
445
+                });
446
+            }
447
+        }
448
+    };
449
+    sourceContentFor = (map, source) => {
450
+        const { sources, resolvedSources, sourcesContent } = map;
451
+        if (sourcesContent == null)
452
+            return null;
453
+        let index = sources.indexOf(source);
454
+        if (index === -1)
455
+            index = resolvedSources.indexOf(source);
456
+        return index === -1 ? null : sourcesContent[index];
457
+    };
458
+    presortedDecodedMap = (map, mapUrl) => {
459
+        const tracer = new TraceMap(clone(map, []), mapUrl);
460
+        tracer._decoded = map.mappings;
461
+        return tracer;
462
+    };
463
+    decodedMap = (map) => {
464
+        return clone(map, decodedMappings(map));
465
+    };
466
+    encodedMap = (map) => {
467
+        return clone(map, encodedMappings(map));
468
+    };
469
+    function generatedPosition(map, source, line, column, bias, all) {
470
+        line--;
471
+        if (line < 0)
472
+            throw new Error(LINE_GTR_ZERO);
473
+        if (column < 0)
474
+            throw new Error(COL_GTR_EQ_ZERO);
475
+        const { sources, resolvedSources } = map;
476
+        let sourceIndex = sources.indexOf(source);
477
+        if (sourceIndex === -1)
478
+            sourceIndex = resolvedSources.indexOf(source);
479
+        if (sourceIndex === -1)
480
+            return all ? [] : GMapping(null, null);
481
+        const generated = (map._bySources || (map._bySources = buildBySources(decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState)))));
482
+        const segments = generated[sourceIndex][line];
483
+        if (segments == null)
484
+            return all ? [] : GMapping(null, null);
485
+        const memo = map._bySourceMemos[sourceIndex];
486
+        if (all)
487
+            return sliceGeneratedPositions(segments, memo, line, column, bias);
488
+        const index = traceSegmentInternal(segments, memo, line, column, bias);
489
+        if (index === -1)
490
+            return GMapping(null, null);
491
+        const segment = segments[index];
492
+        return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);
493
+    }
494
+})();
495
+function clone(map, mappings) {
496
+    return {
497
+        version: map.version,
498
+        file: map.file,
499
+        names: map.names,
500
+        sourceRoot: map.sourceRoot,
501
+        sources: map.sources,
502
+        sourcesContent: map.sourcesContent,
503
+        mappings,
504
+    };
505
+}
506
+function OMapping(source, line, column, name) {
507
+    return { source, line, column, name };
508
+}
509
+function GMapping(line, column) {
510
+    return { line, column };
511
+}
512
+function traceSegmentInternal(segments, memo, line, column, bias) {
513
+    let index = memoizedBinarySearch(segments, column, memo, line);
514
+    if (found) {
515
+        index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
516
+    }
517
+    else if (bias === LEAST_UPPER_BOUND)
518
+        index++;
519
+    if (index === -1 || index === segments.length)
520
+        return -1;
521
+    return index;
522
+}
523
+function sliceGeneratedPositions(segments, memo, line, column, bias) {
524
+    let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
525
+    // We ignored the bias when tracing the segment so that we're guarnateed to find the first (in
526
+    // insertion order) segment that matched. Even if we did respect the bias when tracing, we would
527
+    // still need to call `lowerBound()` to find the first segment, which is slower than just looking
528
+    // for the GREATEST_LOWER_BOUND to begin with. The only difference that matters for us is when the
529
+    // binary search didn't match, in which case GREATEST_LOWER_BOUND just needs to increment to
530
+    // match LEAST_UPPER_BOUND.
531
+    if (!found && bias === LEAST_UPPER_BOUND)
532
+        min++;
533
+    if (min === -1 || min === segments.length)
534
+        return [];
535
+    // We may have found the segment that started at an earlier column. If this is the case, then we
536
+    // need to slice all generated segments that match _that_ column, because all such segments span
537
+    // to our desired column.
538
+    const matchedColumn = found ? column : segments[min][COLUMN];
539
+    // The binary search is not guaranteed to find the lower bound when a match wasn't found.
540
+    if (!found)
541
+        min = lowerBound(segments, matchedColumn, min);
542
+    const max = upperBound(segments, matchedColumn, min);
543
+    const result = [];
544
+    for (; min <= max; min++) {
545
+        const segment = segments[min];
546
+        result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
547
+    }
548
+    return result;
549
+}
550
+
551
+export { AnyMap, GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap, allGeneratedPositionsFor, decodedMap, decodedMappings, eachMapping, encodedMap, encodedMappings, generatedPositionFor, originalPositionFor, presortedDecodedMap, sourceContentFor, traceSegment };
552
+//# sourceMappingURL=trace-mapping.mjs.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map


+ 566 - 0
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js

@@ -0,0 +1,566 @@
1
+(function (global, factory) {
2
+    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/sourcemap-codec'), require('@jridgewell/resolve-uri')) :
3
+    typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/sourcemap-codec', '@jridgewell/resolve-uri'], factory) :
4
+    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.traceMapping = {}, global.sourcemapCodec, global.resolveURI));
5
+})(this, (function (exports, sourcemapCodec, resolveUri) { 'use strict';
6
+
7
+    function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+    var resolveUri__default = /*#__PURE__*/_interopDefaultLegacy(resolveUri);
10
+
11
+    function resolve(input, base) {
12
+        // The base is always treated as a directory, if it's not empty.
13
+        // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
14
+        // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
15
+        if (base && !base.endsWith('/'))
16
+            base += '/';
17
+        return resolveUri__default["default"](input, base);
18
+    }
19
+
20
+    /**
21
+     * Removes everything after the last "/", but leaves the slash.
22
+     */
23
+    function stripFilename(path) {
24
+        if (!path)
25
+            return '';
26
+        const index = path.lastIndexOf('/');
27
+        return path.slice(0, index + 1);
28
+    }
29
+
30
+    const COLUMN = 0;
31
+    const SOURCES_INDEX = 1;
32
+    const SOURCE_LINE = 2;
33
+    const SOURCE_COLUMN = 3;
34
+    const NAMES_INDEX = 4;
35
+    const REV_GENERATED_LINE = 1;
36
+    const REV_GENERATED_COLUMN = 2;
37
+
38
+    function maybeSort(mappings, owned) {
39
+        const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
40
+        if (unsortedIndex === mappings.length)
41
+            return mappings;
42
+        // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
43
+        // not, we do not want to modify the consumer's input array.
44
+        if (!owned)
45
+            mappings = mappings.slice();
46
+        for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
47
+            mappings[i] = sortSegments(mappings[i], owned);
48
+        }
49
+        return mappings;
50
+    }
51
+    function nextUnsortedSegmentLine(mappings, start) {
52
+        for (let i = start; i < mappings.length; i++) {
53
+            if (!isSorted(mappings[i]))
54
+                return i;
55
+        }
56
+        return mappings.length;
57
+    }
58
+    function isSorted(line) {
59
+        for (let j = 1; j < line.length; j++) {
60
+            if (line[j][COLUMN] < line[j - 1][COLUMN]) {
61
+                return false;
62
+            }
63
+        }
64
+        return true;
65
+    }
66
+    function sortSegments(line, owned) {
67
+        if (!owned)
68
+            line = line.slice();
69
+        return line.sort(sortComparator);
70
+    }
71
+    function sortComparator(a, b) {
72
+        return a[COLUMN] - b[COLUMN];
73
+    }
74
+
75
+    let found = false;
76
+    /**
77
+     * A binary search implementation that returns the index if a match is found.
78
+     * If no match is found, then the left-index (the index associated with the item that comes just
79
+     * before the desired index) is returned. To maintain proper sort order, a splice would happen at
80
+     * the next index:
81
+     *
82
+     * ```js
83
+     * const array = [1, 3];
84
+     * const needle = 2;
85
+     * const index = binarySearch(array, needle, (item, needle) => item - needle);
86
+     *
87
+     * assert.equal(index, 0);
88
+     * array.splice(index + 1, 0, needle);
89
+     * assert.deepEqual(array, [1, 2, 3]);
90
+     * ```
91
+     */
92
+    function binarySearch(haystack, needle, low, high) {
93
+        while (low <= high) {
94
+            const mid = low + ((high - low) >> 1);
95
+            const cmp = haystack[mid][COLUMN] - needle;
96
+            if (cmp === 0) {
97
+                found = true;
98
+                return mid;
99
+            }
100
+            if (cmp < 0) {
101
+                low = mid + 1;
102
+            }
103
+            else {
104
+                high = mid - 1;
105
+            }
106
+        }
107
+        found = false;
108
+        return low - 1;
109
+    }
110
+    function upperBound(haystack, needle, index) {
111
+        for (let i = index + 1; i < haystack.length; index = i++) {
112
+            if (haystack[i][COLUMN] !== needle)
113
+                break;
114
+        }
115
+        return index;
116
+    }
117
+    function lowerBound(haystack, needle, index) {
118
+        for (let i = index - 1; i >= 0; index = i--) {
119
+            if (haystack[i][COLUMN] !== needle)
120
+                break;
121
+        }
122
+        return index;
123
+    }
124
+    function memoizedState() {
125
+        return {
126
+            lastKey: -1,
127
+            lastNeedle: -1,
128
+            lastIndex: -1,
129
+        };
130
+    }
131
+    /**
132
+     * This overly complicated beast is just to record the last tested line/column and the resulting
133
+     * index, allowing us to skip a few tests if mappings are monotonically increasing.
134
+     */
135
+    function memoizedBinarySearch(haystack, needle, state, key) {
136
+        const { lastKey, lastNeedle, lastIndex } = state;
137
+        let low = 0;
138
+        let high = haystack.length - 1;
139
+        if (key === lastKey) {
140
+            if (needle === lastNeedle) {
141
+                found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
142
+                return lastIndex;
143
+            }
144
+            if (needle >= lastNeedle) {
145
+                // lastIndex may be -1 if the previous needle was not found.
146
+                low = lastIndex === -1 ? 0 : lastIndex;
147
+            }
148
+            else {
149
+                high = lastIndex;
150
+            }
151
+        }
152
+        state.lastKey = key;
153
+        state.lastNeedle = needle;
154
+        return (state.lastIndex = binarySearch(haystack, needle, low, high));
155
+    }
156
+
157
+    // Rebuilds the original source files, with mappings that are ordered by source line/column instead
158
+    // of generated line/column.
159
+    function buildBySources(decoded, memos) {
160
+        const sources = memos.map(buildNullArray);
161
+        for (let i = 0; i < decoded.length; i++) {
162
+            const line = decoded[i];
163
+            for (let j = 0; j < line.length; j++) {
164
+                const seg = line[j];
165
+                if (seg.length === 1)
166
+                    continue;
167
+                const sourceIndex = seg[SOURCES_INDEX];
168
+                const sourceLine = seg[SOURCE_LINE];
169
+                const sourceColumn = seg[SOURCE_COLUMN];
170
+                const originalSource = sources[sourceIndex];
171
+                const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = []));
172
+                const memo = memos[sourceIndex];
173
+                // The binary search either found a match, or it found the left-index just before where the
174
+                // segment should go. Either way, we want to insert after that. And there may be multiple
175
+                // generated segments associated with an original location, so there may need to move several
176
+                // indexes before we find where we need to insert.
177
+                const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine));
178
+                insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);
179
+            }
180
+        }
181
+        return sources;
182
+    }
183
+    function insert(array, index, value) {
184
+        for (let i = array.length; i > index; i--) {
185
+            array[i] = array[i - 1];
186
+        }
187
+        array[index] = value;
188
+    }
189
+    // Null arrays allow us to use ordered index keys without actually allocating contiguous memory like
190
+    // a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations.
191
+    // Numeric properties on objects are magically sorted in ascending order by the engine regardless of
192
+    // the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending
193
+    // order when iterating with for-in.
194
+    function buildNullArray() {
195
+        return { __proto__: null };
196
+    }
197
+
198
+    const AnyMap = function (map, mapUrl) {
199
+        const parsed = typeof map === 'string' ? JSON.parse(map) : map;
200
+        if (!('sections' in parsed))
201
+            return new TraceMap(parsed, mapUrl);
202
+        const mappings = [];
203
+        const sources = [];
204
+        const sourcesContent = [];
205
+        const names = [];
206
+        recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, 0, 0, Infinity, Infinity);
207
+        const joined = {
208
+            version: 3,
209
+            file: parsed.file,
210
+            names,
211
+            sources,
212
+            sourcesContent,
213
+            mappings,
214
+        };
215
+        return exports.presortedDecodedMap(joined);
216
+    };
217
+    function recurse(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) {
218
+        const { sections } = input;
219
+        for (let i = 0; i < sections.length; i++) {
220
+            const { map, offset } = sections[i];
221
+            let sl = stopLine;
222
+            let sc = stopColumn;
223
+            if (i + 1 < sections.length) {
224
+                const nextOffset = sections[i + 1].offset;
225
+                sl = Math.min(stopLine, lineOffset + nextOffset.line);
226
+                if (sl === stopLine) {
227
+                    sc = Math.min(stopColumn, columnOffset + nextOffset.column);
228
+                }
229
+                else if (sl < stopLine) {
230
+                    sc = columnOffset + nextOffset.column;
231
+                }
232
+            }
233
+            addSection(map, mapUrl, mappings, sources, sourcesContent, names, lineOffset + offset.line, columnOffset + offset.column, sl, sc);
234
+        }
235
+    }
236
+    function addSection(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) {
237
+        if ('sections' in input)
238
+            return recurse(...arguments);
239
+        const map = new TraceMap(input, mapUrl);
240
+        const sourcesOffset = sources.length;
241
+        const namesOffset = names.length;
242
+        const decoded = exports.decodedMappings(map);
243
+        const { resolvedSources, sourcesContent: contents } = map;
244
+        append(sources, resolvedSources);
245
+        append(names, map.names);
246
+        if (contents)
247
+            append(sourcesContent, contents);
248
+        else
249
+            for (let i = 0; i < resolvedSources.length; i++)
250
+                sourcesContent.push(null);
251
+        for (let i = 0; i < decoded.length; i++) {
252
+            const lineI = lineOffset + i;
253
+            // We can only add so many lines before we step into the range that the next section's map
254
+            // controls. When we get to the last line, then we'll start checking the segments to see if
255
+            // they've crossed into the column range. But it may not have any columns that overstep, so we
256
+            // still need to check that we don't overstep lines, too.
257
+            if (lineI > stopLine)
258
+                return;
259
+            // The out line may already exist in mappings (if we're continuing the line started by a
260
+            // previous section). Or, we may have jumped ahead several lines to start this section.
261
+            const out = getLine(mappings, lineI);
262
+            // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the
263
+            // map can be multiple lines), it doesn't.
264
+            const cOffset = i === 0 ? columnOffset : 0;
265
+            const line = decoded[i];
266
+            for (let j = 0; j < line.length; j++) {
267
+                const seg = line[j];
268
+                const column = cOffset + seg[COLUMN];
269
+                // If this segment steps into the column range that the next section's map controls, we need
270
+                // to stop early.
271
+                if (lineI === stopLine && column >= stopColumn)
272
+                    return;
273
+                if (seg.length === 1) {
274
+                    out.push([column]);
275
+                    continue;
276
+                }
277
+                const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
278
+                const sourceLine = seg[SOURCE_LINE];
279
+                const sourceColumn = seg[SOURCE_COLUMN];
280
+                out.push(seg.length === 4
281
+                    ? [column, sourcesIndex, sourceLine, sourceColumn]
282
+                    : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]);
283
+            }
284
+        }
285
+    }
286
+    function append(arr, other) {
287
+        for (let i = 0; i < other.length; i++)
288
+            arr.push(other[i]);
289
+    }
290
+    function getLine(arr, index) {
291
+        for (let i = arr.length; i <= index; i++)
292
+            arr[i] = [];
293
+        return arr[index];
294
+    }
295
+
296
+    const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
297
+    const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
298
+    const LEAST_UPPER_BOUND = -1;
299
+    const GREATEST_LOWER_BOUND = 1;
300
+    /**
301
+     * Returns the encoded (VLQ string) form of the SourceMap's mappings field.
302
+     */
303
+    exports.encodedMappings = void 0;
304
+    /**
305
+     * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
306
+     */
307
+    exports.decodedMappings = void 0;
308
+    /**
309
+     * A low-level API to find the segment associated with a generated line/column (think, from a
310
+     * stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
311
+     */
312
+    exports.traceSegment = void 0;
313
+    /**
314
+     * A higher-level API to find the source/line/column associated with a generated line/column
315
+     * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
316
+     * `source-map` library.
317
+     */
318
+    exports.originalPositionFor = void 0;
319
+    /**
320
+     * Finds the generated line/column position of the provided source/line/column source position.
321
+     */
322
+    exports.generatedPositionFor = void 0;
323
+    /**
324
+     * Finds all generated line/column positions of the provided source/line/column source position.
325
+     */
326
+    exports.allGeneratedPositionsFor = void 0;
327
+    /**
328
+     * Iterates each mapping in generated position order.
329
+     */
330
+    exports.eachMapping = void 0;
331
+    /**
332
+     * Retrieves the source content for a particular source, if its found. Returns null if not.
333
+     */
334
+    exports.sourceContentFor = void 0;
335
+    /**
336
+     * A helper that skips sorting of the input map's mappings array, which can be expensive for larger
337
+     * maps.
338
+     */
339
+    exports.presortedDecodedMap = void 0;
340
+    /**
341
+     * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
342
+     * a sourcemap, or to JSON.stringify.
343
+     */
344
+    exports.decodedMap = void 0;
345
+    /**
346
+     * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
347
+     * a sourcemap, or to JSON.stringify.
348
+     */
349
+    exports.encodedMap = void 0;
350
+    class TraceMap {
351
+        constructor(map, mapUrl) {
352
+            const isString = typeof map === 'string';
353
+            if (!isString && map._decodedMemo)
354
+                return map;
355
+            const parsed = (isString ? JSON.parse(map) : map);
356
+            const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
357
+            this.version = version;
358
+            this.file = file;
359
+            this.names = names;
360
+            this.sourceRoot = sourceRoot;
361
+            this.sources = sources;
362
+            this.sourcesContent = sourcesContent;
363
+            const from = resolve(sourceRoot || '', stripFilename(mapUrl));
364
+            this.resolvedSources = sources.map((s) => resolve(s || '', from));
365
+            const { mappings } = parsed;
366
+            if (typeof mappings === 'string') {
367
+                this._encoded = mappings;
368
+                this._decoded = undefined;
369
+            }
370
+            else {
371
+                this._encoded = undefined;
372
+                this._decoded = maybeSort(mappings, isString);
373
+            }
374
+            this._decodedMemo = memoizedState();
375
+            this._bySources = undefined;
376
+            this._bySourceMemos = undefined;
377
+        }
378
+    }
379
+    (() => {
380
+        exports.encodedMappings = (map) => {
381
+            var _a;
382
+            return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = sourcemapCodec.encode(map._decoded)));
383
+        };
384
+        exports.decodedMappings = (map) => {
385
+            return (map._decoded || (map._decoded = sourcemapCodec.decode(map._encoded)));
386
+        };
387
+        exports.traceSegment = (map, line, column) => {
388
+            const decoded = exports.decodedMappings(map);
389
+            // It's common for parent source maps to have pointers to lines that have no
390
+            // mapping (like a "//# sourceMappingURL=") at the end of the child file.
391
+            if (line >= decoded.length)
392
+                return null;
393
+            const segments = decoded[line];
394
+            const index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
395
+            return index === -1 ? null : segments[index];
396
+        };
397
+        exports.originalPositionFor = (map, { line, column, bias }) => {
398
+            line--;
399
+            if (line < 0)
400
+                throw new Error(LINE_GTR_ZERO);
401
+            if (column < 0)
402
+                throw new Error(COL_GTR_EQ_ZERO);
403
+            const decoded = exports.decodedMappings(map);
404
+            // It's common for parent source maps to have pointers to lines that have no
405
+            // mapping (like a "//# sourceMappingURL=") at the end of the child file.
406
+            if (line >= decoded.length)
407
+                return OMapping(null, null, null, null);
408
+            const segments = decoded[line];
409
+            const index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
410
+            if (index === -1)
411
+                return OMapping(null, null, null, null);
412
+            const segment = segments[index];
413
+            if (segment.length === 1)
414
+                return OMapping(null, null, null, null);
415
+            const { names, resolvedSources } = map;
416
+            return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
417
+        };
418
+        exports.allGeneratedPositionsFor = (map, { source, line, column, bias }) => {
419
+            // SourceMapConsumer uses LEAST_UPPER_BOUND for some reason, so we follow suit.
420
+            return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);
421
+        };
422
+        exports.generatedPositionFor = (map, { source, line, column, bias }) => {
423
+            return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);
424
+        };
425
+        exports.eachMapping = (map, cb) => {
426
+            const decoded = exports.decodedMappings(map);
427
+            const { names, resolvedSources } = map;
428
+            for (let i = 0; i < decoded.length; i++) {
429
+                const line = decoded[i];
430
+                for (let j = 0; j < line.length; j++) {
431
+                    const seg = line[j];
432
+                    const generatedLine = i + 1;
433
+                    const generatedColumn = seg[0];
434
+                    let source = null;
435
+                    let originalLine = null;
436
+                    let originalColumn = null;
437
+                    let name = null;
438
+                    if (seg.length !== 1) {
439
+                        source = resolvedSources[seg[1]];
440
+                        originalLine = seg[2] + 1;
441
+                        originalColumn = seg[3];
442
+                    }
443
+                    if (seg.length === 5)
444
+                        name = names[seg[4]];
445
+                    cb({
446
+                        generatedLine,
447
+                        generatedColumn,
448
+                        source,
449
+                        originalLine,
450
+                        originalColumn,
451
+                        name,
452
+                    });
453
+                }
454
+            }
455
+        };
456
+        exports.sourceContentFor = (map, source) => {
457
+            const { sources, resolvedSources, sourcesContent } = map;
458
+            if (sourcesContent == null)
459
+                return null;
460
+            let index = sources.indexOf(source);
461
+            if (index === -1)
462
+                index = resolvedSources.indexOf(source);
463
+            return index === -1 ? null : sourcesContent[index];
464
+        };
465
+        exports.presortedDecodedMap = (map, mapUrl) => {
466
+            const tracer = new TraceMap(clone(map, []), mapUrl);
467
+            tracer._decoded = map.mappings;
468
+            return tracer;
469
+        };
470
+        exports.decodedMap = (map) => {
471
+            return clone(map, exports.decodedMappings(map));
472
+        };
473
+        exports.encodedMap = (map) => {
474
+            return clone(map, exports.encodedMappings(map));
475
+        };
476
+        function generatedPosition(map, source, line, column, bias, all) {
477
+            line--;
478
+            if (line < 0)
479
+                throw new Error(LINE_GTR_ZERO);
480
+            if (column < 0)
481
+                throw new Error(COL_GTR_EQ_ZERO);
482
+            const { sources, resolvedSources } = map;
483
+            let sourceIndex = sources.indexOf(source);
484
+            if (sourceIndex === -1)
485
+                sourceIndex = resolvedSources.indexOf(source);
486
+            if (sourceIndex === -1)
487
+                return all ? [] : GMapping(null, null);
488
+            const generated = (map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState)))));
489
+            const segments = generated[sourceIndex][line];
490
+            if (segments == null)
491
+                return all ? [] : GMapping(null, null);
492
+            const memo = map._bySourceMemos[sourceIndex];
493
+            if (all)
494
+                return sliceGeneratedPositions(segments, memo, line, column, bias);
495
+            const index = traceSegmentInternal(segments, memo, line, column, bias);
496
+            if (index === -1)
497
+                return GMapping(null, null);
498
+            const segment = segments[index];
499
+            return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);
500
+        }
501
+    })();
502
+    function clone(map, mappings) {
503
+        return {
504
+            version: map.version,
505
+            file: map.file,
506
+            names: map.names,
507
+            sourceRoot: map.sourceRoot,
508
+            sources: map.sources,
509
+            sourcesContent: map.sourcesContent,
510
+            mappings,
511
+        };
512
+    }
513
+    function OMapping(source, line, column, name) {
514
+        return { source, line, column, name };
515
+    }
516
+    function GMapping(line, column) {
517
+        return { line, column };
518
+    }
519
+    function traceSegmentInternal(segments, memo, line, column, bias) {
520
+        let index = memoizedBinarySearch(segments, column, memo, line);
521
+        if (found) {
522
+            index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
523
+        }
524
+        else if (bias === LEAST_UPPER_BOUND)
525
+            index++;
526
+        if (index === -1 || index === segments.length)
527
+            return -1;
528
+        return index;
529
+    }
530
+    function sliceGeneratedPositions(segments, memo, line, column, bias) {
531
+        let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
532
+        // We ignored the bias when tracing the segment so that we're guarnateed to find the first (in
533
+        // insertion order) segment that matched. Even if we did respect the bias when tracing, we would
534
+        // still need to call `lowerBound()` to find the first segment, which is slower than just looking
535
+        // for the GREATEST_LOWER_BOUND to begin with. The only difference that matters for us is when the
536
+        // binary search didn't match, in which case GREATEST_LOWER_BOUND just needs to increment to
537
+        // match LEAST_UPPER_BOUND.
538
+        if (!found && bias === LEAST_UPPER_BOUND)
539
+            min++;
540
+        if (min === -1 || min === segments.length)
541
+            return [];
542
+        // We may have found the segment that started at an earlier column. If this is the case, then we
543
+        // need to slice all generated segments that match _that_ column, because all such segments span
544
+        // to our desired column.
545
+        const matchedColumn = found ? column : segments[min][COLUMN];
546
+        // The binary search is not guaranteed to find the lower bound when a match wasn't found.
547
+        if (!found)
548
+            min = lowerBound(segments, matchedColumn, min);
549
+        const max = upperBound(segments, matchedColumn, min);
550
+        const result = [];
551
+        for (; min <= max; min++) {
552
+            const segment = segments[min];
553
+            result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
554
+        }
555
+        return result;
556
+    }
557
+
558
+    exports.AnyMap = AnyMap;
559
+    exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND;
560
+    exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND;
561
+    exports.TraceMap = TraceMap;
562
+
563
+    Object.defineProperty(exports, '__esModule', { value: true });
564
+
565
+}));
566
+//# sourceMappingURL=trace-mapping.umd.js.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map


+ 8 - 0
node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts

@@ -0,0 +1,8 @@
1
+import { TraceMap } from './trace-mapping';
2
+import type { SectionedSourceMapInput } from './types';
3
+declare type AnyMap = {
4
+    new (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;
5
+    (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;
6
+};
7
+export declare const AnyMap: AnyMap;
8
+export {};

+ 32 - 0
node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts

@@ -0,0 +1,32 @@
1
+import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment';
2
+export declare type MemoState = {
3
+    lastKey: number;
4
+    lastNeedle: number;
5
+    lastIndex: number;
6
+};
7
+export declare let found: boolean;
8
+/**
9
+ * A binary search implementation that returns the index if a match is found.
10
+ * If no match is found, then the left-index (the index associated with the item that comes just
11
+ * before the desired index) is returned. To maintain proper sort order, a splice would happen at
12
+ * the next index:
13
+ *
14
+ * ```js
15
+ * const array = [1, 3];
16
+ * const needle = 2;
17
+ * const index = binarySearch(array, needle, (item, needle) => item - needle);
18
+ *
19
+ * assert.equal(index, 0);
20
+ * array.splice(index + 1, 0, needle);
21
+ * assert.deepEqual(array, [1, 2, 3]);
22
+ * ```
23
+ */
24
+export declare function binarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, low: number, high: number): number;
25
+export declare function upperBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number;
26
+export declare function lowerBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number;
27
+export declare function memoizedState(): MemoState;
28
+/**
29
+ * This overly complicated beast is just to record the last tested line/column and the resulting
30
+ * index, allowing us to skip a few tests if mappings are monotonically increasing.
31
+ */
32
+export declare function memoizedBinarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, state: MemoState, key: number): number;

+ 7 - 0
node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts

@@ -0,0 +1,7 @@
1
+import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment';
2
+import type { MemoState } from './binary-search';
3
+export declare type Source = {
4
+    __proto__: null;
5
+    [line: number]: Exclude<ReverseSegment, [number]>[];
6
+};
7
+export default function buildBySources(decoded: readonly SourceMapSegment[][], memos: MemoState[]): Source[];

+ 1 - 0
node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts

@@ -0,0 +1 @@
1
+export default function resolve(input: string, base: string | undefined): string;

+ 2 - 0
node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts

@@ -0,0 +1,2 @@
1
+import type { SourceMapSegment } from './sourcemap-segment';
2
+export default function maybeSort(mappings: SourceMapSegment[][], owned: boolean): SourceMapSegment[][];

+ 16 - 0
node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts

@@ -0,0 +1,16 @@
1
+declare type GeneratedColumn = number;
2
+declare type SourcesIndex = number;
3
+declare type SourceLine = number;
4
+declare type SourceColumn = number;
5
+declare type NamesIndex = number;
6
+declare type GeneratedLine = number;
7
+export declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];
8
+export declare type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn];
9
+export declare const COLUMN = 0;
10
+export declare const SOURCES_INDEX = 1;
11
+export declare const SOURCE_LINE = 2;
12
+export declare const SOURCE_COLUMN = 3;
13
+export declare const NAMES_INDEX = 4;
14
+export declare const REV_GENERATED_LINE = 1;
15
+export declare const REV_GENERATED_COLUMN = 2;
16
+export {};

+ 4 - 0
node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts

@@ -0,0 +1,4 @@
1
+/**
2
+ * Removes everything after the last "/", but leaves the slash.
3
+ */
4
+export default function stripFilename(path: string | undefined | null): string;

+ 74 - 0
node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts

@@ -0,0 +1,74 @@
1
+import type { SourceMapSegment } from './sourcemap-segment';
2
+import type { SourceMapV3, DecodedSourceMap, EncodedSourceMap, InvalidOriginalMapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, SourceMapInput, Needle, SourceNeedle, SourceMap, EachMapping } from './types';
3
+export type { SourceMapSegment } from './sourcemap-segment';
4
+export type { SourceMapInput, SectionedSourceMapInput, DecodedSourceMap, EncodedSourceMap, SectionedSourceMap, InvalidOriginalMapping, OriginalMapping as Mapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, EachMapping, } from './types';
5
+export declare const LEAST_UPPER_BOUND = -1;
6
+export declare const GREATEST_LOWER_BOUND = 1;
7
+/**
8
+ * Returns the encoded (VLQ string) form of the SourceMap's mappings field.
9
+ */
10
+export declare let encodedMappings: (map: TraceMap) => EncodedSourceMap['mappings'];
11
+/**
12
+ * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
13
+ */
14
+export declare let decodedMappings: (map: TraceMap) => Readonly<DecodedSourceMap['mappings']>;
15
+/**
16
+ * A low-level API to find the segment associated with a generated line/column (think, from a
17
+ * stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
18
+ */
19
+export declare let traceSegment: (map: TraceMap, line: number, column: number) => Readonly<SourceMapSegment> | null;
20
+/**
21
+ * A higher-level API to find the source/line/column associated with a generated line/column
22
+ * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
23
+ * `source-map` library.
24
+ */
25
+export declare let originalPositionFor: (map: TraceMap, needle: Needle) => OriginalMapping | InvalidOriginalMapping;
26
+/**
27
+ * Finds the generated line/column position of the provided source/line/column source position.
28
+ */
29
+export declare let generatedPositionFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping | InvalidGeneratedMapping;
30
+/**
31
+ * Finds all generated line/column positions of the provided source/line/column source position.
32
+ */
33
+export declare let allGeneratedPositionsFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping[];
34
+/**
35
+ * Iterates each mapping in generated position order.
36
+ */
37
+export declare let eachMapping: (map: TraceMap, cb: (mapping: EachMapping) => void) => void;
38
+/**
39
+ * Retrieves the source content for a particular source, if its found. Returns null if not.
40
+ */
41
+export declare let sourceContentFor: (map: TraceMap, source: string) => string | null;
42
+/**
43
+ * A helper that skips sorting of the input map's mappings array, which can be expensive for larger
44
+ * maps.
45
+ */
46
+export declare let presortedDecodedMap: (map: DecodedSourceMap, mapUrl?: string) => TraceMap;
47
+/**
48
+ * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
49
+ * a sourcemap, or to JSON.stringify.
50
+ */
51
+export declare let decodedMap: (map: TraceMap) => Omit<DecodedSourceMap, 'mappings'> & {
52
+    mappings: readonly SourceMapSegment[][];
53
+};
54
+/**
55
+ * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
56
+ * a sourcemap, or to JSON.stringify.
57
+ */
58
+export declare let encodedMap: (map: TraceMap) => EncodedSourceMap;
59
+export { AnyMap } from './any-map';
60
+export declare class TraceMap implements SourceMap {
61
+    version: SourceMapV3['version'];
62
+    file: SourceMapV3['file'];
63
+    names: SourceMapV3['names'];
64
+    sourceRoot: SourceMapV3['sourceRoot'];
65
+    sources: SourceMapV3['sources'];
66
+    sourcesContent: SourceMapV3['sourcesContent'];
67
+    resolvedSources: string[];
68
+    private _encoded;
69
+    private _decoded;
70
+    private _decodedMemo;
71
+    private _bySources;
72
+    private _bySourceMemos;
73
+    constructor(map: SourceMapInput, mapUrl?: string | null);
74
+}

+ 92 - 0
node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts

@@ -0,0 +1,92 @@
1
+import type { SourceMapSegment } from './sourcemap-segment';
2
+import type { GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap } from './trace-mapping';
3
+export interface SourceMapV3 {
4
+    file?: string | null;
5
+    names: string[];
6
+    sourceRoot?: string;
7
+    sources: (string | null)[];
8
+    sourcesContent?: (string | null)[];
9
+    version: 3;
10
+}
11
+export interface EncodedSourceMap extends SourceMapV3 {
12
+    mappings: string;
13
+}
14
+export interface DecodedSourceMap extends SourceMapV3 {
15
+    mappings: SourceMapSegment[][];
16
+}
17
+export interface Section {
18
+    offset: {
19
+        line: number;
20
+        column: number;
21
+    };
22
+    map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap;
23
+}
24
+export interface SectionedSourceMap {
25
+    file?: string | null;
26
+    sections: Section[];
27
+    version: 3;
28
+}
29
+export declare type OriginalMapping = {
30
+    source: string | null;
31
+    line: number;
32
+    column: number;
33
+    name: string | null;
34
+};
35
+export declare type InvalidOriginalMapping = {
36
+    source: null;
37
+    line: null;
38
+    column: null;
39
+    name: null;
40
+};
41
+export declare type GeneratedMapping = {
42
+    line: number;
43
+    column: number;
44
+};
45
+export declare type InvalidGeneratedMapping = {
46
+    line: null;
47
+    column: null;
48
+};
49
+export declare type Bias = typeof GREATEST_LOWER_BOUND | typeof LEAST_UPPER_BOUND;
50
+export declare type SourceMapInput = string | Ro<EncodedSourceMap> | Ro<DecodedSourceMap> | TraceMap;
51
+export declare type SectionedSourceMapInput = SourceMapInput | Ro<SectionedSourceMap>;
52
+export declare type Needle = {
53
+    line: number;
54
+    column: number;
55
+    bias?: Bias;
56
+};
57
+export declare type SourceNeedle = {
58
+    source: string;
59
+    line: number;
60
+    column: number;
61
+    bias?: Bias;
62
+};
63
+export declare type EachMapping = {
64
+    generatedLine: number;
65
+    generatedColumn: number;
66
+    source: null;
67
+    originalLine: null;
68
+    originalColumn: null;
69
+    name: null;
70
+} | {
71
+    generatedLine: number;
72
+    generatedColumn: number;
73
+    source: string | null;
74
+    originalLine: number;
75
+    originalColumn: number;
76
+    name: string | null;
77
+};
78
+export declare abstract class SourceMap {
79
+    version: SourceMapV3['version'];
80
+    file: SourceMapV3['file'];
81
+    names: SourceMapV3['names'];
82
+    sourceRoot: SourceMapV3['sourceRoot'];
83
+    sources: SourceMapV3['sources'];
84
+    sourcesContent: SourceMapV3['sourcesContent'];
85
+    resolvedSources: SourceMapV3['sources'];
86
+}
87
+export declare type Ro<T> = T extends Array<infer V> ? V[] | Readonly<V[]> | RoArray<V> | Readonly<RoArray<V>> : T extends object ? T | Readonly<T> | RoObject<T> | Readonly<RoObject<T>> : T;
88
+declare type RoArray<T> = Ro<T>[];
89
+declare type RoObject<T> = {
90
+    [K in keyof T]: T[K] | Ro<T[K]>;
91
+};
92
+export {};

+ 21 - 0
node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/LICENSE

@@ -0,0 +1,21 @@
1
+The MIT License
2
+
3
+Copyright (c) 2015 Rich Harris
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in
13
+all copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+THE SOFTWARE.

+ 200 - 0
node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/README.md

@@ -0,0 +1,200 @@
1
+# sourcemap-codec
2
+
3
+Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit).
4
+
5
+
6
+## Why?
7
+
8
+Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap.
9
+
10
+This package makes the process slightly easier.
11
+
12
+
13
+## Installation
14
+
15
+```bash
16
+npm install sourcemap-codec
17
+```
18
+
19
+
20
+## Usage
21
+
22
+```js
23
+import { encode, decode } from 'sourcemap-codec';
24
+
25
+var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
26
+
27
+assert.deepEqual( decoded, [
28
+	// the first line (of the generated code) has no mappings,
29
+	// as shown by the starting semi-colon (which separates lines)
30
+	[],
31
+
32
+	// the second line contains four (comma-separated) segments
33
+	[
34
+		// segments are encoded as you'd expect:
35
+		// [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ]
36
+
37
+		// i.e. the first segment begins at column 2, and maps back to the second column
38
+		// of the second line (both zero-based) of the 0th source, and uses the 0th
39
+		// name in the `map.names` array
40
+		[ 2, 0, 2, 2, 0 ],
41
+
42
+		// the remaining segments are 4-length rather than 5-length,
43
+		// because they don't map a name
44
+		[ 4, 0, 2, 4 ],
45
+		[ 6, 0, 2, 5 ],
46
+		[ 7, 0, 2, 7 ]
47
+	],
48
+
49
+	// the final line contains two segments
50
+	[
51
+		[ 2, 1, 10, 19 ],
52
+		[ 12, 1, 11, 20 ]
53
+	]
54
+]);
55
+
56
+var encoded = encode( decoded );
57
+assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
58
+```
59
+
60
+## Benchmarks
61
+
62
+```
63
+node v18.0.0
64
+
65
+amp.js.map - 45120 segments
66
+
67
+Decode Memory Usage:
68
+@jridgewell/sourcemap-codec       5479160 bytes
69
+sourcemap-codec                   5659336 bytes
70
+source-map-0.6.1                 17144440 bytes
71
+source-map-0.8.0                  6867424 bytes
72
+Smallest memory usage is @jridgewell/sourcemap-codec
73
+
74
+Decode speed:
75
+decode: @jridgewell/sourcemap-codec x 502 ops/sec ±1.03% (90 runs sampled)
76
+decode: sourcemap-codec x 445 ops/sec ±0.97% (92 runs sampled)
77
+decode: source-map-0.6.1 x 36.01 ops/sec ±1.64% (49 runs sampled)
78
+decode: source-map-0.8.0 x 367 ops/sec ±0.04% (95 runs sampled)
79
+Fastest is decode: @jridgewell/sourcemap-codec
80
+
81
+Encode Memory Usage:
82
+@jridgewell/sourcemap-codec       1261620 bytes
83
+sourcemap-codec                   9119248 bytes
84
+source-map-0.6.1                  8968560 bytes
85
+source-map-0.8.0                  8952952 bytes
86
+Smallest memory usage is @jridgewell/sourcemap-codec
87
+
88
+Encode speed:
89
+encode: @jridgewell/sourcemap-codec x 738 ops/sec ±0.42% (98 runs sampled)
90
+encode: sourcemap-codec x 238 ops/sec ±0.73% (88 runs sampled)
91
+encode: source-map-0.6.1 x 162 ops/sec ±0.43% (84 runs sampled)
92
+encode: source-map-0.8.0 x 191 ops/sec ±0.34% (90 runs sampled)
93
+Fastest is encode: @jridgewell/sourcemap-codec
94
+
95
+
96
+***
97
+
98
+
99
+babel.min.js.map - 347793 segments
100
+
101
+Decode Memory Usage:
102
+@jridgewell/sourcemap-codec      35338184 bytes
103
+sourcemap-codec                  35922736 bytes
104
+source-map-0.6.1                 62366360 bytes
105
+source-map-0.8.0                 44337416 bytes
106
+Smallest memory usage is @jridgewell/sourcemap-codec
107
+
108
+Decode speed:
109
+decode: @jridgewell/sourcemap-codec x 40.35 ops/sec ±4.47% (54 runs sampled)
110
+decode: sourcemap-codec x 36.76 ops/sec ±3.67% (51 runs sampled)
111
+decode: source-map-0.6.1 x 4.44 ops/sec ±2.15% (16 runs sampled)
112
+decode: source-map-0.8.0 x 59.35 ops/sec ±0.05% (78 runs sampled)
113
+Fastest is decode: source-map-0.8.0
114
+
115
+Encode Memory Usage:
116
+@jridgewell/sourcemap-codec       7212604 bytes
117
+sourcemap-codec                  21421456 bytes
118
+source-map-0.6.1                 25286888 bytes
119
+source-map-0.8.0                 25498744 bytes
120
+Smallest memory usage is @jridgewell/sourcemap-codec
121
+
122
+Encode speed:
123
+encode: @jridgewell/sourcemap-codec x 112 ops/sec ±0.13% (84 runs sampled)
124
+encode: sourcemap-codec x 30.23 ops/sec ±2.76% (53 runs sampled)
125
+encode: source-map-0.6.1 x 19.43 ops/sec ±3.70% (37 runs sampled)
126
+encode: source-map-0.8.0 x 19.40 ops/sec ±3.26% (37 runs sampled)
127
+Fastest is encode: @jridgewell/sourcemap-codec
128
+
129
+
130
+***
131
+
132
+
133
+preact.js.map - 1992 segments
134
+
135
+Decode Memory Usage:
136
+@jridgewell/sourcemap-codec        500272 bytes
137
+sourcemap-codec                    516864 bytes
138
+source-map-0.6.1                  1596672 bytes
139
+source-map-0.8.0                   517272 bytes
140
+Smallest memory usage is @jridgewell/sourcemap-codec
141
+
142
+Decode speed:
143
+decode: @jridgewell/sourcemap-codec x 16,137 ops/sec ±0.17% (99 runs sampled)
144
+decode: sourcemap-codec x 12,139 ops/sec ±0.13% (99 runs sampled)
145
+decode: source-map-0.6.1 x 1,264 ops/sec ±0.12% (100 runs sampled)
146
+decode: source-map-0.8.0 x 9,894 ops/sec ±0.08% (101 runs sampled)
147
+Fastest is decode: @jridgewell/sourcemap-codec
148
+
149
+Encode Memory Usage:
150
+@jridgewell/sourcemap-codec        321026 bytes
151
+sourcemap-codec                    830832 bytes
152
+source-map-0.6.1                   586608 bytes
153
+source-map-0.8.0                   586680 bytes
154
+Smallest memory usage is @jridgewell/sourcemap-codec
155
+
156
+Encode speed:
157
+encode: @jridgewell/sourcemap-codec x 19,876 ops/sec ±0.78% (95 runs sampled)
158
+encode: sourcemap-codec x 6,983 ops/sec ±0.15% (100 runs sampled)
159
+encode: source-map-0.6.1 x 5,070 ops/sec ±0.12% (102 runs sampled)
160
+encode: source-map-0.8.0 x 5,641 ops/sec ±0.17% (100 runs sampled)
161
+Fastest is encode: @jridgewell/sourcemap-codec
162
+
163
+
164
+***
165
+
166
+
167
+react.js.map - 5726 segments
168
+
169
+Decode Memory Usage:
170
+@jridgewell/sourcemap-codec        734848 bytes
171
+sourcemap-codec                    954200 bytes
172
+source-map-0.6.1                  2276432 bytes
173
+source-map-0.8.0                   955488 bytes
174
+Smallest memory usage is @jridgewell/sourcemap-codec
175
+
176
+Decode speed:
177
+decode: @jridgewell/sourcemap-codec x 5,723 ops/sec ±0.12% (98 runs sampled)
178
+decode: sourcemap-codec x 4,555 ops/sec ±0.09% (101 runs sampled)
179
+decode: source-map-0.6.1 x 437 ops/sec ±0.11% (93 runs sampled)
180
+decode: source-map-0.8.0 x 3,441 ops/sec ±0.15% (100 runs sampled)
181
+Fastest is decode: @jridgewell/sourcemap-codec
182
+
183
+Encode Memory Usage:
184
+@jridgewell/sourcemap-codec        638672 bytes
185
+sourcemap-codec                   1109840 bytes
186
+source-map-0.6.1                  1321224 bytes
187
+source-map-0.8.0                  1324448 bytes
188
+Smallest memory usage is @jridgewell/sourcemap-codec
189
+
190
+Encode speed:
191
+encode: @jridgewell/sourcemap-codec x 6,801 ops/sec ±0.48% (98 runs sampled)
192
+encode: sourcemap-codec x 2,533 ops/sec ±0.13% (101 runs sampled)
193
+encode: source-map-0.6.1 x 2,248 ops/sec ±0.08% (100 runs sampled)
194
+encode: source-map-0.8.0 x 2,303 ops/sec ±0.15% (100 runs sampled)
195
+Fastest is encode: @jridgewell/sourcemap-codec
196
+```
197
+
198
+# License
199
+
200
+MIT

+ 164 - 0
node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs

@@ -0,0 +1,164 @@
1
+const comma = ','.charCodeAt(0);
2
+const semicolon = ';'.charCodeAt(0);
3
+const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
4
+const intToChar = new Uint8Array(64); // 64 possible chars.
5
+const charToInt = new Uint8Array(128); // z is 122 in ASCII
6
+for (let i = 0; i < chars.length; i++) {
7
+    const c = chars.charCodeAt(i);
8
+    intToChar[i] = c;
9
+    charToInt[c] = i;
10
+}
11
+// Provide a fallback for older environments.
12
+const td = typeof TextDecoder !== 'undefined'
13
+    ? /* #__PURE__ */ new TextDecoder()
14
+    : typeof Buffer !== 'undefined'
15
+        ? {
16
+            decode(buf) {
17
+                const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
18
+                return out.toString();
19
+            },
20
+        }
21
+        : {
22
+            decode(buf) {
23
+                let out = '';
24
+                for (let i = 0; i < buf.length; i++) {
25
+                    out += String.fromCharCode(buf[i]);
26
+                }
27
+                return out;
28
+            },
29
+        };
30
+function decode(mappings) {
31
+    const state = new Int32Array(5);
32
+    const decoded = [];
33
+    let index = 0;
34
+    do {
35
+        const semi = indexOf(mappings, index);
36
+        const line = [];
37
+        let sorted = true;
38
+        let lastCol = 0;
39
+        state[0] = 0;
40
+        for (let i = index; i < semi; i++) {
41
+            let seg;
42
+            i = decodeInteger(mappings, i, state, 0); // genColumn
43
+            const col = state[0];
44
+            if (col < lastCol)
45
+                sorted = false;
46
+            lastCol = col;
47
+            if (hasMoreVlq(mappings, i, semi)) {
48
+                i = decodeInteger(mappings, i, state, 1); // sourcesIndex
49
+                i = decodeInteger(mappings, i, state, 2); // sourceLine
50
+                i = decodeInteger(mappings, i, state, 3); // sourceColumn
51
+                if (hasMoreVlq(mappings, i, semi)) {
52
+                    i = decodeInteger(mappings, i, state, 4); // namesIndex
53
+                    seg = [col, state[1], state[2], state[3], state[4]];
54
+                }
55
+                else {
56
+                    seg = [col, state[1], state[2], state[3]];
57
+                }
58
+            }
59
+            else {
60
+                seg = [col];
61
+            }
62
+            line.push(seg);
63
+        }
64
+        if (!sorted)
65
+            sort(line);
66
+        decoded.push(line);
67
+        index = semi + 1;
68
+    } while (index <= mappings.length);
69
+    return decoded;
70
+}
71
+function indexOf(mappings, index) {
72
+    const idx = mappings.indexOf(';', index);
73
+    return idx === -1 ? mappings.length : idx;
74
+}
75
+function decodeInteger(mappings, pos, state, j) {
76
+    let value = 0;
77
+    let shift = 0;
78
+    let integer = 0;
79
+    do {
80
+        const c = mappings.charCodeAt(pos++);
81
+        integer = charToInt[c];
82
+        value |= (integer & 31) << shift;
83
+        shift += 5;
84
+    } while (integer & 32);
85
+    const shouldNegate = value & 1;
86
+    value >>>= 1;
87
+    if (shouldNegate) {
88
+        value = -0x80000000 | -value;
89
+    }
90
+    state[j] += value;
91
+    return pos;
92
+}
93
+function hasMoreVlq(mappings, i, length) {
94
+    if (i >= length)
95
+        return false;
96
+    return mappings.charCodeAt(i) !== comma;
97
+}
98
+function sort(line) {
99
+    line.sort(sortComparator);
100
+}
101
+function sortComparator(a, b) {
102
+    return a[0] - b[0];
103
+}
104
+function encode(decoded) {
105
+    const state = new Int32Array(5);
106
+    const bufLength = 1024 * 16;
107
+    const subLength = bufLength - 36;
108
+    const buf = new Uint8Array(bufLength);
109
+    const sub = buf.subarray(0, subLength);
110
+    let pos = 0;
111
+    let out = '';
112
+    for (let i = 0; i < decoded.length; i++) {
113
+        const line = decoded[i];
114
+        if (i > 0) {
115
+            if (pos === bufLength) {
116
+                out += td.decode(buf);
117
+                pos = 0;
118
+            }
119
+            buf[pos++] = semicolon;
120
+        }
121
+        if (line.length === 0)
122
+            continue;
123
+        state[0] = 0;
124
+        for (let j = 0; j < line.length; j++) {
125
+            const segment = line[j];
126
+            // We can push up to 5 ints, each int can take at most 7 chars, and we
127
+            // may push a comma.
128
+            if (pos > subLength) {
129
+                out += td.decode(sub);
130
+                buf.copyWithin(0, subLength, pos);
131
+                pos -= subLength;
132
+            }
133
+            if (j > 0)
134
+                buf[pos++] = comma;
135
+            pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
136
+            if (segment.length === 1)
137
+                continue;
138
+            pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
139
+            pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
140
+            pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
141
+            if (segment.length === 4)
142
+                continue;
143
+            pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
144
+        }
145
+    }
146
+    return out + td.decode(buf.subarray(0, pos));
147
+}
148
+function encodeInteger(buf, pos, state, segment, j) {
149
+    const next = segment[j];
150
+    let num = next - state[j];
151
+    state[j] = next;
152
+    num = num < 0 ? (-num << 1) | 1 : num << 1;
153
+    do {
154
+        let clamped = num & 0b011111;
155
+        num >>>= 5;
156
+        if (num > 0)
157
+            clamped |= 0b100000;
158
+        buf[pos++] = intToChar[clamped];
159
+    } while (num > 0);
160
+    return pos;
161
+}
162
+
163
+export { decode, encode };
164
+//# sourceMappingURL=sourcemap-codec.mjs.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map


+ 175 - 0
node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js

@@ -0,0 +1,175 @@
1
+(function (global, factory) {
2
+    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+    typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {}));
5
+})(this, (function (exports) { 'use strict';
6
+
7
+    const comma = ','.charCodeAt(0);
8
+    const semicolon = ';'.charCodeAt(0);
9
+    const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
10
+    const intToChar = new Uint8Array(64); // 64 possible chars.
11
+    const charToInt = new Uint8Array(128); // z is 122 in ASCII
12
+    for (let i = 0; i < chars.length; i++) {
13
+        const c = chars.charCodeAt(i);
14
+        intToChar[i] = c;
15
+        charToInt[c] = i;
16
+    }
17
+    // Provide a fallback for older environments.
18
+    const td = typeof TextDecoder !== 'undefined'
19
+        ? /* #__PURE__ */ new TextDecoder()
20
+        : typeof Buffer !== 'undefined'
21
+            ? {
22
+                decode(buf) {
23
+                    const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
24
+                    return out.toString();
25
+                },
26
+            }
27
+            : {
28
+                decode(buf) {
29
+                    let out = '';
30
+                    for (let i = 0; i < buf.length; i++) {
31
+                        out += String.fromCharCode(buf[i]);
32
+                    }
33
+                    return out;
34
+                },
35
+            };
36
+    function decode(mappings) {
37
+        const state = new Int32Array(5);
38
+        const decoded = [];
39
+        let index = 0;
40
+        do {
41
+            const semi = indexOf(mappings, index);
42
+            const line = [];
43
+            let sorted = true;
44
+            let lastCol = 0;
45
+            state[0] = 0;
46
+            for (let i = index; i < semi; i++) {
47
+                let seg;
48
+                i = decodeInteger(mappings, i, state, 0); // genColumn
49
+                const col = state[0];
50
+                if (col < lastCol)
51
+                    sorted = false;
52
+                lastCol = col;
53
+                if (hasMoreVlq(mappings, i, semi)) {
54
+                    i = decodeInteger(mappings, i, state, 1); // sourcesIndex
55
+                    i = decodeInteger(mappings, i, state, 2); // sourceLine
56
+                    i = decodeInteger(mappings, i, state, 3); // sourceColumn
57
+                    if (hasMoreVlq(mappings, i, semi)) {
58
+                        i = decodeInteger(mappings, i, state, 4); // namesIndex
59
+                        seg = [col, state[1], state[2], state[3], state[4]];
60
+                    }
61
+                    else {
62
+                        seg = [col, state[1], state[2], state[3]];
63
+                    }
64
+                }
65
+                else {
66
+                    seg = [col];
67
+                }
68
+                line.push(seg);
69
+            }
70
+            if (!sorted)
71
+                sort(line);
72
+            decoded.push(line);
73
+            index = semi + 1;
74
+        } while (index <= mappings.length);
75
+        return decoded;
76
+    }
77
+    function indexOf(mappings, index) {
78
+        const idx = mappings.indexOf(';', index);
79
+        return idx === -1 ? mappings.length : idx;
80
+    }
81
+    function decodeInteger(mappings, pos, state, j) {
82
+        let value = 0;
83
+        let shift = 0;
84
+        let integer = 0;
85
+        do {
86
+            const c = mappings.charCodeAt(pos++);
87
+            integer = charToInt[c];
88
+            value |= (integer & 31) << shift;
89
+            shift += 5;
90
+        } while (integer & 32);
91
+        const shouldNegate = value & 1;
92
+        value >>>= 1;
93
+        if (shouldNegate) {
94
+            value = -0x80000000 | -value;
95
+        }
96
+        state[j] += value;
97
+        return pos;
98
+    }
99
+    function hasMoreVlq(mappings, i, length) {
100
+        if (i >= length)
101
+            return false;
102
+        return mappings.charCodeAt(i) !== comma;
103
+    }
104
+    function sort(line) {
105
+        line.sort(sortComparator);
106
+    }
107
+    function sortComparator(a, b) {
108
+        return a[0] - b[0];
109
+    }
110
+    function encode(decoded) {
111
+        const state = new Int32Array(5);
112
+        const bufLength = 1024 * 16;
113
+        const subLength = bufLength - 36;
114
+        const buf = new Uint8Array(bufLength);
115
+        const sub = buf.subarray(0, subLength);
116
+        let pos = 0;
117
+        let out = '';
118
+        for (let i = 0; i < decoded.length; i++) {
119
+            const line = decoded[i];
120
+            if (i > 0) {
121
+                if (pos === bufLength) {
122
+                    out += td.decode(buf);
123
+                    pos = 0;
124
+                }
125
+                buf[pos++] = semicolon;
126
+            }
127
+            if (line.length === 0)
128
+                continue;
129
+            state[0] = 0;
130
+            for (let j = 0; j < line.length; j++) {
131
+                const segment = line[j];
132
+                // We can push up to 5 ints, each int can take at most 7 chars, and we
133
+                // may push a comma.
134
+                if (pos > subLength) {
135
+                    out += td.decode(sub);
136
+                    buf.copyWithin(0, subLength, pos);
137
+                    pos -= subLength;
138
+                }
139
+                if (j > 0)
140
+                    buf[pos++] = comma;
141
+                pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
142
+                if (segment.length === 1)
143
+                    continue;
144
+                pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
145
+                pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
146
+                pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
147
+                if (segment.length === 4)
148
+                    continue;
149
+                pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
150
+            }
151
+        }
152
+        return out + td.decode(buf.subarray(0, pos));
153
+    }
154
+    function encodeInteger(buf, pos, state, segment, j) {
155
+        const next = segment[j];
156
+        let num = next - state[j];
157
+        state[j] = next;
158
+        num = num < 0 ? (-num << 1) | 1 : num << 1;
159
+        do {
160
+            let clamped = num & 0b011111;
161
+            num >>>= 5;
162
+            if (num > 0)
163
+                clamped |= 0b100000;
164
+            buf[pos++] = intToChar[clamped];
165
+        } while (num > 0);
166
+        return pos;
167
+    }
168
+
169
+    exports.decode = decode;
170
+    exports.encode = encode;
171
+
172
+    Object.defineProperty(exports, '__esModule', { value: true });
173
+
174
+}));
175
+//# sourceMappingURL=sourcemap-codec.umd.js.map

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map


+ 6 - 0
node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts

@@ -0,0 +1,6 @@
1
+export declare type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number];
2
+export declare type SourceMapLine = SourceMapSegment[];
3
+export declare type SourceMapMappings = SourceMapLine[];
4
+export declare function decode(mappings: string): SourceMapMappings;
5
+export declare function encode(decoded: SourceMapMappings): string;
6
+export declare function encode(decoded: Readonly<SourceMapMappings>): string;

+ 75 - 0
node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/package.json

@@ -0,0 +1,75 @@
1
+{
2
+  "name": "@jridgewell/sourcemap-codec",
3
+  "version": "1.4.14",
4
+  "description": "Encode/decode sourcemap mappings",
5
+  "keywords": [
6
+    "sourcemap",
7
+    "vlq"
8
+  ],
9
+  "main": "dist/sourcemap-codec.umd.js",
10
+  "module": "dist/sourcemap-codec.mjs",
11
+  "typings": "dist/types/sourcemap-codec.d.ts",
12
+  "files": [
13
+    "dist",
14
+    "src"
15
+  ],
16
+  "exports": {
17
+    ".": [
18
+      {
19
+        "types": "./dist/types/sourcemap-codec.d.ts",
20
+        "browser": "./dist/sourcemap-codec.umd.js",
21
+        "import": "./dist/sourcemap-codec.mjs",
22
+        "require": "./dist/sourcemap-codec.umd.js"
23
+      },
24
+      "./dist/sourcemap-codec.umd.js"
25
+    ],
26
+    "./package.json": "./package.json"
27
+  },
28
+  "scripts": {
29
+    "benchmark": "run-s build:rollup benchmark:*",
30
+    "benchmark:install": "cd benchmark && npm install",
31
+    "benchmark:only": "node --expose-gc benchmark/index.js",
32
+    "build": "run-s -n build:*",
33
+    "build:rollup": "rollup -c rollup.config.js",
34
+    "build:ts": "tsc --project tsconfig.build.json",
35
+    "lint": "run-s -n lint:*",
36
+    "lint:prettier": "npm run test:lint:prettier -- --write",
37
+    "lint:ts": "npm run test:lint:ts -- --fix",
38
+    "prebuild": "rm -rf dist",
39
+    "prepublishOnly": "npm run preversion",
40
+    "preversion": "run-s test build",
41
+    "pretest": "run-s build:rollup",
42
+    "test": "run-s -n test:lint test:only",
43
+    "test:debug": "mocha --inspect-brk",
44
+    "test:lint": "run-s -n test:lint:*",
45
+    "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
46
+    "test:lint:ts": "eslint '{src,test}/**/*.ts'",
47
+    "test:only": "mocha",
48
+    "test:coverage": "c8 mocha",
49
+    "test:watch": "mocha --watch"
50
+  },
51
+  "repository": {
52
+    "type": "git",
53
+    "url": "git+https://github.com/jridgewell/sourcemap-codec.git"
54
+  },
55
+  "author": "Rich Harris",
56
+  "license": "MIT",
57
+  "devDependencies": {
58
+    "@rollup/plugin-typescript": "8.3.0",
59
+    "@types/node": "17.0.15",
60
+    "@typescript-eslint/eslint-plugin": "5.10.0",
61
+    "@typescript-eslint/parser": "5.10.0",
62
+    "benchmark": "2.1.4",
63
+    "c8": "7.11.2",
64
+    "eslint": "8.7.0",
65
+    "eslint-config-prettier": "8.3.0",
66
+    "mocha": "9.2.0",
67
+    "npm-run-all": "4.1.5",
68
+    "prettier": "2.5.1",
69
+    "rollup": "2.64.0",
70
+    "source-map": "0.6.1",
71
+    "source-map-js": "1.0.2",
72
+    "sourcemap-codec": "1.4.8",
73
+    "typescript": "4.5.4"
74
+  }
75
+}

+ 198 - 0
node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts

@@ -0,0 +1,198 @@
1
+export type SourceMapSegment =
2
+  | [number]
3
+  | [number, number, number, number]
4
+  | [number, number, number, number, number];
5
+export type SourceMapLine = SourceMapSegment[];
6
+export type SourceMapMappings = SourceMapLine[];
7
+
8
+const comma = ','.charCodeAt(0);
9
+const semicolon = ';'.charCodeAt(0);
10
+const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
11
+const intToChar = new Uint8Array(64); // 64 possible chars.
12
+const charToInt = new Uint8Array(128); // z is 122 in ASCII
13
+
14
+for (let i = 0; i < chars.length; i++) {
15
+  const c = chars.charCodeAt(i);
16
+  intToChar[i] = c;
17
+  charToInt[c] = i;
18
+}
19
+
20
+// Provide a fallback for older environments.
21
+const td =
22
+  typeof TextDecoder !== 'undefined'
23
+    ? /* #__PURE__ */ new TextDecoder()
24
+    : typeof Buffer !== 'undefined'
25
+    ? {
26
+        decode(buf: Uint8Array) {
27
+          const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
28
+          return out.toString();
29
+        },
30
+      }
31
+    : {
32
+        decode(buf: Uint8Array) {
33
+          let out = '';
34
+          for (let i = 0; i < buf.length; i++) {
35
+            out += String.fromCharCode(buf[i]);
36
+          }
37
+          return out;
38
+        },
39
+      };
40
+
41
+export function decode(mappings: string): SourceMapMappings {
42
+  const state: [number, number, number, number, number] = new Int32Array(5) as any;
43
+  const decoded: SourceMapMappings = [];
44
+
45
+  let index = 0;
46
+  do {
47
+    const semi = indexOf(mappings, index);
48
+    const line: SourceMapLine = [];
49
+    let sorted = true;
50
+    let lastCol = 0;
51
+    state[0] = 0;
52
+
53
+    for (let i = index; i < semi; i++) {
54
+      let seg: SourceMapSegment;
55
+
56
+      i = decodeInteger(mappings, i, state, 0); // genColumn
57
+      const col = state[0];
58
+      if (col < lastCol) sorted = false;
59
+      lastCol = col;
60
+
61
+      if (hasMoreVlq(mappings, i, semi)) {
62
+        i = decodeInteger(mappings, i, state, 1); // sourcesIndex
63
+        i = decodeInteger(mappings, i, state, 2); // sourceLine
64
+        i = decodeInteger(mappings, i, state, 3); // sourceColumn
65
+
66
+        if (hasMoreVlq(mappings, i, semi)) {
67
+          i = decodeInteger(mappings, i, state, 4); // namesIndex
68
+          seg = [col, state[1], state[2], state[3], state[4]];
69
+        } else {
70
+          seg = [col, state[1], state[2], state[3]];
71
+        }
72
+      } else {
73
+        seg = [col];
74
+      }
75
+
76
+      line.push(seg);
77
+    }
78
+
79
+    if (!sorted) sort(line);
80
+    decoded.push(line);
81
+    index = semi + 1;
82
+  } while (index <= mappings.length);
83
+
84
+  return decoded;
85
+}
86
+
87
+function indexOf(mappings: string, index: number): number {
88
+  const idx = mappings.indexOf(';', index);
89
+  return idx === -1 ? mappings.length : idx;
90
+}
91
+
92
+function decodeInteger(mappings: string, pos: number, state: SourceMapSegment, j: number): number {
93
+  let value = 0;
94
+  let shift = 0;
95
+  let integer = 0;
96
+
97
+  do {
98
+    const c = mappings.charCodeAt(pos++);
99
+    integer = charToInt[c];
100
+    value |= (integer & 31) << shift;
101
+    shift += 5;
102
+  } while (integer & 32);
103
+
104
+  const shouldNegate = value & 1;
105
+  value >>>= 1;
106
+
107
+  if (shouldNegate) {
108
+    value = -0x80000000 | -value;
109
+  }
110
+
111
+  state[j] += value;
112
+  return pos;
113
+}
114
+
115
+function hasMoreVlq(mappings: string, i: number, length: number): boolean {
116
+  if (i >= length) return false;
117
+  return mappings.charCodeAt(i) !== comma;
118
+}
119
+
120
+function sort(line: SourceMapSegment[]) {
121
+  line.sort(sortComparator);
122
+}
123
+
124
+function sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {
125
+  return a[0] - b[0];
126
+}
127
+
128
+export function encode(decoded: SourceMapMappings): string;
129
+export function encode(decoded: Readonly<SourceMapMappings>): string;
130
+export function encode(decoded: Readonly<SourceMapMappings>): string {
131
+  const state: [number, number, number, number, number] = new Int32Array(5) as any;
132
+  const bufLength = 1024 * 16;
133
+  const subLength = bufLength - 36;
134
+  const buf = new Uint8Array(bufLength);
135
+  const sub = buf.subarray(0, subLength);
136
+  let pos = 0;
137
+  let out = '';
138
+
139
+  for (let i = 0; i < decoded.length; i++) {
140
+    const line = decoded[i];
141
+    if (i > 0) {
142
+      if (pos === bufLength) {
143
+        out += td.decode(buf);
144
+        pos = 0;
145
+      }
146
+      buf[pos++] = semicolon;
147
+    }
148
+    if (line.length === 0) continue;
149
+
150
+    state[0] = 0;
151
+
152
+    for (let j = 0; j < line.length; j++) {
153
+      const segment = line[j];
154
+      // We can push up to 5 ints, each int can take at most 7 chars, and we
155
+      // may push a comma.
156
+      if (pos > subLength) {
157
+        out += td.decode(sub);
158
+        buf.copyWithin(0, subLength, pos);
159
+        pos -= subLength;
160
+      }
161
+      if (j > 0) buf[pos++] = comma;
162
+
163
+      pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
164
+
165
+      if (segment.length === 1) continue;
166
+      pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
167
+      pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
168
+      pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
169
+
170
+      if (segment.length === 4) continue;
171
+      pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
172
+    }
173
+  }
174
+
175
+  return out + td.decode(buf.subarray(0, pos));
176
+}
177
+
178
+function encodeInteger(
179
+  buf: Uint8Array,
180
+  pos: number,
181
+  state: SourceMapSegment,
182
+  segment: SourceMapSegment,
183
+  j: number,
184
+): number {
185
+  const next = segment[j];
186
+  let num = next - state[j];
187
+  state[j] = next;
188
+
189
+  num = num < 0 ? (-num << 1) | 1 : num << 1;
190
+  do {
191
+    let clamped = num & 0b011111;
192
+    num >>>= 5;
193
+    if (num > 0) clamped |= 0b100000;
194
+    buf[pos++] = intToChar[clamped];
195
+  } while (num > 0);
196
+
197
+  return pos;
198
+}

+ 75 - 0
node_modules/@jridgewell/trace-mapping/package.json

@@ -0,0 +1,75 @@
1
+{
2
+  "name": "@jridgewell/trace-mapping",
3
+  "version": "0.3.18",
4
+  "description": "Trace the original position through a source map",
5
+  "keywords": [
6
+    "source",
7
+    "map"
8
+  ],
9
+  "main": "dist/trace-mapping.umd.js",
10
+  "module": "dist/trace-mapping.mjs",
11
+  "types": "dist/types/trace-mapping.d.ts",
12
+  "files": [
13
+    "dist"
14
+  ],
15
+  "exports": {
16
+    ".": [
17
+      {
18
+        "types": "./dist/types/trace-mapping.d.ts",
19
+        "browser": "./dist/trace-mapping.umd.js",
20
+        "require": "./dist/trace-mapping.umd.js",
21
+        "import": "./dist/trace-mapping.mjs"
22
+      },
23
+      "./dist/trace-mapping.umd.js"
24
+    ],
25
+    "./package.json": "./package.json"
26
+  },
27
+  "author": "Justin Ridgewell <justin@ridgewell.name>",
28
+  "repository": {
29
+    "type": "git",
30
+    "url": "git+https://github.com/jridgewell/trace-mapping.git"
31
+  },
32
+  "license": "MIT",
33
+  "scripts": {
34
+    "benchmark": "run-s build:rollup benchmark:*",
35
+    "benchmark:install": "cd benchmark && npm install",
36
+    "benchmark:only": "node --expose-gc benchmark/index.mjs",
37
+    "build": "run-s -n build:*",
38
+    "build:rollup": "rollup -c rollup.config.js",
39
+    "build:ts": "tsc --project tsconfig.build.json",
40
+    "lint": "run-s -n lint:*",
41
+    "lint:prettier": "npm run test:lint:prettier -- --write",
42
+    "lint:ts": "npm run test:lint:ts -- --fix",
43
+    "prebuild": "rm -rf dist",
44
+    "prepublishOnly": "npm run preversion",
45
+    "preversion": "run-s test build",
46
+    "test": "run-s -n test:lint test:only",
47
+    "test:debug": "ava debug",
48
+    "test:lint": "run-s -n test:lint:*",
49
+    "test:lint:prettier": "prettier --check '{src,test}/**/*.ts' '**/*.md'",
50
+    "test:lint:ts": "eslint '{src,test}/**/*.ts'",
51
+    "test:only": "c8 ava",
52
+    "test:watch": "ava --watch"
53
+  },
54
+  "devDependencies": {
55
+    "@rollup/plugin-typescript": "8.5.0",
56
+    "@typescript-eslint/eslint-plugin": "5.39.0",
57
+    "@typescript-eslint/parser": "5.39.0",
58
+    "ava": "4.3.3",
59
+    "benchmark": "2.1.4",
60
+    "c8": "7.12.0",
61
+    "esbuild": "0.15.10",
62
+    "eslint": "8.25.0",
63
+    "eslint-config-prettier": "8.5.0",
64
+    "eslint-plugin-no-only-tests": "3.0.0",
65
+    "npm-run-all": "4.1.5",
66
+    "prettier": "2.7.1",
67
+    "rollup": "2.79.1",
68
+    "tsx": "3.10.1",
69
+    "typescript": "4.8.4"
70
+  },
71
+  "dependencies": {
72
+    "@jridgewell/resolve-uri": "3.1.0",
73
+    "@jridgewell/sourcemap-codec": "1.4.14"
74
+  }
75
+}

+ 21 - 0
node_modules/@nodelib/fs.scandir/LICENSE

@@ -0,0 +1,21 @@
1
+The MIT License (MIT)
2
+
3
+Copyright (c) Denis Malinochkin
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+SOFTWARE.

+ 171 - 0
node_modules/@nodelib/fs.scandir/README.md

@@ -0,0 +1,171 @@
1
+# @nodelib/fs.scandir
2
+
3
+> List files and directories inside the specified directory.
4
+
5
+## :bulb: Highlights
6
+
7
+The package is aimed at obtaining information about entries in the directory.
8
+
9
+* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional).
10
+* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode).
11
+* :link: Can safely work with broken symbolic links.
12
+
13
+## Install
14
+
15
+```console
16
+npm install @nodelib/fs.scandir
17
+```
18
+
19
+## Usage
20
+
21
+```ts
22
+import * as fsScandir from '@nodelib/fs.scandir';
23
+
24
+fsScandir.scandir('path', (error, stats) => { /* … */ });
25
+```
26
+
27
+## API
28
+
29
+### .scandir(path, [optionsOrSettings], callback)
30
+
31
+Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style.
32
+
33
+```ts
34
+fsScandir.scandir('path', (error, entries) => { /* … */ });
35
+fsScandir.scandir('path', {}, (error, entries) => { /* … */ });
36
+fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ });
37
+```
38
+
39
+### .scandirSync(path, [optionsOrSettings])
40
+
41
+Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path.
42
+
43
+```ts
44
+const entries = fsScandir.scandirSync('path');
45
+const entries = fsScandir.scandirSync('path', {});
46
+const entries = fsScandir.scandirSync(('path', new fsScandir.Settings());
47
+```
48
+
49
+#### path
50
+
51
+* Required: `true`
52
+* Type: `string | Buffer | URL`
53
+
54
+A path to a file. If a URL is provided, it must use the `file:` protocol.
55
+
56
+#### optionsOrSettings
57
+
58
+* Required: `false`
59
+* Type: `Options | Settings`
60
+* Default: An instance of `Settings` class
61
+
62
+An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class.
63
+
64
+> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
65
+
66
+### Settings([options])
67
+
68
+A class of full settings of the package.
69
+
70
+```ts
71
+const settings = new fsScandir.Settings({ followSymbolicLinks: false });
72
+
73
+const entries = fsScandir.scandirSync('path', settings);
74
+```
75
+
76
+## Entry
77
+
78
+* `name` — The name of the entry (`unknown.txt`).
79
+* `path` — The path of the entry relative to call directory (`root/unknown.txt`).
80
+* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class.
81
+* `stats` (optional) — An instance of `fs.Stats` class.
82
+
83
+For example, the `scandir` call for `tools` directory with one directory inside:
84
+
85
+```ts
86
+{
87
+	dirent: Dirent { name: 'typedoc', /* … */ },
88
+	name: 'typedoc',
89
+	path: 'tools/typedoc'
90
+}
91
+```
92
+
93
+## Options
94
+
95
+### stats
96
+
97
+* Type: `boolean`
98
+* Default: `false`
99
+
100
+Adds an instance of `fs.Stats` class to the [`Entry`](#entry).
101
+
102
+> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO??
103
+
104
+### followSymbolicLinks
105
+
106
+* Type: `boolean`
107
+* Default: `false`
108
+
109
+Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`.
110
+
111
+### `throwErrorOnBrokenSymbolicLink`
112
+
113
+* Type: `boolean`
114
+* Default: `true`
115
+
116
+Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`.
117
+
118
+### `pathSegmentSeparator`
119
+
120
+* Type: `string`
121
+* Default: `path.sep`
122
+
123
+By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead.
124
+
125
+### `fs`
126
+
127
+* Type: [`FileSystemAdapter`](./src/adapters/fs.ts)
128
+* Default: A default FS methods
129
+
130
+By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
131
+
132
+```ts
133
+interface FileSystemAdapter {
134
+	lstat?: typeof fs.lstat;
135
+	stat?: typeof fs.stat;
136
+	lstatSync?: typeof fs.lstatSync;
137
+	statSync?: typeof fs.statSync;
138
+	readdir?: typeof fs.readdir;
139
+	readdirSync?: typeof fs.readdirSync;
140
+}
141
+
142
+const settings = new fsScandir.Settings({
143
+	fs: { lstat: fakeLstat }
144
+});
145
+```
146
+
147
+## `old` and `modern` mode
148
+
149
+This package has two modes that are used depending on the environment and parameters of use.
150
+
151
+### old
152
+
153
+* Node.js below `10.10` or when the `stats` option is enabled
154
+
155
+When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links).
156
+
157
+### modern
158
+
159
+* Node.js 10.10+ and the `stats` option is disabled
160
+
161
+In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present.
162
+
163
+This mode makes fewer calls to the file system. It's faster.
164
+
165
+## Changelog
166
+
167
+See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
168
+
169
+## License
170
+
171
+This software is released under the terms of the MIT license.

+ 20 - 0
node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts

@@ -0,0 +1,20 @@
1
+import type * as fsStat from '@nodelib/fs.stat';
2
+import type { Dirent, ErrnoException } from '../types';
3
+export interface ReaddirAsynchronousMethod {
4
+    (filepath: string, options: {
5
+        withFileTypes: true;
6
+    }, callback: (error: ErrnoException | null, files: Dirent[]) => void): void;
7
+    (filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void;
8
+}
9
+export interface ReaddirSynchronousMethod {
10
+    (filepath: string, options: {
11
+        withFileTypes: true;
12
+    }): Dirent[];
13
+    (filepath: string): string[];
14
+}
15
+export declare type FileSystemAdapter = fsStat.FileSystemAdapter & {
16
+    readdir: ReaddirAsynchronousMethod;
17
+    readdirSync: ReaddirSynchronousMethod;
18
+};
19
+export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
20
+export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;

+ 19 - 0
node_modules/@nodelib/fs.scandir/out/adapters/fs.js

@@ -0,0 +1,19 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
4
+const fs = require("fs");
5
+exports.FILE_SYSTEM_ADAPTER = {
6
+    lstat: fs.lstat,
7
+    stat: fs.stat,
8
+    lstatSync: fs.lstatSync,
9
+    statSync: fs.statSync,
10
+    readdir: fs.readdir,
11
+    readdirSync: fs.readdirSync
12
+};
13
+function createFileSystemAdapter(fsMethods) {
14
+    if (fsMethods === undefined) {
15
+        return exports.FILE_SYSTEM_ADAPTER;
16
+    }
17
+    return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
18
+}
19
+exports.createFileSystemAdapter = createFileSystemAdapter;

+ 4 - 0
node_modules/@nodelib/fs.scandir/out/constants.d.ts

@@ -0,0 +1,4 @@
1
+/**
2
+ * IS `true` for Node.js 10.10 and greater.
3
+ */
4
+export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean;

+ 0 - 0
node_modules/@nodelib/fs.scandir/out/constants.js


Некоторые файлы не были показаны из-за большого количества измененных файлов

tum/whitesports - Gogs: Simplico Git Service

No Description

comment-template.php 94KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749
  1. <?php
  2. /**
  3. * Comment template functions
  4. *
  5. * These functions are meant to live inside of the WordPress loop.
  6. *
  7. * @package WordPress
  8. * @subpackage Template
  9. */
  10. /**
  11. * Retrieves the author of the current comment.
  12. *
  13. * If the comment has an empty comment_author field, then 'Anonymous' person is
  14. * assumed.
  15. *
  16. * @since 1.5.0
  17. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  18. *
  19. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to retrieve the author.
  20. * Default current comment.
  21. * @return string The comment author
  22. */
  23. function get_comment_author( $comment_ID = 0 ) {
  24. $comment = get_comment( $comment_ID );
  25. $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_ID;
  26. if ( empty( $comment->comment_author ) ) {
  27. $user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false;
  28. if ( $user ) {
  29. $author = $user->display_name;
  30. } else {
  31. $author = __( 'Anonymous' );
  32. }
  33. } else {
  34. $author = $comment->comment_author;
  35. }
  36. /**
  37. * Filters the returned comment author name.
  38. *
  39. * @since 1.5.0
  40. * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
  41. *
  42. * @param string $author The comment author's username.
  43. * @param string $comment_ID The comment ID as a numeric string.
  44. * @param WP_Comment $comment The comment object.
  45. */
  46. return apply_filters( 'get_comment_author', $author, $comment_ID, $comment );
  47. }
  48. /**
  49. * Displays the author of the current comment.
  50. *
  51. * @since 0.71
  52. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  53. *
  54. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author.
  55. * Default current comment.
  56. */
  57. function comment_author( $comment_ID = 0 ) {
  58. $comment = get_comment( $comment_ID );
  59. $author = get_comment_author( $comment );
  60. /**
  61. * Filters the comment author's name for display.
  62. *
  63. * @since 1.2.0
  64. * @since 4.1.0 The `$comment_ID` parameter was added.
  65. *
  66. * @param string $author The comment author's username.
  67. * @param string $comment_ID The comment ID as a numeric string.
  68. */
  69. echo apply_filters( 'comment_author', $author, $comment->comment_ID );
  70. }
  71. /**
  72. * Retrieves the email of the author of the current comment.
  73. *
  74. * @since 1.5.0
  75. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  76. *
  77. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's email.
  78. * Default current comment.
  79. * @return string The current comment author's email
  80. */
  81. function get_comment_author_email( $comment_ID = 0 ) {
  82. $comment = get_comment( $comment_ID );
  83. /**
  84. * Filters the comment author's returned email address.
  85. *
  86. * @since 1.5.0
  87. * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
  88. *
  89. * @param string $comment_author_email The comment author's email address.
  90. * @param string $comment_ID The comment ID as a numeric string.
  91. * @param WP_Comment $comment The comment object.
  92. */
  93. return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment );
  94. }
  95. /**
  96. * Displays the email of the author of the current global $comment.
  97. *
  98. * Care should be taken to protect the email address and assure that email
  99. * harvesters do not capture your commenter's email address. Most assume that
  100. * their email address will not appear in raw form on the site. Doing so will
  101. * enable anyone, including those that people don't want to get the email
  102. * address and use it for their own means good and bad.
  103. *
  104. * @since 0.71
  105. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  106. *
  107. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's email.
  108. * Default current comment.
  109. */
  110. function comment_author_email( $comment_ID = 0 ) {
  111. $comment = get_comment( $comment_ID );
  112. $author_email = get_comment_author_email( $comment );
  113. /**
  114. * Filters the comment author's email for display.
  115. *
  116. * @since 1.2.0
  117. * @since 4.1.0 The `$comment_ID` parameter was added.
  118. *
  119. * @param string $author_email The comment author's email address.
  120. * @param string $comment_ID The comment ID as a numeric string.
  121. */
  122. echo apply_filters( 'author_email', $author_email, $comment->comment_ID );
  123. }
  124. /**
  125. * Displays the HTML email link to the author of the current comment.
  126. *
  127. * Care should be taken to protect the email address and assure that email
  128. * harvesters do not capture your commenter's email address. Most assume that
  129. * their email address will not appear in raw form on the site. Doing so will
  130. * enable anyone, including those that people don't want to get the email
  131. * address and use it for their own means good and bad.
  132. *
  133. * @since 0.71
  134. * @since 4.6.0 Added the `$comment` parameter.
  135. *
  136. * @param string $linktext Optional. Text to display instead of the comment author's email address.
  137. * Default empty.
  138. * @param string $before Optional. Text or HTML to display before the email link. Default empty.
  139. * @param string $after Optional. Text or HTML to display after the email link. Default empty.
  140. * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object. Default is the current comment.
  141. */
  142. function comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null ) {
  143. $link = get_comment_author_email_link( $linktext, $before, $after, $comment );
  144. if ( $link ) {
  145. echo $link;
  146. }
  147. }
  148. /**
  149. * Returns the HTML email link to the author of the current comment.
  150. *
  151. * Care should be taken to protect the email address and assure that email
  152. * harvesters do not capture your commenter's email address. Most assume that
  153. * their email address will not appear in raw form on the site. Doing so will
  154. * enable anyone, including those that people don't want to get the email
  155. * address and use it for their own means good and bad.
  156. *
  157. * @since 2.7.0
  158. * @since 4.6.0 Added the `$comment` parameter.
  159. *
  160. * @param string $linktext Optional. Text to display instead of the comment author's email address.
  161. * Default empty.
  162. * @param string $before Optional. Text or HTML to display before the email link. Default empty.
  163. * @param string $after Optional. Text or HTML to display after the email link. Default empty.
  164. * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object. Default is the current comment.
  165. * @return string HTML markup for the comment author email link. By default, the email address is obfuscated
  166. * via the {@see 'comment_email'} filter with antispambot().
  167. */
  168. function get_comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null ) {
  169. $comment = get_comment( $comment );
  170. /**
  171. * Filters the comment author's email for display.
  172. *
  173. * Care should be taken to protect the email address and assure that email
  174. * harvesters do not capture your commenter's email address.
  175. *
  176. * @since 1.2.0
  177. * @since 4.1.0 The `$comment` parameter was added.
  178. *
  179. * @param string $comment_author_email The comment author's email address.
  180. * @param WP_Comment $comment The comment object.
  181. */
  182. $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );
  183. if ( ( ! empty( $email ) ) && ( '@' !== $email ) ) {
  184. $display = ( '' !== $linktext ) ? $linktext : $email;
  185. $return = $before;
  186. $return .= sprintf( '<a href="%1$s">%2$s</a>', esc_url( 'mailto:' . $email ), esc_html( $display ) );
  187. $return .= $after;
  188. return $return;
  189. } else {
  190. return '';
  191. }
  192. }
  193. /**
  194. * Retrieves the HTML link to the URL of the author of the current comment.
  195. *
  196. * Both get_comment_author_url() and get_comment_author() rely on get_comment(),
  197. * which falls back to the global comment variable if the $comment_ID argument is empty.
  198. *
  199. * @since 1.5.0
  200. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  201. *
  202. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's link.
  203. * Default current comment.
  204. * @return string The comment author name or HTML link for author's URL.
  205. */
  206. function get_comment_author_link( $comment_ID = 0 ) {
  207. $comment = get_comment( $comment_ID );
  208. $url = get_comment_author_url( $comment );
  209. $author = get_comment_author( $comment );
  210. if ( empty( $url ) || 'http://' === $url ) {
  211. $return = $author;
  212. } else {
  213. $return = "<a href='$url' rel='external nofollow ugc' class='url'>$author</a>";
  214. }
  215. /**
  216. * Filters the comment author's link for display.
  217. *
  218. * @since 1.5.0
  219. * @since 4.1.0 The `$author` and `$comment_ID` parameters were added.
  220. *
  221. * @param string $return The HTML-formatted comment author link.
  222. * Empty for an invalid URL.
  223. * @param string $author The comment author's username.
  224. * @param string $comment_ID The comment ID as a numeric string.
  225. */
  226. return apply_filters( 'get_comment_author_link', $return, $author, $comment->comment_ID );
  227. }
  228. /**
  229. * Displays the HTML link to the URL of the author of the current comment.
  230. *
  231. * @since 0.71
  232. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  233. *
  234. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's link.
  235. * Default current comment.
  236. */
  237. function comment_author_link( $comment_ID = 0 ) {
  238. echo get_comment_author_link( $comment_ID );
  239. }
  240. /**
  241. * Retrieves the IP address of the author of the current comment.
  242. *
  243. * @since 1.5.0
  244. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  245. *
  246. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's IP address.
  247. * Default current comment.
  248. * @return string Comment author's IP address, or an empty string if it's not available.
  249. */
  250. function get_comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
  251. $comment = get_comment( $comment_ID );
  252. /**
  253. * Filters the comment author's returned IP address.
  254. *
  255. * @since 1.5.0
  256. * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
  257. *
  258. * @param string $comment_author_IP The comment author's IP address, or an empty string if it's not available.
  259. * @param string $comment_ID The comment ID as a numeric string.
  260. * @param WP_Comment $comment The comment object.
  261. */
  262. return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
  263. }
  264. /**
  265. * Displays the IP address of the author of the current comment.
  266. *
  267. * @since 0.71
  268. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  269. *
  270. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's IP address.
  271. * Default current comment.
  272. */
  273. function comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
  274. echo esc_html( get_comment_author_IP( $comment_ID ) );
  275. }
  276. /**
  277. * Retrieves the URL of the author of the current comment, not linked.
  278. *
  279. * @since 1.5.0
  280. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  281. *
  282. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's URL.
  283. * Default current comment.
  284. * @return string Comment author URL, if provided, an empty string otherwise.
  285. */
  286. function get_comment_author_url( $comment_ID = 0 ) {
  287. $comment = get_comment( $comment_ID );
  288. $url = '';
  289. $id = 0;
  290. if ( ! empty( $comment ) ) {
  291. $author_url = ( 'http://' === $comment->comment_author_url ) ? '' : $comment->comment_author_url;
  292. $url = esc_url( $author_url, array( 'http', 'https' ) );
  293. $id = $comment->comment_ID;
  294. }
  295. /**
  296. * Filters the comment author's URL.
  297. *
  298. * @since 1.5.0
  299. * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
  300. *
  301. * @param string $url The comment author's URL, or an empty string.
  302. * @param string|int $comment_ID The comment ID as a numeric string, or 0 if not found.
  303. * @param WP_Comment|null $comment The comment object, or null if not found.
  304. */
  305. return apply_filters( 'get_comment_author_url', $url, $id, $comment );
  306. }
  307. /**
  308. * Displays the URL of the author of the current comment, not linked.
  309. *
  310. * @since 0.71
  311. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  312. *
  313. * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's URL.
  314. * Default current comment.
  315. */
  316. function comment_author_url( $comment_ID = 0 ) {
  317. $comment = get_comment( $comment_ID );
  318. $author_url = get_comment_author_url( $comment );
  319. /**
  320. * Filters the comment author's URL for display.
  321. *
  322. * @since 1.2.0
  323. * @since 4.1.0 The `$comment_ID` parameter was added.
  324. *
  325. * @param string $author_url The comment author's URL.
  326. * @param string $comment_ID The comment ID as a numeric string.
  327. */
  328. echo apply_filters( 'comment_url', $author_url, $comment->comment_ID );
  329. }
  330. /**
  331. * Retrieves the HTML link of the URL of the author of the current comment.
  332. *
  333. * $linktext parameter is only used if the URL does not exist for the comment
  334. * author. If the URL does exist then the URL will be used and the $linktext
  335. * will be ignored.
  336. *
  337. * Encapsulate the HTML link between the $before and $after. So it will appear
  338. * in the order of $before, link, and finally $after.
  339. *
  340. * @since 1.5.0
  341. * @since 4.6.0 Added the `$comment` parameter.
  342. *
  343. * @param string $linktext Optional. The text to display instead of the comment
  344. * author's email address. Default empty.
  345. * @param string $before Optional. The text or HTML to display before the email link.
  346. * Default empty.
  347. * @param string $after Optional. The text or HTML to display after the email link.
  348. * Default empty.
  349. * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object.
  350. * Default is the current comment.
  351. * @return string The HTML link between the $before and $after parameters.
  352. */
  353. function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) {
  354. $url = get_comment_author_url( $comment );
  355. $display = ( '' !== $linktext ) ? $linktext : $url;
  356. $display = str_replace( 'http://www.', '', $display );
  357. $display = str_replace( 'http://', '', $display );
  358. if ( '/' === substr( $display, -1 ) ) {
  359. $display = substr( $display, 0, -1 );
  360. }
  361. $return = "$before<a href='$url' rel='external'>$display</a>$after";
  362. /**
  363. * Filters the comment author's returned URL link.
  364. *
  365. * @since 1.5.0
  366. *
  367. * @param string $return The HTML-formatted comment author URL link.
  368. */
  369. return apply_filters( 'get_comment_author_url_link', $return );
  370. }
  371. /**
  372. * Displays the HTML link of the URL of the author of the current comment.
  373. *
  374. * @since 0.71
  375. * @since 4.6.0 Added the `$comment` parameter.
  376. *
  377. * @param string $linktext Optional. Text to display instead of the comment author's
  378. * email address. Default empty.
  379. * @param string $before Optional. Text or HTML to display before the email link.
  380. * Default empty.
  381. * @param string $after Optional. Text or HTML to display after the email link.
  382. * Default empty.
  383. * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object.
  384. * Default is the current comment.
  385. */
  386. function comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) {
  387. echo get_comment_author_url_link( $linktext, $before, $after, $comment );
  388. }
  389. /**
  390. * Generates semantic classes for each comment element.
  391. *
  392. * @since 2.7.0
  393. * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
  394. *
  395. * @param string|string[] $css_class Optional. One or more classes to add to the class list.
  396. * Default empty.
  397. * @param int|WP_Comment $comment Comment ID or WP_Comment object. Default current comment.
  398. * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post.
  399. * @param bool $display Optional. Whether to print or return the output.
  400. * Default true.
  401. * @return void|string Void if `$display` argument is true, comment classes if `$display` is false.
  402. */
  403. function comment_class( $css_class = '', $comment = null, $post_id = null, $display = true ) {
  404. // Separates classes with a single space, collates classes for comment DIV.
  405. $css_class = 'class="' . implode( ' ', get_comment_class( $css_class, $comment, $post_id ) ) . '"';
  406. if ( $display ) {
  407. echo $css_class;
  408. } else {
  409. return $css_class;
  410. }
  411. }
  412. /**
  413. * Returns the classes for the comment div as an array.
  414. *
  415. * @since 2.7.0
  416. * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
  417. *
  418. * @global int $comment_alt
  419. * @global int $comment_depth
  420. * @global int $comment_thread_alt
  421. *
  422. * @param string|string[] $css_class Optional. One or more classes to add to the class list. Default empty.
  423. * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. Default current comment.
  424. * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post.
  425. * @return string[] An array of classes.
  426. */
  427. function get_comment_class( $css_class = '', $comment_id = null, $post_id = null ) {
  428. global $comment_alt, $comment_depth, $comment_thread_alt;
  429. $classes = array();
  430. $comment = get_comment( $comment_id );
  431. if ( ! $comment ) {
  432. return $classes;
  433. }
  434. // Get the comment type (comment, trackback).
  435. $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
  436. // Add classes for comment authors that are registered users.
  437. $user = $comment->user_id ? get_userdata( $comment->user_id ) : false;
  438. if ( $user ) {
  439. $classes[] = 'byuser';
  440. $classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id );
  441. // For comment authors who are the author of the post.
  442. $post = get_post( $post_id );
  443. if ( $post ) {
  444. if ( $comment->user_id === $post->post_author ) {
  445. $classes[] = 'bypostauthor';
  446. }
  447. }
  448. }
  449. if ( empty( $comment_alt ) ) {
  450. $comment_alt = 0;
  451. }
  452. if ( empty( $comment_depth ) ) {
  453. $comment_depth = 1;
  454. }
  455. if ( empty( $comment_thread_alt ) ) {
  456. $comment_thread_alt = 0;
  457. }
  458. if ( $comment_alt % 2 ) {
  459. $classes[] = 'odd';
  460. $classes[] = 'alt';
  461. } else {
  462. $classes[] = 'even';
  463. }
  464. $comment_alt++;
  465. // Alt for top-level comments.
  466. if ( 1 == $comment_depth ) {
  467. if ( $comment_thread_alt % 2 ) {
  468. $classes[] = 'thread-odd';
  469. $classes[] = 'thread-alt';
  470. } else {
  471. $classes[] = 'thread-even';
  472. }
  473. $comment_thread_alt++;
  474. }
  475. $classes[] = "depth-$comment_depth";
  476. if ( ! empty( $css_class ) ) {
  477. if ( ! is_array( $css_class ) ) {
  478. $css_class = preg_split( '#\s+#', $css_class );
  479. }
  480. $classes = array_merge( $classes, $css_class );
  481. }
  482. $classes = array_map( 'esc_attr', $classes );
  483. /**
  484. * Filters the returned CSS classes for the current comment.
  485. *
  486. * @since 2.7.0
  487. *
  488. * @param string[] $classes An array of comment classes.
  489. * @param string[] $css_class An array of additional classes added to the list.
  490. * @param string $comment_id The comment ID as a numeric string.
  491. * @param WP_Comment $comment The comment object.
  492. * @param int|WP_Post $post_id The post ID or WP_Post object.
  493. */
  494. return apply_filters( 'comment_class', $classes, $css_class, $comment->comment_ID, $comment, $post_id );
  495. }
  496. /**
  497. * Retrieves the comment date of the current comment.
  498. *
  499. * @since 1.5.0
  500. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  501. *
  502. * @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
  503. * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date.
  504. * Default current comment.
  505. * @return string The comment's date.
  506. */
  507. function get_comment_date( $format = '', $comment_ID = 0 ) {
  508. $comment = get_comment( $comment_ID );
  509. $_format = ! empty( $format ) ? $format : get_option( 'date_format' );
  510. $date = mysql2date( $_format, $comment->comment_date );
  511. /**
  512. * Filters the returned comment date.
  513. *
  514. * @since 1.5.0
  515. *
  516. * @param string|int $date Formatted date string or Unix timestamp.
  517. * @param string $format PHP date format.
  518. * @param WP_Comment $comment The comment object.
  519. */
  520. return apply_filters( 'get_comment_date', $date, $format, $comment );
  521. }
  522. /**
  523. * Displays the comment date of the current comment.
  524. *
  525. * @since 0.71
  526. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  527. *
  528. * @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
  529. * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the date.
  530. * Default current comment.
  531. */
  532. function comment_date( $format = '', $comment_ID = 0 ) {
  533. echo get_comment_date( $format, $comment_ID );
  534. }
  535. /**
  536. * Retrieves the excerpt of the given comment.
  537. *
  538. * Returns a maximum of 20 words with an ellipsis appended if necessary.
  539. *
  540. * @since 1.5.0
  541. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  542. *
  543. * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the excerpt.
  544. * Default current comment.
  545. * @return string The possibly truncated comment excerpt.
  546. */
  547. function get_comment_excerpt( $comment_ID = 0 ) {
  548. $comment = get_comment( $comment_ID );
  549. if ( ! post_password_required( $comment->comment_post_ID ) ) {
  550. $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) );
  551. } else {
  552. $comment_text = __( 'Password protected' );
  553. }
  554. /* translators: Maximum number of words used in a comment excerpt. */
  555. $comment_excerpt_length = (int) _x( '20', 'comment_excerpt_length' );
  556. /**
  557. * Filters the maximum number of words used in the comment excerpt.
  558. *
  559. * @since 4.4.0
  560. *
  561. * @param int $comment_excerpt_length The amount of words you want to display in the comment excerpt.
  562. */
  563. $comment_excerpt_length = apply_filters( 'comment_excerpt_length', $comment_excerpt_length );
  564. $excerpt = wp_trim_words( $comment_text, $comment_excerpt_length, '&hellip;' );
  565. /**
  566. * Filters the retrieved comment excerpt.
  567. *
  568. * @since 1.5.0
  569. * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
  570. *
  571. * @param string $excerpt The comment excerpt text.
  572. * @param string $comment_ID The comment ID as a numeric string.
  573. * @param WP_Comment $comment The comment object.
  574. */
  575. return apply_filters( 'get_comment_excerpt', $excerpt, $comment->comment_ID, $comment );
  576. }
  577. /**
  578. * Displays the excerpt of the current comment.
  579. *
  580. * @since 1.2.0
  581. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  582. *
  583. * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the excerpt.
  584. * Default current comment.
  585. */
  586. function comment_excerpt( $comment_ID = 0 ) {
  587. $comment = get_comment( $comment_ID );
  588. $comment_excerpt = get_comment_excerpt( $comment );
  589. /**
  590. * Filters the comment excerpt for display.
  591. *
  592. * @since 1.2.0
  593. * @since 4.1.0 The `$comment_ID` parameter was added.
  594. *
  595. * @param string $comment_excerpt The comment excerpt text.
  596. * @param string $comment_ID The comment ID as a numeric string.
  597. */
  598. echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );
  599. }
  600. /**
  601. * Retrieves the comment ID of the current comment.
  602. *
  603. * @since 1.5.0
  604. *
  605. * @return string The comment ID as a numeric string.
  606. */
  607. function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
  608. $comment = get_comment();
  609. $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0';
  610. /**
  611. * Filters the returned comment ID.
  612. *
  613. * @since 1.5.0
  614. * @since 4.1.0 The `$comment` parameter was added.
  615. *
  616. * @param string $comment_ID The current comment ID as a numeric string.
  617. * @param WP_Comment $comment The comment object.
  618. */
  619. return apply_filters( 'get_comment_ID', $comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
  620. }
  621. /**
  622. * Displays the comment ID of the current comment.
  623. *
  624. * @since 0.71
  625. */
  626. function comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
  627. echo get_comment_ID();
  628. }
  629. /**
  630. * Retrieves the link to a given comment.
  631. *
  632. * @since 1.5.0
  633. * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object. Added `$cpage` argument.
  634. *
  635. * @see get_page_of_comment()
  636. *
  637. * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
  638. * @global bool $in_comment_loop
  639. *
  640. * @param WP_Comment|int|null $comment Comment to retrieve. Default current comment.
  641. * @param array $args {
  642. * An array of optional arguments to override the defaults.
  643. *
  644. * @type string $type Passed to get_page_of_comment().
  645. * @type int $page Current page of comments, for calculating comment pagination.
  646. * @type int $per_page Per-page value for comment pagination.
  647. * @type int $max_depth Passed to get_page_of_comment().
  648. * @type int|string $cpage Value to use for the comment's "comment-page" or "cpage" value.
  649. * If provided, this value overrides any value calculated from `$page`
  650. * and `$per_page`.
  651. * }
  652. * @return string The permalink to the given comment.
  653. */
  654. function get_comment_link( $comment = null, $args = array() ) {
  655. global $wp_rewrite, $in_comment_loop;
  656. $comment = get_comment( $comment );
  657. // Back-compat.
  658. if ( ! is_array( $args ) ) {
  659. $args = array( 'page' => $args );
  660. }
  661. $defaults = array(
  662. 'type' => 'all',
  663. 'page' => '',
  664. 'per_page' => '',
  665. 'max_depth' => '',
  666. 'cpage' => null,
  667. );
  668. $args = wp_parse_args( $args, $defaults );
  669. $link = get_permalink( $comment->comment_post_ID );
  670. // The 'cpage' param takes precedence.
  671. if ( ! is_null( $args['cpage'] ) ) {
  672. $cpage = $args['cpage'];
  673. // No 'cpage' is provided, so we calculate one.
  674. } else {
  675. if ( '' === $args['per_page'] && get_option( 'page_comments' ) ) {
  676. $args['per_page'] = get_option( 'comments_per_page' );
  677. }
  678. if ( empty( $args['per_page'] ) ) {
  679. $args['per_page'] = 0;
  680. $args['page'] = 0;
  681. }
  682. $cpage = $args['page'];
  683. if ( '' == $cpage ) {
  684. if ( ! empty( $in_comment_loop ) ) {
  685. $cpage = get_query_var( 'cpage' );
  686. } else {
  687. // Requires a database hit, so we only do it when we can't figure out from context.
  688. $cpage = get_page_of_comment( $comment->comment_ID, $args );
  689. }
  690. }
  691. /*
  692. * If the default page displays the oldest comments, the permalinks for comments on the default page
  693. * do not need a 'cpage' query var.
  694. */
  695. if ( 'oldest' === get_option( 'default_comments_page' ) && 1 === $cpage ) {
  696. $cpage = '';
  697. }
  698. }
  699. if ( $cpage && get_option( 'page_comments' ) ) {
  700. if ( $wp_rewrite->using_permalinks() ) {
  701. if ( $cpage ) {
  702. $link = trailingslashit( $link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage;
  703. }
  704. $link = user_trailingslashit( $link, 'comment' );
  705. } elseif ( $cpage ) {
  706. $link = add_query_arg( 'cpage', $cpage, $link );
  707. }
  708. }
  709. if ( $wp_rewrite->using_permalinks() ) {
  710. $link = user_trailingslashit( $link, 'comment' );
  711. }
  712. $link = $link . '#comment-' . $comment->comment_ID;
  713. /**
  714. * Filters the returned single comment permalink.
  715. *
  716. * @since 2.8.0
  717. * @since 4.4.0 Added the `$cpage` parameter.
  718. *
  719. * @see get_page_of_comment()
  720. *
  721. * @param string $link The comment permalink with '#comment-$id' appended.
  722. * @param WP_Comment $comment The current comment object.
  723. * @param array $args An array of arguments to override the defaults.
  724. * @param int $cpage The calculated 'cpage' value.
  725. */
  726. return apply_filters( 'get_comment_link', $link, $comment, $args, $cpage );
  727. }
  728. /**
  729. * Retrieves the link to the current post comments.
  730. *
  731. * @since 1.5.0
  732. *
  733. * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
  734. * @return string The link to the comments.
  735. */
  736. function get_comments_link( $post_id = 0 ) {
  737. $hash = get_comments_number( $post_id ) ? '#comments' : '#respond';
  738. $comments_link = get_permalink( $post_id ) . $hash;
  739. /**
  740. * Filters the returned post comments permalink.
  741. *
  742. * @since 3.6.0
  743. *
  744. * @param string $comments_link Post comments permalink with '#comments' appended.
  745. * @param int|WP_Post $post_id Post ID or WP_Post object.
  746. */
  747. return apply_filters( 'get_comments_link', $comments_link, $post_id );
  748. }
  749. /**
  750. * Displays the link to the current post comments.
  751. *
  752. * @since 0.71
  753. *
  754. * @param string $deprecated Not Used.
  755. * @param string $deprecated_2 Not Used.
  756. */
  757. function comments_link( $deprecated = '', $deprecated_2 = '' ) {
  758. if ( ! empty( $deprecated ) ) {
  759. _deprecated_argument( __FUNCTION__, '0.72' );
  760. }
  761. if ( ! empty( $deprecated_2 ) ) {
  762. _deprecated_argument( __FUNCTION__, '1.3.0' );
  763. }
  764. echo esc_url( get_comments_link() );
  765. }
  766. /**
  767. * Retrieves the amount of comments a post has.
  768. *
  769. * @since 1.5.0
  770. *
  771. * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`.
  772. * @return string|int If the post exists, a numeric string representing the number of comments
  773. * the post has, otherwise 0.
  774. */
  775. function get_comments_number( $post_id = 0 ) {
  776. $post = get_post( $post_id );
  777. if ( ! $post ) {
  778. $count = 0;
  779. } else {
  780. $count = $post->comment_count;
  781. $post_id = $post->ID;
  782. }
  783. /**
  784. * Filters the returned comment count for a post.
  785. *
  786. * @since 1.5.0
  787. *
  788. * @param string|int $count A string representing the number of comments a post has, otherwise 0.
  789. * @param int $post_id Post ID.
  790. */
  791. return apply_filters( 'get_comments_number', $count, $post_id );
  792. }
  793. /**
  794. * Displays the language string for the number of comments the current post has.
  795. *
  796. * @since 0.71
  797. * @since 5.4.0 The `$deprecated` parameter was changed to `$post_id`.
  798. *
  799. * @param string|false $zero Optional. Text for no comments. Default false.
  800. * @param string|false $one Optional. Text for one comment. Default false.
  801. * @param string|false $more Optional. Text for more than one comment. Default false.
  802. * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`.
  803. */
  804. function comments_number( $zero = false, $one = false, $more = false, $post_id = 0 ) {
  805. echo get_comments_number_text( $zero, $one, $more, $post_id );
  806. }
  807. /**
  808. * Displays the language string for the number of comments the current post has.
  809. *
  810. * @since 4.0.0
  811. * @since 5.4.0 Added the `$post_id` parameter to allow using the function outside of the loop.
  812. *
  813. * @param string $zero Optional. Text for no comments. Default false.
  814. * @param string $one Optional. Text for one comment. Default false.
  815. * @param string $more Optional. Text for more than one comment. Default false.
  816. * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`.
  817. * @return string Language string for the number of comments a post has.
  818. */
  819. function get_comments_number_text( $zero = false, $one = false, $more = false, $post_id = 0 ) {
  820. $number = get_comments_number( $post_id );
  821. if ( $number > 1 ) {
  822. if ( false === $more ) {
  823. /* translators: %s: Number of comments. */
  824. $output = sprintf( _n( '%s Comment', '%s Comments', $number ), number_format_i18n( $number ) );
  825. } else {
  826. // % Comments
  827. /*
  828. * translators: If comment number in your language requires declension,
  829. * translate this to 'on'. Do not translate into your own language.
  830. */
  831. if ( 'on' === _x( 'off', 'Comment number declension: on or off' ) ) {
  832. $text = preg_replace( '#<span class="screen-reader-text">.+?</span>#', '', $more );
  833. $text = preg_replace( '/&.+?;/', '', $text ); // Kill entities.
  834. $text = trim( strip_tags( $text ), '% ' );
  835. // Replace '% Comments' with a proper plural form.
  836. if ( $text && ! preg_match( '/[0-9]+/', $text ) && false !== strpos( $more, '%' ) ) {
  837. /* translators: %s: Number of comments. */
  838. $new_text = _n( '%s Comment', '%s Comments', $number );
  839. $new_text = trim( sprintf( $new_text, '' ) );
  840. $more = str_replace( $text, $new_text, $more );
  841. if ( false === strpos( $more, '%' ) ) {
  842. $more = '% ' . $more;
  843. }
  844. }
  845. }
  846. $output = str_replace( '%', number_format_i18n( $number ), $more );
  847. }
  848. } elseif ( 0 == $number ) {
  849. $output = ( false === $zero ) ? __( 'No Comments' ) : $zero;
  850. } else { // Must be one.
  851. $output = ( false === $one ) ? __( '1 Comment' ) : $one;
  852. }
  853. /**
  854. * Filters the comments count for display.
  855. *
  856. * @since 1.5.0
  857. *
  858. * @see _n()
  859. *
  860. * @param string $output A translatable string formatted based on whether the count
  861. * is equal to 0, 1, or 1+.
  862. * @param int $number The number of post comments.
  863. */
  864. return apply_filters( 'comments_number', $output, $number );
  865. }
  866. /**
  867. * Retrieves the text of the current comment.
  868. *
  869. * @since 1.5.0
  870. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  871. * @since 5.4.0 Added 'In reply to %s.' prefix to child comments in comments feed.
  872. *
  873. * @see Walker_Comment::comment()
  874. *
  875. * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the text.
  876. * Default current comment.
  877. * @param array $args Optional. An array of arguments. Default empty array.
  878. * @return string The comment content.
  879. */
  880. function get_comment_text( $comment_ID = 0, $args = array() ) {
  881. $comment = get_comment( $comment_ID );
  882. $comment_content = $comment->comment_content;
  883. if ( is_comment_feed() && $comment->comment_parent ) {
  884. $parent = get_comment( $comment->comment_parent );
  885. if ( $parent ) {
  886. $parent_link = esc_url( get_comment_link( $parent ) );
  887. $name = get_comment_author( $parent );
  888. $comment_content = sprintf(
  889. /* translators: %s: Comment link. */
  890. ent2ncr( __( 'In reply to %s.' ) ),
  891. '<a href="' . $parent_link . '">' . $name . '</a>'
  892. ) . "\n\n" . $comment_content;
  893. }
  894. }
  895. /**
  896. * Filters the text of a comment.
  897. *
  898. * @since 1.5.0
  899. *
  900. * @see Walker_Comment::comment()
  901. *
  902. * @param string $comment_content Text of the comment.
  903. * @param WP_Comment $comment The comment object.
  904. * @param array $args An array of arguments.
  905. */
  906. return apply_filters( 'get_comment_text', $comment_content, $comment, $args );
  907. }
  908. /**
  909. * Displays the text of the current comment.
  910. *
  911. * @since 0.71
  912. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  913. *
  914. * @see Walker_Comment::comment()
  915. *
  916. * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the text.
  917. * Default current comment.
  918. * @param array $args Optional. An array of arguments. Default empty array.
  919. */
  920. function comment_text( $comment_ID = 0, $args = array() ) {
  921. $comment = get_comment( $comment_ID );
  922. $comment_text = get_comment_text( $comment, $args );
  923. /**
  924. * Filters the text of a comment to be displayed.
  925. *
  926. * @since 1.2.0
  927. *
  928. * @see Walker_Comment::comment()
  929. *
  930. * @param string $comment_text Text of the current comment.
  931. * @param WP_Comment|null $comment The comment object. Null if not found.
  932. * @param array $args An array of arguments.
  933. */
  934. echo apply_filters( 'comment_text', $comment_text, $comment, $args );
  935. }
  936. /**
  937. * Retrieves the comment time of the current comment.
  938. *
  939. * @since 1.5.0
  940. *
  941. * @param string $format Optional. PHP time format. Defaults to the 'time_format' option.
  942. * @param bool $gmt Optional. Whether to use the GMT date. Default false.
  943. * @param bool $translate Optional. Whether to translate the time (for use in feeds).
  944. * Default true.
  945. * @return string The formatted time.
  946. */
  947. function get_comment_time( $format = '', $gmt = false, $translate = true ) {
  948. $comment = get_comment();
  949. $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
  950. $_format = ! empty( $format ) ? $format : get_option( 'time_format' );
  951. $date = mysql2date( $_format, $comment_date, $translate );
  952. /**
  953. * Filters the returned comment time.
  954. *
  955. * @since 1.5.0
  956. *
  957. * @param string|int $date The comment time, formatted as a date string or Unix timestamp.
  958. * @param string $format PHP date format.
  959. * @param bool $gmt Whether the GMT date is in use.
  960. * @param bool $translate Whether the time is translated.
  961. * @param WP_Comment $comment The comment object.
  962. */
  963. return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment );
  964. }
  965. /**
  966. * Displays the comment time of the current comment.
  967. *
  968. * @since 0.71
  969. *
  970. * @param string $format Optional. PHP time format. Defaults to the 'time_format' option.
  971. */
  972. function comment_time( $format = '' ) {
  973. echo get_comment_time( $format );
  974. }
  975. /**
  976. * Retrieves the comment type of the current comment.
  977. *
  978. * @since 1.5.0
  979. * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  980. *
  981. * @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the type.
  982. * Default current comment.
  983. * @return string The comment type.
  984. */
  985. function get_comment_type( $comment_ID = 0 ) {
  986. $comment = get_comment( $comment_ID );
  987. if ( '' === $comment->comment_type ) {
  988. $comment->comment_type = 'comment';
  989. }
  990. /**
  991. * Filters the returned comment type.
  992. *
  993. * @since 1.5.0
  994. * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
  995. *
  996. * @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
  997. * @param string $comment_ID The comment ID as a numeric string.
  998. * @param WP_Comment $comment The comment object.
  999. */
  1000. return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment );
  1001. }
  1002. /**
  1003. * Displays the comment type of the current comment.
  1004. *
  1005. * @since 0.71
  1006. *
  1007. * @param string|false $commenttxt Optional. String to display for comment type. Default false.
  1008. * @param string|false $trackbacktxt Optional. String to display for trackback type. Default false.
  1009. * @param string|false $pingbacktxt Optional. String to display for pingback type. Default false.
  1010. */
  1011. function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) {
  1012. if ( false === $commenttxt ) {
  1013. $commenttxt = _x( 'Comment', 'noun' );
  1014. }
  1015. if ( false === $trackbacktxt ) {
  1016. $trackbacktxt = __( 'Trackback' );
  1017. }
  1018. if ( false === $pingbacktxt ) {
  1019. $pingbacktxt = __( 'Pingback' );
  1020. }
  1021. $type = get_comment_type();
  1022. switch ( $type ) {
  1023. case 'trackback':
  1024. echo $trackbacktxt;
  1025. break;
  1026. case 'pingback':
  1027. echo $pingbacktxt;
  1028. break;
  1029. default:
  1030. echo $commenttxt;
  1031. }
  1032. }
  1033. /**
  1034. * Retrieves the current post's trackback URL.
  1035. *
  1036. * There is a check to see if permalink's have been enabled and if so, will
  1037. * retrieve the pretty path. If permalinks weren't enabled, the ID of the
  1038. * current post is used and appended to the correct page to go to.
  1039. *
  1040. * @since 1.5.0
  1041. *
  1042. * @return string The trackback URL after being filtered.
  1043. */
  1044. function get_trackback_url() {
  1045. if ( get_option( 'permalink_structure' ) ) {
  1046. $tb_url = trailingslashit( get_permalink() ) . user_trailingslashit( 'trackback', 'single_trackback' );
  1047. } else {
  1048. $tb_url = get_option( 'siteurl' ) . '/wp-trackback.php?p=' . get_the_ID();
  1049. }
  1050. /**
  1051. * Filters the returned trackback URL.
  1052. *
  1053. * @since 2.2.0
  1054. *
  1055. * @param string $tb_url The trackback URL.
  1056. */
  1057. return apply_filters( 'trackback_url', $tb_url );
  1058. }
  1059. /**
  1060. * Displays the current post's trackback URL.
  1061. *
  1062. * @since 0.71
  1063. *
  1064. * @param bool $deprecated_echo Not used.
  1065. * @return void|string Should only be used to echo the trackback URL, use get_trackback_url()
  1066. * for the result instead.
  1067. */
  1068. function trackback_url( $deprecated_echo = true ) {
  1069. if ( true !== $deprecated_echo ) {
  1070. _deprecated_argument(
  1071. __FUNCTION__,
  1072. '2.5.0',
  1073. sprintf(
  1074. /* translators: %s: get_trackback_url() */
  1075. __( 'Use %s instead if you do not want the value echoed.' ),
  1076. '<code>get_trackback_url()</code>'
  1077. )
  1078. );
  1079. }
  1080. if ( $deprecated_echo ) {
  1081. echo get_trackback_url();
  1082. } else {
  1083. return get_trackback_url();
  1084. }
  1085. }
  1086. /**
  1087. * Generates and displays the RDF for the trackback information of current post.
  1088. *
  1089. * Deprecated in 3.0.0, and restored in 3.0.1.
  1090. *
  1091. * @since 0.71
  1092. *
  1093. * @param int|string $deprecated Not used (Was $timezone = 0).
  1094. */
  1095. function trackback_rdf( $deprecated = '' ) {
  1096. if ( ! empty( $deprecated ) ) {
  1097. _deprecated_argument( __FUNCTION__, '2.5.0' );
  1098. }
  1099. if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && false !== stripos( $_SERVER['HTTP_USER_AGENT'], 'W3C_Validator' ) ) {
  1100. return;
  1101. }
  1102. echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  1103. xmlns:dc="http://purl.org/dc/elements/1.1/"
  1104. xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  1105. <rdf:Description rdf:about="';
  1106. the_permalink();
  1107. echo '"' . "\n";
  1108. echo ' dc:identifier="';
  1109. the_permalink();
  1110. echo '"' . "\n";
  1111. echo ' dc:title="' . str_replace( '--', '&#x2d;&#x2d;', wptexturize( strip_tags( get_the_title() ) ) ) . '"' . "\n";
  1112. echo ' trackback:ping="' . get_trackback_url() . '"' . " />\n";
  1113. echo '</rdf:RDF>';
  1114. }
  1115. /**
  1116. * Determines whether the current post is open for comments.
  1117. *
  1118. * For more information on this and similar theme functions, check out
  1119. * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
  1120. * Conditional Tags} article in the Theme Developer Handbook.
  1121. *
  1122. * @since 1.5.0
  1123. *
  1124. * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post.
  1125. * @return bool True if the comments are open.
  1126. */
  1127. function comments_open( $post_id = null ) {
  1128. $_post = get_post( $post_id );
  1129. $post_id = $_post ? $_post->ID : 0;
  1130. $open = ( $_post && ( 'open' === $_post->comment_status ) );
  1131. /**
  1132. * Filters whether the current post is open for comments.
  1133. *
  1134. * @since 2.5.0
  1135. *
  1136. * @param bool $open Whether the current post is open for comments.
  1137. * @param int $post_id The post ID.
  1138. */
  1139. return apply_filters( 'comments_open', $open, $post_id );
  1140. }
  1141. /**
  1142. * Determines whether the current post is open for pings.
  1143. *
  1144. * For more information on this and similar theme functions, check out
  1145. * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
  1146. * Conditional Tags} article in the Theme Developer Handbook.
  1147. *
  1148. * @since 1.5.0
  1149. *
  1150. * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post.
  1151. * @return bool True if pings are accepted
  1152. */
  1153. function pings_open( $post_id = null ) {
  1154. $_post = get_post( $post_id );
  1155. $post_id = $_post ? $_post->ID : 0;
  1156. $open = ( $_post && ( 'open' === $_post->ping_status ) );
  1157. /**
  1158. * Filters whether the current post is open for pings.
  1159. *
  1160. * @since 2.5.0
  1161. *
  1162. * @param bool $open Whether the current post is open for pings.
  1163. * @param int $post_id The post ID.
  1164. */
  1165. return apply_filters( 'pings_open', $open, $post_id );
  1166. }
  1167. /**
  1168. * Displays form token for unfiltered comments.
  1169. *
  1170. * Will only display nonce token if the current user has permissions for
  1171. * unfiltered html. Won't display the token for other users.
  1172. *
  1173. * The function was backported to 2.0.10 and was added to versions 2.1.3 and
  1174. * above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in
  1175. * the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0.
  1176. *
  1177. * Backported to 2.0.10.
  1178. *
  1179. * @since 2.1.3
  1180. */
  1181. function wp_comment_form_unfiltered_html_nonce() {
  1182. $post = get_post();
  1183. $post_id = $post ? $post->ID : 0;
  1184. if ( current_user_can( 'unfiltered_html' ) ) {
  1185. wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment_disabled', false );
  1186. echo "<script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>\n";
  1187. }
  1188. }
  1189. /**
  1190. * Loads the comment template specified in $file.
  1191. *
  1192. * Will not display the comments template if not on single post or page, or if
  1193. * the post does not have comments.
  1194. *
  1195. * Uses the WordPress database object to query for the comments. The comments
  1196. * are passed through the {@see 'comments_array'} filter hook with the list of comments
  1197. * and the post ID respectively.
  1198. *
  1199. * The `$file` path is passed through a filter hook called {@see 'comments_template'},
  1200. * which includes the TEMPLATEPATH and $file combined. Tries the $filtered path
  1201. * first and if it fails it will require the default comment template from the
  1202. * default theme. If either does not exist, then the WordPress process will be
  1203. * halted. It is advised for that reason, that the default theme is not deleted.
  1204. *
  1205. * Will not try to get the comments if the post has none.
  1206. *
  1207. * @since 1.5.0
  1208. *
  1209. * @global WP_Query $wp_query WordPress Query object.
  1210. * @global WP_Post $post Global post object.
  1211. * @global wpdb $wpdb WordPress database abstraction object.
  1212. * @global int $id
  1213. * @global WP_Comment $comment Global comment object.
  1214. * @global string $user_login
  1215. * @global string $user_identity
  1216. * @global bool $overridden_cpage
  1217. * @global bool $withcomments
  1218. *
  1219. * @param string $file Optional. The file to load. Default '/comments.php'.
  1220. * @param bool $separate_comments Optional. Whether to separate the comments by comment type.
  1221. * Default false.
  1222. */
  1223. function comments_template( $file = '/comments.php', $separate_comments = false ) {
  1224. global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_identity, $overridden_cpage;
  1225. if ( ! ( is_single() || is_page() || $withcomments ) || empty( $post ) ) {
  1226. return;
  1227. }
  1228. if ( empty( $file ) ) {
  1229. $file = '/comments.php';
  1230. }
  1231. $req = get_option( 'require_name_email' );
  1232. /*
  1233. * Comment author information fetched from the comment cookies.
  1234. */
  1235. $commenter = wp_get_current_commenter();
  1236. /*
  1237. * The name of the current comment author escaped for use in attributes.
  1238. * Escaped by sanitize_comment_cookies().
  1239. */
  1240. $comment_author = $commenter['comment_author'];
  1241. /*
  1242. * The email address of the current comment author escaped for use in attributes.
  1243. * Escaped by sanitize_comment_cookies().
  1244. */
  1245. $comment_author_email = $commenter['comment_author_email'];
  1246. /*
  1247. * The URL of the current comment author escaped for use in attributes.
  1248. */
  1249. $comment_author_url = esc_url( $commenter['comment_author_url'] );
  1250. $comment_args = array(
  1251. 'orderby' => 'comment_date_gmt',
  1252. 'order' => 'ASC',
  1253. 'status' => 'approve',
  1254. 'post_id' => $post->ID,
  1255. 'no_found_rows' => false,
  1256. 'update_comment_meta_cache' => false, // We lazy-load comment meta for performance.
  1257. );
  1258. if ( get_option( 'thread_comments' ) ) {
  1259. $comment_args['hierarchical'] = 'threaded';
  1260. } else {
  1261. $comment_args['hierarchical'] = false;
  1262. }
  1263. if ( is_user_logged_in() ) {
  1264. $comment_args['include_unapproved'] = array( get_current_user_id() );
  1265. } else {
  1266. $unapproved_email = wp_get_unapproved_comment_author_email();
  1267. if ( $unapproved_email ) {
  1268. $comment_args['include_unapproved'] = array( $unapproved_email );
  1269. }
  1270. }
  1271. $per_page = 0;
  1272. if ( get_option( 'page_comments' ) ) {
  1273. $per_page = (int) get_query_var( 'comments_per_page' );
  1274. if ( 0 === $per_page ) {
  1275. $per_page = (int) get_option( 'comments_per_page' );
  1276. }
  1277. $comment_args['number'] = $per_page;
  1278. $page = (int) get_query_var( 'cpage' );
  1279. if ( $page ) {
  1280. $comment_args['offset'] = ( $page - 1 ) * $per_page;
  1281. } elseif ( 'oldest' === get_option( 'default_comments_page' ) ) {
  1282. $comment_args['offset'] = 0;
  1283. } else {
  1284. // If fetching the first page of 'newest', we need a top-level comment count.
  1285. $top_level_query = new WP_Comment_Query();
  1286. $top_level_args = array(
  1287. 'count' => true,
  1288. 'orderby' => false,
  1289. 'post_id' => $post->ID,
  1290. 'status' => 'approve',
  1291. );
  1292. if ( $comment_args['hierarchical'] ) {
  1293. $top_level_args['parent'] = 0;
  1294. }
  1295. if ( isset( $comment_args['include_unapproved'] ) ) {
  1296. $top_level_args['include_unapproved'] = $comment_args['include_unapproved'];
  1297. }
  1298. /**
  1299. * Filters the arguments used in the top level comments query.
  1300. *
  1301. * @since 5.6.0
  1302. *
  1303. * @see WP_Comment_Query::__construct()
  1304. *
  1305. * @param array $top_level_args {
  1306. * The top level query arguments for the comments template.
  1307. *
  1308. * @type bool $count Whether to return a comment count.
  1309. * @type string|array $orderby The field(s) to order by.
  1310. * @type int $post_id The post ID.
  1311. * @type string|array $status The comment status to limit results by.
  1312. * }
  1313. */
  1314. $top_level_args = apply_filters( 'comments_template_top_level_query_args', $top_level_args );
  1315. $top_level_count = $top_level_query->query( $top_level_args );
  1316. $comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page;
  1317. }
  1318. }
  1319. /**
  1320. * Filters the arguments used to query comments in comments_template().
  1321. *
  1322. * @since 4.5.0
  1323. *
  1324. * @see WP_Comment_Query::__construct()
  1325. *
  1326. * @param array $comment_args {
  1327. * Array of WP_Comment_Query arguments.
  1328. *
  1329. * @type string|array $orderby Field(s) to order by.
  1330. * @type string $order Order of results. Accepts 'ASC' or 'DESC'.
  1331. * @type string $status Comment status.
  1332. * @type array $include_unapproved Array of IDs or email addresses whose unapproved comments
  1333. * will be included in results.
  1334. * @type int $post_id ID of the post.
  1335. * @type bool $no_found_rows Whether to refrain from querying for found rows.
  1336. * @type bool $update_comment_meta_cache Whether to prime cache for comment meta.
  1337. * @type bool|string $hierarchical Whether to query for comments hierarchically.
  1338. * @type int $offset Comment offset.
  1339. * @type int $number Number of comments to fetch.
  1340. * }
  1341. */
  1342. $comment_args = apply_filters( 'comments_template_query_args', $comment_args );
  1343. $comment_query = new WP_Comment_Query( $comment_args );
  1344. $_comments = $comment_query->comments;
  1345. // Trees must be flattened before they're passed to the walker.
  1346. if ( $comment_args['hierarchical'] ) {
  1347. $comments_flat = array();
  1348. foreach ( $_comments as $_comment ) {
  1349. $comments_flat[] = $_comment;
  1350. $comment_children = $_comment->get_children(
  1351. array(
  1352. 'format' => 'flat',
  1353. 'status' => $comment_args['status'],
  1354. 'orderby' => $comment_args['orderby'],
  1355. )
  1356. );
  1357. foreach ( $comment_children as $comment_child ) {
  1358. $comments_flat[] = $comment_child;
  1359. }
  1360. }
  1361. } else {
  1362. $comments_flat = $_comments;
  1363. }
  1364. /**
  1365. * Filters the comments array.
  1366. *
  1367. * @since 2.1.0
  1368. *
  1369. * @param array $comments Array of comments supplied to the comments template.
  1370. * @param int $post_ID Post ID.
  1371. */
  1372. $wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID );
  1373. $comments = &$wp_query->comments;
  1374. $wp_query->comment_count = count( $wp_query->comments );
  1375. $wp_query->max_num_comment_pages = $comment_query->max_num_pages;
  1376. if ( $separate_comments ) {
  1377. $wp_query->comments_by_type = separate_comments( $comments );
  1378. $comments_by_type = &$wp_query->comments_by_type;
  1379. } else {
  1380. $wp_query->comments_by_type = array();
  1381. }
  1382. $overridden_cpage = false;
  1383. if ( '' == get_query_var( 'cpage' ) && $wp_query->max_num_comment_pages > 1 ) {
  1384. set_query_var( 'cpage', 'newest' === get_option( 'default_comments_page' ) ? get_comment_pages_count() : 1 );
  1385. $overridden_cpage = true;
  1386. }
  1387. if ( ! defined( 'COMMENTS_TEMPLATE' ) ) {
  1388. define( 'COMMENTS_TEMPLATE', true );
  1389. }
  1390. $theme_template = STYLESHEETPATH . $file;
  1391. /**
  1392. * Filters the path to the theme template file used for the comments template.
  1393. *
  1394. * @since 1.5.1
  1395. *
  1396. * @param string $theme_template The path to the theme template file.
  1397. */
  1398. $include = apply_filters( 'comments_template', $theme_template );
  1399. if ( file_exists( $include ) ) {
  1400. require $include;
  1401. } elseif ( file_exists( TEMPLATEPATH . $file ) ) {
  1402. require TEMPLATEPATH . $file;
  1403. } else { // Backward compat code will be removed in a future release.
  1404. require ABSPATH . WPINC . '/theme-compat/comments.php';
  1405. }
  1406. }
  1407. /**
  1408. * Displays the link to the comments for the current post ID.
  1409. *
  1410. * @since 0.71
  1411. *
  1412. * @param false|string $zero Optional. String to display when no comments. Default false.
  1413. * @param false|string $one Optional. String to display when only one comment is available. Default false.
  1414. * @param false|string $more Optional. String to display when there are more than one comment. Default false.
  1415. * @param string $css_class Optional. CSS class to use for comments. Default empty.
  1416. * @param false|string $none Optional. String to display when comments have been turned off. Default false.
  1417. */
  1418. function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
  1419. $post_id = get_the_ID();
  1420. $post_title = get_the_title();
  1421. $number = get_comments_number( $post_id );
  1422. if ( false === $zero ) {
  1423. /* translators: %s: Post title. */
  1424. $zero = sprintf( __( 'No Comments<span class="screen-reader-text"> on %s</span>' ), $post_title );
  1425. }
  1426. if ( false === $one ) {
  1427. /* translators: %s: Post title. */
  1428. $one = sprintf( __( '1 Comment<span class="screen-reader-text"> on %s</span>' ), $post_title );
  1429. }
  1430. if ( false === $more ) {
  1431. /* translators: 1: Number of comments, 2: Post title. */
  1432. $more = _n( '%1$s Comment<span class="screen-reader-text"> on %2$s</span>', '%1$s Comments<span class="screen-reader-text"> on %2$s</span>', $number );
  1433. $more = sprintf( $more, number_format_i18n( $number ), $post_title );
  1434. }
  1435. if ( false === $none ) {
  1436. /* translators: %s: Post title. */
  1437. $none = sprintf( __( 'Comments Off<span class="screen-reader-text"> on %s</span>' ), $post_title );
  1438. }
  1439. if ( 0 == $number && ! comments_open() && ! pings_open() ) {
  1440. echo '<span' . ( ( ! empty( $css_class ) ) ? ' class="' . esc_attr( $css_class ) . '"' : '' ) . '>' . $none . '</span>';
  1441. return;
  1442. }
  1443. if ( post_password_required() ) {
  1444. _e( 'Enter your password to view comments.' );
  1445. return;
  1446. }
  1447. echo '<a href="';
  1448. if ( 0 == $number ) {
  1449. $respond_link = get_permalink() . '#respond';
  1450. /**
  1451. * Filters the respond link when a post has no comments.
  1452. *
  1453. * @since 4.4.0
  1454. *
  1455. * @param string $respond_link The default response link.
  1456. * @param int $post_id The post ID.
  1457. */
  1458. echo apply_filters( 'respond_link', $respond_link, $post_id );
  1459. } else {
  1460. comments_link();
  1461. }
  1462. echo '"';
  1463. if ( ! empty( $css_class ) ) {
  1464. echo ' class="' . $css_class . '" ';
  1465. }
  1466. $attributes = '';
  1467. /**
  1468. * Filters the comments link attributes for display.
  1469. *
  1470. * @since 2.5.0
  1471. *
  1472. * @param string $attributes The comments link attributes. Default empty.
  1473. */
  1474. echo apply_filters( 'comments_popup_link_attributes', $attributes );
  1475. echo '>';
  1476. comments_number( $zero, $one, $more );
  1477. echo '</a>';
  1478. }
  1479. /**
  1480. * Retrieves HTML content for reply to comment link.
  1481. *
  1482. * @since 2.7.0
  1483. * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
  1484. *
  1485. * @param array $args {
  1486. * Optional. Override default arguments.
  1487. *
  1488. * @type string $add_below The first part of the selector used to identify the comment to respond below.
  1489. * The resulting value is passed as the first parameter to addComment.moveForm(),
  1490. * concatenated as $add_below-$comment->comment_ID. Default 'comment'.
  1491. * @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
  1492. * to addComment.moveForm(), and appended to the link URL as a hash value.
  1493. * Default 'respond'.
  1494. * @type string $reply_text The text of the Reply link. Default 'Reply'.
  1495. * @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
  1496. * @type int $max_depth The max depth of the comment tree. Default 0.
  1497. * @type int $depth The depth of the new comment. Must be greater than 0 and less than the value
  1498. * of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
  1499. * @type string $before The text or HTML to add before the reply link. Default empty.
  1500. * @type string $after The text or HTML to add after the reply link. Default empty.
  1501. * }
  1502. * @param int|WP_Comment $comment Comment being replied to. Default current comment.
  1503. * @param int|WP_Post $post Post ID or WP_Post object the comment is going to be displayed on.
  1504. * Default current post.
  1505. * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
  1506. */
  1507. function get_comment_reply_link( $args = array(), $comment = null, $post = null ) {
  1508. $defaults = array(
  1509. 'add_below' => 'comment',
  1510. 'respond_id' => 'respond',
  1511. 'reply_text' => __( 'Reply' ),
  1512. /* translators: Comment reply button text. %s: Comment author name. */
  1513. 'reply_to_text' => __( 'Reply to %s' ),
  1514. 'login_text' => __( 'Log in to Reply' ),
  1515. 'max_depth' => 0,
  1516. 'depth' => 0,
  1517. 'before' => '',
  1518. 'after' => '',
  1519. );
  1520. $args = wp_parse_args( $args, $defaults );
  1521. if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] ) {
  1522. return;
  1523. }
  1524. $comment = get_comment( $comment );
  1525. if ( empty( $comment ) ) {
  1526. return;
  1527. }
  1528. if ( empty( $post ) ) {
  1529. $post = $comment->comment_post_ID;
  1530. }
  1531. $post = get_post( $post );
  1532. if ( ! comments_open( $post->ID ) ) {
  1533. return false;
  1534. }
  1535. if ( get_option( 'page_comments' ) ) {
  1536. $permalink = str_replace( '#comment-' . $comment->comment_ID, '', get_comment_link( $comment ) );
  1537. } else {
  1538. $permalink = get_permalink( $post->ID );
  1539. }
  1540. /**
  1541. * Filters the comment reply link arguments.
  1542. *
  1543. * @since 4.1.0
  1544. *
  1545. * @param array $args Comment reply link arguments. See get_comment_reply_link()
  1546. * for more information on accepted arguments.
  1547. * @param WP_Comment $comment The object of the comment being replied to.
  1548. * @param WP_Post $post The WP_Post object.
  1549. */
  1550. $args = apply_filters( 'comment_reply_link_args', $args, $comment, $post );
  1551. if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
  1552. $link = sprintf(
  1553. '<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
  1554. esc_url( wp_login_url( get_permalink() ) ),
  1555. $args['login_text']
  1556. );
  1557. } else {
  1558. $data_attributes = array(
  1559. 'commentid' => $comment->comment_ID,
  1560. 'postid' => $post->ID,
  1561. 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID,
  1562. 'respondelement' => $args['respond_id'],
  1563. 'replyto' => sprintf( $args['reply_to_text'], get_comment_author( $comment ) ),
  1564. );
  1565. $data_attribute_string = '';
  1566. foreach ( $data_attributes as $name => $value ) {
  1567. $data_attribute_string .= " data-${name}=\"" . esc_attr( $value ) . '"';
  1568. }
  1569. $data_attribute_string = trim( $data_attribute_string );
  1570. $link = sprintf(
  1571. "<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>",
  1572. esc_url(
  1573. add_query_arg(
  1574. array(
  1575. 'replytocom' => $comment->comment_ID,
  1576. 'unapproved' => false,
  1577. 'moderation-hash' => false,
  1578. ),
  1579. $permalink
  1580. )
  1581. ) . '#' . $args['respond_id'],
  1582. $data_attribute_string,
  1583. esc_attr( sprintf( $args['reply_to_text'], get_comment_author( $comment ) ) ),
  1584. $args['reply_text']
  1585. );
  1586. }
  1587. /**
  1588. * Filters the comment reply link.
  1589. *
  1590. * @since 2.7.0
  1591. *
  1592. * @param string $link The HTML markup for the comment reply link.
  1593. * @param array $args An array of arguments overriding the defaults.
  1594. * @param WP_Comment $comment The object of the comment being replied.
  1595. * @param WP_Post $post The WP_Post object.
  1596. */
  1597. return apply_filters( 'comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post );
  1598. }
  1599. /**
  1600. * Displays the HTML content for reply to comment link.
  1601. *
  1602. * @since 2.7.0
  1603. *
  1604. * @see get_comment_reply_link()
  1605. *
  1606. * @param array $args Optional. Override default options. Default empty array.
  1607. * @param int|WP_Comment $comment Comment being replied to. Default current comment.
  1608. * @param int|WP_Post $post Post ID or WP_Post object the comment is going to be displayed on.
  1609. * Default current post.
  1610. */
  1611. function comment_reply_link( $args = array(), $comment = null, $post = null ) {
  1612. echo get_comment_reply_link( $args, $comment, $post );
  1613. }
  1614. /**
  1615. * Retrieves HTML content for reply to post link.
  1616. *
  1617. * @since 2.7.0
  1618. *
  1619. * @param array $args {
  1620. * Optional. Override default arguments.
  1621. *
  1622. * @type string $add_below The first part of the selector used to identify the comment to respond below.
  1623. * The resulting value is passed as the first parameter to addComment.moveForm(),
  1624. * concatenated as $add_below-$comment->comment_ID. Default is 'post'.
  1625. * @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
  1626. * to addComment.moveForm(), and appended to the link URL as a hash value.
  1627. * Default 'respond'.
  1628. * @type string $reply_text Text of the Reply link. Default is 'Leave a Comment'.
  1629. * @type string $login_text Text of the link to reply if logged out. Default is 'Log in to leave a Comment'.
  1630. * @type string $before Text or HTML to add before the reply link. Default empty.
  1631. * @type string $after Text or HTML to add after the reply link. Default empty.
  1632. * }
  1633. * @param int|WP_Post $post Optional. Post ID or WP_Post object the comment is going to be displayed on.
  1634. * Default current post.
  1635. * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
  1636. */
  1637. function get_post_reply_link( $args = array(), $post = null ) {
  1638. $defaults = array(
  1639. 'add_below' => 'post',
  1640. 'respond_id' => 'respond',
  1641. 'reply_text' => __( 'Leave a Comment' ),
  1642. 'login_text' => __( 'Log in to leave a Comment' ),
  1643. 'before' => '',
  1644. 'after' => '',
  1645. );
  1646. $args = wp_parse_args( $args, $defaults );
  1647. $post = get_post( $post );
  1648. if ( ! comments_open( $post->ID ) ) {
  1649. return false;
  1650. }
  1651. if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
  1652. $link = sprintf(
  1653. '<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
  1654. wp_login_url( get_permalink() ),
  1655. $args['login_text']
  1656. );
  1657. } else {
  1658. $onclick = sprintf(
  1659. 'return addComment.moveForm( "%1$s-%2$s", "0", "%3$s", "%2$s" )',
  1660. $args['add_below'],
  1661. $post->ID,
  1662. $args['respond_id']
  1663. );
  1664. $link = sprintf(
  1665. "<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s'>%s</a>",
  1666. get_permalink( $post->ID ) . '#' . $args['respond_id'],
  1667. $onclick,
  1668. $args['reply_text']
  1669. );
  1670. }
  1671. $formatted_link = $args['before'] . $link . $args['after'];
  1672. /**
  1673. * Filters the formatted post comments link HTML.
  1674. *
  1675. * @since 2.7.0
  1676. *
  1677. * @param string $formatted The HTML-formatted post comments link.
  1678. * @param int|WP_Post $post The post ID or WP_Post object.
  1679. */
  1680. return apply_filters( 'post_comments_link', $formatted_link, $post );
  1681. }
  1682. /**
  1683. * Displays the HTML content for reply to post link.
  1684. *
  1685. * @since 2.7.0
  1686. *
  1687. * @see get_post_reply_link()
  1688. *
  1689. * @param array $args Optional. Override default options. Default empty array.
  1690. * @param int|WP_Post $post Post ID or WP_Post object the comment is going to be displayed on.
  1691. * Default current post.
  1692. */
  1693. function post_reply_link( $args = array(), $post = null ) {
  1694. echo get_post_reply_link( $args, $post );
  1695. }
  1696. /**
  1697. * Retrieves HTML content for cancel comment reply link.
  1698. *
  1699. * @since 2.7.0
  1700. *
  1701. * @param string $text Optional. Text to display for cancel reply link. If empty,
  1702. * defaults to 'Click here to cancel reply'. Default empty.
  1703. * @return string
  1704. */
  1705. function get_cancel_comment_reply_link( $text = '' ) {
  1706. if ( empty( $text ) ) {
  1707. $text = __( 'Click here to cancel reply.' );
  1708. }
  1709. $style = isset( $_GET['replytocom'] ) ? '' : ' style="display:none;"';
  1710. $link = esc_html( remove_query_arg( array( 'replytocom', 'unapproved', 'moderation-hash' ) ) ) . '#respond';
  1711. $formatted_link = '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>';
  1712. /**
  1713. * Filters the cancel comment reply link HTML.
  1714. *
  1715. * @since 2.7.0
  1716. *
  1717. * @param string $formatted_link The HTML-formatted cancel comment reply link.
  1718. * @param string $link Cancel comment reply link URL.
  1719. * @param string $text Cancel comment reply link text.
  1720. */
  1721. return apply_filters( 'cancel_comment_reply_link', $formatted_link, $link, $text );
  1722. }
  1723. /**
  1724. * Displays HTML content for cancel comment reply link.
  1725. *
  1726. * @since 2.7.0
  1727. *
  1728. * @param string $text Optional. Text to display for cancel reply link. If empty,
  1729. * defaults to 'Click here to cancel reply'. Default empty.
  1730. */
  1731. function cancel_comment_reply_link( $text = '' ) {
  1732. echo get_cancel_comment_reply_link( $text );
  1733. }
  1734. /**
  1735. * Retrieves hidden input HTML for replying to comments.
  1736. *
  1737. * @since 3.0.0
  1738. *
  1739. * @param int $post_id Optional. Post ID. Defaults to the current post ID.
  1740. * @return string Hidden input HTML for replying to comments.
  1741. */
  1742. function get_comment_id_fields( $post_id = 0 ) {
  1743. if ( empty( $post_id ) ) {
  1744. $post_id = get_the_ID();
  1745. }
  1746. $reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
  1747. $result = "<input type='hidden' name='comment_post_ID' value='$post_id' id='comment_post_ID' />\n";
  1748. $result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$reply_to_id' />\n";
  1749. /**
  1750. * Filters the returned comment ID fields.
  1751. *
  1752. * @since 3.0.0
  1753. *
  1754. * @param string $result The HTML-formatted hidden ID field comment elements.
  1755. * @param int $post_id The post ID.
  1756. * @param int $reply_to_id The ID of the comment being replied to.
  1757. */
  1758. return apply_filters( 'comment_id_fields', $result, $post_id, $reply_to_id );
  1759. }
  1760. /**
  1761. * Outputs hidden input HTML for replying to comments.
  1762. *
  1763. * Adds two hidden inputs to the comment form to identify the `comment_post_ID`
  1764. * and `comment_parent` values for threaded comments.
  1765. *
  1766. * This tag must be within the `<form>` section of the `comments.php` template.
  1767. *
  1768. * @since 2.7.0
  1769. *
  1770. * @see get_comment_id_fields()
  1771. *
  1772. * @param int $post_id Optional. Post ID. Defaults to the current post ID.
  1773. */
  1774. function comment_id_fields( $post_id = 0 ) {
  1775. echo get_comment_id_fields( $post_id );
  1776. }
  1777. /**
  1778. * Displays text based on comment reply status.
  1779. *
  1780. * Only affects users with JavaScript disabled.
  1781. *
  1782. * @internal The $comment global must be present to allow template tags access to the current
  1783. * comment. See https://core.trac.wordpress.org/changeset/36512.
  1784. *
  1785. * @since 2.7.0
  1786. *
  1787. * @global WP_Comment $comment Global comment object.
  1788. *
  1789. * @param string|false $no_reply_text Optional. Text to display when not replying to a comment.
  1790. * Default false.
  1791. * @param string|false $reply_text Optional. Text to display when replying to a comment.
  1792. * Default false. Accepts "%s" for the author of the comment
  1793. * being replied to.
  1794. * @param bool $link_to_parent Optional. Boolean to control making the author's name a link
  1795. * to their comment. Default true.
  1796. */
  1797. function comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true ) {
  1798. global $comment;
  1799. if ( false === $no_reply_text ) {
  1800. $no_reply_text = __( 'Leave a Reply' );
  1801. }
  1802. if ( false === $reply_text ) {
  1803. /* translators: %s: Author of the comment being replied to. */
  1804. $reply_text = __( 'Leave a Reply to %s' );
  1805. }
  1806. $reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
  1807. if ( 0 == $reply_to_id ) {
  1808. echo $no_reply_text;
  1809. } else {
  1810. // Sets the global so that template tags can be used in the comment form.
  1811. $comment = get_comment( $reply_to_id );
  1812. if ( $link_to_parent ) {
  1813. $author = '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>';
  1814. } else {
  1815. $author = get_comment_author( $comment );
  1816. }
  1817. printf( $reply_text, $author );
  1818. }
  1819. }
  1820. /**
  1821. * Displays a list of comments.
  1822. *
  1823. * Used in the comments.php template to list comments for a particular post.
  1824. *
  1825. * @since 2.7.0
  1826. *
  1827. * @see WP_Query->comments
  1828. *
  1829. * @global WP_Query $wp_query WordPress Query object.
  1830. * @global int $comment_alt
  1831. * @global int $comment_depth
  1832. * @global int $comment_thread_alt
  1833. * @global bool $overridden_cpage
  1834. * @global bool $in_comment_loop
  1835. *
  1836. * @param string|array $args {
  1837. * Optional. Formatting options.
  1838. *
  1839. * @type object $walker Instance of a Walker class to list comments. Default null.
  1840. * @type int $max_depth The maximum comments depth. Default empty.
  1841. * @type string $style The style of list ordering. Accepts 'ul', 'ol', or 'div'.
  1842. * 'div' will result in no additional list markup. Default 'ul'.
  1843. * @type callable $callback Callback function to use. Default null.
  1844. * @type callable $end-callback Callback function to use at the end. Default null.
  1845. * @type string $type Type of comments to list. Accepts 'all', 'comment',
  1846. * 'pingback', 'trackback', 'pings'. Default 'all'.
  1847. * @type int $page Page ID to list comments for. Default empty.
  1848. * @type int $per_page Number of comments to list per page. Default empty.
  1849. * @type int $avatar_size Height and width dimensions of the avatar size. Default 32.
  1850. * @type bool $reverse_top_level Ordering of the listed comments. If true, will display
  1851. * newest comments first. Default null.
  1852. * @type bool $reverse_children Whether to reverse child comments in the list. Default null.
  1853. * @type string $format How to format the comments list. Accepts 'html5', 'xhtml'.
  1854. * Default 'html5' if the theme supports it.
  1855. * @type bool $short_ping Whether to output short pings. Default false.
  1856. * @type bool $echo Whether to echo the output or return it. Default true.
  1857. * }
  1858. * @param WP_Comment[] $comments Optional. Array of WP_Comment objects.
  1859. * @return void|string Void if 'echo' argument is true, or no comments to list.
  1860. * Otherwise, HTML list of comments.
  1861. */
  1862. function wp_list_comments( $args = array(), $comments = null ) {
  1863. global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop;
  1864. $in_comment_loop = true;
  1865. $comment_alt = 0;
  1866. $comment_thread_alt = 0;
  1867. $comment_depth = 1;
  1868. $defaults = array(
  1869. 'walker' => null,
  1870. 'max_depth' => '',
  1871. 'style' => 'ul',
  1872. 'callback' => null,
  1873. 'end-callback' => null,
  1874. 'type' => 'all',
  1875. 'page' => '',
  1876. 'per_page' => '',
  1877. 'avatar_size' => 32,
  1878. 'reverse_top_level' => null,
  1879. 'reverse_children' => '',
  1880. 'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml',
  1881. 'short_ping' => false,
  1882. 'echo' => true,
  1883. );
  1884. $parsed_args = wp_parse_args( $args, $defaults );
  1885. /**
  1886. * Filters the arguments used in retrieving the comment list.
  1887. *
  1888. * @since 4.0.0
  1889. *
  1890. * @see wp_list_comments()
  1891. *
  1892. * @param array $parsed_args An array of arguments for displaying comments.
  1893. */
  1894. $parsed_args = apply_filters( 'wp_list_comments_args', $parsed_args );
  1895. // Figure out what comments we'll be looping through ($_comments).
  1896. if ( null !== $comments ) {
  1897. $comments = (array) $comments;
  1898. if ( empty( $comments ) ) {
  1899. return;
  1900. }
  1901. if ( 'all' !== $parsed_args['type'] ) {
  1902. $comments_by_type = separate_comments( $comments );
  1903. if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) {
  1904. return;
  1905. }
  1906. $_comments = $comments_by_type[ $parsed_args['type'] ];
  1907. } else {
  1908. $_comments = $comments;
  1909. }
  1910. } else {
  1911. /*
  1912. * If 'page' or 'per_page' has been passed, and does not match what's in $wp_query,
  1913. * perform a separate comment query and allow Walker_Comment to paginate.
  1914. */
  1915. if ( $parsed_args['page'] || $parsed_args['per_page'] ) {
  1916. $current_cpage = get_query_var( 'cpage' );
  1917. if ( ! $current_cpage ) {
  1918. $current_cpage = 'newest' === get_option( 'default_comments_page' ) ? 1 : $wp_query->max_num_comment_pages;
  1919. }
  1920. $current_per_page = get_query_var( 'comments_per_page' );
  1921. if ( $parsed_args['page'] != $current_cpage || $parsed_args['per_page'] != $current_per_page ) {
  1922. $comment_args = array(
  1923. 'post_id' => get_the_ID(),
  1924. 'orderby' => 'comment_date_gmt',
  1925. 'order' => 'ASC',
  1926. 'status' => 'approve',
  1927. );
  1928. if ( is_user_logged_in() ) {
  1929. $comment_args['include_unapproved'] = array( get_current_user_id() );
  1930. } else {
  1931. $unapproved_email = wp_get_unapproved_comment_author_email();
  1932. if ( $unapproved_email ) {
  1933. $comment_args['include_unapproved'] = array( $unapproved_email );
  1934. }
  1935. }
  1936. $comments = get_comments( $comment_args );
  1937. if ( 'all' !== $parsed_args['type'] ) {
  1938. $comments_by_type = separate_comments( $comments );
  1939. if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) {
  1940. return;
  1941. }
  1942. $_comments = $comments_by_type[ $parsed_args['type'] ];
  1943. } else {
  1944. $_comments = $comments;
  1945. }
  1946. }
  1947. // Otherwise, fall back on the comments from `$wp_query->comments`.
  1948. } else {
  1949. if ( empty( $wp_query->comments ) ) {
  1950. return;
  1951. }
  1952. if ( 'all' !== $parsed_args['type'] ) {
  1953. if ( empty( $wp_query->comments_by_type ) ) {
  1954. $wp_query->comments_by_type = separate_comments( $wp_query->comments );
  1955. }
  1956. if ( empty( $wp_query->comments_by_type[ $parsed_args['type'] ] ) ) {
  1957. return;
  1958. }
  1959. $_comments = $wp_query->comments_by_type[ $parsed_args['type'] ];
  1960. } else {
  1961. $_comments = $wp_query->comments;
  1962. }
  1963. if ( $wp_query->max_num_comment_pages ) {
  1964. $default_comments_page = get_option( 'default_comments_page' );
  1965. $cpage = get_query_var( 'cpage' );
  1966. if ( 'newest' === $default_comments_page ) {
  1967. $parsed_args['cpage'] = $cpage;
  1968. /*
  1969. * When first page shows oldest comments, post permalink is the same as
  1970. * the comment permalink.
  1971. */
  1972. } elseif ( 1 == $cpage ) {
  1973. $parsed_args['cpage'] = '';
  1974. } else {
  1975. $parsed_args['cpage'] = $cpage;
  1976. }
  1977. $parsed_args['page'] = 0;
  1978. $parsed_args['per_page'] = 0;
  1979. }
  1980. }
  1981. }
  1982. if ( '' === $parsed_args['per_page'] && get_option( 'page_comments' ) ) {
  1983. $parsed_args['per_page'] = get_query_var( 'comments_per_page' );
  1984. }
  1985. if ( empty( $parsed_args['per_page'] ) ) {
  1986. $parsed_args['per_page'] = 0;
  1987. $parsed_args['page'] = 0;
  1988. }
  1989. if ( '' === $parsed_args['max_depth'] ) {
  1990. if ( get_option( 'thread_comments' ) ) {
  1991. $parsed_args['max_depth'] = get_option( 'thread_comments_depth' );
  1992. } else {
  1993. $parsed_args['max_depth'] = -1;
  1994. }
  1995. }
  1996. if ( '' === $parsed_args['page'] ) {
  1997. if ( empty( $overridden_cpage ) ) {
  1998. $parsed_args['page'] = get_query_var( 'cpage' );
  1999. } else {
  2000. $threaded = ( -1 != $parsed_args['max_depth'] );
  2001. $parsed_args['page'] = ( 'newest' === get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $parsed_args['per_page'], $threaded ) : 1;
  2002. set_query_var( 'cpage', $parsed_args['page'] );
  2003. }
  2004. }
  2005. // Validation check.
  2006. $parsed_args['page'] = (int) $parsed_args['page'];
  2007. if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) {
  2008. $parsed_args['page'] = 1;
  2009. }
  2010. if ( null === $parsed_args['reverse_top_level'] ) {
  2011. $parsed_args['reverse_top_level'] = ( 'desc' === get_option( 'comment_order' ) );
  2012. }
  2013. wp_queue_comments_for_comment_meta_lazyload( $_comments );
  2014. if ( empty( $parsed_args['walker'] ) ) {
  2015. $walker = new Walker_Comment;
  2016. } else {
  2017. $walker = $parsed_args['walker'];
  2018. }
  2019. $output = $walker->paged_walk( $_comments, $parsed_args['max_depth'], $parsed_args['page'], $parsed_args['per_page'], $parsed_args );
  2020. $in_comment_loop = false;
  2021. if ( $parsed_args['echo'] ) {
  2022. echo $output;
  2023. } else {
  2024. return $output;
  2025. }
  2026. }
  2027. /**
  2028. * Outputs a complete commenting form for use within a template.
  2029. *
  2030. * Most strings and form fields may be controlled through the `$args` array passed
  2031. * into the function, while you may also choose to use the {@see 'comment_form_default_fields'}
  2032. * filter to modify the array of default fields if you'd just like to add a new
  2033. * one or remove a single field. All fields are also individually passed through
  2034. * a filter of the {@see 'comment_form_field_$name'} where `$name` is the key used
  2035. * in the array of fields.
  2036. *
  2037. * @since 3.0.0
  2038. * @since 4.1.0 Introduced the 'class_submit' argument.
  2039. * @since 4.2.0 Introduced the 'submit_button' and 'submit_fields' arguments.
  2040. * @since 4.4.0 Introduced the 'class_form', 'title_reply_before', 'title_reply_after',
  2041. * 'cancel_reply_before', and 'cancel_reply_after' arguments.
  2042. * @since 4.5.0 The 'author', 'email', and 'url' form fields are limited to 245, 100,
  2043. * and 200 characters, respectively.
  2044. * @since 4.6.0 Introduced the 'action' argument.
  2045. * @since 4.9.6 Introduced the 'cookies' default comment field.
  2046. * @since 5.5.0 Introduced the 'class_container' argument.
  2047. *
  2048. * @param array $args {
  2049. * Optional. Default arguments and form fields to override.
  2050. *
  2051. * @type array $fields {
  2052. * Default comment fields, filterable by default via the {@see 'comment_form_default_fields'} hook.
  2053. *
  2054. * @type string $author Comment author field HTML.
  2055. * @type string $email Comment author email field HTML.
  2056. * @type string $url Comment author URL field HTML.
  2057. * @type string $cookies Comment cookie opt-in field HTML.
  2058. * }
  2059. * @type string $comment_field The comment textarea field HTML.
  2060. * @type string $must_log_in HTML element for a 'must be logged in to comment' message.
  2061. * @type string $logged_in_as HTML element for a 'logged in as [user]' message.
  2062. * @type string $comment_notes_before HTML element for a message displayed before the comment fields
  2063. * if the user is not logged in.
  2064. * Default 'Your email address will not be published.'.
  2065. * @type string $comment_notes_after HTML element for a message displayed after the textarea field.
  2066. * @type string $action The comment form element action attribute. Default '/wp-comments-post.php'.
  2067. * @type string $id_form The comment form element id attribute. Default 'commentform'.
  2068. * @type string $id_submit The comment submit element id attribute. Default 'submit'.
  2069. * @type string $class_container The comment form container class attribute. Default 'comment-respond'.
  2070. * @type string $class_form The comment form element class attribute. Default 'comment-form'.
  2071. * @type string $class_submit The comment submit element class attribute. Default 'submit'.
  2072. * @type string $name_submit The comment submit element name attribute. Default 'submit'.
  2073. * @type string $title_reply The translatable 'reply' button label. Default 'Leave a Reply'.
  2074. * @type string $title_reply_to The translatable 'reply-to' button label. Default 'Leave a Reply to %s',
  2075. * where %s is the author of the comment being replied to.
  2076. * @type string $title_reply_before HTML displayed before the comment form title.
  2077. * Default: '<h3 id="reply-title" class="comment-reply-title">'.
  2078. * @type string $title_reply_after HTML displayed after the comment form title.
  2079. * Default: '</h3>'.
  2080. * @type string $cancel_reply_before HTML displayed before the cancel reply link.
  2081. * @type string $cancel_reply_after HTML displayed after the cancel reply link.
  2082. * @type string $cancel_reply_link The translatable 'cancel reply' button label. Default 'Cancel reply'.
  2083. * @type string $label_submit The translatable 'submit' button label. Default 'Post a comment'.
  2084. * @type string $submit_button HTML format for the Submit button.
  2085. * Default: '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />'.
  2086. * @type string $submit_field HTML format for the markup surrounding the Submit button and comment hidden
  2087. * fields. Default: '<p class="form-submit">%1$s %2$s</p>', where %1$s is the
  2088. * submit button markup and %2$s is the comment hidden fields.
  2089. * @type string $format The comment form format. Default 'xhtml'. Accepts 'xhtml', 'html5'.
  2090. * }
  2091. * @param int|WP_Post $post_id Post ID or WP_Post object to generate the form for. Default current post.
  2092. */
  2093. function comment_form( $args = array(), $post_id = null ) {
  2094. if ( null === $post_id ) {
  2095. $post_id = get_the_ID();
  2096. }
  2097. // Exit the function when comments for the post are closed.
  2098. if ( ! comments_open( $post_id ) ) {
  2099. /**
  2100. * Fires after the comment form if comments are closed.
  2101. *
  2102. * @since 3.0.0
  2103. */
  2104. do_action( 'comment_form_comments_closed' );
  2105. return;
  2106. }
  2107. $commenter = wp_get_current_commenter();
  2108. $user = wp_get_current_user();
  2109. $user_identity = $user->exists() ? $user->display_name : '';
  2110. $args = wp_parse_args( $args );
  2111. if ( ! isset( $args['format'] ) ) {
  2112. $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml';
  2113. }
  2114. $req = get_option( 'require_name_email' );
  2115. $html5 = 'html5' === $args['format'];
  2116. // Define attributes in HTML5 or XHTML syntax.
  2117. $required_attribute = ( $html5 ? ' required' : ' required="required"' );
  2118. $checked_attribute = ( $html5 ? ' checked' : ' checked="checked"' );
  2119. // Identify required fields visually.
  2120. $required_indicator = ' <span class="required" aria-hidden="true">*</span>';
  2121. $fields = array(
  2122. 'author' => sprintf(
  2123. '<p class="comment-form-author">%s %s</p>',
  2124. sprintf(
  2125. '<label for="author">%s%s</label>',
  2126. __( 'Name' ),
  2127. ( $req ? $required_indicator : '' )
  2128. ),
  2129. sprintf(
  2130. '<input id="author" name="author" type="text" value="%s" size="30" maxlength="245"%s />',
  2131. esc_attr( $commenter['comment_author'] ),
  2132. ( $req ? $required_attribute : '' )
  2133. )
  2134. ),
  2135. 'email' => sprintf(
  2136. '<p class="comment-form-email">%s %s</p>',
  2137. sprintf(
  2138. '<label for="email">%s%s</label>',
  2139. __( 'Email' ),
  2140. ( $req ? $required_indicator : '' )
  2141. ),
  2142. sprintf(
  2143. '<input id="email" name="email" %s value="%s" size="30" maxlength="100" aria-describedby="email-notes"%s />',
  2144. ( $html5 ? 'type="email"' : 'type="text"' ),
  2145. esc_attr( $commenter['comment_author_email'] ),
  2146. ( $req ? $required_attribute : '' )
  2147. )
  2148. ),
  2149. 'url' => sprintf(
  2150. '<p class="comment-form-url">%s %s</p>',
  2151. sprintf(
  2152. '<label for="url">%s</label>',
  2153. __( 'Website' )
  2154. ),
  2155. sprintf(
  2156. '<input id="url" name="url" %s value="%s" size="30" maxlength="200" />',
  2157. ( $html5 ? 'type="url"' : 'type="text"' ),
  2158. esc_attr( $commenter['comment_author_url'] )
  2159. )
  2160. ),
  2161. );
  2162. if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) {
  2163. $consent = empty( $commenter['comment_author_email'] ) ? '' : $checked_attribute;
  2164. $fields['cookies'] = sprintf(
  2165. '<p class="comment-form-cookies-consent">%s %s</p>',
  2166. sprintf(
  2167. '<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"%s />',
  2168. $consent
  2169. ),
  2170. sprintf(
  2171. '<label for="wp-comment-cookies-consent">%s</label>',
  2172. __( 'Save my name, email, and website in this browser for the next time I comment.' )
  2173. )
  2174. );
  2175. // Ensure that the passed fields include cookies consent.
  2176. if ( isset( $args['fields'] ) && ! isset( $args['fields']['cookies'] ) ) {
  2177. $args['fields']['cookies'] = $fields['cookies'];
  2178. }
  2179. }
  2180. $required_text = sprintf(
  2181. /* translators: %s: Asterisk symbol (*). */
  2182. ' <span class="required-field-message" aria-hidden="true">' . __( 'Required fields are marked %s' ) . '</span>',
  2183. trim( $required_indicator )
  2184. );
  2185. /**
  2186. * Filters the default comment form fields.
  2187. *
  2188. * @since 3.0.0
  2189. *
  2190. * @param string[] $fields Array of the default comment fields.
  2191. */
  2192. $fields = apply_filters( 'comment_form_default_fields', $fields );
  2193. $defaults = array(
  2194. 'fields' => $fields,
  2195. 'comment_field' => sprintf(
  2196. '<p class="comment-form-comment">%s %s</p>',
  2197. sprintf(
  2198. '<label for="comment">%s%s</label>',
  2199. _x( 'Comment', 'noun' ),
  2200. $required_indicator
  2201. ),
  2202. '<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525"' . $required_attribute . '></textarea>'
  2203. ),
  2204. 'must_log_in' => sprintf(
  2205. '<p class="must-log-in">%s</p>',
  2206. sprintf(
  2207. /* translators: %s: Login URL. */
  2208. __( 'You must be <a href="%s">logged in</a> to post a comment.' ),
  2209. /** This filter is documented in wp-includes/link-template.php */
  2210. wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
  2211. )
  2212. ),
  2213. 'logged_in_as' => sprintf(
  2214. '<p class="logged-in-as">%s%s</p>',
  2215. sprintf(
  2216. /* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */
  2217. __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
  2218. get_edit_user_link(),
  2219. /* translators: %s: User name. */
  2220. esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
  2221. $user_identity,
  2222. /** This filter is documented in wp-includes/link-template.php */
  2223. wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
  2224. ),
  2225. $required_text
  2226. ),
  2227. 'comment_notes_before' => sprintf(
  2228. '<p class="comment-notes">%s%s</p>',
  2229. sprintf(
  2230. '<span id="email-notes">%s</span>',
  2231. __( 'Your email address will not be published.' )
  2232. ),
  2233. $required_text
  2234. ),
  2235. 'comment_notes_after' => '',
  2236. 'action' => site_url( '/wp-comments-post.php' ),
  2237. 'id_form' => 'commentform',
  2238. 'id_submit' => 'submit',
  2239. 'class_container' => 'comment-respond',
  2240. 'class_form' => 'comment-form',
  2241. 'class_submit' => 'submit',
  2242. 'name_submit' => 'submit',
  2243. 'title_reply' => __( 'Leave a Reply' ),
  2244. /* translators: %s: Author of the comment being replied to. */
  2245. 'title_reply_to' => __( 'Leave a Reply to %s' ),
  2246. 'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title">',
  2247. 'title_reply_after' => '</h3>',
  2248. 'cancel_reply_before' => ' <small>',
  2249. 'cancel_reply_after' => '</small>',
  2250. 'cancel_reply_link' => __( 'Cancel reply' ),
  2251. 'label_submit' => __( 'Post Comment' ),
  2252. 'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />',
  2253. 'submit_field' => '<p class="form-submit">%1$s %2$s</p>',
  2254. 'format' => 'xhtml',
  2255. );
  2256. /**
  2257. * Filters the comment form default arguments.
  2258. *
  2259. * Use {@see 'comment_form_default_fields'} to filter the comment fields.
  2260. *
  2261. * @since 3.0.0
  2262. *
  2263. * @param array $defaults The default comment form arguments.
  2264. */
  2265. $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );
  2266. // Ensure that the filtered arguments contain all required default values.
  2267. $args = array_merge( $defaults, $args );
  2268. // Remove `aria-describedby` from the email field if there's no associated description.
  2269. if ( isset( $args['fields']['email'] ) && false === strpos( $args['comment_notes_before'], 'id="email-notes"' ) ) {
  2270. $args['fields']['email'] = str_replace(
  2271. ' aria-describedby="email-notes"',
  2272. '',
  2273. $args['fields']['email']
  2274. );
  2275. }
  2276. /**
  2277. * Fires before the comment form.
  2278. *
  2279. * @since 3.0.0
  2280. */
  2281. do_action( 'comment_form_before' );
  2282. ?>
  2283. <div id="respond" class="<?php echo esc_attr( $args['class_container'] ); ?>">
  2284. <?php
  2285. echo $args['title_reply_before'];
  2286. comment_form_title( $args['title_reply'], $args['title_reply_to'] );
  2287. if ( get_option( 'thread_comments' ) ) {
  2288. echo $args['cancel_reply_before'];
  2289. cancel_comment_reply_link( $args['cancel_reply_link'] );
  2290. echo $args['cancel_reply_after'];
  2291. }
  2292. echo $args['title_reply_after'];
  2293. if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) :
  2294. echo $args['must_log_in'];
  2295. /**
  2296. * Fires after the HTML-formatted 'must log in after' message in the comment form.
  2297. *
  2298. * @since 3.0.0
  2299. */
  2300. do_action( 'comment_form_must_log_in_after' );
  2301. else :
  2302. printf(
  2303. '<form action="%s" method="post" id="%s" class="%s"%s>',
  2304. esc_url( $args['action'] ),
  2305. esc_attr( $args['id_form'] ),
  2306. esc_attr( $args['class_form'] ),
  2307. ( $html5 ? ' novalidate' : '' )
  2308. );
  2309. /**
  2310. * Fires at the top of the comment form, inside the form tag.
  2311. *
  2312. * @since 3.0.0
  2313. */
  2314. do_action( 'comment_form_top' );
  2315. if ( is_user_logged_in() ) :
  2316. /**
  2317. * Filters the 'logged in' message for the comment form for display.
  2318. *
  2319. * @since 3.0.0
  2320. *
  2321. * @param string $args_logged_in The logged-in-as HTML-formatted message.
  2322. * @param array $commenter An array containing the comment author's
  2323. * username, email, and URL.
  2324. * @param string $user_identity If the commenter is a registered user,
  2325. * the display name, blank otherwise.
  2326. */
  2327. echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity );
  2328. /**
  2329. * Fires after the is_user_logged_in() check in the comment form.
  2330. *
  2331. * @since 3.0.0
  2332. *
  2333. * @param array $commenter An array containing the comment author's
  2334. * username, email, and URL.
  2335. * @param string $user_identity If the commenter is a registered user,
  2336. * the display name, blank otherwise.
  2337. */
  2338. do_action( 'comment_form_logged_in_after', $commenter, $user_identity );
  2339. else :
  2340. echo $args['comment_notes_before'];
  2341. endif;
  2342. // Prepare an array of all fields, including the textarea.
  2343. $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields'];
  2344. /**
  2345. * Filters the comment form fields, including the textarea.
  2346. *
  2347. * @since 4.4.0
  2348. *
  2349. * @param array $comment_fields The comment fields.
  2350. */
  2351. $comment_fields = apply_filters( 'comment_form_fields', $comment_fields );
  2352. // Get an array of field names, excluding the textarea.
  2353. $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) );
  2354. // Get the first and the last field name, excluding the textarea.
  2355. $first_field = reset( $comment_field_keys );
  2356. $last_field = end( $comment_field_keys );
  2357. foreach ( $comment_fields as $name => $field ) {
  2358. if ( 'comment' === $name ) {
  2359. /**
  2360. * Filters the content of the comment textarea field for display.
  2361. *
  2362. * @since 3.0.0
  2363. *
  2364. * @param string $args_comment_field The content of the comment textarea field.
  2365. */
  2366. echo apply_filters( 'comment_form_field_comment', $field );
  2367. echo $args['comment_notes_after'];
  2368. } elseif ( ! is_user_logged_in() ) {
  2369. if ( $first_field === $name ) {
  2370. /**
  2371. * Fires before the comment fields in the comment form, excluding the textarea.
  2372. *
  2373. * @since 3.0.0
  2374. */
  2375. do_action( 'comment_form_before_fields' );
  2376. }
  2377. /**
  2378. * Filters a comment form field for display.
  2379. *
  2380. * The dynamic portion of the hook name, `$name`, refers to the name
  2381. * of the comment form field.
  2382. *
  2383. * Possible hook names include:
  2384. *
  2385. * - `comment_form_field_comment`
  2386. * - `comment_form_field_author`
  2387. * - `comment_form_field_email`
  2388. * - `comment_form_field_url`
  2389. * - `comment_form_field_cookies`
  2390. *
  2391. * @since 3.0.0
  2392. *
  2393. * @param string $field The HTML-formatted output of the comment form field.
  2394. */
  2395. echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
  2396. if ( $last_field === $name ) {
  2397. /**
  2398. * Fires after the comment fields in the comment form, excluding the textarea.
  2399. *
  2400. * @since 3.0.0
  2401. */
  2402. do_action( 'comment_form_after_fields' );
  2403. }
  2404. }
  2405. }
  2406. $submit_button = sprintf(
  2407. $args['submit_button'],
  2408. esc_attr( $args['name_submit'] ),
  2409. esc_attr( $args['id_submit'] ),
  2410. esc_attr( $args['class_submit'] ),
  2411. esc_attr( $args['label_submit'] )
  2412. );
  2413. /**
  2414. * Filters the submit button for the comment form to display.
  2415. *
  2416. * @since 4.2.0
  2417. *
  2418. * @param string $submit_button HTML markup for the submit button.
  2419. * @param array $args Arguments passed to comment_form().
  2420. */
  2421. $submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args );
  2422. $submit_field = sprintf(
  2423. $args['submit_field'],
  2424. $submit_button,
  2425. get_comment_id_fields( $post_id )
  2426. );
  2427. /**
  2428. * Filters the submit field for the comment form to display.
  2429. *
  2430. * The submit field includes the submit button, hidden fields for the
  2431. * comment form, and any wrapper markup.
  2432. *
  2433. * @since 4.2.0
  2434. *
  2435. * @param string $submit_field HTML markup for the submit field.
  2436. * @param array $args Arguments passed to comment_form().
  2437. */
  2438. echo apply_filters( 'comment_form_submit_field', $submit_field, $args );
  2439. /**
  2440. * Fires at the bottom of the comment form, inside the closing form tag.
  2441. *
  2442. * @since 1.5.0
  2443. *
  2444. * @param int $post_id The post ID.
  2445. */
  2446. do_action( 'comment_form', $post_id );
  2447. echo '</form>';
  2448. endif;
  2449. ?>
  2450. </div><!-- #respond -->
  2451. <?php
  2452. /**
  2453. * Fires after the comment form.
  2454. *
  2455. * @since 3.0.0
  2456. */
  2457. do_action( 'comment_form_after' );
  2458. }