@brightsideoy/kama 0.1.0-alpha.136 → 0.1.0-alpha.138
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/dist/assets/{index-gbnLc3aO.js → index-DrAVYz6F.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +928 -971
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -867,22 +867,22 @@ function Ie(e, t) {
|
|
|
867
867
|
}
|
|
868
868
|
//#endregion
|
|
869
869
|
//#region node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js
|
|
870
|
-
var Le = "<<",
|
|
870
|
+
var Le = "<<", z = {
|
|
871
871
|
identify: (e) => e === Le || typeof e == "symbol" && e.description === Le,
|
|
872
872
|
default: "key",
|
|
873
873
|
tag: "tag:yaml.org,2002:merge",
|
|
874
874
|
test: /^<<$/,
|
|
875
|
-
resolve: () => Object.assign(new N(Symbol(Le)), { addToJSMap:
|
|
875
|
+
resolve: () => Object.assign(new N(Symbol(Le)), { addToJSMap: ze }),
|
|
876
876
|
stringify: () => Le
|
|
877
|
-
},
|
|
878
|
-
function
|
|
879
|
-
let r =
|
|
880
|
-
if (v(r)) for (let n of r.items)
|
|
881
|
-
else if (Array.isArray(r)) for (let n of r)
|
|
882
|
-
else
|
|
877
|
+
}, Re = (e, t) => (z.identify(t) || _(t) && (!t.type || t.type === N.PLAIN) && z.identify(t.value)) && e?.doc.schema.tags.some((e) => e.tag === z.tag && e.default);
|
|
878
|
+
function ze(e, t, n) {
|
|
879
|
+
let r = Ve(e, n);
|
|
880
|
+
if (v(r)) for (let n of r.items) Be(e, t, n);
|
|
881
|
+
else if (Array.isArray(r)) for (let n of r) Be(e, t, n);
|
|
882
|
+
else Be(e, t, r);
|
|
883
883
|
}
|
|
884
|
-
function
|
|
885
|
-
let r =
|
|
884
|
+
function Be(e, t, n) {
|
|
885
|
+
let r = Ve(e, n);
|
|
886
886
|
if (!h(r)) throw Error("Merge sources must be maps or map aliases");
|
|
887
887
|
let i = r.toJSON(null, e, Map);
|
|
888
888
|
for (let [e, n] of i) t instanceof Map ? t.has(e) || t.set(e, n) : t instanceof Set ? t.add(e) : Object.prototype.hasOwnProperty.call(t, e) || Object.defineProperty(t, e, {
|
|
@@ -893,20 +893,20 @@ function Ve(e, t, n) {
|
|
|
893
893
|
});
|
|
894
894
|
return t;
|
|
895
895
|
}
|
|
896
|
-
function
|
|
896
|
+
function Ve(e, t) {
|
|
897
897
|
return e && p(t) ? t.resolve(e.doc, e) : t;
|
|
898
898
|
}
|
|
899
899
|
//#endregion
|
|
900
900
|
//#region node_modules/yaml/browser/dist/nodes/addPairToJSMap.js
|
|
901
|
-
function
|
|
901
|
+
function He(e, t, { key: n, value: r }) {
|
|
902
902
|
if (b(n) && n.addToJSMap) n.addToJSMap(e, t, r);
|
|
903
|
-
else if (
|
|
903
|
+
else if (Re(e, n)) ze(e, t, r);
|
|
904
904
|
else {
|
|
905
905
|
let i = j(n, "", e);
|
|
906
906
|
if (t instanceof Map) t.set(i, j(r, i, e));
|
|
907
907
|
else if (t instanceof Set) t.add(i);
|
|
908
908
|
else {
|
|
909
|
-
let a =
|
|
909
|
+
let a = Ue(n, i, e), o = j(r, a, e);
|
|
910
910
|
a in t ? Object.defineProperty(t, a, {
|
|
911
911
|
value: o,
|
|
912
912
|
writable: !0,
|
|
@@ -917,7 +917,7 @@ function Ue(e, t, { key: n, value: r }) {
|
|
|
917
917
|
}
|
|
918
918
|
return t;
|
|
919
919
|
}
|
|
920
|
-
function
|
|
920
|
+
function Ue(e, t, n) {
|
|
921
921
|
if (t === null) return "";
|
|
922
922
|
if (typeof t != "object") return String(t);
|
|
923
923
|
if (b(e) && n?.doc) {
|
|
@@ -936,10 +936,10 @@ function We(e, t, n) {
|
|
|
936
936
|
}
|
|
937
937
|
//#endregion
|
|
938
938
|
//#region node_modules/yaml/browser/dist/nodes/Pair.js
|
|
939
|
-
function
|
|
940
|
-
return new
|
|
939
|
+
function We(e, t, n) {
|
|
940
|
+
return new B(P(e, void 0, n), P(t, void 0, n));
|
|
941
941
|
}
|
|
942
|
-
var
|
|
942
|
+
var B = class e {
|
|
943
943
|
constructor(e, t = null) {
|
|
944
944
|
Object.defineProperty(this, f, { value: l }), this.key = e, this.value = t;
|
|
945
945
|
}
|
|
@@ -948,7 +948,7 @@ var z = class e {
|
|
|
948
948
|
return b(n) && (n = n.clone(t)), b(r) && (r = r.clone(t)), new e(n, r);
|
|
949
949
|
}
|
|
950
950
|
toJSON(e, t) {
|
|
951
|
-
return
|
|
951
|
+
return He(t, t?.mapAsMap ? /* @__PURE__ */ new Map() : {}, this);
|
|
952
952
|
}
|
|
953
953
|
toString(e, t, n) {
|
|
954
954
|
return e?.doc ? Fe(this, e, t, n) : JSON.stringify(this);
|
|
@@ -956,20 +956,20 @@ var z = class e {
|
|
|
956
956
|
};
|
|
957
957
|
//#endregion
|
|
958
958
|
//#region node_modules/yaml/browser/dist/stringify/stringifyCollection.js
|
|
959
|
-
function
|
|
960
|
-
return (t.inFlow ?? e.flow ?
|
|
959
|
+
function Ge(e, t, n) {
|
|
960
|
+
return (t.inFlow ?? e.flow ? qe : Ke)(e, t, n);
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function Ke({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, itemIndent: a, onChompKeep: o, onComment: s }) {
|
|
963
963
|
let { indent: c, options: { commentString: l } } = n, u = Object.assign({}, n, {
|
|
964
964
|
indent: a,
|
|
965
965
|
type: null
|
|
966
966
|
}), d = !1, f = [];
|
|
967
967
|
for (let e = 0; e < t.length; ++e) {
|
|
968
968
|
let i = t[e], o = null;
|
|
969
|
-
if (b(i)) !d && i.spaceBefore && f.push(""),
|
|
969
|
+
if (b(i)) !d && i.spaceBefore && f.push(""), Je(n, f, i.commentBefore, d), i.comment && (o = i.comment);
|
|
970
970
|
else if (g(i)) {
|
|
971
971
|
let e = b(i.key) ? i.key : null;
|
|
972
|
-
e && (!d && e.spaceBefore && f.push(""),
|
|
972
|
+
e && (!d && e.spaceBefore && f.push(""), Je(n, f, e.commentBefore, d));
|
|
973
973
|
}
|
|
974
974
|
d = !1;
|
|
975
975
|
let s = Pe(i, u, () => o = null, () => d = !0);
|
|
@@ -986,7 +986,7 @@ function qe({ comment: e, items: t }, n, { blockItemPrefix: r, flowChars: i, ite
|
|
|
986
986
|
}
|
|
987
987
|
return e ? (p += "\n" + F(l(e), c), s && s()) : d && o && o(), p;
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function qe({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
990
990
|
let { indent: i, indentStep: a, flowCollectionPadding: o, options: { commentString: s } } = t;
|
|
991
991
|
r += a;
|
|
992
992
|
let c = Object.assign({}, t, {
|
|
@@ -996,10 +996,10 @@ function Je({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
|
996
996
|
}), l = !1, u = 0, d = [];
|
|
997
997
|
for (let n = 0; n < e.length; ++n) {
|
|
998
998
|
let i = e[n], a = null;
|
|
999
|
-
if (b(i)) i.spaceBefore && d.push(""),
|
|
999
|
+
if (b(i)) i.spaceBefore && d.push(""), Je(t, d, i.commentBefore, !1), i.comment && (a = i.comment);
|
|
1000
1000
|
else if (g(i)) {
|
|
1001
1001
|
let e = b(i.key) ? i.key : null;
|
|
1002
|
-
e && (e.spaceBefore && d.push(""),
|
|
1002
|
+
e && (e.spaceBefore && d.push(""), Je(t, d, e.commentBefore, !1), e.comment && (l = !0));
|
|
1003
1003
|
let n = b(i.value) ? i.value : null;
|
|
1004
1004
|
n ? (n.comment && (a = n.comment), n.commentBefore && (l = !0)) : i.value == null && e?.comment && (a = e.comment);
|
|
1005
1005
|
}
|
|
@@ -1020,7 +1020,7 @@ function Je({ items: e }, t, { flowChars: n, itemIndent: r }) {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
return `${f}${o}${d.join(" ")}${o}${p}`;
|
|
1022
1022
|
}
|
|
1023
|
-
function
|
|
1023
|
+
function Je({ indent: e, options: { commentString: t } }, n, r, i) {
|
|
1024
1024
|
if (r && i && (r = r.replace(/^\n+/, "")), r) {
|
|
1025
1025
|
let i = F(t(r), e);
|
|
1026
1026
|
n.push(i.trimStart());
|
|
@@ -1028,11 +1028,11 @@ function Ye({ indent: e, options: { commentString: t } }, n, r, i) {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
//#endregion
|
|
1030
1030
|
//#region node_modules/yaml/browser/dist/nodes/YAMLMap.js
|
|
1031
|
-
function
|
|
1031
|
+
function Ye(e, t) {
|
|
1032
1032
|
let n = _(t) ? t.value : t;
|
|
1033
1033
|
for (let r of e) if (g(r) && (r.key === t || r.key === n || _(r.key) && r.key.value === n)) return r;
|
|
1034
1034
|
}
|
|
1035
|
-
var
|
|
1035
|
+
var V = class extends ge {
|
|
1036
1036
|
static get tagName() {
|
|
1037
1037
|
return "tag:yaml.org,2002:map";
|
|
1038
1038
|
}
|
|
@@ -1043,7 +1043,7 @@ var B = class extends ge {
|
|
|
1043
1043
|
let { keepUndefined: r, replacer: i } = n, a = new this(e), o = (e, o) => {
|
|
1044
1044
|
if (typeof i == "function") o = i.call(t, e, o);
|
|
1045
1045
|
else if (Array.isArray(i) && !i.includes(e)) return;
|
|
1046
|
-
(o !== void 0 || r) && a.items.push(
|
|
1046
|
+
(o !== void 0 || r) && a.items.push(We(e, o, n));
|
|
1047
1047
|
};
|
|
1048
1048
|
if (t instanceof Map) for (let [e, n] of t) o(e, n);
|
|
1049
1049
|
else if (t && typeof t == "object") for (let e of Object.keys(t)) o(e, t[e]);
|
|
@@ -1051,8 +1051,8 @@ var B = class extends ge {
|
|
|
1051
1051
|
}
|
|
1052
1052
|
add(e, t) {
|
|
1053
1053
|
let n;
|
|
1054
|
-
n = g(e) ? e : !e || typeof e != "object" || !("key" in e) ? new
|
|
1055
|
-
let r =
|
|
1054
|
+
n = g(e) ? e : !e || typeof e != "object" || !("key" in e) ? new B(e, e?.value) : new B(e.key, e.value);
|
|
1055
|
+
let r = Ye(this.items, n.key), i = this.schema?.sortMapEntries;
|
|
1056
1056
|
if (r) {
|
|
1057
1057
|
if (!t) throw Error(`Key ${n.key} already set`);
|
|
1058
1058
|
_(r.value) && de(n.value) ? r.value.value = n.value : r.value = n.value;
|
|
@@ -1062,29 +1062,29 @@ var B = class extends ge {
|
|
|
1062
1062
|
} else this.items.push(n);
|
|
1063
1063
|
}
|
|
1064
1064
|
delete(e) {
|
|
1065
|
-
let t =
|
|
1065
|
+
let t = Ye(this.items, e);
|
|
1066
1066
|
return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
|
|
1067
1067
|
}
|
|
1068
1068
|
get(e, t) {
|
|
1069
|
-
let n =
|
|
1069
|
+
let n = Ye(this.items, e)?.value;
|
|
1070
1070
|
return (!t && _(n) ? n.value : n) ?? void 0;
|
|
1071
1071
|
}
|
|
1072
1072
|
has(e) {
|
|
1073
|
-
return !!
|
|
1073
|
+
return !!Ye(this.items, e);
|
|
1074
1074
|
}
|
|
1075
1075
|
set(e, t) {
|
|
1076
|
-
this.add(new
|
|
1076
|
+
this.add(new B(e, t), !0);
|
|
1077
1077
|
}
|
|
1078
1078
|
toJSON(e, t, n) {
|
|
1079
1079
|
let r = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1080
1080
|
t?.onCreate && t.onCreate(r);
|
|
1081
|
-
for (let e of this.items)
|
|
1081
|
+
for (let e of this.items) He(t, r, e);
|
|
1082
1082
|
return r;
|
|
1083
1083
|
}
|
|
1084
1084
|
toString(e, t, n) {
|
|
1085
1085
|
if (!e) return JSON.stringify(this);
|
|
1086
1086
|
for (let e of this.items) if (!g(e)) throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);
|
|
1087
|
-
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })),
|
|
1087
|
+
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Ge(this, e, {
|
|
1088
1088
|
blockItemPrefix: "",
|
|
1089
1089
|
flowChars: {
|
|
1090
1090
|
start: "{",
|
|
@@ -1095,16 +1095,16 @@ var B = class extends ge {
|
|
|
1095
1095
|
onComment: t
|
|
1096
1096
|
});
|
|
1097
1097
|
}
|
|
1098
|
-
},
|
|
1098
|
+
}, Xe = {
|
|
1099
1099
|
collection: "map",
|
|
1100
1100
|
default: !0,
|
|
1101
|
-
nodeClass:
|
|
1101
|
+
nodeClass: V,
|
|
1102
1102
|
tag: "tag:yaml.org,2002:map",
|
|
1103
1103
|
resolve(e, t) {
|
|
1104
1104
|
return h(e) || t("Expected a mapping for this tag"), e;
|
|
1105
1105
|
},
|
|
1106
|
-
createNode: (e, t, n) =>
|
|
1107
|
-
},
|
|
1106
|
+
createNode: (e, t, n) => V.from(e, t, n)
|
|
1107
|
+
}, Ze = class extends ge {
|
|
1108
1108
|
static get tagName() {
|
|
1109
1109
|
return "tag:yaml.org,2002:seq";
|
|
1110
1110
|
}
|
|
@@ -1115,21 +1115,21 @@ var B = class extends ge {
|
|
|
1115
1115
|
this.items.push(e);
|
|
1116
1116
|
}
|
|
1117
1117
|
delete(e) {
|
|
1118
|
-
let t =
|
|
1118
|
+
let t = Qe(e);
|
|
1119
1119
|
return typeof t == "number" && this.items.splice(t, 1).length > 0;
|
|
1120
1120
|
}
|
|
1121
1121
|
get(e, t) {
|
|
1122
|
-
let n =
|
|
1122
|
+
let n = Qe(e);
|
|
1123
1123
|
if (typeof n != "number") return;
|
|
1124
1124
|
let r = this.items[n];
|
|
1125
1125
|
return !t && _(r) ? r.value : r;
|
|
1126
1126
|
}
|
|
1127
1127
|
has(e) {
|
|
1128
|
-
let t =
|
|
1128
|
+
let t = Qe(e);
|
|
1129
1129
|
return typeof t == "number" && t < this.items.length;
|
|
1130
1130
|
}
|
|
1131
1131
|
set(e, t) {
|
|
1132
|
-
let n =
|
|
1132
|
+
let n = Qe(e);
|
|
1133
1133
|
if (typeof n != "number") throw Error(`Expected a valid index, not ${e}.`);
|
|
1134
1134
|
let r = this.items[n];
|
|
1135
1135
|
_(r) && de(t) ? r.value = t : this.items[n] = t;
|
|
@@ -1142,7 +1142,7 @@ var B = class extends ge {
|
|
|
1142
1142
|
return n;
|
|
1143
1143
|
}
|
|
1144
1144
|
toString(e, t, n) {
|
|
1145
|
-
return e ?
|
|
1145
|
+
return e ? Ge(this, e, {
|
|
1146
1146
|
blockItemPrefix: "- ",
|
|
1147
1147
|
flowChars: {
|
|
1148
1148
|
start: "[",
|
|
@@ -1168,22 +1168,22 @@ var B = class extends ge {
|
|
|
1168
1168
|
return i;
|
|
1169
1169
|
}
|
|
1170
1170
|
};
|
|
1171
|
-
function
|
|
1171
|
+
function Qe(e) {
|
|
1172
1172
|
let t = _(e) ? e.value : e;
|
|
1173
1173
|
return t && typeof t == "string" && (t = Number(t)), typeof t == "number" && Number.isInteger(t) && t >= 0 ? t : null;
|
|
1174
1174
|
}
|
|
1175
1175
|
//#endregion
|
|
1176
1176
|
//#region node_modules/yaml/browser/dist/schema/common/seq.js
|
|
1177
|
-
var
|
|
1177
|
+
var $e = {
|
|
1178
1178
|
collection: "seq",
|
|
1179
1179
|
default: !0,
|
|
1180
|
-
nodeClass:
|
|
1180
|
+
nodeClass: Ze,
|
|
1181
1181
|
tag: "tag:yaml.org,2002:seq",
|
|
1182
1182
|
resolve(e, t) {
|
|
1183
1183
|
return v(e) || t("Expected a sequence for this tag"), e;
|
|
1184
1184
|
},
|
|
1185
|
-
createNode: (e, t, n) =>
|
|
1186
|
-
},
|
|
1185
|
+
createNode: (e, t, n) => Ze.from(e, t, n)
|
|
1186
|
+
}, et = {
|
|
1187
1187
|
identify: (e) => typeof e == "string",
|
|
1188
1188
|
default: !0,
|
|
1189
1189
|
tag: "tag:yaml.org,2002:str",
|
|
@@ -1191,27 +1191,27 @@ var et = {
|
|
|
1191
1191
|
stringify(e, t, n, r) {
|
|
1192
1192
|
return t = Object.assign({ actualString: !0 }, t), Ae(e, t, n, r);
|
|
1193
1193
|
}
|
|
1194
|
-
},
|
|
1194
|
+
}, tt = {
|
|
1195
1195
|
identify: (e) => e == null,
|
|
1196
1196
|
createNode: () => new N(null),
|
|
1197
1197
|
default: !0,
|
|
1198
1198
|
tag: "tag:yaml.org,2002:null",
|
|
1199
1199
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1200
1200
|
resolve: () => new N(null),
|
|
1201
|
-
stringify: ({ source: e }, t) => typeof e == "string" &&
|
|
1202
|
-
},
|
|
1201
|
+
stringify: ({ source: e }, t) => typeof e == "string" && tt.test.test(e) ? e : t.options.nullStr
|
|
1202
|
+
}, nt = {
|
|
1203
1203
|
identify: (e) => typeof e == "boolean",
|
|
1204
1204
|
default: !0,
|
|
1205
1205
|
tag: "tag:yaml.org,2002:bool",
|
|
1206
1206
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1207
1207
|
resolve: (e) => new N(e[0] === "t" || e[0] === "T"),
|
|
1208
1208
|
stringify({ source: e, value: t }, n) {
|
|
1209
|
-
return e &&
|
|
1209
|
+
return e && nt.test.test(e) && t === (e[0] === "t" || e[0] === "T") ? e : t ? n.options.trueStr : n.options.falseStr;
|
|
1210
1210
|
}
|
|
1211
1211
|
};
|
|
1212
1212
|
//#endregion
|
|
1213
1213
|
//#region node_modules/yaml/browser/dist/stringify/stringifyNumber.js
|
|
1214
|
-
function
|
|
1214
|
+
function H({ format: e, minFractionDigits: t, tag: n, value: r }) {
|
|
1215
1215
|
if (typeof r == "bigint") return String(r);
|
|
1216
1216
|
let i = typeof r == "number" ? r : Number(r);
|
|
1217
1217
|
if (!isFinite(i)) return isNaN(i) ? ".nan" : i < 0 ? "-.inf" : ".inf";
|
|
@@ -1226,14 +1226,14 @@ function V({ format: e, minFractionDigits: t, tag: n, value: r }) {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
//#endregion
|
|
1228
1228
|
//#region node_modules/yaml/browser/dist/schema/core/float.js
|
|
1229
|
-
var
|
|
1229
|
+
var rt = {
|
|
1230
1230
|
identify: (e) => typeof e == "number",
|
|
1231
1231
|
default: !0,
|
|
1232
1232
|
tag: "tag:yaml.org,2002:float",
|
|
1233
1233
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1234
1234
|
resolve: (e) => e.slice(-3).toLowerCase() === "nan" ? NaN : e[0] === "-" ? -Infinity : Infinity,
|
|
1235
|
-
stringify:
|
|
1236
|
-
},
|
|
1235
|
+
stringify: H
|
|
1236
|
+
}, it = {
|
|
1237
1237
|
identify: (e) => typeof e == "number",
|
|
1238
1238
|
default: !0,
|
|
1239
1239
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1242,9 +1242,9 @@ var it = {
|
|
|
1242
1242
|
resolve: (e) => parseFloat(e),
|
|
1243
1243
|
stringify(e) {
|
|
1244
1244
|
let t = Number(e.value);
|
|
1245
|
-
return isFinite(t) ? t.toExponential() :
|
|
1245
|
+
return isFinite(t) ? t.toExponential() : H(e);
|
|
1246
1246
|
}
|
|
1247
|
-
},
|
|
1247
|
+
}, at = {
|
|
1248
1248
|
identify: (e) => typeof e == "number",
|
|
1249
1249
|
default: !0,
|
|
1250
1250
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1253,60 +1253,60 @@ var it = {
|
|
|
1253
1253
|
let t = new N(parseFloat(e)), n = e.indexOf(".");
|
|
1254
1254
|
return n !== -1 && e[e.length - 1] === "0" && (t.minFractionDigits = e.length - n - 1), t;
|
|
1255
1255
|
},
|
|
1256
|
-
stringify:
|
|
1257
|
-
},
|
|
1258
|
-
function
|
|
1256
|
+
stringify: H
|
|
1257
|
+
}, ot = (e) => typeof e == "bigint" || Number.isInteger(e), st = (e, t, n, { intAsBigInt: r }) => r ? BigInt(e) : parseInt(e.substring(t), n);
|
|
1258
|
+
function ct(e, t, n) {
|
|
1259
1259
|
let { value: r } = e;
|
|
1260
|
-
return
|
|
1260
|
+
return ot(r) && r >= 0 ? n + r.toString(t) : H(e);
|
|
1261
1261
|
}
|
|
1262
|
-
var
|
|
1263
|
-
identify: (e) =>
|
|
1262
|
+
var lt = {
|
|
1263
|
+
identify: (e) => ot(e) && e >= 0,
|
|
1264
1264
|
default: !0,
|
|
1265
1265
|
tag: "tag:yaml.org,2002:int",
|
|
1266
1266
|
format: "OCT",
|
|
1267
1267
|
test: /^0o[0-7]+$/,
|
|
1268
|
-
resolve: (e, t, n) =>
|
|
1269
|
-
stringify: (e) =>
|
|
1270
|
-
},
|
|
1271
|
-
identify:
|
|
1268
|
+
resolve: (e, t, n) => st(e, 2, 8, n),
|
|
1269
|
+
stringify: (e) => ct(e, 8, "0o")
|
|
1270
|
+
}, ut = {
|
|
1271
|
+
identify: ot,
|
|
1272
1272
|
default: !0,
|
|
1273
1273
|
tag: "tag:yaml.org,2002:int",
|
|
1274
1274
|
test: /^[-+]?[0-9]+$/,
|
|
1275
|
-
resolve: (e, t, n) =>
|
|
1276
|
-
stringify:
|
|
1277
|
-
},
|
|
1278
|
-
identify: (e) =>
|
|
1275
|
+
resolve: (e, t, n) => st(e, 0, 10, n),
|
|
1276
|
+
stringify: H
|
|
1277
|
+
}, dt = {
|
|
1278
|
+
identify: (e) => ot(e) && e >= 0,
|
|
1279
1279
|
default: !0,
|
|
1280
1280
|
tag: "tag:yaml.org,2002:int",
|
|
1281
1281
|
format: "HEX",
|
|
1282
1282
|
test: /^0x[0-9a-fA-F]+$/,
|
|
1283
|
-
resolve: (e, t, n) =>
|
|
1284
|
-
stringify: (e) =>
|
|
1285
|
-
},
|
|
1286
|
-
|
|
1283
|
+
resolve: (e, t, n) => st(e, 2, 16, n),
|
|
1284
|
+
stringify: (e) => ct(e, 16, "0x")
|
|
1285
|
+
}, ft = [
|
|
1286
|
+
Xe,
|
|
1287
|
+
$e,
|
|
1287
1288
|
et,
|
|
1288
1289
|
tt,
|
|
1289
1290
|
nt,
|
|
1290
|
-
|
|
1291
|
+
lt,
|
|
1291
1292
|
ut,
|
|
1292
1293
|
dt,
|
|
1293
|
-
|
|
1294
|
+
rt,
|
|
1294
1295
|
it,
|
|
1295
|
-
at
|
|
1296
|
-
ot
|
|
1296
|
+
at
|
|
1297
1297
|
];
|
|
1298
1298
|
//#endregion
|
|
1299
1299
|
//#region node_modules/yaml/browser/dist/schema/json/schema.js
|
|
1300
|
-
function
|
|
1300
|
+
function pt(e) {
|
|
1301
1301
|
return typeof e == "bigint" || Number.isInteger(e);
|
|
1302
1302
|
}
|
|
1303
|
-
var
|
|
1303
|
+
var mt = ({ value: e }) => JSON.stringify(e), ht = [
|
|
1304
1304
|
{
|
|
1305
1305
|
identify: (e) => typeof e == "string",
|
|
1306
1306
|
default: !0,
|
|
1307
1307
|
tag: "tag:yaml.org,2002:str",
|
|
1308
1308
|
resolve: (e) => e,
|
|
1309
|
-
stringify:
|
|
1309
|
+
stringify: mt
|
|
1310
1310
|
},
|
|
1311
1311
|
{
|
|
1312
1312
|
identify: (e) => e == null,
|
|
@@ -1315,7 +1315,7 @@ var ht = ({ value: e }) => JSON.stringify(e), gt = [
|
|
|
1315
1315
|
tag: "tag:yaml.org,2002:null",
|
|
1316
1316
|
test: /^null$/,
|
|
1317
1317
|
resolve: () => null,
|
|
1318
|
-
stringify:
|
|
1318
|
+
stringify: mt
|
|
1319
1319
|
},
|
|
1320
1320
|
{
|
|
1321
1321
|
identify: (e) => typeof e == "boolean",
|
|
@@ -1323,15 +1323,15 @@ var ht = ({ value: e }) => JSON.stringify(e), gt = [
|
|
|
1323
1323
|
tag: "tag:yaml.org,2002:bool",
|
|
1324
1324
|
test: /^true$|^false$/,
|
|
1325
1325
|
resolve: (e) => e === "true",
|
|
1326
|
-
stringify:
|
|
1326
|
+
stringify: mt
|
|
1327
1327
|
},
|
|
1328
1328
|
{
|
|
1329
|
-
identify:
|
|
1329
|
+
identify: pt,
|
|
1330
1330
|
default: !0,
|
|
1331
1331
|
tag: "tag:yaml.org,2002:int",
|
|
1332
1332
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
1333
1333
|
resolve: (e, t, { intAsBigInt: n }) => n ? BigInt(e) : parseInt(e, 10),
|
|
1334
|
-
stringify: ({ value: e }) =>
|
|
1334
|
+
stringify: ({ value: e }) => pt(e) ? e.toString() : JSON.stringify(e)
|
|
1335
1335
|
},
|
|
1336
1336
|
{
|
|
1337
1337
|
identify: (e) => typeof e == "number",
|
|
@@ -1339,16 +1339,16 @@ var ht = ({ value: e }) => JSON.stringify(e), gt = [
|
|
|
1339
1339
|
tag: "tag:yaml.org,2002:float",
|
|
1340
1340
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
1341
1341
|
resolve: (e) => parseFloat(e),
|
|
1342
|
-
stringify:
|
|
1342
|
+
stringify: mt
|
|
1343
1343
|
}
|
|
1344
|
-
],
|
|
1344
|
+
], gt = [Xe, $e].concat(ht, {
|
|
1345
1345
|
default: !0,
|
|
1346
1346
|
tag: "",
|
|
1347
1347
|
test: /^/,
|
|
1348
1348
|
resolve(e, t) {
|
|
1349
1349
|
return t(`Unresolved plain scalar ${JSON.stringify(e)}`), e;
|
|
1350
1350
|
}
|
|
1351
|
-
}),
|
|
1351
|
+
}), _t = {
|
|
1352
1352
|
identify: (e) => e instanceof Uint8Array,
|
|
1353
1353
|
default: !1,
|
|
1354
1354
|
tag: "tag:yaml.org,2002:binary",
|
|
@@ -1382,27 +1382,27 @@ var ht = ({ value: e }) => JSON.stringify(e), gt = [
|
|
|
1382
1382
|
};
|
|
1383
1383
|
//#endregion
|
|
1384
1384
|
//#region node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js
|
|
1385
|
-
function
|
|
1385
|
+
function vt(e, t) {
|
|
1386
1386
|
if (v(e)) for (let n = 0; n < e.items.length; ++n) {
|
|
1387
1387
|
let r = e.items[n];
|
|
1388
1388
|
if (!g(r)) {
|
|
1389
1389
|
if (h(r)) {
|
|
1390
1390
|
r.items.length > 1 && t("Each pair must have its own sequence indicator");
|
|
1391
|
-
let e = r.items[0] || new
|
|
1391
|
+
let e = r.items[0] || new B(new N(null));
|
|
1392
1392
|
if (r.commentBefore && (e.key.commentBefore = e.key.commentBefore ? `${r.commentBefore}\n${e.key.commentBefore}` : r.commentBefore), r.comment) {
|
|
1393
1393
|
let t = e.value ?? e.key;
|
|
1394
1394
|
t.comment = t.comment ? `${r.comment}\n${t.comment}` : r.comment;
|
|
1395
1395
|
}
|
|
1396
1396
|
r = e;
|
|
1397
1397
|
}
|
|
1398
|
-
e.items[n] = g(r) ? r : new
|
|
1398
|
+
e.items[n] = g(r) ? r : new B(r);
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
1401
1401
|
else t("Expected a sequence for this tag");
|
|
1402
1402
|
return e;
|
|
1403
1403
|
}
|
|
1404
|
-
function
|
|
1405
|
-
let { replacer: r } = n, i = new
|
|
1404
|
+
function yt(e, t, n) {
|
|
1405
|
+
let { replacer: r } = n, i = new Ze(e);
|
|
1406
1406
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
1407
1407
|
let a = 0;
|
|
1408
1408
|
if (t && Symbol.iterator in Object(t)) for (let e of t) {
|
|
@@ -1416,19 +1416,19 @@ function bt(e, t, n) {
|
|
|
1416
1416
|
if (t.length === 1) o = t[0], s = e[o];
|
|
1417
1417
|
else throw TypeError(`Expected tuple with one key, not ${t.length} keys`);
|
|
1418
1418
|
} else o = e;
|
|
1419
|
-
i.items.push(
|
|
1419
|
+
i.items.push(We(o, s, n));
|
|
1420
1420
|
}
|
|
1421
1421
|
return i;
|
|
1422
1422
|
}
|
|
1423
|
-
var
|
|
1423
|
+
var bt = {
|
|
1424
1424
|
collection: "seq",
|
|
1425
1425
|
default: !1,
|
|
1426
1426
|
tag: "tag:yaml.org,2002:pairs",
|
|
1427
|
-
resolve:
|
|
1428
|
-
createNode:
|
|
1429
|
-
},
|
|
1427
|
+
resolve: vt,
|
|
1428
|
+
createNode: yt
|
|
1429
|
+
}, xt = class e extends Ze {
|
|
1430
1430
|
constructor() {
|
|
1431
|
-
super(), this.add =
|
|
1431
|
+
super(), this.add = V.prototype.add.bind(this), this.delete = V.prototype.delete.bind(this), this.get = V.prototype.get.bind(this), this.has = V.prototype.has.bind(this), this.set = V.prototype.set.bind(this), this.tag = e.tag;
|
|
1432
1432
|
}
|
|
1433
1433
|
toJSON(e, t) {
|
|
1434
1434
|
if (!t) return super.toJSON(e);
|
|
@@ -1442,51 +1442,51 @@ var xt = {
|
|
|
1442
1442
|
return n;
|
|
1443
1443
|
}
|
|
1444
1444
|
static from(e, t, n) {
|
|
1445
|
-
let r =
|
|
1445
|
+
let r = yt(e, t, n), i = new this();
|
|
1446
1446
|
return i.items = r.items, i;
|
|
1447
1447
|
}
|
|
1448
1448
|
};
|
|
1449
|
-
|
|
1450
|
-
var
|
|
1449
|
+
xt.tag = "tag:yaml.org,2002:omap";
|
|
1450
|
+
var St = {
|
|
1451
1451
|
collection: "seq",
|
|
1452
1452
|
identify: (e) => e instanceof Map,
|
|
1453
|
-
nodeClass:
|
|
1453
|
+
nodeClass: xt,
|
|
1454
1454
|
default: !1,
|
|
1455
1455
|
tag: "tag:yaml.org,2002:omap",
|
|
1456
1456
|
resolve(e, t) {
|
|
1457
|
-
let n =
|
|
1457
|
+
let n = vt(e, t), r = [];
|
|
1458
1458
|
for (let { key: e } of n.items) _(e) && (r.includes(e.value) ? t(`Ordered maps must not include duplicate keys: ${e.value}`) : r.push(e.value));
|
|
1459
|
-
return Object.assign(new
|
|
1459
|
+
return Object.assign(new xt(), n);
|
|
1460
1460
|
},
|
|
1461
|
-
createNode: (e, t, n) =>
|
|
1461
|
+
createNode: (e, t, n) => xt.from(e, t, n)
|
|
1462
1462
|
};
|
|
1463
1463
|
//#endregion
|
|
1464
1464
|
//#region node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
|
|
1465
|
-
function
|
|
1466
|
-
return t && (e ?
|
|
1465
|
+
function Ct({ value: e, source: t }, n) {
|
|
1466
|
+
return t && (e ? wt : Tt).test.test(t) ? t : e ? n.options.trueStr : n.options.falseStr;
|
|
1467
1467
|
}
|
|
1468
|
-
var
|
|
1468
|
+
var wt = {
|
|
1469
1469
|
identify: (e) => e === !0,
|
|
1470
1470
|
default: !0,
|
|
1471
1471
|
tag: "tag:yaml.org,2002:bool",
|
|
1472
1472
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1473
1473
|
resolve: () => new N(!0),
|
|
1474
|
-
stringify:
|
|
1475
|
-
},
|
|
1474
|
+
stringify: Ct
|
|
1475
|
+
}, Tt = {
|
|
1476
1476
|
identify: (e) => e === !1,
|
|
1477
1477
|
default: !0,
|
|
1478
1478
|
tag: "tag:yaml.org,2002:bool",
|
|
1479
1479
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
1480
1480
|
resolve: () => new N(!1),
|
|
1481
|
-
stringify:
|
|
1482
|
-
},
|
|
1481
|
+
stringify: Ct
|
|
1482
|
+
}, Et = {
|
|
1483
1483
|
identify: (e) => typeof e == "number",
|
|
1484
1484
|
default: !0,
|
|
1485
1485
|
tag: "tag:yaml.org,2002:float",
|
|
1486
1486
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1487
1487
|
resolve: (e) => e.slice(-3).toLowerCase() === "nan" ? NaN : e[0] === "-" ? -Infinity : Infinity,
|
|
1488
|
-
stringify:
|
|
1489
|
-
},
|
|
1488
|
+
stringify: H
|
|
1489
|
+
}, Dt = {
|
|
1490
1490
|
identify: (e) => typeof e == "number",
|
|
1491
1491
|
default: !0,
|
|
1492
1492
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1495,9 +1495,9 @@ var Tt = {
|
|
|
1495
1495
|
resolve: (e) => parseFloat(e.replace(/_/g, "")),
|
|
1496
1496
|
stringify(e) {
|
|
1497
1497
|
let t = Number(e.value);
|
|
1498
|
-
return isFinite(t) ? t.toExponential() :
|
|
1498
|
+
return isFinite(t) ? t.toExponential() : H(e);
|
|
1499
1499
|
}
|
|
1500
|
-
},
|
|
1500
|
+
}, Ot = {
|
|
1501
1501
|
identify: (e) => typeof e == "number",
|
|
1502
1502
|
default: !0,
|
|
1503
1503
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1510,9 +1510,9 @@ var Tt = {
|
|
|
1510
1510
|
}
|
|
1511
1511
|
return t;
|
|
1512
1512
|
},
|
|
1513
|
-
stringify:
|
|
1514
|
-
},
|
|
1515
|
-
function
|
|
1513
|
+
stringify: H
|
|
1514
|
+
}, kt = (e) => typeof e == "bigint" || Number.isInteger(e);
|
|
1515
|
+
function At(e, t, n, { intAsBigInt: r }) {
|
|
1516
1516
|
let i = e[0];
|
|
1517
1517
|
if ((i === "-" || i === "+") && (t += 1), e = e.substring(t).replace(/_/g, ""), r) {
|
|
1518
1518
|
switch (n) {
|
|
@@ -1530,61 +1530,61 @@ function jt(e, t, n, { intAsBigInt: r }) {
|
|
|
1530
1530
|
let a = parseInt(e, n);
|
|
1531
1531
|
return i === "-" ? -1 * a : a;
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1533
|
+
function jt(e, t, n) {
|
|
1534
1534
|
let { value: r } = e;
|
|
1535
|
-
if (
|
|
1535
|
+
if (kt(r)) {
|
|
1536
1536
|
let e = r.toString(t);
|
|
1537
1537
|
return r < 0 ? "-" + n + e.substr(1) : n + e;
|
|
1538
1538
|
}
|
|
1539
|
-
return
|
|
1539
|
+
return H(e);
|
|
1540
1540
|
}
|
|
1541
|
-
var
|
|
1542
|
-
identify:
|
|
1541
|
+
var Mt = {
|
|
1542
|
+
identify: kt,
|
|
1543
1543
|
default: !0,
|
|
1544
1544
|
tag: "tag:yaml.org,2002:int",
|
|
1545
1545
|
format: "BIN",
|
|
1546
1546
|
test: /^[-+]?0b[0-1_]+$/,
|
|
1547
|
-
resolve: (e, t, n) =>
|
|
1548
|
-
stringify: (e) =>
|
|
1549
|
-
},
|
|
1550
|
-
identify:
|
|
1547
|
+
resolve: (e, t, n) => At(e, 2, 2, n),
|
|
1548
|
+
stringify: (e) => jt(e, 2, "0b")
|
|
1549
|
+
}, Nt = {
|
|
1550
|
+
identify: kt,
|
|
1551
1551
|
default: !0,
|
|
1552
1552
|
tag: "tag:yaml.org,2002:int",
|
|
1553
1553
|
format: "OCT",
|
|
1554
1554
|
test: /^[-+]?0[0-7_]+$/,
|
|
1555
|
-
resolve: (e, t, n) =>
|
|
1556
|
-
stringify: (e) =>
|
|
1557
|
-
},
|
|
1558
|
-
identify:
|
|
1555
|
+
resolve: (e, t, n) => At(e, 1, 8, n),
|
|
1556
|
+
stringify: (e) => jt(e, 8, "0")
|
|
1557
|
+
}, Pt = {
|
|
1558
|
+
identify: kt,
|
|
1559
1559
|
default: !0,
|
|
1560
1560
|
tag: "tag:yaml.org,2002:int",
|
|
1561
1561
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
1562
|
-
resolve: (e, t, n) =>
|
|
1563
|
-
stringify:
|
|
1564
|
-
},
|
|
1565
|
-
identify:
|
|
1562
|
+
resolve: (e, t, n) => At(e, 0, 10, n),
|
|
1563
|
+
stringify: H
|
|
1564
|
+
}, Ft = {
|
|
1565
|
+
identify: kt,
|
|
1566
1566
|
default: !0,
|
|
1567
1567
|
tag: "tag:yaml.org,2002:int",
|
|
1568
1568
|
format: "HEX",
|
|
1569
1569
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
1570
|
-
resolve: (e, t, n) =>
|
|
1571
|
-
stringify: (e) =>
|
|
1572
|
-
},
|
|
1570
|
+
resolve: (e, t, n) => At(e, 2, 16, n),
|
|
1571
|
+
stringify: (e) => jt(e, 16, "0x")
|
|
1572
|
+
}, It = class e extends V {
|
|
1573
1573
|
constructor(t) {
|
|
1574
1574
|
super(t), this.tag = e.tag;
|
|
1575
1575
|
}
|
|
1576
1576
|
add(e) {
|
|
1577
1577
|
let t;
|
|
1578
|
-
t = g(e) ? e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? new
|
|
1578
|
+
t = g(e) ? e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? new B(e.key, null) : new B(e, null), Ye(this.items, t.key) || this.items.push(t);
|
|
1579
1579
|
}
|
|
1580
1580
|
get(e, t) {
|
|
1581
|
-
let n =
|
|
1581
|
+
let n = Ye(this.items, e);
|
|
1582
1582
|
return !t && g(n) ? _(n.key) ? n.key.value : n.key : n;
|
|
1583
1583
|
}
|
|
1584
1584
|
set(e, t) {
|
|
1585
1585
|
if (typeof t != "boolean") throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
|
|
1586
|
-
let n =
|
|
1587
|
-
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new
|
|
1586
|
+
let n = Ye(this.items, e);
|
|
1587
|
+
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new B(e));
|
|
1588
1588
|
}
|
|
1589
1589
|
toJSON(e, t) {
|
|
1590
1590
|
return super.toJSON(e, t, Set);
|
|
@@ -1596,21 +1596,21 @@ var Nt = {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
static from(e, t, n) {
|
|
1598
1598
|
let { replacer: r } = n, i = new this(e);
|
|
1599
|
-
if (t && Symbol.iterator in Object(t)) for (let e of t) typeof r == "function" && (e = r.call(t, e, e)), i.items.push(
|
|
1599
|
+
if (t && Symbol.iterator in Object(t)) for (let e of t) typeof r == "function" && (e = r.call(t, e, e)), i.items.push(We(e, null, n));
|
|
1600
1600
|
return i;
|
|
1601
1601
|
}
|
|
1602
1602
|
};
|
|
1603
|
-
|
|
1604
|
-
var
|
|
1603
|
+
It.tag = "tag:yaml.org,2002:set";
|
|
1604
|
+
var Lt = {
|
|
1605
1605
|
collection: "map",
|
|
1606
1606
|
identify: (e) => e instanceof Set,
|
|
1607
|
-
nodeClass:
|
|
1607
|
+
nodeClass: It,
|
|
1608
1608
|
default: !1,
|
|
1609
1609
|
tag: "tag:yaml.org,2002:set",
|
|
1610
|
-
createNode: (e, t, n) =>
|
|
1610
|
+
createNode: (e, t, n) => It.from(e, t, n),
|
|
1611
1611
|
resolve(e, t) {
|
|
1612
1612
|
if (h(e)) {
|
|
1613
|
-
if (e.hasAllNullValues(!0)) return Object.assign(new
|
|
1613
|
+
if (e.hasAllNullValues(!0)) return Object.assign(new It(), e);
|
|
1614
1614
|
t("Set items must all have null values");
|
|
1615
1615
|
} else t("Expected a mapping for this tag");
|
|
1616
1616
|
return e;
|
|
@@ -1618,127 +1618,127 @@ var Rt = {
|
|
|
1618
1618
|
};
|
|
1619
1619
|
//#endregion
|
|
1620
1620
|
//#region node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js
|
|
1621
|
-
function
|
|
1621
|
+
function Rt(e, t) {
|
|
1622
1622
|
let n = e[0], r = n === "-" || n === "+" ? e.substring(1) : e, i = (e) => t ? BigInt(e) : Number(e), a = r.replace(/_/g, "").split(":").reduce((e, t) => e * i(60) + i(t), i(0));
|
|
1623
1623
|
return n === "-" ? i(-1) * a : a;
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
1625
|
+
function zt(e) {
|
|
1626
1626
|
let { value: t } = e, n = (e) => e;
|
|
1627
1627
|
if (typeof t == "bigint") n = (e) => BigInt(e);
|
|
1628
|
-
else if (isNaN(t) || !isFinite(t)) return
|
|
1628
|
+
else if (isNaN(t) || !isFinite(t)) return H(e);
|
|
1629
1629
|
let r = "";
|
|
1630
1630
|
t < 0 && (r = "-", t *= n(-1));
|
|
1631
1631
|
let i = n(60), a = [t % i];
|
|
1632
1632
|
return t < 60 ? a.unshift(0) : (t = (t - a[0]) / i, a.unshift(t % i), t >= 60 && (t = (t - a[0]) / i, a.unshift(t))), r + a.map((e) => String(e).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
|
|
1633
1633
|
}
|
|
1634
|
-
var
|
|
1634
|
+
var Bt = {
|
|
1635
1635
|
identify: (e) => typeof e == "bigint" || Number.isInteger(e),
|
|
1636
1636
|
default: !0,
|
|
1637
1637
|
tag: "tag:yaml.org,2002:int",
|
|
1638
1638
|
format: "TIME",
|
|
1639
1639
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
1640
|
-
resolve: (e, t, { intAsBigInt: n }) =>
|
|
1641
|
-
stringify:
|
|
1642
|
-
},
|
|
1640
|
+
resolve: (e, t, { intAsBigInt: n }) => Rt(e, n),
|
|
1641
|
+
stringify: zt
|
|
1642
|
+
}, Vt = {
|
|
1643
1643
|
identify: (e) => typeof e == "number",
|
|
1644
1644
|
default: !0,
|
|
1645
1645
|
tag: "tag:yaml.org,2002:float",
|
|
1646
1646
|
format: "TIME",
|
|
1647
1647
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
1648
|
-
resolve: (e) =>
|
|
1649
|
-
stringify:
|
|
1650
|
-
},
|
|
1648
|
+
resolve: (e) => Rt(e, !1),
|
|
1649
|
+
stringify: zt
|
|
1650
|
+
}, Ht = {
|
|
1651
1651
|
identify: (e) => e instanceof Date,
|
|
1652
1652
|
default: !0,
|
|
1653
1653
|
tag: "tag:yaml.org,2002:timestamp",
|
|
1654
1654
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
1655
1655
|
resolve(e) {
|
|
1656
|
-
let t = e.match(
|
|
1656
|
+
let t = e.match(Ht.test);
|
|
1657
1657
|
if (!t) throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
1658
1658
|
let [, n, r, i, a, o, s] = t.map(Number), c = t[7] ? Number((t[7] + "00").substr(1, 3)) : 0, l = Date.UTC(n, r - 1, i, a || 0, o || 0, s || 0, c), u = t[8];
|
|
1659
1659
|
if (u && u !== "Z") {
|
|
1660
|
-
let e =
|
|
1660
|
+
let e = Rt(u, !1);
|
|
1661
1661
|
Math.abs(e) < 30 && (e *= 60), l -= 6e4 * e;
|
|
1662
1662
|
}
|
|
1663
1663
|
return new Date(l);
|
|
1664
1664
|
},
|
|
1665
1665
|
stringify: ({ value: e }) => e?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
1666
|
-
},
|
|
1667
|
-
|
|
1666
|
+
}, Ut = [
|
|
1667
|
+
Xe,
|
|
1668
|
+
$e,
|
|
1668
1669
|
et,
|
|
1669
1670
|
tt,
|
|
1670
|
-
|
|
1671
|
+
wt,
|
|
1671
1672
|
Tt,
|
|
1672
|
-
|
|
1673
|
+
Mt,
|
|
1673
1674
|
Nt,
|
|
1674
1675
|
Pt,
|
|
1675
1676
|
Ft,
|
|
1676
|
-
|
|
1677
|
+
Et,
|
|
1677
1678
|
Dt,
|
|
1678
1679
|
Ot,
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1680
|
+
_t,
|
|
1681
|
+
z,
|
|
1682
|
+
St,
|
|
1683
|
+
bt,
|
|
1684
|
+
Lt,
|
|
1685
|
+
Bt,
|
|
1685
1686
|
Vt,
|
|
1686
|
-
Ht
|
|
1687
|
-
|
|
1688
|
-
],
|
|
1689
|
-
["core", pt],
|
|
1687
|
+
Ht
|
|
1688
|
+
], Wt = /* @__PURE__ */ new Map([
|
|
1689
|
+
["core", ft],
|
|
1690
1690
|
["failsafe", [
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1691
|
+
Xe,
|
|
1692
|
+
$e,
|
|
1693
|
+
et
|
|
1694
1694
|
]],
|
|
1695
|
-
["json",
|
|
1696
|
-
["yaml11",
|
|
1697
|
-
["yaml-1.1",
|
|
1698
|
-
]),
|
|
1699
|
-
binary:
|
|
1700
|
-
bool:
|
|
1701
|
-
float:
|
|
1702
|
-
floatExp:
|
|
1703
|
-
floatNaN:
|
|
1704
|
-
floatTime:
|
|
1705
|
-
int:
|
|
1706
|
-
intHex:
|
|
1707
|
-
intOct:
|
|
1708
|
-
intTime:
|
|
1709
|
-
map:
|
|
1710
|
-
merge:
|
|
1711
|
-
null:
|
|
1712
|
-
omap:
|
|
1713
|
-
pairs:
|
|
1714
|
-
seq:
|
|
1715
|
-
set:
|
|
1716
|
-
timestamp:
|
|
1717
|
-
},
|
|
1718
|
-
"tag:yaml.org,2002:binary":
|
|
1719
|
-
"tag:yaml.org,2002:merge":
|
|
1720
|
-
"tag:yaml.org,2002:omap":
|
|
1721
|
-
"tag:yaml.org,2002:pairs":
|
|
1722
|
-
"tag:yaml.org,2002:set":
|
|
1723
|
-
"tag:yaml.org,2002:timestamp":
|
|
1695
|
+
["json", gt],
|
|
1696
|
+
["yaml11", Ut],
|
|
1697
|
+
["yaml-1.1", Ut]
|
|
1698
|
+
]), Gt = {
|
|
1699
|
+
binary: _t,
|
|
1700
|
+
bool: nt,
|
|
1701
|
+
float: at,
|
|
1702
|
+
floatExp: it,
|
|
1703
|
+
floatNaN: rt,
|
|
1704
|
+
floatTime: Vt,
|
|
1705
|
+
int: ut,
|
|
1706
|
+
intHex: dt,
|
|
1707
|
+
intOct: lt,
|
|
1708
|
+
intTime: Bt,
|
|
1709
|
+
map: Xe,
|
|
1710
|
+
merge: z,
|
|
1711
|
+
null: tt,
|
|
1712
|
+
omap: St,
|
|
1713
|
+
pairs: bt,
|
|
1714
|
+
seq: $e,
|
|
1715
|
+
set: Lt,
|
|
1716
|
+
timestamp: Ht
|
|
1717
|
+
}, Kt = {
|
|
1718
|
+
"tag:yaml.org,2002:binary": _t,
|
|
1719
|
+
"tag:yaml.org,2002:merge": z,
|
|
1720
|
+
"tag:yaml.org,2002:omap": St,
|
|
1721
|
+
"tag:yaml.org,2002:pairs": bt,
|
|
1722
|
+
"tag:yaml.org,2002:set": Lt,
|
|
1723
|
+
"tag:yaml.org,2002:timestamp": Ht
|
|
1724
1724
|
};
|
|
1725
|
-
function
|
|
1726
|
-
let r =
|
|
1727
|
-
if (r && !e) return n && !r.includes(
|
|
1725
|
+
function qt(e, t, n) {
|
|
1726
|
+
let r = Wt.get(t);
|
|
1727
|
+
if (r && !e) return n && !r.includes(z) ? r.concat(z) : r.slice();
|
|
1728
1728
|
let i = r;
|
|
1729
1729
|
if (!i) {
|
|
1730
1730
|
if (Array.isArray(e)) i = [];
|
|
1731
1731
|
else {
|
|
1732
|
-
let e = Array.from(
|
|
1732
|
+
let e = Array.from(Wt.keys()).filter((e) => e !== "yaml11").map((e) => JSON.stringify(e)).join(", ");
|
|
1733
1733
|
throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`);
|
|
1734
1734
|
}
|
|
1735
1735
|
}
|
|
1736
1736
|
if (Array.isArray(e)) for (let t of e) i = i.concat(t);
|
|
1737
1737
|
else typeof e == "function" && (i = e(i.slice()));
|
|
1738
|
-
return n && (i = i.concat(
|
|
1739
|
-
let n = typeof t == "string" ?
|
|
1738
|
+
return n && (i = i.concat(z)), i.reduce((e, t) => {
|
|
1739
|
+
let n = typeof t == "string" ? Gt[t] : t;
|
|
1740
1740
|
if (!n) {
|
|
1741
|
-
let e = JSON.stringify(t), n = Object.keys(
|
|
1741
|
+
let e = JSON.stringify(t), n = Object.keys(Gt).map((e) => JSON.stringify(e)).join(", ");
|
|
1742
1742
|
throw Error(`Unknown custom tag ${e}; use one of ${n}`);
|
|
1743
1743
|
}
|
|
1744
1744
|
return e.includes(n) || e.push(n), e;
|
|
@@ -1746,9 +1746,9 @@ function Jt(e, t, n) {
|
|
|
1746
1746
|
}
|
|
1747
1747
|
//#endregion
|
|
1748
1748
|
//#region node_modules/yaml/browser/dist/schema/Schema.js
|
|
1749
|
-
var
|
|
1749
|
+
var Jt = (e, t) => e.key < t.key ? -1 : +(e.key > t.key), Yt = class e {
|
|
1750
1750
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: r, schema: i, sortMapEntries: a, toStringDefaults: o }) {
|
|
1751
|
-
this.compat = Array.isArray(e) ?
|
|
1751
|
+
this.compat = Array.isArray(e) ? qt(e, "compat") : e ? qt(null, e) : null, this.name = typeof i == "string" && i || "core", this.knownTags = r ? Kt : {}, this.tags = qt(t, this.name, n), this.toStringOptions = o ?? null, Object.defineProperty(this, c, { value: Xe }), Object.defineProperty(this, u, { value: et }), Object.defineProperty(this, d, { value: $e }), this.sortMapEntries = typeof a == "function" ? a : a === !0 ? Jt : null;
|
|
1752
1752
|
}
|
|
1753
1753
|
clone() {
|
|
1754
1754
|
let t = Object.create(e.prototype, Object.getOwnPropertyDescriptors(this));
|
|
@@ -1757,7 +1757,7 @@ var Yt = (e, t) => e.key < t.key ? -1 : +(e.key > t.key), Xt = class e {
|
|
|
1757
1757
|
};
|
|
1758
1758
|
//#endregion
|
|
1759
1759
|
//#region node_modules/yaml/browser/dist/stringify/stringifyDocument.js
|
|
1760
|
-
function
|
|
1760
|
+
function Xt(e, t) {
|
|
1761
1761
|
let n = [], r = t.directives === !0;
|
|
1762
1762
|
if (t.directives !== !1 && e.directives) {
|
|
1763
1763
|
let t = e.directives.toString(e);
|
|
@@ -1795,7 +1795,7 @@ function Zt(e, t) {
|
|
|
1795
1795
|
}
|
|
1796
1796
|
//#endregion
|
|
1797
1797
|
//#region node_modules/yaml/browser/dist/doc/Document.js
|
|
1798
|
-
var
|
|
1798
|
+
var Zt = class e {
|
|
1799
1799
|
constructor(e, t, n) {
|
|
1800
1800
|
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, f, { value: s });
|
|
1801
1801
|
let r = null;
|
|
@@ -1819,10 +1819,10 @@ var Qt = class e {
|
|
|
1819
1819
|
return t.commentBefore = this.commentBefore, t.comment = this.comment, t.errors = this.errors.slice(), t.warnings = this.warnings.slice(), t.options = Object.assign({}, this.options), this.directives && (t.directives = this.directives.clone()), t.schema = this.schema.clone(), t.contents = b(this.contents) ? this.contents.clone(t.schema) : this.contents, this.range && (t.range = this.range.slice()), t;
|
|
1820
1820
|
}
|
|
1821
1821
|
add(e) {
|
|
1822
|
-
|
|
1822
|
+
Qt(this.contents) && this.contents.add(e);
|
|
1823
1823
|
}
|
|
1824
1824
|
addIn(e, t) {
|
|
1825
|
-
|
|
1825
|
+
Qt(this.contents) && this.contents.addIn(e, t);
|
|
1826
1826
|
}
|
|
1827
1827
|
createAlias(e, t) {
|
|
1828
1828
|
if (!e.anchor) {
|
|
@@ -1850,13 +1850,13 @@ var Qt = class e {
|
|
|
1850
1850
|
return o && y(m) && (m.flow = !0), d(), m;
|
|
1851
1851
|
}
|
|
1852
1852
|
createPair(e, t, n = {}) {
|
|
1853
|
-
return new
|
|
1853
|
+
return new B(this.createNode(e, null, n), this.createNode(t, null, n));
|
|
1854
1854
|
}
|
|
1855
1855
|
delete(e) {
|
|
1856
|
-
return
|
|
1856
|
+
return Qt(this.contents) ? this.contents.delete(e) : !1;
|
|
1857
1857
|
}
|
|
1858
1858
|
deleteIn(e) {
|
|
1859
|
-
return he(e) ? this.contents != null && (this.contents = null, !0) :
|
|
1859
|
+
return he(e) ? this.contents != null && (this.contents = null, !0) : Qt(this.contents) ? this.contents.deleteIn(e) : !1;
|
|
1860
1860
|
}
|
|
1861
1861
|
get(e, t) {
|
|
1862
1862
|
return y(this.contents) ? this.contents.get(e, t) : void 0;
|
|
@@ -1871,10 +1871,10 @@ var Qt = class e {
|
|
|
1871
1871
|
return he(e) ? this.contents !== void 0 : y(this.contents) ? this.contents.hasIn(e) : !1;
|
|
1872
1872
|
}
|
|
1873
1873
|
set(e, t) {
|
|
1874
|
-
this.contents == null ? this.contents = me(this.schema, [e], t) :
|
|
1874
|
+
this.contents == null ? this.contents = me(this.schema, [e], t) : Qt(this.contents) && this.contents.set(e, t);
|
|
1875
1875
|
}
|
|
1876
1876
|
setIn(e, t) {
|
|
1877
|
-
he(e) ? this.contents = t : this.contents == null ? this.contents = me(this.schema, Array.from(e), t) :
|
|
1877
|
+
he(e) ? this.contents = t : this.contents == null ? this.contents = me(this.schema, Array.from(e), t) : Qt(this.contents) && this.contents.setIn(e, t);
|
|
1878
1878
|
}
|
|
1879
1879
|
setSchema(e, t = {}) {
|
|
1880
1880
|
typeof e == "number" && (e = String(e));
|
|
@@ -1902,7 +1902,7 @@ var Qt = class e {
|
|
|
1902
1902
|
}
|
|
1903
1903
|
}
|
|
1904
1904
|
if (t.schema instanceof Object) this.schema = t.schema;
|
|
1905
|
-
else if (n) this.schema = new
|
|
1905
|
+
else if (n) this.schema = new Yt(Object.assign(n, t));
|
|
1906
1906
|
else throw Error("With a null YAML version, the { schema: Schema } option is required");
|
|
1907
1907
|
}
|
|
1908
1908
|
toJS({ json: e, jsonArg: t, mapAsMap: n, maxAliasCount: r, onAnchor: i, reviver: a } = {}) {
|
|
@@ -1931,28 +1931,28 @@ var Qt = class e {
|
|
|
1931
1931
|
let t = JSON.stringify(e.indent);
|
|
1932
1932
|
throw Error(`"indent" option must be a positive integer, not ${t}`);
|
|
1933
1933
|
}
|
|
1934
|
-
return
|
|
1934
|
+
return Xt(this, e);
|
|
1935
1935
|
}
|
|
1936
1936
|
};
|
|
1937
|
-
function
|
|
1937
|
+
function Qt(e) {
|
|
1938
1938
|
if (y(e)) return !0;
|
|
1939
1939
|
throw Error("Expected a YAML collection as document contents");
|
|
1940
1940
|
}
|
|
1941
1941
|
//#endregion
|
|
1942
1942
|
//#region node_modules/yaml/browser/dist/errors.js
|
|
1943
|
-
var
|
|
1943
|
+
var $t = class extends Error {
|
|
1944
1944
|
constructor(e, t, n, r) {
|
|
1945
1945
|
super(), this.name = e, this.code = n, this.message = r, this.pos = t;
|
|
1946
1946
|
}
|
|
1947
|
-
},
|
|
1947
|
+
}, en = class extends $t {
|
|
1948
1948
|
constructor(e, t, n) {
|
|
1949
1949
|
super("YAMLParseError", e, t, n);
|
|
1950
1950
|
}
|
|
1951
|
-
},
|
|
1951
|
+
}, tn = class extends $t {
|
|
1952
1952
|
constructor(e, t, n) {
|
|
1953
1953
|
super("YAMLWarning", e, t, n);
|
|
1954
1954
|
}
|
|
1955
|
-
},
|
|
1955
|
+
}, nn = (e, t) => (n) => {
|
|
1956
1956
|
if (n.pos[0] === -1) return;
|
|
1957
1957
|
n.linePos = n.pos.map((e) => t.linePos(e));
|
|
1958
1958
|
let { line: r, col: i } = n.linePos[0];
|
|
@@ -1975,7 +1975,7 @@ var en = class extends Error {
|
|
|
1975
1975
|
};
|
|
1976
1976
|
//#endregion
|
|
1977
1977
|
//#region node_modules/yaml/browser/dist/compose/resolve-props.js
|
|
1978
|
-
function
|
|
1978
|
+
function rn(e, { flow: t, indicator: n, next: r, offset: i, onError: a, parentIndent: o, startOnNewline: s }) {
|
|
1979
1979
|
let c = !1, l = s, u = s, d = "", f = "", p = !1, m = !1, h = null, g = null, _ = null, v = null, y = null, b = null, x = null;
|
|
1980
1980
|
for (let i of e) switch (m &&= (i.type !== "space" && i.type !== "newline" && i.type !== "comma" && a(i.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), !1), h &&= (l && i.type !== "comment" && i.type !== "newline" && a(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), null), i.type) {
|
|
1981
1981
|
case "space":
|
|
@@ -2021,7 +2021,7 @@ function an(e, { flow: t, indicator: n, next: r, offset: i, onError: a, parentIn
|
|
|
2021
2021
|
}
|
|
2022
2022
|
//#endregion
|
|
2023
2023
|
//#region node_modules/yaml/browser/dist/compose/util-contains-newline.js
|
|
2024
|
-
function
|
|
2024
|
+
function an(e) {
|
|
2025
2025
|
if (!e) return null;
|
|
2026
2026
|
switch (e.type) {
|
|
2027
2027
|
case "alias":
|
|
@@ -2039,7 +2039,7 @@ function on(e) {
|
|
|
2039
2039
|
if (t.sep) {
|
|
2040
2040
|
for (let e of t.sep) if (e.type === "newline") return !0;
|
|
2041
2041
|
}
|
|
2042
|
-
if (
|
|
2042
|
+
if (an(t.key) || an(t.value)) return !0;
|
|
2043
2043
|
}
|
|
2044
2044
|
return !1;
|
|
2045
2045
|
default: return !0;
|
|
@@ -2047,15 +2047,15 @@ function on(e) {
|
|
|
2047
2047
|
}
|
|
2048
2048
|
//#endregion
|
|
2049
2049
|
//#region node_modules/yaml/browser/dist/compose/util-flow-indent-check.js
|
|
2050
|
-
function
|
|
2050
|
+
function on(e, t, n) {
|
|
2051
2051
|
if (t?.type === "flow-collection") {
|
|
2052
2052
|
let r = t.end[0];
|
|
2053
|
-
r.indent === e && (r.source === "]" || r.source === "}") &&
|
|
2053
|
+
r.indent === e && (r.source === "]" || r.source === "}") && an(t) && n(r, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
2054
2054
|
}
|
|
2055
2055
|
}
|
|
2056
2056
|
//#endregion
|
|
2057
2057
|
//#region node_modules/yaml/browser/dist/compose/util-map-includes.js
|
|
2058
|
-
function
|
|
2058
|
+
function sn(e, t, n) {
|
|
2059
2059
|
let { uniqueKeys: r } = e.options;
|
|
2060
2060
|
if (r === !1) return !1;
|
|
2061
2061
|
let i = typeof r == "function" ? r : (e, t) => e === t || _(e) && _(t) && e.value === t.value;
|
|
@@ -2063,13 +2063,13 @@ function cn(e, t, n) {
|
|
|
2063
2063
|
}
|
|
2064
2064
|
//#endregion
|
|
2065
2065
|
//#region node_modules/yaml/browser/dist/compose/resolve-block-map.js
|
|
2066
|
-
var
|
|
2067
|
-
function
|
|
2068
|
-
let o = new ((a?.nodeClass) ??
|
|
2066
|
+
var cn = "All mapping items must start at the same column";
|
|
2067
|
+
function ln({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
2068
|
+
let o = new ((a?.nodeClass) ?? V)(n.schema);
|
|
2069
2069
|
n.atRoot &&= !1;
|
|
2070
2070
|
let s = r.offset, c = null;
|
|
2071
2071
|
for (let a of r.items) {
|
|
2072
|
-
let { start: l, key: u, sep: d, value: f } = a, p =
|
|
2072
|
+
let { start: l, key: u, sep: d, value: f } = a, p = rn(l, {
|
|
2073
2073
|
indicator: "explicit-key-ind",
|
|
2074
2074
|
next: u ?? d?.[0],
|
|
2075
2075
|
offset: s,
|
|
@@ -2078,16 +2078,16 @@ function un({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2078
2078
|
startOnNewline: !0
|
|
2079
2079
|
}), m = !p.found;
|
|
2080
2080
|
if (m) {
|
|
2081
|
-
if (u && (u.type === "block-seq" ? i(s, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== r.indent && i(s, "BAD_INDENT",
|
|
2081
|
+
if (u && (u.type === "block-seq" ? i(s, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== r.indent && i(s, "BAD_INDENT", cn)), !p.anchor && !p.tag && !d) {
|
|
2082
2082
|
c = p.end, p.comment && (o.comment ? o.comment += "\n" + p.comment : o.comment = p.comment);
|
|
2083
2083
|
continue;
|
|
2084
2084
|
}
|
|
2085
|
-
(p.newlineAfterProp ||
|
|
2086
|
-
} else p.found?.indent !== r.indent && i(s, "BAD_INDENT",
|
|
2085
|
+
(p.newlineAfterProp || an(u)) && i(u ?? l[l.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
2086
|
+
} else p.found?.indent !== r.indent && i(s, "BAD_INDENT", cn);
|
|
2087
2087
|
n.atKey = !0;
|
|
2088
2088
|
let h = p.end, g = u ? e(n, u, p, i) : t(n, h, l, null, p, i);
|
|
2089
|
-
n.schema.compat &&
|
|
2090
|
-
let _ =
|
|
2089
|
+
n.schema.compat && on(r.indent, u, i), n.atKey = !1, sn(n, o.items, g) && i(h, "DUPLICATE_KEY", "Map keys must be unique");
|
|
2090
|
+
let _ = rn(d ?? [], {
|
|
2091
2091
|
indicator: "map-value-ind",
|
|
2092
2092
|
next: f,
|
|
2093
2093
|
offset: g.range[2],
|
|
@@ -2098,12 +2098,12 @@ function un({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2098
2098
|
if (s = _.end, _.found) {
|
|
2099
2099
|
m && (f?.type === "block-map" && !_.hasNewline && i(s, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), n.options.strict && p.start < _.found.offset - 1024 && i(g.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
2100
2100
|
let c = f ? e(n, f, _, i) : t(n, s, d, null, _, i);
|
|
2101
|
-
n.schema.compat &&
|
|
2102
|
-
let l = new
|
|
2101
|
+
n.schema.compat && on(r.indent, f, i), s = c.range[2];
|
|
2102
|
+
let l = new B(g, c);
|
|
2103
2103
|
n.options.keepSourceTokens && (l.srcToken = a), o.items.push(l);
|
|
2104
2104
|
} else {
|
|
2105
2105
|
m && i(g.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), _.comment && (g.comment ? g.comment += "\n" + _.comment : g.comment = _.comment);
|
|
2106
|
-
let e = new
|
|
2106
|
+
let e = new B(g);
|
|
2107
2107
|
n.options.keepSourceTokens && (e.srcToken = a), o.items.push(e);
|
|
2108
2108
|
}
|
|
2109
2109
|
}
|
|
@@ -2115,12 +2115,12 @@ function un({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2115
2115
|
}
|
|
2116
2116
|
//#endregion
|
|
2117
2117
|
//#region node_modules/yaml/browser/dist/compose/resolve-block-seq.js
|
|
2118
|
-
function
|
|
2119
|
-
let o = new ((a?.nodeClass) ??
|
|
2118
|
+
function un({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
2119
|
+
let o = new ((a?.nodeClass) ?? Ze)(n.schema);
|
|
2120
2120
|
n.atRoot &&= !1, n.atKey &&= !1;
|
|
2121
2121
|
let s = r.offset, c = null;
|
|
2122
2122
|
for (let { start: a, value: l } of r.items) {
|
|
2123
|
-
let u =
|
|
2123
|
+
let u = rn(a, {
|
|
2124
2124
|
indicator: "seq-item-ind",
|
|
2125
2125
|
next: l,
|
|
2126
2126
|
offset: s,
|
|
@@ -2136,7 +2136,7 @@ function dn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2136
2136
|
}
|
|
2137
2137
|
}
|
|
2138
2138
|
let d = l ? e(n, l, u, i) : t(n, u.end, a, null, u, i);
|
|
2139
|
-
n.schema.compat &&
|
|
2139
|
+
n.schema.compat && on(r.indent, l, i), s = d.range[2], o.items.push(d);
|
|
2140
2140
|
}
|
|
2141
2141
|
return o.range = [
|
|
2142
2142
|
r.offset,
|
|
@@ -2146,7 +2146,7 @@ function dn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2146
2146
|
}
|
|
2147
2147
|
//#endregion
|
|
2148
2148
|
//#region node_modules/yaml/browser/dist/compose/resolve-end.js
|
|
2149
|
-
function
|
|
2149
|
+
function dn(e, t, n, r) {
|
|
2150
2150
|
let i = "";
|
|
2151
2151
|
if (e) {
|
|
2152
2152
|
let a = !1, o = "";
|
|
@@ -2177,15 +2177,15 @@ function fn(e, t, n, r) {
|
|
|
2177
2177
|
}
|
|
2178
2178
|
//#endregion
|
|
2179
2179
|
//#region node_modules/yaml/browser/dist/compose/resolve-flow-collection.js
|
|
2180
|
-
var
|
|
2181
|
-
function
|
|
2182
|
-
let o = r.start.source === "{", s = o ? "flow map" : "flow sequence", c = new ((a?.nodeClass) ?? (o ?
|
|
2180
|
+
var fn = "Block collections are not allowed within flow collections", pn = (e) => e && (e.type === "block-map" || e.type === "block-seq");
|
|
2181
|
+
function mn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
2182
|
+
let o = r.start.source === "{", s = o ? "flow map" : "flow sequence", c = new ((a?.nodeClass) ?? (o ? V : Ze))(n.schema);
|
|
2183
2183
|
c.flow = !0;
|
|
2184
2184
|
let l = n.atRoot;
|
|
2185
2185
|
l && (n.atRoot = !1), n.atKey &&= !1;
|
|
2186
2186
|
let u = r.offset + r.start.source.length;
|
|
2187
2187
|
for (let a = 0; a < r.items.length; ++a) {
|
|
2188
|
-
let l = r.items[a], { start: d, key: f, sep: p, value: m } = l, h =
|
|
2188
|
+
let l = r.items[a], { start: d, key: f, sep: p, value: m } = l, h = rn(d, {
|
|
2189
2189
|
flow: s,
|
|
2190
2190
|
indicator: "explicit-key-ind",
|
|
2191
2191
|
next: f ?? p?.[0],
|
|
@@ -2199,7 +2199,7 @@ function hn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2199
2199
|
a === 0 && h.comma ? i(h.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${s}`) : a < r.items.length - 1 && i(h.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${s}`), h.comment && (c.comment ? c.comment += "\n" + h.comment : c.comment = h.comment), u = h.end;
|
|
2200
2200
|
continue;
|
|
2201
2201
|
}
|
|
2202
|
-
!o && n.options.strict &&
|
|
2202
|
+
!o && n.options.strict && an(f) && i(f, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
|
|
2203
2203
|
}
|
|
2204
2204
|
if (a === 0) h.comma && i(h.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${s}`);
|
|
2205
2205
|
else if (h.comma || i(h.start, "MISSING_CHAR", `Missing , between ${s} items`), h.comment) {
|
|
@@ -2219,12 +2219,12 @@ function hn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2219
2219
|
}
|
|
2220
2220
|
if (!o && !p && !h.found) {
|
|
2221
2221
|
let r = m ? e(n, m, h, i) : t(n, h.end, p, null, h, i);
|
|
2222
|
-
c.items.push(r), u = r.range[2],
|
|
2222
|
+
c.items.push(r), u = r.range[2], pn(m) && i(r.range, "BLOCK_IN_FLOW", fn);
|
|
2223
2223
|
} else {
|
|
2224
2224
|
n.atKey = !0;
|
|
2225
2225
|
let a = h.end, g = f ? e(n, f, h, i) : t(n, a, d, null, h, i);
|
|
2226
|
-
|
|
2227
|
-
let _ =
|
|
2226
|
+
pn(f) && i(g.range, "BLOCK_IN_FLOW", fn), n.atKey = !1;
|
|
2227
|
+
let _ = rn(p ?? [], {
|
|
2228
2228
|
flow: s,
|
|
2229
2229
|
indicator: "map-value-ind",
|
|
2230
2230
|
next: m,
|
|
@@ -2246,13 +2246,13 @@ function hn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2246
2246
|
}
|
|
2247
2247
|
} else m && ("source" in m && m.source?.[0] === ":" ? i(m, "MISSING_CHAR", `Missing space after : in ${s}`) : i(_.start, "MISSING_CHAR", `Missing , or : between ${s} items`));
|
|
2248
2248
|
let v = m ? e(n, m, _, i) : _.found ? t(n, _.end, p, null, _, i) : null;
|
|
2249
|
-
v ?
|
|
2250
|
-
let y = new
|
|
2249
|
+
v ? pn(m) && i(v.range, "BLOCK_IN_FLOW", fn) : _.comment && (g.comment ? g.comment += "\n" + _.comment : g.comment = _.comment);
|
|
2250
|
+
let y = new B(g, v);
|
|
2251
2251
|
if (n.options.keepSourceTokens && (y.srcToken = l), o) {
|
|
2252
2252
|
let e = c;
|
|
2253
|
-
|
|
2253
|
+
sn(n, e.items, g) && i(a, "DUPLICATE_KEY", "Map keys must be unique"), e.items.push(y);
|
|
2254
2254
|
} else {
|
|
2255
|
-
let e = new
|
|
2255
|
+
let e = new V(n.schema);
|
|
2256
2256
|
e.flow = !0, e.items.push(y);
|
|
2257
2257
|
let t = (v ?? g).range;
|
|
2258
2258
|
e.range = [
|
|
@@ -2271,7 +2271,7 @@ function hn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2271
2271
|
i(u, l ? "MISSING_CHAR" : "BAD_INDENT", t), f && f.source.length !== 1 && p.unshift(f);
|
|
2272
2272
|
}
|
|
2273
2273
|
if (p.length > 0) {
|
|
2274
|
-
let e =
|
|
2274
|
+
let e = dn(p, m, n.options.strict, i);
|
|
2275
2275
|
e.comment && (c.comment ? c.comment += "\n" + e.comment : c.comment = e.comment), c.range = [
|
|
2276
2276
|
r.offset,
|
|
2277
2277
|
m,
|
|
@@ -2286,31 +2286,31 @@ function hn({ composeNode: e, composeEmptyNode: t }, n, r, i, a) {
|
|
|
2286
2286
|
}
|
|
2287
2287
|
//#endregion
|
|
2288
2288
|
//#region node_modules/yaml/browser/dist/compose/compose-collection.js
|
|
2289
|
-
function
|
|
2290
|
-
let o = n.type === "block-map" ?
|
|
2289
|
+
function hn(e, t, n, r, i, a) {
|
|
2290
|
+
let o = n.type === "block-map" ? ln(e, t, n, r, a) : n.type === "block-seq" ? un(e, t, n, r, a) : mn(e, t, n, r, a), s = o.constructor;
|
|
2291
2291
|
return i === "!" || i === s.tagName ? (o.tag = s.tagName, o) : (i && (o.tag = i), o);
|
|
2292
2292
|
}
|
|
2293
|
-
function
|
|
2293
|
+
function gn(e, t, n, r, i) {
|
|
2294
2294
|
let a = r.tag, o = a ? t.directives.tagName(a.source, (e) => i(a, "TAG_RESOLVE_FAILED", e)) : null;
|
|
2295
2295
|
if (n.type === "block-seq") {
|
|
2296
2296
|
let { anchor: e, newlineAfterProp: t } = r, n = e && a ? e.offset > a.offset ? e : a : e ?? a;
|
|
2297
2297
|
n && (!t || t.offset < n.offset) && i(n, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
2298
2298
|
}
|
|
2299
2299
|
let s = n.type === "block-map" ? "map" : n.type === "block-seq" ? "seq" : n.start.source === "{" ? "map" : "seq";
|
|
2300
|
-
if (!a || !o || o === "!" || o ===
|
|
2300
|
+
if (!a || !o || o === "!" || o === V.tagName && s === "map" || o === Ze.tagName && s === "seq") return hn(e, t, n, i, o);
|
|
2301
2301
|
let c = t.schema.tags.find((e) => e.tag === o && e.collection === s);
|
|
2302
2302
|
if (!c) {
|
|
2303
2303
|
let r = t.schema.knownTags[o];
|
|
2304
2304
|
if (r?.collection === s) t.schema.tags.push(Object.assign({}, r, { default: !1 })), c = r;
|
|
2305
|
-
else return r ? i(a, "BAD_COLLECTION_TYPE", `${r.tag} used for ${s} collection, but expects ${r.collection ?? "scalar"}`, !0) : i(a, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0),
|
|
2305
|
+
else return r ? i(a, "BAD_COLLECTION_TYPE", `${r.tag} used for ${s} collection, but expects ${r.collection ?? "scalar"}`, !0) : i(a, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), hn(e, t, n, i, o);
|
|
2306
2306
|
}
|
|
2307
|
-
let l =
|
|
2307
|
+
let l = hn(e, t, n, i, o, c), u = c.resolve?.(l, (e) => i(a, "TAG_RESOLVE_FAILED", e), t.options) ?? l, d = b(u) ? u : new N(u);
|
|
2308
2308
|
return d.range = l.range, d.tag = o, c?.format && (d.format = c.format), d;
|
|
2309
2309
|
}
|
|
2310
2310
|
//#endregion
|
|
2311
2311
|
//#region node_modules/yaml/browser/dist/compose/resolve-block-scalar.js
|
|
2312
|
-
function
|
|
2313
|
-
let r = t.offset, i =
|
|
2312
|
+
function _n(e, t, n) {
|
|
2313
|
+
let r = t.offset, i = vn(t, e.options.strict, n);
|
|
2314
2314
|
if (!i) return {
|
|
2315
2315
|
value: "",
|
|
2316
2316
|
type: null,
|
|
@@ -2321,7 +2321,7 @@ function vn(e, t, n) {
|
|
|
2321
2321
|
r
|
|
2322
2322
|
]
|
|
2323
2323
|
};
|
|
2324
|
-
let a = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = t.source ?
|
|
2324
|
+
let a = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = t.source ? yn(t.source) : [], s = o.length;
|
|
2325
2325
|
for (let e = o.length - 1; e >= 0; --e) {
|
|
2326
2326
|
let t = o[e][1];
|
|
2327
2327
|
if (t === "" || t === "\r") s = e;
|
|
@@ -2384,7 +2384,7 @@ function vn(e, t, n) {
|
|
|
2384
2384
|
]
|
|
2385
2385
|
};
|
|
2386
2386
|
}
|
|
2387
|
-
function
|
|
2387
|
+
function vn({ offset: e, props: t }, n, r) {
|
|
2388
2388
|
/* istanbul ignore if should not happen */
|
|
2389
2389
|
if (t[0].type !== "block-scalar-header") return r(t[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
2390
2390
|
let { source: i } = t[0], a = i[0], o = 0, s = "", c = -1;
|
|
@@ -2427,24 +2427,24 @@ function yn({ offset: e, props: t }, n, r) {
|
|
|
2427
2427
|
length: d
|
|
2428
2428
|
};
|
|
2429
2429
|
}
|
|
2430
|
-
function
|
|
2430
|
+
function yn(e) {
|
|
2431
2431
|
let t = e.split(/\n( *)/), n = t[0], r = n.match(/^( *)/), i = [r?.[1] ? [r[1], n.slice(r[1].length)] : ["", n]];
|
|
2432
2432
|
for (let e = 1; e < t.length; e += 2) i.push([t[e], t[e + 1]]);
|
|
2433
2433
|
return i;
|
|
2434
2434
|
}
|
|
2435
2435
|
//#endregion
|
|
2436
2436
|
//#region node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js
|
|
2437
|
-
function
|
|
2437
|
+
function bn(e, t, n) {
|
|
2438
2438
|
let { offset: r, type: i, source: a, end: o } = e, s, c, l = (e, t, i) => n(r + e, t, i);
|
|
2439
2439
|
switch (i) {
|
|
2440
2440
|
case "scalar":
|
|
2441
|
-
s = N.PLAIN, c =
|
|
2441
|
+
s = N.PLAIN, c = xn(a, l);
|
|
2442
2442
|
break;
|
|
2443
2443
|
case "single-quoted-scalar":
|
|
2444
|
-
s = N.QUOTE_SINGLE, c =
|
|
2444
|
+
s = N.QUOTE_SINGLE, c = Sn(a, l);
|
|
2445
2445
|
break;
|
|
2446
2446
|
case "double-quoted-scalar":
|
|
2447
|
-
s = N.QUOTE_DOUBLE, c =
|
|
2447
|
+
s = N.QUOTE_DOUBLE, c = wn(a, l);
|
|
2448
2448
|
break;
|
|
2449
2449
|
/* istanbul ignore next should not happen */
|
|
2450
2450
|
default: return n(e, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
|
|
@@ -2458,7 +2458,7 @@ function xn(e, t, n) {
|
|
|
2458
2458
|
]
|
|
2459
2459
|
};
|
|
2460
2460
|
}
|
|
2461
|
-
let u = r + a.length, d =
|
|
2461
|
+
let u = r + a.length, d = dn(o, u, t, n);
|
|
2462
2462
|
return {
|
|
2463
2463
|
value: c,
|
|
2464
2464
|
type: s,
|
|
@@ -2470,7 +2470,7 @@ function xn(e, t, n) {
|
|
|
2470
2470
|
]
|
|
2471
2471
|
};
|
|
2472
2472
|
}
|
|
2473
|
-
function
|
|
2473
|
+
function xn(e, t) {
|
|
2474
2474
|
let n = "";
|
|
2475
2475
|
switch (e[0]) {
|
|
2476
2476
|
/* istanbul ignore next should not happen */
|
|
@@ -2490,12 +2490,12 @@ function Sn(e, t) {
|
|
|
2490
2490
|
case "@":
|
|
2491
2491
|
case "`": n = `reserved character ${e[0]}`;
|
|
2492
2492
|
}
|
|
2493
|
-
return n && t(0, "BAD_SCALAR_START", `Plain value cannot start with ${n}`),
|
|
2493
|
+
return n && t(0, "BAD_SCALAR_START", `Plain value cannot start with ${n}`), Cn(e);
|
|
2494
2494
|
}
|
|
2495
|
-
function
|
|
2496
|
-
return (e[e.length - 1] !== "'" || e.length === 1) && t(e.length, "MISSING_CHAR", "Missing closing 'quote"),
|
|
2495
|
+
function Sn(e, t) {
|
|
2496
|
+
return (e[e.length - 1] !== "'" || e.length === 1) && t(e.length, "MISSING_CHAR", "Missing closing 'quote"), Cn(e.slice(1, -1)).replace(/''/g, "'");
|
|
2497
2497
|
}
|
|
2498
|
-
function
|
|
2498
|
+
function Cn(e) {
|
|
2499
2499
|
let t, n;
|
|
2500
2500
|
try {
|
|
2501
2501
|
t = /* @__PURE__ */ RegExp("(.*?)(?<![ ])[ ]*\r?\n", "sy"), n = /* @__PURE__ */ RegExp("[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?\n", "sy");
|
|
@@ -2509,22 +2509,22 @@ function wn(e) {
|
|
|
2509
2509
|
let s = /[ \t]*(.*)/sy;
|
|
2510
2510
|
return s.lastIndex = o, r = s.exec(e), i + a + (r?.[1] ?? "");
|
|
2511
2511
|
}
|
|
2512
|
-
function
|
|
2512
|
+
function wn(e, t) {
|
|
2513
2513
|
let n = "";
|
|
2514
2514
|
for (let r = 1; r < e.length - 1; ++r) {
|
|
2515
2515
|
let i = e[r];
|
|
2516
2516
|
if (i !== "\r" || e[r + 1] !== "\n") {
|
|
2517
2517
|
if (i === "\n") {
|
|
2518
|
-
let { fold: t, offset: i } =
|
|
2518
|
+
let { fold: t, offset: i } = Tn(e, r);
|
|
2519
2519
|
n += t, r = i;
|
|
2520
2520
|
} else if (i === "\\") {
|
|
2521
|
-
let i = e[++r], a =
|
|
2521
|
+
let i = e[++r], a = En[i];
|
|
2522
2522
|
if (a) n += a;
|
|
2523
2523
|
else if (i === "\n") for (i = e[r + 1]; i === " " || i === " ";) i = e[++r + 1];
|
|
2524
2524
|
else if (i === "\r" && e[r + 1] === "\n") for (i = e[++r + 1]; i === " " || i === " ";) i = e[++r + 1];
|
|
2525
2525
|
else if (i === "x" || i === "u" || i === "U") {
|
|
2526
2526
|
let a = i === "x" ? 2 : i === "u" ? 4 : 8;
|
|
2527
|
-
n +=
|
|
2527
|
+
n += Dn(e, r + 1, a, t), r += a;
|
|
2528
2528
|
} else {
|
|
2529
2529
|
let i = e.substr(r - 1, 2);
|
|
2530
2530
|
t(r - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${i}`), n += i;
|
|
@@ -2538,7 +2538,7 @@ function Tn(e, t) {
|
|
|
2538
2538
|
}
|
|
2539
2539
|
return (e[e.length - 1] !== "\"" || e.length === 1) && t(e.length, "MISSING_CHAR", "Missing closing \"quote"), n;
|
|
2540
2540
|
}
|
|
2541
|
-
function
|
|
2541
|
+
function Tn(e, t) {
|
|
2542
2542
|
let n = "", r = e[t + 1];
|
|
2543
2543
|
for (; (r === " " || r === " " || r === "\n" || r === "\r") && (r !== "\r" || e[t + 2] === "\n");) r === "\n" && (n += "\n"), t += 1, r = e[t + 1];
|
|
2544
2544
|
return n ||= " ", {
|
|
@@ -2546,7 +2546,7 @@ function En(e, t) {
|
|
|
2546
2546
|
offset: t
|
|
2547
2547
|
};
|
|
2548
2548
|
}
|
|
2549
|
-
var
|
|
2549
|
+
var En = {
|
|
2550
2550
|
0: "\0",
|
|
2551
2551
|
a: "\x07",
|
|
2552
2552
|
b: "\b",
|
|
@@ -2566,7 +2566,7 @@ var Dn = {
|
|
|
2566
2566
|
"\\": "\\",
|
|
2567
2567
|
" ": " "
|
|
2568
2568
|
};
|
|
2569
|
-
function
|
|
2569
|
+
function Dn(e, t, n, r) {
|
|
2570
2570
|
let i = e.substr(t, n), a = i.length === n && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
2571
2571
|
try {
|
|
2572
2572
|
return String.fromCodePoint(a);
|
|
@@ -2577,9 +2577,9 @@ function On(e, t, n, r) {
|
|
|
2577
2577
|
}
|
|
2578
2578
|
//#endregion
|
|
2579
2579
|
//#region node_modules/yaml/browser/dist/compose/compose-scalar.js
|
|
2580
|
-
function
|
|
2581
|
-
let { value: i, type: a, comment: o, range: s } = t.type === "block-scalar" ?
|
|
2582
|
-
l = e.options.stringKeys && e.atKey ? e.schema[u] : c ?
|
|
2580
|
+
function On(e, t, n, r) {
|
|
2581
|
+
let { value: i, type: a, comment: o, range: s } = t.type === "block-scalar" ? _n(e, t, r) : bn(t, e.options.strict, r), c = n ? e.directives.tagName(n.source, (e) => r(n, "TAG_RESOLVE_FAILED", e)) : null, l;
|
|
2582
|
+
l = e.options.stringKeys && e.atKey ? e.schema[u] : c ? kn(e.schema, i, c, n, r) : t.type === "scalar" ? An(e, i, t, r) : e.schema[u];
|
|
2583
2583
|
let d;
|
|
2584
2584
|
try {
|
|
2585
2585
|
let a = l.resolve(i, (e) => r(n ?? t, "TAG_RESOLVE_FAILED", e), e.options);
|
|
@@ -2590,7 +2590,7 @@ function kn(e, t, n, r) {
|
|
|
2590
2590
|
}
|
|
2591
2591
|
return d.range = s, d.source = i, a && (d.type = a), c && (d.tag = c), l.format && (d.format = l.format), o && (d.comment = o), d;
|
|
2592
2592
|
}
|
|
2593
|
-
function
|
|
2593
|
+
function kn(e, t, n, r, i) {
|
|
2594
2594
|
if (n === "!") return e[u];
|
|
2595
2595
|
let a = [];
|
|
2596
2596
|
for (let t of e.tags) if (!t.collection && t.tag === n) {
|
|
@@ -2604,7 +2604,7 @@ function An(e, t, n, r, i) {
|
|
|
2604
2604
|
test: void 0
|
|
2605
2605
|
})), o) : (i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${n}`, n !== "tag:yaml.org,2002:str"), e[u]);
|
|
2606
2606
|
}
|
|
2607
|
-
function
|
|
2607
|
+
function An({ atKey: e, directives: t, schema: n }, r, i, a) {
|
|
2608
2608
|
let o = n.tags.find((t) => (t.default === !0 || e && t.default === "key") && t.test?.test(r)) || n[u];
|
|
2609
2609
|
if (n.compat) {
|
|
2610
2610
|
let e = n.compat.find((e) => e.default && e.test?.test(r)) ?? n[u];
|
|
@@ -2614,7 +2614,7 @@ function jn({ atKey: e, directives: t, schema: n }, r, i, a) {
|
|
|
2614
2614
|
}
|
|
2615
2615
|
//#endregion
|
|
2616
2616
|
//#region node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js
|
|
2617
|
-
function
|
|
2617
|
+
function jn(e, t, n) {
|
|
2618
2618
|
if (t) {
|
|
2619
2619
|
n ??= t.length;
|
|
2620
2620
|
for (let r = n - 1; r >= 0; --r) {
|
|
@@ -2634,48 +2634,48 @@ function Mn(e, t, n) {
|
|
|
2634
2634
|
}
|
|
2635
2635
|
//#endregion
|
|
2636
2636
|
//#region node_modules/yaml/browser/dist/compose/compose-node.js
|
|
2637
|
-
var
|
|
2638
|
-
composeNode:
|
|
2639
|
-
composeEmptyNode:
|
|
2637
|
+
var Mn = {
|
|
2638
|
+
composeNode: Nn,
|
|
2639
|
+
composeEmptyNode: Pn
|
|
2640
2640
|
};
|
|
2641
|
-
function
|
|
2641
|
+
function Nn(e, t, n, r) {
|
|
2642
2642
|
let i = e.atKey, { spaceBefore: a, comment: o, anchor: s, tag: c } = n, l, u = !0;
|
|
2643
2643
|
switch (t.type) {
|
|
2644
2644
|
case "alias":
|
|
2645
|
-
l =
|
|
2645
|
+
l = Fn(e, t, r), (s || c) && r(t, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
2646
2646
|
break;
|
|
2647
2647
|
case "scalar":
|
|
2648
2648
|
case "single-quoted-scalar":
|
|
2649
2649
|
case "double-quoted-scalar":
|
|
2650
2650
|
case "block-scalar":
|
|
2651
|
-
l =
|
|
2651
|
+
l = On(e, t, c, r), s && (l.anchor = s.source.substring(1));
|
|
2652
2652
|
break;
|
|
2653
2653
|
case "block-map":
|
|
2654
2654
|
case "block-seq":
|
|
2655
2655
|
case "flow-collection":
|
|
2656
2656
|
try {
|
|
2657
|
-
l =
|
|
2657
|
+
l = gn(Mn, e, t, n, r), s && (l.anchor = s.source.substring(1));
|
|
2658
2658
|
} catch (e) {
|
|
2659
2659
|
r(t, "RESOURCE_EXHAUSTION", e instanceof Error ? e.message : String(e));
|
|
2660
2660
|
}
|
|
2661
2661
|
break;
|
|
2662
2662
|
default: r(t, "UNEXPECTED_TOKEN", t.type === "error" ? t.message : `Unsupported token (type: ${t.type})`), u = !1;
|
|
2663
2663
|
}
|
|
2664
|
-
return l ??=
|
|
2664
|
+
return l ??= Pn(e, t.offset, void 0, null, n, r), s && l.anchor === "" && r(s, "BAD_ALIAS", "Anchor cannot be an empty string"), i && e.options.stringKeys && (!_(l) || typeof l.value != "string" || l.tag && l.tag !== "tag:yaml.org,2002:str") && r(c ?? t, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), a && (l.spaceBefore = !0), o && (t.type === "scalar" && t.source === "" ? l.comment = o : l.commentBefore = o), e.options.keepSourceTokens && u && (l.srcToken = t), l;
|
|
2665
2665
|
}
|
|
2666
|
-
function
|
|
2667
|
-
let u =
|
|
2666
|
+
function Pn(e, t, n, r, { spaceBefore: i, comment: a, anchor: o, tag: s, end: c }, l) {
|
|
2667
|
+
let u = On(e, {
|
|
2668
2668
|
type: "scalar",
|
|
2669
|
-
offset:
|
|
2669
|
+
offset: jn(t, n, r),
|
|
2670
2670
|
indent: -1,
|
|
2671
2671
|
source: ""
|
|
2672
2672
|
}, s, l);
|
|
2673
2673
|
return o && (u.anchor = o.source.substring(1), u.anchor === "" && l(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (u.spaceBefore = !0), a && (u.comment = a, u.range[2] = c), u;
|
|
2674
2674
|
}
|
|
2675
|
-
function
|
|
2675
|
+
function Fn({ options: e }, { offset: t, source: n, end: r }, i) {
|
|
2676
2676
|
let a = new ue(n.substring(1));
|
|
2677
2677
|
a.source === "" && i(t, "BAD_ALIAS", "Alias cannot be an empty string"), a.source.endsWith(":") && i(t + n.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
|
|
2678
|
-
let o = t + n.length, s =
|
|
2678
|
+
let o = t + n.length, s = dn(r, o, e.strict, i);
|
|
2679
2679
|
return a.range = [
|
|
2680
2680
|
t,
|
|
2681
2681
|
o,
|
|
@@ -2684,14 +2684,14 @@ function In({ options: e }, { offset: t, source: n, end: r }, i) {
|
|
|
2684
2684
|
}
|
|
2685
2685
|
//#endregion
|
|
2686
2686
|
//#region node_modules/yaml/browser/dist/compose/compose-doc.js
|
|
2687
|
-
function
|
|
2688
|
-
let s = new
|
|
2687
|
+
function In(e, t, { offset: n, start: r, value: i, end: a }, o) {
|
|
2688
|
+
let s = new Zt(void 0, Object.assign({ _directives: t }, e)), c = {
|
|
2689
2689
|
atKey: !1,
|
|
2690
2690
|
atRoot: !0,
|
|
2691
2691
|
directives: s.directives,
|
|
2692
2692
|
options: s.options,
|
|
2693
2693
|
schema: s.schema
|
|
2694
|
-
}, l =
|
|
2694
|
+
}, l = rn(r, {
|
|
2695
2695
|
indicator: "doc-start",
|
|
2696
2696
|
next: i ?? a?.[0],
|
|
2697
2697
|
offset: n,
|
|
@@ -2699,8 +2699,8 @@ function Ln(e, t, { offset: n, start: r, value: i, end: a }, o) {
|
|
|
2699
2699
|
parentIndent: 0,
|
|
2700
2700
|
startOnNewline: !0
|
|
2701
2701
|
});
|
|
2702
|
-
l.found && (s.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !l.hasNewline && o(l.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), s.contents = i ?
|
|
2703
|
-
let u = s.contents.range[2], d =
|
|
2702
|
+
l.found && (s.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !l.hasNewline && o(l.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), s.contents = i ? Nn(c, i, l, o) : Pn(c, l.end, r, null, l, o);
|
|
2703
|
+
let u = s.contents.range[2], d = dn(a, u, !1, o);
|
|
2704
2704
|
return d.comment && (s.comment = d.comment), s.range = [
|
|
2705
2705
|
n,
|
|
2706
2706
|
u,
|
|
@@ -2709,13 +2709,13 @@ function Ln(e, t, { offset: n, start: r, value: i, end: a }, o) {
|
|
|
2709
2709
|
}
|
|
2710
2710
|
//#endregion
|
|
2711
2711
|
//#region node_modules/yaml/browser/dist/compose/composer.js
|
|
2712
|
-
function
|
|
2712
|
+
function Ln(e) {
|
|
2713
2713
|
if (typeof e == "number") return [e, e + 1];
|
|
2714
2714
|
if (Array.isArray(e)) return e.length === 2 ? e : [e[0], e[1]];
|
|
2715
2715
|
let { offset: t, source: n } = e;
|
|
2716
2716
|
return [t, t + (typeof n == "string" ? n.length : 1)];
|
|
2717
2717
|
}
|
|
2718
|
-
function
|
|
2718
|
+
function Rn(e) {
|
|
2719
2719
|
let t = "", n = !1, r = !1;
|
|
2720
2720
|
for (let i = 0; i < e.length; ++i) {
|
|
2721
2721
|
let a = e[i];
|
|
@@ -2734,15 +2734,15 @@ function zn(e) {
|
|
|
2734
2734
|
afterEmptyLine: r
|
|
2735
2735
|
};
|
|
2736
2736
|
}
|
|
2737
|
-
var
|
|
2737
|
+
var zn = class {
|
|
2738
2738
|
constructor(e = {}) {
|
|
2739
2739
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (e, t, n, r) => {
|
|
2740
|
-
let i =
|
|
2741
|
-
r ? this.warnings.push(new
|
|
2740
|
+
let i = Ln(e);
|
|
2741
|
+
r ? this.warnings.push(new tn(i, t, n)) : this.errors.push(new en(i, t, n));
|
|
2742
2742
|
}, this.directives = new A({ version: e.version || "1.2" }), this.options = e;
|
|
2743
2743
|
}
|
|
2744
2744
|
decorate(e, t) {
|
|
2745
|
-
let { comment: n, afterEmptyLine: r } =
|
|
2745
|
+
let { comment: n, afterEmptyLine: r } = Rn(this.prelude);
|
|
2746
2746
|
if (n) {
|
|
2747
2747
|
let i = e.contents;
|
|
2748
2748
|
if (t) e.comment = e.comment ? `${e.comment}\n${n}` : n;
|
|
@@ -2765,7 +2765,7 @@ var Bn = class {
|
|
|
2765
2765
|
}
|
|
2766
2766
|
streamInfo() {
|
|
2767
2767
|
return {
|
|
2768
|
-
comment:
|
|
2768
|
+
comment: Rn(this.prelude).comment,
|
|
2769
2769
|
directives: this.directives,
|
|
2770
2770
|
errors: this.errors,
|
|
2771
2771
|
warnings: this.warnings
|
|
@@ -2779,12 +2779,12 @@ var Bn = class {
|
|
|
2779
2779
|
switch (e.type) {
|
|
2780
2780
|
case "directive":
|
|
2781
2781
|
this.directives.add(e.source, (t, n, r) => {
|
|
2782
|
-
let i =
|
|
2782
|
+
let i = Ln(e);
|
|
2783
2783
|
i[0] += t, this.onError(i, "BAD_DIRECTIVE", n, r);
|
|
2784
2784
|
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
2785
2785
|
break;
|
|
2786
2786
|
case "document": {
|
|
2787
|
-
let t =
|
|
2787
|
+
let t = In(this.options, this.directives, e, this.onError);
|
|
2788
2788
|
this.atDirectives && !t.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(t, !1), this.doc && (yield this.doc), this.doc = t, this.atDirectives = !1;
|
|
2789
2789
|
break;
|
|
2790
2790
|
}
|
|
@@ -2795,17 +2795,17 @@ var Bn = class {
|
|
|
2795
2795
|
this.prelude.push(e.source);
|
|
2796
2796
|
break;
|
|
2797
2797
|
case "error": {
|
|
2798
|
-
let t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new
|
|
2798
|
+
let t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new en(Ln(e), "UNEXPECTED_TOKEN", t);
|
|
2799
2799
|
this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
|
|
2800
2800
|
break;
|
|
2801
2801
|
}
|
|
2802
2802
|
case "doc-end": {
|
|
2803
2803
|
if (!this.doc) {
|
|
2804
|
-
this.errors.push(new
|
|
2804
|
+
this.errors.push(new en(Ln(e), "UNEXPECTED_TOKEN", "Unexpected doc-end without preceding document"));
|
|
2805
2805
|
break;
|
|
2806
2806
|
}
|
|
2807
2807
|
this.doc.directives.docEnd = !0;
|
|
2808
|
-
let t =
|
|
2808
|
+
let t = dn(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
|
|
2809
2809
|
if (this.decorate(this.doc, !0), t.comment) {
|
|
2810
2810
|
let e = this.doc.comment;
|
|
2811
2811
|
this.doc.comment = e ? `${e}\n${t.comment}` : t.comment;
|
|
@@ -2813,13 +2813,13 @@ var Bn = class {
|
|
|
2813
2813
|
this.doc.range[2] = t.offset;
|
|
2814
2814
|
break;
|
|
2815
2815
|
}
|
|
2816
|
-
default: this.errors.push(new
|
|
2816
|
+
default: this.errors.push(new en(Ln(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
|
|
2817
2817
|
}
|
|
2818
2818
|
}
|
|
2819
2819
|
*end(e = !1, t = -1) {
|
|
2820
2820
|
if (this.doc) this.decorate(this.doc, !0), yield this.doc, this.doc = null;
|
|
2821
2821
|
else if (e) {
|
|
2822
|
-
let e = new
|
|
2822
|
+
let e = new Zt(void 0, Object.assign({ _directives: this.directives }, this.options));
|
|
2823
2823
|
this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), e.range = [
|
|
2824
2824
|
0,
|
|
2825
2825
|
t,
|
|
@@ -2830,23 +2830,23 @@ var Bn = class {
|
|
|
2830
2830
|
};
|
|
2831
2831
|
//#endregion
|
|
2832
2832
|
//#region node_modules/yaml/browser/dist/parse/cst-scalar.js
|
|
2833
|
-
function
|
|
2833
|
+
function Bn(e, t = !0, n) {
|
|
2834
2834
|
if (e) {
|
|
2835
2835
|
let r = (e, t, r) => {
|
|
2836
2836
|
let i = typeof e == "number" ? e : Array.isArray(e) ? e[0] : e.offset;
|
|
2837
2837
|
if (n) n(i, t, r);
|
|
2838
|
-
else throw new
|
|
2838
|
+
else throw new en([i, i + 1], t, r);
|
|
2839
2839
|
};
|
|
2840
2840
|
switch (e.type) {
|
|
2841
2841
|
case "scalar":
|
|
2842
2842
|
case "single-quoted-scalar":
|
|
2843
|
-
case "double-quoted-scalar": return
|
|
2844
|
-
case "block-scalar": return
|
|
2843
|
+
case "double-quoted-scalar": return bn(e, t, r);
|
|
2844
|
+
case "block-scalar": return _n({ options: { strict: t } }, e, r);
|
|
2845
2845
|
}
|
|
2846
2846
|
}
|
|
2847
2847
|
return null;
|
|
2848
2848
|
}
|
|
2849
|
-
function
|
|
2849
|
+
function Vn(e, t) {
|
|
2850
2850
|
let { implicitKey: n = !1, indent: r, inFlow: i = !1, offset: a = -1, type: o = "PLAIN" } = t, s = Ae({
|
|
2851
2851
|
type: o,
|
|
2852
2852
|
value: e
|
|
@@ -2873,7 +2873,7 @@ function Hn(e, t) {
|
|
|
2873
2873
|
indent: r,
|
|
2874
2874
|
source: t
|
|
2875
2875
|
}];
|
|
2876
|
-
return
|
|
2876
|
+
return Wn(i, c) || i.push({
|
|
2877
2877
|
type: "newline",
|
|
2878
2878
|
offset: -1,
|
|
2879
2879
|
indent: r,
|
|
@@ -2909,7 +2909,7 @@ function Hn(e, t) {
|
|
|
2909
2909
|
};
|
|
2910
2910
|
}
|
|
2911
2911
|
}
|
|
2912
|
-
function
|
|
2912
|
+
function Hn(e, t, n = {}) {
|
|
2913
2913
|
let { afterKey: r = !1, implicitKey: i = !1, inFlow: a = !1, type: o } = n, s = "indent" in e ? e.indent : null;
|
|
2914
2914
|
if (r && typeof s == "number" && (s += 2), !o) switch (e.type) {
|
|
2915
2915
|
case "single-quoted-scalar":
|
|
@@ -2941,18 +2941,18 @@ function Un(e, t, n = {}) {
|
|
|
2941
2941
|
switch (c[0]) {
|
|
2942
2942
|
case "|":
|
|
2943
2943
|
case ">":
|
|
2944
|
-
|
|
2944
|
+
Un(e, c);
|
|
2945
2945
|
break;
|
|
2946
2946
|
case "\"":
|
|
2947
|
-
|
|
2947
|
+
Gn(e, c, "double-quoted-scalar");
|
|
2948
2948
|
break;
|
|
2949
2949
|
case "'":
|
|
2950
|
-
|
|
2950
|
+
Gn(e, c, "single-quoted-scalar");
|
|
2951
2951
|
break;
|
|
2952
|
-
default:
|
|
2952
|
+
default: Gn(e, c, "scalar");
|
|
2953
2953
|
}
|
|
2954
2954
|
}
|
|
2955
|
-
function
|
|
2955
|
+
function Un(e, t) {
|
|
2956
2956
|
let n = t.indexOf("\n"), r = t.substring(0, n), i = t.substring(n + 1) + "\n";
|
|
2957
2957
|
if (e.type === "block-scalar") {
|
|
2958
2958
|
let t = e.props[0];
|
|
@@ -2965,7 +2965,7 @@ function Wn(e, t) {
|
|
|
2965
2965
|
indent: n,
|
|
2966
2966
|
source: r
|
|
2967
2967
|
}];
|
|
2968
|
-
|
|
2968
|
+
Wn(a, "end" in e ? e.end : void 0) || a.push({
|
|
2969
2969
|
type: "newline",
|
|
2970
2970
|
offset: -1,
|
|
2971
2971
|
indent: n,
|
|
@@ -2980,7 +2980,7 @@ function Wn(e, t) {
|
|
|
2980
2980
|
});
|
|
2981
2981
|
}
|
|
2982
2982
|
}
|
|
2983
|
-
function
|
|
2983
|
+
function Wn(e, t) {
|
|
2984
2984
|
if (t) for (let n of t) switch (n.type) {
|
|
2985
2985
|
case "space":
|
|
2986
2986
|
case "comment":
|
|
@@ -2990,7 +2990,7 @@ function Gn(e, t) {
|
|
|
2990
2990
|
}
|
|
2991
2991
|
return !1;
|
|
2992
2992
|
}
|
|
2993
|
-
function
|
|
2993
|
+
function Gn(e, t, n) {
|
|
2994
2994
|
switch (e.type) {
|
|
2995
2995
|
case "scalar":
|
|
2996
2996
|
case "double-quoted-scalar":
|
|
@@ -3037,28 +3037,28 @@ function Kn(e, t, n) {
|
|
|
3037
3037
|
}
|
|
3038
3038
|
//#endregion
|
|
3039
3039
|
//#region node_modules/yaml/browser/dist/parse/cst-stringify.js
|
|
3040
|
-
var
|
|
3041
|
-
function
|
|
3040
|
+
var Kn = (e) => "type" in e ? qn(e) : Jn(e);
|
|
3041
|
+
function qn(e) {
|
|
3042
3042
|
switch (e.type) {
|
|
3043
3043
|
case "block-scalar": {
|
|
3044
3044
|
let t = "";
|
|
3045
|
-
for (let n of e.props) t +=
|
|
3045
|
+
for (let n of e.props) t += qn(n);
|
|
3046
3046
|
return t + e.source;
|
|
3047
3047
|
}
|
|
3048
3048
|
case "block-map":
|
|
3049
3049
|
case "block-seq": {
|
|
3050
3050
|
let t = "";
|
|
3051
|
-
for (let n of e.items) t +=
|
|
3051
|
+
for (let n of e.items) t += Jn(n);
|
|
3052
3052
|
return t;
|
|
3053
3053
|
}
|
|
3054
3054
|
case "flow-collection": {
|
|
3055
3055
|
let t = e.start.source;
|
|
3056
|
-
for (let n of e.items) t +=
|
|
3056
|
+
for (let n of e.items) t += Jn(n);
|
|
3057
3057
|
for (let n of e.end) t += n.source;
|
|
3058
3058
|
return t;
|
|
3059
3059
|
}
|
|
3060
3060
|
case "document": {
|
|
3061
|
-
let t =
|
|
3061
|
+
let t = Jn(e);
|
|
3062
3062
|
if (e.end) for (let n of e.end) t += n.source;
|
|
3063
3063
|
return t;
|
|
3064
3064
|
}
|
|
@@ -3069,22 +3069,22 @@ function Jn(e) {
|
|
|
3069
3069
|
}
|
|
3070
3070
|
}
|
|
3071
3071
|
}
|
|
3072
|
-
function
|
|
3072
|
+
function Jn({ start: e, key: t, sep: n, value: r }) {
|
|
3073
3073
|
let i = "";
|
|
3074
3074
|
for (let t of e) i += t.source;
|
|
3075
|
-
if (t && (i +=
|
|
3076
|
-
return r && (i +=
|
|
3075
|
+
if (t && (i += qn(t)), n) for (let e of n) i += e.source;
|
|
3076
|
+
return r && (i += qn(r)), i;
|
|
3077
3077
|
}
|
|
3078
3078
|
//#endregion
|
|
3079
3079
|
//#region node_modules/yaml/browser/dist/parse/cst-visit.js
|
|
3080
|
-
var
|
|
3081
|
-
function
|
|
3080
|
+
var Yn = Symbol("break visit"), Xn = Symbol("skip children"), Zn = Symbol("remove item");
|
|
3081
|
+
function Qn(e, t) {
|
|
3082
3082
|
"type" in e && e.type === "document" && (e = {
|
|
3083
3083
|
start: e.start,
|
|
3084
3084
|
value: e.value
|
|
3085
|
-
}),
|
|
3085
|
+
}), $n(Object.freeze([]), e, t);
|
|
3086
3086
|
}
|
|
3087
|
-
|
|
3087
|
+
Qn.BREAK = Yn, Qn.SKIP = Xn, Qn.REMOVE = Zn, Qn.itemAtPath = (e, t) => {
|
|
3088
3088
|
let n = e;
|
|
3089
3089
|
for (let [e, r] of t) {
|
|
3090
3090
|
let t = n?.[e];
|
|
@@ -3092,22 +3092,22 @@ $n.BREAK = Xn, $n.SKIP = Zn, $n.REMOVE = Qn, $n.itemAtPath = (e, t) => {
|
|
|
3092
3092
|
else return;
|
|
3093
3093
|
}
|
|
3094
3094
|
return n;
|
|
3095
|
-
},
|
|
3096
|
-
let n =
|
|
3095
|
+
}, Qn.parentCollection = (e, t) => {
|
|
3096
|
+
let n = Qn.itemAtPath(e, t.slice(0, -1)), r = t[t.length - 1][0], i = n?.[r];
|
|
3097
3097
|
if (i && "items" in i) return i;
|
|
3098
3098
|
throw Error("Parent collection not found");
|
|
3099
3099
|
};
|
|
3100
|
-
function
|
|
3100
|
+
function $n(e, t, n) {
|
|
3101
3101
|
let r = n(t, e);
|
|
3102
3102
|
if (typeof r == "symbol") return r;
|
|
3103
3103
|
for (let i of ["key", "value"]) {
|
|
3104
3104
|
let a = t[i];
|
|
3105
3105
|
if (a && "items" in a) {
|
|
3106
3106
|
for (let t = 0; t < a.items.length; ++t) {
|
|
3107
|
-
let r =
|
|
3107
|
+
let r = $n(Object.freeze(e.concat([[i, t]])), a.items[t], n);
|
|
3108
3108
|
if (typeof r == "number") t = r - 1;
|
|
3109
|
-
else if (r ===
|
|
3110
|
-
else r ===
|
|
3109
|
+
else if (r === Yn) return Yn;
|
|
3110
|
+
else r === Zn && (a.items.splice(t, 1), --t);
|
|
3111
3111
|
}
|
|
3112
3112
|
typeof r == "function" && i === "key" && (r = r(t, e));
|
|
3113
3113
|
}
|
|
@@ -3116,23 +3116,23 @@ function er(e, t, n) {
|
|
|
3116
3116
|
}
|
|
3117
3117
|
//#endregion
|
|
3118
3118
|
//#region node_modules/yaml/browser/dist/parse/cst.js
|
|
3119
|
-
var
|
|
3119
|
+
var er = /* @__PURE__ */ a({
|
|
3120
3120
|
BOM: () => "",
|
|
3121
3121
|
DOCUMENT: () => "",
|
|
3122
3122
|
FLOW_END: () => "",
|
|
3123
3123
|
SCALAR: () => "",
|
|
3124
|
-
createScalarToken: () =>
|
|
3125
|
-
isCollection: () =>
|
|
3126
|
-
isScalar: () =>
|
|
3127
|
-
prettyToken: () =>
|
|
3128
|
-
resolveAsScalar: () =>
|
|
3129
|
-
setScalarValue: () =>
|
|
3130
|
-
stringify: () =>
|
|
3131
|
-
tokenType: () =>
|
|
3132
|
-
visit: () =>
|
|
3133
|
-
}),
|
|
3124
|
+
createScalarToken: () => Vn,
|
|
3125
|
+
isCollection: () => tr,
|
|
3126
|
+
isScalar: () => nr,
|
|
3127
|
+
prettyToken: () => rr,
|
|
3128
|
+
resolveAsScalar: () => Bn,
|
|
3129
|
+
setScalarValue: () => Hn,
|
|
3130
|
+
stringify: () => Kn,
|
|
3131
|
+
tokenType: () => ir,
|
|
3132
|
+
visit: () => Qn
|
|
3133
|
+
}), tr = (e) => !!e && "items" in e, nr = (e) => !!e && (e.type === "scalar" || e.type === "single-quoted-scalar" || e.type === "double-quoted-scalar" || e.type === "block-scalar");
|
|
3134
3134
|
/* istanbul ignore next */
|
|
3135
|
-
function
|
|
3135
|
+
function rr(e) {
|
|
3136
3136
|
switch (e) {
|
|
3137
3137
|
case "": return "<BOM>";
|
|
3138
3138
|
case "": return "<DOC>";
|
|
@@ -3141,7 +3141,7 @@ function ir(e) {
|
|
|
3141
3141
|
default: return JSON.stringify(e);
|
|
3142
3142
|
}
|
|
3143
3143
|
}
|
|
3144
|
-
function
|
|
3144
|
+
function ir(e) {
|
|
3145
3145
|
switch (e) {
|
|
3146
3146
|
case "": return "byte-order-mark";
|
|
3147
3147
|
case "": return "doc-mode";
|
|
@@ -3178,7 +3178,7 @@ function ar(e) {
|
|
|
3178
3178
|
}
|
|
3179
3179
|
//#endregion
|
|
3180
3180
|
//#region node_modules/yaml/browser/dist/parse/lexer.js
|
|
3181
|
-
function
|
|
3181
|
+
function U(e) {
|
|
3182
3182
|
switch (e) {
|
|
3183
3183
|
case void 0:
|
|
3184
3184
|
case " ":
|
|
@@ -3188,7 +3188,7 @@ function H(e) {
|
|
|
3188
3188
|
default: return !1;
|
|
3189
3189
|
}
|
|
3190
3190
|
}
|
|
3191
|
-
var
|
|
3191
|
+
var ar = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), or = /* @__PURE__ */ new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), sr = /* @__PURE__ */ new Set(",[]{}"), cr = /* @__PURE__ */ new Set(" ,[]{}\n\r "), lr = (e) => !e || cr.has(e), ur = class {
|
|
3192
3192
|
constructor() {
|
|
3193
3193
|
this.atEnd = !1, this.blockScalarIndent = -1, this.blockScalarKeep = !1, this.buffer = "", this.flowKey = !1, this.flowLevel = 0, this.indentNext = 0, this.indentValue = 0, this.lineEndPos = null, this.next = null, this.pos = 0;
|
|
3194
3194
|
}
|
|
@@ -3222,7 +3222,7 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3222
3222
|
}
|
|
3223
3223
|
if (t === "-" || t === ".") {
|
|
3224
3224
|
let t = this.buffer.substr(e, 3);
|
|
3225
|
-
if ((t === "---" || t === "...") &&
|
|
3225
|
+
if ((t === "---" || t === "...") && U(this.buffer[e + 3])) return -1;
|
|
3226
3226
|
}
|
|
3227
3227
|
return e;
|
|
3228
3228
|
}
|
|
@@ -3284,14 +3284,14 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3284
3284
|
if (e === "-" || e === ".") {
|
|
3285
3285
|
if (!this.atEnd && !this.hasChars(4)) return this.setNext("line-start");
|
|
3286
3286
|
let e = this.peek(3);
|
|
3287
|
-
if ((e === "---" || e === "...") &&
|
|
3287
|
+
if ((e === "---" || e === "...") && U(this.charAt(3))) return yield* this.pushCount(3), this.indentValue = 0, this.indentNext = 0, e === "---" ? "doc" : "stream";
|
|
3288
3288
|
}
|
|
3289
|
-
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !
|
|
3289
|
+
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !U(this.charAt(1)) && (this.indentNext = this.indentValue), yield* this.parseBlockStart();
|
|
3290
3290
|
}
|
|
3291
3291
|
*parseBlockStart() {
|
|
3292
3292
|
let [e, t] = this.peek(2);
|
|
3293
3293
|
if (!t && !this.atEnd) return this.setNext("block-start");
|
|
3294
|
-
if ((e === "-" || e === "?" || e === ":") &&
|
|
3294
|
+
if ((e === "-" || e === "?" || e === ":") && U(t)) {
|
|
3295
3295
|
let e = (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0));
|
|
3296
3296
|
return this.indentNext = this.indentValue + 1, this.indentValue += e, "block-start";
|
|
3297
3297
|
}
|
|
@@ -3309,7 +3309,7 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3309
3309
|
case "[": return yield* this.pushCount(1), this.flowKey = !1, this.flowLevel = 1, "flow";
|
|
3310
3310
|
case "}":
|
|
3311
3311
|
case "]": return yield* this.pushCount(1), "doc";
|
|
3312
|
-
case "*": return yield* this.pushUntil(
|
|
3312
|
+
case "*": return yield* this.pushUntil(lr), "doc";
|
|
3313
3313
|
case "\"":
|
|
3314
3314
|
case "'": return yield* this.parseQuotedScalar();
|
|
3315
3315
|
case "|":
|
|
@@ -3324,7 +3324,7 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3324
3324
|
while (e + t > 0);
|
|
3325
3325
|
let r = this.getLine();
|
|
3326
3326
|
if (r === null) return this.setNext("flow");
|
|
3327
|
-
if ((n !== -1 && n < this.indentNext && r[0] !== "#" || n === 0 && (r.startsWith("---") || r.startsWith("...")) &&
|
|
3327
|
+
if ((n !== -1 && n < this.indentNext && r[0] !== "#" || n === 0 && (r.startsWith("---") || r.startsWith("...")) && U(r[3])) && (n !== this.indentNext - 1 || this.flowLevel !== 1 || r[0] !== "]" && r[0] !== "}")) return this.flowLevel = 0, yield "", yield* this.parseLineStart();
|
|
3328
3328
|
let i = 0;
|
|
3329
3329
|
for (; r[i] === ",";) i += yield* this.pushCount(1), i += yield* this.pushSpaces(!0), this.flowKey = !1;
|
|
3330
3330
|
switch (i += yield* this.pushIndicators(), r[i]) {
|
|
@@ -3334,12 +3334,12 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3334
3334
|
case "[": return yield* this.pushCount(1), this.flowKey = !1, this.flowLevel += 1, "flow";
|
|
3335
3335
|
case "}":
|
|
3336
3336
|
case "]": return yield* this.pushCount(1), this.flowKey = !0, --this.flowLevel, this.flowLevel ? "flow" : "doc";
|
|
3337
|
-
case "*": return yield* this.pushUntil(
|
|
3337
|
+
case "*": return yield* this.pushUntil(lr), "flow";
|
|
3338
3338
|
case "\"":
|
|
3339
3339
|
case "'": return this.flowKey = !0, yield* this.parseQuotedScalar();
|
|
3340
3340
|
case ":": {
|
|
3341
3341
|
let e = this.charAt(1);
|
|
3342
|
-
if (this.flowKey ||
|
|
3342
|
+
if (this.flowKey || U(e) || e === ",") return this.flowKey = !1, yield* this.pushCount(1), yield* this.pushSpaces(!0), "flow";
|
|
3343
3343
|
}
|
|
3344
3344
|
default: return this.flowKey = !1, yield* this.parsePlainScalar();
|
|
3345
3345
|
}
|
|
@@ -3377,7 +3377,7 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3377
3377
|
else if (t > "0" && t <= "9") this.blockScalarIndent = Number(t) - 1;
|
|
3378
3378
|
else if (t !== "-") break;
|
|
3379
3379
|
}
|
|
3380
|
-
return yield* this.pushUntil((e) =>
|
|
3380
|
+
return yield* this.pushUntil((e) => U(e) || e === "#");
|
|
3381
3381
|
}
|
|
3382
3382
|
*parseBlockScalar() {
|
|
3383
3383
|
let e = this.pos - 1, t = 0, n;
|
|
@@ -3427,18 +3427,18 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3427
3427
|
let e = this.flowLevel > 0, t = this.pos - 1, n = this.pos - 1, r;
|
|
3428
3428
|
for (; r = this.buffer[++n];) if (r === ":") {
|
|
3429
3429
|
let r = this.buffer[n + 1];
|
|
3430
|
-
if (
|
|
3430
|
+
if (U(r) || e && sr.has(r)) break;
|
|
3431
3431
|
t = n;
|
|
3432
|
-
} else if (
|
|
3432
|
+
} else if (U(r)) {
|
|
3433
3433
|
let i = this.buffer[n + 1];
|
|
3434
|
-
if (r === "\r" && (i === "\n" ? (n += 1, r = "\n", i = this.buffer[n + 1]) : t = n), i === "#" || e &&
|
|
3434
|
+
if (r === "\r" && (i === "\n" ? (n += 1, r = "\n", i = this.buffer[n + 1]) : t = n), i === "#" || e && sr.has(i)) break;
|
|
3435
3435
|
if (r === "\n") {
|
|
3436
3436
|
let e = this.continueScalar(n + 1);
|
|
3437
3437
|
if (e === -1) break;
|
|
3438
3438
|
n = Math.max(n, e - 2);
|
|
3439
3439
|
}
|
|
3440
3440
|
} else {
|
|
3441
|
-
if (e &&
|
|
3441
|
+
if (e && sr.has(r)) break;
|
|
3442
3442
|
t = n;
|
|
3443
3443
|
}
|
|
3444
3444
|
return !r && !this.atEnd ? this.setNext("plain-scalar") : (yield "", yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
|
|
@@ -3458,13 +3458,13 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3458
3458
|
e += yield* this.pushTag(), e += yield* this.pushSpaces(!0);
|
|
3459
3459
|
continue loop;
|
|
3460
3460
|
case "&":
|
|
3461
|
-
e += yield* this.pushUntil(
|
|
3461
|
+
e += yield* this.pushUntil(lr), e += yield* this.pushSpaces(!0);
|
|
3462
3462
|
continue loop;
|
|
3463
3463
|
case "-":
|
|
3464
3464
|
case "?":
|
|
3465
3465
|
case ":": {
|
|
3466
3466
|
let t = this.flowLevel > 0, n = this.charAt(1);
|
|
3467
|
-
if (
|
|
3467
|
+
if (U(n) || t && sr.has(n)) {
|
|
3468
3468
|
t ? this.flowKey &&= !1 : this.indentNext = this.indentValue + 1, e += yield* this.pushCount(1), e += yield* this.pushSpaces(!0);
|
|
3469
3469
|
continue loop;
|
|
3470
3470
|
}
|
|
@@ -3477,13 +3477,13 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3477
3477
|
*pushTag() {
|
|
3478
3478
|
if (this.charAt(1) === "<") {
|
|
3479
3479
|
let e = this.pos + 2, t = this.buffer[e];
|
|
3480
|
-
for (; !
|
|
3480
|
+
for (; !U(t) && t !== ">";) t = this.buffer[++e];
|
|
3481
3481
|
return yield* this.pushToIndex(t === ">" ? e + 1 : e, !1);
|
|
3482
3482
|
}
|
|
3483
3483
|
{
|
|
3484
3484
|
let e = this.pos + 1, t = this.buffer[e];
|
|
3485
|
-
for (; t;) if (
|
|
3486
|
-
else if (t === "%" &&
|
|
3485
|
+
for (; t;) if (or.has(t)) t = this.buffer[++e];
|
|
3486
|
+
else if (t === "%" && ar.has(this.buffer[e + 1]) && ar.has(this.buffer[e + 2])) t = this.buffer[e += 3];
|
|
3487
3487
|
else break;
|
|
3488
3488
|
return yield* this.pushToIndex(e, !1);
|
|
3489
3489
|
}
|
|
@@ -3505,7 +3505,7 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3505
3505
|
for (; !e(n);) n = this.buffer[++t];
|
|
3506
3506
|
return yield* this.pushToIndex(t, !1);
|
|
3507
3507
|
}
|
|
3508
|
-
},
|
|
3508
|
+
}, dr = class {
|
|
3509
3509
|
constructor() {
|
|
3510
3510
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
3511
3511
|
let t = 0, n = this.lineStarts.length;
|
|
@@ -3531,11 +3531,11 @@ var or = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), sr = /* @__PURE__ */
|
|
|
3531
3531
|
};
|
|
3532
3532
|
//#endregion
|
|
3533
3533
|
//#region node_modules/yaml/browser/dist/parse/parser.js
|
|
3534
|
-
function
|
|
3534
|
+
function fr(e, t) {
|
|
3535
3535
|
for (let n = 0; n < e.length; ++n) if (e[n].type === t) return !0;
|
|
3536
3536
|
return !1;
|
|
3537
3537
|
}
|
|
3538
|
-
function
|
|
3538
|
+
function pr(e) {
|
|
3539
3539
|
for (let t = 0; t < e.length; ++t) switch (e[t].type) {
|
|
3540
3540
|
case "space":
|
|
3541
3541
|
case "comment":
|
|
@@ -3544,7 +3544,7 @@ function mr(e) {
|
|
|
3544
3544
|
}
|
|
3545
3545
|
return -1;
|
|
3546
3546
|
}
|
|
3547
|
-
function
|
|
3547
|
+
function mr(e) {
|
|
3548
3548
|
switch (e?.type) {
|
|
3549
3549
|
case "alias":
|
|
3550
3550
|
case "scalar":
|
|
@@ -3554,7 +3554,7 @@ function hr(e) {
|
|
|
3554
3554
|
default: return !1;
|
|
3555
3555
|
}
|
|
3556
3556
|
}
|
|
3557
|
-
function
|
|
3557
|
+
function hr(e) {
|
|
3558
3558
|
switch (e.type) {
|
|
3559
3559
|
case "document": return e.start;
|
|
3560
3560
|
case "block-map": {
|
|
@@ -3566,7 +3566,7 @@ function gr(e) {
|
|
|
3566
3566
|
default: return [];
|
|
3567
3567
|
}
|
|
3568
3568
|
}
|
|
3569
|
-
function
|
|
3569
|
+
function gr(e) {
|
|
3570
3570
|
if (e.length === 0) return [];
|
|
3571
3571
|
let t = e.length;
|
|
3572
3572
|
loop: for (; --t >= 0;) switch (e[t].type) {
|
|
@@ -3579,16 +3579,16 @@ function _r(e) {
|
|
|
3579
3579
|
for (; e[++t]?.type === "space";);
|
|
3580
3580
|
return e.splice(t, e.length);
|
|
3581
3581
|
}
|
|
3582
|
-
function
|
|
3582
|
+
function _r(e, t) {
|
|
3583
3583
|
if (t.length < 1e5) Array.prototype.push.apply(e, t);
|
|
3584
3584
|
else for (let n = 0; n < t.length; ++n) e.push(t[n]);
|
|
3585
3585
|
}
|
|
3586
|
-
function
|
|
3587
|
-
if (e.start.type === "flow-seq-start") for (let t of e.items) t.sep && !t.value && !
|
|
3586
|
+
function vr(e) {
|
|
3587
|
+
if (e.start.type === "flow-seq-start") for (let t of e.items) t.sep && !t.value && !fr(t.start, "explicit-key-ind") && !fr(t.sep, "map-value-ind") && (t.key && (t.value = t.key), delete t.key, mr(t.value) ? t.value.end ? _r(t.value.end, t.sep) : t.value.end = t.sep : _r(t.start, t.sep), delete t.sep);
|
|
3588
3588
|
}
|
|
3589
|
-
var
|
|
3589
|
+
var yr = class {
|
|
3590
3590
|
constructor(e) {
|
|
3591
|
-
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new
|
|
3591
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new ur(), this.onNewLine = e;
|
|
3592
3592
|
}
|
|
3593
3593
|
*parse(e, t = !1) {
|
|
3594
3594
|
this.onNewLine && this.offset === 0 && this.onNewLine(0);
|
|
@@ -3600,7 +3600,7 @@ var br = class {
|
|
|
3600
3600
|
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
3601
3601
|
return;
|
|
3602
3602
|
}
|
|
3603
|
-
let t =
|
|
3603
|
+
let t = ir(e);
|
|
3604
3604
|
if (!t) {
|
|
3605
3605
|
let t = `Not a YAML token: ${e}`;
|
|
3606
3606
|
yield* this.pop({
|
|
@@ -3683,7 +3683,7 @@ var br = class {
|
|
|
3683
3683
|
else if (this.stack.length === 0) yield t;
|
|
3684
3684
|
else {
|
|
3685
3685
|
let e = this.peek(1);
|
|
3686
|
-
switch (t.type === "block-scalar" ? t.indent = "indent" in e ? e.indent : 0 : t.type === "flow-collection" && e.type === "document" && (t.indent = 0), t.type === "flow-collection" &&
|
|
3686
|
+
switch (t.type === "block-scalar" ? t.indent = "indent" in e ? e.indent : 0 : t.type === "flow-collection" && e.type === "document" && (t.indent = 0), t.type === "flow-collection" && vr(t), e.type) {
|
|
3687
3687
|
case "document":
|
|
3688
3688
|
e.value = t;
|
|
3689
3689
|
break;
|
|
@@ -3735,7 +3735,7 @@ var br = class {
|
|
|
3735
3735
|
}
|
|
3736
3736
|
if ((e.type === "document" || e.type === "block-map" || e.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
3737
3737
|
let n = t.items[t.items.length - 1];
|
|
3738
|
-
n && !n.sep && !n.value && n.start.length > 0 &&
|
|
3738
|
+
n && !n.sep && !n.value && n.start.length > 0 && pr(n.start) === -1 && (t.indent === 0 || n.start.every((e) => e.type !== "comment" || e.indent < t.indent)) && (e.type === "document" ? e.end = n.start : e.items.push({ start: n.start }), t.items.splice(-1, 1));
|
|
3739
3739
|
}
|
|
3740
3740
|
}
|
|
3741
3741
|
}
|
|
@@ -3776,7 +3776,7 @@ var br = class {
|
|
|
3776
3776
|
if (e.value) return yield* this.lineEnd(e);
|
|
3777
3777
|
switch (this.type) {
|
|
3778
3778
|
case "doc-start":
|
|
3779
|
-
|
|
3779
|
+
pr(e.start) === -1 ? e.start.push(this.sourceToken) : (yield* this.pop(), yield* this.step());
|
|
3780
3780
|
return;
|
|
3781
3781
|
case "anchor":
|
|
3782
3782
|
case "tag":
|
|
@@ -3796,7 +3796,7 @@ var br = class {
|
|
|
3796
3796
|
}
|
|
3797
3797
|
*scalar(e) {
|
|
3798
3798
|
if (this.type === "map-value-ind") {
|
|
3799
|
-
let t =
|
|
3799
|
+
let t = gr(hr(this.peek(2))), n;
|
|
3800
3800
|
e.end ? (n = e.end, n.push(this.sourceToken), delete e.end) : n = [this.sourceToken];
|
|
3801
3801
|
let r = {
|
|
3802
3802
|
type: "block-map",
|
|
@@ -3846,7 +3846,7 @@ var br = class {
|
|
|
3846
3846
|
if (this.atIndentedComment(t.start, e.indent)) {
|
|
3847
3847
|
let n = e.items[e.items.length - 2]?.value?.end;
|
|
3848
3848
|
if (Array.isArray(n)) {
|
|
3849
|
-
|
|
3849
|
+
_r(n, t.start), n.push(this.sourceToken), e.items.pop();
|
|
3850
3850
|
return;
|
|
3851
3851
|
}
|
|
3852
3852
|
}
|
|
@@ -3895,12 +3895,12 @@ var br = class {
|
|
|
3895
3895
|
case "map-value-ind":
|
|
3896
3896
|
if (t.explicitKey) {
|
|
3897
3897
|
if (!t.sep) {
|
|
3898
|
-
if (
|
|
3898
|
+
if (fr(t.start, "newline")) Object.assign(t, {
|
|
3899
3899
|
key: null,
|
|
3900
3900
|
sep: [this.sourceToken]
|
|
3901
3901
|
});
|
|
3902
3902
|
else {
|
|
3903
|
-
let e =
|
|
3903
|
+
let e = gr(t.start);
|
|
3904
3904
|
this.stack.push({
|
|
3905
3905
|
type: "block-map",
|
|
3906
3906
|
offset: this.offset,
|
|
@@ -3917,7 +3917,7 @@ var br = class {
|
|
|
3917
3917
|
key: null,
|
|
3918
3918
|
sep: [this.sourceToken]
|
|
3919
3919
|
});
|
|
3920
|
-
else if (
|
|
3920
|
+
else if (fr(t.sep, "map-value-ind")) this.stack.push({
|
|
3921
3921
|
type: "block-map",
|
|
3922
3922
|
offset: this.offset,
|
|
3923
3923
|
indent: this.indent,
|
|
@@ -3927,8 +3927,8 @@ var br = class {
|
|
|
3927
3927
|
sep: [this.sourceToken]
|
|
3928
3928
|
}]
|
|
3929
3929
|
});
|
|
3930
|
-
else if (
|
|
3931
|
-
let e =
|
|
3930
|
+
else if (mr(t.key) && !fr(t.sep, "newline")) {
|
|
3931
|
+
let e = gr(t.start), n = t.key, r = t.sep;
|
|
3932
3932
|
r.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
3933
3933
|
type: "block-map",
|
|
3934
3934
|
offset: this.offset,
|
|
@@ -3944,7 +3944,7 @@ var br = class {
|
|
|
3944
3944
|
start: i,
|
|
3945
3945
|
key: null,
|
|
3946
3946
|
sep: [this.sourceToken]
|
|
3947
|
-
}) :
|
|
3947
|
+
}) : fr(t.sep, "map-value-ind") ? this.stack.push({
|
|
3948
3948
|
type: "block-map",
|
|
3949
3949
|
offset: this.offset,
|
|
3950
3950
|
indent: this.indent,
|
|
@@ -3978,7 +3978,7 @@ var br = class {
|
|
|
3978
3978
|
let r = this.startBlockValue(e);
|
|
3979
3979
|
if (r) {
|
|
3980
3980
|
if (r.type === "block-seq") {
|
|
3981
|
-
if (!t.explicitKey && t.sep && !
|
|
3981
|
+
if (!t.explicitKey && t.sep && !fr(t.sep, "newline")) {
|
|
3982
3982
|
yield* this.pop({
|
|
3983
3983
|
type: "error",
|
|
3984
3984
|
offset: this.offset,
|
|
@@ -4012,7 +4012,7 @@ var br = class {
|
|
|
4012
4012
|
if (this.atIndentedComment(t.start, e.indent)) {
|
|
4013
4013
|
let n = e.items[e.items.length - 2]?.value?.end;
|
|
4014
4014
|
if (Array.isArray(n)) {
|
|
4015
|
-
|
|
4015
|
+
_r(n, t.start), n.push(this.sourceToken), e.items.pop();
|
|
4016
4016
|
return;
|
|
4017
4017
|
}
|
|
4018
4018
|
}
|
|
@@ -4026,7 +4026,7 @@ var br = class {
|
|
|
4026
4026
|
return;
|
|
4027
4027
|
case "seq-item-ind":
|
|
4028
4028
|
if (this.indent !== e.indent) break;
|
|
4029
|
-
t.value ||
|
|
4029
|
+
t.value || fr(t.start, "seq-item-ind") ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
|
|
4030
4030
|
return;
|
|
4031
4031
|
}
|
|
4032
4032
|
if (this.indent > e.indent) {
|
|
@@ -4095,8 +4095,8 @@ var br = class {
|
|
|
4095
4095
|
let t = this.peek(2);
|
|
4096
4096
|
if (t.type === "block-map" && (this.type === "map-value-ind" && t.indent === e.indent || this.type === "newline" && !t.items[t.items.length - 1].sep)) yield* this.pop(), yield* this.step();
|
|
4097
4097
|
else if (this.type === "map-value-ind" && t.type !== "flow-collection") {
|
|
4098
|
-
let n =
|
|
4099
|
-
|
|
4098
|
+
let n = gr(hr(t));
|
|
4099
|
+
vr(e);
|
|
4100
4100
|
let r = e.end.splice(1, e.end.length);
|
|
4101
4101
|
r.push(this.sourceToken);
|
|
4102
4102
|
let i = {
|
|
@@ -4155,7 +4155,7 @@ var br = class {
|
|
|
4155
4155
|
};
|
|
4156
4156
|
case "explicit-key-ind": {
|
|
4157
4157
|
this.onKeyLine = !0;
|
|
4158
|
-
let t =
|
|
4158
|
+
let t = gr(hr(e));
|
|
4159
4159
|
return t.push(this.sourceToken), {
|
|
4160
4160
|
type: "block-map",
|
|
4161
4161
|
offset: this.offset,
|
|
@@ -4168,7 +4168,7 @@ var br = class {
|
|
|
4168
4168
|
}
|
|
4169
4169
|
case "map-value-ind": {
|
|
4170
4170
|
this.onKeyLine = !0;
|
|
4171
|
-
let t =
|
|
4171
|
+
let t = gr(hr(e));
|
|
4172
4172
|
return {
|
|
4173
4173
|
type: "block-map",
|
|
4174
4174
|
offset: this.offset,
|
|
@@ -4206,31 +4206,31 @@ var br = class {
|
|
|
4206
4206
|
};
|
|
4207
4207
|
//#endregion
|
|
4208
4208
|
//#region node_modules/yaml/browser/dist/public-api.js
|
|
4209
|
-
function
|
|
4209
|
+
function br(e) {
|
|
4210
4210
|
let t = e.prettyErrors !== !1;
|
|
4211
4211
|
return {
|
|
4212
|
-
lineCounter: e.lineCounter || t && new
|
|
4212
|
+
lineCounter: e.lineCounter || t && new dr() || null,
|
|
4213
4213
|
prettyErrors: t
|
|
4214
4214
|
};
|
|
4215
4215
|
}
|
|
4216
|
-
function
|
|
4217
|
-
let { lineCounter: n, prettyErrors: r } =
|
|
4218
|
-
if (r && n) for (let t of o) t.errors.forEach(
|
|
4216
|
+
function xr(e, t = {}) {
|
|
4217
|
+
let { lineCounter: n, prettyErrors: r } = br(t), i = new yr(n?.addNewLine), a = new zn(t), o = Array.from(a.compose(i.parse(e)));
|
|
4218
|
+
if (r && n) for (let t of o) t.errors.forEach(nn(e, n)), t.warnings.forEach(nn(e, n));
|
|
4219
4219
|
return o.length > 0 ? o : Object.assign([], { empty: !0 }, a.streamInfo());
|
|
4220
4220
|
}
|
|
4221
|
-
function
|
|
4222
|
-
let { lineCounter: n, prettyErrors: r } =
|
|
4221
|
+
function Sr(e, t = {}) {
|
|
4222
|
+
let { lineCounter: n, prettyErrors: r } = br(t), i = new yr(n?.addNewLine), a = new zn(t), o = null;
|
|
4223
4223
|
for (let t of a.compose(i.parse(e), !0, e.length)) if (!o) o = t;
|
|
4224
4224
|
else if (o.options.logLevel !== "silent") {
|
|
4225
|
-
o.errors.push(new
|
|
4225
|
+
o.errors.push(new en(t.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
4226
4226
|
break;
|
|
4227
4227
|
}
|
|
4228
|
-
return r && n && (o.errors.forEach(
|
|
4228
|
+
return r && n && (o.errors.forEach(nn(e, n)), o.warnings.forEach(nn(e, n))), o;
|
|
4229
4229
|
}
|
|
4230
|
-
function
|
|
4230
|
+
function Cr(e, t, n) {
|
|
4231
4231
|
let r;
|
|
4232
4232
|
typeof t == "function" ? r = t : n === void 0 && t && typeof t == "object" && (n = t);
|
|
4233
|
-
let i =
|
|
4233
|
+
let i = Sr(e, n);
|
|
4234
4234
|
if (!i) return null;
|
|
4235
4235
|
if (i.warnings.forEach((e) => Ie(i.options.logLevel, e)), i.errors.length > 0) {
|
|
4236
4236
|
if (i.options.logLevel !== "silent") throw i.errors[0];
|
|
@@ -4238,7 +4238,7 @@ function wr(e, t, n) {
|
|
|
4238
4238
|
}
|
|
4239
4239
|
return i.toJS(Object.assign({ reviver: r }, n));
|
|
4240
4240
|
}
|
|
4241
|
-
function
|
|
4241
|
+
function wr(e, t, n) {
|
|
4242
4242
|
let r = null;
|
|
4243
4243
|
if (typeof t == "function" || Array.isArray(t) ? r = t : n === void 0 && t && (n = t), typeof n == "string" && (n = n.length), typeof n == "number") {
|
|
4244
4244
|
let e = Math.round(n);
|
|
@@ -4248,26 +4248,26 @@ function Tr(e, t, n) {
|
|
|
4248
4248
|
let { keepUndefined: e } = n ?? t ?? {};
|
|
4249
4249
|
if (!e) return;
|
|
4250
4250
|
}
|
|
4251
|
-
return m(e) && !r ? e.toString(n) : new
|
|
4251
|
+
return m(e) && !r ? e.toString(n) : new Zt(e, r, n).toString(n);
|
|
4252
4252
|
}
|
|
4253
4253
|
//#endregion
|
|
4254
4254
|
//#region node_modules/yaml/browser/index.js
|
|
4255
|
-
var
|
|
4255
|
+
var Tr = /* @__PURE__ */ a({
|
|
4256
4256
|
Alias: () => ue,
|
|
4257
|
-
CST: () =>
|
|
4258
|
-
Composer: () =>
|
|
4259
|
-
Document: () =>
|
|
4260
|
-
Lexer: () =>
|
|
4261
|
-
LineCounter: () =>
|
|
4262
|
-
Pair: () =>
|
|
4263
|
-
Parser: () =>
|
|
4257
|
+
CST: () => er,
|
|
4258
|
+
Composer: () => zn,
|
|
4259
|
+
Document: () => Zt,
|
|
4260
|
+
Lexer: () => ur,
|
|
4261
|
+
LineCounter: () => dr,
|
|
4262
|
+
Pair: () => B,
|
|
4263
|
+
Parser: () => yr,
|
|
4264
4264
|
Scalar: () => N,
|
|
4265
|
-
Schema: () =>
|
|
4266
|
-
YAMLError: () =>
|
|
4267
|
-
YAMLMap: () =>
|
|
4268
|
-
YAMLParseError: () =>
|
|
4269
|
-
YAMLSeq: () =>
|
|
4270
|
-
YAMLWarning: () =>
|
|
4265
|
+
Schema: () => Yt,
|
|
4266
|
+
YAMLError: () => $t,
|
|
4267
|
+
YAMLMap: () => V,
|
|
4268
|
+
YAMLParseError: () => en,
|
|
4269
|
+
YAMLSeq: () => Ze,
|
|
4270
|
+
YAMLWarning: () => tn,
|
|
4271
4271
|
isAlias: () => p,
|
|
4272
4272
|
isCollection: () => y,
|
|
4273
4273
|
isDocument: () => m,
|
|
@@ -4276,13 +4276,13 @@ var Er = /* @__PURE__ */ a({
|
|
|
4276
4276
|
isPair: () => g,
|
|
4277
4277
|
isScalar: () => _,
|
|
4278
4278
|
isSeq: () => v,
|
|
4279
|
-
parse: () =>
|
|
4280
|
-
parseAllDocuments: () =>
|
|
4281
|
-
parseDocument: () =>
|
|
4282
|
-
stringify: () =>
|
|
4279
|
+
parse: () => Cr,
|
|
4280
|
+
parseAllDocuments: () => xr,
|
|
4281
|
+
parseDocument: () => Sr,
|
|
4282
|
+
stringify: () => wr,
|
|
4283
4283
|
visit: () => T,
|
|
4284
4284
|
visitAsync: () => D
|
|
4285
|
-
}),
|
|
4285
|
+
}), W = {
|
|
4286
4286
|
nodes: {},
|
|
4287
4287
|
trees: {},
|
|
4288
4288
|
blocks: {},
|
|
@@ -4291,13 +4291,13 @@ var Er = /* @__PURE__ */ a({
|
|
|
4291
4291
|
nodeLayouts: {},
|
|
4292
4292
|
blockLayouts: {}
|
|
4293
4293
|
};
|
|
4294
|
-
function
|
|
4295
|
-
e.nodes && Object.assign(
|
|
4294
|
+
function Er(e) {
|
|
4295
|
+
e.nodes && Object.assign(W.nodes, e.nodes), e.trees && Object.assign(W.trees, e.trees), e.blocks && Object.assign(W.blocks, e.blocks), e.fieldSets && Object.assign(W.fieldSets, e.fieldSets), e.channels && Object.assign(W.channels, e.channels), e.nodeLayouts && Object.assign(W.nodeLayouts, e.nodeLayouts), e.blockLayouts && Object.assign(W.blockLayouts, e.blockLayouts);
|
|
4296
4296
|
}
|
|
4297
|
-
function
|
|
4297
|
+
function Dr(e) {
|
|
4298
4298
|
return e ? typeof e == "string" ? e.trim() : Array.isArray(e) ? e.includes("*") ? "*" : e : "*" : "*";
|
|
4299
4299
|
}
|
|
4300
|
-
function
|
|
4300
|
+
function G(e = {}, t = {}) {
|
|
4301
4301
|
let n = {
|
|
4302
4302
|
...e,
|
|
4303
4303
|
...t,
|
|
@@ -4309,46 +4309,46 @@ function W(e = {}, t = {}) {
|
|
|
4309
4309
|
};
|
|
4310
4310
|
return t.required === !0 || String(t.required).toLowerCase() === "true" || t.rules?.required === !0 || String(t.rules?.required).toLowerCase() === "true" || t.required === void 0 && (e.required === !0 || String(e.required).toLowerCase() === "true" || e.rules?.required === !0 || String(e.rules?.required).toLowerCase() === "true") ? (n.required = !0, n.rules.required = !0) : (t.required === !1 || t.rules?.required === !1) && (n.required = !1, n.rules.required = !1), n;
|
|
4311
4311
|
}
|
|
4312
|
-
function
|
|
4312
|
+
function Or(e) {
|
|
4313
4313
|
if (!e || typeof e != "object") return e;
|
|
4314
|
-
if (Array.isArray(e)) return e.map(
|
|
4314
|
+
if (Array.isArray(e)) return e.map(Or);
|
|
4315
4315
|
let t = {};
|
|
4316
4316
|
for (let [n, r] of Object.entries(e)) if (n === "<<" || n === "<<:") {
|
|
4317
|
-
let e =
|
|
4317
|
+
let e = Or(r);
|
|
4318
4318
|
if (typeof e == "object" && e) {
|
|
4319
4319
|
if (Array.isArray(e)) for (let n of e) Object.assign(t, n);
|
|
4320
4320
|
else Object.assign(t, e);
|
|
4321
4321
|
}
|
|
4322
|
-
} else t[n] =
|
|
4322
|
+
} else t[n] = Or(r);
|
|
4323
4323
|
return t;
|
|
4324
4324
|
}
|
|
4325
|
-
function
|
|
4326
|
-
return e ?
|
|
4325
|
+
function kr(e, n) {
|
|
4326
|
+
return e ? Or(Tr.parseDocument(e, { customTags: [{
|
|
4327
4327
|
tag: "!include",
|
|
4328
4328
|
resolve(e) {
|
|
4329
4329
|
let r = (typeof e == "string" ? e : String(e?.strValue || e?.value || "")).trim(), i = t.basename(r);
|
|
4330
4330
|
if (!i) return r;
|
|
4331
4331
|
if (n && n.fieldSets) {
|
|
4332
4332
|
let e = Object.keys(n.fieldSets).find((e) => e.endsWith("/" + i) || e === i);
|
|
4333
|
-
if (e) return
|
|
4333
|
+
if (e) return kr(n.fieldSets[e], n);
|
|
4334
4334
|
}
|
|
4335
4335
|
return r;
|
|
4336
4336
|
}
|
|
4337
4337
|
}] }).toJS() || {}) : {};
|
|
4338
4338
|
}
|
|
4339
|
-
function
|
|
4339
|
+
function Ar(n, r = /* @__PURE__ */ new Set()) {
|
|
4340
4340
|
let i = t.resolve(n);
|
|
4341
4341
|
if (r.has(i) || (r.add(i), !e.existsSync(i))) return {};
|
|
4342
4342
|
let a = e.readFileSync(i, "utf-8");
|
|
4343
|
-
return
|
|
4343
|
+
return Or(Tr.parseDocument(a, { customTags: [{
|
|
4344
4344
|
tag: "!include",
|
|
4345
4345
|
resolve(e) {
|
|
4346
4346
|
let n = (typeof e == "string" ? e : String(e?.strValue || e?.value || "")).trim();
|
|
4347
|
-
return n ?
|
|
4347
|
+
return n ? Ar(t.resolve(t.dirname(i), n), new Set(r)) : {};
|
|
4348
4348
|
}
|
|
4349
4349
|
}] }).toJS() || {});
|
|
4350
4350
|
}
|
|
4351
|
-
function
|
|
4351
|
+
function jr() {
|
|
4352
4352
|
if (typeof process > "u" || !process?.versions?.node) return null;
|
|
4353
4353
|
try {
|
|
4354
4354
|
let n = (n) => {
|
|
@@ -4377,7 +4377,7 @@ function Mr() {
|
|
|
4377
4377
|
for (let i of n(e)) {
|
|
4378
4378
|
let e = t.basename(i, t.extname(i));
|
|
4379
4379
|
try {
|
|
4380
|
-
r[e] =
|
|
4380
|
+
r[e] = Ar(i);
|
|
4381
4381
|
} catch {}
|
|
4382
4382
|
}
|
|
4383
4383
|
return r;
|
|
@@ -4401,42 +4401,42 @@ function Mr() {
|
|
|
4401
4401
|
return null;
|
|
4402
4402
|
}
|
|
4403
4403
|
}
|
|
4404
|
-
var
|
|
4405
|
-
function
|
|
4406
|
-
if (
|
|
4407
|
-
let t =
|
|
4408
|
-
return
|
|
4404
|
+
var Mr = null, Nr = null;
|
|
4405
|
+
function Pr(e) {
|
|
4406
|
+
if (Mr && Nr === e) return Mr;
|
|
4407
|
+
let t = Fr(e);
|
|
4408
|
+
return Mr = t, Nr = e, t;
|
|
4409
4409
|
}
|
|
4410
|
-
function
|
|
4410
|
+
function Fr(e) {
|
|
4411
4411
|
if (e) {
|
|
4412
4412
|
let n = {
|
|
4413
4413
|
nodes: {
|
|
4414
4414
|
...e.nodes || e.rawNodes || {},
|
|
4415
|
-
...
|
|
4415
|
+
...W.nodes
|
|
4416
4416
|
},
|
|
4417
4417
|
trees: {
|
|
4418
4418
|
...e.trees || e.rawTrees || {},
|
|
4419
|
-
...
|
|
4419
|
+
...W.trees
|
|
4420
4420
|
},
|
|
4421
4421
|
channels: {
|
|
4422
4422
|
...e.channels || e.rawChannels || {},
|
|
4423
|
-
...
|
|
4423
|
+
...W.channels
|
|
4424
4424
|
},
|
|
4425
4425
|
blocks: {
|
|
4426
4426
|
...e.blocks || e.rawBlocks || {},
|
|
4427
|
-
...
|
|
4427
|
+
...W.blocks
|
|
4428
4428
|
},
|
|
4429
4429
|
nodeLayouts: {
|
|
4430
4430
|
...e.nodeLayouts || e.rawNodeLayouts || {},
|
|
4431
|
-
...
|
|
4431
|
+
...W.nodeLayouts
|
|
4432
4432
|
},
|
|
4433
4433
|
blockLayouts: {
|
|
4434
4434
|
...e.blockLayouts || e.rawBlockLayouts || {},
|
|
4435
|
-
...
|
|
4435
|
+
...W.blockLayouts
|
|
4436
4436
|
},
|
|
4437
4437
|
fieldSets: {
|
|
4438
4438
|
...e.fieldSets || e.rawFieldSets || {},
|
|
4439
|
-
...
|
|
4439
|
+
...W.fieldSets
|
|
4440
4440
|
}
|
|
4441
4441
|
};
|
|
4442
4442
|
if (typeof Object.values(n.nodes)[0] == "string") {
|
|
@@ -4444,11 +4444,11 @@ function Ir(e) {
|
|
|
4444
4444
|
let r = {};
|
|
4445
4445
|
for (let [i, a] of Object.entries(e || {})) {
|
|
4446
4446
|
let e = t.basename(i, t.extname(i));
|
|
4447
|
-
r[e] =
|
|
4447
|
+
r[e] = kr(a, n);
|
|
4448
4448
|
}
|
|
4449
4449
|
return r;
|
|
4450
4450
|
};
|
|
4451
|
-
return
|
|
4451
|
+
return Ir({
|
|
4452
4452
|
rawNodes: e(n.nodes),
|
|
4453
4453
|
rawTrees: e(n.trees),
|
|
4454
4454
|
rawChannels: e(n.channels),
|
|
@@ -4458,12 +4458,12 @@ function Ir(e) {
|
|
|
4458
4458
|
rawFieldSets: e(n.fieldSets)
|
|
4459
4459
|
});
|
|
4460
4460
|
}
|
|
4461
|
-
return
|
|
4461
|
+
return Ir(n);
|
|
4462
4462
|
}
|
|
4463
|
-
let n =
|
|
4464
|
-
return n && Object.keys(n.rawNodes || {}).length > 0 ?
|
|
4463
|
+
let n = jr();
|
|
4464
|
+
return n && Object.keys(n.rawNodes || {}).length > 0 ? Ir(n) : Ir(null);
|
|
4465
4465
|
}
|
|
4466
|
-
function
|
|
4466
|
+
function Ir(e) {
|
|
4467
4467
|
if (!e) return {
|
|
4468
4468
|
nodes: {},
|
|
4469
4469
|
trees: {},
|
|
@@ -4494,11 +4494,11 @@ function Lr(e) {
|
|
|
4494
4494
|
fields: {}
|
|
4495
4495
|
}), Object.entries(s).forEach(([e, r]) => {
|
|
4496
4496
|
let i = n[t].fields[e] || {};
|
|
4497
|
-
n[t].fields[e] =
|
|
4497
|
+
n[t].fields[e] = G(i, r);
|
|
4498
4498
|
});
|
|
4499
4499
|
} else Object.entries(s).forEach(([e, t]) => {
|
|
4500
4500
|
let n = i[e] || {};
|
|
4501
|
-
i[e] =
|
|
4501
|
+
i[e] = G(n, t);
|
|
4502
4502
|
});
|
|
4503
4503
|
};
|
|
4504
4504
|
return !Array.isArray(e) && typeof e == "object" && e ? (Object.entries(e).forEach(([e, t]) => {
|
|
@@ -4508,14 +4508,14 @@ function Lr(e) {
|
|
|
4508
4508
|
return;
|
|
4509
4509
|
}
|
|
4510
4510
|
let n = i[e] || g[e] || {};
|
|
4511
|
-
i[e] =
|
|
4511
|
+
i[e] = G(n, typeof t == "object" && t ? t : { label: String(t) });
|
|
4512
4512
|
}), i) : (Array.isArray(e) && e.forEach((e) => {
|
|
4513
4513
|
if (typeof e == "string") {
|
|
4514
4514
|
if (e.includes("/") || e.endsWith(".yaml") || e.endsWith(".yml")) return;
|
|
4515
4515
|
if (e.startsWith("fieldSet:")) a(e.replace("fieldSet:", "").trim());
|
|
4516
4516
|
else {
|
|
4517
4517
|
let t = i[e] || g[e] || {};
|
|
4518
|
-
i[e] =
|
|
4518
|
+
i[e] = G(t, {
|
|
4519
4519
|
type: "text",
|
|
4520
4520
|
label: e
|
|
4521
4521
|
});
|
|
@@ -4524,7 +4524,7 @@ function Lr(e) {
|
|
|
4524
4524
|
if (e === "fieldSet") a(String(t));
|
|
4525
4525
|
else if (e !== "<<" && e !== "<<:") {
|
|
4526
4526
|
let n = i[e] || g[e] || {};
|
|
4527
|
-
i[e] =
|
|
4527
|
+
i[e] = G(n, typeof t == "object" && t ? t : {});
|
|
4528
4528
|
}
|
|
4529
4529
|
});
|
|
4530
4530
|
}), i);
|
|
@@ -4542,7 +4542,7 @@ function Lr(e) {
|
|
|
4542
4542
|
let s = v(i.fields || i, a, n, t);
|
|
4543
4543
|
Object.entries(s).forEach(([e, t]) => {
|
|
4544
4544
|
let r = n[a].fields[e] || {};
|
|
4545
|
-
n[a].fields[e] =
|
|
4545
|
+
n[a].fields[e] = G(r, t);
|
|
4546
4546
|
});
|
|
4547
4547
|
}
|
|
4548
4548
|
}), n) : (Object.entries(e).forEach(([e, r]) => {
|
|
@@ -4558,7 +4558,7 @@ function Lr(e) {
|
|
|
4558
4558
|
Object.entries(s).forEach(([t, r]) => {
|
|
4559
4559
|
if (t === "<<" || t === "<<:" || t === "label") return;
|
|
4560
4560
|
let i = n[e].fields[t] || {};
|
|
4561
|
-
n[e].fields[t] =
|
|
4561
|
+
n[e].fields[t] = G(i, r);
|
|
4562
4562
|
});
|
|
4563
4563
|
}), n);
|
|
4564
4564
|
}, b = {};
|
|
@@ -4576,16 +4576,16 @@ function Lr(e) {
|
|
|
4576
4576
|
fields: {}
|
|
4577
4577
|
}), Object.entries(o).forEach(([e, r]) => {
|
|
4578
4578
|
let i = n[t].fields[e] || {};
|
|
4579
|
-
n[t].fields[e] =
|
|
4579
|
+
n[t].fields[e] = G(i, r);
|
|
4580
4580
|
});
|
|
4581
4581
|
} else Object.entries(o).forEach(([e, t]) => {
|
|
4582
4582
|
let n = r[e] || g[e] || {};
|
|
4583
|
-
r[e] =
|
|
4583
|
+
r[e] = G(n, t);
|
|
4584
4584
|
});
|
|
4585
4585
|
}), Object.values(n).forEach((e) => {
|
|
4586
4586
|
Object.entries(e.fields).forEach(([e, t]) => {
|
|
4587
4587
|
let n = r[e] || {};
|
|
4588
|
-
r[e] =
|
|
4588
|
+
r[e] = G(n, t);
|
|
4589
4589
|
});
|
|
4590
4590
|
}), Object.keys(n).length === 0 && Object.keys(r).length > 0 && (n.settings = {
|
|
4591
4591
|
label: t.label || "Settings",
|
|
@@ -4598,8 +4598,8 @@ function Lr(e) {
|
|
|
4598
4598
|
inVault: t.inVault !== !1,
|
|
4599
4599
|
hasCanvas: t.hasCanvas === !0,
|
|
4600
4600
|
defaultLayout: t.defaultLayout,
|
|
4601
|
-
allowedBlocks:
|
|
4602
|
-
disallowedBlocks: t.disallowedBlocks ?
|
|
4601
|
+
allowedBlocks: Dr(t.allowedBlocks),
|
|
4602
|
+
disallowedBlocks: t.disallowedBlocks ? Dr(t.disallowedBlocks) : void 0,
|
|
4603
4603
|
tabs: n,
|
|
4604
4604
|
fields: r
|
|
4605
4605
|
};
|
|
@@ -4610,11 +4610,11 @@ function Lr(e) {
|
|
|
4610
4610
|
Array.isArray(t.fieldSets) && t.fieldSets.forEach((e) => {
|
|
4611
4611
|
let t = _[e] || {}, i = t.fields || t, a = v(i, "settings", n);
|
|
4612
4612
|
Object.entries(a).forEach(([e, t]) => {
|
|
4613
|
-
r[e] =
|
|
4613
|
+
r[e] = G(r[e] || {}, t);
|
|
4614
4614
|
});
|
|
4615
4615
|
}), Object.values(n).forEach((e) => {
|
|
4616
4616
|
Object.entries(e.fields).forEach(([e, t]) => {
|
|
4617
|
-
r[e] =
|
|
4617
|
+
r[e] = G(r[e] || {}, t);
|
|
4618
4618
|
});
|
|
4619
4619
|
}), x[e] = {
|
|
4620
4620
|
...t,
|
|
@@ -4630,11 +4630,11 @@ function Lr(e) {
|
|
|
4630
4630
|
Array.isArray(t.fieldSets) && t.fieldSets.forEach((e) => {
|
|
4631
4631
|
let t = _[e] || {}, n = t.fields || t, i = v(n);
|
|
4632
4632
|
Object.entries(i).forEach(([e, t]) => {
|
|
4633
|
-
r[e] =
|
|
4633
|
+
r[e] = G(r[e] || {}, t);
|
|
4634
4634
|
});
|
|
4635
4635
|
}), Object.values(n).forEach((e) => {
|
|
4636
4636
|
Object.entries(e.fields).forEach(([e, t]) => {
|
|
4637
|
-
r[e] =
|
|
4637
|
+
r[e] = G(r[e] || {}, t);
|
|
4638
4638
|
});
|
|
4639
4639
|
}), S[e] = {
|
|
4640
4640
|
...t,
|
|
@@ -4654,7 +4654,7 @@ function Lr(e) {
|
|
|
4654
4654
|
Array.isArray(t.fieldSets) && t.fieldSets.forEach((e) => {
|
|
4655
4655
|
let t = _[e] || {}, r = t.fields || t, i = v(r);
|
|
4656
4656
|
Object.entries(i).forEach(([e, t]) => {
|
|
4657
|
-
n[e] =
|
|
4657
|
+
n[e] = G(n[e] || {}, t);
|
|
4658
4658
|
});
|
|
4659
4659
|
}), C[e] = {
|
|
4660
4660
|
...t,
|
|
@@ -4674,8 +4674,8 @@ function Lr(e) {
|
|
|
4674
4674
|
i[e] = {
|
|
4675
4675
|
...t,
|
|
4676
4676
|
label: t.label || e,
|
|
4677
|
-
allowedBlocks:
|
|
4678
|
-
disallowedBlocks: t.disallowedBlocks ?
|
|
4677
|
+
allowedBlocks: Dr(t.allowedBlocks),
|
|
4678
|
+
disallowedBlocks: t.disallowedBlocks ? Dr(t.disallowedBlocks) : void 0
|
|
4679
4679
|
};
|
|
4680
4680
|
}), T[e] = {
|
|
4681
4681
|
...t,
|
|
@@ -4697,8 +4697,8 @@ function Lr(e) {
|
|
|
4697
4697
|
i[e] = {
|
|
4698
4698
|
...t,
|
|
4699
4699
|
label: t.label || e,
|
|
4700
|
-
allowedBlocks:
|
|
4701
|
-
disallowedBlocks: t.disallowedBlocks ?
|
|
4700
|
+
allowedBlocks: Dr(t.allowedBlocks),
|
|
4701
|
+
disallowedBlocks: t.disallowedBlocks ? Dr(t.disallowedBlocks) : void 0
|
|
4702
4702
|
};
|
|
4703
4703
|
}), D[e] = {
|
|
4704
4704
|
...t,
|
|
@@ -4717,7 +4717,7 @@ function Lr(e) {
|
|
|
4717
4717
|
Array.isArray(m?.fieldSets) && m?.fieldSets.forEach((e) => {
|
|
4718
4718
|
let t = _[e] || {}, n = t.fields || t, r = v(n);
|
|
4719
4719
|
Object.entries(r).forEach(([e, t]) => {
|
|
4720
|
-
O[e] =
|
|
4720
|
+
O[e] = G(O[e] || {}, t);
|
|
4721
4721
|
});
|
|
4722
4722
|
});
|
|
4723
4723
|
let k = m ? {
|
|
@@ -4727,7 +4727,7 @@ function Lr(e) {
|
|
|
4727
4727
|
Array.isArray(h?.fieldSets) && h?.fieldSets.forEach((e) => {
|
|
4728
4728
|
let t = _[e] || {}, n = t.fields || t, r = v(n);
|
|
4729
4729
|
Object.entries(r).forEach(([e, t]) => {
|
|
4730
|
-
ee[e] =
|
|
4730
|
+
ee[e] = G(ee[e] || {}, t);
|
|
4731
4731
|
});
|
|
4732
4732
|
});
|
|
4733
4733
|
let te = h ? {
|
|
@@ -4750,7 +4750,7 @@ function Lr(e) {
|
|
|
4750
4750
|
}
|
|
4751
4751
|
//#endregion
|
|
4752
4752
|
//#region node_modules/hono/dist/middleware/cors/index.js
|
|
4753
|
-
var
|
|
4753
|
+
var Lr = (e) => {
|
|
4754
4754
|
let t = {
|
|
4755
4755
|
origin: "*",
|
|
4756
4756
|
allowMethods: [
|
|
@@ -4795,17 +4795,17 @@ var Rr = (e) => {
|
|
|
4795
4795
|
}
|
|
4796
4796
|
await o(), t.origin !== "*" && e.header("Vary", "Origin", { append: !0 });
|
|
4797
4797
|
};
|
|
4798
|
-
},
|
|
4798
|
+
}, Rr = (/* @__PURE__ */ i(((e, t) => {
|
|
4799
4799
|
t.exports = {};
|
|
4800
|
-
})))(),
|
|
4801
|
-
function
|
|
4802
|
-
if (!
|
|
4803
|
-
let e = (0,
|
|
4804
|
-
r.mkdirSync(n.dirname(i), { recursive: !0 }),
|
|
4800
|
+
})))(), zr = null;
|
|
4801
|
+
function Br() {
|
|
4802
|
+
if (!zr) {
|
|
4803
|
+
let e = (0, Rr.createRequire)(import.meta.url), t = e("better-sqlite3"), n = e("node:path"), r = e("node:fs"), i = n.resolve(process.cwd(), "./data/cms.db");
|
|
4804
|
+
r.mkdirSync(n.dirname(i), { recursive: !0 }), zr = new t(i), zr.pragma("journal_mode = WAL");
|
|
4805
4805
|
}
|
|
4806
|
-
return
|
|
4806
|
+
return zr;
|
|
4807
4807
|
}
|
|
4808
|
-
function
|
|
4808
|
+
function Vr(e) {
|
|
4809
4809
|
let t = e?.env?.kama_db || e?.env?.DB;
|
|
4810
4810
|
if (t) return {
|
|
4811
4811
|
prepare(e) {
|
|
@@ -4838,7 +4838,7 @@ function Hr(e) {
|
|
|
4838
4838
|
await t.batch(n);
|
|
4839
4839
|
}
|
|
4840
4840
|
};
|
|
4841
|
-
let n =
|
|
4841
|
+
let n = Br();
|
|
4842
4842
|
return {
|
|
4843
4843
|
prepare(e) {
|
|
4844
4844
|
let t = n.prepare(e);
|
|
@@ -4874,7 +4874,7 @@ function Hr(e) {
|
|
|
4874
4874
|
}
|
|
4875
4875
|
//#endregion
|
|
4876
4876
|
//#region server/db/dynamic-sync.ts
|
|
4877
|
-
async function
|
|
4877
|
+
async function Hr(e, t) {
|
|
4878
4878
|
try {
|
|
4879
4879
|
let n = await e.prepare(`PRAGMA table_info("${t}")`).all(), r = Array.isArray(n) ? n : n?.results || [];
|
|
4880
4880
|
return new Set(r.map((e) => e.name));
|
|
@@ -4882,7 +4882,7 @@ async function Ur(e, t) {
|
|
|
4882
4882
|
return /* @__PURE__ */ new Set();
|
|
4883
4883
|
}
|
|
4884
4884
|
}
|
|
4885
|
-
var
|
|
4885
|
+
var Ur = {
|
|
4886
4886
|
content_schemas: "\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n type TEXT UNIQUE NOT NULL,\n schemaJson TEXT NOT NULL,\n isSystem INTEGER DEFAULT 1,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP\n ",
|
|
4887
4887
|
users: "\n id TEXT PRIMARY KEY,\n email TEXT UNIQUE NOT NULL,\n name TEXT NOT NULL,\n globalRole TEXT DEFAULT 'editor',\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP\n ",
|
|
4888
4888
|
user_accounts: "\n id TEXT PRIMARY KEY,\n userId TEXT NOT NULL,\n provider TEXT NOT NULL,\n providerAccountId TEXT NOT NULL,\n passwordHash TEXT NOT NULL,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE,\n UNIQUE(provider, providerAccountId)\n ",
|
|
@@ -4897,14 +4897,14 @@ var Wr = {
|
|
|
4897
4897
|
node_revisions: "\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n nodeId INTEGER NOT NULL,\n version INTEGER NOT NULL DEFAULT 1,\n snapshotJson TEXT NOT NULL,\n createdById TEXT,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (nodeId) REFERENCES content_nodes(id) ON DELETE CASCADE,\n FOREIGN KEY (createdById) REFERENCES users(id) ON DELETE SET NULL\n ",
|
|
4898
4898
|
assets: "\n id TEXT PRIMARY KEY,\n filename TEXT NOT NULL,\n mimeType TEXT NOT NULL,\n sizeBytes INTEGER NOT NULL,\n storageKeyPrivate TEXT,\n cdnUrl TEXT,\n parentAssetId TEXT,\n cropCoordinatesJson TEXT,\n isSystemVariant INTEGER DEFAULT 0,\n dataJson TEXT DEFAULT '{}',\n createdById TEXT,\n createdAt TEXT DEFAULT CURRENT_TIMESTAMP,\n updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,\n deletedAt TEXT,\n FOREIGN KEY (parentAssetId) REFERENCES assets(id) ON DELETE SET NULL,\n FOREIGN KEY (createdById) REFERENCES users(id) ON DELETE SET NULL\n ",
|
|
4899
4899
|
node_assets: "\n nodeId INTEGER NOT NULL,\n assetId TEXT NOT NULL,\n fieldKey TEXT NOT NULL,\n sortOrder INTEGER DEFAULT 0,\n PRIMARY KEY (nodeId, assetId, fieldKey),\n FOREIGN KEY (nodeId) REFERENCES content_nodes(id) ON DELETE CASCADE,\n FOREIGN KEY (assetId) REFERENCES assets(id) ON DELETE CASCADE\n "
|
|
4900
|
-
},
|
|
4901
|
-
async function
|
|
4900
|
+
}, Wr = /* @__PURE__ */ "CREATE INDEX IF NOT EXISTS idx_tree_nodes_tree_parent ON tree_nodes(treeId, parentId);.CREATE INDEX IF NOT EXISTS idx_tree_nodes_contentId ON tree_nodes(contentId);.CREATE INDEX IF NOT EXISTS idx_content_nodes_slug_status ON content_nodes(slug, status);.CREATE INDEX IF NOT EXISTS idx_content_blocks_node ON content_blocks(contentId, isDraft);.CREATE INDEX IF NOT EXISTS idx_node_assets_nodeId ON node_assets(nodeId);.CREATE INDEX IF NOT EXISTS idx_node_assets_assetId ON node_assets(assetId);.CREATE INDEX IF NOT EXISTS idx_content_schemas_type ON content_schemas(type);.CREATE INDEX IF NOT EXISTS idx_sessions_user ON sessions(userId);.CREATE INDEX IF NOT EXISTS idx_sessions_expires ON sessions(expiresAt);.CREATE INDEX IF NOT EXISTS idx_channels_visibility ON channels(isHidden);.CREATE INDEX IF NOT EXISTS idx_trees_visibility ON trees(isHidden);.CREATE INDEX IF NOT EXISTS idx_content_nodes_visibility ON content_nodes(isHidden, status);.CREATE INDEX IF NOT EXISTS idx_content_nodes_slug ON content_nodes(slug);.CREATE INDEX IF NOT EXISTS idx_content_nodes_type ON content_nodes(contentType);.CREATE INDEX IF NOT EXISTS idx_content_nodes_deleted_updated ON content_nodes(deletedAt, updatedAt DESC);.CREATE INDEX IF NOT EXISTS idx_tree_nodes_hierarchy ON tree_nodes(treeId, parentId, sortOrder);.CREATE INDEX IF NOT EXISTS idx_tree_nodes_content ON tree_nodes(contentId, treeId);.CREATE INDEX IF NOT EXISTS idx_content_blocks_content ON content_blocks(contentId, isDraft, region, sortOrder);.CREATE INDEX IF NOT EXISTS idx_node_channels_channel ON node_channels(channelId, nodeId);.CREATE INDEX IF NOT EXISTS idx_node_channels_node ON node_channels(nodeId, channelId);.CREATE INDEX IF NOT EXISTS idx_node_assets_node_asset ON node_assets(nodeId, assetId);.CREATE INDEX IF NOT EXISTS idx_node_assets_asset_node ON node_assets(assetId, nodeId);.CREATE INDEX IF NOT EXISTS idx_node_revisions_node ON node_revisions(nodeId, version);.CREATE INDEX IF NOT EXISTS idx_assets_system_created ON assets(isSystemVariant, createdAt DESC);.CREATE INDEX IF NOT EXISTS idx_assets_system_mime ON assets(isSystemVariant, mimeType);.CREATE INDEX IF NOT EXISTS idx_assets_deleted ON assets(deletedAt);.CREATE INDEX IF NOT EXISTS idx_assets_parent ON assets(parentAssetId);".split(".");
|
|
4901
|
+
async function Gr(e, t) {
|
|
4902
4902
|
try {
|
|
4903
4903
|
await e.prepare("PRAGMA foreign_keys = ON;").run();
|
|
4904
4904
|
} catch {}
|
|
4905
|
-
for (let [t, n] of Object.entries(
|
|
4906
|
-
for (let [t] of Object.entries(
|
|
4907
|
-
let n = await
|
|
4905
|
+
for (let [t, n] of Object.entries(Ur)) await e.prepare(`CREATE TABLE IF NOT EXISTS "${t}" (${n});`).run();
|
|
4906
|
+
for (let [t] of Object.entries(Ur)) {
|
|
4907
|
+
let n = await Hr(e, t);
|
|
4908
4908
|
if (n.size > 0) {
|
|
4909
4909
|
if (t === "content_nodes" && !n.has("disabledRegionsJson")) try {
|
|
4910
4910
|
await e.prepare("ALTER TABLE \"content_nodes\" ADD COLUMN disabledRegionsJson TEXT DEFAULT '{}';").run();
|
|
@@ -4919,13 +4919,13 @@ async function Kr(e, t) {
|
|
|
4919
4919
|
}
|
|
4920
4920
|
}
|
|
4921
4921
|
}
|
|
4922
|
-
for (let t of
|
|
4922
|
+
for (let t of Wr) try {
|
|
4923
4923
|
await e.prepare(t).run();
|
|
4924
4924
|
} catch {}
|
|
4925
|
-
await
|
|
4925
|
+
await Kr(e, t);
|
|
4926
4926
|
}
|
|
4927
|
-
async function
|
|
4928
|
-
let n =
|
|
4927
|
+
async function Kr(e, t) {
|
|
4928
|
+
let n = Pr(t), r = n.rawNodes || n.nodes || {};
|
|
4929
4929
|
for (let [t, n] of Object.entries(r)) {
|
|
4930
4930
|
if (!n || typeof n != "object") continue;
|
|
4931
4931
|
let r = n.type || n.id || t, i = n.name || n.label || r, a = `schema_${r}`, o = JSON.stringify(n);
|
|
@@ -4939,7 +4939,7 @@ async function qr(e, t) {
|
|
|
4939
4939
|
}
|
|
4940
4940
|
//#endregion
|
|
4941
4941
|
//#region server/middleware/media-static.ts
|
|
4942
|
-
function
|
|
4942
|
+
function qr() {
|
|
4943
4943
|
return async (e, t) => {
|
|
4944
4944
|
if (e.env?.MEDIA_BUCKET) {
|
|
4945
4945
|
let t = e.req.path.replace(/^\/media\//, ""), n = await e.env.MEDIA_BUCKET.get(t, { onlyIf: e.req.raw.headers });
|
|
@@ -4970,23 +4970,23 @@ function Jr() {
|
|
|
4970
4970
|
}
|
|
4971
4971
|
//#endregion
|
|
4972
4972
|
//#region server/utils/asset-hydrator.ts
|
|
4973
|
-
function
|
|
4973
|
+
function Jr(e) {
|
|
4974
4974
|
if (!e) return null;
|
|
4975
4975
|
if (typeof e == "string" && e.startsWith("ast_")) return e;
|
|
4976
4976
|
if (typeof e == "object" && e) {
|
|
4977
4977
|
if (typeof e.id == "string" && e.id.startsWith("ast_")) return e.id;
|
|
4978
|
-
if (typeof e.id == "object") return
|
|
4978
|
+
if (typeof e.id == "object") return Jr(e.id);
|
|
4979
4979
|
}
|
|
4980
4980
|
return null;
|
|
4981
4981
|
}
|
|
4982
|
-
async function
|
|
4982
|
+
async function Yr(e, t) {
|
|
4983
4983
|
if (!t || typeof t != "object" || !JSON.stringify(t).includes("ast_")) return t;
|
|
4984
4984
|
let n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
4985
4985
|
if (!e) return;
|
|
4986
|
-
let t =
|
|
4986
|
+
let t = Jr(e);
|
|
4987
4987
|
if (t) {
|
|
4988
4988
|
if (n.add(t), typeof e == "object" && e.parentAssetId) {
|
|
4989
|
-
let t =
|
|
4989
|
+
let t = Jr(e.parentAssetId);
|
|
4990
4990
|
t && n.add(t);
|
|
4991
4991
|
}
|
|
4992
4992
|
} else Array.isArray(e) ? e.forEach(r) : typeof e == "object" && Object.values(e).forEach(r);
|
|
@@ -5022,7 +5022,7 @@ async function Xr(e, t) {
|
|
|
5022
5022
|
}
|
|
5023
5023
|
let s = /* @__PURE__ */ new Map();
|
|
5024
5024
|
for (let e of o) {
|
|
5025
|
-
let t =
|
|
5025
|
+
let t = Jr(e.parentAssetId) || i.find((t) => e.filename.includes(t));
|
|
5026
5026
|
if (!t) continue;
|
|
5027
5027
|
let n = e.filename.match(/^crop_([a-z0-9]+)_/i), r = n ? n[1] : "standard", a = null;
|
|
5028
5028
|
if (e.cropCoordinatesJson) try {
|
|
@@ -5057,7 +5057,7 @@ async function Xr(e, t) {
|
|
|
5057
5057
|
id: e.id,
|
|
5058
5058
|
url: t,
|
|
5059
5059
|
originalUrl: n,
|
|
5060
|
-
parentAssetId:
|
|
5060
|
+
parentAssetId: Jr(e.parentAssetId) || null,
|
|
5061
5061
|
cropCoordinates: r,
|
|
5062
5062
|
variants: i && Object.keys(i).length > 0 ? i : void 0,
|
|
5063
5063
|
filename: e.filename,
|
|
@@ -5069,7 +5069,7 @@ async function Xr(e, t) {
|
|
|
5069
5069
|
}
|
|
5070
5070
|
let l = (e) => {
|
|
5071
5071
|
if (!e) return e;
|
|
5072
|
-
let t =
|
|
5072
|
+
let t = Jr(e);
|
|
5073
5073
|
if (t) {
|
|
5074
5074
|
let n = c.get(t) || {
|
|
5075
5075
|
id: t,
|
|
@@ -5079,7 +5079,7 @@ async function Xr(e, t) {
|
|
|
5079
5079
|
return {
|
|
5080
5080
|
...n,
|
|
5081
5081
|
id: t,
|
|
5082
|
-
parentAssetId: n.parentAssetId ?
|
|
5082
|
+
parentAssetId: n.parentAssetId ? Jr(n.parentAssetId) : null,
|
|
5083
5083
|
url: typeof e == "object" && e.url && !e.url.startsWith("blob:") ? e.url : n.url,
|
|
5084
5084
|
originalUrl: typeof e == "object" && e.originalUrl && !e.originalUrl.startsWith("blob:") ? e.originalUrl : n.originalUrl,
|
|
5085
5085
|
cropCoordinates: i || n.cropCoordinates || null,
|
|
@@ -5099,18 +5099,18 @@ async function Xr(e, t) {
|
|
|
5099
5099
|
}
|
|
5100
5100
|
//#endregion
|
|
5101
5101
|
//#region node_modules/lru-cache/dist/esm/browser/index.min.js
|
|
5102
|
-
var
|
|
5103
|
-
typeof
|
|
5104
|
-
},
|
|
5102
|
+
var Xr = { hasSubscribers: !1 }, K = Xr, Zr = Xr, Qr = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, $r = () => K.hasSubscribers || Zr.hasSubscribers, ei = /* @__PURE__ */ new Set(), ti = typeof process == "object" && process ? process : {}, ni = (e, t, n, r) => {
|
|
5103
|
+
typeof ti.emitWarning == "function" ? ti.emitWarning(e, t, n, r) : console.error(`[${n}] ${t}: ${e}`);
|
|
5104
|
+
}, ri = (e) => !ei.has(e), ii = (e) => !!e && e === Math.floor(e) && e > 0 && isFinite(e), ai = (e) => ii(e) ? e <= 256 ? Uint8Array : e <= 2 ** 16 ? Uint16Array : e <= 2 ** 32 ? Uint32Array : e <= 2 ** 53 - 1 ? oi : null : null, oi = class extends Array {
|
|
5105
5105
|
constructor(e) {
|
|
5106
5106
|
super(e), this.fill(0);
|
|
5107
5107
|
}
|
|
5108
|
-
},
|
|
5108
|
+
}, si = class e {
|
|
5109
5109
|
heap;
|
|
5110
5110
|
length;
|
|
5111
5111
|
static #e = !1;
|
|
5112
5112
|
static create(t) {
|
|
5113
|
-
let n =
|
|
5113
|
+
let n = ai(t);
|
|
5114
5114
|
if (!n) return [];
|
|
5115
5115
|
e.#e = !0;
|
|
5116
5116
|
let r = new e(t, n);
|
|
@@ -5126,7 +5126,7 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5126
5126
|
pop() {
|
|
5127
5127
|
return this.heap[--this.length];
|
|
5128
5128
|
}
|
|
5129
|
-
},
|
|
5129
|
+
}, ci = class e {
|
|
5130
5130
|
#e;
|
|
5131
5131
|
#t;
|
|
5132
5132
|
#n;
|
|
@@ -5229,8 +5229,8 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5229
5229
|
constructor(t) {
|
|
5230
5230
|
let { max: n = 0, ttl: r, ttlResolution: i = 1, ttlAutopurge: a, updateAgeOnGet: o, updateAgeOnHas: s, allowStale: c, dispose: l, onInsert: u, disposeAfter: d, noDisposeOnSet: f, noUpdateTTL: p, maxSize: m = 0, maxEntrySize: h = 0, sizeCalculation: g, fetchMethod: _, memoMethod: v, noDeleteOnFetchRejection: y, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: x, allowStaleOnFetchAbort: S, ignoreFetchAbort: C, backgroundFetchSize: w = 1, perf: T } = t;
|
|
5231
5231
|
if (this.backgroundFetchSize = w, T !== void 0 && typeof T?.now != "function") throw TypeError("perf option must have a now() method if specified");
|
|
5232
|
-
if (this.#s = T ??
|
|
5233
|
-
let E = n ?
|
|
5232
|
+
if (this.#s = T ?? Qr, n !== 0 && !ii(n)) throw TypeError("max option must be a nonnegative integer");
|
|
5233
|
+
let E = n ? ai(n) : Array;
|
|
5234
5234
|
if (!E) throw Error("invalid max value: " + n);
|
|
5235
5235
|
if (this.#e = n, this.#t = m, this.maxEntrySize = h || this.#t, this.sizeCalculation = g, this.sizeCalculation) {
|
|
5236
5236
|
if (!this.#t && !this.maxEntrySize) throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
@@ -5238,26 +5238,26 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5238
5238
|
}
|
|
5239
5239
|
if (v !== void 0 && typeof v != "function") throw TypeError("memoMethod must be a function if defined");
|
|
5240
5240
|
if (this.#o = v, _ !== void 0 && typeof _ != "function") throw TypeError("fetchMethod must be a function if specified");
|
|
5241
|
-
if (this.#a = _, this.#w = !!_, this.#u = /* @__PURE__ */ new Map(), this.#d = Array.from({ length: n }).fill(void 0), this.#f = Array.from({ length: n }).fill(void 0), this.#p = new E(n), this.#m = new E(n), this.#h = 0, this.#g = 0, this.#_ =
|
|
5242
|
-
if (this.#t !== 0 && !
|
|
5243
|
-
if (!
|
|
5241
|
+
if (this.#a = _, this.#w = !!_, this.#u = /* @__PURE__ */ new Map(), this.#d = Array.from({ length: n }).fill(void 0), this.#f = Array.from({ length: n }).fill(void 0), this.#p = new E(n), this.#m = new E(n), this.#h = 0, this.#g = 0, this.#_ = si.create(n), this.#c = 0, this.#l = 0, typeof l == "function" && (this.#n = l), typeof u == "function" && (this.#r = u), typeof d == "function" ? (this.#i = d, this.#v = []) : (this.#i = void 0, this.#v = void 0), this.#C = !!this.#n, this.#E = !!this.#r, this.#T = !!this.#i, this.noDisposeOnSet = !!f, this.noUpdateTTL = !!p, this.noDeleteOnFetchRejection = !!y, this.allowStaleOnFetchRejection = !!x, this.allowStaleOnFetchAbort = !!S, this.ignoreFetchAbort = !!C, this.maxEntrySize !== 0) {
|
|
5242
|
+
if (this.#t !== 0 && !ii(this.#t)) throw TypeError("maxSize must be a positive integer if specified");
|
|
5243
|
+
if (!ii(this.maxEntrySize)) throw TypeError("maxEntrySize must be a positive integer if specified");
|
|
5244
5244
|
this.#M();
|
|
5245
5245
|
}
|
|
5246
|
-
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution =
|
|
5247
|
-
if (!
|
|
5246
|
+
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution = ii(i) || i === 0 ? i : 1, this.ttlAutopurge = !!a, this.ttl = r || 0, this.ttl) {
|
|
5247
|
+
if (!ii(this.ttl)) throw TypeError("ttl must be a positive integer if specified");
|
|
5248
5248
|
this.#D();
|
|
5249
5249
|
}
|
|
5250
5250
|
if (this.#e === 0 && this.ttl === 0 && this.#t === 0) throw TypeError("At least one of max, maxSize, or ttl is required");
|
|
5251
5251
|
if (!this.ttlAutopurge && !this.#e && !this.#t) {
|
|
5252
5252
|
let t = "LRU_CACHE_UNBOUNDED";
|
|
5253
|
-
|
|
5253
|
+
ri(t) && (ei.add(t), ni("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", t, e));
|
|
5254
5254
|
}
|
|
5255
5255
|
}
|
|
5256
5256
|
getRemainingTTL(e) {
|
|
5257
5257
|
return this.#u.has(e) ? 1 / 0 : 0;
|
|
5258
5258
|
}
|
|
5259
5259
|
#D() {
|
|
5260
|
-
let e = new
|
|
5260
|
+
let e = new oi(this.#e), t = new oi(this.#e);
|
|
5261
5261
|
this.#x = e, this.#b = t;
|
|
5262
5262
|
let n = this.ttlAutopurge ? Array.from({ length: this.#e }) : void 0;
|
|
5263
5263
|
this.#S = n, this.#A = (n, i, a = this.#s.now()) => {
|
|
@@ -5307,15 +5307,15 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5307
5307
|
#A = () => {};
|
|
5308
5308
|
#j = () => !1;
|
|
5309
5309
|
#M() {
|
|
5310
|
-
let e = new
|
|
5310
|
+
let e = new oi(this.#e);
|
|
5311
5311
|
this.#l = 0, this.#y = e, this.#N = (t) => {
|
|
5312
5312
|
this.#l -= e[t], e[t] = 0;
|
|
5313
5313
|
}, this.#F = (e, t, n, r) => {
|
|
5314
|
-
if (!
|
|
5314
|
+
if (!ii(n)) {
|
|
5315
5315
|
if (this.#W(t)) return this.backgroundFetchSize;
|
|
5316
5316
|
if (r) {
|
|
5317
5317
|
if (typeof r != "function") throw TypeError("sizeCalculation must be a function");
|
|
5318
|
-
if (n = r(t, e), !
|
|
5318
|
+
if (n = r(t, e), !ii(n)) throw TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
5319
5319
|
} else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
5320
5320
|
}
|
|
5321
5321
|
return n;
|
|
@@ -5431,10 +5431,10 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5431
5431
|
}
|
|
5432
5432
|
}
|
|
5433
5433
|
set(e, t, n = {}) {
|
|
5434
|
-
let { status: r =
|
|
5434
|
+
let { status: r = K.hasSubscribers ? {} : void 0 } = n;
|
|
5435
5435
|
n.status = r, r && (r.op = "set", r.key = e, t !== void 0 && (r.value = t), r.cache = this);
|
|
5436
5436
|
let i = this.#z(e, t, n);
|
|
5437
|
-
return r &&
|
|
5437
|
+
return r && K.hasSubscribers && K.publish(r), i;
|
|
5438
5438
|
}
|
|
5439
5439
|
#z(e, t, n, r) {
|
|
5440
5440
|
let { ttl: i = this.ttl, start: a, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: s = this.sizeCalculation, status: c } = n, l = this.#W(t);
|
|
@@ -5502,10 +5502,10 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5502
5502
|
])), this.#N(t), this.#S?.[t] && (clearTimeout(this.#S[t]), this.#S[t] = void 0), e && (this.#d[t] = void 0, this.#f[t] = void 0, this.#_.push(t)), this.#c === 1 ? (this.#h = this.#g = 0, this.#_.length = 0) : this.#h = this.#p[t], this.#u.delete(n), this.#c--, t;
|
|
5503
5503
|
}
|
|
5504
5504
|
has(e, t = {}) {
|
|
5505
|
-
let { status: n =
|
|
5505
|
+
let { status: n = K.hasSubscribers ? {} : void 0 } = t;
|
|
5506
5506
|
t.status = n, n && (n.op = "has", n.key = e, n.cache = this);
|
|
5507
5507
|
let r = this.#V(e, t);
|
|
5508
|
-
return
|
|
5508
|
+
return K.hasSubscribers && K.publish(n), r;
|
|
5509
5509
|
}
|
|
5510
5510
|
#V(e, t = {}) {
|
|
5511
5511
|
let { updateAgeOnHas: n = this.updateAgeOnHas, status: r } = t, i = this.#u.get(e);
|
|
@@ -5518,10 +5518,10 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5518
5518
|
return !1;
|
|
5519
5519
|
}
|
|
5520
5520
|
peek(e, t = {}) {
|
|
5521
|
-
let { status: n =
|
|
5521
|
+
let { status: n = $r() ? {} : void 0 } = t;
|
|
5522
5522
|
n && (n.op = "peek", n.key = e, n.cache = this), t.status = n;
|
|
5523
5523
|
let r = this.#H(e, t);
|
|
5524
|
-
return
|
|
5524
|
+
return K.hasSubscribers && K.publish(n), r;
|
|
5525
5525
|
}
|
|
5526
5526
|
#H(e, t) {
|
|
5527
5527
|
let { status: n, allowStale: r = this.allowStale } = t, i = this.#u.get(e);
|
|
@@ -5573,10 +5573,10 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5573
5573
|
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
|
|
5574
5574
|
}
|
|
5575
5575
|
fetch(e, t = {}) {
|
|
5576
|
-
let n =
|
|
5576
|
+
let n = Zr.hasSubscribers, { status: r = $r() ? {} : void 0 } = t;
|
|
5577
5577
|
t.status = r, r && t.context && (r.context = t.context);
|
|
5578
5578
|
let i = this.#G(e, t);
|
|
5579
|
-
return r && n && (r.trace = !0,
|
|
5579
|
+
return r && n && (r.trace = !0, Zr.tracePromise(() => i, r).catch(() => {})), i;
|
|
5580
5580
|
}
|
|
5581
5581
|
async #G(e, t = {}) {
|
|
5582
5582
|
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, ttl: a = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: s = 0, sizeCalculation: c = this.sizeCalculation, noUpdateTTL: l = this.noUpdateTTL, noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: m, forceRefresh: h = !1, status: g, signal: _ } = t;
|
|
@@ -5620,10 +5620,10 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5620
5620
|
}
|
|
5621
5621
|
}
|
|
5622
5622
|
forceFetch(e, t = {}) {
|
|
5623
|
-
let n =
|
|
5623
|
+
let n = Zr.hasSubscribers, { status: r = $r() ? {} : void 0 } = t;
|
|
5624
5624
|
t.status = r, r && t.context && (r.context = t.context);
|
|
5625
5625
|
let i = this.#K(e, t);
|
|
5626
|
-
return r && n && (r.trace = !0,
|
|
5626
|
+
return r && n && (r.trace = !0, Zr.tracePromise(() => i, r).catch(() => {})), i;
|
|
5627
5627
|
}
|
|
5628
5628
|
async #K(e, t = {}) {
|
|
5629
5629
|
let n = await this.#G(e, t);
|
|
@@ -5631,10 +5631,10 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5631
5631
|
return n;
|
|
5632
5632
|
}
|
|
5633
5633
|
memo(e, t = {}) {
|
|
5634
|
-
let { status: n =
|
|
5634
|
+
let { status: n = K.hasSubscribers ? {} : void 0 } = t;
|
|
5635
5635
|
t.status = n, n && (n.op = "memo", n.key = e, t.context && (n.context = t.context), n.cache = this);
|
|
5636
5636
|
let r = this.#q(e, t);
|
|
5637
|
-
return n && (n.value = r),
|
|
5637
|
+
return n && (n.value = r), K.hasSubscribers && K.publish(n), r;
|
|
5638
5638
|
}
|
|
5639
5639
|
#q(e, t = {}) {
|
|
5640
5640
|
let n = this.#o;
|
|
@@ -5650,10 +5650,10 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5650
5650
|
return i && (i.value = l), this.#z(e, l, o), l;
|
|
5651
5651
|
}
|
|
5652
5652
|
get(e, t = {}) {
|
|
5653
|
-
let { status: n =
|
|
5653
|
+
let { status: n = K.hasSubscribers ? {} : void 0 } = t;
|
|
5654
5654
|
t.status = n, n && (n.op = "get", n.key = e, n.cache = this);
|
|
5655
5655
|
let r = this.#J(e, t);
|
|
5656
|
-
return n && (r !== void 0 && (n.value = r),
|
|
5656
|
+
return n && (r !== void 0 && (n.value = r), K.hasSubscribers && K.publish(n)), r;
|
|
5657
5657
|
}
|
|
5658
5658
|
#J(e, t = {}) {
|
|
5659
5659
|
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, status: a } = t, o = this.#u.get(e);
|
|
@@ -5674,7 +5674,7 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5674
5674
|
return this.#Z(e, "delete");
|
|
5675
5675
|
}
|
|
5676
5676
|
#Z(e, t) {
|
|
5677
|
-
|
|
5677
|
+
K.hasSubscribers && K.publish({
|
|
5678
5678
|
op: "delete",
|
|
5679
5679
|
delete: t,
|
|
5680
5680
|
key: e,
|
|
@@ -5736,10 +5736,10 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5736
5736
|
for (; t = e?.shift();) this.#i?.(...t);
|
|
5737
5737
|
}
|
|
5738
5738
|
}
|
|
5739
|
-
},
|
|
5739
|
+
}, li = class {
|
|
5740
5740
|
cache;
|
|
5741
5741
|
constructor(e = 1e3, t = 3e5) {
|
|
5742
|
-
this.cache = new
|
|
5742
|
+
this.cache = new ci({
|
|
5743
5743
|
max: e,
|
|
5744
5744
|
ttl: t
|
|
5745
5745
|
});
|
|
@@ -5758,7 +5758,7 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5758
5758
|
async clear() {
|
|
5759
5759
|
this.cache.clear();
|
|
5760
5760
|
}
|
|
5761
|
-
},
|
|
5761
|
+
}, ui = class {
|
|
5762
5762
|
kv;
|
|
5763
5763
|
constructor(e) {
|
|
5764
5764
|
this.kv = e;
|
|
@@ -5775,21 +5775,21 @@ var Zr = { hasSubscribers: !1 }, G = Zr, Qr = Zr, $r = typeof performance == "ob
|
|
|
5775
5775
|
this.kv && await this.kv.delete(e);
|
|
5776
5776
|
}
|
|
5777
5777
|
async clear() {}
|
|
5778
|
-
},
|
|
5778
|
+
}, di = class {
|
|
5779
5779
|
async get() {
|
|
5780
5780
|
return null;
|
|
5781
5781
|
}
|
|
5782
5782
|
async set() {}
|
|
5783
5783
|
async delete() {}
|
|
5784
5784
|
async clear() {}
|
|
5785
|
-
},
|
|
5786
|
-
function
|
|
5785
|
+
}, fi = null;
|
|
5786
|
+
function q(e) {
|
|
5787
5787
|
let t = process.env.CACHE_DRIVER || "lru";
|
|
5788
|
-
return t === "none" || t === "off" || t === "false" ? new
|
|
5788
|
+
return t === "none" || t === "off" || t === "false" ? new di() : e?.env?.CMS_CACHE_KV ? new ui(e.env.CMS_CACHE_KV) : t === "lru" ? (fi ||= new li(), fi) : new di();
|
|
5789
5789
|
}
|
|
5790
5790
|
//#endregion
|
|
5791
5791
|
//#region server/services/cache-manager.ts
|
|
5792
|
-
var
|
|
5792
|
+
var J = class {
|
|
5793
5793
|
env;
|
|
5794
5794
|
constructor(e) {
|
|
5795
5795
|
this.env = e || {};
|
|
@@ -5830,7 +5830,7 @@ var q = class {
|
|
|
5830
5830
|
}
|
|
5831
5831
|
async purgeInternalWorkerCache(e, t, n, r, i = "en") {
|
|
5832
5832
|
try {
|
|
5833
|
-
let a =
|
|
5833
|
+
let a = q(e), o = [];
|
|
5834
5834
|
if (n) {
|
|
5835
5835
|
let [e, s] = await Promise.all([t.prepare("SELECT treeId FROM tree_nodes WHERE contentId = ?").all(n), t.prepare("SELECT c.key, c.id FROM node_channels nc JOIN channels c ON nc.channelId = c.id WHERE nc.nodeId = ?").all(n)]);
|
|
5836
5836
|
(e?.results || []).forEach((e) => {
|
|
@@ -5908,14 +5908,14 @@ var q = class {
|
|
|
5908
5908
|
console.warn("[CacheManager] Slug Purge skipped");
|
|
5909
5909
|
}
|
|
5910
5910
|
}
|
|
5911
|
-
},
|
|
5912
|
-
function
|
|
5911
|
+
}, Y = new n();
|
|
5912
|
+
function pi(e, t) {
|
|
5913
5913
|
let n = Promise.resolve(typeof t == "function" ? t() : t).catch((e) => console.error("[Background Task Error]:", e));
|
|
5914
5914
|
try {
|
|
5915
5915
|
e.executionCtx && typeof e.executionCtx.waitUntil == "function" && e.executionCtx.waitUntil(n);
|
|
5916
5916
|
} catch {}
|
|
5917
5917
|
}
|
|
5918
|
-
async function
|
|
5918
|
+
async function X(e, t, n = []) {
|
|
5919
5919
|
let r = e.prepare(t);
|
|
5920
5920
|
if (typeof r.bind == "function") {
|
|
5921
5921
|
let e = await r.bind(...n).all();
|
|
@@ -5927,23 +5927,23 @@ async function Y(e, t, n = []) {
|
|
|
5927
5927
|
}
|
|
5928
5928
|
return [];
|
|
5929
5929
|
}
|
|
5930
|
-
async function
|
|
5930
|
+
async function mi(e, t, n = []) {
|
|
5931
5931
|
let r = e.prepare(t);
|
|
5932
5932
|
if (typeof r.bind == "function") return r.bind(...n).run();
|
|
5933
5933
|
if (typeof r.run == "function") return r.run(...n);
|
|
5934
5934
|
}
|
|
5935
|
-
function
|
|
5935
|
+
function hi(e) {
|
|
5936
5936
|
return !e || !e.trim() ? null : e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/[\s-]+/g, "-").replace(/^-+|-+$/g, "") || null;
|
|
5937
5937
|
}
|
|
5938
|
-
function
|
|
5938
|
+
function gi(e) {
|
|
5939
5939
|
return +(e === !0 || e === 1 || e === "1" || e === "true");
|
|
5940
5940
|
}
|
|
5941
|
-
function
|
|
5941
|
+
function _i(e) {
|
|
5942
5942
|
if (e == null || e === "null" || e === "" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
5943
5943
|
let t = Number(e);
|
|
5944
5944
|
return isNaN(t) ? null : t;
|
|
5945
5945
|
}
|
|
5946
|
-
function
|
|
5946
|
+
function vi(e) {
|
|
5947
5947
|
if (!e || typeof e != "object") return {};
|
|
5948
5948
|
let t = { ...e };
|
|
5949
5949
|
for (let e of [
|
|
@@ -5974,10 +5974,10 @@ function yi(e) {
|
|
|
5974
5974
|
]) e === "id" && typeof t[e] == "string" && t[e].startsWith("ast_") || delete t[e];
|
|
5975
5975
|
return t;
|
|
5976
5976
|
}
|
|
5977
|
-
async function
|
|
5977
|
+
async function yi(e, t, n) {
|
|
5978
5978
|
let r = {}, i = null;
|
|
5979
|
-
if (t) {
|
|
5980
|
-
let n = await e.prepare("\n WITH RECURSIVE ancestor_path(id, parentId, draftDataJson, dataJson, level) AS (\n SELECT t.id, t.parentId, c.draftDataJson, c.dataJson, 0 FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id WHERE t.id =
|
|
5979
|
+
if (t && t !== "0" && t !== 0 && t !== "null") {
|
|
5980
|
+
let n = await e.prepare("\n WITH RECURSIVE ancestor_path(id, parentId, draftDataJson, dataJson, level) AS (\n SELECT t.id, t.parentId, c.draftDataJson, c.dataJson, 0 \n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id \n WHERE t.id = ? AND t.id IS NOT NULL AND t.id != 0\n \n UNION ALL\n \n SELECT t.id, t.parentId, c.draftDataJson, c.dataJson, ap.level + 1 \n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id \n INNER JOIN ancestor_path ap ON t.id = ap.parentId\n WHERE ap.parentId IS NOT NULL AND ap.parentId != 0 AND ap.parentId != '0' AND ap.parentId != 'null' AND ap.level < 20\n ) SELECT draftDataJson, dataJson FROM ancestor_path ORDER BY level ASC\n ").all(t), a = Array.isArray(n) ? n : n?.results || [], o = /* @__PURE__ */ new Set([
|
|
5981
5981
|
"subpageLayoutId",
|
|
5982
5982
|
"layoutId",
|
|
5983
5983
|
"slug",
|
|
@@ -6012,7 +6012,7 @@ async function bi(e, t, n) {
|
|
|
6012
6012
|
inheritedFields: r
|
|
6013
6013
|
};
|
|
6014
6014
|
}
|
|
6015
|
-
|
|
6015
|
+
Y.get("/", async (e) => {
|
|
6016
6016
|
let t = e.get("db"), n = e.req.query("id"), r = e.req.query("type"), i = e.req.query("search") || e.req.query("q"), a = e.req.query("channelId"), o = e.req.query("trashed") === "true", s = e.req.query("assetId"), c = e.req.query("sort") || "updatedAt", l = (e.req.query("order") || "DESC").toUpperCase() === "ASC" ? "ASC" : "DESC", u = Math.max(1, Math.min(100, parseInt(e.req.query("limit") || "50", 10))), d = Math.max(0, parseInt(e.req.query("offset") || "0", 10));
|
|
6017
6017
|
if (n) {
|
|
6018
6018
|
let r = Number(n);
|
|
@@ -6037,7 +6037,7 @@ J.get("/", async (e) => {
|
|
|
6037
6037
|
updatedAt: i.updatedAt
|
|
6038
6038
|
}, s = i.draftDataJson || i.dataJson;
|
|
6039
6039
|
if (s) try {
|
|
6040
|
-
let n = typeof s == "string" ? JSON.parse(s) : s, a = await t.prepare("SELECT id as treeNodeId, treeId, parentId FROM tree_nodes WHERE contentId = ? LIMIT 1").get(r), c =
|
|
6040
|
+
let n = typeof s == "string" ? JSON.parse(s) : s, a = await t.prepare("SELECT id as treeNodeId, treeId, parentId FROM tree_nodes WHERE contentId = ? LIMIT 1").get(r), c = Pr(e.env?.BUNDLED_DEFINITIONS).nodes?.[i.contentType] || {}, l = vi(n), u = l.layoutId || null, d = !1, f = null;
|
|
6041
6041
|
if (c) {
|
|
6042
6042
|
let e = (e) => {
|
|
6043
6043
|
e && (d = !0, e.options && Array.isArray(e.options) && (f = e.options.map((e) => typeof e == "object" ? e.value || e.id : e)));
|
|
@@ -6047,11 +6047,11 @@ J.get("/", async (e) => {
|
|
|
6047
6047
|
if (d && f && f.length === 1 && f[0] !== "inherit") u = f[0];
|
|
6048
6048
|
else if (!d && c.defaultLayout) u = c.defaultLayout;
|
|
6049
6049
|
else if (a) {
|
|
6050
|
-
let { resolvedLayoutId: e, inheritedFields: n } = await
|
|
6050
|
+
let { resolvedLayoutId: e, inheritedFields: n } = await yi(t, a.parentId, a.treeId);
|
|
6051
6051
|
(u === "inherit" || !u) && (u = e && (!f || f.includes(e) || f.includes("inherit")) ? e : c.defaultLayout || null);
|
|
6052
6052
|
for (let [e, t] of Object.entries(n)) (l[e] === void 0 || l[e] === null || l[e] === "" || l[e] === "inherit") && (l[e] = t);
|
|
6053
6053
|
} else (u === "inherit" || !u) && (u = c.defaultLayout || null);
|
|
6054
|
-
let p = await
|
|
6054
|
+
let p = await Yr(t, l);
|
|
6055
6055
|
Object.assign(o, p), c.hasCanvas && (o.resolvedLayoutId = u);
|
|
6056
6056
|
} catch {}
|
|
6057
6057
|
let c = await t.prepare("SELECT channelId FROM node_channels WHERE nodeId = ?").all(r);
|
|
@@ -6061,7 +6061,7 @@ J.get("/", async (e) => {
|
|
|
6061
6061
|
let u = await t.prepare("SELECT * FROM content_blocks WHERE contentId = ? AND isDraft = 1 ORDER BY sortOrder ASC").all(r), d = Array.isArray(u) ? u : u?.results || [], f = await Promise.all(d.map(async (e) => {
|
|
6062
6062
|
let n = {};
|
|
6063
6063
|
try {
|
|
6064
|
-
n = typeof e.dataJson == "string" ? JSON.parse(e.dataJson || "{}") : e.dataJson || {}, n && typeof n == "object" && (n = await
|
|
6064
|
+
n = typeof e.dataJson == "string" ? JSON.parse(e.dataJson || "{}") : e.dataJson || {}, n && typeof n == "object" && (n = await Yr(t, n));
|
|
6065
6065
|
} catch {
|
|
6066
6066
|
n = {};
|
|
6067
6067
|
}
|
|
@@ -6097,7 +6097,7 @@ J.get("/", async (e) => {
|
|
|
6097
6097
|
contentType: "LOWER(cn.contentType)"
|
|
6098
6098
|
};
|
|
6099
6099
|
v[c] && (_ = v[c]);
|
|
6100
|
-
let y = await
|
|
6100
|
+
let y = await X(t, `
|
|
6101
6101
|
WITH filtered_nodes AS (
|
|
6102
6102
|
SELECT cn.*,
|
|
6103
6103
|
json_extract(COALESCE(cn.draftDataJson, cn.dataJson, '{}'), '$.image') as extImage,
|
|
@@ -6117,9 +6117,9 @@ J.get("/", async (e) => {
|
|
|
6117
6117
|
]), b = Array.isArray(y) ? y : y?.results || [], x = b.map((e) => e.id), S = {}, C = {};
|
|
6118
6118
|
if (x.length > 0) {
|
|
6119
6119
|
let e = x.map(() => "?").join(",");
|
|
6120
|
-
(await
|
|
6120
|
+
(await X(t, `SELECT nc.nodeId, c.label FROM node_channels nc JOIN channels c ON nc.channelId = c.id WHERE nc.nodeId IN (${e})`, x)).forEach((e) => {
|
|
6121
6121
|
S[e.nodeId] || (S[e.nodeId] = []), S[e.nodeId].push(e.label);
|
|
6122
|
-
}), (await
|
|
6122
|
+
}), (await X(t, `SELECT tn.contentId as nodeId, t.label FROM tree_nodes tn JOIN trees t ON tn.treeId = t.id WHERE tn.contentId IN (${e})`, x)).forEach((e) => {
|
|
6123
6123
|
C[e.nodeId] || (C[e.nodeId] = []), C[e.nodeId].includes(e.label) || C[e.nodeId].push(e.label);
|
|
6124
6124
|
});
|
|
6125
6125
|
}
|
|
@@ -6152,13 +6152,13 @@ J.get("/", async (e) => {
|
|
|
6152
6152
|
offset: d,
|
|
6153
6153
|
limit: u
|
|
6154
6154
|
});
|
|
6155
|
-
}),
|
|
6156
|
-
let t = e.get("db"), n = await e.req.json(), r = n.node || n.activeNode || n, i = r.id || n.id, a = i != null && i !== "" && !isNaN(Number(i)) ? Number(i) : null, { title: o, slug: s, language: c, nodeType: l, contentType: u, isHidden: d, hidden: f, is_hidden: p, blocks: m, channels: h, trees: g, attachedAssets: _, ...v } = r, y =
|
|
6155
|
+
}), Y.post("/", async (e) => {
|
|
6156
|
+
let t = e.get("db"), n = await e.req.json(), r = n.node || n.activeNode || n, i = r.id || n.id, a = i != null && i !== "" && !isNaN(Number(i)) ? Number(i) : null, { title: o, slug: s, language: c, nodeType: l, contentType: u, isHidden: d, hidden: f, is_hidden: p, blocks: m, channels: h, trees: g, attachedAssets: _, ...v } = r, y = vi(v), b = gi(d === void 0 ? f === void 0 ? p : f : d), x = c || "en", S = l || u || "page", C = e.get("user")?.id || null, w = a, T = [];
|
|
6157
6157
|
if (a) {
|
|
6158
6158
|
let e = await t.prepare("SELECT assetId FROM node_assets WHERE nodeId = ?").all(a);
|
|
6159
6159
|
T = (Array.isArray(e) ? e : e?.results || []).map((e) => e.assetId);
|
|
6160
6160
|
}
|
|
6161
|
-
let E = s === void 0 ? null :
|
|
6161
|
+
let E = s === void 0 ? null : hi(s), D = [];
|
|
6162
6162
|
if (a) D.push({
|
|
6163
6163
|
sql: "UPDATE content_nodes \n SET title = COALESCE(?, title), \n slug = COALESCE(?, slug), \n language = COALESCE(?, language), \n contentType = COALESCE(?, contentType), \n isHidden = COALESCE(?, isHidden), \n status = 'draft', \n draftDataJson = json_patch(COALESCE(draftDataJson, '{}'), ?), \n updatedById = ?, \n updatedAt = CURRENT_TIMESTAMP \n WHERE id = ?",
|
|
6164
6164
|
params: [
|
|
@@ -6196,7 +6196,7 @@ J.get("/", async (e) => {
|
|
|
6196
6196
|
}
|
|
6197
6197
|
if (g !== void 0 && Array.isArray(g) && g.length > 0 && w) for (let e of g) {
|
|
6198
6198
|
if (!e || !e.treeId) continue;
|
|
6199
|
-
let n = Number(e.treeId) || e.treeId, r =
|
|
6199
|
+
let n = Number(e.treeId) || e.treeId, r = _i(e.parentId ?? e._draftParentId ?? null), i = typeof e.sortOrder == "number" ? e.sortOrder : 0, a = await t.prepare("SELECT id FROM tree_nodes WHERE treeId = ? AND contentId = ?").get(n, w);
|
|
6200
6200
|
a ? D.push({
|
|
6201
6201
|
sql: "UPDATE tree_nodes SET parentId = ?, sortOrder = ? WHERE id = ?",
|
|
6202
6202
|
params: [
|
|
@@ -6250,20 +6250,20 @@ J.get("/", async (e) => {
|
|
|
6250
6250
|
});
|
|
6251
6251
|
}
|
|
6252
6252
|
}
|
|
6253
|
-
return D.length > 0 && await t.batch(D),
|
|
6253
|
+
return D.length > 0 && await t.batch(D), pi(e, async () => {
|
|
6254
6254
|
if (w && Array.isArray(_)) {
|
|
6255
6255
|
let e = new Set([...T].filter((e) => !O.has(e)));
|
|
6256
|
-
for (let n of e) (await
|
|
6256
|
+
for (let n of e) (await X(t, "SELECT 1 FROM node_assets WHERE assetId = ? LIMIT 1", [n])).length > 0 || await mi(t, "DELETE FROM assets WHERE id = ?", [n]);
|
|
6257
6257
|
}
|
|
6258
6258
|
}), e.json({
|
|
6259
6259
|
success: !0,
|
|
6260
6260
|
id: w,
|
|
6261
6261
|
status: "draft"
|
|
6262
6262
|
});
|
|
6263
|
-
}),
|
|
6263
|
+
}), Y.post("/publish", async (e) => {
|
|
6264
6264
|
let t = e.get("db"), n = await e.req.json(), r = n.id || n.nodeId;
|
|
6265
6265
|
if (!r || isNaN(Number(r))) return e.json({ error: "Node ID required for publishing" }, 400);
|
|
6266
|
-
let i = Number(r), a = e.get("user")?.id || null, o = (await
|
|
6266
|
+
let i = Number(r), a = e.get("user")?.id || null, o = (await X(t, "SELECT * FROM content_nodes WHERE id = ?", [i]))[0];
|
|
6267
6267
|
if (!o) return e.json({ error: "Node not found" }, 404);
|
|
6268
6268
|
let s = [];
|
|
6269
6269
|
return s.push({
|
|
@@ -6275,9 +6275,9 @@ J.get("/", async (e) => {
|
|
|
6275
6275
|
}), s.push({
|
|
6276
6276
|
sql: "INSERT INTO content_blocks (contentId, sortOrder, elementType, dataJson, region, isDraft) \n SELECT contentId, sortOrder, elementType, dataJson, region, 0 \n FROM content_blocks \n WHERE contentId = ? AND isDraft = 1",
|
|
6277
6277
|
params: [i]
|
|
6278
|
-
}), await t.batch(s),
|
|
6278
|
+
}), await t.batch(s), pi(e, async () => {
|
|
6279
6279
|
try {
|
|
6280
|
-
let n = ((await
|
|
6280
|
+
let n = ((await X(t, "SELECT COUNT(*) as count FROM node_revisions WHERE nodeId = ?", [i]))[0]?.count || 0) + 1, r = (await X(t, "SELECT elementType, dataJson, region, sortOrder FROM content_blocks WHERE contentId = ? AND isDraft = 1", [i])).map((e) => {
|
|
6281
6281
|
let t = e.dataJson ? JSON.parse(e.dataJson) : {};
|
|
6282
6282
|
return {
|
|
6283
6283
|
...e,
|
|
@@ -6299,12 +6299,12 @@ J.get("/", async (e) => {
|
|
|
6299
6299
|
},
|
|
6300
6300
|
blocks: r
|
|
6301
6301
|
});
|
|
6302
|
-
await
|
|
6302
|
+
await mi(t, "INSERT INTO node_revisions (nodeId, version, snapshotJson, createdById) VALUES (?, ?, ?, ?)", [
|
|
6303
6303
|
i,
|
|
6304
6304
|
n,
|
|
6305
6305
|
s,
|
|
6306
6306
|
a
|
|
6307
|
-
]), new
|
|
6307
|
+
]), new J(e.env).purgeNode(e, t, i, !1);
|
|
6308
6308
|
} catch (e) {
|
|
6309
6309
|
console.warn("Failed to compile revision snapshot in background", e);
|
|
6310
6310
|
}
|
|
@@ -6314,18 +6314,18 @@ J.get("/", async (e) => {
|
|
|
6314
6314
|
status: "published",
|
|
6315
6315
|
publishedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6316
6316
|
});
|
|
6317
|
-
}),
|
|
6317
|
+
}), Y.get("/revisions", async (e) => {
|
|
6318
6318
|
let t = e.get("db"), n = Number(e.req.query("id"));
|
|
6319
6319
|
if (!n || isNaN(n)) return e.json({ error: "Invalid Node ID" }, 400);
|
|
6320
|
-
let r = (await
|
|
6320
|
+
let r = (await X(t, "\n SELECT r.id, r.version, r.createdAt, r.createdById, u.name as createdByName, u.email as createdByEmail\n FROM node_revisions r LEFT JOIN users u ON r.createdById = u.id\n WHERE r.nodeId = ? ORDER BY r.createdAt DESC LIMIT 50\n ", [n])).map((e) => ({
|
|
6321
6321
|
...e,
|
|
6322
6322
|
createdAt: (e.createdAt || "").replace(" ", "T") + "Z"
|
|
6323
6323
|
}));
|
|
6324
6324
|
return e.json({ revisions: r });
|
|
6325
|
-
}),
|
|
6325
|
+
}), Y.get("/revisions/payload", async (e) => {
|
|
6326
6326
|
let t = e.get("db"), n = Number(e.req.query("id")), r = Number(e.req.query("revisionId"));
|
|
6327
6327
|
if (!n || isNaN(n) || !r || isNaN(r)) return e.json({ error: "Invalid IDs" }, 400);
|
|
6328
|
-
let i = (await
|
|
6328
|
+
let i = (await X(t, "SELECT * FROM content_nodes WHERE id = ?", [n]))[0] || {}, a = (await X(t, "SELECT snapshotJson FROM node_revisions WHERE id = ? AND nodeId = ?", [r, n]))[0];
|
|
6329
6329
|
if (!a) return e.json({ error: "Revision not found" }, 404);
|
|
6330
6330
|
let o = {};
|
|
6331
6331
|
try {
|
|
@@ -6334,7 +6334,7 @@ J.get("/", async (e) => {
|
|
|
6334
6334
|
return e.json({ error: "Failed to parse snapshot" }, 500);
|
|
6335
6335
|
}
|
|
6336
6336
|
let s = typeof o.node?.dataJson == "string" ? JSON.parse(o.node.dataJson) : o.node?.dataJson || o.node || {};
|
|
6337
|
-
s = await
|
|
6337
|
+
s = await Yr(t, vi(s));
|
|
6338
6338
|
let c = {
|
|
6339
6339
|
...i,
|
|
6340
6340
|
nodeType: i.contentType,
|
|
@@ -6346,7 +6346,7 @@ J.get("/", async (e) => {
|
|
|
6346
6346
|
slug: o.node?.slug || i.slug
|
|
6347
6347
|
}, l = o.blocks || [], u = await Promise.all(l.map(async (e) => {
|
|
6348
6348
|
let n = typeof e.dataJson == "string" ? JSON.parse(e.dataJson || "{}") : e.dataJson || {};
|
|
6349
|
-
n = await
|
|
6349
|
+
n = await Yr(t, n);
|
|
6350
6350
|
let r = n.blockId || n._instanceId || (n.id && !String(n.id).startsWith("ast_") ? n.id : null) || e.instanceId || String(e.id), i = { ...n };
|
|
6351
6351
|
return delete i._instanceId, {
|
|
6352
6352
|
instanceId: String(r),
|
|
@@ -6361,25 +6361,25 @@ J.get("/", async (e) => {
|
|
|
6361
6361
|
blocks: u,
|
|
6362
6362
|
version: o.version
|
|
6363
6363
|
});
|
|
6364
|
-
}),
|
|
6364
|
+
}), Y.delete("/", async (e) => {
|
|
6365
6365
|
let t = e.get("db"), n = e.req.query("id");
|
|
6366
6366
|
if (!n) return e.json({ error: "Node ID required" }, 400);
|
|
6367
6367
|
let r = Number(n);
|
|
6368
|
-
return await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r),
|
|
6369
|
-
new
|
|
6368
|
+
return await t.prepare("UPDATE content_nodes SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(r), pi(e, async () => {
|
|
6369
|
+
new J(e.env).purgeNode(e, t, r, !0);
|
|
6370
6370
|
}), e.json({
|
|
6371
6371
|
success: !0,
|
|
6372
6372
|
deletedNodeId: r
|
|
6373
6373
|
});
|
|
6374
|
-
}),
|
|
6374
|
+
}), Y.post("/restore", async (e) => {
|
|
6375
6375
|
let t = e.get("db"), n = await e.req.json(), r = Number(n.id);
|
|
6376
|
-
return r ? await t.prepare("SELECT id FROM content_nodes WHERE id = ?").get(r) ? (await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r),
|
|
6377
|
-
new
|
|
6376
|
+
return r ? await t.prepare("SELECT id FROM content_nodes WHERE id = ?").get(r) ? (await t.prepare("UPDATE content_nodes SET deletedAt = NULL WHERE id = ?").run(r), pi(e, async () => {
|
|
6377
|
+
new J(e.env).purgeNode(e, t, r, !0);
|
|
6378
6378
|
}), e.json({
|
|
6379
6379
|
success: !0,
|
|
6380
6380
|
restoredNodeId: r
|
|
6381
6381
|
})) : e.json({ error: "Node not found" }, 404) : e.json({ error: "Node ID required" }, 400);
|
|
6382
|
-
}),
|
|
6382
|
+
}), Y.delete("/purge", async (e) => {
|
|
6383
6383
|
let t = e.get("db"), n = e.req.query("id");
|
|
6384
6384
|
if (!n) return e.json({ error: "Node ID required" }, 400);
|
|
6385
6385
|
let r = Number(n), i = [
|
|
@@ -6408,8 +6408,8 @@ J.get("/", async (e) => {
|
|
|
6408
6408
|
params: [r]
|
|
6409
6409
|
}
|
|
6410
6410
|
];
|
|
6411
|
-
return await t.batch(i),
|
|
6412
|
-
new
|
|
6411
|
+
return await t.batch(i), pi(e, async () => {
|
|
6412
|
+
new J(e.env).purgeNode(e, t, r, !0);
|
|
6413
6413
|
}), e.json({
|
|
6414
6414
|
success: !0,
|
|
6415
6415
|
purgedNodeId: r
|
|
@@ -6417,14 +6417,14 @@ J.get("/", async (e) => {
|
|
|
6417
6417
|
});
|
|
6418
6418
|
//#endregion
|
|
6419
6419
|
//#region server/routes/admin/trees.ts
|
|
6420
|
-
var
|
|
6421
|
-
function
|
|
6420
|
+
var bi = new n();
|
|
6421
|
+
function xi(e, t) {
|
|
6422
6422
|
let n = Promise.resolve(typeof t == "function" ? t() : t).catch((e) => console.error("[Background Task Error]:", e));
|
|
6423
6423
|
try {
|
|
6424
6424
|
e.executionCtx && typeof e.executionCtx.waitUntil == "function" && e.executionCtx.waitUntil(n);
|
|
6425
6425
|
} catch {}
|
|
6426
6426
|
}
|
|
6427
|
-
async function
|
|
6427
|
+
async function Z(e, t, n = []) {
|
|
6428
6428
|
let r = e.prepare(t);
|
|
6429
6429
|
if (typeof r.bind == "function") {
|
|
6430
6430
|
let e = await r.bind(...n).all();
|
|
@@ -6436,94 +6436,103 @@ async function X(e, t, n = []) {
|
|
|
6436
6436
|
}
|
|
6437
6437
|
return [];
|
|
6438
6438
|
}
|
|
6439
|
-
async function
|
|
6439
|
+
async function Q(e, t, n = []) {
|
|
6440
6440
|
let r = e.prepare(t);
|
|
6441
6441
|
if (typeof r.bind == "function") return r.bind(...n).run();
|
|
6442
6442
|
if (typeof r.run == "function") return r.run(...n);
|
|
6443
6443
|
}
|
|
6444
|
-
function
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6444
|
+
function Si(e, t = null, n = 0) {
|
|
6445
|
+
if (n > 50) return [];
|
|
6446
|
+
let r = [];
|
|
6447
|
+
for (let i = 0; i < e.length; i++) {
|
|
6448
|
+
let a = e[i];
|
|
6449
|
+
if (!a) continue;
|
|
6450
|
+
let o = a.treeNodeId || a.id || a.contentId;
|
|
6451
|
+
if (!o || typeof o == "string" && o.startsWith("draft-")) continue;
|
|
6452
|
+
let s = Number(o);
|
|
6453
|
+
isNaN(s) || (r.push({
|
|
6454
|
+
id: s,
|
|
6454
6455
|
parentId: t,
|
|
6455
|
-
sortOrder:
|
|
6456
|
-
}),
|
|
6456
|
+
sortOrder: i
|
|
6457
|
+
}), a.children && Array.isArray(a.children) && a.children.length > 0 && r.push(...Si(a.children, s, n + 1)));
|
|
6457
6458
|
}
|
|
6458
|
-
return
|
|
6459
|
+
return r;
|
|
6459
6460
|
}
|
|
6460
|
-
function
|
|
6461
|
+
function Ci(e) {
|
|
6461
6462
|
if (e == null || e === "null" || e === "" || e === 0 || e === "0" || typeof e == "string" && e.startsWith("draft-")) return null;
|
|
6462
6463
|
let t = Number(e);
|
|
6463
6464
|
return isNaN(t) ? null : t;
|
|
6464
6465
|
}
|
|
6465
|
-
function
|
|
6466
|
+
function wi(e) {
|
|
6466
6467
|
return +(e === !0 || e === 1 || e === "1" || e === "true");
|
|
6467
6468
|
}
|
|
6468
|
-
|
|
6469
|
+
bi.get("/tree.json", async (e) => {
|
|
6469
6470
|
try {
|
|
6470
6471
|
let t = e.get("db"), n = e.req.query("treeId") || "main-nav", r = e.req.query("preview") === "true", i = 1;
|
|
6471
6472
|
if (isNaN(Number(n))) {
|
|
6472
|
-
let e = await
|
|
6473
|
+
let e = await Z(t, "SELECT id FROM trees WHERE key = ?", [n]);
|
|
6473
6474
|
if (e[0] && e[0].id) i = Number(e[0].id);
|
|
6474
6475
|
else {
|
|
6475
|
-
let e = await
|
|
6476
|
+
let e = await Z(t, "SELECT id FROM trees LIMIT 1");
|
|
6476
6477
|
e[0] && e[0].id && (i = Number(e[0].id));
|
|
6477
6478
|
}
|
|
6478
6479
|
} else i = Number(n);
|
|
6479
|
-
let a = await
|
|
6480
|
+
let a = await Z(t, "\n SELECT \n t.id as treeNodeId,\n t.treeId,\n t.contentId,\n t.parentId,\n t.sortOrder,\n c.title,\n c.slug,\n c.language,\n c.contentType as nodeType,\n c.isHidden,\n c.status,\n c.publishedAt,\n c.dataJson,\n c.draftDataJson,\n (SELECT COUNT(*) FROM node_assets WHERE nodeId = t.contentId) as assetCount\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE t.treeId = ? AND (c.deletedAt IS NULL OR c.deletedAt = '')\n ORDER BY t.sortOrder ASC\n ", [i]), o = [], s = /* @__PURE__ */ new Set();
|
|
6480
6481
|
for (let e of a) {
|
|
6481
6482
|
let t = e.contentId;
|
|
6482
6483
|
s.has(t) || (s.add(t), o.push(e));
|
|
6483
6484
|
}
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6485
|
+
let c = /* @__PURE__ */ new Map();
|
|
6486
|
+
for (let e of o) {
|
|
6487
|
+
let t = !e.parentId || e.parentId === "null" || e.parentId === "" ? "__ROOT__" : String(e.parentId);
|
|
6488
|
+
c.has(t) || c.set(t, []), c.get(t).push(e);
|
|
6489
|
+
}
|
|
6490
|
+
function l(e = null, t = 0, n = /* @__PURE__ */ new Set()) {
|
|
6491
|
+
if (t > 50) return console.error("[CMS] Infinite loop aborted: Tree depth exceeded 50 levels."), [];
|
|
6492
|
+
let i = !e || e === "null" || e === "" ? "__ROOT__" : String(e);
|
|
6493
|
+
return (c.get(i) || []).map((e) => {
|
|
6494
|
+
let r = String(e.treeNodeId);
|
|
6495
|
+
if (n.has(r)) return console.warn(`[CMS] Cycle detected for treeNodeId: ${r}. Aborting branch.`), null;
|
|
6496
|
+
let i = new Set(n);
|
|
6497
|
+
i.add(r);
|
|
6498
|
+
let a = {}, o = e.draftDataJson || e.dataJson;
|
|
6499
|
+
if (o) try {
|
|
6500
|
+
let e = typeof o == "string" ? JSON.parse(o) : o;
|
|
6501
|
+
e && typeof e == "object" && (a = e, delete a._isTreeDraft, delete a._draftParentId, delete a.nodeType, delete a.contentType, delete a.title, delete a.slug, delete a.hidden, delete a.is_hidden, delete a.isHidden, delete a.status);
|
|
6493
6502
|
} catch {}
|
|
6494
|
-
let { dataJson:
|
|
6495
|
-
...
|
|
6496
|
-
...
|
|
6497
|
-
},
|
|
6503
|
+
let { dataJson: s, draftDataJson: c, ...u } = e, d = {
|
|
6504
|
+
...u,
|
|
6505
|
+
...a
|
|
6506
|
+
}, f = Number(e.isHidden) === 1 || d.hidden === !0 || d.hidden === 1 || d.hidden === "true", p = (e.status === "draft" || !e.status) && !!e.publishedAt;
|
|
6498
6507
|
return {
|
|
6499
|
-
...
|
|
6508
|
+
...d,
|
|
6500
6509
|
id: e.contentId,
|
|
6501
6510
|
treeNodeId: e.treeNodeId,
|
|
6502
6511
|
parentId: e.parentId || null,
|
|
6503
6512
|
language: e.language || "en",
|
|
6504
|
-
hidden: +!!
|
|
6505
|
-
isHidden:
|
|
6513
|
+
hidden: +!!f,
|
|
6514
|
+
isHidden: f,
|
|
6506
6515
|
status: e.status || "draft",
|
|
6507
6516
|
publishedAt: e.publishedAt || null,
|
|
6508
|
-
hasUnpublishedChanges:
|
|
6517
|
+
hasUnpublishedChanges: p,
|
|
6509
6518
|
assetCount: e.assetCount || 0,
|
|
6510
|
-
children:
|
|
6519
|
+
children: l(e.treeNodeId, t + 1, i)
|
|
6511
6520
|
};
|
|
6512
|
-
}).filter((e) => r || !e.hidden);
|
|
6521
|
+
}).filter((e) => e !== null && (r || !e.hidden));
|
|
6513
6522
|
}
|
|
6514
|
-
return e.json(
|
|
6523
|
+
return e.json(l(null));
|
|
6515
6524
|
} catch (t) {
|
|
6516
6525
|
return console.error("[CMS Tree API] GET Error:", t), e.json({ error: t.message || "Failed to fetch tree" }, 500);
|
|
6517
6526
|
}
|
|
6518
|
-
}),
|
|
6527
|
+
}), bi.post("/tree.json", async (e) => {
|
|
6519
6528
|
try {
|
|
6520
6529
|
let t = e.get("db"), n = await e.req.json(), r = n.treeId ? String(n.treeId).trim() : "main-nav", i = 1;
|
|
6521
6530
|
if (isNaN(Number(r))) {
|
|
6522
|
-
let e = await
|
|
6531
|
+
let e = await Z(t, "SELECT id FROM trees WHERE key = ?", [r]);
|
|
6523
6532
|
e[0] && e[0].id && (i = Number(e[0].id));
|
|
6524
6533
|
} else i = Number(r);
|
|
6525
6534
|
if (n.tree && Array.isArray(n.tree)) {
|
|
6526
|
-
let r =
|
|
6535
|
+
let r = Si(n.tree, null);
|
|
6527
6536
|
if (r.length > 0) {
|
|
6528
6537
|
let e = r.map((e) => ({
|
|
6529
6538
|
sql: "UPDATE tree_nodes SET parentId = ?, sortOrder = ? WHERE id = ? AND treeId = ?",
|
|
@@ -6536,16 +6545,16 @@ xi.get("/tree.json", async (e) => {
|
|
|
6536
6545
|
}));
|
|
6537
6546
|
await t.batch(e);
|
|
6538
6547
|
}
|
|
6539
|
-
return
|
|
6540
|
-
await
|
|
6548
|
+
return xi(e, async () => {
|
|
6549
|
+
await q(e).clear(), new J(e.env).purgeGlobalCache(e, t);
|
|
6541
6550
|
}), e.json({
|
|
6542
6551
|
success: !0,
|
|
6543
6552
|
reorderedCount: r.length
|
|
6544
6553
|
});
|
|
6545
6554
|
}
|
|
6546
|
-
let { action: a, title: o, nodeType: s, parentId: c, contentId: l, nodeData: u = {}, pageData: d = {} } = n, f = Object.keys(u).length > 0 ? { ...u } : { ...d }, p =
|
|
6555
|
+
let { action: a, title: o, nodeType: s, parentId: c, contentId: l, nodeData: u = {}, pageData: d = {} } = n, f = Object.keys(u).length > 0 ? { ...u } : { ...d }, p = wi(n.isHidden === void 0 ? f.isHidden === void 0 ? f.hidden : f.isHidden : n.isHidden);
|
|
6547
6556
|
delete f._isTreeDraft, delete f._draftParentId, delete f.isNew, delete f.nodeType, delete f.contentType, delete f.title, delete f.slug, delete f.hidden, delete f.is_hidden, delete f.isHidden, delete f.status;
|
|
6548
|
-
let m =
|
|
6557
|
+
let m = Ci(c), h = e.get("user")?.id || null;
|
|
6549
6558
|
if (a === "create") {
|
|
6550
6559
|
let r = f.slug || n.slug || o, a = r ? String(r).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") : null;
|
|
6551
6560
|
if (a) {
|
|
@@ -6556,24 +6565,24 @@ xi.get("/tree.json", async (e) => {
|
|
|
6556
6565
|
a
|
|
6557
6566
|
]);
|
|
6558
6567
|
let s = n.contentId || n.id ? Number(n.contentId || n.id) : null;
|
|
6559
|
-
if (s && !isNaN(s) && (r += " AND cn.id != ?", o.push(s)), r += " LIMIT 1", (await
|
|
6568
|
+
if (s && !isNaN(s) && (r += " AND cn.id != ?", o.push(s)), r += " LIMIT 1", (await Z(t, r, o)).length > 0) return e.json({
|
|
6560
6569
|
error: `The slug '${a}' is already in use by another page in this section.`,
|
|
6561
6570
|
field: "slug"
|
|
6562
6571
|
}, 409);
|
|
6563
6572
|
}
|
|
6564
6573
|
let c = JSON.stringify(f), l = await t.prepare("\n INSERT INTO content_nodes (contentType, title, slug, language, isHidden, status, draftDataJson, dataJson, createdById, updatedById)\n VALUES (?, ?, ?, ?, ?, 'draft', ?, NULL, ?, ?)\n ").run(s || "page", o || "Untitled", a, f.language || n.language || "en", p, c, h, h), u = Number(l.lastInsertRowid);
|
|
6565
|
-
await
|
|
6574
|
+
await Q(t, "DELETE FROM tree_nodes WHERE treeId = ? AND contentId = ?", [i, u]);
|
|
6566
6575
|
let d = [];
|
|
6567
|
-
d = m === null ? await
|
|
6576
|
+
d = m === null ? await Z(t, "SELECT COALESCE(MAX(sortOrder), -1) + 1 as nextSort FROM tree_nodes WHERE treeId = ? AND parentId IS NULL", [i]) : await Z(t, "SELECT COALESCE(MAX(sortOrder), -1) + 1 as nextSort FROM tree_nodes WHERE treeId = ? AND parentId = ?", [i, m]);
|
|
6568
6577
|
let g = d[0]?.nextSort ?? 0, _ = await t.prepare("\n INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder)\n VALUES (?, ?, ?, ?)\n ").run(i, u, m, g), v = Number(_.lastInsertRowid), y = [];
|
|
6569
6578
|
n.channels && Array.isArray(n.channels) ? y = n.channels : n.channelId && n.channelId !== "all" && (y = [n.channelId]);
|
|
6570
6579
|
let b = [...new Set(y)].filter((e) => e && e !== "all").map((e) => Number(e));
|
|
6571
6580
|
if (b.length > 0) {
|
|
6572
6581
|
let e = b.map(() => "(?, ?)").join(", "), n = b.flatMap((e) => [u, e]);
|
|
6573
|
-
await
|
|
6582
|
+
await Q(t, `INSERT OR IGNORE INTO node_channels (nodeId, channelId) VALUES ${e}`, n);
|
|
6574
6583
|
}
|
|
6575
|
-
return
|
|
6576
|
-
await
|
|
6584
|
+
return xi(e, async () => {
|
|
6585
|
+
await q(e).clear(), new J(e.env).purgeGlobalCache(e, t);
|
|
6577
6586
|
}), e.json({
|
|
6578
6587
|
success: !0,
|
|
6579
6588
|
id: u,
|
|
@@ -6583,7 +6592,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
6583
6592
|
}
|
|
6584
6593
|
if (a === "attach") {
|
|
6585
6594
|
if (!l) return e.json({ error: "contentId is required for attach" }, 400);
|
|
6586
|
-
let n = (await
|
|
6595
|
+
let n = (await Z(t, "SELECT slug FROM content_nodes WHERE id = ?", [l]))[0];
|
|
6587
6596
|
if (n && n.slug) {
|
|
6588
6597
|
let r = "", a = [];
|
|
6589
6598
|
if (m === null ? (r = "\n SELECT 1 \n FROM tree_nodes tn\n INNER JOIN content_nodes cn ON tn.contentId = cn.id\n WHERE tn.treeId = ? \n AND tn.parentId IS NULL\n AND cn.slug = ?\n AND cn.id != ?\n AND (cn.deletedAt IS NULL OR cn.deletedAt = '')\n LIMIT 1\n ", a = [
|
|
@@ -6595,15 +6604,15 @@ xi.get("/tree.json", async (e) => {
|
|
|
6595
6604
|
m,
|
|
6596
6605
|
n.slug,
|
|
6597
6606
|
l
|
|
6598
|
-
]), (await
|
|
6607
|
+
]), (await Z(t, r, a)).length > 0) return e.json({
|
|
6599
6608
|
error: `Cannot attach. The slug '${n.slug}' is already in use by another page in this section.`,
|
|
6600
6609
|
field: "slug"
|
|
6601
6610
|
}, 409);
|
|
6602
6611
|
}
|
|
6603
|
-
await
|
|
6612
|
+
await Q(t, "DELETE FROM tree_nodes WHERE treeId = ? AND contentId = ?", [i, l]);
|
|
6604
6613
|
let r = await t.prepare("\n INSERT INTO tree_nodes (treeId, contentId, parentId, sortOrder)\n VALUES (?, ?, ?, 0)\n ").run(i, l, m), a = Number(r.lastInsertRowid);
|
|
6605
|
-
return
|
|
6606
|
-
await
|
|
6614
|
+
return xi(e, async () => {
|
|
6615
|
+
await q(e).clear(), new J(e.env).purgeGlobalCache(e, t);
|
|
6607
6616
|
}), e.json({
|
|
6608
6617
|
success: !0,
|
|
6609
6618
|
treeNodeId: a
|
|
@@ -6611,18 +6620,18 @@ xi.get("/tree.json", async (e) => {
|
|
|
6611
6620
|
}
|
|
6612
6621
|
if (a === "detach") {
|
|
6613
6622
|
let r = n.treeNodeId || n.contentId;
|
|
6614
|
-
return r ? (await
|
|
6623
|
+
return r ? (await Q(t, "\n UPDATE tree_nodes \n SET parentId = (SELECT parentId FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?) \n WHERE parentId = ? AND treeId = ?\n ", [
|
|
6615
6624
|
r,
|
|
6616
6625
|
r,
|
|
6617
6626
|
i,
|
|
6618
6627
|
r,
|
|
6619
6628
|
i
|
|
6620
|
-
]), await
|
|
6629
|
+
]), await Q(t, "DELETE FROM tree_nodes WHERE (id = ? OR contentId = ?) AND treeId = ?", [
|
|
6621
6630
|
r,
|
|
6622
6631
|
r,
|
|
6623
6632
|
i
|
|
6624
|
-
]),
|
|
6625
|
-
await
|
|
6633
|
+
]), xi(e, async () => {
|
|
6634
|
+
await q(e).clear(), new J(e.env).purgeGlobalCache(e, t);
|
|
6626
6635
|
}), e.json({ success: !0 })) : e.json({ error: "treeNodeId or contentId required for detach" }, 400);
|
|
6627
6636
|
}
|
|
6628
6637
|
return e.json({ error: "Invalid payload or action" }, 400);
|
|
@@ -6632,9 +6641,9 @@ xi.get("/tree.json", async (e) => {
|
|
|
6632
6641
|
details: t.message
|
|
6633
6642
|
}, 500);
|
|
6634
6643
|
}
|
|
6635
|
-
}),
|
|
6644
|
+
}), bi.get("/trees.json", async (e) => {
|
|
6636
6645
|
try {
|
|
6637
|
-
let t = e.get("db"), n = await
|
|
6646
|
+
let t = e.get("db"), n = await Z(t, "SELECT * FROM trees ORDER BY LOWER(label) ASC"), r = (await Z(t, "SELECT channelId, treeId FROM channel_trees")).reduce((e, t) => {
|
|
6638
6647
|
let n = Number(t.treeId), r = Number(t.channelId);
|
|
6639
6648
|
return e[n] || (e[n] = []), e[n].includes(r) || e[n].push(r), e;
|
|
6640
6649
|
}, {}), i = n.map((e) => {
|
|
@@ -6662,15 +6671,15 @@ xi.get("/tree.json", async (e) => {
|
|
|
6662
6671
|
} catch {
|
|
6663
6672
|
return e.json([]);
|
|
6664
6673
|
}
|
|
6665
|
-
}),
|
|
6674
|
+
}), bi.post("/trees.json", async (e) => {
|
|
6666
6675
|
try {
|
|
6667
6676
|
let t = e.get("db"), n = await e.req.json(), r = n.id, i = r != null && r !== "" && !isNaN(Number(r)) ? Number(r) : null, a = `tree-${Date.now().toString(36)}`, o = (n.key || n.slug || a).toLowerCase().replace(/[^a-z0-9_-]/g, "-"), s = n.label?.trim() || o, c = n.treeType !== void 0 && n.treeType !== null ? n.treeType : n.type ?? "site", l = n.channelId !== void 0 && n.channelId !== null && Number(n.channelId) || null, u = +(n.isHidden === !0 || n.isHidden === 1 || n.isHidden === "true"), d = e.get("user")?.id || null, f = { ...n };
|
|
6668
|
-
if (delete f.id, delete f.key, delete f.label, delete f.treeType, delete f.type, delete f.channelId, delete f.channels, delete f.isHidden, delete f.createdById, delete f.updatedById, delete f.createdAt, delete f.updatedAt, (await
|
|
6677
|
+
if (delete f.id, delete f.key, delete f.label, delete f.treeType, delete f.type, delete f.channelId, delete f.channels, delete f.isHidden, delete f.createdById, delete f.updatedById, delete f.createdAt, delete f.updatedAt, (await Z(t, "SELECT id FROM trees WHERE key = ? AND id != ? LIMIT 1", [o, i ?? -1])).length > 0) return e.json({
|
|
6669
6678
|
error: `Tree API key "${o}" is already in use.`,
|
|
6670
6679
|
field: "key"
|
|
6671
6680
|
}, 409);
|
|
6672
6681
|
let p = i;
|
|
6673
|
-
if (i) await
|
|
6682
|
+
if (i) await Q(t, "\n UPDATE trees \n SET key = ?, label = ?, treeType = ?, channelId = ?, isHidden = ?, dataJson = ?, updatedById = ?, updatedAt = CURRENT_TIMESTAMP\n WHERE id = ?\n ", [
|
|
6674
6683
|
o,
|
|
6675
6684
|
s,
|
|
6676
6685
|
c,
|
|
@@ -6685,7 +6694,7 @@ xi.get("/tree.json", async (e) => {
|
|
|
6685
6694
|
p = Number(e.lastInsertRowid);
|
|
6686
6695
|
}
|
|
6687
6696
|
if (n.channels !== void 0 && Array.isArray(n.channels) && p) {
|
|
6688
|
-
await
|
|
6697
|
+
await Q(t, "DELETE FROM channel_trees WHERE treeId = ?", [p]);
|
|
6689
6698
|
let e = [...new Set(n.channels)].filter((e) => e && e !== "all").map((e) => Number(e) || e);
|
|
6690
6699
|
if (e.length > 0) {
|
|
6691
6700
|
let n = e.map(() => "(?, ?, ?)").join(", "), r = e.flatMap((e) => [
|
|
@@ -6693,11 +6702,11 @@ xi.get("/tree.json", async (e) => {
|
|
|
6693
6702
|
p,
|
|
6694
6703
|
"main"
|
|
6695
6704
|
]);
|
|
6696
|
-
await
|
|
6705
|
+
await Q(t, `INSERT OR IGNORE INTO channel_trees (channelId, treeId, key) VALUES ${n}`, r);
|
|
6697
6706
|
}
|
|
6698
6707
|
}
|
|
6699
|
-
return
|
|
6700
|
-
await
|
|
6708
|
+
return xi(e, async () => {
|
|
6709
|
+
await q(e).clear(), new J(e.env).purgeGlobalCache(e, t);
|
|
6701
6710
|
}), e.json({
|
|
6702
6711
|
success: !0,
|
|
6703
6712
|
id: p,
|
|
@@ -6712,13 +6721,13 @@ xi.get("/tree.json", async (e) => {
|
|
|
6712
6721
|
} catch (t) {
|
|
6713
6722
|
return console.error("[API Trees] Error saving tree:", t), e.json({ error: t.message || "Failed to save tree" }, 500);
|
|
6714
6723
|
}
|
|
6715
|
-
}),
|
|
6724
|
+
}), bi.delete("/trees.json", async (e) => {
|
|
6716
6725
|
let t = e.get("db"), n = e.req.query("id");
|
|
6717
6726
|
if (!n) return e.json({ error: "Tree ID required" }, 400);
|
|
6718
6727
|
let r = Number(n);
|
|
6719
6728
|
try {
|
|
6720
|
-
return await
|
|
6721
|
-
await
|
|
6729
|
+
return await Q(t, "DELETE FROM trees WHERE id = ?", [r]), await Q(t, "DELETE FROM channel_trees WHERE treeId = ?", [r]), await Q(t, "DELETE FROM tree_nodes WHERE treeId = ?", [r]), xi(e, async () => {
|
|
6730
|
+
await q(e).clear(), new J(e.env).purgeGlobalCache(e, t);
|
|
6722
6731
|
}), e.json({
|
|
6723
6732
|
success: !0,
|
|
6724
6733
|
deletedTreeId: r
|
|
@@ -6729,8 +6738,8 @@ xi.get("/tree.json", async (e) => {
|
|
|
6729
6738
|
});
|
|
6730
6739
|
//#endregion
|
|
6731
6740
|
//#region server/routes/admin/channels.ts
|
|
6732
|
-
var
|
|
6733
|
-
|
|
6741
|
+
var Ti = new n();
|
|
6742
|
+
Ti.get("/", async (e) => {
|
|
6734
6743
|
try {
|
|
6735
6744
|
let t = e.get("db"), n = await t.prepare("SELECT * FROM channels ORDER BY id ASC").all(), r = Array.isArray(n) ? n : n?.results || [], i = await t.prepare("SELECT channelId, treeId, key, metaJson FROM channel_trees ORDER BY rowid ASC").all(), a = ((Array.isArray(i) ? i : i?.results || []) || []).reduce((e, t) => {
|
|
6736
6745
|
e[t.channelId] || (e[t.channelId] = []);
|
|
@@ -6754,7 +6763,7 @@ Ei.get("/", async (e) => {
|
|
|
6754
6763
|
isHidden: !!e.isHidden,
|
|
6755
6764
|
trees: a[e.id] || []
|
|
6756
6765
|
};
|
|
6757
|
-
}), s = e.get("schemas")?.rawChannels || {}, c = e.env?.BUNDLED_DEFINITIONS, l =
|
|
6766
|
+
}), s = e.get("schemas")?.rawChannels || {}, c = e.env?.BUNDLED_DEFINITIONS, l = Pr(c), u = l?.channelTemplate || Object.values(s)[0] || {
|
|
6758
6767
|
label: "Channel Settings",
|
|
6759
6768
|
fields: {
|
|
6760
6769
|
key: {
|
|
@@ -6798,7 +6807,7 @@ Ei.get("/", async (e) => {
|
|
|
6798
6807
|
error: t.message
|
|
6799
6808
|
}, 500);
|
|
6800
6809
|
}
|
|
6801
|
-
}),
|
|
6810
|
+
}), Ti.post("/", async (e) => {
|
|
6802
6811
|
try {
|
|
6803
6812
|
let t = e.get("db"), n = await e.req.json(), r = n.id, i = r != null && r !== "" && !isNaN(Number(r)) ? Number(r) : null, { key: a, label: o, channelType: s, domain: c, baseUrl: l, defaultLanguage: u, isHidden: d = !1, trees: f = [], createdById: p = null, updatedById: m = null, id: h, createdAt: g, updatedAt: _, ...v } = n, y = a?.trim() || "main", b = o?.trim() || "Untitled Channel", x = s ?? "website", S = c ?? "localhost", C = l ?? "http://localhost:4321", w = u ?? "en", T = JSON.stringify(v || {}), E = e.get("user")?.id || m || p, D = E === void 0 ? null : E;
|
|
6804
6813
|
if (await t.prepare("SELECT id FROM channels WHERE key = ? AND id != ? LIMIT 1").get(y, i ?? -1)) return e.json({
|
|
@@ -6828,7 +6837,7 @@ Ei.get("/", async (e) => {
|
|
|
6828
6837
|
VALUES ${r}
|
|
6829
6838
|
`).run(...i);
|
|
6830
6839
|
}
|
|
6831
|
-
return await
|
|
6840
|
+
return await q(e).clear(), new J(e.env).purgeGlobalCache(e, t), e.json({
|
|
6832
6841
|
success: !0,
|
|
6833
6842
|
id: O
|
|
6834
6843
|
});
|
|
@@ -6838,12 +6847,12 @@ Ei.get("/", async (e) => {
|
|
|
6838
6847
|
details: t.message
|
|
6839
6848
|
}, 500);
|
|
6840
6849
|
}
|
|
6841
|
-
}),
|
|
6850
|
+
}), Ti.delete("/", async (e) => {
|
|
6842
6851
|
let t = e.get("db"), n = e.req.query("id");
|
|
6843
6852
|
if (!n) return e.json({ error: "Channel ID required" }, 400);
|
|
6844
6853
|
let r = Number(n);
|
|
6845
6854
|
try {
|
|
6846
|
-
return await t.prepare("DELETE FROM channel_trees WHERE channelId = ?").run(r), await t.prepare("DELETE FROM node_channels WHERE channelId = ?").run(r), await t.prepare("DELETE FROM channels WHERE id = ?").run(r), await
|
|
6855
|
+
return await t.prepare("DELETE FROM channel_trees WHERE channelId = ?").run(r), await t.prepare("DELETE FROM node_channels WHERE channelId = ?").run(r), await t.prepare("DELETE FROM channels WHERE id = ?").run(r), await q(e).clear(), new J(e.env).purgeGlobalCache(e, t), e.json({
|
|
6847
6856
|
success: !0,
|
|
6848
6857
|
deletedSiteId: r
|
|
6849
6858
|
});
|
|
@@ -6856,7 +6865,7 @@ Ei.get("/", async (e) => {
|
|
|
6856
6865
|
});
|
|
6857
6866
|
//#endregion
|
|
6858
6867
|
//#region server/db/bundled-definitions.ts
|
|
6859
|
-
var
|
|
6868
|
+
var Ei = {
|
|
6860
6869
|
nodes: {
|
|
6861
6870
|
address: {
|
|
6862
6871
|
id: "address",
|
|
@@ -11554,11 +11563,11 @@ var Di = {
|
|
|
11554
11563
|
treeTemplate: null,
|
|
11555
11564
|
channelTemplate: null,
|
|
11556
11565
|
userTemplate: null
|
|
11557
|
-
},
|
|
11566
|
+
}, Di = new n(), Oi = null, ki = (e) => {
|
|
11558
11567
|
try {
|
|
11559
11568
|
let t = typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
11560
|
-
if (!
|
|
11561
|
-
let t = e.env?.BUNDLED_DEFINITIONS ||
|
|
11569
|
+
if (!Oi || t) {
|
|
11570
|
+
let t = e.env?.BUNDLED_DEFINITIONS || Ei || {}, n = Pr(t) || {}, r = e.get("schemas") || {}, i = r.rawChannels || {}, a = r.rawNodes || {}, o = r.rawTrees || {}, s = r.rawBlocks || {}, c = r.rawNodeLayouts || {}, l = r.rawBlockLayouts || {}, u = t.rawChannels || t.channels || n.channels || {}, d = t.rawNodes || t.nodes || n.nodes || {}, f = t.rawTrees || t.trees || n.trees || {}, p = t.rawBlocks || t.blocks || n.blocks || {}, m = t.rawNodeLayouts || t.nodeLayouts || n.nodeLayouts || {}, h = t.rawBlockLayouts || t.blockLayouts || n.blockLayouts || {}, g = Object.keys(i).length > 0 ? i : u, _ = Object.keys(a).length > 0 ? a : d, v = Object.keys(o).length > 0 ? o : f, y = Object.keys(s).length > 0 ? s : p, b = Object.keys(c).length > 0 ? c : m, x = Object.keys(l).length > 0 ? l : h, S = n.userTemplate || {
|
|
11562
11571
|
id: "userTemplate",
|
|
11563
11572
|
label: "User Account",
|
|
11564
11573
|
fields: {
|
|
@@ -11594,7 +11603,7 @@ var Di = {
|
|
|
11594
11603
|
}
|
|
11595
11604
|
}
|
|
11596
11605
|
}, C = Object.keys(g)[0];
|
|
11597
|
-
|
|
11606
|
+
Oi = {
|
|
11598
11607
|
channelTemplate: n.channelTemplate || (C ? g[C] : null),
|
|
11599
11608
|
treeTemplate: n.treeTemplate || null,
|
|
11600
11609
|
userTemplate: S,
|
|
@@ -11609,7 +11618,7 @@ var Di = {
|
|
|
11609
11618
|
blockLayouts: x
|
|
11610
11619
|
};
|
|
11611
11620
|
}
|
|
11612
|
-
return e.json(
|
|
11621
|
+
return e.json(Oi, 200, { "Cache-Control": "no-cache, no-store, must-revalidate" });
|
|
11613
11622
|
} catch (t) {
|
|
11614
11623
|
return console.error("[CMS API] Error loading schemas:", t), e.json({
|
|
11615
11624
|
error: "Failed to load schemas",
|
|
@@ -11617,10 +11626,10 @@ var Di = {
|
|
|
11617
11626
|
}, 500);
|
|
11618
11627
|
}
|
|
11619
11628
|
};
|
|
11620
|
-
|
|
11629
|
+
Di.get("/", ki), Di.get("/schemas.json", ki);
|
|
11621
11630
|
//#endregion
|
|
11622
11631
|
//#region server/routes/admin/validation.ts
|
|
11623
|
-
var
|
|
11632
|
+
var Ai = new n(), ji = {
|
|
11624
11633
|
node: "content_nodes",
|
|
11625
11634
|
nodes: "content_nodes",
|
|
11626
11635
|
content_node: "content_nodes",
|
|
@@ -11632,7 +11641,7 @@ var ji = new n(), Mi = {
|
|
|
11632
11641
|
user: "users",
|
|
11633
11642
|
users: "users",
|
|
11634
11643
|
user_account: "user_accounts"
|
|
11635
|
-
},
|
|
11644
|
+
}, Mi = {
|
|
11636
11645
|
content_nodes: [
|
|
11637
11646
|
"id",
|
|
11638
11647
|
"title",
|
|
@@ -11689,11 +11698,11 @@ var ji = new n(), Mi = {
|
|
|
11689
11698
|
"createdAt"
|
|
11690
11699
|
]
|
|
11691
11700
|
};
|
|
11692
|
-
|
|
11701
|
+
Ai.post("/validate-unique", async (e) => {
|
|
11693
11702
|
try {
|
|
11694
11703
|
let t = e.get("db"), { entityType: n, field: r, value: i, excludeId: a } = await e.req.json();
|
|
11695
11704
|
if (!r || i == null || String(i).trim() === "") return e.json({ isUnique: !0 });
|
|
11696
|
-
let o =
|
|
11705
|
+
let o = ji[n] || "content_nodes", s = r.replace(/[^a-zA-Z0-9_]/g, ""), c = (Mi[o] || Mi.content_nodes).includes(s), l = -1;
|
|
11697
11706
|
if (a != null && String(a).trim() !== "") {
|
|
11698
11707
|
let e = Number(a);
|
|
11699
11708
|
l = isNaN(e) ? String(a) : e;
|
|
@@ -11705,7 +11714,7 @@ ji.post("/validate-unique", async (e) => {
|
|
|
11705
11714
|
} catch (t) {
|
|
11706
11715
|
return console.error("[API Validation] Error validating global uniqueness:", t), e.json({ error: "Failed to validate uniqueness" }, 500);
|
|
11707
11716
|
}
|
|
11708
|
-
}),
|
|
11717
|
+
}), Ai.post("/validate-unique-sibling", async (e) => {
|
|
11709
11718
|
try {
|
|
11710
11719
|
let t = e.get("db"), { slug: n, treeId: r, parentId: i, excludeTreeNodeId: a } = await e.req.json();
|
|
11711
11720
|
if (!n || !String(n).trim() || !r) return e.json({ isUnique: !0 });
|
|
@@ -11733,8 +11742,8 @@ ji.post("/validate-unique", async (e) => {
|
|
|
11733
11742
|
});
|
|
11734
11743
|
//#endregion
|
|
11735
11744
|
//#region server/routes/admin/stats.ts
|
|
11736
|
-
var
|
|
11737
|
-
|
|
11745
|
+
var Ni = new n();
|
|
11746
|
+
Ni.get("/", async (e) => {
|
|
11738
11747
|
try {
|
|
11739
11748
|
let t = e.get("db"), n = await t.prepare("\n SELECT \n COUNT(*) as total,\n SUM(CASE WHEN isHidden = 0 THEN 1 ELSE 0 END) as published,\n SUM(CASE WHEN isHidden = 1 THEN 1 ELSE 0 END) as hidden\n FROM content_nodes\n ").get(), r = Number(n?.total) || 0, i = Number(n?.published) || 0, a = Number(n?.hidden) || 0, o = await t.prepare("\n SELECT \n (SELECT COUNT(*) FROM channels) as totalChannels,\n (SELECT COUNT(*) FROM trees) as totalTrees,\n (SELECT COUNT(*) FROM users) as totalUsers\n ").get(), s = await t.prepare("\n SELECT contentType as type, COUNT(*) as count \n FROM content_nodes \n GROUP BY contentType \n ORDER BY count DESC\n ").all(), c = Array.isArray(s) ? s : s?.results || [], l = await t.prepare("\n SELECT id, title, slug, contentType, isHidden, status, updatedAt \n FROM content_nodes \n ORDER BY updatedAt DESC \n LIMIT 5\n ").all(), u = (Array.isArray(l) ? l : l?.results || []).map((e) => ({
|
|
11740
11749
|
...e,
|
|
@@ -11749,7 +11758,7 @@ Pi.get("/", async (e) => {
|
|
|
11749
11758
|
isHidden: !!e.isHidden,
|
|
11750
11759
|
channelNames: e.channelLabels ? e.channelLabels.split(",") : [],
|
|
11751
11760
|
treeNames: e.treeLabels ? e.treeLabels.split(",") : []
|
|
11752
|
-
})), p = e.env?.BUNDLED_DEFINITIONS, m =
|
|
11761
|
+
})), p = e.env?.BUNDLED_DEFINITIONS, m = Pr(p), h = m.nodes || m.nodeSchemas || {}, g = c.map((e) => {
|
|
11753
11762
|
let t = e.type || "node", n = h[t]?.label || t.charAt(0).toUpperCase() + t.slice(1);
|
|
11754
11763
|
return {
|
|
11755
11764
|
type: t,
|
|
@@ -11777,7 +11786,7 @@ Pi.get("/", async (e) => {
|
|
|
11777
11786
|
});
|
|
11778
11787
|
//#endregion
|
|
11779
11788
|
//#region server/storage/provider.ts
|
|
11780
|
-
function
|
|
11789
|
+
function Pi(e) {
|
|
11781
11790
|
let t = e.split(".").pop()?.toLowerCase() || "bin";
|
|
11782
11791
|
return t = t.replace(/[^a-z0-9]/g, ""), [
|
|
11783
11792
|
"php",
|
|
@@ -11792,14 +11801,14 @@ function Fi(e) {
|
|
|
11792
11801
|
"cjs"
|
|
11793
11802
|
].includes(t) ? "bin" : t;
|
|
11794
11803
|
}
|
|
11795
|
-
var
|
|
11804
|
+
var Fi = class {
|
|
11796
11805
|
bucket;
|
|
11797
11806
|
publicDomain;
|
|
11798
11807
|
constructor(e, t) {
|
|
11799
11808
|
this.bucket = e, this.publicDomain = t;
|
|
11800
11809
|
}
|
|
11801
11810
|
async upload(e, t = "uploads") {
|
|
11802
|
-
let n =
|
|
11811
|
+
let n = Pi(e.name), r = `${t}/${crypto.randomUUID().replace(/-/g, "")}.${n}`;
|
|
11803
11812
|
return await this.bucket.put(r, e.stream(), { httpMetadata: { contentType: e.type } }), {
|
|
11804
11813
|
key: r,
|
|
11805
11814
|
url: `/media/${r.replace(/^\//, "")}`
|
|
@@ -11808,7 +11817,7 @@ var Ii = class {
|
|
|
11808
11817
|
async delete(e) {
|
|
11809
11818
|
await this.bucket.delete(e);
|
|
11810
11819
|
}
|
|
11811
|
-
},
|
|
11820
|
+
}, Ii = class {
|
|
11812
11821
|
customStoragePath;
|
|
11813
11822
|
constructor(e) {
|
|
11814
11823
|
this.customStoragePath = e;
|
|
@@ -11826,7 +11835,7 @@ var Ii = class {
|
|
|
11826
11835
|
), { pipeline: a } = await import(
|
|
11827
11836
|
/* @vite-ignore */
|
|
11828
11837
|
"node:stream/promises"
|
|
11829
|
-
), o =
|
|
11838
|
+
), o = Pi(e.name), s = `${t}/${crypto.randomUUID().replace(/-/g, "")}.${o}`, c = this.customStoragePath || "./public/media", l = n.resolve(process.cwd(), c), u = n.join(l, s);
|
|
11830
11839
|
await i.mkdir(n.dirname(u), { recursive: !0 });
|
|
11831
11840
|
let d = r.createWriteStream(u);
|
|
11832
11841
|
return await a(e.stream(), d), {
|
|
@@ -11849,43 +11858,26 @@ var Ii = class {
|
|
|
11849
11858
|
}
|
|
11850
11859
|
}
|
|
11851
11860
|
};
|
|
11852
|
-
function
|
|
11861
|
+
function Li(e) {
|
|
11853
11862
|
if (e.MEDIA_BUCKET) {
|
|
11854
11863
|
let t = e.CDN_DOMAIN || "cdn.yourdomain.com";
|
|
11855
|
-
return new
|
|
11864
|
+
return new Fi(e.MEDIA_BUCKET, t);
|
|
11856
11865
|
}
|
|
11857
|
-
return new
|
|
11866
|
+
return new Ii(e.LOCAL_MEDIA_PATH);
|
|
11858
11867
|
}
|
|
11859
11868
|
//#endregion
|
|
11860
11869
|
//#region server/routes/admin/assets.ts
|
|
11861
|
-
var
|
|
11862
|
-
|
|
11863
|
-
let r = e.prepare(t);
|
|
11864
|
-
if (typeof r.bind == "function") {
|
|
11865
|
-
let e = await r.bind(...n).all();
|
|
11866
|
-
return e?.results || e || [];
|
|
11867
|
-
}
|
|
11868
|
-
if (typeof r.all == "function") {
|
|
11869
|
-
let e = await r.all(...n);
|
|
11870
|
-
return Array.isArray(e) ? e : e?.results || [];
|
|
11871
|
-
}
|
|
11872
|
-
return [];
|
|
11873
|
-
}
|
|
11874
|
-
async function Bi(e, t, n = []) {
|
|
11875
|
-
let r = e.prepare(t);
|
|
11876
|
-
if (typeof r.bind == "function") return await r.bind(...n).run();
|
|
11877
|
-
if (typeof r.run == "function") return await r.run(...n);
|
|
11878
|
-
}
|
|
11879
|
-
function Vi(e, t) {
|
|
11870
|
+
var Ri = new n();
|
|
11871
|
+
function zi(e, t) {
|
|
11880
11872
|
let n = e || (t ? `/media/${t}` : "");
|
|
11881
11873
|
try {
|
|
11882
11874
|
n.startsWith("http") && (n = new URL(n).pathname);
|
|
11883
11875
|
} catch {}
|
|
11884
11876
|
return n.startsWith("/media/") || (n = `/media/${n.replace(/^\/+/, "")}`), n;
|
|
11885
11877
|
}
|
|
11886
|
-
|
|
11878
|
+
Ri.get("/", async (e) => {
|
|
11887
11879
|
try {
|
|
11888
|
-
let t =
|
|
11880
|
+
let t = Vr(e), { search: n = "", type: r = "all", page: i = "1", limit: a = "24", sort: o = "createdAt", order: s = "DESC", nodeId: c, channelId: l, trashed: u } = e.req.query(), d = Math.max(1, parseInt(i, 10) || 1), f = Math.max(1, Math.min(100, parseInt(a, 10) || 24)), p = (d - 1) * f, m = {
|
|
11889
11881
|
createdAt: "a.createdAt",
|
|
11890
11882
|
updatedAt: "a.updatedAt",
|
|
11891
11883
|
filename: "a.filename",
|
|
@@ -11893,7 +11885,7 @@ zi.get("/", async (e) => {
|
|
|
11893
11885
|
sizeBytes: "a.sizeBytes"
|
|
11894
11886
|
}[o] || "a.createdAt", h = s.toUpperCase() === "ASC" ? "ASC" : "DESC", g = [], _ = ["(a.isSystemVariant = 0 OR a.isSystemVariant IS NULL)", u === "true" || u === "1" ? "(a.deletedAt IS NOT NULL AND a.deletedAt != '')" : "(a.deletedAt IS NULL OR a.deletedAt = '')"];
|
|
11895
11887
|
if (c) {
|
|
11896
|
-
let e = await
|
|
11888
|
+
let e = await t.prepare("\n SELECT a.id, a.filename, a.isSystemVariant \n FROM node_assets na \n JOIN assets a ON na.assetId = a.id \n WHERE na.nodeId = ?\n ").all(Number(c));
|
|
11897
11889
|
if (e.length === 0) _.push("1 = 0");
|
|
11898
11890
|
else {
|
|
11899
11891
|
let t = e.map((e) => e.isSystemVariant ? `(
|
|
@@ -11917,8 +11909,9 @@ zi.get("/", async (e) => {
|
|
|
11917
11909
|
LIMIT ? OFFSET ?
|
|
11918
11910
|
`;
|
|
11919
11911
|
g.push(f, p);
|
|
11920
|
-
let y = await
|
|
11921
|
-
b.length > 0
|
|
11912
|
+
let y = await t.prepare(v).all(...g), b = y.map((e) => e.id), x = /* @__PURE__ */ new Map();
|
|
11913
|
+
if (b.length > 0) {
|
|
11914
|
+
let e = `
|
|
11922
11915
|
SELECT master.id AS assetId, COUNT(DISTINCT na.nodeId) AS count
|
|
11923
11916
|
FROM assets master
|
|
11924
11917
|
INNER JOIN node_assets na ON (
|
|
@@ -11935,9 +11928,11 @@ zi.get("/", async (e) => {
|
|
|
11935
11928
|
)
|
|
11936
11929
|
WHERE master.id IN (${b.map(() => "?").join(",")})
|
|
11937
11930
|
GROUP BY master.id
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11931
|
+
`;
|
|
11932
|
+
(await t.prepare(e).all(...b)).forEach((e) => {
|
|
11933
|
+
x.set(String(e.assetId), e.count || 0);
|
|
11934
|
+
});
|
|
11935
|
+
}
|
|
11941
11936
|
let S = y.map((e) => {
|
|
11942
11937
|
let t = {
|
|
11943
11938
|
title: "",
|
|
@@ -11950,7 +11945,7 @@ zi.get("/", async (e) => {
|
|
|
11950
11945
|
...JSON.parse(e.dataJson || "{}")
|
|
11951
11946
|
};
|
|
11952
11947
|
} catch {}
|
|
11953
|
-
let n =
|
|
11948
|
+
let n = zi(e.cdnUrl, e.storageKeyPrivate);
|
|
11954
11949
|
return {
|
|
11955
11950
|
id: e.id,
|
|
11956
11951
|
filename: e.filename || "Untitled Asset",
|
|
@@ -11974,10 +11969,10 @@ zi.get("/", async (e) => {
|
|
|
11974
11969
|
details: t.message || String(t)
|
|
11975
11970
|
}, 500);
|
|
11976
11971
|
}
|
|
11977
|
-
}),
|
|
11972
|
+
}), Ri.post("/upload", async (e) => {
|
|
11978
11973
|
try {
|
|
11979
|
-
let t =
|
|
11980
|
-
s && (await
|
|
11974
|
+
let t = Vr(e), n = Li(e.env), r = await e.req.parseBody(), i = r.file, a = r.isVariant === "true" || r.isVariant === "1" || r.temporary === "true", o = r.parentAssetId || r.parentAsset, s = typeof o == "string" && o.trim().length > 0 ? o.trim() : null;
|
|
11975
|
+
s && (await t.prepare("SELECT id FROM assets WHERE id = ?").all(s)).length === 0 && (s = null);
|
|
11981
11976
|
let c = r.cropCoordinates, l = null, u = null;
|
|
11982
11977
|
if (c) {
|
|
11983
11978
|
if (typeof c == "string") {
|
|
@@ -11991,24 +11986,13 @@ zi.get("/", async (e) => {
|
|
|
11991
11986
|
let d = crypto.randomUUID().replace(/-/g, "").slice(0, 12), f = `ast_${d}`, p = (/* @__PURE__ */ new Date()).toISOString().slice(0, 7).replace("-", "/"), m = a || i.name.startsWith("crop_"), h = m ? `kama/cache/${p}` : `kama/uploads/${p}`, g = await n.upload(i, h), _ = typeof g == "string" ? g : g?.key || g?.storageKeyPrivate || g?.storageKey || `${h}/${d}_${i.name}`;
|
|
11992
11987
|
if (!_) throw Error("Storage provider failed to return a valid storage key");
|
|
11993
11988
|
let v = `/media/${_.replace(/^\//, "")}`, y = i.type || "application/octet-stream", b = i.size || 0, x = e.get("userId"), S = typeof x == "string" && x.trim().length > 0 ? x : null;
|
|
11994
|
-
S && (await
|
|
11989
|
+
S && (await t.prepare("SELECT id FROM users WHERE id = ?").all(S)).length === 0 && (S = null);
|
|
11995
11990
|
let C = +!!m;
|
|
11996
|
-
await
|
|
11997
|
-
f,
|
|
11998
|
-
i.name,
|
|
11999
|
-
y,
|
|
12000
|
-
b,
|
|
12001
|
-
_,
|
|
12002
|
-
v,
|
|
12003
|
-
S,
|
|
12004
|
-
C,
|
|
12005
|
-
s,
|
|
12006
|
-
l
|
|
12007
|
-
]);
|
|
11991
|
+
await t.prepare("\n INSERT INTO assets (id, filename, mimeType, sizeBytes, storageKeyPrivate, cdnUrl, createdById, isSystemVariant, parentAssetId, cropCoordinatesJson)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ").run(f, i.name, y, b, _, v, S, C, s, l);
|
|
12008
11992
|
let w = v;
|
|
12009
11993
|
if (s) {
|
|
12010
|
-
let n = await
|
|
12011
|
-
n.length > 0 && (w =
|
|
11994
|
+
let n = await t.prepare("SELECT cdnUrl, storageKeyPrivate FROM assets WHERE id = ?").all(s);
|
|
11995
|
+
n.length > 0 && (w = zi(n[0].cdnUrl, n[0].storageKeyPrivate)), new J(e.env).purgeAsset(e, t, s);
|
|
12012
11996
|
}
|
|
12013
11997
|
return e.json({
|
|
12014
11998
|
id: f,
|
|
@@ -12027,19 +12011,11 @@ zi.get("/", async (e) => {
|
|
|
12027
12011
|
details: t.message || String(t)
|
|
12028
12012
|
}, 500);
|
|
12029
12013
|
}
|
|
12030
|
-
}),
|
|
12014
|
+
}), Ri.get("/:id/details", async (e) => {
|
|
12031
12015
|
try {
|
|
12032
|
-
let t =
|
|
12016
|
+
let t = Vr(e), n = e.req.param("id"), r = await t.prepare("SELECT * FROM assets WHERE id = ?").all(n);
|
|
12033
12017
|
if (!r || r.length === 0) return e.json({ error: "Asset not found" }, 404);
|
|
12034
|
-
let i = r[0], a = i.filename ? i.filename.replace(/\.[^/.]+$/, "") : "", o = await
|
|
12035
|
-
n,
|
|
12036
|
-
`crop_%${a}%`,
|
|
12037
|
-
`%${n}%`
|
|
12038
|
-
]), s = await Q(t, "\n SELECT id, filename, mimeType, sizeBytes, cdnUrl, storageKeyPrivate, parentAssetId, cropCoordinatesJson, createdAt \n FROM assets \n WHERE isSystemVariant = 1 \n AND (parentAssetId = ? OR filename LIKE ? OR filename LIKE ?)\n ORDER BY createdAt DESC\n ", [
|
|
12039
|
-
n,
|
|
12040
|
-
`crop_%${a}%`,
|
|
12041
|
-
`%${n}%`
|
|
12042
|
-
]), c = {
|
|
12018
|
+
let i = r[0], a = i.filename ? i.filename.replace(/\.[^/.]+$/, "") : "", o = await t.prepare("\n SELECT DISTINCT cn.id, cn.title, cn.contentType, cn.slug, na.fieldKey, na.assetId \n FROM node_assets na\n INNER JOIN content_nodes cn ON na.nodeId = cn.id\n LEFT JOIN assets crop ON na.assetId = crop.id\n WHERE na.assetId = ?\n OR (crop.isSystemVariant = 1 AND (crop.filename LIKE ? OR crop.filename LIKE ?))\n ").all(n, `crop_%${a}%`, `%${n}%`), s = await t.prepare("\n SELECT id, filename, mimeType, sizeBytes, cdnUrl, storageKeyPrivate, parentAssetId, cropCoordinatesJson, createdAt \n FROM assets \n WHERE isSystemVariant = 1 \n AND (parentAssetId = ? OR filename LIKE ? OR filename LIKE ?)\n ORDER BY createdAt DESC\n ").all(n, `crop_%${a}%`, `%${n}%`), c = {
|
|
12043
12019
|
title: "",
|
|
12044
12020
|
alt: "",
|
|
12045
12021
|
description: ""
|
|
@@ -12050,7 +12026,7 @@ zi.get("/", async (e) => {
|
|
|
12050
12026
|
...JSON.parse(i.dataJson || "{}")
|
|
12051
12027
|
};
|
|
12052
12028
|
} catch {}
|
|
12053
|
-
let l =
|
|
12029
|
+
let l = zi(i.cdnUrl, i.storageKeyPrivate);
|
|
12054
12030
|
return e.json({
|
|
12055
12031
|
id: i.id,
|
|
12056
12032
|
filename: i.filename,
|
|
@@ -12077,7 +12053,7 @@ zi.get("/", async (e) => {
|
|
|
12077
12053
|
createdAt: e.createdAt,
|
|
12078
12054
|
parentAssetId: e.parentAssetId || i.id,
|
|
12079
12055
|
cropCoordinates: t,
|
|
12080
|
-
url:
|
|
12056
|
+
url: zi(e.cdnUrl, e.storageKeyPrivate),
|
|
12081
12057
|
originalUrl: l
|
|
12082
12058
|
};
|
|
12083
12059
|
})
|
|
@@ -12085,73 +12061,68 @@ zi.get("/", async (e) => {
|
|
|
12085
12061
|
} catch (t) {
|
|
12086
12062
|
return console.error("❌ [Asset Details Error]:", t), e.json({ error: "Failed to load details" }, 500);
|
|
12087
12063
|
}
|
|
12088
|
-
}),
|
|
12064
|
+
}), Ri.put("/:id", async (e) => {
|
|
12089
12065
|
try {
|
|
12090
|
-
let t =
|
|
12066
|
+
let t = Vr(e), n = e.req.param("id"), r = await e.req.json(), i = await t.prepare("SELECT filename, dataJson FROM assets WHERE id = ?").all(n);
|
|
12091
12067
|
if (!i || i.length === 0) return e.json({ error: "Asset not found" }, 404);
|
|
12092
12068
|
let a = i[0], o = {};
|
|
12093
12069
|
try {
|
|
12094
12070
|
o = JSON.parse(a.dataJson || "{}");
|
|
12095
12071
|
} catch {}
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
n
|
|
12100
|
-
]), new q(e.env).purgeAsset(e, t, n), e.json({ success: !0 });
|
|
12072
|
+
r.title !== void 0 && (o.title = r.title), r.alt !== void 0 && (o.alt = r.alt), r.description !== void 0 && (o.description = r.description);
|
|
12073
|
+
let s = r.filename === void 0 ? a.filename : r.filename;
|
|
12074
|
+
return await t.prepare("UPDATE assets SET filename = ?, dataJson = ?, updatedAt = CURRENT_TIMESTAMP WHERE id = ?").run(s, JSON.stringify(o), n), new J(e.env).purgeAsset(e, t, n), e.json({ success: !0 });
|
|
12101
12075
|
} catch (t) {
|
|
12102
12076
|
return console.error("❌ [Asset Update Error]:", t), e.json({ error: "Failed to update asset" }, 500);
|
|
12103
12077
|
}
|
|
12104
|
-
}),
|
|
12078
|
+
}), Ri.delete("/:id", async (e) => {
|
|
12105
12079
|
try {
|
|
12106
|
-
let t =
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
`%${n}%`
|
|
12112
|
-
|
|
12080
|
+
let t = Vr(e), n = e.req.param("id"), r = (await t.prepare("SELECT id, filename, isSystemVariant FROM assets WHERE id = ?").all(n))[0];
|
|
12081
|
+
if (!r) return e.json({ error: "Asset not found" }, 404);
|
|
12082
|
+
if (new J(e.env).purgeAsset(e, t, n), r.isSystemVariant) await t.prepare("UPDATE assets SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?").run(n);
|
|
12083
|
+
else {
|
|
12084
|
+
let e = r.filename ? r.filename.replace(/\.[^/.]+$/, "") : "";
|
|
12085
|
+
await t.prepare("UPDATE assets\n SET deletedAt = CURRENT_TIMESTAMP\n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))").run(n, n, `crop_%${e}%`, `%${n}%`);
|
|
12086
|
+
}
|
|
12087
|
+
return e.json({
|
|
12113
12088
|
success: !0,
|
|
12114
12089
|
id: n,
|
|
12115
12090
|
trashed: !0
|
|
12116
|
-
})
|
|
12091
|
+
});
|
|
12117
12092
|
} catch (t) {
|
|
12118
12093
|
return console.error("❌ [Asset Soft Delete Error]:", t), e.json({
|
|
12119
12094
|
error: "Failed to move asset to trash",
|
|
12120
12095
|
details: t.message || String(t)
|
|
12121
12096
|
}, 500);
|
|
12122
12097
|
}
|
|
12123
|
-
}),
|
|
12098
|
+
}), Ri.post("/restore", async (e) => {
|
|
12124
12099
|
try {
|
|
12125
|
-
let t =
|
|
12100
|
+
let t = Vr(e), n = await e.req.json(), r = n.id || n.assetId;
|
|
12126
12101
|
if (!r) return e.json({ error: "Asset ID required" }, 400);
|
|
12127
|
-
let i = (await
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
`crop_%${i.filename ? i.filename.replace(/\.[^/.]+$/, "") : ""}%`,
|
|
12132
|
-
`%${r}%`
|
|
12133
|
-
]), new q(e.env).purgeAsset(e, t, r), e.json({
|
|
12102
|
+
let i = (await t.prepare("SELECT id, filename FROM assets WHERE id = ?").all(r))[0];
|
|
12103
|
+
if (!i) return e.json({ error: "Asset not found" }, 404);
|
|
12104
|
+
let a = i.filename ? i.filename.replace(/\.[^/.]+$/, "") : "";
|
|
12105
|
+
return await t.prepare("UPDATE assets \n SET deletedAt = NULL \n WHERE id = ? OR parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))").run(r, r, `crop_%${a}%`, `%${r}%`), new J(e.env).purgeAsset(e, t, r), e.json({
|
|
12134
12106
|
success: !0,
|
|
12135
12107
|
id: r,
|
|
12136
12108
|
restored: !0
|
|
12137
|
-
})
|
|
12109
|
+
});
|
|
12138
12110
|
} catch (t) {
|
|
12139
12111
|
return console.error("❌ [Asset Restore Error]:", t), e.json({
|
|
12140
12112
|
error: "Failed to restore asset",
|
|
12141
12113
|
details: t.message
|
|
12142
12114
|
}, 500);
|
|
12143
12115
|
}
|
|
12144
|
-
}),
|
|
12116
|
+
}), Ri.delete("/purge/:id", async (e) => {
|
|
12145
12117
|
try {
|
|
12146
|
-
let t =
|
|
12118
|
+
let t = Vr(e), n = Li(e.env), r = e.req.param("id"), i = (await t.prepare("SELECT id, filename, storageKeyPrivate, isSystemVariant FROM assets WHERE id = ?").all(r))[0];
|
|
12147
12119
|
if (!i) return e.json({ error: "Asset not found" }, 404);
|
|
12148
|
-
new
|
|
12120
|
+
new J(e.env).purgeAsset(e, t, r);
|
|
12149
12121
|
let a = [i];
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
])]);
|
|
12122
|
+
if (!i.isSystemVariant) {
|
|
12123
|
+
let e = i.filename ? i.filename.replace(/\.[^/.]+$/, "") : "";
|
|
12124
|
+
a = [i, ...await t.prepare("SELECT id, storageKeyPrivate FROM assets \n WHERE parentAssetId = ? OR (isSystemVariant = 1 AND (filename LIKE ? OR filename LIKE ?))").all(r, `crop_%${e}%`, `%${r}%`)];
|
|
12125
|
+
}
|
|
12155
12126
|
let o = a.map((e) => e.id);
|
|
12156
12127
|
if (typeof n.delete == "function") {
|
|
12157
12128
|
for (let e of a) if (e.storageKeyPrivate) try {
|
|
@@ -12161,7 +12132,7 @@ zi.get("/", async (e) => {
|
|
|
12161
12132
|
}
|
|
12162
12133
|
}
|
|
12163
12134
|
let s = o.map(() => "?").join(",");
|
|
12164
|
-
return await
|
|
12135
|
+
return await t.prepare(`DELETE FROM node_assets WHERE assetId IN (${s})`).run(...o), await t.prepare(`DELETE FROM assets WHERE id IN (${s})`).run(...o), e.json({
|
|
12165
12136
|
success: !0,
|
|
12166
12137
|
id: r,
|
|
12167
12138
|
purged: !0,
|
|
@@ -12177,14 +12148,14 @@ zi.get("/", async (e) => {
|
|
|
12177
12148
|
});
|
|
12178
12149
|
//#endregion
|
|
12179
12150
|
//#region server/routes/public/node.ts
|
|
12180
|
-
var
|
|
12181
|
-
function
|
|
12151
|
+
var Bi = new n();
|
|
12152
|
+
function Vi(e, t) {
|
|
12182
12153
|
let n = Promise.resolve(t).catch((e) => console.error("[Background Task Error]:", e));
|
|
12183
12154
|
try {
|
|
12184
12155
|
e.executionCtx && typeof e.executionCtx.waitUntil == "function" && e.executionCtx.waitUntil(n);
|
|
12185
12156
|
} catch {}
|
|
12186
12157
|
}
|
|
12187
|
-
function
|
|
12158
|
+
function Hi() {
|
|
12188
12159
|
return {
|
|
12189
12160
|
fullPath: /* @__PURE__ */ new Map(),
|
|
12190
12161
|
treeEdges: /* @__PURE__ */ new Map(),
|
|
@@ -12192,15 +12163,15 @@ function Wi() {
|
|
|
12192
12163
|
assetUrls: /* @__PURE__ */ new Map()
|
|
12193
12164
|
};
|
|
12194
12165
|
}
|
|
12195
|
-
function
|
|
12166
|
+
function Ui(...e) {
|
|
12196
12167
|
return e.map((e) => String(e ?? "")).join(":");
|
|
12197
12168
|
}
|
|
12198
|
-
function
|
|
12169
|
+
function Wi(e) {
|
|
12199
12170
|
if (!e || String(e).trim() === "") return null;
|
|
12200
12171
|
let t = new Date(e.includes("T") ? e : e.replace(" ", "T") + "Z");
|
|
12201
12172
|
return isNaN(t.getTime()) ? e : t.toISOString();
|
|
12202
12173
|
}
|
|
12203
|
-
function
|
|
12174
|
+
function Gi(e, t) {
|
|
12204
12175
|
let n = Date.now();
|
|
12205
12176
|
if (e && String(e).trim() !== "") {
|
|
12206
12177
|
let t = Date.parse(e);
|
|
@@ -12212,7 +12183,7 @@ function qi(e, t) {
|
|
|
12212
12183
|
}
|
|
12213
12184
|
return !0;
|
|
12214
12185
|
}
|
|
12215
|
-
async function
|
|
12186
|
+
async function Ki(e, t, n) {
|
|
12216
12187
|
let r = t.filter((e) => e.componentId === "content-feed" || e.componentId === "article-list");
|
|
12217
12188
|
await Promise.all(r.map(async (t) => {
|
|
12218
12189
|
let r = t.data || {}, i = r.nodeType || "article", a = Number(r.limit) || 12, o = r.sortBy || "updatedAt", s = "FROM content_nodes WHERE contentType = ? AND isHidden = 0 AND (status = 'published' OR status IS NULL)", c = [i];
|
|
@@ -12226,13 +12197,13 @@ async function Ji(e, t, n) {
|
|
|
12226
12197
|
if (e.dataJson) try {
|
|
12227
12198
|
t = typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson;
|
|
12228
12199
|
} catch {}
|
|
12229
|
-
return
|
|
12200
|
+
return Gi(t.startShowingAt, t.stopShowingAt) ? {
|
|
12230
12201
|
id: e.id,
|
|
12231
12202
|
title: e.title,
|
|
12232
12203
|
slug: e.slug,
|
|
12233
12204
|
language: e.language || "en",
|
|
12234
|
-
createdAt:
|
|
12235
|
-
updatedAt:
|
|
12205
|
+
createdAt: Wi(e.createdAt),
|
|
12206
|
+
updatedAt: Wi(e.updatedAt),
|
|
12236
12207
|
excerpt: t.excerpt || "",
|
|
12237
12208
|
image: t.image || t.coverImage || null,
|
|
12238
12209
|
author: t.author || null
|
|
@@ -12243,7 +12214,7 @@ async function Ji(e, t, n) {
|
|
|
12243
12214
|
}
|
|
12244
12215
|
}));
|
|
12245
12216
|
}
|
|
12246
|
-
async function
|
|
12217
|
+
async function qi(e, t, n, r, i = !1, a) {
|
|
12247
12218
|
if (!t || t === "0" || t === 0 || t === "null") return { blocks: [] };
|
|
12248
12219
|
try {
|
|
12249
12220
|
let o = await Promise.resolve(e.prepare("\n WITH RECURSIVE ancestor_path(id, contentId, title, slug, parentId, level) AS (\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, 0 \n FROM tree_nodes t \n INNER JOIN content_nodes c ON t.contentId = c.id \n WHERE t.id = ? OR c.id = ?\n \n UNION ALL\n \n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, ap.level + 1 \n FROM tree_nodes t \n INNER JOIN content_nodes c ON t.contentId = c.id \n INNER JOIN ancestor_path ap ON t.id = ap.parentId\n WHERE ap.parentId IS NOT NULL AND ap.parentId != 0 AND ap.parentId != '0' AND ap.parentId != 'null' AND ap.level < 20\n ) SELECT * FROM ancestor_path ORDER BY level ASC\n ").all(t, t));
|
|
@@ -12283,9 +12254,9 @@ async function Yi(e, t, n, r, i = !1, a) {
|
|
|
12283
12254
|
try {
|
|
12284
12255
|
t = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
12285
12256
|
} catch {}
|
|
12286
|
-
let n = t.hidden === !0 || t.hidden === 1 || t.hidden === "1" || t.hidden === "true", a =
|
|
12257
|
+
let n = t.hidden === !0 || t.hidden === 1 || t.hidden === "1" || t.hidden === "true", a = Gi(t.startShowingAt, t.stopShowingAt);
|
|
12287
12258
|
if (!i && (n || !a)) continue;
|
|
12288
|
-
let o = e.elementType || e.componentId || "text-block", s = r.blocks?.[o]?.fields || r.elements?.[o]?.fields || r.components?.[o]?.fields || {}, c = String(t.blockId || t._instanceId || (t.id && !String(t.id).startsWith("ast_") ? t.id : null) || e.blockId || e.id), l =
|
|
12259
|
+
let o = e.elementType || e.componentId || "text-block", s = r.blocks?.[o]?.fields || r.elements?.[o]?.fields || r.components?.[o]?.fields || {}, c = String(t.blockId || t._instanceId || (t.id && !String(t.id).startsWith("ast_") ? t.id : null) || e.blockId || e.id), l = Ji(t, s);
|
|
12289
12260
|
u.push({
|
|
12290
12261
|
original: e,
|
|
12291
12262
|
data: l,
|
|
@@ -12294,7 +12265,7 @@ async function Yi(e, t, n, r, i = !1, a) {
|
|
|
12294
12265
|
});
|
|
12295
12266
|
}
|
|
12296
12267
|
let d = u.map((e) => e.data);
|
|
12297
|
-
d.length > 0 && (d = await
|
|
12268
|
+
d.length > 0 && (d = await Yr(e, d), d = Yi(d), a && (d = await Xi(e, d, a)));
|
|
12298
12269
|
let m = {};
|
|
12299
12270
|
for (let e = 0; e < u.length; e++) {
|
|
12300
12271
|
let t = u[e], r = d[e];
|
|
@@ -12319,7 +12290,7 @@ async function Yi(e, t, n, r, i = !1, a) {
|
|
|
12319
12290
|
}
|
|
12320
12291
|
return { blocks: [] };
|
|
12321
12292
|
}
|
|
12322
|
-
function
|
|
12293
|
+
function Ji(e, t = {}) {
|
|
12323
12294
|
let n = {};
|
|
12324
12295
|
for (let [r, i] of Object.entries(e)) {
|
|
12325
12296
|
if (r === "id" && typeof i == "string" && i.startsWith("ast_")) {
|
|
@@ -12330,14 +12301,14 @@ function Xi(e, t = {}) {
|
|
|
12330
12301
|
}
|
|
12331
12302
|
return n;
|
|
12332
12303
|
}
|
|
12333
|
-
function
|
|
12334
|
-
if (Array.isArray(e)) return e.map(
|
|
12304
|
+
function Yi(e) {
|
|
12305
|
+
if (Array.isArray(e)) return e.map(Yi);
|
|
12335
12306
|
if (!e || typeof e != "object") return e;
|
|
12336
12307
|
if (typeof e.id == "string" && e.id.startsWith("ast_") && typeof e.url == "string") {
|
|
12337
12308
|
let t = e.metadataOverrides || {}, n = e.variants && typeof e.variants == "object" ? e.variants : {}, r = Object.entries(n).find(([, t]) => t?.id === e.id)?.[0], i = r ? {
|
|
12338
12309
|
...t,
|
|
12339
12310
|
...t.crops?.[r] || {}
|
|
12340
|
-
} : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t,
|
|
12311
|
+
} : t, a = Object.fromEntries(Object.entries(n).filter(([, t]) => t?.id !== e.id).map(([t, n]) => [t, Yi({
|
|
12341
12312
|
...n,
|
|
12342
12313
|
title: n?.title ?? e.title ?? "",
|
|
12343
12314
|
alt: n?.alt ?? e.alt ?? "",
|
|
@@ -12351,9 +12322,9 @@ function Zi(e) {
|
|
|
12351
12322
|
...Object.keys(a).length > 0 ? { variants: a } : {}
|
|
12352
12323
|
};
|
|
12353
12324
|
}
|
|
12354
|
-
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e,
|
|
12325
|
+
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Yi(t)]));
|
|
12355
12326
|
}
|
|
12356
|
-
async function
|
|
12327
|
+
async function Xi(e, t, n) {
|
|
12357
12328
|
if (!t) return t;
|
|
12358
12329
|
if (typeof t == "string") {
|
|
12359
12330
|
if (!t.includes("#node:") && !t.includes("data-node-id") && !t.includes("#asset:") && !t.includes("data-asset-id")) return t;
|
|
@@ -12372,9 +12343,9 @@ async function Qi(e, t, n) {
|
|
|
12372
12343
|
return await Promise.all(Array.from(t.matchAll(d)).map(async (t) => {
|
|
12373
12344
|
let i = t[1], a = r(i, "data-node-id"), o = r(i, "data-tree-id");
|
|
12374
12345
|
if (!a || !o) return;
|
|
12375
|
-
let s = await
|
|
12346
|
+
let s = await Qi(e, a, o, n);
|
|
12376
12347
|
if (s?.treeNodeId) {
|
|
12377
|
-
let t = await
|
|
12348
|
+
let t = await na(e, String(s.treeNodeId), o, n);
|
|
12378
12349
|
u.set(`${a}:${o}`, t);
|
|
12379
12350
|
}
|
|
12380
12351
|
})), t.replace(d, (e, t) => {
|
|
@@ -12394,41 +12365,41 @@ async function Qi(e, t, n) {
|
|
|
12394
12365
|
return /href\s*=/.test(h) || (h += ` href="${m || "/"}"`), `<a ${h}>`;
|
|
12395
12366
|
});
|
|
12396
12367
|
}
|
|
12397
|
-
if (Array.isArray(t)) return Promise.all(t.map((t) =>
|
|
12368
|
+
if (Array.isArray(t)) return Promise.all(t.map((t) => Xi(e, t, n)));
|
|
12398
12369
|
if (typeof t == "object") {
|
|
12399
12370
|
let r = JSON.stringify(t);
|
|
12400
12371
|
if (!r.includes("#node:") && !r.includes("data-node-id") && !r.includes("#asset:") && !r.includes("data-asset-id")) return t;
|
|
12401
12372
|
if (typeof t.href == "string" && (t.href.startsWith("#node:") || t.href.startsWith("#asset:"))) return {
|
|
12402
12373
|
...t,
|
|
12403
|
-
href: await
|
|
12374
|
+
href: await Zi(e, t, n)
|
|
12404
12375
|
};
|
|
12405
|
-
let i = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await
|
|
12376
|
+
let i = await Promise.all(Object.entries(t).map(async ([t, r]) => [t, await Xi(e, r, n)]));
|
|
12406
12377
|
return Object.fromEntries(i);
|
|
12407
12378
|
}
|
|
12408
12379
|
return t;
|
|
12409
12380
|
}
|
|
12410
|
-
async function
|
|
12381
|
+
async function Zi(e, t, n) {
|
|
12411
12382
|
let r = t.href.match(/^#node:(.+)$/), i = t.href.match(/^#asset:(.+)$/);
|
|
12412
|
-
if (i) return
|
|
12383
|
+
if (i) return ea(e, i[1], n);
|
|
12413
12384
|
if (!r) return t.href;
|
|
12414
12385
|
let a = r[1];
|
|
12415
12386
|
if (t.treeId) {
|
|
12416
|
-
let r = await
|
|
12387
|
+
let r = await Qi(e, a, String(t.treeId), n);
|
|
12417
12388
|
if (r?.treeNodeId) {
|
|
12418
|
-
let i = await
|
|
12389
|
+
let i = await na(e, String(r.treeNodeId), String(t.treeId), n);
|
|
12419
12390
|
if (i) return i;
|
|
12420
12391
|
}
|
|
12421
12392
|
}
|
|
12422
|
-
let o = await
|
|
12393
|
+
let o = await $i(e, a, n);
|
|
12423
12394
|
return o === void 0 ? "#" : `/${o}`;
|
|
12424
12395
|
}
|
|
12425
|
-
async function
|
|
12426
|
-
let i =
|
|
12396
|
+
async function Qi(e, t, n, r) {
|
|
12397
|
+
let i = Ui(t, n);
|
|
12427
12398
|
if (r.treeEdges.has(i)) return r.treeEdges.get(i);
|
|
12428
12399
|
let a = Promise.resolve(e.prepare("SELECT id as treeNodeId FROM tree_nodes WHERE contentId = ? AND treeId = ? LIMIT 1").get(t, n));
|
|
12429
12400
|
return r.treeEdges.set(i, a), a;
|
|
12430
12401
|
}
|
|
12431
|
-
async function
|
|
12402
|
+
async function $i(e, t, n) {
|
|
12432
12403
|
let r = String(t);
|
|
12433
12404
|
if (n.nodeSlugs.has(r)) return n.nodeSlugs.get(r);
|
|
12434
12405
|
let i = (async () => {
|
|
@@ -12437,7 +12408,7 @@ async function ta(e, t, n) {
|
|
|
12437
12408
|
})();
|
|
12438
12409
|
return n.nodeSlugs.set(r, i), i;
|
|
12439
12410
|
}
|
|
12440
|
-
async function
|
|
12411
|
+
async function ea(e, t, n) {
|
|
12441
12412
|
let r = String(t);
|
|
12442
12413
|
if (n.assetUrls.has(r)) return n.assetUrls.get(r);
|
|
12443
12414
|
let i = (async () => {
|
|
@@ -12446,7 +12417,7 @@ async function na(e, t, n) {
|
|
|
12446
12417
|
})();
|
|
12447
12418
|
return n.assetUrls.set(r, i), i;
|
|
12448
12419
|
}
|
|
12449
|
-
function
|
|
12420
|
+
function ta(e) {
|
|
12450
12421
|
let t = e.socialImage;
|
|
12451
12422
|
if (!t || typeof t != "object") return null;
|
|
12452
12423
|
let n = (e, t) => {
|
|
@@ -12477,9 +12448,9 @@ function ra(e) {
|
|
|
12477
12448
|
])
|
|
12478
12449
|
};
|
|
12479
12450
|
}
|
|
12480
|
-
async function
|
|
12451
|
+
async function na(e, t, n, r) {
|
|
12481
12452
|
if (!t || t === "0" || t === "null") return "/home";
|
|
12482
|
-
let i =
|
|
12453
|
+
let i = Ui(t, n);
|
|
12483
12454
|
if (r && r.fullPath.has(i)) return r.fullPath.get(i);
|
|
12484
12455
|
let a = (async () => {
|
|
12485
12456
|
try {
|
|
@@ -12497,7 +12468,7 @@ async function ia(e, t, n, r) {
|
|
|
12497
12468
|
})();
|
|
12498
12469
|
return r && r.fullPath.set(i, a), a;
|
|
12499
12470
|
}
|
|
12500
|
-
async function
|
|
12471
|
+
async function ra(e, t, n, r, i) {
|
|
12501
12472
|
let a = {}, o = null;
|
|
12502
12473
|
if (t && t !== "0" && t !== 0 && t !== "null") try {
|
|
12503
12474
|
let n = await Promise.resolve(e.prepare("\n WITH RECURSIVE ancestor_path(id, contentId, title, slug, parentId, level) AS (\n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, 0 \n FROM tree_nodes t \n INNER JOIN content_nodes c ON t.contentId = c.id \n WHERE t.id = ? OR c.id = ?\n \n UNION ALL\n \n SELECT t.id, t.contentId, c.title, c.slug, t.parentId, ap.level + 1 \n FROM tree_nodes t \n INNER JOIN content_nodes c ON t.contentId = c.id \n INNER JOIN ancestor_path ap ON t.id = ap.parentId\n WHERE ap.parentId IS NOT NULL AND ap.parentId != 0 AND ap.parentId != '0' AND ap.parentId != 'null' AND ap.level < 20\n ) SELECT c.dataJson, c.draftDataJson FROM ancestor_path ap INNER JOIN content_nodes c ON ap.contentId = c.id ORDER BY ap.level ASC\n ").all(t, t)), i = /* @__PURE__ */ new Set([
|
|
@@ -12537,22 +12508,22 @@ async function aa(e, t, n, r, i) {
|
|
|
12537
12508
|
inheritedFields: a
|
|
12538
12509
|
};
|
|
12539
12510
|
}
|
|
12540
|
-
function
|
|
12511
|
+
function ia(e) {
|
|
12541
12512
|
let t = Number(e?.env?.CMS_NODE_CACHE_TTL);
|
|
12542
12513
|
return Number.isFinite(t) && t >= 60 ? Math.floor(t) : 300;
|
|
12543
12514
|
}
|
|
12544
|
-
|
|
12515
|
+
Bi.get("/*", async (e) => {
|
|
12545
12516
|
try {
|
|
12546
|
-
let t = e.get("db"), n =
|
|
12517
|
+
let t = e.get("db"), n = Hi(), r = new URL(e.req.url).pathname.match(/\/node\/(.+)$/), i = (r ? r[1] : "home").replace(/^\/+|\/+$/g, ""), a = e.req.query("channelId") || e.req.query("channel") || "1", o = e.req.query("lang") || "en", s = e.req.query("preview") === "true", c = isNaN(Number(a)) ? await Promise.resolve(t.prepare("SELECT * FROM channels WHERE key = ?").get(a)) : await Promise.resolve(t.prepare("SELECT * FROM channels WHERE id = ?").get(Number(a)));
|
|
12547
12518
|
if (!c) return e.json({ error: `Channel '${a}' not found` }, 404);
|
|
12548
12519
|
let l = c.status === "disabled" || c.status === "inactive" || c.isEnabled === 0 || c.isEnabled === !1;
|
|
12549
12520
|
if (!s && l) return e.json({ error: `Channel '${c.key || a}' is currently inactive` }, 404);
|
|
12550
|
-
let u = c.id, d = c.key || a, f =
|
|
12521
|
+
let u = c.id, d = c.key || a, f = q(e), p = `node:${u || d}:${o}:${i}`, m = e.req.header("x-bypass-cache") === "true";
|
|
12551
12522
|
if (!s && !m) {
|
|
12552
12523
|
let t = await f.get(p);
|
|
12553
12524
|
if (t) return e.header("X-Cache", "HIT"), e.json(t);
|
|
12554
12525
|
}
|
|
12555
|
-
let h =
|
|
12526
|
+
let h = Pr(e.env?.BUNDLED_DEFINITIONS), g = /^\d+$/.test(i), _ = null, v = null, y = e.req.query("treeId"), b = i.split("/"), x = b[b.length - 1], S = "/" + i.replace(/^\/+|\/+$/g, ""), C = `
|
|
12556
12527
|
SELECT cn.*, tn.id as treeNodeId, tn.parentId, tn.treeId
|
|
12557
12528
|
FROM content_nodes cn
|
|
12558
12529
|
INNER JOIN tree_nodes tn ON cn.id = tn.contentId
|
|
@@ -12562,7 +12533,7 @@ Hi.get("/*", async (e) => {
|
|
|
12562
12533
|
if (T.length > 0) {
|
|
12563
12534
|
let e = await Promise.all(T.map(async (e) => ({
|
|
12564
12535
|
candidate: e,
|
|
12565
|
-
calculatedPath: await
|
|
12536
|
+
calculatedPath: await na(t, String(e.treeNodeId), String(e.treeId), n)
|
|
12566
12537
|
}))), r = S.replace(/^\/+|\/+$/g, "");
|
|
12567
12538
|
for (let { candidate: t, calculatedPath: n } of e) {
|
|
12568
12539
|
let e = n.replace(/^\/+|\/+$/g, "");
|
|
@@ -12577,7 +12548,7 @@ Hi.get("/*", async (e) => {
|
|
|
12577
12548
|
let e = `SELECT id as treeNodeId, treeId, parentId FROM tree_nodes WHERE contentId = ? ${y ? "AND treeId = ?" : ""} LIMIT 1`, n = y ? [_.id, y] : [_.id];
|
|
12578
12549
|
v = await Promise.resolve(t.prepare(e).get(...n));
|
|
12579
12550
|
}
|
|
12580
|
-
let E = v?.treeId || y || "main-nav", D = v?.parentId || null, O = v?.treeNodeId ? await
|
|
12551
|
+
let E = v?.treeId || y || "main-nav", D = v?.parentId || null, O = v?.treeNodeId ? await na(t, String(v.treeNodeId), String(E), n) : `/${(_.slug || "").replace(/^\/+|\/+$/g, "")}`, k = {}, ee = s && _.draftDataJson ? _.draftDataJson : _.dataJson || _.draftDataJson;
|
|
12581
12552
|
if (ee) try {
|
|
12582
12553
|
k = typeof ee == "string" ? JSON.parse(ee) : ee;
|
|
12583
12554
|
} catch {}
|
|
@@ -12595,7 +12566,7 @@ Hi.get("/*", async (e) => {
|
|
|
12595
12566
|
WHERE t.parentId = ? AND t.treeId = ?
|
|
12596
12567
|
ORDER BY t.sortOrder ASC
|
|
12597
12568
|
`, [se, ce, j] = await Promise.all([
|
|
12598
|
-
|
|
12569
|
+
ra(t, D, E, s, A),
|
|
12599
12570
|
v?.treeNodeId ? Promise.resolve(t.prepare(oe).all(v.treeNodeId, E)) : Promise.resolve([]),
|
|
12600
12571
|
Promise.resolve(t.prepare("SELECT * FROM content_blocks WHERE contentId = ? AND isDraft = ? ORDER BY sortOrder ASC").all(_.id, ie))
|
|
12601
12572
|
]), { resolvedLayoutId: le, inheritedFields: ue } = se, M = {
|
|
@@ -12604,10 +12575,10 @@ Hi.get("/*", async (e) => {
|
|
|
12604
12575
|
slug: _.slug,
|
|
12605
12576
|
path: O === "" ? "/" : O,
|
|
12606
12577
|
nodeType: te,
|
|
12607
|
-
createdAt:
|
|
12608
|
-
updatedAt:
|
|
12609
|
-
publishedAt:
|
|
12610
|
-
}, de = k.disabledRegions || {}, N = k.hidden === !0 || k.hidden === 1 || k.hidden === "1" || k.hidden === "true", fe = k.startShowingAt || null, pe = k.stopShowingAt || null, P =
|
|
12578
|
+
createdAt: Wi(_.createdAt),
|
|
12579
|
+
updatedAt: Wi(_.updatedAt),
|
|
12580
|
+
publishedAt: Wi(k.publishedAt || _.createdAt)
|
|
12581
|
+
}, de = k.disabledRegions || {}, N = k.hidden === !0 || k.hidden === 1 || k.hidden === "1" || k.hidden === "true", fe = k.startShowingAt || null, pe = k.stopShowingAt || null, P = Ji(k, A), me = P.layoutId || null, he = me && me !== "inherit", ge = !1, _e = null;
|
|
12611
12582
|
A.layoutId && (ge = !0, A.layoutId.options && Array.isArray(A.layoutId.options) && (_e = A.layoutId.options.map((e) => typeof e == "object" ? e.value || e.id : e)));
|
|
12612
12583
|
let F = null;
|
|
12613
12584
|
if (ge && _e && _e.length === 1 && _e[0] !== "inherit") F = _e[0];
|
|
@@ -12617,13 +12588,13 @@ Hi.get("/*", async (e) => {
|
|
|
12617
12588
|
F = e && e !== "inherit" && (!_e || _e.includes(e) || _e.includes("inherit")) ? e : re.defaultLayout || null;
|
|
12618
12589
|
}
|
|
12619
12590
|
for (let [e, t] of Object.entries(ue)) A[e] && (P[e] === void 0 || P[e] === null || P[e] === "" || P[e] === "inherit") && t !== void 0 && (P[e] = t);
|
|
12620
|
-
let ve = Number(_.isHidden) === 1 || N, ye = !
|
|
12591
|
+
let ve = Number(_.isHidden) === 1 || N, ye = !Gi(fe, pe);
|
|
12621
12592
|
if (!s && (ve || ye)) return e.json({ error: "Node is hidden or outside its scheduled publishing window" }, 404);
|
|
12622
12593
|
let be = [];
|
|
12623
12594
|
if (v?.treeNodeId) {
|
|
12624
12595
|
let e = M.path === "/" ? "" : M.path;
|
|
12625
12596
|
be = (ce || []).map((t) => {
|
|
12626
|
-
let n = Number(t.isHidden) === 1 || t.extHidden === 1 || t.extHidden === "1" || t.extHidden === "true" || t.extHidden === !0, r =
|
|
12597
|
+
let n = Number(t.isHidden) === 1 || t.extHidden === 1 || t.extHidden === "1" || t.extHidden === "true" || t.extHidden === !0, r = Gi(t.extStart, t.extStop), i = (t.slug || "").replace(/^\/+|\/+$/g, "");
|
|
12627
12598
|
return !s && (n || !r) ? null : {
|
|
12628
12599
|
treeNodeId: t.treeNodeId,
|
|
12629
12600
|
id: t.id,
|
|
@@ -12644,9 +12615,9 @@ Hi.get("/*", async (e) => {
|
|
|
12644
12615
|
try {
|
|
12645
12616
|
n = (typeof e.dataJson == "string" ? JSON.parse(e.dataJson) : e.dataJson) || {};
|
|
12646
12617
|
} catch {}
|
|
12647
|
-
let r = n.hidden === !0 || n.hidden === 1 || n.hidden === "1" || n.hidden === "true", i =
|
|
12618
|
+
let r = n.hidden === !0 || n.hidden === 1 || n.hidden === "1" || n.hidden === "true", i = Gi(n.startShowingAt, n.stopShowingAt);
|
|
12648
12619
|
if (!s && (r || !i)) continue;
|
|
12649
|
-
let a = e.elementType || e.componentId || "text-block", o = h.blocks?.[a]?.fields || h.elements?.[a]?.fields || h.components?.[a]?.fields || {}, c = String(n.blockId || n._instanceId || (n.id && !String(n.id).startsWith("ast_") ? n.id : null) || e.blockId || e.id), l =
|
|
12620
|
+
let a = e.elementType || e.componentId || "text-block", o = h.blocks?.[a]?.fields || h.elements?.[a]?.fields || h.components?.[a]?.fields || {}, c = String(n.blockId || n._instanceId || (n.id && !String(n.id).startsWith("ast_") ? n.id : null) || e.blockId || e.id), l = Ji(n, o);
|
|
12650
12621
|
Ce.push({
|
|
12651
12622
|
original: e,
|
|
12652
12623
|
region: t,
|
|
@@ -12655,12 +12626,12 @@ Hi.get("/*", async (e) => {
|
|
|
12655
12626
|
resolvedBlockId: c
|
|
12656
12627
|
});
|
|
12657
12628
|
}
|
|
12658
|
-
let L = await
|
|
12629
|
+
let L = await Yr(t, {
|
|
12659
12630
|
node: P,
|
|
12660
12631
|
blocks: Ce.map((e) => e.data)
|
|
12661
12632
|
});
|
|
12662
|
-
L =
|
|
12663
|
-
let R = L.node, we =
|
|
12633
|
+
L = Yi(L), L = await Xi(t, L, n);
|
|
12634
|
+
let R = L.node, we = ta(R);
|
|
12664
12635
|
delete R.socialImage, delete R.fbImage, delete R.xImage, delete R.whatsappImage, we && (R.socialImages = we), delete R.id, delete R.title, delete R.slug, delete R.language, delete R.contentType, delete R.nodeType, delete R.createdAt, delete R.updatedAt, delete R.publishedAt, delete R.channelId, delete R.treeId, delete R.path, R.iconName === "" && (R.iconName = null), Object.assign(M, R), re.hasCanvas && (M.layoutId = F);
|
|
12665
12636
|
for (let e = 0; e < Ce.length; e++) {
|
|
12666
12637
|
let t = Ce[e], n = L.blocks[e];
|
|
@@ -12685,7 +12656,7 @@ Hi.get("/*", async (e) => {
|
|
|
12685
12656
|
for (let [e, r] of Object.entries(Te)) {
|
|
12686
12657
|
let i = I[e] && I[e].length > 0, a = !!de[e];
|
|
12687
12658
|
if (I[e] || (I[e] = [], Se[e] = { isInherited: !1 }), (r?.inherit === "parent" || r?.inherit === !0 || r?.inherit === "true" || e === "header" || e === "footer") && !i && !a && D) {
|
|
12688
|
-
let r = await
|
|
12659
|
+
let r = await qi(t, D, e, h, s, n);
|
|
12689
12660
|
if (r.blocks.length > 0 && (I[e] = r.blocks, Se[e] = {
|
|
12690
12661
|
isInherited: !0,
|
|
12691
12662
|
inheritedFromId: r.inheritedFromId,
|
|
@@ -12697,7 +12668,7 @@ Hi.get("/*", async (e) => {
|
|
|
12697
12668
|
});
|
|
12698
12669
|
}
|
|
12699
12670
|
}
|
|
12700
|
-
await Promise.all(Object.keys(I).map((e) =>
|
|
12671
|
+
await Promise.all(Object.keys(I).map((e) => Ki(t, I[e], u)));
|
|
12701
12672
|
let Ee = {
|
|
12702
12673
|
channelId: u || d,
|
|
12703
12674
|
treeId: E,
|
|
@@ -12706,7 +12677,7 @@ Hi.get("/*", async (e) => {
|
|
|
12706
12677
|
content: I,
|
|
12707
12678
|
regionMeta: Se
|
|
12708
12679
|
};
|
|
12709
|
-
return !s && !m ? (e.header("X-Cache", "MISS"),
|
|
12680
|
+
return !s && !m ? (e.header("X-Cache", "MISS"), Vi(e, f.set(p, Ee, ia(e)))) : e.header("Cache-Control", "no-store, no-cache, must-revalidate"), e.json(Ee);
|
|
12710
12681
|
} catch (t) {
|
|
12711
12682
|
console.error("[CMS Public API] Error fetching node by path:", t);
|
|
12712
12683
|
let n = e.env?.ENVIRONMENT === "development";
|
|
@@ -12718,33 +12689,14 @@ Hi.get("/*", async (e) => {
|
|
|
12718
12689
|
});
|
|
12719
12690
|
//#endregion
|
|
12720
12691
|
//#region server/routes/public/tree.ts
|
|
12721
|
-
var
|
|
12722
|
-
function
|
|
12692
|
+
var aa = new n();
|
|
12693
|
+
function oa(e, t) {
|
|
12723
12694
|
let n = Promise.resolve(t).catch((e) => console.error("[Background Task Error]:", e));
|
|
12724
12695
|
try {
|
|
12725
12696
|
e.executionCtx && typeof e.executionCtx.waitUntil == "function" && e.executionCtx.waitUntil(n);
|
|
12726
12697
|
} catch {}
|
|
12727
12698
|
}
|
|
12728
|
-
|
|
12729
|
-
try {
|
|
12730
|
-
let r = e.prepare(t);
|
|
12731
|
-
if (typeof r.bind == "function") {
|
|
12732
|
-
let e = await r.bind(...n).all();
|
|
12733
|
-
return Array.isArray(e) ? e : e?.results || [];
|
|
12734
|
-
}
|
|
12735
|
-
if (typeof r.all == "function") {
|
|
12736
|
-
let e = await r.all(...n);
|
|
12737
|
-
return Array.isArray(e) ? e : e?.results || [];
|
|
12738
|
-
}
|
|
12739
|
-
return [];
|
|
12740
|
-
} catch (e) {
|
|
12741
|
-
return console.error("[Public Tree DB Error]:", e, "SQL:", t, "Params:", n), [];
|
|
12742
|
-
}
|
|
12743
|
-
}
|
|
12744
|
-
async function ua(e, t, n = []) {
|
|
12745
|
-
return (await la(e, t, n))[0] || null;
|
|
12746
|
-
}
|
|
12747
|
-
function da(e, t) {
|
|
12699
|
+
function sa(e, t) {
|
|
12748
12700
|
let n = /* @__PURE__ */ new Date();
|
|
12749
12701
|
if (e && String(e).trim() !== "") {
|
|
12750
12702
|
let t = new Date(e);
|
|
@@ -12756,22 +12708,22 @@ function da(e, t) {
|
|
|
12756
12708
|
}
|
|
12757
12709
|
return !0;
|
|
12758
12710
|
}
|
|
12759
|
-
|
|
12711
|
+
aa.get("/:treeParam", async (e) => {
|
|
12760
12712
|
try {
|
|
12761
12713
|
let t = e.get("db"), n = e.req.param("treeParam"), r = e.req.query("channelId") || e.req.query("channel") || "default", i = e.req.query("preview") === "true";
|
|
12762
12714
|
if (r && r !== "default" && r !== "all") {
|
|
12763
|
-
let n = isNaN(Number(r)) ? await
|
|
12715
|
+
let n = isNaN(Number(r)) ? await Promise.resolve(t.prepare("SELECT * FROM channels WHERE key = ?").get(r)) : await Promise.resolve(t.prepare("SELECT * FROM channels WHERE id = ?").get(Number(r)));
|
|
12764
12716
|
if (n) {
|
|
12765
12717
|
let t = n.status === "disabled" || n.status === "inactive" || n.isEnabled === 0 || n.isEnabled === !1;
|
|
12766
12718
|
if (!i && t) return e.json({ error: `Channel '${n.key || r}' is currently inactive` }, 404);
|
|
12767
12719
|
}
|
|
12768
12720
|
}
|
|
12769
|
-
let a =
|
|
12721
|
+
let a = q(e), o = `tree:${r}:${n}`, s = e.req.header("x-bypass-cache") === "true";
|
|
12770
12722
|
if (!i && !s) {
|
|
12771
12723
|
let t = await a.get(o);
|
|
12772
12724
|
if (t) return e.header("X-Cache", "HIT"), e.json(t);
|
|
12773
12725
|
}
|
|
12774
|
-
let c = !isNaN(Number(n)), l = c ? Number(n) : n, u = await
|
|
12726
|
+
let c = !isNaN(Number(n)), l = c ? Number(n) : n, u = await Promise.resolve(t.prepare(`SELECT * FROM trees WHERE ${c ? "id" : "key"} = ?`).get(l)), d = i ? "COALESCE(c.draftDataJson, c.dataJson, '{}')" : "COALESCE(c.dataJson, c.draftDataJson, '{}')", f = await Promise.resolve(t.prepare(`
|
|
12775
12727
|
SELECT
|
|
12776
12728
|
t.id as treeNodeId,
|
|
12777
12729
|
t.treeId,
|
|
@@ -12795,12 +12747,12 @@ sa.get("/:treeParam", async (e) => {
|
|
|
12795
12747
|
WHERE t.treeId = ${c ? "?" : "(SELECT id FROM trees WHERE key = ?)"}
|
|
12796
12748
|
AND (c.deletedAt IS NULL OR c.deletedAt = '')
|
|
12797
12749
|
ORDER BY t.sortOrder ASC
|
|
12798
|
-
|
|
12750
|
+
`).all(l));
|
|
12799
12751
|
if (u && Number(u.isHidden) === 1 && !i) return e.json({ error: `Tree '${n}' is hidden` }, 404);
|
|
12800
12752
|
if (!f.length && !u) return e.json({ error: `Tree '${n}' not found` }, 404);
|
|
12801
12753
|
let p = {};
|
|
12802
12754
|
if (u && u.dataJson) try {
|
|
12803
|
-
let t = typeof u.dataJson == "string" ? JSON.parse(u.dataJson) : u.dataJson, r = e.env?.BUNDLED_DEFINITIONS, i =
|
|
12755
|
+
let t = typeof u.dataJson == "string" ? JSON.parse(u.dataJson) : u.dataJson, r = e.env?.BUNDLED_DEFINITIONS, i = Pr(r), a = (i.trees?.[u.treeType || n] || i.trees?.site || {}).fields || {};
|
|
12804
12756
|
for (let [e, n] of Object.entries(t)) a[e]?.public === !0 && (p[e] = n);
|
|
12805
12757
|
} catch (e) {
|
|
12806
12758
|
console.warn("[CMS Public Tree API] Failed to parse tree dataJson", e);
|
|
@@ -12810,25 +12762,30 @@ sa.get("/:treeParam", async (e) => {
|
|
|
12810
12762
|
let t = !e.parentId || e.parentId === "null" || e.parentId === "" ? null : e.parentId, n = t === null ? "__ROOT__" : String(t), r = m.get(n);
|
|
12811
12763
|
r ? r.push(e) : m.set(n, [e]);
|
|
12812
12764
|
}
|
|
12813
|
-
function h(e = null, t = "") {
|
|
12814
|
-
|
|
12815
|
-
|
|
12816
|
-
|
|
12765
|
+
function h(e = null, t = "", n = 0, r = /* @__PURE__ */ new Set()) {
|
|
12766
|
+
if (n > 50) return console.error("[CMS] Infinite loop aborted in public tree: depth > 50"), [];
|
|
12767
|
+
let a = e == null || e === "" || e === "null" ? "__ROOT__" : String(e);
|
|
12768
|
+
return (m.get(a) || []).map((e) => {
|
|
12769
|
+
let a = String(e.treeNodeId);
|
|
12770
|
+
if (r.has(a)) return console.warn(`[CMS] Cycle detected for treeNodeId: ${a}. Aborting branch.`), null;
|
|
12771
|
+
let o = new Set(r);
|
|
12772
|
+
o.add(a);
|
|
12773
|
+
let s = !i && (e.status === "draft" || e.status === "new"), c = e.extHidden === 1 || e.extHidden === !0 || e.extHidden === "true" || e.extHidden === "1", l = Number(e.isHidden) === 1 || s || c, u = sa(e.extStart, e.extStop), d = (e.slug || "").replace(/^\/+|\/+$/g, ""), f = (!e.parentId || e.parentId === "null" || e.parentId === "") && (d === "home" || d === "homee") ? "/" : `${t}/${d}`.replace(/\/+/g, "/"), p = {
|
|
12817
12774
|
id: e.id,
|
|
12818
12775
|
treeNodeId: e.treeNodeId,
|
|
12819
12776
|
parentId: e.parentId || null,
|
|
12820
12777
|
title: e.title,
|
|
12821
|
-
slug:
|
|
12778
|
+
slug: d,
|
|
12822
12779
|
language: e.language || "en",
|
|
12823
|
-
path:
|
|
12780
|
+
path: f,
|
|
12824
12781
|
nodeType: e.nodeType,
|
|
12825
|
-
hidden:
|
|
12782
|
+
hidden: l || !u ? 1 : 0,
|
|
12826
12783
|
summary: e.extSummary || ""
|
|
12827
12784
|
};
|
|
12828
|
-
e.nodeType === "external-link" && (e.extUrl && (
|
|
12829
|
-
let
|
|
12830
|
-
return
|
|
12831
|
-
}).filter((e) => i || !e.hidden);
|
|
12785
|
+
e.nodeType === "external-link" && (e.extUrl && (p.url = e.extUrl), e.extTarget && (p.target = e.extTarget));
|
|
12786
|
+
let m = f === "/" ? "" : f;
|
|
12787
|
+
return p.children = h(e.treeNodeId, m, n + 1, o), p;
|
|
12788
|
+
}).filter((e) => e !== null && (i || !e.hidden));
|
|
12832
12789
|
}
|
|
12833
12790
|
let g = {
|
|
12834
12791
|
treeId: u?.id || (c ? Number(n) : null),
|
|
@@ -12838,7 +12795,7 @@ sa.get("/:treeParam", async (e) => {
|
|
|
12838
12795
|
...p,
|
|
12839
12796
|
items: h(null)
|
|
12840
12797
|
};
|
|
12841
|
-
return !i && !s ? (e.header("X-Cache", "MISS"),
|
|
12798
|
+
return !i && !s ? (e.header("X-Cache", "MISS"), oa(e, a.set(o, g, 300))) : e.header("Cache-Control", "no-store, no-cache, must-revalidate"), e.json(g);
|
|
12842
12799
|
} catch (t) {
|
|
12843
12800
|
return console.error("[CMS Public Tree API] Error:", t), e.json({
|
|
12844
12801
|
error: "Failed to fetch public tree",
|
|
@@ -12848,8 +12805,8 @@ sa.get("/:treeParam", async (e) => {
|
|
|
12848
12805
|
});
|
|
12849
12806
|
//#endregion
|
|
12850
12807
|
//#region server/routes/public/assets.ts
|
|
12851
|
-
var
|
|
12852
|
-
function
|
|
12808
|
+
var ca = new n();
|
|
12809
|
+
function la(e, t) {
|
|
12853
12810
|
if (t === "webp") return "image/webp";
|
|
12854
12811
|
if (t === "avif") return "image/avif";
|
|
12855
12812
|
if (t === "jpeg" || t === "jpg") return "image/jpeg";
|
|
@@ -12857,7 +12814,7 @@ function pa(e, t) {
|
|
|
12857
12814
|
let n = e.toLowerCase();
|
|
12858
12815
|
return n.endsWith(".jpg") || n.endsWith(".jpeg") ? "image/jpeg" : n.endsWith(".png") ? "image/png" : n.endsWith(".webp") ? "image/webp" : n.endsWith(".gif") ? "image/gif" : n.endsWith(".svg") ? "image/svg+xml" : n.endsWith(".pdf") ? "application/pdf" : n.endsWith(".mp4") ? "video/mp4" : n.endsWith(".webm") ? "video/webm" : "application/octet-stream";
|
|
12859
12816
|
}
|
|
12860
|
-
|
|
12817
|
+
ca.get("/*", async (e) => {
|
|
12861
12818
|
let t = e.req.path.replace(/^\/media\//, "").replace(/^\//, "");
|
|
12862
12819
|
if (!t) return e.text("Asset key missing", 400);
|
|
12863
12820
|
let n = e.env?.MEDIA_BUCKET, { w: r, h: i, q: a, f: o } = e.req.query(), s = !!(r || i || a || o), c = e.req.header("Accept") || "", l = "";
|
|
@@ -12874,7 +12831,7 @@ fa.get("/*", async (e) => {
|
|
|
12874
12831
|
}
|
|
12875
12832
|
let p = e.req.header("Via")?.includes("image-resizing") || e.req.header("User-Agent")?.includes("Cloudflare-ImgRen"), m = new URL(e.req.url), h = e.env?.CDN_DOMAIN || m.hostname;
|
|
12876
12833
|
if (n) {
|
|
12877
|
-
let l =
|
|
12834
|
+
let l = la(t), u = l.startsWith("image/") && !l.includes("svg");
|
|
12878
12835
|
if (s && u && h && !p) {
|
|
12879
12836
|
let e = r ? parseInt(r, 10) : void 0, n = i ? parseInt(i, 10) : void 0, s = a ? parseInt(a, 10) : 85, l = o || "auto", u = `https://${h}/media/${t}`;
|
|
12880
12837
|
try {
|
|
@@ -12917,7 +12874,7 @@ fa.get("/*", async (e) => {
|
|
|
12917
12874
|
if (!s) {
|
|
12918
12875
|
let n = _(C);
|
|
12919
12876
|
return e.body(n, 200, {
|
|
12920
|
-
"Content-Type":
|
|
12877
|
+
"Content-Type": la(t),
|
|
12921
12878
|
"Cache-Control": "public, max-age=86400"
|
|
12922
12879
|
});
|
|
12923
12880
|
}
|
|
@@ -12925,7 +12882,7 @@ fa.get("/*", async (e) => {
|
|
|
12925
12882
|
if (g(f)) {
|
|
12926
12883
|
let n = _(f);
|
|
12927
12884
|
return e.body(n, 200, {
|
|
12928
|
-
"Content-Type":
|
|
12885
|
+
"Content-Type": la(t, u),
|
|
12929
12886
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
12930
12887
|
"X-Local-Cache": "HIT"
|
|
12931
12888
|
});
|
|
@@ -12938,14 +12895,14 @@ fa.get("/*", async (e) => {
|
|
|
12938
12895
|
typeof n == "number" && (a.width = n), typeof o == "number" && (a.height = o), (a.width || a.height) && (a.fit = "cover", i = i.resize(a)), u === "webp" ? i = i.webp({ quality: typeof c == "number" ? c : 80 }) : u === "avif" ? i = i.avif({ quality: typeof c == "number" ? c : 70 }) : u === "jpeg" || u === "jpg" ? i = i.jpeg({ quality: typeof c == "number" ? c : 80 }) : u === "png" && (i = i.png({ quality: typeof c == "number" ? c : 80 }));
|
|
12939
12896
|
let s = await i.toBuffer();
|
|
12940
12897
|
return v(x(f), { recursive: !0 }), y(f, s), e.body(s, 200, {
|
|
12941
|
-
"Content-Type":
|
|
12898
|
+
"Content-Type": la(t, u),
|
|
12942
12899
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
12943
12900
|
"X-Local-Cache": "MISS"
|
|
12944
12901
|
});
|
|
12945
12902
|
} catch {
|
|
12946
12903
|
let n = _(C);
|
|
12947
12904
|
return e.body(n, 200, {
|
|
12948
|
-
"Content-Type":
|
|
12905
|
+
"Content-Type": la(t),
|
|
12949
12906
|
"Cache-Control": "public, max-age=86400"
|
|
12950
12907
|
});
|
|
12951
12908
|
}
|
|
@@ -12956,8 +12913,8 @@ fa.get("/*", async (e) => {
|
|
|
12956
12913
|
});
|
|
12957
12914
|
//#endregion
|
|
12958
12915
|
//#region server/routes/public/paths.ts
|
|
12959
|
-
var
|
|
12960
|
-
function
|
|
12916
|
+
var ua = new n();
|
|
12917
|
+
function da(e, t) {
|
|
12961
12918
|
let n = /* @__PURE__ */ new Date();
|
|
12962
12919
|
if (e && String(e).trim() !== "") {
|
|
12963
12920
|
let t = new Date(e);
|
|
@@ -12969,7 +12926,7 @@ function ha(e, t) {
|
|
|
12969
12926
|
}
|
|
12970
12927
|
return !0;
|
|
12971
12928
|
}
|
|
12972
|
-
|
|
12929
|
+
ua.get("/", async (e) => {
|
|
12973
12930
|
try {
|
|
12974
12931
|
let t = await e.get("db").prepare("\n SELECT\n t.id as treeNodeId,\n t.parentId,\n c.slug,\n c.contentType as nodeType,\n c.status,\n c.dataJson\n FROM tree_nodes t\n INNER JOIN content_nodes c ON t.contentId = c.id\n WHERE (c.deletedAt IS NULL OR c.deletedAt = '')\n ORDER BY t.sortOrder ASC\n ").all(), n = Array.isArray(t) ? t : t?.results || [], r = [], i = /* @__PURE__ */ new Map();
|
|
12975
12932
|
for (let e of n) {
|
|
@@ -12993,7 +12950,7 @@ ma.get("/", async (e) => {
|
|
|
12993
12950
|
function o(e = null, t = "") {
|
|
12994
12951
|
let n = e == null || e === "" || e === "null" ? "__ROOT__" : String(e), s = i.get(n) || [];
|
|
12995
12952
|
for (let e of s) {
|
|
12996
|
-
let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s =
|
|
12953
|
+
let n = a.get(String(e.treeNodeId)) || {}, i = e.status === "published" || e.status === "active", s = da(n.startShowingAt, n.stopShowingAt);
|
|
12997
12954
|
if (!i || !s) continue;
|
|
12998
12955
|
let c = (e.slug || "").replace(/^\/+|\/+$/g, ""), l = c === "home" || c === "homee" ? "/" : `${t}/${c}`.replace(/\/+/g, "/");
|
|
12999
12956
|
e.nodeType !== "external-link" && r.push(l);
|
|
@@ -13010,8 +12967,8 @@ ma.get("/", async (e) => {
|
|
|
13010
12967
|
});
|
|
13011
12968
|
//#endregion
|
|
13012
12969
|
//#region server/index.ts
|
|
13013
|
-
var
|
|
13014
|
-
$.use("*",
|
|
12970
|
+
var fa = Fr(), $ = new n(), pa = !1;
|
|
12971
|
+
$.use("*", Lr()), $.use("/media/*", Lr({
|
|
13015
12972
|
origin: "*",
|
|
13016
12973
|
allowMethods: [
|
|
13017
12974
|
"GET",
|
|
@@ -13028,18 +12985,18 @@ $.use("*", Rr()), $.use("/media/*", Rr({
|
|
|
13028
12985
|
await t(), e.header("Cache-Control", "public, max-age=31536000, immutable"), e.header("Access-Control-Allow-Origin", "*");
|
|
13029
12986
|
}), $.use("*", async (e, t) => {
|
|
13030
12987
|
if (e.req.path.startsWith("/media/")) return t();
|
|
13031
|
-
let n =
|
|
13032
|
-
e.env?.BUNDLED_DEFINITIONS && (e.env.BUNDLED_DEFINITIONS._isCompiled || (e.env.BUNDLED_DEFINITIONS =
|
|
12988
|
+
let n = fa;
|
|
12989
|
+
e.env?.BUNDLED_DEFINITIONS && (e.env.BUNDLED_DEFINITIONS._isCompiled || (e.env.BUNDLED_DEFINITIONS = Fr(e.env.BUNDLED_DEFINITIONS), e.env.BUNDLED_DEFINITIONS._isCompiled = !0), n = e.env.BUNDLED_DEFINITIONS), e.set("schemas", n);
|
|
13033
12990
|
let r = new URL(e.req.url), i = (e.req.header("host") || r.hostname).split(":")[0];
|
|
13034
12991
|
e.set("currentDomain", i);
|
|
13035
|
-
let a =
|
|
13036
|
-
if (e.set("db", a), !
|
|
13037
|
-
await
|
|
12992
|
+
let a = Vr(e);
|
|
12993
|
+
if (e.set("db", a), !pa) try {
|
|
12994
|
+
await Gr(a, n), pa = !0;
|
|
13038
12995
|
} catch (e) {
|
|
13039
12996
|
console.error("❌ [CMS Server] Failed to initialize system tables on cold start:", e);
|
|
13040
12997
|
}
|
|
13041
12998
|
await t();
|
|
13042
|
-
}), $.route("/media",
|
|
12999
|
+
}), $.route("/media", ca), $.use("/media/*", qr()), $.route("/api/cms/nodes", Y), $.route("/api/cms/nodes.json", Y), $.route("/api/cms/formcsv", Y), $.route("/api/cms/formcsv.json", Y), $.route("/api/cms/stats", Ni), $.route("/api/cms/stats.json", Ni), $.route("/api/cms", bi), $.route("/api/cms/channels", Ti), $.route("/api/cms/channels.json", Ti), $.route("/api/cms/schemas", Di), $.route("/api/cms/schemas.json", Di), $.route("/api/admin/schemas", Di), $.route("/api/cms", Ai), $.route("/api/admin/assets", Ri), $.route("/api/v1/node", Bi), $.route("/api/v1/page", Bi), $.route("/api/v1/tree", aa), $.route("/api/v1/all-paths", ua), $.get("*", async (e) => {
|
|
13043
13000
|
if (e.env?.ASSETS) {
|
|
13044
13001
|
let t = await e.env.ASSETS.fetch(e.req.raw);
|
|
13045
13002
|
if (t.status === 404) {
|
|
@@ -13051,4 +13008,4 @@ $.use("*", Rr()), $.use("/media/*", Rr({
|
|
|
13051
13008
|
return e.text("Kama CMS Engine Active", 200);
|
|
13052
13009
|
});
|
|
13053
13010
|
//#endregion
|
|
13054
|
-
export { $ as app, $ as default,
|
|
13011
|
+
export { $ as app, $ as default, Er as registerHostSchemas };
|