@player-ui/markdown-plugin 0.16.0--canary.866.36538 → 0.16.0--canary.891.38216
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.
|
@@ -1513,412 +1513,6 @@ var MarkdownPlugin = function() {
|
|
|
1513
1513
|
});
|
|
1514
1514
|
return batchTxn;
|
|
1515
1515
|
};
|
|
1516
|
-
var pointerToBinding = function pointerToBinding(pointer) {
|
|
1517
|
-
if (!pointer || pointer === "/") return "";
|
|
1518
|
-
var absolute = pointer.startsWith("/");
|
|
1519
|
-
var raw = absolute ? pointer.slice(1) : pointer;
|
|
1520
|
-
var segments = raw.split("/").map(decodeSegment);
|
|
1521
|
-
var out = "";
|
|
1522
|
-
for(var i = 0; i < segments.length; i++){
|
|
1523
|
-
var seg = segments[i];
|
|
1524
|
-
if (NUMERIC_SEGMENT.test(seg)) {
|
|
1525
|
-
out += "[".concat(seg, "]");
|
|
1526
|
-
} else {
|
|
1527
|
-
out += i === 0 ? seg : ".".concat(seg);
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
return out;
|
|
1531
|
-
};
|
|
1532
|
-
var bindingToSegments = function bindingToSegments(binding) {
|
|
1533
|
-
if (!binding) return [];
|
|
1534
|
-
var segments = [];
|
|
1535
|
-
var parts = binding.split(".");
|
|
1536
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1537
|
-
try {
|
|
1538
|
-
for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1539
|
-
var part = _step.value;
|
|
1540
|
-
var match = part.match(/^([^[]+)((?:\[\d+\])*)$/);
|
|
1541
|
-
if (!match) {
|
|
1542
|
-
segments.push(part);
|
|
1543
|
-
continue;
|
|
1544
|
-
}
|
|
1545
|
-
var _match = _sliced_to_array(match, 3), name = _match[1], arrays = _match[2];
|
|
1546
|
-
if (name) segments.push(name);
|
|
1547
|
-
if (arrays) {
|
|
1548
|
-
var _segments;
|
|
1549
|
-
var _arrays_match;
|
|
1550
|
-
var arrayMatches = (_arrays_match = arrays.match(/\[\d+\]/g)) !== null && _arrays_match !== void 0 ? _arrays_match : [];
|
|
1551
|
-
(_segments = segments).push.apply(_segments, _to_consumable_array(arrayMatches));
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
} catch (err) {
|
|
1555
|
-
_didIteratorError = true;
|
|
1556
|
-
_iteratorError = err;
|
|
1557
|
-
} finally{
|
|
1558
|
-
try {
|
|
1559
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1560
|
-
_iterator.return();
|
|
1561
|
-
}
|
|
1562
|
-
} finally{
|
|
1563
|
-
if (_didIteratorError) {
|
|
1564
|
-
throw _iteratorError;
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
return segments;
|
|
1569
|
-
};
|
|
1570
|
-
var interpolatePointers = function interpolatePointers(input) {
|
|
1571
|
-
return input.replace(/\$\{([^}]+)\}/g, function(_, pointer) {
|
|
1572
|
-
return "{{".concat(pointerToBinding(pointer), "}}");
|
|
1573
|
-
});
|
|
1574
|
-
};
|
|
1575
|
-
var translateFunctionCall = function translateFunctionCall(call, logger) {
|
|
1576
|
-
if (call.call === "formatString") {
|
|
1577
|
-
var _call_args;
|
|
1578
|
-
var value = (_call_args = call.args) === null || _call_args === void 0 ? void 0 : _call_args.value;
|
|
1579
|
-
if (typeof value === "string") return interpolatePointers(value);
|
|
1580
|
-
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] formatString received non-string 'value' arg; emitting expression form");
|
|
1581
|
-
}
|
|
1582
|
-
var argList = renderArgList(call.args);
|
|
1583
|
-
if (call.call === "formatString") {
|
|
1584
|
-
return "@[formatString(".concat(argList, ")]@");
|
|
1585
|
-
}
|
|
1586
|
-
return "@[".concat(call.call, "(").concat(argList, ")]@");
|
|
1587
|
-
};
|
|
1588
|
-
var renderArgList = function renderArgList(args) {
|
|
1589
|
-
if (!args) return "";
|
|
1590
|
-
return Object.values(args).map(renderArg).join(", ");
|
|
1591
|
-
};
|
|
1592
|
-
var newBuilder = function newBuilder() {
|
|
1593
|
-
return {
|
|
1594
|
-
schema: {
|
|
1595
|
-
ROOT: {}
|
|
1596
|
-
},
|
|
1597
|
-
knownTypes: /* @__PURE__ */ new Set([
|
|
1598
|
-
"ROOT"
|
|
1599
|
-
])
|
|
1600
|
-
};
|
|
1601
|
-
};
|
|
1602
|
-
var findBoundPath = function findBoundPath(component, logger) {
|
|
1603
|
-
var lookupProp = INPUT_BINDING_PROPS[component.component];
|
|
1604
|
-
if (lookupProp) {
|
|
1605
|
-
var prop = component[lookupProp];
|
|
1606
|
-
if (isPathRef(prop)) return prop.path;
|
|
1607
|
-
}
|
|
1608
|
-
var pathRefs = collectPathRefs(component);
|
|
1609
|
-
if (pathRefs.length === 1) return pathRefs[0];
|
|
1610
|
-
if (pathRefs.length > 1) {
|
|
1611
|
-
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] Component '".concat(component.id, "' (").concat(component.component, ") has checks but multiple {path} refs; skipping schema synthesis for this component"));
|
|
1612
|
-
} else {
|
|
1613
|
-
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] Component '".concat(component.id, "' (").concat(component.component, ") has checks but no bound path could be determined; skipping"));
|
|
1614
|
-
}
|
|
1615
|
-
return void 0;
|
|
1616
|
-
};
|
|
1617
|
-
var collectPathRefs = function collectPathRefs(component) {
|
|
1618
|
-
var found = [];
|
|
1619
|
-
var walk = function walk1(v) {
|
|
1620
|
-
if (!v || (typeof v === "undefined" ? "undefined" : _type_of(v)) !== "object") return;
|
|
1621
|
-
if (Array.isArray(v)) {
|
|
1622
|
-
v.forEach(walk);
|
|
1623
|
-
return;
|
|
1624
|
-
}
|
|
1625
|
-
if (isPathRef(v)) {
|
|
1626
|
-
found.push(v.path);
|
|
1627
|
-
return;
|
|
1628
|
-
}
|
|
1629
|
-
Object.values(v).forEach(walk);
|
|
1630
|
-
};
|
|
1631
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1632
|
-
try {
|
|
1633
|
-
for(var _iterator = Object.entries(component)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1634
|
-
var _step_value = _sliced_to_array(_step.value, 2), k = _step_value[0], v = _step_value[1];
|
|
1635
|
-
if (k === "id" || k === "component" || k === "checks" || k === "action") {
|
|
1636
|
-
continue;
|
|
1637
|
-
}
|
|
1638
|
-
walk(v);
|
|
1639
|
-
}
|
|
1640
|
-
} catch (err) {
|
|
1641
|
-
_didIteratorError = true;
|
|
1642
|
-
_iteratorError = err;
|
|
1643
|
-
} finally{
|
|
1644
|
-
try {
|
|
1645
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1646
|
-
_iterator.return();
|
|
1647
|
-
}
|
|
1648
|
-
} finally{
|
|
1649
|
-
if (_didIteratorError) {
|
|
1650
|
-
throw _iteratorError;
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
return found;
|
|
1655
|
-
};
|
|
1656
|
-
var translateCheck = function translateCheck(check, logger) {
|
|
1657
|
-
var _check_args;
|
|
1658
|
-
var type = CHECK_TO_VALIDATOR[check.call];
|
|
1659
|
-
if (!type) {
|
|
1660
|
-
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] Unknown validation check '".concat(check.call, "'; dropping"));
|
|
1661
|
-
return void 0;
|
|
1662
|
-
}
|
|
1663
|
-
var ref = {
|
|
1664
|
-
type: type,
|
|
1665
|
-
severity: "error"
|
|
1666
|
-
};
|
|
1667
|
-
if (check.message) ref.message = check.message;
|
|
1668
|
-
if (check.call === "regex" && ((_check_args = check.args) === null || _check_args === void 0 ? void 0 : _check_args.pattern)) {
|
|
1669
|
-
ref.regex = unwrapLiteral(check.args.pattern);
|
|
1670
|
-
}
|
|
1671
|
-
if (check.call === "length") {
|
|
1672
|
-
var _check_args1, _check_args2;
|
|
1673
|
-
if (((_check_args1 = check.args) === null || _check_args1 === void 0 ? void 0 : _check_args1.min) !== void 0) ref.min = unwrapLiteral(check.args.min);
|
|
1674
|
-
if (((_check_args2 = check.args) === null || _check_args2 === void 0 ? void 0 : _check_args2.max) !== void 0) ref.max = unwrapLiteral(check.args.max);
|
|
1675
|
-
}
|
|
1676
|
-
return ref;
|
|
1677
|
-
};
|
|
1678
|
-
var unwrapLiteral = function unwrapLiteral(value) {
|
|
1679
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) {
|
|
1680
|
-
return value;
|
|
1681
|
-
}
|
|
1682
|
-
return value;
|
|
1683
|
-
};
|
|
1684
|
-
var installAtPath = function installAtPath(builder, binding, leafType, validations, logger) {
|
|
1685
|
-
var segments = bindingToSegments(binding).filter(function(s) {
|
|
1686
|
-
return !s.startsWith("[");
|
|
1687
|
-
});
|
|
1688
|
-
if (segments.length === 0) {
|
|
1689
|
-
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] Cannot install schema validation at empty path; skipping");
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
var currentNode = builder.schema.ROOT;
|
|
1693
|
-
var ownerPath = [];
|
|
1694
|
-
for(var i = 0; i < segments.length - 1; i++){
|
|
1695
|
-
var seg = segments[i];
|
|
1696
|
-
ownerPath.push(seg);
|
|
1697
|
-
var typeName = "".concat(TYPE_PREFIX).concat(ownerPath.join("_"));
|
|
1698
|
-
var existing = currentNode[seg];
|
|
1699
|
-
if (!existing) {
|
|
1700
|
-
currentNode[seg] = {
|
|
1701
|
-
type: typeName
|
|
1702
|
-
};
|
|
1703
|
-
} else if (existing.type !== typeName) {}
|
|
1704
|
-
var ref = currentNode[seg].type;
|
|
1705
|
-
if (!builder.schema[ref]) {
|
|
1706
|
-
builder.schema[ref] = {};
|
|
1707
|
-
builder.knownTypes.add(ref);
|
|
1708
|
-
}
|
|
1709
|
-
currentNode = builder.schema[ref];
|
|
1710
|
-
}
|
|
1711
|
-
var leafSeg = segments[segments.length - 1];
|
|
1712
|
-
var existingLeaf = currentNode[leafSeg];
|
|
1713
|
-
if (existingLeaf) {
|
|
1714
|
-
var _existingLeaf_validation;
|
|
1715
|
-
var merged = _object_spread_props(_object_spread({}, existingLeaf), {
|
|
1716
|
-
type: pickLeafType(existingLeaf.type, leafType),
|
|
1717
|
-
validation: _to_consumable_array((_existingLeaf_validation = existingLeaf.validation) !== null && _existingLeaf_validation !== void 0 ? _existingLeaf_validation : []).concat(_to_consumable_array(validations))
|
|
1718
|
-
});
|
|
1719
|
-
currentNode[leafSeg] = merged;
|
|
1720
|
-
} else {
|
|
1721
|
-
currentNode[leafSeg] = {
|
|
1722
|
-
type: leafType,
|
|
1723
|
-
validation: validations
|
|
1724
|
-
};
|
|
1725
|
-
}
|
|
1726
|
-
};
|
|
1727
|
-
var pickLeafType = function pickLeafType(existing, incoming) {
|
|
1728
|
-
if (incoming !== "string") return incoming;
|
|
1729
|
-
return existing;
|
|
1730
|
-
};
|
|
1731
|
-
var defaultLeafType = function defaultLeafType(component, checks) {
|
|
1732
|
-
if (component.component === "CheckBox") return "boolean";
|
|
1733
|
-
if (checks.some(function(c) {
|
|
1734
|
-
return c.call === "numeric";
|
|
1735
|
-
})) return "number";
|
|
1736
|
-
return "string";
|
|
1737
|
-
};
|
|
1738
|
-
var synthesizeSchema = function synthesizeSchema(components, logger) {
|
|
1739
|
-
var builder = newBuilder();
|
|
1740
|
-
var found = false;
|
|
1741
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1742
|
-
try {
|
|
1743
|
-
for(var _iterator = components[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1744
|
-
var component = _step.value;
|
|
1745
|
-
if (!component.checks || component.checks.length === 0) continue;
|
|
1746
|
-
var pointer = findBoundPath(component, logger);
|
|
1747
|
-
if (!pointer) continue;
|
|
1748
|
-
var binding = pointerToBinding(pointer);
|
|
1749
|
-
if (!binding) continue;
|
|
1750
|
-
var validations = component.checks.map(function(c) {
|
|
1751
|
-
return translateCheck(c, logger);
|
|
1752
|
-
}).filter(function(v) {
|
|
1753
|
-
return v !== void 0;
|
|
1754
|
-
});
|
|
1755
|
-
if (validations.length === 0) continue;
|
|
1756
|
-
installAtPath(builder, binding, defaultLeafType(component, component.checks), validations, logger);
|
|
1757
|
-
found = true;
|
|
1758
|
-
}
|
|
1759
|
-
} catch (err) {
|
|
1760
|
-
_didIteratorError = true;
|
|
1761
|
-
_iteratorError = err;
|
|
1762
|
-
} finally{
|
|
1763
|
-
try {
|
|
1764
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1765
|
-
_iterator.return();
|
|
1766
|
-
}
|
|
1767
|
-
} finally{
|
|
1768
|
-
if (_didIteratorError) {
|
|
1769
|
-
throw _iteratorError;
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
return found ? builder.schema : void 0;
|
|
1774
|
-
};
|
|
1775
|
-
var resolveAndInline = function resolveAndInline(id, ctx, templateScope) {
|
|
1776
|
-
var component = ctx.byId.get(id);
|
|
1777
|
-
if (!component) {
|
|
1778
|
-
throw new Error("[a2ui] Component reference '".concat(id, "' could not be resolved in the snapshot."));
|
|
1779
|
-
}
|
|
1780
|
-
return inlineComponent(component, ctx, templateScope);
|
|
1781
|
-
};
|
|
1782
|
-
var wrapInlined = function wrapInlined(asset) {
|
|
1783
|
-
return {
|
|
1784
|
-
asset: asset
|
|
1785
|
-
};
|
|
1786
|
-
};
|
|
1787
|
-
var scopedBinding = function scopedBinding(pointer, scope) {
|
|
1788
|
-
if (!pointer || pointer === "/") return scope !== null && scope !== void 0 ? scope : "";
|
|
1789
|
-
if (pointer.startsWith("/")) return pointerToBinding(pointer);
|
|
1790
|
-
if (!scope) return pointerToBinding(pointer);
|
|
1791
|
-
var relative = pointerToBinding(pointer);
|
|
1792
|
-
return relative ? "".concat(scope, "._index_.").concat(relative) : "".concat(scope, "._index_");
|
|
1793
|
-
};
|
|
1794
|
-
var scopedPointer = function scopedPointer(pointer, scope) {
|
|
1795
|
-
if (pointer.startsWith("/")) return pointer;
|
|
1796
|
-
return "/".concat(scope, "/_index_/").concat(pointer);
|
|
1797
|
-
};
|
|
1798
|
-
var translateAction = function translateAction(action, ctx) {
|
|
1799
|
-
if ("event" in action) {
|
|
1800
|
-
var _action_event = action.event, name = _action_event.name, context = _action_event.context;
|
|
1801
|
-
ctx.eventNames.add(name);
|
|
1802
|
-
var result = {
|
|
1803
|
-
value: name
|
|
1804
|
-
};
|
|
1805
|
-
if (context && Object.keys(context).length > 0) {
|
|
1806
|
-
result.exp = buildContextWriteExpressions(context);
|
|
1807
|
-
}
|
|
1808
|
-
return result;
|
|
1809
|
-
}
|
|
1810
|
-
return {
|
|
1811
|
-
exp: translateFunctionCall(action.functionCall, ctx.logger)
|
|
1812
|
-
};
|
|
1813
|
-
};
|
|
1814
|
-
var buildContextWriteExpressions = function buildContextWriteExpressions(context) {
|
|
1815
|
-
return Object.entries(context).map(function(param) {
|
|
1816
|
-
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
1817
|
-
var lhs = "{{".concat(A2UI_EVENT_CONTEXT_NAMESPACE, ".").concat(key, "}}");
|
|
1818
|
-
return "".concat(lhs, " = ").concat(renderRhs(value));
|
|
1819
|
-
});
|
|
1820
|
-
};
|
|
1821
|
-
var buildNavigation = function buildNavigation(surfaceId, eventNames) {
|
|
1822
|
-
var view = {
|
|
1823
|
-
state_type: "VIEW",
|
|
1824
|
-
ref: surfaceId,
|
|
1825
|
-
transitions: {
|
|
1826
|
-
"*": "END_Done"
|
|
1827
|
-
}
|
|
1828
|
-
};
|
|
1829
|
-
var endStates = {
|
|
1830
|
-
END_Done: {
|
|
1831
|
-
state_type: "END",
|
|
1832
|
-
outcome: "done"
|
|
1833
|
-
}
|
|
1834
|
-
};
|
|
1835
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1836
|
-
try {
|
|
1837
|
-
for(var _iterator = eventNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1838
|
-
var name = _step.value;
|
|
1839
|
-
var endName = "END_".concat(name);
|
|
1840
|
-
view.transitions[name] = endName;
|
|
1841
|
-
endStates[endName] = {
|
|
1842
|
-
state_type: "END",
|
|
1843
|
-
outcome: name
|
|
1844
|
-
};
|
|
1845
|
-
}
|
|
1846
|
-
} catch (err) {
|
|
1847
|
-
_didIteratorError = true;
|
|
1848
|
-
_iteratorError = err;
|
|
1849
|
-
} finally{
|
|
1850
|
-
try {
|
|
1851
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1852
|
-
_iterator.return();
|
|
1853
|
-
}
|
|
1854
|
-
} finally{
|
|
1855
|
-
if (_didIteratorError) {
|
|
1856
|
-
throw _iteratorError;
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
var flow3 = _object_spread({
|
|
1861
|
-
startState: "VIEW_1",
|
|
1862
|
-
VIEW_1: view
|
|
1863
|
-
}, endStates);
|
|
1864
|
-
return {
|
|
1865
|
-
BEGIN: "FLOW_1",
|
|
1866
|
-
FLOW_1: flow3
|
|
1867
|
-
};
|
|
1868
|
-
};
|
|
1869
|
-
var adaptA2UIToFlow = function adaptA2UIToFlow(snapshot, logger) {
|
|
1870
|
-
var _snapshot_data;
|
|
1871
|
-
if (!snapshot || !Array.isArray(snapshot.components)) {
|
|
1872
|
-
throw new Error("[a2ui] snapshot.components must be an array");
|
|
1873
|
-
}
|
|
1874
|
-
var byId = /* @__PURE__ */ new Map();
|
|
1875
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1876
|
-
try {
|
|
1877
|
-
for(var _iterator = snapshot.components[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1878
|
-
var component = _step.value;
|
|
1879
|
-
if (!(component === null || component === void 0 ? void 0 : component.id)) {
|
|
1880
|
-
throw new Error("[a2ui] every component must have an id");
|
|
1881
|
-
}
|
|
1882
|
-
byId.set(component.id, component);
|
|
1883
|
-
}
|
|
1884
|
-
} catch (err) {
|
|
1885
|
-
_didIteratorError = true;
|
|
1886
|
-
_iteratorError = err;
|
|
1887
|
-
} finally{
|
|
1888
|
-
try {
|
|
1889
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1890
|
-
_iterator.return();
|
|
1891
|
-
}
|
|
1892
|
-
} finally{
|
|
1893
|
-
if (_didIteratorError) {
|
|
1894
|
-
throw _iteratorError;
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
var root = byId.get("root");
|
|
1899
|
-
if (!root) {
|
|
1900
|
-
throw new Error("[a2ui] snapshot must contain a component with id 'root'");
|
|
1901
|
-
}
|
|
1902
|
-
var ctx = {
|
|
1903
|
-
byId: byId,
|
|
1904
|
-
inProgress: /* @__PURE__ */ new Set(),
|
|
1905
|
-
eventNames: /* @__PURE__ */ new Set(),
|
|
1906
|
-
logger: logger
|
|
1907
|
-
};
|
|
1908
|
-
var rootAsset = inlineComponent(root, ctx);
|
|
1909
|
-
rootAsset.id = snapshot.surfaceId;
|
|
1910
|
-
var schema = synthesizeSchema(snapshot.components, logger);
|
|
1911
|
-
var flow3 = {
|
|
1912
|
-
id: snapshot.surfaceId,
|
|
1913
|
-
views: [
|
|
1914
|
-
rootAsset
|
|
1915
|
-
],
|
|
1916
|
-
data: (_snapshot_data = snapshot.data) !== null && _snapshot_data !== void 0 ? _snapshot_data : {},
|
|
1917
|
-
navigation: buildNavigation(snapshot.surfaceId, ctx.eventNames)
|
|
1918
|
-
};
|
|
1919
|
-
if (schema) flow3.schema = schema;
|
|
1920
|
-
return flow3;
|
|
1921
|
-
};
|
|
1922
1516
|
var toString = function toString(value, options) {
|
|
1923
1517
|
var settings = options || emptyOptions;
|
|
1924
1518
|
var includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
|
|
@@ -6491,7 +6085,7 @@ var MarkdownPlugin = function() {
|
|
|
6491
6085
|
}
|
|
6492
6086
|
return out;
|
|
6493
6087
|
}
|
|
6494
|
-
function
|
|
6088
|
+
function isObject(o) {
|
|
6495
6089
|
return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
|
|
6496
6090
|
}
|
|
6497
6091
|
function addLast2(array, val) {
|
|
@@ -6564,7 +6158,7 @@ var MarkdownPlugin = function() {
|
|
|
6564
6158
|
if (idx === path.length - 1) {
|
|
6565
6159
|
newValue = val;
|
|
6566
6160
|
} else {
|
|
6567
|
-
var nestedObj =
|
|
6161
|
+
var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof path[idx + 1] === "number" ? [] : {};
|
|
6568
6162
|
newValue = doSetIn(nestedObj, path, val, idx + 1);
|
|
6569
6163
|
}
|
|
6570
6164
|
return set2(obj, key, newValue);
|
|
@@ -6694,7 +6288,7 @@ var MarkdownPlugin = function() {
|
|
|
6694
6288
|
var key = keys[j];
|
|
6695
6289
|
if (fAddDefaults && out[key] !== void 0) continue;
|
|
6696
6290
|
var nextVal = obj[key];
|
|
6697
|
-
if (fDeep &&
|
|
6291
|
+
if (fDeep && isObject(out[key]) && isObject(nextVal)) {
|
|
6698
6292
|
nextVal = doMerge(fAddDefaults, fDeep, out[key], nextVal);
|
|
6699
6293
|
}
|
|
6700
6294
|
if (nextVal === void 0 || nextVal === out[key]) continue;
|
|
@@ -12166,234 +11760,8 @@ var MarkdownPlugin = function() {
|
|
|
12166
11760
|
ref: Symbol("not-started"),
|
|
12167
11761
|
status: "not-started"
|
|
12168
11762
|
};
|
|
12169
|
-
var
|
|
12170
|
-
var
|
|
12171
|
-
var decodeSegment = function decodeSegment(segment) {
|
|
12172
|
-
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
12173
|
-
};
|
|
12174
|
-
var isObject = function isObject(v) {
|
|
12175
|
-
return (typeof v === "undefined" ? "undefined" : _type_of(v)) === "object" && v !== null && !Array.isArray(v);
|
|
12176
|
-
};
|
|
12177
|
-
var isPathRef = function isPathRef(v) {
|
|
12178
|
-
return isObject(v) && typeof v.path === "string" && Object.keys(v).length === 1;
|
|
12179
|
-
};
|
|
12180
|
-
var isFunctionCall = function isFunctionCall(v) {
|
|
12181
|
-
return isObject(v) && typeof v.call === "string";
|
|
12182
|
-
};
|
|
12183
|
-
function renderArg(value) {
|
|
12184
|
-
if (value === null) return "null";
|
|
12185
|
-
if (value === void 0) return "null";
|
|
12186
|
-
if (typeof value === "boolean") return String(value);
|
|
12187
|
-
if (typeof value === "number") return String(value);
|
|
12188
|
-
if (typeof value === "string") return JSON.stringify(value);
|
|
12189
|
-
if (Array.isArray(value)) {
|
|
12190
|
-
return "[".concat(value.map(renderArg).join(", "), "]");
|
|
12191
|
-
}
|
|
12192
|
-
if (isPathRef(value)) {
|
|
12193
|
-
return "{{".concat(pointerToBinding(value.path), "}}");
|
|
12194
|
-
}
|
|
12195
|
-
if (isFunctionCall(value)) {
|
|
12196
|
-
var inner = translateFunctionCall(value);
|
|
12197
|
-
return inner.replace(/^@\[/, "").replace(/\]@$/, "");
|
|
12198
|
-
}
|
|
12199
|
-
return JSON.stringify(value);
|
|
12200
|
-
}
|
|
12201
|
-
var INPUT_BINDING_PROPS = {
|
|
12202
|
-
TextField: "text",
|
|
12203
|
-
CheckBox: "checked",
|
|
12204
|
-
DateTimeInput: "value",
|
|
12205
|
-
ChoicePicker: "value",
|
|
12206
|
-
Slider: "value"
|
|
12207
|
-
};
|
|
12208
|
-
var CHECK_TO_VALIDATOR = {
|
|
12209
|
-
required: "required",
|
|
12210
|
-
regex: "regex",
|
|
12211
|
-
email: "email",
|
|
12212
|
-
length: "length",
|
|
12213
|
-
numeric: "numeric"
|
|
12214
|
-
};
|
|
12215
|
-
var TYPE_PREFIX = "T_";
|
|
12216
|
-
var STRUCTURAL_KEYS = /* @__PURE__ */ new Set([
|
|
12217
|
-
"id",
|
|
12218
|
-
"component",
|
|
12219
|
-
"child",
|
|
12220
|
-
"children",
|
|
12221
|
-
"checks",
|
|
12222
|
-
"action"
|
|
12223
|
-
]);
|
|
12224
|
-
function inlineComponent(component, ctx, templateScope) {
|
|
12225
|
-
if (ctx.inProgress.has(component.id)) {
|
|
12226
|
-
throw new Error("[a2ui] Component cycle detected at id '".concat(component.id, "'. A2UI requires the component graph to be a tree."));
|
|
12227
|
-
}
|
|
12228
|
-
ctx.inProgress.add(component.id);
|
|
12229
|
-
var asset = {
|
|
12230
|
-
id: component.id,
|
|
12231
|
-
type: component.component
|
|
12232
|
-
};
|
|
12233
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
12234
|
-
try {
|
|
12235
|
-
for(var _iterator = Object.entries(component)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
12236
|
-
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
12237
|
-
if (STRUCTURAL_KEYS.has(key)) continue;
|
|
12238
|
-
asset[key] = translatePropValue(value, templateScope, ctx, key);
|
|
12239
|
-
}
|
|
12240
|
-
} catch (err) {
|
|
12241
|
-
_didIteratorError = true;
|
|
12242
|
-
_iteratorError = err;
|
|
12243
|
-
} finally{
|
|
12244
|
-
try {
|
|
12245
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
12246
|
-
_iterator.return();
|
|
12247
|
-
}
|
|
12248
|
-
} finally{
|
|
12249
|
-
if (_didIteratorError) {
|
|
12250
|
-
throw _iteratorError;
|
|
12251
|
-
}
|
|
12252
|
-
}
|
|
12253
|
-
}
|
|
12254
|
-
if (typeof component.child === "string") {
|
|
12255
|
-
var childId = component.child;
|
|
12256
|
-
asset.child = wrapInlined(resolveAndInline(childId, ctx, templateScope));
|
|
12257
|
-
}
|
|
12258
|
-
if (component.children) {
|
|
12259
|
-
if (Array.isArray(component.children)) {
|
|
12260
|
-
asset.children = component.children.map(function(id) {
|
|
12261
|
-
return wrapInlined(resolveAndInline(id, ctx, templateScope));
|
|
12262
|
-
});
|
|
12263
|
-
} else {
|
|
12264
|
-
var _component_children = component.children, path = _component_children.path, componentId = _component_children.componentId;
|
|
12265
|
-
var data = scopedBinding(path, templateScope);
|
|
12266
|
-
var templateComponent = ctx.byId.get(componentId);
|
|
12267
|
-
if (!templateComponent) {
|
|
12268
|
-
throw new Error("[a2ui] Templated children reference unknown componentId '".concat(componentId, "' on component '").concat(component.id, "'."));
|
|
12269
|
-
}
|
|
12270
|
-
var templated = inlineComponent(_object_spread_props(_object_spread({}, templateComponent), {
|
|
12271
|
-
id: "".concat(templateComponent.id, "-_index_")
|
|
12272
|
-
}), ctx, data);
|
|
12273
|
-
asset.template = [
|
|
12274
|
-
{
|
|
12275
|
-
data: data,
|
|
12276
|
-
output: "children",
|
|
12277
|
-
value: {
|
|
12278
|
-
asset: templated
|
|
12279
|
-
}
|
|
12280
|
-
}
|
|
12281
|
-
];
|
|
12282
|
-
}
|
|
12283
|
-
}
|
|
12284
|
-
if (component.action) {
|
|
12285
|
-
Object.assign(asset, translateAction(component.action, ctx));
|
|
12286
|
-
}
|
|
12287
|
-
ctx.inProgress.delete(component.id);
|
|
12288
|
-
return asset;
|
|
12289
|
-
}
|
|
12290
|
-
var CHILD_KEY_RE = /(?:^|[a-z])Child$|^child$/;
|
|
12291
|
-
var CHILDREN_KEY_RE = /(?:^|[a-z])Children$|^children$/;
|
|
12292
|
-
function translatePropValue(value, templateScope, ctx, parentKey) {
|
|
12293
|
-
if (value === null || value === void 0) return value;
|
|
12294
|
-
if (parentKey && CHILD_KEY_RE.test(parentKey) && typeof value === "string") {
|
|
12295
|
-
return wrapInlined(resolveAndInline(value, ctx, templateScope));
|
|
12296
|
-
}
|
|
12297
|
-
if (parentKey && CHILDREN_KEY_RE.test(parentKey)) {
|
|
12298
|
-
if (Array.isArray(value) && value.every(function(v) {
|
|
12299
|
-
return typeof v === "string";
|
|
12300
|
-
})) {
|
|
12301
|
-
return value.map(function(id) {
|
|
12302
|
-
return wrapInlined(resolveAndInline(id, ctx, templateScope));
|
|
12303
|
-
});
|
|
12304
|
-
}
|
|
12305
|
-
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null && !Array.isArray(value) && "componentId" in value) {
|
|
12306
|
-
var _ctx_logger;
|
|
12307
|
-
(_ctx_logger = ctx.logger) === null || _ctx_logger === void 0 ? void 0 : _ctx_logger.warn("[a2ui] Templated children are only supported at top-level 'children'; '".concat(parentKey, "' will be left unresolved."));
|
|
12308
|
-
}
|
|
12309
|
-
}
|
|
12310
|
-
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) !== "object") return value;
|
|
12311
|
-
if (Array.isArray(value)) {
|
|
12312
|
-
return value.map(function(v) {
|
|
12313
|
-
return translatePropValue(v, templateScope, ctx, void 0);
|
|
12314
|
-
});
|
|
12315
|
-
}
|
|
12316
|
-
if (isPathRef(value)) {
|
|
12317
|
-
return scopedBinding(value.path, templateScope);
|
|
12318
|
-
}
|
|
12319
|
-
if (isFunctionCall(value)) {
|
|
12320
|
-
if (templateScope) {
|
|
12321
|
-
return translateFunctionCall(rewritePathsInCall(value, templateScope), ctx.logger);
|
|
12322
|
-
}
|
|
12323
|
-
return translateFunctionCall(value, ctx.logger);
|
|
12324
|
-
}
|
|
12325
|
-
var out = {};
|
|
12326
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
12327
|
-
try {
|
|
12328
|
-
for(var _iterator = Object.entries(value)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
12329
|
-
var _step_value = _sliced_to_array(_step.value, 2), k = _step_value[0], v = _step_value[1];
|
|
12330
|
-
out[k] = translatePropValue(v, templateScope, ctx, k);
|
|
12331
|
-
}
|
|
12332
|
-
} catch (err) {
|
|
12333
|
-
_didIteratorError = true;
|
|
12334
|
-
_iteratorError = err;
|
|
12335
|
-
} finally{
|
|
12336
|
-
try {
|
|
12337
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
12338
|
-
_iterator.return();
|
|
12339
|
-
}
|
|
12340
|
-
} finally{
|
|
12341
|
-
if (_didIteratorError) {
|
|
12342
|
-
throw _iteratorError;
|
|
12343
|
-
}
|
|
12344
|
-
}
|
|
12345
|
-
}
|
|
12346
|
-
return out;
|
|
12347
|
-
}
|
|
12348
|
-
function rewritePathsInCall(value, scope) {
|
|
12349
|
-
if (!value || (typeof value === "undefined" ? "undefined" : _type_of(value)) !== "object") return value;
|
|
12350
|
-
if (Array.isArray(value)) {
|
|
12351
|
-
return value.map(function(v) {
|
|
12352
|
-
return rewritePathsInCall(v, scope);
|
|
12353
|
-
});
|
|
12354
|
-
}
|
|
12355
|
-
if (isPathRef(value)) {
|
|
12356
|
-
return {
|
|
12357
|
-
path: scopedPointer(value.path, scope)
|
|
12358
|
-
};
|
|
12359
|
-
}
|
|
12360
|
-
if (isFunctionCall(value)) {
|
|
12361
|
-
return _object_spread_props(_object_spread({}, value), {
|
|
12362
|
-
args: value.args ? Object.fromEntries(Object.entries(value.args).map(function(param) {
|
|
12363
|
-
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
|
12364
|
-
return [
|
|
12365
|
-
k,
|
|
12366
|
-
rewritePathsInCall(v, scope)
|
|
12367
|
-
];
|
|
12368
|
-
})) : value.args
|
|
12369
|
-
});
|
|
12370
|
-
}
|
|
12371
|
-
return Object.fromEntries(Object.entries(value).map(function(param) {
|
|
12372
|
-
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
|
12373
|
-
return [
|
|
12374
|
-
k,
|
|
12375
|
-
rewritePathsInCall(v, scope)
|
|
12376
|
-
];
|
|
12377
|
-
}));
|
|
12378
|
-
}
|
|
12379
|
-
function renderRhs(value) {
|
|
12380
|
-
if (value === null || value === void 0) return "null";
|
|
12381
|
-
if (typeof value === "boolean") return String(value);
|
|
12382
|
-
if (typeof value === "number") return String(value);
|
|
12383
|
-
if (typeof value === "string") return JSON.stringify(value);
|
|
12384
|
-
if (Array.isArray(value)) {
|
|
12385
|
-
return "[".concat(value.map(renderRhs).join(", "), "]");
|
|
12386
|
-
}
|
|
12387
|
-
if (isPathRef(value)) {
|
|
12388
|
-
return "{{".concat(pointerToBinding(value.path), "}}");
|
|
12389
|
-
}
|
|
12390
|
-
if (isFunctionCall(value)) {
|
|
12391
|
-
return translateFunctionCall(value).replace(/^@\[/, "").replace(/\]@$/, "");
|
|
12392
|
-
}
|
|
12393
|
-
return JSON.stringify(value);
|
|
12394
|
-
}
|
|
12395
|
-
var PLAYER_VERSION = true ? "0.16.0--canary.866.36538" : "unknown";
|
|
12396
|
-
var COMMIT = true ? "0186f1bd04fda238cbc62b8d293c8048ab26efc2" : "unknown";
|
|
11763
|
+
var PLAYER_VERSION = true ? "0.16.0--canary.891.38216" : "unknown";
|
|
11764
|
+
var COMMIT = true ? "372ab6dbe7d9c6ad1f0fa889c3824b7287a328e7" : "unknown";
|
|
12397
11765
|
var _Player = /*#__PURE__*/ function() {
|
|
12398
11766
|
function _Player2(config) {
|
|
12399
11767
|
var _this = this;
|
|
@@ -12721,15 +12089,14 @@ var MarkdownPlugin = function() {
|
|
|
12721
12089
|
},
|
|
12722
12090
|
{
|
|
12723
12091
|
key: "start",
|
|
12724
|
-
value: function start(payload
|
|
12092
|
+
value: function start(payload) {
|
|
12725
12093
|
return _async_to_generator(function() {
|
|
12726
|
-
var _this, _ref,
|
|
12094
|
+
var _this, _ref, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
12727
12095
|
return _ts_generator(this, function(_state) {
|
|
12728
12096
|
switch(_state.label){
|
|
12729
12097
|
case 0:
|
|
12730
12098
|
_this = this;
|
|
12731
|
-
|
|
12732
|
-
ref = Symbol((_ref = flow3 === null || flow3 === void 0 ? void 0 : flow3.id) !== null && _ref !== void 0 ? _ref : "payload");
|
|
12099
|
+
ref = Symbol((_ref = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _ref !== void 0 ? _ref : "payload");
|
|
12733
12100
|
maybeUpdateState = function maybeUpdateState(newState) {
|
|
12734
12101
|
if (_this.state.ref !== ref) {
|
|
12735
12102
|
_this.logger.warn("Received update for a flow that's not the current one");
|
|
@@ -12750,7 +12117,7 @@ var MarkdownPlugin = function() {
|
|
|
12750
12117
|
,
|
|
12751
12118
|
4
|
|
12752
12119
|
]);
|
|
12753
|
-
_this_setupFlow = this.setupFlow(
|
|
12120
|
+
_this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
|
|
12754
12121
|
this.setState(_object_spread({
|
|
12755
12122
|
ref: ref
|
|
12756
12123
|
}, state));
|
|
@@ -12785,7 +12152,7 @@ var MarkdownPlugin = function() {
|
|
|
12785
12152
|
errorState = {
|
|
12786
12153
|
status: "error",
|
|
12787
12154
|
ref: ref,
|
|
12788
|
-
flow:
|
|
12155
|
+
flow: payload,
|
|
12789
12156
|
error: error
|
|
12790
12157
|
};
|
|
12791
12158
|
maybeUpdateState(errorState);
|