securemark 0.299.3 → 0.299.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/index.js +2054 -2095
- package/index.ts +2 -2
- package/package.json +1 -1
- package/src/{parser/api → api}/bind.test.ts +2 -2
- package/src/{parser/api → api}/bind.ts +5 -5
- package/src/{parser/api → api}/body.test.ts +1 -1
- package/src/{parser/api → api}/cache.ts +1 -1
- package/src/{parser/api → api}/header.test.ts +1 -1
- package/src/{parser/api → api}/header.ts +2 -2
- package/src/{parser/api → api}/normalize.test.ts +1 -1
- package/src/{parser/api → api}/parse.test.ts +3 -3
- package/src/{parser/api → api}/parse.ts +5 -5
- package/src/combinator/data/{node.ts → list/list.ts} +4 -4
- package/src/combinator/data/parser/inits.ts +3 -3
- package/src/combinator/data/parser/sequence.ts +3 -3
- package/src/combinator/data/parser/subsequence.ts +3 -3
- package/src/combinator/data/parser/tails.ts +3 -3
- package/src/combinator/data/parser.ts +1 -1
- package/src/parser/block/blockquote.ts +1 -1
- package/src/parser/block/extension/aside.ts +1 -1
- package/src/parser/block/extension/example.ts +1 -1
- package/src/parser/inline/link.ts +2 -2
- package/src/parser/inline/media.ts +1 -1
- package/src/parser/node.ts +1 -1
- package/src/parser/visibility.ts +1 -1
- package/src/{parser/processor → processor}/figure.test.ts +4 -4
- package/src/{parser/processor → processor}/figure.ts +2 -2
- package/src/{parser/processor → processor}/note.test.ts +3 -3
- package/src/{parser/processor → processor}/note.ts +2 -2
- package/src/renderer/render/media/pdf.ts +1 -1
- package/src/renderer/render/media/twitter.ts +1 -1
- package/src/renderer/render/media.test.ts +1 -2
- package/src/renderer/render.test.ts +1 -1
- package/src/util/info.test.ts +1 -1
- package/src/util/quote.test.ts +1 -1
- package/src/util/toc.test.ts +1 -1
- package/src/parser.ts +0 -1
- /package/src/{parser/api → api}/body.ts +0 -0
- /package/src/{parser/api → api}/normalize.ts +0 -0
- /package/src/{parser/api.ts → api.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.299.
|
|
1
|
+
/*! securemark v0.299.4 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -41,9 +41,9 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
41
41
|
value: true
|
|
42
42
|
}));
|
|
43
43
|
__webpack_require__(518);
|
|
44
|
-
__exportStar(__webpack_require__(
|
|
45
|
-
__exportStar(__webpack_require__(2570), exports);
|
|
44
|
+
__exportStar(__webpack_require__(3972), exports);
|
|
46
45
|
__exportStar(__webpack_require__(1625), exports);
|
|
46
|
+
__exportStar(__webpack_require__(2570), exports);
|
|
47
47
|
|
|
48
48
|
/***/ },
|
|
49
49
|
|
|
@@ -2321,229 +2321,68 @@ class ReadonlyURLSearchParams extends URLSearchParams {
|
|
|
2321
2321
|
|
|
2322
2322
|
/***/ },
|
|
2323
2323
|
|
|
2324
|
-
/***/
|
|
2324
|
+
/***/ 3972
|
|
2325
2325
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2326
2326
|
|
|
2327
2327
|
"use strict";
|
|
2328
2328
|
|
|
2329
2329
|
|
|
2330
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
2331
|
-
if (k2 === undefined) k2 = k;
|
|
2332
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2333
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2334
|
-
desc = {
|
|
2335
|
-
enumerable: true,
|
|
2336
|
-
get: function () {
|
|
2337
|
-
return m[k];
|
|
2338
|
-
}
|
|
2339
|
-
};
|
|
2340
|
-
}
|
|
2341
|
-
Object.defineProperty(o, k2, desc);
|
|
2342
|
-
} : function (o, m, k, k2) {
|
|
2343
|
-
if (k2 === undefined) k2 = k;
|
|
2344
|
-
o[k2] = m[k];
|
|
2345
|
-
});
|
|
2346
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
2347
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2348
|
-
};
|
|
2349
2330
|
Object.defineProperty(exports, "__esModule", ({
|
|
2350
2331
|
value: true
|
|
2351
2332
|
}));
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
__exportStar(__webpack_require__(8212), exports);
|
|
2360
|
-
__exportStar(__webpack_require__(8287), exports);
|
|
2361
|
-
__exportStar(__webpack_require__(4271), exports);
|
|
2362
|
-
__exportStar(__webpack_require__(7190), exports);
|
|
2363
|
-
__exportStar(__webpack_require__(549), exports);
|
|
2364
|
-
__exportStar(__webpack_require__(7723), exports);
|
|
2365
|
-
__exportStar(__webpack_require__(8606), exports);
|
|
2366
|
-
__exportStar(__webpack_require__(5781), exports);
|
|
2367
|
-
__exportStar(__webpack_require__(1638), exports);
|
|
2368
|
-
__exportStar(__webpack_require__(6572), exports);
|
|
2369
|
-
__exportStar(__webpack_require__(4750), exports);
|
|
2370
|
-
__exportStar(__webpack_require__(2217), exports);
|
|
2371
|
-
__exportStar(__webpack_require__(5117), exports);
|
|
2372
|
-
__exportStar(__webpack_require__(1672), exports);
|
|
2373
|
-
__exportStar(__webpack_require__(6981), exports);
|
|
2374
|
-
__exportStar(__webpack_require__(2705), exports);
|
|
2375
|
-
__exportStar(__webpack_require__(994), exports);
|
|
2376
|
-
|
|
2377
|
-
/***/ },
|
|
2378
|
-
|
|
2379
|
-
/***/ 8212
|
|
2380
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2381
|
-
|
|
2382
|
-
"use strict";
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
2386
|
-
value: true
|
|
2333
|
+
exports.normalize = exports.body = exports.headers = exports.header = exports.caches = exports.bind = exports.parse = void 0;
|
|
2334
|
+
var parse_1 = __webpack_require__(2032);
|
|
2335
|
+
Object.defineProperty(exports, "parse", ({
|
|
2336
|
+
enumerable: true,
|
|
2337
|
+
get: function () {
|
|
2338
|
+
return parse_1.parse;
|
|
2339
|
+
}
|
|
2387
2340
|
}));
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
function
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
const {
|
|
2395
|
-
source,
|
|
2396
|
-
position
|
|
2397
|
-
} = context;
|
|
2398
|
-
if (position === source.length) return;
|
|
2399
|
-
if (segment !== 0 && context.segment & 1 /* Segment.write */) {
|
|
2400
|
-
if (context.segment !== (segment | 1 /* Segment.write */)) return;
|
|
2401
|
-
context.position = source.length;
|
|
2402
|
-
return new parser_1.List();
|
|
2403
|
-
}
|
|
2404
|
-
const result = parser(input);
|
|
2405
|
-
if (result === undefined || separation && !(0, line_1.isEmptyline)(source, context.position)) {
|
|
2406
|
-
context.position = position;
|
|
2407
|
-
return;
|
|
2408
|
-
}
|
|
2409
|
-
if (segment !== 0 && context.segment & 1 /* Segment.write */ ^ 1 /* Segment.write */) {
|
|
2410
|
-
context.segment = segment;
|
|
2411
|
-
}
|
|
2412
|
-
return result;
|
|
2413
|
-
};
|
|
2414
|
-
}
|
|
2415
|
-
exports.block = block;
|
|
2416
|
-
|
|
2417
|
-
/***/ },
|
|
2418
|
-
|
|
2419
|
-
/***/ 4271
|
|
2420
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2421
|
-
|
|
2422
|
-
"use strict";
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
2426
|
-
value: true
|
|
2341
|
+
var bind_1 = __webpack_require__(8012);
|
|
2342
|
+
Object.defineProperty(exports, "bind", ({
|
|
2343
|
+
enumerable: true,
|
|
2344
|
+
get: function () {
|
|
2345
|
+
return bind_1.bind;
|
|
2346
|
+
}
|
|
2427
2347
|
}));
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
function
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
return input => test(input) && parser(input);
|
|
2435
|
-
}
|
|
2436
|
-
exports.validate = validate;
|
|
2437
|
-
function guard(f, parser) {
|
|
2438
|
-
return input => f(input) ? parser(input) : undefined;
|
|
2439
|
-
}
|
|
2440
|
-
function verify(parser, cond) {
|
|
2441
|
-
return (0, bind_1.bind)(parser, (nodes, context) => cond(nodes, context) ? nodes : undefined);
|
|
2442
|
-
}
|
|
2443
|
-
exports.verify = verify;
|
|
2444
|
-
|
|
2445
|
-
/***/ },
|
|
2446
|
-
|
|
2447
|
-
/***/ 8287
|
|
2448
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2449
|
-
|
|
2450
|
-
"use strict";
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
2454
|
-
value: true
|
|
2348
|
+
var cache_1 = __webpack_require__(4197);
|
|
2349
|
+
Object.defineProperty(exports, "caches", ({
|
|
2350
|
+
enumerable: true,
|
|
2351
|
+
get: function () {
|
|
2352
|
+
return cache_1.caches;
|
|
2353
|
+
}
|
|
2455
2354
|
}));
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
position
|
|
2463
|
-
} = context;
|
|
2464
|
-
if (position === source.length) return;
|
|
2465
|
-
const line = firstline(source, position);
|
|
2466
|
-
context.offset += position;
|
|
2467
|
-
const result = parser((0, parser_1.input)(line, context));
|
|
2468
|
-
context.source = source;
|
|
2469
|
-
context.position = result ? context.position === 0 ? position + line.length : position + context.position : position;
|
|
2470
|
-
context.offset -= position;
|
|
2471
|
-
if (result === undefined || context.position < position + line.length && !isEmptyline(source, context.position)) {
|
|
2472
|
-
context.position = position;
|
|
2473
|
-
return;
|
|
2474
|
-
}
|
|
2475
|
-
context.position = position + line.length;
|
|
2476
|
-
return result;
|
|
2477
|
-
};
|
|
2478
|
-
}
|
|
2479
|
-
exports.line = line;
|
|
2480
|
-
function firstline(source, position) {
|
|
2481
|
-
const i = source.indexOf('\n', position);
|
|
2482
|
-
return i === -1 ? source.slice(position) : source.slice(position, i + 1);
|
|
2483
|
-
}
|
|
2484
|
-
exports.firstline = firstline;
|
|
2485
|
-
const emptyline = /[^\S\r\n]*(?:$|\r?\n)/y;
|
|
2486
|
-
function isEmptyline(source, position) {
|
|
2487
|
-
emptyline.lastIndex = position;
|
|
2488
|
-
return source.length === position || source[position] === '\n' || emptyline.test(source);
|
|
2489
|
-
}
|
|
2490
|
-
exports.isEmptyline = isEmptyline;
|
|
2491
|
-
|
|
2492
|
-
/***/ },
|
|
2493
|
-
|
|
2494
|
-
/***/ 8606
|
|
2495
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2496
|
-
|
|
2497
|
-
"use strict";
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
2501
|
-
value: true
|
|
2355
|
+
var header_1 = __webpack_require__(8206);
|
|
2356
|
+
Object.defineProperty(exports, "header", ({
|
|
2357
|
+
enumerable: true,
|
|
2358
|
+
get: function () {
|
|
2359
|
+
return header_1.header;
|
|
2360
|
+
}
|
|
2502
2361
|
}));
|
|
2503
|
-
exports
|
|
2504
|
-
|
|
2505
|
-
function
|
|
2506
|
-
|
|
2507
|
-
}
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2362
|
+
Object.defineProperty(exports, "headers", ({
|
|
2363
|
+
enumerable: true,
|
|
2364
|
+
get: function () {
|
|
2365
|
+
return header_1.headers;
|
|
2366
|
+
}
|
|
2367
|
+
}));
|
|
2368
|
+
var body_1 = __webpack_require__(8307);
|
|
2369
|
+
Object.defineProperty(exports, "body", ({
|
|
2370
|
+
enumerable: true,
|
|
2371
|
+
get: function () {
|
|
2372
|
+
return body_1.body;
|
|
2373
|
+
}
|
|
2374
|
+
}));
|
|
2375
|
+
var normalize_1 = __webpack_require__(5188);
|
|
2376
|
+
Object.defineProperty(exports, "normalize", ({
|
|
2377
|
+
enumerable: true,
|
|
2378
|
+
get: function () {
|
|
2379
|
+
return normalize_1.normalize;
|
|
2380
|
+
}
|
|
2520
2381
|
}));
|
|
2521
|
-
exports.convert = void 0;
|
|
2522
|
-
const parser_1 = __webpack_require__(605);
|
|
2523
|
-
function convert(conv, parser) {
|
|
2524
|
-
return input => {
|
|
2525
|
-
const context = input;
|
|
2526
|
-
const {
|
|
2527
|
-
source,
|
|
2528
|
-
position,
|
|
2529
|
-
offset
|
|
2530
|
-
} = context;
|
|
2531
|
-
if (position === source.length) return;
|
|
2532
|
-
const src = conv(source.slice(position), context);
|
|
2533
|
-
if (src === '') {
|
|
2534
|
-
context.position = source.length;
|
|
2535
|
-
return new parser_1.List();
|
|
2536
|
-
}
|
|
2537
|
-
const result = parser((0, parser_1.subinput)(src, context));
|
|
2538
|
-
context.position = result ? context.source.length : position;
|
|
2539
|
-
return result;
|
|
2540
|
-
};
|
|
2541
|
-
}
|
|
2542
|
-
exports.convert = convert;
|
|
2543
2382
|
|
|
2544
2383
|
/***/ },
|
|
2545
2384
|
|
|
2546
|
-
/***/
|
|
2385
|
+
/***/ 8012
|
|
2547
2386
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2548
2387
|
|
|
2549
2388
|
"use strict";
|
|
@@ -2552,17 +2391,180 @@ exports.convert = convert;
|
|
|
2552
2391
|
Object.defineProperty(exports, "__esModule", ({
|
|
2553
2392
|
value: true
|
|
2554
2393
|
}));
|
|
2555
|
-
exports.
|
|
2394
|
+
exports.bind = void 0;
|
|
2395
|
+
const context_1 = __webpack_require__(8669);
|
|
2556
2396
|
const parser_1 = __webpack_require__(605);
|
|
2557
|
-
const
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2397
|
+
const segment_1 = __webpack_require__(3967);
|
|
2398
|
+
const block_1 = __webpack_require__(7099);
|
|
2399
|
+
const header_1 = __webpack_require__(8206);
|
|
2400
|
+
const figure_1 = __webpack_require__(5815);
|
|
2401
|
+
const note_1 = __webpack_require__(8119);
|
|
2402
|
+
const url_1 = __webpack_require__(1904);
|
|
2403
|
+
const array_1 = __webpack_require__(6876);
|
|
2404
|
+
function bind(target, settings) {
|
|
2405
|
+
const options = {
|
|
2406
|
+
...settings,
|
|
2407
|
+
host: settings.host ?? new url_1.ReadonlyURL(location.pathname, location.origin)
|
|
2408
|
+
};
|
|
2409
|
+
if (options.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
|
|
2410
|
+
if (options.host?.origin === 'null') throw new Error(`Invalid host: ${options.host.href}`);
|
|
2411
|
+
const blocks = [];
|
|
2412
|
+
const adds = [];
|
|
2413
|
+
const dels = [];
|
|
2414
|
+
const bottom = target.firstChild;
|
|
2415
|
+
let revision;
|
|
2416
|
+
return {
|
|
2417
|
+
parse,
|
|
2418
|
+
nearest,
|
|
2419
|
+
index
|
|
2420
|
+
};
|
|
2421
|
+
function* parse(source) {
|
|
2422
|
+
if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
|
|
2423
|
+
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
2424
|
+
// @ts-expect-error
|
|
2425
|
+
options.url = url ? new url_1.ReadonlyURL(url) : undefined;
|
|
2426
|
+
const rev = revision = Symbol();
|
|
2427
|
+
const sourceSegments = [];
|
|
2428
|
+
const sourceSegmentAttrs = [];
|
|
2429
|
+
for (const [seg, attr] of (0, segment_1.segment)(source, true)) {
|
|
2430
|
+
sourceSegments.push(seg);
|
|
2431
|
+
sourceSegmentAttrs.push(attr);
|
|
2432
|
+
yield {
|
|
2433
|
+
type: 'segment',
|
|
2434
|
+
value: seg
|
|
2435
|
+
};
|
|
2436
|
+
}
|
|
2437
|
+
const targetSegments = blocks.map(([seg]) => seg);
|
|
2438
|
+
let head = 0;
|
|
2439
|
+
for (; head < targetSegments.length; ++head) {
|
|
2440
|
+
if (blocks[head][2] !== url) break;
|
|
2441
|
+
if (targetSegments[head] !== sourceSegments[head]) break;
|
|
2442
|
+
}
|
|
2443
|
+
if (adds.length + dels.length === 0 && sourceSegments.length === targetSegments.length && head === sourceSegments.length) return;
|
|
2444
|
+
let last = 0;
|
|
2445
|
+
for (; head + last < targetSegments.length && head + last < sourceSegments.length; ++last) {
|
|
2446
|
+
if (blocks[targetSegments.length - last - 1][2] !== url) break;
|
|
2447
|
+
if (targetSegments[targetSegments.length - last - 1] !== sourceSegments[sourceSegments.length - last - 1]) break;
|
|
2448
|
+
}
|
|
2449
|
+
const base = next(head);
|
|
2450
|
+
let index = head;
|
|
2451
|
+
// @ts-expect-error
|
|
2452
|
+
options.header = true;
|
|
2453
|
+
for (; index < sourceSegments.length - last; ++index) {
|
|
2454
|
+
const seg = sourceSegments[index];
|
|
2455
|
+
options.segment = sourceSegmentAttrs[index] | 1 /* Segment.write */;
|
|
2456
|
+
const es = (0, block_1.block)((0, parser_1.input)(seg, new context_1.Context(options))).foldl((acc, {
|
|
2457
|
+
value
|
|
2458
|
+
}) => void acc.push(value) || acc, []);
|
|
2459
|
+
// @ts-expect-error
|
|
2460
|
+
options.header = false;
|
|
2461
|
+
blocks.length === index ? blocks.push([seg, es, url]) : blocks.splice(index, 0, [seg, es, url]);
|
|
2462
|
+
if (es.length === 0) continue;
|
|
2463
|
+
// All deletion processes always run after all addition processes have done.
|
|
2464
|
+
// Therefore any `base` node will never be unavailable by deletions until all the dependent `el` nodes are added.
|
|
2465
|
+
adds.push(...es.map(el => [el, base]));
|
|
2466
|
+
adds.reverse();
|
|
2467
|
+
for (; adds.length > 0;) {
|
|
2468
|
+
const [el, base] = adds.pop();
|
|
2469
|
+
target.insertBefore(el, base);
|
|
2470
|
+
yield {
|
|
2471
|
+
type: 'block',
|
|
2472
|
+
value: el
|
|
2473
|
+
};
|
|
2474
|
+
if (rev !== revision) return yield {
|
|
2475
|
+
type: 'cancel'
|
|
2476
|
+
};
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
for (let refuse = (0, array_1.splice)(blocks, index, blocks.length - sourceSegments.length), i = 0; i < refuse.length; ++i) {
|
|
2480
|
+
const es = refuse[i][1];
|
|
2481
|
+
if (es.length === 0) continue;
|
|
2482
|
+
dels.push(...es.map(el => [el]));
|
|
2483
|
+
}
|
|
2484
|
+
adds.reverse();
|
|
2485
|
+
for (; adds.length > 0;) {
|
|
2486
|
+
const [el, base] = adds.pop();
|
|
2487
|
+
target.insertBefore(el, base);
|
|
2488
|
+
yield {
|
|
2489
|
+
type: 'block',
|
|
2490
|
+
value: el
|
|
2491
|
+
};
|
|
2492
|
+
if (rev !== revision) return yield {
|
|
2493
|
+
type: 'cancel'
|
|
2494
|
+
};
|
|
2495
|
+
}
|
|
2496
|
+
dels.reverse();
|
|
2497
|
+
for (; dels.length > 0;) {
|
|
2498
|
+
const [el] = dels.pop();
|
|
2499
|
+
el.parentNode?.removeChild(el);
|
|
2500
|
+
yield {
|
|
2501
|
+
type: 'block',
|
|
2502
|
+
value: el
|
|
2503
|
+
};
|
|
2504
|
+
if (rev !== revision) return yield {
|
|
2505
|
+
type: 'cancel'
|
|
2506
|
+
};
|
|
2507
|
+
}
|
|
2508
|
+
yield {
|
|
2509
|
+
type: 'break'
|
|
2510
|
+
};
|
|
2511
|
+
if (rev !== revision) return yield {
|
|
2512
|
+
type: 'cancel'
|
|
2513
|
+
};
|
|
2514
|
+
for (const el of (0, figure_1.figure)(next(0)?.parentNode ?? target, settings.notes, options)) {
|
|
2515
|
+
el ? yield {
|
|
2516
|
+
type: 'figure',
|
|
2517
|
+
value: el
|
|
2518
|
+
} : yield {
|
|
2519
|
+
type: 'break'
|
|
2520
|
+
};
|
|
2521
|
+
if (rev !== revision) return yield {
|
|
2522
|
+
type: 'cancel'
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
for (const el of (0, note_1.note)(next(0)?.parentNode ?? target, settings.notes, options, bottom)) {
|
|
2526
|
+
el ? yield {
|
|
2527
|
+
type: 'note',
|
|
2528
|
+
value: el
|
|
2529
|
+
} : yield {
|
|
2530
|
+
type: 'break'
|
|
2531
|
+
};
|
|
2532
|
+
if (rev !== revision) return yield {
|
|
2533
|
+
type: 'cancel'
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
function next(index) {
|
|
2538
|
+
for (let i = index; i < blocks.length; ++i) {
|
|
2539
|
+
const [, es] = blocks[i];
|
|
2540
|
+
if (es.length > 0) return es[0];
|
|
2541
|
+
}
|
|
2542
|
+
return bottom;
|
|
2543
|
+
}
|
|
2544
|
+
function nearest(index) {
|
|
2545
|
+
let el;
|
|
2546
|
+
for (let len = 0, i = 0; i < blocks.length; ++i) {
|
|
2547
|
+
const block = blocks[i];
|
|
2548
|
+
len += block[0].length;
|
|
2549
|
+
el = block[1][0] ?? el;
|
|
2550
|
+
if (len >= index) break;
|
|
2551
|
+
}
|
|
2552
|
+
return el;
|
|
2553
|
+
}
|
|
2554
|
+
function index(source) {
|
|
2555
|
+
for (let len = 0, i = 0; i < blocks.length; ++i) {
|
|
2556
|
+
const block = blocks[i];
|
|
2557
|
+
if (block[1].includes(source)) return len;
|
|
2558
|
+
len += block[0].length;
|
|
2559
|
+
}
|
|
2560
|
+
return -1;
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
exports.bind = bind;
|
|
2564
|
+
|
|
2563
2565
|
/***/ },
|
|
2564
2566
|
|
|
2565
|
-
/***/
|
|
2567
|
+
/***/ 8307
|
|
2566
2568
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2567
2569
|
|
|
2568
2570
|
"use strict";
|
|
@@ -2571,16 +2573,16 @@ exports.dup = dup;
|
|
|
2571
2573
|
Object.defineProperty(exports, "__esModule", ({
|
|
2572
2574
|
value: true
|
|
2573
2575
|
}));
|
|
2574
|
-
exports.
|
|
2575
|
-
const
|
|
2576
|
-
function
|
|
2577
|
-
return (0,
|
|
2576
|
+
exports.body = void 0;
|
|
2577
|
+
const header_1 = __webpack_require__(8206);
|
|
2578
|
+
function body(source) {
|
|
2579
|
+
return source.slice((0, header_1.header)(source).length);
|
|
2578
2580
|
}
|
|
2579
|
-
exports.
|
|
2581
|
+
exports.body = body;
|
|
2580
2582
|
|
|
2581
2583
|
/***/ },
|
|
2582
2584
|
|
|
2583
|
-
/***/
|
|
2585
|
+
/***/ 4197
|
|
2584
2586
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2585
2587
|
|
|
2586
2588
|
"use strict";
|
|
@@ -2589,64 +2591,35 @@ exports.fallback = fallback;
|
|
|
2589
2591
|
Object.defineProperty(exports, "__esModule", ({
|
|
2590
2592
|
value: true
|
|
2591
2593
|
}));
|
|
2592
|
-
exports.
|
|
2593
|
-
const
|
|
2594
|
-
const
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
let overflow = '';
|
|
2618
|
-
for (let count = 1;; ++count) {
|
|
2619
|
-
if (context.position === source.length) break;
|
|
2620
|
-
const line = (0, line_1.firstline)(source, context.position);
|
|
2621
|
-
if ((closer || count > limit + 1) && (0, line_1.isEmptyline)(line, 0)) break;
|
|
2622
|
-
if (closer) {
|
|
2623
|
-
overflow += line;
|
|
2624
|
-
}
|
|
2625
|
-
if (!closer && count <= limit + 1 && line.slice(0, delim.length) === delim && line.trimEnd() === delim) {
|
|
2626
|
-
closer = line;
|
|
2627
|
-
if ((0, line_1.isEmptyline)(source, context.position + line.length)) {
|
|
2628
|
-
context.position += line.length;
|
|
2629
|
-
break;
|
|
2630
|
-
}
|
|
2631
|
-
if (!separation) {
|
|
2632
|
-
context.position += line.length;
|
|
2633
|
-
break;
|
|
2634
|
-
}
|
|
2635
|
-
overflow = line;
|
|
2636
|
-
}
|
|
2637
|
-
if (!overflow) {
|
|
2638
|
-
block += line;
|
|
2639
|
-
}
|
|
2640
|
-
context.position += line.length;
|
|
2641
|
-
}
|
|
2642
|
-
return new parser_1.List((0, array_1.push)([block, overflow, closer], matches).map(str => new parser_1.Node(str)));
|
|
2643
|
-
});
|
|
2644
|
-
}
|
|
2645
|
-
exports.fence = fence;
|
|
2594
|
+
exports.caches = void 0;
|
|
2595
|
+
const tclock_1 = __webpack_require__(3307);
|
|
2596
|
+
const tlru_1 = __webpack_require__(8888);
|
|
2597
|
+
// For rerendering in editing.
|
|
2598
|
+
/*
|
|
2599
|
+
同一文書内で複数回使用される可能性が低いデータ: TClock
|
|
2600
|
+
同一文書内で複数回使用される可能性が高いデータ: TLRU
|
|
2601
|
+
|
|
2602
|
+
編集時の再描画高速化が主目的であるためブロックを周期とするループおよび
|
|
2603
|
+
異なるブロックへのジャンプに適したアルゴリズムを使用。
|
|
2604
|
+
キャッシュサイズはブロック内の全データをキャッシュできなければならない。
|
|
2605
|
+
キャッシュサイズは100あれば足りるが10,000までは速度低下しないようなので
|
|
2606
|
+
データサイズを加味して100から1,000とする。
|
|
2607
|
+
遠くで少数の同じデータを高速描画してもあまり意味はない。
|
|
2608
|
+
タイムラインとスレッドのmediaにおいても多数の同一データが長周期で複数回表示
|
|
2609
|
+
される適切な状況はないと思われる。
|
|
2610
|
+
同一投稿は頻繁に再送されてはならずスパムは削除されなければならず
|
|
2611
|
+
ジャーゴンは考慮に値しない。
|
|
2612
|
+
|
|
2613
|
+
*/
|
|
2614
|
+
exports.caches = {
|
|
2615
|
+
code: new tclock_1.TClock(1000),
|
|
2616
|
+
math: new tlru_1.TLRU(1000),
|
|
2617
|
+
media: new tclock_1.TClock(100)
|
|
2618
|
+
};
|
|
2646
2619
|
|
|
2647
2620
|
/***/ },
|
|
2648
2621
|
|
|
2649
|
-
/***/
|
|
2622
|
+
/***/ 8206
|
|
2650
2623
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2651
2624
|
|
|
2652
2625
|
"use strict";
|
|
@@ -2655,39 +2628,36 @@ exports.fence = fence;
|
|
|
2655
2628
|
Object.defineProperty(exports, "__esModule", ({
|
|
2656
2629
|
value: true
|
|
2657
2630
|
}));
|
|
2658
|
-
exports.
|
|
2659
|
-
const
|
|
2660
|
-
const
|
|
2661
|
-
|
|
2662
|
-
const
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
opener = / {1,4}|\t{1,2}/y;
|
|
2631
|
+
exports.headers = exports.header = void 0;
|
|
2632
|
+
const context_1 = __webpack_require__(8669);
|
|
2633
|
+
const header_1 = __webpack_require__(3009);
|
|
2634
|
+
function header(source) {
|
|
2635
|
+
const [, pos = 0] = parse(source);
|
|
2636
|
+
return source.slice(0, pos);
|
|
2637
|
+
}
|
|
2638
|
+
exports.header = header;
|
|
2639
|
+
function headers(source) {
|
|
2640
|
+
const [el] = parse(source);
|
|
2641
|
+
const acc = [];
|
|
2642
|
+
for (let field = el?.firstChild?.firstChild; field = field?.nextSibling;) {
|
|
2643
|
+
acc.push(field.textContent);
|
|
2672
2644
|
}
|
|
2673
|
-
return
|
|
2674
|
-
const {
|
|
2675
|
-
source,
|
|
2676
|
-
position
|
|
2677
|
-
} = context;
|
|
2678
|
-
context.position = source.length;
|
|
2679
|
-
return new parser_1.List([new parser_1.Node(source.slice(position))]);
|
|
2680
|
-
}))), ([indent]) => indent.length * 2 + -(indent[0] === ' '), [], 2 ** 4 - 1)), separation), (lines, context) => parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context))));
|
|
2645
|
+
return acc;
|
|
2681
2646
|
}
|
|
2682
|
-
exports.
|
|
2683
|
-
function
|
|
2684
|
-
|
|
2647
|
+
exports.headers = headers;
|
|
2648
|
+
function parse(source) {
|
|
2649
|
+
const context = new context_1.Context({
|
|
2650
|
+
source
|
|
2651
|
+
});
|
|
2652
|
+
const result = (0, header_1.header)(context);
|
|
2653
|
+
const el = result?.head?.value;
|
|
2654
|
+
return el?.tagName === 'ASIDE' ? [el, context.position] : [];
|
|
2685
2655
|
}
|
|
2686
2656
|
|
|
2687
2657
|
/***/ },
|
|
2688
2658
|
|
|
2689
|
-
/***/
|
|
2690
|
-
(__unused_webpack_module, exports) {
|
|
2659
|
+
/***/ 5188
|
|
2660
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2691
2661
|
|
|
2692
2662
|
"use strict";
|
|
2693
2663
|
|
|
@@ -2695,16 +2665,78 @@ function trimBlockEnd(block) {
|
|
|
2695
2665
|
Object.defineProperty(exports, "__esModule", ({
|
|
2696
2666
|
value: true
|
|
2697
2667
|
}));
|
|
2698
|
-
exports.
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2668
|
+
exports.escape = exports.invisibleGraphHTMLEntityNames = exports.invisibleBlankHTMLEntityNames = exports.normalize = void 0;
|
|
2669
|
+
const dom_1 = __webpack_require__(394);
|
|
2670
|
+
const UNICODE_REPLACEMENT_CHARACTER = '\uFFFD';
|
|
2671
|
+
function normalize(source) {
|
|
2672
|
+
return sanitize(format(source));
|
|
2702
2673
|
}
|
|
2703
|
-
exports.
|
|
2674
|
+
exports.normalize = normalize;
|
|
2675
|
+
function format(source) {
|
|
2676
|
+
return source.replace(/\r\n?|[\u2028\u2029]/g, '\n');
|
|
2677
|
+
}
|
|
2678
|
+
const invalid = new RegExp([/(?![\t\r\n])[\x00-\x1F\x7F]/g.source, /(?![\u200C\u200D])[\u2006\u200B-\u200F\u202A-\u202F\u2060\uFEFF]/g.source
|
|
2679
|
+
// 後読みが重い
|
|
2680
|
+
///(?<![\u1820\u1821])\u180E/g.source,
|
|
2681
|
+
///[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g.source,
|
|
2682
|
+
].join('|'), 'g');
|
|
2683
|
+
function sanitize(source) {
|
|
2684
|
+
return source.replace(invalid, UNICODE_REPLACEMENT_CHARACTER);
|
|
2685
|
+
}
|
|
2686
|
+
// https://dev.w3.org/html5/html-author/charref
|
|
2687
|
+
// https://en.wikipedia.org/wiki/Whitespace_character
|
|
2688
|
+
const invisibleHTMLEntityNames = ['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'shy', 'ensp', 'emsp', 'emsp13', 'emsp14', 'numsp', 'puncsp', 'ThinSpace', 'thinsp', 'VeryThinSpace', 'hairsp', 'ZeroWidthSpace', 'NegativeVeryThinSpace', 'NegativeThinSpace', 'NegativeMediumSpace', 'NegativeThickSpace', 'zwj', 'zwnj', 'lrm', 'rlm', 'MediumSpace', 'NoBreak', 'ApplyFunction', 'af', 'InvisibleTimes', 'it', 'InvisibleComma', 'ic'];
|
|
2689
|
+
const parser = (el => entity => {
|
|
2690
|
+
if (entity === '
') return entity;
|
|
2691
|
+
el.innerHTML = entity;
|
|
2692
|
+
return el.textContent;
|
|
2693
|
+
})((0, dom_1.html)('span'));
|
|
2694
|
+
exports.invisibleBlankHTMLEntityNames = invisibleHTMLEntityNames.filter(name => parser(`&${name};`).trimStart() === '');
|
|
2695
|
+
exports.invisibleGraphHTMLEntityNames = invisibleHTMLEntityNames.filter(name => parser(`&${name};`).trimStart() !== '');
|
|
2696
|
+
const unreadableEscapeHTMLEntityNames = invisibleHTMLEntityNames.filter(name => !['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'zwj', 'zwnj'].includes(name));
|
|
2697
|
+
const unreadableEscapeCharacters = unreadableEscapeHTMLEntityNames.map(name => parser(`&${name};`));
|
|
2698
|
+
const unreadableEscapeCharacter = new RegExp(`[${unreadableEscapeCharacters.join('')}]`, 'g');
|
|
2699
|
+
// https://www.pandanoir.info/entry/2018/03/11/193000
|
|
2700
|
+
// http://anti.rosx.net/etc/memo/002_space.html
|
|
2701
|
+
// http://nicowiki.com/%E7%A9%BA%E7%99%BD%E3%83%BB%E7%89%B9%E6%AE%8A%E8%A8%98%E5%8F%B7.html
|
|
2702
|
+
const unreadableSpecialCharacters = (/* unused pure expression or super */ null && ([
|
|
2703
|
+
// SIX-PER-EM SPACE
|
|
2704
|
+
'\u2006',
|
|
2705
|
+
// ZERO WIDTH SPACE
|
|
2706
|
+
'\u200B',
|
|
2707
|
+
// ZERO WIDTH NON-JOINER
|
|
2708
|
+
//'\u200C',
|
|
2709
|
+
// ZERO WIDTH JOINER
|
|
2710
|
+
//'\u200D',
|
|
2711
|
+
// LEFT-TO-RIGHT MARK
|
|
2712
|
+
'\u200E',
|
|
2713
|
+
// RIGHT-TO-LEFT MARK
|
|
2714
|
+
'\u200F',
|
|
2715
|
+
// LEFT-TO-RIGHT EMBEDDING
|
|
2716
|
+
'\u202A',
|
|
2717
|
+
// RIGHT-TO-LEFT EMBEDDING
|
|
2718
|
+
'\u202B',
|
|
2719
|
+
// POP DIRECTIONAL FORMATTING
|
|
2720
|
+
'\u202C',
|
|
2721
|
+
// LEFT-TO-RIGHT OVERRIDE
|
|
2722
|
+
'\u202D',
|
|
2723
|
+
// RIGHT-TO-LEFT OVERRIDE
|
|
2724
|
+
'\u202E',
|
|
2725
|
+
// NARROW NO-BREAK SPACE
|
|
2726
|
+
'\u202F',
|
|
2727
|
+
// WORD JOINER
|
|
2728
|
+
'\u2060',
|
|
2729
|
+
// ZERO WIDTH NON-BREAKING SPACE
|
|
2730
|
+
'\uFEFF']));
|
|
2731
|
+
// 特殊不可視文字はエディタおよびソースビューアでは等幅および強調表示により可視化する
|
|
2732
|
+
function escape(source) {
|
|
2733
|
+
return source.replace(unreadableEscapeCharacter, char => `&${unreadableEscapeHTMLEntityNames[unreadableEscapeCharacters.indexOf(char)]};`);
|
|
2734
|
+
}
|
|
2735
|
+
exports.escape = escape;
|
|
2704
2736
|
|
|
2705
2737
|
/***/ },
|
|
2706
2738
|
|
|
2707
|
-
/***/
|
|
2739
|
+
/***/ 2032
|
|
2708
2740
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2709
2741
|
|
|
2710
2742
|
"use strict";
|
|
@@ -2713,61 +2745,106 @@ exports.lazy = lazy;
|
|
|
2713
2745
|
Object.defineProperty(exports, "__esModule", ({
|
|
2714
2746
|
value: true
|
|
2715
2747
|
}));
|
|
2716
|
-
exports.
|
|
2717
|
-
const
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2748
|
+
exports.parse = void 0;
|
|
2749
|
+
const parser_1 = __webpack_require__(605);
|
|
2750
|
+
const context_1 = __webpack_require__(8669);
|
|
2751
|
+
const segment_1 = __webpack_require__(3967);
|
|
2752
|
+
const block_1 = __webpack_require__(7099);
|
|
2753
|
+
const header_1 = __webpack_require__(8206);
|
|
2754
|
+
const figure_1 = __webpack_require__(5815);
|
|
2755
|
+
const note_1 = __webpack_require__(8119);
|
|
2756
|
+
const url_1 = __webpack_require__(1904);
|
|
2757
|
+
const dom_1 = __webpack_require__(394);
|
|
2758
|
+
function parse(source, opts = {}, options) {
|
|
2759
|
+
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
2760
|
+
options = {
|
|
2761
|
+
host: opts.host ?? options?.host ?? new url_1.ReadonlyURL(location.pathname, location.origin),
|
|
2762
|
+
url: url ? new url_1.ReadonlyURL(url) : options?.url,
|
|
2763
|
+
id: opts.id ?? options?.id,
|
|
2764
|
+
local: opts.local ?? options?.local ?? false,
|
|
2765
|
+
caches: options?.caches,
|
|
2766
|
+
resources: options?.resources
|
|
2734
2767
|
};
|
|
2768
|
+
if (options.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
|
|
2769
|
+
if (options.host?.origin === 'null') throw new Error(`Invalid host: ${options.host.href}`);
|
|
2770
|
+
const node = (0, dom_1.frag)();
|
|
2771
|
+
// @ts-expect-error
|
|
2772
|
+
options.header = true;
|
|
2773
|
+
for (const [seg, attr] of (0, segment_1.segment)(source, !options.local)) {
|
|
2774
|
+
options.segment = attr | 1 /* Segment.write */;
|
|
2775
|
+
const es = (0, block_1.block)((0, parser_1.input)(seg, new context_1.Context(options))).foldl((acc, {
|
|
2776
|
+
value
|
|
2777
|
+
}) => void acc.push(value) || acc, []);
|
|
2778
|
+
// @ts-expect-error
|
|
2779
|
+
options.header = false;
|
|
2780
|
+
if (es.length === 0) continue;
|
|
2781
|
+
node.append(...es);
|
|
2782
|
+
}
|
|
2783
|
+
if (opts.test) return node;
|
|
2784
|
+
for (const _ of (0, figure_1.figure)(node, opts.notes, options));
|
|
2785
|
+
for (const _ of (0, note_1.note)(node, opts.notes, options));
|
|
2786
|
+
return node;
|
|
2735
2787
|
}
|
|
2736
|
-
exports.
|
|
2788
|
+
exports.parse = parse;
|
|
2737
2789
|
|
|
2738
2790
|
/***/ },
|
|
2739
2791
|
|
|
2740
|
-
/***/
|
|
2741
|
-
(__unused_webpack_module, exports) {
|
|
2792
|
+
/***/ 3484
|
|
2793
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2742
2794
|
|
|
2743
2795
|
"use strict";
|
|
2744
2796
|
|
|
2745
2797
|
|
|
2798
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
2799
|
+
if (k2 === undefined) k2 = k;
|
|
2800
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2801
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2802
|
+
desc = {
|
|
2803
|
+
enumerable: true,
|
|
2804
|
+
get: function () {
|
|
2805
|
+
return m[k];
|
|
2806
|
+
}
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
Object.defineProperty(o, k2, desc);
|
|
2810
|
+
} : function (o, m, k, k2) {
|
|
2811
|
+
if (k2 === undefined) k2 = k;
|
|
2812
|
+
o[k2] = m[k];
|
|
2813
|
+
});
|
|
2814
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
2815
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2816
|
+
};
|
|
2746
2817
|
Object.defineProperty(exports, "__esModule", ({
|
|
2747
2818
|
value: true
|
|
2748
2819
|
}));
|
|
2749
|
-
exports
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
exports
|
|
2820
|
+
__exportStar(__webpack_require__(2369), exports);
|
|
2821
|
+
__exportStar(__webpack_require__(2861), exports);
|
|
2822
|
+
__exportStar(__webpack_require__(765), exports);
|
|
2823
|
+
__exportStar(__webpack_require__(3989), exports);
|
|
2824
|
+
__exportStar(__webpack_require__(7429), exports);
|
|
2825
|
+
__exportStar(__webpack_require__(2148), exports);
|
|
2826
|
+
__exportStar(__webpack_require__(5745), exports);
|
|
2827
|
+
__exportStar(__webpack_require__(8212), exports);
|
|
2828
|
+
__exportStar(__webpack_require__(8287), exports);
|
|
2829
|
+
__exportStar(__webpack_require__(4271), exports);
|
|
2830
|
+
__exportStar(__webpack_require__(7190), exports);
|
|
2831
|
+
__exportStar(__webpack_require__(549), exports);
|
|
2832
|
+
__exportStar(__webpack_require__(7723), exports);
|
|
2833
|
+
__exportStar(__webpack_require__(8606), exports);
|
|
2834
|
+
__exportStar(__webpack_require__(5781), exports);
|
|
2835
|
+
__exportStar(__webpack_require__(1638), exports);
|
|
2836
|
+
__exportStar(__webpack_require__(6572), exports);
|
|
2837
|
+
__exportStar(__webpack_require__(4750), exports);
|
|
2838
|
+
__exportStar(__webpack_require__(2217), exports);
|
|
2839
|
+
__exportStar(__webpack_require__(5117), exports);
|
|
2840
|
+
__exportStar(__webpack_require__(1672), exports);
|
|
2841
|
+
__exportStar(__webpack_require__(6981), exports);
|
|
2842
|
+
__exportStar(__webpack_require__(2705), exports);
|
|
2843
|
+
__exportStar(__webpack_require__(994), exports);
|
|
2767
2844
|
|
|
2768
2845
|
/***/ },
|
|
2769
2846
|
|
|
2770
|
-
/***/
|
|
2847
|
+
/***/ 8212
|
|
2771
2848
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2772
2849
|
|
|
2773
2850
|
"use strict";
|
|
@@ -2776,89 +2853,38 @@ exports.recover = recover;
|
|
|
2776
2853
|
Object.defineProperty(exports, "__esModule", ({
|
|
2777
2854
|
value: true
|
|
2778
2855
|
}));
|
|
2779
|
-
exports.
|
|
2856
|
+
exports.block = void 0;
|
|
2780
2857
|
const parser_1 = __webpack_require__(605);
|
|
2781
|
-
const
|
|
2782
|
-
function
|
|
2783
|
-
return
|
|
2784
|
-
|
|
2785
|
-
exports.reverse = reverse;
|
|
2786
|
-
|
|
2787
|
-
/***/ },
|
|
2788
|
-
|
|
2789
|
-
/***/ 7723
|
|
2790
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2791
|
-
|
|
2792
|
-
"use strict";
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
2796
|
-
value: true
|
|
2797
|
-
}));
|
|
2798
|
-
exports.rewrite = exports.focus = void 0;
|
|
2799
|
-
const parser_1 = __webpack_require__(605);
|
|
2800
|
-
const delimiter_1 = __webpack_require__(385);
|
|
2801
|
-
function focus(scope, parser, slice = true) {
|
|
2802
|
-
const match = (0, delimiter_1.matcher)(scope, false);
|
|
2803
|
-
return (0, parser_1.failsafe)(context => {
|
|
2858
|
+
const line_1 = __webpack_require__(8287);
|
|
2859
|
+
function block(parser, separation = true, segment = 0) {
|
|
2860
|
+
return input => {
|
|
2861
|
+
const context = input;
|
|
2804
2862
|
const {
|
|
2805
|
-
SID,
|
|
2806
2863
|
source,
|
|
2807
2864
|
position
|
|
2808
2865
|
} = context;
|
|
2809
2866
|
if (position === source.length) return;
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
const result = parser(context);
|
|
2815
|
-
context.position += result && context.position === position ? range : 0;
|
|
2816
|
-
return result;
|
|
2867
|
+
if (segment !== 0 && context.segment & 1 /* Segment.write */) {
|
|
2868
|
+
if (context.segment !== (segment | 1 /* Segment.write */)) return;
|
|
2869
|
+
context.position = source.length;
|
|
2870
|
+
return new parser_1.List();
|
|
2817
2871
|
}
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
context.source = source;
|
|
2821
|
-
context.SID = SID;
|
|
2822
|
-
context.position += position;
|
|
2823
|
-
context.position += result && context.position === position ? src.length : 0;
|
|
2824
|
-
context.offset -= position;
|
|
2825
|
-
return result;
|
|
2826
|
-
});
|
|
2827
|
-
}
|
|
2828
|
-
exports.focus = focus;
|
|
2829
|
-
function rewrite(scope, parser, slice = true) {
|
|
2830
|
-
return (0, parser_1.failsafe)(context => {
|
|
2831
|
-
const {
|
|
2832
|
-
SID,
|
|
2833
|
-
source,
|
|
2834
|
-
position
|
|
2835
|
-
} = context;
|
|
2836
|
-
if (position === source.length) return;
|
|
2837
|
-
const res1 = scope(context);
|
|
2838
|
-
if (res1 === undefined || context.position < position) return;
|
|
2839
|
-
const range = context.range = context.position - position;
|
|
2840
|
-
if (!slice) {
|
|
2872
|
+
const result = parser(input);
|
|
2873
|
+
if (result === undefined || separation && !(0, line_1.isEmptyline)(source, context.position)) {
|
|
2841
2874
|
context.position = position;
|
|
2842
|
-
|
|
2843
|
-
context.position += res2 && context.position === position ? range : 0;
|
|
2844
|
-
return res2;
|
|
2875
|
+
return;
|
|
2845
2876
|
}
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
context.position += position;
|
|
2852
|
-
context.position += res2 && context.position === position ? src.length : 0;
|
|
2853
|
-
context.offset -= position;
|
|
2854
|
-
return res2;
|
|
2855
|
-
});
|
|
2877
|
+
if (segment !== 0 && context.segment & 1 /* Segment.write */ ^ 1 /* Segment.write */) {
|
|
2878
|
+
context.segment = segment;
|
|
2879
|
+
}
|
|
2880
|
+
return result;
|
|
2881
|
+
};
|
|
2856
2882
|
}
|
|
2857
|
-
exports.
|
|
2883
|
+
exports.block = block;
|
|
2858
2884
|
|
|
2859
2885
|
/***/ },
|
|
2860
2886
|
|
|
2861
|
-
/***/
|
|
2887
|
+
/***/ 4271
|
|
2862
2888
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2863
2889
|
|
|
2864
2890
|
"use strict";
|
|
@@ -2867,128 +2893,27 @@ exports.rewrite = rewrite;
|
|
|
2867
2893
|
Object.defineProperty(exports, "__esModule", ({
|
|
2868
2894
|
value: true
|
|
2869
2895
|
}));
|
|
2870
|
-
exports.
|
|
2871
|
-
const parser_1 = __webpack_require__(605);
|
|
2896
|
+
exports.verify = exports.validate = void 0;
|
|
2872
2897
|
const delimiter_1 = __webpack_require__(385);
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
}
|
|
2879
|
-
switch (typeof parser) {
|
|
2880
|
-
case 'string':
|
|
2881
|
-
case 'object':
|
|
2882
|
-
parser = (0, delimiter_1.tester)(parser, true);
|
|
2883
|
-
}
|
|
2884
|
-
switch (typeof closer) {
|
|
2885
|
-
case 'string':
|
|
2886
|
-
case 'object':
|
|
2887
|
-
closer = (0, delimiter_1.tester)(closer, true);
|
|
2888
|
-
}
|
|
2889
|
-
const [blen, rbs, wbs] = reduce(backtracks);
|
|
2890
|
-
return (0, parser_1.failsafe)(input => {
|
|
2891
|
-
const context = input;
|
|
2892
|
-
const {
|
|
2893
|
-
source,
|
|
2894
|
-
position
|
|
2895
|
-
} = context;
|
|
2896
|
-
if (position === source.length) return;
|
|
2897
|
-
const {
|
|
2898
|
-
linebreak
|
|
2899
|
-
} = context;
|
|
2900
|
-
context.linebreak = 0;
|
|
2901
|
-
const nodesO = opener(input);
|
|
2902
|
-
if (nodesO === undefined) {
|
|
2903
|
-
return void revert(context, linebreak);
|
|
2904
|
-
}
|
|
2905
|
-
if (rbs && isBacktrack(context, rbs, position, blen)) {
|
|
2906
|
-
return void revert(context, linebreak);
|
|
2907
|
-
}
|
|
2908
|
-
const nodesM = context.position < source.length ? parser(input) : undefined;
|
|
2909
|
-
context.range = context.position - position;
|
|
2910
|
-
if (nodesM === undefined && !optional) {
|
|
2911
|
-
wbs && setBacktrack(context, wbs, position);
|
|
2912
|
-
const result = g?.([nodesO, nodesM], context);
|
|
2913
|
-
return result || void revert(context, linebreak);
|
|
2914
|
-
}
|
|
2915
|
-
const nodesC = optional || nodesM ? closer(input) : undefined;
|
|
2916
|
-
context.range = context.position - position;
|
|
2917
|
-
if (nodesC === undefined) {
|
|
2918
|
-
wbs && setBacktrack(context, wbs, position);
|
|
2919
|
-
const result = g?.([nodesO, nodesM], context);
|
|
2920
|
-
return result || void revert(context, linebreak);
|
|
2921
|
-
}
|
|
2922
|
-
if (context.position === position) {
|
|
2923
|
-
return void revert(context, linebreak);
|
|
2924
|
-
}
|
|
2925
|
-
context.range = context.position - position;
|
|
2926
|
-
const result = f ? f([nodesO, nodesM, nodesC], context) : nodesM ? nodesO.import(nodesM).import(nodesC) : nodesO.import(nodesC);
|
|
2927
|
-
if (result) {
|
|
2928
|
-
context.linebreak ||= linebreak;
|
|
2929
|
-
}
|
|
2930
|
-
return result || void revert(context, linebreak);
|
|
2931
|
-
});
|
|
2932
|
-
}
|
|
2933
|
-
exports.surround = surround;
|
|
2934
|
-
function open(opener, parser, optional, backtracks = []) {
|
|
2935
|
-
return surround(opener, parser, '', optional, backtracks);
|
|
2936
|
-
}
|
|
2937
|
-
exports.open = open;
|
|
2938
|
-
function close(parser, closer, optional, backtracks = []) {
|
|
2939
|
-
return surround('', parser, closer, optional, backtracks);
|
|
2940
|
-
}
|
|
2941
|
-
exports.close = close;
|
|
2942
|
-
const commandsize = 2;
|
|
2943
|
-
function isBacktrack(context, backtrack, position = context.position, length = 1) {
|
|
2944
|
-
const {
|
|
2945
|
-
backtracks,
|
|
2946
|
-
offset
|
|
2947
|
-
} = context;
|
|
2948
|
-
for (let i = 0; i < length; ++i) {
|
|
2949
|
-
if (backtracks[position + i + offset] & backtrack >>> commandsize) return true;
|
|
2950
|
-
}
|
|
2951
|
-
return false;
|
|
2952
|
-
}
|
|
2953
|
-
exports.isBacktrack = isBacktrack;
|
|
2954
|
-
function setBacktrack(context, backtrack, position, length = 1) {
|
|
2955
|
-
// バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
|
|
2956
|
-
|
|
2957
|
-
const {
|
|
2958
|
-
backtracks,
|
|
2959
|
-
offset
|
|
2960
|
-
} = context;
|
|
2961
|
-
for (let i = 0; i < length; ++i) {
|
|
2962
|
-
backtracks[position + i + offset] |= backtrack >>> commandsize;
|
|
2963
|
-
}
|
|
2898
|
+
const bind_1 = __webpack_require__(994);
|
|
2899
|
+
function validate(pattern, parser) {
|
|
2900
|
+
if (typeof pattern === 'function') return guard(pattern, parser);
|
|
2901
|
+
const test = (0, delimiter_1.tester)(pattern, false);
|
|
2902
|
+
return input => test(input) && parser(input);
|
|
2964
2903
|
}
|
|
2965
|
-
exports.
|
|
2966
|
-
function
|
|
2967
|
-
|
|
2968
|
-
let rbs = 0;
|
|
2969
|
-
let wbs = 0;
|
|
2970
|
-
for (const backtrack of backtracks) {
|
|
2971
|
-
if (backtrack >>> commandsize === 0) {
|
|
2972
|
-
len = backtrack;
|
|
2973
|
-
continue;
|
|
2974
|
-
}
|
|
2975
|
-
if (1 & backtrack) {
|
|
2976
|
-
rbs |= backtrack;
|
|
2977
|
-
}
|
|
2978
|
-
if (2 & backtrack) {
|
|
2979
|
-
wbs |= backtrack;
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
|
-
return [len, rbs, wbs];
|
|
2904
|
+
exports.validate = validate;
|
|
2905
|
+
function guard(f, parser) {
|
|
2906
|
+
return input => f(input) ? parser(input) : undefined;
|
|
2983
2907
|
}
|
|
2984
|
-
function
|
|
2985
|
-
|
|
2908
|
+
function verify(parser, cond) {
|
|
2909
|
+
return (0, bind_1.bind)(parser, (nodes, context) => cond(nodes, context) ? nodes : undefined);
|
|
2986
2910
|
}
|
|
2911
|
+
exports.verify = verify;
|
|
2987
2912
|
|
|
2988
2913
|
/***/ },
|
|
2989
2914
|
|
|
2990
|
-
/***/
|
|
2991
|
-
(__unused_webpack_module, exports) {
|
|
2915
|
+
/***/ 8287
|
|
2916
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2992
2917
|
|
|
2993
2918
|
"use strict";
|
|
2994
2919
|
|
|
@@ -2996,34 +2921,45 @@ function revert(context, linebreak) {
|
|
|
2996
2921
|
Object.defineProperty(exports, "__esModule", ({
|
|
2997
2922
|
value: true
|
|
2998
2923
|
}));
|
|
2999
|
-
exports.
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
2924
|
+
exports.isEmptyline = exports.firstline = exports.line = void 0;
|
|
2925
|
+
const parser_1 = __webpack_require__(605);
|
|
2926
|
+
function line(parser) {
|
|
2927
|
+
return context => {
|
|
3003
2928
|
const {
|
|
3004
2929
|
source,
|
|
3005
2930
|
position
|
|
3006
2931
|
} = context;
|
|
3007
2932
|
if (position === source.length) return;
|
|
3008
|
-
const
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
context.
|
|
3014
|
-
|
|
3015
|
-
if (res2 === undefined) {
|
|
2933
|
+
const line = firstline(source, position);
|
|
2934
|
+
context.offset += position;
|
|
2935
|
+
const result = parser((0, parser_1.input)(line, context));
|
|
2936
|
+
context.source = source;
|
|
2937
|
+
context.position = result ? context.position === 0 ? position + line.length : position + context.position : position;
|
|
2938
|
+
context.offset -= position;
|
|
2939
|
+
if (result === undefined || context.position < position + line.length && !isEmptyline(source, context.position)) {
|
|
3016
2940
|
context.position = position;
|
|
3017
2941
|
return;
|
|
3018
2942
|
}
|
|
3019
|
-
|
|
2943
|
+
context.position = position + line.length;
|
|
2944
|
+
return result;
|
|
3020
2945
|
};
|
|
3021
2946
|
}
|
|
3022
|
-
exports.
|
|
2947
|
+
exports.line = line;
|
|
2948
|
+
function firstline(source, position) {
|
|
2949
|
+
const i = source.indexOf('\n', position);
|
|
2950
|
+
return i === -1 ? source.slice(position) : source.slice(position, i + 1);
|
|
2951
|
+
}
|
|
2952
|
+
exports.firstline = firstline;
|
|
2953
|
+
const emptyline = /[^\S\r\n]*(?:$|\r?\n)/y;
|
|
2954
|
+
function isEmptyline(source, position) {
|
|
2955
|
+
emptyline.lastIndex = position;
|
|
2956
|
+
return source.length === position || source[position] === '\n' || emptyline.test(source);
|
|
2957
|
+
}
|
|
2958
|
+
exports.isEmptyline = isEmptyline;
|
|
3023
2959
|
|
|
3024
2960
|
/***/ },
|
|
3025
2961
|
|
|
3026
|
-
/***/
|
|
2962
|
+
/***/ 8606
|
|
3027
2963
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3028
2964
|
|
|
3029
2965
|
"use strict";
|
|
@@ -3032,16 +2968,16 @@ exports.bind = bind;
|
|
|
3032
2968
|
Object.defineProperty(exports, "__esModule", ({
|
|
3033
2969
|
value: true
|
|
3034
2970
|
}));
|
|
3035
|
-
exports.
|
|
3036
|
-
const
|
|
3037
|
-
function
|
|
3038
|
-
return
|
|
2971
|
+
exports.clear = void 0;
|
|
2972
|
+
const parser_1 = __webpack_require__(605);
|
|
2973
|
+
function clear(parser) {
|
|
2974
|
+
return input => parser(input) && new parser_1.List();
|
|
3039
2975
|
}
|
|
3040
|
-
exports.
|
|
2976
|
+
exports.clear = clear;
|
|
3041
2977
|
|
|
3042
2978
|
/***/ },
|
|
3043
2979
|
|
|
3044
|
-
/***/
|
|
2980
|
+
/***/ 6572
|
|
3045
2981
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3046
2982
|
|
|
3047
2983
|
"use strict";
|
|
@@ -3050,261 +2986,136 @@ exports.fmap = fmap;
|
|
|
3050
2986
|
Object.defineProperty(exports, "__esModule", ({
|
|
3051
2987
|
value: true
|
|
3052
2988
|
}));
|
|
3053
|
-
exports.
|
|
2989
|
+
exports.convert = void 0;
|
|
3054
2990
|
const parser_1 = __webpack_require__(605);
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
2991
|
+
function convert(conv, parser) {
|
|
2992
|
+
return input => {
|
|
2993
|
+
const context = input;
|
|
2994
|
+
const {
|
|
2995
|
+
source,
|
|
2996
|
+
position,
|
|
2997
|
+
offset
|
|
2998
|
+
} = context;
|
|
2999
|
+
if (position === source.length) return;
|
|
3000
|
+
const src = conv(source.slice(position), context);
|
|
3001
|
+
if (src === '') {
|
|
3002
|
+
context.position = source.length;
|
|
3003
|
+
return new parser_1.List();
|
|
3004
|
+
}
|
|
3005
|
+
const result = parser((0, parser_1.subinput)(src, context));
|
|
3006
|
+
context.position = result ? context.source.length : position;
|
|
3007
|
+
return result;
|
|
3008
|
+
};
|
|
3009
|
+
}
|
|
3010
|
+
exports.convert = convert;
|
|
3062
3011
|
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3012
|
+
/***/ },
|
|
3013
|
+
|
|
3014
|
+
/***/ 4750
|
|
3015
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3016
|
+
|
|
3017
|
+
"use strict";
|
|
3018
|
+
|
|
3019
|
+
|
|
3020
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3021
|
+
value: true
|
|
3022
|
+
}));
|
|
3023
|
+
exports.dup = void 0;
|
|
3024
|
+
const parser_1 = __webpack_require__(605);
|
|
3025
|
+
const fmap_1 = __webpack_require__(2705);
|
|
3026
|
+
function dup(parser) {
|
|
3027
|
+
return (0, fmap_1.fmap)(parser, nodes => new parser_1.List([new parser_1.Node(nodes)]));
|
|
3070
3028
|
}
|
|
3071
|
-
|
|
3072
|
-
constructor() {
|
|
3073
|
-
this.memories = [];
|
|
3074
|
-
this.delimiters = [];
|
|
3075
|
-
this.stack = [];
|
|
3076
|
-
this.states = [];
|
|
3077
|
-
}
|
|
3078
|
-
// 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
|
|
3079
|
-
static signature(pattern) {
|
|
3080
|
-
switch (typeof pattern) {
|
|
3081
|
-
case 'undefined':
|
|
3082
|
-
return 0;
|
|
3083
|
-
case 'string':
|
|
3084
|
-
return index(`'${pattern}`);
|
|
3085
|
-
case 'object':
|
|
3086
|
-
return index(`/${pattern.source}`);
|
|
3087
|
-
}
|
|
3088
|
-
}
|
|
3089
|
-
static tester(pattern, after) {
|
|
3090
|
-
switch (typeof pattern) {
|
|
3091
|
-
case 'undefined':
|
|
3092
|
-
return () => undefined;
|
|
3093
|
-
case 'string':
|
|
3094
|
-
case 'object':
|
|
3095
|
-
const test = tester(pattern, false);
|
|
3096
|
-
const verify = after ? tester(after, false) : undefined;
|
|
3097
|
-
return verify ? input => test(input) !== undefined && verify(input) !== undefined || undefined : input => test(input) !== undefined || undefined;
|
|
3098
|
-
}
|
|
3099
|
-
}
|
|
3100
|
-
registry(signature) {
|
|
3101
|
-
return this.memories[signature] ??= [];
|
|
3102
|
-
}
|
|
3103
|
-
push(delims) {
|
|
3104
|
-
const {
|
|
3105
|
-
delimiters,
|
|
3106
|
-
stack
|
|
3107
|
-
} = this;
|
|
3108
|
-
// シグネチャ数以下
|
|
3029
|
+
exports.dup = dup;
|
|
3109
3030
|
|
|
3110
|
-
|
|
3111
|
-
const {
|
|
3112
|
-
signature,
|
|
3113
|
-
tester,
|
|
3114
|
-
precedence
|
|
3115
|
-
} = delims[i];
|
|
3116
|
-
const memory = this.registry(signature);
|
|
3117
|
-
const index = memory[0]?.index ?? delimiters.length;
|
|
3118
|
-
if (memory.length === 0) {
|
|
3119
|
-
const delimiter = {
|
|
3120
|
-
memory,
|
|
3121
|
-
index,
|
|
3122
|
-
tester,
|
|
3123
|
-
precedence,
|
|
3124
|
-
state: true
|
|
3125
|
-
};
|
|
3126
|
-
delimiters[index] = delimiter;
|
|
3127
|
-
memory.push(delimiter);
|
|
3128
|
-
stack.push(index);
|
|
3129
|
-
} else {
|
|
3130
|
-
// 現状各優先順位は固定
|
|
3031
|
+
/***/ },
|
|
3131
3032
|
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3033
|
+
/***/ 5117
|
|
3034
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3035
|
+
|
|
3036
|
+
"use strict";
|
|
3037
|
+
|
|
3038
|
+
|
|
3039
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3040
|
+
value: true
|
|
3041
|
+
}));
|
|
3042
|
+
exports.fallback = void 0;
|
|
3043
|
+
const union_1 = __webpack_require__(2369);
|
|
3044
|
+
function fallback(parser, otherwise) {
|
|
3045
|
+
return (0, union_1.union)([parser, otherwise]);
|
|
3046
|
+
}
|
|
3047
|
+
exports.fallback = fallback;
|
|
3048
|
+
|
|
3049
|
+
/***/ },
|
|
3050
|
+
|
|
3051
|
+
/***/ 7190
|
|
3052
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3053
|
+
|
|
3054
|
+
"use strict";
|
|
3055
|
+
|
|
3056
|
+
|
|
3057
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3058
|
+
value: true
|
|
3059
|
+
}));
|
|
3060
|
+
exports.fence = void 0;
|
|
3061
|
+
const parser_1 = __webpack_require__(605);
|
|
3062
|
+
const combinator_1 = __webpack_require__(3484);
|
|
3063
|
+
const line_1 = __webpack_require__(8287);
|
|
3064
|
+
const array_1 = __webpack_require__(6876);
|
|
3065
|
+
function fence(opener, limit, separation = true) {
|
|
3066
|
+
return (0, parser_1.failsafe)(input => {
|
|
3067
|
+
const context = input;
|
|
3137
3068
|
const {
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
} =
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3069
|
+
source,
|
|
3070
|
+
position
|
|
3071
|
+
} = context;
|
|
3072
|
+
if (position === source.length) return;
|
|
3073
|
+
opener.lastIndex = position;
|
|
3074
|
+
const matches = opener.exec(source);
|
|
3075
|
+
if (!matches) return;
|
|
3076
|
+
(0, combinator_1.spend)(context, matches[0].length);
|
|
3077
|
+
const delim = matches[1];
|
|
3078
|
+
if (matches[0].includes(delim, delim.length)) return;
|
|
3079
|
+
context.position += matches[0].length;
|
|
3080
|
+
// Prevent annoying parsing in editing.
|
|
3081
|
+
const secondline = (0, line_1.firstline)(source, context.position);
|
|
3082
|
+
if ((0, line_1.isEmptyline)(secondline, 0) && (0, line_1.firstline)(source, context.position + secondline.length).trimEnd() !== delim) return;
|
|
3083
|
+
let block = '';
|
|
3084
|
+
let closer = '';
|
|
3085
|
+
let overflow = '';
|
|
3086
|
+
for (let count = 1;; ++count) {
|
|
3087
|
+
if (context.position === source.length) break;
|
|
3088
|
+
const line = (0, line_1.firstline)(source, context.position);
|
|
3089
|
+
if ((closer || count > limit + 1) && (0, line_1.isEmptyline)(line, 0)) break;
|
|
3090
|
+
if (closer) {
|
|
3091
|
+
overflow += line;
|
|
3153
3092
|
}
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
}
|
|
3169
|
-
unshift() {
|
|
3170
|
-
const {
|
|
3171
|
-
delimiters
|
|
3172
|
-
} = this;
|
|
3173
|
-
const indexes = this.states.pop();
|
|
3174
|
-
for (let i = indexes.length; i--;) {
|
|
3175
|
-
delimiters[indexes[i]].state = true;
|
|
3176
|
-
}
|
|
3177
|
-
}
|
|
3178
|
-
test(input) {
|
|
3179
|
-
const {
|
|
3180
|
-
precedence
|
|
3181
|
-
} = input;
|
|
3182
|
-
const {
|
|
3183
|
-
delimiters
|
|
3184
|
-
} = this;
|
|
3185
|
-
for (let i = delimiters.length; i--;) {
|
|
3186
|
-
const delimiter = delimiters[i];
|
|
3187
|
-
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3188
|
-
switch (delimiter.tester(input)) {
|
|
3189
|
-
case true:
|
|
3190
|
-
return true;
|
|
3191
|
-
case false:
|
|
3192
|
-
return false;
|
|
3193
|
-
default:
|
|
3194
|
-
continue;
|
|
3093
|
+
if (!closer && count <= limit + 1 && line.slice(0, delim.length) === delim && line.trimEnd() === delim) {
|
|
3094
|
+
closer = line;
|
|
3095
|
+
if ((0, line_1.isEmptyline)(source, context.position + line.length)) {
|
|
3096
|
+
context.position += line.length;
|
|
3097
|
+
break;
|
|
3098
|
+
}
|
|
3099
|
+
if (!separation) {
|
|
3100
|
+
context.position += line.length;
|
|
3101
|
+
break;
|
|
3102
|
+
}
|
|
3103
|
+
overflow = line;
|
|
3104
|
+
}
|
|
3105
|
+
if (!overflow) {
|
|
3106
|
+
block += line;
|
|
3195
3107
|
}
|
|
3108
|
+
context.position += line.length;
|
|
3196
3109
|
}
|
|
3197
|
-
return
|
|
3198
|
-
}
|
|
3110
|
+
return new parser_1.List((0, array_1.push)([block, overflow, closer], matches).map(str => new parser_1.Node(str)));
|
|
3111
|
+
});
|
|
3199
3112
|
}
|
|
3200
|
-
exports.
|
|
3201
|
-
function matcher(pattern, advance, after) {
|
|
3202
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3203
|
-
let sid = 0,
|
|
3204
|
-
pos = 0,
|
|
3205
|
-
index = -1;
|
|
3206
|
-
switch (typeof pattern) {
|
|
3207
|
-
case 'string':
|
|
3208
|
-
if (pattern === '') return () => new parser_1.List([new parser_1.Node(pattern)]);
|
|
3209
|
-
return input => {
|
|
3210
|
-
const context = input;
|
|
3211
|
-
const {
|
|
3212
|
-
SID,
|
|
3213
|
-
source,
|
|
3214
|
-
position
|
|
3215
|
-
} = context;
|
|
3216
|
-
const hit = SID === sid && position === pos;
|
|
3217
|
-
index = hit ? index : source.startsWith(pattern, position) ? position : -1;
|
|
3218
|
-
sid = SID;
|
|
3219
|
-
pos = position;
|
|
3220
|
-
if (index === -1) return;
|
|
3221
|
-
if (advance) {
|
|
3222
|
-
context.position += pattern.length;
|
|
3223
|
-
}
|
|
3224
|
-
const next = after?.(input);
|
|
3225
|
-
return after ? next && new parser_1.List([new parser_1.Node(pattern)]).import(next) : new parser_1.List([new parser_1.Node(pattern)]);
|
|
3226
|
-
};
|
|
3227
|
-
case 'object':
|
|
3228
|
-
return input => {
|
|
3229
|
-
const context = input;
|
|
3230
|
-
const {
|
|
3231
|
-
SID,
|
|
3232
|
-
source,
|
|
3233
|
-
position
|
|
3234
|
-
} = context;
|
|
3235
|
-
const hit = SID === sid && position === pos;
|
|
3236
|
-
pattern.lastIndex = position;
|
|
3237
|
-
index = hit ? index : pattern.test(source) ? pattern.lastIndex : -1;
|
|
3238
|
-
sid = SID;
|
|
3239
|
-
pos = position;
|
|
3240
|
-
if (index === -1) return;
|
|
3241
|
-
const src = source.slice(position, index);
|
|
3242
|
-
count && !hit && (0, context_1.spend)(context, src.length);
|
|
3243
|
-
if (advance) {
|
|
3244
|
-
context.position = index;
|
|
3245
|
-
}
|
|
3246
|
-
const next = after?.(input);
|
|
3247
|
-
return after ? next && new parser_1.List([new parser_1.Node(src)]).import(next) : new parser_1.List([new parser_1.Node(src)]);
|
|
3248
|
-
};
|
|
3249
|
-
}
|
|
3250
|
-
}
|
|
3251
|
-
exports.matcher = matcher;
|
|
3252
|
-
function tester(pattern, advance, after) {
|
|
3253
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3254
|
-
let sid = 0,
|
|
3255
|
-
pos = 0,
|
|
3256
|
-
index = -1;
|
|
3257
|
-
switch (typeof pattern) {
|
|
3258
|
-
case 'string':
|
|
3259
|
-
if (pattern === '') return () => new parser_1.List();
|
|
3260
|
-
return input => {
|
|
3261
|
-
const context = input;
|
|
3262
|
-
const {
|
|
3263
|
-
SID,
|
|
3264
|
-
source,
|
|
3265
|
-
position
|
|
3266
|
-
} = context;
|
|
3267
|
-
const hit = SID === sid && position === pos;
|
|
3268
|
-
index = hit ? index : source.startsWith(pattern, position) ? position : -1;
|
|
3269
|
-
sid = SID;
|
|
3270
|
-
pos = position;
|
|
3271
|
-
if (index === -1) return;
|
|
3272
|
-
if (advance) {
|
|
3273
|
-
context.position += pattern.length;
|
|
3274
|
-
}
|
|
3275
|
-
if (after && after(input) === undefined) return;
|
|
3276
|
-
return new parser_1.List();
|
|
3277
|
-
};
|
|
3278
|
-
case 'object':
|
|
3279
|
-
return input => {
|
|
3280
|
-
const context = input;
|
|
3281
|
-
const {
|
|
3282
|
-
SID,
|
|
3283
|
-
source,
|
|
3284
|
-
position
|
|
3285
|
-
} = context;
|
|
3286
|
-
const hit = SID === sid && position === pos;
|
|
3287
|
-
pattern.lastIndex = position;
|
|
3288
|
-
index = hit ? index : pattern.test(source) ? pattern.lastIndex : -1;
|
|
3289
|
-
sid = SID;
|
|
3290
|
-
pos = position;
|
|
3291
|
-
if (index === -1) return;
|
|
3292
|
-
const len = index - position;
|
|
3293
|
-
count && !hit && (0, context_1.spend)(context, len);
|
|
3294
|
-
if (advance) {
|
|
3295
|
-
context.position = index;
|
|
3296
|
-
}
|
|
3297
|
-
if (after && after(input) === undefined) return;
|
|
3298
|
-
return new parser_1.List();
|
|
3299
|
-
};
|
|
3300
|
-
}
|
|
3301
|
-
}
|
|
3302
|
-
exports.tester = tester;
|
|
3113
|
+
exports.fence = fence;
|
|
3303
3114
|
|
|
3304
3115
|
/***/ },
|
|
3305
3116
|
|
|
3306
|
-
/***/
|
|
3307
|
-
(__unused_webpack_module, exports) {
|
|
3117
|
+
/***/ 549
|
|
3118
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3308
3119
|
|
|
3309
3120
|
"use strict";
|
|
3310
3121
|
|
|
@@ -3312,144 +3123,39 @@ exports.tester = tester;
|
|
|
3312
3123
|
Object.defineProperty(exports, "__esModule", ({
|
|
3313
3124
|
value: true
|
|
3314
3125
|
}));
|
|
3315
|
-
exports.
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
insert(node, before) {
|
|
3330
|
-
if (before === undefined) return this.push(node);
|
|
3331
|
-
if (before === this.head) return this.unshift(node);
|
|
3332
|
-
if (++this.length === 1) {
|
|
3333
|
-
return this.head = this.last = node;
|
|
3334
|
-
}
|
|
3335
|
-
const next = node.next = before;
|
|
3336
|
-
const prev = node.prev = next.prev;
|
|
3337
|
-
return next.prev = prev.next = node;
|
|
3338
|
-
}
|
|
3339
|
-
delete(node) {
|
|
3340
|
-
if (--this.length === 0) {
|
|
3341
|
-
this.head = this.last = undefined;
|
|
3342
|
-
} else {
|
|
3343
|
-
const {
|
|
3344
|
-
next,
|
|
3345
|
-
prev
|
|
3346
|
-
} = node;
|
|
3347
|
-
prev === undefined ? this.head = next : prev.next = next;
|
|
3348
|
-
next === undefined ? this.last = prev : next.prev = prev;
|
|
3349
|
-
}
|
|
3350
|
-
node.next = node.prev = undefined;
|
|
3351
|
-
return node;
|
|
3352
|
-
}
|
|
3353
|
-
unshift(node) {
|
|
3354
|
-
if (++this.length === 1) {
|
|
3355
|
-
return this.head = this.last = node;
|
|
3356
|
-
}
|
|
3357
|
-
node.next = this.head;
|
|
3358
|
-
return this.head = this.head.prev = node;
|
|
3359
|
-
}
|
|
3360
|
-
push(node) {
|
|
3361
|
-
if (++this.length === 1) {
|
|
3362
|
-
return this.head = this.last = node;
|
|
3363
|
-
}
|
|
3364
|
-
node.prev = this.last;
|
|
3365
|
-
return this.last = this.last.next = node;
|
|
3366
|
-
}
|
|
3367
|
-
shift() {
|
|
3368
|
-
if (this.length === 0) return;
|
|
3369
|
-
return this.delete(this.head);
|
|
3370
|
-
}
|
|
3371
|
-
pop() {
|
|
3372
|
-
if (this.length === 0) return;
|
|
3373
|
-
return this.delete(this.last);
|
|
3374
|
-
}
|
|
3375
|
-
import(list, before) {
|
|
3376
|
-
if (list.length === 0) return this;
|
|
3377
|
-
if (this.length === 0) {
|
|
3378
|
-
this.head = list.head;
|
|
3379
|
-
this.last = list.last;
|
|
3380
|
-
this.length = list.length;
|
|
3381
|
-
list.clear();
|
|
3382
|
-
return this;
|
|
3383
|
-
}
|
|
3384
|
-
const head = list.head;
|
|
3385
|
-
const last = list.last;
|
|
3386
|
-
const next = last.next = before;
|
|
3387
|
-
const prev = head.prev = before?.prev ?? this.last;
|
|
3388
|
-
next === undefined ? this.last = last : next.prev = last;
|
|
3389
|
-
prev.next = head;
|
|
3390
|
-
this.length += list.length;
|
|
3391
|
-
list.clear();
|
|
3392
|
-
return this;
|
|
3393
|
-
}
|
|
3394
|
-
clear() {
|
|
3395
|
-
this.length = 0;
|
|
3396
|
-
this.head = this.last = undefined;
|
|
3397
|
-
}
|
|
3398
|
-
*[Symbol.iterator]() {
|
|
3399
|
-
for (let node = this.head; node && this.head;) {
|
|
3400
|
-
const next = node.next;
|
|
3401
|
-
yield node;
|
|
3402
|
-
node = next;
|
|
3403
|
-
}
|
|
3404
|
-
}
|
|
3405
|
-
flatMap(f) {
|
|
3406
|
-
const acc = new List();
|
|
3407
|
-
for (let node = this.head; node && this.head;) {
|
|
3408
|
-
const next = node.next;
|
|
3409
|
-
acc.import(f(node));
|
|
3410
|
-
node = next;
|
|
3411
|
-
}
|
|
3412
|
-
return acc;
|
|
3413
|
-
}
|
|
3414
|
-
foldl(f, acc) {
|
|
3415
|
-
for (let node = this.head; node && this.head;) {
|
|
3416
|
-
const next = node.next;
|
|
3417
|
-
acc = f(acc, node);
|
|
3418
|
-
node = next;
|
|
3419
|
-
}
|
|
3420
|
-
return acc;
|
|
3421
|
-
}
|
|
3422
|
-
foldr(f, acc) {
|
|
3423
|
-
for (let node = this.last; node && this.head;) {
|
|
3424
|
-
const prev = node.prev;
|
|
3425
|
-
acc = f(node, acc);
|
|
3426
|
-
node = prev;
|
|
3427
|
-
}
|
|
3428
|
-
return acc;
|
|
3429
|
-
}
|
|
3430
|
-
find(f) {
|
|
3431
|
-
for (let node = this.head; node && this.head;) {
|
|
3432
|
-
const next = node.next;
|
|
3433
|
-
if (f(node)) return node;
|
|
3434
|
-
node = next;
|
|
3435
|
-
}
|
|
3126
|
+
exports.indent = void 0;
|
|
3127
|
+
const parser_1 = __webpack_require__(605);
|
|
3128
|
+
const some_1 = __webpack_require__(2148);
|
|
3129
|
+
const block_1 = __webpack_require__(8212);
|
|
3130
|
+
const line_1 = __webpack_require__(8287);
|
|
3131
|
+
const bind_1 = __webpack_require__(994);
|
|
3132
|
+
const match_1 = __webpack_require__(1638);
|
|
3133
|
+
const surround_1 = __webpack_require__(5781);
|
|
3134
|
+
const memoize_1 = __webpack_require__(6925);
|
|
3135
|
+
function indent(opener, parser = false, separation = false) {
|
|
3136
|
+
if (typeof opener === 'function') {
|
|
3137
|
+
separation = parser;
|
|
3138
|
+
parser = opener;
|
|
3139
|
+
opener = / {1,4}|\t{1,2}/y;
|
|
3436
3140
|
}
|
|
3141
|
+
return (0, parser_1.failsafe)((0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, context => {
|
|
3142
|
+
const {
|
|
3143
|
+
source,
|
|
3144
|
+
position
|
|
3145
|
+
} = context;
|
|
3146
|
+
context.position = source.length;
|
|
3147
|
+
return new parser_1.List([new parser_1.Node(source.slice(position))]);
|
|
3148
|
+
}))), ([indent]) => indent.length * 2 + -(indent[0] === ' '), [], 2 ** 4 - 1)), separation), (lines, context) => parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context))));
|
|
3149
|
+
}
|
|
3150
|
+
exports.indent = indent;
|
|
3151
|
+
function trimBlockEnd(block) {
|
|
3152
|
+
return block === '' || block.at(-1) !== '\n' ? block : block.slice(0, -1);
|
|
3437
3153
|
}
|
|
3438
|
-
exports.List = List;
|
|
3439
|
-
(function (List) {
|
|
3440
|
-
class Node {
|
|
3441
|
-
constructor() {
|
|
3442
|
-
this.next = undefined;
|
|
3443
|
-
this.prev = undefined;
|
|
3444
|
-
}
|
|
3445
|
-
}
|
|
3446
|
-
List.Node = Node;
|
|
3447
|
-
})(List || (exports.List = List = {}));
|
|
3448
3154
|
|
|
3449
3155
|
/***/ },
|
|
3450
3156
|
|
|
3451
|
-
/***/
|
|
3452
|
-
(__unused_webpack_module, exports
|
|
3157
|
+
/***/ 6981
|
|
3158
|
+
(__unused_webpack_module, exports) {
|
|
3453
3159
|
|
|
3454
3160
|
"use strict";
|
|
3455
3161
|
|
|
@@ -3457,88 +3163,16 @@ exports.List = List;
|
|
|
3457
3163
|
Object.defineProperty(exports, "__esModule", ({
|
|
3458
3164
|
value: true
|
|
3459
3165
|
}));
|
|
3460
|
-
exports.
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
get: function () {
|
|
3465
|
-
return node_1.List;
|
|
3466
|
-
}
|
|
3467
|
-
}));
|
|
3468
|
-
const delimiter_1 = __webpack_require__(385);
|
|
3469
|
-
class Node {
|
|
3470
|
-
constructor(value, flags = 0) {
|
|
3471
|
-
this.value = value;
|
|
3472
|
-
this.flags = flags;
|
|
3473
|
-
this.next = undefined;
|
|
3474
|
-
this.prev = undefined;
|
|
3475
|
-
}
|
|
3476
|
-
}
|
|
3477
|
-
exports.Node = Node;
|
|
3478
|
-
let SID = 0;
|
|
3479
|
-
function sid() {
|
|
3480
|
-
return SID = ++SID >>> 0 || 1;
|
|
3481
|
-
}
|
|
3482
|
-
class Context {
|
|
3483
|
-
constructor({
|
|
3484
|
-
source,
|
|
3485
|
-
position,
|
|
3486
|
-
segment,
|
|
3487
|
-
resources,
|
|
3488
|
-
delimiters,
|
|
3489
|
-
precedence,
|
|
3490
|
-
state,
|
|
3491
|
-
linebreak,
|
|
3492
|
-
range,
|
|
3493
|
-
offset,
|
|
3494
|
-
backtracks
|
|
3495
|
-
} = {}) {
|
|
3496
|
-
this.SID = sid();
|
|
3497
|
-
this.source = source ?? '';
|
|
3498
|
-
this.position = position ?? 0;
|
|
3499
|
-
this.segment = segment ?? 0;
|
|
3500
|
-
this.resources = resources;
|
|
3501
|
-
this.precedence = precedence ?? 0;
|
|
3502
|
-
this.delimiters = delimiters ?? new delimiter_1.Delimiters();
|
|
3503
|
-
this.state = state ?? 0;
|
|
3504
|
-
this.linebreak = linebreak ?? 0;
|
|
3505
|
-
this.range = range ?? 0;
|
|
3506
|
-
this.offset = offset ?? 0;
|
|
3507
|
-
this.backtracks = backtracks ?? {};
|
|
3508
|
-
}
|
|
3509
|
-
clone() {
|
|
3510
|
-
// @ts-ignore
|
|
3511
|
-
return new this.constructor(this);
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
exports.Context = Context;
|
|
3515
|
-
function input(source, context) {
|
|
3516
|
-
context.SID = sid();
|
|
3517
|
-
context.source = source;
|
|
3518
|
-
context.position = 0;
|
|
3519
|
-
return context;
|
|
3520
|
-
}
|
|
3521
|
-
exports.input = input;
|
|
3522
|
-
function subinput(source, context) {
|
|
3523
|
-
const c = context.clone();
|
|
3524
|
-
c.source = source;
|
|
3525
|
-
c.position = 0;
|
|
3526
|
-
c.offset = 0;
|
|
3527
|
-
c.backtracks = {};
|
|
3528
|
-
return c;
|
|
3529
|
-
}
|
|
3530
|
-
exports.subinput = subinput;
|
|
3531
|
-
function failsafe(parser) {
|
|
3532
|
-
return context => {
|
|
3533
|
-
const position = context.position;
|
|
3534
|
-
return parser(context) ?? (context.position = position, undefined);
|
|
3535
|
-
};
|
|
3166
|
+
exports.lazy = void 0;
|
|
3167
|
+
function lazy(builder) {
|
|
3168
|
+
let parser;
|
|
3169
|
+
return input => (parser ??= builder())(input);
|
|
3536
3170
|
}
|
|
3537
|
-
exports.
|
|
3171
|
+
exports.lazy = lazy;
|
|
3538
3172
|
|
|
3539
3173
|
/***/ },
|
|
3540
3174
|
|
|
3541
|
-
/***/
|
|
3175
|
+
/***/ 1638
|
|
3542
3176
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3543
3177
|
|
|
3544
3178
|
"use strict";
|
|
@@ -3547,101 +3181,81 @@ exports.failsafe = failsafe;
|
|
|
3547
3181
|
Object.defineProperty(exports, "__esModule", ({
|
|
3548
3182
|
value: true
|
|
3549
3183
|
}));
|
|
3550
|
-
exports.
|
|
3551
|
-
const
|
|
3552
|
-
function
|
|
3553
|
-
|
|
3554
|
-
const context = input;
|
|
3555
|
-
const result = parser(input);
|
|
3556
|
-
if (result === undefined) return;
|
|
3557
|
-
spend(context, cost);
|
|
3558
|
-
return result;
|
|
3559
|
-
};
|
|
3560
|
-
}
|
|
3561
|
-
exports.creation = creation;
|
|
3562
|
-
function spend(context, cost) {
|
|
3563
|
-
const resources = context.resources ?? {
|
|
3564
|
-
clock: cost || 1,
|
|
3565
|
-
recursions: [1]
|
|
3566
|
-
};
|
|
3567
|
-
if (resources.clock < cost) throw new Error('Too many creations');
|
|
3568
|
-
resources.clock -= cost;
|
|
3569
|
-
}
|
|
3570
|
-
exports.spend = spend;
|
|
3571
|
-
function recursion(index, parser) {
|
|
3184
|
+
exports.match = void 0;
|
|
3185
|
+
const combinator_1 = __webpack_require__(3484);
|
|
3186
|
+
function match(pattern, f) {
|
|
3187
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3572
3188
|
return input => {
|
|
3573
3189
|
const context = input;
|
|
3574
|
-
const resources = context.resources ?? {
|
|
3575
|
-
clock: 1,
|
|
3576
|
-
recursions: [1]
|
|
3577
|
-
};
|
|
3578
3190
|
const {
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3191
|
+
source,
|
|
3192
|
+
position
|
|
3193
|
+
} = context;
|
|
3194
|
+
if (position === source.length) return;
|
|
3195
|
+
pattern.lastIndex = position;
|
|
3196
|
+
const params = pattern.exec(source);
|
|
3197
|
+
if (!params) return;
|
|
3198
|
+
count && (0, combinator_1.spend)(context, params[0].length);
|
|
3199
|
+
const result = f(params)(input);
|
|
3200
|
+
context.position += result ? context.position === position ? params[0].length : 0 : context.position - position;
|
|
3584
3201
|
return result;
|
|
3585
3202
|
};
|
|
3586
3203
|
}
|
|
3587
|
-
exports.
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3204
|
+
exports.match = match;
|
|
3205
|
+
|
|
3206
|
+
/***/ },
|
|
3207
|
+
|
|
3208
|
+
/***/ 1672
|
|
3209
|
+
(__unused_webpack_module, exports) {
|
|
3210
|
+
|
|
3211
|
+
"use strict";
|
|
3212
|
+
|
|
3213
|
+
|
|
3214
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3215
|
+
value: true
|
|
3216
|
+
}));
|
|
3217
|
+
exports.recover = void 0;
|
|
3218
|
+
function recover(parser, catcher) {
|
|
3595
3219
|
return input => {
|
|
3596
3220
|
const context = input;
|
|
3597
3221
|
const {
|
|
3598
|
-
|
|
3599
|
-
|
|
3222
|
+
source,
|
|
3223
|
+
position
|
|
3600
3224
|
} = context;
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
return result;
|
|
3609
|
-
};
|
|
3610
|
-
}
|
|
3611
|
-
exports.precedence = precedence;
|
|
3612
|
-
function state(state, positive, parser) {
|
|
3613
|
-
if (typeof positive === 'function') {
|
|
3614
|
-
parser = positive;
|
|
3615
|
-
positive = true;
|
|
3616
|
-
}
|
|
3617
|
-
return input => {
|
|
3618
|
-
const context = input;
|
|
3619
|
-
const s = context.state ?? 0;
|
|
3620
|
-
context.state = positive ? s | state : s & ~state;
|
|
3621
|
-
const result = parser(input);
|
|
3622
|
-
context.state = s;
|
|
3623
|
-
return result;
|
|
3225
|
+
try {
|
|
3226
|
+
return parser(input);
|
|
3227
|
+
} catch (reason) {
|
|
3228
|
+
context.source = source;
|
|
3229
|
+
context.position = position;
|
|
3230
|
+
return catcher(input, reason);
|
|
3231
|
+
}
|
|
3624
3232
|
};
|
|
3625
3233
|
}
|
|
3626
|
-
exports.
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3234
|
+
exports.recover = recover;
|
|
3235
|
+
|
|
3236
|
+
/***/ },
|
|
3237
|
+
|
|
3238
|
+
/***/ 2217
|
|
3239
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3240
|
+
|
|
3241
|
+
"use strict";
|
|
3242
|
+
|
|
3243
|
+
|
|
3244
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3245
|
+
value: true
|
|
3246
|
+
}));
|
|
3247
|
+
exports.reverse = void 0;
|
|
3248
|
+
const parser_1 = __webpack_require__(605);
|
|
3249
|
+
const fmap_1 = __webpack_require__(2705);
|
|
3250
|
+
function reverse(parser) {
|
|
3251
|
+
return (0, fmap_1.fmap)(parser, nodes => nodes.foldr((node, acc) => acc.push(nodes.delete(node)) && acc, new parser_1.List()));
|
|
3638
3252
|
}
|
|
3639
|
-
exports.
|
|
3253
|
+
exports.reverse = reverse;
|
|
3640
3254
|
|
|
3641
3255
|
/***/ },
|
|
3642
3256
|
|
|
3643
|
-
/***/
|
|
3644
|
-
(__unused_webpack_module, exports) {
|
|
3257
|
+
/***/ 7723
|
|
3258
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3645
3259
|
|
|
3646
3260
|
"use strict";
|
|
3647
3261
|
|
|
@@ -3649,30 +3263,70 @@ exports.constraint = constraint;
|
|
|
3649
3263
|
Object.defineProperty(exports, "__esModule", ({
|
|
3650
3264
|
value: true
|
|
3651
3265
|
}));
|
|
3652
|
-
exports.
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3266
|
+
exports.rewrite = exports.focus = void 0;
|
|
3267
|
+
const parser_1 = __webpack_require__(605);
|
|
3268
|
+
const delimiter_1 = __webpack_require__(385);
|
|
3269
|
+
function focus(scope, parser, slice = true) {
|
|
3270
|
+
const match = (0, delimiter_1.matcher)(scope, false);
|
|
3271
|
+
return (0, parser_1.failsafe)(context => {
|
|
3657
3272
|
const {
|
|
3658
|
-
|
|
3273
|
+
SID,
|
|
3274
|
+
source,
|
|
3275
|
+
position
|
|
3659
3276
|
} = context;
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3277
|
+
if (position === source.length) return;
|
|
3278
|
+
const src = match(context)?.head?.value ?? '';
|
|
3279
|
+
if (src === '') return;
|
|
3280
|
+
const range = context.range = src.length;
|
|
3281
|
+
if (!slice) {
|
|
3282
|
+
const result = parser(context);
|
|
3283
|
+
context.position += result && context.position === position ? range : 0;
|
|
3284
|
+
return result;
|
|
3667
3285
|
}
|
|
3668
|
-
|
|
3669
|
-
|
|
3286
|
+
context.offset += position;
|
|
3287
|
+
const result = parser((0, parser_1.input)(src, context));
|
|
3288
|
+
context.source = source;
|
|
3289
|
+
context.SID = SID;
|
|
3290
|
+
context.position += position;
|
|
3291
|
+
context.position += result && context.position === position ? src.length : 0;
|
|
3292
|
+
context.offset -= position;
|
|
3293
|
+
return result;
|
|
3294
|
+
});
|
|
3670
3295
|
}
|
|
3671
|
-
exports.
|
|
3296
|
+
exports.focus = focus;
|
|
3297
|
+
function rewrite(scope, parser, slice = true) {
|
|
3298
|
+
return (0, parser_1.failsafe)(context => {
|
|
3299
|
+
const {
|
|
3300
|
+
SID,
|
|
3301
|
+
source,
|
|
3302
|
+
position
|
|
3303
|
+
} = context;
|
|
3304
|
+
if (position === source.length) return;
|
|
3305
|
+
const res1 = scope(context);
|
|
3306
|
+
if (res1 === undefined || context.position < position) return;
|
|
3307
|
+
const range = context.range = context.position - position;
|
|
3308
|
+
if (!slice) {
|
|
3309
|
+
context.position = position;
|
|
3310
|
+
const res2 = parser(context);
|
|
3311
|
+
context.position += res2 && context.position === position ? range : 0;
|
|
3312
|
+
return res2;
|
|
3313
|
+
}
|
|
3314
|
+
const src = source.slice(position, context.position);
|
|
3315
|
+
context.offset += position;
|
|
3316
|
+
const res2 = parser((0, parser_1.input)(src, context));
|
|
3317
|
+
context.SID = SID;
|
|
3318
|
+
context.source = source;
|
|
3319
|
+
context.position += position;
|
|
3320
|
+
context.position += res2 && context.position === position ? src.length : 0;
|
|
3321
|
+
context.offset -= position;
|
|
3322
|
+
return res2;
|
|
3323
|
+
});
|
|
3324
|
+
}
|
|
3325
|
+
exports.rewrite = rewrite;
|
|
3672
3326
|
|
|
3673
3327
|
/***/ },
|
|
3674
3328
|
|
|
3675
|
-
/***/
|
|
3329
|
+
/***/ 5781
|
|
3676
3330
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3677
3331
|
|
|
3678
3332
|
"use strict";
|
|
@@ -3681,32 +3335,128 @@ exports.inits = inits;
|
|
|
3681
3335
|
Object.defineProperty(exports, "__esModule", ({
|
|
3682
3336
|
value: true
|
|
3683
3337
|
}));
|
|
3684
|
-
exports.
|
|
3338
|
+
exports.setBacktrack = exports.isBacktrack = exports.close = exports.open = exports.surround = void 0;
|
|
3685
3339
|
const parser_1 = __webpack_require__(605);
|
|
3686
|
-
|
|
3687
|
-
|
|
3340
|
+
const delimiter_1 = __webpack_require__(385);
|
|
3341
|
+
function surround(opener, parser, closer, optional = false, backtracks = [], f, g) {
|
|
3342
|
+
switch (typeof opener) {
|
|
3343
|
+
case 'string':
|
|
3344
|
+
case 'object':
|
|
3345
|
+
opener = (0, delimiter_1.tester)(opener, true);
|
|
3346
|
+
}
|
|
3347
|
+
switch (typeof parser) {
|
|
3348
|
+
case 'string':
|
|
3349
|
+
case 'object':
|
|
3350
|
+
parser = (0, delimiter_1.tester)(parser, true);
|
|
3351
|
+
}
|
|
3352
|
+
switch (typeof closer) {
|
|
3353
|
+
case 'string':
|
|
3354
|
+
case 'object':
|
|
3355
|
+
closer = (0, delimiter_1.tester)(closer, true);
|
|
3356
|
+
}
|
|
3357
|
+
const [blen, rbs, wbs] = reduce(backtracks);
|
|
3688
3358
|
return (0, parser_1.failsafe)(input => {
|
|
3689
3359
|
const context = input;
|
|
3690
3360
|
const {
|
|
3691
|
-
source
|
|
3361
|
+
source,
|
|
3362
|
+
position
|
|
3692
3363
|
} = context;
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3364
|
+
if (position === source.length) return;
|
|
3365
|
+
const {
|
|
3366
|
+
linebreak
|
|
3367
|
+
} = context;
|
|
3368
|
+
context.linebreak = 0;
|
|
3369
|
+
const nodesO = opener(input);
|
|
3370
|
+
if (nodesO === undefined) {
|
|
3371
|
+
return void revert(context, linebreak);
|
|
3700
3372
|
}
|
|
3701
|
-
|
|
3373
|
+
if (rbs && isBacktrack(context, rbs, position, blen)) {
|
|
3374
|
+
return void revert(context, linebreak);
|
|
3375
|
+
}
|
|
3376
|
+
const nodesM = context.position < source.length ? parser(input) : undefined;
|
|
3377
|
+
context.range = context.position - position;
|
|
3378
|
+
if (nodesM === undefined && !optional) {
|
|
3379
|
+
wbs && setBacktrack(context, wbs, position);
|
|
3380
|
+
const result = g?.([nodesO, nodesM], context);
|
|
3381
|
+
return result || void revert(context, linebreak);
|
|
3382
|
+
}
|
|
3383
|
+
const nodesC = optional || nodesM ? closer(input) : undefined;
|
|
3384
|
+
context.range = context.position - position;
|
|
3385
|
+
if (nodesC === undefined) {
|
|
3386
|
+
wbs && setBacktrack(context, wbs, position);
|
|
3387
|
+
const result = g?.([nodesO, nodesM], context);
|
|
3388
|
+
return result || void revert(context, linebreak);
|
|
3389
|
+
}
|
|
3390
|
+
if (context.position === position) {
|
|
3391
|
+
return void revert(context, linebreak);
|
|
3392
|
+
}
|
|
3393
|
+
context.range = context.position - position;
|
|
3394
|
+
const result = f ? f([nodesO, nodesM, nodesC], context) : nodesM ? nodesO.import(nodesM).import(nodesC) : nodesO.import(nodesC);
|
|
3395
|
+
if (result) {
|
|
3396
|
+
context.linebreak ||= linebreak;
|
|
3397
|
+
}
|
|
3398
|
+
return result || void revert(context, linebreak);
|
|
3702
3399
|
});
|
|
3703
3400
|
}
|
|
3704
|
-
exports.
|
|
3401
|
+
exports.surround = surround;
|
|
3402
|
+
function open(opener, parser, optional, backtracks = []) {
|
|
3403
|
+
return surround(opener, parser, '', optional, backtracks);
|
|
3404
|
+
}
|
|
3405
|
+
exports.open = open;
|
|
3406
|
+
function close(parser, closer, optional, backtracks = []) {
|
|
3407
|
+
return surround('', parser, closer, optional, backtracks);
|
|
3408
|
+
}
|
|
3409
|
+
exports.close = close;
|
|
3410
|
+
const commandsize = 2;
|
|
3411
|
+
function isBacktrack(context, backtrack, position = context.position, length = 1) {
|
|
3412
|
+
const {
|
|
3413
|
+
backtracks,
|
|
3414
|
+
offset
|
|
3415
|
+
} = context;
|
|
3416
|
+
for (let i = 0; i < length; ++i) {
|
|
3417
|
+
if (backtracks[position + i + offset] & backtrack >>> commandsize) return true;
|
|
3418
|
+
}
|
|
3419
|
+
return false;
|
|
3420
|
+
}
|
|
3421
|
+
exports.isBacktrack = isBacktrack;
|
|
3422
|
+
function setBacktrack(context, backtrack, position, length = 1) {
|
|
3423
|
+
// バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
|
|
3424
|
+
|
|
3425
|
+
const {
|
|
3426
|
+
backtracks,
|
|
3427
|
+
offset
|
|
3428
|
+
} = context;
|
|
3429
|
+
for (let i = 0; i < length; ++i) {
|
|
3430
|
+
backtracks[position + i + offset] |= backtrack >>> commandsize;
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
exports.setBacktrack = setBacktrack;
|
|
3434
|
+
function reduce(backtracks) {
|
|
3435
|
+
let len = 1;
|
|
3436
|
+
let rbs = 0;
|
|
3437
|
+
let wbs = 0;
|
|
3438
|
+
for (const backtrack of backtracks) {
|
|
3439
|
+
if (backtrack >>> commandsize === 0) {
|
|
3440
|
+
len = backtrack;
|
|
3441
|
+
continue;
|
|
3442
|
+
}
|
|
3443
|
+
if (1 & backtrack) {
|
|
3444
|
+
rbs |= backtrack;
|
|
3445
|
+
}
|
|
3446
|
+
if (2 & backtrack) {
|
|
3447
|
+
wbs |= backtrack;
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
return [len, rbs, wbs];
|
|
3451
|
+
}
|
|
3452
|
+
function revert(context, linebreak) {
|
|
3453
|
+
context.linebreak = linebreak;
|
|
3454
|
+
}
|
|
3705
3455
|
|
|
3706
3456
|
/***/ },
|
|
3707
3457
|
|
|
3708
|
-
/***/
|
|
3709
|
-
(__unused_webpack_module, exports
|
|
3458
|
+
/***/ 994
|
|
3459
|
+
(__unused_webpack_module, exports) {
|
|
3710
3460
|
|
|
3711
3461
|
"use strict";
|
|
3712
3462
|
|
|
@@ -3714,59 +3464,34 @@ exports.sequence = sequence;
|
|
|
3714
3464
|
Object.defineProperty(exports, "__esModule", ({
|
|
3715
3465
|
value: true
|
|
3716
3466
|
}));
|
|
3717
|
-
exports.
|
|
3718
|
-
|
|
3719
|
-
function some(parser, delimiter, after, delimiters, limit = 0) {
|
|
3720
|
-
if (typeof delimiter === 'number') {
|
|
3721
|
-
limit = delimiter;
|
|
3722
|
-
delimiters = undefined;
|
|
3723
|
-
delimiter = undefined;
|
|
3724
|
-
} else if (Array.isArray(delimiter)) {
|
|
3725
|
-
limit = after;
|
|
3726
|
-
delimiters = delimiter;
|
|
3727
|
-
delimiter = undefined;
|
|
3728
|
-
} else if (after === undefined || Array.isArray(after)) {
|
|
3729
|
-
limit = delimiters;
|
|
3730
|
-
delimiters = after;
|
|
3731
|
-
after = undefined;
|
|
3732
|
-
} else {
|
|
3733
|
-
delimiters = delimiters;
|
|
3734
|
-
}
|
|
3735
|
-
const match = delimiter_1.Delimiters.tester(delimiter, after);
|
|
3736
|
-
const delims = delimiters?.map(([delimiter, precedence]) => ({
|
|
3737
|
-
signature: delimiter_1.Delimiters.signature(delimiter),
|
|
3738
|
-
tester: delimiter_1.Delimiters.tester(delimiter),
|
|
3739
|
-
precedence
|
|
3740
|
-
}));
|
|
3467
|
+
exports.bind = void 0;
|
|
3468
|
+
function bind(parser, f) {
|
|
3741
3469
|
return input => {
|
|
3742
3470
|
const context = input;
|
|
3743
3471
|
const {
|
|
3744
3472
|
source,
|
|
3745
3473
|
position
|
|
3746
3474
|
} = context;
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
if (context.delimiters.test(input)) break;
|
|
3753
|
-
const pos = context.position;
|
|
3754
|
-
const result = parser(input);
|
|
3755
|
-
if (result === undefined) break;
|
|
3756
|
-
if (context.position === pos) break;
|
|
3757
|
-
nodes = nodes?.import(result) ?? result;
|
|
3758
|
-
// 次にパースに成功すれば確実に制限値を超えるので制限値ちょうどでも中止する
|
|
3759
|
-
if (limit > 0 && context.position - position >= limit) break;
|
|
3475
|
+
if (position === source.length) return;
|
|
3476
|
+
const res1 = parser(input);
|
|
3477
|
+
if (res1 === undefined) {
|
|
3478
|
+
context.position = position;
|
|
3479
|
+
return;
|
|
3760
3480
|
}
|
|
3761
|
-
|
|
3762
|
-
|
|
3481
|
+
context.range = context.position - position;
|
|
3482
|
+
const res2 = f(res1, context);
|
|
3483
|
+
if (res2 === undefined) {
|
|
3484
|
+
context.position = position;
|
|
3485
|
+
return;
|
|
3486
|
+
}
|
|
3487
|
+
return res2;
|
|
3763
3488
|
};
|
|
3764
3489
|
}
|
|
3765
|
-
exports.
|
|
3490
|
+
exports.bind = bind;
|
|
3766
3491
|
|
|
3767
3492
|
/***/ },
|
|
3768
3493
|
|
|
3769
|
-
/***/
|
|
3494
|
+
/***/ 2705
|
|
3770
3495
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3771
3496
|
|
|
3772
3497
|
"use strict";
|
|
@@ -3775,17 +3500,16 @@ exports.some = some;
|
|
|
3775
3500
|
Object.defineProperty(exports, "__esModule", ({
|
|
3776
3501
|
value: true
|
|
3777
3502
|
}));
|
|
3778
|
-
exports.
|
|
3779
|
-
const
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
return (0, union_1.union)(parsers.map((_, i) => i + 1 < parsers.length ? (0, inits_1.inits)([parsers[i], subsequence(parsers.slice(i + 1))]) : parsers[i]));
|
|
3503
|
+
exports.fmap = void 0;
|
|
3504
|
+
const bind_1 = __webpack_require__(994);
|
|
3505
|
+
function fmap(parser, f) {
|
|
3506
|
+
return (0, bind_1.bind)(parser, (nodes, context) => f(nodes, context));
|
|
3783
3507
|
}
|
|
3784
|
-
exports.
|
|
3508
|
+
exports.fmap = fmap;
|
|
3785
3509
|
|
|
3786
3510
|
/***/ },
|
|
3787
3511
|
|
|
3788
|
-
/***/
|
|
3512
|
+
/***/ 385
|
|
3789
3513
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3790
3514
|
|
|
3791
3515
|
"use strict";
|
|
@@ -3794,17 +3518,260 @@ exports.subsequence = subsequence;
|
|
|
3794
3518
|
Object.defineProperty(exports, "__esModule", ({
|
|
3795
3519
|
value: true
|
|
3796
3520
|
}));
|
|
3797
|
-
exports.
|
|
3798
|
-
const
|
|
3799
|
-
const
|
|
3800
|
-
|
|
3801
|
-
|
|
3521
|
+
exports.tester = exports.matcher = exports.Delimiters = void 0;
|
|
3522
|
+
const parser_1 = __webpack_require__(605);
|
|
3523
|
+
const context_1 = __webpack_require__(5745);
|
|
3524
|
+
const indexes = new Map();
|
|
3525
|
+
function index(source) {
|
|
3526
|
+
let x = 0;
|
|
3527
|
+
for (let i = 0; i < source.length; ++i) {
|
|
3528
|
+
const c = source.charCodeAt(i);
|
|
3529
|
+
x = x ^ c << 1 || ~x ^ c << 1; // 16+1bit
|
|
3530
|
+
|
|
3531
|
+
x ^= x << 13; // shift <= 32-17bit
|
|
3532
|
+
x ^= x >>> 17;
|
|
3533
|
+
x ^= x << 15;
|
|
3534
|
+
}
|
|
3535
|
+
x >>>= 3;
|
|
3536
|
+
x &= ~0 >>> 32 - 4;
|
|
3537
|
+
return x;
|
|
3538
|
+
}
|
|
3539
|
+
class Delimiters {
|
|
3540
|
+
constructor() {
|
|
3541
|
+
this.memories = [];
|
|
3542
|
+
this.delimiters = [];
|
|
3543
|
+
this.stack = [];
|
|
3544
|
+
this.states = [];
|
|
3545
|
+
}
|
|
3546
|
+
// 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
|
|
3547
|
+
static signature(pattern) {
|
|
3548
|
+
switch (typeof pattern) {
|
|
3549
|
+
case 'undefined':
|
|
3550
|
+
return 0;
|
|
3551
|
+
case 'string':
|
|
3552
|
+
return index(`'${pattern}`);
|
|
3553
|
+
case 'object':
|
|
3554
|
+
return index(`/${pattern.source}`);
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
static tester(pattern, after) {
|
|
3558
|
+
switch (typeof pattern) {
|
|
3559
|
+
case 'undefined':
|
|
3560
|
+
return () => undefined;
|
|
3561
|
+
case 'string':
|
|
3562
|
+
case 'object':
|
|
3563
|
+
const test = tester(pattern, false);
|
|
3564
|
+
const verify = after ? tester(after, false) : undefined;
|
|
3565
|
+
return verify ? input => test(input) !== undefined && verify(input) !== undefined || undefined : input => test(input) !== undefined || undefined;
|
|
3566
|
+
}
|
|
3567
|
+
}
|
|
3568
|
+
registry(signature) {
|
|
3569
|
+
return this.memories[signature] ??= [];
|
|
3570
|
+
}
|
|
3571
|
+
push(delims) {
|
|
3572
|
+
const {
|
|
3573
|
+
delimiters,
|
|
3574
|
+
stack
|
|
3575
|
+
} = this;
|
|
3576
|
+
// シグネチャ数以下
|
|
3577
|
+
|
|
3578
|
+
for (let i = 0; i < delims.length; ++i) {
|
|
3579
|
+
const {
|
|
3580
|
+
signature,
|
|
3581
|
+
tester,
|
|
3582
|
+
precedence
|
|
3583
|
+
} = delims[i];
|
|
3584
|
+
const memory = this.registry(signature);
|
|
3585
|
+
const index = memory[0]?.index ?? delimiters.length;
|
|
3586
|
+
if (memory.length === 0) {
|
|
3587
|
+
const delimiter = {
|
|
3588
|
+
memory,
|
|
3589
|
+
index,
|
|
3590
|
+
tester,
|
|
3591
|
+
precedence,
|
|
3592
|
+
state: true
|
|
3593
|
+
};
|
|
3594
|
+
delimiters[index] = delimiter;
|
|
3595
|
+
memory.push(delimiter);
|
|
3596
|
+
stack.push(index);
|
|
3597
|
+
} else {
|
|
3598
|
+
// 現状各優先順位は固定
|
|
3599
|
+
|
|
3600
|
+
stack.push(-1);
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
pop(count) {
|
|
3605
|
+
const {
|
|
3606
|
+
delimiters,
|
|
3607
|
+
stack
|
|
3608
|
+
} = this;
|
|
3609
|
+
for (let i = 0; i < count; ++i) {
|
|
3610
|
+
const index = stack.pop();
|
|
3611
|
+
if (index === -1) continue;
|
|
3612
|
+
const {
|
|
3613
|
+
memory
|
|
3614
|
+
} = delimiters[index];
|
|
3615
|
+
if (memory.length === 1) {
|
|
3616
|
+
memory.pop();
|
|
3617
|
+
delimiters.pop();
|
|
3618
|
+
} else {
|
|
3619
|
+
memory.pop();
|
|
3620
|
+
delimiters[index] = memory.at(-1);
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
shift(precedence) {
|
|
3625
|
+
const {
|
|
3626
|
+
delimiters
|
|
3627
|
+
} = this;
|
|
3628
|
+
const indexes = [];
|
|
3629
|
+
for (let i = delimiters.length; i--;) {
|
|
3630
|
+
const delimiter = delimiters[i];
|
|
3631
|
+
if (delimiter.precedence >= precedence || !delimiter.state) continue;
|
|
3632
|
+
delimiter.state = false;
|
|
3633
|
+
indexes.push(i);
|
|
3634
|
+
}
|
|
3635
|
+
this.states.push(indexes);
|
|
3636
|
+
}
|
|
3637
|
+
unshift() {
|
|
3638
|
+
const {
|
|
3639
|
+
delimiters
|
|
3640
|
+
} = this;
|
|
3641
|
+
const indexes = this.states.pop();
|
|
3642
|
+
for (let i = indexes.length; i--;) {
|
|
3643
|
+
delimiters[indexes[i]].state = true;
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
test(input) {
|
|
3647
|
+
const {
|
|
3648
|
+
precedence
|
|
3649
|
+
} = input;
|
|
3650
|
+
const {
|
|
3651
|
+
delimiters
|
|
3652
|
+
} = this;
|
|
3653
|
+
for (let i = delimiters.length; i--;) {
|
|
3654
|
+
const delimiter = delimiters[i];
|
|
3655
|
+
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3656
|
+
switch (delimiter.tester(input)) {
|
|
3657
|
+
case true:
|
|
3658
|
+
return true;
|
|
3659
|
+
case false:
|
|
3660
|
+
return false;
|
|
3661
|
+
default:
|
|
3662
|
+
continue;
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
return false;
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
exports.Delimiters = Delimiters;
|
|
3669
|
+
function matcher(pattern, advance, after) {
|
|
3670
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3671
|
+
let sid = 0,
|
|
3672
|
+
pos = 0,
|
|
3673
|
+
index = -1;
|
|
3674
|
+
switch (typeof pattern) {
|
|
3675
|
+
case 'string':
|
|
3676
|
+
if (pattern === '') return () => new parser_1.List([new parser_1.Node(pattern)]);
|
|
3677
|
+
return input => {
|
|
3678
|
+
const context = input;
|
|
3679
|
+
const {
|
|
3680
|
+
SID,
|
|
3681
|
+
source,
|
|
3682
|
+
position
|
|
3683
|
+
} = context;
|
|
3684
|
+
const hit = SID === sid && position === pos;
|
|
3685
|
+
index = hit ? index : source.startsWith(pattern, position) ? position : -1;
|
|
3686
|
+
sid = SID;
|
|
3687
|
+
pos = position;
|
|
3688
|
+
if (index === -1) return;
|
|
3689
|
+
if (advance) {
|
|
3690
|
+
context.position += pattern.length;
|
|
3691
|
+
}
|
|
3692
|
+
const next = after?.(input);
|
|
3693
|
+
return after ? next && new parser_1.List([new parser_1.Node(pattern)]).import(next) : new parser_1.List([new parser_1.Node(pattern)]);
|
|
3694
|
+
};
|
|
3695
|
+
case 'object':
|
|
3696
|
+
return input => {
|
|
3697
|
+
const context = input;
|
|
3698
|
+
const {
|
|
3699
|
+
SID,
|
|
3700
|
+
source,
|
|
3701
|
+
position
|
|
3702
|
+
} = context;
|
|
3703
|
+
const hit = SID === sid && position === pos;
|
|
3704
|
+
pattern.lastIndex = position;
|
|
3705
|
+
index = hit ? index : pattern.test(source) ? pattern.lastIndex : -1;
|
|
3706
|
+
sid = SID;
|
|
3707
|
+
pos = position;
|
|
3708
|
+
if (index === -1) return;
|
|
3709
|
+
const src = source.slice(position, index);
|
|
3710
|
+
count && !hit && (0, context_1.spend)(context, src.length);
|
|
3711
|
+
if (advance) {
|
|
3712
|
+
context.position = index;
|
|
3713
|
+
}
|
|
3714
|
+
const next = after?.(input);
|
|
3715
|
+
return after ? next && new parser_1.List([new parser_1.Node(src)]).import(next) : new parser_1.List([new parser_1.Node(src)]);
|
|
3716
|
+
};
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
exports.matcher = matcher;
|
|
3720
|
+
function tester(pattern, advance, after) {
|
|
3721
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3722
|
+
let sid = 0,
|
|
3723
|
+
pos = 0,
|
|
3724
|
+
index = -1;
|
|
3725
|
+
switch (typeof pattern) {
|
|
3726
|
+
case 'string':
|
|
3727
|
+
if (pattern === '') return () => new parser_1.List();
|
|
3728
|
+
return input => {
|
|
3729
|
+
const context = input;
|
|
3730
|
+
const {
|
|
3731
|
+
SID,
|
|
3732
|
+
source,
|
|
3733
|
+
position
|
|
3734
|
+
} = context;
|
|
3735
|
+
const hit = SID === sid && position === pos;
|
|
3736
|
+
index = hit ? index : source.startsWith(pattern, position) ? position : -1;
|
|
3737
|
+
sid = SID;
|
|
3738
|
+
pos = position;
|
|
3739
|
+
if (index === -1) return;
|
|
3740
|
+
if (advance) {
|
|
3741
|
+
context.position += pattern.length;
|
|
3742
|
+
}
|
|
3743
|
+
if (after && after(input) === undefined) return;
|
|
3744
|
+
return new parser_1.List();
|
|
3745
|
+
};
|
|
3746
|
+
case 'object':
|
|
3747
|
+
return input => {
|
|
3748
|
+
const context = input;
|
|
3749
|
+
const {
|
|
3750
|
+
SID,
|
|
3751
|
+
source,
|
|
3752
|
+
position
|
|
3753
|
+
} = context;
|
|
3754
|
+
const hit = SID === sid && position === pos;
|
|
3755
|
+
pattern.lastIndex = position;
|
|
3756
|
+
index = hit ? index : pattern.test(source) ? pattern.lastIndex : -1;
|
|
3757
|
+
sid = SID;
|
|
3758
|
+
pos = position;
|
|
3759
|
+
if (index === -1) return;
|
|
3760
|
+
const len = index - position;
|
|
3761
|
+
count && !hit && (0, context_1.spend)(context, len);
|
|
3762
|
+
if (advance) {
|
|
3763
|
+
context.position = index;
|
|
3764
|
+
}
|
|
3765
|
+
if (after && after(input) === undefined) return;
|
|
3766
|
+
return new parser_1.List();
|
|
3767
|
+
};
|
|
3768
|
+
}
|
|
3802
3769
|
}
|
|
3803
|
-
exports.
|
|
3770
|
+
exports.tester = tester;
|
|
3804
3771
|
|
|
3805
3772
|
/***/ },
|
|
3806
3773
|
|
|
3807
|
-
/***/
|
|
3774
|
+
/***/ 1461
|
|
3808
3775
|
(__unused_webpack_module, exports) {
|
|
3809
3776
|
|
|
3810
3777
|
"use strict";
|
|
@@ -3813,54 +3780,134 @@ exports.tails = tails;
|
|
|
3813
3780
|
Object.defineProperty(exports, "__esModule", ({
|
|
3814
3781
|
value: true
|
|
3815
3782
|
}));
|
|
3816
|
-
exports.
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3783
|
+
exports.List = void 0;
|
|
3784
|
+
class List {
|
|
3785
|
+
constructor(nodes) {
|
|
3786
|
+
this.length = 0;
|
|
3787
|
+
this.head = undefined;
|
|
3788
|
+
this.last = undefined;
|
|
3789
|
+
if (nodes === undefined) return;
|
|
3790
|
+
for (let i = 0; i < nodes.length; ++i) {
|
|
3791
|
+
this.push(nodes[i]);
|
|
3792
|
+
}
|
|
3825
3793
|
}
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
/***/ },
|
|
3830
|
-
|
|
3831
|
-
/***/ 3561
|
|
3832
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3833
|
-
|
|
3834
|
-
"use strict";
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
3838
|
-
if (k2 === undefined) k2 = k;
|
|
3839
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3840
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3841
|
-
desc = {
|
|
3842
|
-
enumerable: true,
|
|
3843
|
-
get: function () {
|
|
3844
|
-
return m[k];
|
|
3845
|
-
}
|
|
3846
|
-
};
|
|
3794
|
+
get tail() {
|
|
3795
|
+
return this.head?.next;
|
|
3847
3796
|
}
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3797
|
+
insert(node, before) {
|
|
3798
|
+
if (before === undefined) return this.push(node);
|
|
3799
|
+
if (before === this.head) return this.unshift(node);
|
|
3800
|
+
if (++this.length === 1) {
|
|
3801
|
+
return this.head = this.last = node;
|
|
3802
|
+
}
|
|
3803
|
+
const next = node.next = before;
|
|
3804
|
+
const prev = node.prev = next.prev;
|
|
3805
|
+
return next.prev = prev.next = node;
|
|
3806
|
+
}
|
|
3807
|
+
delete(node) {
|
|
3808
|
+
if (--this.length === 0) {
|
|
3809
|
+
this.head = this.last = undefined;
|
|
3810
|
+
} else {
|
|
3811
|
+
const {
|
|
3812
|
+
next,
|
|
3813
|
+
prev
|
|
3814
|
+
} = node;
|
|
3815
|
+
prev === undefined ? this.head = next : prev.next = next;
|
|
3816
|
+
next === undefined ? this.last = prev : next.prev = prev;
|
|
3817
|
+
}
|
|
3818
|
+
node.next = node.prev = undefined;
|
|
3819
|
+
return node;
|
|
3820
|
+
}
|
|
3821
|
+
unshift(node) {
|
|
3822
|
+
if (++this.length === 1) {
|
|
3823
|
+
return this.head = this.last = node;
|
|
3824
|
+
}
|
|
3825
|
+
node.next = this.head;
|
|
3826
|
+
return this.head = this.head.prev = node;
|
|
3827
|
+
}
|
|
3828
|
+
push(node) {
|
|
3829
|
+
if (++this.length === 1) {
|
|
3830
|
+
return this.head = this.last = node;
|
|
3831
|
+
}
|
|
3832
|
+
node.prev = this.last;
|
|
3833
|
+
return this.last = this.last.next = node;
|
|
3834
|
+
}
|
|
3835
|
+
shift() {
|
|
3836
|
+
if (this.length === 0) return;
|
|
3837
|
+
return this.delete(this.head);
|
|
3838
|
+
}
|
|
3839
|
+
pop() {
|
|
3840
|
+
if (this.length === 0) return;
|
|
3841
|
+
return this.delete(this.last);
|
|
3842
|
+
}
|
|
3843
|
+
import(list, before) {
|
|
3844
|
+
if (list.length === 0) return this;
|
|
3845
|
+
if (this.length === 0) {
|
|
3846
|
+
this.head = list.head;
|
|
3847
|
+
this.last = list.last;
|
|
3848
|
+
this.length = list.length;
|
|
3849
|
+
list.clear();
|
|
3850
|
+
return this;
|
|
3851
|
+
}
|
|
3852
|
+
const head = list.head;
|
|
3853
|
+
const last = list.last;
|
|
3854
|
+
const next = last.next = before;
|
|
3855
|
+
const prev = head.prev = before?.prev ?? this.last;
|
|
3856
|
+
next === undefined ? this.last = last : next.prev = last;
|
|
3857
|
+
prev.next = head;
|
|
3858
|
+
this.length += list.length;
|
|
3859
|
+
list.clear();
|
|
3860
|
+
return this;
|
|
3861
|
+
}
|
|
3862
|
+
clear() {
|
|
3863
|
+
this.length = 0;
|
|
3864
|
+
this.head = this.last = undefined;
|
|
3865
|
+
}
|
|
3866
|
+
*[Symbol.iterator]() {
|
|
3867
|
+
for (let node = this.head; node && this.head;) {
|
|
3868
|
+
const next = node.next;
|
|
3869
|
+
yield node;
|
|
3870
|
+
node = next;
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
flatMap(f) {
|
|
3874
|
+
const acc = new List();
|
|
3875
|
+
for (let node = this.head; node && this.head;) {
|
|
3876
|
+
const next = node.next;
|
|
3877
|
+
acc.import(f(node));
|
|
3878
|
+
node = next;
|
|
3879
|
+
}
|
|
3880
|
+
return acc;
|
|
3881
|
+
}
|
|
3882
|
+
foldl(f, acc) {
|
|
3883
|
+
for (let node = this.head; node && this.head;) {
|
|
3884
|
+
const next = node.next;
|
|
3885
|
+
acc = f(acc, node);
|
|
3886
|
+
node = next;
|
|
3887
|
+
}
|
|
3888
|
+
return acc;
|
|
3889
|
+
}
|
|
3890
|
+
foldr(f, acc) {
|
|
3891
|
+
for (let node = this.last; node && this.head;) {
|
|
3892
|
+
const prev = node.prev;
|
|
3893
|
+
acc = f(node, acc);
|
|
3894
|
+
node = prev;
|
|
3895
|
+
}
|
|
3896
|
+
return acc;
|
|
3897
|
+
}
|
|
3898
|
+
find(f) {
|
|
3899
|
+
for (let node = this.head; node && this.head;) {
|
|
3900
|
+
const next = node.next;
|
|
3901
|
+
if (f(node)) return node;
|
|
3902
|
+
node = next;
|
|
3903
|
+
}
|
|
3904
|
+
}
|
|
3905
|
+
}
|
|
3906
|
+
exports.List = List;
|
|
3860
3907
|
|
|
3861
3908
|
/***/ },
|
|
3862
3909
|
|
|
3863
|
-
/***/
|
|
3910
|
+
/***/ 605
|
|
3864
3911
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3865
3912
|
|
|
3866
3913
|
"use strict";
|
|
@@ -3869,59 +3916,88 @@ __exportStar(__webpack_require__(5886), exports);
|
|
|
3869
3916
|
Object.defineProperty(exports, "__esModule", ({
|
|
3870
3917
|
value: true
|
|
3871
3918
|
}));
|
|
3872
|
-
exports.
|
|
3873
|
-
|
|
3874
|
-
Object.defineProperty(exports, "
|
|
3875
|
-
enumerable: true,
|
|
3876
|
-
get: function () {
|
|
3877
|
-
return parse_1.parse;
|
|
3878
|
-
}
|
|
3879
|
-
}));
|
|
3880
|
-
var bind_1 = __webpack_require__(7990);
|
|
3881
|
-
Object.defineProperty(exports, "bind", ({
|
|
3882
|
-
enumerable: true,
|
|
3883
|
-
get: function () {
|
|
3884
|
-
return bind_1.bind;
|
|
3885
|
-
}
|
|
3886
|
-
}));
|
|
3887
|
-
var cache_1 = __webpack_require__(4331);
|
|
3888
|
-
Object.defineProperty(exports, "caches", ({
|
|
3889
|
-
enumerable: true,
|
|
3890
|
-
get: function () {
|
|
3891
|
-
return cache_1.caches;
|
|
3892
|
-
}
|
|
3893
|
-
}));
|
|
3894
|
-
var header_1 = __webpack_require__(3652);
|
|
3895
|
-
Object.defineProperty(exports, "header", ({
|
|
3919
|
+
exports.failsafe = exports.subinput = exports.input = exports.Context = exports.Node = exports.List = void 0;
|
|
3920
|
+
const list_1 = __webpack_require__(1461);
|
|
3921
|
+
Object.defineProperty(exports, "List", ({
|
|
3896
3922
|
enumerable: true,
|
|
3897
3923
|
get: function () {
|
|
3898
|
-
return
|
|
3924
|
+
return list_1.List;
|
|
3899
3925
|
}
|
|
3900
3926
|
}));
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3927
|
+
const delimiter_1 = __webpack_require__(385);
|
|
3928
|
+
class Node {
|
|
3929
|
+
constructor(value, flags = 0) {
|
|
3930
|
+
this.value = value;
|
|
3931
|
+
this.flags = flags;
|
|
3932
|
+
this.next = undefined;
|
|
3933
|
+
this.prev = undefined;
|
|
3905
3934
|
}
|
|
3906
|
-
}
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3935
|
+
}
|
|
3936
|
+
exports.Node = Node;
|
|
3937
|
+
let SID = 0;
|
|
3938
|
+
function sid() {
|
|
3939
|
+
return SID = ++SID >>> 0 || 1;
|
|
3940
|
+
}
|
|
3941
|
+
class Context {
|
|
3942
|
+
constructor({
|
|
3943
|
+
source,
|
|
3944
|
+
position,
|
|
3945
|
+
segment,
|
|
3946
|
+
resources,
|
|
3947
|
+
delimiters,
|
|
3948
|
+
precedence,
|
|
3949
|
+
state,
|
|
3950
|
+
linebreak,
|
|
3951
|
+
range,
|
|
3952
|
+
offset,
|
|
3953
|
+
backtracks
|
|
3954
|
+
} = {}) {
|
|
3955
|
+
this.SID = sid();
|
|
3956
|
+
this.source = source ?? '';
|
|
3957
|
+
this.position = position ?? 0;
|
|
3958
|
+
this.segment = segment ?? 0;
|
|
3959
|
+
this.resources = resources;
|
|
3960
|
+
this.precedence = precedence ?? 0;
|
|
3961
|
+
this.delimiters = delimiters ?? new delimiter_1.Delimiters();
|
|
3962
|
+
this.state = state ?? 0;
|
|
3963
|
+
this.linebreak = linebreak ?? 0;
|
|
3964
|
+
this.range = range ?? 0;
|
|
3965
|
+
this.offset = offset ?? 0;
|
|
3966
|
+
this.backtracks = backtracks ?? {};
|
|
3912
3967
|
}
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
enumerable: true,
|
|
3917
|
-
get: function () {
|
|
3918
|
-
return normalize_1.normalize;
|
|
3968
|
+
clone() {
|
|
3969
|
+
// @ts-ignore
|
|
3970
|
+
return new this.constructor(this);
|
|
3919
3971
|
}
|
|
3920
|
-
}
|
|
3972
|
+
}
|
|
3973
|
+
exports.Context = Context;
|
|
3974
|
+
function input(source, context) {
|
|
3975
|
+
context.SID = sid();
|
|
3976
|
+
context.source = source;
|
|
3977
|
+
context.position = 0;
|
|
3978
|
+
return context;
|
|
3979
|
+
}
|
|
3980
|
+
exports.input = input;
|
|
3981
|
+
function subinput(source, context) {
|
|
3982
|
+
const c = context.clone();
|
|
3983
|
+
c.source = source;
|
|
3984
|
+
c.position = 0;
|
|
3985
|
+
c.offset = 0;
|
|
3986
|
+
c.backtracks = {};
|
|
3987
|
+
return c;
|
|
3988
|
+
}
|
|
3989
|
+
exports.subinput = subinput;
|
|
3990
|
+
function failsafe(parser) {
|
|
3991
|
+
return context => {
|
|
3992
|
+
const position = context.position;
|
|
3993
|
+
return parser(context) ?? (context.position = position, undefined);
|
|
3994
|
+
};
|
|
3995
|
+
}
|
|
3996
|
+
exports.failsafe = failsafe;
|
|
3921
3997
|
|
|
3922
3998
|
/***/ },
|
|
3923
3999
|
|
|
3924
|
-
/***/
|
|
4000
|
+
/***/ 5745
|
|
3925
4001
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3926
4002
|
|
|
3927
4003
|
"use strict";
|
|
@@ -3930,181 +4006,101 @@ Object.defineProperty(exports, "normalize", ({
|
|
|
3930
4006
|
Object.defineProperty(exports, "__esModule", ({
|
|
3931
4007
|
value: true
|
|
3932
4008
|
}));
|
|
3933
|
-
exports.
|
|
3934
|
-
const
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
const
|
|
3938
|
-
const
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
const array_1 = __webpack_require__(6876);
|
|
3943
|
-
function bind(target, settings) {
|
|
3944
|
-
const options = {
|
|
3945
|
-
...settings,
|
|
3946
|
-
host: settings.host ?? new url_1.ReadonlyURL(location.pathname, location.origin)
|
|
4009
|
+
exports.constraint = exports.state = exports.precedence = exports.recur = exports.recursion = exports.spend = exports.creation = void 0;
|
|
4010
|
+
const alias_1 = __webpack_require__(5413);
|
|
4011
|
+
function creation(cost, parser) {
|
|
4012
|
+
return input => {
|
|
4013
|
+
const context = input;
|
|
4014
|
+
const result = parser(input);
|
|
4015
|
+
if (result === undefined) return;
|
|
4016
|
+
spend(context, cost);
|
|
4017
|
+
return result;
|
|
3947
4018
|
};
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
const
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
let revision;
|
|
3955
|
-
return {
|
|
3956
|
-
parse,
|
|
3957
|
-
nearest,
|
|
3958
|
-
index
|
|
4019
|
+
}
|
|
4020
|
+
exports.creation = creation;
|
|
4021
|
+
function spend(context, cost) {
|
|
4022
|
+
const resources = context.resources ?? {
|
|
4023
|
+
clock: cost || 1,
|
|
4024
|
+
recursions: [1]
|
|
3959
4025
|
};
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
const
|
|
3967
|
-
const
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
sourceSegmentAttrs.push(attr);
|
|
3971
|
-
yield {
|
|
3972
|
-
type: 'segment',
|
|
3973
|
-
value: seg
|
|
3974
|
-
};
|
|
3975
|
-
}
|
|
3976
|
-
const targetSegments = blocks.map(([seg]) => seg);
|
|
3977
|
-
let head = 0;
|
|
3978
|
-
for (; head < targetSegments.length; ++head) {
|
|
3979
|
-
if (blocks[head][2] !== url) break;
|
|
3980
|
-
if (targetSegments[head] !== sourceSegments[head]) break;
|
|
3981
|
-
}
|
|
3982
|
-
if (adds.length + dels.length === 0 && sourceSegments.length === targetSegments.length && head === sourceSegments.length) return;
|
|
3983
|
-
let last = 0;
|
|
3984
|
-
for (; head + last < targetSegments.length && head + last < sourceSegments.length; ++last) {
|
|
3985
|
-
if (blocks[targetSegments.length - last - 1][2] !== url) break;
|
|
3986
|
-
if (targetSegments[targetSegments.length - last - 1] !== sourceSegments[sourceSegments.length - last - 1]) break;
|
|
3987
|
-
}
|
|
3988
|
-
const base = next(head);
|
|
3989
|
-
let index = head;
|
|
3990
|
-
// @ts-expect-error
|
|
3991
|
-
options.header = true;
|
|
3992
|
-
for (; index < sourceSegments.length - last; ++index) {
|
|
3993
|
-
const seg = sourceSegments[index];
|
|
3994
|
-
options.segment = sourceSegmentAttrs[index] | 1 /* Segment.write */;
|
|
3995
|
-
const es = (0, block_1.block)((0, parser_1.input)(seg, new context_1.Context(options))).foldl((acc, {
|
|
3996
|
-
value
|
|
3997
|
-
}) => void acc.push(value) || acc, []);
|
|
3998
|
-
// @ts-expect-error
|
|
3999
|
-
options.header = false;
|
|
4000
|
-
blocks.length === index ? blocks.push([seg, es, url]) : blocks.splice(index, 0, [seg, es, url]);
|
|
4001
|
-
if (es.length === 0) continue;
|
|
4002
|
-
// All deletion processes always run after all addition processes have done.
|
|
4003
|
-
// Therefore any `base` node will never be unavailable by deletions until all the dependent `el` nodes are added.
|
|
4004
|
-
adds.push(...es.map(el => [el, base]));
|
|
4005
|
-
adds.reverse();
|
|
4006
|
-
for (; adds.length > 0;) {
|
|
4007
|
-
const [el, base] = adds.pop();
|
|
4008
|
-
target.insertBefore(el, base);
|
|
4009
|
-
yield {
|
|
4010
|
-
type: 'block',
|
|
4011
|
-
value: el
|
|
4012
|
-
};
|
|
4013
|
-
if (rev !== revision) return yield {
|
|
4014
|
-
type: 'cancel'
|
|
4015
|
-
};
|
|
4016
|
-
}
|
|
4017
|
-
}
|
|
4018
|
-
for (let refuse = (0, array_1.splice)(blocks, index, blocks.length - sourceSegments.length), i = 0; i < refuse.length; ++i) {
|
|
4019
|
-
const es = refuse[i][1];
|
|
4020
|
-
if (es.length === 0) continue;
|
|
4021
|
-
dels.push(...es.map(el => [el]));
|
|
4022
|
-
}
|
|
4023
|
-
adds.reverse();
|
|
4024
|
-
for (; adds.length > 0;) {
|
|
4025
|
-
const [el, base] = adds.pop();
|
|
4026
|
-
target.insertBefore(el, base);
|
|
4027
|
-
yield {
|
|
4028
|
-
type: 'block',
|
|
4029
|
-
value: el
|
|
4030
|
-
};
|
|
4031
|
-
if (rev !== revision) return yield {
|
|
4032
|
-
type: 'cancel'
|
|
4033
|
-
};
|
|
4034
|
-
}
|
|
4035
|
-
dels.reverse();
|
|
4036
|
-
for (; dels.length > 0;) {
|
|
4037
|
-
const [el] = dels.pop();
|
|
4038
|
-
el.parentNode?.removeChild(el);
|
|
4039
|
-
yield {
|
|
4040
|
-
type: 'block',
|
|
4041
|
-
value: el
|
|
4042
|
-
};
|
|
4043
|
-
if (rev !== revision) return yield {
|
|
4044
|
-
type: 'cancel'
|
|
4045
|
-
};
|
|
4046
|
-
}
|
|
4047
|
-
yield {
|
|
4048
|
-
type: 'break'
|
|
4049
|
-
};
|
|
4050
|
-
if (rev !== revision) return yield {
|
|
4051
|
-
type: 'cancel'
|
|
4026
|
+
if (resources.clock < cost) throw new Error('Too many creations');
|
|
4027
|
+
resources.clock -= cost;
|
|
4028
|
+
}
|
|
4029
|
+
exports.spend = spend;
|
|
4030
|
+
function recursion(index, parser) {
|
|
4031
|
+
return input => {
|
|
4032
|
+
const context = input;
|
|
4033
|
+
const resources = context.resources ?? {
|
|
4034
|
+
clock: 1,
|
|
4035
|
+
recursions: [1]
|
|
4052
4036
|
};
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
return el;
|
|
4092
|
-
}
|
|
4093
|
-
function index(source) {
|
|
4094
|
-
for (let len = 0, i = 0; i < blocks.length; ++i) {
|
|
4095
|
-
const block = blocks[i];
|
|
4096
|
-
if (block[1].includes(source)) return len;
|
|
4097
|
-
len += block[0].length;
|
|
4098
|
-
}
|
|
4099
|
-
return -1;
|
|
4037
|
+
const {
|
|
4038
|
+
recursions
|
|
4039
|
+
} = resources;
|
|
4040
|
+
recur(recursions, index, 1);
|
|
4041
|
+
const result = parser(input);
|
|
4042
|
+
recur(recursions, index, -1);
|
|
4043
|
+
return result;
|
|
4044
|
+
};
|
|
4045
|
+
}
|
|
4046
|
+
exports.recursion = recursion;
|
|
4047
|
+
function recur(recursions, index, size, force = false) {
|
|
4048
|
+
index = (0, alias_1.min)(index, recursions.length && recursions.length - 1);
|
|
4049
|
+
if (recursions[index] < size - +force) throw new Error('Too much recursion');
|
|
4050
|
+
recursions[index] -= size;
|
|
4051
|
+
}
|
|
4052
|
+
exports.recur = recur;
|
|
4053
|
+
function precedence(precedence, parser) {
|
|
4054
|
+
return input => {
|
|
4055
|
+
const context = input;
|
|
4056
|
+
const {
|
|
4057
|
+
delimiters,
|
|
4058
|
+
precedence: p
|
|
4059
|
+
} = context;
|
|
4060
|
+
const shift = delimiters && precedence > p;
|
|
4061
|
+
context.precedence = precedence;
|
|
4062
|
+
// デリミタはシフト後に設定しなければならない
|
|
4063
|
+
shift && delimiters.shift(precedence);
|
|
4064
|
+
const result = parser(input);
|
|
4065
|
+
shift && delimiters.unshift();
|
|
4066
|
+
context.precedence = p;
|
|
4067
|
+
return result;
|
|
4068
|
+
};
|
|
4069
|
+
}
|
|
4070
|
+
exports.precedence = precedence;
|
|
4071
|
+
function state(state, positive, parser) {
|
|
4072
|
+
if (typeof positive === 'function') {
|
|
4073
|
+
parser = positive;
|
|
4074
|
+
positive = true;
|
|
4100
4075
|
}
|
|
4076
|
+
return input => {
|
|
4077
|
+
const context = input;
|
|
4078
|
+
const s = context.state ?? 0;
|
|
4079
|
+
context.state = positive ? s | state : s & ~state;
|
|
4080
|
+
const result = parser(input);
|
|
4081
|
+
context.state = s;
|
|
4082
|
+
return result;
|
|
4083
|
+
};
|
|
4101
4084
|
}
|
|
4102
|
-
exports.
|
|
4085
|
+
exports.state = state;
|
|
4086
|
+
//export function constraint<P extends Parser>(state: number, positive: boolean, parser: P): P;
|
|
4087
|
+
function constraint(state, positive, parser) {
|
|
4088
|
+
if (typeof positive === 'function') {
|
|
4089
|
+
parser = positive;
|
|
4090
|
+
positive = false;
|
|
4091
|
+
}
|
|
4092
|
+
return input => {
|
|
4093
|
+
const context = input;
|
|
4094
|
+
const s = positive ? state & context.state : state & ~context.state;
|
|
4095
|
+
return s === state ? parser(input) : undefined;
|
|
4096
|
+
};
|
|
4097
|
+
}
|
|
4098
|
+
exports.constraint = constraint;
|
|
4103
4099
|
|
|
4104
4100
|
/***/ },
|
|
4105
4101
|
|
|
4106
|
-
/***/
|
|
4107
|
-
(__unused_webpack_module, exports
|
|
4102
|
+
/***/ 2861
|
|
4103
|
+
(__unused_webpack_module, exports) {
|
|
4108
4104
|
|
|
4109
4105
|
"use strict";
|
|
4110
4106
|
|
|
@@ -4112,16 +4108,30 @@ exports.bind = bind;
|
|
|
4112
4108
|
Object.defineProperty(exports, "__esModule", ({
|
|
4113
4109
|
value: true
|
|
4114
4110
|
}));
|
|
4115
|
-
exports.
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
return
|
|
4111
|
+
exports.inits = void 0;
|
|
4112
|
+
function inits(parsers, delimitation = false) {
|
|
4113
|
+
if (parsers.length === 1) return parsers[0];
|
|
4114
|
+
return input => {
|
|
4115
|
+
const context = input;
|
|
4116
|
+
const {
|
|
4117
|
+
source
|
|
4118
|
+
} = context;
|
|
4119
|
+
let nodes;
|
|
4120
|
+
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
4121
|
+
if (context.position === source.length) break;
|
|
4122
|
+
if (delimitation && context.delimiters.test(input)) break;
|
|
4123
|
+
const result = parsers[i](input);
|
|
4124
|
+
if (result === undefined) break;
|
|
4125
|
+
nodes = nodes?.import(result) ?? result;
|
|
4126
|
+
}
|
|
4127
|
+
return nodes;
|
|
4128
|
+
};
|
|
4119
4129
|
}
|
|
4120
|
-
exports.
|
|
4130
|
+
exports.inits = inits;
|
|
4121
4131
|
|
|
4122
4132
|
/***/ },
|
|
4123
4133
|
|
|
4124
|
-
/***/
|
|
4134
|
+
/***/ 3989
|
|
4125
4135
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
4126
4136
|
|
|
4127
4137
|
"use strict";
|
|
@@ -4130,35 +4140,31 @@ exports.body = body;
|
|
|
4130
4140
|
Object.defineProperty(exports, "__esModule", ({
|
|
4131
4141
|
value: true
|
|
4132
4142
|
}));
|
|
4133
|
-
exports.
|
|
4134
|
-
const
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
exports.
|
|
4154
|
-
code: new tclock_1.TClock(1000),
|
|
4155
|
-
math: new tlru_1.TLRU(1000),
|
|
4156
|
-
media: new tclock_1.TClock(100)
|
|
4157
|
-
};
|
|
4143
|
+
exports.sequence = void 0;
|
|
4144
|
+
const parser_1 = __webpack_require__(605);
|
|
4145
|
+
function sequence(parsers, delimitation = false) {
|
|
4146
|
+
if (parsers.length === 1) return parsers[0];
|
|
4147
|
+
return (0, parser_1.failsafe)(input => {
|
|
4148
|
+
const context = input;
|
|
4149
|
+
const {
|
|
4150
|
+
source
|
|
4151
|
+
} = context;
|
|
4152
|
+
let nodes;
|
|
4153
|
+
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
4154
|
+
if (context.position === source.length) return;
|
|
4155
|
+
if (delimitation && context.delimiters.test(input)) return;
|
|
4156
|
+
const result = parsers[i](input);
|
|
4157
|
+
if (result === undefined) return;
|
|
4158
|
+
nodes = nodes?.import(result) ?? result;
|
|
4159
|
+
}
|
|
4160
|
+
return nodes;
|
|
4161
|
+
});
|
|
4162
|
+
}
|
|
4163
|
+
exports.sequence = sequence;
|
|
4158
4164
|
|
|
4159
4165
|
/***/ },
|
|
4160
4166
|
|
|
4161
|
-
/***/
|
|
4167
|
+
/***/ 2148
|
|
4162
4168
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
4163
4169
|
|
|
4164
4170
|
"use strict";
|
|
@@ -4167,35 +4173,59 @@ exports.caches = {
|
|
|
4167
4173
|
Object.defineProperty(exports, "__esModule", ({
|
|
4168
4174
|
value: true
|
|
4169
4175
|
}));
|
|
4170
|
-
exports.
|
|
4171
|
-
const
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4176
|
+
exports.some = void 0;
|
|
4177
|
+
const delimiter_1 = __webpack_require__(385);
|
|
4178
|
+
function some(parser, delimiter, after, delimiters, limit = 0) {
|
|
4179
|
+
if (typeof delimiter === 'number') {
|
|
4180
|
+
limit = delimiter;
|
|
4181
|
+
delimiters = undefined;
|
|
4182
|
+
delimiter = undefined;
|
|
4183
|
+
} else if (Array.isArray(delimiter)) {
|
|
4184
|
+
limit = after;
|
|
4185
|
+
delimiters = delimiter;
|
|
4186
|
+
delimiter = undefined;
|
|
4187
|
+
} else if (after === undefined || Array.isArray(after)) {
|
|
4188
|
+
limit = delimiters;
|
|
4189
|
+
delimiters = after;
|
|
4190
|
+
after = undefined;
|
|
4191
|
+
} else {
|
|
4192
|
+
delimiters = delimiters;
|
|
4183
4193
|
}
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
+
const match = delimiter_1.Delimiters.tester(delimiter, after);
|
|
4195
|
+
const delims = delimiters?.map(([delimiter, precedence]) => ({
|
|
4196
|
+
signature: delimiter_1.Delimiters.signature(delimiter),
|
|
4197
|
+
tester: delimiter_1.Delimiters.tester(delimiter),
|
|
4198
|
+
precedence
|
|
4199
|
+
}));
|
|
4200
|
+
return input => {
|
|
4201
|
+
const context = input;
|
|
4202
|
+
const {
|
|
4203
|
+
source,
|
|
4204
|
+
position
|
|
4205
|
+
} = context;
|
|
4206
|
+
let nodes;
|
|
4207
|
+
delims && context.delimiters.push(delims);
|
|
4208
|
+
// whileは数倍遅い
|
|
4209
|
+
for (const len = source.length; context.position < len;) {
|
|
4210
|
+
if (match(input)) break;
|
|
4211
|
+
if (context.delimiters.test(input)) break;
|
|
4212
|
+
const pos = context.position;
|
|
4213
|
+
const result = parser(input);
|
|
4214
|
+
if (result === undefined) break;
|
|
4215
|
+
if (context.position === pos) break;
|
|
4216
|
+
nodes = nodes?.import(result) ?? result;
|
|
4217
|
+
// 次にパースに成功すれば確実に制限値を超えるので制限値ちょうどでも中止する
|
|
4218
|
+
if (limit > 0 && context.position - position >= limit) break;
|
|
4219
|
+
}
|
|
4220
|
+
delims && context.delimiters.pop(delims.length);
|
|
4221
|
+
return context.position > position ? nodes : undefined;
|
|
4222
|
+
};
|
|
4194
4223
|
}
|
|
4224
|
+
exports.some = some;
|
|
4195
4225
|
|
|
4196
4226
|
/***/ },
|
|
4197
4227
|
|
|
4198
|
-
/***/
|
|
4228
|
+
/***/ 7429
|
|
4199
4229
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
4200
4230
|
|
|
4201
4231
|
"use strict";
|
|
@@ -4204,78 +4234,17 @@ function parse(source) {
|
|
|
4204
4234
|
Object.defineProperty(exports, "__esModule", ({
|
|
4205
4235
|
value: true
|
|
4206
4236
|
}));
|
|
4207
|
-
exports.
|
|
4208
|
-
const
|
|
4209
|
-
const
|
|
4210
|
-
function
|
|
4211
|
-
return
|
|
4212
|
-
}
|
|
4213
|
-
exports.normalize = normalize;
|
|
4214
|
-
function format(source) {
|
|
4215
|
-
return source.replace(/\r\n?|[\u2028\u2029]/g, '\n');
|
|
4216
|
-
}
|
|
4217
|
-
const invalid = new RegExp([/(?![\t\r\n])[\x00-\x1F\x7F]/g.source, /(?![\u200C\u200D])[\u2006\u200B-\u200F\u202A-\u202F\u2060\uFEFF]/g.source
|
|
4218
|
-
// 後読みが重い
|
|
4219
|
-
///(?<![\u1820\u1821])\u180E/g.source,
|
|
4220
|
-
///[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g.source,
|
|
4221
|
-
].join('|'), 'g');
|
|
4222
|
-
function sanitize(source) {
|
|
4223
|
-
return source.replace(invalid, UNICODE_REPLACEMENT_CHARACTER);
|
|
4224
|
-
}
|
|
4225
|
-
// https://dev.w3.org/html5/html-author/charref
|
|
4226
|
-
// https://en.wikipedia.org/wiki/Whitespace_character
|
|
4227
|
-
const invisibleHTMLEntityNames = ['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'shy', 'ensp', 'emsp', 'emsp13', 'emsp14', 'numsp', 'puncsp', 'ThinSpace', 'thinsp', 'VeryThinSpace', 'hairsp', 'ZeroWidthSpace', 'NegativeVeryThinSpace', 'NegativeThinSpace', 'NegativeMediumSpace', 'NegativeThickSpace', 'zwj', 'zwnj', 'lrm', 'rlm', 'MediumSpace', 'NoBreak', 'ApplyFunction', 'af', 'InvisibleTimes', 'it', 'InvisibleComma', 'ic'];
|
|
4228
|
-
const parser = (el => entity => {
|
|
4229
|
-
if (entity === '
') return entity;
|
|
4230
|
-
el.innerHTML = entity;
|
|
4231
|
-
return el.textContent;
|
|
4232
|
-
})((0, dom_1.html)('span'));
|
|
4233
|
-
exports.invisibleBlankHTMLEntityNames = invisibleHTMLEntityNames.filter(name => parser(`&${name};`).trimStart() === '');
|
|
4234
|
-
exports.invisibleGraphHTMLEntityNames = invisibleHTMLEntityNames.filter(name => parser(`&${name};`).trimStart() !== '');
|
|
4235
|
-
const unreadableEscapeHTMLEntityNames = invisibleHTMLEntityNames.filter(name => !['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'zwj', 'zwnj'].includes(name));
|
|
4236
|
-
const unreadableEscapeCharacters = unreadableEscapeHTMLEntityNames.map(name => parser(`&${name};`));
|
|
4237
|
-
const unreadableEscapeCharacter = new RegExp(`[${unreadableEscapeCharacters.join('')}]`, 'g');
|
|
4238
|
-
// https://www.pandanoir.info/entry/2018/03/11/193000
|
|
4239
|
-
// http://anti.rosx.net/etc/memo/002_space.html
|
|
4240
|
-
// http://nicowiki.com/%E7%A9%BA%E7%99%BD%E3%83%BB%E7%89%B9%E6%AE%8A%E8%A8%98%E5%8F%B7.html
|
|
4241
|
-
const unreadableSpecialCharacters = (/* unused pure expression or super */ null && ([
|
|
4242
|
-
// SIX-PER-EM SPACE
|
|
4243
|
-
'\u2006',
|
|
4244
|
-
// ZERO WIDTH SPACE
|
|
4245
|
-
'\u200B',
|
|
4246
|
-
// ZERO WIDTH NON-JOINER
|
|
4247
|
-
//'\u200C',
|
|
4248
|
-
// ZERO WIDTH JOINER
|
|
4249
|
-
//'\u200D',
|
|
4250
|
-
// LEFT-TO-RIGHT MARK
|
|
4251
|
-
'\u200E',
|
|
4252
|
-
// RIGHT-TO-LEFT MARK
|
|
4253
|
-
'\u200F',
|
|
4254
|
-
// LEFT-TO-RIGHT EMBEDDING
|
|
4255
|
-
'\u202A',
|
|
4256
|
-
// RIGHT-TO-LEFT EMBEDDING
|
|
4257
|
-
'\u202B',
|
|
4258
|
-
// POP DIRECTIONAL FORMATTING
|
|
4259
|
-
'\u202C',
|
|
4260
|
-
// LEFT-TO-RIGHT OVERRIDE
|
|
4261
|
-
'\u202D',
|
|
4262
|
-
// RIGHT-TO-LEFT OVERRIDE
|
|
4263
|
-
'\u202E',
|
|
4264
|
-
// NARROW NO-BREAK SPACE
|
|
4265
|
-
'\u202F',
|
|
4266
|
-
// WORD JOINER
|
|
4267
|
-
'\u2060',
|
|
4268
|
-
// ZERO WIDTH NON-BREAKING SPACE
|
|
4269
|
-
'\uFEFF']));
|
|
4270
|
-
// 特殊不可視文字はエディタおよびソースビューアでは等幅および強調表示により可視化する
|
|
4271
|
-
function escape(source) {
|
|
4272
|
-
return source.replace(unreadableEscapeCharacter, char => `&${unreadableEscapeHTMLEntityNames[unreadableEscapeCharacters.indexOf(char)]};`);
|
|
4237
|
+
exports.subsequence = void 0;
|
|
4238
|
+
const union_1 = __webpack_require__(2369);
|
|
4239
|
+
const inits_1 = __webpack_require__(2861);
|
|
4240
|
+
function subsequence(parsers, delimitation = false) {
|
|
4241
|
+
return (0, union_1.union)(parsers.map((_, i) => i + 1 < parsers.length ? (0, inits_1.inits)([parsers[i], subsequence(parsers.slice(i + 1), delimitation)], delimitation) : parsers[i]));
|
|
4273
4242
|
}
|
|
4274
|
-
exports.
|
|
4243
|
+
exports.subsequence = subsequence;
|
|
4275
4244
|
|
|
4276
4245
|
/***/ },
|
|
4277
4246
|
|
|
4278
|
-
/***/
|
|
4247
|
+
/***/ 765
|
|
4279
4248
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
4280
4249
|
|
|
4281
4250
|
"use strict";
|
|
@@ -4284,47 +4253,37 @@ exports.escape = escape;
|
|
|
4284
4253
|
Object.defineProperty(exports, "__esModule", ({
|
|
4285
4254
|
value: true
|
|
4286
4255
|
}));
|
|
4287
|
-
exports.
|
|
4288
|
-
const
|
|
4289
|
-
const
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
value
|
|
4316
|
-
}) => void acc.push(value) || acc, []);
|
|
4317
|
-
// @ts-expect-error
|
|
4318
|
-
options.header = false;
|
|
4319
|
-
if (es.length === 0) continue;
|
|
4320
|
-
node.append(...es);
|
|
4256
|
+
exports.tails = void 0;
|
|
4257
|
+
const union_1 = __webpack_require__(2369);
|
|
4258
|
+
const sequence_1 = __webpack_require__(3989);
|
|
4259
|
+
function tails(parsers, delimitation) {
|
|
4260
|
+
return (0, union_1.union)(parsers.map((_, i) => (0, sequence_1.sequence)(parsers.slice(i), delimitation)));
|
|
4261
|
+
}
|
|
4262
|
+
exports.tails = tails;
|
|
4263
|
+
|
|
4264
|
+
/***/ },
|
|
4265
|
+
|
|
4266
|
+
/***/ 2369
|
|
4267
|
+
(__unused_webpack_module, exports) {
|
|
4268
|
+
|
|
4269
|
+
"use strict";
|
|
4270
|
+
|
|
4271
|
+
|
|
4272
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
4273
|
+
value: true
|
|
4274
|
+
}));
|
|
4275
|
+
exports.union = void 0;
|
|
4276
|
+
function union(parsers) {
|
|
4277
|
+
switch (parsers.length) {
|
|
4278
|
+
case 0:
|
|
4279
|
+
return () => undefined;
|
|
4280
|
+
case 1:
|
|
4281
|
+
return parsers[0];
|
|
4282
|
+
default:
|
|
4283
|
+
return eval(['(', parsers.map((_, i) => `parser${i},`).join(''), ') =>', 'input =>', parsers.map((_, i) => `|| parser${i}(input)`).join('').slice(2)].join(''))(...parsers);
|
|
4321
4284
|
}
|
|
4322
|
-
if (opts.test) return node;
|
|
4323
|
-
for (const _ of (0, figure_1.figure)(node, opts.notes, options));
|
|
4324
|
-
for (const _ of (0, note_1.note)(node, opts.notes, options));
|
|
4325
|
-
return node;
|
|
4326
4285
|
}
|
|
4327
|
-
exports.
|
|
4286
|
+
exports.union = union;
|
|
4328
4287
|
|
|
4329
4288
|
/***/ },
|
|
4330
4289
|
|
|
@@ -4473,7 +4432,7 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
4473
4432
|
const autolink_1 = __webpack_require__(1671);
|
|
4474
4433
|
const source_1 = __webpack_require__(8745);
|
|
4475
4434
|
const util_1 = __webpack_require__(4992);
|
|
4476
|
-
const parse_1 = __webpack_require__(
|
|
4435
|
+
const parse_1 = __webpack_require__(2032);
|
|
4477
4436
|
const dom_1 = __webpack_require__(394);
|
|
4478
4437
|
exports.segment = (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(/!?>+ /y, (0, combinator_1.some)(source_1.contentline))]));
|
|
4479
4438
|
exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.union)([(0, combinator_1.open)(/(?=>)/y, source), (0, combinator_1.open)(/!(?=>)/y, markdown)]))));
|
|
@@ -4630,7 +4589,7 @@ const parser_1 = __webpack_require__(605);
|
|
|
4630
4589
|
const combinator_1 = __webpack_require__(3484);
|
|
4631
4590
|
const indexee_1 = __webpack_require__(7610);
|
|
4632
4591
|
const util_1 = __webpack_require__(4992);
|
|
4633
|
-
const parse_1 = __webpack_require__(
|
|
4592
|
+
const parse_1 = __webpack_require__(2032);
|
|
4634
4593
|
const dom_1 = __webpack_require__(394);
|
|
4635
4594
|
exports.aside = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})aside(?!\S)([^\r\n]*)(?:$|\r?\n)/y, 300),
|
|
4636
4595
|
// Bug: Type mismatch between outer and inner.
|
|
@@ -4679,7 +4638,7 @@ const parser_1 = __webpack_require__(605);
|
|
|
4679
4638
|
const combinator_1 = __webpack_require__(3484);
|
|
4680
4639
|
const mathblock_1 = __webpack_require__(4903);
|
|
4681
4640
|
const util_1 = __webpack_require__(4992);
|
|
4682
|
-
const parse_1 = __webpack_require__(
|
|
4641
|
+
const parse_1 = __webpack_require__(2032);
|
|
4683
4642
|
const dom_1 = __webpack_require__(394);
|
|
4684
4643
|
exports.example = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:example\/(\S+))?(?!\S)([^\r\n]*)(?:$|\r?\n)/y, 300),
|
|
4685
4644
|
// Bug: Type mismatch between outer and inner.
|
|
@@ -7190,7 +7149,7 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combi
|
|
|
7190
7149
|
})))),
|
|
7191
7150
|
// `{ `と`{`で個別にバックトラックが発生し+1nされる。
|
|
7192
7151
|
// 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
|
|
7193
|
-
(0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.
|
|
7152
|
+
(0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && as))]), ([{
|
|
7194
7153
|
value: content
|
|
7195
7154
|
}, {
|
|
7196
7155
|
value: params = undefined
|
|
@@ -7216,7 +7175,7 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combi
|
|
|
7216
7175
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
7217
7176
|
return new parser_1.List([new parser_1.Node(parse(content, params, context))]);
|
|
7218
7177
|
}));
|
|
7219
|
-
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.
|
|
7178
|
+
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))]), ([{
|
|
7220
7179
|
value: content
|
|
7221
7180
|
}, {
|
|
7222
7181
|
value: params
|
|
@@ -7418,7 +7377,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7418
7377
|
return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
7419
7378
|
}
|
|
7420
7379
|
return ns;
|
|
7421
|
-
})), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.
|
|
7380
|
+
})), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && as))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Node(new parser_1.List([new parser_1.Node('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Node(new parser_1.List([new parser_1.Node(nodes.head.value.foldl((acc, {
|
|
7422
7381
|
value
|
|
7423
7382
|
}) => acc + value, ''), nodes.head.value.head?.flags)])), nodes.delete(nodes.last)])), ([{
|
|
7424
7383
|
value: [{
|
|
@@ -7703,246 +7662,30 @@ const text = input => {
|
|
|
7703
7662
|
context.position += 1;
|
|
7704
7663
|
continue;
|
|
7705
7664
|
}
|
|
7706
|
-
const result = (0, source_1.txt)(input);
|
|
7707
|
-
acc.last.value += result.head?.value ?? '';
|
|
7708
|
-
continue;
|
|
7709
|
-
}
|
|
7710
|
-
}
|
|
7711
|
-
}
|
|
7712
|
-
context.sequential = false;
|
|
7713
|
-
state ||= acc.last.value.trimStart() !== '';
|
|
7714
|
-
return state ? acc : undefined;
|
|
7715
|
-
};
|
|
7716
|
-
function* zip(a, b) {
|
|
7717
|
-
const ia = a[Symbol.iterator]();
|
|
7718
|
-
const ib = b[Symbol.iterator]();
|
|
7719
|
-
for (;;) {
|
|
7720
|
-
const ra = ia.next();
|
|
7721
|
-
const rb = ib.next();
|
|
7722
|
-
if (ra.done) break;
|
|
7723
|
-
yield [ra.value, rb.value];
|
|
7724
|
-
}
|
|
7725
|
-
}
|
|
7726
|
-
|
|
7727
|
-
/***/ },
|
|
7728
|
-
|
|
7729
|
-
/***/ 5902
|
|
7730
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7731
|
-
|
|
7732
|
-
"use strict";
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
7736
|
-
value: true
|
|
7737
|
-
}));
|
|
7738
|
-
exports.lineshortmedia = exports.shortmedia = void 0;
|
|
7739
|
-
const combinator_1 = __webpack_require__(3484);
|
|
7740
|
-
const url_1 = __webpack_require__(2129);
|
|
7741
|
-
const media_1 = __webpack_require__(7478);
|
|
7742
|
-
exports.shortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.rewrite)((0, combinator_1.open)('!', url_1.url), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
|
|
7743
|
-
exports.lineshortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.focus)(/(?<=^|[\r\n])!https?:\/\/\S+(?=[^\S\r\n]*(?:$|\r?\n))/y, (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
|
|
7744
|
-
|
|
7745
|
-
/***/ },
|
|
7746
|
-
|
|
7747
|
-
/***/ 6591
|
|
7748
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7749
|
-
|
|
7750
|
-
"use strict";
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
7754
|
-
value: true
|
|
7755
|
-
}));
|
|
7756
|
-
exports.strong = void 0;
|
|
7757
|
-
const parser_1 = __webpack_require__(605);
|
|
7758
|
-
const combinator_1 = __webpack_require__(3484);
|
|
7759
|
-
const inline_1 = __webpack_require__(7973);
|
|
7760
|
-
const emphasis_1 = __webpack_require__(1354);
|
|
7761
|
-
const source_1 = __webpack_require__(8745);
|
|
7762
|
-
const visibility_1 = __webpack_require__(6364);
|
|
7763
|
-
const util_1 = __webpack_require__(4992);
|
|
7764
|
-
const dom_1 = __webpack_require__(394);
|
|
7765
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', (0, visibility_1.beforeNonblankWith)(/(?!\*)/)), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank), emphasis_1.emphasis])))), (0, source_1.str)('**'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
|
|
7766
|
-
|
|
7767
|
-
/***/ },
|
|
7768
|
-
|
|
7769
|
-
/***/ 4510
|
|
7770
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7771
|
-
|
|
7772
|
-
"use strict";
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
7776
|
-
value: true
|
|
7777
|
-
}));
|
|
7778
|
-
exports.template = void 0;
|
|
7779
|
-
const parser_1 = __webpack_require__(605);
|
|
7780
|
-
const combinator_1 = __webpack_require__(3484);
|
|
7781
|
-
const source_1 = __webpack_require__(8745);
|
|
7782
|
-
const util_1 = __webpack_require__(4992);
|
|
7783
|
-
const dom_1 = __webpack_require__(394);
|
|
7784
|
-
exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7785
|
-
class: 'template'
|
|
7786
|
-
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7787
|
-
class: 'invalid',
|
|
7788
|
-
...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
|
|
7789
|
-
}, context.source.slice(context.position - context.range, context.position)))])));
|
|
7790
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs]) => bs && as.import(bs))]));
|
|
7791
|
-
|
|
7792
|
-
/***/ },
|
|
7793
|
-
|
|
7794
|
-
/***/ 8068
|
|
7795
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7796
|
-
|
|
7797
|
-
"use strict";
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
7801
|
-
value: true
|
|
7802
|
-
}));
|
|
7803
|
-
exports.isBlankHTMLEntityName = void 0;
|
|
7804
|
-
const normalize_1 = __webpack_require__(4490);
|
|
7805
|
-
exports.isBlankHTMLEntityName = eval(['name => {', 'switch(name){', normalize_1.invisibleBlankHTMLEntityNames.map(name => `case '${name}':`).join(''), 'return true;', 'default:', 'return false;', '}', '}'].join(''));
|
|
7806
|
-
|
|
7807
|
-
/***/ },
|
|
7808
|
-
|
|
7809
|
-
/***/ 1657
|
|
7810
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7811
|
-
|
|
7812
|
-
"use strict";
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
7816
|
-
value: true
|
|
7817
|
-
}));
|
|
7818
|
-
exports.figure = void 0;
|
|
7819
|
-
const label_1 = __webpack_require__(2178);
|
|
7820
|
-
const util_1 = __webpack_require__(4992);
|
|
7821
|
-
const queue_1 = __webpack_require__(4110);
|
|
7822
|
-
const array_1 = __webpack_require__(6876);
|
|
7823
|
-
const dom_1 = __webpack_require__(394);
|
|
7824
|
-
const query_1 = __webpack_require__(2282);
|
|
7825
|
-
function* figure(target, notes, opts = {}) {
|
|
7826
|
-
const selector = ':is(figure[data-label], h1, h2)';
|
|
7827
|
-
const refs = new queue_1.MultiQueue((0, array_1.push)((0, query_1.querySelectorAll)(target, 'a.label:not(.local)[data-label]'), notes && (0, query_1.querySelectorAll)(notes.references, 'a.label:not(.local)') || []).map(el => [el.getAttribute('data-label'), el]));
|
|
7828
|
-
const labels = new Set();
|
|
7829
|
-
const numbers = new Map();
|
|
7830
|
-
let base = '0';
|
|
7831
|
-
let bases = base.split('.');
|
|
7832
|
-
let index = bases;
|
|
7833
|
-
for (let defs = target instanceof Element ? target.querySelectorAll(`:scope > ${selector}`) : target.querySelectorAll(`${selector}:not(* > *)`), len = defs.length, i = 0; i < len; ++i) {
|
|
7834
|
-
yield;
|
|
7835
|
-
const def = defs[i];
|
|
7836
|
-
const {
|
|
7837
|
-
tagName
|
|
7838
|
-
} = def;
|
|
7839
|
-
if (bases.length === 1 && tagName[0] === 'H') continue;
|
|
7840
|
-
const label = tagName === 'FIGURE' ? def.getAttribute('data-label') : `$-${increment(index, def)}`;
|
|
7841
|
-
if (label.endsWith('-')) continue;
|
|
7842
|
-
if (label.endsWith('-0')) {
|
|
7843
|
-
(0, util_1.markInvalid)(def, 'figure', 'argument', 'Invalid base index');
|
|
7844
|
-
(0, dom_1.define)(def, {
|
|
7845
|
-
hidden: null
|
|
7846
|
-
});
|
|
7847
|
-
continue;
|
|
7848
|
-
}
|
|
7849
|
-
if (tagName === 'FIGURE' && label.endsWith('.0')) {
|
|
7850
|
-
// $-x.x.0 is disabled.
|
|
7851
|
-
if (label.lastIndexOf('.', label.length - 3) !== -1) {
|
|
7852
|
-
(0, util_1.markInvalid)(def, 'figure', 'argument', 'Base index must be $-x.0 format');
|
|
7853
|
-
(0, dom_1.define)(def, {
|
|
7854
|
-
hidden: null
|
|
7855
|
-
});
|
|
7856
|
-
continue;
|
|
7857
|
-
}
|
|
7858
|
-
// $-x.0 after h1-h6.
|
|
7859
|
-
if (!/^H[1-6]$/.test(def.previousElementSibling?.tagName ?? '')) {
|
|
7860
|
-
(0, util_1.markInvalid)(def, 'figure', 'position', messages.declaration);
|
|
7861
|
-
(0, dom_1.define)(def, {
|
|
7862
|
-
hidden: null
|
|
7863
|
-
});
|
|
7864
|
-
continue;
|
|
7865
|
-
} else if (def.getAttribute('data-invalid-message') === messages.declaration) {
|
|
7866
|
-
(0, util_1.unmarkInvalid)(def);
|
|
7867
|
-
(0, dom_1.define)(def, {
|
|
7868
|
-
hidden: null
|
|
7869
|
-
});
|
|
7870
|
-
}
|
|
7871
|
-
}
|
|
7872
|
-
const group = label.split('-', 1)[0];
|
|
7873
|
-
let number = (0, label_1.number)(label, numbers.has(group) && !(0, label_1.isFixed)(label) ? numbers.get(group).split('.').slice(0, bases.length).join('.') : base);
|
|
7874
|
-
if (number.endsWith('.0')) {
|
|
7875
|
-
if (group !== '$' || tagName === 'FIGURE' && def.firstChild) continue;
|
|
7876
|
-
if (number.startsWith('0.')) {
|
|
7877
|
-
number = index.slice(0).reduce((ns, _, i, xs) => {
|
|
7878
|
-
i === ns.length ? xs.length = i : ns[i] = +ns[i] > +xs[i] ? ns[i] : +ns[i] === 0 ? xs[i] : `${+xs[i] + 1}`;
|
|
7879
|
-
return ns;
|
|
7880
|
-
}, number.split('.')).join('.');
|
|
7881
|
-
}
|
|
7882
|
-
base = number;
|
|
7883
|
-
bases = index = base.split('.');
|
|
7884
|
-
tagName !== 'FIGURE' && numbers.clear();
|
|
7885
|
-
continue;
|
|
7886
|
-
}
|
|
7887
|
-
!(0, label_1.isFixed)(label) && numbers.set(group, number);
|
|
7888
|
-
const figindex = group === '$' ? `(${number})` : `${capitalize(group)}${group === 'fig' ? '.' : ''} ${number}`;
|
|
7889
|
-
(0, dom_1.define)(def.querySelector(':scope > figcaption > .figindex'), group === '$' ? figindex : `${figindex}. `);
|
|
7890
|
-
if (labels.has(label)) {
|
|
7891
|
-
if (def.classList.contains('invalid')) continue;
|
|
7892
|
-
(0, dom_1.define)(def, {
|
|
7893
|
-
id: null
|
|
7894
|
-
});
|
|
7895
|
-
(0, util_1.markInvalid)(def, 'figure', 'argument', messages.duplicate);
|
|
7896
|
-
continue;
|
|
7897
|
-
} else if (def.getAttribute('data-invalid-message') === messages.duplicate) {
|
|
7898
|
-
(0, util_1.unmarkInvalid)(def);
|
|
7899
|
-
}
|
|
7900
|
-
labels.add(label);
|
|
7901
|
-
opts.id !== '' && def.setAttribute('id', `label:${opts.id ? `${opts.id}:` : ''}${label}`);
|
|
7902
|
-
for (const ref of refs.take(label, Infinity)) {
|
|
7903
|
-
if (ref.getAttribute('data-invalid-message') === messages.reference) {
|
|
7904
|
-
(0, util_1.unmarkInvalid)(ref);
|
|
7905
|
-
}
|
|
7906
|
-
if (ref.hash.slice(1) === def.id && ref.innerText === figindex) continue;
|
|
7907
|
-
yield (0, dom_1.define)(ref, {
|
|
7908
|
-
class: opts.local ? `${ref.className} local` : undefined,
|
|
7909
|
-
href: opts.id !== '' ? `#${def.id}` : undefined
|
|
7910
|
-
}, figindex);
|
|
7911
|
-
}
|
|
7912
|
-
}
|
|
7913
|
-
for (const [, ref] of refs) {
|
|
7914
|
-
if (opts.id !== '' && !ref.classList.contains('invalid')) {
|
|
7915
|
-
(0, util_1.markInvalid)(ref, 'label', 'reference', messages.reference);
|
|
7665
|
+
const result = (0, source_1.txt)(input);
|
|
7666
|
+
acc.last.value += result.head?.value ?? '';
|
|
7667
|
+
continue;
|
|
7668
|
+
}
|
|
7916
7669
|
}
|
|
7917
|
-
yield ref;
|
|
7918
7670
|
}
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
declaration: 'Base index declarations must be after level 1 to 6 headings',
|
|
7923
|
-
duplicate: 'Duplicate label',
|
|
7924
|
-
reference: 'Missing the target figure'
|
|
7671
|
+
context.sequential = false;
|
|
7672
|
+
state ||= acc.last.value.trimStart() !== '';
|
|
7673
|
+
return state ? acc : undefined;
|
|
7925
7674
|
};
|
|
7926
|
-
function
|
|
7927
|
-
const
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
return 0;
|
|
7936
|
-
}
|
|
7937
|
-
}).join('.') : '';
|
|
7938
|
-
}
|
|
7939
|
-
function capitalize(label) {
|
|
7940
|
-
return label[0].toUpperCase() + label.slice(1);
|
|
7675
|
+
function* zip(a, b) {
|
|
7676
|
+
const ia = a[Symbol.iterator]();
|
|
7677
|
+
const ib = b[Symbol.iterator]();
|
|
7678
|
+
for (;;) {
|
|
7679
|
+
const ra = ia.next();
|
|
7680
|
+
const rb = ib.next();
|
|
7681
|
+
if (ra.done) break;
|
|
7682
|
+
yield [ra.value, rb.value];
|
|
7683
|
+
}
|
|
7941
7684
|
}
|
|
7942
7685
|
|
|
7943
7686
|
/***/ },
|
|
7944
7687
|
|
|
7945
|
-
/***/
|
|
7688
|
+
/***/ 5902
|
|
7946
7689
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7947
7690
|
|
|
7948
7691
|
"use strict";
|
|
@@ -7951,166 +7694,74 @@ function capitalize(label) {
|
|
|
7951
7694
|
Object.defineProperty(exports, "__esModule", ({
|
|
7952
7695
|
value: true
|
|
7953
7696
|
}));
|
|
7954
|
-
exports.
|
|
7955
|
-
const
|
|
7697
|
+
exports.lineshortmedia = exports.shortmedia = void 0;
|
|
7698
|
+
const combinator_1 = __webpack_require__(3484);
|
|
7699
|
+
const url_1 = __webpack_require__(2129);
|
|
7700
|
+
const media_1 = __webpack_require__(7478);
|
|
7701
|
+
exports.shortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.rewrite)((0, combinator_1.open)('!', url_1.url), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
|
|
7702
|
+
exports.lineshortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.focus)(/(?<=^|[\r\n])!https?:\/\/\S+(?=[^\S\r\n]*(?:$|\r?\n))/y, (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
|
|
7703
|
+
|
|
7704
|
+
/***/ },
|
|
7705
|
+
|
|
7706
|
+
/***/ 6591
|
|
7707
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7708
|
+
|
|
7709
|
+
"use strict";
|
|
7710
|
+
|
|
7711
|
+
|
|
7712
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
7713
|
+
value: true
|
|
7714
|
+
}));
|
|
7715
|
+
exports.strong = void 0;
|
|
7716
|
+
const parser_1 = __webpack_require__(605);
|
|
7717
|
+
const combinator_1 = __webpack_require__(3484);
|
|
7718
|
+
const inline_1 = __webpack_require__(7973);
|
|
7719
|
+
const emphasis_1 = __webpack_require__(1354);
|
|
7720
|
+
const source_1 = __webpack_require__(8745);
|
|
7721
|
+
const visibility_1 = __webpack_require__(6364);
|
|
7956
7722
|
const util_1 = __webpack_require__(4992);
|
|
7957
|
-
const memoize_1 = __webpack_require__(6925);
|
|
7958
7723
|
const dom_1 = __webpack_require__(394);
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
const
|
|
7975
|
-
const
|
|
7976
|
-
const
|
|
7977
|
-
const
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
title: '' && 0,
|
|
8001
|
-
queue: []
|
|
8002
|
-
}));
|
|
8003
|
-
const splitters = splitter ? target instanceof Element ? target.querySelectorAll(`:scope > :is(${splitter}, .${list})`) : target.querySelectorAll(`:is(${splitter}, .${list}):not(* > *)`) : [];
|
|
8004
|
-
let iSplitters = 0;
|
|
8005
|
-
let total = 0;
|
|
8006
|
-
let format;
|
|
8007
|
-
let refIndex = 0;
|
|
8008
|
-
for (let len = refs.length, i = 0; i < len; ++i) {
|
|
8009
|
-
const ref = refs[i];
|
|
8010
|
-
if (splitter) for (let splitter; splitter = splitters[iSplitters]; ++iSplitters) {
|
|
8011
|
-
const pos = splitter?.compareDocumentPosition(ref) ?? 0;
|
|
8012
|
-
if (pos & (Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_DISCONNECTED)) break;
|
|
8013
|
-
if (~iSplitters << 32 - 8 === 0) yield;
|
|
8014
|
-
if (splitter.classList.contains(list) && splitter.nextElementSibling !== splitters[iSplitters + 1]) {
|
|
8015
|
-
yield* proc(splitter);
|
|
8016
|
-
splitter.remove();
|
|
8017
|
-
continue;
|
|
8018
|
-
}
|
|
8019
|
-
if (defs.size > 0) {
|
|
8020
|
-
total += defs.size;
|
|
8021
|
-
const note = splitter.classList.contains(list) ? splitter : target.insertBefore((0, dom_1.html)('ol', {
|
|
8022
|
-
class: list
|
|
8023
|
-
}), splitter);
|
|
8024
|
-
yield* proc(note, defs);
|
|
8025
|
-
}
|
|
8026
|
-
}
|
|
8027
|
-
const {
|
|
8028
|
-
content,
|
|
8029
|
-
identifier,
|
|
8030
|
-
abbr,
|
|
8031
|
-
text
|
|
8032
|
-
} = refInfoCaller(ref);
|
|
8033
|
-
const info = identifierInfoCaller(identifier);
|
|
8034
|
-
const refSubindex = ++info.refSubindex;
|
|
8035
|
-
const refId = opts.id !== '' ? `${syntax}:${opts.id ?? ''}:ref:${identifier}:${refSubindex}` : undefined;
|
|
8036
|
-
const initial = splitter ? !defs.has(identifier) : refSubindex === 1;
|
|
8037
|
-
const defSubindex = initial ? ++info.defSubindex : info.defSubindex;
|
|
8038
|
-
const defId = opts.id !== '' ? `${syntax}:${opts.id ?? ''}:def:${identifier}${splitter && `:${defSubindex}`}` : undefined;
|
|
8039
|
-
const def = initial ? (0, dom_1.html)('li', {
|
|
8040
|
-
id: defId,
|
|
8041
|
-
'data-marker': note ? undefined : marker(total + defs.size + 1, abbr)
|
|
8042
|
-
}, [content, (0, dom_1.html)('sup')]) : defs.get(identifier);
|
|
8043
|
-
initial && defs.set(identifier, def);
|
|
8044
|
-
if (!initial && content.innerHTML.length > def.firstElementChild.innerHTML.length) {
|
|
8045
|
-
def.firstElementChild.replaceWith(content);
|
|
8046
|
-
}
|
|
8047
|
-
const defIndex = initial ? info.defIndex = total + defs.size : info.defIndex;
|
|
8048
|
-
const title = info.title ||= text;
|
|
8049
|
-
(0, dom_1.define)(ref, {
|
|
8050
|
-
id: refId,
|
|
8051
|
-
class: opts.local ? `${ref.className} local` : undefined,
|
|
8052
|
-
title
|
|
8053
|
-
}, []);
|
|
8054
|
-
if (title && info.queue.length > 0) {
|
|
8055
|
-
for (const ref of info.queue) {
|
|
8056
|
-
(0, dom_1.define)(ref, {
|
|
8057
|
-
title
|
|
8058
|
-
});
|
|
8059
|
-
(0, util_1.unmarkInvalid)(ref);
|
|
8060
|
-
}
|
|
8061
|
-
info.queue = [];
|
|
8062
|
-
def.firstElementChild.replaceWith(content);
|
|
8063
|
-
}
|
|
8064
|
-
switch (ref.getAttribute('data-invalid-syntax')) {
|
|
8065
|
-
case 'format':
|
|
8066
|
-
case 'content':
|
|
8067
|
-
(0, util_1.unmarkInvalid)(ref);
|
|
8068
|
-
}
|
|
8069
|
-
format ??= abbr ? 'abbr' : 'number';
|
|
8070
|
-
if (!ref.classList.contains('invalid')) switch (true) {
|
|
8071
|
-
case format === 'number' ? abbr !== '' : abbr === '':
|
|
8072
|
-
(0, util_1.markInvalid)(ref, syntax, 'format', 'Notation format must be consistent with numbers or abbreviations');
|
|
8073
|
-
break;
|
|
8074
|
-
case title === '':
|
|
8075
|
-
(0, util_1.markInvalid)(ref, syntax, 'content', 'Missing the content');
|
|
8076
|
-
info.queue.push(ref);
|
|
8077
|
-
break;
|
|
8078
|
-
}
|
|
8079
|
-
ref.appendChild((0, dom_1.html)('a', {
|
|
8080
|
-
href: refId && defId && `#${defId}`
|
|
8081
|
-
}, marker(defIndex, abbr)));
|
|
8082
|
-
def.lastElementChild.appendChild((0, dom_1.html)('a', {
|
|
8083
|
-
href: refId && `#${refId}`,
|
|
8084
|
-
title: abbr && text || undefined
|
|
8085
|
-
}, `^${++refIndex}`));
|
|
8086
|
-
yield;
|
|
8087
|
-
}
|
|
8088
|
-
if (note || defs.size > 0) {
|
|
8089
|
-
const splitter = splitters[iSplitters++];
|
|
8090
|
-
note ??= splitter?.classList.contains(list) ? splitter : target.insertBefore((0, dom_1.html)('ol', {
|
|
8091
|
-
class: list
|
|
8092
|
-
}), splitter ?? bottom);
|
|
8093
|
-
yield* proc(note, defs);
|
|
8094
|
-
}
|
|
8095
|
-
if (splitter) for (let splitter; splitter = splitters[iSplitters]; ++iSplitters) {
|
|
8096
|
-
if (~iSplitters << 32 - 8 === 0) yield;
|
|
8097
|
-
if (splitter.classList.contains(list)) {
|
|
8098
|
-
yield* proc(splitter);
|
|
8099
|
-
splitter.remove();
|
|
8100
|
-
}
|
|
8101
|
-
}
|
|
8102
|
-
};
|
|
8103
|
-
}
|
|
8104
|
-
function* proc(note, defs) {
|
|
8105
|
-
for (let defs = note.children, i = defs.length; i--;) {
|
|
8106
|
-
yield note.removeChild(defs[i]);
|
|
8107
|
-
}
|
|
8108
|
-
if (!defs) return;
|
|
8109
|
-
for (const [, def] of defs) {
|
|
8110
|
-
yield note.appendChild(def);
|
|
8111
|
-
}
|
|
8112
|
-
defs.clear();
|
|
8113
|
-
}
|
|
7724
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', (0, visibility_1.beforeNonblankWith)(/(?!\*)/)), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank), emphasis_1.emphasis])))), (0, source_1.str)('**'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
|
|
7725
|
+
|
|
7726
|
+
/***/ },
|
|
7727
|
+
|
|
7728
|
+
/***/ 4510
|
|
7729
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7730
|
+
|
|
7731
|
+
"use strict";
|
|
7732
|
+
|
|
7733
|
+
|
|
7734
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
7735
|
+
value: true
|
|
7736
|
+
}));
|
|
7737
|
+
exports.template = void 0;
|
|
7738
|
+
const parser_1 = __webpack_require__(605);
|
|
7739
|
+
const combinator_1 = __webpack_require__(3484);
|
|
7740
|
+
const source_1 = __webpack_require__(8745);
|
|
7741
|
+
const util_1 = __webpack_require__(4992);
|
|
7742
|
+
const dom_1 = __webpack_require__(394);
|
|
7743
|
+
exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7744
|
+
class: 'template'
|
|
7745
|
+
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7746
|
+
class: 'invalid',
|
|
7747
|
+
...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
|
|
7748
|
+
}, context.source.slice(context.position - context.range, context.position)))])));
|
|
7749
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs]) => bs && as.import(bs))]));
|
|
7750
|
+
|
|
7751
|
+
/***/ },
|
|
7752
|
+
|
|
7753
|
+
/***/ 8068
|
|
7754
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7755
|
+
|
|
7756
|
+
"use strict";
|
|
7757
|
+
|
|
7758
|
+
|
|
7759
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
7760
|
+
value: true
|
|
7761
|
+
}));
|
|
7762
|
+
exports.isBlankHTMLEntityName = void 0;
|
|
7763
|
+
const normalize_1 = __webpack_require__(5188);
|
|
7764
|
+
exports.isBlankHTMLEntityName = eval(['name => {', 'switch(name){', normalize_1.invisibleBlankHTMLEntityNames.map(name => `case '${name}':`).join(''), 'return true;', 'default:', 'return false;', '}', '}'].join(''));
|
|
8114
7765
|
|
|
8115
7766
|
/***/ },
|
|
8116
7767
|
|
|
@@ -8996,11 +8647,265 @@ exports.stringify = stringify;
|
|
|
8996
8647
|
function randomID() {
|
|
8997
8648
|
return `random-${(0, random_1.rnd0Z)(6)}`;
|
|
8998
8649
|
}
|
|
8999
|
-
exports.randomID = randomID;
|
|
8650
|
+
exports.randomID = randomID;
|
|
8651
|
+
|
|
8652
|
+
/***/ },
|
|
8653
|
+
|
|
8654
|
+
/***/ 6364
|
|
8655
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
8656
|
+
|
|
8657
|
+
"use strict";
|
|
8658
|
+
|
|
8659
|
+
|
|
8660
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
8661
|
+
value: true
|
|
8662
|
+
}));
|
|
8663
|
+
exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlank = exports.isNonblankNodeStart = exports.isNonblankFirstLine = exports.beforeNonblankWith = exports.blankWith = exports.afterNonblank = exports.beforeNonblank = exports.visualize = void 0;
|
|
8664
|
+
const parser_1 = __webpack_require__(605);
|
|
8665
|
+
const combinator_1 = __webpack_require__(3484);
|
|
8666
|
+
const normalize_1 = __webpack_require__(5188);
|
|
8667
|
+
var blank;
|
|
8668
|
+
(function (blank) {
|
|
8669
|
+
blank.line = new RegExp(/((?:^|\n)[^\S\r\n]*(?=\S))((?:[^\S\r\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+(?=$|\r?\n))/g.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'g');
|
|
8670
|
+
blank.start = new RegExp(/(?:[^\S\r\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
|
|
8671
|
+
blank.unit = new RegExp(/(?:[^\S\r\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
|
|
8672
|
+
})(blank || (blank = {}));
|
|
8673
|
+
function visualize(parser) {
|
|
8674
|
+
return (0, combinator_1.convert)(source => source.replace(blank.line, `$1${"\u001B" /* Command.Escape */}$2`), parser);
|
|
8675
|
+
}
|
|
8676
|
+
exports.visualize = visualize;
|
|
8677
|
+
exports.beforeNonblank = beforeNonblankWith('');
|
|
8678
|
+
exports.afterNonblank = afterNonblankWith('');
|
|
8679
|
+
function blankWith(starts, delimiter) {
|
|
8680
|
+
return new RegExp([
|
|
8681
|
+
// 空行除去
|
|
8682
|
+
// 完全な空行はエスケープ済みなので再帰的バックトラックにはならない。
|
|
8683
|
+
String.raw`(?:${starts}(?:\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)*)?`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
|
|
8684
|
+
}
|
|
8685
|
+
exports.blankWith = blankWith;
|
|
8686
|
+
function beforeNonblankWith(delimiter) {
|
|
8687
|
+
return new RegExp([typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source, String.raw`(?!\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`].join(''), 'y');
|
|
8688
|
+
}
|
|
8689
|
+
exports.beforeNonblankWith = beforeNonblankWith;
|
|
8690
|
+
function afterNonblankWith(delimiter) {
|
|
8691
|
+
return new RegExp([String.raw`(?<!\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
|
|
8692
|
+
}
|
|
8693
|
+
function isNonblankFirstLine(nodes) {
|
|
8694
|
+
if (nodes.length === 0) return true;
|
|
8695
|
+
for (const node of nodes) {
|
|
8696
|
+
if (isNonblank(node)) return true;
|
|
8697
|
+
if (node.flags & 1 /* Flag.blank */ && typeof node.value === 'object' && node.value.tagName === 'BR') break;
|
|
8698
|
+
}
|
|
8699
|
+
return false;
|
|
8700
|
+
}
|
|
8701
|
+
exports.isNonblankFirstLine = isNonblankFirstLine;
|
|
8702
|
+
function isNonblankNodeStart(nodes) {
|
|
8703
|
+
if (nodes.length === 0) return true;
|
|
8704
|
+
return isNonblank(nodes.head, 0);
|
|
8705
|
+
}
|
|
8706
|
+
exports.isNonblankNodeStart = isNonblankNodeStart;
|
|
8707
|
+
function isNonblank({
|
|
8708
|
+
value: node,
|
|
8709
|
+
flags
|
|
8710
|
+
}, strpos) {
|
|
8711
|
+
if (flags & 1 /* Flag.blank */) return false;
|
|
8712
|
+
if (typeof node !== 'string') return true;
|
|
8713
|
+
const str = node && strpos !== undefined ? node[strpos >= 0 ? strpos : node.length + strpos] : node;
|
|
8714
|
+
switch (str) {
|
|
8715
|
+
case '':
|
|
8716
|
+
case ' ':
|
|
8717
|
+
case '\t':
|
|
8718
|
+
case '\r':
|
|
8719
|
+
case '\n':
|
|
8720
|
+
return false;
|
|
8721
|
+
default:
|
|
8722
|
+
return str.trimStart() !== '';
|
|
8723
|
+
}
|
|
8724
|
+
}
|
|
8725
|
+
function trimBlank(parser) {
|
|
8726
|
+
return trimBlankStart(trimBlankEnd(parser));
|
|
8727
|
+
}
|
|
8728
|
+
exports.trimBlank = trimBlank;
|
|
8729
|
+
function trimBlankStart(parser) {
|
|
8730
|
+
return input => {
|
|
8731
|
+
const context = input;
|
|
8732
|
+
const {
|
|
8733
|
+
source,
|
|
8734
|
+
position
|
|
8735
|
+
} = context;
|
|
8736
|
+
if (position === source.length) return;
|
|
8737
|
+
const reg = blank.start;
|
|
8738
|
+
reg.lastIndex = position;
|
|
8739
|
+
reg.test(source);
|
|
8740
|
+
context.position = reg.lastIndex || position;
|
|
8741
|
+
return context.position === source.length ? new parser_1.List() : parser(input);
|
|
8742
|
+
};
|
|
8743
|
+
}
|
|
8744
|
+
function trimBlankEnd(parser) {
|
|
8745
|
+
return (0, combinator_1.fmap)(parser, trimBlankNodeEnd);
|
|
8746
|
+
}
|
|
8747
|
+
exports.trimBlankEnd = trimBlankEnd;
|
|
8748
|
+
function trimBlankNodeEnd(nodes) {
|
|
8749
|
+
const skip = nodes.last && ~nodes.last.flags & 1 /* Flag.blank */ && typeof nodes.last.value === 'object' ? nodes.last.value.className === 'indexer' : false;
|
|
8750
|
+
for (let node = skip ? nodes.last?.prev : nodes.last; node;) {
|
|
8751
|
+
if (~node.flags & 1 /* Flag.blank */) {
|
|
8752
|
+
if (typeof node.value === 'string') {
|
|
8753
|
+
const str = node.value.trimEnd();
|
|
8754
|
+
if (str.length > 0) {
|
|
8755
|
+
node.value = str;
|
|
8756
|
+
break;
|
|
8757
|
+
}
|
|
8758
|
+
} else {
|
|
8759
|
+
break;
|
|
8760
|
+
}
|
|
8761
|
+
}
|
|
8762
|
+
const target = node;
|
|
8763
|
+
node = node.prev;
|
|
8764
|
+
nodes.delete(target);
|
|
8765
|
+
}
|
|
8766
|
+
return nodes;
|
|
8767
|
+
}
|
|
8768
|
+
exports.trimBlankNodeEnd = trimBlankNodeEnd;
|
|
8769
|
+
|
|
8770
|
+
/***/ },
|
|
8771
|
+
|
|
8772
|
+
/***/ 5815
|
|
8773
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
8774
|
+
|
|
8775
|
+
"use strict";
|
|
8776
|
+
|
|
8777
|
+
|
|
8778
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
8779
|
+
value: true
|
|
8780
|
+
}));
|
|
8781
|
+
exports.figure = void 0;
|
|
8782
|
+
const label_1 = __webpack_require__(2178);
|
|
8783
|
+
const util_1 = __webpack_require__(4992);
|
|
8784
|
+
const queue_1 = __webpack_require__(4110);
|
|
8785
|
+
const array_1 = __webpack_require__(6876);
|
|
8786
|
+
const dom_1 = __webpack_require__(394);
|
|
8787
|
+
const query_1 = __webpack_require__(2282);
|
|
8788
|
+
function* figure(target, notes, opts = {}) {
|
|
8789
|
+
const selector = ':is(figure[data-label], h1, h2)';
|
|
8790
|
+
const refs = new queue_1.MultiQueue((0, array_1.push)((0, query_1.querySelectorAll)(target, 'a.label:not(.local)[data-label]'), notes && (0, query_1.querySelectorAll)(notes.references, 'a.label:not(.local)') || []).map(el => [el.getAttribute('data-label'), el]));
|
|
8791
|
+
const labels = new Set();
|
|
8792
|
+
const numbers = new Map();
|
|
8793
|
+
let base = '0';
|
|
8794
|
+
let bases = base.split('.');
|
|
8795
|
+
let index = bases;
|
|
8796
|
+
for (let defs = target instanceof Element ? target.querySelectorAll(`:scope > ${selector}`) : target.querySelectorAll(`${selector}:not(* > *)`), len = defs.length, i = 0; i < len; ++i) {
|
|
8797
|
+
yield;
|
|
8798
|
+
const def = defs[i];
|
|
8799
|
+
const {
|
|
8800
|
+
tagName
|
|
8801
|
+
} = def;
|
|
8802
|
+
if (bases.length === 1 && tagName[0] === 'H') continue;
|
|
8803
|
+
const label = tagName === 'FIGURE' ? def.getAttribute('data-label') : `$-${increment(index, def)}`;
|
|
8804
|
+
if (label.endsWith('-')) continue;
|
|
8805
|
+
if (label.endsWith('-0')) {
|
|
8806
|
+
(0, util_1.markInvalid)(def, 'figure', 'argument', 'Invalid base index');
|
|
8807
|
+
(0, dom_1.define)(def, {
|
|
8808
|
+
hidden: null
|
|
8809
|
+
});
|
|
8810
|
+
continue;
|
|
8811
|
+
}
|
|
8812
|
+
if (tagName === 'FIGURE' && label.endsWith('.0')) {
|
|
8813
|
+
// $-x.x.0 is disabled.
|
|
8814
|
+
if (label.lastIndexOf('.', label.length - 3) !== -1) {
|
|
8815
|
+
(0, util_1.markInvalid)(def, 'figure', 'argument', 'Base index must be $-x.0 format');
|
|
8816
|
+
(0, dom_1.define)(def, {
|
|
8817
|
+
hidden: null
|
|
8818
|
+
});
|
|
8819
|
+
continue;
|
|
8820
|
+
}
|
|
8821
|
+
// $-x.0 after h1-h6.
|
|
8822
|
+
if (!/^H[1-6]$/.test(def.previousElementSibling?.tagName ?? '')) {
|
|
8823
|
+
(0, util_1.markInvalid)(def, 'figure', 'position', messages.declaration);
|
|
8824
|
+
(0, dom_1.define)(def, {
|
|
8825
|
+
hidden: null
|
|
8826
|
+
});
|
|
8827
|
+
continue;
|
|
8828
|
+
} else if (def.getAttribute('data-invalid-message') === messages.declaration) {
|
|
8829
|
+
(0, util_1.unmarkInvalid)(def);
|
|
8830
|
+
(0, dom_1.define)(def, {
|
|
8831
|
+
hidden: null
|
|
8832
|
+
});
|
|
8833
|
+
}
|
|
8834
|
+
}
|
|
8835
|
+
const group = label.split('-', 1)[0];
|
|
8836
|
+
let number = (0, label_1.number)(label, numbers.has(group) && !(0, label_1.isFixed)(label) ? numbers.get(group).split('.').slice(0, bases.length).join('.') : base);
|
|
8837
|
+
if (number.endsWith('.0')) {
|
|
8838
|
+
if (group !== '$' || tagName === 'FIGURE' && def.firstChild) continue;
|
|
8839
|
+
if (number.startsWith('0.')) {
|
|
8840
|
+
number = index.slice(0).reduce((ns, _, i, xs) => {
|
|
8841
|
+
i === ns.length ? xs.length = i : ns[i] = +ns[i] > +xs[i] ? ns[i] : +ns[i] === 0 ? xs[i] : `${+xs[i] + 1}`;
|
|
8842
|
+
return ns;
|
|
8843
|
+
}, number.split('.')).join('.');
|
|
8844
|
+
}
|
|
8845
|
+
base = number;
|
|
8846
|
+
bases = index = base.split('.');
|
|
8847
|
+
tagName !== 'FIGURE' && numbers.clear();
|
|
8848
|
+
continue;
|
|
8849
|
+
}
|
|
8850
|
+
!(0, label_1.isFixed)(label) && numbers.set(group, number);
|
|
8851
|
+
const figindex = group === '$' ? `(${number})` : `${capitalize(group)}${group === 'fig' ? '.' : ''} ${number}`;
|
|
8852
|
+
(0, dom_1.define)(def.querySelector(':scope > figcaption > .figindex'), group === '$' ? figindex : `${figindex}. `);
|
|
8853
|
+
if (labels.has(label)) {
|
|
8854
|
+
if (def.classList.contains('invalid')) continue;
|
|
8855
|
+
(0, dom_1.define)(def, {
|
|
8856
|
+
id: null
|
|
8857
|
+
});
|
|
8858
|
+
(0, util_1.markInvalid)(def, 'figure', 'argument', messages.duplicate);
|
|
8859
|
+
continue;
|
|
8860
|
+
} else if (def.getAttribute('data-invalid-message') === messages.duplicate) {
|
|
8861
|
+
(0, util_1.unmarkInvalid)(def);
|
|
8862
|
+
}
|
|
8863
|
+
labels.add(label);
|
|
8864
|
+
opts.id !== '' && def.setAttribute('id', `label:${opts.id ? `${opts.id}:` : ''}${label}`);
|
|
8865
|
+
for (const ref of refs.take(label, Infinity)) {
|
|
8866
|
+
if (ref.getAttribute('data-invalid-message') === messages.reference) {
|
|
8867
|
+
(0, util_1.unmarkInvalid)(ref);
|
|
8868
|
+
}
|
|
8869
|
+
if (ref.hash.slice(1) === def.id && ref.innerText === figindex) continue;
|
|
8870
|
+
yield (0, dom_1.define)(ref, {
|
|
8871
|
+
class: opts.local ? `${ref.className} local` : undefined,
|
|
8872
|
+
href: opts.id !== '' ? `#${def.id}` : undefined
|
|
8873
|
+
}, figindex);
|
|
8874
|
+
}
|
|
8875
|
+
}
|
|
8876
|
+
for (const [, ref] of refs) {
|
|
8877
|
+
if (opts.id !== '' && !ref.classList.contains('invalid')) {
|
|
8878
|
+
(0, util_1.markInvalid)(ref, 'label', 'reference', messages.reference);
|
|
8879
|
+
}
|
|
8880
|
+
yield ref;
|
|
8881
|
+
}
|
|
8882
|
+
}
|
|
8883
|
+
exports.figure = figure;
|
|
8884
|
+
const messages = {
|
|
8885
|
+
declaration: 'Base index declarations must be after level 1 to 6 headings',
|
|
8886
|
+
duplicate: 'Duplicate label',
|
|
8887
|
+
reference: 'Missing the target figure'
|
|
8888
|
+
};
|
|
8889
|
+
function increment(bases, el) {
|
|
8890
|
+
const index = (+el.tagName[1] - 1 || 1) - 1;
|
|
8891
|
+
return index + 1 < bases.length ? bases.slice(0, index + 2).map((v, i) => {
|
|
8892
|
+
switch (true) {
|
|
8893
|
+
case i < index:
|
|
8894
|
+
return v;
|
|
8895
|
+
case i === index:
|
|
8896
|
+
return +v + 1;
|
|
8897
|
+
default:
|
|
8898
|
+
return 0;
|
|
8899
|
+
}
|
|
8900
|
+
}).join('.') : '';
|
|
8901
|
+
}
|
|
8902
|
+
function capitalize(label) {
|
|
8903
|
+
return label[0].toUpperCase() + label.slice(1);
|
|
8904
|
+
}
|
|
9000
8905
|
|
|
9001
8906
|
/***/ },
|
|
9002
8907
|
|
|
9003
|
-
/***/
|
|
8908
|
+
/***/ 8119
|
|
9004
8909
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
9005
8910
|
|
|
9006
8911
|
"use strict";
|
|
@@ -9009,112 +8914,166 @@ exports.randomID = randomID;
|
|
|
9009
8914
|
Object.defineProperty(exports, "__esModule", ({
|
|
9010
8915
|
value: true
|
|
9011
8916
|
}));
|
|
9012
|
-
exports.
|
|
9013
|
-
const
|
|
9014
|
-
const
|
|
9015
|
-
const
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
exports.afterNonblank = afterNonblankWith('');
|
|
9028
|
-
function blankWith(starts, delimiter) {
|
|
9029
|
-
return new RegExp([
|
|
9030
|
-
// 空行除去
|
|
9031
|
-
// 完全な空行はエスケープ済みなので再帰的バックトラックにはならない。
|
|
9032
|
-
String.raw`(?:${starts}(?:\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)*)?`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
|
|
9033
|
-
}
|
|
9034
|
-
exports.blankWith = blankWith;
|
|
9035
|
-
function beforeNonblankWith(delimiter) {
|
|
9036
|
-
return new RegExp([typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source, String.raw`(?!\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`].join(''), 'y');
|
|
9037
|
-
}
|
|
9038
|
-
exports.beforeNonblankWith = beforeNonblankWith;
|
|
9039
|
-
function afterNonblankWith(delimiter) {
|
|
9040
|
-
return new RegExp([String.raw`(?<!\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
|
|
9041
|
-
}
|
|
9042
|
-
function isNonblankFirstLine(nodes) {
|
|
9043
|
-
if (nodes.length === 0) return true;
|
|
9044
|
-
for (const node of nodes) {
|
|
9045
|
-
if (isNonblank(node)) return true;
|
|
9046
|
-
if (node.flags & 1 /* Flag.blank */ && typeof node.value === 'object' && node.value.tagName === 'BR') break;
|
|
9047
|
-
}
|
|
9048
|
-
return false;
|
|
9049
|
-
}
|
|
9050
|
-
exports.isNonblankFirstLine = isNonblankFirstLine;
|
|
9051
|
-
function isNonblankNodeStart(nodes) {
|
|
9052
|
-
if (nodes.length === 0) return true;
|
|
9053
|
-
return isNonblank(nodes.head, 0);
|
|
9054
|
-
}
|
|
9055
|
-
exports.isNonblankNodeStart = isNonblankNodeStart;
|
|
9056
|
-
function isNonblank({
|
|
9057
|
-
value: node,
|
|
9058
|
-
flags
|
|
9059
|
-
}, strpos) {
|
|
9060
|
-
if (flags & 1 /* Flag.blank */) return false;
|
|
9061
|
-
if (typeof node !== 'string') return true;
|
|
9062
|
-
const str = node && strpos !== undefined ? node[strpos >= 0 ? strpos : node.length + strpos] : node;
|
|
9063
|
-
switch (str) {
|
|
9064
|
-
case '':
|
|
9065
|
-
case ' ':
|
|
9066
|
-
case '\t':
|
|
9067
|
-
case '\r':
|
|
9068
|
-
case '\n':
|
|
9069
|
-
return false;
|
|
9070
|
-
default:
|
|
9071
|
-
return str.trimStart() !== '';
|
|
8917
|
+
exports.note = void 0;
|
|
8918
|
+
const indexee_1 = __webpack_require__(7610);
|
|
8919
|
+
const util_1 = __webpack_require__(4992);
|
|
8920
|
+
const memoize_1 = __webpack_require__(6925);
|
|
8921
|
+
const dom_1 = __webpack_require__(394);
|
|
8922
|
+
function* note(target, notes, opts = {}, bottom = null) {
|
|
8923
|
+
const referenceRefMemory = referenceRefsMemoryCaller(target);
|
|
8924
|
+
const annotationRefMemory = annotationRefsMemoryCaller(target);
|
|
8925
|
+
for (const memory of [referenceRefMemory, annotationRefMemory]) {
|
|
8926
|
+
for (const [ref, {
|
|
8927
|
+
content
|
|
8928
|
+
}] of memory) {
|
|
8929
|
+
ref.replaceChildren(content);
|
|
8930
|
+
}
|
|
8931
|
+
memory.clear();
|
|
9072
8932
|
}
|
|
8933
|
+
yield* reference(referenceRefMemory, target, notes?.references, opts, bottom);
|
|
8934
|
+
yield* annotation(annotationRefMemory, target, notes?.annotations, opts, bottom);
|
|
9073
8935
|
}
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
8936
|
+
exports.note = note;
|
|
8937
|
+
const annotationRefsMemoryCaller = (0, memoize_1.memoize)(target => new Map() ?? target, new WeakMap());
|
|
8938
|
+
const referenceRefsMemoryCaller = (0, memoize_1.memoize)(target => new Map() ?? target, new WeakMap());
|
|
8939
|
+
const annotation = build('annotation', 'annotations', '.annotation:not(:is(.annotations, .references) &, .local)', n => `*${n}`, 'h1, h2, h3, h4, h5, h6, aside.aside, hr');
|
|
8940
|
+
const reference = build('reference', 'references', '.reference:not(:is(.annotations, .references) &, .local)', (n, abbr) => `[${abbr || n}]`);
|
|
8941
|
+
function build(syntax, list, selector, marker, splitter = '') {
|
|
8942
|
+
splitter &&= `${splitter}, .${list}`;
|
|
8943
|
+
return function* (memory, target, note, opts = {}, bottom = null) {
|
|
8944
|
+
const refInfoCaller = (0, memoize_1.memoize)(ref => {
|
|
8945
|
+
const content = ref.firstElementChild;
|
|
8946
|
+
const abbr = ref.getAttribute('data-abbr') ?? '';
|
|
8947
|
+
const clone = ref.cloneNode(true);
|
|
8948
|
+
const txt = (0, indexee_1.text)(clone).trim();
|
|
8949
|
+
const identifier = abbr ? (0, indexee_1.identity)('', undefined, abbr.match(/^(?:\S+ )+?(?:(?:January|February|March|April|May|June|August|September|October|November|December) \d{1,2}(?:-\d{0,2})?, \d{1,4}(?:-\d{0,4})?[a-z]?|n\.d\.)(?=,|$)/)?.[0] ?? abbr.match(/^[^,\s]+(?:,? [^,\s]+)*?(?: \d{1,4}(?:-\d{0,4})?[a-z]?(?=,|$)|(?=,(?: [a-z]+\.?)? [0-9]))/)?.[0] ?? abbr)?.slice(2) || '' : (0, indexee_1.identity)('mark', undefined, (0, indexee_1.signature)(clone))?.slice(6) || '';
|
|
8950
|
+
return {
|
|
8951
|
+
content,
|
|
8952
|
+
identifier,
|
|
8953
|
+
abbr,
|
|
8954
|
+
text: txt
|
|
8955
|
+
};
|
|
8956
|
+
}, memory);
|
|
8957
|
+
const defs = new Map();
|
|
8958
|
+
const refs = target.querySelectorAll(selector);
|
|
8959
|
+
const identifierInfoCaller = (0, memoize_1.memoize)(identifier => ({
|
|
8960
|
+
defIndex: 0,
|
|
8961
|
+
defSubindex: 0,
|
|
8962
|
+
refSubindex: 0,
|
|
8963
|
+
title: '' && 0,
|
|
8964
|
+
queue: []
|
|
8965
|
+
}));
|
|
8966
|
+
const splitters = splitter ? target instanceof Element ? target.querySelectorAll(`:scope > :is(${splitter}, .${list})`) : target.querySelectorAll(`:is(${splitter}, .${list}):not(* > *)`) : [];
|
|
8967
|
+
let iSplitters = 0;
|
|
8968
|
+
let total = 0;
|
|
8969
|
+
let format;
|
|
8970
|
+
let refIndex = 0;
|
|
8971
|
+
for (let len = refs.length, i = 0; i < len; ++i) {
|
|
8972
|
+
const ref = refs[i];
|
|
8973
|
+
if (splitter) for (let splitter; splitter = splitters[iSplitters]; ++iSplitters) {
|
|
8974
|
+
const pos = splitter?.compareDocumentPosition(ref) ?? 0;
|
|
8975
|
+
if (pos & (Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_DISCONNECTED)) break;
|
|
8976
|
+
if (~iSplitters << 32 - 8 === 0) yield;
|
|
8977
|
+
if (splitter.classList.contains(list) && splitter.nextElementSibling !== splitters[iSplitters + 1]) {
|
|
8978
|
+
yield* proc(splitter);
|
|
8979
|
+
splitter.remove();
|
|
8980
|
+
continue;
|
|
9106
8981
|
}
|
|
9107
|
-
|
|
9108
|
-
|
|
8982
|
+
if (defs.size > 0) {
|
|
8983
|
+
total += defs.size;
|
|
8984
|
+
const note = splitter.classList.contains(list) ? splitter : target.insertBefore((0, dom_1.html)('ol', {
|
|
8985
|
+
class: list
|
|
8986
|
+
}), splitter);
|
|
8987
|
+
yield* proc(note, defs);
|
|
8988
|
+
}
|
|
8989
|
+
}
|
|
8990
|
+
const {
|
|
8991
|
+
content,
|
|
8992
|
+
identifier,
|
|
8993
|
+
abbr,
|
|
8994
|
+
text
|
|
8995
|
+
} = refInfoCaller(ref);
|
|
8996
|
+
const info = identifierInfoCaller(identifier);
|
|
8997
|
+
const refSubindex = ++info.refSubindex;
|
|
8998
|
+
const refId = opts.id !== '' ? `${syntax}:${opts.id ?? ''}:ref:${identifier}:${refSubindex}` : undefined;
|
|
8999
|
+
const initial = splitter ? !defs.has(identifier) : refSubindex === 1;
|
|
9000
|
+
const defSubindex = initial ? ++info.defSubindex : info.defSubindex;
|
|
9001
|
+
const defId = opts.id !== '' ? `${syntax}:${opts.id ?? ''}:def:${identifier}${splitter && `:${defSubindex}`}` : undefined;
|
|
9002
|
+
const def = initial ? (0, dom_1.html)('li', {
|
|
9003
|
+
id: defId,
|
|
9004
|
+
'data-marker': note ? undefined : marker(total + defs.size + 1, abbr)
|
|
9005
|
+
}, [content, (0, dom_1.html)('sup')]) : defs.get(identifier);
|
|
9006
|
+
initial && defs.set(identifier, def);
|
|
9007
|
+
if (!initial && content.innerHTML.length > def.firstElementChild.innerHTML.length) {
|
|
9008
|
+
def.firstElementChild.replaceWith(content);
|
|
9009
|
+
}
|
|
9010
|
+
const defIndex = initial ? info.defIndex = total + defs.size : info.defIndex;
|
|
9011
|
+
const title = info.title ||= text;
|
|
9012
|
+
(0, dom_1.define)(ref, {
|
|
9013
|
+
id: refId,
|
|
9014
|
+
class: opts.local ? `${ref.className} local` : undefined,
|
|
9015
|
+
title
|
|
9016
|
+
}, []);
|
|
9017
|
+
if (title && info.queue.length > 0) {
|
|
9018
|
+
for (const ref of info.queue) {
|
|
9019
|
+
(0, dom_1.define)(ref, {
|
|
9020
|
+
title
|
|
9021
|
+
});
|
|
9022
|
+
(0, util_1.unmarkInvalid)(ref);
|
|
9023
|
+
}
|
|
9024
|
+
info.queue = [];
|
|
9025
|
+
def.firstElementChild.replaceWith(content);
|
|
9026
|
+
}
|
|
9027
|
+
switch (ref.getAttribute('data-invalid-syntax')) {
|
|
9028
|
+
case 'format':
|
|
9029
|
+
case 'content':
|
|
9030
|
+
(0, util_1.unmarkInvalid)(ref);
|
|
9031
|
+
}
|
|
9032
|
+
format ??= abbr ? 'abbr' : 'number';
|
|
9033
|
+
if (!ref.classList.contains('invalid')) switch (true) {
|
|
9034
|
+
case format === 'number' ? abbr !== '' : abbr === '':
|
|
9035
|
+
(0, util_1.markInvalid)(ref, syntax, 'format', 'Notation format must be consistent with numbers or abbreviations');
|
|
9036
|
+
break;
|
|
9037
|
+
case title === '':
|
|
9038
|
+
(0, util_1.markInvalid)(ref, syntax, 'content', 'Missing the content');
|
|
9039
|
+
info.queue.push(ref);
|
|
9040
|
+
break;
|
|
9041
|
+
}
|
|
9042
|
+
ref.appendChild((0, dom_1.html)('a', {
|
|
9043
|
+
href: refId && defId && `#${defId}`
|
|
9044
|
+
}, marker(defIndex, abbr)));
|
|
9045
|
+
def.lastElementChild.appendChild((0, dom_1.html)('a', {
|
|
9046
|
+
href: refId && `#${refId}`,
|
|
9047
|
+
title: abbr && text || undefined
|
|
9048
|
+
}, `^${++refIndex}`));
|
|
9049
|
+
yield;
|
|
9050
|
+
}
|
|
9051
|
+
if (note || defs.size > 0) {
|
|
9052
|
+
const splitter = splitters[iSplitters++];
|
|
9053
|
+
note ??= splitter?.classList.contains(list) ? splitter : target.insertBefore((0, dom_1.html)('ol', {
|
|
9054
|
+
class: list
|
|
9055
|
+
}), splitter ?? bottom);
|
|
9056
|
+
yield* proc(note, defs);
|
|
9057
|
+
}
|
|
9058
|
+
if (splitter) for (let splitter; splitter = splitters[iSplitters]; ++iSplitters) {
|
|
9059
|
+
if (~iSplitters << 32 - 8 === 0) yield;
|
|
9060
|
+
if (splitter.classList.contains(list)) {
|
|
9061
|
+
yield* proc(splitter);
|
|
9062
|
+
splitter.remove();
|
|
9109
9063
|
}
|
|
9110
9064
|
}
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9065
|
+
};
|
|
9066
|
+
}
|
|
9067
|
+
function* proc(note, defs) {
|
|
9068
|
+
for (let defs = note.children, i = defs.length; i--;) {
|
|
9069
|
+
yield note.removeChild(defs[i]);
|
|
9114
9070
|
}
|
|
9115
|
-
return
|
|
9071
|
+
if (!defs) return;
|
|
9072
|
+
for (const [, def] of defs) {
|
|
9073
|
+
yield note.appendChild(def);
|
|
9074
|
+
}
|
|
9075
|
+
defs.clear();
|
|
9116
9076
|
}
|
|
9117
|
-
exports.trimBlankNodeEnd = trimBlankNodeEnd;
|
|
9118
9077
|
|
|
9119
9078
|
/***/ },
|
|
9120
9079
|
|
|
@@ -9344,7 +9303,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9344
9303
|
value: true
|
|
9345
9304
|
}));
|
|
9346
9305
|
exports.pdf = void 0;
|
|
9347
|
-
const
|
|
9306
|
+
const api_1 = __webpack_require__(3972);
|
|
9348
9307
|
const dom_1 = __webpack_require__(394);
|
|
9349
9308
|
const extensions = ['.pdf'];
|
|
9350
9309
|
function pdf(source, url) {
|
|
@@ -9355,7 +9314,7 @@ function pdf(source, url) {
|
|
|
9355
9314
|
}, [(0, dom_1.html)('object', {
|
|
9356
9315
|
type: 'application/pdf',
|
|
9357
9316
|
data: source.getAttribute('data-src')
|
|
9358
|
-
}), (0, dom_1.html)('div', [(0, dom_1.define)((0,
|
|
9317
|
+
}), (0, dom_1.html)('div', [(0, dom_1.define)((0, api_1.parse)(`{ ${source.getAttribute('data-src')} }`).querySelector('a'), {
|
|
9359
9318
|
class: null,
|
|
9360
9319
|
target: '_blank'
|
|
9361
9320
|
})])]);
|
|
@@ -9379,7 +9338,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9379
9338
|
value: true
|
|
9380
9339
|
}));
|
|
9381
9340
|
exports.twitter = void 0;
|
|
9382
|
-
const
|
|
9341
|
+
const api_1 = __webpack_require__(3972);
|
|
9383
9342
|
const dom_1 = __webpack_require__(394);
|
|
9384
9343
|
const dompurify_1 = __importDefault(__webpack_require__(611));
|
|
9385
9344
|
const origins = ['https://twitter.com'];
|
|
@@ -9411,7 +9370,7 @@ function twitter(source, url) {
|
|
|
9411
9370
|
status,
|
|
9412
9371
|
statusText
|
|
9413
9372
|
}) {
|
|
9414
|
-
(0, dom_1.define)(el, [(0, dom_1.define)((0,
|
|
9373
|
+
(0, dom_1.define)(el, [(0, dom_1.define)((0, api_1.parse)(`{ ${source.getAttribute('data-src')} }`).querySelector('a'), {
|
|
9415
9374
|
class: null,
|
|
9416
9375
|
target: '_blank'
|
|
9417
9376
|
}), (0, dom_1.html)('pre', `${status}\n${statusText}`)]);
|