@learncard/network-plugin 2.9.0 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lcn-plugin.cjs.development.js +541 -18
- package/dist/lcn-plugin.cjs.development.js.map +4 -4
- package/dist/lcn-plugin.cjs.production.min.js +38 -27
- package/dist/lcn-plugin.cjs.production.min.js.map +4 -4
- package/dist/lcn-plugin.esm.js +541 -18
- package/dist/lcn-plugin.esm.js.map +4 -4
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -8
|
@@ -722,9 +722,9 @@ function maybeFreeze(scope, value, deep = false) {
|
|
|
722
722
|
__name(maybeFreeze, "maybeFreeze");
|
|
723
723
|
__name2(maybeFreeze, "maybeFreeze");
|
|
724
724
|
function createProxyProxy(base, parent) {
|
|
725
|
-
const
|
|
725
|
+
const isArray2 = Array.isArray(base);
|
|
726
726
|
const state = {
|
|
727
|
-
type_:
|
|
727
|
+
type_: isArray2 ? 1 : 0,
|
|
728
728
|
// Track which produce call this is associated with.
|
|
729
729
|
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
730
730
|
// True for both shallow and deep changes.
|
|
@@ -748,7 +748,7 @@ function createProxyProxy(base, parent) {
|
|
|
748
748
|
};
|
|
749
749
|
let target = state;
|
|
750
750
|
let traps = objectTraps;
|
|
751
|
-
if (
|
|
751
|
+
if (isArray2) {
|
|
752
752
|
target = [state];
|
|
753
753
|
traps = arrayTraps;
|
|
754
754
|
}
|
|
@@ -29516,7 +29516,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29516
29516
|
contractUri: external_exports22.string().optional(),
|
|
29517
29517
|
templateUri: external_exports22.string().optional(),
|
|
29518
29518
|
template: SendBoostTemplateValidator2.optional(),
|
|
29519
|
-
signedCredential: VCValidator2.optional()
|
|
29519
|
+
signedCredential: VCValidator2.optional(),
|
|
29520
|
+
templateData: external_exports22.record(external_exports22.string(), external_exports22.unknown()).optional()
|
|
29520
29521
|
}).refine((data) => data.templateUri || data.template, {
|
|
29521
29522
|
message: "Either templateUri or template creation data must be provided.",
|
|
29522
29523
|
path: ["templateUri"]
|
|
@@ -30513,16 +30514,16 @@ function parserForArrayFormat(options) {
|
|
|
30513
30514
|
case "comma":
|
|
30514
30515
|
case "separator": {
|
|
30515
30516
|
return (key, value, accumulator) => {
|
|
30516
|
-
const
|
|
30517
|
-
const newValue =
|
|
30517
|
+
const isArray2 = typeof value === "string" && value.includes(options.arrayFormatSeparator);
|
|
30518
|
+
const newValue = isArray2 ? value.split(options.arrayFormatSeparator).map((item) => decode3(item, options)) : value === null ? value : decode3(value, options);
|
|
30518
30519
|
accumulator[key] = newValue;
|
|
30519
30520
|
};
|
|
30520
30521
|
}
|
|
30521
30522
|
case "bracket-separator": {
|
|
30522
30523
|
return (key, value, accumulator) => {
|
|
30523
|
-
const
|
|
30524
|
+
const isArray2 = /(\[])$/.test(key);
|
|
30524
30525
|
key = key.replace(/\[]$/, "");
|
|
30525
|
-
if (!
|
|
30526
|
+
if (!isArray2) {
|
|
30526
30527
|
accumulator[key] = value ? decode3(value, options) : value;
|
|
30527
30528
|
return;
|
|
30528
30529
|
}
|
|
@@ -46116,7 +46117,8 @@ var SendBoostInputValidator = external_exports2.object({
|
|
|
46116
46117
|
contractUri: external_exports2.string().optional(),
|
|
46117
46118
|
templateUri: external_exports2.string().optional(),
|
|
46118
46119
|
template: SendBoostTemplateValidator.optional(),
|
|
46119
|
-
signedCredential: VCValidator.optional()
|
|
46120
|
+
signedCredential: VCValidator.optional(),
|
|
46121
|
+
templateData: external_exports2.record(external_exports2.string(), external_exports2.unknown()).optional()
|
|
46120
46122
|
}).refine((data) => data.templateUri || data.template, {
|
|
46121
46123
|
message: "Either templateUri or template creation data must be provided.",
|
|
46122
46124
|
path: ["templateUri"]
|
|
@@ -47253,9 +47255,9 @@ function maybeFreeze2(scope, value, deep = false) {
|
|
|
47253
47255
|
}
|
|
47254
47256
|
__name(maybeFreeze2, "maybeFreeze");
|
|
47255
47257
|
function createProxyProxy2(base, parent) {
|
|
47256
|
-
const
|
|
47258
|
+
const isArray2 = Array.isArray(base);
|
|
47257
47259
|
const state = {
|
|
47258
|
-
type_:
|
|
47260
|
+
type_: isArray2 ? 1 : 0,
|
|
47259
47261
|
// Track which produce call this is associated with.
|
|
47260
47262
|
scope_: parent ? parent.scope_ : getCurrentScope2(),
|
|
47261
47263
|
// True for both shallow and deep changes.
|
|
@@ -47279,7 +47281,7 @@ function createProxyProxy2(base, parent) {
|
|
|
47279
47281
|
};
|
|
47280
47282
|
let target = state;
|
|
47281
47283
|
let traps = objectTraps2;
|
|
47282
|
-
if (
|
|
47284
|
+
if (isArray2) {
|
|
47283
47285
|
target = [state];
|
|
47284
47286
|
traps = arrayTraps2;
|
|
47285
47287
|
}
|
|
@@ -62303,7 +62305,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
62303
62305
|
contractUri: external_exports3.string().optional(),
|
|
62304
62306
|
templateUri: external_exports3.string().optional(),
|
|
62305
62307
|
template: SendBoostTemplateValidator2.optional(),
|
|
62306
|
-
signedCredential: VCValidator2.optional()
|
|
62308
|
+
signedCredential: VCValidator2.optional(),
|
|
62309
|
+
templateData: external_exports3.record(external_exports3.string(), external_exports3.unknown()).optional()
|
|
62307
62310
|
}).refine((data) => data.templateUri || data.template, {
|
|
62308
62311
|
message: "Either templateUri or template creation data must be provided.",
|
|
62309
62312
|
path: ["templateUri"]
|
|
@@ -63299,16 +63302,16 @@ function parserForArrayFormat2(options) {
|
|
|
63299
63302
|
case "comma":
|
|
63300
63303
|
case "separator": {
|
|
63301
63304
|
return (key, value, accumulator) => {
|
|
63302
|
-
const
|
|
63303
|
-
const newValue =
|
|
63305
|
+
const isArray2 = typeof value === "string" && value.includes(options.arrayFormatSeparator);
|
|
63306
|
+
const newValue = isArray2 ? value.split(options.arrayFormatSeparator).map((item) => decode6(item, options)) : value === null ? value : decode6(value, options);
|
|
63304
63307
|
accumulator[key] = newValue;
|
|
63305
63308
|
};
|
|
63306
63309
|
}
|
|
63307
63310
|
case "bracket-separator": {
|
|
63308
63311
|
return (key, value, accumulator) => {
|
|
63309
|
-
const
|
|
63312
|
+
const isArray2 = /(\[])$/.test(key);
|
|
63310
63313
|
key = key.replace(/\[]$/, "");
|
|
63311
|
-
if (!
|
|
63314
|
+
if (!isArray2) {
|
|
63312
63315
|
accumulator[key] = value ? decode6(value, options) : value;
|
|
63313
63316
|
return;
|
|
63314
63317
|
}
|
|
@@ -63779,7 +63782,494 @@ var isVC2Format = /* @__PURE__ */ __name4((credential) => {
|
|
|
63779
63782
|
return credential["@context"].includes("https://www.w3.org/ns/credentials/v2");
|
|
63780
63783
|
}, "isVC2Format");
|
|
63781
63784
|
|
|
63785
|
+
// ../../../node_modules/.pnpm/mustache@4.2.0/node_modules/mustache/mustache.mjs
|
|
63786
|
+
var objectToString = Object.prototype.toString;
|
|
63787
|
+
var isArray = Array.isArray || /* @__PURE__ */ __name(function isArrayPolyfill(object3) {
|
|
63788
|
+
return objectToString.call(object3) === "[object Array]";
|
|
63789
|
+
}, "isArrayPolyfill");
|
|
63790
|
+
function isFunction(object3) {
|
|
63791
|
+
return typeof object3 === "function";
|
|
63792
|
+
}
|
|
63793
|
+
__name(isFunction, "isFunction");
|
|
63794
|
+
function typeStr(obj) {
|
|
63795
|
+
return isArray(obj) ? "array" : typeof obj;
|
|
63796
|
+
}
|
|
63797
|
+
__name(typeStr, "typeStr");
|
|
63798
|
+
function escapeRegExp(string7) {
|
|
63799
|
+
return string7.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
63800
|
+
}
|
|
63801
|
+
__name(escapeRegExp, "escapeRegExp");
|
|
63802
|
+
function hasProperty(obj, propName) {
|
|
63803
|
+
return obj != null && typeof obj === "object" && propName in obj;
|
|
63804
|
+
}
|
|
63805
|
+
__name(hasProperty, "hasProperty");
|
|
63806
|
+
function primitiveHasOwnProperty(primitive, propName) {
|
|
63807
|
+
return primitive != null && typeof primitive !== "object" && primitive.hasOwnProperty && primitive.hasOwnProperty(propName);
|
|
63808
|
+
}
|
|
63809
|
+
__name(primitiveHasOwnProperty, "primitiveHasOwnProperty");
|
|
63810
|
+
var regExpTest = RegExp.prototype.test;
|
|
63811
|
+
function testRegExp(re, string7) {
|
|
63812
|
+
return regExpTest.call(re, string7);
|
|
63813
|
+
}
|
|
63814
|
+
__name(testRegExp, "testRegExp");
|
|
63815
|
+
var nonSpaceRe = /\S/;
|
|
63816
|
+
function isWhitespace(string7) {
|
|
63817
|
+
return !testRegExp(nonSpaceRe, string7);
|
|
63818
|
+
}
|
|
63819
|
+
__name(isWhitespace, "isWhitespace");
|
|
63820
|
+
var entityMap = {
|
|
63821
|
+
"&": "&",
|
|
63822
|
+
"<": "<",
|
|
63823
|
+
">": ">",
|
|
63824
|
+
'"': """,
|
|
63825
|
+
"'": "'",
|
|
63826
|
+
"/": "/",
|
|
63827
|
+
"`": "`",
|
|
63828
|
+
"=": "="
|
|
63829
|
+
};
|
|
63830
|
+
function escapeHtml(string7) {
|
|
63831
|
+
return String(string7).replace(/[&<>"'`=\/]/g, /* @__PURE__ */ __name(function fromEntityMap(s) {
|
|
63832
|
+
return entityMap[s];
|
|
63833
|
+
}, "fromEntityMap"));
|
|
63834
|
+
}
|
|
63835
|
+
__name(escapeHtml, "escapeHtml");
|
|
63836
|
+
var whiteRe = /\s*/;
|
|
63837
|
+
var spaceRe = /\s+/;
|
|
63838
|
+
var equalsRe = /\s*=/;
|
|
63839
|
+
var curlyRe = /\s*\}/;
|
|
63840
|
+
var tagRe = /#|\^|\/|>|\{|&|=|!/;
|
|
63841
|
+
function parseTemplate(template, tags) {
|
|
63842
|
+
if (!template)
|
|
63843
|
+
return [];
|
|
63844
|
+
var lineHasNonSpace = false;
|
|
63845
|
+
var sections = [];
|
|
63846
|
+
var tokens = [];
|
|
63847
|
+
var spaces = [];
|
|
63848
|
+
var hasTag = false;
|
|
63849
|
+
var nonSpace = false;
|
|
63850
|
+
var indentation = "";
|
|
63851
|
+
var tagIndex = 0;
|
|
63852
|
+
function stripSpace() {
|
|
63853
|
+
if (hasTag && !nonSpace) {
|
|
63854
|
+
while (spaces.length)
|
|
63855
|
+
delete tokens[spaces.pop()];
|
|
63856
|
+
} else {
|
|
63857
|
+
spaces = [];
|
|
63858
|
+
}
|
|
63859
|
+
hasTag = false;
|
|
63860
|
+
nonSpace = false;
|
|
63861
|
+
}
|
|
63862
|
+
__name(stripSpace, "stripSpace");
|
|
63863
|
+
var openingTagRe, closingTagRe, closingCurlyRe;
|
|
63864
|
+
function compileTags(tagsToCompile) {
|
|
63865
|
+
if (typeof tagsToCompile === "string")
|
|
63866
|
+
tagsToCompile = tagsToCompile.split(spaceRe, 2);
|
|
63867
|
+
if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)
|
|
63868
|
+
throw new Error("Invalid tags: " + tagsToCompile);
|
|
63869
|
+
openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + "\\s*");
|
|
63870
|
+
closingTagRe = new RegExp("\\s*" + escapeRegExp(tagsToCompile[1]));
|
|
63871
|
+
closingCurlyRe = new RegExp("\\s*" + escapeRegExp("}" + tagsToCompile[1]));
|
|
63872
|
+
}
|
|
63873
|
+
__name(compileTags, "compileTags");
|
|
63874
|
+
compileTags(tags || mustache.tags);
|
|
63875
|
+
var scanner = new Scanner(template);
|
|
63876
|
+
var start, type, value, chr, token, openSection;
|
|
63877
|
+
while (!scanner.eos()) {
|
|
63878
|
+
start = scanner.pos;
|
|
63879
|
+
value = scanner.scanUntil(openingTagRe);
|
|
63880
|
+
if (value) {
|
|
63881
|
+
for (var i = 0, valueLength = value.length; i < valueLength; ++i) {
|
|
63882
|
+
chr = value.charAt(i);
|
|
63883
|
+
if (isWhitespace(chr)) {
|
|
63884
|
+
spaces.push(tokens.length);
|
|
63885
|
+
indentation += chr;
|
|
63886
|
+
} else {
|
|
63887
|
+
nonSpace = true;
|
|
63888
|
+
lineHasNonSpace = true;
|
|
63889
|
+
indentation += " ";
|
|
63890
|
+
}
|
|
63891
|
+
tokens.push(["text", chr, start, start + 1]);
|
|
63892
|
+
start += 1;
|
|
63893
|
+
if (chr === "\n") {
|
|
63894
|
+
stripSpace();
|
|
63895
|
+
indentation = "";
|
|
63896
|
+
tagIndex = 0;
|
|
63897
|
+
lineHasNonSpace = false;
|
|
63898
|
+
}
|
|
63899
|
+
}
|
|
63900
|
+
}
|
|
63901
|
+
if (!scanner.scan(openingTagRe))
|
|
63902
|
+
break;
|
|
63903
|
+
hasTag = true;
|
|
63904
|
+
type = scanner.scan(tagRe) || "name";
|
|
63905
|
+
scanner.scan(whiteRe);
|
|
63906
|
+
if (type === "=") {
|
|
63907
|
+
value = scanner.scanUntil(equalsRe);
|
|
63908
|
+
scanner.scan(equalsRe);
|
|
63909
|
+
scanner.scanUntil(closingTagRe);
|
|
63910
|
+
} else if (type === "{") {
|
|
63911
|
+
value = scanner.scanUntil(closingCurlyRe);
|
|
63912
|
+
scanner.scan(curlyRe);
|
|
63913
|
+
scanner.scanUntil(closingTagRe);
|
|
63914
|
+
type = "&";
|
|
63915
|
+
} else {
|
|
63916
|
+
value = scanner.scanUntil(closingTagRe);
|
|
63917
|
+
}
|
|
63918
|
+
if (!scanner.scan(closingTagRe))
|
|
63919
|
+
throw new Error("Unclosed tag at " + scanner.pos);
|
|
63920
|
+
if (type == ">") {
|
|
63921
|
+
token = [type, value, start, scanner.pos, indentation, tagIndex, lineHasNonSpace];
|
|
63922
|
+
} else {
|
|
63923
|
+
token = [type, value, start, scanner.pos];
|
|
63924
|
+
}
|
|
63925
|
+
tagIndex++;
|
|
63926
|
+
tokens.push(token);
|
|
63927
|
+
if (type === "#" || type === "^") {
|
|
63928
|
+
sections.push(token);
|
|
63929
|
+
} else if (type === "/") {
|
|
63930
|
+
openSection = sections.pop();
|
|
63931
|
+
if (!openSection)
|
|
63932
|
+
throw new Error('Unopened section "' + value + '" at ' + start);
|
|
63933
|
+
if (openSection[1] !== value)
|
|
63934
|
+
throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
|
|
63935
|
+
} else if (type === "name" || type === "{" || type === "&") {
|
|
63936
|
+
nonSpace = true;
|
|
63937
|
+
} else if (type === "=") {
|
|
63938
|
+
compileTags(value);
|
|
63939
|
+
}
|
|
63940
|
+
}
|
|
63941
|
+
stripSpace();
|
|
63942
|
+
openSection = sections.pop();
|
|
63943
|
+
if (openSection)
|
|
63944
|
+
throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
|
|
63945
|
+
return nestTokens(squashTokens(tokens));
|
|
63946
|
+
}
|
|
63947
|
+
__name(parseTemplate, "parseTemplate");
|
|
63948
|
+
function squashTokens(tokens) {
|
|
63949
|
+
var squashedTokens = [];
|
|
63950
|
+
var token, lastToken;
|
|
63951
|
+
for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
|
|
63952
|
+
token = tokens[i];
|
|
63953
|
+
if (token) {
|
|
63954
|
+
if (token[0] === "text" && lastToken && lastToken[0] === "text") {
|
|
63955
|
+
lastToken[1] += token[1];
|
|
63956
|
+
lastToken[3] = token[3];
|
|
63957
|
+
} else {
|
|
63958
|
+
squashedTokens.push(token);
|
|
63959
|
+
lastToken = token;
|
|
63960
|
+
}
|
|
63961
|
+
}
|
|
63962
|
+
}
|
|
63963
|
+
return squashedTokens;
|
|
63964
|
+
}
|
|
63965
|
+
__name(squashTokens, "squashTokens");
|
|
63966
|
+
function nestTokens(tokens) {
|
|
63967
|
+
var nestedTokens = [];
|
|
63968
|
+
var collector = nestedTokens;
|
|
63969
|
+
var sections = [];
|
|
63970
|
+
var token, section;
|
|
63971
|
+
for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
|
|
63972
|
+
token = tokens[i];
|
|
63973
|
+
switch (token[0]) {
|
|
63974
|
+
case "#":
|
|
63975
|
+
case "^":
|
|
63976
|
+
collector.push(token);
|
|
63977
|
+
sections.push(token);
|
|
63978
|
+
collector = token[4] = [];
|
|
63979
|
+
break;
|
|
63980
|
+
case "/":
|
|
63981
|
+
section = sections.pop();
|
|
63982
|
+
section[5] = token[2];
|
|
63983
|
+
collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
|
|
63984
|
+
break;
|
|
63985
|
+
default:
|
|
63986
|
+
collector.push(token);
|
|
63987
|
+
}
|
|
63988
|
+
}
|
|
63989
|
+
return nestedTokens;
|
|
63990
|
+
}
|
|
63991
|
+
__name(nestTokens, "nestTokens");
|
|
63992
|
+
function Scanner(string7) {
|
|
63993
|
+
this.string = string7;
|
|
63994
|
+
this.tail = string7;
|
|
63995
|
+
this.pos = 0;
|
|
63996
|
+
}
|
|
63997
|
+
__name(Scanner, "Scanner");
|
|
63998
|
+
Scanner.prototype.eos = /* @__PURE__ */ __name(function eos() {
|
|
63999
|
+
return this.tail === "";
|
|
64000
|
+
}, "eos");
|
|
64001
|
+
Scanner.prototype.scan = /* @__PURE__ */ __name(function scan(re) {
|
|
64002
|
+
var match = this.tail.match(re);
|
|
64003
|
+
if (!match || match.index !== 0)
|
|
64004
|
+
return "";
|
|
64005
|
+
var string7 = match[0];
|
|
64006
|
+
this.tail = this.tail.substring(string7.length);
|
|
64007
|
+
this.pos += string7.length;
|
|
64008
|
+
return string7;
|
|
64009
|
+
}, "scan");
|
|
64010
|
+
Scanner.prototype.scanUntil = /* @__PURE__ */ __name(function scanUntil(re) {
|
|
64011
|
+
var index = this.tail.search(re), match;
|
|
64012
|
+
switch (index) {
|
|
64013
|
+
case -1:
|
|
64014
|
+
match = this.tail;
|
|
64015
|
+
this.tail = "";
|
|
64016
|
+
break;
|
|
64017
|
+
case 0:
|
|
64018
|
+
match = "";
|
|
64019
|
+
break;
|
|
64020
|
+
default:
|
|
64021
|
+
match = this.tail.substring(0, index);
|
|
64022
|
+
this.tail = this.tail.substring(index);
|
|
64023
|
+
}
|
|
64024
|
+
this.pos += match.length;
|
|
64025
|
+
return match;
|
|
64026
|
+
}, "scanUntil");
|
|
64027
|
+
function Context(view, parentContext) {
|
|
64028
|
+
this.view = view;
|
|
64029
|
+
this.cache = { ".": this.view };
|
|
64030
|
+
this.parent = parentContext;
|
|
64031
|
+
}
|
|
64032
|
+
__name(Context, "Context");
|
|
64033
|
+
Context.prototype.push = /* @__PURE__ */ __name(function push(view) {
|
|
64034
|
+
return new Context(view, this);
|
|
64035
|
+
}, "push");
|
|
64036
|
+
Context.prototype.lookup = /* @__PURE__ */ __name(function lookup(name) {
|
|
64037
|
+
var cache = this.cache;
|
|
64038
|
+
var value;
|
|
64039
|
+
if (cache.hasOwnProperty(name)) {
|
|
64040
|
+
value = cache[name];
|
|
64041
|
+
} else {
|
|
64042
|
+
var context = this, intermediateValue, names, index, lookupHit = false;
|
|
64043
|
+
while (context) {
|
|
64044
|
+
if (name.indexOf(".") > 0) {
|
|
64045
|
+
intermediateValue = context.view;
|
|
64046
|
+
names = name.split(".");
|
|
64047
|
+
index = 0;
|
|
64048
|
+
while (intermediateValue != null && index < names.length) {
|
|
64049
|
+
if (index === names.length - 1)
|
|
64050
|
+
lookupHit = hasProperty(intermediateValue, names[index]) || primitiveHasOwnProperty(intermediateValue, names[index]);
|
|
64051
|
+
intermediateValue = intermediateValue[names[index++]];
|
|
64052
|
+
}
|
|
64053
|
+
} else {
|
|
64054
|
+
intermediateValue = context.view[name];
|
|
64055
|
+
lookupHit = hasProperty(context.view, name);
|
|
64056
|
+
}
|
|
64057
|
+
if (lookupHit) {
|
|
64058
|
+
value = intermediateValue;
|
|
64059
|
+
break;
|
|
64060
|
+
}
|
|
64061
|
+
context = context.parent;
|
|
64062
|
+
}
|
|
64063
|
+
cache[name] = value;
|
|
64064
|
+
}
|
|
64065
|
+
if (isFunction(value))
|
|
64066
|
+
value = value.call(this.view);
|
|
64067
|
+
return value;
|
|
64068
|
+
}, "lookup");
|
|
64069
|
+
function Writer() {
|
|
64070
|
+
this.templateCache = {
|
|
64071
|
+
_cache: {},
|
|
64072
|
+
set: /* @__PURE__ */ __name(function set5(key, value) {
|
|
64073
|
+
this._cache[key] = value;
|
|
64074
|
+
}, "set"),
|
|
64075
|
+
get: /* @__PURE__ */ __name(function get(key) {
|
|
64076
|
+
return this._cache[key];
|
|
64077
|
+
}, "get"),
|
|
64078
|
+
clear: /* @__PURE__ */ __name(function clear() {
|
|
64079
|
+
this._cache = {};
|
|
64080
|
+
}, "clear")
|
|
64081
|
+
};
|
|
64082
|
+
}
|
|
64083
|
+
__name(Writer, "Writer");
|
|
64084
|
+
Writer.prototype.clearCache = /* @__PURE__ */ __name(function clearCache() {
|
|
64085
|
+
if (typeof this.templateCache !== "undefined") {
|
|
64086
|
+
this.templateCache.clear();
|
|
64087
|
+
}
|
|
64088
|
+
}, "clearCache");
|
|
64089
|
+
Writer.prototype.parse = /* @__PURE__ */ __name(function parse7(template, tags) {
|
|
64090
|
+
var cache = this.templateCache;
|
|
64091
|
+
var cacheKey = template + ":" + (tags || mustache.tags).join(":");
|
|
64092
|
+
var isCacheEnabled = typeof cache !== "undefined";
|
|
64093
|
+
var tokens = isCacheEnabled ? cache.get(cacheKey) : void 0;
|
|
64094
|
+
if (tokens == void 0) {
|
|
64095
|
+
tokens = parseTemplate(template, tags);
|
|
64096
|
+
isCacheEnabled && cache.set(cacheKey, tokens);
|
|
64097
|
+
}
|
|
64098
|
+
return tokens;
|
|
64099
|
+
}, "parse");
|
|
64100
|
+
Writer.prototype.render = /* @__PURE__ */ __name(function render(template, view, partials, config3) {
|
|
64101
|
+
var tags = this.getConfigTags(config3);
|
|
64102
|
+
var tokens = this.parse(template, tags);
|
|
64103
|
+
var context = view instanceof Context ? view : new Context(view, void 0);
|
|
64104
|
+
return this.renderTokens(tokens, context, partials, template, config3);
|
|
64105
|
+
}, "render");
|
|
64106
|
+
Writer.prototype.renderTokens = /* @__PURE__ */ __name(function renderTokens(tokens, context, partials, originalTemplate, config3) {
|
|
64107
|
+
var buffer = "";
|
|
64108
|
+
var token, symbol3, value;
|
|
64109
|
+
for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
|
|
64110
|
+
value = void 0;
|
|
64111
|
+
token = tokens[i];
|
|
64112
|
+
symbol3 = token[0];
|
|
64113
|
+
if (symbol3 === "#") value = this.renderSection(token, context, partials, originalTemplate, config3);
|
|
64114
|
+
else if (symbol3 === "^") value = this.renderInverted(token, context, partials, originalTemplate, config3);
|
|
64115
|
+
else if (symbol3 === ">") value = this.renderPartial(token, context, partials, config3);
|
|
64116
|
+
else if (symbol3 === "&") value = this.unescapedValue(token, context);
|
|
64117
|
+
else if (symbol3 === "name") value = this.escapedValue(token, context, config3);
|
|
64118
|
+
else if (symbol3 === "text") value = this.rawValue(token);
|
|
64119
|
+
if (value !== void 0)
|
|
64120
|
+
buffer += value;
|
|
64121
|
+
}
|
|
64122
|
+
return buffer;
|
|
64123
|
+
}, "renderTokens");
|
|
64124
|
+
Writer.prototype.renderSection = /* @__PURE__ */ __name(function renderSection(token, context, partials, originalTemplate, config3) {
|
|
64125
|
+
var self = this;
|
|
64126
|
+
var buffer = "";
|
|
64127
|
+
var value = context.lookup(token[1]);
|
|
64128
|
+
function subRender(template) {
|
|
64129
|
+
return self.render(template, context, partials, config3);
|
|
64130
|
+
}
|
|
64131
|
+
__name(subRender, "subRender");
|
|
64132
|
+
if (!value) return;
|
|
64133
|
+
if (isArray(value)) {
|
|
64134
|
+
for (var j = 0, valueLength = value.length; j < valueLength; ++j) {
|
|
64135
|
+
buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate, config3);
|
|
64136
|
+
}
|
|
64137
|
+
} else if (typeof value === "object" || typeof value === "string" || typeof value === "number") {
|
|
64138
|
+
buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate, config3);
|
|
64139
|
+
} else if (isFunction(value)) {
|
|
64140
|
+
if (typeof originalTemplate !== "string")
|
|
64141
|
+
throw new Error("Cannot use higher-order sections without the original template");
|
|
64142
|
+
value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);
|
|
64143
|
+
if (value != null)
|
|
64144
|
+
buffer += value;
|
|
64145
|
+
} else {
|
|
64146
|
+
buffer += this.renderTokens(token[4], context, partials, originalTemplate, config3);
|
|
64147
|
+
}
|
|
64148
|
+
return buffer;
|
|
64149
|
+
}, "renderSection");
|
|
64150
|
+
Writer.prototype.renderInverted = /* @__PURE__ */ __name(function renderInverted(token, context, partials, originalTemplate, config3) {
|
|
64151
|
+
var value = context.lookup(token[1]);
|
|
64152
|
+
if (!value || isArray(value) && value.length === 0)
|
|
64153
|
+
return this.renderTokens(token[4], context, partials, originalTemplate, config3);
|
|
64154
|
+
}, "renderInverted");
|
|
64155
|
+
Writer.prototype.indentPartial = /* @__PURE__ */ __name(function indentPartial(partial3, indentation, lineHasNonSpace) {
|
|
64156
|
+
var filteredIndentation = indentation.replace(/[^ \t]/g, "");
|
|
64157
|
+
var partialByNl = partial3.split("\n");
|
|
64158
|
+
for (var i = 0; i < partialByNl.length; i++) {
|
|
64159
|
+
if (partialByNl[i].length && (i > 0 || !lineHasNonSpace)) {
|
|
64160
|
+
partialByNl[i] = filteredIndentation + partialByNl[i];
|
|
64161
|
+
}
|
|
64162
|
+
}
|
|
64163
|
+
return partialByNl.join("\n");
|
|
64164
|
+
}, "indentPartial");
|
|
64165
|
+
Writer.prototype.renderPartial = /* @__PURE__ */ __name(function renderPartial(token, context, partials, config3) {
|
|
64166
|
+
if (!partials) return;
|
|
64167
|
+
var tags = this.getConfigTags(config3);
|
|
64168
|
+
var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
|
|
64169
|
+
if (value != null) {
|
|
64170
|
+
var lineHasNonSpace = token[6];
|
|
64171
|
+
var tagIndex = token[5];
|
|
64172
|
+
var indentation = token[4];
|
|
64173
|
+
var indentedValue = value;
|
|
64174
|
+
if (tagIndex == 0 && indentation) {
|
|
64175
|
+
indentedValue = this.indentPartial(value, indentation, lineHasNonSpace);
|
|
64176
|
+
}
|
|
64177
|
+
var tokens = this.parse(indentedValue, tags);
|
|
64178
|
+
return this.renderTokens(tokens, context, partials, indentedValue, config3);
|
|
64179
|
+
}
|
|
64180
|
+
}, "renderPartial");
|
|
64181
|
+
Writer.prototype.unescapedValue = /* @__PURE__ */ __name(function unescapedValue(token, context) {
|
|
64182
|
+
var value = context.lookup(token[1]);
|
|
64183
|
+
if (value != null)
|
|
64184
|
+
return value;
|
|
64185
|
+
}, "unescapedValue");
|
|
64186
|
+
Writer.prototype.escapedValue = /* @__PURE__ */ __name(function escapedValue(token, context, config3) {
|
|
64187
|
+
var escape = this.getConfigEscape(config3) || mustache.escape;
|
|
64188
|
+
var value = context.lookup(token[1]);
|
|
64189
|
+
if (value != null)
|
|
64190
|
+
return typeof value === "number" && escape === mustache.escape ? String(value) : escape(value);
|
|
64191
|
+
}, "escapedValue");
|
|
64192
|
+
Writer.prototype.rawValue = /* @__PURE__ */ __name(function rawValue(token) {
|
|
64193
|
+
return token[1];
|
|
64194
|
+
}, "rawValue");
|
|
64195
|
+
Writer.prototype.getConfigTags = /* @__PURE__ */ __name(function getConfigTags(config3) {
|
|
64196
|
+
if (isArray(config3)) {
|
|
64197
|
+
return config3;
|
|
64198
|
+
} else if (config3 && typeof config3 === "object") {
|
|
64199
|
+
return config3.tags;
|
|
64200
|
+
} else {
|
|
64201
|
+
return void 0;
|
|
64202
|
+
}
|
|
64203
|
+
}, "getConfigTags");
|
|
64204
|
+
Writer.prototype.getConfigEscape = /* @__PURE__ */ __name(function getConfigEscape(config3) {
|
|
64205
|
+
if (config3 && typeof config3 === "object" && !isArray(config3)) {
|
|
64206
|
+
return config3.escape;
|
|
64207
|
+
} else {
|
|
64208
|
+
return void 0;
|
|
64209
|
+
}
|
|
64210
|
+
}, "getConfigEscape");
|
|
64211
|
+
var mustache = {
|
|
64212
|
+
name: "mustache.js",
|
|
64213
|
+
version: "4.2.0",
|
|
64214
|
+
tags: ["{{", "}}"],
|
|
64215
|
+
clearCache: void 0,
|
|
64216
|
+
escape: void 0,
|
|
64217
|
+
parse: void 0,
|
|
64218
|
+
render: void 0,
|
|
64219
|
+
Scanner: void 0,
|
|
64220
|
+
Context: void 0,
|
|
64221
|
+
Writer: void 0,
|
|
64222
|
+
/**
|
|
64223
|
+
* Allows a user to override the default caching strategy, by providing an
|
|
64224
|
+
* object with set, get and clear methods. This can also be used to disable
|
|
64225
|
+
* the cache by setting it to the literal `undefined`.
|
|
64226
|
+
*/
|
|
64227
|
+
set templateCache(cache) {
|
|
64228
|
+
defaultWriter.templateCache = cache;
|
|
64229
|
+
},
|
|
64230
|
+
/**
|
|
64231
|
+
* Gets the default or overridden caching object from the default writer.
|
|
64232
|
+
*/
|
|
64233
|
+
get templateCache() {
|
|
64234
|
+
return defaultWriter.templateCache;
|
|
64235
|
+
}
|
|
64236
|
+
};
|
|
64237
|
+
var defaultWriter = new Writer();
|
|
64238
|
+
mustache.clearCache = /* @__PURE__ */ __name(function clearCache2() {
|
|
64239
|
+
return defaultWriter.clearCache();
|
|
64240
|
+
}, "clearCache");
|
|
64241
|
+
mustache.parse = /* @__PURE__ */ __name(function parse8(template, tags) {
|
|
64242
|
+
return defaultWriter.parse(template, tags);
|
|
64243
|
+
}, "parse");
|
|
64244
|
+
mustache.render = /* @__PURE__ */ __name(function render2(template, view, partials, config3) {
|
|
64245
|
+
if (typeof template !== "string") {
|
|
64246
|
+
throw new TypeError('Invalid template! Template should be a "string" but "' + typeStr(template) + '" was given as the first argument for mustache#render(template, view, partials)');
|
|
64247
|
+
}
|
|
64248
|
+
return defaultWriter.render(template, view, partials, config3);
|
|
64249
|
+
}, "render");
|
|
64250
|
+
mustache.escape = escapeHtml;
|
|
64251
|
+
mustache.Scanner = Scanner;
|
|
64252
|
+
mustache.Context = Context;
|
|
64253
|
+
mustache.Writer = Writer;
|
|
64254
|
+
var mustache_default = mustache;
|
|
64255
|
+
|
|
63782
64256
|
// src/plugin.ts
|
|
64257
|
+
var escapeJsonStringValue = /* @__PURE__ */ __name((value) => {
|
|
64258
|
+
if (value === null || value === void 0) return "";
|
|
64259
|
+
return String(value).replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\f/g, "\\f").replace(/[\b]/g, "\\b");
|
|
64260
|
+
}, "escapeJsonStringValue");
|
|
64261
|
+
var prepareTemplateData = /* @__PURE__ */ __name((templateData) => {
|
|
64262
|
+
const prepared = {};
|
|
64263
|
+
for (const [key, value] of Object.entries(templateData)) {
|
|
64264
|
+
prepared[key] = escapeJsonStringValue(value);
|
|
64265
|
+
}
|
|
64266
|
+
return prepared;
|
|
64267
|
+
}, "prepareTemplateData");
|
|
64268
|
+
var renderTemplateJson = /* @__PURE__ */ __name((jsonString, templateData) => {
|
|
64269
|
+
const preparedData = prepareTemplateData(templateData);
|
|
64270
|
+
const unescapedTemplate = jsonString.replace(/\{\{([^{}]+)\}\}/g, "{{{$1}}}");
|
|
64271
|
+
return mustache_default.render(unescapedTemplate, preparedData);
|
|
64272
|
+
}, "renderTemplateJson");
|
|
63783
64273
|
async function getLearnCardNetworkPlugin(learnCard, url3, apiToken) {
|
|
63784
64274
|
let did = "";
|
|
63785
64275
|
try {
|
|
@@ -64361,7 +64851,7 @@ async function getLearnCardNetworkPlugin(learnCard, url3, apiToken) {
|
|
|
64361
64851
|
await ensureUser();
|
|
64362
64852
|
return client.boost.deleteBoost.mutate({ uri });
|
|
64363
64853
|
}, "deleteBoost"),
|
|
64364
|
-
sendBoost: /* @__PURE__ */ __name(async (_learnCard, profileId, boostUri, options = { encrypt: true, skipNotification: false }) => {
|
|
64854
|
+
sendBoost: /* @__PURE__ */ __name(async (_learnCard, profileId, boostUri, options = { encrypt: true, skipNotification: false, templateData: {} }) => {
|
|
64365
64855
|
await ensureUser();
|
|
64366
64856
|
const result = await _learnCard.invoke.resolveFromLCN(boostUri);
|
|
64367
64857
|
const data = await UnsignedVCValidator.spa(result);
|
|
@@ -64384,6 +64874,17 @@ async function getLearnCardNetworkPlugin(learnCard, url3, apiToken) {
|
|
|
64384
64874
|
boost.credentialSubject.id = targetProfile.did;
|
|
64385
64875
|
}
|
|
64386
64876
|
if (boost?.type?.includes("BoostCredential")) boost.boostId = boostUri;
|
|
64877
|
+
if (typeof options === "object" && options.templateData && Object.keys(options.templateData).length > 0) {
|
|
64878
|
+
try {
|
|
64879
|
+
const boostString = JSON.stringify(boost);
|
|
64880
|
+
const rendered = renderTemplateJson(boostString, options.templateData);
|
|
64881
|
+
boost = JSON.parse(rendered);
|
|
64882
|
+
} catch (error91) {
|
|
64883
|
+
throw new Error(
|
|
64884
|
+
`Template substitution failed: ${error91 instanceof Error ? error91.message : "Unknown error"}. Please check your templateData variables and ensure the rendered output is valid JSON.`
|
|
64885
|
+
);
|
|
64886
|
+
}
|
|
64887
|
+
}
|
|
64387
64888
|
if (typeof options === "object" && options.overideFn) {
|
|
64388
64889
|
boost = options.overideFn(boost);
|
|
64389
64890
|
}
|
|
@@ -64469,6 +64970,20 @@ async function getLearnCardNetworkPlugin(learnCard, url3, apiToken) {
|
|
|
64469
64970
|
targetDid = targetProfile.did;
|
|
64470
64971
|
}
|
|
64471
64972
|
let boost = data.data;
|
|
64973
|
+
if (input.templateData && Object.keys(input.templateData).length > 0) {
|
|
64974
|
+
try {
|
|
64975
|
+
const boostString = JSON.stringify(boost);
|
|
64976
|
+
const rendered = renderTemplateJson(
|
|
64977
|
+
boostString,
|
|
64978
|
+
input.templateData
|
|
64979
|
+
);
|
|
64980
|
+
boost = JSON.parse(rendered);
|
|
64981
|
+
} catch (error91) {
|
|
64982
|
+
throw new Error(
|
|
64983
|
+
`Failed to apply template data: ${error91 instanceof Error ? error91.message : "Unknown error"}`
|
|
64984
|
+
);
|
|
64985
|
+
}
|
|
64986
|
+
}
|
|
64472
64987
|
if (isVC2Format(boost)) {
|
|
64473
64988
|
boost.validFrom = (/* @__PURE__ */ new Date()).toISOString();
|
|
64474
64989
|
} else {
|
|
@@ -65136,4 +65651,12 @@ var getVerifyBoostPlugin = /* @__PURE__ */ __name(async (learnCard, trustedBoost
|
|
|
65136
65651
|
@trpc/client/dist/links/retryLink.mjs:
|
|
65137
65652
|
(* istanbul ignore file -- @preserve *)
|
|
65138
65653
|
*/
|
|
65654
|
+
/*! Bundled license information:
|
|
65655
|
+
|
|
65656
|
+
mustache/mustache.mjs:
|
|
65657
|
+
(*!
|
|
65658
|
+
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
65659
|
+
* http://github.com/janl/mustache.js
|
|
65660
|
+
*)
|
|
65661
|
+
*/
|
|
65139
65662
|
//# sourceMappingURL=lcn-plugin.cjs.development.js.map
|