@verbb/formie-browser 1.0.13 → 1.0.15
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/CHANGELOG.md +80 -0
- package/dist/chunks/{address-country-Rx6GQTND.js → address-country-BcEQKw0T.js} +11 -5
- package/dist/chunks/{address-finder-k7_BXaRe.js → address-finder-BWGINCSA.js} +3 -3
- package/dist/chunks/address-state-DI3ndhMU.js +365 -0
- package/dist/chunks/{api-BUb6P-xu.js → api-BK9b340y.js} +93 -63
- package/dist/chunks/{api-DqpfkZWL.js → api-Dxl_CKw-.js} +202 -193
- package/dist/chunks/{api-sPqGbOww.js → api-ghNr2uxX.js} +15 -9
- package/dist/chunks/{async-nPFRNQ06.js → async-2GdXNFCE.js} +18 -1
- package/dist/chunks/{bpoint-Dlq34XH1.js → bpoint-BwtuyN_O.js} +3 -3
- package/dist/chunks/calculations-YEoVCG2q.js +310 -0
- package/dist/chunks/{captcha-eu-CGm8Lbrj.js → captcha-eu-DWLoQFKB.js} +6 -5
- package/dist/chunks/{checkbox-radio-BY2aTCOG.js → checkbox-radio-gsm8QPJg.js} +74 -75
- package/dist/chunks/{combobox-C0EuExSI.js → combobox-Ba08_cHL.js} +340 -328
- package/dist/chunks/conditions-Ceeg6ReZ.js +467 -0
- package/dist/chunks/country-from-ip-DDj_mFki.js +29 -0
- package/dist/chunks/csrf-DxHg_ZYt.js +61 -0
- package/dist/chunks/{custom-google-maps-BsaSirEZ.js → custom-google-maps-C4l2S3GO.js} +9 -3
- package/dist/chunks/{custom-link-CJ1-FjEM.js → custom-link-CLazgKYH.js} +8 -2
- package/dist/chunks/{custom-maps-DYW_pBid.js → custom-maps-DqcAlD0v.js} +10 -4
- package/dist/chunks/{date-picker-F9BUBDSW.js → date-picker-DaPvMrop.js} +467 -443
- package/dist/chunks/{dist-D6i-VNgM.js → dist-ZLeW0zZ3.js} +1281 -453
- package/dist/chunks/{eway-D9_m8ooj.js → eway-uw0DzU-L.js} +5 -5
- package/dist/chunks/field-references.resolver-Ca8MguFv.js +104 -0
- package/dist/chunks/{file-upload-rqfZNqlH.js → file-upload-B8_mH012.js} +119 -99
- package/dist/chunks/friendly-captcha-v1-CVXaXgDO.js +34 -0
- package/dist/chunks/{friendly-captcha-v2-CLSAbkqx.js → friendly-captcha-v2-DkeIVTKI.js} +6 -5
- package/dist/chunks/{friendly-challenge-8uPatWqk.js → friendly-challenge-DPG9MJb1.js} +111 -102
- package/dist/chunks/{go-cardless-DAT3ZaQf.js → go-cardless-c4wLJdOt.js} +2 -2
- package/dist/chunks/google-address-JHYvjwgN.js +168 -0
- package/dist/chunks/{hcaptcha-CGLAmgjO.js → hcaptcha-Dt3ELLlP.js} +4 -4
- package/dist/chunks/{hidden-D7_Ch-QN.js → hidden-BZhXnNPe.js} +8 -2
- package/dist/chunks/http-C2QdHuWO.js +27 -0
- package/dist/chunks/{leaflet-src-j-lHNmhR.js → leaflet-src-DE6rv6M-.js} +42 -46
- package/dist/chunks/{loqate-CJPzBmSm.js → loqate-m51iPyO1.js} +3 -3
- package/dist/chunks/{mollie-Bibhl67p.js → mollie-Bn0PX173.js} +2 -2
- package/dist/chunks/{moneris-H2wSqk9h.js → moneris-BRbUvI4t.js} +3 -3
- package/dist/chunks/opayo-BwWdInEP.js +188 -0
- package/dist/chunks/{paddle-DkvIxQdG.js → paddle-CympHVvd.js} +4 -4
- package/dist/chunks/{password-validation-D06uH9va.js → password-validation-C8_uO_c_.js} +18 -12
- package/dist/chunks/{paypal-CQpAF7Ua.js → paypal-h75h6wae.js} +8 -6
- package/dist/chunks/{payway-CwDkC7YZ.js → payway-C9rHTCC_.js} +4 -4
- package/dist/chunks/{phone-country-D3ayr60L.js → phone-country-B8fv-L5_.js} +80 -63
- package/dist/chunks/{place-kit-BGHklIZ-.js → place-kit-BnZGQ-L1.js} +11 -11
- package/dist/chunks/{placekit-autocomplete.esm-DWVabQlq.js → placekit-autocomplete.esm-CZZERYur.js} +11 -15
- package/dist/chunks/{recaptcha-enterprise-XPId5-bS.js → recaptcha-enterprise-CUs8BO6V.js} +4 -4
- package/dist/chunks/{recaptcha-shared-CLYJvojk.js → recaptcha-shared-DTbTw-MF.js} +2 -2
- package/dist/chunks/{recaptcha-v2-checkbox-Cy-0PEPc.js → recaptcha-v2-checkbox-P1McW4Pv.js} +4 -4
- package/dist/chunks/{recaptcha-v2-invisible-BwRH540O.js → recaptcha-v2-invisible-FGDqozSP.js} +4 -4
- package/dist/chunks/{recaptcha-v3-No4Ykrhk.js → recaptcha-v3-CflUHeZD.js} +4 -4
- package/dist/chunks/{repeater-BVnPUqTj.js → repeater-CyhDbozO.js} +60 -40
- package/dist/chunks/request-profile-DhwkeCpS.js +10 -0
- package/dist/chunks/rich-text-uV4o_pGk.js +361 -0
- package/dist/chunks/{chunk-3b4jIN3o.js → rolldown-runtime-DtPi1Y-2.js} +2 -2
- package/dist/chunks/{scripts-CbQ7agX3.js → scripts-DrccjrFv.js} +1 -1
- package/dist/chunks/{sdk-BhHAYgga.js → sdk-lkwSvlpM.js} +282 -234
- package/dist/chunks/{shared-Bx9s0i0P.js → shared-OKhSay59.js} +27 -21
- package/dist/chunks/{signature-IOhuicje.js → signature-7cldFbqj.js} +138 -112
- package/dist/chunks/skip-CEW89ExY.js +7 -0
- package/dist/chunks/{snaptcha-DKx98oon.js → snaptcha-C3QLYxFT.js} +2 -2
- package/dist/chunks/{square-DwdcOI1G.js → square-C1z5DPVw.js} +9 -7
- package/dist/chunks/{stripe-DaoG2FT1.js → stripe-Dmkdkq1y.js} +11 -12
- package/dist/chunks/{summary-Dks0gXS3.js → summary-Bn-g5SDx.js} +48 -46
- package/dist/chunks/{survey-likert-DkE6bR7B.js → survey-likert-fk1hUPff.js} +7 -1
- package/dist/chunks/{survey-rank-DN6x4IZM.js → survey-rank-BsLGl2LX.js} +37 -25
- package/dist/chunks/{survey-rating-BnsNL9U5.js → survey-rating-DVS6e6fM.js} +17 -5
- package/dist/chunks/{table-CAjCJHrL.js → table-j7MlLLCc.js} +22 -16
- package/dist/chunks/{text-limit-BGaY0jhI.js → text-limit-LGMPhFuC.js} +40 -34
- package/dist/chunks/{theme-classes-Tv7q7ToE.js → theme-classes-DAQuEqdP.js} +1 -1
- package/dist/chunks/{turnstile-DJakPzQD.js → turnstile-ptihQfLl.js} +4 -4
- package/dist/chunks/{upload-manager-W-QDgxKD.js → upload-manager-BW7l-BhF.js} +459 -387
- package/dist/chunks/{utils-Vqp8i_RM.js → utils-DpUBPadZ.js} +20 -14
- package/dist/css/formie-base.css +104 -1
- package/dist/css/theme/_messages.css +2 -0
- package/dist/css/theme/_tokens.css +31 -25
- package/dist/css/theme/forms/_form.css +5 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1779 -1415
- package/dist/js/contracts/client.d.ts +5 -3
- package/dist/js/contracts/client.d.ts.map +1 -1
- package/dist/js/contracts/common.d.ts +2 -2
- package/dist/js/contracts/common.d.ts.map +1 -1
- package/dist/js/contracts/modules.d.ts +37 -12
- package/dist/js/contracts/modules.d.ts.map +1 -1
- package/dist/js/contracts/schema.d.ts +20 -38
- package/dist/js/contracts/schema.d.ts.map +1 -1
- package/dist/js/contracts/theme.d.ts +4 -1
- package/dist/js/contracts/theme.d.ts.map +1 -1
- package/dist/js/core/client-rendered-modules.d.ts +17 -0
- package/dist/js/core/client-rendered-modules.d.ts.map +1 -0
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/field-error-aria.d.ts +23 -0
- package/dist/js/core/field-error-aria.d.ts.map +1 -0
- package/dist/js/core/hydrate-modules.d.ts +10 -8
- package/dist/js/core/hydrate-modules.d.ts.map +1 -1
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts +3 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/core/validation-focus.d.ts.map +1 -1
- package/dist/js/modules/address/address-finder.d.ts +1 -1
- package/dist/js/modules/address/address-finder.d.ts.map +1 -1
- package/dist/js/modules/address/factories.d.ts +3 -3
- package/dist/js/modules/address/factories.d.ts.map +1 -1
- package/dist/js/modules/address/google-address.d.ts +12 -1
- package/dist/js/modules/address/google-address.d.ts.map +1 -1
- package/dist/js/modules/address/index.d.ts +2 -2
- package/dist/js/modules/address/index.d.ts.map +1 -1
- package/dist/js/modules/address/loqate.d.ts +1 -1
- package/dist/js/modules/address/loqate.d.ts.map +1 -1
- package/dist/js/modules/address/place-kit.d.ts +1 -1
- package/dist/js/modules/address/place-kit.d.ts.map +1 -1
- package/dist/js/modules/captchas/captcha-eu.d.ts +1 -1
- package/dist/js/modules/captchas/captcha-eu.d.ts.map +1 -1
- package/dist/js/modules/captchas/factories.d.ts +11 -11
- package/dist/js/modules/captchas/factories.d.ts.map +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v1.d.ts +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v1.d.ts.map +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v2.d.ts +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v2.d.ts.map +1 -1
- package/dist/js/modules/captchas/hcaptcha.d.ts +1 -1
- package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -1
- package/dist/js/modules/captchas/index.d.ts +2 -2
- package/dist/js/modules/captchas/index.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-enterprise.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v3.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
- package/dist/js/modules/captchas/snaptcha.d.ts +1 -1
- package/dist/js/modules/captchas/snaptcha.d.ts.map +1 -1
- package/dist/js/modules/captchas/turnstile.d.ts +1 -1
- package/dist/js/modules/captchas/turnstile.d.ts.map +1 -1
- package/dist/js/modules/fields/address-country.d.ts +2 -2
- package/dist/js/modules/fields/address-country.d.ts.map +1 -1
- package/dist/js/modules/fields/address-state.d.ts +2 -2
- package/dist/js/modules/fields/address-state.d.ts.map +1 -1
- package/dist/js/modules/fields/calculations.d.ts +2 -2
- package/dist/js/modules/fields/calculations.d.ts.map +1 -1
- package/dist/js/modules/fields/checkbox-radio.d.ts +2 -2
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts +2 -2
- package/dist/js/modules/fields/combobox.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/config.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/effects.d.ts +1 -0
- package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/evaluator.d.ts +4 -1
- package/dist/js/modules/fields/conditions/evaluator.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/references.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/submission-context.d.ts +15 -0
- package/dist/js/modules/fields/conditions/submission-context.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/types.d.ts +3 -1
- package/dist/js/modules/fields/conditions/types.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/values.d.ts +1 -1
- package/dist/js/modules/fields/conditions/values.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions.d.ts +2 -2
- package/dist/js/modules/fields/conditions.d.ts.map +1 -1
- package/dist/js/modules/fields/custom-google-maps.d.ts +2 -2
- package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -1
- package/dist/js/modules/fields/custom-link.d.ts +2 -2
- package/dist/js/modules/fields/custom-link.d.ts.map +1 -1
- package/dist/js/modules/fields/custom-maps.d.ts +2 -2
- package/dist/js/modules/fields/custom-maps.d.ts.map +1 -1
- package/dist/js/modules/fields/date-picker.d.ts +2 -2
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts +2 -2
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/hidden.d.ts +2 -2
- package/dist/js/modules/fields/hidden.d.ts.map +1 -1
- package/dist/js/modules/fields/index.d.ts +2 -2
- package/dist/js/modules/fields/index.d.ts.map +1 -1
- package/dist/js/modules/fields/password-validation.d.ts +2 -2
- package/dist/js/modules/fields/password-validation.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts +2 -2
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/modules/fields/repeater.d.ts +2 -2
- package/dist/js/modules/fields/repeater.d.ts.map +1 -1
- package/dist/js/modules/fields/rich-text.d.ts +2 -2
- package/dist/js/modules/fields/rich-text.d.ts.map +1 -1
- package/dist/js/modules/fields/shared.d.ts +1 -0
- package/dist/js/modules/fields/shared.d.ts.map +1 -1
- package/dist/js/modules/fields/signature.d.ts +2 -2
- package/dist/js/modules/fields/signature.d.ts.map +1 -1
- package/dist/js/modules/fields/summary.d.ts +2 -2
- package/dist/js/modules/fields/summary.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-likert.d.ts +2 -2
- package/dist/js/modules/fields/survey-likert.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-rank.d.ts +2 -2
- package/dist/js/modules/fields/survey-rank.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-rating.d.ts +2 -2
- package/dist/js/modules/fields/survey-rating.d.ts.map +1 -1
- package/dist/js/modules/fields/table.d.ts +2 -2
- package/dist/js/modules/fields/table.d.ts.map +1 -1
- package/dist/js/modules/fields/text-limit.d.ts +2 -2
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts +2 -2
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
- package/dist/js/modules/loader.d.ts +10 -4
- package/dist/js/modules/loader.d.ts.map +1 -1
- package/dist/js/modules/payments/bpoint.d.ts +1 -1
- package/dist/js/modules/payments/bpoint.d.ts.map +1 -1
- package/dist/js/modules/payments/eway.d.ts +1 -1
- package/dist/js/modules/payments/eway.d.ts.map +1 -1
- package/dist/js/modules/payments/factories.d.ts +7 -7
- package/dist/js/modules/payments/factories.d.ts.map +1 -1
- package/dist/js/modules/payments/go-cardless.d.ts +1 -1
- package/dist/js/modules/payments/go-cardless.d.ts.map +1 -1
- package/dist/js/modules/payments/index.d.ts +2 -2
- package/dist/js/modules/payments/index.d.ts.map +1 -1
- package/dist/js/modules/payments/mollie.d.ts +1 -1
- package/dist/js/modules/payments/mollie.d.ts.map +1 -1
- package/dist/js/modules/payments/moneris.d.ts +1 -1
- package/dist/js/modules/payments/moneris.d.ts.map +1 -1
- package/dist/js/modules/payments/opayo.d.ts +1 -1
- package/dist/js/modules/payments/opayo.d.ts.map +1 -1
- package/dist/js/modules/payments/paddle.d.ts +1 -1
- package/dist/js/modules/payments/paddle.d.ts.map +1 -1
- package/dist/js/modules/payments/paypal.d.ts +1 -1
- package/dist/js/modules/payments/paypal.d.ts.map +1 -1
- package/dist/js/modules/payments/payway.d.ts +1 -1
- package/dist/js/modules/payments/payway.d.ts.map +1 -1
- package/dist/js/modules/payments/square.d.ts +1 -1
- package/dist/js/modules/payments/square.d.ts.map +1 -1
- package/dist/js/modules/payments/stripe.d.ts +1 -1
- package/dist/js/modules/payments/stripe.d.ts.map +1 -1
- package/dist/js/modules/payments/utils.d.ts +6 -0
- package/dist/js/modules/payments/utils.d.ts.map +1 -1
- package/dist/js/modules/registry.d.ts +6 -4
- package/dist/js/modules/registry.d.ts.map +1 -1
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/theme/browser-theme-state.generated.d.ts +24 -0
- package/dist/js/theme/browser-theme-state.generated.d.ts.map +1 -0
- package/dist/js/theme/theme-classes.d.ts +3 -3
- package/dist/js/theme/theme-classes.d.ts.map +1 -1
- package/dist/js/transport/forms-api.d.ts +5 -3
- package/dist/js/transport/forms-api.d.ts.map +1 -1
- package/dist/js/utils/async.d.ts +1 -0
- package/dist/js/utils/async.d.ts.map +1 -1
- package/dist/js/utils/country-from-ip.d.ts +2 -2
- package/dist/js/utils/country-from-ip.d.ts.map +1 -1
- package/dist/js/utils/csrf.d.ts +17 -0
- package/dist/js/utils/csrf.d.ts.map +1 -0
- package/dist/js/utils/field-references.parser.d.ts +1 -0
- package/dist/js/utils/field-references.parser.d.ts.map +1 -1
- package/dist/js/utils/field-references.resolver.d.ts.map +1 -1
- package/dist/js/utils/field-references.types.d.ts +1 -0
- package/dist/js/utils/field-references.types.d.ts.map +1 -1
- package/dist/js/utils/http.d.ts +3 -1
- package/dist/js/utils/http.d.ts.map +1 -1
- package/dist/js/utils/request-profile.d.ts +4 -0
- package/dist/js/utils/request-profile.d.ts.map +1 -0
- package/dist/js/utils/unload-warning.d.ts.map +1 -1
- package/dist/js/validation/rules/email.d.ts.map +1 -1
- package/dist/js/validation/rules/match.d.ts.map +1 -1
- package/dist/js/validation/rules/number.d.ts.map +1 -1
- package/dist/js/validation/rules/required.d.ts.map +1 -1
- package/dist/js/validation/rules/shared.d.ts.map +1 -1
- package/dist/js/validation/rules/url.d.ts.map +1 -1
- package/dist/js/validation/skip.d.ts +7 -0
- package/dist/js/validation/skip.d.ts.map +1 -0
- package/dist/js/validation/submit-readiness.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +43 -12
- package/src/css/formie-base.css +104 -1
- package/src/css/theme/_messages.css +2 -0
- package/src/css/theme/_tokens.css +31 -25
- package/src/css/theme/forms/_form.css +5 -1
- package/src/index.ts +13 -8
- package/src/js/contracts/client.ts +5 -3
- package/src/js/contracts/common.ts +5 -6
- package/src/js/contracts/modules.ts +41 -12
- package/src/js/contracts/schema.ts +21 -43
- package/src/js/contracts/theme.ts +6 -1
- package/src/js/core/client-rendered-modules.ts +69 -0
- package/src/js/core/create-formie-client.ts +132 -86
- package/src/js/core/field-error-aria.ts +93 -0
- package/src/js/core/hydrate-modules.ts +54 -29
- package/src/js/core/submit-result-state.ts +51 -45
- package/src/js/core/submit-result-ui.ts +25 -68
- package/src/js/core/validation-focus.ts +20 -20
- package/src/js/modules/address/address-finder.ts +1 -1
- package/src/js/modules/address/factories.ts +15 -13
- package/src/js/modules/address/google-address.ts +102 -40
- package/src/js/modules/address/index.ts +2 -2
- package/src/js/modules/address/loqate.ts +1 -1
- package/src/js/modules/address/place-kit.ts +14 -8
- package/src/js/modules/captchas/captcha-eu.ts +2 -2
- package/src/js/modules/captchas/factories.ts +66 -42
- package/src/js/modules/captchas/friendly-captcha-v1.ts +12 -2
- package/src/js/modules/captchas/friendly-captcha-v2.ts +4 -2
- package/src/js/modules/captchas/hcaptcha.ts +5 -5
- package/src/js/modules/captchas/index.ts +2 -2
- package/src/js/modules/captchas/recaptcha-enterprise.ts +2 -2
- package/src/js/modules/captchas/recaptcha-v2-checkbox.ts +3 -3
- package/src/js/modules/captchas/recaptcha-v2-invisible.ts +2 -2
- package/src/js/modules/captchas/recaptcha-v3.ts +2 -2
- package/src/js/modules/captchas/snaptcha.ts +1 -1
- package/src/js/modules/captchas/turnstile.ts +3 -3
- package/src/js/modules/fields/address-country.ts +11 -9
- package/src/js/modules/fields/address-state.ts +94 -35
- package/src/js/modules/fields/calculations.ts +5 -3
- package/src/js/modules/fields/checkbox-radio.ts +24 -42
- package/src/js/modules/fields/combobox.ts +28 -9
- package/src/js/modules/fields/conditions/config.ts +17 -20
- package/src/js/modules/fields/conditions/effects.ts +25 -29
- package/src/js/modules/fields/conditions/evaluator.ts +21 -29
- package/src/js/modules/fields/conditions/references.ts +16 -5
- package/src/js/modules/fields/conditions/submission-context.ts +80 -0
- package/src/js/modules/fields/conditions/types.ts +3 -1
- package/src/js/modules/fields/conditions/values.ts +31 -6
- package/src/js/modules/fields/conditions.ts +65 -18
- package/src/js/modules/fields/custom-google-maps.ts +5 -3
- package/src/js/modules/fields/custom-link.ts +5 -3
- package/src/js/modules/fields/custom-maps.ts +5 -3
- package/src/js/modules/fields/date-picker.ts +40 -7
- package/src/js/modules/fields/file-upload.ts +62 -23
- package/src/js/modules/fields/hidden.ts +5 -3
- package/src/js/modules/fields/index.ts +2 -2
- package/src/js/modules/fields/password-validation.ts +5 -3
- package/src/js/modules/fields/phone-country.ts +35 -8
- package/src/js/modules/fields/repeater.ts +60 -7
- package/src/js/modules/fields/rich-text.ts +20 -4
- package/src/js/modules/fields/shared.ts +13 -0
- package/src/js/modules/fields/signature.ts +24 -4
- package/src/js/modules/fields/summary.ts +8 -20
- package/src/js/modules/fields/survey-likert.ts +5 -3
- package/src/js/modules/fields/survey-rank.ts +21 -3
- package/src/js/modules/fields/survey-rating.ts +17 -3
- package/src/js/modules/fields/table.ts +5 -3
- package/src/js/modules/fields/text-limit.ts +5 -3
- package/src/js/modules/fields/upload-manager.ts +244 -67
- package/src/js/modules/loader.ts +345 -281
- package/src/js/modules/payments/bpoint.ts +2 -2
- package/src/js/modules/payments/eway.ts +2 -2
- package/src/js/modules/payments/factories.ts +53 -52
- package/src/js/modules/payments/go-cardless.ts +1 -1
- package/src/js/modules/payments/index.ts +2 -2
- package/src/js/modules/payments/mollie.ts +1 -1
- package/src/js/modules/payments/moneris.ts +2 -2
- package/src/js/modules/payments/opayo.ts +21 -8
- package/src/js/modules/payments/paddle.ts +10 -6
- package/src/js/modules/payments/payment.ts +22 -18
- package/src/js/modules/payments/paypal.ts +1 -1
- package/src/js/modules/payments/payway.ts +2 -2
- package/src/js/modules/payments/square.ts +2 -2
- package/src/js/modules/payments/stripe.ts +5 -5
- package/src/js/modules/payments/utils.ts +14 -0
- package/src/js/modules/registry.ts +19 -11
- package/src/js/submit/pipeline.ts +10 -11
- package/src/js/theme/browser-theme-state.generated.ts +25 -0
- package/src/js/theme/theme-classes.ts +3 -3
- package/src/js/transport/forms-api.ts +66 -67
- package/src/js/utils/async.ts +34 -0
- package/src/js/utils/country-from-ip.ts +14 -9
- package/src/js/utils/csrf.ts +136 -0
- package/src/js/utils/field-references.parser.ts +13 -113
- package/src/js/utils/field-references.resolver.ts +27 -64
- package/src/js/utils/field-references.row-scope.ts +1 -1
- package/src/js/utils/field-references.types.ts +1 -0
- package/src/js/utils/http.ts +5 -5
- package/src/js/utils/request-profile.ts +10 -0
- package/src/js/utils/unload-warning.ts +12 -4
- package/src/js/validation/rules/email.ts +3 -5
- package/src/js/validation/rules/match.ts +2 -1
- package/src/js/validation/rules/minmax.ts +4 -43
- package/src/js/validation/rules/number.ts +3 -47
- package/src/js/validation/rules/pattern.ts +3 -8
- package/src/js/validation/rules/required.ts +14 -1
- package/src/js/validation/rules/shared.ts +5 -1
- package/src/js/validation/rules/url.ts +3 -10
- package/src/js/validation/skip.ts +9 -0
- package/src/js/validation/submit-readiness.ts +9 -2
- package/src/js/validation/validator.ts +49 -61
- package/dist/chunks/address-state-BwE01m2_.js +0 -344
- package/dist/chunks/calculations-Dv3hYb8_.js +0 -299
- package/dist/chunks/conditions-CPH1snCx.js +0 -424
- package/dist/chunks/country-from-ip-BwxKaBuJ.js +0 -26
- package/dist/chunks/field-references.resolver-CHwn0G0L.js +0 -145
- package/dist/chunks/friendly-captcha-v1-C_2reOXr.js +0 -31
- package/dist/chunks/google-address-BH3Zhi06.js +0 -161
- package/dist/chunks/http-D-JExro7.js +0 -27
- package/dist/chunks/opayo-CR0DtsLa.js +0 -179
- package/dist/chunks/rich-text-Bg_--4TG.js +0 -349
- package/dist/js/modules/fields/conditions/transforms.d.ts +0 -3
- package/dist/js/modules/fields/conditions/transforms.d.ts.map +0 -1
- package/src/js/modules/fields/conditions/transforms.ts +0 -206
- package/src/js/modules/payments/stub-payment-module.ts +0 -87
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { n as e, t } from "./
|
|
2
|
-
import { a as n
|
|
3
|
-
import {
|
|
4
|
-
import { t as a } from "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { n as e, t } from "./rolldown-runtime-DtPi1Y-2.js";
|
|
2
|
+
import { a as n } from "./dist-ZLeW0zZ3.js";
|
|
3
|
+
import { a as r, r as i } from "./event-names-BCI2FLD8.js";
|
|
4
|
+
import { t as a } from "./debug-BV0DvdHx.js";
|
|
5
|
+
import { n as o, r as s, t as c } from "./csrf-DxHg_ZYt.js";
|
|
6
|
+
import { n as l } from "./http-C2QdHuWO.js";
|
|
7
|
+
import { t as u } from "./field-references.keys-58ZSTrCW.js";
|
|
8
|
+
import { t as d } from "./styles-BfoIZwJp.js";
|
|
9
|
+
import { l as f, n as p, u as m } from "./shared-OKhSay59.js";
|
|
7
10
|
//#region ../../node_modules/@uppy/utils/lib/NetworkError.js
|
|
8
|
-
var
|
|
11
|
+
var h = class extends Error {
|
|
9
12
|
cause;
|
|
10
13
|
isNetworkError;
|
|
11
14
|
request;
|
|
12
15
|
constructor(e, t = null) {
|
|
13
16
|
super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."), this.cause = e, this.isNetworkError = !0, this.request = t;
|
|
14
17
|
}
|
|
15
|
-
},
|
|
18
|
+
}, g = class {
|
|
16
19
|
#e;
|
|
17
20
|
#t = !1;
|
|
18
21
|
#n;
|
|
@@ -26,55 +29,55 @@ var u = class extends Error {
|
|
|
26
29
|
done() {
|
|
27
30
|
this.#t ||= (clearTimeout(this.#e), this.#e = void 0, !0);
|
|
28
31
|
}
|
|
29
|
-
},
|
|
30
|
-
function
|
|
31
|
-
let { body: n = null, headers: r = {}, method: i = "GET", onBeforeRequest: a =
|
|
32
|
+
}, _ = () => {};
|
|
33
|
+
function v(e, t = {}) {
|
|
34
|
+
let { body: n = null, headers: r = {}, method: i = "GET", onBeforeRequest: a = _, onUploadProgress: o = _, shouldRetry: s = () => !0, onAfterResponse: c = _, onTimeout: l = _, responseType: u, retries: d = 3, signal: f = null, timeout: p = 3e4, withCredentials: m = !1 } = t, v = (e) => .3 * 2 ** (e - 1) * 1e3, y = new g(p, l);
|
|
32
35
|
function b(t = 0) {
|
|
33
|
-
return new Promise(async (l,
|
|
34
|
-
let
|
|
35
|
-
s(
|
|
36
|
-
b(t + 1).then(l,
|
|
37
|
-
}, v(t)) : (y.done(),
|
|
36
|
+
return new Promise(async (l, p) => {
|
|
37
|
+
let g = new XMLHttpRequest(), _ = (e) => {
|
|
38
|
+
s(g) && t < d ? setTimeout(() => {
|
|
39
|
+
b(t + 1).then(l, p);
|
|
40
|
+
}, v(t)) : (y.done(), p(e));
|
|
38
41
|
};
|
|
39
|
-
|
|
42
|
+
g.open(i, e, !0), g.withCredentials = m, u && (g.responseType = u), g.onload = async () => {
|
|
40
43
|
try {
|
|
41
|
-
await c(
|
|
44
|
+
await c(g, t);
|
|
42
45
|
} catch (e) {
|
|
43
|
-
e.request =
|
|
46
|
+
e.request = g, _(e);
|
|
44
47
|
return;
|
|
45
48
|
}
|
|
46
|
-
|
|
47
|
-
b(t + 1).then(l,
|
|
48
|
-
}, v(t)) : (y.done(),
|
|
49
|
-
},
|
|
49
|
+
g.status >= 200 && g.status < 300 ? (y.done(), l(g)) : s(g) && t < d ? setTimeout(() => {
|
|
50
|
+
b(t + 1).then(l, p);
|
|
51
|
+
}, v(t)) : (y.done(), p(new h(g.statusText, g)));
|
|
52
|
+
}, g.onerror = () => _(new h(g.statusText, g)), g.upload.onprogress = (e) => {
|
|
50
53
|
y.progress(), o(e);
|
|
51
54
|
}, r && Object.keys(r).forEach((e) => {
|
|
52
|
-
|
|
55
|
+
g.setRequestHeader(e, r[e]);
|
|
53
56
|
});
|
|
54
57
|
function x() {
|
|
55
|
-
|
|
58
|
+
g.abort(), p(new DOMException("Aborted", "AbortError"));
|
|
56
59
|
}
|
|
57
|
-
if (
|
|
60
|
+
if (f?.addEventListener("abort", x), f?.aborted) {
|
|
58
61
|
x();
|
|
59
62
|
return;
|
|
60
63
|
}
|
|
61
|
-
await a(
|
|
64
|
+
await a(g, t), g.send(n);
|
|
62
65
|
});
|
|
63
66
|
}
|
|
64
67
|
return b();
|
|
65
68
|
}
|
|
66
69
|
//#endregion
|
|
67
70
|
//#region ../../node_modules/@uppy/utils/lib/fileFilters.js
|
|
68
|
-
var
|
|
69
|
-
function
|
|
70
|
-
return e.filter((e) => !
|
|
71
|
+
var y = (e) => "error" in e && !!e.error, b = (e) => e.progress.uploadComplete;
|
|
72
|
+
function x(e) {
|
|
73
|
+
return e.filter((e) => !y(e) && !b(e));
|
|
71
74
|
}
|
|
72
|
-
function
|
|
75
|
+
function S(e) {
|
|
73
76
|
return e.filter((e) => !e.progress?.uploadStarted || !e.isRestored);
|
|
74
77
|
}
|
|
75
78
|
//#endregion
|
|
76
79
|
//#region ../../node_modules/@uppy/utils/lib/getFileNameAndExtension.js
|
|
77
|
-
function
|
|
80
|
+
function C(e) {
|
|
78
81
|
let t = e.lastIndexOf(".");
|
|
79
82
|
return t === -1 || t === e.length - 1 ? {
|
|
80
83
|
name: e,
|
|
@@ -86,7 +89,7 @@ function v(e) {
|
|
|
86
89
|
}
|
|
87
90
|
//#endregion
|
|
88
91
|
//#region ../../node_modules/@uppy/utils/lib/mimeTypes.js
|
|
89
|
-
var
|
|
92
|
+
var w = {
|
|
90
93
|
__proto__: null,
|
|
91
94
|
md: "text/markdown",
|
|
92
95
|
markdown: "text/markdown",
|
|
@@ -143,63 +146,63 @@ var y = {
|
|
|
143
146
|
};
|
|
144
147
|
//#endregion
|
|
145
148
|
//#region ../../node_modules/@uppy/utils/lib/getFileType.js
|
|
146
|
-
function
|
|
149
|
+
function T(e) {
|
|
147
150
|
if (e.type) return e.type;
|
|
148
|
-
let t = e.name ?
|
|
149
|
-
return t && t in
|
|
151
|
+
let t = e.name ? C(e.name).extension?.toLowerCase() : null;
|
|
152
|
+
return t && t in w ? w[t] : "application/octet-stream";
|
|
150
153
|
}
|
|
151
154
|
//#endregion
|
|
152
155
|
//#region ../../node_modules/@uppy/utils/lib/generateFileID.js
|
|
153
|
-
function
|
|
156
|
+
function E(e) {
|
|
154
157
|
return e.charCodeAt(0).toString(32);
|
|
155
158
|
}
|
|
156
|
-
function
|
|
159
|
+
function D(e) {
|
|
157
160
|
let t = "";
|
|
158
|
-
return e.replace(/[^A-Z0-9]/gi, (e) => (t += `-${
|
|
161
|
+
return e.replace(/[^A-Z0-9]/gi, (e) => (t += `-${E(e)}`, "/")) + t;
|
|
159
162
|
}
|
|
160
|
-
function
|
|
163
|
+
function O(e, t) {
|
|
161
164
|
let n = t || "uppy";
|
|
162
|
-
return typeof e.name == "string" && (n += `-${
|
|
165
|
+
return typeof e.name == "string" && (n += `-${D(e.name.toLowerCase())}`), e.type !== void 0 && (n += `-${e.type}`), e.meta && typeof e.meta.relativePath == "string" && (n += `-${D(e.meta.relativePath.toLowerCase())}`), e.data?.size !== void 0 && (n += `-${e.data.size}`), e.data.lastModified !== void 0 && (n += `-${e.data.lastModified}`), n;
|
|
163
166
|
}
|
|
164
|
-
function
|
|
165
|
-
return !e.isRemote || !e.remote ? !1 : new Set([
|
|
167
|
+
function k(e) {
|
|
168
|
+
return !e.isRemote || !e.remote ? !1 : (/* @__PURE__ */ new Set([
|
|
166
169
|
"box",
|
|
167
170
|
"dropbox",
|
|
168
171
|
"drive",
|
|
169
172
|
"facebook",
|
|
170
173
|
"unsplash"
|
|
171
|
-
]).has(e.remote.provider);
|
|
174
|
+
])).has(e.remote.provider);
|
|
172
175
|
}
|
|
173
|
-
function
|
|
174
|
-
if (
|
|
175
|
-
let n =
|
|
176
|
-
return
|
|
176
|
+
function ee(e, t) {
|
|
177
|
+
if (k(e)) return e.id;
|
|
178
|
+
let n = T(e);
|
|
179
|
+
return O({
|
|
177
180
|
...e,
|
|
178
181
|
type: n
|
|
179
182
|
}, t);
|
|
180
183
|
}
|
|
181
184
|
//#endregion
|
|
182
185
|
//#region ../../node_modules/@uppy/utils/lib/getAllowedMetaFields.js
|
|
183
|
-
function
|
|
186
|
+
function A(e, t) {
|
|
184
187
|
return e === !0 ? Object.keys(t) : Array.isArray(e) ? e : [];
|
|
185
188
|
}
|
|
186
189
|
//#endregion
|
|
187
190
|
//#region ../../node_modules/@uppy/utils/lib/getTimeStamp.js
|
|
188
|
-
function
|
|
191
|
+
function j(e) {
|
|
189
192
|
return e < 10 ? `0${e}` : e.toString();
|
|
190
193
|
}
|
|
191
|
-
function
|
|
194
|
+
function M() {
|
|
192
195
|
let e = /* @__PURE__ */ new Date();
|
|
193
|
-
return `${
|
|
196
|
+
return `${j(e.getHours())}:${j(e.getMinutes())}:${j(e.getSeconds())}`;
|
|
194
197
|
}
|
|
195
198
|
//#endregion
|
|
196
199
|
//#region ../../node_modules/@uppy/utils/lib/isNetworkError.js
|
|
197
|
-
function
|
|
200
|
+
function N(e) {
|
|
198
201
|
return e ? e.readyState === 4 && e.status === 0 : !1;
|
|
199
202
|
}
|
|
200
203
|
//#endregion
|
|
201
204
|
//#region ../../node_modules/@uppy/utils/lib/TaskQueue.js
|
|
202
|
-
var
|
|
205
|
+
var te = class {
|
|
203
206
|
#e = [];
|
|
204
207
|
#t = 0;
|
|
205
208
|
#n;
|
|
@@ -296,26 +299,26 @@ var A = class {
|
|
|
296
299
|
};
|
|
297
300
|
//#endregion
|
|
298
301
|
//#region ../../node_modules/@uppy/utils/lib/Translator.js
|
|
299
|
-
function
|
|
302
|
+
function ne(e, t, n) {
|
|
300
303
|
let r = [];
|
|
301
304
|
return e.forEach((e) => typeof e == "string" ? t[Symbol.split](e).forEach((e, t, i) => {
|
|
302
305
|
e !== "" && r.push(e), t < i.length - 1 && r.push(n);
|
|
303
306
|
}) : r.push(e)), r;
|
|
304
307
|
}
|
|
305
|
-
function
|
|
308
|
+
function re(e, t) {
|
|
306
309
|
let n = /\$/g, r = [e];
|
|
307
310
|
if (t == null) return r;
|
|
308
311
|
for (let e of Object.keys(t)) if (e !== "_") {
|
|
309
312
|
let i = t[e];
|
|
310
|
-
typeof i == "string" && (i = n[Symbol.replace](i, "$$$$")), r =
|
|
313
|
+
typeof i == "string" && (i = n[Symbol.replace](i, "$$$$")), r = ne(r, RegExp(`%\\{${e}\\}`, "g"), i);
|
|
311
314
|
}
|
|
312
315
|
return r;
|
|
313
316
|
}
|
|
314
|
-
var
|
|
317
|
+
var ie = (e) => {
|
|
315
318
|
throw Error(`missing string: ${e}`);
|
|
316
|
-
},
|
|
319
|
+
}, P = class {
|
|
317
320
|
locale;
|
|
318
|
-
constructor(e, { onMissingKey: t =
|
|
321
|
+
constructor(e, { onMissingKey: t = ie } = {}) {
|
|
319
322
|
this.locale = {
|
|
320
323
|
strings: {},
|
|
321
324
|
pluralize(e) {
|
|
@@ -343,14 +346,14 @@ var te = (e) => {
|
|
|
343
346
|
if (n ??= (this.#e(e), e), typeof n == "object") {
|
|
344
347
|
if (t && t.smart_count !== void 0) {
|
|
345
348
|
let e = this.locale.pluralize(t.smart_count);
|
|
346
|
-
return
|
|
349
|
+
return re(n[e], t);
|
|
347
350
|
}
|
|
348
351
|
throw Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}");
|
|
349
352
|
}
|
|
350
353
|
if (typeof n != "string") throw Error("string was not a string");
|
|
351
|
-
return
|
|
354
|
+
return re(n, t);
|
|
352
355
|
}
|
|
353
|
-
},
|
|
356
|
+
}, F = class {
|
|
354
357
|
uppy;
|
|
355
358
|
opts;
|
|
356
359
|
id;
|
|
@@ -383,7 +386,7 @@ var te = (e) => {
|
|
|
383
386
|
}, this.setPluginState(void 0), this.i18nInit();
|
|
384
387
|
}
|
|
385
388
|
i18nInit() {
|
|
386
|
-
let e = new
|
|
389
|
+
let e = new P([
|
|
387
390
|
this.defaultLocale,
|
|
388
391
|
this.uppy.locale,
|
|
389
392
|
this.opts.locale
|
|
@@ -397,7 +400,7 @@ var te = (e) => {
|
|
|
397
400
|
uninstall() {}
|
|
398
401
|
update(e) {}
|
|
399
402
|
afterUpdate() {}
|
|
400
|
-
},
|
|
403
|
+
}, I = class {
|
|
401
404
|
#e;
|
|
402
405
|
#t = [];
|
|
403
406
|
constructor(e) {
|
|
@@ -449,15 +452,15 @@ var te = (e) => {
|
|
|
449
452
|
this.#e.getFile(e) && t();
|
|
450
453
|
});
|
|
451
454
|
}
|
|
452
|
-
},
|
|
455
|
+
}, ae = {
|
|
453
456
|
debug: () => {},
|
|
454
457
|
warn: () => {},
|
|
455
|
-
error: (...e) => console.error(`[Uppy] [${
|
|
456
|
-
},
|
|
457
|
-
debug: (...e) => console.debug(`[Uppy] [${
|
|
458
|
-
warn: (...e) => console.warn(`[Uppy] [${
|
|
459
|
-
error: (...e) => console.error(`[Uppy] [${
|
|
460
|
-
},
|
|
458
|
+
error: (...e) => console.error(`[Uppy] [${M()}]`, ...e)
|
|
459
|
+
}, oe = {
|
|
460
|
+
debug: (...e) => console.debug(`[Uppy] [${M()}]`, ...e),
|
|
461
|
+
warn: (...e) => console.warn(`[Uppy] [${M()}]`, ...e),
|
|
462
|
+
error: (...e) => console.error(`[Uppy] [${M()}]`, ...e)
|
|
463
|
+
}, se = /* @__PURE__ */ t(((e, t) => {
|
|
461
464
|
t.exports = function(e) {
|
|
462
465
|
if (typeof e != "number" || Number.isNaN(e)) throw TypeError(`Expected a number, got ${typeof e}`);
|
|
463
466
|
let t = e < 0, n = Math.abs(e);
|
|
@@ -475,27 +478,28 @@ var te = (e) => {
|
|
|
475
478
|
], i = Math.min(Math.floor(Math.log(n) / Math.log(1024)), r.length - 1), a = Number(n / 1024 ** i), o = r[i];
|
|
476
479
|
return `${a >= 10 || a % 1 == 0 ? Math.round(a) : a.toFixed(1)} ${o}`;
|
|
477
480
|
};
|
|
478
|
-
})),
|
|
481
|
+
})), ce = /* @__PURE__ */ t(((e, t) => {
|
|
479
482
|
function n(e, t) {
|
|
480
483
|
this.text = e ||= "", this.hasWild = ~e.indexOf("*"), this.separator = t, this.parts = e.split(t);
|
|
481
484
|
}
|
|
482
485
|
n.prototype.match = function(e) {
|
|
483
486
|
var t = !0, n = this.parts, r, i = n.length, a;
|
|
484
|
-
if (typeof e == "string" || e instanceof String)
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
487
|
+
if (typeof e == "string" || e instanceof String) {
|
|
488
|
+
if (!this.hasWild && this.text != e) t = !1;
|
|
489
|
+
else {
|
|
490
|
+
for (a = (e || "").split(this.separator), r = 0; t && r < i; r++) if (n[r] === "*") continue;
|
|
491
|
+
else t = r < a.length && n[r] === a[r];
|
|
492
|
+
t &&= a;
|
|
493
|
+
}
|
|
494
|
+
} else if (typeof e.splice == "function") for (t = [], r = e.length; r--;) this.match(e[r]) && (t[t.length] = e[r]);
|
|
491
495
|
else if (typeof e == "object") for (var o in t = {}, e) this.match(o) && (t[o] = e[o]);
|
|
492
496
|
return t;
|
|
493
497
|
}, t.exports = function(e, t, r) {
|
|
494
498
|
var i = new n(e, r || /[\/\.]/);
|
|
495
499
|
return t === void 0 ? i : i.match(t);
|
|
496
500
|
};
|
|
497
|
-
})),
|
|
498
|
-
var n =
|
|
501
|
+
})), le = /* @__PURE__ */ t(((e, t) => {
|
|
502
|
+
var n = ce(), r = /[\/\+\.]/;
|
|
499
503
|
t.exports = function(e, t) {
|
|
500
504
|
function i(t) {
|
|
501
505
|
var i = n(t, e, r);
|
|
@@ -503,7 +507,7 @@ var te = (e) => {
|
|
|
503
507
|
}
|
|
504
508
|
return t ? i(t.split(";")[0]) : i;
|
|
505
509
|
};
|
|
506
|
-
})),
|
|
510
|
+
})), L = /* @__PURE__ */ e(se(), 1), ue = /* @__PURE__ */ e(le(), 1), de = {
|
|
507
511
|
maxFileSize: null,
|
|
508
512
|
minFileSize: null,
|
|
509
513
|
maxTotalFileSize: null,
|
|
@@ -511,14 +515,14 @@ var te = (e) => {
|
|
|
511
515
|
minNumberOfFiles: null,
|
|
512
516
|
allowedFileTypes: null,
|
|
513
517
|
requiredMetaFields: []
|
|
514
|
-
},
|
|
518
|
+
}, R = class extends Error {
|
|
515
519
|
isUserFacing;
|
|
516
520
|
file;
|
|
517
521
|
constructor(e, t) {
|
|
518
522
|
super(e), this.isUserFacing = t?.isUserFacing ?? !0, t?.file && (this.file = t.file);
|
|
519
523
|
}
|
|
520
524
|
isRestriction = !0;
|
|
521
|
-
},
|
|
525
|
+
}, fe = class {
|
|
522
526
|
getI18n;
|
|
523
527
|
getOpts;
|
|
524
528
|
constructor(e, t) {
|
|
@@ -530,26 +534,26 @@ var te = (e) => {
|
|
|
530
534
|
}
|
|
531
535
|
validateAggregateRestrictions(e, t) {
|
|
532
536
|
let { maxTotalFileSize: n, maxNumberOfFiles: r } = this.getOpts().restrictions;
|
|
533
|
-
if (r && e.filter((e) => !e.isGhost).length + t.length > r) throw new
|
|
537
|
+
if (r && e.filter((e) => !e.isGhost).length + t.length > r) throw new R(`${this.getI18n()("youCanOnlyUploadX", { smart_count: r })}`);
|
|
534
538
|
if (n) {
|
|
535
539
|
let r = [...e, ...t].reduce((e, t) => e + (t.size ?? 0), 0);
|
|
536
|
-
if (r > n) throw new
|
|
537
|
-
sizeAllowed: (0,
|
|
538
|
-
size: (0,
|
|
540
|
+
if (r > n) throw new R(this.getI18n()("aggregateExceedsSize", {
|
|
541
|
+
sizeAllowed: (0, L.default)(n),
|
|
542
|
+
size: (0, L.default)(r)
|
|
539
543
|
}));
|
|
540
544
|
}
|
|
541
545
|
}
|
|
542
546
|
validateSingleFile(e) {
|
|
543
547
|
let { maxFileSize: t, minFileSize: n, allowedFileTypes: r } = this.getOpts().restrictions;
|
|
544
|
-
if (r && !r.some((t) => t.includes("/") ? e.type ? (0,
|
|
548
|
+
if (r && !r.some((t) => t.includes("/") ? e.type ? (0, ue.default)(e.type.replace(/;.*?$/, ""), t) : !1 : t[0] === "." && e.extension ? e.extension.toLowerCase() === t.slice(1).toLowerCase() : !1)) {
|
|
545
549
|
let t = r.join(", ");
|
|
546
|
-
throw new
|
|
550
|
+
throw new R(this.getI18n()("youCanOnlyUploadFileTypes", { types: t }), { file: e });
|
|
547
551
|
}
|
|
548
|
-
if (t && e.size != null && e.size > t) throw new
|
|
549
|
-
size: (0,
|
|
552
|
+
if (t && e.size != null && e.size > t) throw new R(this.getI18n()("exceedsSize", {
|
|
553
|
+
size: (0, L.default)(t),
|
|
550
554
|
file: e.name ?? this.getI18n()("unnamed")
|
|
551
555
|
}), { file: e });
|
|
552
|
-
if (n && e.size != null && e.size < n) throw new
|
|
556
|
+
if (n && e.size != null && e.size < n) throw new R(this.getI18n()("inferiorSize", { size: (0, L.default)(n) }), { file: e });
|
|
553
557
|
}
|
|
554
558
|
validate(e, t) {
|
|
555
559
|
t.forEach((e) => {
|
|
@@ -558,17 +562,17 @@ var te = (e) => {
|
|
|
558
562
|
}
|
|
559
563
|
validateMinNumberOfFiles(e) {
|
|
560
564
|
let { minNumberOfFiles: t } = this.getOpts().restrictions;
|
|
561
|
-
if (t && Object.keys(e).length < t) throw new
|
|
565
|
+
if (t && Object.keys(e).length < t) throw new R(this.getI18n()("youHaveToAtLeastSelectX", { smart_count: t }));
|
|
562
566
|
}
|
|
563
567
|
getMissingRequiredMetaFields(e) {
|
|
564
|
-
let t = new
|
|
568
|
+
let t = new R(this.getI18n()("missingRequiredMetaFieldOnFile", { fileName: e.name ?? this.getI18n()("unnamed") })), { requiredMetaFields: n } = this.getOpts().restrictions, r = [];
|
|
565
569
|
for (let t of n) (!Object.hasOwn(e.meta, t) || e.meta[t] === "") && r.push(t);
|
|
566
570
|
return {
|
|
567
571
|
missingFields: r,
|
|
568
572
|
error: t
|
|
569
573
|
};
|
|
570
574
|
}
|
|
571
|
-
},
|
|
575
|
+
}, pe = {
|
|
572
576
|
name: "@uppy/store-default",
|
|
573
577
|
description: "The default simple object-based store for Uppy.",
|
|
574
578
|
version: "5.0.0",
|
|
@@ -607,8 +611,8 @@ var te = (e) => {
|
|
|
607
611
|
"dist",
|
|
608
612
|
"CHANGELOG.md"
|
|
609
613
|
]
|
|
610
|
-
},
|
|
611
|
-
static VERSION =
|
|
614
|
+
}, me = class {
|
|
615
|
+
static VERSION = pe.version;
|
|
612
616
|
state = {};
|
|
613
617
|
#e = /* @__PURE__ */ new Set();
|
|
614
618
|
getState() {
|
|
@@ -631,39 +635,39 @@ var te = (e) => {
|
|
|
631
635
|
t(...e);
|
|
632
636
|
});
|
|
633
637
|
}
|
|
634
|
-
},
|
|
638
|
+
}, z = /* @__PURE__ */ t(((e, t) => {
|
|
635
639
|
function n(e) {
|
|
636
640
|
var t = typeof e;
|
|
637
641
|
return e != null && (t == "object" || t == "function");
|
|
638
642
|
}
|
|
639
643
|
t.exports = n;
|
|
640
|
-
})),
|
|
644
|
+
})), he = /* @__PURE__ */ t(((e, t) => {
|
|
641
645
|
t.exports = typeof global == "object" && global && global.Object === Object && global;
|
|
642
|
-
})),
|
|
643
|
-
var n =
|
|
646
|
+
})), ge = /* @__PURE__ */ t(((e, t) => {
|
|
647
|
+
var n = he(), r = typeof self == "object" && self && self.Object === Object && self;
|
|
644
648
|
t.exports = n || r || Function("return this")();
|
|
645
|
-
})),
|
|
646
|
-
var n =
|
|
649
|
+
})), _e = /* @__PURE__ */ t(((e, t) => {
|
|
650
|
+
var n = ge();
|
|
647
651
|
t.exports = function() {
|
|
648
652
|
return n.Date.now();
|
|
649
653
|
};
|
|
650
|
-
})),
|
|
654
|
+
})), ve = /* @__PURE__ */ t(((e, t) => {
|
|
651
655
|
var n = /\s/;
|
|
652
656
|
function r(e) {
|
|
653
657
|
for (var t = e.length; t-- && n.test(e.charAt(t)););
|
|
654
658
|
return t;
|
|
655
659
|
}
|
|
656
660
|
t.exports = r;
|
|
657
|
-
})),
|
|
658
|
-
var n =
|
|
661
|
+
})), ye = /* @__PURE__ */ t(((e, t) => {
|
|
662
|
+
var n = ve(), r = /^\s+/;
|
|
659
663
|
function i(e) {
|
|
660
664
|
return e && e.slice(0, n(e) + 1).replace(r, "");
|
|
661
665
|
}
|
|
662
666
|
t.exports = i;
|
|
663
|
-
})),
|
|
664
|
-
t.exports =
|
|
665
|
-
})),
|
|
666
|
-
var n =
|
|
667
|
+
})), be = /* @__PURE__ */ t(((e, t) => {
|
|
668
|
+
t.exports = ge().Symbol;
|
|
669
|
+
})), xe = /* @__PURE__ */ t(((e, t) => {
|
|
670
|
+
var n = be(), r = Object.prototype, i = r.hasOwnProperty, a = r.toString, o = n ? n.toStringTag : void 0;
|
|
667
671
|
function s(e) {
|
|
668
672
|
var t = i.call(e, o), n = e[o];
|
|
669
673
|
try {
|
|
@@ -674,31 +678,31 @@ var te = (e) => {
|
|
|
674
678
|
return r && (t ? e[o] = n : delete e[o]), s;
|
|
675
679
|
}
|
|
676
680
|
t.exports = s;
|
|
677
|
-
})),
|
|
681
|
+
})), Se = /* @__PURE__ */ t(((e, t) => {
|
|
678
682
|
var n = Object.prototype.toString;
|
|
679
683
|
function r(e) {
|
|
680
684
|
return n.call(e);
|
|
681
685
|
}
|
|
682
686
|
t.exports = r;
|
|
683
|
-
})),
|
|
684
|
-
var n =
|
|
687
|
+
})), Ce = /* @__PURE__ */ t(((e, t) => {
|
|
688
|
+
var n = be(), r = xe(), i = Se(), a = "[object Null]", o = "[object Undefined]", s = n ? n.toStringTag : void 0;
|
|
685
689
|
function c(e) {
|
|
686
690
|
return e == null ? e === void 0 ? o : a : s && s in Object(e) ? r(e) : i(e);
|
|
687
691
|
}
|
|
688
692
|
t.exports = c;
|
|
689
|
-
})),
|
|
693
|
+
})), we = /* @__PURE__ */ t(((e, t) => {
|
|
690
694
|
function n(e) {
|
|
691
695
|
return typeof e == "object" && !!e;
|
|
692
696
|
}
|
|
693
697
|
t.exports = n;
|
|
694
|
-
})),
|
|
695
|
-
var n =
|
|
698
|
+
})), Te = /* @__PURE__ */ t(((e, t) => {
|
|
699
|
+
var n = Ce(), r = we(), i = "[object Symbol]";
|
|
696
700
|
function a(e) {
|
|
697
701
|
return typeof e == "symbol" || r(e) && n(e) == i;
|
|
698
702
|
}
|
|
699
703
|
t.exports = a;
|
|
700
|
-
})),
|
|
701
|
-
var n =
|
|
704
|
+
})), Ee = /* @__PURE__ */ t(((e, t) => {
|
|
705
|
+
var n = ye(), r = z(), i = Te(), a = NaN, o = /^[-+]0x[0-9a-f]+$/i, s = /^0b[01]+$/i, c = /^0o[0-7]+$/i, l = parseInt;
|
|
702
706
|
function u(e) {
|
|
703
707
|
if (typeof e == "number") return e;
|
|
704
708
|
if (i(e)) return a;
|
|
@@ -712,8 +716,8 @@ var te = (e) => {
|
|
|
712
716
|
return u || c.test(e) ? l(e.slice(2), u ? 2 : 8) : o.test(e) ? a : +e;
|
|
713
717
|
}
|
|
714
718
|
t.exports = u;
|
|
715
|
-
})),
|
|
716
|
-
var n =
|
|
719
|
+
})), De = /* @__PURE__ */ t(((e, t) => {
|
|
720
|
+
var n = z(), r = _e(), i = Ee(), a = "Expected a function", o = Math.max, s = Math.min;
|
|
717
721
|
function c(e, t, c) {
|
|
718
722
|
var l, u, d, f, p, m, h = 0, g = !1, _ = !1, v = !0;
|
|
719
723
|
if (typeof e != "function") throw TypeError(a);
|
|
@@ -758,8 +762,8 @@ var te = (e) => {
|
|
|
758
762
|
return D.cancel = T, D.flush = E, D;
|
|
759
763
|
}
|
|
760
764
|
t.exports = c;
|
|
761
|
-
})),
|
|
762
|
-
var n =
|
|
765
|
+
})), Oe = /* @__PURE__ */ t(((e, t) => {
|
|
766
|
+
var n = De(), r = z(), i = "Expected a function";
|
|
763
767
|
function a(e, t, a) {
|
|
764
768
|
var o = !0, s = !0;
|
|
765
769
|
if (typeof e != "function") throw TypeError(i);
|
|
@@ -770,7 +774,7 @@ var te = (e) => {
|
|
|
770
774
|
});
|
|
771
775
|
}
|
|
772
776
|
t.exports = a;
|
|
773
|
-
})),
|
|
777
|
+
})), ke = /* @__PURE__ */ t(((e, t) => {
|
|
774
778
|
t.exports = function() {
|
|
775
779
|
var e = {}, t = e._fns = {};
|
|
776
780
|
e.emit = function(e, t, i, a, o, s, c) {
|
|
@@ -810,11 +814,11 @@ var te = (e) => {
|
|
|
810
814
|
}
|
|
811
815
|
return e;
|
|
812
816
|
};
|
|
813
|
-
})),
|
|
817
|
+
})), Ae = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", je = (e = 21) => {
|
|
814
818
|
let t = "", n = e | 0;
|
|
815
|
-
for (; n
|
|
819
|
+
for (; n-- > 0;) t += Ae[Math.random() * 64 | 0];
|
|
816
820
|
return t;
|
|
817
|
-
},
|
|
821
|
+
}, Me = {
|
|
818
822
|
name: "@uppy/core",
|
|
819
823
|
description: "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
|
|
820
824
|
version: "5.2.0",
|
|
@@ -876,12 +880,12 @@ var te = (e) => {
|
|
|
876
880
|
};
|
|
877
881
|
//#endregion
|
|
878
882
|
//#region ../../node_modules/@uppy/core/lib/getFileName.js
|
|
879
|
-
function
|
|
883
|
+
function Ne(e, t) {
|
|
880
884
|
return t.name ? t.name : e.split("/")[0] === "image" ? `${e.split("/")[0]}.${e.split("/")[1]}` : "noname";
|
|
881
885
|
}
|
|
882
886
|
//#endregion
|
|
883
887
|
//#region ../../node_modules/@uppy/core/lib/locale.js
|
|
884
|
-
var
|
|
888
|
+
var Pe = { strings: {
|
|
885
889
|
addBulkFilesFailed: {
|
|
886
890
|
0: "Failed to add %{smart_count} file due to an internal error",
|
|
887
891
|
1: "Failed to add %{smart_count} files due to internal errors"
|
|
@@ -945,7 +949,7 @@ var je = { strings: {
|
|
|
945
949
|
} };
|
|
946
950
|
//#endregion
|
|
947
951
|
//#region ../../node_modules/@uppy/core/lib/supportsUploadProgress.js
|
|
948
|
-
function
|
|
952
|
+
function Fe(e) {
|
|
949
953
|
if (e == null && typeof navigator < "u" && (e = navigator.userAgent), !e) return !0;
|
|
950
954
|
let t = /Edge\/(\d+\.\d+)/.exec(e);
|
|
951
955
|
if (!t) return !0;
|
|
@@ -954,17 +958,17 @@ function Me(e) {
|
|
|
954
958
|
}
|
|
955
959
|
//#endregion
|
|
956
960
|
//#region ../../node_modules/@uppy/core/lib/Uppy.js
|
|
957
|
-
var
|
|
961
|
+
var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
958
962
|
totalProgress: 0,
|
|
959
963
|
allowNewUpload: !0,
|
|
960
964
|
error: null,
|
|
961
965
|
recoveredState: null
|
|
962
|
-
},
|
|
963
|
-
static VERSION =
|
|
966
|
+
}, Re = class e {
|
|
967
|
+
static VERSION = Me.version;
|
|
964
968
|
#e = Object.create(null);
|
|
965
969
|
#t;
|
|
966
970
|
#n;
|
|
967
|
-
#r = (0,
|
|
971
|
+
#r = (0, Le.default)();
|
|
968
972
|
#i = /* @__PURE__ */ new Set();
|
|
969
973
|
#a = /* @__PURE__ */ new Set();
|
|
970
974
|
#o = /* @__PURE__ */ new Set();
|
|
@@ -977,18 +981,18 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
977
981
|
scheduledAutoProceed = null;
|
|
978
982
|
wasOffline = !1;
|
|
979
983
|
constructor(t) {
|
|
980
|
-
this.defaultLocale =
|
|
984
|
+
this.defaultLocale = Pe;
|
|
981
985
|
let n = {
|
|
982
986
|
id: "uppy",
|
|
983
987
|
autoProceed: !1,
|
|
984
988
|
allowMultipleUploadBatches: !0,
|
|
985
989
|
debug: !1,
|
|
986
|
-
restrictions:
|
|
990
|
+
restrictions: de,
|
|
987
991
|
meta: {},
|
|
988
992
|
onBeforeFileAdded: (e, t) => !Object.hasOwn(t, e.id),
|
|
989
993
|
onBeforeUpload: (e) => e,
|
|
990
|
-
store: new
|
|
991
|
-
logger:
|
|
994
|
+
store: new me(),
|
|
995
|
+
logger: ae,
|
|
992
996
|
infoTimeout: 5e3
|
|
993
997
|
}, r = {
|
|
994
998
|
...n,
|
|
@@ -1000,19 +1004,19 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1000
1004
|
...n.restrictions,
|
|
1001
1005
|
...t?.restrictions
|
|
1002
1006
|
}
|
|
1003
|
-
}, t?.logger && t.debug ? this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.", "warning") : t?.debug && (this.opts.logger =
|
|
1004
|
-
...
|
|
1007
|
+
}, t?.logger && t.debug ? this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.", "warning") : t?.debug && (this.opts.logger = oe), this.log(`Using Core v${e.VERSION}`), this.i18nInit(), this.store = this.opts.store, this.setState({
|
|
1008
|
+
...B,
|
|
1005
1009
|
plugins: {},
|
|
1006
1010
|
files: {},
|
|
1007
1011
|
currentUploads: {},
|
|
1008
1012
|
capabilities: {
|
|
1009
|
-
uploadProgress:
|
|
1013
|
+
uploadProgress: Fe(),
|
|
1010
1014
|
individualCancellation: !0,
|
|
1011
1015
|
resumableUploads: !1
|
|
1012
1016
|
},
|
|
1013
1017
|
meta: { ...this.opts.meta },
|
|
1014
1018
|
info: []
|
|
1015
|
-
}), this.#t = new
|
|
1019
|
+
}), this.#t = new fe(() => this.opts, () => this.i18n), this.#n = this.store.subscribe((e, t, n) => {
|
|
1016
1020
|
this.emit("state-update", e, t, n), this.updateAll(t);
|
|
1017
1021
|
}), this.opts.debug && typeof window < "u" && (window[this.opts.id] = this), this.#b();
|
|
1018
1022
|
}
|
|
@@ -1054,7 +1058,7 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1054
1058
|
this.patchFilesState({ [e]: t });
|
|
1055
1059
|
}
|
|
1056
1060
|
i18nInit() {
|
|
1057
|
-
let e = new
|
|
1061
|
+
let e = new P([this.defaultLocale, this.opts.locale], { onMissingKey: (e) => this.log(`Missing i18n string: ${e}`, "error") });
|
|
1058
1062
|
this.i18n = e.translate.bind(e), this.i18nArray = e.translateArray.bind(e), this.locale = e.locale;
|
|
1059
1063
|
}
|
|
1060
1064
|
setOptions(e) {
|
|
@@ -1088,14 +1092,14 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1088
1092
|
};
|
|
1089
1093
|
}), this.setState({
|
|
1090
1094
|
files: n,
|
|
1091
|
-
...
|
|
1095
|
+
...B
|
|
1092
1096
|
});
|
|
1093
1097
|
}
|
|
1094
1098
|
clear() {
|
|
1095
1099
|
let { capabilities: e, currentUploads: t } = this.getState();
|
|
1096
1100
|
if (Object.keys(t).length > 0 && !e.individualCancellation) throw Error("The installed uploader plugin does not allow removing files during an upload.");
|
|
1097
1101
|
this.setState({
|
|
1098
|
-
...
|
|
1102
|
+
...B,
|
|
1099
1103
|
files: {}
|
|
1100
1104
|
});
|
|
1101
1105
|
}
|
|
@@ -1234,13 +1238,13 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1234
1238
|
#u(e) {
|
|
1235
1239
|
let { allowNewUpload: t } = this.getState();
|
|
1236
1240
|
if (t === !1) {
|
|
1237
|
-
let t = new
|
|
1241
|
+
let t = new R(this.i18n("noMoreFilesAllowed"), { file: e });
|
|
1238
1242
|
throw this.#s([t]), t;
|
|
1239
1243
|
}
|
|
1240
1244
|
}
|
|
1241
1245
|
checkIfFileAlreadyExists(e) {
|
|
1242
1246
|
let { files: t } = this.getState();
|
|
1243
|
-
return
|
|
1247
|
+
return !(!t[e] || t[e].isGhost);
|
|
1244
1248
|
}
|
|
1245
1249
|
#d(e) {
|
|
1246
1250
|
let t = e instanceof File ? {
|
|
@@ -1252,7 +1256,7 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1252
1256
|
isRemote: !1,
|
|
1253
1257
|
source: void 0,
|
|
1254
1258
|
preview: void 0
|
|
1255
|
-
} : e, n =
|
|
1259
|
+
} : e, n = T(t), r = Ne(n, t), i = C(r).extension, a = ee(t, this.getID()), o = {
|
|
1256
1260
|
...t.meta,
|
|
1257
1261
|
name: r,
|
|
1258
1262
|
type: n
|
|
@@ -1312,8 +1316,8 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1312
1316
|
if (t = this.getState().files, n = {
|
|
1313
1317
|
...t,
|
|
1314
1318
|
...n
|
|
1315
|
-
}, !s && this.checkIfFileAlreadyExists(e.id)) throw new
|
|
1316
|
-
if (s === !1 && !o) throw new
|
|
1319
|
+
}, !s && this.checkIfFileAlreadyExists(e.id)) throw new R(this.i18n("noDuplicates", { fileName: e.name ?? this.i18n("unnamed") }), { file: e });
|
|
1320
|
+
if (s === !1 && !o) throw new R("Cannot add the file because onBeforeFileAdded returned false.", {
|
|
1317
1321
|
isUserFacing: !1,
|
|
1318
1322
|
file: e
|
|
1319
1323
|
});
|
|
@@ -1408,20 +1412,22 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1408
1412
|
pauseAll() {
|
|
1409
1413
|
let e = { ...this.getState().files };
|
|
1410
1414
|
Object.keys(e).filter((t) => !e[t].progress.uploadComplete && e[t].progress.uploadStarted).forEach((t) => {
|
|
1411
|
-
|
|
1415
|
+
let n = {
|
|
1412
1416
|
...e[t],
|
|
1413
1417
|
isPaused: !0
|
|
1414
1418
|
};
|
|
1419
|
+
e[t] = n;
|
|
1415
1420
|
}), this.setState({ files: e }), this.emit("pause-all");
|
|
1416
1421
|
}
|
|
1417
1422
|
resumeAll() {
|
|
1418
1423
|
let e = { ...this.getState().files };
|
|
1419
1424
|
Object.keys(e).filter((t) => !e[t].progress.uploadComplete && e[t].progress.uploadStarted).forEach((t) => {
|
|
1420
|
-
|
|
1425
|
+
let n = {
|
|
1421
1426
|
...e[t],
|
|
1422
1427
|
isPaused: !1,
|
|
1423
1428
|
error: null
|
|
1424
1429
|
};
|
|
1430
|
+
e[t] = n;
|
|
1425
1431
|
}), this.setState({ files: e }), this.emit("resume-all");
|
|
1426
1432
|
}
|
|
1427
1433
|
#m() {
|
|
@@ -1456,7 +1462,7 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1456
1462
|
cancelAll() {
|
|
1457
1463
|
this.emit("cancel-all");
|
|
1458
1464
|
let { files: e } = this.getState(), t = Object.keys(e);
|
|
1459
|
-
t.length && this.removeFiles(t), this.setState(
|
|
1465
|
+
t.length && this.removeFiles(t), this.setState(B);
|
|
1460
1466
|
}
|
|
1461
1467
|
retryUpload(e) {
|
|
1462
1468
|
this.setFileState(e, {
|
|
@@ -1498,7 +1504,7 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1498
1504
|
let e = this.#y(), t = null;
|
|
1499
1505
|
e != null && (t = Math.round(e * 100), t > 100 ? t = 100 : t < 0 && (t = 0)), this.emit("progress", t ?? 0), this.setState({ totalProgress: t ?? 0 });
|
|
1500
1506
|
}
|
|
1501
|
-
#v = (0,
|
|
1507
|
+
#v = (0, Ie.default)(() => this.#_(), 500, {
|
|
1502
1508
|
leading: !0,
|
|
1503
1509
|
trailing: !0
|
|
1504
1510
|
});
|
|
@@ -1682,9 +1688,7 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1682
1688
|
case "warning":
|
|
1683
1689
|
n.warn(e);
|
|
1684
1690
|
break;
|
|
1685
|
-
default:
|
|
1686
|
-
n.debug(e);
|
|
1687
|
-
break;
|
|
1691
|
+
default: n.debug(e);
|
|
1688
1692
|
}
|
|
1689
1693
|
}
|
|
1690
1694
|
#S = /* @__PURE__ */ new Map();
|
|
@@ -1705,7 +1709,7 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1705
1709
|
#C(e, t = {}) {
|
|
1706
1710
|
let { forceAllowNewUpload: n = !1 } = t, { allowNewUpload: r, currentUploads: i } = this.getState();
|
|
1707
1711
|
if (!r && !n) throw Error("Cannot create a new upload: already uploading.");
|
|
1708
|
-
let a =
|
|
1712
|
+
let a = je();
|
|
1709
1713
|
return this.emit("upload", a, this.getFilesByIds(e)), this.setState({
|
|
1710
1714
|
allowNewUpload: this.opts.allowMultipleUploadBatches !== !1 && this.opts.allowMultipleUploads !== !1,
|
|
1711
1715
|
currentUploads: {
|
|
@@ -1804,7 +1808,7 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1804
1808
|
if (t === !1) throw Error("Not starting the upload because onBeforeUpload returned false");
|
|
1805
1809
|
t && typeof t == "object" && (e = t, this.setState({ files: e }));
|
|
1806
1810
|
try {
|
|
1807
|
-
if (this.#t.validateMinNumberOfFiles(e), !this.#l(e)) throw new
|
|
1811
|
+
if (this.#t.validateMinNumberOfFiles(e), !this.#l(e)) throw new R(this.i18n("missingRequiredMetaField"));
|
|
1808
1812
|
let { currentUploads: t } = this.getState(), n = Object.values(t).flatMap((e) => e.fileIDs), r = Object.keys(e).filter((e) => {
|
|
1809
1813
|
let t = this.getFile(e);
|
|
1810
1814
|
return t && !t.progress.uploadStarted && !n.includes(e);
|
|
@@ -1814,7 +1818,7 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1814
1818
|
throw this.#s([e]), e;
|
|
1815
1819
|
}
|
|
1816
1820
|
}
|
|
1817
|
-
},
|
|
1821
|
+
}, ze = {
|
|
1818
1822
|
name: "@uppy/xhr-upload",
|
|
1819
1823
|
description: "Plain and simple classic HTML multipart form uploads with Uppy, as well as uploads using the HTTP PUT method.",
|
|
1820
1824
|
version: "5.2.0",
|
|
@@ -1869,43 +1873,43 @@ var Ne = /* @__PURE__ */ e(Te(), 1), Pe = /* @__PURE__ */ e(Ee(), 1), R = {
|
|
|
1869
1873
|
vitest: "^3.2.4"
|
|
1870
1874
|
},
|
|
1871
1875
|
peerDependencies: { "@uppy/core": "^5.2.0" }
|
|
1872
|
-
},
|
|
1876
|
+
}, Be = { strings: { uploadStalled: "Upload has not made any progress for %{seconds} seconds. You may want to retry it." } };
|
|
1873
1877
|
//#endregion
|
|
1874
1878
|
//#region ../../node_modules/@uppy/xhr-upload/lib/index.js
|
|
1875
|
-
function
|
|
1879
|
+
function Ve(e, t) {
|
|
1876
1880
|
let n = t;
|
|
1877
|
-
return n ||= /* @__PURE__ */ Error("Upload error"), typeof n == "string" && (n = Error(n)), n instanceof Error || (n = Object.assign(/* @__PURE__ */ Error("Upload error"), { data: n })),
|
|
1881
|
+
return n ||= /* @__PURE__ */ Error("Upload error"), typeof n == "string" && (n = Error(n)), n instanceof Error || (n = Object.assign(/* @__PURE__ */ Error("Upload error"), { data: n })), N(e) ? (n = new h(n, e), n) : (n.request = e, n);
|
|
1878
1882
|
}
|
|
1879
|
-
function
|
|
1883
|
+
function He(e) {
|
|
1880
1884
|
return e.data.slice(0, e.data.size, e.meta.type);
|
|
1881
1885
|
}
|
|
1882
|
-
var
|
|
1886
|
+
var Ue = {
|
|
1883
1887
|
formData: !0,
|
|
1884
1888
|
fieldName: "file",
|
|
1885
1889
|
method: "post",
|
|
1886
1890
|
allowedMetaFields: !0,
|
|
1887
1891
|
bundle: !1,
|
|
1888
1892
|
headers: {},
|
|
1889
|
-
timeout:
|
|
1893
|
+
timeout: 3e4,
|
|
1890
1894
|
limit: 5,
|
|
1891
1895
|
withCredentials: !1,
|
|
1892
1896
|
responseType: ""
|
|
1893
|
-
},
|
|
1894
|
-
static VERSION =
|
|
1897
|
+
}, We = class extends F {
|
|
1898
|
+
static VERSION = ze.version;
|
|
1895
1899
|
#e;
|
|
1896
1900
|
#t;
|
|
1897
1901
|
uploaderEvents;
|
|
1898
1902
|
constructor(e, t) {
|
|
1899
1903
|
if (super(e, {
|
|
1900
|
-
...
|
|
1904
|
+
...Ue,
|
|
1901
1905
|
fieldName: t.bundle ? "files[]" : "file",
|
|
1902
1906
|
...t
|
|
1903
|
-
}), this.type = "uploader", this.id = this.opts.id || "XHRUpload", this.defaultLocale =
|
|
1907
|
+
}), this.type = "uploader", this.id = this.opts.id || "XHRUpload", this.defaultLocale = Be, this.i18nInit(), this.#t = new te({ concurrency: this.opts.limit }), this.opts.bundle && !this.opts.formData) throw Error("`opts.formData` must be true when `opts.bundle` is enabled.");
|
|
1904
1908
|
if (this.opts.bundle && typeof this.opts.headers == "function") throw Error("`opts.headers` can not be a function when the `bundle: true` option is set.");
|
|
1905
1909
|
if (t?.allowedMetaFields === void 0 && "metaFields" in this.opts) throw Error("The `metaFields` option has been renamed to `allowedMetaFields`.");
|
|
1906
1910
|
this.uploaderEvents = Object.create(null), this.#e = (e) => async (t, n) => {
|
|
1907
1911
|
try {
|
|
1908
|
-
let r = await
|
|
1912
|
+
let r = await v(t, {
|
|
1909
1913
|
...n,
|
|
1910
1914
|
onBeforeRequest: (t, n) => this.opts.onBeforeRequest?.(t, n, e),
|
|
1911
1915
|
shouldRetry: this.opts.shouldRetry,
|
|
@@ -1941,7 +1945,7 @@ var Be = {
|
|
|
1941
1945
|
} catch (t) {
|
|
1942
1946
|
if (t.name === "AbortError") return;
|
|
1943
1947
|
let n = t.request;
|
|
1944
|
-
for (let r of e) this.uppy.emit("upload-error", this.uppy.getFile(r.id),
|
|
1948
|
+
for (let r of e) this.uppy.emit("upload-error", this.uppy.getFile(r.id), Ve(n, t), n);
|
|
1945
1949
|
throw t;
|
|
1946
1950
|
}
|
|
1947
1951
|
};
|
|
@@ -1956,7 +1960,7 @@ var Be = {
|
|
|
1956
1960
|
return typeof n == "function" ? r.headers = n(e) : Object.assign(r.headers, this.opts.headers), t && Object.assign(r.headers, t.headers), e.xhrUpload && Object.assign(r.headers, e.xhrUpload.headers), r;
|
|
1957
1961
|
}
|
|
1958
1962
|
addMetadata(e, t, n) {
|
|
1959
|
-
|
|
1963
|
+
A(n.allowedMetaFields, t).forEach((n) => {
|
|
1960
1964
|
let r = t[n];
|
|
1961
1965
|
Array.isArray(r) ? r.forEach((t) => e.append(n, t)) : e.append(n, r);
|
|
1962
1966
|
});
|
|
@@ -1964,18 +1968,18 @@ var Be = {
|
|
|
1964
1968
|
createFormDataUpload(e, t) {
|
|
1965
1969
|
let n = new FormData();
|
|
1966
1970
|
this.addMetadata(n, e.meta, t);
|
|
1967
|
-
let r =
|
|
1971
|
+
let r = He(e);
|
|
1968
1972
|
return e.name ? n.append(t.fieldName, r, e.meta.name) : n.append(t.fieldName, r), n;
|
|
1969
1973
|
}
|
|
1970
1974
|
createBundledUpload(e, t) {
|
|
1971
1975
|
let n = new FormData(), { meta: r } = this.uppy.getState();
|
|
1972
1976
|
return this.addMetadata(n, r, t), e.forEach((e) => {
|
|
1973
|
-
let t = this.getOptions(e), r =
|
|
1977
|
+
let t = this.getOptions(e), r = He(e);
|
|
1974
1978
|
e.name ? n.append(t.fieldName, r, e.name) : n.append(t.fieldName, r);
|
|
1975
1979
|
}), n;
|
|
1976
1980
|
}
|
|
1977
1981
|
async #n(e) {
|
|
1978
|
-
let t = new
|
|
1982
|
+
let t = new I(this.uppy), n = new AbortController();
|
|
1979
1983
|
t.onFileRemove(e.id, () => n.abort()), t.onCancelAll(e.id, () => n.abort());
|
|
1980
1984
|
try {
|
|
1981
1985
|
await this.#t.add(async (t) => {
|
|
@@ -2019,7 +2023,7 @@ var Be = {
|
|
|
2019
2023
|
}
|
|
2020
2024
|
}
|
|
2021
2025
|
#i(e) {
|
|
2022
|
-
let t = this.getOptions(e), n =
|
|
2026
|
+
let t = this.getOptions(e), n = A(t.allowedMetaFields, e.meta);
|
|
2023
2027
|
return {
|
|
2024
2028
|
...e.remote?.body,
|
|
2025
2029
|
protocol: "multipart",
|
|
@@ -2054,7 +2058,7 @@ var Be = {
|
|
|
2054
2058
|
return;
|
|
2055
2059
|
}
|
|
2056
2060
|
this.opts.limit === 0 && this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0", "warning"), this.uppy.log("[XHRUpload] Uploading...");
|
|
2057
|
-
let t =
|
|
2061
|
+
let t = x(this.uppy.getFilesByIds(e)), n = S(t);
|
|
2058
2062
|
if (this.uppy.emit("upload-start", n), this.opts.bundle) {
|
|
2059
2063
|
if (t.some((e) => e.isRemote)) throw Error("Can’t upload remote files when the `bundle: true` option is set");
|
|
2060
2064
|
if (typeof this.opts.headers == "function") throw TypeError("`headers` may not be a function when the `bundle: true` option is set");
|
|
@@ -2081,83 +2085,109 @@ var Be = {
|
|
|
2081
2085
|
}
|
|
2082
2086
|
this.uppy.removeUploader(this.#o);
|
|
2083
2087
|
}
|
|
2084
|
-
},
|
|
2085
|
-
|
|
2086
|
-
function
|
|
2088
|
+
}, Ge = "@layer formie-theme{.formie-upload-manager{gap:var(--formie-gap-field);flex-direction:column;display:flex}.formie-upload-manager-dropzone{justify-content:center;align-items:center;gap:var(--formie-space-2);padding:var(--formie-space-4);min-height:calc(var(--formie-control-height) * 3);border:var(--formie-border-width) dashed var(--formie-color-border-control);border-radius:var(--formie-radius-sm);background:var(--formie-color-surface-subtle);color:var(--formie-color-text);text-align:center;cursor:pointer;flex-direction:column;transition:border-color .15s,background-color .15s,box-shadow .15s;display:flex}.formie-upload-manager-dropzone:hover,.formie-upload-manager-dropzone.formie-upload-manager-dropzone-active{border-color:var(--formie-color-focus-ring);background:var(--formie-color-surface-muted)}.formie-upload-manager-dropzone:focus{outline:0}.formie-upload-manager-dropzone:focus-visible{box-shadow:0 0 0 var(--formie-focus-ring-width) var(--formie-color-focus-ring)}.formie-field-has-error .formie-upload-manager-dropzone{border-color:var(--formie-color-danger)}.formie-upload-manager-prompt{font-size:var(--formie-font-size-sm);color:var(--formie-color-text-muted);margin:0}.formie-upload-manager-list{gap:var(--formie-space-2);flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.formie-upload-manager-item{align-items:center;gap:var(--formie-space-2);padding:var(--formie-space-2) var(--formie-space-3);border:var(--formie-border-width) solid var(--formie-color-border-control);border-radius:var(--formie-radius-sm);background:var(--formie-color-surface);grid-template-columns:minmax(0,1fr) minmax(6.5rem,8rem) auto;display:grid}.formie-upload-manager-item.is-error{border-color:var(--formie-color-danger)}.formie-upload-manager-item.is-complete .formie-upload-manager-progress{opacity:0;visibility:hidden;pointer-events:none}.formie-upload-manager-filename{text-overflow:ellipsis;white-space:nowrap;font-size:var(--formie-font-size-sm);overflow:hidden}.formie-upload-manager-progress{justify-content:center;gap:var(--formie-space-1);min-height:var(--formie-button-icon-button-size);opacity:1;visibility:visible;flex-direction:column;align-self:center;transition:opacity .2s,visibility .2s;display:flex}.formie-upload-manager-progress-track{border-radius:var(--formie-radius-full);background:var(--formie-color-surface-muted);height:.375rem;position:relative;overflow:hidden}.formie-upload-manager-progress-bar{border-radius:inherit;background:var(--formie-color-primary);width:0;height:100%;transition:width .18s ease-out,background-color .2s}.formie-upload-manager-item.is-upload-complete .formie-upload-manager-progress-bar{background:var(--formie-color-success,var(--formie-color-primary));width:100%!important}.formie-upload-manager-item.is-uploading:not(.is-upload-complete) .formie-upload-manager-progress-track[data-indeterminate=true] .formie-upload-manager-progress-bar,.formie-upload-manager-item.is-preparing .formie-upload-manager-progress-bar,.formie-upload-manager-item.is-processing .formie-upload-manager-progress-bar{width:35%;animation:1.1s ease-in-out infinite formie-upload-manager-progress-indeterminate}.formie-upload-manager-item.is-processing .formie-upload-manager-progress-bar{opacity:.85}.formie-upload-manager-item.is-processing .formie-upload-manager-progress-label{color:var(--formie-color-text)}@keyframes formie-upload-manager-progress-indeterminate{0%{transform:translate(-120%)}to{transform:translate(320%)}}.formie-upload-manager-progress-label{font-size:var(--formie-font-size-xs);color:var(--formie-color-text-muted);text-align:center;white-space:nowrap;line-height:1.2}.formie-upload-manager-item.is-upload-complete .formie-upload-manager-progress-label{color:var(--formie-color-success-dark,var(--formie-color-primary));font-weight:var(--formie-font-weight-medium)}.formie-upload-manager-error{font-size:var(--formie-font-size-xs);color:var(--formie-color-danger);grid-column:1/-1}.formie-upload-manager-browse-button{margin-top:var(--formie-space-1)}.formie-upload-manager-actions{align-items:center;gap:var(--formie-space-2);flex-shrink:0;align-self:center;display:flex}.formie-upload-manager-sort-controls{border-radius:var(--formie-radius-sm);background:0 0;flex-direction:row;align-items:center;gap:.0625rem;padding:0;display:inline-flex}.formie-upload-manager-sort-controls[hidden]{display:none}.formie-upload-manager-sort-button,.formie-upload-manager-action-button{border-radius:var(--formie-radius-sm);width:1.375rem;height:1.375rem;color:var(--formie-color-text-muted);cursor:pointer;text-indent:-9999px;white-space:nowrap;background:0 0;border:0;justify-content:center;align-items:center;padding:0;font-size:0;line-height:0;transition:background-color .15s,color .15s,opacity .15s;display:inline-flex;position:relative;overflow:hidden}.formie-upload-manager-sort-button{width:1.375rem;height:1.375rem}.formie-upload-manager-sort-button:hover:not(:disabled),.formie-upload-manager-action-button:hover{background:var(--formie-color-surface-muted);color:var(--formie-color-text)}.formie-upload-manager-sort-button:focus-visible,.formie-upload-manager-action-button:focus-visible{box-shadow:0 0 0 var(--formie-focus-ring-width) var(--formie-color-focus-ring);outline:0}.formie-upload-manager-sort-button:disabled{opacity:.28;cursor:not-allowed}.formie-upload-manager-sort-button:after,.formie-upload-manager-action-button:after{content:\"\";background-color:currentColor;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.formie-upload-manager-sort-button[data-formie-icon=arrow-up]{--formie-upload-manager-icon-mask:var(--formie-icon-mask-arrow-up)}.formie-upload-manager-sort-button[data-formie-icon=arrow-down]{--formie-upload-manager-icon-mask:var(--formie-icon-mask-arrow-down)}.formie-upload-manager-action-button[data-formie-icon=close]{--formie-upload-manager-icon-mask:var(--formie-icon-mask-close)}.formie-upload-manager-sort-button:after{width:.75rem;height:.75rem;-webkit-mask-image:var(--formie-upload-manager-icon-mask);-webkit-mask-image:var(--formie-upload-manager-icon-mask);mask-image:var(--formie-upload-manager-icon-mask)}.formie-upload-manager-action-button:after{width:.825rem;height:.825rem;-webkit-mask-image:var(--formie-upload-manager-icon-mask);-webkit-mask-image:var(--formie-upload-manager-icon-mask);mask-image:var(--formie-upload-manager-icon-mask)}.formie-upload-manager-remove-button{flex-shrink:0}}", V = "[data-formie-upload-manager-root]", H = "[data-formie-upload-manager]", Ke = "[data-formie-upload-manager-browse]", qe = "[data-formie-upload-manager-input]", U = "[data-formie-upload-manager-status]", Je = "[data-formie-upload-manager-list]", Ye = "[data-formie-upload-manager-sort-controls]", Xe = "[data-formie-upload-manager-sort=\"up\"]", Ze = "[data-formie-upload-manager-sort=\"down\"]", W = "data-formie-file-upload-anchor", G = "data-formie-file-upload-asset-id", Qe = "data-formie-file-upload-token", K = "data-formie-file-upload-entry", $e = r("reset"), et = i("repeater", "init-row"), tt = "upload-manager", nt = "upload-manager", rt = ["uploadManagerRequired", "uploadManagerFileLimit"], it = 900, at = 95, ot = 12e4, q = a("fields", "upload-manager");
|
|
2089
|
+
d(tt, [Ge]);
|
|
2090
|
+
function st(e) {
|
|
2087
2091
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
2088
2092
|
}
|
|
2089
|
-
function
|
|
2093
|
+
function J(e) {
|
|
2090
2094
|
let t = Number(e);
|
|
2091
2095
|
return Number.isInteger(t) && t > 0 ? t : null;
|
|
2092
2096
|
}
|
|
2093
|
-
function
|
|
2097
|
+
function Y(e) {
|
|
2098
|
+
return typeof e == "string" ? e.trim() : "";
|
|
2099
|
+
}
|
|
2100
|
+
function ct(e) {
|
|
2094
2101
|
return e.getAttribute("data-formie-field-handle")?.trim() || "";
|
|
2095
2102
|
}
|
|
2096
|
-
function
|
|
2103
|
+
function lt(e) {
|
|
2097
2104
|
if (!e) return "";
|
|
2098
2105
|
let t = e.querySelector("input[name=\"handle\"]");
|
|
2099
2106
|
return t instanceof HTMLInputElement && t.value.trim() ? t.value.trim() : e.getAttribute("data-formie-handle")?.trim() || "";
|
|
2100
2107
|
}
|
|
2101
|
-
function
|
|
2108
|
+
function X(e) {
|
|
2102
2109
|
return Array.from(e.querySelectorAll("input[type=\"hidden\"]")).filter((e) => e instanceof HTMLInputElement);
|
|
2103
2110
|
}
|
|
2104
|
-
function
|
|
2105
|
-
let n =
|
|
2106
|
-
if (n) return n.setAttribute(
|
|
2111
|
+
function ut(e, t) {
|
|
2112
|
+
let n = X(e).find((e) => e.hasAttribute(W) || e.name === t.replace("[]", "") && e.value === "");
|
|
2113
|
+
if (n) return n.setAttribute(W, "true"), n;
|
|
2107
2114
|
let r = document.createElement("input");
|
|
2108
|
-
return r.type = "hidden", r.name = t.replace("[]", ""), r.value = "", r.setAttribute(
|
|
2115
|
+
return r.type = "hidden", r.name = t.replace("[]", ""), r.value = "", r.setAttribute(W, "true"), e.prepend(r), r;
|
|
2109
2116
|
}
|
|
2110
|
-
function
|
|
2111
|
-
return
|
|
2117
|
+
function dt(e, t) {
|
|
2118
|
+
return X(e).filter((e) => e.hasAttribute(G) || e.name === t && e.value.trim() !== "");
|
|
2112
2119
|
}
|
|
2113
|
-
function
|
|
2114
|
-
return
|
|
2120
|
+
function ft(e, t) {
|
|
2121
|
+
return dt(e, t).map((e) => J(e.getAttribute(G)) ?? J(e.value)).filter((e) => e !== null);
|
|
2115
2122
|
}
|
|
2116
|
-
function
|
|
2117
|
-
let
|
|
2118
|
-
|
|
2123
|
+
function pt(e, t) {
|
|
2124
|
+
let n = {};
|
|
2125
|
+
return dt(e, t).forEach((e) => {
|
|
2126
|
+
let t = J(e.getAttribute(G)) ?? J(e.value), r = e.getAttribute(Qe)?.trim() || "";
|
|
2127
|
+
t && r && (n[t] = r);
|
|
2128
|
+
}), n;
|
|
2129
|
+
}
|
|
2130
|
+
function mt(e, t, n, r) {
|
|
2131
|
+
let i = t, a = n.endsWith("[]") ? n.slice(0, -2) : n;
|
|
2132
|
+
X(e).filter((e) => e.hasAttribute(K) || e.name === n && e.value.trim() !== "").forEach((e) => {
|
|
2119
2133
|
e.remove();
|
|
2120
|
-
}), r.forEach((e) => {
|
|
2121
|
-
let
|
|
2122
|
-
|
|
2134
|
+
}), r.forEach(({ assetId: e, uploadToken: t, uploadUid: n, attachToken: r }, o) => {
|
|
2135
|
+
let s = document.createElement("input");
|
|
2136
|
+
if (s.type = "hidden", s.setAttribute(K, "true"), s.setAttribute(G, String(e)), n && r ? (s.name = `${a}[${o}][uploadUid]`, s.value = n) : (s.name = `${a}[${o}][assetId]`, s.value = String(e)), t && s.setAttribute(Qe, t), i.insertAdjacentElement("afterend", s), i = s, n && r) {
|
|
2137
|
+
let e = document.createElement("input");
|
|
2138
|
+
e.type = "hidden", e.name = `${a}[${o}][attachToken]`, e.value = r, e.setAttribute(K, "true"), i.insertAdjacentElement("afterend", e), i = e;
|
|
2139
|
+
}
|
|
2123
2140
|
});
|
|
2124
2141
|
}
|
|
2125
|
-
function
|
|
2142
|
+
function ht(e, t, n) {
|
|
2126
2143
|
let r = n.getAttribute("data-formie-upload-key")?.trim() || n.getAttribute("data-formie-input-id")?.trim() || "", i = {
|
|
2127
|
-
handle:
|
|
2128
|
-
fieldHandle:
|
|
2144
|
+
handle: lt(e),
|
|
2145
|
+
fieldHandle: ct(t),
|
|
2129
2146
|
inputKey: r
|
|
2130
2147
|
};
|
|
2131
|
-
|
|
2132
|
-
[
|
|
2148
|
+
return e ? ([
|
|
2133
2149
|
"renderId",
|
|
2134
2150
|
"draftContextToken",
|
|
2135
2151
|
"draftContext",
|
|
2136
|
-
"submissionId"
|
|
2152
|
+
"submissionId",
|
|
2153
|
+
"siteId",
|
|
2154
|
+
"submissionEditToken",
|
|
2155
|
+
"resumeToken",
|
|
2156
|
+
"submissionUid",
|
|
2157
|
+
"uploadCreateToken"
|
|
2137
2158
|
].forEach((t) => {
|
|
2138
2159
|
let n = e.querySelector(`input[name="${t}"]`);
|
|
2139
2160
|
n instanceof HTMLInputElement && n.value.trim() && (i[t] = n.value.trim());
|
|
2140
|
-
});
|
|
2141
|
-
let a = e.querySelector("input[name=\"CRAFT_CSRF_TOKEN\"]");
|
|
2142
|
-
return a instanceof HTMLInputElement && a.value.trim() && (i.CRAFT_CSRF_TOKEN = a.value.trim()), i;
|
|
2161
|
+
}), o(i, e), i) : i;
|
|
2143
2162
|
}
|
|
2144
|
-
function
|
|
2145
|
-
let
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2163
|
+
function gt(e, t, n, r = {}) {
|
|
2164
|
+
let i = new FormData(), a = lt(e), o = ct(t);
|
|
2165
|
+
return a && i.append("handle", a), o && i.append("fieldHandle", o), [
|
|
2166
|
+
"submissionUid",
|
|
2167
|
+
"resumeToken",
|
|
2168
|
+
"submissionEditToken",
|
|
2169
|
+
"siteId",
|
|
2170
|
+
"renderId",
|
|
2171
|
+
"draftContext",
|
|
2172
|
+
"draftContextToken"
|
|
2173
|
+
].forEach((t) => {
|
|
2174
|
+
let n = e?.querySelector(`input[name="${t}"]`);
|
|
2175
|
+
n instanceof HTMLInputElement && n.value.trim() && i.append(t, n.value.trim());
|
|
2176
|
+
}), n.forEach((e) => {
|
|
2177
|
+
i.append("assetIds[]", String(e));
|
|
2178
|
+
let t = r[e];
|
|
2179
|
+
t && i.append(`uploadTokens[${e}]`, t);
|
|
2180
|
+
}), c(i, e), i;
|
|
2151
2181
|
}
|
|
2152
|
-
function
|
|
2182
|
+
function _t(e) {
|
|
2153
2183
|
if (!e) return null;
|
|
2154
2184
|
let t = e.split(",").map((e) => e.trim()).filter(Boolean);
|
|
2155
2185
|
return t.length ? t : null;
|
|
2156
2186
|
}
|
|
2157
|
-
function
|
|
2187
|
+
function vt(e, t, n, r) {
|
|
2158
2188
|
return t?.trim() || e.getAttribute(n)?.trim() || r;
|
|
2159
2189
|
}
|
|
2160
|
-
function
|
|
2190
|
+
function Z(e) {
|
|
2161
2191
|
let t = e.querySelector("[data-formie-upload-manager-progress]");
|
|
2162
2192
|
if (!(t instanceof HTMLElement)) return {
|
|
2163
2193
|
track: null,
|
|
@@ -2171,28 +2201,28 @@ function X(e) {
|
|
|
2171
2201
|
label: i instanceof HTMLElement ? i : null
|
|
2172
2202
|
};
|
|
2173
2203
|
}
|
|
2174
|
-
function
|
|
2175
|
-
let { track: r, bar: i, label: a } =
|
|
2204
|
+
function Q(e, t, n = "uploading") {
|
|
2205
|
+
let { track: r, bar: i, label: a } = Z(e);
|
|
2176
2206
|
e.classList.add("is-uploading"), e.classList.remove("is-upload-complete", "is-complete", "is-processing", "is-preparing"), n === "processing" ? e.classList.add("is-processing") : n === "preparing" && e.classList.add("is-preparing"), r && r.setAttribute("data-indeterminate", "true"), i && (i.style.removeProperty("width"), i.setAttribute("data-progress", n)), a && (a.textContent = t);
|
|
2177
2207
|
}
|
|
2178
|
-
function
|
|
2179
|
-
let { track: r, bar: i, label: a } =
|
|
2180
|
-
e.classList.add("is-uploading"), e.classList.remove("is-upload-complete", "is-complete", "is-processing", "is-preparing"), r && r.setAttribute("data-indeterminate", "false"), i && (i.style.width = `${o}%`, i.setAttribute("data-progress", String(o))), a && (
|
|
2208
|
+
function yt(e, t, n) {
|
|
2209
|
+
let { track: r, bar: i, label: a } = Z(e), o = Math.max(0, Math.min(at, Math.round(t)));
|
|
2210
|
+
e.classList.add("is-uploading"), e.classList.remove("is-upload-complete", "is-complete", "is-processing", "is-preparing"), r && r.setAttribute("data-indeterminate", "false"), i && (i.style.width = `${o}%`, i.setAttribute("data-progress", String(o))), a && (a.textContent = n || (o > 0 ? `Uploading… ${o}%` : "Uploading…"));
|
|
2181
2211
|
}
|
|
2182
|
-
function
|
|
2212
|
+
function bt(e, t, n = {}) {
|
|
2183
2213
|
let { loaded: r = 0, total: i = 0 } = n;
|
|
2184
2214
|
if ((i > 0 ? r >= i : t >= 100) || t >= 100) {
|
|
2185
|
-
|
|
2215
|
+
Q(e, "Processing…", "processing");
|
|
2186
2216
|
return;
|
|
2187
2217
|
}
|
|
2188
2218
|
if (t <= 0 && r <= 0) {
|
|
2189
|
-
|
|
2219
|
+
Q(e, "Uploading…", "uploading");
|
|
2190
2220
|
return;
|
|
2191
2221
|
}
|
|
2192
|
-
let a = Math.min(
|
|
2193
|
-
|
|
2222
|
+
let a = Math.min(at, Math.max(1, Math.round(t)));
|
|
2223
|
+
yt(e, a, `Uploading… ${a}%`);
|
|
2194
2224
|
}
|
|
2195
|
-
function
|
|
2225
|
+
function xt(e, t) {
|
|
2196
2226
|
if (e instanceof XMLHttpRequest && e.responseText) try {
|
|
2197
2227
|
let t = JSON.parse(e.responseText);
|
|
2198
2228
|
if (t.message) return t.message;
|
|
@@ -2203,20 +2233,24 @@ function pt(e, t) {
|
|
|
2203
2233
|
} catch {}
|
|
2204
2234
|
return t instanceof Error && t.message ? t.message : "Upload failed.";
|
|
2205
2235
|
}
|
|
2206
|
-
function
|
|
2207
|
-
return e.status === 0
|
|
2236
|
+
function St(e) {
|
|
2237
|
+
return e.status === 0 || e.status >= 500;
|
|
2208
2238
|
}
|
|
2209
|
-
function
|
|
2210
|
-
let { track: t, bar: n, label: r } =
|
|
2239
|
+
function Ct(e) {
|
|
2240
|
+
let { track: t, bar: n, label: r } = Z(e);
|
|
2211
2241
|
e.classList.add("is-uploading", "is-upload-complete"), e.classList.remove("is-complete", "is-processing", "is-preparing"), t && t.setAttribute("data-indeterminate", "false"), n && (n.style.width = "100%", n.setAttribute("data-progress", "100")), r && (r.textContent = "Complete"), window.setTimeout(() => {
|
|
2212
2242
|
e.classList.add("is-complete"), e.classList.remove("is-uploading", "is-upload-complete");
|
|
2213
|
-
},
|
|
2243
|
+
}, it);
|
|
2214
2244
|
}
|
|
2215
|
-
function
|
|
2245
|
+
function wt(e) {
|
|
2246
|
+
let { track: t, bar: n, label: r } = Z(e);
|
|
2247
|
+
e.classList.add("is-error"), e.classList.remove("is-uploading", "is-upload-complete", "is-processing", "is-preparing"), t?.setAttribute("data-indeterminate", "false"), n?.setAttribute("data-progress", "error"), r && (r.textContent = "Upload failed");
|
|
2248
|
+
}
|
|
2249
|
+
function Tt(e) {
|
|
2216
2250
|
let t = e === "up" ? "Move file up" : "Move file down", n = document.createElement("button");
|
|
2217
2251
|
return n.type = "button", n.className = "formie-upload-manager-sort-button", n.setAttribute("data-formie-upload-manager-sort", e), n.setAttribute("data-formie-icon", e === "up" ? "arrow-up" : "arrow-down"), n.setAttribute("aria-label", t), n.setAttribute("title", t), n.textContent = t, n;
|
|
2218
2252
|
}
|
|
2219
|
-
function
|
|
2253
|
+
function Et(e, t) {
|
|
2220
2254
|
let n = document.createElement("li");
|
|
2221
2255
|
n.className = "formie-upload-manager-item", n.setAttribute("data-formie-upload-manager-item", "true");
|
|
2222
2256
|
let r = document.createElement("span");
|
|
@@ -2231,14 +2265,14 @@ function _t(e, t) {
|
|
|
2231
2265
|
s.className = "formie-upload-manager-progress-label", s.setAttribute("data-formie-upload-manager-progress-label", "true"), s.textContent = "Preparing…", a.append(o), i.append(a, s);
|
|
2232
2266
|
let c = document.createElement("div");
|
|
2233
2267
|
c.className = "formie-upload-manager-sort-controls", c.setAttribute("data-formie-upload-manager-sort-controls", "true"), c.hidden = !0;
|
|
2234
|
-
let l =
|
|
2268
|
+
let l = Tt("up"), u = Tt("down");
|
|
2235
2269
|
c.append(l, u);
|
|
2236
2270
|
let d = document.createElement("div");
|
|
2237
2271
|
d.className = "formie-upload-manager-actions", d.setAttribute("data-formie-upload-manager-actions", "true");
|
|
2238
2272
|
let f = document.createElement("button");
|
|
2239
2273
|
f.type = "button", f.className = "formie-upload-manager-action-button formie-upload-manager-remove-button", f.setAttribute("data-formie-upload-manager-remove", "true"), f.setAttribute("aria-label", "Remove file"), f.setAttribute("title", "Remove file"), f.setAttribute("data-formie-icon", "close"), f.textContent = "Remove", d.append(c, f);
|
|
2240
2274
|
let p = document.createElement("span");
|
|
2241
|
-
return p.className = "formie-upload-manager-error", p.setAttribute("data-formie-upload-manager-error", "true"), p.hidden = !0, n.append(r, i, d, p),
|
|
2275
|
+
return p.className = "formie-upload-manager-error", p.setAttribute("data-formie-upload-manager-error", "true"), p.hidden = !0, n.append(r, i, d, p), Q(n, "Preparing…", "preparing"), {
|
|
2242
2276
|
listItem: n,
|
|
2243
2277
|
filenameEl: r,
|
|
2244
2278
|
errorEl: p,
|
|
@@ -2247,70 +2281,83 @@ function _t(e, t) {
|
|
|
2247
2281
|
sortDownButton: u
|
|
2248
2282
|
};
|
|
2249
2283
|
}
|
|
2250
|
-
function
|
|
2251
|
-
let t =
|
|
2252
|
-
if (t?.name) return t.name
|
|
2253
|
-
let n =
|
|
2254
|
-
return
|
|
2284
|
+
function Dt(e) {
|
|
2285
|
+
let t = X(e).find((e) => e.hasAttribute(W));
|
|
2286
|
+
if (t?.name) return t.name.endsWith("[]") ? t.name : `${t.name}[]`;
|
|
2287
|
+
let n = ct(e), r = n ? u(n) : "";
|
|
2288
|
+
return r ? `${r}[]` : "fields[fileUpload][]";
|
|
2255
2289
|
}
|
|
2256
|
-
function
|
|
2290
|
+
function Ot(e) {
|
|
2257
2291
|
return e.files.filter((e) => e.assetId !== null).length;
|
|
2258
2292
|
}
|
|
2259
2293
|
function $(e) {
|
|
2260
|
-
let t = e.files.
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2294
|
+
let t = e.files.filter((e) => e.assetId !== null).map((e) => ({
|
|
2295
|
+
assetId: e.assetId,
|
|
2296
|
+
uploadToken: e.uploadToken,
|
|
2297
|
+
uploadUid: e.uploadUid,
|
|
2298
|
+
attachToken: e.attachToken,
|
|
2299
|
+
filename: e.filename
|
|
2300
|
+
}));
|
|
2301
|
+
mt(e.field, e.anchorInput, e.assetInputName, t), e.statusInput && (e.statusInput.value = t.length ? "uploaded" : ""), p(e.field, "file-upload", "uploaded-assets-sync", { assets: t.map(({ assetId: e, filename: t }) => ({
|
|
2302
|
+
assetId: e,
|
|
2303
|
+
filename: t
|
|
2264
2304
|
})) });
|
|
2265
2305
|
}
|
|
2266
|
-
function
|
|
2267
|
-
|
|
2306
|
+
function kt(e) {
|
|
2307
|
+
m(e, nt, (e) => {
|
|
2268
2308
|
e.addValidator("uploadManagerRequired", ({ input: e }) => {
|
|
2269
|
-
if (!e.matches(
|
|
2309
|
+
if (!e.matches(U)) return !0;
|
|
2270
2310
|
let t = e.closest("[data-formie-field-handle]");
|
|
2271
|
-
return !(t instanceof HTMLElement) || e.getAttribute("data-formie-validation-required") !== "true"
|
|
2311
|
+
return !(t instanceof HTMLElement) || e.getAttribute("data-formie-validation-required") !== "true" || ft(t, Dt(t)).length > 0;
|
|
2272
2312
|
}, ({ input: e, label: t, t: n }) => e.getAttribute("data-formie-required-message") ?? n("{label} cannot be blank.", { label: t })), e.addValidator("uploadManagerFileLimit", ({ input: e }) => {
|
|
2273
|
-
if (!e.matches(
|
|
2313
|
+
if (!e.matches(U)) return !0;
|
|
2274
2314
|
let t = e.closest("[data-formie-field-handle]");
|
|
2275
2315
|
if (!(t instanceof HTMLElement)) return !0;
|
|
2276
|
-
let n = t.querySelector(
|
|
2316
|
+
let n = t.querySelector(H);
|
|
2277
2317
|
if (!(n instanceof HTMLElement)) return !0;
|
|
2278
2318
|
let r = parseInt(n.getAttribute("data-formie-file-limit") || "", 10);
|
|
2279
|
-
return r
|
|
2319
|
+
return !r || ft(t, Dt(t)).length <= r;
|
|
2280
2320
|
}, ({ input: e, t }) => {
|
|
2281
|
-
let n = e.closest("[data-formie-field-handle]")?.querySelector(
|
|
2321
|
+
let n = e.closest("[data-formie-field-handle]")?.querySelector(H);
|
|
2282
2322
|
return n?.getAttribute("data-formie-validation-max-files-message") ?? t("Choose up to {files} files.", { files: n?.getAttribute("data-formie-file-limit") || "" });
|
|
2283
2323
|
});
|
|
2284
2324
|
});
|
|
2285
2325
|
}
|
|
2286
|
-
function
|
|
2287
|
-
|
|
2326
|
+
function At(e) {
|
|
2327
|
+
f(e, nt, rt);
|
|
2288
2328
|
}
|
|
2289
|
-
function
|
|
2329
|
+
function jt(e, t) {
|
|
2290
2330
|
if (e instanceof HTMLFormElement) return e;
|
|
2291
2331
|
let n = t.closest("form");
|
|
2292
2332
|
return n instanceof HTMLFormElement ? n : null;
|
|
2293
2333
|
}
|
|
2294
|
-
function
|
|
2295
|
-
let
|
|
2296
|
-
if (!(r instanceof HTMLElement)) return () => {};
|
|
2297
|
-
let i = r.querySelector(B);
|
|
2334
|
+
function Mt(e, t, r) {
|
|
2335
|
+
let i = e.querySelector(V);
|
|
2298
2336
|
if (!(i instanceof HTMLElement)) return () => {};
|
|
2299
|
-
let
|
|
2300
|
-
if (!(
|
|
2301
|
-
let
|
|
2302
|
-
|
|
2303
|
-
let C =
|
|
2337
|
+
let a = i.querySelector(H);
|
|
2338
|
+
if (!(a instanceof HTMLElement)) return () => {};
|
|
2339
|
+
let o = i.querySelector(qe), c = i.querySelector(Ke), u = i.querySelector(Je), d = i.querySelector(U);
|
|
2340
|
+
if (!(o instanceof HTMLInputElement) || !(u instanceof HTMLElement)) return () => {};
|
|
2341
|
+
let f = jt(t, e), m = d instanceof HTMLInputElement ? d : null, h = Dt(e), g = ut(e, h), _ = vt(a, r.uploadEndpoint, "data-formie-file-upload-upload-endpoint", "/actions/formie/file-upload/upload"), v = vt(a, r.deleteEndpoint, "data-formie-file-upload-delete-endpoint", "/actions/formie/file-upload/delete"), y = vt(a, r.hydrateEndpoint, "data-formie-file-upload-hydrate-endpoint", "/actions/formie/file-upload/hydrate"), b = r.maxFiles ?? J(a.getAttribute("data-formie-file-limit")), x = r.maxFileSize ?? parseFloat(a.getAttribute("data-formie-size-max-limit") || ""), S = r.minFileSize ?? parseFloat(a.getAttribute("data-formie-size-min-limit") || ""), C = _t(r.accept ?? a.getAttribute("accept") ?? o.accept), w = {};
|
|
2342
|
+
b && (w.maxNumberOfFiles = b), x && (w.maxFileSize = x * 1e3 * 1e3), S && (w.minFileSize = S * 1e3 * 1e3), C && (w.allowedFileTypes = C);
|
|
2343
|
+
let T = new Re({
|
|
2304
2344
|
autoProceed: !0,
|
|
2305
|
-
restrictions:
|
|
2345
|
+
restrictions: w
|
|
2346
|
+
}), E = document.createElement("div");
|
|
2347
|
+
E.className = "formie-upload-manager-error", E.setAttribute("role", "alert"), E.hidden = !0, i.append(E), T.on("info-visible", () => {
|
|
2348
|
+
let e = T.getState().info.filter((e) => e.type === "error");
|
|
2349
|
+
e.length && (E.textContent = [...new Set(e.map((e) => e.message))].join(" "), E.hidden = !1);
|
|
2306
2350
|
});
|
|
2307
|
-
|
|
2308
|
-
|
|
2351
|
+
let D = () => {
|
|
2352
|
+
E.textContent = "", E.hidden = !0;
|
|
2353
|
+
}, O = s(f);
|
|
2354
|
+
T.use(We, {
|
|
2355
|
+
endpoint: _,
|
|
2309
2356
|
fieldName: "file",
|
|
2310
2357
|
formData: !0,
|
|
2311
|
-
withCredentials:
|
|
2312
|
-
timeout:
|
|
2313
|
-
shouldRetry:
|
|
2358
|
+
withCredentials: f?.dataset.formieRequestProfile !== "cross-origin-public",
|
|
2359
|
+
timeout: ot,
|
|
2360
|
+
shouldRetry: St,
|
|
2314
2361
|
headers: { Accept: "application/json" },
|
|
2315
2362
|
allowedMetaFields: [
|
|
2316
2363
|
"handle",
|
|
@@ -2320,7 +2367,11 @@ function St(e, t, n) {
|
|
|
2320
2367
|
"draftContextToken",
|
|
2321
2368
|
"draftContext",
|
|
2322
2369
|
"submissionId",
|
|
2323
|
-
"
|
|
2370
|
+
"siteId",
|
|
2371
|
+
"submissionEditToken",
|
|
2372
|
+
"resumeToken",
|
|
2373
|
+
"uploadCreateToken",
|
|
2374
|
+
...O ? [O.name] : []
|
|
2324
2375
|
],
|
|
2325
2376
|
getResponseData(e) {
|
|
2326
2377
|
try {
|
|
@@ -2329,230 +2380,251 @@ function St(e, t, n) {
|
|
|
2329
2380
|
return {};
|
|
2330
2381
|
}
|
|
2331
2382
|
},
|
|
2332
|
-
onBeforeRequest(e, t,
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2383
|
+
onBeforeRequest(e, t, r) {
|
|
2384
|
+
n(_, { profile: f?.dataset.formieRequestProfile }).forEach((t, n) => e.setRequestHeader(n, t));
|
|
2385
|
+
let i = s(f);
|
|
2386
|
+
i && e.setRequestHeader("X-CSRF-Token", i.value);
|
|
2387
|
+
let a = r[0];
|
|
2388
|
+
a?.id && a.size && e.upload.addEventListener("progress", (e) => {
|
|
2389
|
+
let t = P(a.id);
|
|
2336
2390
|
if (!t) return;
|
|
2337
2391
|
let n = 0;
|
|
2338
|
-
e.lengthComputable && e.total > 0 ? n = Math.round(e.loaded / e.total * 100) : e.loaded > 0 &&
|
|
2392
|
+
e.lengthComputable && e.total > 0 ? n = Math.round(e.loaded / e.total * 100) : e.loaded > 0 && a.size && (n = Math.min(100, Math.round(e.loaded / a.size * 100))), bt(t.listItem, n, {
|
|
2339
2393
|
loaded: e.loaded,
|
|
2340
|
-
total: e.lengthComputable ? e.total :
|
|
2394
|
+
total: e.lengthComputable ? e.total : a.size ?? void 0
|
|
2341
2395
|
});
|
|
2342
2396
|
});
|
|
2343
2397
|
}
|
|
2344
2398
|
});
|
|
2345
|
-
let
|
|
2399
|
+
let k = {
|
|
2346
2400
|
field: e,
|
|
2347
|
-
dropzone:
|
|
2401
|
+
dropzone: a,
|
|
2348
2402
|
browseInput: o,
|
|
2349
|
-
statusInput:
|
|
2350
|
-
fileList:
|
|
2351
|
-
anchorInput:
|
|
2352
|
-
assetInputName:
|
|
2353
|
-
uppy:
|
|
2403
|
+
statusInput: m,
|
|
2404
|
+
fileList: u,
|
|
2405
|
+
anchorInput: g,
|
|
2406
|
+
assetInputName: h,
|
|
2407
|
+
uppy: T,
|
|
2354
2408
|
files: []
|
|
2355
|
-
},
|
|
2356
|
-
|
|
2357
|
-
},
|
|
2358
|
-
let e =
|
|
2359
|
-
|
|
2360
|
-
let r = t.listItem.querySelector(
|
|
2409
|
+
}, ee = () => b ? Math.max(0, b - Ot(k)) : null, A = (e) => {
|
|
2410
|
+
a.classList.toggle("formie-upload-manager-dropzone-active", e);
|
|
2411
|
+
}, j = (e) => e.assetId !== null && !e.listItem.classList.contains("is-error"), M = () => {
|
|
2412
|
+
let e = k.files.length >= 2;
|
|
2413
|
+
k.files.forEach((t, n) => {
|
|
2414
|
+
let r = t.listItem.querySelector(Ye), i = t.listItem.querySelector(Xe), a = t.listItem.querySelector(Ze);
|
|
2361
2415
|
if (!(r instanceof HTMLElement)) return;
|
|
2362
|
-
let o = e &&
|
|
2363
|
-
r.hidden = !o, i instanceof HTMLButtonElement && (i.disabled = !o || n === 0), a instanceof HTMLButtonElement && (a.disabled = !o || n >=
|
|
2416
|
+
let o = e && j(t);
|
|
2417
|
+
r.hidden = !o, i instanceof HTMLButtonElement && (i.disabled = !o || n === 0), a instanceof HTMLButtonElement && (a.disabled = !o || n >= k.files.length - 1);
|
|
2364
2418
|
});
|
|
2365
|
-
},
|
|
2366
|
-
let n =
|
|
2367
|
-
if (n < 0 || r < 0 || r >=
|
|
2368
|
-
let i =
|
|
2369
|
-
|
|
2419
|
+
}, N = (e, t) => {
|
|
2420
|
+
let n = k.files.indexOf(e), r = n + t;
|
|
2421
|
+
if (n < 0 || r < 0 || r >= k.files.length) return;
|
|
2422
|
+
let i = k.files[r];
|
|
2423
|
+
k.files[n] = i, k.files[r] = e, t === -1 ? e.listItem.before(i.listItem) : e.listItem.after(i.listItem), $(k), M(), p(k.field, "file-upload", "uploaded-assets-reordered", { assets: k.files.filter((e) => e.assetId !== null).map((e) => ({
|
|
2370
2424
|
assetId: e.assetId,
|
|
2371
2425
|
filename: e.filename
|
|
2372
2426
|
})) });
|
|
2373
|
-
},
|
|
2427
|
+
}, te = (e, t, n, r) => {
|
|
2374
2428
|
t.addEventListener("click", () => {
|
|
2375
|
-
|
|
2429
|
+
ne(e);
|
|
2376
2430
|
}), n.addEventListener("click", () => {
|
|
2377
|
-
|
|
2431
|
+
N(e, -1);
|
|
2378
2432
|
}), r.addEventListener("click", () => {
|
|
2379
|
-
|
|
2433
|
+
N(e, 1);
|
|
2380
2434
|
});
|
|
2381
|
-
},
|
|
2382
|
-
if (t.uppyFileId &&
|
|
2383
|
-
let n = new FormData(), r =
|
|
2435
|
+
}, ne = async (t) => {
|
|
2436
|
+
if (t.uppyFileId && T.removeFile(t.uppyFileId), t.assetId) {
|
|
2437
|
+
let n = new FormData(), r = ht(f, e, a);
|
|
2384
2438
|
Object.entries(r).forEach(([e, t]) => {
|
|
2385
2439
|
n.append(e, t);
|
|
2386
|
-
}), n.append("assetId", String(t.assetId));
|
|
2440
|
+
}), n.append("assetId", String(t.assetId)), t.uploadToken && n.append("uploadToken", t.deleteToken || "");
|
|
2387
2441
|
try {
|
|
2388
|
-
await
|
|
2442
|
+
await l(v, {
|
|
2443
|
+
profile: f?.dataset.formieRequestProfile,
|
|
2389
2444
|
method: "POST",
|
|
2390
2445
|
body: n
|
|
2391
2446
|
});
|
|
2392
2447
|
} catch (e) {
|
|
2393
|
-
|
|
2448
|
+
q.warn("Failed to delete uploaded asset.", {
|
|
2394
2449
|
assetId: t.assetId,
|
|
2395
2450
|
error: e
|
|
2396
2451
|
});
|
|
2397
2452
|
}
|
|
2398
2453
|
}
|
|
2399
|
-
t.listItem.remove(),
|
|
2400
|
-
},
|
|
2401
|
-
let { listItem:
|
|
2402
|
-
|
|
2403
|
-
let
|
|
2454
|
+
t.listItem.remove(), k.files = k.files.filter((e) => e !== t), $(k), M();
|
|
2455
|
+
}, re = (t, n, r = null, i = null, a = null, o = null) => {
|
|
2456
|
+
let { listItem: s, removeButton: c, sortUpButton: l, sortDownButton: d } = Et(e, n);
|
|
2457
|
+
s.classList.add("is-complete"), u.append(s);
|
|
2458
|
+
let f = {
|
|
2404
2459
|
assetId: t,
|
|
2460
|
+
uploadToken: r,
|
|
2461
|
+
deleteToken: i,
|
|
2462
|
+
uploadUid: a,
|
|
2463
|
+
attachToken: o,
|
|
2405
2464
|
filename: n,
|
|
2406
2465
|
uppyFileId: null,
|
|
2407
|
-
listItem:
|
|
2466
|
+
listItem: s
|
|
2408
2467
|
};
|
|
2409
|
-
|
|
2410
|
-
},
|
|
2411
|
-
let t =
|
|
2412
|
-
if (t.length)
|
|
2413
|
-
|
|
2468
|
+
te(f, c, l, d), k.files.push(f), M();
|
|
2469
|
+
}, ie = async () => {
|
|
2470
|
+
let t = ft(e, h);
|
|
2471
|
+
if (!t.length) return;
|
|
2472
|
+
let n = pt(e, h);
|
|
2473
|
+
try {
|
|
2474
|
+
let r = (await l(y, {
|
|
2475
|
+
profile: f?.dataset.formieRequestProfile,
|
|
2414
2476
|
method: "POST",
|
|
2415
|
-
body:
|
|
2416
|
-
})).assets || [],
|
|
2477
|
+
body: gt(f, e, t, n)
|
|
2478
|
+
})).assets || [], i = new Map(r.map((e) => [J(e.assetId), e]).filter(([e]) => e !== null));
|
|
2417
2479
|
t.forEach((e) => {
|
|
2418
|
-
if (
|
|
2419
|
-
let t =
|
|
2420
|
-
t &&
|
|
2421
|
-
}), $(
|
|
2480
|
+
if (k.files.some((t) => t.assetId === e)) return;
|
|
2481
|
+
let t = i.get(e);
|
|
2482
|
+
t && re(e, t.filename || `Asset #${e}`, Y(t.uploadToken) || n[e] || null, Y(t.deleteToken) || null, Y(t.uploadUid) || null, Y(t.attachToken) || null);
|
|
2483
|
+
}), $(k), M();
|
|
2422
2484
|
} catch (e) {
|
|
2423
|
-
|
|
2485
|
+
q.warn("Failed to hydrate uploaded assets.", { error: e });
|
|
2424
2486
|
}
|
|
2425
|
-
},
|
|
2426
|
-
|
|
2427
|
-
let n =
|
|
2487
|
+
}, P = (e) => e && k.files.find((t) => t.uppyFileId === e) || null;
|
|
2488
|
+
T.on("upload-progress", (e, t) => {
|
|
2489
|
+
let n = P(e?.id);
|
|
2428
2490
|
if (!n) return;
|
|
2429
2491
|
let r = t.bytesTotal || 0, i = t.bytesUploaded || 0, a = r > 0 ? Math.round(i / r * 100) : 0;
|
|
2430
|
-
|
|
2492
|
+
bt(n.listItem, a, {
|
|
2431
2493
|
loaded: i,
|
|
2432
2494
|
total: r
|
|
2433
2495
|
});
|
|
2434
|
-
}),
|
|
2435
|
-
let t =
|
|
2436
|
-
t &&
|
|
2437
|
-
}),
|
|
2438
|
-
let n =
|
|
2496
|
+
}), T.on("upload-retry", (e) => {
|
|
2497
|
+
let t = P(e?.id);
|
|
2498
|
+
t && Q(t.listItem, "Retrying…", "retrying");
|
|
2499
|
+
}), T.on("upload-success", (e, t) => {
|
|
2500
|
+
let n = P(e?.id);
|
|
2439
2501
|
if (!n) return;
|
|
2440
|
-
let r = n.listItem.querySelector("[data-formie-upload-manager-error]"), i =
|
|
2502
|
+
let r = n.listItem.querySelector("[data-formie-upload-manager-error]"), i = st(t?.body) ? t.body : {}, a = J(i.assetId);
|
|
2441
2503
|
if (!i.success || !a) {
|
|
2442
|
-
if (
|
|
2443
|
-
r.hidden = !1, r.textContent =
|
|
2504
|
+
if (wt(n.listItem), r instanceof HTMLElement) {
|
|
2505
|
+
r.hidden = !1, r.textContent = xt(null, { message: "Upload failed." });
|
|
2444
2506
|
let e = i.errors ? Object.values(i.errors).flat().find(Boolean) : null;
|
|
2445
2507
|
e && (r.textContent = e);
|
|
2446
2508
|
}
|
|
2447
2509
|
return;
|
|
2448
2510
|
}
|
|
2449
|
-
n.assetId = a, n.filename = i.filename || n.filename,
|
|
2450
|
-
}),
|
|
2451
|
-
let r =
|
|
2511
|
+
n.assetId = a, n.uploadToken = Y(i.uploadToken) || null, n.deleteToken = Y(i.deleteToken) || null, n.uploadUid = Y(i.uploadUid) || null, n.attachToken = Y(i.attachToken) || null, n.filename = i.filename || n.filename, Ct(n.listItem), $(k), M();
|
|
2512
|
+
}), T.on("upload-error", (e, t, n) => {
|
|
2513
|
+
let r = P(e?.id);
|
|
2452
2514
|
if (!r) return;
|
|
2453
2515
|
let i = r.listItem.querySelector("[data-formie-upload-manager-error]");
|
|
2454
|
-
|
|
2455
|
-
}),
|
|
2456
|
-
let n =
|
|
2516
|
+
wt(r.listItem), i instanceof HTMLElement && (i.hidden = !1, i.textContent = xt(n, t));
|
|
2517
|
+
}), T.on("file-added", (t) => {
|
|
2518
|
+
let n = ee();
|
|
2457
2519
|
if (n !== null && n <= 0) {
|
|
2458
|
-
|
|
2520
|
+
T.removeFile(t.id), T.info("File limit reached.", "error", 3e3);
|
|
2459
2521
|
return;
|
|
2460
2522
|
}
|
|
2461
|
-
|
|
2462
|
-
let { listItem: r, removeButton:
|
|
2463
|
-
|
|
2464
|
-
let
|
|
2523
|
+
T.setFileMeta(t.id, ht(f, e, a));
|
|
2524
|
+
let { listItem: r, removeButton: i, sortUpButton: o, sortDownButton: s } = Et(e, t.name || "Upload");
|
|
2525
|
+
u.append(r);
|
|
2526
|
+
let c = {
|
|
2465
2527
|
assetId: null,
|
|
2528
|
+
uploadToken: null,
|
|
2529
|
+
uploadUid: null,
|
|
2530
|
+
attachToken: null,
|
|
2466
2531
|
filename: t.name || "Upload",
|
|
2467
2532
|
uppyFileId: t.id,
|
|
2468
2533
|
listItem: r
|
|
2469
2534
|
};
|
|
2470
|
-
|
|
2535
|
+
te(c, i, o, s), k.files.push(c), M();
|
|
2471
2536
|
});
|
|
2472
|
-
let
|
|
2537
|
+
let F = () => {
|
|
2473
2538
|
o.click();
|
|
2474
2539
|
};
|
|
2475
|
-
|
|
2476
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2477
|
-
}),
|
|
2478
|
-
e.target instanceof Element && e.target.closest(
|
|
2479
|
-
}),
|
|
2480
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
2540
|
+
c?.addEventListener("click", (e) => {
|
|
2541
|
+
e.preventDefault(), e.stopPropagation(), F();
|
|
2542
|
+
}), a.addEventListener("click", (e) => {
|
|
2543
|
+
e.target instanceof Element && e.target.closest(Ke) || F();
|
|
2544
|
+
}), a.addEventListener("keydown", (e) => {
|
|
2545
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), F());
|
|
2481
2546
|
}), o.addEventListener("change", () => {
|
|
2482
2547
|
if (!o.files?.length) return;
|
|
2483
2548
|
let e = Array.from(o.files);
|
|
2484
|
-
o.value = "";
|
|
2549
|
+
o.value = "", D();
|
|
2485
2550
|
try {
|
|
2486
|
-
|
|
2551
|
+
T.addFiles(e.map((e) => ({
|
|
2487
2552
|
name: e.name,
|
|
2488
2553
|
type: e.type,
|
|
2489
2554
|
data: e
|
|
2490
2555
|
})));
|
|
2491
2556
|
} catch (e) {
|
|
2492
|
-
e instanceof Error &&
|
|
2557
|
+
e instanceof Error && T.info(e.message, "error", 3e3);
|
|
2493
2558
|
}
|
|
2494
2559
|
}), ["dragenter", "dragover"].forEach((e) => {
|
|
2495
|
-
|
|
2496
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2560
|
+
a.addEventListener(e, (e) => {
|
|
2561
|
+
e.preventDefault(), e.stopPropagation(), A(!0);
|
|
2497
2562
|
});
|
|
2498
2563
|
}), ["dragleave", "drop"].forEach((e) => {
|
|
2499
|
-
|
|
2500
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2564
|
+
a.addEventListener(e, (e) => {
|
|
2565
|
+
e.preventDefault(), e.stopPropagation(), A(!1);
|
|
2501
2566
|
});
|
|
2502
|
-
}),
|
|
2567
|
+
}), a.addEventListener("drop", (e) => {
|
|
2503
2568
|
let t = e.dataTransfer;
|
|
2504
2569
|
if (!t?.files?.length) return;
|
|
2505
2570
|
let n = Array.from(t.files);
|
|
2571
|
+
D();
|
|
2506
2572
|
try {
|
|
2507
|
-
|
|
2573
|
+
T.addFiles(n.map((e) => ({
|
|
2508
2574
|
name: e.name,
|
|
2509
2575
|
type: e.type,
|
|
2510
2576
|
data: e
|
|
2511
2577
|
})));
|
|
2512
2578
|
} catch (e) {
|
|
2513
|
-
e instanceof Error &&
|
|
2579
|
+
e instanceof Error && T.info(e.message, "error", 3e3);
|
|
2514
2580
|
}
|
|
2515
2581
|
});
|
|
2516
|
-
let
|
|
2517
|
-
|
|
2582
|
+
let I = () => {
|
|
2583
|
+
D(), k.files.forEach((e) => {
|
|
2518
2584
|
e.listItem.remove();
|
|
2519
|
-
}),
|
|
2585
|
+
}), k.files = [], T.cancelAll(), mt(e, g, h, []);
|
|
2520
2586
|
};
|
|
2521
|
-
return
|
|
2522
|
-
|
|
2587
|
+
return f?.addEventListener($e, I), ie(), () => {
|
|
2588
|
+
f?.removeEventListener($e, I), T.destroy(), E.remove(), k.files = [];
|
|
2523
2589
|
};
|
|
2524
2590
|
}
|
|
2525
|
-
var
|
|
2526
|
-
|
|
2591
|
+
var Nt = {
|
|
2592
|
+
moduleId: `formie:${tt}`,
|
|
2593
|
+
version: 2,
|
|
2594
|
+
surfaces: [
|
|
2595
|
+
"server-rendered",
|
|
2596
|
+
"client-rendered",
|
|
2597
|
+
"cp-edit"
|
|
2598
|
+
],
|
|
2527
2599
|
kind: "field",
|
|
2528
|
-
match: (e) => !!e.target.querySelector(
|
|
2600
|
+
match: (e) => !!e.target.querySelector(V),
|
|
2529
2601
|
setup: async (e) => {
|
|
2530
2602
|
let t = e.options || {}, n = e.form, r = /* @__PURE__ */ new WeakSet(), i = [];
|
|
2531
|
-
|
|
2603
|
+
kt(n);
|
|
2532
2604
|
let a = (e) => {
|
|
2533
2605
|
let a = /* @__PURE__ */ new Set();
|
|
2534
2606
|
e instanceof HTMLElement && e.hasAttribute("data-formie-field-handle") && a.add(e), e instanceof Element && (e.querySelectorAll("[data-formie-field-handle]").forEach((e) => {
|
|
2535
2607
|
e instanceof HTMLElement && a.add(e);
|
|
2536
|
-
}), e.querySelectorAll(
|
|
2608
|
+
}), e.querySelectorAll(V).forEach((e) => {
|
|
2537
2609
|
let t = e.closest("[data-formie-field-handle]");
|
|
2538
2610
|
t instanceof HTMLElement && a.add(t);
|
|
2539
2611
|
})), a.forEach((e) => {
|
|
2540
|
-
r.has(e)
|
|
2612
|
+
!r.has(e) && e.querySelector(V) && (r.add(e), i.push(Mt(e, n, t)));
|
|
2541
2613
|
});
|
|
2542
2614
|
};
|
|
2543
2615
|
a(e.target);
|
|
2544
2616
|
let o = (e) => {
|
|
2545
2617
|
let t = e.detail;
|
|
2546
|
-
if (!
|
|
2618
|
+
if (!st(t)) return;
|
|
2547
2619
|
let n = t.row;
|
|
2548
2620
|
n instanceof HTMLElement && a(n);
|
|
2549
2621
|
};
|
|
2550
|
-
return n?.addEventListener(
|
|
2551
|
-
n?.removeEventListener(
|
|
2622
|
+
return n?.addEventListener(et, o), q.log("Module setup.", { count: i.length }), await e.emit("formie:module:upload-manager:init", { count: i.length }), { destroy: () => {
|
|
2623
|
+
n?.removeEventListener(et, o), i.forEach((e) => {
|
|
2552
2624
|
e();
|
|
2553
|
-
}),
|
|
2625
|
+
}), At(n), q.log("Module destroy."), e.emit("formie:module:upload-manager:destroy", {});
|
|
2554
2626
|
} };
|
|
2555
2627
|
}
|
|
2556
2628
|
};
|
|
2557
2629
|
//#endregion
|
|
2558
|
-
export {
|
|
2630
|
+
export { Nt as uploadManagerModule };
|