@feathery/react 2.14.0 → 2.15.1
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/cjs/Form/grid/Element/index.d.ts.map +1 -1
- package/cjs/Form/grid/index.d.ts.map +1 -1
- package/cjs/Form/index.d.ts.map +1 -1
- package/cjs/Form/logic.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/Actions.d.ts +10 -0
- package/cjs/elements/basic/TableElement/Actions.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/EmptyState.d.ts +6 -0
- package/cjs/elements/basic/TableElement/EmptyState.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/Pagination.d.ts +10 -0
- package/cjs/elements/basic/TableElement/Pagination.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/Search.d.ts +7 -0
- package/cjs/elements/basic/TableElement/Search.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/Sort.d.ts +12 -0
- package/cjs/elements/basic/TableElement/Sort.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/exampleData.d.ts +3 -0
- package/cjs/elements/basic/TableElement/exampleData.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/index.d.ts +3 -0
- package/cjs/elements/basic/TableElement/index.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/styles.d.ts +391 -0
- package/cjs/elements/basic/TableElement/styles.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/types.d.ts +10 -0
- package/cjs/elements/basic/TableElement/types.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/useTableData.d.ts +37 -0
- package/cjs/elements/basic/TableElement/useTableData.d.ts.map +1 -0
- package/cjs/elements/basic/TableElement/utils.d.ts +11 -0
- package/cjs/elements/basic/TableElement/utils.d.ts.map +1 -0
- package/cjs/elements/components/skeletons/ElementSkeleton.d.ts +8 -0
- package/cjs/elements/components/skeletons/ElementSkeleton.d.ts.map +1 -0
- package/cjs/elements/fields/AddressLine1Field/index.d.ts.map +1 -1
- package/cjs/elements/index.d.ts +1 -0
- package/cjs/elements/index.d.ts.map +1 -1
- package/cjs/{fthry_FormControl.BwXT0ep8.js → fthry_FormControl.DhxdiYw6.js} +1 -1
- package/cjs/{fthry_InlineTooltip.BdhCa_rK.js → fthry_InlineTooltip.BgAXRUIt.js} +2 -2
- package/cjs/{fthry_Overlay.CkaxO8d5.js → fthry_Overlay.D7IM1ywp.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.mg1fdRD0.js → fthry_PaymentMethodField.NEoloWMI.js} +4 -4
- package/cjs/{fthry_Placeholder.Jcsn0I77.js → fthry_Placeholder.D5C0aH2S.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon.B1bZYLk8.js → fthry_ShowEyeIcon.CmLMyaN5.js} +1 -1
- package/cjs/{fthry_index.CNP-DZpU.js → fthry_index.BFpcCw2o.js} +1 -1
- package/cjs/{fthry_index.CIRAsV1y.js → fthry_index.BJYH_2P6.js} +1 -1
- package/cjs/{fthry_index.CdljdZZa.js → fthry_index.BK_jaGHn.js} +5 -5
- package/cjs/{fthry_index.DamIMdR9.js → fthry_index.Bb1R5GZK.js} +2 -2
- package/cjs/{fthry_index.Wk8VztlG.js → fthry_index.Bd1HfYvE.js} +5 -5
- package/cjs/{fthry_index.CrMPecva.js → fthry_index.BgeTdwT5.js} +2 -2
- package/cjs/{fthry_index.BlqRmYU3.js → fthry_index.Bq3nU0FH.js} +6 -6
- package/cjs/{fthry_index.BDYAeN41.js → fthry_index.BqS0kCfh.js} +1 -1
- package/cjs/{fthry_index.CH-jUzEB.js → fthry_index.By8RWuUY.js} +6 -6
- package/cjs/{fthry_index.CM61c38_.js → fthry_index.CbfDILWu.js} +4 -4
- package/cjs/{fthry_index.BWlL6Yer.js → fthry_index.CgMWWz7f.js} +1 -1
- package/cjs/{fthry_index.CFas_RaG.js → fthry_index.Ci8dMyBp.js} +1 -1
- package/cjs/fthry_index.CkmA933O.js +669 -0
- package/cjs/{fthry_index.BAjR2Rnl.js → fthry_index.CrFjXWLg.js} +3 -3
- package/cjs/{fthry_index.YHxFZskW.js → fthry_index.CzzIM_Es.js} +1895 -62
- package/cjs/{fthry_index.Cg6LX1gC.js → fthry_index.D4rjZ-iU.js} +4 -4
- package/cjs/{fthry_index.Brf3d6gi.js → fthry_index.DDjTLR_C.js} +6 -6
- package/cjs/{fthry_index.DAUqZ_Ax.js → fthry_index.DLnigFf3.js} +4 -4
- package/cjs/{fthry_index.6mEHhzfW.js → fthry_index.DXm31Dvn.js} +4 -4
- package/cjs/{fthry_index.LJEYPWI3.js → fthry_index.DzpGyyn4.js} +5 -5
- package/cjs/{fthry_index.Dl8vbJjd.js → fthry_index.E_vLB-7s.js} +8 -8
- package/cjs/{fthry_index.stdBLQZf.js → fthry_index.GeYRayLh.js} +1 -1
- package/cjs/{fthry_index.C1fh-rBQ.js → fthry_index.JRP5lBfp.js} +7 -6
- package/cjs/{fthry_index.D347YZZf.js → fthry_index.WDI9ExUl.js} +1 -1
- package/cjs/{fthry_input.Co8r9GsS.js → fthry_input.kxr0lkUP.js} +1 -1
- package/cjs/{fthry_script.Bq4U9W-W.js → fthry_script.CpqGoZRW.js} +1 -1
- package/cjs/{fthry_styles.v2wlusMk.js → fthry_styles.UURZE2St.js} +1 -1
- package/cjs/{fthry_useElementSize.H_jyVKqM.js → fthry_useElementSize.B7mqB2ri.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.PzKJwKNh.js → fthry_useSalesforceSync.DFHAEpBn.js} +1 -1
- package/cjs/{fthry_webfontloader.BEk-u0hO.js → fthry_webfontloader.COsYlNwD.js} +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +1 -1
- package/cjs/types/Form.d.ts +4 -1
- package/cjs/types/Form.d.ts.map +1 -1
- package/cjs/utils/eventQueue.d.ts +26 -0
- package/cjs/utils/eventQueue.d.ts.map +1 -0
- package/cjs/utils/featheryClient/index.d.ts +6 -0
- package/cjs/utils/featheryClient/index.d.ts.map +1 -1
- package/cjs/utils/formHelperFunctions.d.ts +1 -1
- package/cjs/utils/formHelperFunctions.d.ts.map +1 -1
- package/cjs/utils/hideAndRepeats.d.ts.map +1 -1
- package/dist/Form/grid/Element/index.d.ts.map +1 -1
- package/dist/Form/grid/index.d.ts.map +1 -1
- package/dist/Form/index.d.ts.map +1 -1
- package/dist/Form/logic.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/Actions.d.ts +10 -0
- package/dist/elements/basic/TableElement/Actions.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/EmptyState.d.ts +6 -0
- package/dist/elements/basic/TableElement/EmptyState.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/Pagination.d.ts +10 -0
- package/dist/elements/basic/TableElement/Pagination.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/Search.d.ts +7 -0
- package/dist/elements/basic/TableElement/Search.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/Sort.d.ts +12 -0
- package/dist/elements/basic/TableElement/Sort.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/exampleData.d.ts +3 -0
- package/dist/elements/basic/TableElement/exampleData.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/index.d.ts +3 -0
- package/dist/elements/basic/TableElement/index.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/styles.d.ts +391 -0
- package/dist/elements/basic/TableElement/styles.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/types.d.ts +10 -0
- package/dist/elements/basic/TableElement/types.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/useTableData.d.ts +37 -0
- package/dist/elements/basic/TableElement/useTableData.d.ts.map +1 -0
- package/dist/elements/basic/TableElement/utils.d.ts +11 -0
- package/dist/elements/basic/TableElement/utils.d.ts.map +1 -0
- package/dist/elements/components/skeletons/ElementSkeleton.d.ts +8 -0
- package/dist/elements/components/skeletons/ElementSkeleton.d.ts.map +1 -0
- package/dist/elements/fields/AddressLine1Field/index.d.ts.map +1 -1
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.d.ts.map +1 -1
- package/dist/{fthry_FormControl.CrSvLSA7.js → fthry_FormControl.CikgGb3C.js} +1 -1
- package/dist/{fthry_InlineTooltip.xj-t-582.js → fthry_InlineTooltip.BpfxcSEn.js} +2 -2
- package/dist/{fthry_Overlay.CJFSLbLE.js → fthry_Overlay.CJVfag7c.js} +1 -1
- package/dist/{fthry_PaymentMethodField.PRJIHswh.js → fthry_PaymentMethodField.BpA_xhqt.js} +4 -4
- package/dist/{fthry_Placeholder.7M07CwTS.js → fthry_Placeholder.DwCFN6a9.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.n639xEWA.js → fthry_ShowEyeIcon.D6nQhesH.js} +1 -1
- package/dist/{fthry_index.DQhKI62v.js → fthry_index.B-oHlMGi.js} +2 -2
- package/dist/{fthry_index.DsHJmYgu.js → fthry_index.B7VWXvgC.js} +4 -4
- package/dist/{fthry_index.DQuVxHkp.js → fthry_index.B84L3MVC.js} +1 -1
- package/dist/fthry_index.BAhh3Pz6.js +667 -0
- package/dist/{fthry_index.DtttVU-B.js → fthry_index.BEZmvsoo.js} +7 -6
- package/dist/{fthry_index.D6sWBKuA.js → fthry_index.BSEfDQAc.js} +2 -2
- package/dist/{fthry_index.BdbDXIuj.js → fthry_index.BsEfTy-x.js} +8 -8
- package/dist/{fthry_index.sXNItbKY.js → fthry_index.BsNCOSBE.js} +5 -5
- package/dist/{fthry_index.CzHuSmWc.js → fthry_index.Bz07r-AM.js} +1 -1
- package/dist/{fthry_index.DgIPpVNk.js → fthry_index.BzrcCLzO.js} +4 -4
- package/dist/{fthry_index.Df-7wyL2.js → fthry_index.CJKGRCG-.js} +4 -4
- package/dist/{fthry_index.DMTSFPNS.js → fthry_index.D9AKkBzu.js} +1 -1
- package/dist/{fthry_index.DEU7NBKU.js → fthry_index.D9VjMJ_U.js} +1 -1
- package/dist/{fthry_index.Cfn3D1XZ.js → fthry_index.DH2fsNWG.js} +3 -3
- package/dist/{fthry_index.CxH24rcl.js → fthry_index.Dgmpm9wy.js} +6 -6
- package/dist/{fthry_index.g8xB96Yo.js → fthry_index.DhU16s57.js} +5 -5
- package/dist/{fthry_index.Dd5mpmpk.js → fthry_index.DoP7RwIP.js} +1 -1
- package/dist/{fthry_index.BpsK3TYO.js → fthry_index.Dy4nSWZa.js} +1 -1
- package/dist/{fthry_index.Be8xdrui.js → fthry_index.Fs86Fy9Y.js} +5 -5
- package/dist/{fthry_index.RwhYSoEm.js → fthry_index.NOuMR_hq.js} +6 -6
- package/dist/{fthry_index.CwsphGMI.js → fthry_index.OHN-Iv2R.js} +1 -1
- package/dist/{fthry_index.BE1aEx2n.js → fthry_index.m7CZv4YY.js} +4 -4
- package/dist/{fthry_index.BKbx2qxD.js → fthry_index.t4v0qqgv.js} +6 -6
- package/dist/{fthry_index.CdIRvNp8.js → fthry_index.y4j9reIZ.js} +1896 -63
- package/dist/{fthry_input.CD5doOgD.js → fthry_input.Cb2u4VEf.js} +1 -1
- package/dist/{fthry_script.B1ROwso4.js → fthry_script.C5O1ZNQQ.js} +1 -1
- package/dist/{fthry_styles.C-VyrwW3.js → fthry_styles.DGB23xLr.js} +1 -1
- package/dist/{fthry_useElementSize.1FdURPgQ.js → fthry_useElementSize.CBdpS9aW.js} +1 -1
- package/dist/{fthry_useSalesforceSync.wEr6a7_E.js → fthry_useSalesforceSync.Cae_lMG1.js} +1 -1
- package/dist/{fthry_webfontloader.ChgT0Ifr.js → fthry_webfontloader.DAANkO2-.js} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/Form.d.ts +4 -1
- package/dist/types/Form.d.ts.map +1 -1
- package/dist/utils/eventQueue.d.ts +26 -0
- package/dist/utils/eventQueue.d.ts.map +1 -0
- package/dist/utils/featheryClient/index.d.ts +6 -0
- package/dist/utils/featheryClient/index.d.ts.map +1 -1
- package/dist/utils/formHelperFunctions.d.ts +1 -1
- package/dist/utils/formHelperFunctions.d.ts.map +1 -1
- package/dist/utils/hideAndRepeats.d.ts.map +1 -1
- package/package.json +4 -3
- package/umd/{277.94ae8bf6190836d1dceb.js → 277.d9907ecd5dc2117c9171.js} +1 -1
- package/umd/{509.4236d4d76d2fa2ccd971.js → 509.341a4196aad912adb28d.js} +2 -2
- package/umd/{AddressField.3523efd23175117d47a5.js → AddressField.ec97334fe233830bc05b.js} +1 -1
- package/umd/SignatureField.56c69ad7ee1f7e0b5003.js +1 -0
- package/umd/TableElement.ef63774f461682dd3ac9.js +1 -0
- package/umd/index.js +1 -1
- package/cjs/elements/components/skeletons/FieldSkeleton.d.ts +0 -8
- package/cjs/elements/components/skeletons/FieldSkeleton.d.ts.map +0 -1
- package/dist/elements/components/skeletons/FieldSkeleton.d.ts +0 -8
- package/dist/elements/components/skeletons/FieldSkeleton.d.ts.map +0 -1
- package/umd/SignatureField.1b502b1edb19e4af3b64.js +0 -1
- /package/umd/{509.4236d4d76d2fa2ccd971.js.LICENSE.txt → 509.341a4196aad912adb28d.js.LICENSE.txt} +0 -0
|
@@ -655,7 +655,7 @@ function identifier (index) {
|
|
|
655
655
|
* @return {object[]}
|
|
656
656
|
*/
|
|
657
657
|
function compile (value) {
|
|
658
|
-
return dealloc(parse$
|
|
658
|
+
return dealloc(parse$2('', null, null, null, [''], value = alloc(value), 0, [0], value))
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
/**
|
|
@@ -670,7 +670,7 @@ function compile (value) {
|
|
|
670
670
|
* @param {string[]} declarations
|
|
671
671
|
* @return {object}
|
|
672
672
|
*/
|
|
673
|
-
function parse$
|
|
673
|
+
function parse$2 (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
|
674
674
|
var index = 0;
|
|
675
675
|
var offset = 0;
|
|
676
676
|
var length = pseudo;
|
|
@@ -739,15 +739,15 @@ function parse$1 (value, root, parent, rule, rules, rulesets, pseudo, points, de
|
|
|
739
739
|
|
|
740
740
|
if (character === 123)
|
|
741
741
|
if (offset === 0)
|
|
742
|
-
parse$
|
|
742
|
+
parse$2(characters, root, reference, reference, props, rulesets, length, points, children);
|
|
743
743
|
else
|
|
744
744
|
switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
|
|
745
745
|
// d l m s
|
|
746
746
|
case 100: case 108: case 109: case 115:
|
|
747
|
-
parse$
|
|
747
|
+
parse$2(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
|
|
748
748
|
break
|
|
749
749
|
default:
|
|
750
|
-
parse$
|
|
750
|
+
parse$2(characters, reference, reference, reference, [''], children, 0, points, children);
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
753
|
|
|
@@ -16503,7 +16503,8 @@ var stepElementTypes = [
|
|
|
16503
16503
|
'servar_fields',
|
|
16504
16504
|
'progress_bars',
|
|
16505
16505
|
'images',
|
|
16506
|
-
'videos'
|
|
16506
|
+
'videos',
|
|
16507
|
+
'tables'
|
|
16507
16508
|
];
|
|
16508
16509
|
var getPositionKey = function (node) {
|
|
16509
16510
|
if (!node.position)
|
|
@@ -16561,7 +16562,9 @@ function getVisiblePositions(step, internalId) {
|
|
|
16561
16562
|
var typeIndex = elementTypes.indexOf('subgrids');
|
|
16562
16563
|
elementTypes.splice(typeIndex, 1);
|
|
16563
16564
|
elementTypes.forEach(function (elementType) {
|
|
16564
|
-
|
|
16565
|
+
var _a;
|
|
16566
|
+
// TODO (table): remove backwards compatibility
|
|
16567
|
+
(_a = step[elementType]) === null || _a === void 0 ? void 0 : _a.forEach(function (el) {
|
|
16565
16568
|
_collectHideFlags(step, el, visiblePositions, hiddenPositions, repeatKeys, internalId);
|
|
16566
16569
|
});
|
|
16567
16570
|
});
|
|
@@ -20142,7 +20145,7 @@ var Element$1 = function (_a) {
|
|
|
20142
20145
|
var _b, _c, _d, _e, _f, _g;
|
|
20143
20146
|
var el = _a.node, form = _a.form;
|
|
20144
20147
|
var type = el.type;
|
|
20145
|
-
var userProgress = form.userProgress, curDepth = form.curDepth, maxDepth = form.maxDepth, elementProps = form.elementProps, activeStep = form.activeStep, buttonLoaders = form.buttonLoaders, customClickSelectionState = form.customClickSelectionState, runElementActions = form.runElementActions, buttonOnClick = form.buttonOnClick, fieldOnChange = form.fieldOnChange, inlineErrors = form.inlineErrors, setInlineErrors = form.setInlineErrors, changeValue = form.changeValue, updateFieldValues = form.updateFieldValues, elementOnView = form.elementOnView, onViewElements = form.onViewElements, formSettings = form.formSettings, formRef = form.formRef, focusRef = form.focusRef, setCardElement = form.setCardElement, visiblePositions = form.visiblePositions, featheryContext = form.featheryContext;
|
|
20148
|
+
var userProgress = form.userProgress, curDepth = form.curDepth, maxDepth = form.maxDepth, elementProps = form.elementProps, activeStep = form.activeStep, buttonLoaders = form.buttonLoaders, customClickSelectionState = form.customClickSelectionState, runElementActions = form.runElementActions, buttonOnClick = form.buttonOnClick, tableOnClick = form.tableOnClick, fieldOnChange = form.fieldOnChange, inlineErrors = form.inlineErrors, setInlineErrors = form.setInlineErrors, changeValue = form.changeValue, updateFieldValues = form.updateFieldValues, elementOnView = form.elementOnView, onViewElements = form.onViewElements, formSettings = form.formSettings, formRef = form.formRef, focusRef = form.focusRef, setCardElement = form.setCardElement, visiblePositions = form.visiblePositions, featheryContext = form.featheryContext;
|
|
20146
20149
|
var readOnly = formSettings.readOnly || initState.collaboratorReview === 'readOnly';
|
|
20147
20150
|
var basicProps = {
|
|
20148
20151
|
componentOnly: false,
|
|
@@ -20161,6 +20164,8 @@ var Element$1 = function (_a) {
|
|
|
20161
20164
|
return jsx$1(Elements.ImageElement, exports.__assign({}, basicProps));
|
|
20162
20165
|
else if (type === 'video')
|
|
20163
20166
|
return jsx$1(Elements.VideoElement, exports.__assign({}, basicProps));
|
|
20167
|
+
else if (type === 'table')
|
|
20168
|
+
return (jsx$1(Elements.TableElement, exports.__assign({}, basicProps, { onClick: function (payload) { return tableOnClick(el, payload); } })));
|
|
20164
20169
|
else if (type === 'text')
|
|
20165
20170
|
return (jsx$1(Elements.TextElement, exports.__assign({ textSpanOnClick: function (textSpanStart, textSpanEnd) {
|
|
20166
20171
|
var _a;
|
|
@@ -21986,7 +21991,9 @@ var buildStepGrid = function (step, viewport, visiblePositions) {
|
|
|
21986
21991
|
};
|
|
21987
21992
|
var convertStepToViewport = function (step, viewport) {
|
|
21988
21993
|
stepElementTypes.forEach(function (type) {
|
|
21989
|
-
|
|
21994
|
+
// TODO (table): remove backwards compatibility
|
|
21995
|
+
var _a;
|
|
21996
|
+
(_a = step[type]) === null || _a === void 0 ? void 0 : _a.forEach(function (obj, i) {
|
|
21990
21997
|
step[type][i] =
|
|
21991
21998
|
type === 'subgrids'
|
|
21992
21999
|
? convertToViewport(obj, viewport, viewportProperties.subgrids)
|
|
@@ -22019,7 +22026,8 @@ var typeMap = {
|
|
|
22019
22026
|
texts: 'text',
|
|
22020
22027
|
buttons: 'button',
|
|
22021
22028
|
servar_fields: 'field',
|
|
22022
|
-
videos: 'video'
|
|
22029
|
+
videos: 'video',
|
|
22030
|
+
tables: 'table'
|
|
22023
22031
|
};
|
|
22024
22032
|
var buildGridMap = function (step) {
|
|
22025
22033
|
var map = {};
|
|
@@ -35623,10 +35631,1637 @@ Parser.acorn = {
|
|
|
35623
35631
|
//
|
|
35624
35632
|
// [estree]: https://github.com/estree/estree
|
|
35625
35633
|
|
|
35626
|
-
function parse(input, options) {
|
|
35634
|
+
function parse$1(input, options) {
|
|
35627
35635
|
return Parser.parse(input, options)
|
|
35628
35636
|
}
|
|
35629
35637
|
|
|
35638
|
+
var dummyValue = "✖";
|
|
35639
|
+
|
|
35640
|
+
function isDummy(node) { return node.name === dummyValue }
|
|
35641
|
+
|
|
35642
|
+
function noop() {}
|
|
35643
|
+
|
|
35644
|
+
var LooseParser = function LooseParser(input, options) {
|
|
35645
|
+
if ( options === void 0 ) options = {};
|
|
35646
|
+
|
|
35647
|
+
this.toks = this.constructor.BaseParser.tokenizer(input, options);
|
|
35648
|
+
this.options = this.toks.options;
|
|
35649
|
+
this.input = this.toks.input;
|
|
35650
|
+
this.tok = this.last = {type: types$1.eof, start: 0, end: 0};
|
|
35651
|
+
this.tok.validateRegExpFlags = noop;
|
|
35652
|
+
this.tok.validateRegExpPattern = noop;
|
|
35653
|
+
if (this.options.locations) {
|
|
35654
|
+
var here = this.toks.curPosition();
|
|
35655
|
+
this.tok.loc = new SourceLocation(this.toks, here, here);
|
|
35656
|
+
}
|
|
35657
|
+
this.ahead = []; // Tokens ahead
|
|
35658
|
+
this.context = []; // Indentation contexted
|
|
35659
|
+
this.curIndent = 0;
|
|
35660
|
+
this.curLineStart = 0;
|
|
35661
|
+
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
|
|
35662
|
+
this.inAsync = false;
|
|
35663
|
+
this.inGenerator = false;
|
|
35664
|
+
this.inFunction = false;
|
|
35665
|
+
};
|
|
35666
|
+
|
|
35667
|
+
LooseParser.prototype.startNode = function startNode () {
|
|
35668
|
+
return new Node(this.toks, this.tok.start, this.options.locations ? this.tok.loc.start : null)
|
|
35669
|
+
};
|
|
35670
|
+
|
|
35671
|
+
LooseParser.prototype.storeCurrentPos = function storeCurrentPos () {
|
|
35672
|
+
return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start
|
|
35673
|
+
};
|
|
35674
|
+
|
|
35675
|
+
LooseParser.prototype.startNodeAt = function startNodeAt (pos) {
|
|
35676
|
+
if (this.options.locations) {
|
|
35677
|
+
return new Node(this.toks, pos[0], pos[1])
|
|
35678
|
+
} else {
|
|
35679
|
+
return new Node(this.toks, pos)
|
|
35680
|
+
}
|
|
35681
|
+
};
|
|
35682
|
+
|
|
35683
|
+
LooseParser.prototype.finishNode = function finishNode (node, type) {
|
|
35684
|
+
node.type = type;
|
|
35685
|
+
node.end = this.last.end;
|
|
35686
|
+
if (this.options.locations)
|
|
35687
|
+
{ node.loc.end = this.last.loc.end; }
|
|
35688
|
+
if (this.options.ranges)
|
|
35689
|
+
{ node.range[1] = this.last.end; }
|
|
35690
|
+
return node
|
|
35691
|
+
};
|
|
35692
|
+
|
|
35693
|
+
LooseParser.prototype.dummyNode = function dummyNode (type) {
|
|
35694
|
+
var dummy = this.startNode();
|
|
35695
|
+
dummy.type = type;
|
|
35696
|
+
dummy.end = dummy.start;
|
|
35697
|
+
if (this.options.locations)
|
|
35698
|
+
{ dummy.loc.end = dummy.loc.start; }
|
|
35699
|
+
if (this.options.ranges)
|
|
35700
|
+
{ dummy.range[1] = dummy.start; }
|
|
35701
|
+
this.last = {type: types$1.name, start: dummy.start, end: dummy.start, loc: dummy.loc};
|
|
35702
|
+
return dummy
|
|
35703
|
+
};
|
|
35704
|
+
|
|
35705
|
+
LooseParser.prototype.dummyIdent = function dummyIdent () {
|
|
35706
|
+
var dummy = this.dummyNode("Identifier");
|
|
35707
|
+
dummy.name = dummyValue;
|
|
35708
|
+
return dummy
|
|
35709
|
+
};
|
|
35710
|
+
|
|
35711
|
+
LooseParser.prototype.dummyString = function dummyString () {
|
|
35712
|
+
var dummy = this.dummyNode("Literal");
|
|
35713
|
+
dummy.value = dummy.raw = dummyValue;
|
|
35714
|
+
return dummy
|
|
35715
|
+
};
|
|
35716
|
+
|
|
35717
|
+
LooseParser.prototype.eat = function eat (type) {
|
|
35718
|
+
if (this.tok.type === type) {
|
|
35719
|
+
this.next();
|
|
35720
|
+
return true
|
|
35721
|
+
} else {
|
|
35722
|
+
return false
|
|
35723
|
+
}
|
|
35724
|
+
};
|
|
35725
|
+
|
|
35726
|
+
LooseParser.prototype.isContextual = function isContextual (name) {
|
|
35727
|
+
return this.tok.type === types$1.name && this.tok.value === name
|
|
35728
|
+
};
|
|
35729
|
+
|
|
35730
|
+
LooseParser.prototype.eatContextual = function eatContextual (name) {
|
|
35731
|
+
return this.tok.value === name && this.eat(types$1.name)
|
|
35732
|
+
};
|
|
35733
|
+
|
|
35734
|
+
LooseParser.prototype.canInsertSemicolon = function canInsertSemicolon () {
|
|
35735
|
+
return this.tok.type === types$1.eof || this.tok.type === types$1.braceR ||
|
|
35736
|
+
lineBreak.test(this.input.slice(this.last.end, this.tok.start))
|
|
35737
|
+
};
|
|
35738
|
+
|
|
35739
|
+
LooseParser.prototype.semicolon = function semicolon () {
|
|
35740
|
+
return this.eat(types$1.semi)
|
|
35741
|
+
};
|
|
35742
|
+
|
|
35743
|
+
LooseParser.prototype.expect = function expect (type) {
|
|
35744
|
+
if (this.eat(type)) { return true }
|
|
35745
|
+
for (var i = 1; i <= 2; i++) {
|
|
35746
|
+
if (this.lookAhead(i).type === type) {
|
|
35747
|
+
for (var j = 0; j < i; j++) { this.next(); }
|
|
35748
|
+
return true
|
|
35749
|
+
}
|
|
35750
|
+
}
|
|
35751
|
+
};
|
|
35752
|
+
|
|
35753
|
+
LooseParser.prototype.pushCx = function pushCx () {
|
|
35754
|
+
this.context.push(this.curIndent);
|
|
35755
|
+
};
|
|
35756
|
+
|
|
35757
|
+
LooseParser.prototype.popCx = function popCx () {
|
|
35758
|
+
this.curIndent = this.context.pop();
|
|
35759
|
+
};
|
|
35760
|
+
|
|
35761
|
+
LooseParser.prototype.lineEnd = function lineEnd (pos) {
|
|
35762
|
+
while (pos < this.input.length && !isNewLine(this.input.charCodeAt(pos))) { ++pos; }
|
|
35763
|
+
return pos
|
|
35764
|
+
};
|
|
35765
|
+
|
|
35766
|
+
LooseParser.prototype.indentationAfter = function indentationAfter (pos) {
|
|
35767
|
+
for (var count = 0;; ++pos) {
|
|
35768
|
+
var ch = this.input.charCodeAt(pos);
|
|
35769
|
+
if (ch === 32) { ++count; }
|
|
35770
|
+
else if (ch === 9) { count += this.options.tabSize; }
|
|
35771
|
+
else { return count }
|
|
35772
|
+
}
|
|
35773
|
+
};
|
|
35774
|
+
|
|
35775
|
+
LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) {
|
|
35776
|
+
if (this.tok.type === closeTok || this.tok.type === types$1.eof) { return true }
|
|
35777
|
+
return line !== this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
|
|
35778
|
+
(!blockHeuristic || this.nextLineStart >= this.input.length ||
|
|
35779
|
+
this.indentationAfter(this.nextLineStart) < indent)
|
|
35780
|
+
};
|
|
35781
|
+
|
|
35782
|
+
LooseParser.prototype.tokenStartsLine = function tokenStartsLine () {
|
|
35783
|
+
for (var p = this.tok.start - 1; p >= this.curLineStart; --p) {
|
|
35784
|
+
var ch = this.input.charCodeAt(p);
|
|
35785
|
+
if (ch !== 9 && ch !== 32) { return false }
|
|
35786
|
+
}
|
|
35787
|
+
return true
|
|
35788
|
+
};
|
|
35789
|
+
|
|
35790
|
+
LooseParser.prototype.extend = function extend (name, f) {
|
|
35791
|
+
this[name] = f(this[name]);
|
|
35792
|
+
};
|
|
35793
|
+
|
|
35794
|
+
LooseParser.prototype.parse = function parse () {
|
|
35795
|
+
this.next();
|
|
35796
|
+
return this.parseTopLevel()
|
|
35797
|
+
};
|
|
35798
|
+
|
|
35799
|
+
LooseParser.extend = function extend () {
|
|
35800
|
+
var plugins = [], len = arguments.length;
|
|
35801
|
+
while ( len-- ) plugins[ len ] = arguments[ len ];
|
|
35802
|
+
|
|
35803
|
+
var cls = this;
|
|
35804
|
+
for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }
|
|
35805
|
+
return cls
|
|
35806
|
+
};
|
|
35807
|
+
|
|
35808
|
+
LooseParser.parse = function parse (input, options) {
|
|
35809
|
+
return new this(input, options).parse()
|
|
35810
|
+
};
|
|
35811
|
+
|
|
35812
|
+
// Allows plugins to extend the base parser / tokenizer used
|
|
35813
|
+
LooseParser.BaseParser = Parser;
|
|
35814
|
+
|
|
35815
|
+
var lp$2 = LooseParser.prototype;
|
|
35816
|
+
|
|
35817
|
+
function isSpace(ch) {
|
|
35818
|
+
return (ch < 14 && ch > 8) || ch === 32 || ch === 160 || isNewLine(ch)
|
|
35819
|
+
}
|
|
35820
|
+
|
|
35821
|
+
lp$2.next = function() {
|
|
35822
|
+
this.last = this.tok;
|
|
35823
|
+
if (this.ahead.length)
|
|
35824
|
+
{ this.tok = this.ahead.shift(); }
|
|
35825
|
+
else
|
|
35826
|
+
{ this.tok = this.readToken(); }
|
|
35827
|
+
|
|
35828
|
+
if (this.tok.start >= this.nextLineStart) {
|
|
35829
|
+
while (this.tok.start >= this.nextLineStart) {
|
|
35830
|
+
this.curLineStart = this.nextLineStart;
|
|
35831
|
+
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
|
|
35832
|
+
}
|
|
35833
|
+
this.curIndent = this.indentationAfter(this.curLineStart);
|
|
35834
|
+
}
|
|
35835
|
+
};
|
|
35836
|
+
|
|
35837
|
+
lp$2.readToken = function() {
|
|
35838
|
+
for (;;) {
|
|
35839
|
+
try {
|
|
35840
|
+
this.toks.next();
|
|
35841
|
+
if (this.toks.type === types$1.dot &&
|
|
35842
|
+
this.input.substr(this.toks.end, 1) === "." &&
|
|
35843
|
+
this.options.ecmaVersion >= 6) {
|
|
35844
|
+
this.toks.end++;
|
|
35845
|
+
this.toks.type = types$1.ellipsis;
|
|
35846
|
+
}
|
|
35847
|
+
return new Token(this.toks)
|
|
35848
|
+
} catch (e) {
|
|
35849
|
+
if (!(e instanceof SyntaxError)) { throw e }
|
|
35850
|
+
|
|
35851
|
+
// Try to skip some text, based on the error message, and then continue
|
|
35852
|
+
var msg = e.message, pos = e.raisedAt, replace = true;
|
|
35853
|
+
if (/unterminated/i.test(msg)) {
|
|
35854
|
+
pos = this.lineEnd(e.pos + 1);
|
|
35855
|
+
if (/string/.test(msg)) {
|
|
35856
|
+
replace = {start: e.pos, end: pos, type: types$1.string, value: this.input.slice(e.pos + 1, pos)};
|
|
35857
|
+
} else if (/regular expr/i.test(msg)) {
|
|
35858
|
+
var re = this.input.slice(e.pos, pos);
|
|
35859
|
+
try { re = new RegExp(re); } catch (e$1) { /* ignore compilation error due to new syntax */ }
|
|
35860
|
+
replace = {start: e.pos, end: pos, type: types$1.regexp, value: re};
|
|
35861
|
+
} else if (/template/.test(msg)) {
|
|
35862
|
+
replace = {
|
|
35863
|
+
start: e.pos,
|
|
35864
|
+
end: pos,
|
|
35865
|
+
type: types$1.template,
|
|
35866
|
+
value: this.input.slice(e.pos, pos)
|
|
35867
|
+
};
|
|
35868
|
+
} else {
|
|
35869
|
+
replace = false;
|
|
35870
|
+
}
|
|
35871
|
+
} else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix|numeric separator/i.test(msg)) {
|
|
35872
|
+
while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) { ++pos; }
|
|
35873
|
+
} else if (/character escape|expected hexadecimal/i.test(msg)) {
|
|
35874
|
+
while (pos < this.input.length) {
|
|
35875
|
+
var ch = this.input.charCodeAt(pos++);
|
|
35876
|
+
if (ch === 34 || ch === 39 || isNewLine(ch)) { break }
|
|
35877
|
+
}
|
|
35878
|
+
} else if (/unexpected character/i.test(msg)) {
|
|
35879
|
+
pos++;
|
|
35880
|
+
replace = false;
|
|
35881
|
+
} else if (/regular expression/i.test(msg)) {
|
|
35882
|
+
replace = true;
|
|
35883
|
+
} else {
|
|
35884
|
+
throw e
|
|
35885
|
+
}
|
|
35886
|
+
this.resetTo(pos);
|
|
35887
|
+
if (replace === true) { replace = {start: pos, end: pos, type: types$1.name, value: dummyValue}; }
|
|
35888
|
+
if (replace) {
|
|
35889
|
+
if (this.options.locations)
|
|
35890
|
+
{ replace.loc = new SourceLocation(
|
|
35891
|
+
this.toks,
|
|
35892
|
+
getLineInfo(this.input, replace.start),
|
|
35893
|
+
getLineInfo(this.input, replace.end)); }
|
|
35894
|
+
return replace
|
|
35895
|
+
}
|
|
35896
|
+
}
|
|
35897
|
+
}
|
|
35898
|
+
};
|
|
35899
|
+
|
|
35900
|
+
lp$2.resetTo = function(pos) {
|
|
35901
|
+
this.toks.pos = pos;
|
|
35902
|
+
this.toks.containsEsc = false;
|
|
35903
|
+
var ch = this.input.charAt(pos - 1);
|
|
35904
|
+
this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) ||
|
|
35905
|
+
/[enwfd]/.test(ch) &&
|
|
35906
|
+
/\b(case|else|return|throw|new|in|(instance|type)?of|delete|void)$/.test(this.input.slice(pos - 10, pos));
|
|
35907
|
+
|
|
35908
|
+
if (this.options.locations) {
|
|
35909
|
+
this.toks.curLine = 1;
|
|
35910
|
+
this.toks.lineStart = lineBreakG.lastIndex = 0;
|
|
35911
|
+
var match;
|
|
35912
|
+
while ((match = lineBreakG.exec(this.input)) && match.index < pos) {
|
|
35913
|
+
++this.toks.curLine;
|
|
35914
|
+
this.toks.lineStart = match.index + match[0].length;
|
|
35915
|
+
}
|
|
35916
|
+
}
|
|
35917
|
+
};
|
|
35918
|
+
|
|
35919
|
+
lp$2.lookAhead = function(n) {
|
|
35920
|
+
while (n > this.ahead.length)
|
|
35921
|
+
{ this.ahead.push(this.readToken()); }
|
|
35922
|
+
return this.ahead[n - 1]
|
|
35923
|
+
};
|
|
35924
|
+
|
|
35925
|
+
var lp$1 = LooseParser.prototype;
|
|
35926
|
+
|
|
35927
|
+
lp$1.parseTopLevel = function() {
|
|
35928
|
+
var node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0);
|
|
35929
|
+
node.body = [];
|
|
35930
|
+
while (this.tok.type !== types$1.eof) { node.body.push(this.parseStatement()); }
|
|
35931
|
+
this.toks.adaptDirectivePrologue(node.body);
|
|
35932
|
+
this.last = this.tok;
|
|
35933
|
+
node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType;
|
|
35934
|
+
return this.finishNode(node, "Program")
|
|
35935
|
+
};
|
|
35936
|
+
|
|
35937
|
+
lp$1.parseStatement = function() {
|
|
35938
|
+
var starttype = this.tok.type, node = this.startNode(), kind;
|
|
35939
|
+
|
|
35940
|
+
if (this.toks.isLet()) {
|
|
35941
|
+
starttype = types$1._var;
|
|
35942
|
+
kind = "let";
|
|
35943
|
+
}
|
|
35944
|
+
|
|
35945
|
+
switch (starttype) {
|
|
35946
|
+
case types$1._break: case types$1._continue:
|
|
35947
|
+
this.next();
|
|
35948
|
+
var isBreak = starttype === types$1._break;
|
|
35949
|
+
if (this.semicolon() || this.canInsertSemicolon()) {
|
|
35950
|
+
node.label = null;
|
|
35951
|
+
} else {
|
|
35952
|
+
node.label = this.tok.type === types$1.name ? this.parseIdent() : null;
|
|
35953
|
+
this.semicolon();
|
|
35954
|
+
}
|
|
35955
|
+
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
35956
|
+
|
|
35957
|
+
case types$1._debugger:
|
|
35958
|
+
this.next();
|
|
35959
|
+
this.semicolon();
|
|
35960
|
+
return this.finishNode(node, "DebuggerStatement")
|
|
35961
|
+
|
|
35962
|
+
case types$1._do:
|
|
35963
|
+
this.next();
|
|
35964
|
+
node.body = this.parseStatement();
|
|
35965
|
+
node.test = this.eat(types$1._while) ? this.parseParenExpression() : this.dummyIdent();
|
|
35966
|
+
this.semicolon();
|
|
35967
|
+
return this.finishNode(node, "DoWhileStatement")
|
|
35968
|
+
|
|
35969
|
+
case types$1._for:
|
|
35970
|
+
this.next(); // `for` keyword
|
|
35971
|
+
var isAwait = this.options.ecmaVersion >= 9 && this.eatContextual("await");
|
|
35972
|
+
|
|
35973
|
+
this.pushCx();
|
|
35974
|
+
this.expect(types$1.parenL);
|
|
35975
|
+
if (this.tok.type === types$1.semi) { return this.parseFor(node, null) }
|
|
35976
|
+
var isLet = this.toks.isLet();
|
|
35977
|
+
var isAwaitUsing = this.toks.isAwaitUsing(true);
|
|
35978
|
+
var isUsing = !isAwaitUsing && this.toks.isUsing(true);
|
|
35979
|
+
|
|
35980
|
+
if (isLet || this.tok.type === types$1._var || this.tok.type === types$1._const || isUsing || isAwaitUsing) {
|
|
35981
|
+
var kind$1 = isLet ? "let" : isUsing ? "using" : isAwaitUsing ? "await using" : this.tok.value;
|
|
35982
|
+
var init$1 = this.startNode();
|
|
35983
|
+
if (isUsing || isAwaitUsing) {
|
|
35984
|
+
if (isAwaitUsing) { this.next(); }
|
|
35985
|
+
this.parseVar(init$1, true, kind$1);
|
|
35986
|
+
} else {
|
|
35987
|
+
init$1 = this.parseVar(init$1, true, kind$1);
|
|
35988
|
+
}
|
|
35989
|
+
|
|
35990
|
+
if (init$1.declarations.length === 1 && (this.tok.type === types$1._in || this.isContextual("of"))) {
|
|
35991
|
+
if (this.options.ecmaVersion >= 9 && this.tok.type !== types$1._in) {
|
|
35992
|
+
node.await = isAwait;
|
|
35993
|
+
}
|
|
35994
|
+
return this.parseForIn(node, init$1)
|
|
35995
|
+
}
|
|
35996
|
+
return this.parseFor(node, init$1)
|
|
35997
|
+
}
|
|
35998
|
+
var init = this.parseExpression(true);
|
|
35999
|
+
if (this.tok.type === types$1._in || this.isContextual("of")) {
|
|
36000
|
+
if (this.options.ecmaVersion >= 9 && this.tok.type !== types$1._in) {
|
|
36001
|
+
node.await = isAwait;
|
|
36002
|
+
}
|
|
36003
|
+
return this.parseForIn(node, this.toAssignable(init))
|
|
36004
|
+
}
|
|
36005
|
+
return this.parseFor(node, init)
|
|
36006
|
+
|
|
36007
|
+
case types$1._function:
|
|
36008
|
+
this.next();
|
|
36009
|
+
return this.parseFunction(node, true)
|
|
36010
|
+
|
|
36011
|
+
case types$1._if:
|
|
36012
|
+
this.next();
|
|
36013
|
+
node.test = this.parseParenExpression();
|
|
36014
|
+
node.consequent = this.parseStatement();
|
|
36015
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement() : null;
|
|
36016
|
+
return this.finishNode(node, "IfStatement")
|
|
36017
|
+
|
|
36018
|
+
case types$1._return:
|
|
36019
|
+
this.next();
|
|
36020
|
+
if (this.eat(types$1.semi) || this.canInsertSemicolon()) { node.argument = null; }
|
|
36021
|
+
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
36022
|
+
return this.finishNode(node, "ReturnStatement")
|
|
36023
|
+
|
|
36024
|
+
case types$1._switch:
|
|
36025
|
+
var blockIndent = this.curIndent, line = this.curLineStart;
|
|
36026
|
+
this.next();
|
|
36027
|
+
node.discriminant = this.parseParenExpression();
|
|
36028
|
+
node.cases = [];
|
|
36029
|
+
this.pushCx();
|
|
36030
|
+
this.expect(types$1.braceL);
|
|
36031
|
+
|
|
36032
|
+
var cur;
|
|
36033
|
+
while (!this.closes(types$1.braceR, blockIndent, line, true)) {
|
|
36034
|
+
if (this.tok.type === types$1._case || this.tok.type === types$1._default) {
|
|
36035
|
+
var isCase = this.tok.type === types$1._case;
|
|
36036
|
+
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
36037
|
+
node.cases.push(cur = this.startNode());
|
|
36038
|
+
cur.consequent = [];
|
|
36039
|
+
this.next();
|
|
36040
|
+
if (isCase) { cur.test = this.parseExpression(); }
|
|
36041
|
+
else { cur.test = null; }
|
|
36042
|
+
this.expect(types$1.colon);
|
|
36043
|
+
} else {
|
|
36044
|
+
if (!cur) {
|
|
36045
|
+
node.cases.push(cur = this.startNode());
|
|
36046
|
+
cur.consequent = [];
|
|
36047
|
+
cur.test = null;
|
|
36048
|
+
}
|
|
36049
|
+
cur.consequent.push(this.parseStatement());
|
|
36050
|
+
}
|
|
36051
|
+
}
|
|
36052
|
+
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
36053
|
+
this.popCx();
|
|
36054
|
+
this.eat(types$1.braceR);
|
|
36055
|
+
return this.finishNode(node, "SwitchStatement")
|
|
36056
|
+
|
|
36057
|
+
case types$1._throw:
|
|
36058
|
+
this.next();
|
|
36059
|
+
node.argument = this.parseExpression();
|
|
36060
|
+
this.semicolon();
|
|
36061
|
+
return this.finishNode(node, "ThrowStatement")
|
|
36062
|
+
|
|
36063
|
+
case types$1._try:
|
|
36064
|
+
this.next();
|
|
36065
|
+
node.block = this.parseBlock();
|
|
36066
|
+
node.handler = null;
|
|
36067
|
+
if (this.tok.type === types$1._catch) {
|
|
36068
|
+
var clause = this.startNode();
|
|
36069
|
+
this.next();
|
|
36070
|
+
if (this.eat(types$1.parenL)) {
|
|
36071
|
+
clause.param = this.toAssignable(this.parseExprAtom(), true);
|
|
36072
|
+
this.expect(types$1.parenR);
|
|
36073
|
+
} else {
|
|
36074
|
+
clause.param = null;
|
|
36075
|
+
}
|
|
36076
|
+
clause.body = this.parseBlock();
|
|
36077
|
+
node.handler = this.finishNode(clause, "CatchClause");
|
|
36078
|
+
}
|
|
36079
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
36080
|
+
if (!node.handler && !node.finalizer) { return node.block }
|
|
36081
|
+
return this.finishNode(node, "TryStatement")
|
|
36082
|
+
|
|
36083
|
+
case types$1._var:
|
|
36084
|
+
case types$1._const:
|
|
36085
|
+
return this.parseVar(node, false, kind || this.tok.value)
|
|
36086
|
+
|
|
36087
|
+
case types$1._while:
|
|
36088
|
+
this.next();
|
|
36089
|
+
node.test = this.parseParenExpression();
|
|
36090
|
+
node.body = this.parseStatement();
|
|
36091
|
+
return this.finishNode(node, "WhileStatement")
|
|
36092
|
+
|
|
36093
|
+
case types$1._with:
|
|
36094
|
+
this.next();
|
|
36095
|
+
node.object = this.parseParenExpression();
|
|
36096
|
+
node.body = this.parseStatement();
|
|
36097
|
+
return this.finishNode(node, "WithStatement")
|
|
36098
|
+
|
|
36099
|
+
case types$1.braceL:
|
|
36100
|
+
return this.parseBlock()
|
|
36101
|
+
|
|
36102
|
+
case types$1.semi:
|
|
36103
|
+
this.next();
|
|
36104
|
+
return this.finishNode(node, "EmptyStatement")
|
|
36105
|
+
|
|
36106
|
+
case types$1._class:
|
|
36107
|
+
return this.parseClass(true)
|
|
36108
|
+
|
|
36109
|
+
case types$1._import:
|
|
36110
|
+
if (this.options.ecmaVersion > 10) {
|
|
36111
|
+
var nextType = this.lookAhead(1).type;
|
|
36112
|
+
if (nextType === types$1.parenL || nextType === types$1.dot) {
|
|
36113
|
+
node.expression = this.parseExpression();
|
|
36114
|
+
this.semicolon();
|
|
36115
|
+
return this.finishNode(node, "ExpressionStatement")
|
|
36116
|
+
}
|
|
36117
|
+
}
|
|
36118
|
+
|
|
36119
|
+
return this.parseImport()
|
|
36120
|
+
|
|
36121
|
+
case types$1._export:
|
|
36122
|
+
return this.parseExport()
|
|
36123
|
+
|
|
36124
|
+
default:
|
|
36125
|
+
if (this.toks.isAsyncFunction()) {
|
|
36126
|
+
this.next();
|
|
36127
|
+
this.next();
|
|
36128
|
+
return this.parseFunction(node, true, true)
|
|
36129
|
+
}
|
|
36130
|
+
|
|
36131
|
+
if (this.toks.isUsing(false)) {
|
|
36132
|
+
return this.parseVar(node, false, "using")
|
|
36133
|
+
}
|
|
36134
|
+
|
|
36135
|
+
if (this.toks.isAwaitUsing(false)) {
|
|
36136
|
+
this.next();
|
|
36137
|
+
return this.parseVar(node, false, "await using")
|
|
36138
|
+
}
|
|
36139
|
+
|
|
36140
|
+
var expr = this.parseExpression();
|
|
36141
|
+
if (isDummy(expr)) {
|
|
36142
|
+
this.next();
|
|
36143
|
+
if (this.tok.type === types$1.eof) { return this.finishNode(node, "EmptyStatement") }
|
|
36144
|
+
return this.parseStatement()
|
|
36145
|
+
} else if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) {
|
|
36146
|
+
node.body = this.parseStatement();
|
|
36147
|
+
node.label = expr;
|
|
36148
|
+
return this.finishNode(node, "LabeledStatement")
|
|
36149
|
+
} else {
|
|
36150
|
+
node.expression = expr;
|
|
36151
|
+
this.semicolon();
|
|
36152
|
+
return this.finishNode(node, "ExpressionStatement")
|
|
36153
|
+
}
|
|
36154
|
+
}
|
|
36155
|
+
};
|
|
36156
|
+
|
|
36157
|
+
lp$1.parseBlock = function() {
|
|
36158
|
+
var node = this.startNode();
|
|
36159
|
+
this.pushCx();
|
|
36160
|
+
this.expect(types$1.braceL);
|
|
36161
|
+
var blockIndent = this.curIndent, line = this.curLineStart;
|
|
36162
|
+
node.body = [];
|
|
36163
|
+
while (!this.closes(types$1.braceR, blockIndent, line, true))
|
|
36164
|
+
{ node.body.push(this.parseStatement()); }
|
|
36165
|
+
this.popCx();
|
|
36166
|
+
this.eat(types$1.braceR);
|
|
36167
|
+
return this.finishNode(node, "BlockStatement")
|
|
36168
|
+
};
|
|
36169
|
+
|
|
36170
|
+
lp$1.parseFor = function(node, init) {
|
|
36171
|
+
node.init = init;
|
|
36172
|
+
node.test = node.update = null;
|
|
36173
|
+
if (this.eat(types$1.semi) && this.tok.type !== types$1.semi) { node.test = this.parseExpression(); }
|
|
36174
|
+
if (this.eat(types$1.semi) && this.tok.type !== types$1.parenR) { node.update = this.parseExpression(); }
|
|
36175
|
+
this.popCx();
|
|
36176
|
+
this.expect(types$1.parenR);
|
|
36177
|
+
node.body = this.parseStatement();
|
|
36178
|
+
return this.finishNode(node, "ForStatement")
|
|
36179
|
+
};
|
|
36180
|
+
|
|
36181
|
+
lp$1.parseForIn = function(node, init) {
|
|
36182
|
+
var type = this.tok.type === types$1._in ? "ForInStatement" : "ForOfStatement";
|
|
36183
|
+
this.next();
|
|
36184
|
+
node.left = init;
|
|
36185
|
+
node.right = this.parseExpression();
|
|
36186
|
+
this.popCx();
|
|
36187
|
+
this.expect(types$1.parenR);
|
|
36188
|
+
node.body = this.parseStatement();
|
|
36189
|
+
return this.finishNode(node, type)
|
|
36190
|
+
};
|
|
36191
|
+
|
|
36192
|
+
lp$1.parseVar = function(node, noIn, kind) {
|
|
36193
|
+
node.kind = kind;
|
|
36194
|
+
this.next();
|
|
36195
|
+
node.declarations = [];
|
|
36196
|
+
do {
|
|
36197
|
+
var decl = this.startNode();
|
|
36198
|
+
decl.id = this.options.ecmaVersion >= 6 ? this.toAssignable(this.parseExprAtom(), true) : this.parseIdent();
|
|
36199
|
+
decl.init = this.eat(types$1.eq) ? this.parseMaybeAssign(noIn) : null;
|
|
36200
|
+
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
36201
|
+
} while (this.eat(types$1.comma))
|
|
36202
|
+
if (!node.declarations.length) {
|
|
36203
|
+
var decl$1 = this.startNode();
|
|
36204
|
+
decl$1.id = this.dummyIdent();
|
|
36205
|
+
node.declarations.push(this.finishNode(decl$1, "VariableDeclarator"));
|
|
36206
|
+
}
|
|
36207
|
+
if (!noIn) { this.semicolon(); }
|
|
36208
|
+
return this.finishNode(node, "VariableDeclaration")
|
|
36209
|
+
};
|
|
36210
|
+
|
|
36211
|
+
lp$1.parseClass = function(isStatement) {
|
|
36212
|
+
var node = this.startNode();
|
|
36213
|
+
this.next();
|
|
36214
|
+
if (this.tok.type === types$1.name) { node.id = this.parseIdent(); }
|
|
36215
|
+
else if (isStatement === true) { node.id = this.dummyIdent(); }
|
|
36216
|
+
else { node.id = null; }
|
|
36217
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExpression() : null;
|
|
36218
|
+
node.body = this.startNode();
|
|
36219
|
+
node.body.body = [];
|
|
36220
|
+
this.pushCx();
|
|
36221
|
+
var indent = this.curIndent + 1, line = this.curLineStart;
|
|
36222
|
+
this.eat(types$1.braceL);
|
|
36223
|
+
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; }
|
|
36224
|
+
while (!this.closes(types$1.braceR, indent, line)) {
|
|
36225
|
+
var element = this.parseClassElement();
|
|
36226
|
+
if (element) { node.body.body.push(element); }
|
|
36227
|
+
}
|
|
36228
|
+
this.popCx();
|
|
36229
|
+
if (!this.eat(types$1.braceR)) {
|
|
36230
|
+
// If there is no closing brace, make the node span to the start
|
|
36231
|
+
// of the next token (this is useful for Tern)
|
|
36232
|
+
this.last.end = this.tok.start;
|
|
36233
|
+
if (this.options.locations) { this.last.loc.end = this.tok.loc.start; }
|
|
36234
|
+
}
|
|
36235
|
+
this.semicolon();
|
|
36236
|
+
this.finishNode(node.body, "ClassBody");
|
|
36237
|
+
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
36238
|
+
};
|
|
36239
|
+
|
|
36240
|
+
lp$1.parseClassElement = function() {
|
|
36241
|
+
if (this.eat(types$1.semi)) { return null }
|
|
36242
|
+
|
|
36243
|
+
var ref = this.options;
|
|
36244
|
+
var ecmaVersion = ref.ecmaVersion;
|
|
36245
|
+
var locations = ref.locations;
|
|
36246
|
+
var indent = this.curIndent;
|
|
36247
|
+
var line = this.curLineStart;
|
|
36248
|
+
var node = this.startNode();
|
|
36249
|
+
var keyName = "";
|
|
36250
|
+
var isGenerator = false;
|
|
36251
|
+
var isAsync = false;
|
|
36252
|
+
var kind = "method";
|
|
36253
|
+
var isStatic = false;
|
|
36254
|
+
|
|
36255
|
+
if (this.eatContextual("static")) {
|
|
36256
|
+
// Parse static init block
|
|
36257
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
36258
|
+
this.parseClassStaticBlock(node);
|
|
36259
|
+
return node
|
|
36260
|
+
}
|
|
36261
|
+
if (this.isClassElementNameStart() || this.toks.type === types$1.star) {
|
|
36262
|
+
isStatic = true;
|
|
36263
|
+
} else {
|
|
36264
|
+
keyName = "static";
|
|
36265
|
+
}
|
|
36266
|
+
}
|
|
36267
|
+
node.static = isStatic;
|
|
36268
|
+
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
36269
|
+
if ((this.isClassElementNameStart() || this.toks.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
36270
|
+
isAsync = true;
|
|
36271
|
+
} else {
|
|
36272
|
+
keyName = "async";
|
|
36273
|
+
}
|
|
36274
|
+
}
|
|
36275
|
+
if (!keyName) {
|
|
36276
|
+
isGenerator = this.eat(types$1.star);
|
|
36277
|
+
var lastValue = this.toks.value;
|
|
36278
|
+
if (this.eatContextual("get") || this.eatContextual("set")) {
|
|
36279
|
+
if (this.isClassElementNameStart()) {
|
|
36280
|
+
kind = lastValue;
|
|
36281
|
+
} else {
|
|
36282
|
+
keyName = lastValue;
|
|
36283
|
+
}
|
|
36284
|
+
}
|
|
36285
|
+
}
|
|
36286
|
+
|
|
36287
|
+
// Parse element name
|
|
36288
|
+
if (keyName) {
|
|
36289
|
+
// 'async', 'get', 'set', or 'static' were not a keyword contextually.
|
|
36290
|
+
// The last token is any of those. Make it the element name.
|
|
36291
|
+
node.computed = false;
|
|
36292
|
+
node.key = this.startNodeAt(locations ? [this.toks.lastTokStart, this.toks.lastTokStartLoc] : this.toks.lastTokStart);
|
|
36293
|
+
node.key.name = keyName;
|
|
36294
|
+
this.finishNode(node.key, "Identifier");
|
|
36295
|
+
} else {
|
|
36296
|
+
this.parseClassElementName(node);
|
|
36297
|
+
|
|
36298
|
+
// From https://github.com/acornjs/acorn/blob/7deba41118d6384a2c498c61176b3cf434f69590/acorn-loose/src/statement.js#L291
|
|
36299
|
+
// Skip broken stuff.
|
|
36300
|
+
if (isDummy(node.key)) {
|
|
36301
|
+
if (isDummy(this.parseMaybeAssign())) { this.next(); }
|
|
36302
|
+
this.eat(types$1.comma);
|
|
36303
|
+
return null
|
|
36304
|
+
}
|
|
36305
|
+
}
|
|
36306
|
+
|
|
36307
|
+
// Parse element value
|
|
36308
|
+
if (ecmaVersion < 13 || this.toks.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
36309
|
+
// Method
|
|
36310
|
+
var isConstructor =
|
|
36311
|
+
!node.computed &&
|
|
36312
|
+
!node.static &&
|
|
36313
|
+
!isGenerator &&
|
|
36314
|
+
!isAsync &&
|
|
36315
|
+
kind === "method" && (
|
|
36316
|
+
node.key.type === "Identifier" && node.key.name === "constructor" ||
|
|
36317
|
+
node.key.type === "Literal" && node.key.value === "constructor"
|
|
36318
|
+
);
|
|
36319
|
+
node.kind = isConstructor ? "constructor" : kind;
|
|
36320
|
+
node.value = this.parseMethod(isGenerator, isAsync);
|
|
36321
|
+
this.finishNode(node, "MethodDefinition");
|
|
36322
|
+
} else {
|
|
36323
|
+
// Field
|
|
36324
|
+
if (this.eat(types$1.eq)) {
|
|
36325
|
+
if (this.curLineStart !== line && this.curIndent <= indent && this.tokenStartsLine()) {
|
|
36326
|
+
// Estimated the next line is the next class element by indentations.
|
|
36327
|
+
node.value = null;
|
|
36328
|
+
} else {
|
|
36329
|
+
var oldInAsync = this.inAsync;
|
|
36330
|
+
var oldInGenerator = this.inGenerator;
|
|
36331
|
+
this.inAsync = false;
|
|
36332
|
+
this.inGenerator = false;
|
|
36333
|
+
node.value = this.parseMaybeAssign();
|
|
36334
|
+
this.inAsync = oldInAsync;
|
|
36335
|
+
this.inGenerator = oldInGenerator;
|
|
36336
|
+
}
|
|
36337
|
+
} else {
|
|
36338
|
+
node.value = null;
|
|
36339
|
+
}
|
|
36340
|
+
this.semicolon();
|
|
36341
|
+
this.finishNode(node, "PropertyDefinition");
|
|
36342
|
+
}
|
|
36343
|
+
|
|
36344
|
+
return node
|
|
36345
|
+
};
|
|
36346
|
+
|
|
36347
|
+
lp$1.parseClassStaticBlock = function(node) {
|
|
36348
|
+
var blockIndent = this.curIndent, line = this.curLineStart;
|
|
36349
|
+
node.body = [];
|
|
36350
|
+
this.pushCx();
|
|
36351
|
+
while (!this.closes(types$1.braceR, blockIndent, line, true))
|
|
36352
|
+
{ node.body.push(this.parseStatement()); }
|
|
36353
|
+
this.popCx();
|
|
36354
|
+
this.eat(types$1.braceR);
|
|
36355
|
+
|
|
36356
|
+
return this.finishNode(node, "StaticBlock")
|
|
36357
|
+
};
|
|
36358
|
+
|
|
36359
|
+
lp$1.isClassElementNameStart = function() {
|
|
36360
|
+
return this.toks.isClassElementNameStart()
|
|
36361
|
+
};
|
|
36362
|
+
|
|
36363
|
+
lp$1.parseClassElementName = function(element) {
|
|
36364
|
+
if (this.toks.type === types$1.privateId) {
|
|
36365
|
+
element.computed = false;
|
|
36366
|
+
element.key = this.parsePrivateIdent();
|
|
36367
|
+
} else {
|
|
36368
|
+
this.parsePropertyName(element);
|
|
36369
|
+
}
|
|
36370
|
+
};
|
|
36371
|
+
|
|
36372
|
+
lp$1.parseFunction = function(node, isStatement, isAsync) {
|
|
36373
|
+
var oldInAsync = this.inAsync, oldInGenerator = this.inGenerator, oldInFunction = this.inFunction;
|
|
36374
|
+
this.initFunction(node);
|
|
36375
|
+
if (this.options.ecmaVersion >= 6) {
|
|
36376
|
+
node.generator = this.eat(types$1.star);
|
|
36377
|
+
}
|
|
36378
|
+
if (this.options.ecmaVersion >= 8) {
|
|
36379
|
+
node.async = !!isAsync;
|
|
36380
|
+
}
|
|
36381
|
+
if (this.tok.type === types$1.name) { node.id = this.parseIdent(); }
|
|
36382
|
+
else if (isStatement === true) { node.id = this.dummyIdent(); }
|
|
36383
|
+
this.inAsync = node.async;
|
|
36384
|
+
this.inGenerator = node.generator;
|
|
36385
|
+
this.inFunction = true;
|
|
36386
|
+
node.params = this.parseFunctionParams();
|
|
36387
|
+
node.body = this.parseBlock();
|
|
36388
|
+
this.toks.adaptDirectivePrologue(node.body.body);
|
|
36389
|
+
this.inAsync = oldInAsync;
|
|
36390
|
+
this.inGenerator = oldInGenerator;
|
|
36391
|
+
this.inFunction = oldInFunction;
|
|
36392
|
+
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
|
|
36393
|
+
};
|
|
36394
|
+
|
|
36395
|
+
lp$1.parseExport = function() {
|
|
36396
|
+
var node = this.startNode();
|
|
36397
|
+
this.next();
|
|
36398
|
+
if (this.eat(types$1.star)) {
|
|
36399
|
+
if (this.options.ecmaVersion >= 11) {
|
|
36400
|
+
if (this.eatContextual("as")) {
|
|
36401
|
+
node.exported = this.parseExprAtom();
|
|
36402
|
+
} else {
|
|
36403
|
+
node.exported = null;
|
|
36404
|
+
}
|
|
36405
|
+
}
|
|
36406
|
+
node.source = this.eatContextual("from") ? this.parseExprAtom() : this.dummyString();
|
|
36407
|
+
if (this.options.ecmaVersion >= 16)
|
|
36408
|
+
{ node.attributes = this.parseWithClause(); }
|
|
36409
|
+
this.semicolon();
|
|
36410
|
+
return this.finishNode(node, "ExportAllDeclaration")
|
|
36411
|
+
}
|
|
36412
|
+
if (this.eat(types$1._default)) {
|
|
36413
|
+
// export default (function foo() {}) // This is FunctionExpression.
|
|
36414
|
+
var isAsync;
|
|
36415
|
+
if (this.tok.type === types$1._function || (isAsync = this.toks.isAsyncFunction())) {
|
|
36416
|
+
var fNode = this.startNode();
|
|
36417
|
+
this.next();
|
|
36418
|
+
if (isAsync) { this.next(); }
|
|
36419
|
+
node.declaration = this.parseFunction(fNode, "nullableID", isAsync);
|
|
36420
|
+
} else if (this.tok.type === types$1._class) {
|
|
36421
|
+
node.declaration = this.parseClass("nullableID");
|
|
36422
|
+
} else {
|
|
36423
|
+
node.declaration = this.parseMaybeAssign();
|
|
36424
|
+
this.semicolon();
|
|
36425
|
+
}
|
|
36426
|
+
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
36427
|
+
}
|
|
36428
|
+
if (this.tok.type.keyword || this.toks.isLet() || this.toks.isAsyncFunction()) {
|
|
36429
|
+
node.declaration = this.parseStatement();
|
|
36430
|
+
node.specifiers = [];
|
|
36431
|
+
node.source = null;
|
|
36432
|
+
} else {
|
|
36433
|
+
node.declaration = null;
|
|
36434
|
+
node.specifiers = this.parseExportSpecifierList();
|
|
36435
|
+
node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
|
|
36436
|
+
if (this.options.ecmaVersion >= 16)
|
|
36437
|
+
{ node.attributes = this.parseWithClause(); }
|
|
36438
|
+
this.semicolon();
|
|
36439
|
+
}
|
|
36440
|
+
return this.finishNode(node, "ExportNamedDeclaration")
|
|
36441
|
+
};
|
|
36442
|
+
|
|
36443
|
+
lp$1.parseImport = function() {
|
|
36444
|
+
var node = this.startNode();
|
|
36445
|
+
this.next();
|
|
36446
|
+
if (this.tok.type === types$1.string) {
|
|
36447
|
+
node.specifiers = [];
|
|
36448
|
+
node.source = this.parseExprAtom();
|
|
36449
|
+
} else {
|
|
36450
|
+
var elt;
|
|
36451
|
+
if (this.tok.type === types$1.name && this.tok.value !== "from") {
|
|
36452
|
+
elt = this.startNode();
|
|
36453
|
+
elt.local = this.parseIdent();
|
|
36454
|
+
this.finishNode(elt, "ImportDefaultSpecifier");
|
|
36455
|
+
this.eat(types$1.comma);
|
|
36456
|
+
}
|
|
36457
|
+
node.specifiers = this.parseImportSpecifiers();
|
|
36458
|
+
node.source = this.eatContextual("from") && this.tok.type === types$1.string ? this.parseExprAtom() : this.dummyString();
|
|
36459
|
+
if (elt) { node.specifiers.unshift(elt); }
|
|
36460
|
+
}
|
|
36461
|
+
if (this.options.ecmaVersion >= 16)
|
|
36462
|
+
{ node.attributes = this.parseWithClause(); }
|
|
36463
|
+
this.semicolon();
|
|
36464
|
+
return this.finishNode(node, "ImportDeclaration")
|
|
36465
|
+
};
|
|
36466
|
+
|
|
36467
|
+
lp$1.parseImportSpecifiers = function() {
|
|
36468
|
+
var elts = [];
|
|
36469
|
+
if (this.tok.type === types$1.star) {
|
|
36470
|
+
var elt = this.startNode();
|
|
36471
|
+
this.next();
|
|
36472
|
+
elt.local = this.eatContextual("as") ? this.parseIdent() : this.dummyIdent();
|
|
36473
|
+
elts.push(this.finishNode(elt, "ImportNamespaceSpecifier"));
|
|
36474
|
+
} else {
|
|
36475
|
+
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart;
|
|
36476
|
+
this.pushCx();
|
|
36477
|
+
this.eat(types$1.braceL);
|
|
36478
|
+
if (this.curLineStart > continuedLine) { continuedLine = this.curLineStart; }
|
|
36479
|
+
while (!this.closes(types$1.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
|
36480
|
+
var elt$1 = this.startNode();
|
|
36481
|
+
if (this.eat(types$1.star)) {
|
|
36482
|
+
elt$1.local = this.eatContextual("as") ? this.parseModuleExportName() : this.dummyIdent();
|
|
36483
|
+
this.finishNode(elt$1, "ImportNamespaceSpecifier");
|
|
36484
|
+
} else {
|
|
36485
|
+
if (this.isContextual("from")) { break }
|
|
36486
|
+
elt$1.imported = this.parseModuleExportName();
|
|
36487
|
+
if (isDummy(elt$1.imported)) { break }
|
|
36488
|
+
elt$1.local = this.eatContextual("as") ? this.parseModuleExportName() : elt$1.imported;
|
|
36489
|
+
this.finishNode(elt$1, "ImportSpecifier");
|
|
36490
|
+
}
|
|
36491
|
+
elts.push(elt$1);
|
|
36492
|
+
this.eat(types$1.comma);
|
|
36493
|
+
}
|
|
36494
|
+
this.eat(types$1.braceR);
|
|
36495
|
+
this.popCx();
|
|
36496
|
+
}
|
|
36497
|
+
return elts
|
|
36498
|
+
};
|
|
36499
|
+
|
|
36500
|
+
lp$1.parseWithClause = function() {
|
|
36501
|
+
var nodes = [];
|
|
36502
|
+
if (!this.eat(types$1._with)) {
|
|
36503
|
+
return nodes
|
|
36504
|
+
}
|
|
36505
|
+
|
|
36506
|
+
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart;
|
|
36507
|
+
this.pushCx();
|
|
36508
|
+
this.eat(types$1.braceL);
|
|
36509
|
+
if (this.curLineStart > continuedLine) { continuedLine = this.curLineStart; }
|
|
36510
|
+
while (!this.closes(types$1.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
|
36511
|
+
var attr = this.startNode();
|
|
36512
|
+
attr.key = this.tok.type === types$1.string ? this.parseExprAtom() : this.parseIdent();
|
|
36513
|
+
if (this.eat(types$1.colon)) {
|
|
36514
|
+
if (this.tok.type === types$1.string)
|
|
36515
|
+
{ attr.value = this.parseExprAtom(); }
|
|
36516
|
+
else { attr.value = this.dummyString(); }
|
|
36517
|
+
} else {
|
|
36518
|
+
if (isDummy(attr.key)) { break }
|
|
36519
|
+
if (this.tok.type === types$1.string)
|
|
36520
|
+
{ attr.value = this.parseExprAtom(); }
|
|
36521
|
+
else { break }
|
|
36522
|
+
}
|
|
36523
|
+
nodes.push(this.finishNode(attr, "ImportAttribute"));
|
|
36524
|
+
this.eat(types$1.comma);
|
|
36525
|
+
}
|
|
36526
|
+
this.eat(types$1.braceR);
|
|
36527
|
+
this.popCx();
|
|
36528
|
+
return nodes
|
|
36529
|
+
};
|
|
36530
|
+
|
|
36531
|
+
lp$1.parseExportSpecifierList = function() {
|
|
36532
|
+
var elts = [];
|
|
36533
|
+
var indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart;
|
|
36534
|
+
this.pushCx();
|
|
36535
|
+
this.eat(types$1.braceL);
|
|
36536
|
+
if (this.curLineStart > continuedLine) { continuedLine = this.curLineStart; }
|
|
36537
|
+
while (!this.closes(types$1.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
|
36538
|
+
if (this.isContextual("from")) { break }
|
|
36539
|
+
var elt = this.startNode();
|
|
36540
|
+
elt.local = this.parseModuleExportName();
|
|
36541
|
+
if (isDummy(elt.local)) { break }
|
|
36542
|
+
elt.exported = this.eatContextual("as") ? this.parseModuleExportName() : elt.local;
|
|
36543
|
+
this.finishNode(elt, "ExportSpecifier");
|
|
36544
|
+
elts.push(elt);
|
|
36545
|
+
this.eat(types$1.comma);
|
|
36546
|
+
}
|
|
36547
|
+
this.eat(types$1.braceR);
|
|
36548
|
+
this.popCx();
|
|
36549
|
+
return elts
|
|
36550
|
+
};
|
|
36551
|
+
|
|
36552
|
+
lp$1.parseModuleExportName = function() {
|
|
36553
|
+
return this.options.ecmaVersion >= 13 && this.tok.type === types$1.string
|
|
36554
|
+
? this.parseExprAtom()
|
|
36555
|
+
: this.parseIdent()
|
|
36556
|
+
};
|
|
36557
|
+
|
|
36558
|
+
var lp = LooseParser.prototype;
|
|
36559
|
+
|
|
36560
|
+
lp.checkLVal = function(expr) {
|
|
36561
|
+
if (!expr) { return expr }
|
|
36562
|
+
switch (expr.type) {
|
|
36563
|
+
case "Identifier":
|
|
36564
|
+
case "MemberExpression":
|
|
36565
|
+
return expr
|
|
36566
|
+
|
|
36567
|
+
case "ParenthesizedExpression":
|
|
36568
|
+
expr.expression = this.checkLVal(expr.expression);
|
|
36569
|
+
return expr
|
|
36570
|
+
|
|
36571
|
+
default:
|
|
36572
|
+
return this.dummyIdent()
|
|
36573
|
+
}
|
|
36574
|
+
};
|
|
36575
|
+
|
|
36576
|
+
lp.parseExpression = function(noIn) {
|
|
36577
|
+
var start = this.storeCurrentPos();
|
|
36578
|
+
var expr = this.parseMaybeAssign(noIn);
|
|
36579
|
+
if (this.tok.type === types$1.comma) {
|
|
36580
|
+
var node = this.startNodeAt(start);
|
|
36581
|
+
node.expressions = [expr];
|
|
36582
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(noIn)); }
|
|
36583
|
+
return this.finishNode(node, "SequenceExpression")
|
|
36584
|
+
}
|
|
36585
|
+
return expr
|
|
36586
|
+
};
|
|
36587
|
+
|
|
36588
|
+
lp.parseParenExpression = function() {
|
|
36589
|
+
this.pushCx();
|
|
36590
|
+
this.expect(types$1.parenL);
|
|
36591
|
+
var val = this.parseExpression();
|
|
36592
|
+
this.popCx();
|
|
36593
|
+
this.expect(types$1.parenR);
|
|
36594
|
+
return val
|
|
36595
|
+
};
|
|
36596
|
+
|
|
36597
|
+
lp.parseMaybeAssign = function(noIn) {
|
|
36598
|
+
// `yield` should be an identifier reference if it's not in generator functions.
|
|
36599
|
+
if (this.inGenerator && this.toks.isContextual("yield")) {
|
|
36600
|
+
var node = this.startNode();
|
|
36601
|
+
this.next();
|
|
36602
|
+
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type !== types$1.star && !this.tok.type.startsExpr)) {
|
|
36603
|
+
node.delegate = false;
|
|
36604
|
+
node.argument = null;
|
|
36605
|
+
} else {
|
|
36606
|
+
node.delegate = this.eat(types$1.star);
|
|
36607
|
+
node.argument = this.parseMaybeAssign();
|
|
36608
|
+
}
|
|
36609
|
+
return this.finishNode(node, "YieldExpression")
|
|
36610
|
+
}
|
|
36611
|
+
|
|
36612
|
+
var start = this.storeCurrentPos();
|
|
36613
|
+
var left = this.parseMaybeConditional(noIn);
|
|
36614
|
+
if (this.tok.type.isAssign) {
|
|
36615
|
+
var node$1 = this.startNodeAt(start);
|
|
36616
|
+
node$1.operator = this.tok.value;
|
|
36617
|
+
node$1.left = this.tok.type === types$1.eq ? this.toAssignable(left) : this.checkLVal(left);
|
|
36618
|
+
this.next();
|
|
36619
|
+
node$1.right = this.parseMaybeAssign(noIn);
|
|
36620
|
+
return this.finishNode(node$1, "AssignmentExpression")
|
|
36621
|
+
}
|
|
36622
|
+
return left
|
|
36623
|
+
};
|
|
36624
|
+
|
|
36625
|
+
lp.parseMaybeConditional = function(noIn) {
|
|
36626
|
+
var start = this.storeCurrentPos();
|
|
36627
|
+
var expr = this.parseExprOps(noIn);
|
|
36628
|
+
if (this.eat(types$1.question)) {
|
|
36629
|
+
var node = this.startNodeAt(start);
|
|
36630
|
+
node.test = expr;
|
|
36631
|
+
node.consequent = this.parseMaybeAssign();
|
|
36632
|
+
node.alternate = this.expect(types$1.colon) ? this.parseMaybeAssign(noIn) : this.dummyIdent();
|
|
36633
|
+
return this.finishNode(node, "ConditionalExpression")
|
|
36634
|
+
}
|
|
36635
|
+
return expr
|
|
36636
|
+
};
|
|
36637
|
+
|
|
36638
|
+
lp.parseExprOps = function(noIn) {
|
|
36639
|
+
var start = this.storeCurrentPos();
|
|
36640
|
+
var indent = this.curIndent, line = this.curLineStart;
|
|
36641
|
+
return this.parseExprOp(this.parseMaybeUnary(false), start, -1, noIn, indent, line)
|
|
36642
|
+
};
|
|
36643
|
+
|
|
36644
|
+
lp.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
|
|
36645
|
+
if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) { return left }
|
|
36646
|
+
var prec = this.tok.type.binop;
|
|
36647
|
+
if (prec != null && (!noIn || this.tok.type !== types$1._in)) {
|
|
36648
|
+
if (prec > minPrec) {
|
|
36649
|
+
var node = this.startNodeAt(start);
|
|
36650
|
+
node.left = left;
|
|
36651
|
+
node.operator = this.tok.value;
|
|
36652
|
+
this.next();
|
|
36653
|
+
if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) {
|
|
36654
|
+
node.right = this.dummyIdent();
|
|
36655
|
+
} else {
|
|
36656
|
+
var rightStart = this.storeCurrentPos();
|
|
36657
|
+
node.right = this.parseExprOp(this.parseMaybeUnary(false), rightStart, prec, noIn, indent, line);
|
|
36658
|
+
}
|
|
36659
|
+
this.finishNode(node, /&&|\|\||\?\?/.test(node.operator) ? "LogicalExpression" : "BinaryExpression");
|
|
36660
|
+
return this.parseExprOp(node, start, minPrec, noIn, indent, line)
|
|
36661
|
+
}
|
|
36662
|
+
}
|
|
36663
|
+
return left
|
|
36664
|
+
};
|
|
36665
|
+
|
|
36666
|
+
lp.parseMaybeUnary = function(sawUnary) {
|
|
36667
|
+
var start = this.storeCurrentPos(), expr;
|
|
36668
|
+
if (this.options.ecmaVersion >= 8 && this.toks.isContextual("await") &&
|
|
36669
|
+
(this.inAsync || (this.toks.inModule && this.options.ecmaVersion >= 13) ||
|
|
36670
|
+
(!this.inFunction && this.options.allowAwaitOutsideFunction))) {
|
|
36671
|
+
expr = this.parseAwait();
|
|
36672
|
+
sawUnary = true;
|
|
36673
|
+
} else if (this.tok.type.prefix) {
|
|
36674
|
+
var node = this.startNode(), update = this.tok.type === types$1.incDec;
|
|
36675
|
+
if (!update) { sawUnary = true; }
|
|
36676
|
+
node.operator = this.tok.value;
|
|
36677
|
+
node.prefix = true;
|
|
36678
|
+
this.next();
|
|
36679
|
+
node.argument = this.parseMaybeUnary(true);
|
|
36680
|
+
if (update) { node.argument = this.checkLVal(node.argument); }
|
|
36681
|
+
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
36682
|
+
} else if (this.tok.type === types$1.ellipsis) {
|
|
36683
|
+
var node$1 = this.startNode();
|
|
36684
|
+
this.next();
|
|
36685
|
+
node$1.argument = this.parseMaybeUnary(sawUnary);
|
|
36686
|
+
expr = this.finishNode(node$1, "SpreadElement");
|
|
36687
|
+
} else if (!sawUnary && this.tok.type === types$1.privateId) {
|
|
36688
|
+
expr = this.parsePrivateIdent();
|
|
36689
|
+
} else {
|
|
36690
|
+
expr = this.parseExprSubscripts();
|
|
36691
|
+
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
|
|
36692
|
+
var node$2 = this.startNodeAt(start);
|
|
36693
|
+
node$2.operator = this.tok.value;
|
|
36694
|
+
node$2.prefix = false;
|
|
36695
|
+
node$2.argument = this.checkLVal(expr);
|
|
36696
|
+
this.next();
|
|
36697
|
+
expr = this.finishNode(node$2, "UpdateExpression");
|
|
36698
|
+
}
|
|
36699
|
+
}
|
|
36700
|
+
|
|
36701
|
+
if (!sawUnary && this.eat(types$1.starstar)) {
|
|
36702
|
+
var node$3 = this.startNodeAt(start);
|
|
36703
|
+
node$3.operator = "**";
|
|
36704
|
+
node$3.left = expr;
|
|
36705
|
+
node$3.right = this.parseMaybeUnary(false);
|
|
36706
|
+
return this.finishNode(node$3, "BinaryExpression")
|
|
36707
|
+
}
|
|
36708
|
+
|
|
36709
|
+
return expr
|
|
36710
|
+
};
|
|
36711
|
+
|
|
36712
|
+
lp.parseExprSubscripts = function() {
|
|
36713
|
+
var start = this.storeCurrentPos();
|
|
36714
|
+
return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart)
|
|
36715
|
+
};
|
|
36716
|
+
|
|
36717
|
+
lp.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
36718
|
+
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
36719
|
+
var optionalChained = false;
|
|
36720
|
+
for (;;) {
|
|
36721
|
+
if (this.curLineStart !== line && this.curIndent <= startIndent && this.tokenStartsLine()) {
|
|
36722
|
+
if (this.tok.type === types$1.dot && this.curIndent === startIndent)
|
|
36723
|
+
{ --startIndent; }
|
|
36724
|
+
else
|
|
36725
|
+
{ break }
|
|
36726
|
+
}
|
|
36727
|
+
|
|
36728
|
+
var maybeAsyncArrow = base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon();
|
|
36729
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
36730
|
+
if (optional) {
|
|
36731
|
+
optionalChained = true;
|
|
36732
|
+
}
|
|
36733
|
+
|
|
36734
|
+
if ((optional && this.tok.type !== types$1.parenL && this.tok.type !== types$1.bracketL && this.tok.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
36735
|
+
var node = this.startNodeAt(start);
|
|
36736
|
+
node.object = base;
|
|
36737
|
+
if (this.curLineStart !== line && this.curIndent <= startIndent && this.tokenStartsLine())
|
|
36738
|
+
{ node.property = this.dummyIdent(); }
|
|
36739
|
+
else
|
|
36740
|
+
{ node.property = this.parsePropertyAccessor() || this.dummyIdent(); }
|
|
36741
|
+
node.computed = false;
|
|
36742
|
+
if (optionalSupported) {
|
|
36743
|
+
node.optional = optional;
|
|
36744
|
+
}
|
|
36745
|
+
base = this.finishNode(node, "MemberExpression");
|
|
36746
|
+
} else if (this.tok.type === types$1.bracketL) {
|
|
36747
|
+
this.pushCx();
|
|
36748
|
+
this.next();
|
|
36749
|
+
var node$1 = this.startNodeAt(start);
|
|
36750
|
+
node$1.object = base;
|
|
36751
|
+
node$1.property = this.parseExpression();
|
|
36752
|
+
node$1.computed = true;
|
|
36753
|
+
if (optionalSupported) {
|
|
36754
|
+
node$1.optional = optional;
|
|
36755
|
+
}
|
|
36756
|
+
this.popCx();
|
|
36757
|
+
this.expect(types$1.bracketR);
|
|
36758
|
+
base = this.finishNode(node$1, "MemberExpression");
|
|
36759
|
+
} else if (!noCalls && this.tok.type === types$1.parenL) {
|
|
36760
|
+
var exprList = this.parseExprList(types$1.parenR);
|
|
36761
|
+
if (maybeAsyncArrow && this.eat(types$1.arrow))
|
|
36762
|
+
{ return this.parseArrowExpression(this.startNodeAt(start), exprList, true) }
|
|
36763
|
+
var node$2 = this.startNodeAt(start);
|
|
36764
|
+
node$2.callee = base;
|
|
36765
|
+
node$2.arguments = exprList;
|
|
36766
|
+
if (optionalSupported) {
|
|
36767
|
+
node$2.optional = optional;
|
|
36768
|
+
}
|
|
36769
|
+
base = this.finishNode(node$2, "CallExpression");
|
|
36770
|
+
} else if (this.tok.type === types$1.backQuote) {
|
|
36771
|
+
var node$3 = this.startNodeAt(start);
|
|
36772
|
+
node$3.tag = base;
|
|
36773
|
+
node$3.quasi = this.parseTemplate();
|
|
36774
|
+
base = this.finishNode(node$3, "TaggedTemplateExpression");
|
|
36775
|
+
} else {
|
|
36776
|
+
break
|
|
36777
|
+
}
|
|
36778
|
+
}
|
|
36779
|
+
|
|
36780
|
+
if (optionalChained) {
|
|
36781
|
+
var chainNode = this.startNodeAt(start);
|
|
36782
|
+
chainNode.expression = base;
|
|
36783
|
+
base = this.finishNode(chainNode, "ChainExpression");
|
|
36784
|
+
}
|
|
36785
|
+
return base
|
|
36786
|
+
};
|
|
36787
|
+
|
|
36788
|
+
lp.parseExprAtom = function() {
|
|
36789
|
+
var node;
|
|
36790
|
+
switch (this.tok.type) {
|
|
36791
|
+
case types$1._this:
|
|
36792
|
+
case types$1._super:
|
|
36793
|
+
var type = this.tok.type === types$1._this ? "ThisExpression" : "Super";
|
|
36794
|
+
node = this.startNode();
|
|
36795
|
+
this.next();
|
|
36796
|
+
return this.finishNode(node, type)
|
|
36797
|
+
|
|
36798
|
+
case types$1.name:
|
|
36799
|
+
var start = this.storeCurrentPos();
|
|
36800
|
+
var id = this.parseIdent();
|
|
36801
|
+
var isAsync = false;
|
|
36802
|
+
if (id.name === "async" && !this.canInsertSemicolon()) {
|
|
36803
|
+
if (this.eat(types$1._function)) {
|
|
36804
|
+
this.toks.overrideContext(types.f_expr);
|
|
36805
|
+
return this.parseFunction(this.startNodeAt(start), false, true)
|
|
36806
|
+
}
|
|
36807
|
+
if (this.tok.type === types$1.name) {
|
|
36808
|
+
id = this.parseIdent();
|
|
36809
|
+
isAsync = true;
|
|
36810
|
+
}
|
|
36811
|
+
}
|
|
36812
|
+
return this.eat(types$1.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id], isAsync) : id
|
|
36813
|
+
|
|
36814
|
+
case types$1.regexp:
|
|
36815
|
+
node = this.startNode();
|
|
36816
|
+
var val = this.tok.value;
|
|
36817
|
+
node.regex = {pattern: val.pattern, flags: val.flags};
|
|
36818
|
+
node.value = val.value;
|
|
36819
|
+
node.raw = this.input.slice(this.tok.start, this.tok.end);
|
|
36820
|
+
this.next();
|
|
36821
|
+
return this.finishNode(node, "Literal")
|
|
36822
|
+
|
|
36823
|
+
case types$1.num: case types$1.string:
|
|
36824
|
+
node = this.startNode();
|
|
36825
|
+
node.value = this.tok.value;
|
|
36826
|
+
node.raw = this.input.slice(this.tok.start, this.tok.end);
|
|
36827
|
+
if (this.tok.type === types$1.num && node.raw.charCodeAt(node.raw.length - 1) === 110)
|
|
36828
|
+
{ node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, ""); }
|
|
36829
|
+
this.next();
|
|
36830
|
+
return this.finishNode(node, "Literal")
|
|
36831
|
+
|
|
36832
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
36833
|
+
node = this.startNode();
|
|
36834
|
+
node.value = this.tok.type === types$1._null ? null : this.tok.type === types$1._true;
|
|
36835
|
+
node.raw = this.tok.type.keyword;
|
|
36836
|
+
this.next();
|
|
36837
|
+
return this.finishNode(node, "Literal")
|
|
36838
|
+
|
|
36839
|
+
case types$1.parenL:
|
|
36840
|
+
var parenStart = this.storeCurrentPos();
|
|
36841
|
+
this.next();
|
|
36842
|
+
var inner = this.parseExpression();
|
|
36843
|
+
this.expect(types$1.parenR);
|
|
36844
|
+
if (this.eat(types$1.arrow)) {
|
|
36845
|
+
// (a,)=>a // SequenceExpression makes dummy in the last hole. Drop the dummy.
|
|
36846
|
+
var params = inner.expressions || [inner];
|
|
36847
|
+
if (params.length && isDummy(params[params.length - 1]))
|
|
36848
|
+
{ params.pop(); }
|
|
36849
|
+
return this.parseArrowExpression(this.startNodeAt(parenStart), params)
|
|
36850
|
+
}
|
|
36851
|
+
if (this.options.preserveParens) {
|
|
36852
|
+
var par = this.startNodeAt(parenStart);
|
|
36853
|
+
par.expression = inner;
|
|
36854
|
+
inner = this.finishNode(par, "ParenthesizedExpression");
|
|
36855
|
+
}
|
|
36856
|
+
return inner
|
|
36857
|
+
|
|
36858
|
+
case types$1.bracketL:
|
|
36859
|
+
node = this.startNode();
|
|
36860
|
+
node.elements = this.parseExprList(types$1.bracketR, true);
|
|
36861
|
+
return this.finishNode(node, "ArrayExpression")
|
|
36862
|
+
|
|
36863
|
+
case types$1.braceL:
|
|
36864
|
+
this.toks.overrideContext(types.b_expr);
|
|
36865
|
+
return this.parseObj()
|
|
36866
|
+
|
|
36867
|
+
case types$1._class:
|
|
36868
|
+
return this.parseClass(false)
|
|
36869
|
+
|
|
36870
|
+
case types$1._function:
|
|
36871
|
+
node = this.startNode();
|
|
36872
|
+
this.next();
|
|
36873
|
+
return this.parseFunction(node, false)
|
|
36874
|
+
|
|
36875
|
+
case types$1._new:
|
|
36876
|
+
return this.parseNew()
|
|
36877
|
+
|
|
36878
|
+
case types$1.backQuote:
|
|
36879
|
+
return this.parseTemplate()
|
|
36880
|
+
|
|
36881
|
+
case types$1._import:
|
|
36882
|
+
if (this.options.ecmaVersion >= 11) {
|
|
36883
|
+
return this.parseExprImport()
|
|
36884
|
+
} else {
|
|
36885
|
+
return this.dummyIdent()
|
|
36886
|
+
}
|
|
36887
|
+
|
|
36888
|
+
default:
|
|
36889
|
+
return this.dummyIdent()
|
|
36890
|
+
}
|
|
36891
|
+
};
|
|
36892
|
+
|
|
36893
|
+
lp.parseExprImport = function() {
|
|
36894
|
+
var node = this.startNode();
|
|
36895
|
+
var meta = this.parseIdent(true);
|
|
36896
|
+
switch (this.tok.type) {
|
|
36897
|
+
case types$1.parenL:
|
|
36898
|
+
return this.parseDynamicImport(node)
|
|
36899
|
+
case types$1.dot:
|
|
36900
|
+
node.meta = meta;
|
|
36901
|
+
return this.parseImportMeta(node)
|
|
36902
|
+
default:
|
|
36903
|
+
node.name = "import";
|
|
36904
|
+
return this.finishNode(node, "Identifier")
|
|
36905
|
+
}
|
|
36906
|
+
};
|
|
36907
|
+
|
|
36908
|
+
lp.parseDynamicImport = function(node) {
|
|
36909
|
+
var list = this.parseExprList(types$1.parenR);
|
|
36910
|
+
node.source = list[0] || this.dummyString();
|
|
36911
|
+
node.options = list[1] || null;
|
|
36912
|
+
return this.finishNode(node, "ImportExpression")
|
|
36913
|
+
};
|
|
36914
|
+
|
|
36915
|
+
lp.parseImportMeta = function(node) {
|
|
36916
|
+
this.next(); // skip '.'
|
|
36917
|
+
node.property = this.parseIdent(true);
|
|
36918
|
+
return this.finishNode(node, "MetaProperty")
|
|
36919
|
+
};
|
|
36920
|
+
|
|
36921
|
+
lp.parseNew = function() {
|
|
36922
|
+
var node = this.startNode(), startIndent = this.curIndent, line = this.curLineStart;
|
|
36923
|
+
var meta = this.parseIdent(true);
|
|
36924
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
36925
|
+
node.meta = meta;
|
|
36926
|
+
node.property = this.parseIdent(true);
|
|
36927
|
+
return this.finishNode(node, "MetaProperty")
|
|
36928
|
+
}
|
|
36929
|
+
var start = this.storeCurrentPos();
|
|
36930
|
+
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
|
|
36931
|
+
if (this.tok.type === types$1.parenL) {
|
|
36932
|
+
node.arguments = this.parseExprList(types$1.parenR);
|
|
36933
|
+
} else {
|
|
36934
|
+
node.arguments = [];
|
|
36935
|
+
}
|
|
36936
|
+
return this.finishNode(node, "NewExpression")
|
|
36937
|
+
};
|
|
36938
|
+
|
|
36939
|
+
lp.parseTemplateElement = function() {
|
|
36940
|
+
var elem = this.startNode();
|
|
36941
|
+
|
|
36942
|
+
// The loose parser accepts invalid unicode escapes even in untagged templates.
|
|
36943
|
+
if (this.tok.type === types$1.invalidTemplate) {
|
|
36944
|
+
elem.value = {
|
|
36945
|
+
raw: this.tok.value,
|
|
36946
|
+
cooked: null
|
|
36947
|
+
};
|
|
36948
|
+
} else {
|
|
36949
|
+
elem.value = {
|
|
36950
|
+
raw: this.input.slice(this.tok.start, this.tok.end).replace(/\r\n?/g, "\n"),
|
|
36951
|
+
cooked: this.tok.value
|
|
36952
|
+
};
|
|
36953
|
+
}
|
|
36954
|
+
this.next();
|
|
36955
|
+
elem.tail = this.tok.type === types$1.backQuote;
|
|
36956
|
+
return this.finishNode(elem, "TemplateElement")
|
|
36957
|
+
};
|
|
36958
|
+
|
|
36959
|
+
lp.parseTemplate = function() {
|
|
36960
|
+
var node = this.startNode();
|
|
36961
|
+
this.next();
|
|
36962
|
+
node.expressions = [];
|
|
36963
|
+
var curElt = this.parseTemplateElement();
|
|
36964
|
+
node.quasis = [curElt];
|
|
36965
|
+
while (!curElt.tail) {
|
|
36966
|
+
this.next();
|
|
36967
|
+
node.expressions.push(this.parseExpression());
|
|
36968
|
+
if (this.expect(types$1.braceR)) {
|
|
36969
|
+
curElt = this.parseTemplateElement();
|
|
36970
|
+
} else {
|
|
36971
|
+
curElt = this.startNode();
|
|
36972
|
+
curElt.value = {cooked: "", raw: ""};
|
|
36973
|
+
curElt.tail = true;
|
|
36974
|
+
this.finishNode(curElt, "TemplateElement");
|
|
36975
|
+
}
|
|
36976
|
+
node.quasis.push(curElt);
|
|
36977
|
+
}
|
|
36978
|
+
this.expect(types$1.backQuote);
|
|
36979
|
+
return this.finishNode(node, "TemplateLiteral")
|
|
36980
|
+
};
|
|
36981
|
+
|
|
36982
|
+
lp.parseObj = function() {
|
|
36983
|
+
var node = this.startNode();
|
|
36984
|
+
node.properties = [];
|
|
36985
|
+
this.pushCx();
|
|
36986
|
+
var indent = this.curIndent + 1, line = this.curLineStart;
|
|
36987
|
+
this.eat(types$1.braceL);
|
|
36988
|
+
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; }
|
|
36989
|
+
while (!this.closes(types$1.braceR, indent, line)) {
|
|
36990
|
+
var prop = this.startNode(), isGenerator = (void 0), isAsync = (void 0), start = (void 0);
|
|
36991
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
36992
|
+
prop.argument = this.parseMaybeAssign();
|
|
36993
|
+
node.properties.push(this.finishNode(prop, "SpreadElement"));
|
|
36994
|
+
this.eat(types$1.comma);
|
|
36995
|
+
continue
|
|
36996
|
+
}
|
|
36997
|
+
if (this.options.ecmaVersion >= 6) {
|
|
36998
|
+
start = this.storeCurrentPos();
|
|
36999
|
+
prop.method = false;
|
|
37000
|
+
prop.shorthand = false;
|
|
37001
|
+
isGenerator = this.eat(types$1.star);
|
|
37002
|
+
}
|
|
37003
|
+
this.parsePropertyName(prop);
|
|
37004
|
+
if (this.toks.isAsyncProp(prop)) {
|
|
37005
|
+
isAsync = true;
|
|
37006
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
37007
|
+
this.parsePropertyName(prop);
|
|
37008
|
+
} else {
|
|
37009
|
+
isAsync = false;
|
|
37010
|
+
}
|
|
37011
|
+
if (isDummy(prop.key)) { if (isDummy(this.parseMaybeAssign())) { this.next(); } this.eat(types$1.comma); continue }
|
|
37012
|
+
if (this.eat(types$1.colon)) {
|
|
37013
|
+
prop.kind = "init";
|
|
37014
|
+
prop.value = this.parseMaybeAssign();
|
|
37015
|
+
} else if (this.options.ecmaVersion >= 6 && (this.tok.type === types$1.parenL || this.tok.type === types$1.braceL)) {
|
|
37016
|
+
prop.kind = "init";
|
|
37017
|
+
prop.method = true;
|
|
37018
|
+
prop.value = this.parseMethod(isGenerator, isAsync);
|
|
37019
|
+
} else if (this.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
|
|
37020
|
+
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
|
|
37021
|
+
(this.tok.type !== types$1.comma && this.tok.type !== types$1.braceR && this.tok.type !== types$1.eq)) {
|
|
37022
|
+
prop.kind = prop.key.name;
|
|
37023
|
+
this.parsePropertyName(prop);
|
|
37024
|
+
prop.value = this.parseMethod(false);
|
|
37025
|
+
} else {
|
|
37026
|
+
prop.kind = "init";
|
|
37027
|
+
if (this.options.ecmaVersion >= 6) {
|
|
37028
|
+
if (this.eat(types$1.eq)) {
|
|
37029
|
+
var assign = this.startNodeAt(start);
|
|
37030
|
+
assign.operator = "=";
|
|
37031
|
+
assign.left = prop.key;
|
|
37032
|
+
assign.right = this.parseMaybeAssign();
|
|
37033
|
+
prop.value = this.finishNode(assign, "AssignmentExpression");
|
|
37034
|
+
} else {
|
|
37035
|
+
prop.value = prop.key;
|
|
37036
|
+
}
|
|
37037
|
+
} else {
|
|
37038
|
+
prop.value = this.dummyIdent();
|
|
37039
|
+
}
|
|
37040
|
+
prop.shorthand = true;
|
|
37041
|
+
}
|
|
37042
|
+
node.properties.push(this.finishNode(prop, "Property"));
|
|
37043
|
+
this.eat(types$1.comma);
|
|
37044
|
+
}
|
|
37045
|
+
this.popCx();
|
|
37046
|
+
if (!this.eat(types$1.braceR)) {
|
|
37047
|
+
// If there is no closing brace, make the node span to the start
|
|
37048
|
+
// of the next token (this is useful for Tern)
|
|
37049
|
+
this.last.end = this.tok.start;
|
|
37050
|
+
if (this.options.locations) { this.last.loc.end = this.tok.loc.start; }
|
|
37051
|
+
}
|
|
37052
|
+
return this.finishNode(node, "ObjectExpression")
|
|
37053
|
+
};
|
|
37054
|
+
|
|
37055
|
+
lp.parsePropertyName = function(prop) {
|
|
37056
|
+
if (this.options.ecmaVersion >= 6) {
|
|
37057
|
+
if (this.eat(types$1.bracketL)) {
|
|
37058
|
+
prop.computed = true;
|
|
37059
|
+
prop.key = this.parseExpression();
|
|
37060
|
+
this.expect(types$1.bracketR);
|
|
37061
|
+
return
|
|
37062
|
+
} else {
|
|
37063
|
+
prop.computed = false;
|
|
37064
|
+
}
|
|
37065
|
+
}
|
|
37066
|
+
var key = (this.tok.type === types$1.num || this.tok.type === types$1.string) ? this.parseExprAtom() : this.parseIdent();
|
|
37067
|
+
prop.key = key || this.dummyIdent();
|
|
37068
|
+
};
|
|
37069
|
+
|
|
37070
|
+
lp.parsePropertyAccessor = function() {
|
|
37071
|
+
if (this.tok.type === types$1.name || this.tok.type.keyword) { return this.parseIdent() }
|
|
37072
|
+
if (this.tok.type === types$1.privateId) { return this.parsePrivateIdent() }
|
|
37073
|
+
};
|
|
37074
|
+
|
|
37075
|
+
lp.parseIdent = function() {
|
|
37076
|
+
var name = this.tok.type === types$1.name ? this.tok.value : this.tok.type.keyword;
|
|
37077
|
+
if (!name) { return this.dummyIdent() }
|
|
37078
|
+
if (this.tok.type.keyword) { this.toks.type = types$1.name; }
|
|
37079
|
+
var node = this.startNode();
|
|
37080
|
+
this.next();
|
|
37081
|
+
node.name = name;
|
|
37082
|
+
return this.finishNode(node, "Identifier")
|
|
37083
|
+
};
|
|
37084
|
+
|
|
37085
|
+
lp.parsePrivateIdent = function() {
|
|
37086
|
+
var node = this.startNode();
|
|
37087
|
+
node.name = this.tok.value;
|
|
37088
|
+
this.next();
|
|
37089
|
+
return this.finishNode(node, "PrivateIdentifier")
|
|
37090
|
+
};
|
|
37091
|
+
|
|
37092
|
+
lp.initFunction = function(node) {
|
|
37093
|
+
node.id = null;
|
|
37094
|
+
node.params = [];
|
|
37095
|
+
if (this.options.ecmaVersion >= 6) {
|
|
37096
|
+
node.generator = false;
|
|
37097
|
+
node.expression = false;
|
|
37098
|
+
}
|
|
37099
|
+
if (this.options.ecmaVersion >= 8)
|
|
37100
|
+
{ node.async = false; }
|
|
37101
|
+
};
|
|
37102
|
+
|
|
37103
|
+
// Convert existing expression atom to assignable pattern
|
|
37104
|
+
// if possible.
|
|
37105
|
+
|
|
37106
|
+
lp.toAssignable = function(node, binding) {
|
|
37107
|
+
if (!node || node.type === "Identifier" || (node.type === "MemberExpression" && !binding)) ; else if (node.type === "ParenthesizedExpression") {
|
|
37108
|
+
this.toAssignable(node.expression, binding);
|
|
37109
|
+
} else if (this.options.ecmaVersion < 6) {
|
|
37110
|
+
return this.dummyIdent()
|
|
37111
|
+
} else if (node.type === "ObjectExpression") {
|
|
37112
|
+
node.type = "ObjectPattern";
|
|
37113
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
|
37114
|
+
{
|
|
37115
|
+
var prop = list[i];
|
|
37116
|
+
|
|
37117
|
+
this.toAssignable(prop, binding);
|
|
37118
|
+
}
|
|
37119
|
+
} else if (node.type === "ArrayExpression") {
|
|
37120
|
+
node.type = "ArrayPattern";
|
|
37121
|
+
this.toAssignableList(node.elements, binding);
|
|
37122
|
+
} else if (node.type === "Property") {
|
|
37123
|
+
this.toAssignable(node.value, binding);
|
|
37124
|
+
} else if (node.type === "SpreadElement") {
|
|
37125
|
+
node.type = "RestElement";
|
|
37126
|
+
this.toAssignable(node.argument, binding);
|
|
37127
|
+
} else if (node.type === "AssignmentExpression") {
|
|
37128
|
+
node.type = "AssignmentPattern";
|
|
37129
|
+
delete node.operator;
|
|
37130
|
+
} else {
|
|
37131
|
+
return this.dummyIdent()
|
|
37132
|
+
}
|
|
37133
|
+
return node
|
|
37134
|
+
};
|
|
37135
|
+
|
|
37136
|
+
lp.toAssignableList = function(exprList, binding) {
|
|
37137
|
+
for (var i = 0, list = exprList; i < list.length; i += 1)
|
|
37138
|
+
{
|
|
37139
|
+
var expr = list[i];
|
|
37140
|
+
|
|
37141
|
+
this.toAssignable(expr, binding);
|
|
37142
|
+
}
|
|
37143
|
+
return exprList
|
|
37144
|
+
};
|
|
37145
|
+
|
|
37146
|
+
lp.parseFunctionParams = function(params) {
|
|
37147
|
+
params = this.parseExprList(types$1.parenR);
|
|
37148
|
+
return this.toAssignableList(params, true)
|
|
37149
|
+
};
|
|
37150
|
+
|
|
37151
|
+
lp.parseMethod = function(isGenerator, isAsync) {
|
|
37152
|
+
var node = this.startNode(), oldInAsync = this.inAsync, oldInGenerator = this.inGenerator, oldInFunction = this.inFunction;
|
|
37153
|
+
this.initFunction(node);
|
|
37154
|
+
if (this.options.ecmaVersion >= 6)
|
|
37155
|
+
{ node.generator = !!isGenerator; }
|
|
37156
|
+
if (this.options.ecmaVersion >= 8)
|
|
37157
|
+
{ node.async = !!isAsync; }
|
|
37158
|
+
this.inAsync = node.async;
|
|
37159
|
+
this.inGenerator = node.generator;
|
|
37160
|
+
this.inFunction = true;
|
|
37161
|
+
node.params = this.parseFunctionParams();
|
|
37162
|
+
node.body = this.parseBlock();
|
|
37163
|
+
this.toks.adaptDirectivePrologue(node.body.body);
|
|
37164
|
+
this.inAsync = oldInAsync;
|
|
37165
|
+
this.inGenerator = oldInGenerator;
|
|
37166
|
+
this.inFunction = oldInFunction;
|
|
37167
|
+
return this.finishNode(node, "FunctionExpression")
|
|
37168
|
+
};
|
|
37169
|
+
|
|
37170
|
+
lp.parseArrowExpression = function(node, params, isAsync) {
|
|
37171
|
+
var oldInAsync = this.inAsync, oldInGenerator = this.inGenerator, oldInFunction = this.inFunction;
|
|
37172
|
+
this.initFunction(node);
|
|
37173
|
+
if (this.options.ecmaVersion >= 8)
|
|
37174
|
+
{ node.async = !!isAsync; }
|
|
37175
|
+
this.inAsync = node.async;
|
|
37176
|
+
this.inGenerator = false;
|
|
37177
|
+
this.inFunction = true;
|
|
37178
|
+
node.params = this.toAssignableList(params, true);
|
|
37179
|
+
node.expression = this.tok.type !== types$1.braceL;
|
|
37180
|
+
if (node.expression) {
|
|
37181
|
+
node.body = this.parseMaybeAssign();
|
|
37182
|
+
} else {
|
|
37183
|
+
node.body = this.parseBlock();
|
|
37184
|
+
this.toks.adaptDirectivePrologue(node.body.body);
|
|
37185
|
+
}
|
|
37186
|
+
this.inAsync = oldInAsync;
|
|
37187
|
+
this.inGenerator = oldInGenerator;
|
|
37188
|
+
this.inFunction = oldInFunction;
|
|
37189
|
+
return this.finishNode(node, "ArrowFunctionExpression")
|
|
37190
|
+
};
|
|
37191
|
+
|
|
37192
|
+
lp.parseExprList = function(close, allowEmpty) {
|
|
37193
|
+
this.pushCx();
|
|
37194
|
+
var indent = this.curIndent, line = this.curLineStart, elts = [];
|
|
37195
|
+
this.next(); // Opening bracket
|
|
37196
|
+
while (!this.closes(close, indent + 1, line)) {
|
|
37197
|
+
if (this.eat(types$1.comma)) {
|
|
37198
|
+
elts.push(allowEmpty ? null : this.dummyIdent());
|
|
37199
|
+
continue
|
|
37200
|
+
}
|
|
37201
|
+
var elt = this.parseMaybeAssign();
|
|
37202
|
+
if (isDummy(elt)) {
|
|
37203
|
+
if (this.closes(close, indent, line)) { break }
|
|
37204
|
+
this.next();
|
|
37205
|
+
} else {
|
|
37206
|
+
elts.push(elt);
|
|
37207
|
+
}
|
|
37208
|
+
this.eat(types$1.comma);
|
|
37209
|
+
}
|
|
37210
|
+
this.popCx();
|
|
37211
|
+
if (!this.eat(close)) {
|
|
37212
|
+
// If there is no closing brace, make the node span to the start
|
|
37213
|
+
// of the next token (this is useful for Tern)
|
|
37214
|
+
this.last.end = this.tok.start;
|
|
37215
|
+
if (this.options.locations) { this.last.loc.end = this.tok.loc.start; }
|
|
37216
|
+
}
|
|
37217
|
+
return elts
|
|
37218
|
+
};
|
|
37219
|
+
|
|
37220
|
+
lp.parseAwait = function() {
|
|
37221
|
+
var node = this.startNode();
|
|
37222
|
+
this.next();
|
|
37223
|
+
node.argument = this.parseMaybeUnary();
|
|
37224
|
+
return this.finishNode(node, "AwaitExpression")
|
|
37225
|
+
};
|
|
37226
|
+
|
|
37227
|
+
// Acorn: Loose parser
|
|
37228
|
+
//
|
|
37229
|
+
// This module provides an alternative parser that exposes that same
|
|
37230
|
+
// interface as the main module's `parse` function, but will try to
|
|
37231
|
+
// parse anything as JavaScript, repairing syntax error the best it
|
|
37232
|
+
// can. There are circumstances in which it will raise an error and
|
|
37233
|
+
// give up, but they are very rare. The resulting AST will be a mostly
|
|
37234
|
+
// valid JavaScript AST (as per the [ESTree spec][estree], except
|
|
37235
|
+
// that:
|
|
37236
|
+
//
|
|
37237
|
+
// - Return outside functions is allowed
|
|
37238
|
+
//
|
|
37239
|
+
// - Label consistency (no conflicts, break only to existing labels)
|
|
37240
|
+
// is not enforced.
|
|
37241
|
+
//
|
|
37242
|
+
// - Bogus Identifier nodes with a name of `"✖"` are inserted whenever
|
|
37243
|
+
// the parser got too confused to return anything meaningful.
|
|
37244
|
+
//
|
|
37245
|
+
// [estree]: https://github.com/estree/estree
|
|
37246
|
+
//
|
|
37247
|
+
// The expected use for this is to *first* try `acorn.parse`, and only
|
|
37248
|
+
// if that fails switch to the loose parser. The loose parser might
|
|
37249
|
+
// parse badly indented code incorrectly, so **don't** use it as your
|
|
37250
|
+
// default parser.
|
|
37251
|
+
//
|
|
37252
|
+
// Quite a lot of acorn.js is duplicated here. The alternative was to
|
|
37253
|
+
// add a *lot* of extra cruft to that file, making it less readable
|
|
37254
|
+
// and slower. Copying and editing the code allowed me to make
|
|
37255
|
+
// invasive changes and simplifications without creating a complicated
|
|
37256
|
+
// tangle.
|
|
37257
|
+
|
|
37258
|
+
|
|
37259
|
+
defaultOptions.tabSize = 4;
|
|
37260
|
+
|
|
37261
|
+
function parse(input, options) {
|
|
37262
|
+
return LooseParser.parse(input, options)
|
|
37263
|
+
}
|
|
37264
|
+
|
|
35630
37265
|
// AST walker module for ESTree compatible trees
|
|
35631
37266
|
|
|
35632
37267
|
// A simple walk is one where you simply specify callbacks to be
|
|
@@ -35914,13 +37549,24 @@ base.MethodDefinition = base.PropertyDefinition = base.Property = function (node
|
|
|
35914
37549
|
function getAcornParsedNodes(input) {
|
|
35915
37550
|
var parsedNode = null;
|
|
35916
37551
|
try {
|
|
35917
|
-
parsedNode = parse(input, {
|
|
37552
|
+
parsedNode = parse$1(input, {
|
|
35918
37553
|
ecmaVersion: 'latest',
|
|
35919
37554
|
sourceType: 'module',
|
|
35920
37555
|
locations: true
|
|
35921
37556
|
});
|
|
35922
37557
|
}
|
|
35923
|
-
catch (_a) {
|
|
37558
|
+
catch (_a) {
|
|
37559
|
+
// attempt parse with more error-tolerant parser.
|
|
37560
|
+
// handles rules with both shared code and top-level
|
|
37561
|
+
// return, which is technically invalid syntax
|
|
37562
|
+
try {
|
|
37563
|
+
parsedNode = parse(input, {
|
|
37564
|
+
ecmaVersion: 'latest',
|
|
37565
|
+
locations: true
|
|
37566
|
+
});
|
|
37567
|
+
}
|
|
37568
|
+
catch (_b) { }
|
|
37569
|
+
}
|
|
35924
37570
|
return parsedNode;
|
|
35925
37571
|
}
|
|
35926
37572
|
function extractReferencedIdentifiers(bodyNode) {
|
|
@@ -36064,8 +37710,10 @@ function extractJsElements(code) {
|
|
|
36064
37710
|
var exportFunctions = [];
|
|
36065
37711
|
var exportVariables = [];
|
|
36066
37712
|
var parsedNodes = getAcornParsedNodes(code);
|
|
36067
|
-
if (!parsedNodes)
|
|
37713
|
+
if (!parsedNodes) {
|
|
37714
|
+
console.warn('Failed to parse logic rule code');
|
|
36068
37715
|
return { exportVariables: exportVariables, exportFunctions: exportFunctions };
|
|
37716
|
+
}
|
|
36069
37717
|
// Helper: turn a param node into its original text
|
|
36070
37718
|
var paramText = function (p) { return code.slice(p.start, p.end); };
|
|
36071
37719
|
// Helper: build function signature and body from FunctionExpression or ArrowFunctionExpression
|
|
@@ -38519,13 +40167,28 @@ function Form(_a) {
|
|
|
38519
40167
|
}
|
|
38520
40168
|
});
|
|
38521
40169
|
}); };
|
|
40170
|
+
var tableOnClick = function (table, payload) { return __awaiter$2(_this, void 0, void 0, function () {
|
|
40171
|
+
return __generator(this, function (_a) {
|
|
40172
|
+
switch (_a.label) {
|
|
40173
|
+
case 0: return [4 /*yield*/, runElementActions({
|
|
40174
|
+
actions: [],
|
|
40175
|
+
element: table,
|
|
40176
|
+
elementType: 'table',
|
|
40177
|
+
triggerPayload: payload
|
|
40178
|
+
})];
|
|
40179
|
+
case 1:
|
|
40180
|
+
_a.sent();
|
|
40181
|
+
return [2 /*return*/];
|
|
40182
|
+
}
|
|
40183
|
+
});
|
|
40184
|
+
}); };
|
|
38522
40185
|
// Orchestrates all actions triggered by a button/element click.
|
|
38523
40186
|
// Runs validations and submission first (if submit=true), then executes click actions in order.
|
|
38524
40187
|
// Prevents race conditions by locking element during execution and tracking global button state.
|
|
38525
40188
|
// Some actions (Persona, Plaid, etc) require special handling: they pause execution and
|
|
38526
40189
|
// provide a callback for continuing to the next action once they complete.
|
|
38527
40190
|
var runElementActions = function (_a) {
|
|
38528
|
-
var actions = _a.actions, element = _a.element, elementType = _a.elementType, _b = _a.submit, submit = _b === void 0 ? false : _b, _c = _a.setElementError, setElementError = _c === void 0 ? function () { } : _c, _d = _a.onAsyncEnd, onAsyncEnd = _d === void 0 ? function () { } : _d, textSpanStart = _a.textSpanStart, textSpanEnd = _a.textSpanEnd;
|
|
40191
|
+
var actions = _a.actions, element = _a.element, elementType = _a.elementType, _b = _a.submit, submit = _b === void 0 ? false : _b, _c = _a.setElementError, setElementError = _c === void 0 ? function () { } : _c, _d = _a.onAsyncEnd, onAsyncEnd = _d === void 0 ? function () { } : _d, textSpanStart = _a.textSpanStart, textSpanEnd = _a.textSpanEnd, triggerPayload = _a.triggerPayload;
|
|
38529
40192
|
return __awaiter$2(_this, void 0, void 0, function () {
|
|
38530
40193
|
var id, metadata, trigger, submitPromise, pendingFileKeys, invalid, hasNext, submissionResult, error_3, _e, stepPromise, flowOnSuccess, actionTypes, runAction, i, hasExtractions, hasEnvelopeGeneration, _loop_1, state_1;
|
|
38531
40194
|
var _this = this;
|
|
@@ -38549,7 +40212,7 @@ function Form(_a) {
|
|
|
38549
40212
|
start: textSpanStart,
|
|
38550
40213
|
end: textSpanEnd
|
|
38551
40214
|
};
|
|
38552
|
-
trigger = exports.__assign(exports.__assign({}, lookUpTrigger(activeStep, elementType === 'container' ? element.key : element.id, elementType)), { repeatIndex: element.repeat });
|
|
40215
|
+
trigger = exports.__assign(exports.__assign({}, lookUpTrigger(activeStep, elementType === 'container' ? element.key : element.id, elementType, triggerPayload)), { repeatIndex: element.repeat });
|
|
38553
40216
|
submitPromise = Promise.resolve();
|
|
38554
40217
|
if (!(submit && !readOnly)) return [3 /*break*/, 7];
|
|
38555
40218
|
// Do not proceed until user has gone through required flows
|
|
@@ -38650,7 +40313,8 @@ function Form(_a) {
|
|
|
38650
40313
|
setElementError: setElementError,
|
|
38651
40314
|
onAsyncEnd: onAsyncEnd,
|
|
38652
40315
|
textSpanStart: textSpanStart,
|
|
38653
|
-
textSpanEnd: textSpanEnd
|
|
40316
|
+
textSpanEnd: textSpanEnd,
|
|
40317
|
+
triggerPayload: triggerPayload
|
|
38654
40318
|
})];
|
|
38655
40319
|
case 1:
|
|
38656
40320
|
running = _a.sent();
|
|
@@ -39425,6 +41089,7 @@ function Form(_a) {
|
|
|
39425
41089
|
customClickSelectionState: customClickSelectionState,
|
|
39426
41090
|
runElementActions: runElementActions,
|
|
39427
41091
|
buttonOnClick: buttonOnClick,
|
|
41092
|
+
tableOnClick: tableOnClick,
|
|
39428
41093
|
fieldOnChange: fieldOnChange,
|
|
39429
41094
|
buttonLoaders: buttonLoaders,
|
|
39430
41095
|
inlineErrors: inlineErrors,
|
|
@@ -42307,6 +43972,112 @@ function loadQRScanner() {
|
|
|
42307
43972
|
exports.qrPromise = dynamicImport(QR_SCANNER_LIB_URL);
|
|
42308
43973
|
}
|
|
42309
43974
|
|
|
43975
|
+
/**
|
|
43976
|
+
* Event queue for holding events before user interaction
|
|
43977
|
+
*/
|
|
43978
|
+
var EventQueue = /** @class */ (function () {
|
|
43979
|
+
function EventQueue() {
|
|
43980
|
+
this.queue = [];
|
|
43981
|
+
this.isReplaying = false;
|
|
43982
|
+
}
|
|
43983
|
+
EventQueue.prototype.enqueue = function (eventData) {
|
|
43984
|
+
var _this = this;
|
|
43985
|
+
return new Promise(function (resolve, reject) {
|
|
43986
|
+
_this.queue.push({
|
|
43987
|
+
eventData: eventData,
|
|
43988
|
+
timestamp: Date.now(),
|
|
43989
|
+
resolve: resolve,
|
|
43990
|
+
reject: reject
|
|
43991
|
+
});
|
|
43992
|
+
});
|
|
43993
|
+
};
|
|
43994
|
+
EventQueue.prototype.getAll = function () {
|
|
43995
|
+
return this.queue;
|
|
43996
|
+
};
|
|
43997
|
+
EventQueue.prototype.clear = function () {
|
|
43998
|
+
this.queue = [];
|
|
43999
|
+
};
|
|
44000
|
+
EventQueue.prototype.isEmpty = function () {
|
|
44001
|
+
return this.queue.length === 0;
|
|
44002
|
+
};
|
|
44003
|
+
EventQueue.prototype.size = function () {
|
|
44004
|
+
return this.queue.length;
|
|
44005
|
+
};
|
|
44006
|
+
EventQueue.prototype.isReplayingEvents = function () {
|
|
44007
|
+
return this.isReplaying;
|
|
44008
|
+
};
|
|
44009
|
+
EventQueue.prototype.setReplayState = function (replaying) {
|
|
44010
|
+
this.isReplaying = replaying;
|
|
44011
|
+
};
|
|
44012
|
+
/**
|
|
44013
|
+
* Apply replay function to all queued events
|
|
44014
|
+
* @param replayFn Function to call for each event
|
|
44015
|
+
*/
|
|
44016
|
+
EventQueue.prototype.replayAll = function (replayFn) {
|
|
44017
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
44018
|
+
var eventsToReplay, eventsToReplay_1, eventsToReplay_1_1, queuedEvent, result, error_1, e_1_1;
|
|
44019
|
+
var e_1, _a;
|
|
44020
|
+
return __generator(this, function (_b) {
|
|
44021
|
+
switch (_b.label) {
|
|
44022
|
+
case 0:
|
|
44023
|
+
if (this.isEmpty())
|
|
44024
|
+
return [2 /*return*/];
|
|
44025
|
+
this.setReplayState(true);
|
|
44026
|
+
_b.label = 1;
|
|
44027
|
+
case 1:
|
|
44028
|
+
_b.trys.push([1, , 14, 15]);
|
|
44029
|
+
_b.label = 2;
|
|
44030
|
+
case 2:
|
|
44031
|
+
if (!!this.isEmpty()) return [3 /*break*/, 13];
|
|
44032
|
+
eventsToReplay = __spreadArray([], __read(this.queue), false);
|
|
44033
|
+
this.queue = [];
|
|
44034
|
+
_b.label = 3;
|
|
44035
|
+
case 3:
|
|
44036
|
+
_b.trys.push([3, 10, 11, 12]);
|
|
44037
|
+
eventsToReplay_1 = (e_1 = void 0, __values(eventsToReplay)), eventsToReplay_1_1 = eventsToReplay_1.next();
|
|
44038
|
+
_b.label = 4;
|
|
44039
|
+
case 4:
|
|
44040
|
+
if (!!eventsToReplay_1_1.done) return [3 /*break*/, 9];
|
|
44041
|
+
queuedEvent = eventsToReplay_1_1.value;
|
|
44042
|
+
_b.label = 5;
|
|
44043
|
+
case 5:
|
|
44044
|
+
_b.trys.push([5, 7, , 8]);
|
|
44045
|
+
return [4 /*yield*/, replayFn(queuedEvent.eventData)];
|
|
44046
|
+
case 6:
|
|
44047
|
+
result = _b.sent();
|
|
44048
|
+
queuedEvent.resolve(result);
|
|
44049
|
+
return [3 /*break*/, 8];
|
|
44050
|
+
case 7:
|
|
44051
|
+
error_1 = _b.sent();
|
|
44052
|
+
queuedEvent.reject(error_1);
|
|
44053
|
+
return [3 /*break*/, 8];
|
|
44054
|
+
case 8:
|
|
44055
|
+
eventsToReplay_1_1 = eventsToReplay_1.next();
|
|
44056
|
+
return [3 /*break*/, 4];
|
|
44057
|
+
case 9: return [3 /*break*/, 12];
|
|
44058
|
+
case 10:
|
|
44059
|
+
e_1_1 = _b.sent();
|
|
44060
|
+
e_1 = { error: e_1_1 };
|
|
44061
|
+
return [3 /*break*/, 12];
|
|
44062
|
+
case 11:
|
|
44063
|
+
try {
|
|
44064
|
+
if (eventsToReplay_1_1 && !eventsToReplay_1_1.done && (_a = eventsToReplay_1.return)) _a.call(eventsToReplay_1);
|
|
44065
|
+
}
|
|
44066
|
+
finally { if (e_1) throw e_1.error; }
|
|
44067
|
+
return [7 /*endfinally*/];
|
|
44068
|
+
case 12: return [3 /*break*/, 2];
|
|
44069
|
+
case 13: return [3 /*break*/, 15];
|
|
44070
|
+
case 14:
|
|
44071
|
+
this.setReplayState(false);
|
|
44072
|
+
return [7 /*endfinally*/];
|
|
44073
|
+
case 15: return [2 /*return*/];
|
|
44074
|
+
}
|
|
44075
|
+
});
|
|
44076
|
+
});
|
|
44077
|
+
};
|
|
44078
|
+
return EventQueue;
|
|
44079
|
+
}());
|
|
44080
|
+
|
|
42310
44081
|
var API_URL_OPTIONS = {
|
|
42311
44082
|
local: 'http://localhost:8006/api/',
|
|
42312
44083
|
staging: 'https://staging.feathery.io/api/',
|
|
@@ -42381,6 +44152,10 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
42381
44152
|
var _this = this;
|
|
42382
44153
|
var _a, _b;
|
|
42383
44154
|
_this = _super.call(this, formKey, ignoreNetworkErrors, draft, bypassCDN) || this;
|
|
44155
|
+
/**
|
|
44156
|
+
* Queue for events triggered before user interaction
|
|
44157
|
+
*/
|
|
44158
|
+
_this.userEventQueue = new EventQueue();
|
|
42384
44159
|
/**
|
|
42385
44160
|
* `beforeunload` event handler that flushes the pending submit custom changes
|
|
42386
44161
|
* when a user is attempting to exit the page.
|
|
@@ -42416,8 +44191,39 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
42416
44191
|
var _a, _b;
|
|
42417
44192
|
return __awaiter$2(this, void 0, void 0, function () {
|
|
42418
44193
|
return __generator(this, function (_c) {
|
|
42419
|
-
|
|
42420
|
-
|
|
44194
|
+
switch (_c.label) {
|
|
44195
|
+
case 0:
|
|
44196
|
+
(_b = (_a = featheryWindow()).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, FEATHERY_INTERACTION_EVENT, this.handleInteraction);
|
|
44197
|
+
// replay queued events, then flush fields
|
|
44198
|
+
return [4 /*yield*/, this.replayQueuedEvents()];
|
|
44199
|
+
case 1:
|
|
44200
|
+
// replay queued events, then flush fields
|
|
44201
|
+
_c.sent();
|
|
44202
|
+
return [4 /*yield*/, this.submitCustom({}, { shouldFlush: true })];
|
|
44203
|
+
case 2:
|
|
44204
|
+
_c.sent();
|
|
44205
|
+
return [2 /*return*/];
|
|
44206
|
+
}
|
|
44207
|
+
});
|
|
44208
|
+
});
|
|
44209
|
+
};
|
|
44210
|
+
FeatheryClient.prototype.replayQueuedEvents = function () {
|
|
44211
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
44212
|
+
var _this = this;
|
|
44213
|
+
return __generator(this, function (_a) {
|
|
44214
|
+
switch (_a.label) {
|
|
44215
|
+
case 0:
|
|
44216
|
+
if (this.userEventQueue.isEmpty())
|
|
44217
|
+
return [2 /*return*/];
|
|
44218
|
+
return [4 /*yield*/, this.userEventQueue.replayAll(function (eventData) { return __awaiter$2(_this, void 0, void 0, function () {
|
|
44219
|
+
return __generator(this, function (_a) {
|
|
44220
|
+
return [2 /*return*/, this._registerEventInternal(eventData)];
|
|
44221
|
+
});
|
|
44222
|
+
}); })];
|
|
44223
|
+
case 1:
|
|
44224
|
+
_a.sent();
|
|
44225
|
+
return [2 /*return*/];
|
|
44226
|
+
}
|
|
42421
44227
|
});
|
|
42422
44228
|
});
|
|
42423
44229
|
};
|
|
@@ -43108,15 +44914,24 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
43108
44914
|
});
|
|
43109
44915
|
};
|
|
43110
44916
|
FeatheryClient.prototype.registerEvent = function (eventData) {
|
|
44917
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
44918
|
+
return __generator(this, function (_a) {
|
|
44919
|
+
if (this.draft)
|
|
44920
|
+
return [2 /*return*/];
|
|
44921
|
+
if (!isInteractionDetected() || this.userEventQueue.isReplayingEvents()) {
|
|
44922
|
+
return [2 /*return*/, this.userEventQueue.enqueue(eventData)];
|
|
44923
|
+
}
|
|
44924
|
+
return [2 /*return*/, this._registerEventInternal(eventData)];
|
|
44925
|
+
});
|
|
44926
|
+
});
|
|
44927
|
+
};
|
|
44928
|
+
FeatheryClient.prototype._registerEventInternal = function (eventData) {
|
|
43111
44929
|
return __awaiter$2(this, void 0, void 0, function () {
|
|
43112
44930
|
var _a, userId, collaboratorId, url, data, options, prom, stepKey, triggerEvent, eventPromise;
|
|
43113
44931
|
var _this = this;
|
|
43114
44932
|
return __generator(this, function (_b) {
|
|
43115
44933
|
switch (_b.label) {
|
|
43116
|
-
case 0:
|
|
43117
|
-
if (this.draft)
|
|
43118
|
-
return [2 /*return*/];
|
|
43119
|
-
return [4 /*yield*/, initFormsPromise];
|
|
44934
|
+
case 0: return [4 /*yield*/, initFormsPromise];
|
|
43120
44935
|
case 1:
|
|
43121
44936
|
_b.sent();
|
|
43122
44937
|
_a = initInfo(), userId = _a.userId, collaboratorId = _a.collaboratorId;
|
|
@@ -43628,9 +45443,9 @@ function init(sdkKey, options) {
|
|
|
43628
45443
|
if (runningInClient()) {
|
|
43629
45444
|
// Dynamically load libraries that must be client side
|
|
43630
45445
|
global.scriptjsLoadPromise = Promise.resolve().then(function () { return require(
|
|
43631
|
-
/* webpackChunkName: "scriptjs" */ './fthry_script.
|
|
45446
|
+
/* webpackChunkName: "scriptjs" */ './fthry_script.CpqGoZRW.js'); }).then(function (n) { return n.script; });
|
|
43632
45447
|
global.webfontloaderPromise = Promise.resolve().then(function () { return require(
|
|
43633
|
-
/* webpackChunkName: "webfontloader" */ './fthry_webfontloader.
|
|
45448
|
+
/* webpackChunkName: "webfontloader" */ './fthry_webfontloader.COsYlNwD.js'); }).then(function (n) { return n.webfontloader; });
|
|
43634
45449
|
// Client-side tracking logic
|
|
43635
45450
|
if (initState.userTracking === 'cookie') {
|
|
43636
45451
|
var cookieKey = "feathery-user-id-".concat(sdkKey);
|
|
@@ -43776,7 +45591,7 @@ function getFieldValues() {
|
|
|
43776
45591
|
return exports.__assign({}, exports.fieldValues);
|
|
43777
45592
|
}
|
|
43778
45593
|
function logFeatheryBadge() {
|
|
43779
|
-
console.log('%c Feathery %c v' + "2.
|
|
45594
|
+
console.log('%c Feathery %c v' + "2.15.1" + ' ', // replaced with real version during build
|
|
43780
45595
|
'background: #e2626e; color: white; padding: 2px 6px; border-radius: 3px 0 0 3px; font-weight: bold;', 'background: #fce7e9; color: #c5495a; padding: 2px 6px; border-radius: 0 3px 3px 0;');
|
|
43781
45596
|
}
|
|
43782
45597
|
|
|
@@ -43812,9 +45627,10 @@ var getABVariant = function (stepRes) {
|
|
|
43812
45627
|
return stepRes;
|
|
43813
45628
|
};
|
|
43814
45629
|
var getAllElements = function (step) {
|
|
43815
|
-
|
|
45630
|
+
var _a, _b;
|
|
45631
|
+
return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(step.progress_bars.map(function (e) { return [e, 'progress_bar']; })), false), __read(step.images.map(function (e) { return [e, 'image']; })), false), __read(step.videos.map(function (e) { return [e, 'video']; })), false), __read(((_b = (_a = step.tables) === null || _a === void 0 ? void 0 : _a.map(function (e) { return [e, 'table']; })) !== null && _b !== void 0 ? _b : [])), false), __read(step.texts.map(function (e) { return [e, 'text']; })), false), __read(step.buttons.map(function (e) { return [e, 'button']; })), false), __read(step.servar_fields.map(function (e) { return [e, 'field']; })), false), __read(step.subgrids.map(function (e) { return [e, 'subgrid']; })), false);
|
|
43816
45632
|
};
|
|
43817
|
-
var lookUpTrigger = function (step, elementID, type) {
|
|
45633
|
+
var lookUpTrigger = function (step, elementID, type, additionalPayload) {
|
|
43818
45634
|
var _a, _b;
|
|
43819
45635
|
var payload = {};
|
|
43820
45636
|
if (type === 'button') {
|
|
@@ -43834,7 +45650,12 @@ var lookUpTrigger = function (step, elementID, type) {
|
|
|
43834
45650
|
text: element.servar.name
|
|
43835
45651
|
};
|
|
43836
45652
|
}
|
|
43837
|
-
|
|
45653
|
+
else if (type === 'table') {
|
|
45654
|
+
// For tables, we don't look up additional properties from the step
|
|
45655
|
+
// All table-specific data is provided via additionalPayload
|
|
45656
|
+
payload = {};
|
|
45657
|
+
}
|
|
45658
|
+
return exports.__assign(exports.__assign({ id: elementID, type: type }, payload), additionalPayload);
|
|
43838
45659
|
};
|
|
43839
45660
|
/** Update the fieldValues cache with a backend session */
|
|
43840
45661
|
function updateSessionValues(session) {
|
|
@@ -45248,39 +47069,39 @@ breakpoint) {
|
|
|
45248
47069
|
return styles.getTarget('inner-container', undefined, viewport === 'mobile');
|
|
45249
47070
|
};
|
|
45250
47071
|
|
|
45251
|
-
var AddressLine1 = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "AddressField" */ './fthry_index.
|
|
45252
|
-
var ButtonGroupField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "ButtonGroupField" */ './fthry_index.
|
|
45253
|
-
var CheckboxField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "CheckboxField" */ './fthry_index.
|
|
47072
|
+
var AddressLine1 = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "AddressField" */ './fthry_index.JRP5lBfp.js'); }); });
|
|
47073
|
+
var ButtonGroupField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "ButtonGroupField" */ './fthry_index.DLnigFf3.js'); }); });
|
|
47074
|
+
var CheckboxField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "CheckboxField" */ './fthry_index.BJYH_2P6.js'); }); });
|
|
45254
47075
|
var CheckboxGroupField = React.lazy(function () {
|
|
45255
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "CheckboxGroupField" */ './fthry_index.
|
|
47076
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "CheckboxGroupField" */ './fthry_index.Bq3nU0FH.js'); });
|
|
45256
47077
|
});
|
|
45257
|
-
var ColorPickerField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "ColorPickerField" */ './fthry_index.
|
|
45258
|
-
var CustomField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "CustomField" */ './fthry_index.
|
|
47078
|
+
var ColorPickerField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "ColorPickerField" */ './fthry_index.WDI9ExUl.js'); }); });
|
|
47079
|
+
var CustomField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "CustomField" */ './fthry_index.CgMWWz7f.js'); }); });
|
|
45259
47080
|
var DateSelectorField = React.lazy(function () {
|
|
45260
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "DateSelectorField" */ './fthry_index.
|
|
47081
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "DateSelectorField" */ './fthry_index.By8RWuUY.js'); });
|
|
45261
47082
|
});
|
|
45262
|
-
var DropdownField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "DropdownField" */ './fthry_index.
|
|
47083
|
+
var DropdownField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "DropdownField" */ './fthry_index.CbfDILWu.js'); }); });
|
|
45263
47084
|
var DropdownMultiField = React.lazy(function () {
|
|
45264
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "DropdownMultiField" */ './fthry_index.
|
|
47085
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "DropdownMultiField" */ './fthry_index.DzpGyyn4.js'); });
|
|
45265
47086
|
});
|
|
45266
|
-
var FileUploadField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "FileUploadField" */ './fthry_index.
|
|
45267
|
-
var MatrixField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "MatrixField" */ './fthry_index.
|
|
45268
|
-
var PasswordField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PasswordField" */ './fthry_index.
|
|
47087
|
+
var FileUploadField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "FileUploadField" */ './fthry_index.Ci8dMyBp.js'); }); });
|
|
47088
|
+
var MatrixField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "MatrixField" */ './fthry_index.CrFjXWLg.js'); }); });
|
|
47089
|
+
var PasswordField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PasswordField" */ './fthry_index.Bd1HfYvE.js'); }); });
|
|
45269
47090
|
var PaymentMethodField = React.lazy(function () {
|
|
45270
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "PaymentMethodField" */ './fthry_PaymentMethodField.
|
|
47091
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "PaymentMethodField" */ './fthry_PaymentMethodField.NEoloWMI.js'); });
|
|
45271
47092
|
});
|
|
45272
|
-
var PhoneField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PhoneField" */ './fthry_index.
|
|
45273
|
-
var PinInputField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PinInputField" */ './fthry_index.
|
|
45274
|
-
var QRScanner = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "QRScanner" */ './fthry_index.
|
|
47093
|
+
var PhoneField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PhoneField" */ './fthry_index.BK_jaGHn.js'); }); });
|
|
47094
|
+
var PinInputField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PinInputField" */ './fthry_index.BqS0kCfh.js'); }); });
|
|
47095
|
+
var QRScanner = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "QRScanner" */ './fthry_index.Bb1R5GZK.js'); }); });
|
|
45275
47096
|
var RadioButtonGroupField = React.lazy(function () {
|
|
45276
47097
|
return Promise.resolve().then(function () { return require(
|
|
45277
|
-
/* webpackChunkName: "RadioButtonGroupField" */ './fthry_index.
|
|
47098
|
+
/* webpackChunkName: "RadioButtonGroupField" */ './fthry_index.DDjTLR_C.js'); });
|
|
45278
47099
|
});
|
|
45279
|
-
var RatingField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "RatingField" */ './fthry_index.
|
|
45280
|
-
var SignatureField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "SignatureField" */ './fthry_index.
|
|
45281
|
-
var SliderField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "SliderField" */ './fthry_index.
|
|
45282
|
-
var TextField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TextField" */ './fthry_index.
|
|
45283
|
-
var TextArea = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TextArea" */ './fthry_index.
|
|
47100
|
+
var RatingField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "RatingField" */ './fthry_index.GeYRayLh.js'); }); });
|
|
47101
|
+
var SignatureField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "SignatureField" */ './fthry_index.DXm31Dvn.js'); }); });
|
|
47102
|
+
var SliderField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "SliderField" */ './fthry_index.BgeTdwT5.js'); }); });
|
|
47103
|
+
var TextField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TextField" */ './fthry_index.E_vLB-7s.js'); }); });
|
|
47104
|
+
var TextArea = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TextArea" */ './fthry_index.D4rjZ-iU.js'); }); });
|
|
45284
47105
|
var Fields = {
|
|
45285
47106
|
AddressLine1: AddressLine1,
|
|
45286
47107
|
ButtonGroupField: ButtonGroupField,
|
|
@@ -45320,7 +47141,7 @@ var defaultBorderFields = [
|
|
|
45320
47141
|
'file_upload'
|
|
45321
47142
|
];
|
|
45322
47143
|
var DROPDOWN_Z_INDEX = 10;
|
|
45323
|
-
function applyFieldStyles
|
|
47144
|
+
function applyFieldStyles(field, styles) {
|
|
45324
47145
|
var type = field.servar.type;
|
|
45325
47146
|
styles.addTargets('fc', 'sub-fc', 'field', 'error', 'active', 'hover', 'disabled', 'tooltipIcon');
|
|
45326
47147
|
// For these fields, selector font colors
|
|
@@ -45655,7 +47476,7 @@ Object.entries(Fields).map(function (_a) {
|
|
|
45655
47476
|
whiteSpace: 'pre-wrap',
|
|
45656
47477
|
overflowWrap: 'anywhere'
|
|
45657
47478
|
} }, { children: servar.name }))) : null;
|
|
45658
|
-
var styles = React.useMemo(function () { return applyFieldStyles
|
|
47479
|
+
var styles = React.useMemo(function () { return applyFieldStyles(element, responsiveStyles); }, [element]);
|
|
45659
47480
|
return (jsx$1(Field, exports.__assign({ element: element, fieldLabel: fieldLabel, responsiveStyles: styles }, props)));
|
|
45660
47481
|
});
|
|
45661
47482
|
});
|
|
@@ -46049,7 +47870,7 @@ function ProgressBarElement(_a) {
|
|
|
46049
47870
|
var element = _a.element, responsiveStyles = _a.responsiveStyles, progress = _a.progress, _d = _a.curDepth, curDepth = _d === void 0 ? 1 : _d, _e = _a.maxDepth, maxDepth = _e === void 0 ? 1 : _e, _f = _a.elementProps, elementProps = _f === void 0 ? {} : _f, children = _a.children;
|
|
46050
47871
|
var styles = React.useMemo(function () { return applyProgressBarStyles(responsiveStyles); }, [responsiveStyles]);
|
|
46051
47872
|
var userProgress, userSegments;
|
|
46052
|
-
if (progress) {
|
|
47873
|
+
if (![null, undefined].includes(progress)) {
|
|
46053
47874
|
if (typeof progress === 'number') {
|
|
46054
47875
|
userProgress = progress;
|
|
46055
47876
|
}
|
|
@@ -46082,7 +47903,8 @@ var shimmerFields = [
|
|
|
46082
47903
|
'select',
|
|
46083
47904
|
'button_group',
|
|
46084
47905
|
'slider',
|
|
46085
|
-
'rating'
|
|
47906
|
+
'rating',
|
|
47907
|
+
'table_element'
|
|
46086
47908
|
];
|
|
46087
47909
|
var shimmer = keyframes$1(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 100% {\n transform: translateX(100%);\n }\n"], ["\n 100% {\n transform: translateX(100%);\n }\n"])));
|
|
46088
47910
|
var shimmerStyles = {
|
|
@@ -46101,8 +47923,8 @@ var shimmerStyles = {
|
|
|
46101
47923
|
animation: "".concat(shimmer, " 5s infinite")
|
|
46102
47924
|
}
|
|
46103
47925
|
};
|
|
46104
|
-
function
|
|
46105
|
-
var type =
|
|
47926
|
+
function applyStyles(element, styles) {
|
|
47927
|
+
var type = element._type;
|
|
46106
47928
|
styles.addTargets('fc', 'sub-fc', 'field');
|
|
46107
47929
|
styles.applyFontStyles('fc', false, true);
|
|
46108
47930
|
switch (type) {
|
|
@@ -46174,11 +47996,11 @@ function applyFieldStyles(field, styles) {
|
|
|
46174
47996
|
}
|
|
46175
47997
|
return styles;
|
|
46176
47998
|
}
|
|
46177
|
-
function
|
|
47999
|
+
function ElementSkeleton(_a) {
|
|
46178
48000
|
var _b, _c, _d;
|
|
46179
48001
|
var responsiveStyles = _a.responsiveStyles, element = _a.element;
|
|
46180
|
-
var type = element.
|
|
46181
|
-
var styles = React.useMemo(function () { return
|
|
48002
|
+
var type = element._type;
|
|
48003
|
+
var styles = React.useMemo(function () { return applyStyles(element, responsiveStyles); }, [element, responsiveStyles]);
|
|
46182
48004
|
var renderPinInput = function () {
|
|
46183
48005
|
var maxLength = element.servar.max_length || 6;
|
|
46184
48006
|
var pinDivs = [];
|
|
@@ -46202,6 +48024,15 @@ function FieldSkeleton(_a) {
|
|
|
46202
48024
|
else if (type === 'qr_scanner') {
|
|
46203
48025
|
heightAdjust.height = '166px'; // hardcode qr scanner height
|
|
46204
48026
|
}
|
|
48027
|
+
if (!element.servar) {
|
|
48028
|
+
return (jsx$1("div", exports.__assign({ css: {
|
|
48029
|
+
maxWidth: '100%',
|
|
48030
|
+
width: '100%',
|
|
48031
|
+
height: '100%',
|
|
48032
|
+
position: 'relative',
|
|
48033
|
+
boxSizing: 'border-box'
|
|
48034
|
+
} }, { children: jsx$1("div", { css: exports.__assign(exports.__assign({ width: '100%', boxSizing: 'border-box' }, heightAdjust), shimmerStyles) }) })));
|
|
48035
|
+
}
|
|
46205
48036
|
return (jsx$1("div", exports.__assign({ css: exports.__assign({ maxWidth: '100%', width: '100%', height: '100%', position: 'relative', boxSizing: 'border-box' }, styles.getTarget('fc')) }, { children: type === 'pin_input' ? (jsx$1("div", exports.__assign({ css: {
|
|
46206
48037
|
display: 'flex',
|
|
46207
48038
|
alignItems: 'center',
|
|
@@ -46210,12 +48041,14 @@ function FieldSkeleton(_a) {
|
|
|
46210
48041
|
}
|
|
46211
48042
|
var templateObject_1;
|
|
46212
48043
|
|
|
48044
|
+
var TableElement = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TableElement" */ './fthry_index.CkmA933O.js'); }); });
|
|
46213
48045
|
var Basic = {
|
|
46214
48046
|
ImageElement: ImageElement,
|
|
46215
48047
|
VideoElement: VideoElement,
|
|
46216
48048
|
TextElement: TextElement,
|
|
46217
48049
|
ButtonElement: ButtonElement,
|
|
46218
|
-
ProgressBarElement: ProgressBarElement
|
|
48050
|
+
ProgressBarElement: ProgressBarElement,
|
|
48051
|
+
TableElement: TableElement
|
|
46219
48052
|
};
|
|
46220
48053
|
var Elements = exports.__assign(exports.__assign({}, Basic), Fields);
|
|
46221
48054
|
Object.entries(Elements).map(function (_a) {
|
|
@@ -46226,7 +48059,7 @@ Object.entries(Elements).map(function (_a) {
|
|
|
46226
48059
|
var responsiveStyles = React.useMemo(function () {
|
|
46227
48060
|
return new ResponsiveStyles(element, ['container'], !componentOnly, formSettings === null || formSettings === void 0 ? void 0 : formSettings.mobileBreakpoint);
|
|
46228
48061
|
}, [element, componentOnly, formSettings]);
|
|
46229
|
-
var featheryElement = (jsx$1(React.Suspense, exports.__assign({ fallback: jsx$1(
|
|
48062
|
+
var featheryElement = (jsx$1(React.Suspense, exports.__assign({ fallback: jsx$1(ElementSkeleton, { element: element, responsiveStyles: responsiveStyles }) }, { children: jsx$1(Element, exports.__assign({ element: element, responsiveStyles: responsiveStyles }, props)) })));
|
|
46230
48063
|
var e = onView ? (jsx$1(InView, exports.__assign({ onChange: onView }, { children: featheryElement }))) : (featheryElement);
|
|
46231
48064
|
if (componentOnly) {
|
|
46232
48065
|
return (jsxs(Fragment, { children: [children, e] }));
|