@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
package/dist/lcn-plugin.esm.js
CHANGED
|
@@ -712,9 +712,9 @@ function maybeFreeze(scope, value, deep = false) {
|
|
|
712
712
|
__name(maybeFreeze, "maybeFreeze");
|
|
713
713
|
__name2(maybeFreeze, "maybeFreeze");
|
|
714
714
|
function createProxyProxy(base, parent) {
|
|
715
|
-
const
|
|
715
|
+
const isArray2 = Array.isArray(base);
|
|
716
716
|
const state = {
|
|
717
|
-
type_:
|
|
717
|
+
type_: isArray2 ? 1 : 0,
|
|
718
718
|
// Track which produce call this is associated with.
|
|
719
719
|
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
720
720
|
// True for both shallow and deep changes.
|
|
@@ -738,7 +738,7 @@ function createProxyProxy(base, parent) {
|
|
|
738
738
|
};
|
|
739
739
|
let target = state;
|
|
740
740
|
let traps = objectTraps;
|
|
741
|
-
if (
|
|
741
|
+
if (isArray2) {
|
|
742
742
|
target = [state];
|
|
743
743
|
traps = arrayTraps;
|
|
744
744
|
}
|
|
@@ -29506,7 +29506,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29506
29506
|
contractUri: external_exports22.string().optional(),
|
|
29507
29507
|
templateUri: external_exports22.string().optional(),
|
|
29508
29508
|
template: SendBoostTemplateValidator2.optional(),
|
|
29509
|
-
signedCredential: VCValidator2.optional()
|
|
29509
|
+
signedCredential: VCValidator2.optional(),
|
|
29510
|
+
templateData: external_exports22.record(external_exports22.string(), external_exports22.unknown()).optional()
|
|
29510
29511
|
}).refine((data) => data.templateUri || data.template, {
|
|
29511
29512
|
message: "Either templateUri or template creation data must be provided.",
|
|
29512
29513
|
path: ["templateUri"]
|
|
@@ -30503,16 +30504,16 @@ function parserForArrayFormat(options) {
|
|
|
30503
30504
|
case "comma":
|
|
30504
30505
|
case "separator": {
|
|
30505
30506
|
return (key, value, accumulator) => {
|
|
30506
|
-
const
|
|
30507
|
-
const newValue =
|
|
30507
|
+
const isArray2 = typeof value === "string" && value.includes(options.arrayFormatSeparator);
|
|
30508
|
+
const newValue = isArray2 ? value.split(options.arrayFormatSeparator).map((item) => decode3(item, options)) : value === null ? value : decode3(value, options);
|
|
30508
30509
|
accumulator[key] = newValue;
|
|
30509
30510
|
};
|
|
30510
30511
|
}
|
|
30511
30512
|
case "bracket-separator": {
|
|
30512
30513
|
return (key, value, accumulator) => {
|
|
30513
|
-
const
|
|
30514
|
+
const isArray2 = /(\[])$/.test(key);
|
|
30514
30515
|
key = key.replace(/\[]$/, "");
|
|
30515
|
-
if (!
|
|
30516
|
+
if (!isArray2) {
|
|
30516
30517
|
accumulator[key] = value ? decode3(value, options) : value;
|
|
30517
30518
|
return;
|
|
30518
30519
|
}
|
|
@@ -46106,7 +46107,8 @@ var SendBoostInputValidator = external_exports2.object({
|
|
|
46106
46107
|
contractUri: external_exports2.string().optional(),
|
|
46107
46108
|
templateUri: external_exports2.string().optional(),
|
|
46108
46109
|
template: SendBoostTemplateValidator.optional(),
|
|
46109
|
-
signedCredential: VCValidator.optional()
|
|
46110
|
+
signedCredential: VCValidator.optional(),
|
|
46111
|
+
templateData: external_exports2.record(external_exports2.string(), external_exports2.unknown()).optional()
|
|
46110
46112
|
}).refine((data) => data.templateUri || data.template, {
|
|
46111
46113
|
message: "Either templateUri or template creation data must be provided.",
|
|
46112
46114
|
path: ["templateUri"]
|
|
@@ -47243,9 +47245,9 @@ function maybeFreeze2(scope, value, deep = false) {
|
|
|
47243
47245
|
}
|
|
47244
47246
|
__name(maybeFreeze2, "maybeFreeze");
|
|
47245
47247
|
function createProxyProxy2(base, parent) {
|
|
47246
|
-
const
|
|
47248
|
+
const isArray2 = Array.isArray(base);
|
|
47247
47249
|
const state = {
|
|
47248
|
-
type_:
|
|
47250
|
+
type_: isArray2 ? 1 : 0,
|
|
47249
47251
|
// Track which produce call this is associated with.
|
|
47250
47252
|
scope_: parent ? parent.scope_ : getCurrentScope2(),
|
|
47251
47253
|
// True for both shallow and deep changes.
|
|
@@ -47269,7 +47271,7 @@ function createProxyProxy2(base, parent) {
|
|
|
47269
47271
|
};
|
|
47270
47272
|
let target = state;
|
|
47271
47273
|
let traps = objectTraps2;
|
|
47272
|
-
if (
|
|
47274
|
+
if (isArray2) {
|
|
47273
47275
|
target = [state];
|
|
47274
47276
|
traps = arrayTraps2;
|
|
47275
47277
|
}
|
|
@@ -62293,7 +62295,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
62293
62295
|
contractUri: external_exports3.string().optional(),
|
|
62294
62296
|
templateUri: external_exports3.string().optional(),
|
|
62295
62297
|
template: SendBoostTemplateValidator2.optional(),
|
|
62296
|
-
signedCredential: VCValidator2.optional()
|
|
62298
|
+
signedCredential: VCValidator2.optional(),
|
|
62299
|
+
templateData: external_exports3.record(external_exports3.string(), external_exports3.unknown()).optional()
|
|
62297
62300
|
}).refine((data) => data.templateUri || data.template, {
|
|
62298
62301
|
message: "Either templateUri or template creation data must be provided.",
|
|
62299
62302
|
path: ["templateUri"]
|
|
@@ -63289,16 +63292,16 @@ function parserForArrayFormat2(options) {
|
|
|
63289
63292
|
case "comma":
|
|
63290
63293
|
case "separator": {
|
|
63291
63294
|
return (key, value, accumulator) => {
|
|
63292
|
-
const
|
|
63293
|
-
const newValue =
|
|
63295
|
+
const isArray2 = typeof value === "string" && value.includes(options.arrayFormatSeparator);
|
|
63296
|
+
const newValue = isArray2 ? value.split(options.arrayFormatSeparator).map((item) => decode6(item, options)) : value === null ? value : decode6(value, options);
|
|
63294
63297
|
accumulator[key] = newValue;
|
|
63295
63298
|
};
|
|
63296
63299
|
}
|
|
63297
63300
|
case "bracket-separator": {
|
|
63298
63301
|
return (key, value, accumulator) => {
|
|
63299
|
-
const
|
|
63302
|
+
const isArray2 = /(\[])$/.test(key);
|
|
63300
63303
|
key = key.replace(/\[]$/, "");
|
|
63301
|
-
if (!
|
|
63304
|
+
if (!isArray2) {
|
|
63302
63305
|
accumulator[key] = value ? decode6(value, options) : value;
|
|
63303
63306
|
return;
|
|
63304
63307
|
}
|
|
@@ -63769,7 +63772,494 @@ var isVC2Format = /* @__PURE__ */ __name4((credential) => {
|
|
|
63769
63772
|
return credential["@context"].includes("https://www.w3.org/ns/credentials/v2");
|
|
63770
63773
|
}, "isVC2Format");
|
|
63771
63774
|
|
|
63775
|
+
// ../../../node_modules/.pnpm/mustache@4.2.0/node_modules/mustache/mustache.mjs
|
|
63776
|
+
var objectToString = Object.prototype.toString;
|
|
63777
|
+
var isArray = Array.isArray || /* @__PURE__ */ __name(function isArrayPolyfill(object3) {
|
|
63778
|
+
return objectToString.call(object3) === "[object Array]";
|
|
63779
|
+
}, "isArrayPolyfill");
|
|
63780
|
+
function isFunction(object3) {
|
|
63781
|
+
return typeof object3 === "function";
|
|
63782
|
+
}
|
|
63783
|
+
__name(isFunction, "isFunction");
|
|
63784
|
+
function typeStr(obj) {
|
|
63785
|
+
return isArray(obj) ? "array" : typeof obj;
|
|
63786
|
+
}
|
|
63787
|
+
__name(typeStr, "typeStr");
|
|
63788
|
+
function escapeRegExp(string7) {
|
|
63789
|
+
return string7.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
63790
|
+
}
|
|
63791
|
+
__name(escapeRegExp, "escapeRegExp");
|
|
63792
|
+
function hasProperty(obj, propName) {
|
|
63793
|
+
return obj != null && typeof obj === "object" && propName in obj;
|
|
63794
|
+
}
|
|
63795
|
+
__name(hasProperty, "hasProperty");
|
|
63796
|
+
function primitiveHasOwnProperty(primitive, propName) {
|
|
63797
|
+
return primitive != null && typeof primitive !== "object" && primitive.hasOwnProperty && primitive.hasOwnProperty(propName);
|
|
63798
|
+
}
|
|
63799
|
+
__name(primitiveHasOwnProperty, "primitiveHasOwnProperty");
|
|
63800
|
+
var regExpTest = RegExp.prototype.test;
|
|
63801
|
+
function testRegExp(re, string7) {
|
|
63802
|
+
return regExpTest.call(re, string7);
|
|
63803
|
+
}
|
|
63804
|
+
__name(testRegExp, "testRegExp");
|
|
63805
|
+
var nonSpaceRe = /\S/;
|
|
63806
|
+
function isWhitespace(string7) {
|
|
63807
|
+
return !testRegExp(nonSpaceRe, string7);
|
|
63808
|
+
}
|
|
63809
|
+
__name(isWhitespace, "isWhitespace");
|
|
63810
|
+
var entityMap = {
|
|
63811
|
+
"&": "&",
|
|
63812
|
+
"<": "<",
|
|
63813
|
+
">": ">",
|
|
63814
|
+
'"': """,
|
|
63815
|
+
"'": "'",
|
|
63816
|
+
"/": "/",
|
|
63817
|
+
"`": "`",
|
|
63818
|
+
"=": "="
|
|
63819
|
+
};
|
|
63820
|
+
function escapeHtml(string7) {
|
|
63821
|
+
return String(string7).replace(/[&<>"'`=\/]/g, /* @__PURE__ */ __name(function fromEntityMap(s) {
|
|
63822
|
+
return entityMap[s];
|
|
63823
|
+
}, "fromEntityMap"));
|
|
63824
|
+
}
|
|
63825
|
+
__name(escapeHtml, "escapeHtml");
|
|
63826
|
+
var whiteRe = /\s*/;
|
|
63827
|
+
var spaceRe = /\s+/;
|
|
63828
|
+
var equalsRe = /\s*=/;
|
|
63829
|
+
var curlyRe = /\s*\}/;
|
|
63830
|
+
var tagRe = /#|\^|\/|>|\{|&|=|!/;
|
|
63831
|
+
function parseTemplate(template, tags) {
|
|
63832
|
+
if (!template)
|
|
63833
|
+
return [];
|
|
63834
|
+
var lineHasNonSpace = false;
|
|
63835
|
+
var sections = [];
|
|
63836
|
+
var tokens = [];
|
|
63837
|
+
var spaces = [];
|
|
63838
|
+
var hasTag = false;
|
|
63839
|
+
var nonSpace = false;
|
|
63840
|
+
var indentation = "";
|
|
63841
|
+
var tagIndex = 0;
|
|
63842
|
+
function stripSpace() {
|
|
63843
|
+
if (hasTag && !nonSpace) {
|
|
63844
|
+
while (spaces.length)
|
|
63845
|
+
delete tokens[spaces.pop()];
|
|
63846
|
+
} else {
|
|
63847
|
+
spaces = [];
|
|
63848
|
+
}
|
|
63849
|
+
hasTag = false;
|
|
63850
|
+
nonSpace = false;
|
|
63851
|
+
}
|
|
63852
|
+
__name(stripSpace, "stripSpace");
|
|
63853
|
+
var openingTagRe, closingTagRe, closingCurlyRe;
|
|
63854
|
+
function compileTags(tagsToCompile) {
|
|
63855
|
+
if (typeof tagsToCompile === "string")
|
|
63856
|
+
tagsToCompile = tagsToCompile.split(spaceRe, 2);
|
|
63857
|
+
if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)
|
|
63858
|
+
throw new Error("Invalid tags: " + tagsToCompile);
|
|
63859
|
+
openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + "\\s*");
|
|
63860
|
+
closingTagRe = new RegExp("\\s*" + escapeRegExp(tagsToCompile[1]));
|
|
63861
|
+
closingCurlyRe = new RegExp("\\s*" + escapeRegExp("}" + tagsToCompile[1]));
|
|
63862
|
+
}
|
|
63863
|
+
__name(compileTags, "compileTags");
|
|
63864
|
+
compileTags(tags || mustache.tags);
|
|
63865
|
+
var scanner = new Scanner(template);
|
|
63866
|
+
var start, type, value, chr, token, openSection;
|
|
63867
|
+
while (!scanner.eos()) {
|
|
63868
|
+
start = scanner.pos;
|
|
63869
|
+
value = scanner.scanUntil(openingTagRe);
|
|
63870
|
+
if (value) {
|
|
63871
|
+
for (var i = 0, valueLength = value.length; i < valueLength; ++i) {
|
|
63872
|
+
chr = value.charAt(i);
|
|
63873
|
+
if (isWhitespace(chr)) {
|
|
63874
|
+
spaces.push(tokens.length);
|
|
63875
|
+
indentation += chr;
|
|
63876
|
+
} else {
|
|
63877
|
+
nonSpace = true;
|
|
63878
|
+
lineHasNonSpace = true;
|
|
63879
|
+
indentation += " ";
|
|
63880
|
+
}
|
|
63881
|
+
tokens.push(["text", chr, start, start + 1]);
|
|
63882
|
+
start += 1;
|
|
63883
|
+
if (chr === "\n") {
|
|
63884
|
+
stripSpace();
|
|
63885
|
+
indentation = "";
|
|
63886
|
+
tagIndex = 0;
|
|
63887
|
+
lineHasNonSpace = false;
|
|
63888
|
+
}
|
|
63889
|
+
}
|
|
63890
|
+
}
|
|
63891
|
+
if (!scanner.scan(openingTagRe))
|
|
63892
|
+
break;
|
|
63893
|
+
hasTag = true;
|
|
63894
|
+
type = scanner.scan(tagRe) || "name";
|
|
63895
|
+
scanner.scan(whiteRe);
|
|
63896
|
+
if (type === "=") {
|
|
63897
|
+
value = scanner.scanUntil(equalsRe);
|
|
63898
|
+
scanner.scan(equalsRe);
|
|
63899
|
+
scanner.scanUntil(closingTagRe);
|
|
63900
|
+
} else if (type === "{") {
|
|
63901
|
+
value = scanner.scanUntil(closingCurlyRe);
|
|
63902
|
+
scanner.scan(curlyRe);
|
|
63903
|
+
scanner.scanUntil(closingTagRe);
|
|
63904
|
+
type = "&";
|
|
63905
|
+
} else {
|
|
63906
|
+
value = scanner.scanUntil(closingTagRe);
|
|
63907
|
+
}
|
|
63908
|
+
if (!scanner.scan(closingTagRe))
|
|
63909
|
+
throw new Error("Unclosed tag at " + scanner.pos);
|
|
63910
|
+
if (type == ">") {
|
|
63911
|
+
token = [type, value, start, scanner.pos, indentation, tagIndex, lineHasNonSpace];
|
|
63912
|
+
} else {
|
|
63913
|
+
token = [type, value, start, scanner.pos];
|
|
63914
|
+
}
|
|
63915
|
+
tagIndex++;
|
|
63916
|
+
tokens.push(token);
|
|
63917
|
+
if (type === "#" || type === "^") {
|
|
63918
|
+
sections.push(token);
|
|
63919
|
+
} else if (type === "/") {
|
|
63920
|
+
openSection = sections.pop();
|
|
63921
|
+
if (!openSection)
|
|
63922
|
+
throw new Error('Unopened section "' + value + '" at ' + start);
|
|
63923
|
+
if (openSection[1] !== value)
|
|
63924
|
+
throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
|
|
63925
|
+
} else if (type === "name" || type === "{" || type === "&") {
|
|
63926
|
+
nonSpace = true;
|
|
63927
|
+
} else if (type === "=") {
|
|
63928
|
+
compileTags(value);
|
|
63929
|
+
}
|
|
63930
|
+
}
|
|
63931
|
+
stripSpace();
|
|
63932
|
+
openSection = sections.pop();
|
|
63933
|
+
if (openSection)
|
|
63934
|
+
throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
|
|
63935
|
+
return nestTokens(squashTokens(tokens));
|
|
63936
|
+
}
|
|
63937
|
+
__name(parseTemplate, "parseTemplate");
|
|
63938
|
+
function squashTokens(tokens) {
|
|
63939
|
+
var squashedTokens = [];
|
|
63940
|
+
var token, lastToken;
|
|
63941
|
+
for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
|
|
63942
|
+
token = tokens[i];
|
|
63943
|
+
if (token) {
|
|
63944
|
+
if (token[0] === "text" && lastToken && lastToken[0] === "text") {
|
|
63945
|
+
lastToken[1] += token[1];
|
|
63946
|
+
lastToken[3] = token[3];
|
|
63947
|
+
} else {
|
|
63948
|
+
squashedTokens.push(token);
|
|
63949
|
+
lastToken = token;
|
|
63950
|
+
}
|
|
63951
|
+
}
|
|
63952
|
+
}
|
|
63953
|
+
return squashedTokens;
|
|
63954
|
+
}
|
|
63955
|
+
__name(squashTokens, "squashTokens");
|
|
63956
|
+
function nestTokens(tokens) {
|
|
63957
|
+
var nestedTokens = [];
|
|
63958
|
+
var collector = nestedTokens;
|
|
63959
|
+
var sections = [];
|
|
63960
|
+
var token, section;
|
|
63961
|
+
for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
|
|
63962
|
+
token = tokens[i];
|
|
63963
|
+
switch (token[0]) {
|
|
63964
|
+
case "#":
|
|
63965
|
+
case "^":
|
|
63966
|
+
collector.push(token);
|
|
63967
|
+
sections.push(token);
|
|
63968
|
+
collector = token[4] = [];
|
|
63969
|
+
break;
|
|
63970
|
+
case "/":
|
|
63971
|
+
section = sections.pop();
|
|
63972
|
+
section[5] = token[2];
|
|
63973
|
+
collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
|
|
63974
|
+
break;
|
|
63975
|
+
default:
|
|
63976
|
+
collector.push(token);
|
|
63977
|
+
}
|
|
63978
|
+
}
|
|
63979
|
+
return nestedTokens;
|
|
63980
|
+
}
|
|
63981
|
+
__name(nestTokens, "nestTokens");
|
|
63982
|
+
function Scanner(string7) {
|
|
63983
|
+
this.string = string7;
|
|
63984
|
+
this.tail = string7;
|
|
63985
|
+
this.pos = 0;
|
|
63986
|
+
}
|
|
63987
|
+
__name(Scanner, "Scanner");
|
|
63988
|
+
Scanner.prototype.eos = /* @__PURE__ */ __name(function eos() {
|
|
63989
|
+
return this.tail === "";
|
|
63990
|
+
}, "eos");
|
|
63991
|
+
Scanner.prototype.scan = /* @__PURE__ */ __name(function scan(re) {
|
|
63992
|
+
var match = this.tail.match(re);
|
|
63993
|
+
if (!match || match.index !== 0)
|
|
63994
|
+
return "";
|
|
63995
|
+
var string7 = match[0];
|
|
63996
|
+
this.tail = this.tail.substring(string7.length);
|
|
63997
|
+
this.pos += string7.length;
|
|
63998
|
+
return string7;
|
|
63999
|
+
}, "scan");
|
|
64000
|
+
Scanner.prototype.scanUntil = /* @__PURE__ */ __name(function scanUntil(re) {
|
|
64001
|
+
var index = this.tail.search(re), match;
|
|
64002
|
+
switch (index) {
|
|
64003
|
+
case -1:
|
|
64004
|
+
match = this.tail;
|
|
64005
|
+
this.tail = "";
|
|
64006
|
+
break;
|
|
64007
|
+
case 0:
|
|
64008
|
+
match = "";
|
|
64009
|
+
break;
|
|
64010
|
+
default:
|
|
64011
|
+
match = this.tail.substring(0, index);
|
|
64012
|
+
this.tail = this.tail.substring(index);
|
|
64013
|
+
}
|
|
64014
|
+
this.pos += match.length;
|
|
64015
|
+
return match;
|
|
64016
|
+
}, "scanUntil");
|
|
64017
|
+
function Context(view, parentContext) {
|
|
64018
|
+
this.view = view;
|
|
64019
|
+
this.cache = { ".": this.view };
|
|
64020
|
+
this.parent = parentContext;
|
|
64021
|
+
}
|
|
64022
|
+
__name(Context, "Context");
|
|
64023
|
+
Context.prototype.push = /* @__PURE__ */ __name(function push(view) {
|
|
64024
|
+
return new Context(view, this);
|
|
64025
|
+
}, "push");
|
|
64026
|
+
Context.prototype.lookup = /* @__PURE__ */ __name(function lookup(name) {
|
|
64027
|
+
var cache = this.cache;
|
|
64028
|
+
var value;
|
|
64029
|
+
if (cache.hasOwnProperty(name)) {
|
|
64030
|
+
value = cache[name];
|
|
64031
|
+
} else {
|
|
64032
|
+
var context = this, intermediateValue, names, index, lookupHit = false;
|
|
64033
|
+
while (context) {
|
|
64034
|
+
if (name.indexOf(".") > 0) {
|
|
64035
|
+
intermediateValue = context.view;
|
|
64036
|
+
names = name.split(".");
|
|
64037
|
+
index = 0;
|
|
64038
|
+
while (intermediateValue != null && index < names.length) {
|
|
64039
|
+
if (index === names.length - 1)
|
|
64040
|
+
lookupHit = hasProperty(intermediateValue, names[index]) || primitiveHasOwnProperty(intermediateValue, names[index]);
|
|
64041
|
+
intermediateValue = intermediateValue[names[index++]];
|
|
64042
|
+
}
|
|
64043
|
+
} else {
|
|
64044
|
+
intermediateValue = context.view[name];
|
|
64045
|
+
lookupHit = hasProperty(context.view, name);
|
|
64046
|
+
}
|
|
64047
|
+
if (lookupHit) {
|
|
64048
|
+
value = intermediateValue;
|
|
64049
|
+
break;
|
|
64050
|
+
}
|
|
64051
|
+
context = context.parent;
|
|
64052
|
+
}
|
|
64053
|
+
cache[name] = value;
|
|
64054
|
+
}
|
|
64055
|
+
if (isFunction(value))
|
|
64056
|
+
value = value.call(this.view);
|
|
64057
|
+
return value;
|
|
64058
|
+
}, "lookup");
|
|
64059
|
+
function Writer() {
|
|
64060
|
+
this.templateCache = {
|
|
64061
|
+
_cache: {},
|
|
64062
|
+
set: /* @__PURE__ */ __name(function set5(key, value) {
|
|
64063
|
+
this._cache[key] = value;
|
|
64064
|
+
}, "set"),
|
|
64065
|
+
get: /* @__PURE__ */ __name(function get(key) {
|
|
64066
|
+
return this._cache[key];
|
|
64067
|
+
}, "get"),
|
|
64068
|
+
clear: /* @__PURE__ */ __name(function clear() {
|
|
64069
|
+
this._cache = {};
|
|
64070
|
+
}, "clear")
|
|
64071
|
+
};
|
|
64072
|
+
}
|
|
64073
|
+
__name(Writer, "Writer");
|
|
64074
|
+
Writer.prototype.clearCache = /* @__PURE__ */ __name(function clearCache() {
|
|
64075
|
+
if (typeof this.templateCache !== "undefined") {
|
|
64076
|
+
this.templateCache.clear();
|
|
64077
|
+
}
|
|
64078
|
+
}, "clearCache");
|
|
64079
|
+
Writer.prototype.parse = /* @__PURE__ */ __name(function parse7(template, tags) {
|
|
64080
|
+
var cache = this.templateCache;
|
|
64081
|
+
var cacheKey = template + ":" + (tags || mustache.tags).join(":");
|
|
64082
|
+
var isCacheEnabled = typeof cache !== "undefined";
|
|
64083
|
+
var tokens = isCacheEnabled ? cache.get(cacheKey) : void 0;
|
|
64084
|
+
if (tokens == void 0) {
|
|
64085
|
+
tokens = parseTemplate(template, tags);
|
|
64086
|
+
isCacheEnabled && cache.set(cacheKey, tokens);
|
|
64087
|
+
}
|
|
64088
|
+
return tokens;
|
|
64089
|
+
}, "parse");
|
|
64090
|
+
Writer.prototype.render = /* @__PURE__ */ __name(function render(template, view, partials, config3) {
|
|
64091
|
+
var tags = this.getConfigTags(config3);
|
|
64092
|
+
var tokens = this.parse(template, tags);
|
|
64093
|
+
var context = view instanceof Context ? view : new Context(view, void 0);
|
|
64094
|
+
return this.renderTokens(tokens, context, partials, template, config3);
|
|
64095
|
+
}, "render");
|
|
64096
|
+
Writer.prototype.renderTokens = /* @__PURE__ */ __name(function renderTokens(tokens, context, partials, originalTemplate, config3) {
|
|
64097
|
+
var buffer = "";
|
|
64098
|
+
var token, symbol3, value;
|
|
64099
|
+
for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
|
|
64100
|
+
value = void 0;
|
|
64101
|
+
token = tokens[i];
|
|
64102
|
+
symbol3 = token[0];
|
|
64103
|
+
if (symbol3 === "#") value = this.renderSection(token, context, partials, originalTemplate, config3);
|
|
64104
|
+
else if (symbol3 === "^") value = this.renderInverted(token, context, partials, originalTemplate, config3);
|
|
64105
|
+
else if (symbol3 === ">") value = this.renderPartial(token, context, partials, config3);
|
|
64106
|
+
else if (symbol3 === "&") value = this.unescapedValue(token, context);
|
|
64107
|
+
else if (symbol3 === "name") value = this.escapedValue(token, context, config3);
|
|
64108
|
+
else if (symbol3 === "text") value = this.rawValue(token);
|
|
64109
|
+
if (value !== void 0)
|
|
64110
|
+
buffer += value;
|
|
64111
|
+
}
|
|
64112
|
+
return buffer;
|
|
64113
|
+
}, "renderTokens");
|
|
64114
|
+
Writer.prototype.renderSection = /* @__PURE__ */ __name(function renderSection(token, context, partials, originalTemplate, config3) {
|
|
64115
|
+
var self = this;
|
|
64116
|
+
var buffer = "";
|
|
64117
|
+
var value = context.lookup(token[1]);
|
|
64118
|
+
function subRender(template) {
|
|
64119
|
+
return self.render(template, context, partials, config3);
|
|
64120
|
+
}
|
|
64121
|
+
__name(subRender, "subRender");
|
|
64122
|
+
if (!value) return;
|
|
64123
|
+
if (isArray(value)) {
|
|
64124
|
+
for (var j = 0, valueLength = value.length; j < valueLength; ++j) {
|
|
64125
|
+
buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate, config3);
|
|
64126
|
+
}
|
|
64127
|
+
} else if (typeof value === "object" || typeof value === "string" || typeof value === "number") {
|
|
64128
|
+
buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate, config3);
|
|
64129
|
+
} else if (isFunction(value)) {
|
|
64130
|
+
if (typeof originalTemplate !== "string")
|
|
64131
|
+
throw new Error("Cannot use higher-order sections without the original template");
|
|
64132
|
+
value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);
|
|
64133
|
+
if (value != null)
|
|
64134
|
+
buffer += value;
|
|
64135
|
+
} else {
|
|
64136
|
+
buffer += this.renderTokens(token[4], context, partials, originalTemplate, config3);
|
|
64137
|
+
}
|
|
64138
|
+
return buffer;
|
|
64139
|
+
}, "renderSection");
|
|
64140
|
+
Writer.prototype.renderInverted = /* @__PURE__ */ __name(function renderInverted(token, context, partials, originalTemplate, config3) {
|
|
64141
|
+
var value = context.lookup(token[1]);
|
|
64142
|
+
if (!value || isArray(value) && value.length === 0)
|
|
64143
|
+
return this.renderTokens(token[4], context, partials, originalTemplate, config3);
|
|
64144
|
+
}, "renderInverted");
|
|
64145
|
+
Writer.prototype.indentPartial = /* @__PURE__ */ __name(function indentPartial(partial3, indentation, lineHasNonSpace) {
|
|
64146
|
+
var filteredIndentation = indentation.replace(/[^ \t]/g, "");
|
|
64147
|
+
var partialByNl = partial3.split("\n");
|
|
64148
|
+
for (var i = 0; i < partialByNl.length; i++) {
|
|
64149
|
+
if (partialByNl[i].length && (i > 0 || !lineHasNonSpace)) {
|
|
64150
|
+
partialByNl[i] = filteredIndentation + partialByNl[i];
|
|
64151
|
+
}
|
|
64152
|
+
}
|
|
64153
|
+
return partialByNl.join("\n");
|
|
64154
|
+
}, "indentPartial");
|
|
64155
|
+
Writer.prototype.renderPartial = /* @__PURE__ */ __name(function renderPartial(token, context, partials, config3) {
|
|
64156
|
+
if (!partials) return;
|
|
64157
|
+
var tags = this.getConfigTags(config3);
|
|
64158
|
+
var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
|
|
64159
|
+
if (value != null) {
|
|
64160
|
+
var lineHasNonSpace = token[6];
|
|
64161
|
+
var tagIndex = token[5];
|
|
64162
|
+
var indentation = token[4];
|
|
64163
|
+
var indentedValue = value;
|
|
64164
|
+
if (tagIndex == 0 && indentation) {
|
|
64165
|
+
indentedValue = this.indentPartial(value, indentation, lineHasNonSpace);
|
|
64166
|
+
}
|
|
64167
|
+
var tokens = this.parse(indentedValue, tags);
|
|
64168
|
+
return this.renderTokens(tokens, context, partials, indentedValue, config3);
|
|
64169
|
+
}
|
|
64170
|
+
}, "renderPartial");
|
|
64171
|
+
Writer.prototype.unescapedValue = /* @__PURE__ */ __name(function unescapedValue(token, context) {
|
|
64172
|
+
var value = context.lookup(token[1]);
|
|
64173
|
+
if (value != null)
|
|
64174
|
+
return value;
|
|
64175
|
+
}, "unescapedValue");
|
|
64176
|
+
Writer.prototype.escapedValue = /* @__PURE__ */ __name(function escapedValue(token, context, config3) {
|
|
64177
|
+
var escape = this.getConfigEscape(config3) || mustache.escape;
|
|
64178
|
+
var value = context.lookup(token[1]);
|
|
64179
|
+
if (value != null)
|
|
64180
|
+
return typeof value === "number" && escape === mustache.escape ? String(value) : escape(value);
|
|
64181
|
+
}, "escapedValue");
|
|
64182
|
+
Writer.prototype.rawValue = /* @__PURE__ */ __name(function rawValue(token) {
|
|
64183
|
+
return token[1];
|
|
64184
|
+
}, "rawValue");
|
|
64185
|
+
Writer.prototype.getConfigTags = /* @__PURE__ */ __name(function getConfigTags(config3) {
|
|
64186
|
+
if (isArray(config3)) {
|
|
64187
|
+
return config3;
|
|
64188
|
+
} else if (config3 && typeof config3 === "object") {
|
|
64189
|
+
return config3.tags;
|
|
64190
|
+
} else {
|
|
64191
|
+
return void 0;
|
|
64192
|
+
}
|
|
64193
|
+
}, "getConfigTags");
|
|
64194
|
+
Writer.prototype.getConfigEscape = /* @__PURE__ */ __name(function getConfigEscape(config3) {
|
|
64195
|
+
if (config3 && typeof config3 === "object" && !isArray(config3)) {
|
|
64196
|
+
return config3.escape;
|
|
64197
|
+
} else {
|
|
64198
|
+
return void 0;
|
|
64199
|
+
}
|
|
64200
|
+
}, "getConfigEscape");
|
|
64201
|
+
var mustache = {
|
|
64202
|
+
name: "mustache.js",
|
|
64203
|
+
version: "4.2.0",
|
|
64204
|
+
tags: ["{{", "}}"],
|
|
64205
|
+
clearCache: void 0,
|
|
64206
|
+
escape: void 0,
|
|
64207
|
+
parse: void 0,
|
|
64208
|
+
render: void 0,
|
|
64209
|
+
Scanner: void 0,
|
|
64210
|
+
Context: void 0,
|
|
64211
|
+
Writer: void 0,
|
|
64212
|
+
/**
|
|
64213
|
+
* Allows a user to override the default caching strategy, by providing an
|
|
64214
|
+
* object with set, get and clear methods. This can also be used to disable
|
|
64215
|
+
* the cache by setting it to the literal `undefined`.
|
|
64216
|
+
*/
|
|
64217
|
+
set templateCache(cache) {
|
|
64218
|
+
defaultWriter.templateCache = cache;
|
|
64219
|
+
},
|
|
64220
|
+
/**
|
|
64221
|
+
* Gets the default or overridden caching object from the default writer.
|
|
64222
|
+
*/
|
|
64223
|
+
get templateCache() {
|
|
64224
|
+
return defaultWriter.templateCache;
|
|
64225
|
+
}
|
|
64226
|
+
};
|
|
64227
|
+
var defaultWriter = new Writer();
|
|
64228
|
+
mustache.clearCache = /* @__PURE__ */ __name(function clearCache2() {
|
|
64229
|
+
return defaultWriter.clearCache();
|
|
64230
|
+
}, "clearCache");
|
|
64231
|
+
mustache.parse = /* @__PURE__ */ __name(function parse8(template, tags) {
|
|
64232
|
+
return defaultWriter.parse(template, tags);
|
|
64233
|
+
}, "parse");
|
|
64234
|
+
mustache.render = /* @__PURE__ */ __name(function render2(template, view, partials, config3) {
|
|
64235
|
+
if (typeof template !== "string") {
|
|
64236
|
+
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)');
|
|
64237
|
+
}
|
|
64238
|
+
return defaultWriter.render(template, view, partials, config3);
|
|
64239
|
+
}, "render");
|
|
64240
|
+
mustache.escape = escapeHtml;
|
|
64241
|
+
mustache.Scanner = Scanner;
|
|
64242
|
+
mustache.Context = Context;
|
|
64243
|
+
mustache.Writer = Writer;
|
|
64244
|
+
var mustache_default = mustache;
|
|
64245
|
+
|
|
63772
64246
|
// src/plugin.ts
|
|
64247
|
+
var escapeJsonStringValue = /* @__PURE__ */ __name((value) => {
|
|
64248
|
+
if (value === null || value === void 0) return "";
|
|
64249
|
+
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");
|
|
64250
|
+
}, "escapeJsonStringValue");
|
|
64251
|
+
var prepareTemplateData = /* @__PURE__ */ __name((templateData) => {
|
|
64252
|
+
const prepared = {};
|
|
64253
|
+
for (const [key, value] of Object.entries(templateData)) {
|
|
64254
|
+
prepared[key] = escapeJsonStringValue(value);
|
|
64255
|
+
}
|
|
64256
|
+
return prepared;
|
|
64257
|
+
}, "prepareTemplateData");
|
|
64258
|
+
var renderTemplateJson = /* @__PURE__ */ __name((jsonString, templateData) => {
|
|
64259
|
+
const preparedData = prepareTemplateData(templateData);
|
|
64260
|
+
const unescapedTemplate = jsonString.replace(/\{\{([^{}]+)\}\}/g, "{{{$1}}}");
|
|
64261
|
+
return mustache_default.render(unescapedTemplate, preparedData);
|
|
64262
|
+
}, "renderTemplateJson");
|
|
63773
64263
|
async function getLearnCardNetworkPlugin(learnCard, url3, apiToken) {
|
|
63774
64264
|
let did = "";
|
|
63775
64265
|
try {
|
|
@@ -64351,7 +64841,7 @@ async function getLearnCardNetworkPlugin(learnCard, url3, apiToken) {
|
|
|
64351
64841
|
await ensureUser();
|
|
64352
64842
|
return client.boost.deleteBoost.mutate({ uri });
|
|
64353
64843
|
}, "deleteBoost"),
|
|
64354
|
-
sendBoost: /* @__PURE__ */ __name(async (_learnCard, profileId, boostUri, options = { encrypt: true, skipNotification: false }) => {
|
|
64844
|
+
sendBoost: /* @__PURE__ */ __name(async (_learnCard, profileId, boostUri, options = { encrypt: true, skipNotification: false, templateData: {} }) => {
|
|
64355
64845
|
await ensureUser();
|
|
64356
64846
|
const result = await _learnCard.invoke.resolveFromLCN(boostUri);
|
|
64357
64847
|
const data = await UnsignedVCValidator.spa(result);
|
|
@@ -64374,6 +64864,17 @@ async function getLearnCardNetworkPlugin(learnCard, url3, apiToken) {
|
|
|
64374
64864
|
boost.credentialSubject.id = targetProfile.did;
|
|
64375
64865
|
}
|
|
64376
64866
|
if (boost?.type?.includes("BoostCredential")) boost.boostId = boostUri;
|
|
64867
|
+
if (typeof options === "object" && options.templateData && Object.keys(options.templateData).length > 0) {
|
|
64868
|
+
try {
|
|
64869
|
+
const boostString = JSON.stringify(boost);
|
|
64870
|
+
const rendered = renderTemplateJson(boostString, options.templateData);
|
|
64871
|
+
boost = JSON.parse(rendered);
|
|
64872
|
+
} catch (error91) {
|
|
64873
|
+
throw new Error(
|
|
64874
|
+
`Template substitution failed: ${error91 instanceof Error ? error91.message : "Unknown error"}. Please check your templateData variables and ensure the rendered output is valid JSON.`
|
|
64875
|
+
);
|
|
64876
|
+
}
|
|
64877
|
+
}
|
|
64377
64878
|
if (typeof options === "object" && options.overideFn) {
|
|
64378
64879
|
boost = options.overideFn(boost);
|
|
64379
64880
|
}
|
|
@@ -64459,6 +64960,20 @@ async function getLearnCardNetworkPlugin(learnCard, url3, apiToken) {
|
|
|
64459
64960
|
targetDid = targetProfile.did;
|
|
64460
64961
|
}
|
|
64461
64962
|
let boost = data.data;
|
|
64963
|
+
if (input.templateData && Object.keys(input.templateData).length > 0) {
|
|
64964
|
+
try {
|
|
64965
|
+
const boostString = JSON.stringify(boost);
|
|
64966
|
+
const rendered = renderTemplateJson(
|
|
64967
|
+
boostString,
|
|
64968
|
+
input.templateData
|
|
64969
|
+
);
|
|
64970
|
+
boost = JSON.parse(rendered);
|
|
64971
|
+
} catch (error91) {
|
|
64972
|
+
throw new Error(
|
|
64973
|
+
`Failed to apply template data: ${error91 instanceof Error ? error91.message : "Unknown error"}`
|
|
64974
|
+
);
|
|
64975
|
+
}
|
|
64976
|
+
}
|
|
64462
64977
|
if (isVC2Format(boost)) {
|
|
64463
64978
|
boost.validFrom = (/* @__PURE__ */ new Date()).toISOString();
|
|
64464
64979
|
} else {
|
|
@@ -65130,4 +65645,12 @@ export {
|
|
|
65130
65645
|
@trpc/client/dist/links/retryLink.mjs:
|
|
65131
65646
|
(* istanbul ignore file -- @preserve *)
|
|
65132
65647
|
*/
|
|
65648
|
+
/*! Bundled license information:
|
|
65649
|
+
|
|
65650
|
+
mustache/mustache.mjs:
|
|
65651
|
+
(*!
|
|
65652
|
+
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
65653
|
+
* http://github.com/janl/mustache.js
|
|
65654
|
+
*)
|
|
65655
|
+
*/
|
|
65133
65656
|
//# sourceMappingURL=lcn-plugin.esm.js.map
|