@kky42/pievo-server 2.3.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/MachinesModal-CSbnrUER.js +1 -0
- package/.output/public/assets/SignIn-0Tjqs-Ma.js +1 -0
- package/.output/public/assets/actionUi-DpwGIGpw.js +1 -0
- package/.output/public/assets/app-CaZpuwOS.css +2 -0
- package/.output/public/assets/index-CaS_SmDq.js +10 -0
- package/.output/public/assets/invite._token-Btg_0aLp.js +1 -0
- package/.output/public/assets/invite._token-KMD2JAgE.js +1 -0
- package/.output/public/assets/lifecycleUi-C7dwHtbw.js +1 -0
- package/.output/public/assets/loops._loopId-D5usF3DO.js +67 -0
- package/.output/public/assets/loops._loopId_.runs._runId-DRCgXaCq.js +3 -0
- package/.output/public/assets/preload-helper-DsxECZIS.js +5 -0
- package/.output/public/assets/routes-CtFgwdgW.js +1 -0
- package/.output/public/assets/routes-LDbnnQ3f.js +1 -0
- package/.output/public/assets/t._teamId-D41xcbsF.js +1 -0
- package/.output/public/assets/t._teamId-DUena1pV.js +1 -0
- package/.output/public/assets/ui-Do4gqMyP.js +1 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +4130 -4130
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
- package/.output/server/_libs/drizzle-orm+postgres.mjs +28 -1
- package/.output/server/_ssr/DashboardView-C2LdV6J0.mjs +914 -0
- package/.output/server/_ssr/{notifyFns-DuPR1zd7.mjs → MachinesModal-BjkcVjjx.mjs} +55 -35
- package/.output/server/_ssr/{SignIn-RmpWm9uy.mjs → SignIn-DEGrvJvb.mjs} +10 -24
- package/.output/server/_ssr/SocialLinks-Cm4H8pUJ.mjs +1044 -0
- package/.output/server/_ssr/{actionUi-BN55TNYE.mjs → actionUi-DJBWuNwr.mjs} +3 -3
- package/.output/server/_ssr/{artifactFiles-BCaIIrrT.mjs → artifactFiles-DtpRidFZ.mjs} +7 -8
- package/.output/server/_ssr/{artifactKind-BW0isV8L.mjs → artifactKind-FBYbgSuf.mjs} +27 -2
- package/.output/server/_ssr/artifacts-BR3jj0NC.mjs +2 -0
- package/.output/server/_ssr/{auth-30Z4lV1w.mjs → auth-C0zoZCGe.mjs} +16 -19
- package/.output/server/_ssr/boot-CdOO4xOo.mjs +2 -0
- package/.output/server/_ssr/{boot-3BNKujyp.mjs → boot-sNlIkoLe.mjs} +1331 -3927
- package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-_7tfuNRi.mjs → bun-sqlite-dialect-BW9W1_Ps-DmlZWqO7.mjs} +2 -2
- package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-ucDUbeBk.mjs → d1-sqlite-dialect-BLC8LXE6-CCNzqZwZ.mjs} +2 -2
- package/.output/server/_ssr/db-CwLD-5w1.mjs +2 -0
- package/.output/server/_ssr/{dist-Cd6nlLlO.mjs → dist-B3SxDOpW.mjs} +2 -2
- package/.output/server/_ssr/{factory-CWWwV7XZ.mjs → factory-Dv3Zopis.mjs} +2 -2
- package/.output/server/_ssr/invite._token-CJ6-H-s3.mjs +20 -0
- package/.output/server/_ssr/{invite._token-SdWXemIc.mjs → invite._token-dLKDJKVs.mjs} +9 -17
- package/.output/server/_ssr/{invite._token-BKlz0R2f.mjs → invite._token-l1SjouDz.mjs} +6 -15
- package/.output/server/_ssr/{kysely-adapter-C8iS51DB.mjs → kysely-adapter-nL7WKSgw.mjs} +1 -1
- package/.output/server/_ssr/{lifecycleUi-DgBQAYzp.mjs → lifecycleUi-Dad3hvhm.mjs} +11 -11
- package/.output/server/_ssr/logger-B8m8F1Qu.mjs +2 -0
- package/.output/server/_ssr/loopApi-BKyFB4KM.mjs +342 -0
- package/.output/server/_ssr/{adapters-BoLkOf1T.mjs → loopProjection-B8a829ij.mjs} +25 -55
- package/.output/server/_ssr/loops._loopId-DS16Phmq.mjs +1271 -0
- package/.output/server/_ssr/{loops._loopId_.runs._runId-PUGBrD5q.mjs → loops._loopId_.runs._runId-BEJI6iK5.mjs} +23 -74
- package/.output/server/_ssr/{loops._loopId_.runs._runId-Ymy4lwee.mjs → loops._loopId_.runs._runId-CduETLqH.mjs} +4 -5
- package/.output/server/_ssr/{machineFns-BZ9puxDt.mjs → machineFns-ByMsgG12.mjs} +3 -5
- package/.output/server/_ssr/{node-sqlite-dialect-D_3JmkMo.mjs → node-sqlite-dialect-CjNineno.mjs} +2 -2
- package/.output/server/_ssr/router-CXyrnvx-.mjs +565 -0
- package/.output/server/_ssr/{routes-ClZEdsnB.mjs → routes-BulNEUEE.mjs} +6 -10
- package/.output/server/_ssr/{routes-ComqHvCL.mjs → routes-DD94baie.mjs} +3 -3
- package/.output/server/_ssr/{routes-D5jJJ-30.mjs → routes-Wjexi35W.mjs} +6 -6
- package/.output/server/_ssr/runDiff-Ba8Lg1vg.mjs +2 -0
- package/.output/server/_ssr/ssr.mjs +60 -100
- package/.output/server/_ssr/store-Cujtg2QE.mjs +2 -0
- package/.output/server/_ssr/{t._teamId-BgHV_KFP.mjs → t._teamId-1CreIlPV.mjs} +7 -11
- package/.output/server/_ssr/{t._teamId-DDERNgfn.mjs → t._teamId-Bd6-zZsy.mjs} +4 -4
- package/.output/server/_ssr/{t._teamId-DRJvKHZn.mjs → t._teamId-COuMKQ4r.mjs} +7 -7
- package/.output/server/_ssr/{teamFns-Bp81UO-x.mjs → teamFns-H438WnZC.mjs} +12 -30
- package/.output/server/_ssr/{teamFns-bm82twd5.mjs → teamFns-j2JKjorZ.mjs} +2 -2
- package/.output/server/_ssr/tokens-DgG_Syq3.mjs +2 -0
- package/.output/server/_ssr/{ui-Ww2tTM2u.mjs → ui-D5KWstlb.mjs} +26 -48
- package/.output/server/{_tanstack-start-manifest_v-DwKENYCN.mjs → _tanstack-start-manifest_v-3H7yBKLz.mjs} +25 -35
- package/{drizzle/0000_round_marauders.sql → .output/server/drizzle/0000_baseline.sql} +102 -44
- package/.output/server/drizzle/meta/_journal.json +3 -115
- package/.output/server/index.mjs +83 -132
- package/{.output/server/drizzle/0000_round_marauders.sql → drizzle/0000_baseline.sql} +102 -44
- package/drizzle/meta/_journal.json +3 -115
- package/package.json +2 -11
- package/scripts/pievo-server.mjs +3 -1
- package/scripts/server-cli-lib.mjs +23 -16
- package/.output/public/assets/CodeField-dOzyFQNH.js +0 -34
- package/.output/public/assets/LoopView-DjVHUyrR.js +0 -59
- package/.output/public/assets/Modal-CCRvx959.js +0 -1
- package/.output/public/assets/SignIn-Qxw5zDFq.js +0 -1
- package/.output/public/assets/actionUi-CXxhzYe2.js +0 -1
- package/.output/public/assets/app-D1cij_NJ.css +0 -2
- package/.output/public/assets/artifactView-Cd5wWPil.js +0 -66
- package/.output/public/assets/index-BRN_CQ8U.js +0 -12
- package/.output/public/assets/invite._token-BIxr8DlP.js +0 -1
- package/.output/public/assets/invite._token-j2BTCeG1.js +0 -1
- package/.output/public/assets/jsx-runtime-BseJUIpC.js +0 -1
- package/.output/public/assets/lifecycleUi-Qy_8beQK.js +0 -1
- package/.output/public/assets/loopApi-CT1mMhlb.js +0 -3
- package/.output/public/assets/loops._loopId-BRBQzioy.js +0 -4
- package/.output/public/assets/loops._loopId_.runs._runId-CMnOJkem.js +0 -3
- package/.output/public/assets/notifyFns-DYD4EKaG.js +0 -1
- package/.output/public/assets/preload-helper-DFkkpP6W.js +0 -3
- package/.output/public/assets/routes-3nuEJGdo.js +0 -1
- package/.output/public/assets/routes-DORLim-C.js +0 -1
- package/.output/public/assets/t._teamId-F5f4K8kd.js +0 -1
- package/.output/public/assets/t._teamId-XfE_S1Fo.js +0 -1
- package/.output/public/assets/ui-Dhsx6SW0.js +0 -1
- package/.output/public/assets/useRouter-DsjH8G0p.js +0 -1
- package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +0 -19713
- package/.output/server/_libs/@codemirror/lang-css+[...].mjs +0 -2636
- package/.output/server/_libs/@codemirror/lang-html+[...].mjs +0 -2247
- package/.output/server/_libs/@codemirror/lang-json+[...].mjs +0 -79
- package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +0 -1736
- package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +0 -76
- package/.output/server/_libs/babel__runtime.mjs +0 -30
- package/.output/server/_libs/clsx.mjs +0 -16
- package/.output/server/_libs/codemirror__commands.mjs +0 -1725
- package/.output/server/_libs/codemirror__lint.mjs +0 -565
- package/.output/server/_libs/codemirror__search.mjs +0 -1138
- package/.output/server/_libs/codemirror__theme-one-dark.mjs +0 -161
- package/.output/server/_libs/d3-array.mjs +0 -231
- package/.output/server/_libs/d3-color.mjs +0 -330
- package/.output/server/_libs/d3-format.mjs +0 -252
- package/.output/server/_libs/d3-interpolate.mjs +0 -163
- package/.output/server/_libs/d3-path.mjs +0 -77
- package/.output/server/_libs/d3-scale+[...].mjs +0 -1907
- package/.output/server/_libs/d3-shape.mjs +0 -818
- package/.output/server/_libs/decimal.js-light.mjs +0 -884
- package/.output/server/_libs/dom-serializer+[...].mjs +0 -708
- package/.output/server/_libs/domhandler.mjs +0 -461
- package/.output/server/_libs/domutils.mjs +0 -868
- package/.output/server/_libs/es-toolkit.mjs +0 -1737
- package/.output/server/_libs/eventemitter3.mjs +0 -236
- package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +0 -1560
- package/.output/server/_libs/html-react-parser+[...].mjs +0 -1360
- package/.output/server/_libs/react-is.mjs +0 -48
- package/.output/server/_libs/react-redux+[...].mjs +0 -205
- package/.output/server/_libs/recharts+victory-vendor.mjs +0 -17303
- package/.output/server/_libs/uiw__codemirror-themes.mjs +0 -32
- package/.output/server/_libs/uiw__react-codemirror.mjs +0 -354
- package/.output/server/_ssr/CodeField-B7oOmmwH.mjs +0 -143
- package/.output/server/_ssr/DashboardView-BF7PciP7.mjs +0 -2736
- package/.output/server/_ssr/LoopPlaybook-DC7QVvPY.mjs +0 -2105
- package/.output/server/_ssr/LoopView-DwSrm9Ja.mjs +0 -1300
- package/.output/server/_ssr/Modal-MaCG52Pv.mjs +0 -49
- package/.output/server/_ssr/artifactView-iuPsp5aa.mjs +0 -304
- package/.output/server/_ssr/artifacts-jQ-bfdhI.mjs +0 -2
- package/.output/server/_ssr/boot-CsEFT53K.mjs +0 -2
- package/.output/server/_ssr/db-CXownd1H.mjs +0 -2
- package/.output/server/_ssr/invite._token-CWl6kipD.mjs +0 -28
- package/.output/server/_ssr/logger-Gy-47z3k.mjs +0 -2
- package/.output/server/_ssr/loopApi-8_KgBapr.mjs +0 -109
- package/.output/server/_ssr/loopApi-ABi9SgWS.mjs +0 -564
- package/.output/server/_ssr/loops._loopId-SON_t43g.mjs +0 -30
- package/.output/server/_ssr/loops._loopId-p1KWsvMM.mjs +0 -1477
- package/.output/server/_ssr/notifyFns-BUCePuF3.mjs +0 -118
- package/.output/server/_ssr/router-Czxvra6l.mjs +0 -685
- package/.output/server/_ssr/runDiff--qLtU4FI.mjs +0 -2
- package/.output/server/_ssr/store-40eVzW1S.mjs +0 -2
- package/.output/server/_ssr/tokens-CbfoRC_s.mjs +0 -2
- package/.output/server/drizzle/0001_naive_silver_fox.sql +0 -25
- package/.output/server/drizzle/0002_funny_sage.sql +0 -12
- package/.output/server/drizzle/0003_optimal_slapstick.sql +0 -102
- package/.output/server/drizzle/0004_remove_grok_agent.sql +0 -5
- package/.output/server/drizzle/0005_heavy_gauntlet.sql +0 -8
- package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +0 -1
- package/.output/server/drizzle/0007_faulty_starbolt.sql +0 -30
- package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
- package/.output/server/drizzle/0009_ordinary_electro.sql +0 -1
- package/.output/server/drizzle/0010_workable_rage.sql +0 -14
- package/.output/server/drizzle/0011_steep_marvel_zombies.sql +0 -3
- package/.output/server/drizzle/0012_blocked_run_status.sql +0 -12
- package/.output/server/drizzle/0013_drop_run_outcome.sql +0 -2
- package/.output/server/drizzle/0014_luxuriant_scrambler.sql +0 -5
- package/.output/server/drizzle/0015_run_history_foundation.sql +0 -43
- package/.output/server/drizzle/0016_plural_machine_runs.sql +0 -4
- package/.output/server/drizzle/meta/0000_snapshot.json +0 -1333
- package/.output/server/drizzle/meta/0001_snapshot.json +0 -1498
- package/.output/server/drizzle/meta/0002_snapshot.json +0 -1576
- package/.output/server/drizzle/meta/0003_snapshot.json +0 -1666
- package/.output/server/drizzle/meta/0005_snapshot.json +0 -1666
- package/.output/server/drizzle/meta/0006_snapshot.json +0 -1672
- package/.output/server/drizzle/meta/0007_snapshot.json +0 -1787
- package/.output/server/drizzle/meta/0009_snapshot.json +0 -1793
- package/.output/server/drizzle/meta/0010_snapshot.json +0 -1891
- package/.output/server/drizzle/meta/0011_snapshot.json +0 -1872
- package/drizzle/0001_naive_silver_fox.sql +0 -25
- package/drizzle/0002_funny_sage.sql +0 -12
- package/drizzle/0003_optimal_slapstick.sql +0 -102
- package/drizzle/0004_remove_grok_agent.sql +0 -5
- package/drizzle/0005_heavy_gauntlet.sql +0 -8
- package/drizzle/0006_tranquil_sharon_carter.sql +0 -1
- package/drizzle/0007_faulty_starbolt.sql +0 -30
- package/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
- package/drizzle/0009_ordinary_electro.sql +0 -1
- package/drizzle/0010_workable_rage.sql +0 -14
- package/drizzle/0011_steep_marvel_zombies.sql +0 -3
- package/drizzle/0012_blocked_run_status.sql +0 -12
- package/drizzle/0013_drop_run_outcome.sql +0 -2
- package/drizzle/0014_luxuriant_scrambler.sql +0 -5
- package/drizzle/0015_run_history_foundation.sql +0 -43
- package/drizzle/0016_plural_machine_runs.sql +0 -4
- package/drizzle/meta/0000_snapshot.json +0 -1333
- package/drizzle/meta/0001_snapshot.json +0 -1498
- package/drizzle/meta/0002_snapshot.json +0 -1576
- package/drizzle/meta/0003_snapshot.json +0 -1666
- package/drizzle/meta/0005_snapshot.json +0 -1666
- package/drizzle/meta/0006_snapshot.json +0 -1672
- package/drizzle/meta/0007_snapshot.json +0 -1787
- package/drizzle/meta/0009_snapshot.json +0 -1793
- package/drizzle/meta/0010_snapshot.json +0 -1891
- package/drizzle/meta/0011_snapshot.json +0 -1872
|
@@ -1,868 +0,0 @@
|
|
|
1
|
-
import { n as __esmMin, r as __exportAll } from "../_runtime.mjs";
|
|
2
|
-
import { f as init_dist$2, n as render, t as init_dist$1, u as ElementType } from "./dom-serializer+[...].mjs";
|
|
3
|
-
import { c as isTag, i as hasChildren, l as isText, o as isCDATA, r as init_dist$3, s as isComment } from "./domhandler.mjs";
|
|
4
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/querying.js
|
|
5
|
-
/**
|
|
6
|
-
* Search a node and its children for nodes passing a test function. If `node` is not an array, it will be wrapped in one.
|
|
7
|
-
*
|
|
8
|
-
* @category Querying
|
|
9
|
-
* @param test Function to test nodes on.
|
|
10
|
-
* @param node Node to search. Will be included in the result set if it matches.
|
|
11
|
-
* @param recurse Also consider child nodes.
|
|
12
|
-
* @param limit Maximum number of nodes to return.
|
|
13
|
-
* @returns All nodes passing `test`.
|
|
14
|
-
*/
|
|
15
|
-
function filter(test, node, recurse = true, limit = Number.POSITIVE_INFINITY) {
|
|
16
|
-
return find(test, Array.isArray(node) ? node : [node], recurse, limit);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Search an array of nodes and their children for nodes passing a test function.
|
|
20
|
-
*
|
|
21
|
-
* @category Querying
|
|
22
|
-
* @param test Function to test nodes on.
|
|
23
|
-
* @param nodes Array of nodes to search.
|
|
24
|
-
* @param recurse Also consider child nodes.
|
|
25
|
-
* @param limit Maximum number of nodes to return.
|
|
26
|
-
* @returns All nodes passing `test`.
|
|
27
|
-
*/
|
|
28
|
-
function find(test, nodes, recurse, limit) {
|
|
29
|
-
const result = [];
|
|
30
|
-
/** Stack of the arrays we are looking at. */
|
|
31
|
-
const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
|
|
32
|
-
/** Stack of the indices within the arrays. */
|
|
33
|
-
const indexStack = [0];
|
|
34
|
-
for (;;) {
|
|
35
|
-
if (indexStack[0] >= nodeStack[0].length) {
|
|
36
|
-
if (indexStack.length === 1) return result;
|
|
37
|
-
nodeStack.shift();
|
|
38
|
-
indexStack.shift();
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
const element = nodeStack[0][indexStack[0]++];
|
|
42
|
-
if (test(element)) {
|
|
43
|
-
result.push(element);
|
|
44
|
-
if (--limit <= 0) return result;
|
|
45
|
-
}
|
|
46
|
-
if (recurse && hasChildren(element) && element.children.length > 0) {
|
|
47
|
-
indexStack.unshift(0);
|
|
48
|
-
nodeStack.unshift(element.children);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Finds one element in a tree that passes a test.
|
|
54
|
-
*
|
|
55
|
-
* @category Querying
|
|
56
|
-
* @param test Function to test nodes on.
|
|
57
|
-
* @param nodes Node or array of nodes to search.
|
|
58
|
-
* @param recurse Also consider child nodes.
|
|
59
|
-
* @returns The first node that passes `test`.
|
|
60
|
-
*/
|
|
61
|
-
function findOne(test, nodes, recurse = true) {
|
|
62
|
-
const searchedNodes = Array.isArray(nodes) ? nodes : [nodes];
|
|
63
|
-
for (const node of searchedNodes) {
|
|
64
|
-
if (isTag(node) && test(node)) return node;
|
|
65
|
-
if (recurse && hasChildren(node) && node.children.length > 0) {
|
|
66
|
-
const found = findOne(test, node.children, true);
|
|
67
|
-
if (found) return found;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Checks if a tree of nodes contains at least one node passing a test.
|
|
74
|
-
*
|
|
75
|
-
* @category Querying
|
|
76
|
-
* @param test Function to test nodes on.
|
|
77
|
-
* @param nodes Array of nodes to search.
|
|
78
|
-
* @returns Whether a tree of nodes contains at least one node passing the test.
|
|
79
|
-
*/
|
|
80
|
-
function existsOne(test, nodes) {
|
|
81
|
-
return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => isTag(node) && test(node) || hasChildren(node) && existsOne(test, node.children));
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Search an array of nodes and their children for elements passing a test function.
|
|
85
|
-
*
|
|
86
|
-
* Same as `find`, but limited to elements and with less options, leading to reduced complexity.
|
|
87
|
-
*
|
|
88
|
-
* @category Querying
|
|
89
|
-
* @param test Function to test nodes on.
|
|
90
|
-
* @param nodes Array of nodes to search.
|
|
91
|
-
* @returns All nodes passing `test`.
|
|
92
|
-
*/
|
|
93
|
-
function findAll(test, nodes) {
|
|
94
|
-
const result = [];
|
|
95
|
-
const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
|
|
96
|
-
const indexStack = [0];
|
|
97
|
-
for (;;) {
|
|
98
|
-
if (indexStack[0] >= nodeStack[0].length) {
|
|
99
|
-
if (nodeStack.length === 1) return result;
|
|
100
|
-
nodeStack.shift();
|
|
101
|
-
indexStack.shift();
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
const element = nodeStack[0][indexStack[0]++];
|
|
105
|
-
if (isTag(element) && test(element)) result.push(element);
|
|
106
|
-
if (hasChildren(element) && element.children.length > 0) {
|
|
107
|
-
indexStack.unshift(0);
|
|
108
|
-
nodeStack.unshift(element.children);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
var init_querying = __esmMin((() => {
|
|
113
|
-
init_dist$3();
|
|
114
|
-
}));
|
|
115
|
-
//#endregion
|
|
116
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/legacy.js
|
|
117
|
-
/**
|
|
118
|
-
* Returns a function to check whether a node has an attribute with a particular
|
|
119
|
-
* value.
|
|
120
|
-
*
|
|
121
|
-
* @param attrib Attribute to check.
|
|
122
|
-
* @param value Attribute value to look for.
|
|
123
|
-
* @returns A function to check whether the a node has an attribute with a
|
|
124
|
-
* particular value.
|
|
125
|
-
*/
|
|
126
|
-
function getAttribCheck(attrib, value) {
|
|
127
|
-
if (typeof value === "function") return (element) => isTag(element) && value(element.attribs[attrib]);
|
|
128
|
-
return (element) => isTag(element) && element.attribs[attrib] === value;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Returns a function that returns `true` if either of the input functions
|
|
132
|
-
* returns `true` for a node.
|
|
133
|
-
*
|
|
134
|
-
* @param a First function to combine.
|
|
135
|
-
* @param b Second function to combine.
|
|
136
|
-
* @returns A function taking a node and returning `true` if either of the input
|
|
137
|
-
* functions returns `true` for the node.
|
|
138
|
-
*/
|
|
139
|
-
function combineFuncs(a, b) {
|
|
140
|
-
return (element) => a(element) || b(element);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Returns a function that executes all checks in `options` and returns `true`
|
|
144
|
-
* if any of them match a node.
|
|
145
|
-
*
|
|
146
|
-
* @param options An object describing nodes to look for.
|
|
147
|
-
* @returns A function that executes all checks in `options` and returns `true`
|
|
148
|
-
* if any of them match a node.
|
|
149
|
-
*/
|
|
150
|
-
function compileTest(options) {
|
|
151
|
-
const funcs = Object.keys(options).map((key) => {
|
|
152
|
-
const value = options[key];
|
|
153
|
-
return Object.hasOwn(Checks, key) ? Checks[key](value) : getAttribCheck(key, value);
|
|
154
|
-
});
|
|
155
|
-
return funcs.length === 0 ? null : funcs.reduce(combineFuncs);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Checks whether a node matches the description in `options`.
|
|
159
|
-
*
|
|
160
|
-
* @category Legacy Query Functions
|
|
161
|
-
* @param options An object describing nodes to look for.
|
|
162
|
-
* @param node The element to test.
|
|
163
|
-
* @returns Whether the element matches the description in `options`.
|
|
164
|
-
*/
|
|
165
|
-
function testElement(options, node) {
|
|
166
|
-
const test = compileTest(options);
|
|
167
|
-
return test ? test(node) : true;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Returns all nodes that match `options`.
|
|
171
|
-
*
|
|
172
|
-
* @category Legacy Query Functions
|
|
173
|
-
* @param options An object describing nodes to look for.
|
|
174
|
-
* @param nodes Nodes to search through.
|
|
175
|
-
* @param recurse Also consider child nodes.
|
|
176
|
-
* @param limit Maximum number of nodes to return.
|
|
177
|
-
* @returns All nodes that match `options`.
|
|
178
|
-
*/
|
|
179
|
-
function getElements(options, nodes, recurse, limit = Number.POSITIVE_INFINITY) {
|
|
180
|
-
const test = compileTest(options);
|
|
181
|
-
return test ? filter(test, nodes, recurse, limit) : [];
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Returns the node with the supplied ID.
|
|
185
|
-
*
|
|
186
|
-
* @category Legacy Query Functions
|
|
187
|
-
* @param id The unique ID attribute value to look for.
|
|
188
|
-
* @param nodes Nodes to search through.
|
|
189
|
-
* @param recurse Also consider child nodes.
|
|
190
|
-
* @returns The node with the supplied ID.
|
|
191
|
-
*/
|
|
192
|
-
function getElementById(id, nodes, recurse = true) {
|
|
193
|
-
if (!Array.isArray(nodes)) nodes = [nodes];
|
|
194
|
-
return findOne(getAttribCheck("id", id), nodes, recurse);
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Returns all nodes with the supplied `tagName`.
|
|
198
|
-
*
|
|
199
|
-
* @category Legacy Query Functions
|
|
200
|
-
* @param tagName Tag name to search for.
|
|
201
|
-
* @param nodes Nodes to search through.
|
|
202
|
-
* @param recurse Also consider child nodes.
|
|
203
|
-
* @param limit Maximum number of nodes to return.
|
|
204
|
-
* @returns All nodes with the supplied `tagName`.
|
|
205
|
-
*/
|
|
206
|
-
function getElementsByTagName(tagName, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) {
|
|
207
|
-
return filter(Checks["tag_name"](tagName), nodes, recurse, limit);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Returns all nodes with the supplied `className`.
|
|
211
|
-
*
|
|
212
|
-
* @category Legacy Query Functions
|
|
213
|
-
* @param className Class name to search for.
|
|
214
|
-
* @param nodes Nodes to search through.
|
|
215
|
-
* @param recurse Also consider child nodes.
|
|
216
|
-
* @param limit Maximum number of nodes to return.
|
|
217
|
-
* @returns All nodes with the supplied `className`.
|
|
218
|
-
*/
|
|
219
|
-
function getElementsByClassName(className, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) {
|
|
220
|
-
return filter(getAttribCheck("class", className), nodes, recurse, limit);
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Returns all nodes with the supplied `type`.
|
|
224
|
-
*
|
|
225
|
-
* @category Legacy Query Functions
|
|
226
|
-
* @param type Element type to look for.
|
|
227
|
-
* @param nodes Nodes to search through.
|
|
228
|
-
* @param recurse Also consider child nodes.
|
|
229
|
-
* @param limit Maximum number of nodes to return.
|
|
230
|
-
* @returns All nodes with the supplied `type`.
|
|
231
|
-
*/
|
|
232
|
-
function getElementsByTagType(type, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) {
|
|
233
|
-
return filter(Checks["tag_type"](type), nodes, recurse, limit);
|
|
234
|
-
}
|
|
235
|
-
var Checks;
|
|
236
|
-
var init_legacy = __esmMin((() => {
|
|
237
|
-
init_dist$3();
|
|
238
|
-
init_querying();
|
|
239
|
-
Checks = {
|
|
240
|
-
tag_name(name) {
|
|
241
|
-
if (typeof name === "function") return (element) => isTag(element) && name(element.name);
|
|
242
|
-
if (name === "*") return isTag;
|
|
243
|
-
return (element) => isTag(element) && element.name === name;
|
|
244
|
-
},
|
|
245
|
-
tag_type(type) {
|
|
246
|
-
if (typeof type === "function") return (element) => type(element.type);
|
|
247
|
-
return (element) => element.type === type;
|
|
248
|
-
},
|
|
249
|
-
tag_contains(data) {
|
|
250
|
-
if (typeof data === "function") return (element) => isText(element) && data(element.data);
|
|
251
|
-
return (element) => isText(element) && element.data === data;
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
}));
|
|
255
|
-
//#endregion
|
|
256
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/stringify.js
|
|
257
|
-
/**
|
|
258
|
-
* @category Stringify
|
|
259
|
-
* @deprecated Use the `dom-serializer` module directly.
|
|
260
|
-
* @param node Node to get the outer HTML of.
|
|
261
|
-
* @param options Options for serialization.
|
|
262
|
-
* @returns `node`'s outer HTML.
|
|
263
|
-
*/
|
|
264
|
-
function getOuterHTML(node, options) {
|
|
265
|
-
return render(node, options);
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* @category Stringify
|
|
269
|
-
* @deprecated Use the `dom-serializer` module directly.
|
|
270
|
-
* @param node Node to get the inner HTML of.
|
|
271
|
-
* @param options Options for serialization.
|
|
272
|
-
* @returns `node`'s inner HTML.
|
|
273
|
-
*/
|
|
274
|
-
function getInnerHTML(node, options) {
|
|
275
|
-
return hasChildren(node) ? node.children.map((node) => getOuterHTML(node, options)).join("") : "";
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags. Ignores comments.
|
|
279
|
-
*
|
|
280
|
-
* @category Stringify
|
|
281
|
-
* @deprecated Use `textContent` instead.
|
|
282
|
-
* @param node Node to get the inner text of.
|
|
283
|
-
* @returns `node`'s inner text.
|
|
284
|
-
*/
|
|
285
|
-
function getText(node) {
|
|
286
|
-
if (Array.isArray(node)) return node.map(getText).join("");
|
|
287
|
-
if (isTag(node)) return node.name === "br" ? "\n" : getText(node.children);
|
|
288
|
-
if (isCDATA(node)) return getText(node.children);
|
|
289
|
-
if (isText(node)) return node.data;
|
|
290
|
-
return "";
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Get a node's text content. Ignores comments.
|
|
294
|
-
*
|
|
295
|
-
* @category Stringify
|
|
296
|
-
* @param node Node to get the text content of.
|
|
297
|
-
* @returns `node`'s text content.
|
|
298
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent}
|
|
299
|
-
*/
|
|
300
|
-
function textContent(node) {
|
|
301
|
-
if (Array.isArray(node)) return node.map(textContent).join("");
|
|
302
|
-
if (hasChildren(node) && !isComment(node)) return textContent(node.children);
|
|
303
|
-
if (isText(node)) return node.data;
|
|
304
|
-
return "";
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Get a node's inner text, ignoring `<script>` and `<style>` tags. Ignores comments.
|
|
308
|
-
*
|
|
309
|
-
* @category Stringify
|
|
310
|
-
* @param node Node to get the inner text of.
|
|
311
|
-
* @returns `node`'s inner text.
|
|
312
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText}
|
|
313
|
-
*/
|
|
314
|
-
function innerText(node) {
|
|
315
|
-
if (Array.isArray(node)) return node.map(innerText).join("");
|
|
316
|
-
if (hasChildren(node) && (node.type === ElementType.Tag || isCDATA(node))) return innerText(node.children);
|
|
317
|
-
if (isText(node)) return node.data;
|
|
318
|
-
return "";
|
|
319
|
-
}
|
|
320
|
-
var init_stringify = __esmMin((() => {
|
|
321
|
-
init_dist$1();
|
|
322
|
-
init_dist$2();
|
|
323
|
-
init_dist$3();
|
|
324
|
-
}));
|
|
325
|
-
//#endregion
|
|
326
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/feeds.js
|
|
327
|
-
/**
|
|
328
|
-
* Get the feed object from the root of a DOM tree.
|
|
329
|
-
*
|
|
330
|
-
* @category Feeds
|
|
331
|
-
* @param document The DOM to extract the feed from.
|
|
332
|
-
* @returns The feed.
|
|
333
|
-
*/
|
|
334
|
-
function getFeed(document) {
|
|
335
|
-
const feedRoot = getOneElement(isValidFeed, document);
|
|
336
|
-
return feedRoot ? feedRoot.name === "feed" ? getAtomFeed(feedRoot) : getRssFeed(feedRoot) : null;
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Parse an Atom feed.
|
|
340
|
-
*
|
|
341
|
-
* @param feedRoot The root of the feed.
|
|
342
|
-
* @returns The parsed feed.
|
|
343
|
-
*/
|
|
344
|
-
function getAtomFeed(feedRoot) {
|
|
345
|
-
const childs = feedRoot.children;
|
|
346
|
-
const feed = {
|
|
347
|
-
type: "atom",
|
|
348
|
-
items: getElementsByTagName("entry", childs).map((item) => {
|
|
349
|
-
const { children } = item;
|
|
350
|
-
const entry = { media: getMediaElements(children) };
|
|
351
|
-
addConditionally(entry, "id", "id", children);
|
|
352
|
-
addConditionally(entry, "title", "title", children);
|
|
353
|
-
const href = getOneElement("link", children)?.attribs["href"];
|
|
354
|
-
if (href) entry.link = href;
|
|
355
|
-
const description = fetch("summary", children) || fetch("content", children);
|
|
356
|
-
if (description) entry.description = description;
|
|
357
|
-
const pubDate = fetch("updated", children);
|
|
358
|
-
if (pubDate) entry.pubDate = new Date(pubDate);
|
|
359
|
-
return entry;
|
|
360
|
-
})
|
|
361
|
-
};
|
|
362
|
-
addConditionally(feed, "id", "id", childs);
|
|
363
|
-
addConditionally(feed, "title", "title", childs);
|
|
364
|
-
const href = getOneElement("link", childs)?.attribs["href"];
|
|
365
|
-
if (href) feed.link = href;
|
|
366
|
-
addConditionally(feed, "description", "subtitle", childs);
|
|
367
|
-
const updated = fetch("updated", childs);
|
|
368
|
-
if (updated) feed.updated = new Date(updated);
|
|
369
|
-
addConditionally(feed, "author", "email", childs, true);
|
|
370
|
-
return feed;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Parse a RSS feed.
|
|
374
|
-
*
|
|
375
|
-
* @param feedRoot The root of the feed.
|
|
376
|
-
* @returns The parsed feed.
|
|
377
|
-
*/
|
|
378
|
-
function getRssFeed(feedRoot) {
|
|
379
|
-
const childs = getOneElement("channel", feedRoot.children)?.children ?? [];
|
|
380
|
-
const feed = {
|
|
381
|
-
type: feedRoot.name.substr(0, 3),
|
|
382
|
-
id: "",
|
|
383
|
-
items: getElementsByTagName("item", feedRoot.children).map((item) => {
|
|
384
|
-
const { children } = item;
|
|
385
|
-
const entry = { media: getMediaElements(children) };
|
|
386
|
-
addConditionally(entry, "id", "guid", children);
|
|
387
|
-
addConditionally(entry, "title", "title", children);
|
|
388
|
-
addConditionally(entry, "link", "link", children);
|
|
389
|
-
addConditionally(entry, "description", "description", children);
|
|
390
|
-
const pubDate = fetch("pubDate", children) || fetch("dc:date", children);
|
|
391
|
-
if (pubDate) entry.pubDate = new Date(pubDate);
|
|
392
|
-
return entry;
|
|
393
|
-
})
|
|
394
|
-
};
|
|
395
|
-
addConditionally(feed, "title", "title", childs);
|
|
396
|
-
addConditionally(feed, "link", "link", childs);
|
|
397
|
-
addConditionally(feed, "description", "description", childs);
|
|
398
|
-
const updated = fetch("lastBuildDate", childs);
|
|
399
|
-
if (updated) feed.updated = new Date(updated);
|
|
400
|
-
addConditionally(feed, "author", "managingEditor", childs, true);
|
|
401
|
-
return feed;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Get all media elements of a feed item.
|
|
405
|
-
*
|
|
406
|
-
* @param where Nodes to search in.
|
|
407
|
-
* @returns Media elements.
|
|
408
|
-
*/
|
|
409
|
-
function getMediaElements(where) {
|
|
410
|
-
return getElementsByTagName("media:content", where).map((element) => {
|
|
411
|
-
const { attribs } = element;
|
|
412
|
-
const media = {
|
|
413
|
-
medium: attribs["medium"],
|
|
414
|
-
isDefault: !!attribs["isDefault"]
|
|
415
|
-
};
|
|
416
|
-
for (const attrib of MEDIA_KEYS_STRING) if (attribs[attrib]) media[attrib] = attribs[attrib];
|
|
417
|
-
for (const attrib of MEDIA_KEYS_INT) if (attribs[attrib]) media[attrib] = Number.parseInt(attribs[attrib], 10);
|
|
418
|
-
if (attribs["expression"]) media.expression = attribs["expression"];
|
|
419
|
-
return media;
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Get one element by tag name.
|
|
424
|
-
*
|
|
425
|
-
* @param tagName Tag name to look for
|
|
426
|
-
* @param node Node to search in
|
|
427
|
-
* @returns The element or null
|
|
428
|
-
*/
|
|
429
|
-
function getOneElement(tagName, node) {
|
|
430
|
-
return getElementsByTagName(tagName, node, true, 1)[0];
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Get the text content of an element with a certain tag name.
|
|
434
|
-
*
|
|
435
|
-
* @param tagName Tag name to look for.
|
|
436
|
-
* @param where Node to search in.
|
|
437
|
-
* @param recurse Whether to recurse into child nodes.
|
|
438
|
-
* @returns The text content of the element.
|
|
439
|
-
*/
|
|
440
|
-
function fetch(tagName, where, recurse = false) {
|
|
441
|
-
return textContent(getElementsByTagName(tagName, where, recurse, 1)).trim();
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Adds a property to an object if it has a value.
|
|
445
|
-
*
|
|
446
|
-
* @param object Object to be extended.
|
|
447
|
-
* @param property Property name.
|
|
448
|
-
* @param tagName Tag name that contains the conditionally added property.
|
|
449
|
-
* @param where Element to search for the property.
|
|
450
|
-
* @param recurse Whether to recurse into child nodes.
|
|
451
|
-
*/
|
|
452
|
-
function addConditionally(object, property, tagName, where, recurse = false) {
|
|
453
|
-
const value = fetch(tagName, where, recurse);
|
|
454
|
-
if (value) object[property] = value;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Checks if an element is a feed root node.
|
|
458
|
-
*
|
|
459
|
-
* @param value The name of the element to check.
|
|
460
|
-
* @returns Whether an element is a feed root node.
|
|
461
|
-
*/
|
|
462
|
-
function isValidFeed(value) {
|
|
463
|
-
return value === "rss" || value === "feed" || value === "rdf:RDF";
|
|
464
|
-
}
|
|
465
|
-
var MEDIA_KEYS_STRING, MEDIA_KEYS_INT;
|
|
466
|
-
var init_feeds = __esmMin((() => {
|
|
467
|
-
init_legacy();
|
|
468
|
-
init_stringify();
|
|
469
|
-
MEDIA_KEYS_STRING = [
|
|
470
|
-
"url",
|
|
471
|
-
"type",
|
|
472
|
-
"lang"
|
|
473
|
-
];
|
|
474
|
-
MEDIA_KEYS_INT = [
|
|
475
|
-
"fileSize",
|
|
476
|
-
"bitrate",
|
|
477
|
-
"framerate",
|
|
478
|
-
"samplingrate",
|
|
479
|
-
"channels",
|
|
480
|
-
"duration",
|
|
481
|
-
"height",
|
|
482
|
-
"width"
|
|
483
|
-
];
|
|
484
|
-
}));
|
|
485
|
-
//#endregion
|
|
486
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/helpers.js
|
|
487
|
-
/**
|
|
488
|
-
* Given an array of nodes, remove any member that is contained by another
|
|
489
|
-
* member.
|
|
490
|
-
*
|
|
491
|
-
* @category Helpers
|
|
492
|
-
* @param nodes Nodes to filter.
|
|
493
|
-
* @returns Remaining nodes that aren't contained by other nodes.
|
|
494
|
-
*/
|
|
495
|
-
function removeSubsets(nodes) {
|
|
496
|
-
let index = nodes.length;
|
|
497
|
-
while (--index >= 0) {
|
|
498
|
-
const node = nodes[index];
|
|
499
|
-
if (index > 0 && nodes.lastIndexOf(node, index - 1) >= 0) {
|
|
500
|
-
nodes.splice(index, 1);
|
|
501
|
-
continue;
|
|
502
|
-
}
|
|
503
|
-
for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) if (nodes.includes(ancestor)) {
|
|
504
|
-
nodes.splice(index, 1);
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
return nodes;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Compare the position of one node against another node in any other document,
|
|
512
|
-
* returning a bitmask with the values from {@link DocumentPosition}.
|
|
513
|
-
*
|
|
514
|
-
* Document order:
|
|
515
|
-
* > There is an ordering, document order, defined on all the nodes in the
|
|
516
|
-
* > document corresponding to the order in which the first character of the
|
|
517
|
-
* > XML representation of each node occurs in the XML representation of the
|
|
518
|
-
* > document after expansion of general entities. Thus, the document element
|
|
519
|
-
* > node will be the first node. Element nodes occur before their children.
|
|
520
|
-
* > Thus, document order orders element nodes in order of the occurrence of
|
|
521
|
-
* > their start-tag in the XML (after expansion of entities). The attribute
|
|
522
|
-
* > nodes of an element occur after the element and before its children. The
|
|
523
|
-
* > relative order of attribute nodes is implementation-dependent.
|
|
524
|
-
*
|
|
525
|
-
* Source:
|
|
526
|
-
* http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
|
|
527
|
-
*
|
|
528
|
-
* @category Helpers
|
|
529
|
-
* @param nodeA The first node to use in the comparison
|
|
530
|
-
* @param nodeB The second node to use in the comparison
|
|
531
|
-
* @returns A bitmask describing the input nodes' relative position.
|
|
532
|
-
*
|
|
533
|
-
* See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
|
|
534
|
-
* a description of these values.
|
|
535
|
-
*/
|
|
536
|
-
function compareDocumentPosition(nodeA, nodeB) {
|
|
537
|
-
const aParents = [];
|
|
538
|
-
const bParents = [];
|
|
539
|
-
if (nodeA === nodeB) return 0;
|
|
540
|
-
let current = hasChildren(nodeA) ? nodeA : nodeA.parent;
|
|
541
|
-
while (current) {
|
|
542
|
-
aParents.unshift(current);
|
|
543
|
-
current = current.parent;
|
|
544
|
-
}
|
|
545
|
-
current = hasChildren(nodeB) ? nodeB : nodeB.parent;
|
|
546
|
-
while (current) {
|
|
547
|
-
bParents.unshift(current);
|
|
548
|
-
current = current.parent;
|
|
549
|
-
}
|
|
550
|
-
const maxIndex = Math.min(aParents.length, bParents.length);
|
|
551
|
-
let index = 0;
|
|
552
|
-
while (index < maxIndex && aParents[index] === bParents[index]) index++;
|
|
553
|
-
if (index === 0) return DocumentPosition.DISCONNECTED;
|
|
554
|
-
const sharedParent = aParents[index - 1];
|
|
555
|
-
const siblings = sharedParent.children;
|
|
556
|
-
const aSibling = aParents[index];
|
|
557
|
-
const bSibling = bParents[index];
|
|
558
|
-
if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
|
|
559
|
-
if (sharedParent === nodeB) return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY;
|
|
560
|
-
return DocumentPosition.FOLLOWING;
|
|
561
|
-
}
|
|
562
|
-
if (sharedParent === nodeA) return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS;
|
|
563
|
-
return DocumentPosition.PRECEDING;
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* Sort an array of nodes based on their relative position in the document,
|
|
567
|
-
* removing any duplicate nodes. If the array contains nodes that do not belong
|
|
568
|
-
* to the same document, sort order is unspecified.
|
|
569
|
-
*
|
|
570
|
-
* @category Helpers
|
|
571
|
-
* @param nodes Array of DOM nodes.
|
|
572
|
-
* @returns Collection of unique nodes, sorted in document order.
|
|
573
|
-
*/
|
|
574
|
-
function uniqueSort(nodes) {
|
|
575
|
-
nodes = nodes.filter((node, index, array) => !array.includes(node, index + 1));
|
|
576
|
-
nodes.sort((a, b) => {
|
|
577
|
-
const relative = compareDocumentPosition(a, b);
|
|
578
|
-
if (relative & DocumentPosition.PRECEDING) return -1;
|
|
579
|
-
if (relative & DocumentPosition.FOLLOWING) return 1;
|
|
580
|
-
return 0;
|
|
581
|
-
});
|
|
582
|
-
return nodes;
|
|
583
|
-
}
|
|
584
|
-
var DocumentPosition;
|
|
585
|
-
var init_helpers = __esmMin((() => {
|
|
586
|
-
init_dist$3();
|
|
587
|
-
(function(DocumentPosition) {
|
|
588
|
-
DocumentPosition[DocumentPosition["DISCONNECTED"] = 1] = "DISCONNECTED";
|
|
589
|
-
DocumentPosition[DocumentPosition["PRECEDING"] = 2] = "PRECEDING";
|
|
590
|
-
DocumentPosition[DocumentPosition["FOLLOWING"] = 4] = "FOLLOWING";
|
|
591
|
-
DocumentPosition[DocumentPosition["CONTAINS"] = 8] = "CONTAINS";
|
|
592
|
-
DocumentPosition[DocumentPosition["CONTAINED_BY"] = 16] = "CONTAINED_BY";
|
|
593
|
-
})(DocumentPosition || (DocumentPosition = {}));
|
|
594
|
-
}));
|
|
595
|
-
//#endregion
|
|
596
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/manipulation.js
|
|
597
|
-
/**
|
|
598
|
-
* Remove an element from the dom
|
|
599
|
-
*
|
|
600
|
-
* @category Manipulation
|
|
601
|
-
* @param element The element to be removed.
|
|
602
|
-
*/
|
|
603
|
-
function removeElement(element) {
|
|
604
|
-
if (element.prev) element.prev.next = element.next;
|
|
605
|
-
if (element.next) element.next.prev = element.prev;
|
|
606
|
-
if (element.parent) {
|
|
607
|
-
const childs = element.parent.children;
|
|
608
|
-
const childsIndex = childs.lastIndexOf(element);
|
|
609
|
-
if (childsIndex !== -1) childs.splice(childsIndex, 1);
|
|
610
|
-
}
|
|
611
|
-
element.next = null;
|
|
612
|
-
element.prev = null;
|
|
613
|
-
element.parent = null;
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* Replace an element in the dom
|
|
617
|
-
*
|
|
618
|
-
* @category Manipulation
|
|
619
|
-
* @param element The element to be replaced.
|
|
620
|
-
* @param replacement The element to be added
|
|
621
|
-
*/
|
|
622
|
-
function replaceElement(element, replacement) {
|
|
623
|
-
replacement.prev = element.prev;
|
|
624
|
-
if (replacement.prev) replacement.prev.next = replacement;
|
|
625
|
-
replacement.next = element.next;
|
|
626
|
-
if (replacement.next) replacement.next.prev = replacement;
|
|
627
|
-
replacement.parent = element.parent;
|
|
628
|
-
if (replacement.parent) {
|
|
629
|
-
const { children } = replacement.parent;
|
|
630
|
-
const elementIndex = children.lastIndexOf(element);
|
|
631
|
-
if (elementIndex === -1) return;
|
|
632
|
-
children[elementIndex] = replacement;
|
|
633
|
-
element.parent = null;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* Append a child to an element.
|
|
638
|
-
*
|
|
639
|
-
* @category Manipulation
|
|
640
|
-
* @param parent The element to append to.
|
|
641
|
-
* @param child The element to be added as a child.
|
|
642
|
-
*/
|
|
643
|
-
function appendChild(parent, child) {
|
|
644
|
-
removeElement(child);
|
|
645
|
-
child.next = null;
|
|
646
|
-
child.parent = parent;
|
|
647
|
-
if (parent.children.push(child) > 1) {
|
|
648
|
-
const sibling = parent.children[parent.children.length - 2];
|
|
649
|
-
sibling.next = child;
|
|
650
|
-
child.prev = sibling;
|
|
651
|
-
} else child.prev = null;
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Append an element after another.
|
|
655
|
-
*
|
|
656
|
-
* @category Manipulation
|
|
657
|
-
* @param element The element to append after.
|
|
658
|
-
* @param next The element be added.
|
|
659
|
-
*/
|
|
660
|
-
function append(element, next) {
|
|
661
|
-
removeElement(next);
|
|
662
|
-
const { parent } = element;
|
|
663
|
-
const currentNext = element.next;
|
|
664
|
-
next.next = currentNext;
|
|
665
|
-
next.prev = element;
|
|
666
|
-
element.next = next;
|
|
667
|
-
next.parent = parent;
|
|
668
|
-
if (currentNext) {
|
|
669
|
-
currentNext.prev = next;
|
|
670
|
-
if (parent) {
|
|
671
|
-
const childs = parent.children;
|
|
672
|
-
childs.splice(childs.lastIndexOf(currentNext), 0, next);
|
|
673
|
-
}
|
|
674
|
-
} else if (parent) parent.children.push(next);
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Prepend a child to an element.
|
|
678
|
-
*
|
|
679
|
-
* @category Manipulation
|
|
680
|
-
* @param parent The element to prepend before.
|
|
681
|
-
* @param child The element to be added as a child.
|
|
682
|
-
*/
|
|
683
|
-
function prependChild(parent, child) {
|
|
684
|
-
removeElement(child);
|
|
685
|
-
child.parent = parent;
|
|
686
|
-
child.prev = null;
|
|
687
|
-
if (parent.children.unshift(child) === 1) child.next = null;
|
|
688
|
-
else {
|
|
689
|
-
const sibling = parent.children[1];
|
|
690
|
-
sibling.prev = child;
|
|
691
|
-
child.next = sibling;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Prepend an element before another.
|
|
696
|
-
*
|
|
697
|
-
* @category Manipulation
|
|
698
|
-
* @param element The element to prepend before.
|
|
699
|
-
* @param previous The element to be added.
|
|
700
|
-
*/
|
|
701
|
-
function prepend(element, previous) {
|
|
702
|
-
removeElement(previous);
|
|
703
|
-
const { parent } = element;
|
|
704
|
-
if (parent) {
|
|
705
|
-
const childs = parent.children;
|
|
706
|
-
childs.splice(childs.indexOf(element), 0, previous);
|
|
707
|
-
}
|
|
708
|
-
if (element.prev) element.prev.next = previous;
|
|
709
|
-
previous.parent = parent;
|
|
710
|
-
previous.prev = element.prev;
|
|
711
|
-
previous.next = element;
|
|
712
|
-
element.prev = previous;
|
|
713
|
-
}
|
|
714
|
-
var init_manipulation = __esmMin((() => {}));
|
|
715
|
-
//#endregion
|
|
716
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/traversal.js
|
|
717
|
-
/**
|
|
718
|
-
* Get a node's children.
|
|
719
|
-
*
|
|
720
|
-
* @category Traversal
|
|
721
|
-
* @param element Node to get the children of.
|
|
722
|
-
* @returns `element`'s children, or an empty array.
|
|
723
|
-
*/
|
|
724
|
-
function getChildren(element) {
|
|
725
|
-
return hasChildren(element) ? element.children : [];
|
|
726
|
-
}
|
|
727
|
-
function getParent(element) {
|
|
728
|
-
return element.parent || null;
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* Gets an elements siblings, including the element itself.
|
|
732
|
-
*
|
|
733
|
-
* Attempts to get the children through the element's parent first. If we don't
|
|
734
|
-
* have a parent (the element is a root node), we walk the element's `prev` &
|
|
735
|
-
* `next` to get all remaining nodes.
|
|
736
|
-
*
|
|
737
|
-
* @category Traversal
|
|
738
|
-
* @param element Element to get the siblings of.
|
|
739
|
-
* @returns `element`'s siblings, including `element`.
|
|
740
|
-
*/
|
|
741
|
-
function getSiblings(element) {
|
|
742
|
-
const parent = getParent(element);
|
|
743
|
-
if (parent != null) return getChildren(parent);
|
|
744
|
-
const siblings = [element];
|
|
745
|
-
let { prev, next } = element;
|
|
746
|
-
while (prev != null) {
|
|
747
|
-
siblings.unshift(prev);
|
|
748
|
-
({prev} = prev);
|
|
749
|
-
}
|
|
750
|
-
while (next != null) {
|
|
751
|
-
siblings.push(next);
|
|
752
|
-
({next} = next);
|
|
753
|
-
}
|
|
754
|
-
return siblings;
|
|
755
|
-
}
|
|
756
|
-
/**
|
|
757
|
-
* Gets an attribute from an element.
|
|
758
|
-
*
|
|
759
|
-
* @category Traversal
|
|
760
|
-
* @param element Element to check.
|
|
761
|
-
* @param name Attribute name to retrieve.
|
|
762
|
-
* @returns The element's attribute value, or `undefined`.
|
|
763
|
-
*/
|
|
764
|
-
function getAttributeValue(element, name) {
|
|
765
|
-
const { attribs } = element;
|
|
766
|
-
return attribs?.[name];
|
|
767
|
-
}
|
|
768
|
-
/**
|
|
769
|
-
* Checks whether an element has an attribute.
|
|
770
|
-
*
|
|
771
|
-
* @category Traversal
|
|
772
|
-
* @param element Element to check.
|
|
773
|
-
* @param name Attribute name to look for.
|
|
774
|
-
* @returns Returns whether `element` has the attribute `name`.
|
|
775
|
-
*/
|
|
776
|
-
function hasAttrib(element, name) {
|
|
777
|
-
const { attribs } = element;
|
|
778
|
-
return attribs != null && Object.hasOwn(attribs, name) && attribs[name] != null;
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
* Get the tag name of an element.
|
|
782
|
-
*
|
|
783
|
-
* @category Traversal
|
|
784
|
-
* @param element The element to get the name for.
|
|
785
|
-
* @returns The tag name of `element`.
|
|
786
|
-
*/
|
|
787
|
-
function getName(element) {
|
|
788
|
-
return element.name;
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* Returns the next element sibling of a node.
|
|
792
|
-
*
|
|
793
|
-
* @category Traversal
|
|
794
|
-
* @param element The element to get the next sibling of.
|
|
795
|
-
* @returns `element`'s next sibling that is a tag, or `null` if there is no next
|
|
796
|
-
* sibling.
|
|
797
|
-
*/
|
|
798
|
-
function nextElementSibling(element) {
|
|
799
|
-
let { next } = element;
|
|
800
|
-
while (next !== null && !isTag(next)) ({next} = next);
|
|
801
|
-
return next;
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
* Returns the previous element sibling of a node.
|
|
805
|
-
*
|
|
806
|
-
* @category Traversal
|
|
807
|
-
* @param element The element to get the previous sibling of.
|
|
808
|
-
* @returns `element`'s previous sibling that is a tag, or `null` if there is no
|
|
809
|
-
* previous sibling.
|
|
810
|
-
*/
|
|
811
|
-
function prevElementSibling(element) {
|
|
812
|
-
let { prev } = element;
|
|
813
|
-
while (prev !== null && !isTag(prev)) ({prev} = prev);
|
|
814
|
-
return prev;
|
|
815
|
-
}
|
|
816
|
-
var init_traversal = __esmMin((() => {
|
|
817
|
-
init_dist$3();
|
|
818
|
-
}));
|
|
819
|
-
//#endregion
|
|
820
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/index.js
|
|
821
|
-
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
822
|
-
DocumentPosition: () => DocumentPosition,
|
|
823
|
-
append: () => append,
|
|
824
|
-
appendChild: () => appendChild,
|
|
825
|
-
compareDocumentPosition: () => compareDocumentPosition,
|
|
826
|
-
existsOne: () => existsOne,
|
|
827
|
-
filter: () => filter,
|
|
828
|
-
find: () => find,
|
|
829
|
-
findAll: () => findAll,
|
|
830
|
-
findOne: () => findOne,
|
|
831
|
-
getAttributeValue: () => getAttributeValue,
|
|
832
|
-
getChildren: () => getChildren,
|
|
833
|
-
getElementById: () => getElementById,
|
|
834
|
-
getElements: () => getElements,
|
|
835
|
-
getElementsByClassName: () => getElementsByClassName,
|
|
836
|
-
getElementsByTagName: () => getElementsByTagName,
|
|
837
|
-
getElementsByTagType: () => getElementsByTagType,
|
|
838
|
-
getFeed: () => getFeed,
|
|
839
|
-
getInnerHTML: () => getInnerHTML,
|
|
840
|
-
getName: () => getName,
|
|
841
|
-
getOuterHTML: () => getOuterHTML,
|
|
842
|
-
getParent: () => getParent,
|
|
843
|
-
getSiblings: () => getSiblings,
|
|
844
|
-
getText: () => getText,
|
|
845
|
-
hasAttrib: () => hasAttrib,
|
|
846
|
-
innerText: () => innerText,
|
|
847
|
-
nextElementSibling: () => nextElementSibling,
|
|
848
|
-
prepend: () => prepend,
|
|
849
|
-
prependChild: () => prependChild,
|
|
850
|
-
prevElementSibling: () => prevElementSibling,
|
|
851
|
-
removeElement: () => removeElement,
|
|
852
|
-
removeSubsets: () => removeSubsets,
|
|
853
|
-
replaceElement: () => replaceElement,
|
|
854
|
-
testElement: () => testElement,
|
|
855
|
-
textContent: () => textContent,
|
|
856
|
-
uniqueSort: () => uniqueSort
|
|
857
|
-
});
|
|
858
|
-
var init_dist = __esmMin((() => {
|
|
859
|
-
init_feeds();
|
|
860
|
-
init_helpers();
|
|
861
|
-
init_legacy();
|
|
862
|
-
init_manipulation();
|
|
863
|
-
init_querying();
|
|
864
|
-
init_stringify();
|
|
865
|
-
init_traversal();
|
|
866
|
-
}));
|
|
867
|
-
//#endregion
|
|
868
|
-
export { init_feeds as i, init_dist as n, getFeed as r, dist_exports as t };
|