@abtnode/blocklet-services 1.16.26-beta-351de484 → 1.16.26-beta-63f52a83
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/api/libs/auth/adapters/apple.js +3 -0
- package/api/libs/auth/index.js +2 -1
- package/api/middlewares/check-running.js +3 -1
- package/api/routes/oauth.js +13 -5
- package/api/routes/user-session.js +10 -4
- package/api/routes/user.js +15 -7
- package/api/services/auth/connect/invite.js +6 -5
- package/api/services/auth/connect/issue-passport.js +6 -5
- package/api/services/auth/connect/login.js +1 -0
- package/api/services/auth/session.js +37 -2
- package/api/services/oauth/index.js +1 -1
- package/api/util/index.js +1 -4
- package/dist/assets/{Add-C69qn2wR.js → Add-wq3K3S8N.js} +1 -1
- package/dist/assets/{AddBox-B6Fwg2Rf.js → AddBox-a3huCt7Z.js} +1 -1
- package/dist/assets/Alert-AeJ1R0Ji.js +1 -0
- package/dist/assets/{ArrowDropDown-BP0ud9Hj.js → ArrowDropDown-QBtbt6dl.js} +1 -1
- package/dist/assets/{Avatar-D2tnGRpU.js → Avatar-CbYlXxe5.js} +1 -1
- package/dist/assets/{ButtonGroup-BLLuxmvy.js → ButtonGroup-Dr1wINhL.js} +1 -1
- package/dist/assets/{CheckCircle-BfaSnFeT.js → CheckCircle-FvPC4iRr.js} +1 -1
- package/dist/assets/{ChevronRight-Cy-7I5by.js → ChevronRight-B8Tr2-kK.js} +1 -1
- package/dist/assets/{CloseOutlined-sn7xb1bx.js → CloseOutlined-CiEIAAqH.js} +1 -1
- package/dist/assets/{Delete-B2AHSgLp.js → Delete-DdNrAas3.js} +1 -1
- package/dist/assets/{DeleteOutline-CoZFf1fL.js → DeleteOutline-CqfMaUnc.js} +1 -1
- package/dist/assets/{Done-DIK-gyz7.js → Done-W8gzfT_5.js} +1 -1
- package/dist/assets/{Download-DTMBVNgK.js → Download-BC3qtlUd.js} +1 -1
- package/dist/assets/{Edit-6i4-SV5e.js → Edit-DaZNrrOH.js} +1 -1
- package/dist/assets/{EditIcon-DR2M6B2a.js → EditIcon-CnJwBmy2.js} +1 -1
- package/dist/assets/{Error-D5jNQIhZ.js → Error-BXB8PYOq.js} +1 -1
- package/dist/assets/{ExpandMore-BlRkbxIp.js → ExpandMore-C3wlzrO6.js} +1 -1
- package/dist/assets/{FilterList-5-9UBP9o.js → FilterList-soA8TS15.js} +1 -1
- package/dist/assets/{FormControl-DqRtQrj4.js → FormControl-CJq7Xfma.js} +1 -1
- package/dist/assets/{FormControlLabel-CgWEo7K_.js → FormControlLabel-6GUtJ3UI.js} +1 -1
- package/dist/assets/FormGroup-wC9N37Ln.js +1 -0
- package/dist/assets/{Google-Dqg-7vso.js → Google-BufVmtgT.js} +1 -1
- package/dist/assets/{Grid-BIu6B9VD.js → Grid-pyRe8btq.js} +1 -1
- package/dist/assets/{Hidden-CyJIFPqO.js → Hidden-BDqqTjop.js} +1 -1
- package/dist/assets/{InfoOutlined-BrDpDVIb.js → InfoOutlined-BfwDDLiK.js} +1 -1
- package/dist/assets/{InputAdornment-4xRIAUiI.js → InputAdornment-C_Fsz_Fg.js} +1 -1
- package/dist/assets/{InputLabel-Ci8Zez4U.js → InputLabel-BKPmNudA.js} +1 -1
- package/dist/assets/{LastPage-u0X1CCrf.js → LastPage-2HRADEqb.js} +1 -1
- package/dist/assets/{Launch-CPOdFkdd.js → Launch-DAeEHLJt.js} +1 -1
- package/dist/assets/{LaunchOutlined-BFmhp0eE.js → LaunchOutlined-DpspIgnU.js} +1 -1
- package/dist/assets/{Link-3QVwMQPk.js → Link-BhFnPrd2.js} +1 -1
- package/dist/assets/{ListItemText-BbCA9KKV.js → ListItemText-DeMaBW89.js} +1 -1
- package/dist/assets/{LockIcon-BH8DxlZk.js → LockIcon-DarkAnSi.js} +1 -1
- package/dist/assets/{Loop-DH87MBn_.js → Loop-DqznqNl_.js} +1 -1
- package/dist/assets/{MoreHoriz-BgseW-ge.js → MoreHoriz-BREdPNxQ.js} +1 -1
- package/dist/assets/{MoreVert-K_1niM7c.js → MoreVert-CXjMcYsr.js} +1 -1
- package/dist/assets/{OpenInNew-CjFvxH6M.js → OpenInNew-BV4lXYOl.js} +1 -1
- package/dist/assets/{Pagination-DKihrHVe.js → Pagination-yXfVrXV-.js} +1 -1
- package/dist/assets/PlayArrow-BII9eapC.js +1 -0
- package/dist/assets/{RadioGroup-YSjZvhX-.js → RadioGroup-D3tXB92J.js} +1 -1
- package/dist/assets/{Search-BR5ea3vd.js → Search-DxjUq8WV.js} +1 -1
- package/dist/assets/{Select-CKfMC7P9.js → Select-Cl7jr-Au.js} +2 -2
- package/dist/assets/{ServerLogo-C8axw3cY.js → ServerLogo-PN_tOEc_.js} +1 -1
- package/dist/assets/{Skeleton-DlvCFRkz.js → Skeleton-3bt4KCgR.js} +3 -3
- package/dist/assets/{Slider-BR3lL8ok.js → Slider-VR8fYgQ1.js} +1 -1
- package/dist/assets/{Stepper-CQAZ_wrh.js → Stepper-DcXy94Rg.js} +1 -1
- package/dist/assets/{TableRow-G_vHt3-a.js → TableRow-C9biku2f.js} +2 -2
- package/dist/assets/{TextField-DvirKXAG.js → TextField-TSikKYan.js} +1 -1
- package/dist/assets/{Toolbar-BwsW1-XD.js → Toolbar-C-qwCTaG.js} +1 -1
- package/dist/assets/{ViewList-DRQAW-9s.js → ViewList-C5EiQpXT.js} +1 -1
- package/dist/assets/access-control-DKZ_6Mft.js +13 -0
- package/dist/assets/{actions-BJosy9X2.js → actions-DX0vxC2x.js} +1 -1
- package/dist/assets/{add-component-core-Bd75KmSE.js → add-component-core-DrmZbwKZ.js} +58 -57
- package/dist/assets/add-resource-C8x0CQeQ.js +1 -0
- package/dist/assets/{addon-BdxxNkJH.js → addon-oHVHML4Z.js} +1 -1
- package/dist/assets/{analytics-2367oE4k.js → analytics-BqHiZXGu.js} +1 -1
- package/dist/assets/api-CefHmPpT.js +1 -0
- package/dist/assets/ar-CmjKzXiM.js +1 -0
- package/dist/assets/{audit-logs-C9bazLVN.js → audit-logs-DbzFLcIc.js} +1 -1
- package/dist/assets/{button-DbDB2qx6.js → button-D7T8hUwS.js} +1 -1
- package/dist/assets/{click-to-copy-CZvSRIGN.js → click-to-copy-CEYD8rZu.js} +1 -1
- package/dist/assets/{complete-C8SMtDzc.js → complete-CVQBghtq.js} +1 -1
- package/dist/assets/{component-DAWLQ6nL.js → component--4UTcMPh.js} +57 -35
- package/dist/assets/{config-DpteWrvn.js → config-ClMGUD_s.js} +2 -2
- package/dist/assets/{config-DY1CerHN.js → config-DPW6RN7f.js} +1 -1
- package/dist/assets/{config-navigation-DUYmMrZ9.js → config-navigation-oMPN9B_B.js} +1 -1
- package/dist/assets/{config-space-B7Cgf5Se.js → config-space-D4Odh64U.js} +1 -1
- package/dist/assets/{confirm-pPzim8uI.js → confirm-BpbD98r0.js} +1 -1
- package/dist/assets/{connect-4dSo0Eiu.js → connect-DGuTTy26.js} +1 -1
- package/dist/assets/{connect-M2gGxpP6.js → connect-oaGanWb8.js} +1 -1
- package/dist/assets/{connect-to-B8kCNKHN.js → connect-to-3xwIHcHn.js} +2 -2
- package/dist/assets/{content-layout-6_5eggY7.js → content-layout-BAtirHjd.js} +1 -1
- package/dist/assets/dashboard-nnP33m90.js +134 -0
- package/dist/assets/de-1i1rpVGy.js +1 -0
- package/dist/assets/{did-address-CL3Ygw6p.js → did-address-C8LHTEPs.js} +1 -1
- package/dist/assets/{domain-ngITiwlU.js → domain-Bbh6oxOt.js} +1 -1
- package/dist/assets/domain-list-BXY_QQIA.js +12 -0
- package/dist/assets/es-B63xrBF8.js +1 -0
- package/dist/assets/{exchange-passport-D3hdhtRp.js → exchange-passport-CDHq-p_h.js} +1 -1
- package/dist/assets/{fallback-C7-7MBkn.js → fallback-COb8X0HB.js} +1 -1
- package/dist/assets/fr-CiSjR8sO.js +1 -0
- package/dist/assets/{fuel-Cc2B50AI.js → fuel-c20C7se8.js} +1 -1
- package/dist/assets/{fullpage-Dw6TVBrW.js → fullpage-CglmHMez.js} +1 -1
- package/dist/assets/hi-CmN3rbg5.js +1 -0
- package/dist/assets/{home-xAHytUWc.js → home-ByATld9X.js} +1 -1
- package/dist/assets/id-B9e1ETpi.js +1 -0
- package/dist/assets/{iframe-CjfFUNKJ.js → iframe-rf9uwL5E.js} +1 -1
- package/dist/assets/{index-DoFezns_.js → index-9gdShBVt.js} +1 -1
- package/dist/assets/index-B05Db2Ns.js +16 -0
- package/dist/assets/{index-C5wALap9.js → index-B29IbhC9.js} +1 -1
- package/dist/assets/{index-BlQH_bza.js → index-B3BoU7cW.js} +7 -7
- package/dist/assets/{index-i3hx5_MJ.js → index-BU47DxN0.js} +1 -1
- package/dist/assets/{index-CS4hdKgN.js → index-BUuKDGn7.js} +1 -1
- package/dist/assets/{index-q83gH7uv.js → index-BXIedBZ6.js} +1 -1
- package/dist/assets/{index-DNO8iFFj.js → index-B_y65RU8.js} +9 -9
- package/dist/assets/{index-Bqkn_aa3.js → index-Bh3fbWz9.js} +1 -1
- package/dist/assets/{index-lps3yS0-.js → index-BisDKl6l.js} +8 -8
- package/dist/assets/{index-MHeXbht_.js → index-BjZoVrCi.js} +103 -103
- package/dist/assets/{index-CJpqNyVi.js → index-Bwv7AG9N.js} +4 -4
- package/dist/assets/index-C6mOMD3e.js +262 -0
- package/dist/assets/{index-5x037-9C.js → index-CHhP84BV.js} +2 -2
- package/dist/assets/{index-BWj9cvWK.js → index-CPSIBCmf.js} +1 -1
- package/dist/assets/{index-pr0coJZh.js → index-CUi6XG87.js} +4 -4
- package/dist/assets/{index-CYMsHjcv.js → index-C_1DpacI.js} +1 -1
- package/dist/assets/{index-56o2iokr.js → index-CbK1pHld.js} +1 -1
- package/dist/assets/index-D2wkr_9R.js +221 -0
- package/dist/assets/index-DCDzYQMB.js +1 -0
- package/dist/assets/{index-Dwkydwe_.js → index-DDXxu2V0.js} +7 -7
- package/dist/assets/{index-8MsvtmQl.js → index-DE4Fz0yq.js} +1 -1
- package/dist/assets/{index-BpozpbRW.js → index-DIGh8Teu.js} +2 -2
- package/dist/assets/{index-DlPsSbdP.js → index-DPGe_CmP.js} +1 -1
- package/dist/assets/{index-iaLkEwzP.js → index-DRRv3qFX.js} +1 -1
- package/dist/assets/{index-D9bkjrIm.js → index-Dk2_L9Cb.js} +1 -1
- package/dist/assets/{index-Coe2L95f.js → index-DqicrHi6.js} +1 -1
- package/dist/assets/{index-C2bRXXcw.js → index-GzgoR6kP.js} +1 -1
- package/dist/assets/index-j--bQGLl.js +4 -0
- package/dist/assets/{index-DSr4gSZ6.js → index-yMkC5dZG.js} +1 -1
- package/dist/assets/{index.es-BbZKY7XB.js → index.es-qkddoL5U.js} +1 -1
- package/dist/assets/index.esm-j7Y5H-V0.js +1 -0
- package/dist/assets/info-outline-rounded-CAtoxPQe.js +57 -0
- package/dist/assets/{invitation-MLAwJ9Ra.js → invitation-BL94n7u7.js} +1 -1
- package/dist/assets/{invite-DkO9FeY_.js → invite-CnE7XY1Z.js} +1 -1
- package/dist/assets/{issue-passport-C7JZcRZR.js → issue-passport-BVBEMRGD.js} +1 -1
- package/dist/assets/{item-MF9V1-6K.js → item-BfrZyNeB.js} +1 -1
- package/dist/assets/ja-u7LzudUH.js +1 -0
- package/dist/assets/{jss-plugin-props-sort.esm-rVwFJx4d.js → jss-plugin-props-sort.esm-Bl2Rw-QZ.js} +6 -6
- package/dist/assets/ko-Bwaycrvp.js +1 -0
- package/dist/assets/{launch-result-message-DEcCutu3.js → launch-result-message-Bql_D20B.js} +1 -1
- package/dist/assets/{layout-DOFQutAQ.js → layout-CXJf_Rrv.js} +2 -2
- package/dist/assets/{list-header-F6N0Lbga.js → list-header-kKYEDQWv.js} +1 -1
- package/dist/assets/localization-nliBxJ-D.js +1 -0
- package/dist/assets/{log-_MCoFO-Q.js → log-VtW4qFO_.js} +1 -1
- package/dist/assets/{login-g24bmOOt.js → login-DLrRvrvd.js} +1 -1
- package/dist/assets/login-oauth-callback-JEz55t-G.js +1 -0
- package/dist/assets/{logo-uploader-j0OGjkoc.js → logo-uploader-CHy1V18F.js} +3 -3
- package/dist/assets/{lost-passport-CFNDhKO4.js → lost-passport-B3qTZVPf.js} +3 -3
- package/dist/assets/{lottie-sLx_MIFH.js → lottie-DEoLwZAx.js} +1 -1
- package/dist/assets/{notifications-BdAvASdZ.js → notifications-CR7EXwBF.js} +2 -2
- package/dist/assets/overview-BBCCr1Vd.js +12 -0
- package/dist/assets/{page-header-iStgNt-t.js → page-header-BmCsNjq6.js} +1 -1
- package/dist/assets/{permission-DFHjiPOO.js → permission-D1UMw4p9.js} +1 -1
- package/dist/assets/{preferences-CBDwdPlD.js → preferences-v04BMnj5.js} +1 -1
- package/dist/assets/pt-yexEAmVM.js +1 -0
- package/dist/assets/publish-resource-DnjdsY2v.js +1 -0
- package/dist/assets/{react-4Vr75H9n.js → react-Bm9MpxNr.js} +8 -8
- package/dist/assets/{redux-BwEqkH3a.js → redux-LM7tQupS.js} +1 -1
- package/dist/assets/ru-CZZrKeyD.js +1 -0
- package/dist/assets/{selector-haOpsVEc.js → selector-DX2rg91W.js} +3 -3
- package/dist/assets/session-gABemNhB.js +1 -0
- package/dist/assets/setup-DubProJv.js +19 -0
- package/dist/assets/{slicedToArray-x22-0sXq.js → slicedToArray-C3coSglk.js} +2 -2
- package/dist/assets/spaces-V708wb9Z.js +1 -0
- package/dist/assets/start-BDyrLr5o.js +186 -0
- package/dist/assets/{step-actions-AXZRiRyD.js → step-actions-BCYlCgff.js} +1 -1
- package/dist/assets/{studio-DmUAxFbb.js → studio-BQwrI_FJ.js} +1 -1
- package/dist/assets/{switch-control-Lx0DlzPA.js → switch-control-CCrwzQnk.js} +1 -1
- package/dist/assets/th-Bd1vOYLA.js +1 -0
- package/dist/assets/{toUpper-BgobQRvN.js → toUpper-BFW0USLO.js} +1 -1
- package/dist/assets/{transfer-WMTLv9DH.js → transfer-1_LjcvIR.js} +1 -1
- package/dist/assets/uniqBy-DZwfVFVL.js +1 -0
- package/dist/assets/{unsubscribe-BFzCxIJM.js → unsubscribe-CYer6hWm.js} +1 -1
- package/dist/assets/{use-blocklet-info-for-connect-did-spaces-CIjBkljS.js → use-blocklet-info-for-connect-did-spaces-DuJeGPlM.js} +1 -1
- package/dist/assets/{useAsync-ByTahkQO.js → useAsync-BT0mXFoa.js} +1 -1
- package/dist/assets/{useFormControl-CeAUerJZ.js → useFormControl-DQK7RvNb.js} +1 -1
- package/dist/assets/{useLocalStorage-B_i310mR.js → useLocalStorage-qtxzz8XA.js} +1 -1
- package/dist/assets/{useSetState-BB4kdpGs.js → useSetState-Cz5XYWAQ.js} +1 -1
- package/dist/assets/{useSlot-CsiuTStm.js → useSlot-BDG4HR3S.js} +1 -1
- package/dist/assets/{user-center-sGvXEgY6.js → user-center-Dbl7h7gJ.js} +1 -1
- package/dist/assets/user-sessions-6LIYsTwc.js +1 -0
- package/dist/assets/{util-DeMILzW3.js → util-DqcQm4xd.js} +1 -1
- package/dist/assets/vi-D-6-T7Z8.js +1 -0
- package/dist/assets/wrap-locale-CcEfDBvh.js +1 -0
- package/dist/assets/zh-DOTV37ZA.js +2 -0
- package/dist/assets/zh-tw-DJTikE7z.js +1 -0
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +25 -25
- package/dist/assets/Alert-ssp0y7Ib.js +0 -1
- package/dist/assets/FormGroup-BmQQZp_5.js +0 -1
- package/dist/assets/PlayArrow-DOP79lp-.js +0 -1
- package/dist/assets/access-control-CjZfkzkf.js +0 -13
- package/dist/assets/add-resource-Blgo6VIb.js +0 -1
- package/dist/assets/api-DcYvzDkD.js +0 -1
- package/dist/assets/ar-D80LEtfP.js +0 -1
- package/dist/assets/dashboard-nWvY-y5T.js +0 -134
- package/dist/assets/de-R8SpyfWD.js +0 -1
- package/dist/assets/domain-list-D3SCkX5b.js +0 -12
- package/dist/assets/es-DQJXbL8c.js +0 -1
- package/dist/assets/fr-ojA_joLk.js +0 -1
- package/dist/assets/hi-BQAxHgmg.js +0 -1
- package/dist/assets/id-BerMjI8d.js +0 -1
- package/dist/assets/index-BXDXNTsu.js +0 -262
- package/dist/assets/index-BmYpFvRB.js +0 -1
- package/dist/assets/index-C7FkvChp.js +0 -221
- package/dist/assets/index-CYChkNo6.js +0 -4
- package/dist/assets/index-uI5ivd9H.js +0 -16
- package/dist/assets/index.esm-Bx08zGob.js +0 -1
- package/dist/assets/info-outline-rounded-Bfjx6SIO.js +0 -57
- package/dist/assets/ja-BO4aqMDb.js +0 -1
- package/dist/assets/ko-Cv-NiLYG.js +0 -1
- package/dist/assets/localization-BSGMGQL8.js +0 -1
- package/dist/assets/login-oauth-callback-IIluZQpi.js +0 -1
- package/dist/assets/overview-Buny86cT.js +0 -12
- package/dist/assets/pt-DfarVqto.js +0 -1
- package/dist/assets/publish-resource-B8njhGLx.js +0 -1
- package/dist/assets/ru-DeqfYyhe.js +0 -1
- package/dist/assets/session-BxfJegkk.js +0 -1
- package/dist/assets/setup-DMBqOQvQ.js +0 -19
- package/dist/assets/spaces-fv1YlSu4.js +0 -1
- package/dist/assets/start-CmsOWeku.js +0 -186
- package/dist/assets/th-BEfUwHXu.js +0 -1
- package/dist/assets/uniqBy-BnjBhJxf.js +0 -1
- package/dist/assets/user-sessions-BBUW9BFw.js +0 -1
- package/dist/assets/vi-CVN1WwF4.js +0 -1
- package/dist/assets/wrap-locale-CeRDb2BZ.js +0 -1
- package/dist/assets/zh-Bgfgr3pp.js +0 -2
- package/dist/assets/zh-tw-kaMajsUI.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
function __vite__mapDeps(indexes) {
|
|
2
2
|
if (!__vite__mapDeps.viteFileDeps) {
|
|
3
|
-
__vite__mapDeps.viteFileDeps = ["assets/index-
|
|
3
|
+
__vite__mapDeps.viteFileDeps = ["assets/index-Bwv7AG9N.js","assets/index-BjZoVrCi.js","assets/index-CCovGSMB.css","assets/Grid-pyRe8btq.js","assets/TextField-TSikKYan.js","assets/FormControl-CJq7Xfma.js","assets/useFormControl-DQK7RvNb.js","assets/InputLabel-BKPmNudA.js","assets/Select-Cl7jr-Au.js","assets/RadioGroup-D3tXB92J.js","assets/FormControlLabel-6GUtJ3UI.js","assets/FormGroup-wC9N37Ln.js","assets/Slider-VR8fYgQ1.js","assets/useSlot-BDG4HR3S.js","assets/Skeleton-3bt4KCgR.js","assets/index-DRRv3qFX.js","assets/preact.module-B1z5cdvs.js","assets/index-9gdShBVt.js","assets/index-Dk2_L9Cb.js","assets/toUpper-BFW0USLO.js","assets/index-DDXxu2V0.js","assets/fallback-COb8X0HB.js","assets/index-B3BoU7cW.js","assets/Toolbar-C-qwCTaG.js","assets/Hidden-BDqqTjop.js","assets/MoreHoriz-BREdPNxQ.js","assets/ExpandMore-C3wlzrO6.js","assets/index-DIGh8Teu.js","assets/MoreVert-CXjMcYsr.js","assets/selector-DX2rg91W.js","assets/Avatar-CbYlXxe5.js","assets/info-outline-rounded-CAtoxPQe.js","assets/index-D-XBJ_hS.js","assets/OpenInNew-BV4lXYOl.js","assets/CloseOutlined-CiEIAAqH.js","assets/index-CbK1pHld.js","assets/index-DPGe_CmP.js","assets/index-DqicrHi6.js","assets/index-GzgoR6kP.js","assets/FilterList-soA8TS15.js","assets/TableRow-C9biku2f.js","assets/ListItemText-DeMaBW89.js","assets/LastPage-2HRADEqb.js","assets/index-B_y65RU8.js","assets/redux-LM7tQupS.js","assets/Search-DxjUq8WV.js","assets/Delete-DdNrAas3.js","assets/uniqBy-DZwfVFVL.js"]
|
|
4
4
|
}
|
|
5
5
|
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
6
6
|
}
|
|
7
|
-
var Xd=Object.defineProperty;var Qd=(i,e,t)=>e in i?Xd(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Oe=(i,e,t)=>(Qd(i,typeof e!="symbol"?e+"":e,t),t);import{
|
|
7
|
+
var Xd=Object.defineProperty;var Qd=(i,e,t)=>e in i?Xd(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Oe=(i,e,t)=>(Qd(i,typeof e!="symbol"?e+"":e,t),t);import{ao as Yd,j as $e,gW as Jd,dE as Zd,eL as eh,b8 as tt,gX as th,gY as nu,gZ as au,g_ as su,et as Qo,dx as us,eE as At,g$ as to,P as R,r as ne,co as Nr,h0 as Lr,c as Yo,h1 as ih,a0 as ou,M as nh,a2 as ah,h2 as sh,ev as oh,B as ru,ay as rh,h3 as lh,eO as ch,dC as uh}from"./index-BjZoVrCi.js";import{p as ph,u as dh}from"./index-DRRv3qFX.js";import{N as Br,y as d,b as dt,l as io,g as ot,$ as Ct,_ as hh,B as lu}from"./preact.module-B1z5cdvs.js";import{a as mh}from"./index-9gdShBVt.js";import{c as fe}from"./index-Dk2_L9Cb.js";import{m as Mr,t as fh}from"./toUpper-BFW0USLO.js";import"./index-DDXxu2V0.js";import"./index-DIGh8Teu.js";import{W as gh}from"./info-outline-rounded-CAtoxPQe.js";import"./index-CbK1pHld.js";import"./index-DPGe_CmP.js";import"./fallback-COb8X0HB.js";import"./index-DqicrHi6.js";import"./index-GzgoR6kP.js";import{u as cu}from"./uniqBy-DZwfVFVL.js";const vh=Yd($e.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}),"CancelOutlined");function bh(i,e,t,n){for(var a=-1,s=i==null?0:i.length;++a<s;){var o=i[a];e(n,o,t(o),i)}return n}var yh=bh,xh=Jd;function wh(i,e,t,n){return xh(i,function(a,s,o){e(n,a,t(a),o)}),n}var Ph=wh,Sh=yh,Fh=Ph,_h=Zd,Ch=eh;function Eh(i,e){return function(t,n){var a=Ch(t)?Sh:Fh,s=e?e():{};return a(t,i,_h(n),s)}}var kh=Eh,Th=th,Oh=kh,Ah=Oh(function(i,e,t){Th(i,t,e)}),Dh=Ah;const uu=tt(Dh);function ta(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Rh=0;function pu(i){return"__private_"+Rh+++"_"+i}function Ih(i,e,t){const n=[];return i.forEach(a=>typeof a!="string"?n.push(a):e[Symbol.split](a).forEach((s,o,r)=>{s!==""&&n.push(s),o<r.length-1&&n.push(t)})),n}/**
|
|
8
8
|
* Takes a string with placeholder variables like `%{smart_count} file selected`
|
|
9
9
|
* and replaces it with values from options `{smart_count: 5}`
|
|
10
10
|
*
|
|
@@ -13,17 +13,17 @@ var Xd=Object.defineProperty;var Qd=(i,e,t)=>e in i?Xd(i,e,{enumerable:!0,config
|
|
|
13
13
|
*
|
|
14
14
|
* @param phrase that needs interpolation, with placeholders
|
|
15
15
|
* @param options with values that will be used to replace placeholders
|
|
16
|
-
*/function jr(i,e){const t=/\$/g,n="$$$$";let a=[i];if(e==null)return a;for(const s of Object.keys(e))if(s!=="_"){let o=e[s];typeof o=="string"&&(o=t[Symbol.replace](o,n)),a=Ih(a,new RegExp(`%\\{${s}\\}`,"g"),o)}return a}const Uh=i=>{throw new Error(`missing string: ${i}`)};var Di=pu("onMissingKey"),Ri=pu("apply");class du{constructor(e,t){let{onMissingKey:n=Uh}=t===void 0?{}:t;Object.defineProperty(this,Ri,{value:Nh}),Object.defineProperty(this,Di,{writable:!0,value:void 0}),this.locale={strings:{},pluralize(a){return a===1?0:1}},Array.isArray(e)?e.forEach(ta(this,Ri)[Ri],this):ta(this,Ri)[Ri](e),ta(this,Di)[Di]=n}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let n=this.locale.strings[e];if(n==null&&(ta(this,Di)[Di](e),n=e),typeof n=="object"){if(t&&typeof t.smart_count<"u"){const s=this.locale.pluralize(t.smart_count);return jr(n[s],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof n!="string")throw new Error("string was not a string");return jr(n,t)}}function Nh(i){if(!(i!=null&&i.strings))return;const e=this.locale;Object.assign(this.locale,{strings:{...e.strings,...i.strings},pluralize:i.pluralize||e.pluralize})}var Lh=function(){var e={},t=e._fns={};e.emit=function(o,r,l,c,p,u,h){var g=n(o);g.length&&a(o,g,[r,l,c,p,u,h])},e.on=function(o,r){t[o]||(t[o]=[]),t[o].push(r)},e.once=function(o,r){function l(){r.apply(this,arguments),e.off(o,l)}this.on(o,l)},e.off=function(o,r){var l=[];if(o&&r){var c=this._fns[o],p=0,u=c?c.length:0;for(p;p<u;p++)c[p]!==r&&l.push(c[p])}l.length?this._fns[o]=l:delete this._fns[o]};function n(s){var o=t[s]?t[s]:[],r=s.indexOf(":"),l=r===-1?[s]:[s.substring(0,r),s.substring(r+1)],c=Object.keys(t),p=0,u=c.length;for(p;p<u;p++){var h=c[p];if(h==="*"&&(o=o.concat(t[h])),l.length===2&&l[0]===h){o=o.concat(t[h]);break}}return o}function a(s,o,r){var l=0,c=o.length;for(l;l<c&&o[l];l++)o[l].event=s,o[l].apply(o[l],r)}return e};const Bh=tt(Lh);let Mh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Ci=(i=21)=>{let e="",t=i;for(;t--;)e+=Mh[Math.random()*64|0];return e};function ba(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var jh=0;function hu(i){return"__private_"+jh+++"_"+i}const zh={version:"3.2.2"};var ei=hu("callbacks"),ps=hu("publish");class mu{constructor(){Object.defineProperty(this,ps,{value:$h}),this.state={},Object.defineProperty(this,ei,{writable:!0,value:new Set})}getState(){return this.state}setState(e){const t={...this.state},n={...this.state,...e};this.state=n,ba(this,ps)[ps](t,n,e)}subscribe(e){return ba(this,ei)[ei].add(e),()=>{ba(this,ei)[ei].delete(e)}}}function $h(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];ba(this,ei)[ei].forEach(n=>{n(...e)})}mu.VERSION=zh.version;function Jo(i){const e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}const no={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Ja(i){var e;if(i.type)return i.type;const t=i.name?(e=Jo(i.name).extension)==null?void 0:e.toLowerCase():null;return t&&t in no?no[t]:"application/octet-stream"}function qh(i){return i.charCodeAt(0).toString(32)}function zr(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${qh(t)}`,"/"))+e}function Hh(i){let e="uppy";return typeof i.name=="string"&&(e+=`-${zr(i.name.toLowerCase())}`),i.type!==void 0&&(e+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(e+=`-${zr(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(e+=`-${i.data.size}`),i.data.lastModified!==void 0&&(e+=`-${i.data.lastModified}`),e}function Vh(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Zo(i){if(Vh(i))return i.id;const e=Ja(i);return Hh({...i,type:e})}function Wh(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;const e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;const n=e[1].split(".",2),a=parseInt(n[0],10),s=parseInt(n[1],10);return a<15||a===15&&s<15063||a>18||a===18&&s>=18218}function Gh(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}function ds(i){return i<10?`0${i}`:i.toString()}function ya(){const i=new Date,e=ds(i.getHours()),t=ds(i.getMinutes()),n=ds(i.getSeconds());return`${e}:${t}:${n}`}const Kh={debug:()=>{},warn:()=>{},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${ya()}]`,...e)}},Xh={debug:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.debug(`[Uppy] [${ya()}]`,...e)},warn:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.warn(`[Uppy] [${ya()}]`,...e)},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${ya()}]`,...e)}};var Qh=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);const t=e<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return`${(t?"-":"")+e} B`;const a=Math.min(Math.floor(Math.log(e)/Math.log(1024)),n.length-1);e=Number(e/1024**a);const s=n[a];return e>=10||e%1===0?`${(t?"-":"")+e.toFixed(0)} ${s}`:`${(t?"-":"")+e.toFixed(1)} ${s}`};const vi=tt(Qh);function fu(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}fu.prototype.match=function(i){var e=!0,t=this.parts,n,a=t.length,s;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(s=(i||"").split(this.separator),n=0;e&&n<a;n++)t[n]!=="*"&&(n<s.length?e=t[n]===s[n]:e=!1);e=e&&s}else if(typeof i.splice=="function")for(e=[],n=i.length;n--;)this.match(i[n])&&(e[e.length]=i[n]);else if(typeof i=="object"){e={};for(var o in i)this.match(o)&&(e[o]=i[o])}return e};var Yh=function(i,e,t){var n=new fu(i,t||/[\/\.]/);return typeof e<"u"?n.match(e):n},Jh=Yh,Zh=/[\/\+\.]/,em=function(i,e){function t(n){var a=Jh(n,i,Zh);return a&&a.length>=2}return e?t(e.split(";")[0]):t};const tm=tt(em),im={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class Qe extends Error{constructor(e,t){var n;super(e),this.isRestriction=!0,this.isUserFacing=(n=t==null?void 0:t.isUserFacing)!=null?n:!0,t!=null&&t.file&&(this.file=t.file)}}class nm{constructor(e,t){this.i18n=t,this.getOpts=()=>{var n;const a=e();if(((n=a.restrictions)==null?void 0:n.allowedFileTypes)!=null&&!Array.isArray(a.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return a}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:n,maxNumberOfFiles:a}=this.getOpts().restrictions;if(a&&e.filter(o=>!o.isGhost).length+t.length>a)throw new Qe(`${this.i18n("youCanOnlyUploadX",{smart_count:a})}`);if(n){let s=e.reduce((o,r)=>{var l;return o+((l=r.size)!=null?l:0)},0);for(const o of t)if(o.size!=null&&(s+=o.size,s>n))throw new Qe(this.i18n("exceedsSize",{size:vi(n),file:o.name}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:n,allowedFileTypes:a}=this.getOpts().restrictions;if(a&&!a.some(o=>o.includes("/")?e.type?tm(e.type.replace(/;.*?$/,""),o):!1:o[0]==="."&&e.extension?e.extension.toLowerCase()===o.slice(1).toLowerCase():!1)){const o=a.join(", ");throw new Qe(this.i18n("youCanOnlyUploadFileTypes",{types:o}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new Qe(this.i18n("exceedsSize",{size:vi(t),file:e.name}),{file:e});if(n&&e.size!=null&&e.size<n)throw new Qe(this.i18n("inferiorSize",{size:vi(n)}),{file:e})}validate(e,t){t.forEach(n=>{this.validateSingleFile(n)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new Qe(this.i18n("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new Qe(this.i18n("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:n}=this.getOpts().restrictions,a=[];for(const s of n)(!Object.hasOwn(e.meta,s)||e.meta[s]==="")&&a.push(s);return{missingFields:a,error:t}}}const am={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled"}};let gu,vu;function I(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var sm=0;function re(i){return"__private_"+sm+++"_"+i}const om={version:"3.10.0"},ia={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};var xe=re("plugins"),Be=re("restricter"),Ii=re("storeUnsubscribe"),mt=re("emitter"),ti=re("preProcessors"),ii=re("uploaders"),kt=re("postProcessors"),Me=re("informAndEmit"),kn=re("checkRequiredMetaFieldsOnFile"),hs=re("checkRequiredMetaFields"),Ui=re("assertNewUploadAllowed"),ao=re("transformFile"),Ni=re("startIfAutoProceed"),Li=re("checkAndUpdateFileState"),ms=re("addListeners"),Ze=re("updateOnlineStatus"),Bi=re("requestClientById"),ft=re("createUpload"),fs=re("getUpload"),ai=re("removeUpload"),gt=re("runUpload");gu=Symbol.for("uppy test: getPlugins");vu=Symbol.for("uppy test: createUpload");let bu=class yu{constructor(e){Object.defineProperty(this,gt,{value:bm}),Object.defineProperty(this,ai,{value:vm}),Object.defineProperty(this,fs,{value:gm}),Object.defineProperty(this,ft,{value:fm}),Object.defineProperty(this,ms,{value:mm}),Object.defineProperty(this,Li,{value:hm}),Object.defineProperty(this,Ni,{value:dm}),Object.defineProperty(this,ao,{value:pm}),Object.defineProperty(this,Ui,{value:um}),Object.defineProperty(this,hs,{value:cm}),Object.defineProperty(this,kn,{value:lm}),Object.defineProperty(this,Me,{value:rm}),Object.defineProperty(this,xe,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,Be,{writable:!0,value:void 0}),Object.defineProperty(this,Ii,{writable:!0,value:void 0}),Object.defineProperty(this,mt,{writable:!0,value:Bh()}),Object.defineProperty(this,ti,{writable:!0,value:new Set}),Object.defineProperty(this,ii,{writable:!0,value:new Set}),Object.defineProperty(this,kt,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,this.calculateProgress=nu((a,s)=>{const o=this.getFile(a==null?void 0:a.id);if(a==null||!o){this.log(`Not setting progress for a file that has been removed: ${a==null?void 0:a.id}`);return}if(o.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${a.id}`);return}const r=Number.isFinite(s.bytesTotal)&&s.bytesTotal>0;this.setFileState(a.id,{progress:{...o.progress,bytesUploaded:s.bytesUploaded,bytesTotal:s.bytesTotal,percentage:r?Math.round(s.bytesUploaded/s.bytesTotal*100):0}}),this.calculateTotalProgress()},500,{leading:!0,trailing:!0}),Object.defineProperty(this,Ze,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,Bi,{writable:!0,value:new Map}),this.defaultLocale=am;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:im,meta:{},onBeforeFileAdded:(a,s)=>!Object.hasOwn(s,a.id),onBeforeUpload:a=>a,store:new mu,logger:Kh,infoTimeout:5e3},n={...t,...e};this.opts={...n,restrictions:{...t.restrictions,...e&&e.restrictions}},e&&e.logger&&e.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"):e&&e.debug&&(this.opts.logger=Xh),this.log(`Using Core v${yu.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...ia,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:Wh(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),I(this,Be)[Be]=new nm(()=>this.opts,this.i18n),I(this,Ii)[Ii]=this.store.subscribe((a,s,o)=>{this.emit("state-update",a,s,o),this.updateAll(s)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),I(this,ms)[ms]()}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];I(this,mt)[mt].emit(e,...n)}on(e,t){return I(this,mt)[mt].on(e,t),this}once(e,t){return I(this,mt)[mt].once(e,t),this}off(e,t){return I(this,mt)[mt].off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){const t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(n=>{let[a,s]=n;return[a,{...t[a],...s}]}))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can’t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){const e=n=>this.log(`Missing i18n string: ${n}`,"error"),t=new du([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e==null?void 0:e.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){const e={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},n={};Object.keys(t).forEach(a=>{n[a]={...t[a],progress:{...t[a].progress,...e}}}),this.setState({files:n,...ia}),this.emit("reset-progress")}clearUploadedFiles(){this.setState({...ia,files:{}})}addPreProcessor(e){I(this,ti)[ti].add(e)}removePreProcessor(e){return I(this,ti)[ti].delete(e)}addPostProcessor(e){I(this,kt)[kt].add(e)}removePostProcessor(e){return I(this,kt)[kt].delete(e)}addUploader(e){I(this,ii)[ii].add(e)}removeUploader(e){return I(this,ii)[ii].delete(e)}setMeta(e){const t={...this.getState().meta,...e},n={...this.getState().files};Object.keys(n).forEach(a=>{n[a]={...n[a],meta:{...n[a].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:n})}setFileMeta(e,t){const n={...this.getState().files};if(!n[e]){this.log("Was trying to set metadata for a file that has been removed: ",e);return}const a={...n[e].meta,...t};n[e]={...n[e],meta:a},this.setState({files:n})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:n}=this.getState(),a=Object.values(e),s=a.filter(m=>{let{progress:v}=m;return!v.uploadComplete&&v.uploadStarted}),o=a.filter(m=>!m.progress.uploadStarted),r=a.filter(m=>m.progress.uploadStarted||m.progress.preprocess||m.progress.postprocess),l=a.filter(m=>m.progress.uploadStarted),c=a.filter(m=>m.isPaused),p=a.filter(m=>m.progress.uploadComplete),u=a.filter(m=>m.error),h=s.filter(m=>!m.isPaused),g=a.filter(m=>m.progress.preprocess||m.progress.postprocess);return{newFiles:o,startedFiles:r,uploadStartedFiles:l,pausedFiles:c,completeFiles:p,erroredFiles:u,inProgressFiles:s,inProgressNotPausedFiles:h,processingFiles:g,isUploadStarted:l.length>0,isAllComplete:t===100&&p.length===a.length&&g.length===0,isAllErrored:!!n&&u.length===a.length,isAllPaused:s.length!==0&&c.length===s.length,isUploadInProgress:s.length>0,isSomeGhost:a.some(m=>m.isGhost)}}validateRestrictions(e,t){t===void 0&&(t=this.getFiles());try{I(this,Be)[Be].validate(t,[e])}catch(n){return n}return null}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}addFile(e){I(this,Ui)[Ui](e);const{nextFilesState:t,validFilesToAdd:n,errors:a}=I(this,Li)[Li]([e]),s=a.filter(r=>r.isRestriction);if(I(this,Me)[Me](s),a.length>0)throw a[0];this.setState({files:t});const[o]=n;return this.emit("file-added",o),this.emit("files-added",n),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),I(this,Ni)[Ni](),o.id}addFiles(e){I(this,Ui)[Ui]();const{nextFilesState:t,validFilesToAdd:n,errors:a}=I(this,Li)[Li](e),s=a.filter(r=>r.isRestriction);I(this,Me)[Me](s);const o=a.filter(r=>!r.isRestriction);if(o.length>0){let r=`Multiple errors occurred while adding files:
|
|
16
|
+
*/function jr(i,e){const t=/\$/g,n="$$$$";let a=[i];if(e==null)return a;for(const s of Object.keys(e))if(s!=="_"){let o=e[s];typeof o=="string"&&(o=t[Symbol.replace](o,n)),a=Ih(a,new RegExp(`%\\{${s}\\}`,"g"),o)}return a}const Uh=i=>{throw new Error(`missing string: ${i}`)};var Di=pu("onMissingKey"),Ri=pu("apply");class du{constructor(e,t){let{onMissingKey:n=Uh}=t===void 0?{}:t;Object.defineProperty(this,Ri,{value:Nh}),Object.defineProperty(this,Di,{writable:!0,value:void 0}),this.locale={strings:{},pluralize(a){return a===1?0:1}},Array.isArray(e)?e.forEach(ta(this,Ri)[Ri],this):ta(this,Ri)[Ri](e),ta(this,Di)[Di]=n}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let n=this.locale.strings[e];if(n==null&&(ta(this,Di)[Di](e),n=e),typeof n=="object"){if(t&&typeof t.smart_count<"u"){const s=this.locale.pluralize(t.smart_count);return jr(n[s],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof n!="string")throw new Error("string was not a string");return jr(n,t)}}function Nh(i){if(!(i!=null&&i.strings))return;const e=this.locale;Object.assign(this.locale,{strings:{...e.strings,...i.strings},pluralize:i.pluralize||e.pluralize})}var Lh=function(){var e={},t=e._fns={};e.emit=function(o,r,l,c,p,u,h){var g=n(o);g.length&&a(o,g,[r,l,c,p,u,h])},e.on=function(o,r){t[o]||(t[o]=[]),t[o].push(r)},e.once=function(o,r){function l(){r.apply(this,arguments),e.off(o,l)}this.on(o,l)},e.off=function(o,r){var l=[];if(o&&r){var c=this._fns[o],p=0,u=c?c.length:0;for(p;p<u;p++)c[p]!==r&&l.push(c[p])}l.length?this._fns[o]=l:delete this._fns[o]};function n(s){var o=t[s]?t[s]:[],r=s.indexOf(":"),l=r===-1?[s]:[s.substring(0,r),s.substring(r+1)],c=Object.keys(t),p=0,u=c.length;for(p;p<u;p++){var h=c[p];if(h==="*"&&(o=o.concat(t[h])),l.length===2&&l[0]===h){o=o.concat(t[h]);break}}return o}function a(s,o,r){var l=0,c=o.length;for(l;l<c&&o[l];l++)o[l].event=s,o[l].apply(o[l],r)}return e};const Bh=tt(Lh);let Mh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Ci=(i=21)=>{let e="",t=i;for(;t--;)e+=Mh[Math.random()*64|0];return e};function ba(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var jh=0;function hu(i){return"__private_"+jh+++"_"+i}const zh={version:"3.2.2"};var ei=hu("callbacks"),ps=hu("publish");class mu{constructor(){Object.defineProperty(this,ps,{value:$h}),this.state={},Object.defineProperty(this,ei,{writable:!0,value:new Set})}getState(){return this.state}setState(e){const t={...this.state},n={...this.state,...e};this.state=n,ba(this,ps)[ps](t,n,e)}subscribe(e){return ba(this,ei)[ei].add(e),()=>{ba(this,ei)[ei].delete(e)}}}function $h(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];ba(this,ei)[ei].forEach(n=>{n(...e)})}mu.VERSION=zh.version;function Jo(i){const e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}const no={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Ja(i){var e;if(i.type)return i.type;const t=i.name?(e=Jo(i.name).extension)==null?void 0:e.toLowerCase():null;return t&&t in no?no[t]:"application/octet-stream"}function qh(i){return i.charCodeAt(0).toString(32)}function zr(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${qh(t)}`,"/"))+e}function Hh(i){let e="uppy";return typeof i.name=="string"&&(e+=`-${zr(i.name.toLowerCase())}`),i.type!==void 0&&(e+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(e+=`-${zr(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(e+=`-${i.data.size}`),i.data.lastModified!==void 0&&(e+=`-${i.data.lastModified}`),e}function Vh(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Zo(i){if(Vh(i))return i.id;const e=Ja(i);return Hh({...i,type:e})}function Wh(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;const e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;const n=e[1].split(".",2),a=parseInt(n[0],10),s=parseInt(n[1],10);return a<15||a===15&&s<15063||a>18||a===18&&s>=18218}function Gh(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}function ds(i){return i<10?`0${i}`:i.toString()}function ya(){const i=new Date,e=ds(i.getHours()),t=ds(i.getMinutes()),n=ds(i.getSeconds());return`${e}:${t}:${n}`}const Kh={debug:()=>{},warn:()=>{},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${ya()}]`,...e)}},Xh={debug:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.debug(`[Uppy] [${ya()}]`,...e)},warn:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.warn(`[Uppy] [${ya()}]`,...e)},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${ya()}]`,...e)}};var Qh=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);const t=e<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return`${(t?"-":"")+e} B`;const a=Math.min(Math.floor(Math.log(e)/Math.log(1024)),n.length-1);e=Number(e/1024**a);const s=n[a];return e>=10||e%1===0?`${(t?"-":"")+e.toFixed(0)} ${s}`:`${(t?"-":"")+e.toFixed(1)} ${s}`};const vi=tt(Qh);function fu(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}fu.prototype.match=function(i){var e=!0,t=this.parts,n,a=t.length,s;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(s=(i||"").split(this.separator),n=0;e&&n<a;n++)t[n]!=="*"&&(n<s.length?e=t[n]===s[n]:e=!1);e=e&&s}else if(typeof i.splice=="function")for(e=[],n=i.length;n--;)this.match(i[n])&&(e[e.length]=i[n]);else if(typeof i=="object"){e={};for(var o in i)this.match(o)&&(e[o]=i[o])}return e};var Yh=function(i,e,t){var n=new fu(i,t||/[\/\.]/);return typeof e<"u"?n.match(e):n},Jh=Yh,Zh=/[\/\+\.]/,em=function(i,e){function t(n){var a=Jh(n,i,Zh);return a&&a.length>=2}return e?t(e.split(";")[0]):t};const tm=tt(em),im={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class Qe extends Error{constructor(e,t){var n;super(e),this.isRestriction=!0,this.isUserFacing=(n=t==null?void 0:t.isUserFacing)!=null?n:!0,t!=null&&t.file&&(this.file=t.file)}}class nm{constructor(e,t){this.i18n=t,this.getOpts=()=>{var n;const a=e();if(((n=a.restrictions)==null?void 0:n.allowedFileTypes)!=null&&!Array.isArray(a.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return a}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:n,maxNumberOfFiles:a}=this.getOpts().restrictions;if(a&&e.filter(o=>!o.isGhost).length+t.length>a)throw new Qe(`${this.i18n("youCanOnlyUploadX",{smart_count:a})}`);if(n){let s=e.reduce((o,r)=>{var l;return o+((l=r.size)!=null?l:0)},0);for(const o of t)if(o.size!=null&&(s+=o.size,s>n))throw new Qe(this.i18n("exceedsSize",{size:vi(n),file:o.name}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:n,allowedFileTypes:a}=this.getOpts().restrictions;if(a&&!a.some(o=>o.includes("/")?e.type?tm(e.type.replace(/;.*?$/,""),o):!1:o[0]==="."&&e.extension?e.extension.toLowerCase()===o.slice(1).toLowerCase():!1)){const o=a.join(", ");throw new Qe(this.i18n("youCanOnlyUploadFileTypes",{types:o}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new Qe(this.i18n("exceedsSize",{size:vi(t),file:e.name}),{file:e});if(n&&e.size!=null&&e.size<n)throw new Qe(this.i18n("inferiorSize",{size:vi(n)}),{file:e})}validate(e,t){t.forEach(n=>{this.validateSingleFile(n)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new Qe(this.i18n("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new Qe(this.i18n("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:n}=this.getOpts().restrictions,a=[];for(const s of n)(!Object.hasOwn(e.meta,s)||e.meta[s]==="")&&a.push(s);return{missingFields:a,error:t}}}const am={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled"}};let gu,vu;function I(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var sm=0;function re(i){return"__private_"+sm+++"_"+i}const om={version:"3.10.1"},ia={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};var xe=re("plugins"),Be=re("restricter"),Ii=re("storeUnsubscribe"),mt=re("emitter"),ti=re("preProcessors"),ii=re("uploaders"),kt=re("postProcessors"),Me=re("informAndEmit"),kn=re("checkRequiredMetaFieldsOnFile"),hs=re("checkRequiredMetaFields"),Ui=re("assertNewUploadAllowed"),ao=re("transformFile"),Ni=re("startIfAutoProceed"),Li=re("checkAndUpdateFileState"),ms=re("addListeners"),Ze=re("updateOnlineStatus"),Bi=re("requestClientById"),ft=re("createUpload"),fs=re("getUpload"),ai=re("removeUpload"),gt=re("runUpload");gu=Symbol.for("uppy test: getPlugins");vu=Symbol.for("uppy test: createUpload");let bu=class yu{constructor(e){Object.defineProperty(this,gt,{value:bm}),Object.defineProperty(this,ai,{value:vm}),Object.defineProperty(this,fs,{value:gm}),Object.defineProperty(this,ft,{value:fm}),Object.defineProperty(this,ms,{value:mm}),Object.defineProperty(this,Li,{value:hm}),Object.defineProperty(this,Ni,{value:dm}),Object.defineProperty(this,ao,{value:pm}),Object.defineProperty(this,Ui,{value:um}),Object.defineProperty(this,hs,{value:cm}),Object.defineProperty(this,kn,{value:lm}),Object.defineProperty(this,Me,{value:rm}),Object.defineProperty(this,xe,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,Be,{writable:!0,value:void 0}),Object.defineProperty(this,Ii,{writable:!0,value:void 0}),Object.defineProperty(this,mt,{writable:!0,value:Bh()}),Object.defineProperty(this,ti,{writable:!0,value:new Set}),Object.defineProperty(this,ii,{writable:!0,value:new Set}),Object.defineProperty(this,kt,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,this.calculateProgress=nu((a,s)=>{const o=this.getFile(a==null?void 0:a.id);if(a==null||!o){this.log(`Not setting progress for a file that has been removed: ${a==null?void 0:a.id}`);return}if(o.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${a.id}`);return}const r=Number.isFinite(s.bytesTotal)&&s.bytesTotal>0;this.setFileState(a.id,{progress:{...o.progress,bytesUploaded:s.bytesUploaded,bytesTotal:s.bytesTotal,percentage:r?Math.round(s.bytesUploaded/s.bytesTotal*100):0}}),this.calculateTotalProgress()},500,{leading:!0,trailing:!0}),Object.defineProperty(this,Ze,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,Bi,{writable:!0,value:new Map}),this.defaultLocale=am;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:im,meta:{},onBeforeFileAdded:(a,s)=>!Object.hasOwn(s,a.id),onBeforeUpload:a=>a,store:new mu,logger:Kh,infoTimeout:5e3},n={...t,...e};this.opts={...n,restrictions:{...t.restrictions,...e&&e.restrictions}},e&&e.logger&&e.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"):e&&e.debug&&(this.opts.logger=Xh),this.log(`Using Core v${yu.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...ia,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:Wh(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),I(this,Be)[Be]=new nm(()=>this.opts,this.i18n),I(this,Ii)[Ii]=this.store.subscribe((a,s,o)=>{this.emit("state-update",a,s,o),this.updateAll(s)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),I(this,ms)[ms]()}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];I(this,mt)[mt].emit(e,...n)}on(e,t){return I(this,mt)[mt].on(e,t),this}once(e,t){return I(this,mt)[mt].once(e,t),this}off(e,t){return I(this,mt)[mt].off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){const t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(n=>{let[a,s]=n;return[a,{...t[a],...s}]}))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can’t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){const e=n=>this.log(`Missing i18n string: ${n}`,"error"),t=new du([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e==null?void 0:e.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){const e={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},n={};Object.keys(t).forEach(a=>{n[a]={...t[a],progress:{...t[a].progress,...e}}}),this.setState({files:n,...ia}),this.emit("reset-progress")}clearUploadedFiles(){this.setState({...ia,files:{}})}addPreProcessor(e){I(this,ti)[ti].add(e)}removePreProcessor(e){return I(this,ti)[ti].delete(e)}addPostProcessor(e){I(this,kt)[kt].add(e)}removePostProcessor(e){return I(this,kt)[kt].delete(e)}addUploader(e){I(this,ii)[ii].add(e)}removeUploader(e){return I(this,ii)[ii].delete(e)}setMeta(e){const t={...this.getState().meta,...e},n={...this.getState().files};Object.keys(n).forEach(a=>{n[a]={...n[a],meta:{...n[a].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:n})}setFileMeta(e,t){const n={...this.getState().files};if(!n[e]){this.log("Was trying to set metadata for a file that has been removed: ",e);return}const a={...n[e].meta,...t};n[e]={...n[e],meta:a},this.setState({files:n})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:n}=this.getState(),a=Object.values(e),s=a.filter(m=>{let{progress:v}=m;return!v.uploadComplete&&v.uploadStarted}),o=a.filter(m=>!m.progress.uploadStarted),r=a.filter(m=>m.progress.uploadStarted||m.progress.preprocess||m.progress.postprocess),l=a.filter(m=>m.progress.uploadStarted),c=a.filter(m=>m.isPaused),p=a.filter(m=>m.progress.uploadComplete),u=a.filter(m=>m.error),h=s.filter(m=>!m.isPaused),g=a.filter(m=>m.progress.preprocess||m.progress.postprocess);return{newFiles:o,startedFiles:r,uploadStartedFiles:l,pausedFiles:c,completeFiles:p,erroredFiles:u,inProgressFiles:s,inProgressNotPausedFiles:h,processingFiles:g,isUploadStarted:l.length>0,isAllComplete:t===100&&p.length===a.length&&g.length===0,isAllErrored:!!n&&u.length===a.length,isAllPaused:s.length!==0&&c.length===s.length,isUploadInProgress:s.length>0,isSomeGhost:a.some(m=>m.isGhost)}}validateRestrictions(e,t){t===void 0&&(t=this.getFiles());try{I(this,Be)[Be].validate(t,[e])}catch(n){return n}return null}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}addFile(e){I(this,Ui)[Ui](e);const{nextFilesState:t,validFilesToAdd:n,errors:a}=I(this,Li)[Li]([e]),s=a.filter(r=>r.isRestriction);if(I(this,Me)[Me](s),a.length>0)throw a[0];this.setState({files:t});const[o]=n;return this.emit("file-added",o),this.emit("files-added",n),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),I(this,Ni)[Ni](),o.id}addFiles(e){I(this,Ui)[Ui]();const{nextFilesState:t,validFilesToAdd:n,errors:a}=I(this,Li)[Li](e),s=a.filter(r=>r.isRestriction);I(this,Me)[Me](s);const o=a.filter(r=>!r.isRestriction);if(o.length>0){let r=`Multiple errors occurred while adding files:
|
|
17
17
|
`;if(o.forEach(l=>{r+=`
|
|
18
18
|
* ${l.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:o.length}),details:r},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(o,r);{const l=new Error(r);throw l.errors=o,l}}this.setState({files:t}),n.forEach(r=>{this.emit("file-added",r)}),this.emit("files-added",n),n.length>5?this.log(`Added batch of ${n.length} files`):Object.values(n).forEach(r=>{this.log(`Added file: ${r.name}
|
|
19
19
|
id: ${r.id}
|
|
20
20
|
type: ${r.type}`)}),n.length>0&&I(this,Ni)[Ni]()}removeFiles(e,t){const{files:n,currentUploads:a}=this.getState(),s={...n},o={...a},r=Object.create(null);e.forEach(u=>{n[u]&&(r[u]=n[u],delete s[u])});function l(u){return r[u]===void 0}Object.keys(o).forEach(u=>{const h=a[u].fileIDs.filter(l);if(h.length===0){delete o[u];return}const{capabilities:g}=this.getState();if(h.length!==a[u].fileIDs.length&&!g.individualCancellation)throw new Error("individualCancellation is disabled");o[u]={...a[u],fileIDs:h}});const c={currentUploads:o,files:s};Object.keys(s).length===0&&(c.allowNewUpload=!0,c.error=null,c.recoveredState=null),this.setState(c),this.calculateTotalProgress();const p=Object.keys(r);p.forEach(u=>{this.emit("file-removed",r[u],t)}),p.length>5?this.log(`Removed ${p.length} files`):this.log(`Removed files: ${p.join(", ")}`)}removeFile(e,t){this.removeFiles([e],t)}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;const n=!(this.getFile(e).isPaused||!1);return this.setFileState(e,{isPaused:n}),this.emit("upload-pause",e,n),n}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(n=>!e[n].progress.uploadComplete&&e[n].progress.uploadStarted).forEach(n=>{const a={...e[n],isPaused:!0};e[n]=a}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter(n=>!e[n].progress.uploadComplete&&e[n].progress.uploadStarted).forEach(n=>{const a={...e[n],isPaused:!1,error:null};e[n]=a}),this.setState({files:e}),this.emit("resume-all")}retryAll(){const e={...this.getState().files},t=Object.keys(e).filter(a=>e[a].error);if(t.forEach(a=>{const s={...e[a],isPaused:!1,error:null};e[a]=s}),this.setState({files:e,error:null}),this.emit("retry-all",t),t.length===0)return Promise.resolve({successful:[],failed:[]});const n=I(this,ft)[ft](t,{forceAllowNewUpload:!0});return I(this,gt)[gt](n)}cancelAll(e){let{reason:t="user"}=e===void 0?{}:e;if(this.emit("cancel-all",{reason:t}),t==="user"){const{files:n}=this.getState(),a=Object.keys(n);a.length&&this.removeFiles(a,"cancel-all"),this.setState(ia)}}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);const t=I(this,ft)[ft]([e],{forceAllowNewUpload:!0});return I(this,gt)[gt](t)}logout(){this.iteratePlugins(e=>{var t;(t=e.provider)==null||t.logout==null||t.logout()})}calculateTotalProgress(){const t=this.getFiles().filter(c=>c.progress.uploadStarted||c.progress.preprocess||c.progress.postprocess);if(t.length===0){this.emit("progress",0),this.setState({totalProgress:0});return}const n=t.filter(c=>c.progress.bytesTotal!=null),a=t.filter(c=>c.progress.bytesTotal==null);if(n.length===0){const c=t.length*100,p=a.reduce((h,g)=>h+g.progress.percentage,0),u=Math.round(p/c*100);this.setState({totalProgress:u});return}let s=n.reduce((c,p)=>{var u;return c+((u=p.progress.bytesTotal)!=null?u:0)},0);const o=s/n.length;s+=o*a.length;let r=0;n.forEach(c=>{r+=c.progress.bytesUploaded}),a.forEach(c=>{r+=o*(c.progress.percentage||0)/100});let l=s===0?0:Math.round(r/s*100);l>100&&(l=100),this.setState({totalProgress:l}),this.emit("progress",l)}updateOnlineStatus(){var e;((e=window.navigator.onLine)!=null?e:!0)?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(e,t){if(typeof e!="function"){const o=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(o)}const n=new e(this,t),a=n.id;if(!a)throw new Error("Your plugin must have an id");if(!n.type)throw new Error("Your plugin must have a type");const s=this.getPlugin(a);if(s){const o=`Already found a plugin named '${s.id}'. Tried to use: '${a}'.
|
|
21
|
-
Uppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${a} v${e.VERSION}`),n.type in I(this,xe)[xe]?I(this,xe)[xe][n.type].push(n):I(this,xe)[xe][n.type]=[n],n.install(),this.emit("plugin-added",n),this}getPlugin(e){for(const t of Object.values(I(this,xe)[xe])){const n=t.find(a=>a.id===e);if(n!=null)return n}}[gu](e){return I(this,xe)[xe][e]}iteratePlugins(e){Object.values(I(this,xe)[xe]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=I(this,xe)[xe][e.type],n=t.findIndex(o=>o.id===e.id);n!==-1&&t.splice(n,1);const s={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(s)}close(e){let{reason:t}=e===void 0?{}:e;this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll({reason:t}),I(this,Ii)[Ii](),this.iteratePlugins(n=>{this.removePlugin(n)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",I(this,Ze)[Ze]),window.removeEventListener("offline",I(this,Ze)[Ze]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,n){t===void 0&&(t="info"),n===void 0&&(n=3e3);const a=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:a?e.message:e,details:a?e.details:null}]}),setTimeout(()=>this.hideInfo(),n),this.emit("info-visible")}log(e,t){const{logger:n}=this.opts;switch(t){case"error":n.error(e);break;case"warning":n.warn(e);break;default:n.debug(e);break}}registerRequestClient(e,t){I(this,Bi)[Bi].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const t=I(this,Bi)[Bi].get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?I(this,gt)[gt](e):(I(this,ai)[ai](e),Promise.reject(new Error("Nonexistent upload")))}[vu](){return I(this,ft)[ft](...arguments)}addResultData(e,t){if(!I(this,fs)[fs](e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}const{currentUploads:n}=this.getState(),a={...n[e],result:{...n[e].result,...t}};this.setState({currentUploads:{...n,[e]:a}})}upload(){var e;(e=I(this,xe)[xe].uploader)!=null&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const n=this.opts.onBeforeUpload(t);return n===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(n&&typeof n=="object"&&(t=n,this.setState({files:t})),Promise.resolve().then(()=>I(this,Be)[Be].validateMinNumberOfFiles(t)).catch(a=>{throw I(this,Me)[Me]([a]),a}).then(()=>{if(!I(this,hs)[hs](t))throw new Qe(this.i18n("missingRequiredMetaField"))}).catch(a=>{throw a}).then(()=>{const{currentUploads:a}=this.getState(),s=Object.values(a).flatMap(l=>l.fileIDs),o=[];Object.keys(t).forEach(l=>{const c=this.getFile(l);!c.progress.uploadStarted&&s.indexOf(l)===-1&&o.push(c.id)});const r=I(this,ft)[ft](o);return I(this,gt)[gt](r)}).catch(a=>{throw this.emit("error",a),this.log(a,"error"),a}))}};function rm(i){for(const s of i)s.isRestriction?this.emit("restriction-failed",s.file,s):this.emit("error",s,s.file),this.log(s,"warning");const e=i.filter(s=>s.isUserFacing),t=4,n=e.slice(0,t),a=e.slice(t);n.forEach(s=>{let{message:o,details:r=""}=s;this.info({message:o,details:r},"error",this.opts.infoTimeout)}),a.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:a.length})})}function lm(i){const{missingFields:e,error:t}=I(this,Be)[Be].getMissingRequiredMetaFields(i);return e.length>0?(this.setFileState(i.id,{missingRequiredMetaFields:e}),this.log(t.message),this.emit("restriction-failed",i,t),!1):!0}function cm(i){let e=!0;for(const t of Object.values(i))I(this,kn)[kn](t)||(e=!1);return e}function um(i){const{allowNewUpload:e}=this.getState();if(e===!1){const t=new Qe(this.i18n("noMoreFilesAllowed"),{file:i});throw I(this,Me)[Me]([t]),t}}function pm(i){const e=i instanceof File?{name:i.name,type:i.type,size:i.size,data:i}:i,t=Ja(e),n=Gh(t,e),a=Jo(n).extension,s=Zo(e),o=e.meta||{};o.name=n,o.type=t;const r=Number.isFinite(e.data.size)?e.data.size:null;return{source:e.source||"",id:s,name:n,extension:a||"",meta:{...this.getState().meta,...o},type:t,data:e.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:r,uploadComplete:!1,uploadStarted:null},size:r,isGhost:!1,isRemote:e.isRemote||!1,remote:e.remote||"",preview:e.preview}}function dm(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(i=>{i.isRestriction||this.log(i.stack||i.message||i)})},4))}function hm(i){const{files:e}=this.getState(),t={...e},n=[],a=[];for(const o of i)try{var s;let r=I(this,ao)[ao](o);const l=(s=e[r.id])==null?void 0:s.isGhost;l&&(r={...e[r.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${r.name}, ${r.id}`));const c=this.opts.onBeforeFileAdded(r,t);if(!c&&this.checkIfFileAlreadyExists(r.id))throw new Qe(this.i18n("noDuplicates",{fileName:r.name}),{file:o});if(c===!1&&!l)throw new Qe("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});typeof c=="object"&&c!==null&&(r=c),I(this,Be)[Be].validateSingleFile(r),t[r.id]=r,n.push(r)}catch(r){a.push(r)}try{I(this,Be)[Be].validateAggregateRestrictions(Object.values(e),n)}catch(o){return a.push(o),{nextFilesState:e,validFilesToAdd:[],errors:a}}return{nextFilesState:t,validFilesToAdd:n,errors:a}}function mm(){const i=(n,a,s)=>{let o=n.message||"Unknown error";n.details&&(o+=` ${n.details}`),this.setState({error:o}),a!=null&&a.id in this.getState().files&&this.setFileState(a.id,{error:o,response:s})};this.on("error",i),this.on("upload-error",(n,a,s)=>{if(i(a,n,s),typeof a=="object"&&a.message){var o;this.log(a.message,"error");const r=new Error(this.i18n("failedToUpload",{file:(o=n==null?void 0:n.name)!=null?o:""}));r.isUserFacing=!0,r.details=a.message,a.details&&(r.details+=` ${a.details}`),I(this,Me)[Me]([r])}else I(this,Me)[Me]([a])});let e=null;this.on("upload-stalled",(n,a)=>{const{message:s}=n,o=a.map(r=>r.meta.name).join(", ");e||(this.info({message:s,details:o},"warning",this.opts.infoTimeout),e=setTimeout(()=>{e=null},this.opts.infoTimeout)),this.log(`${s} ${o}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const t=n=>{const a=n.filter(o=>{const r=o!=null&&this.getFile(o.id);return r||this.log(`Not setting progress for a file that has been removed: ${o==null?void 0:o.id}`),r}),s=Object.fromEntries(a.map(o=>[o.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:o.size}}]));this.patchFilesState(s)};this.on("upload-start",n=>{n.forEach(a=>{this.emit("upload-started",a)}),t(n)}),this.on("upload-progress",this.calculateProgress),this.on("upload-success",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const s=this.getFile(n.id).progress;this.setFileState(n.id,{progress:{...s,postprocess:I(this,kt)[kt].size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:s.bytesTotal},response:a,uploadURL:a.uploadURL,isPaused:!1}),n.size==null&&this.setFileState(n.id,{size:a.bytesUploaded||s.bytesTotal}),this.calculateTotalProgress()}),this.on("preprocess-progress",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}this.setFileState(n.id,{progress:{...this.getFile(n.id).progress,preprocess:a}})}),this.on("preprocess-complete",n=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const a={...this.getState().files};a[n.id]={...a[n.id],progress:{...a[n.id].progress}},delete a[n.id].progress.preprocess,this.setState({files:a})}),this.on("postprocess-progress",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}this.setFileState(n.id,{progress:{...this.getState().files[n.id].progress,postprocess:a}})}),this.on("postprocess-complete",n=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const a={...this.getState().files};a[n.id]={...a[n.id],progress:{...a[n.id].progress}},delete a[n.id].progress.postprocess,this.setState({files:a})}),this.on("restored",()=>{this.calculateTotalProgress()}),this.on("dashboard:file-edit-complete",n=>{n&&I(this,kn)[kn](n)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",I(this,Ze)[Ze]),window.addEventListener("offline",I(this,Ze)[Ze]),setTimeout(I(this,Ze)[Ze],3e3))}function fm(i,e){e===void 0&&(e={});const{forceAllowNewUpload:t=!1}=e,{allowNewUpload:n,currentUploads:a}=this.getState();if(!n&&!t)throw new Error("Cannot create a new upload: already uploading.");const s=Ci();return this.emit("upload",{id:s,fileIDs:i}),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...a,[s]:{fileIDs:i,step:0,result:{}}}}),s}function gm(i){const{currentUploads:e}=this.getState();return e[i]}function vm(i){const e={...this.getState().currentUploads};delete e[i],this.setState({currentUploads:e})}async function bm(i){const e=()=>{const{currentUploads:s}=this.getState();return s[i]};let t=e();const n=[...I(this,ti)[ti],...I(this,ii)[ii],...I(this,kt)[kt]];try{for(let s=t.step||0;s<n.length&&t;s++){const o=n[s];this.setState({currentUploads:{...this.getState().currentUploads,[i]:{...t,step:s}}});const{fileIDs:r}=t;await o(r,i),t=e()}}catch(s){throw I(this,ai)[ai](i),s}if(t){t.fileIDs.forEach(l=>{const c=this.getFile(l);c&&c.progress.postprocess&&this.emit("postprocess-complete",c)});const s=t.fileIDs.map(l=>this.getFile(l)),o=s.filter(l=>!l.error),r=s.filter(l=>l.error);this.addResultData(i,{successful:o,failed:r,uploadID:i}),t=e()}let a;return t&&(a=t.result,this.emit("complete",a),I(this,ai)[ai](i)),a==null&&this.log(`Not setting result for an upload that has been removed: ${i}`),a}bu.VERSION=om.version;const xu=bu;function wu(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function ym(i,e){return e===void 0&&(e=document),typeof i=="string"?e.querySelector(i):wu(i)?i:null}function Pu(i){for(var e;i&&!i.dir;)i=i.parentNode;return(e=i)==null?void 0:e.dir}class er{constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){const{plugins:e}=this.uppy.getState();return(e==null?void 0:e[this.id])||{}}setPluginState(e){if(!e)return;const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new du([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}function $r(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var xm=0;function wm(i){return"__private_"+xm+++"_"+i}function Pm(i){let e=null,t;return function(){for(var n=arguments.length,a=new Array(n),s=0;s<n;s++)a[s]=arguments[s];return t=a,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e}}var Mi=wm("updateUI");class ye extends er{constructor(){super(...arguments),Object.defineProperty(this,Mi,{writable:!0,value:void 0})}getTargetPlugin(e){let t;if(typeof(e==null?void 0:e.addTarget)=="function")t=e,t instanceof ye||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:ye}}));else if(typeof e=="function"){const n=e;this.uppy.iteratePlugins(a=>{a instanceof n&&(t=a)})}return t}mount(e,t){const n=t.id,a=ym(e);if(a){this.isTargetDOMEl=!0;const r=document.createElement("div");return r.classList.add("uppy-Root"),$r(this,Mi)[Mi]=Pm(l=>{this.uppy.getPlugin(this.id)&&(Br(this.render(l),r),this.afterUpdate())}),this.uppy.log(`Installing ${n} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(a.innerHTML=""),Br(this.render(this.uppy.getState()),r),this.el=r,a.appendChild(r),r.dir=this.opts.direction||Pu(r)||"ltr",this.onMount(),this.el}const s=this.getTargetPlugin(e);if(s)return this.uppy.log(`Installing ${n} to ${s.id}`),this.parent=s,this.el=s.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${n}`);let o=`Invalid target option given to ${n}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){if(this.el!=null){var t,n;(t=(n=$r(this,Mi))[Mi])==null||t.call(n,e)}}unmount(){if(this.isTargetDOMEl){var e;(e=this.el)==null||e.remove()}this.onUnmount()}onMount(){}onUnmount(){}}const Sm={__proto__:null,"audio/mp3":"mp3","audio/mp4":"mp4","audio/ogg":"ogg","audio/webm":"webm","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/png":"png","image/svg+xml":"svg","video/mp4":"mp4","video/ogg":"ogv","video/quicktime":"mov","video/webm":"webm","video/x-matroska":"mkv","video/x-msvideo":"avi"};function gs(i){return[i]=i.split(";",1),Sm[i]||null}var Za={exports:{}};Za.exports=tr;Za.exports.isMobile=tr;Za.exports.default=tr;const Fm=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,_m=/CrOS/,Cm=/android|ipad|playbook|silk/i;function tr(i){i||(i={});let e=i.ua;if(!e&&typeof navigator<"u"&&(e=navigator.userAgent),e&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string")return!1;let t=Fm.test(e)&&!_m.test(e)||!!i.tablet&&Cm.test(e);return!t&&i.tablet&&i.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.indexOf("Macintosh")!==-1&&e.indexOf("Safari")!==-1&&(t=!0),t}var Em=Za.exports;const km=tt(Em);function Tm(i,e,t){return new Promise(n=>{i.toBlob(n,e,t)})}function Om(){return typeof MediaRecorder=="function"&&!!MediaRecorder.prototype&&typeof MediaRecorder.prototype.start=="function"}function Su(){return d("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55"},d("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z",fillRule:"evenodd"}))}function Am(i){let{onSnapshot:e,i18n:t}=i;return d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:t("takePicture"),"aria-label":t("takePicture"),onClick:e,"data-uppy-super-focusable":!0},Su())}function Dm(i){let{recording:e,onStartRecording:t,onStopRecording:n,i18n:a}=i;return e?d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:a("stopRecording"),"aria-label":a("stopRecording"),onClick:n,"data-uppy-super-focusable":!0},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},d("rect",{x:"15",y:"15",width:"70",height:"70"}))):d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:a("startRecording"),"aria-label":a("startRecording"),onClick:t,"data-uppy-super-focusable":!0},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},d("circle",{cx:"50",cy:"50",r:"40"})))}function Rm(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}function Im(i){let{recordingLengthSeconds:e,i18n:t}=i;const n=Rm(e);return d("span",{"aria-label":t("recordingLength",{recording_length:n})},n)}function Um(i){let{currentDeviceId:e,videoSources:t,onChangeVideoSource:n}=i;return d("div",{className:"uppy-Webcam-videoSource"},d("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:a=>{n(a.target.value)}},t.map(a=>d("option",{key:a.deviceId,value:a.deviceId,selected:a.deviceId===e},a.label))))}function Nm(i){let{onSubmit:e,i18n:t}=i;return d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:t("submitRecordedFile"),"aria-label":t("submitRecordedFile"),onClick:e,"data-uppy-super-focusable":!0},d("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},d("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})))}function Lm(i){let{onDiscard:e,i18n:t}=i;return d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard",type:"button",title:t("discardRecordedFile"),"aria-label":t("discardRecordedFile"),onClick:e,"data-uppy-super-focusable":!0},d("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},d("g",{fill:"#FFF",fillRule:"evenodd"},d("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),d("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"}))))}function so(){return so=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},so.apply(this,arguments)}function na(i,e){return i.includes(e)}class Bm extends dt{componentDidMount(){const{onFocus:e}=this.props;e()}componentWillUnmount(){const{onStop:e}=this.props;e()}render(){const{src:e,recordedVideo:t,recording:n,modes:a,supportsRecording:s,videoSources:o,showVideoSourceDropdown:r,showRecordingLength:l,onSubmit:c,i18n:p,mirror:u,onSnapshot:h,onStartRecording:g,onStopRecording:m,onDiscardRecordedVideo:v,recordingLengthSeconds:f}=this.props,y=!!t,F=!y&&s&&(na(a,"video-only")||na(a,"audio-only")||na(a,"video-audio")),S=!y&&na(a,"picture"),A=s&&l&&!y,D=r&&o&&o.length>1,x={playsInline:!0};return t?(x.muted=!1,x.controls=!0,x.src=t,this.videoElement&&(this.videoElement.srcObject=null)):(x.muted=!0,x.autoPlay=!0,x.srcObject=e),d("div",{className:"uppy uppy-Webcam-container"},d("div",{className:"uppy-Webcam-videoContainer"},d("video",so({ref:_=>this.videoElement=_,className:`uppy-Webcam-video ${u?"uppy-Webcam-video--mirrored":""}`},x))),d("div",{className:"uppy-Webcam-footer"},d("div",{className:"uppy-Webcam-videoSourceContainer"},D?Um(this.props):null),d("div",{className:"uppy-Webcam-buttonContainer"},S&&d(Am,{onSnapshot:h,i18n:p}),F&&d(Dm,{recording:n,onStartRecording:g,onStopRecording:m,i18n:p}),y&&d(Nm,{onSubmit:c,i18n:p}),y&&d(Lm,{onDiscard:v,i18n:p})),d("div",{className:"uppy-Webcam-recordingLength"},A&&d(Im,{recordingLengthSeconds:f,i18n:p}))))}}function Mm(i){let{icon:e,i18n:t,hasCamera:n}=i;return d("div",{className:"uppy-Webcam-permissons"},d("div",{className:"uppy-Webcam-permissonsIcon"},e()),d("h1",{className:"uppy-Webcam-title"},t(n?"allowAccessTitle":"noCameraTitle")),d("p",null,t(n?"allowAccessDescription":"noCameraDescription")))}const jm={strings:{pluginNameCamera:"Camera",noCameraTitle:"Camera Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file",smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",recordingLength:"Recording length %{recording_length}",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site."}};function oo(){return oo=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},oo.apply(this,arguments)}function ji(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var zm=0;function $m(i){return"__private_"+zm+++"_"+i}const qm={version:"3.4.0"};function qr(i){return i[0]==="."?no[i.slice(1)]:i}function Hm(i){return/^video\/[^*]+$/.test(i)}function Vm(i){return/^image\/[^*]+$/.test(i)}function Wm(){return navigator.mediaDevices}function vs(i,e){return i.includes(e)}const Gm={onBeforeSnapshot:()=>Promise.resolve(),countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,facingMode:"user",preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1,mobileNativeCamera:km({tablet:!0})};var Ve=$m("enableMirror");class Fu extends ye{constructor(e,t){super(e,{...Gm,...t}),Object.defineProperty(this,Ve,{writable:!0,value:void 0}),this.mediaDevices=Wm(),this.supportsUserMedia=!!this.mediaDevices,this.protocol=location.protocol.match(/https/i)?"https":"http",this.id=this.opts.id||"Webcam",this.type="acquirer",this.capturedMediaFile=null,this.icon=()=>d("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383",fillRule:"nonzero"})),this.defaultLocale=jm,this.i18nInit(),this.title=this.i18n("pluginNameCamera"),ji(this,Ve)[Ve]=this.opts.mirror,this.install=this.install.bind(this),this.setPluginState=this.setPluginState.bind(this),this.render=this.render.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.takeSnapshot=this.takeSnapshot.bind(this),this.startRecording=this.startRecording.bind(this),this.stopRecording=this.stopRecording.bind(this),this.discardRecordedVideo=this.discardRecordedVideo.bind(this),this.submit=this.submit.bind(this),this.oneTwoThreeSmile=this.oneTwoThreeSmile.bind(this),this.focus=this.focus.bind(this),this.changeVideoSource=this.changeVideoSource.bind(this),this.webcamActive=!1,this.opts.countdown&&(this.opts.onBeforeSnapshot=this.oneTwoThreeSmile),this.setPluginState({hasCamera:!1,cameraReady:!1,cameraError:null,recordingLengthSeconds:0,videoSources:[],currentDeviceId:null})}setOptions(e){super.setOptions({...e,videoConstraints:{...this.opts.videoConstraints,...e==null?void 0:e.videoConstraints}})}hasCameraCheck(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then(e=>e.some(t=>t.kind==="videoinput")):Promise.resolve(!1)}isAudioOnly(){return this.opts.modes.length===1&&this.opts.modes[0]==="audio-only"}getConstraints(e){e===void 0&&(e=null);const t=this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("audio-only")!==-1,n=!this.isAudioOnly()&&(this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("video-only")!==-1||this.opts.modes.indexOf("picture")!==-1),a={...this.opts.videoConstraints||{facingMode:this.opts.facingMode},...e?{deviceId:e,facingMode:null}:{}};return{audio:t,video:n?a:!1}}start(e){var t;if(e===void 0&&(e=null),!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&(ji(this,Ve)[Ve]=!0);const n=this.getConstraints((t=e)==null?void 0:t.deviceId);this.hasCameraCheck().then(a=>(this.setPluginState({hasCamera:a}),this.mediaDevices.getUserMedia(n).then(s=>{this.stream=s;let o=null;const r=this.isAudioOnly()?s.getAudioTracks():s.getVideoTracks();!e||!e.deviceId?o=r[0].getSettings().deviceId:r.forEach(l=>{l.getSettings().deviceId===e.deviceId&&(o=l.getSettings().deviceId)}),this.updateVideoSources(),this.setPluginState({currentDeviceId:o,cameraReady:!0})}).catch(s=>{this.setPluginState({cameraReady:!1,cameraError:s}),this.uppy.info(s.message,"error")})))}getMediaRecorderOptions(){const e={};if(MediaRecorder.isTypeSupported){const{restrictions:t}=this.uppy.opts;let n=[];this.opts.preferredVideoMimeType?n=[this.opts.preferredVideoMimeType]:t.allowedFileTypes&&(n=t.allowedFileTypes.map(qr).filter(Hm));const a=o=>MediaRecorder.isTypeSupported(o)&&gs(o),s=n.filter(a);s.length>0&&(e.mimeType=s[0])}return e}startRecording(){this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];let e=!1;this.recorder.addEventListener("dataavailable",t=>{this.recordingChunks.push(t.data);const{restrictions:n}=this.uppy.opts;if(this.recordingChunks.length>1&&n.maxFileSize!=null&&!e){const a=this.recordingChunks.reduce((l,c)=>l+c.size,0),o=(a-this.recordingChunks[0].size)/(this.recordingChunks.length-1)*3,r=Math.max(0,n.maxFileSize-o);a>r&&(e=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.stopRecording())}}),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval(()=>{const t=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:t+1})},1e3)),this.setPluginState({isRecording:!0})}stopRecording(){return new Promise(t=>{this.recorder.addEventListener("stop",()=>{t()}),this.recorder.stop(),this.opts.showRecordingLength&&(clearInterval(this.recordingLengthTimer),this.setPluginState({recordingLengthSeconds:0}))}).then(()=>(this.setPluginState({isRecording:!1}),this.getVideo())).then(t=>{try{this.capturedMediaFile=t,this.setPluginState({recordedVideo:URL.createObjectURL(t.data)}),ji(this,Ve)[Ve]=!1}catch(n){n.isRestriction||this.uppy.log(n)}}).then(()=>{this.recordingChunks=null,this.recorder=null},t=>{throw this.recordingChunks=null,this.recorder=null,t})}discardRecordedVideo(){this.setPluginState({recordedVideo:null}),this.opts.mirror&&(ji(this,Ve)[Ve]=!0),this.capturedMediaFile=null}submit(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"error")}}async stop(){if(this.stream){const e=this.stream.getAudioTracks(),t=this.stream.getVideoTracks();e.concat(t).forEach(n=>n.stop())}this.recorder&&await new Promise(e=>{this.recorder.addEventListener("stop",e,{once:!0}),this.recorder.stop(),this.opts.showRecordingLength&&clearInterval(this.recordingLengthTimer)}),this.recordingChunks=null,this.recorder=null,this.webcamActive=!1,this.stream=null,this.setPluginState({recordedVideo:null,isRecording:!1,recordingLengthSeconds:0})}getVideoElement(){return this.el.querySelector(".uppy-Webcam-video")}oneTwoThreeSmile(){return new Promise((e,t)=>{let n=this.opts.countdown;const a=setInterval(()=>{if(!this.webcamActive)return clearInterval(a),this.captureInProgress=!1,t(new Error("Webcam is not active"));n?(this.uppy.info(`${n}...`,"warning",800),n--):(clearInterval(a),this.uppy.info(this.i18n("smile"),"success",1500),setTimeout(()=>e(),1500))},1e3)})}takeSnapshot(){this.captureInProgress||(this.captureInProgress=!0,this.opts.onBeforeSnapshot().catch(e=>{const t=typeof e=="object"?e.message:e;return this.uppy.info(t,"error",5e3),Promise.reject(new Error(`onBeforeSnapshot: ${t}`))}).then(()=>this.getImage()).then(e=>{this.captureInProgress=!1;try{this.uppy.addFile(e)}catch(t){t.isRestriction||this.uppy.log(t)}},e=>{throw this.captureInProgress=!1,e}))}getImage(){const e=this.getVideoElement();if(!e)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));const t=e.videoWidth,n=e.videoHeight,a=document.createElement("canvas");a.width=t,a.height=n,a.getContext("2d").drawImage(e,0,0);const{restrictions:o}=this.uppy.opts;let r=[];this.opts.preferredImageMimeType?r=[this.opts.preferredImageMimeType]:o.allowedFileTypes&&(r=o.allowedFileTypes.map(qr).filter(Vm));const l=r[0]||"image/jpeg",c=gs(l)||"jpg",p=`cam-${Date.now()}.${c}`;return Tm(a,l).then(u=>({source:this.id,name:p,data:new Blob([u],{type:l}),type:l}))}getVideo(){const e=this.recordingChunks.find(o=>{var r;return((r=o.type)==null?void 0:r.length)>0}).type,t=gs(e);if(!t)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${e}"`));const n=`webcam-${Date.now()}.${t}`,a=new Blob(this.recordingChunks,{type:e}),s={source:this.id,name:n,data:new Blob([a],{type:e}),type:e};return Promise.resolve(s)}focus(){this.opts.countdown&&setTimeout(()=>{this.uppy.info(this.i18n("smile"),"success",1500)},1e3)}changeVideoSource(e){this.stop(),this.start({deviceId:e})}updateVideoSources(){this.mediaDevices.enumerateDevices().then(e=>{this.setPluginState({videoSources:e.filter(t=>t.kind==="videoinput")})})}render(){this.webcamActive||this.start();const e=this.getPluginState();return!e.cameraReady||!e.hasCamera?d(Mm,{icon:Su,i18n:this.i18n,hasCamera:e.hasCamera}):d(Bm,oo({},e,{onChangeVideoSource:this.changeVideoSource,onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onDiscardRecordedVideo:this.discardRecordedVideo,onSubmit:this.submit,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,showRecordingLength:this.opts.showRecordingLength,showVideoSourceDropdown:this.opts.showVideoSourceDropdown,supportsRecording:Om(),recording:e.isRecording,mirror:ji(this,Ve)[Ve],src:this.stream}))}install(){const{mobileNativeCamera:e,modes:t,facingMode:n,videoConstraints:a}=this.opts,{target:s}=this.opts;if(e&&s){var o;(o=this.getTargetPlugin(s))==null||o.setOptions({showNativeVideoCameraButton:vs(t,"video-only")||vs(t,"video-audio"),showNativePhotoCameraButton:vs(t,"picture"),nativeCameraFacingMode:(a==null?void 0:a.facingMode)||n});return}this.setPluginState({cameraReady:!1,recordingLengthSeconds:0}),s&&this.mount(s,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=()=>{if(this.updateVideoSources(),this.stream){let r=!0;const{videoSources:l,currentDeviceId:c}=this.getPluginState();l.forEach(p=>{c===p.deviceId&&(r=!1)}),r&&(this.stop(),this.start())}})}uninstall(){this.stop(),this.unmount()}onUnmount(){this.stop()}}Fu.VERSION=qm.version;class Km extends Error{constructor(){super(...arguments),this.name="UserFacingApiError"}}const Xm=Object.prototype.toString,Qm=i=>Xm.call(i)==="[object Error]",Ym=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed"]);function Jm(i){return i&&Qm(i)&&i.name==="TypeError"&&typeof i.message=="string"?i.message==="Load failed"?i.stack===void 0:Ym.has(i.message):!1}let ro=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}};const Hr=(i,e,t)=>{const n=t.retries-(e-1);return i.attemptNumber=e,i.retriesLeft=n,i};async function _u(i,e){return new Promise((t,n)=>{e={onFailedAttempt(){},retries:10,...e};const a=mh.operation(e),s=()=>{var r;a.stop(),n((r=e.signal)==null?void 0:r.reason)};e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",s,{once:!0});const o=()=>{var r;(r=e.signal)==null||r.removeEventListener("abort",s),a.stop()};a.attempt(async r=>{try{const l=await i(r);o(),t(l)}catch(l){try{if(!(l instanceof Error))throw new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`);if(l instanceof ro)throw l.originalError;if(l instanceof TypeError&&!Jm(l))throw l;if(await e.onFailedAttempt(Hr(l,r,e)),!a.retry(l))throw a.mainError()}catch(c){Hr(c,r,e),o(),n(c)}}})})}class Cu extends Error{constructor(e,t){t===void 0&&(t=null),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}}function Zm(){return fetch(...arguments).catch(i=>{throw i.name==="AbortError"?i:new Cu(i)})}function xa(i,e){return Object.prototype.hasOwnProperty.call(i,e)}class ef extends Error{constructor(e,t){super(e),this.cause=t==null?void 0:t.cause,this.cause&&xa(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}function tf(i,e,t){const{progress:n,bytesUploaded:a,bytesTotal:s}=e;n&&(i.uppy.log(`Upload progress: ${n}`),i.uppy.emit("upload-progress",t,{uploader:i,bytesUploaded:a,bytesTotal:s}))}const nf=nu(tf,300,{leading:!0,trailing:!0});function af(i){var e;const n=(e=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(i))==null?void 0:e[1];return`${/^http:\/\//i.test(i)?"ws":"wss"}://${n}`}class sf extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}let Eu;function vt(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var of=0;function es(i){return"__private_"+of+++"_"+i}const rf={version:"3.8.0"};function lf(i){return i.replace(/\/$/,"")}const ku=10,cf=5*60*1e3,uf=401;class pf extends Error{constructor(e){let{statusCode:t,message:n}=e;super(n),this.name="HttpError",this.statusCode=t}}async function df(i){if(i.status===uf)throw new sf;if(i.ok)return i.json();let e=`Failed request with status: ${i.status}. ${i.statusText}`,t;try{t=await i.json(),t.message&&(e=`${e} message: ${t.message}`),t.requestId&&(e=`${e} request-Id: ${t.requestId}`)}catch(n){throw new Error(e,{cause:n})}throw i.status>=400&&i.status<=499&&t.message?new Km(t.message):new pf({statusCode:i.status,message:e})}var bt=es("companionHeaders"),zi=es("getUrl"),bs=es("requestSocketToken"),$i=es("awaitRemoteFileUpload");Eu=Symbol.for("uppy test: getCompanionHeaders");class ir{constructor(e,t){Object.defineProperty(this,$i,{value:mf}),Object.defineProperty(this,zi,{value:hf}),Object.defineProperty(this,bt,{writable:!0,value:void 0}),Object.defineProperty(this,bs,{writable:!0,value:async n=>{var a;let{file:s,postBody:o,signal:r}=n;if(((a=s.remote)==null?void 0:a.url)==null)throw new Error("Cannot connect to an undefined URL");return(await this.post(s.remote.url,{...s.remote.body,...o},{signal:r})).token}}),this.uppy=e,this.opts=t,this.onReceiveResponse=this.onReceiveResponse.bind(this),vt(this,bt)[bt]=t==null?void 0:t.companionHeaders}setCompanionHeaders(e){vt(this,bt)[bt]=e}[Eu](){return vt(this,bt)[bt]}get hostname(){const{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return lf(e&&e[t]?e[t]:t)}async headers(e){return e===void 0&&(e=!1),{...{Accept:"application/json",...e?void 0:{"Content-Type":"application/json"}},...vt(this,bt)[bt]}}onReceiveResponse(e){const{headers:t}=e,a=this.uppy.getState().companion||{},s=this.opts.companionUrl;t.has("i-am")&&t.get("i-am")!==a[s]&&this.uppy.setState({companion:{...a,[s]:t.get("i-am")}})}async request(e){let{path:t,method:n="GET",data:a,skipPostResponse:s,signal:o}=e;try{const r=await this.headers(!a),l=await Zm(vt(this,zi)[zi](t),{method:n,signal:o,headers:r,credentials:this.opts.companionCookiesRule||"same-origin",body:a?JSON.stringify(a):null});return s||this.onReceiveResponse(l),await df(l)}catch(r){throw r.isAuthError||r.name==="UserFacingApiError"||r.name==="AbortError"?r:new ef(`Could not ${n} ${vt(this,zi)[zi](t)}`,{cause:r})}}async get(e,t){return typeof t=="boolean"&&(t={skipPostResponse:t}),this.request({...t,path:e})}async post(e,t,n){return typeof n=="boolean"&&(n={skipPostResponse:n}),this.request({...n,path:e,method:"POST",data:t})}async delete(e,t,n){return typeof n=="boolean"&&(n={skipPostResponse:n}),this.request({...n,path:e,method:"DELETE",data:t})}async uploadRemoteFile(e,t,n){var a=this;try{const{signal:s,getQueue:o}=n||{};return await _u(async()=>{var r;const l=(r=this.uppy.getFile(e.id))==null?void 0:r.serverToken;if(l!=null)return this.uppy.log(`Connecting to exiting websocket ${l}`),vt(this,$i)[$i]({file:e,queue:o(),signal:s});const p=await o().wrapPromiseFunction(async function(){try{return await vt(a,bs)[bs](...arguments)}catch(u){if(u.isAuthError)throw new ro(u);if(u.cause==null)throw u;const h=u.cause,g=()=>[408,409,429,418,423].includes(h.statusCode)||h.statusCode>=500&&h.statusCode<=599&&![501,505].includes(h.statusCode);throw h.name==="HttpError"&&!g()?new ro(h):h}},{priority:-1})({file:e,postBody:t,signal:s}).abortOn(s);if(this.uppy.getFile(e.id))return this.uppy.setFileState(e.id,{serverToken:p}),vt(this,$i)[$i]({file:this.uppy.getFile(e.id),queue:o(),signal:s})},{retries:ku,signal:s,onFailedAttempt:r=>this.uppy.log(`Retrying upload due to: ${r.message}`,"warning")})}catch(s){if(s.name==="AbortError")return;throw this.uppy.emit("upload-error",e,s),s}}}function hf(i){return/^(https?:|)\/\//.test(i)?i:`${this.hostname}/${i}`}async function mf(i){let{file:e,queue:t,signal:n}=i,a;const{capabilities:s}=this.uppy.getState();try{return await new Promise((o,r)=>{const l=e.serverToken,c=af(e.remote.companionUrl);let p,u,h,{isPaused:g}=e;const m=(_,O)=>{if(p==null||p.readyState!==p.OPEN){var L;this.uppy.log(`Cannot send "${_}" to socket ${e.id} because the socket state was ${String((L=p)==null?void 0:L.readyState)}`,"warning");return}p.send(JSON.stringify({action:_,payload:O??{}}))};function v(){s.resumableUploads&&m(g?"pause":"resume")}const f=async()=>{u&&u.abort(),u=new AbortController;const _=L=>{var z;this.uppy.setFileState(e.id,{serverToken:null}),(z=u)==null||z.abort==null||z.abort(),r(L)};function O(){clearTimeout(h),!g&&(h=setTimeout(()=>_(new Error("Timeout waiting for message from Companion socket")),cf))}try{await t.wrapPromiseFunction(async()=>{await _u(async()=>new Promise((z,K)=>{p=new WebSocket(`${c}/api/${l}`),O(),p.addEventListener("close",()=>{p=void 0,K(new Error("Socket closed unexpectedly"))}),p.addEventListener("error",G=>{var j;this.uppy.log(`Companion socket error ${JSON.stringify(G)}, closing socket`,"warning"),(j=p)==null||j.close()}),p.addEventListener("open",()=>{v()}),p.addEventListener("message",G=>{O();try{const{action:w,payload:E}=JSON.parse(G.data);switch(w){case"progress":{nf(this,E,this.uppy.getFile(e.id));break}case"success":{var j,$,P,b;const T=(j=E.response)==null?void 0:j.responseText;this.uppy.emit("upload-success",this.uppy.getFile(e.id),{uploadURL:E.url,status:($=(P=E.response)==null?void 0:P.status)!=null?$:200,body:T?JSON.parse(T):void 0}),(b=u)==null||b.abort==null||b.abort(),o();break}case"error":{const{message:T}=E.error;throw Object.assign(new Error(T),{cause:E.error})}default:this.uppy.log(`Companion socket unknown action ${w}`,"warning")}}catch(w){_(w)}});const Z=()=>{this.uppy.log(`Closing socket ${e.id}`,"info"),clearTimeout(h),p&&p.close(),p=void 0};u.signal.addEventListener("abort",()=>{Z()})}),{retries:ku,signal:u.signal,onFailedAttempt:()=>{u.signal.aborted||this.uppy.log(`Retrying websocket ${e.id}`,"info")}})})().abortOn(u.signal)}catch(L){if(u.signal.aborted)return;_(L)}},y=_=>{if(s.resumableUploads)if(g=_,p&&v(),_){var O;(O=u)==null||O.abort==null||O.abort()}else f()},F=_=>{var O;s.individualCancellation&&_.id===e.id&&(m("cancel"),(O=u)==null||O.abort==null||O.abort(),this.uppy.log(`upload ${e.id} was removed`,"info"),o())},S=_=>{var O;let{reason:L}=_;L==="user"&&m("cancel"),(O=u)==null||O.abort==null||O.abort(),this.uppy.log(`upload ${e.id} was canceled`,"info"),o()},A=(_,O)=>{_===e.id&&y(O)},D=()=>y(!0),x=()=>y(!1);this.uppy.on("file-removed",F),this.uppy.on("cancel-all",S),this.uppy.on("upload-pause",A),this.uppy.on("pause-all",D),this.uppy.on("resume-all",x),a=()=>{this.uppy.off("file-removed",F),this.uppy.off("cancel-all",S),this.uppy.off("upload-pause",A),this.uppy.off("pause-all",D),this.uppy.off("resume-all",x)},n.addEventListener("abort",()=>{var _;(_=u)==null||_.abort()}),f()})}finally{a==null||a()}}ir.VERSION=rf.version;const ff=i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");class gf extends ir{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||ff(this.id),this.pluginId=this.opts.pluginId}fileUrl(e){return`${this.hostname}/search/${this.id}/get/${e}`}search(e,t){return this.get(`search/${this.id}/list?q=${encodeURIComponent(e)}${t?`&${t}`:""}`)}}function vf(i,e){if(i){if(typeof i!="string"&&!Array.isArray(i)&&!(i instanceof RegExp))throw new TypeError('The option "companionAllowedHosts" must be one of string, Array, RegExp');return i}return/^(?!https?:\/\/).*$/i.test(e)?`https://${e.replace(/^\/\//,"")}`:new URL(e).origin}function bf(i,e){return new Promise(t=>{localStorage.setItem(i,e),t()})}function yf(i){return Promise.resolve(localStorage.getItem(i))}function xf(i){return new Promise(e=>{localStorage.removeItem(i),e()})}const wf=Object.freeze(Object.defineProperty({__proto__:null,getItem:yf,removeItem:xf,setItem:bf},Symbol.toStringTag,{value:"Module"})),rt=Array.from;function Vr(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Pf=0;function Sf(i){return"__private_"+Pf+++"_"+i}var qi=Sf("handleSubmit");class Ff extends dt{constructor(e){super(e),this.form=document.createElement("form"),Object.defineProperty(this,qi,{writable:!0,value:t=>{t.preventDefault();const{addFile:n}=this.props,a=this.input.value.trim();n(a)}}),this.form.id=Ci()}componentDidMount(){this.input.value="",this.form.addEventListener("submit",Vr(this,qi)[qi]),document.body.appendChild(this.form)}componentWillUnmount(){this.form.removeEventListener("submit",Vr(this,qi)[qi]),document.body.removeChild(this.form)}render(){const{i18n:e}=this.props;return d("div",{className:"uppy-Url"},d("input",{className:"uppy-u-reset uppy-c-textInput uppy-Url-input",type:"text","aria-label":e("enterUrlToImport"),placeholder:e("enterUrlToImport"),ref:t=>{this.input=t},"data-uppy-super-focusable":!0,form:this.form.id}),d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton",type:"submit",form:this.form.id},e("import")))}}function Wr(i,e,t){const n=rt(i.items);let a;switch(e){case"paste":{if(n.some(o=>o.kind==="file"))return;a=n.filter(o=>o.kind==="string"&&o.type==="text/plain");break}case"drop":{a=n.filter(s=>s.kind==="string"&&s.type==="text/uri-list");break}default:throw new Error(`isDropOrPaste must be either 'drop' or 'paste', but it's ${e}`)}a.forEach(s=>{s.getAsString(o=>t(o))})}const _f={strings:{import:"Import",enterUrlToImport:"Enter URL to import a file",failedToFetch:"Companion failed to fetch this URL, please make sure it’s correct",enterCorrectUrl:"Incorrect URL: Please make sure you are entering a direct link to a file"}};var Tu;const Cf={version:"3.6.0"};function Ef(){return d("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{d:"M23.637 15.312l-2.474 2.464a3.582 3.582 0 01-.577.491c-.907.657-1.897.986-2.968.986a4.925 4.925 0 01-3.959-1.971c-.248-.329-.164-.902.165-1.149.33-.247.907-.164 1.155.164 1.072 1.478 3.133 1.724 4.618.656a.642.642 0 00.33-.328l2.473-2.463c1.238-1.313 1.238-3.366-.082-4.597a3.348 3.348 0 00-4.618 0l-1.402 1.395a.799.799 0 01-1.154 0 .79.79 0 010-1.15l1.402-1.394a4.843 4.843 0 016.843 0c2.062 1.805 2.144 5.007.248 6.896zm-8.081 5.664l-1.402 1.395a3.348 3.348 0 01-4.618 0c-1.319-1.23-1.319-3.365-.082-4.596l2.475-2.464.328-.328c.743-.492 1.567-.739 2.475-.657.906.165 1.648.574 2.143 1.314.248.329.825.411 1.155.165.33-.248.412-.822.165-1.15-.825-1.068-1.98-1.724-3.216-1.888-1.238-.247-2.556.082-3.628.902l-.495.493-2.474 2.464c-1.897 1.969-1.814 5.09.083 6.977.99.904 2.226 1.396 3.463 1.396s2.473-.492 3.463-1.395l1.402-1.396a.79.79 0 000-1.15c-.33-.328-.908-.41-1.237-.082z",fill:"#FF753E","fill-rule":"nonzero"}))}function kf(i){const e=/^[a-z0-9]+:\/\//,t="http://";return e.test(i)?i:t+i}function Tf(i){return rt(i.dataTransfer.items).filter(n=>n.kind==="string"&&n.type==="text/uri-list").length>0}function Of(i){return(i==null?void 0:i.startsWith("http://"))||(i==null?void 0:i.startsWith("https://"))}function Af(i){const{pathname:e}=new URL(i);return e.substring(e.lastIndexOf("/")+1)}let Vn=class lo extends ye{constructor(e,t){if(super(e,t),this.getMeta=n=>this.client.post("url/meta",{url:n}).then(a=>{if(a.error)throw this.uppy.log("[URL] Error:"),this.uppy.log(a.error),new Error("Failed to fetch the file");return a}),this.addFile=async(n,a)=>{const s=kf(n);if(!Of(s)){this.uppy.log(`[URL] Incorrect URL entered: ${s}`),this.uppy.info(this.i18n("enterCorrectUrl"),"error",4e3);return}try{const o=await this.getMeta(s),r={meta:a,source:this.id,name:o.name||Af(s),type:o.type,data:{size:o.size},isRemote:!0,body:{url:s},remote:{companionUrl:this.opts.companionUrl,url:`${this.hostname}/url/get`,body:{fileId:s,url:s},requestClientId:lo.requestClientId}};this.uppy.log("[Url] Adding remote file");try{return this.uppy.addFile(r)}catch(l){return l.isRestriction||this.uppy.log(l),l}}catch(o){return this.uppy.log(o),this.uppy.info({message:this.i18n("failedToFetch"),details:o},"error",4e3),o}},this.handleRootDrop=n=>{Wr(n.dataTransfer,"drop",a=>{this.uppy.log(`[URL] Adding file from dropped url: ${a}`),this.addFile(a)})},this.handleRootPaste=n=>{Wr(n.clipboardData,"paste",a=>{this.uppy.log(`[URL] Adding file from pasted url: ${a}`),this.addFile(a)})},this.id=this.opts.id||"Url",this.title=this.opts.title||"Link",this.type="acquirer",this.icon=()=>d(Ef,null),this.defaultLocale=_f,this.i18nInit(),this.hostname=this.opts.companionUrl,!this.hostname)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");this.client=new ir(e,{pluginId:this.id,provider:"url",companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule}),this.uppy.registerRequestClient(lo.requestClientId,this.client)}render(){return d(Ff,{i18n:this.i18n,addFile:this.addFile})}install(){const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}};Tu=Vn;Vn.VERSION=Cf.version;Vn.requestClientId=Tu.name;Vn.prototype.canHandleRootDrop=Tf;var Ou={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function a(l,c,p){this.fn=l,this.context=c,this.once=p||!1}function s(l,c,p,u,h){if(typeof p!="function")throw new TypeError("The listener must be a function");var g=new a(p,u||l,h),m=t?t+c:c;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],g]:l._events[m].push(g):(l._events[m]=g,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function r(){this._events=new n,this._eventsCount=0}r.prototype.eventNames=function(){var c=[],p,u;if(this._eventsCount===0)return c;for(u in p=this._events)e.call(p,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(p)):c},r.prototype.listeners=function(c){var p=t?t+c:c,u=this._events[p];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,g=u.length,m=new Array(g);h<g;h++)m[h]=u[h].fn;return m},r.prototype.listenerCount=function(c){var p=t?t+c:c,u=this._events[p];return u?u.fn?1:u.length:0},r.prototype.emit=function(c,p,u,h,g,m){var v=t?t+c:c;if(!this._events[v])return!1;var f=this._events[v],y=arguments.length,F,S;if(f.fn){switch(f.once&&this.removeListener(c,f.fn,void 0,!0),y){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,p),!0;case 3:return f.fn.call(f.context,p,u),!0;case 4:return f.fn.call(f.context,p,u,h),!0;case 5:return f.fn.call(f.context,p,u,h,g),!0;case 6:return f.fn.call(f.context,p,u,h,g,m),!0}for(S=1,F=new Array(y-1);S<y;S++)F[S-1]=arguments[S];f.fn.apply(f.context,F)}else{var A=f.length,D;for(S=0;S<A;S++)switch(f[S].once&&this.removeListener(c,f[S].fn,void 0,!0),y){case 1:f[S].fn.call(f[S].context);break;case 2:f[S].fn.call(f[S].context,p);break;case 3:f[S].fn.call(f[S].context,p,u);break;case 4:f[S].fn.call(f[S].context,p,u,h);break;default:if(!F)for(D=1,F=new Array(y-1);D<y;D++)F[D-1]=arguments[D];f[S].fn.apply(f[S].context,F)}}return!0},r.prototype.on=function(c,p,u){return s(this,c,p,u,!1)},r.prototype.once=function(c,p,u){return s(this,c,p,u,!0)},r.prototype.removeListener=function(c,p,u,h){var g=t?t+c:c;if(!this._events[g])return this;if(!p)return o(this,g),this;var m=this._events[g];if(m.fn)m.fn===p&&(!h||m.once)&&(!u||m.context===u)&&o(this,g);else{for(var v=0,f=[],y=m.length;v<y;v++)(m[v].fn!==p||h&&!m[v].once||u&&m[v].context!==u)&&f.push(m[v]);f.length?this._events[g]=f.length===1?f[0]:f:o(this,g)}return this},r.prototype.removeAllListeners=function(c){var p;return c?(p=t?t+c:c,this._events[p]&&o(this,p)):(this._events=new n,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prefixed=t,r.EventEmitter=r,i.exports=r})(Ou);var Df=Ou.exports;const Rf=tt(Df);function If(i,e,t){let n=0,a=i.length;for(;a>0;){const s=Math.trunc(a/2);let o=n+s;t(i[o],e)<=0?(n=++o,a-=s+1):a=s}return n}var $t=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},Ft;let Uf=class{constructor(){Ft.set(this,[])}enqueue(e,t){t={priority:0,...t};const n={priority:t.priority,run:e};if(this.size&&$t(this,Ft,"f")[this.size-1].priority>=t.priority){$t(this,Ft,"f").push(n);return}const a=If($t(this,Ft,"f"),n,(s,o)=>o.priority-s.priority);$t(this,Ft,"f").splice(a,0,n)}dequeue(){const e=$t(this,Ft,"f").shift();return e==null?void 0:e.run}filter(e){return $t(this,Ft,"f").filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return $t(this,Ft,"f").length}};Ft=new WeakMap;var ee=function(i,e,t,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!a:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(i,t):a?a.value=t:e.set(i,t),t},U=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},ae,pn,dn,Nt,Ma,hn,wa,Ke,on,De,Pa,Ue,mn,It,Sa,Gr,Kr,Au,Xr,Qr,Fa,ys,xs,ja,Du,_a;let Ru=class extends Error{},Nf=class extends Rf{constructor(e){var t,n,a,s;if(super(),ae.add(this),pn.set(this,void 0),dn.set(this,void 0),Nt.set(this,0),Ma.set(this,void 0),hn.set(this,void 0),wa.set(this,0),Ke.set(this,void 0),on.set(this,void 0),De.set(this,void 0),Pa.set(this,void 0),Ue.set(this,0),mn.set(this,void 0),It.set(this,void 0),Sa.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Uf,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(t=e.intervalCap)===null||t===void 0?void 0:t.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(s=(a=e.interval)===null||a===void 0?void 0:a.toString())!==null&&s!==void 0?s:""}\` (${typeof e.interval})`);ee(this,pn,e.carryoverConcurrencyCount,"f"),ee(this,dn,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),ee(this,Ma,e.intervalCap,"f"),ee(this,hn,e.interval,"f"),ee(this,De,new e.queueClass,"f"),ee(this,Pa,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,ee(this,Sa,e.throwOnTimeout===!0,"f"),ee(this,It,e.autoStart===!1,"f")}get concurrency(){return U(this,mn,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);ee(this,mn,e,"f"),U(this,ae,"m",ja).call(this)}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:U(this,Sa,"f"),...t},new Promise((n,a)=>{U(this,De,"f").enqueue(async()=>{var s,o,r;ee(this,Ue,(o=U(this,Ue,"f"),o++,o),"f"),ee(this,Nt,(r=U(this,Nt,"f"),r++,r),"f");try{if(!((s=t.signal)===null||s===void 0)&&s.aborted)throw new Ru("The task was aborted.");let l=e({signal:t.signal});t.timeout&&(l=au(Promise.resolve(l),t.timeout)),t.signal&&(l=Promise.race([l,U(this,ae,"m",Du).call(this,t.signal)]));const c=await l;n(c),this.emit("completed",c)}catch(l){if(l instanceof su&&!t.throwOnTimeout){n();return}a(l),this.emit("error",l)}finally{U(this,ae,"m",Au).call(this)}},t),this.emit("add"),U(this,ae,"m",Fa).call(this)})}async addAll(e,t){return Promise.all(e.map(async n=>this.add(n,t)))}start(){return U(this,It,"f")?(ee(this,It,!1,"f"),U(this,ae,"m",ja).call(this),this):this}pause(){ee(this,It,!0,"f")}clear(){ee(this,De,new(U(this,Pa,"f")),"f")}async onEmpty(){U(this,De,"f").size!==0&&await U(this,ae,"m",_a).call(this,"empty")}async onSizeLessThan(e){U(this,De,"f").size<e||await U(this,ae,"m",_a).call(this,"next",()=>U(this,De,"f").size<e)}async onIdle(){U(this,Ue,"f")===0&&U(this,De,"f").size===0||await U(this,ae,"m",_a).call(this,"idle")}get size(){return U(this,De,"f").size}sizeBy(e){return U(this,De,"f").filter(e).length}get pending(){return U(this,Ue,"f")}get isPaused(){return U(this,It,"f")}};pn=new WeakMap,dn=new WeakMap,Nt=new WeakMap,Ma=new WeakMap,hn=new WeakMap,wa=new WeakMap,Ke=new WeakMap,on=new WeakMap,De=new WeakMap,Pa=new WeakMap,Ue=new WeakMap,mn=new WeakMap,It=new WeakMap,Sa=new WeakMap,ae=new WeakSet,Gr=function(){return U(this,dn,"f")||U(this,Nt,"f")<U(this,Ma,"f")},Kr=function(){return U(this,Ue,"f")<U(this,mn,"f")},Au=function(){var e;ee(this,Ue,(e=U(this,Ue,"f"),e--,e),"f"),U(this,ae,"m",Fa).call(this),this.emit("next")},Xr=function(){U(this,ae,"m",xs).call(this),U(this,ae,"m",ys).call(this),ee(this,on,void 0,"f")},Qr=function(){const e=Date.now();if(U(this,Ke,"f")===void 0){const t=U(this,wa,"f")-e;if(t<0)ee(this,Nt,U(this,pn,"f")?U(this,Ue,"f"):0,"f");else return U(this,on,"f")===void 0&&ee(this,on,setTimeout(()=>{U(this,ae,"m",Xr).call(this)},t),"f"),!0}return!1},Fa=function(){if(U(this,De,"f").size===0)return U(this,Ke,"f")&&clearInterval(U(this,Ke,"f")),ee(this,Ke,void 0,"f"),this.emit("empty"),U(this,Ue,"f")===0&&this.emit("idle"),!1;if(!U(this,It,"f")){const e=!U(this,ae,"a",Qr);if(U(this,ae,"a",Gr)&&U(this,ae,"a",Kr)){const t=U(this,De,"f").dequeue();return t?(this.emit("active"),t(),e&&U(this,ae,"m",ys).call(this),!0):!1}}return!1},ys=function(){U(this,dn,"f")||U(this,Ke,"f")!==void 0||(ee(this,Ke,setInterval(()=>{U(this,ae,"m",xs).call(this)},U(this,hn,"f")),"f"),ee(this,wa,Date.now()+U(this,hn,"f"),"f"))},xs=function(){U(this,Nt,"f")===0&&U(this,Ue,"f")===0&&U(this,Ke,"f")&&(clearInterval(U(this,Ke,"f")),ee(this,Ke,void 0,"f")),ee(this,Nt,U(this,pn,"f")?U(this,Ue,"f"):0,"f"),U(this,ae,"m",ja).call(this)},ja=function(){for(;U(this,ae,"m",Fa).call(this););},Du=async function(e){return new Promise((t,n)=>{e.addEventListener("abort",()=>{n(new Ru("The task was aborted."))},{once:!0})})},_a=async function(e,t){return new Promise(n=>{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)})};var Tn,oe,ws,Yr,On=0,Iu=[],Ca=[],ce=io,Jr=ce.__b,Zr=ce.__r,el=ce.diffed,tl=ce.__c,il=ce.unmount,nl=ce.__;function nr(i,e){ce.__h&&ce.__h(oe,i,On||e),On=0;var t=oe.__H||(oe.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({__V:Ca}),t.__[i]}function zt(i){return On=1,Lf(Nu,i)}function Lf(i,e,t){var n=nr(Tn++,2);if(n.t=i,!n.__c&&(n.__=[t?t(e):Nu(void 0,e),function(r){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,r);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=oe,!oe.u)){var a=function(r,l,c){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(h){return!!h.__c});if(p.every(function(h){return!h.__N}))return!s||s.call(this,r,l,c);var u=!1;return p.forEach(function(h){if(h.__N){var g=h.__[0];h.__=h.__N,h.__N=void 0,g!==h.__[0]&&(u=!0)}}),!(!u&&n.__c.props===r)&&(!s||s.call(this,r,l,c))};oe.u=!0;var s=oe.shouldComponentUpdate,o=oe.componentWillUpdate;oe.componentWillUpdate=function(r,l,c){if(this.__e){var p=s;s=void 0,a(r,l,c),s=p}o&&o.call(this,r,l,c)},oe.shouldComponentUpdate=a}return n.__N||n.__}function An(i,e){var t=nr(Tn++,3);!ce.__s&&Uu(t.__H,e)&&(t.__=i,t.i=e,oe.__H.__h.push(t))}function Ps(i){return On=5,Wn(function(){return{current:i}},[])}function Wn(i,e){var t=nr(Tn++,7);return Uu(t.__H,e)?(t.__V=i(),t.i=e,t.__h=i,t.__V):t.__}function wi(i,e){return On=8,Wn(function(){return i},e)}function Bf(){for(var i;i=Iu.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Ea),i.__H.__h.forEach(co),i.__H.__h=[]}catch(e){i.__H.__h=[],ce.__e(e,i.__v)}}ce.__b=function(i){oe=null,Jr&&Jr(i)},ce.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),nl&&nl(i,e)},ce.__r=function(i){Zr&&Zr(i),Tn=0;var e=(oe=i.__c).__H;e&&(ws===oe?(e.__h=[],oe.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=Ca,t.__N=t.i=void 0})):(e.__h.forEach(Ea),e.__h.forEach(co),e.__h=[],Tn=0)),ws=oe},ce.diffed=function(i){el&&el(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Iu.push(e)!==1&&Yr===ce.requestAnimationFrame||((Yr=ce.requestAnimationFrame)||Mf)(Bf)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==Ca&&(t.__=t.__V),t.i=void 0,t.__V=Ca})),ws=oe=null},ce.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Ea),t.__h=t.__h.filter(function(n){return!n.__||co(n)})}catch(n){e.some(function(a){a.__h&&(a.__h=[])}),e=[],ce.__e(n,t.__v)}}),tl&&tl(i,e)},ce.unmount=function(i){il&&il(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{Ea(n)}catch(a){e=a}}),t.__H=void 0,e&&ce.__e(e,t.__v))};var al=typeof requestAnimationFrame=="function";function Mf(i){var e,t=function(){clearTimeout(n),al&&cancelAnimationFrame(e),setTimeout(i)},n=setTimeout(t,100);al&&(e=requestAnimationFrame(t))}function Ea(i){var e=oe,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),oe=e}function co(i){var e=oe;i.__c=i.__(),oe=e}function Uu(i,e){return!i||i.length!==e.length||e.some(function(t,n){return t!==i[n]})}function Nu(i,e){return typeof e=="function"?e(i):e}function jf(){return d("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg"},d("g",{fill:"none","fill-rule":"evenodd"},d("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),d("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),d("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),d("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),d("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),d("path",{d:"M4 4h18v18H4z"})))}function zf(i){let{pluginName:e,i18n:t,onAuth:n}=i;const a=e==="Google Drive",s=wi(o=>{o.preventDefault(),n()},[n]);return d("form",{onSubmit:s},a?d("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0},d(jf,null),t("signInWithGoogle")):d("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0},t("authenticateWith",{pluginName:e})))}const $f=i=>{let{pluginName:e,i18n:t,onAuth:n}=i;return d(zf,{pluginName:e,i18n:t,onAuth:n})};function qf(i){const{loading:e,pluginName:t,pluginIcon:n,i18n:a,handleAuth:s,renderForm:o=$f}=i;return d("div",{className:"uppy-Provider-auth"},d("div",{className:"uppy-Provider-authIcon"},n()),d("div",{className:"uppy-Provider-authTitle"},a("authenticateWithTitle",{pluginName:t})),d("div",{className:"uppy-Provider-authForm"},o({pluginName:t,i18n:a,loading:e,onAuth:s})))}function Hf(i){let{i18n:e,logout:t,username:n}=i;return d(ot,null,d("span",{className:"uppy-ProviderBrowser-user",key:"username"},n),d("button",{type:"button",onClick:t,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",key:"logout"},e("logOut")))}const Vf=i=>{const{getFolder:e,title:t,isLast:n}=i;return d(ot,null,d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:e},t),n?"":" / ")};function Wf(i){const{getFolder:e,title:t,breadcrumbsIcon:n,breadcrumbs:a}=i;return d("div",{className:"uppy-Provider-breadcrumbs"},d("div",{className:"uppy-Provider-breadcrumbsIcon"},n),a.map((s,o)=>d(Vf,{key:s.id,getFolder:()=>e(s.requestPath,s.name),title:o===0?t:s.name,isLast:o+1===a.length})))}function Gf(i){return d(ot,null,i.showBreadcrumbs&&d(Wf,{getFolder:i.getFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon&&i.pluginIcon(),title:i.title}),d(Hf,{logout:i.logout,username:i.username,i18n:i.i18n}))}function ts(i){return{...i,type:i.mimeType,extension:i.name?Jo(i.name).extension:null}}function uo(){return uo=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},uo.apply(this,arguments)}const Kf={position:"relative",width:"100%",minHeight:"100%"},Xf={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};class ar extends dt{constructor(e){super(e),this.handleScroll=()=>{this.setState({offset:this.base.scrollTop})},this.handleResize=()=>{this.resize()},this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement&&this.focusElement.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}resize(){const{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render(e){let{data:t,rowHeight:n,renderRow:a,overscanCount:s=10,...o}=e;const{offset:r,height:l}=this.state;let c=Math.floor(r/n),p=Math.floor(l/n);s&&(c=Math.max(0,c-c%s),p+=s);const u=c+p+4,h=t.slice(c,u),g={...Kf,height:t.length*n},m={...Xf,top:c*n};return d("div",uo({onScroll:this.handleScroll},o),d("div",{role:"presentation",style:g},d("div",{role:"presentation",style:m},h.map(a))))}}function Lu(i){const{search:e,searchOnInput:t,searchTerm:n,showButton:a,inputLabel:s,clearSearchLabel:o,buttonLabel:r,clearSearch:l,inputClassName:c,buttonCSSClassName:p}=i,[u,h]=zt(n??""),g=wi(y=>{y.preventDefault(),e(u)},[e,u]),m=wi(y=>{const F=y.target.value;h(F),t&&e(F)},[h,t,e]),v=()=>{h(""),l&&l()},[f]=zt(()=>{const y=document.createElement("form");return y.setAttribute("tabindex","-1"),y.id=Ci(),y});return An(()=>(document.body.appendChild(f),f.addEventListener("submit",g),()=>{f.removeEventListener("submit",g),document.body.removeChild(f)}),[f,g]),d(ot,null,d("input",{className:`uppy-u-reset ${c}`,type:"search","aria-label":s,placeholder:s,value:u,onInput:m,form:f.id,"data-uppy-super-focusable":!0}),!a&&d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12"},d("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})),!a&&u&&d("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":o,title:o,onClick:v},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19"},d("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"}))),a&&d("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${p}`,type:"submit",form:f.id},r))}function Qf(i){let{cancel:e,done:t,i18n:n,selected:a}=i;return d("div",{className:"uppy-ProviderBrowser-footer"},d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary",onClick:t,type:"button"},n("selectX",{smart_count:a})),d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:e,type:"button"},n("cancel")))}function Yf(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58"},d("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"}))}function Jf(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157"},d("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"}))}function Zf(){return d("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58"},d("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),d("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"}))}function eg(i){const{itemIconString:e}=i;if(e===null)return null;switch(e){case"file":return d(Yf,null);case"folder":return d(Jf,null);case"video":return d(Zf,null);default:{const{alt:t}=i;return d("img",{src:e,alt:t,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}}function sl(i){const{className:e,isDisabled:t,restrictionError:n,isChecked:a,title:s,itemIconEl:o,showTitles:r,toggleCheckbox:l,recordShiftKeyPress:c,id:p,children:u}=i,h=fe("uppy-u-reset","uppy-ProviderBrowserItem-checkbox","uppy-ProviderBrowserItem-checkbox--grid",{"uppy-ProviderBrowserItem-checkbox--is-checked":a});return d("li",{className:e,title:t?n==null?void 0:n.message:void 0},d("input",{type:"checkbox",className:h,onChange:l,onKeyDown:c,onMouseDown:c,name:"listitem",id:p,checked:a,disabled:t,"data-uppy-super-focusable":!0}),d("label",{htmlFor:p,"aria-label":s,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},o,r&&s,u))}function tg(i){const{className:e,isDisabled:t,restrictionError:n,isCheckboxDisabled:a,isChecked:s,toggleCheckbox:o,recordShiftKeyPress:r,type:l,id:c,itemIconEl:p,title:u,handleFolderClick:h,showTitles:g,i18n:m}=i;return d("li",{className:e,title:t?n==null?void 0:n.message:void 0},a?null:d("input",{type:"checkbox",className:`uppy-u-reset uppy-ProviderBrowserItem-checkbox ${s?"uppy-ProviderBrowserItem-checkbox--is-checked":""}`,onChange:o,onKeyDown:r,onMouseDown:r,name:"listitem",id:c,checked:s,"aria-label":l==="file"?null:m("allFilesFromFolderNamed",{name:u}),disabled:t,"data-uppy-super-focusable":!0}),l==="file"?d("label",{htmlFor:c,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},d("div",{className:"uppy-ProviderBrowserItem-iconWrap"},p),g&&u):d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:h,"aria-label":m("openFolderNamed",{name:u})},d("div",{className:"uppy-ProviderBrowserItem-iconWrap"},p),g&&d("span",null,u)))}function fn(){return fn=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},fn.apply(this,arguments)}function ol(i){const{author:e,getItemIcon:t,isChecked:n,isDisabled:a,viewType:s}=i,o=t(),r=fe("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--selected":n},{"uppy-ProviderBrowserItem--disabled":a},{"uppy-ProviderBrowserItem--noPreview":o==="video"}),l=d(eg,{itemIconString:o});switch(s){case"grid":return d(sl,fn({},i,{className:r,itemIconEl:l}));case"list":return d(tg,fn({},i,{className:r,itemIconEl:l}));case"unsplash":return d(sl,fn({},i,{className:r,itemIconEl:l}),d("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1},e.name));default:throw new Error(`There is no such type ${s}`)}}const ig="shared-with-me";function rl(i){const{currentSelection:e,uppyFiles:t,viewType:n,isChecked:a,toggleCheckbox:s,recordShiftKeyPress:o,showTitles:r,i18n:l,validateRestrictions:c,getNextFolder:p,f:u}=i;if(u.isFolder)return ol({showTitles:r,viewType:n,i18n:l,id:u.id,title:u.name,getItemIcon:()=>u.icon,isChecked:a(u),toggleCheckbox:g=>s(g,u),recordShiftKeyPress:o,type:"folder",isDisabled:!1,isCheckboxDisabled:u.id===ig,handleFolderClick:()=>p(u)});const h=c(ts(u),[...t,...e]);return ol({id:u.id,title:u.name,author:u.author,getItemIcon:()=>u.icon,isChecked:a(u),toggleCheckbox:g=>s(g,u),isCheckboxDisabled:!1,recordShiftKeyPress:o,showTitles:r,viewType:n,i18n:l,type:"file",isDisabled:!!h&&!a(u),restrictionError:h})}function Bu(i){const{currentSelection:e,folders:t,files:n,uppyFiles:a,viewType:s,headerComponent:o,showBreadcrumbs:r,isChecked:l,toggleCheckbox:c,recordShiftKeyPress:p,handleScroll:u,showTitles:h,i18n:g,validateRestrictions:m,isLoading:v,showSearchFilter:f,search:y,searchTerm:F,clearSearch:S,searchOnInput:A,searchInputLabel:D,clearSearchLabel:x,getNextFolder:_,cancel:O,done:L,noResultsLabel:z,loadAllFiles:K}=i,Z=e.length,G=Wn(()=>[...t,...n],[t,n]);return d("div",{className:fe("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${s}`)},o&&d("div",{className:"uppy-ProviderBrowser-header"},d("div",{className:fe("uppy-ProviderBrowser-headerBar",!r&&"uppy-ProviderBrowser-headerBar--simple")},o)),f&&d("div",{class:"uppy-ProviderBrowser-searchFilter"},d(Lu,{search:y,searchTerm:F,clearSearch:S,inputLabel:D,clearSearchLabel:x,inputClassName:"uppy-ProviderBrowser-searchFilterInput",searchOnInput:A})),v?d("div",{className:"uppy-Provider-loading"},d("span",null,g("loading"))):!t.length&&!n.length?d("div",{className:"uppy-Provider-empty"},z):K?d("div",{className:"uppy-ProviderBrowser-body"},d("ul",{className:"uppy-ProviderBrowser-list"},d(ar,{data:G,renderRow:j=>d(rl,{currentSelection:e,uppyFiles:a,viewType:s,isChecked:l,toggleCheckbox:c,recordShiftKeyPress:p,showTitles:h,i18n:g,validateRestrictions:m,getNextFolder:_,f:j}),rowHeight:31}))):d("div",{className:"uppy-ProviderBrowser-body"},d("ul",{className:"uppy-ProviderBrowser-list",onScroll:u,role:"listbox",tabIndex:-1},G.map(j=>d(rl,{currentSelection:e,uppyFiles:a,viewType:s,isChecked:l,toggleCheckbox:c,recordShiftKeyPress:p,showTitles:h,i18n:g,validateRestrictions:m,getNextFolder:_,f:j})))),Z>0&&d(Qf,{selected:Z,done:L,cancel:O,i18n:g}))}let za=class extends dt{componentWillUnmount(){const{onUnmount:e}=this.props;e()}render(){const{children:e}=this.props;return Ct(e)[0]}};function $a(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}let Mu=class{constructor(e,t){this.filterItems=n=>{const a=this.plugin.getPluginState();return!a.filterInput||a.filterInput===""?n:n.filter(s=>s.name.toLowerCase().indexOf(a.filterInput.toLowerCase())!==-1)},this.recordShiftKeyPress=n=>{this.isShiftKeyPressed=n.shiftKey},this.isChecked=n=>{const{currentSelection:a}=this.plugin.getPluginState();return a.some(s=>s.id===n.id)},this.plugin=e,this.provider=t.provider,this.opts=t,this.isHandlingScroll=!1,this.preFirstRender=this.preFirstRender.bind(this),this.handleError=this.handleError.bind(this),this.clearSelection=this.clearSelection.bind(this),this.cancelPicking=this.cancelPicking.bind(this)}preFirstRender(){this.plugin.setPluginState({didFirstRender:!0}),this.plugin.onFirstRender()}shouldHandleScroll(e){const{scrollHeight:t,scrollTop:n,offsetHeight:a}=e.target;return t-(n+a)<50&&!this.isHandlingScroll}clearSelection(){this.plugin.setPluginState({currentSelection:[],filterInput:""})}cancelPicking(){this.clearSelection();const e=this.plugin.uppy.getPlugin("Dashboard");e&&e.hideAllPanels()}handleError(e){var t;const{uppy:n}=this.plugin,a=n.i18n("companionError");n.log(e.toString()),!(e.isAuthError||((t=e.cause)==null?void 0:t.name)==="AbortError")&&n.info({message:a,details:e.toString()},"error",5e3)}registerRequestClient(){this.requestClientId=this.provider.provider,this.plugin.uppy.registerRequestClient(this.requestClientId,this.provider)}getTagFile(e){const t={id:e.id,source:this.plugin.id,name:e.name||e.id,type:e.mimeType,isRemote:!0,data:e,meta:{},body:{fileId:e.id},remote:{companionUrl:this.plugin.opts.companionUrl,url:`${this.provider.fileUrl(e.requestPath)}`,body:{fileId:e.id},providerName:this.provider.name,provider:this.provider.provider,requestClientId:this.requestClientId}},n=Ja(t);return n&&$a(n)&&(t.preview=e.thumbnail),e.author&&(e.author.name!=null&&(t.meta.authorName=String(e.author.name)),e.author.url&&(t.meta.authorUrl=e.author.url)),e.relDirPath!=null&&(t.meta.relativePath=e.relDirPath?`${e.relDirPath}/${t.name}`:null),e.absDirPath!=null&&(t.meta.absolutePath=e.absDirPath?`/${e.absDirPath}/${t.name}`:`/${t.name}`),t}toggleCheckbox(e,t){e.stopPropagation(),e.preventDefault(),e.currentTarget.focus();const{folders:n,files:a}=this.plugin.getPluginState(),s=this.filterItems(n.concat(a));if(this.lastCheckbox&&this.isShiftKeyPressed){const{currentSelection:r}=this.plugin.getPluginState(),l=s.indexOf(this.lastCheckbox),c=s.indexOf(t),p=l<c?s.slice(l,c+1):s.slice(c,l+1),u=[];for(const h of p){const{uppy:g}=this.plugin,m=g.validateRestrictions(ts(h),[...g.getFiles(),...u]);m?g.info({message:m.message},"error",g.opts.infoTimeout):u.push(h)}this.plugin.setPluginState({currentSelection:[...new Set([...r,...u])]});return}this.lastCheckbox=t;const{currentSelection:o}=this.plugin.getPluginState();this.isChecked(t)?this.plugin.setPluginState({currentSelection:o.filter(r=>r.id!==t.id)}):this.plugin.setPluginState({currentSelection:o.concat([t])})}setLoading(e){this.plugin.setPluginState({loading:e})}};function Ee(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var ng=0;function Gn(i){return"__private_"+ng+++"_"+i}const ag={version:"3.11.0"};function sg(i){return i.slice(1).map(e=>e.name).join("/")}function po(i,e){return i?`${i}/${e}`:e}function ju(){return d("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30"},d("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"}))}const og={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1};var Jt=Gn("abortController"),We=Gn("withAbort"),Dn=Gn("list"),Hi=Gn("listFilesAndFolders"),gn=Gn("recursivelyListAllFiles");let rg=class extends Mu{constructor(e,t){super(e,{...og,...t}),Object.defineProperty(this,gn,{value:pg}),Object.defineProperty(this,Hi,{value:ug}),Object.defineProperty(this,Dn,{value:cg}),Object.defineProperty(this,We,{value:lg}),Object.defineProperty(this,Jt,{writable:!0,value:void 0}),this.filterQuery=this.filterQuery.bind(this),this.clearFilter=this.clearFilter.bind(this),this.getFolder=this.getFolder.bind(this),this.getNextFolder=this.getNextFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.plugin.setPluginState({authenticated:void 0,files:[],folders:[],breadcrumbs:[],filterInput:"",isSearchVisible:!1,currentSelection:[]}),this.registerRequestClient()}tearDown(){}async getFolder(e,t){this.setLoading(!0);try{await Ee(this,We)[We](async n=>{this.lastCheckbox=void 0;let{breadcrumbs:a}=this.plugin.getPluginState();const s=a.findIndex(l=>e===l.requestPath);s!==-1?a=a.slice(0,s+1):a=[...a,{requestPath:e,name:t}],this.nextPagePath=e;let o=[],r=[];do{const{files:l,folders:c}=await Ee(this,Hi)[Hi]({breadcrumbs:a,signal:n});o=o.concat(l),r=r.concat(c),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length+r.length}))}while(this.opts.loadAllFiles&&this.nextPagePath);this.plugin.setPluginState({folders:r,files:o,breadcrumbs:a,filterInput:""})})}catch(n){if((n==null?void 0:n.name)==="UserFacingApiError"){this.plugin.uppy.info({message:this.plugin.uppy.i18n(n.message)},"warning",5e3);return}this.handleError(n)}finally{this.setLoading(!1)}}getNextFolder(e){this.getFolder(e.requestPath,e.name),this.lastCheckbox=void 0}async logout(){try{await Ee(this,We)[We](async e=>{const t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){const a=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(a,"info",7e3)}const n={authenticated:!1,files:[],folders:[],breadcrumbs:[],filterInput:""};this.plugin.setPluginState(n)}})}catch(e){this.handleError(e)}}filterQuery(e){this.plugin.setPluginState({filterInput:e})}clearFilter(){this.plugin.setPluginState({filterInput:""})}async handleAuth(e){try{await Ee(this,We)[We](async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),this.preFirstRender()})}catch(t){if(t.name==="UserFacingApiError"){this.plugin.uppy.info({message:this.plugin.uppy.i18n(t.message)},"warning",5e3);return}this.plugin.uppy.log(`login failed: ${t.message}`)}finally{this.setLoading(!1)}}async handleScroll(e){if(this.shouldHandleScroll(e)&&this.nextPagePath){this.isHandlingScroll=!0;try{await Ee(this,We)[We](async t=>{const{files:n,folders:a,breadcrumbs:s}=this.plugin.getPluginState(),{files:o,folders:r}=await Ee(this,Hi)[Hi]({breadcrumbs:s,signal:t}),l=n.concat(o),c=a.concat(r);this.plugin.setPluginState({folders:c,files:l})})}catch(t){this.handleError(t)}finally{this.isHandlingScroll=!1}}}async donePicking(){this.setLoading(!0);try{await Ee(this,We)[We](async e=>{const{currentSelection:t}=this.plugin.getPluginState(),n=[],a=[];for(const s of t){const{requestPath:o}=s,r=l=>({...l,relDirPath:l.absDirPath.replace(s.absDirPath,"").replace(/^\//,"")});if(s.isFolder){let l=!0,c=0;const p=new Nf({concurrency:6}),u=g=>{for(const m of g){const v=this.getTagFile(m),f=Zo(v);this.plugin.uppy.checkIfFileAlreadyExists(f)||(a.push(r(m)),c++,this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:c}))),l=!1}};await Ee(this,gn)[gn]({requestPath:o,absDirPath:po(s.absDirPath,s.name),relDirPath:s.name,queue:p,onFiles:u,signal:e}),await p.onIdle();let h;l?h=this.plugin.uppy.i18n("emptyFolderAdded"):c===0?h=this.plugin.uppy.i18n("folderAlreadyAdded",{folder:s.name}):h=this.plugin.uppy.i18n("folderAdded",{smart_count:c,folder:s.name}),n.push(h)}else a.push(r(s))}this.plugin.uppy.log("Adding files from a remote provider"),this.plugin.uppy.addFiles(a.map(s=>this.getTagFile(s,this.requestClientId))),this.plugin.setPluginState({filterInput:""}),n.forEach(s=>this.plugin.uppy.info(s)),this.clearSelection()})}catch(e){this.handleError(e)}finally{this.setLoading(!1)}}render(e,t){var n=this;t===void 0&&(t={});const{authenticated:a,didFirstRender:s}=this.plugin.getPluginState(),{i18n:o}=this.plugin.uppy;s||this.preFirstRender();const r={...this.opts,...t},{files:l,folders:c,filterInput:p,loading:u,currentSelection:h}=this.plugin.getPluginState(),{isChecked:g,recordShiftKeyPress:m,filterItems:v}=this,f=p!=="",y=this.plugin.icon||ju,F={showBreadcrumbs:r.showBreadcrumbs,getFolder:this.getFolder,breadcrumbs:this.plugin.getPluginState().breadcrumbs,pluginIcon:y,title:this.plugin.title,logout:this.logout,username:this.username,i18n:o},S={isChecked:g,toggleCheckbox:this.toggleCheckbox.bind(this),recordShiftKeyPress:m,currentSelection:h,files:f?v(l):l,folders:f?v(c):c,getNextFolder:this.getNextFolder,getFolder:this.getFolder,loadAllFiles:this.opts.loadAllFiles,showSearchFilter:r.showFilter,search:this.filterQuery,clearSearch:this.clearFilter,searchTerm:p,searchOnInput:!0,searchInputLabel:o("filter"),clearSearchLabel:o("resetFilter"),noResultsLabel:o("noFilesFound"),logout:this.logout,handleScroll:this.handleScroll,done:this.donePicking,cancel:this.cancelPicking,headerComponent:d(Gf,F),title:this.plugin.title,viewType:r.viewType,showTitles:r.showTitles,showBreadcrumbs:r.showBreadcrumbs,pluginIcon:y,i18n:this.plugin.uppy.i18n,uppyFiles:this.plugin.uppy.getFiles(),validateRestrictions:function(){return n.plugin.uppy.validateRestrictions(...arguments)},isLoading:u};return a===!1?d(za,{onUnmount:this.clearSelection},d(qf,{pluginName:this.plugin.title,pluginIcon:y,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18nArray,renderForm:this.opts.renderAuthForm,loading:u})):d(za,{onUnmount:this.clearSelection},d(Bu,S))}};async function lg(i){var e;(e=Ee(this,Jt)[Jt])==null||e.abort();const t=new AbortController;Ee(this,Jt)[Jt]=t;const n=()=>{t.abort(),this.clearSelection()};try{this.plugin.uppy.on("dashboard:close-panel",n),this.plugin.uppy.on("cancel-all",n),await i(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",n),this.plugin.uppy.off("cancel-all",n),Ee(this,Jt)[Jt]=void 0}}async function cg(i){let{requestPath:e,absDirPath:t,signal:n}=i;const{username:a,nextPagePath:s,items:o}=await this.provider.list(e,{signal:n});return this.username=a||this.username,{items:o.map(r=>({...r,absDirPath:t})),nextPagePath:s}}async function ug(i){let{breadcrumbs:e,signal:t}=i;const n=sg(e),{items:a,nextPagePath:s}=await Ee(this,Dn)[Dn]({requestPath:this.nextPagePath,absDirPath:n,signal:t});this.nextPagePath=s;const o=[],r=[];return a.forEach(l=>{l.isFolder?r.push(l):o.push(l)}),{files:o,folders:r}}async function pg(i){let{requestPath:e,absDirPath:t,relDirPath:n,queue:a,onFiles:s,signal:o}=i,r=e;for(;r;){const l=await Ee(this,Dn)[Dn]({requestPath:r,absDirPath:t,signal:o});r=l.nextPagePath;const c=l.items.filter(h=>!h.isFolder),p=l.items.filter(h=>h.isFolder);s(c);const u=p.map(async h=>a.add(async()=>Ee(this,gn)[gn]({requestPath:h.requestPath,absDirPath:po(t,h.name),relDirPath:po(n,h.name),queue:a,onFiles:s,signal:o})));await Promise.all(u)}}rg.VERSION=ag.version;function ll(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var dg=0;function hg(i){return"__private_"+dg+++"_"+i}const mg={version:"3.11.0"},cl={isInputMode:!0,files:[],folders:[],breadcrumbs:[],filterInput:"",currentSelection:[],searchTerm:null},fg={viewType:"grid",showTitles:!0,showFilter:!0,showBreadcrumbs:!0};var Vi=hg("updateFilesAndInputMode");let zu=class extends Mu{constructor(e,t){super(e,{...fg,...t}),Object.defineProperty(this,Vi,{value:gg}),this.nextPageQuery=null,this.search=this.search.bind(this),this.clearSearch=this.clearSearch.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.plugin.setPluginState(cl),this.registerRequestClient()}tearDown(){}resetPluginState(){this.plugin.setPluginState(cl)}async search(e){const{searchTerm:t}=this.plugin.getPluginState();if(!(e&&e===t)){this.setLoading(!0);try{const n=await this.provider.search(e);ll(this,Vi)[Vi](n,[])}catch(n){this.handleError(n)}finally{this.setLoading(!1)}}}clearSearch(){this.plugin.setPluginState({currentSelection:[],files:[],searchTerm:null})}async handleScroll(e){const t=this.nextPageQuery||null;if(this.shouldHandleScroll(e)&&t){this.isHandlingScroll=!0;try{const{files:n,searchTerm:a}=this.plugin.getPluginState(),s=await this.provider.search(a,t);ll(this,Vi)[Vi](s,n)}catch(n){this.handleError(n)}finally{this.isHandlingScroll=!1}}}donePicking(){const{currentSelection:e}=this.plugin.getPluginState();this.plugin.uppy.log("Adding remote search provider files"),this.plugin.uppy.addFiles(e.map(t=>this.getTagFile(t))),this.resetPluginState()}render(e,t){var n=this;t===void 0&&(t={});const{didFirstRender:a,isInputMode:s,searchTerm:o}=this.plugin.getPluginState(),{i18n:r}=this.plugin.uppy;a||this.preFirstRender();const l={...this.opts,...t},{files:c,folders:p,filterInput:u,loading:h,currentSelection:g}=this.plugin.getPluginState(),{isChecked:m,filterItems:v,recordShiftKeyPress:f}=this,y=u!=="",F={isChecked:m,toggleCheckbox:this.toggleCheckbox.bind(this),recordShiftKeyPress:f,currentSelection:g,files:y?v(c):c,folders:y?v(p):p,handleScroll:this.handleScroll,done:this.donePicking,cancel:this.cancelPicking,showSearchFilter:l.showFilter,search:this.search,clearSearch:this.clearSearch,searchTerm:o,searchOnInput:!1,searchInputLabel:r("search"),clearSearchLabel:r("resetSearch"),noResultsLabel:r("noSearchResults"),title:this.plugin.title,viewType:l.viewType,showTitles:l.showTitles,showFilter:l.showFilter,isLoading:h,showBreadcrumbs:l.showBreadcrumbs,pluginIcon:this.plugin.icon,i18n:r,uppyFiles:this.plugin.uppy.getFiles(),validateRestrictions:function(){return n.plugin.uppy.validateRestrictions(...arguments)}};return s?d(za,{onUnmount:this.resetPluginState},d("div",{className:"uppy-SearchProvider"},d(Lu,{search:this.search,inputLabel:r("enterTextToSearch"),buttonLabel:r("searchImages"),inputClassName:"uppy-c-textInput uppy-SearchProvider-input",buttonCSSClassName:"uppy-SearchProvider-searchButton",showButton:!0}))):d(za,{onUnmount:this.resetPluginState},d(Bu,F))}};function gg(i,e){this.nextPageQuery=i.nextPageQuery,i.items.forEach(t=>{e.push(t)}),this.plugin.setPluginState({currentSelection:[],isInputMode:!1,files:e,searchTerm:i.searchedFor})}zu.VERSION=mg.version;const vg={version:"3.3.0"};class $u extends ye{constructor(e,t){if(super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||wf,this.id=this.opts.id||"Unsplash",this.title=this.opts.title||"Unsplash",this.icon=()=>d("svg",{className:"uppy-DashboardTab-iconUnsplash",viewBox:"0 0 32 32",height:"32",width:"32","aria-hidden":"true"},d("g",{fill:"currentcolor"},d("path",{d:"M46.575 10.883v-9h12v9zm12 5h10v18h-32v-18h10v9h12z"}),d("path",{d:"M13 12.5V8h6v4.5zm6 2.5h5v9H8v-9h5v4.5h6z"}))),!this.opts.companionUrl)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");this.hostname=this.opts.companionUrl,this.opts.companionAllowedHosts=vf(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new gf(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule,provider:"unsplash",pluginId:this.id})}install(){this.view=new zu(this,{provider:this.provider,viewType:"unsplash",showFilter:!0});const{target:e}=this.opts;e&&this.mount(e,this)}async onFirstRender(){}render(e){return this.view.render(e)}uninstall(){this.unmount()}}$u.VERSION=vg.version;function ul(i,e,t,n){return t===0||i===e?i:n===0?e:i+(e-i)*2**(-n/t)}const at={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};function Ss(i){const e=[];let t="indeterminate",n;for(const{progress:s}of Object.values(i)){const{preprocess:o,postprocess:r}=s;n==null&&(o||r)&&({mode:t,message:n}=o||r),(o==null?void 0:o.mode)==="determinate"&&e.push(o.value),(r==null?void 0:r.mode)==="determinate"&&e.push(r.value)}const a=e.reduce((s,o)=>s+o/e.length,0);return{mode:t,message:n,value:a}}function bg(i){const e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,n=Math.floor(i%60);return{hours:e,minutes:t,seconds:n}}function yg(i){const e=bg(i),t=e.hours===0?"":`${e.hours}h`,n=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,a=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${n}${a}`}const xg="·",pl=()=>` ${xg} `;function wg(i){const{newFiles:e,isUploadStarted:t,recoveredState:n,i18n:a,uploadState:s,isSomeGhost:o,startUpload:r}=i,l=fe("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":s===at.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),c=e&&t&&!n?a("uploadXNewFiles",{smart_count:e}):a("uploadXFiles",{smart_count:e});return d("button",{type:"button",className:l,"aria-label":a("uploadXFiles",{smart_count:e}),onClick:r,disabled:o,"data-uppy-super-focusable":!0},c)}function Pg(i){const{i18n:e,uppy:t}=i;return d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry"},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10"},d("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})),e("retry"))}function Sg(i){const{i18n:e,uppy:t}=i;return d("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16"},d("g",{fill:"none",fillRule:"evenodd"},d("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),d("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"}))))}function Fg(i){const{isAllPaused:e,i18n:t,isAllComplete:n,resumableUploads:a,uppy:s}=i,o=t(e?"resume":"pause");function r(){if(!n){if(!a){s.cancelAll();return}if(e){s.resumeAll();return}s.pauseAll()}}return d("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:r,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16"},d("g",{fill:"none",fillRule:"evenodd"},d("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),d("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"}))))}function _g(i){const{i18n:e,doneButtonHandler:t}=i;return d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0},e("done"))}function qu(){return d("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14"},d("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"}))}function Cg(i){const{progress:e}=i,{value:t,mode:n,message:a}=e;return d("div",{className:"uppy-StatusBar-content"},d(qu,null),n==="determinate"?`${Math.round(t*100)}% · `:"",a)}function Eg(i){const{numUploads:e,complete:t,totalUploadedSize:n,totalSize:a,totalETA:s,i18n:o}=i,r=e>1;return d("div",{className:"uppy-StatusBar-statusSecondary"},r&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),d("span",{className:"uppy-StatusBar-additionalInfo"},r&&pl(),o("dataUploadedOfTotal",{complete:vi(n),total:vi(a)}),pl(),o("xTimeLeft",{time:yg(s)})))}function Hu(i){const{i18n:e,complete:t,numUploads:n}=i;return d("div",{className:"uppy-StatusBar-statusSecondary"},e("filesUploadedOfTotal",{complete:t,smart_count:n}))}function kg(i){const{i18n:e,newFiles:t,startUpload:n}=i,a=fe("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return d("div",{className:"uppy-StatusBar-statusSecondary"},d("div",{className:"uppy-StatusBar-statusSecondaryHint"},e("xMoreFilesAdded",{smart_count:t})),d("button",{type:"button",className:a,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:n},e("upload")))}function Tg(i){const{i18n:e,supportsUploadProgress:t,totalProgress:n,showProgressDetails:a,isUploadStarted:s,isAllComplete:o,isAllPaused:r,newFiles:l,numUploads:c,complete:p,totalUploadedSize:u,totalSize:h,totalETA:g,startUpload:m}=i,v=l&&s;if(!s||o)return null;const f=e(r?"paused":"uploading");function y(){return!r&&!v&&a?t?d(Eg,{numUploads:c,complete:p,totalUploadedSize:u,totalSize:h,totalETA:g,i18n:e}):d(Hu,{i18n:e,complete:p,numUploads:c}):null}return d("div",{className:"uppy-StatusBar-content","aria-label":f,title:f},r?null:d(qu,null),d("div",{className:"uppy-StatusBar-status"},d("div",{className:"uppy-StatusBar-statusPrimary"},t?`${f}: ${n}%`:f),y(),v?d(kg,{i18n:e,newFiles:l,startUpload:m}):null))}function Og(i){const{i18n:e}=i;return d("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete")},d("div",{className:"uppy-StatusBar-status"},d("div",{className:"uppy-StatusBar-statusPrimary"},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11"},d("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})),e("complete"))))}function Ag(i){const{error:e,i18n:t,complete:n,numUploads:a}=i;function s(){const o=`${t("uploadFailed")}
|
|
21
|
+
Uppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${a} v${e.VERSION}`),n.type in I(this,xe)[xe]?I(this,xe)[xe][n.type].push(n):I(this,xe)[xe][n.type]=[n],n.install(),this.emit("plugin-added",n),this}getPlugin(e){for(const t of Object.values(I(this,xe)[xe])){const n=t.find(a=>a.id===e);if(n!=null)return n}}[gu](e){return I(this,xe)[xe][e]}iteratePlugins(e){Object.values(I(this,xe)[xe]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=I(this,xe)[xe][e.type],n=t.findIndex(o=>o.id===e.id);n!==-1&&t.splice(n,1);const s={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(s)}close(e){let{reason:t}=e===void 0?{}:e;this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll({reason:t}),I(this,Ii)[Ii](),this.iteratePlugins(n=>{this.removePlugin(n)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",I(this,Ze)[Ze]),window.removeEventListener("offline",I(this,Ze)[Ze]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,n){t===void 0&&(t="info"),n===void 0&&(n=3e3);const a=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:a?e.message:e,details:a?e.details:null}]}),setTimeout(()=>this.hideInfo(),n),this.emit("info-visible")}log(e,t){const{logger:n}=this.opts;switch(t){case"error":n.error(e);break;case"warning":n.warn(e);break;default:n.debug(e);break}}registerRequestClient(e,t){I(this,Bi)[Bi].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const t=I(this,Bi)[Bi].get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?I(this,gt)[gt](e):(I(this,ai)[ai](e),Promise.reject(new Error("Nonexistent upload")))}[vu](){return I(this,ft)[ft](...arguments)}addResultData(e,t){if(!I(this,fs)[fs](e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}const{currentUploads:n}=this.getState(),a={...n[e],result:{...n[e].result,...t}};this.setState({currentUploads:{...n,[e]:a}})}upload(){var e;(e=I(this,xe)[xe].uploader)!=null&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const n=this.opts.onBeforeUpload(t);return n===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(n&&typeof n=="object"&&(t=n,this.setState({files:t})),Promise.resolve().then(()=>I(this,Be)[Be].validateMinNumberOfFiles(t)).catch(a=>{throw I(this,Me)[Me]([a]),a}).then(()=>{if(!I(this,hs)[hs](t))throw new Qe(this.i18n("missingRequiredMetaField"))}).catch(a=>{throw a}).then(()=>{const{currentUploads:a}=this.getState(),s=Object.values(a).flatMap(l=>l.fileIDs),o=[];Object.keys(t).forEach(l=>{const c=this.getFile(l);!c.progress.uploadStarted&&s.indexOf(l)===-1&&o.push(c.id)});const r=I(this,ft)[ft](o);return I(this,gt)[gt](r)}).catch(a=>{throw this.emit("error",a),this.log(a,"error"),a}))}};function rm(i){for(const s of i)s.isRestriction?this.emit("restriction-failed",s.file,s):this.emit("error",s,s.file),this.log(s,"warning");const e=i.filter(s=>s.isUserFacing),t=4,n=e.slice(0,t),a=e.slice(t);n.forEach(s=>{let{message:o,details:r=""}=s;this.info({message:o,details:r},"error",this.opts.infoTimeout)}),a.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:a.length})})}function lm(i){const{missingFields:e,error:t}=I(this,Be)[Be].getMissingRequiredMetaFields(i);return e.length>0?(this.setFileState(i.id,{missingRequiredMetaFields:e}),this.log(t.message),this.emit("restriction-failed",i,t),!1):!0}function cm(i){let e=!0;for(const t of Object.values(i))I(this,kn)[kn](t)||(e=!1);return e}function um(i){const{allowNewUpload:e}=this.getState();if(e===!1){const t=new Qe(this.i18n("noMoreFilesAllowed"),{file:i});throw I(this,Me)[Me]([t]),t}}function pm(i){const e=i instanceof File?{name:i.name,type:i.type,size:i.size,data:i}:i,t=Ja(e),n=Gh(t,e),a=Jo(n).extension,s=Zo(e),o=e.meta||{};o.name=n,o.type=t;const r=Number.isFinite(e.data.size)?e.data.size:null;return{source:e.source||"",id:s,name:n,extension:a||"",meta:{...this.getState().meta,...o},type:t,data:e.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:r,uploadComplete:!1,uploadStarted:null},size:r,isGhost:!1,isRemote:e.isRemote||!1,remote:e.remote||"",preview:e.preview}}function dm(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(i=>{i.isRestriction||this.log(i.stack||i.message||i)})},4))}function hm(i){const{files:e}=this.getState(),t={...e},n=[],a=[];for(const o of i)try{var s;let r=I(this,ao)[ao](o);const l=(s=e[r.id])==null?void 0:s.isGhost;l&&(r={...e[r.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${r.name}, ${r.id}`));const c=this.opts.onBeforeFileAdded(r,t);if(!c&&this.checkIfFileAlreadyExists(r.id))throw new Qe(this.i18n("noDuplicates",{fileName:r.name}),{file:o});if(c===!1&&!l)throw new Qe("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});typeof c=="object"&&c!==null&&(r=c),I(this,Be)[Be].validateSingleFile(r),t[r.id]=r,n.push(r)}catch(r){a.push(r)}try{I(this,Be)[Be].validateAggregateRestrictions(Object.values(e),n)}catch(o){return a.push(o),{nextFilesState:e,validFilesToAdd:[],errors:a}}return{nextFilesState:t,validFilesToAdd:n,errors:a}}function mm(){const i=(n,a,s)=>{let o=n.message||"Unknown error";n.details&&(o+=` ${n.details}`),this.setState({error:o}),a!=null&&a.id in this.getState().files&&this.setFileState(a.id,{error:o,response:s})};this.on("error",i),this.on("upload-error",(n,a,s)=>{if(i(a,n,s),typeof a=="object"&&a.message){var o;this.log(a.message,"error");const r=new Error(this.i18n("failedToUpload",{file:(o=n==null?void 0:n.name)!=null?o:""}));r.isUserFacing=!0,r.details=a.message,a.details&&(r.details+=` ${a.details}`),I(this,Me)[Me]([r])}else I(this,Me)[Me]([a])});let e=null;this.on("upload-stalled",(n,a)=>{const{message:s}=n,o=a.map(r=>r.meta.name).join(", ");e||(this.info({message:s,details:o},"warning",this.opts.infoTimeout),e=setTimeout(()=>{e=null},this.opts.infoTimeout)),this.log(`${s} ${o}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const t=n=>{const a=n.filter(o=>{const r=o!=null&&this.getFile(o.id);return r||this.log(`Not setting progress for a file that has been removed: ${o==null?void 0:o.id}`),r}),s=Object.fromEntries(a.map(o=>[o.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:o.size}}]));this.patchFilesState(s)};this.on("upload-start",n=>{n.forEach(a=>{this.emit("upload-started",a)}),t(n)}),this.on("upload-progress",this.calculateProgress),this.on("upload-success",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const s=this.getFile(n.id).progress;this.setFileState(n.id,{progress:{...s,postprocess:I(this,kt)[kt].size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:s.bytesTotal},response:a,uploadURL:a.uploadURL,isPaused:!1}),n.size==null&&this.setFileState(n.id,{size:a.bytesUploaded||s.bytesTotal}),this.calculateTotalProgress()}),this.on("preprocess-progress",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}this.setFileState(n.id,{progress:{...this.getFile(n.id).progress,preprocess:a}})}),this.on("preprocess-complete",n=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const a={...this.getState().files};a[n.id]={...a[n.id],progress:{...a[n.id].progress}},delete a[n.id].progress.preprocess,this.setState({files:a})}),this.on("postprocess-progress",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}this.setFileState(n.id,{progress:{...this.getState().files[n.id].progress,postprocess:a}})}),this.on("postprocess-complete",n=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const a={...this.getState().files};a[n.id]={...a[n.id],progress:{...a[n.id].progress}},delete a[n.id].progress.postprocess,this.setState({files:a})}),this.on("restored",()=>{this.calculateTotalProgress()}),this.on("dashboard:file-edit-complete",n=>{n&&I(this,kn)[kn](n)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",I(this,Ze)[Ze]),window.addEventListener("offline",I(this,Ze)[Ze]),setTimeout(I(this,Ze)[Ze],3e3))}function fm(i,e){e===void 0&&(e={});const{forceAllowNewUpload:t=!1}=e,{allowNewUpload:n,currentUploads:a}=this.getState();if(!n&&!t)throw new Error("Cannot create a new upload: already uploading.");const s=Ci();return this.emit("upload",{id:s,fileIDs:i}),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...a,[s]:{fileIDs:i,step:0,result:{}}}}),s}function gm(i){const{currentUploads:e}=this.getState();return e[i]}function vm(i){const e={...this.getState().currentUploads};delete e[i],this.setState({currentUploads:e})}async function bm(i){const e=()=>{const{currentUploads:s}=this.getState();return s[i]};let t=e();const n=[...I(this,ti)[ti],...I(this,ii)[ii],...I(this,kt)[kt]];try{for(let s=t.step||0;s<n.length&&t;s++){const o=n[s];this.setState({currentUploads:{...this.getState().currentUploads,[i]:{...t,step:s}}});const{fileIDs:r}=t;await o(r,i),t=e()}}catch(s){throw I(this,ai)[ai](i),s}if(t){t.fileIDs.forEach(l=>{const c=this.getFile(l);c&&c.progress.postprocess&&this.emit("postprocess-complete",c)});const s=t.fileIDs.map(l=>this.getFile(l)),o=s.filter(l=>!l.error),r=s.filter(l=>l.error);this.addResultData(i,{successful:o,failed:r,uploadID:i}),t=e()}let a;return t&&(a=t.result,this.emit("complete",a),I(this,ai)[ai](i)),a==null&&this.log(`Not setting result for an upload that has been removed: ${i}`),a}bu.VERSION=om.version;const xu=bu;function wu(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function ym(i,e){return e===void 0&&(e=document),typeof i=="string"?e.querySelector(i):wu(i)?i:null}function Pu(i){for(var e;i&&!i.dir;)i=i.parentNode;return(e=i)==null?void 0:e.dir}class er{constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){const{plugins:e}=this.uppy.getState();return(e==null?void 0:e[this.id])||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new du([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}function $r(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var xm=0;function wm(i){return"__private_"+xm+++"_"+i}function Pm(i){let e=null,t;return function(){for(var n=arguments.length,a=new Array(n),s=0;s<n;s++)a[s]=arguments[s];return t=a,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e}}var Mi=wm("updateUI");class ye extends er{constructor(){super(...arguments),Object.defineProperty(this,Mi,{writable:!0,value:void 0})}getTargetPlugin(e){let t;if(typeof(e==null?void 0:e.addTarget)=="function")t=e,t instanceof ye||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:ye}}));else if(typeof e=="function"){const n=e;this.uppy.iteratePlugins(a=>{a instanceof n&&(t=a)})}return t}mount(e,t){const n=t.id,a=ym(e);if(a){this.isTargetDOMEl=!0;const r=document.createElement("div");return r.classList.add("uppy-Root"),$r(this,Mi)[Mi]=Pm(l=>{this.uppy.getPlugin(this.id)&&(Br(this.render(l),r),this.afterUpdate())}),this.uppy.log(`Installing ${n} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(a.innerHTML=""),Br(this.render(this.uppy.getState()),r),this.el=r,a.appendChild(r),r.dir=this.opts.direction||Pu(r)||"ltr",this.onMount(),this.el}const s=this.getTargetPlugin(e);if(s)return this.uppy.log(`Installing ${n} to ${s.id}`),this.parent=s,this.el=s.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${n}`);let o=`Invalid target option given to ${n}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){if(this.el!=null){var t,n;(t=(n=$r(this,Mi))[Mi])==null||t.call(n,e)}}unmount(){if(this.isTargetDOMEl){var e;(e=this.el)==null||e.remove()}this.onUnmount()}onMount(){}onUnmount(){}}const Sm={__proto__:null,"audio/mp3":"mp3","audio/mp4":"mp4","audio/ogg":"ogg","audio/webm":"webm","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/png":"png","image/svg+xml":"svg","video/mp4":"mp4","video/ogg":"ogv","video/quicktime":"mov","video/webm":"webm","video/x-matroska":"mkv","video/x-msvideo":"avi"};function gs(i){return[i]=i.split(";",1),Sm[i]||null}var Za={exports:{}};Za.exports=tr;Za.exports.isMobile=tr;Za.exports.default=tr;const Fm=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,_m=/CrOS/,Cm=/android|ipad|playbook|silk/i;function tr(i){i||(i={});let e=i.ua;if(!e&&typeof navigator<"u"&&(e=navigator.userAgent),e&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string")return!1;let t=Fm.test(e)&&!_m.test(e)||!!i.tablet&&Cm.test(e);return!t&&i.tablet&&i.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.indexOf("Macintosh")!==-1&&e.indexOf("Safari")!==-1&&(t=!0),t}var Em=Za.exports;const km=tt(Em);function Tm(i,e,t){return new Promise(n=>{i.toBlob(n,e,t)})}function Om(){return typeof MediaRecorder=="function"&&!!MediaRecorder.prototype&&typeof MediaRecorder.prototype.start=="function"}function Su(){return d("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55"},d("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z",fillRule:"evenodd"}))}function Am(i){let{onSnapshot:e,i18n:t}=i;return d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:t("takePicture"),"aria-label":t("takePicture"),onClick:e,"data-uppy-super-focusable":!0},Su())}function Dm(i){let{recording:e,onStartRecording:t,onStopRecording:n,i18n:a}=i;return e?d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:a("stopRecording"),"aria-label":a("stopRecording"),onClick:n,"data-uppy-super-focusable":!0},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},d("rect",{x:"15",y:"15",width:"70",height:"70"}))):d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:a("startRecording"),"aria-label":a("startRecording"),onClick:t,"data-uppy-super-focusable":!0},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},d("circle",{cx:"50",cy:"50",r:"40"})))}function Rm(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}function Im(i){let{recordingLengthSeconds:e,i18n:t}=i;const n=Rm(e);return d("span",{"aria-label":t("recordingLength",{recording_length:n})},n)}function Um(i){let{currentDeviceId:e,videoSources:t,onChangeVideoSource:n}=i;return d("div",{className:"uppy-Webcam-videoSource"},d("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:a=>{n(a.target.value)}},t.map(a=>d("option",{key:a.deviceId,value:a.deviceId,selected:a.deviceId===e},a.label))))}function Nm(i){let{onSubmit:e,i18n:t}=i;return d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:t("submitRecordedFile"),"aria-label":t("submitRecordedFile"),onClick:e,"data-uppy-super-focusable":!0},d("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},d("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})))}function Lm(i){let{onDiscard:e,i18n:t}=i;return d("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard",type:"button",title:t("discardRecordedFile"),"aria-label":t("discardRecordedFile"),onClick:e,"data-uppy-super-focusable":!0},d("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},d("g",{fill:"#FFF",fillRule:"evenodd"},d("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),d("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"}))))}function so(){return so=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},so.apply(this,arguments)}function na(i,e){return i.includes(e)}class Bm extends dt{componentDidMount(){const{onFocus:e}=this.props;e()}componentWillUnmount(){const{onStop:e}=this.props;e()}render(){const{src:e,recordedVideo:t,recording:n,modes:a,supportsRecording:s,videoSources:o,showVideoSourceDropdown:r,showRecordingLength:l,onSubmit:c,i18n:p,mirror:u,onSnapshot:h,onStartRecording:g,onStopRecording:m,onDiscardRecordedVideo:v,recordingLengthSeconds:f}=this.props,y=!!t,F=!y&&s&&(na(a,"video-only")||na(a,"audio-only")||na(a,"video-audio")),S=!y&&na(a,"picture"),A=s&&l&&!y,D=r&&o&&o.length>1,x={playsInline:!0};return t?(x.muted=!1,x.controls=!0,x.src=t,this.videoElement&&(this.videoElement.srcObject=null)):(x.muted=!0,x.autoPlay=!0,x.srcObject=e),d("div",{className:"uppy uppy-Webcam-container"},d("div",{className:"uppy-Webcam-videoContainer"},d("video",so({ref:_=>this.videoElement=_,className:`uppy-Webcam-video ${u?"uppy-Webcam-video--mirrored":""}`},x))),d("div",{className:"uppy-Webcam-footer"},d("div",{className:"uppy-Webcam-videoSourceContainer"},D?Um(this.props):null),d("div",{className:"uppy-Webcam-buttonContainer"},S&&d(Am,{onSnapshot:h,i18n:p}),F&&d(Dm,{recording:n,onStartRecording:g,onStopRecording:m,i18n:p}),y&&d(Nm,{onSubmit:c,i18n:p}),y&&d(Lm,{onDiscard:v,i18n:p})),d("div",{className:"uppy-Webcam-recordingLength"},A&&d(Im,{recordingLengthSeconds:f,i18n:p}))))}}function Mm(i){let{icon:e,i18n:t,hasCamera:n}=i;return d("div",{className:"uppy-Webcam-permissons"},d("div",{className:"uppy-Webcam-permissonsIcon"},e()),d("h1",{className:"uppy-Webcam-title"},t(n?"allowAccessTitle":"noCameraTitle")),d("p",null,t(n?"allowAccessDescription":"noCameraDescription")))}const jm={strings:{pluginNameCamera:"Camera",noCameraTitle:"Camera Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file",smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",recordingLength:"Recording length %{recording_length}",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site."}};function oo(){return oo=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},oo.apply(this,arguments)}function ji(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var zm=0;function $m(i){return"__private_"+zm+++"_"+i}const qm={version:"3.4.0"};function qr(i){return i[0]==="."?no[i.slice(1)]:i}function Hm(i){return/^video\/[^*]+$/.test(i)}function Vm(i){return/^image\/[^*]+$/.test(i)}function Wm(){return navigator.mediaDevices}function vs(i,e){return i.includes(e)}const Gm={onBeforeSnapshot:()=>Promise.resolve(),countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,facingMode:"user",preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1,mobileNativeCamera:km({tablet:!0})};var Ve=$m("enableMirror");class Fu extends ye{constructor(e,t){super(e,{...Gm,...t}),Object.defineProperty(this,Ve,{writable:!0,value:void 0}),this.mediaDevices=Wm(),this.supportsUserMedia=!!this.mediaDevices,this.protocol=location.protocol.match(/https/i)?"https":"http",this.id=this.opts.id||"Webcam",this.type="acquirer",this.capturedMediaFile=null,this.icon=()=>d("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383",fillRule:"nonzero"})),this.defaultLocale=jm,this.i18nInit(),this.title=this.i18n("pluginNameCamera"),ji(this,Ve)[Ve]=this.opts.mirror,this.install=this.install.bind(this),this.setPluginState=this.setPluginState.bind(this),this.render=this.render.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.takeSnapshot=this.takeSnapshot.bind(this),this.startRecording=this.startRecording.bind(this),this.stopRecording=this.stopRecording.bind(this),this.discardRecordedVideo=this.discardRecordedVideo.bind(this),this.submit=this.submit.bind(this),this.oneTwoThreeSmile=this.oneTwoThreeSmile.bind(this),this.focus=this.focus.bind(this),this.changeVideoSource=this.changeVideoSource.bind(this),this.webcamActive=!1,this.opts.countdown&&(this.opts.onBeforeSnapshot=this.oneTwoThreeSmile),this.setPluginState({hasCamera:!1,cameraReady:!1,cameraError:null,recordingLengthSeconds:0,videoSources:[],currentDeviceId:null})}setOptions(e){super.setOptions({...e,videoConstraints:{...this.opts.videoConstraints,...e==null?void 0:e.videoConstraints}})}hasCameraCheck(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then(e=>e.some(t=>t.kind==="videoinput")):Promise.resolve(!1)}isAudioOnly(){return this.opts.modes.length===1&&this.opts.modes[0]==="audio-only"}getConstraints(e){e===void 0&&(e=null);const t=this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("audio-only")!==-1,n=!this.isAudioOnly()&&(this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("video-only")!==-1||this.opts.modes.indexOf("picture")!==-1),a={...this.opts.videoConstraints||{facingMode:this.opts.facingMode},...e?{deviceId:e,facingMode:null}:{}};return{audio:t,video:n?a:!1}}start(e){var t;if(e===void 0&&(e=null),!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&(ji(this,Ve)[Ve]=!0);const n=this.getConstraints((t=e)==null?void 0:t.deviceId);this.hasCameraCheck().then(a=>(this.setPluginState({hasCamera:a}),this.mediaDevices.getUserMedia(n).then(s=>{this.stream=s;let o=null;const r=this.isAudioOnly()?s.getAudioTracks():s.getVideoTracks();!e||!e.deviceId?o=r[0].getSettings().deviceId:r.forEach(l=>{l.getSettings().deviceId===e.deviceId&&(o=l.getSettings().deviceId)}),this.updateVideoSources(),this.setPluginState({currentDeviceId:o,cameraReady:!0})}).catch(s=>{this.setPluginState({cameraReady:!1,cameraError:s}),this.uppy.info(s.message,"error")})))}getMediaRecorderOptions(){const e={};if(MediaRecorder.isTypeSupported){const{restrictions:t}=this.uppy.opts;let n=[];this.opts.preferredVideoMimeType?n=[this.opts.preferredVideoMimeType]:t.allowedFileTypes&&(n=t.allowedFileTypes.map(qr).filter(Hm));const a=o=>MediaRecorder.isTypeSupported(o)&&gs(o),s=n.filter(a);s.length>0&&(e.mimeType=s[0])}return e}startRecording(){this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];let e=!1;this.recorder.addEventListener("dataavailable",t=>{this.recordingChunks.push(t.data);const{restrictions:n}=this.uppy.opts;if(this.recordingChunks.length>1&&n.maxFileSize!=null&&!e){const a=this.recordingChunks.reduce((l,c)=>l+c.size,0),o=(a-this.recordingChunks[0].size)/(this.recordingChunks.length-1)*3,r=Math.max(0,n.maxFileSize-o);a>r&&(e=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.stopRecording())}}),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval(()=>{const t=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:t+1})},1e3)),this.setPluginState({isRecording:!0})}stopRecording(){return new Promise(t=>{this.recorder.addEventListener("stop",()=>{t()}),this.recorder.stop(),this.opts.showRecordingLength&&(clearInterval(this.recordingLengthTimer),this.setPluginState({recordingLengthSeconds:0}))}).then(()=>(this.setPluginState({isRecording:!1}),this.getVideo())).then(t=>{try{this.capturedMediaFile=t,this.setPluginState({recordedVideo:URL.createObjectURL(t.data)}),ji(this,Ve)[Ve]=!1}catch(n){n.isRestriction||this.uppy.log(n)}}).then(()=>{this.recordingChunks=null,this.recorder=null},t=>{throw this.recordingChunks=null,this.recorder=null,t})}discardRecordedVideo(){this.setPluginState({recordedVideo:null}),this.opts.mirror&&(ji(this,Ve)[Ve]=!0),this.capturedMediaFile=null}submit(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"error")}}async stop(){if(this.stream){const e=this.stream.getAudioTracks(),t=this.stream.getVideoTracks();e.concat(t).forEach(n=>n.stop())}this.recorder&&await new Promise(e=>{this.recorder.addEventListener("stop",e,{once:!0}),this.recorder.stop(),this.opts.showRecordingLength&&clearInterval(this.recordingLengthTimer)}),this.recordingChunks=null,this.recorder=null,this.webcamActive=!1,this.stream=null,this.setPluginState({recordedVideo:null,isRecording:!1,recordingLengthSeconds:0})}getVideoElement(){return this.el.querySelector(".uppy-Webcam-video")}oneTwoThreeSmile(){return new Promise((e,t)=>{let n=this.opts.countdown;const a=setInterval(()=>{if(!this.webcamActive)return clearInterval(a),this.captureInProgress=!1,t(new Error("Webcam is not active"));n?(this.uppy.info(`${n}...`,"warning",800),n--):(clearInterval(a),this.uppy.info(this.i18n("smile"),"success",1500),setTimeout(()=>e(),1500))},1e3)})}takeSnapshot(){this.captureInProgress||(this.captureInProgress=!0,this.opts.onBeforeSnapshot().catch(e=>{const t=typeof e=="object"?e.message:e;return this.uppy.info(t,"error",5e3),Promise.reject(new Error(`onBeforeSnapshot: ${t}`))}).then(()=>this.getImage()).then(e=>{this.captureInProgress=!1;try{this.uppy.addFile(e)}catch(t){t.isRestriction||this.uppy.log(t)}},e=>{throw this.captureInProgress=!1,e}))}getImage(){const e=this.getVideoElement();if(!e)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));const t=e.videoWidth,n=e.videoHeight,a=document.createElement("canvas");a.width=t,a.height=n,a.getContext("2d").drawImage(e,0,0);const{restrictions:o}=this.uppy.opts;let r=[];this.opts.preferredImageMimeType?r=[this.opts.preferredImageMimeType]:o.allowedFileTypes&&(r=o.allowedFileTypes.map(qr).filter(Vm));const l=r[0]||"image/jpeg",c=gs(l)||"jpg",p=`cam-${Date.now()}.${c}`;return Tm(a,l).then(u=>({source:this.id,name:p,data:new Blob([u],{type:l}),type:l}))}getVideo(){const e=this.recordingChunks.find(o=>{var r;return((r=o.type)==null?void 0:r.length)>0}).type,t=gs(e);if(!t)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${e}"`));const n=`webcam-${Date.now()}.${t}`,a=new Blob(this.recordingChunks,{type:e}),s={source:this.id,name:n,data:new Blob([a],{type:e}),type:e};return Promise.resolve(s)}focus(){this.opts.countdown&&setTimeout(()=>{this.uppy.info(this.i18n("smile"),"success",1500)},1e3)}changeVideoSource(e){this.stop(),this.start({deviceId:e})}updateVideoSources(){this.mediaDevices.enumerateDevices().then(e=>{this.setPluginState({videoSources:e.filter(t=>t.kind==="videoinput")})})}render(){this.webcamActive||this.start();const e=this.getPluginState();return!e.cameraReady||!e.hasCamera?d(Mm,{icon:Su,i18n:this.i18n,hasCamera:e.hasCamera}):d(Bm,oo({},e,{onChangeVideoSource:this.changeVideoSource,onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onDiscardRecordedVideo:this.discardRecordedVideo,onSubmit:this.submit,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,showRecordingLength:this.opts.showRecordingLength,showVideoSourceDropdown:this.opts.showVideoSourceDropdown,supportsRecording:Om(),recording:e.isRecording,mirror:ji(this,Ve)[Ve],src:this.stream}))}install(){const{mobileNativeCamera:e,modes:t,facingMode:n,videoConstraints:a}=this.opts,{target:s}=this.opts;if(e&&s){var o;(o=this.getTargetPlugin(s))==null||o.setOptions({showNativeVideoCameraButton:vs(t,"video-only")||vs(t,"video-audio"),showNativePhotoCameraButton:vs(t,"picture"),nativeCameraFacingMode:(a==null?void 0:a.facingMode)||n});return}this.setPluginState({cameraReady:!1,recordingLengthSeconds:0}),s&&this.mount(s,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=()=>{if(this.updateVideoSources(),this.stream){let r=!0;const{videoSources:l,currentDeviceId:c}=this.getPluginState();l.forEach(p=>{c===p.deviceId&&(r=!1)}),r&&(this.stop(),this.start())}})}uninstall(){this.stop(),this.unmount()}onUnmount(){this.stop()}}Fu.VERSION=qm.version;class Km extends Error{constructor(){super(...arguments),this.name="UserFacingApiError"}}const Xm=Object.prototype.toString,Qm=i=>Xm.call(i)==="[object Error]",Ym=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed"]);function Jm(i){return i&&Qm(i)&&i.name==="TypeError"&&typeof i.message=="string"?i.message==="Load failed"?i.stack===void 0:Ym.has(i.message):!1}let ro=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}};const Hr=(i,e,t)=>{const n=t.retries-(e-1);return i.attemptNumber=e,i.retriesLeft=n,i};async function _u(i,e){return new Promise((t,n)=>{e={onFailedAttempt(){},retries:10,...e};const a=mh.operation(e),s=()=>{var r;a.stop(),n((r=e.signal)==null?void 0:r.reason)};e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",s,{once:!0});const o=()=>{var r;(r=e.signal)==null||r.removeEventListener("abort",s),a.stop()};a.attempt(async r=>{try{const l=await i(r);o(),t(l)}catch(l){try{if(!(l instanceof Error))throw new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`);if(l instanceof ro)throw l.originalError;if(l instanceof TypeError&&!Jm(l))throw l;if(await e.onFailedAttempt(Hr(l,r,e)),!a.retry(l))throw a.mainError()}catch(c){Hr(c,r,e),o(),n(c)}}})})}class Cu extends Error{constructor(e,t){t===void 0&&(t=null),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}}function Zm(){return fetch(...arguments).catch(i=>{throw i.name==="AbortError"?i:new Cu(i)})}function xa(i,e){return Object.prototype.hasOwnProperty.call(i,e)}class ef extends Error{constructor(e,t){super(e),this.cause=t==null?void 0:t.cause,this.cause&&xa(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}function tf(i,e,t){const{progress:n,bytesUploaded:a,bytesTotal:s}=e;n&&(i.uppy.log(`Upload progress: ${n}`),i.uppy.emit("upload-progress",t,{uploader:i,bytesUploaded:a,bytesTotal:s}))}const nf=nu(tf,300,{leading:!0,trailing:!0});function af(i){var e;const n=(e=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(i))==null?void 0:e[1];return`${/^http:\/\//i.test(i)?"ws":"wss"}://${n}`}class sf extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}let Eu;function vt(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var of=0;function es(i){return"__private_"+of+++"_"+i}const rf={version:"3.8.0"};function lf(i){return i.replace(/\/$/,"")}const ku=10,cf=5*60*1e3,uf=401;class pf extends Error{constructor(e){let{statusCode:t,message:n}=e;super(n),this.name="HttpError",this.statusCode=t}}async function df(i){if(i.status===uf)throw new sf;if(i.ok)return i.json();let e=`Failed request with status: ${i.status}. ${i.statusText}`,t;try{t=await i.json(),t.message&&(e=`${e} message: ${t.message}`),t.requestId&&(e=`${e} request-Id: ${t.requestId}`)}catch(n){throw new Error(e,{cause:n})}throw i.status>=400&&i.status<=499&&t.message?new Km(t.message):new pf({statusCode:i.status,message:e})}var bt=es("companionHeaders"),zi=es("getUrl"),bs=es("requestSocketToken"),$i=es("awaitRemoteFileUpload");Eu=Symbol.for("uppy test: getCompanionHeaders");class ir{constructor(e,t){Object.defineProperty(this,$i,{value:mf}),Object.defineProperty(this,zi,{value:hf}),Object.defineProperty(this,bt,{writable:!0,value:void 0}),Object.defineProperty(this,bs,{writable:!0,value:async n=>{var a;let{file:s,postBody:o,signal:r}=n;if(((a=s.remote)==null?void 0:a.url)==null)throw new Error("Cannot connect to an undefined URL");return(await this.post(s.remote.url,{...s.remote.body,...o},{signal:r})).token}}),this.uppy=e,this.opts=t,this.onReceiveResponse=this.onReceiveResponse.bind(this),vt(this,bt)[bt]=t==null?void 0:t.companionHeaders}setCompanionHeaders(e){vt(this,bt)[bt]=e}[Eu](){return vt(this,bt)[bt]}get hostname(){const{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return lf(e&&e[t]?e[t]:t)}async headers(e){return e===void 0&&(e=!1),{...{Accept:"application/json",...e?void 0:{"Content-Type":"application/json"}},...vt(this,bt)[bt]}}onReceiveResponse(e){const{headers:t}=e,a=this.uppy.getState().companion||{},s=this.opts.companionUrl;t.has("i-am")&&t.get("i-am")!==a[s]&&this.uppy.setState({companion:{...a,[s]:t.get("i-am")}})}async request(e){let{path:t,method:n="GET",data:a,skipPostResponse:s,signal:o}=e;try{const r=await this.headers(!a),l=await Zm(vt(this,zi)[zi](t),{method:n,signal:o,headers:r,credentials:this.opts.companionCookiesRule||"same-origin",body:a?JSON.stringify(a):null});return s||this.onReceiveResponse(l),await df(l)}catch(r){throw r.isAuthError||r.name==="UserFacingApiError"||r.name==="AbortError"?r:new ef(`Could not ${n} ${vt(this,zi)[zi](t)}`,{cause:r})}}async get(e,t){return typeof t=="boolean"&&(t={skipPostResponse:t}),this.request({...t,path:e})}async post(e,t,n){return typeof n=="boolean"&&(n={skipPostResponse:n}),this.request({...n,path:e,method:"POST",data:t})}async delete(e,t,n){return typeof n=="boolean"&&(n={skipPostResponse:n}),this.request({...n,path:e,method:"DELETE",data:t})}async uploadRemoteFile(e,t,n){var a=this;try{const{signal:s,getQueue:o}=n||{};return await _u(async()=>{var r;const l=(r=this.uppy.getFile(e.id))==null?void 0:r.serverToken;if(l!=null)return this.uppy.log(`Connecting to exiting websocket ${l}`),vt(this,$i)[$i]({file:e,queue:o(),signal:s});const p=await o().wrapPromiseFunction(async function(){try{return await vt(a,bs)[bs](...arguments)}catch(u){if(u.isAuthError)throw new ro(u);if(u.cause==null)throw u;const h=u.cause,g=()=>[408,409,429,418,423].includes(h.statusCode)||h.statusCode>=500&&h.statusCode<=599&&![501,505].includes(h.statusCode);throw h.name==="HttpError"&&!g()?new ro(h):h}},{priority:-1})({file:e,postBody:t,signal:s}).abortOn(s);if(this.uppy.getFile(e.id))return this.uppy.setFileState(e.id,{serverToken:p}),vt(this,$i)[$i]({file:this.uppy.getFile(e.id),queue:o(),signal:s})},{retries:ku,signal:s,onFailedAttempt:r=>this.uppy.log(`Retrying upload due to: ${r.message}`,"warning")})}catch(s){if(s.name==="AbortError")return;throw this.uppy.emit("upload-error",e,s),s}}}function hf(i){return/^(https?:|)\/\//.test(i)?i:`${this.hostname}/${i}`}async function mf(i){let{file:e,queue:t,signal:n}=i,a;const{capabilities:s}=this.uppy.getState();try{return await new Promise((o,r)=>{const l=e.serverToken,c=af(e.remote.companionUrl);let p,u,h,{isPaused:g}=e;const m=(_,O)=>{if(p==null||p.readyState!==p.OPEN){var L;this.uppy.log(`Cannot send "${_}" to socket ${e.id} because the socket state was ${String((L=p)==null?void 0:L.readyState)}`,"warning");return}p.send(JSON.stringify({action:_,payload:O??{}}))};function v(){s.resumableUploads&&m(g?"pause":"resume")}const f=async()=>{u&&u.abort(),u=new AbortController;const _=L=>{var z;this.uppy.setFileState(e.id,{serverToken:null}),(z=u)==null||z.abort==null||z.abort(),r(L)};function O(){clearTimeout(h),!g&&(h=setTimeout(()=>_(new Error("Timeout waiting for message from Companion socket")),cf))}try{await t.wrapPromiseFunction(async()=>{await _u(async()=>new Promise((z,K)=>{p=new WebSocket(`${c}/api/${l}`),O(),p.addEventListener("close",()=>{p=void 0,K(new Error("Socket closed unexpectedly"))}),p.addEventListener("error",G=>{var j;this.uppy.log(`Companion socket error ${JSON.stringify(G)}, closing socket`,"warning"),(j=p)==null||j.close()}),p.addEventListener("open",()=>{v()}),p.addEventListener("message",G=>{O();try{const{action:w,payload:E}=JSON.parse(G.data);switch(w){case"progress":{nf(this,E,this.uppy.getFile(e.id));break}case"success":{var j,$,P,b;const T=(j=E.response)==null?void 0:j.responseText;this.uppy.emit("upload-success",this.uppy.getFile(e.id),{uploadURL:E.url,status:($=(P=E.response)==null?void 0:P.status)!=null?$:200,body:T?JSON.parse(T):void 0}),(b=u)==null||b.abort==null||b.abort(),o();break}case"error":{const{message:T}=E.error;throw Object.assign(new Error(T),{cause:E.error})}default:this.uppy.log(`Companion socket unknown action ${w}`,"warning")}}catch(w){_(w)}});const Z=()=>{this.uppy.log(`Closing socket ${e.id}`,"info"),clearTimeout(h),p&&p.close(),p=void 0};u.signal.addEventListener("abort",()=>{Z()})}),{retries:ku,signal:u.signal,onFailedAttempt:()=>{u.signal.aborted||this.uppy.log(`Retrying websocket ${e.id}`,"info")}})})().abortOn(u.signal)}catch(L){if(u.signal.aborted)return;_(L)}},y=_=>{if(s.resumableUploads)if(g=_,p&&v(),_){var O;(O=u)==null||O.abort==null||O.abort()}else f()},F=_=>{var O;s.individualCancellation&&_.id===e.id&&(m("cancel"),(O=u)==null||O.abort==null||O.abort(),this.uppy.log(`upload ${e.id} was removed`,"info"),o())},S=_=>{var O;let{reason:L}=_;L==="user"&&m("cancel"),(O=u)==null||O.abort==null||O.abort(),this.uppy.log(`upload ${e.id} was canceled`,"info"),o()},A=(_,O)=>{_===e.id&&y(O)},D=()=>y(!0),x=()=>y(!1);this.uppy.on("file-removed",F),this.uppy.on("cancel-all",S),this.uppy.on("upload-pause",A),this.uppy.on("pause-all",D),this.uppy.on("resume-all",x),a=()=>{this.uppy.off("file-removed",F),this.uppy.off("cancel-all",S),this.uppy.off("upload-pause",A),this.uppy.off("pause-all",D),this.uppy.off("resume-all",x)},n.addEventListener("abort",()=>{var _;(_=u)==null||_.abort()}),f()})}finally{a==null||a()}}ir.VERSION=rf.version;const ff=i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");class gf extends ir{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||ff(this.id),this.pluginId=this.opts.pluginId}fileUrl(e){return`${this.hostname}/search/${this.id}/get/${e}`}search(e,t){return this.get(`search/${this.id}/list?q=${encodeURIComponent(e)}${t?`&${t}`:""}`)}}function vf(i,e){if(i){if(typeof i!="string"&&!Array.isArray(i)&&!(i instanceof RegExp))throw new TypeError('The option "companionAllowedHosts" must be one of string, Array, RegExp');return i}return/^(?!https?:\/\/).*$/i.test(e)?`https://${e.replace(/^\/\//,"")}`:new URL(e).origin}function bf(i,e){return new Promise(t=>{localStorage.setItem(i,e),t()})}function yf(i){return Promise.resolve(localStorage.getItem(i))}function xf(i){return new Promise(e=>{localStorage.removeItem(i),e()})}const wf=Object.freeze(Object.defineProperty({__proto__:null,getItem:yf,removeItem:xf,setItem:bf},Symbol.toStringTag,{value:"Module"})),rt=Array.from;function Vr(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Pf=0;function Sf(i){return"__private_"+Pf+++"_"+i}var qi=Sf("handleSubmit");class Ff extends dt{constructor(e){super(e),this.form=document.createElement("form"),Object.defineProperty(this,qi,{writable:!0,value:t=>{t.preventDefault();const{addFile:n}=this.props,a=this.input.value.trim();n(a)}}),this.form.id=Ci()}componentDidMount(){this.input.value="",this.form.addEventListener("submit",Vr(this,qi)[qi]),document.body.appendChild(this.form)}componentWillUnmount(){this.form.removeEventListener("submit",Vr(this,qi)[qi]),document.body.removeChild(this.form)}render(){const{i18n:e}=this.props;return d("div",{className:"uppy-Url"},d("input",{className:"uppy-u-reset uppy-c-textInput uppy-Url-input",type:"text","aria-label":e("enterUrlToImport"),placeholder:e("enterUrlToImport"),ref:t=>{this.input=t},"data-uppy-super-focusable":!0,form:this.form.id}),d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton",type:"submit",form:this.form.id},e("import")))}}function Wr(i,e,t){const n=rt(i.items);let a;switch(e){case"paste":{if(n.some(o=>o.kind==="file"))return;a=n.filter(o=>o.kind==="string"&&o.type==="text/plain");break}case"drop":{a=n.filter(s=>s.kind==="string"&&s.type==="text/uri-list");break}default:throw new Error(`isDropOrPaste must be either 'drop' or 'paste', but it's ${e}`)}a.forEach(s=>{s.getAsString(o=>t(o))})}const _f={strings:{import:"Import",enterUrlToImport:"Enter URL to import a file",failedToFetch:"Companion failed to fetch this URL, please make sure it’s correct",enterCorrectUrl:"Incorrect URL: Please make sure you are entering a direct link to a file"}};var Tu;const Cf={version:"3.6.0"};function Ef(){return d("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{d:"M23.637 15.312l-2.474 2.464a3.582 3.582 0 01-.577.491c-.907.657-1.897.986-2.968.986a4.925 4.925 0 01-3.959-1.971c-.248-.329-.164-.902.165-1.149.33-.247.907-.164 1.155.164 1.072 1.478 3.133 1.724 4.618.656a.642.642 0 00.33-.328l2.473-2.463c1.238-1.313 1.238-3.366-.082-4.597a3.348 3.348 0 00-4.618 0l-1.402 1.395a.799.799 0 01-1.154 0 .79.79 0 010-1.15l1.402-1.394a4.843 4.843 0 016.843 0c2.062 1.805 2.144 5.007.248 6.896zm-8.081 5.664l-1.402 1.395a3.348 3.348 0 01-4.618 0c-1.319-1.23-1.319-3.365-.082-4.596l2.475-2.464.328-.328c.743-.492 1.567-.739 2.475-.657.906.165 1.648.574 2.143 1.314.248.329.825.411 1.155.165.33-.248.412-.822.165-1.15-.825-1.068-1.98-1.724-3.216-1.888-1.238-.247-2.556.082-3.628.902l-.495.493-2.474 2.464c-1.897 1.969-1.814 5.09.083 6.977.99.904 2.226 1.396 3.463 1.396s2.473-.492 3.463-1.395l1.402-1.396a.79.79 0 000-1.15c-.33-.328-.908-.41-1.237-.082z",fill:"#FF753E","fill-rule":"nonzero"}))}function kf(i){const e=/^[a-z0-9]+:\/\//,t="http://";return e.test(i)?i:t+i}function Tf(i){return rt(i.dataTransfer.items).filter(n=>n.kind==="string"&&n.type==="text/uri-list").length>0}function Of(i){return(i==null?void 0:i.startsWith("http://"))||(i==null?void 0:i.startsWith("https://"))}function Af(i){const{pathname:e}=new URL(i);return e.substring(e.lastIndexOf("/")+1)}let Vn=class lo extends ye{constructor(e,t){if(super(e,t),this.getMeta=n=>this.client.post("url/meta",{url:n}).then(a=>{if(a.error)throw this.uppy.log("[URL] Error:"),this.uppy.log(a.error),new Error("Failed to fetch the file");return a}),this.addFile=async(n,a)=>{const s=kf(n);if(!Of(s)){this.uppy.log(`[URL] Incorrect URL entered: ${s}`),this.uppy.info(this.i18n("enterCorrectUrl"),"error",4e3);return}try{const o=await this.getMeta(s),r={meta:a,source:this.id,name:o.name||Af(s),type:o.type,data:{size:o.size},isRemote:!0,body:{url:s},remote:{companionUrl:this.opts.companionUrl,url:`${this.hostname}/url/get`,body:{fileId:s,url:s},requestClientId:lo.requestClientId}};this.uppy.log("[Url] Adding remote file");try{return this.uppy.addFile(r)}catch(l){return l.isRestriction||this.uppy.log(l),l}}catch(o){return this.uppy.log(o),this.uppy.info({message:this.i18n("failedToFetch"),details:o},"error",4e3),o}},this.handleRootDrop=n=>{Wr(n.dataTransfer,"drop",a=>{this.uppy.log(`[URL] Adding file from dropped url: ${a}`),this.addFile(a)})},this.handleRootPaste=n=>{Wr(n.clipboardData,"paste",a=>{this.uppy.log(`[URL] Adding file from pasted url: ${a}`),this.addFile(a)})},this.id=this.opts.id||"Url",this.title=this.opts.title||"Link",this.type="acquirer",this.icon=()=>d(Ef,null),this.defaultLocale=_f,this.i18nInit(),this.hostname=this.opts.companionUrl,!this.hostname)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");this.client=new ir(e,{pluginId:this.id,provider:"url",companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule}),this.uppy.registerRequestClient(lo.requestClientId,this.client)}render(){return d(Ff,{i18n:this.i18n,addFile:this.addFile})}install(){const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}};Tu=Vn;Vn.VERSION=Cf.version;Vn.requestClientId=Tu.name;Vn.prototype.canHandleRootDrop=Tf;var Ou={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function a(l,c,p){this.fn=l,this.context=c,this.once=p||!1}function s(l,c,p,u,h){if(typeof p!="function")throw new TypeError("The listener must be a function");var g=new a(p,u||l,h),m=t?t+c:c;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],g]:l._events[m].push(g):(l._events[m]=g,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function r(){this._events=new n,this._eventsCount=0}r.prototype.eventNames=function(){var c=[],p,u;if(this._eventsCount===0)return c;for(u in p=this._events)e.call(p,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(p)):c},r.prototype.listeners=function(c){var p=t?t+c:c,u=this._events[p];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,g=u.length,m=new Array(g);h<g;h++)m[h]=u[h].fn;return m},r.prototype.listenerCount=function(c){var p=t?t+c:c,u=this._events[p];return u?u.fn?1:u.length:0},r.prototype.emit=function(c,p,u,h,g,m){var v=t?t+c:c;if(!this._events[v])return!1;var f=this._events[v],y=arguments.length,F,S;if(f.fn){switch(f.once&&this.removeListener(c,f.fn,void 0,!0),y){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,p),!0;case 3:return f.fn.call(f.context,p,u),!0;case 4:return f.fn.call(f.context,p,u,h),!0;case 5:return f.fn.call(f.context,p,u,h,g),!0;case 6:return f.fn.call(f.context,p,u,h,g,m),!0}for(S=1,F=new Array(y-1);S<y;S++)F[S-1]=arguments[S];f.fn.apply(f.context,F)}else{var A=f.length,D;for(S=0;S<A;S++)switch(f[S].once&&this.removeListener(c,f[S].fn,void 0,!0),y){case 1:f[S].fn.call(f[S].context);break;case 2:f[S].fn.call(f[S].context,p);break;case 3:f[S].fn.call(f[S].context,p,u);break;case 4:f[S].fn.call(f[S].context,p,u,h);break;default:if(!F)for(D=1,F=new Array(y-1);D<y;D++)F[D-1]=arguments[D];f[S].fn.apply(f[S].context,F)}}return!0},r.prototype.on=function(c,p,u){return s(this,c,p,u,!1)},r.prototype.once=function(c,p,u){return s(this,c,p,u,!0)},r.prototype.removeListener=function(c,p,u,h){var g=t?t+c:c;if(!this._events[g])return this;if(!p)return o(this,g),this;var m=this._events[g];if(m.fn)m.fn===p&&(!h||m.once)&&(!u||m.context===u)&&o(this,g);else{for(var v=0,f=[],y=m.length;v<y;v++)(m[v].fn!==p||h&&!m[v].once||u&&m[v].context!==u)&&f.push(m[v]);f.length?this._events[g]=f.length===1?f[0]:f:o(this,g)}return this},r.prototype.removeAllListeners=function(c){var p;return c?(p=t?t+c:c,this._events[p]&&o(this,p)):(this._events=new n,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prefixed=t,r.EventEmitter=r,i.exports=r})(Ou);var Df=Ou.exports;const Rf=tt(Df);function If(i,e,t){let n=0,a=i.length;for(;a>0;){const s=Math.trunc(a/2);let o=n+s;t(i[o],e)<=0?(n=++o,a-=s+1):a=s}return n}var $t=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},Ft;let Uf=class{constructor(){Ft.set(this,[])}enqueue(e,t){t={priority:0,...t};const n={priority:t.priority,run:e};if(this.size&&$t(this,Ft,"f")[this.size-1].priority>=t.priority){$t(this,Ft,"f").push(n);return}const a=If($t(this,Ft,"f"),n,(s,o)=>o.priority-s.priority);$t(this,Ft,"f").splice(a,0,n)}dequeue(){const e=$t(this,Ft,"f").shift();return e==null?void 0:e.run}filter(e){return $t(this,Ft,"f").filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return $t(this,Ft,"f").length}};Ft=new WeakMap;var ee=function(i,e,t,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!a:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(i,t):a?a.value=t:e.set(i,t),t},U=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},ae,pn,dn,Nt,Ma,hn,wa,Ke,on,De,Pa,Ue,mn,It,Sa,Gr,Kr,Au,Xr,Qr,Fa,ys,xs,ja,Du,_a;let Ru=class extends Error{},Nf=class extends Rf{constructor(e){var t,n,a,s;if(super(),ae.add(this),pn.set(this,void 0),dn.set(this,void 0),Nt.set(this,0),Ma.set(this,void 0),hn.set(this,void 0),wa.set(this,0),Ke.set(this,void 0),on.set(this,void 0),De.set(this,void 0),Pa.set(this,void 0),Ue.set(this,0),mn.set(this,void 0),It.set(this,void 0),Sa.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Uf,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(t=e.intervalCap)===null||t===void 0?void 0:t.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(s=(a=e.interval)===null||a===void 0?void 0:a.toString())!==null&&s!==void 0?s:""}\` (${typeof e.interval})`);ee(this,pn,e.carryoverConcurrencyCount,"f"),ee(this,dn,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),ee(this,Ma,e.intervalCap,"f"),ee(this,hn,e.interval,"f"),ee(this,De,new e.queueClass,"f"),ee(this,Pa,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,ee(this,Sa,e.throwOnTimeout===!0,"f"),ee(this,It,e.autoStart===!1,"f")}get concurrency(){return U(this,mn,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);ee(this,mn,e,"f"),U(this,ae,"m",ja).call(this)}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:U(this,Sa,"f"),...t},new Promise((n,a)=>{U(this,De,"f").enqueue(async()=>{var s,o,r;ee(this,Ue,(o=U(this,Ue,"f"),o++,o),"f"),ee(this,Nt,(r=U(this,Nt,"f"),r++,r),"f");try{if(!((s=t.signal)===null||s===void 0)&&s.aborted)throw new Ru("The task was aborted.");let l=e({signal:t.signal});t.timeout&&(l=au(Promise.resolve(l),t.timeout)),t.signal&&(l=Promise.race([l,U(this,ae,"m",Du).call(this,t.signal)]));const c=await l;n(c),this.emit("completed",c)}catch(l){if(l instanceof su&&!t.throwOnTimeout){n();return}a(l),this.emit("error",l)}finally{U(this,ae,"m",Au).call(this)}},t),this.emit("add"),U(this,ae,"m",Fa).call(this)})}async addAll(e,t){return Promise.all(e.map(async n=>this.add(n,t)))}start(){return U(this,It,"f")?(ee(this,It,!1,"f"),U(this,ae,"m",ja).call(this),this):this}pause(){ee(this,It,!0,"f")}clear(){ee(this,De,new(U(this,Pa,"f")),"f")}async onEmpty(){U(this,De,"f").size!==0&&await U(this,ae,"m",_a).call(this,"empty")}async onSizeLessThan(e){U(this,De,"f").size<e||await U(this,ae,"m",_a).call(this,"next",()=>U(this,De,"f").size<e)}async onIdle(){U(this,Ue,"f")===0&&U(this,De,"f").size===0||await U(this,ae,"m",_a).call(this,"idle")}get size(){return U(this,De,"f").size}sizeBy(e){return U(this,De,"f").filter(e).length}get pending(){return U(this,Ue,"f")}get isPaused(){return U(this,It,"f")}};pn=new WeakMap,dn=new WeakMap,Nt=new WeakMap,Ma=new WeakMap,hn=new WeakMap,wa=new WeakMap,Ke=new WeakMap,on=new WeakMap,De=new WeakMap,Pa=new WeakMap,Ue=new WeakMap,mn=new WeakMap,It=new WeakMap,Sa=new WeakMap,ae=new WeakSet,Gr=function(){return U(this,dn,"f")||U(this,Nt,"f")<U(this,Ma,"f")},Kr=function(){return U(this,Ue,"f")<U(this,mn,"f")},Au=function(){var e;ee(this,Ue,(e=U(this,Ue,"f"),e--,e),"f"),U(this,ae,"m",Fa).call(this),this.emit("next")},Xr=function(){U(this,ae,"m",xs).call(this),U(this,ae,"m",ys).call(this),ee(this,on,void 0,"f")},Qr=function(){const e=Date.now();if(U(this,Ke,"f")===void 0){const t=U(this,wa,"f")-e;if(t<0)ee(this,Nt,U(this,pn,"f")?U(this,Ue,"f"):0,"f");else return U(this,on,"f")===void 0&&ee(this,on,setTimeout(()=>{U(this,ae,"m",Xr).call(this)},t),"f"),!0}return!1},Fa=function(){if(U(this,De,"f").size===0)return U(this,Ke,"f")&&clearInterval(U(this,Ke,"f")),ee(this,Ke,void 0,"f"),this.emit("empty"),U(this,Ue,"f")===0&&this.emit("idle"),!1;if(!U(this,It,"f")){const e=!U(this,ae,"a",Qr);if(U(this,ae,"a",Gr)&&U(this,ae,"a",Kr)){const t=U(this,De,"f").dequeue();return t?(this.emit("active"),t(),e&&U(this,ae,"m",ys).call(this),!0):!1}}return!1},ys=function(){U(this,dn,"f")||U(this,Ke,"f")!==void 0||(ee(this,Ke,setInterval(()=>{U(this,ae,"m",xs).call(this)},U(this,hn,"f")),"f"),ee(this,wa,Date.now()+U(this,hn,"f"),"f"))},xs=function(){U(this,Nt,"f")===0&&U(this,Ue,"f")===0&&U(this,Ke,"f")&&(clearInterval(U(this,Ke,"f")),ee(this,Ke,void 0,"f")),ee(this,Nt,U(this,pn,"f")?U(this,Ue,"f"):0,"f"),U(this,ae,"m",ja).call(this)},ja=function(){for(;U(this,ae,"m",Fa).call(this););},Du=async function(e){return new Promise((t,n)=>{e.addEventListener("abort",()=>{n(new Ru("The task was aborted."))},{once:!0})})},_a=async function(e,t){return new Promise(n=>{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)})};var Tn,oe,ws,Yr,On=0,Iu=[],Ca=[],ce=io,Jr=ce.__b,Zr=ce.__r,el=ce.diffed,tl=ce.__c,il=ce.unmount,nl=ce.__;function nr(i,e){ce.__h&&ce.__h(oe,i,On||e),On=0;var t=oe.__H||(oe.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({__V:Ca}),t.__[i]}function zt(i){return On=1,Lf(Nu,i)}function Lf(i,e,t){var n=nr(Tn++,2);if(n.t=i,!n.__c&&(n.__=[t?t(e):Nu(void 0,e),function(r){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,r);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=oe,!oe.u)){var a=function(r,l,c){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(h){return!!h.__c});if(p.every(function(h){return!h.__N}))return!s||s.call(this,r,l,c);var u=!1;return p.forEach(function(h){if(h.__N){var g=h.__[0];h.__=h.__N,h.__N=void 0,g!==h.__[0]&&(u=!0)}}),!(!u&&n.__c.props===r)&&(!s||s.call(this,r,l,c))};oe.u=!0;var s=oe.shouldComponentUpdate,o=oe.componentWillUpdate;oe.componentWillUpdate=function(r,l,c){if(this.__e){var p=s;s=void 0,a(r,l,c),s=p}o&&o.call(this,r,l,c)},oe.shouldComponentUpdate=a}return n.__N||n.__}function An(i,e){var t=nr(Tn++,3);!ce.__s&&Uu(t.__H,e)&&(t.__=i,t.i=e,oe.__H.__h.push(t))}function Ps(i){return On=5,Wn(function(){return{current:i}},[])}function Wn(i,e){var t=nr(Tn++,7);return Uu(t.__H,e)?(t.__V=i(),t.i=e,t.__h=i,t.__V):t.__}function wi(i,e){return On=8,Wn(function(){return i},e)}function Bf(){for(var i;i=Iu.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Ea),i.__H.__h.forEach(co),i.__H.__h=[]}catch(e){i.__H.__h=[],ce.__e(e,i.__v)}}ce.__b=function(i){oe=null,Jr&&Jr(i)},ce.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),nl&&nl(i,e)},ce.__r=function(i){Zr&&Zr(i),Tn=0;var e=(oe=i.__c).__H;e&&(ws===oe?(e.__h=[],oe.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=Ca,t.__N=t.i=void 0})):(e.__h.forEach(Ea),e.__h.forEach(co),e.__h=[],Tn=0)),ws=oe},ce.diffed=function(i){el&&el(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Iu.push(e)!==1&&Yr===ce.requestAnimationFrame||((Yr=ce.requestAnimationFrame)||Mf)(Bf)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==Ca&&(t.__=t.__V),t.i=void 0,t.__V=Ca})),ws=oe=null},ce.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Ea),t.__h=t.__h.filter(function(n){return!n.__||co(n)})}catch(n){e.some(function(a){a.__h&&(a.__h=[])}),e=[],ce.__e(n,t.__v)}}),tl&&tl(i,e)},ce.unmount=function(i){il&&il(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{Ea(n)}catch(a){e=a}}),t.__H=void 0,e&&ce.__e(e,t.__v))};var al=typeof requestAnimationFrame=="function";function Mf(i){var e,t=function(){clearTimeout(n),al&&cancelAnimationFrame(e),setTimeout(i)},n=setTimeout(t,100);al&&(e=requestAnimationFrame(t))}function Ea(i){var e=oe,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),oe=e}function co(i){var e=oe;i.__c=i.__(),oe=e}function Uu(i,e){return!i||i.length!==e.length||e.some(function(t,n){return t!==i[n]})}function Nu(i,e){return typeof e=="function"?e(i):e}function jf(){return d("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg"},d("g",{fill:"none","fill-rule":"evenodd"},d("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),d("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),d("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),d("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),d("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),d("path",{d:"M4 4h18v18H4z"})))}function zf(i){let{pluginName:e,i18n:t,onAuth:n}=i;const a=e==="Google Drive",s=wi(o=>{o.preventDefault(),n()},[n]);return d("form",{onSubmit:s},a?d("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0},d(jf,null),t("signInWithGoogle")):d("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0},t("authenticateWith",{pluginName:e})))}const $f=i=>{let{pluginName:e,i18n:t,onAuth:n}=i;return d(zf,{pluginName:e,i18n:t,onAuth:n})};function qf(i){const{loading:e,pluginName:t,pluginIcon:n,i18n:a,handleAuth:s,renderForm:o=$f}=i;return d("div",{className:"uppy-Provider-auth"},d("div",{className:"uppy-Provider-authIcon"},n()),d("div",{className:"uppy-Provider-authTitle"},a("authenticateWithTitle",{pluginName:t})),d("div",{className:"uppy-Provider-authForm"},o({pluginName:t,i18n:a,loading:e,onAuth:s})))}function Hf(i){let{i18n:e,logout:t,username:n}=i;return d(ot,null,d("span",{className:"uppy-ProviderBrowser-user",key:"username"},n),d("button",{type:"button",onClick:t,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",key:"logout"},e("logOut")))}const Vf=i=>{const{getFolder:e,title:t,isLast:n}=i;return d(ot,null,d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:e},t),n?"":" / ")};function Wf(i){const{getFolder:e,title:t,breadcrumbsIcon:n,breadcrumbs:a}=i;return d("div",{className:"uppy-Provider-breadcrumbs"},d("div",{className:"uppy-Provider-breadcrumbsIcon"},n),a.map((s,o)=>d(Vf,{key:s.id,getFolder:()=>e(s.requestPath,s.name),title:o===0?t:s.name,isLast:o+1===a.length})))}function Gf(i){return d(ot,null,i.showBreadcrumbs&&d(Wf,{getFolder:i.getFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon&&i.pluginIcon(),title:i.title}),d(Hf,{logout:i.logout,username:i.username,i18n:i.i18n}))}function ts(i){return{...i,type:i.mimeType,extension:i.name?Jo(i.name).extension:null}}function uo(){return uo=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},uo.apply(this,arguments)}const Kf={position:"relative",width:"100%",minHeight:"100%"},Xf={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};class ar extends dt{constructor(e){super(e),this.handleScroll=()=>{this.setState({offset:this.base.scrollTop})},this.handleResize=()=>{this.resize()},this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement&&this.focusElement.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}resize(){const{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render(e){let{data:t,rowHeight:n,renderRow:a,overscanCount:s=10,...o}=e;const{offset:r,height:l}=this.state;let c=Math.floor(r/n),p=Math.floor(l/n);s&&(c=Math.max(0,c-c%s),p+=s);const u=c+p+4,h=t.slice(c,u),g={...Kf,height:t.length*n},m={...Xf,top:c*n};return d("div",uo({onScroll:this.handleScroll},o),d("div",{role:"presentation",style:g},d("div",{role:"presentation",style:m},h.map(a))))}}function Lu(i){const{search:e,searchOnInput:t,searchTerm:n,showButton:a,inputLabel:s,clearSearchLabel:o,buttonLabel:r,clearSearch:l,inputClassName:c,buttonCSSClassName:p}=i,[u,h]=zt(n??""),g=wi(y=>{y.preventDefault(),e(u)},[e,u]),m=wi(y=>{const F=y.target.value;h(F),t&&e(F)},[h,t,e]),v=()=>{h(""),l&&l()},[f]=zt(()=>{const y=document.createElement("form");return y.setAttribute("tabindex","-1"),y.id=Ci(),y});return An(()=>(document.body.appendChild(f),f.addEventListener("submit",g),()=>{f.removeEventListener("submit",g),document.body.removeChild(f)}),[f,g]),d(ot,null,d("input",{className:`uppy-u-reset ${c}`,type:"search","aria-label":s,placeholder:s,value:u,onInput:m,form:f.id,"data-uppy-super-focusable":!0}),!a&&d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12"},d("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})),!a&&u&&d("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":o,title:o,onClick:v},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19"},d("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"}))),a&&d("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${p}`,type:"submit",form:f.id},r))}function Qf(i){let{cancel:e,done:t,i18n:n,selected:a}=i;return d("div",{className:"uppy-ProviderBrowser-footer"},d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary",onClick:t,type:"button"},n("selectX",{smart_count:a})),d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:e,type:"button"},n("cancel")))}function Yf(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58"},d("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"}))}function Jf(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157"},d("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"}))}function Zf(){return d("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58"},d("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),d("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"}))}function eg(i){const{itemIconString:e}=i;if(e===null)return null;switch(e){case"file":return d(Yf,null);case"folder":return d(Jf,null);case"video":return d(Zf,null);default:{const{alt:t}=i;return d("img",{src:e,alt:t,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}}function sl(i){const{className:e,isDisabled:t,restrictionError:n,isChecked:a,title:s,itemIconEl:o,showTitles:r,toggleCheckbox:l,recordShiftKeyPress:c,id:p,children:u}=i,h=fe("uppy-u-reset","uppy-ProviderBrowserItem-checkbox","uppy-ProviderBrowserItem-checkbox--grid",{"uppy-ProviderBrowserItem-checkbox--is-checked":a});return d("li",{className:e,title:t?n==null?void 0:n.message:void 0},d("input",{type:"checkbox",className:h,onChange:l,onKeyDown:c,onMouseDown:c,name:"listitem",id:p,checked:a,disabled:t,"data-uppy-super-focusable":!0}),d("label",{htmlFor:p,"aria-label":s,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},o,r&&s,u))}function tg(i){const{className:e,isDisabled:t,restrictionError:n,isCheckboxDisabled:a,isChecked:s,toggleCheckbox:o,recordShiftKeyPress:r,type:l,id:c,itemIconEl:p,title:u,handleFolderClick:h,showTitles:g,i18n:m}=i;return d("li",{className:e,title:t?n==null?void 0:n.message:void 0},a?null:d("input",{type:"checkbox",className:`uppy-u-reset uppy-ProviderBrowserItem-checkbox ${s?"uppy-ProviderBrowserItem-checkbox--is-checked":""}`,onChange:o,onKeyDown:r,onMouseDown:r,name:"listitem",id:c,checked:s,"aria-label":l==="file"?null:m("allFilesFromFolderNamed",{name:u}),disabled:t,"data-uppy-super-focusable":!0}),l==="file"?d("label",{htmlFor:c,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},d("div",{className:"uppy-ProviderBrowserItem-iconWrap"},p),g&&u):d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:h,"aria-label":m("openFolderNamed",{name:u})},d("div",{className:"uppy-ProviderBrowserItem-iconWrap"},p),g&&d("span",null,u)))}function fn(){return fn=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},fn.apply(this,arguments)}function ol(i){const{author:e,getItemIcon:t,isChecked:n,isDisabled:a,viewType:s}=i,o=t(),r=fe("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--selected":n},{"uppy-ProviderBrowserItem--disabled":a},{"uppy-ProviderBrowserItem--noPreview":o==="video"}),l=d(eg,{itemIconString:o});switch(s){case"grid":return d(sl,fn({},i,{className:r,itemIconEl:l}));case"list":return d(tg,fn({},i,{className:r,itemIconEl:l}));case"unsplash":return d(sl,fn({},i,{className:r,itemIconEl:l}),d("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1},e.name));default:throw new Error(`There is no such type ${s}`)}}const ig="shared-with-me";function rl(i){const{currentSelection:e,uppyFiles:t,viewType:n,isChecked:a,toggleCheckbox:s,recordShiftKeyPress:o,showTitles:r,i18n:l,validateRestrictions:c,getNextFolder:p,f:u}=i;if(u.isFolder)return ol({showTitles:r,viewType:n,i18n:l,id:u.id,title:u.name,getItemIcon:()=>u.icon,isChecked:a(u),toggleCheckbox:g=>s(g,u),recordShiftKeyPress:o,type:"folder",isDisabled:!1,isCheckboxDisabled:u.id===ig,handleFolderClick:()=>p(u)});const h=c(ts(u),[...t,...e]);return ol({id:u.id,title:u.name,author:u.author,getItemIcon:()=>u.icon,isChecked:a(u),toggleCheckbox:g=>s(g,u),isCheckboxDisabled:!1,recordShiftKeyPress:o,showTitles:r,viewType:n,i18n:l,type:"file",isDisabled:!!h&&!a(u),restrictionError:h})}function Bu(i){const{currentSelection:e,folders:t,files:n,uppyFiles:a,viewType:s,headerComponent:o,showBreadcrumbs:r,isChecked:l,toggleCheckbox:c,recordShiftKeyPress:p,handleScroll:u,showTitles:h,i18n:g,validateRestrictions:m,isLoading:v,showSearchFilter:f,search:y,searchTerm:F,clearSearch:S,searchOnInput:A,searchInputLabel:D,clearSearchLabel:x,getNextFolder:_,cancel:O,done:L,noResultsLabel:z,loadAllFiles:K}=i,Z=e.length,G=Wn(()=>[...t,...n],[t,n]);return d("div",{className:fe("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${s}`)},o&&d("div",{className:"uppy-ProviderBrowser-header"},d("div",{className:fe("uppy-ProviderBrowser-headerBar",!r&&"uppy-ProviderBrowser-headerBar--simple")},o)),f&&d("div",{class:"uppy-ProviderBrowser-searchFilter"},d(Lu,{search:y,searchTerm:F,clearSearch:S,inputLabel:D,clearSearchLabel:x,inputClassName:"uppy-ProviderBrowser-searchFilterInput",searchOnInput:A})),v?d("div",{className:"uppy-Provider-loading"},d("span",null,g("loading"))):!t.length&&!n.length?d("div",{className:"uppy-Provider-empty"},z):K?d("div",{className:"uppy-ProviderBrowser-body"},d("ul",{className:"uppy-ProviderBrowser-list"},d(ar,{data:G,renderRow:j=>d(rl,{currentSelection:e,uppyFiles:a,viewType:s,isChecked:l,toggleCheckbox:c,recordShiftKeyPress:p,showTitles:h,i18n:g,validateRestrictions:m,getNextFolder:_,f:j}),rowHeight:31}))):d("div",{className:"uppy-ProviderBrowser-body"},d("ul",{className:"uppy-ProviderBrowser-list",onScroll:u,role:"listbox",tabIndex:-1},G.map(j=>d(rl,{currentSelection:e,uppyFiles:a,viewType:s,isChecked:l,toggleCheckbox:c,recordShiftKeyPress:p,showTitles:h,i18n:g,validateRestrictions:m,getNextFolder:_,f:j})))),Z>0&&d(Qf,{selected:Z,done:L,cancel:O,i18n:g}))}let za=class extends dt{componentWillUnmount(){const{onUnmount:e}=this.props;e()}render(){const{children:e}=this.props;return Ct(e)[0]}};function $a(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}let Mu=class{constructor(e,t){this.filterItems=n=>{const a=this.plugin.getPluginState();return!a.filterInput||a.filterInput===""?n:n.filter(s=>s.name.toLowerCase().indexOf(a.filterInput.toLowerCase())!==-1)},this.recordShiftKeyPress=n=>{this.isShiftKeyPressed=n.shiftKey},this.isChecked=n=>{const{currentSelection:a}=this.plugin.getPluginState();return a.some(s=>s.id===n.id)},this.plugin=e,this.provider=t.provider,this.opts=t,this.isHandlingScroll=!1,this.preFirstRender=this.preFirstRender.bind(this),this.handleError=this.handleError.bind(this),this.clearSelection=this.clearSelection.bind(this),this.cancelPicking=this.cancelPicking.bind(this)}preFirstRender(){this.plugin.setPluginState({didFirstRender:!0}),this.plugin.onFirstRender()}shouldHandleScroll(e){const{scrollHeight:t,scrollTop:n,offsetHeight:a}=e.target;return t-(n+a)<50&&!this.isHandlingScroll}clearSelection(){this.plugin.setPluginState({currentSelection:[],filterInput:""})}cancelPicking(){this.clearSelection();const e=this.plugin.uppy.getPlugin("Dashboard");e&&e.hideAllPanels()}handleError(e){var t;const{uppy:n}=this.plugin,a=n.i18n("companionError");n.log(e.toString()),!(e.isAuthError||((t=e.cause)==null?void 0:t.name)==="AbortError")&&n.info({message:a,details:e.toString()},"error",5e3)}registerRequestClient(){this.requestClientId=this.provider.provider,this.plugin.uppy.registerRequestClient(this.requestClientId,this.provider)}getTagFile(e){const t={id:e.id,source:this.plugin.id,name:e.name||e.id,type:e.mimeType,isRemote:!0,data:e,meta:{},body:{fileId:e.id},remote:{companionUrl:this.plugin.opts.companionUrl,url:`${this.provider.fileUrl(e.requestPath)}`,body:{fileId:e.id},providerName:this.provider.name,provider:this.provider.provider,requestClientId:this.requestClientId}},n=Ja(t);return n&&$a(n)&&(t.preview=e.thumbnail),e.author&&(e.author.name!=null&&(t.meta.authorName=String(e.author.name)),e.author.url&&(t.meta.authorUrl=e.author.url)),e.relDirPath!=null&&(t.meta.relativePath=e.relDirPath?`${e.relDirPath}/${t.name}`:null),e.absDirPath!=null&&(t.meta.absolutePath=e.absDirPath?`/${e.absDirPath}/${t.name}`:`/${t.name}`),t}toggleCheckbox(e,t){e.stopPropagation(),e.preventDefault(),e.currentTarget.focus();const{folders:n,files:a}=this.plugin.getPluginState(),s=this.filterItems(n.concat(a));if(this.lastCheckbox&&this.isShiftKeyPressed){const{currentSelection:r}=this.plugin.getPluginState(),l=s.indexOf(this.lastCheckbox),c=s.indexOf(t),p=l<c?s.slice(l,c+1):s.slice(c,l+1),u=[];for(const h of p){const{uppy:g}=this.plugin,m=g.validateRestrictions(ts(h),[...g.getFiles(),...u]);m?g.info({message:m.message},"error",g.opts.infoTimeout):u.push(h)}this.plugin.setPluginState({currentSelection:[...new Set([...r,...u])]});return}this.lastCheckbox=t;const{currentSelection:o}=this.plugin.getPluginState();this.isChecked(t)?this.plugin.setPluginState({currentSelection:o.filter(r=>r.id!==t.id)}):this.plugin.setPluginState({currentSelection:o.concat([t])})}setLoading(e){this.plugin.setPluginState({loading:e})}};function Ee(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var ng=0;function Gn(i){return"__private_"+ng+++"_"+i}const ag={version:"3.11.0"};function sg(i){return i.slice(1).map(e=>e.name).join("/")}function po(i,e){return i?`${i}/${e}`:e}function ju(){return d("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30"},d("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"}))}const og={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1};var Jt=Gn("abortController"),We=Gn("withAbort"),Dn=Gn("list"),Hi=Gn("listFilesAndFolders"),gn=Gn("recursivelyListAllFiles");let rg=class extends Mu{constructor(e,t){super(e,{...og,...t}),Object.defineProperty(this,gn,{value:pg}),Object.defineProperty(this,Hi,{value:ug}),Object.defineProperty(this,Dn,{value:cg}),Object.defineProperty(this,We,{value:lg}),Object.defineProperty(this,Jt,{writable:!0,value:void 0}),this.filterQuery=this.filterQuery.bind(this),this.clearFilter=this.clearFilter.bind(this),this.getFolder=this.getFolder.bind(this),this.getNextFolder=this.getNextFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.plugin.setPluginState({authenticated:void 0,files:[],folders:[],breadcrumbs:[],filterInput:"",isSearchVisible:!1,currentSelection:[]}),this.registerRequestClient()}tearDown(){}async getFolder(e,t){this.setLoading(!0);try{await Ee(this,We)[We](async n=>{this.lastCheckbox=void 0;let{breadcrumbs:a}=this.plugin.getPluginState();const s=a.findIndex(l=>e===l.requestPath);s!==-1?a=a.slice(0,s+1):a=[...a,{requestPath:e,name:t}],this.nextPagePath=e;let o=[],r=[];do{const{files:l,folders:c}=await Ee(this,Hi)[Hi]({breadcrumbs:a,signal:n});o=o.concat(l),r=r.concat(c),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length+r.length}))}while(this.opts.loadAllFiles&&this.nextPagePath);this.plugin.setPluginState({folders:r,files:o,breadcrumbs:a,filterInput:""})})}catch(n){if((n==null?void 0:n.name)==="UserFacingApiError"){this.plugin.uppy.info({message:this.plugin.uppy.i18n(n.message)},"warning",5e3);return}this.handleError(n)}finally{this.setLoading(!1)}}getNextFolder(e){this.getFolder(e.requestPath,e.name),this.lastCheckbox=void 0}async logout(){try{await Ee(this,We)[We](async e=>{const t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){const a=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(a,"info",7e3)}const n={authenticated:!1,files:[],folders:[],breadcrumbs:[],filterInput:""};this.plugin.setPluginState(n)}})}catch(e){this.handleError(e)}}filterQuery(e){this.plugin.setPluginState({filterInput:e})}clearFilter(){this.plugin.setPluginState({filterInput:""})}async handleAuth(e){try{await Ee(this,We)[We](async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),this.preFirstRender()})}catch(t){if(t.name==="UserFacingApiError"){this.plugin.uppy.info({message:this.plugin.uppy.i18n(t.message)},"warning",5e3);return}this.plugin.uppy.log(`login failed: ${t.message}`)}finally{this.setLoading(!1)}}async handleScroll(e){if(this.shouldHandleScroll(e)&&this.nextPagePath){this.isHandlingScroll=!0;try{await Ee(this,We)[We](async t=>{const{files:n,folders:a,breadcrumbs:s}=this.plugin.getPluginState(),{files:o,folders:r}=await Ee(this,Hi)[Hi]({breadcrumbs:s,signal:t}),l=n.concat(o),c=a.concat(r);this.plugin.setPluginState({folders:c,files:l})})}catch(t){this.handleError(t)}finally{this.isHandlingScroll=!1}}}async donePicking(){this.setLoading(!0);try{await Ee(this,We)[We](async e=>{const{currentSelection:t}=this.plugin.getPluginState(),n=[],a=[];for(const s of t){const{requestPath:o}=s,r=l=>({...l,relDirPath:l.absDirPath.replace(s.absDirPath,"").replace(/^\//,"")});if(s.isFolder){let l=!0,c=0;const p=new Nf({concurrency:6}),u=g=>{for(const m of g){const v=this.getTagFile(m),f=Zo(v);this.plugin.uppy.checkIfFileAlreadyExists(f)||(a.push(r(m)),c++,this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:c}))),l=!1}};await Ee(this,gn)[gn]({requestPath:o,absDirPath:po(s.absDirPath,s.name),relDirPath:s.name,queue:p,onFiles:u,signal:e}),await p.onIdle();let h;l?h=this.plugin.uppy.i18n("emptyFolderAdded"):c===0?h=this.plugin.uppy.i18n("folderAlreadyAdded",{folder:s.name}):h=this.plugin.uppy.i18n("folderAdded",{smart_count:c,folder:s.name}),n.push(h)}else a.push(r(s))}this.plugin.uppy.log("Adding files from a remote provider"),this.plugin.uppy.addFiles(a.map(s=>this.getTagFile(s,this.requestClientId))),this.plugin.setPluginState({filterInput:""}),n.forEach(s=>this.plugin.uppy.info(s)),this.clearSelection()})}catch(e){this.handleError(e)}finally{this.setLoading(!1)}}render(e,t){var n=this;t===void 0&&(t={});const{authenticated:a,didFirstRender:s}=this.plugin.getPluginState(),{i18n:o}=this.plugin.uppy;s||this.preFirstRender();const r={...this.opts,...t},{files:l,folders:c,filterInput:p,loading:u,currentSelection:h}=this.plugin.getPluginState(),{isChecked:g,recordShiftKeyPress:m,filterItems:v}=this,f=p!=="",y=this.plugin.icon||ju,F={showBreadcrumbs:r.showBreadcrumbs,getFolder:this.getFolder,breadcrumbs:this.plugin.getPluginState().breadcrumbs,pluginIcon:y,title:this.plugin.title,logout:this.logout,username:this.username,i18n:o},S={isChecked:g,toggleCheckbox:this.toggleCheckbox.bind(this),recordShiftKeyPress:m,currentSelection:h,files:f?v(l):l,folders:f?v(c):c,getNextFolder:this.getNextFolder,getFolder:this.getFolder,loadAllFiles:this.opts.loadAllFiles,showSearchFilter:r.showFilter,search:this.filterQuery,clearSearch:this.clearFilter,searchTerm:p,searchOnInput:!0,searchInputLabel:o("filter"),clearSearchLabel:o("resetFilter"),noResultsLabel:o("noFilesFound"),logout:this.logout,handleScroll:this.handleScroll,done:this.donePicking,cancel:this.cancelPicking,headerComponent:d(Gf,F),title:this.plugin.title,viewType:r.viewType,showTitles:r.showTitles,showBreadcrumbs:r.showBreadcrumbs,pluginIcon:y,i18n:this.plugin.uppy.i18n,uppyFiles:this.plugin.uppy.getFiles(),validateRestrictions:function(){return n.plugin.uppy.validateRestrictions(...arguments)},isLoading:u};return a===!1?d(za,{onUnmount:this.clearSelection},d(qf,{pluginName:this.plugin.title,pluginIcon:y,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18nArray,renderForm:this.opts.renderAuthForm,loading:u})):d(za,{onUnmount:this.clearSelection},d(Bu,S))}};async function lg(i){var e;(e=Ee(this,Jt)[Jt])==null||e.abort();const t=new AbortController;Ee(this,Jt)[Jt]=t;const n=()=>{t.abort(),this.clearSelection()};try{this.plugin.uppy.on("dashboard:close-panel",n),this.plugin.uppy.on("cancel-all",n),await i(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",n),this.plugin.uppy.off("cancel-all",n),Ee(this,Jt)[Jt]=void 0}}async function cg(i){let{requestPath:e,absDirPath:t,signal:n}=i;const{username:a,nextPagePath:s,items:o}=await this.provider.list(e,{signal:n});return this.username=a||this.username,{items:o.map(r=>({...r,absDirPath:t})),nextPagePath:s}}async function ug(i){let{breadcrumbs:e,signal:t}=i;const n=sg(e),{items:a,nextPagePath:s}=await Ee(this,Dn)[Dn]({requestPath:this.nextPagePath,absDirPath:n,signal:t});this.nextPagePath=s;const o=[],r=[];return a.forEach(l=>{l.isFolder?r.push(l):o.push(l)}),{files:o,folders:r}}async function pg(i){let{requestPath:e,absDirPath:t,relDirPath:n,queue:a,onFiles:s,signal:o}=i,r=e;for(;r;){const l=await Ee(this,Dn)[Dn]({requestPath:r,absDirPath:t,signal:o});r=l.nextPagePath;const c=l.items.filter(h=>!h.isFolder),p=l.items.filter(h=>h.isFolder);s(c);const u=p.map(async h=>a.add(async()=>Ee(this,gn)[gn]({requestPath:h.requestPath,absDirPath:po(t,h.name),relDirPath:po(n,h.name),queue:a,onFiles:s,signal:o})));await Promise.all(u)}}rg.VERSION=ag.version;function ll(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var dg=0;function hg(i){return"__private_"+dg+++"_"+i}const mg={version:"3.11.0"},cl={isInputMode:!0,files:[],folders:[],breadcrumbs:[],filterInput:"",currentSelection:[],searchTerm:null},fg={viewType:"grid",showTitles:!0,showFilter:!0,showBreadcrumbs:!0};var Vi=hg("updateFilesAndInputMode");let zu=class extends Mu{constructor(e,t){super(e,{...fg,...t}),Object.defineProperty(this,Vi,{value:gg}),this.nextPageQuery=null,this.search=this.search.bind(this),this.clearSearch=this.clearSearch.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.plugin.setPluginState(cl),this.registerRequestClient()}tearDown(){}resetPluginState(){this.plugin.setPluginState(cl)}async search(e){const{searchTerm:t}=this.plugin.getPluginState();if(!(e&&e===t)){this.setLoading(!0);try{const n=await this.provider.search(e);ll(this,Vi)[Vi](n,[])}catch(n){this.handleError(n)}finally{this.setLoading(!1)}}}clearSearch(){this.plugin.setPluginState({currentSelection:[],files:[],searchTerm:null})}async handleScroll(e){const t=this.nextPageQuery||null;if(this.shouldHandleScroll(e)&&t){this.isHandlingScroll=!0;try{const{files:n,searchTerm:a}=this.plugin.getPluginState(),s=await this.provider.search(a,t);ll(this,Vi)[Vi](s,n)}catch(n){this.handleError(n)}finally{this.isHandlingScroll=!1}}}donePicking(){const{currentSelection:e}=this.plugin.getPluginState();this.plugin.uppy.log("Adding remote search provider files"),this.plugin.uppy.addFiles(e.map(t=>this.getTagFile(t))),this.resetPluginState()}render(e,t){var n=this;t===void 0&&(t={});const{didFirstRender:a,isInputMode:s,searchTerm:o}=this.plugin.getPluginState(),{i18n:r}=this.plugin.uppy;a||this.preFirstRender();const l={...this.opts,...t},{files:c,folders:p,filterInput:u,loading:h,currentSelection:g}=this.plugin.getPluginState(),{isChecked:m,filterItems:v,recordShiftKeyPress:f}=this,y=u!=="",F={isChecked:m,toggleCheckbox:this.toggleCheckbox.bind(this),recordShiftKeyPress:f,currentSelection:g,files:y?v(c):c,folders:y?v(p):p,handleScroll:this.handleScroll,done:this.donePicking,cancel:this.cancelPicking,showSearchFilter:l.showFilter,search:this.search,clearSearch:this.clearSearch,searchTerm:o,searchOnInput:!1,searchInputLabel:r("search"),clearSearchLabel:r("resetSearch"),noResultsLabel:r("noSearchResults"),title:this.plugin.title,viewType:l.viewType,showTitles:l.showTitles,showFilter:l.showFilter,isLoading:h,showBreadcrumbs:l.showBreadcrumbs,pluginIcon:this.plugin.icon,i18n:r,uppyFiles:this.plugin.uppy.getFiles(),validateRestrictions:function(){return n.plugin.uppy.validateRestrictions(...arguments)}};return s?d(za,{onUnmount:this.resetPluginState},d("div",{className:"uppy-SearchProvider"},d(Lu,{search:this.search,inputLabel:r("enterTextToSearch"),buttonLabel:r("searchImages"),inputClassName:"uppy-c-textInput uppy-SearchProvider-input",buttonCSSClassName:"uppy-SearchProvider-searchButton",showButton:!0}))):d(za,{onUnmount:this.resetPluginState},d(Bu,F))}};function gg(i,e){this.nextPageQuery=i.nextPageQuery,i.items.forEach(t=>{e.push(t)}),this.plugin.setPluginState({currentSelection:[],isInputMode:!1,files:e,searchTerm:i.searchedFor})}zu.VERSION=mg.version;const vg={version:"3.3.0"};class $u extends ye{constructor(e,t){if(super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||wf,this.id=this.opts.id||"Unsplash",this.title=this.opts.title||"Unsplash",this.icon=()=>d("svg",{className:"uppy-DashboardTab-iconUnsplash",viewBox:"0 0 32 32",height:"32",width:"32","aria-hidden":"true"},d("g",{fill:"currentcolor"},d("path",{d:"M46.575 10.883v-9h12v9zm12 5h10v18h-32v-18h10v9h12z"}),d("path",{d:"M13 12.5V8h6v4.5zm6 2.5h5v9H8v-9h5v4.5h6z"}))),!this.opts.companionUrl)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");this.hostname=this.opts.companionUrl,this.opts.companionAllowedHosts=vf(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new gf(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule,provider:"unsplash",pluginId:this.id})}install(){this.view=new zu(this,{provider:this.provider,viewType:"unsplash",showFilter:!0});const{target:e}=this.opts;e&&this.mount(e,this)}async onFirstRender(){}render(e){return this.view.render(e)}uninstall(){this.unmount()}}$u.VERSION=vg.version;function ul(i,e,t,n){return t===0||i===e?i:n===0?e:i+(e-i)*2**(-n/t)}const at={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};function Ss(i){const e=[];let t="indeterminate",n;for(const{progress:s}of Object.values(i)){const{preprocess:o,postprocess:r}=s;n==null&&(o||r)&&({mode:t,message:n}=o||r),(o==null?void 0:o.mode)==="determinate"&&e.push(o.value),(r==null?void 0:r.mode)==="determinate"&&e.push(r.value)}const a=e.reduce((s,o)=>s+o/e.length,0);return{mode:t,message:n,value:a}}function bg(i){const e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,n=Math.floor(i%60);return{hours:e,minutes:t,seconds:n}}function yg(i){const e=bg(i),t=e.hours===0?"":`${e.hours}h`,n=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,a=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${n}${a}`}const xg="·",pl=()=>` ${xg} `;function wg(i){const{newFiles:e,isUploadStarted:t,recoveredState:n,i18n:a,uploadState:s,isSomeGhost:o,startUpload:r}=i,l=fe("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":s===at.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),c=e&&t&&!n?a("uploadXNewFiles",{smart_count:e}):a("uploadXFiles",{smart_count:e});return d("button",{type:"button",className:l,"aria-label":a("uploadXFiles",{smart_count:e}),onClick:r,disabled:o,"data-uppy-super-focusable":!0},c)}function Pg(i){const{i18n:e,uppy:t}=i;return d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry"},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10"},d("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})),e("retry"))}function Sg(i){const{i18n:e,uppy:t}=i;return d("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16"},d("g",{fill:"none",fillRule:"evenodd"},d("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),d("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"}))))}function Fg(i){const{isAllPaused:e,i18n:t,isAllComplete:n,resumableUploads:a,uppy:s}=i,o=t(e?"resume":"pause");function r(){if(!n){if(!a){s.cancelAll();return}if(e){s.resumeAll();return}s.pauseAll()}}return d("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:r,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16"},d("g",{fill:"none",fillRule:"evenodd"},d("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),d("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"}))))}function _g(i){const{i18n:e,doneButtonHandler:t}=i;return d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0},e("done"))}function qu(){return d("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14"},d("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"}))}function Cg(i){const{progress:e}=i,{value:t,mode:n,message:a}=e;return d("div",{className:"uppy-StatusBar-content"},d(qu,null),n==="determinate"?`${Math.round(t*100)}% · `:"",a)}function Eg(i){const{numUploads:e,complete:t,totalUploadedSize:n,totalSize:a,totalETA:s,i18n:o}=i,r=e>1;return d("div",{className:"uppy-StatusBar-statusSecondary"},r&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),d("span",{className:"uppy-StatusBar-additionalInfo"},r&&pl(),o("dataUploadedOfTotal",{complete:vi(n),total:vi(a)}),pl(),o("xTimeLeft",{time:yg(s)})))}function Hu(i){const{i18n:e,complete:t,numUploads:n}=i;return d("div",{className:"uppy-StatusBar-statusSecondary"},e("filesUploadedOfTotal",{complete:t,smart_count:n}))}function kg(i){const{i18n:e,newFiles:t,startUpload:n}=i,a=fe("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return d("div",{className:"uppy-StatusBar-statusSecondary"},d("div",{className:"uppy-StatusBar-statusSecondaryHint"},e("xMoreFilesAdded",{smart_count:t})),d("button",{type:"button",className:a,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:n},e("upload")))}function Tg(i){const{i18n:e,supportsUploadProgress:t,totalProgress:n,showProgressDetails:a,isUploadStarted:s,isAllComplete:o,isAllPaused:r,newFiles:l,numUploads:c,complete:p,totalUploadedSize:u,totalSize:h,totalETA:g,startUpload:m}=i,v=l&&s;if(!s||o)return null;const f=e(r?"paused":"uploading");function y(){return!r&&!v&&a?t?d(Eg,{numUploads:c,complete:p,totalUploadedSize:u,totalSize:h,totalETA:g,i18n:e}):d(Hu,{i18n:e,complete:p,numUploads:c}):null}return d("div",{className:"uppy-StatusBar-content","aria-label":f,title:f},r?null:d(qu,null),d("div",{className:"uppy-StatusBar-status"},d("div",{className:"uppy-StatusBar-statusPrimary"},t?`${f}: ${n}%`:f),y(),v?d(kg,{i18n:e,newFiles:l,startUpload:m}):null))}function Og(i){const{i18n:e}=i;return d("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete")},d("div",{className:"uppy-StatusBar-status"},d("div",{className:"uppy-StatusBar-statusPrimary"},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11"},d("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})),e("complete"))))}function Ag(i){const{error:e,i18n:t,complete:n,numUploads:a}=i;function s(){const o=`${t("uploadFailed")}
|
|
22
22
|
|
|
23
23
|
${e}`;alert(o)}return d("div",{className:"uppy-StatusBar-content",title:t("uploadFailed")},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11"},d("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})),d("div",{className:"uppy-StatusBar-status"},d("div",{className:"uppy-StatusBar-statusPrimary"},t("uploadFailed"),d("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:s,type:"button"},"?")),d(Hu,{i18n:t,complete:n,numUploads:a})))}const{STATE_ERROR:dl,STATE_WAITING:hl,STATE_PREPROCESSING:Fs,STATE_UPLOADING:aa,STATE_POSTPROCESSING:_s,STATE_COMPLETE:sa}=at;function Vu(i){const{newFiles:e,allowNewUpload:t,isUploadInProgress:n,isAllPaused:a,resumableUploads:s,error:o,hideUploadButton:r,hidePauseResumeButton:l,hideCancelButton:c,hideRetryButton:p,recoveredState:u,uploadState:h,totalProgress:g,files:m,supportsUploadProgress:v,hideAfterFinish:f,isSomeGhost:y,doneButtonHandler:F,isUploadStarted:S,i18n:A,startUpload:D,uppy:x,isAllComplete:_,showProgressDetails:O,numUploads:L,complete:z,totalSize:K,totalETA:Z,totalUploadedSize:G}=i;function j(){switch(h){case _s:case Fs:{const le=Ss(m);return le.mode==="determinate"?le.value*100:g}case dl:return null;case aa:return v?g:null;default:return g}}function $(){switch(h){case _s:case Fs:{const{mode:le}=Ss(m);return le==="indeterminate"}case aa:return!v;default:return!1}}function P(){if(u)return!1;switch(h){case hl:return r||e===0;case sa:return f;default:return!1}}const b=j(),w=P(),E=b??100,T=!o&&e&&!n&&!a&&t&&!r,k=!c&&h!==hl&&h!==sa,M=s&&!l&&h===aa,q=o&&!_&&!p,W=F&&h===sa,de=fe("uppy-StatusBar-progress",{"is-indeterminate":$()}),he=fe("uppy-StatusBar",`is-${h}`,{"has-ghosts":y});return d("div",{className:he,"aria-hidden":w},d("div",{className:de,style:{width:`${E}%`},role:"progressbar","aria-label":`${E}%`,"aria-valuetext":`${E}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":b}),(()=>{switch(h){case Fs:case _s:return d(Cg,{progress:Ss(m)});case sa:return d(Og,{i18n:A});case dl:return d(Ag,{error:o,i18n:A,numUploads:L,complete:z});case aa:return d(Tg,{i18n:A,supportsUploadProgress:v,totalProgress:g,showProgressDetails:O,isUploadStarted:S,isAllComplete:_,isAllPaused:a,newFiles:e,numUploads:L,complete:z,totalUploadedSize:G,totalSize:K,totalETA:Z,startUpload:D});default:return null}})(),d("div",{className:"uppy-StatusBar-actions"},u||T?d(wg,{newFiles:e,isUploadStarted:S,recoveredState:u,i18n:A,isSomeGhost:y,startUpload:D,uploadState:h}):null,q?d(Pg,{i18n:A,uppy:x}):null,M?d(Fg,{isAllPaused:a,i18n:A,isAllComplete:_,resumableUploads:s,uppy:x}):null,k?d(Sg,{i18n:A,uppy:x}):null,W?d(_g,{i18n:A,doneButtonHandler:F}):null))}Vu.defaultProps={doneButtonHandler:void 0,hideAfterFinish:!1,hideCancelButton:!1,hidePauseResumeButton:!1,hideRetryButton:!1,hideUploadButton:void 0,showProgressDetails:void 0};const Dg={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};function ie(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Rg=0;function Ei(i){return"__private_"+Rg+++"_"+i}const Ig={version:"3.3.1"},Ug=2e3,Ng=2e3;function Lg(i,e,t,n){if(i)return at.STATE_ERROR;if(e)return at.STATE_COMPLETE;if(t)return at.STATE_WAITING;let a=at.STATE_WAITING;const s=Object.keys(n);for(let o=0;o<s.length;o++){const{progress:r}=n[s[o]];if(r.uploadStarted&&!r.uploadComplete)return at.STATE_UPLOADING;r.preprocess&&(a=at.STATE_PREPROCESSING),r.postprocess&&a!==at.STATE_PREPROCESSING&&(a=at.STATE_POSTPROCESSING)}return a}const Bg={target:"body",hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null};var qe=Ei("lastUpdateTime"),Ye=Ei("previousUploadedBytes"),Et=Ei("previousSpeed"),Re=Ei("previousETA"),Cs=Ei("computeSmoothETA"),Wi=Ei("onUploadStart");let sr=class extends ye{constructor(e,t){super(e,{...Bg,...t}),Object.defineProperty(this,Cs,{value:Mg}),Object.defineProperty(this,qe,{writable:!0,value:void 0}),Object.defineProperty(this,Ye,{writable:!0,value:void 0}),Object.defineProperty(this,Et,{writable:!0,value:void 0}),Object.defineProperty(this,Re,{writable:!0,value:void 0}),this.startUpload=()=>this.uppy.upload().catch(()=>{}),Object.defineProperty(this,Wi,{writable:!0,value:()=>{const{recoveredState:n}=this.uppy.getState();if(ie(this,Et)[Et]=null,ie(this,Re)[Re]=null,n){ie(this,Ye)[Ye]=Object.values(n.files).reduce((a,s)=>{let{progress:o}=s;return a+o.bytesUploaded},0),this.uppy.emit("restore-confirmed");return}ie(this,qe)[qe]=performance.now(),ie(this,Ye)[Ye]=0}}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=Dg,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}render(e){const{capabilities:t,files:n,allowNewUpload:a,totalProgress:s,error:o,recoveredState:r}=e,{newFiles:l,startedFiles:c,completeFiles:p,isUploadStarted:u,isAllComplete:h,isAllErrored:g,isAllPaused:m,isUploadInProgress:v,isSomeGhost:f}=this.uppy.getObjectOfFilesPerState(),y=r?Object.values(n):l,F=!!t.resumableUploads,S=t.uploadProgress!==!1;let A=0,D=0;c.forEach(_=>{A+=_.progress.bytesTotal||0,D+=_.progress.bytesUploaded||0});const x=ie(this,Cs)[Cs]({uploaded:D,total:A,remaining:A-D});return Vu({error:o,uploadState:Lg(o,h,r,e.files||{}),allowNewUpload:a,totalProgress:s,totalSize:A,totalUploadedSize:D,isAllComplete:!1,isAllPaused:m,isAllErrored:g,isUploadStarted:u,isUploadInProgress:v,isSomeGhost:f,recoveredState:r,complete:p.length,newFiles:y.length,numUploads:c.length,totalETA:x,files:n,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:F,supportsUploadProgress:S,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish,isTargetDOMEl:this.isTargetDOMEl})}onMount(){const e=this.el;Pu(e)||(e.dir="ltr")}install(){const{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",ie(this,Wi)[Wi]),ie(this,qe)[qe]=performance.now(),ie(this,Ye)[Ye]=this.uppy.getFiles().reduce((t,n)=>t+n.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",ie(this,Wi)[Wi])}};function Mg(i){var e,t;if(i.total===0||i.remaining===0)return 0;(t=(e=ie(this,qe))[qe])!=null||(e[qe]=performance.now());const n=performance.now()-ie(this,qe)[qe];if(n===0){var a;return Math.round(((a=ie(this,Re)[Re])!=null?a:0)/100)/10}const s=i.uploaded-ie(this,Ye)[Ye];if(ie(this,Ye)[Ye]=i.uploaded,s<=0){var o;return Math.round(((o=ie(this,Re)[Re])!=null?o:0)/100)/10}const r=s/n,l=ie(this,Et)[Et]==null?r:ul(r,ie(this,Et)[Et],Ug,n);ie(this,Et)[Et]=l;const c=i.remaining/l,p=Math.max(ie(this,Re)[Re]-n,0),u=ie(this,Re)[Re]==null?c:ul(c,p,Ng,n);return ie(this,Re)[Re]=u,ie(this,qe)[qe]=performance.now(),Math.round(u/100)/10}sr.VERSION=Ig.version;const ml=300;class jg extends dt{constructor(){super(...arguments),this.ref=hh()}componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,ml)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,ml)}render(){const{children:e}=this.props;return d("div",{className:"uppy-Informer-animated",ref:this.ref},e)}}function zg(i,e){return Object.assign(i,e)}function $g(i,e){var t;return(t=i==null?void 0:i.key)!=null?t:e}function qg(i,e){const t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=n=>{i.refs[e]=n})}function Gi(i){const e={};for(let t=0;t<i.length;t++)if(i[t]!=null){const n=$g(i[t],t.toString(36));e[n]=i[t]}return e}function Hg(i,e){i=i||{},e=e||{};const t=o=>e.hasOwnProperty(o)?e[o]:i[o],n={};let a=[];for(const o in i)e.hasOwnProperty(o)?a.length&&(n[o]=a,a=[]):a.push(o);const s={};for(const o in e){if(n.hasOwnProperty(o))for(let r=0;r<n[o].length;r++){const l=n[o][r];s[n[o][r]]=t(l)}s[o]=t(o)}for(let o=0;o<a.length;o++)s[a[o]]=t(a[o]);return s}const Vg=i=>i;class Wu extends dt{constructor(e,t){super(e,t),this.refs={},this.state={children:Gi(Ct(Ct(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){const e=this.state.children;for(const t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){const t=Gi(Ct(e.children)||[]),n=this.state.children;this.setState(s=>({children:Hg(s.children,t)}));let a;for(a in t)if(t.hasOwnProperty(a)){const s=n&&n.hasOwnProperty(a);t[a]&&s&&this.currentlyTransitioningKeys[a]?(this.keysToEnter.push(a),this.keysToAbortLeave.push(a)):t[a]&&!s&&!this.currentlyTransitioningKeys[a]&&this.keysToEnter.push(a)}for(a in n)if(n.hasOwnProperty(a)){const s=t&&t.hasOwnProperty(a);n[a]&&!s&&!this.currentlyTransitioningKeys[a]&&this.keysToLeave.push(a)}}componentDidUpdate(){const{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);const{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){const t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;const t=this.refs[e];t!=null&&t.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){const t=this.refs[e];t!=null&&t.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);const n=Gi(Ct(this.props.children)||[]);(!n||!n.hasOwnProperty(e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;const t=this.refs[e];t!=null&&t.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){const t=this.refs[e];t!=null&&t.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);const n=Gi(Ct(this.props.children)||[]);(!n||!n.hasOwnProperty(e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;const n=this.refs[e];n!=null&&n.componentWillLeave?n.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;const n=this.refs[e];n!=null&&n.componentDidLeave&&n.componentDidLeave(),delete this.currentlyTransitioningKeys[e];const a=Gi(Ct(this.props.children)||[]);if(a&&a.hasOwnProperty(e))this.performEnter(e);else{const s=zg({},this.state.children);delete s[e],this.setState({children:s})}}render(e,t){let{childFactory:n,transitionLeave:a,transitionName:s,transitionAppear:o,transitionEnter:r,transitionLeaveTimeout:l,transitionEnterTimeout:c,transitionAppearTimeout:p,component:u,...h}=e,{children:g}=t;const m=Object.entries(g).map(v=>{let[f,y]=v;if(!y)return;const F=qg(this,f);return lu(n(y),{ref:F,key:f})}).filter(Boolean);return d(u,h,m)}}Wu.defaultProps={component:"span",childFactory:Vg};const Wg={version:"3.1.0"};class Gu extends ye{constructor(e,t){super(e,t),this.render=n=>d("div",{className:"uppy uppy-Informer"},d(Wu,null,n.info.map(a=>d(jg,{key:a.message},d("p",{role:"alert"},a.message," ",a.details&&d("span",{"aria-label":a.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${a.message}
|
|
24
24
|
|
|
25
25
|
${a.details}`)},"?")))))),this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}install(){const{target:e}=this.opts;e&&this.mount(e,this)}}Gu.VERSION=Wg.version;const Gg=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function Kg(i,e,t){var n,a;const s=Gg.exec(i),o=(n=(a=e.mimeType)!=null?a:s==null?void 0:s[1])!=null?n:"plain/text";let r;if((s==null?void 0:s[2])!=null){const l=atob(decodeURIComponent(s[3])),c=new Uint8Array(l.length);for(let p=0;p<l.length;p++)c[p]=l.charCodeAt(p);r=[c]}else(s==null?void 0:s[3])!=null&&(r=[decodeURIComponent(s[3])]);return t?new File(r,e.name||"",{type:o}):new Blob(r,{type:o})}function fl(i){return i.startsWith("blob:")}function X(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}var Ku=typeof self<"u"?self:Qo;const Rn=typeof navigator<"u",Xg=Rn&&typeof HTMLImageElement>"u",gl=!(typeof Qo>"u"||typeof us>"u"||!us.versions||!us.versions.node),Xu=Ku.Buffer,Qu=!!Xu,Qg=i=>i!==void 0;function Yu(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(Qg).length===0)}function be(i){let e=new Error(i);throw delete e.stack,e}function vl(i){let e=function(t){let n=0;return t.ifd0.enabled&&(n+=1024),t.exif.enabled&&(n+=2048),t.makerNote&&(n+=2048),t.userComment&&(n+=1024),t.gps.enabled&&(n+=512),t.interop.enabled&&(n+=100),t.ifd1.enabled&&(n+=1024),n+2048}(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}const Es=i=>String.fromCharCode.apply(null,i),bl=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0;class et{static from(e,t){return e instanceof this&&e.le===t?e:new et(e,void 0,void 0,t)}constructor(e,t=0,n,a){if(typeof a=="boolean"&&(this.le=a),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){n===void 0&&(n=e.byteLength-t);let s=new DataView(e,t,n);this._swapDataView(s)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof et){n===void 0&&(n=e.byteLength-t),(t+=e.byteOffset)+n>e.byteOffset+e.byteLength&&be("Creating view outside of available memory in ArrayBuffer");let s=new DataView(e.buffer,t,n);this._swapDataView(s)}else if(typeof e=="number"){let s=new DataView(new ArrayBuffer(e));this._swapDataView(s)}else be("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,n=et){return e instanceof DataView||e instanceof et?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||be("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new n(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new et(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return a=this.getUint8Array(e,t),bl?bl.decode(a):Qu?At.from(a).toString("utf8"):decodeURIComponent(escape(Es(a)));var a}getLatin1String(e=0,t=this.byteLength){let n=this.getUint8Array(e,t);return Es(n)}getUnicodeString(e=0,t=this.byteLength){const n=[];for(let a=0;a<t&&e+a<this.byteLength;a+=2)n.push(this.getUint16(e+a));return Es(n)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,n){switch(t){case 1:return this.getUint8(e,n);case 2:return this.getUint16(e,n);case 4:return this.getUint32(e,n);case 8:return this.getUint64&&this.getUint64(e,n)}}getUint(e,t,n){switch(t){case 8:return this.getUint8(e,n);case 16:return this.getUint16(e,n);case 32:return this.getUint32(e,n);case 64:return this.getUint64&&this.getUint64(e,n)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}}function ho(i,e){be(`${i} '${e}' was not loaded, try using full build of exifr.`)}class or extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||ho(this.kind,e),t&&(e in t||function(n,a){be(`Unknown ${n} '${a}'.`)}(this.kind,e),t[e].enabled||ho(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}}var Ju=new or("file parser"),Je=new or("segment parser"),rr=new or("file reader");let Yg=Ku.fetch;function yl(i,e){return(t=i).startsWith("data:")||t.length>1e4?fo(i,e,"base64"):gl&&i.includes("://")?mo(i,e,"url",xl):gl?fo(i,e,"fs"):Rn?mo(i,e,"url",xl):void be("Invalid input argument");var t}async function mo(i,e,t,n){return rr.has(t)?fo(i,e,t):n?async function(a,s){let o=await s(a);return new et(o)}(i,n):void be(`Parser ${t} is not loaded`)}async function fo(i,e,t){let n=new(rr.get(t))(i,e);return await n.read(),n}const xl=i=>Yg(i).then(e=>e.arrayBuffer()),go=i=>new Promise((e,t)=>{let n=new FileReader;n.onloadend=()=>e(n.result||new ArrayBuffer),n.onerror=t,n.readAsArrayBuffer(i)}),lr=new Map,Jg=new Map,Zg=new Map,oa=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],Zu=["jfif","xmp","icc","iptc","ihdr"],vo=["tiff",...Zu],ge=["ifd0","ifd1","exif","gps","interop"],ra=[...vo,...ge],la=["makerNote","userComment"],ep=["translateKeys","translateValues","reviveValues","multiSegment"],ca=[...ep,"sanitize","mergeOutput","silentErrors"];class tp{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}}class Ki extends tp{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,n,a){if(super(),X(this,"enabled",!1),X(this,"skip",new Set),X(this,"pick",new Set),X(this,"deps",new Set),X(this,"translateKeys",!1),X(this,"translateValues",!1),X(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(a),this.canBeFiltered=ge.includes(e),this.canBeFiltered&&(this.dict=lr.get(e)),n!==void 0)if(Array.isArray(n))this.parse=this.enabled=!0,this.canBeFiltered&&n.length>0&&this.translateTagSet(n,this.pick);else if(typeof n=="object"){if(this.enabled=!0,this.parse=n.parse!==!1,this.canBeFiltered){let{pick:s,skip:o}=n;s&&s.length>0&&this.translateTagSet(s,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(n)}else n===!0||n===!1?this.parse=this.enabled=n:be(`Invalid options argument: ${n}`)}applyInheritables(e){let t,n;for(t of ep)n=e[t],n!==void 0&&(this[t]=n)}translateTagSet(e,t){if(this.dict){let n,a,{tagKeys:s,tagValues:o}=this.dict;for(n of e)typeof n=="string"?(a=o.indexOf(n),a===-1&&(a=s.indexOf(Number(n))),a!==-1&&t.add(Number(s[a]))):t.add(n)}else for(let n of e)t.add(n)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,qa(this.pick,this.deps)):this.enabled&&this.pick.size>0&&qa(this.pick,this.deps)}}var Fe={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},wl=new Map;class cr extends tp{static useCached(e){let t=wl.get(e);return t!==void 0||(t=new this(e),wl.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):be(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=Rn?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of oa)this[e]=Fe[e];for(e of ca)this[e]=Fe[e];for(e of la)this[e]=Fe[e];for(e of ra)this[e]=new Ki(e,Fe[e],void 0,this)}setupFromTrue(){let e;for(e of oa)this[e]=Fe[e];for(e of ca)this[e]=Fe[e];for(e of la)this[e]=!0;for(e of ra)this[e]=new Ki(e,!0,void 0,this)}setupFromArray(e){let t;for(t of oa)this[t]=Fe[t];for(t of ca)this[t]=Fe[t];for(t of la)this[t]=Fe[t];for(t of ra)this[t]=new Ki(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,ge)}setupFromObject(e){let t;for(t of(ge.ifd0=ge.ifd0||ge.image,ge.ifd1=ge.ifd1||ge.thumbnail,Object.assign(this,e),oa))this[t]=ks(e[t],Fe[t]);for(t of ca)this[t]=ks(e[t],Fe[t]);for(t of la)this[t]=ks(e[t],Fe[t]);for(t of vo)this[t]=new Ki(t,Fe[t],e[t],this);for(t of ge)this[t]=new Ki(t,Fe[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,ge,ra),e.tiff===!0?this.batchEnableWithBool(ge,!0):e.tiff===!1?this.batchEnableWithUserValue(ge,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,ge):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,ge)}batchEnableWithBool(e,t){for(let n of e)this[n].enabled=t}batchEnableWithUserValue(e,t){for(let n of e){let a=t[n];this[n].enabled=a!==!1&&a!==void 0}}setupGlobalFilters(e,t,n,a=n){if(e&&e.length){for(let o of a)this[o].enabled=!1;let s=Pl(e,n);for(let[o,r]of s)qa(this[o].pick,r),this[o].enabled=!0}else if(t&&t.length){let s=Pl(t,n);for(let[o,r]of s)qa(this[o].skip,r)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:n,iptc:a,icc:s}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),n.enabled||e.skip.add(700),a.enabled||e.skip.add(33723),s.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:n,interop:a}=this;a.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),n.needed&&e.deps.add(34853),this.tiff.enabled=ge.some(s=>this[s].enabled===!0)||this.makerNote||this.userComment;for(let s of ge)this[s].finalizeFilters()}get onlyTiff(){return!Zu.map(e=>this[e].enabled).some(e=>e===!0)&&this.tiff.enabled}checkLoadedPlugins(){for(let e of vo)this[e].enabled&&!Je.has(e)&&ho("segment parser",e)}}function Pl(i,e){let t,n,a,s,o=[];for(a of e){for(s of(t=lr.get(a),n=[],t))(i.includes(s[0])||i.includes(s[1]))&&n.push(s[0]);n.length&&o.push([a,n])}return o}function ks(i,e){return i!==void 0?i:e!==void 0?e:void 0}function qa(i,e){for(let t of e)i.add(t)}X(cr,"default",Fe);class ev{constructor(e){X(this,"parsers",{}),X(this,"output",{}),X(this,"errors",[]),X(this,"pushToErrors",t=>this.errors.push(t)),this.options=cr.useCached(e)}async read(e){this.file=await function(t,n){return typeof t=="string"?yl(t,n):Rn&&!Xg&&t instanceof HTMLImageElement?yl(t.src,n):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new et(t):Rn&&t instanceof Blob?mo(t,n,"blob",go):void be("Invalid input argument")}(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[n,a]of Ju)if(a.canHandle(e,t))return this.fileParser=new a(this.options,this.file,this.parsers),e[n]=!0;this.file.close&&this.file.close(),be("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),Yu(n=e)?void 0:n;var n}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map(async n=>{let a=await n.parse();n.assignToOutput(e,a)});this.options.silentErrors&&(t=t.map(n=>n.catch(this.pushToErrors))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,n=Je.get("tiff",e);var a;if(t.tiff?a={start:0,type:"tiff"}:t.jpeg&&(a=await this.fileParser.getOrFindSegment("tiff")),a===void 0)return;let s=await this.fileParser.ensureSegmentChunk(a),o=this.parsers.tiff=new n(s,e,t),r=await o.extractThumbnail();return t.close&&t.close(),r}}class hi{static findPosition(e,t){let n=e.getUint16(t+2)+2,a=typeof this.headerLength=="function"?this.headerLength(e,t,n):this.headerLength,s=t+a,o=n-a;return{offset:t,length:n,headerLength:a,start:s,size:o,end:s+o}}static parse(e,t={}){return new this(e,new cr({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof et?e:new et(e)}constructor(e,t={},n){X(this,"errors",[]),X(this,"raw",new Map),X(this,"handleError",a=>{if(!this.options.silentErrors)throw a;this.errors.push(a.message)}),this.chunk=this.normalizeInput(e),this.file=n,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let n=Zg.get(t),a=Jg.get(t),s=lr.get(t),o=this.options[t],r=o.reviveValues&&!!n,l=o.translateValues&&!!a,c=o.translateKeys&&!!s,p={};for(let[u,h]of e)r&&n.has(u)?h=n.get(u)(h):l&&a.has(u)&&(h=this.translateValue(h,a.get(u))),c&&s.has(u)&&(u=s.get(u)||u),p[u]=h;return p}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,n){if(this.globalOptions.mergeOutput)return Object.assign(e,n);e[t]?Object.assign(e[t],n):e[t]=n}}X(hi,"headerLength",4),X(hi,"type",void 0),X(hi,"multiSegment",!1),X(hi,"canHandle",()=>!1);function tv(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function iv(i){return i>=224&&i<=239}function nv(i,e,t){for(let[n,a]of Je)if(a.canHandle(i,e,t))return n}class Sl extends class{constructor(e,t,n){X(this,"errors",[]),X(this,"ensureSegmentChunk",async a=>{let s=a.start,o=a.size||65536;if(this.file.chunked)if(this.file.available(s,o))a.chunk=this.file.subarray(s,o);else try{a.chunk=await this.file.readChunk(s,o)}catch(r){be(`Couldn't read segment: ${JSON.stringify(a)}. ${r.message}`)}else this.file.byteLength>s+o?a.chunk=this.file.subarray(s,o):a.size===void 0?a.chunk=this.file.subarray(s):be("Segment unreachable: "+JSON.stringify(a));return a.chunk}),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=n}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let n=new(Je.get(e))(t,this.options,this.file);return this.parsers[e]=n}createParsers(e){for(let t of e){let{type:n,chunk:a}=t,s=this.options[n];if(s&&s.enabled){let o=this.parsers[n];o&&o.append||o||this.createParser(n,a)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{constructor(...e){super(...e),X(this,"appSegments",[]),X(this,"jpegSegments",[]),X(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(Je.keyList())):(e=e===void 0?Je.keyList().filter(t=>this.options[t].enabled):e.filter(t=>this.options[t].enabled&&Je.has(t)),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:n,findAll:a,wanted:s,remaining:o}=this;if(!a&&this.file.chunked&&(a=Array.from(s).some(r=>{let l=Je.get(r),c=this.options[r];return l.multiSegment&&c.multiSegment}),a&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,n.byteLength),!this.options.onlyTiff&&n.chunked){let r=!1;for(;o.size>0&&!r&&(n.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=n,c=this.appSegments.some(p=>!this.file.available(p.offset||p.start,p.length||p.size));if(r=e>l&&!c?!await n.readNextChunk(e):!await n.readNextChunk(l),(e=this.findAppSegmentsInRange(e,n.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let n,a,s,o,r,l,{file:c,findAll:p,wanted:u,remaining:h,options:g}=this;for(;e<t;e++)if(c.getUint8(e)===255){if(n=c.getUint8(e+1),iv(n)){if(a=c.getUint16(e+2),s=nv(c,e,a),s&&u.has(s)&&(o=Je.get(s),r=o.findPosition(c,e),l=g[s],r.type=s,this.appSegments.push(r),!p&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=r.chunkNumber<r.chunkCount,this.unfinishedMultiSegment||h.delete(s)):h.delete(s),h.size===0)))break;g.recordUnknownSegments&&(r=hi.findPosition(c,e),r.marker=n,this.unknownSegments.push(r)),e+=a+1}else if(tv(n)){if(a=c.getUint16(e+2),n===218&&g.stopAfterSos!==!1)return;g.recordJpegSegments&&this.jpegSegments.push({offset:e,length:a,marker:n}),e+=a+1}}return e}mergeMultiSegments(){if(!this.appSegments.some(t=>t.multiSegment))return;let e=function(t,n){let a,s,o,r=new Map;for(let l=0;l<t.length;l++)a=t[l],s=a[n],r.has(s)?o=r.get(s):r.set(s,o=[]),o.push(a);return Array.from(r)}(this.appSegments,"type");this.mergedAppSegments=e.map(([t,n])=>{let a=Je.get(t,this.options);return a.handleMultiSegments?{type:t,chunk:a.handleMultiSegments(n)}:n[0]})}getSegment(e){return this.appSegments.find(t=>t.type===e)}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}}X(Sl,"type","jpeg"),Ju.set("jpeg",Sl);const av=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4];class sv extends hi{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,n=new Map){let{pick:a,skip:s}=this.options[t];a=new Set(a);let o=a.size>0,r=s.size===0,l=this.chunk.getUint16(e);e+=2;for(let c=0;c<l;c++){let p=this.chunk.getUint16(e);if(o){if(a.has(p)&&(n.set(p,this.parseTag(e,p,t)),a.delete(p),a.size===0))break}else!r&&s.has(p)||n.set(p,this.parseTag(e,p,t));e+=12}return n}parseTag(e,t,n){let{chunk:a}=this,s=a.getUint16(e+2),o=a.getUint32(e+4),r=av[s];if(r*o<=4?e+=8:e=a.getUint32(e+8),(s<1||s>13)&&be(`Invalid TIFF value type. block: ${n.toUpperCase()}, tag: ${t.toString(16)}, type: ${s}, offset ${e}`),e>a.byteLength&&be(`Invalid TIFF value offset. block: ${n.toUpperCase()}, tag: ${t.toString(16)}, type: ${s}, offset ${e} is outside of chunk size ${a.byteLength}`),s===1)return a.getUint8Array(e,o);if(s===2)return(l=function(c){for(;c.endsWith("\0");)c=c.slice(0,-1);return c}(l=a.getString(e,o)).trim())===""?void 0:l;var l;if(s===7)return a.getUint8Array(e,o);if(o===1)return this.parseTagValue(s,e);{let c=new(function(u){switch(u){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}}(s))(o),p=r;for(let u=0;u<o;u++)c[u]=this.parseTagValue(s,e),e+=p;return c}}parseTagValue(e,t){let{chunk:n}=this;switch(e){case 1:return n.getUint8(t);case 3:return n.getUint16(t);case 4:return n.getUint32(t);case 5:return n.getUint32(t)/n.getUint32(t+4);case 6:return n.getInt8(t);case 8:return n.getInt16(t);case 9:return n.getInt32(t);case 10:return n.getInt32(t)/n.getInt32(t+4);case 11:return n.getFloat(t);case 12:return n.getDouble(t);case 13:return n.getUint32(t);default:be(`Invalid tiff type ${e}`)}}}class Ts extends sv{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let n=new Map;return this[t]=n,this.parseTags(e,t,n),n}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&be("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&be(`IFD0 offset points to outside of file.
|
|
26
|
-
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,vl(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,vl(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let n=e.get(t);n&&n.length===1&&e.set(t,n[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",Fl(...e.get(2),e.get(1))),e.set("longitude",Fl(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,n,a={};for(t of ge)if(e=this[t],!Yu(e))if(n=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(a,n)}else a[t]=n;return this.makerNote&&(a.makerNote=this.makerNote),this.userComment&&(a.userComment=this.userComment),a}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[n,a]of Object.entries(t))this.assignObjectToOutput(e,n,a)}}function Fl(i,e,t,n){var a=i+e/60+t/3600;return n!=="S"&&n!=="W"||(a*=-1),a}X(Ts,"type","tiff"),X(Ts,"headerLength",10),Je.set("tiff",Ts);const ur={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1};Object.assign({},ur,{firstChunkSize:4e4,gps:[1,2,3,4]});Object.assign({},ur,{tiff:!1,ifd1:!0,mergeOutput:!1});const ov=Object.assign({},ur,{firstChunkSize:4e4,ifd0:[274]});async function rv(i){let e=new ev(ov);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}const lv=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}});let rn=!0,ln=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,n]=e;rn=Number(t)+.1*Number(n)<13.4,ln=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);rn=ln=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);rn=ln=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);rn=ln=Number(e)<77}}async function cv(i){let e=await rv(i);return Object.assign({canvas:rn,css:ln},lv[e])}class uv extends et{constructor(...e){super(...e),X(this,"ranges",new pv),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,n){if(e===0&&this.byteLength===0&&n){let a=new DataView(n.buffer||n,n.byteOffset,n.byteLength);this._swapDataView(a)}else{let a=e+t;if(a>this.byteLength){let{dataView:s}=this._extend(a);this._swapDataView(s)}}}_extend(e){let t;t=Qu?Xu.allocUnsafe(e):new Uint8Array(e);let n=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:n}}subarray(e,t,n=!1){return t=t||this._lengthToEnd(e),n&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,n=!1){n&&this._tryExtend(t,e.byteLength,e);let a=super.set(e,t);return this.ranges.add(t,a.byteLength),a}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}}class pv{constructor(){X(this,"list",[])}get length(){return this.list.length}add(e,t,n=0){let a=e+t,s=this.list.filter(o=>_l(e,o.offset,a)||_l(e,o.end,a));if(s.length>0){e=Math.min(e,...s.map(r=>r.offset)),a=Math.max(a,...s.map(r=>r.end)),t=a-e;let o=s.shift();o.offset=e,o.length=t,o.end=a,this.list=this.list.filter(r=>!s.includes(r))}else this.list.push({offset:e,length:t,end:a})}available(e,t){let n=e+t;return this.list.some(a=>a.offset<=e&&n<=a.end)}}function _l(i,e,t){return i<=e&&e<=t}class dv extends uv{constructor(e,t){super(0),X(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,n=await this.readChunk(e,t);return!!n&&n.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}}rr.set("blob",class extends dv{async readWhole(){this.chunked=!1;let i=await go(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,n=this.input.slice(i,t),a=await go(n);return this.set(a,i,!0)}});const hv={strings:{generatingThumbnails:"Generating thumbnails..."}},mv={version:"3.1.0"};function fv(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(n){if(n.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(n=>{i.toBlob(n,e,t)}).then(n=>{if(n===null)throw new Error("cannot read image, probably an svg with external resources");return n}):Promise.resolve().then(()=>Kg(i.toDataURL(e,t),{})).then(n=>{if(n===null)throw new Error("could not extract blob, probably an old browser");return n})}function gv(i,e){let t=i.width,n=i.height;(e.deg===90||e.deg===270)&&(t=i.height,n=i.width);const a=document.createElement("canvas");a.width=t,a.height=n;const s=a.getContext("2d");return s.translate(t/2,n/2),e.canvas&&(s.rotate(e.rad),s.scale(e.scaleX,e.scaleY)),s.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),a}function vv(i){const e=i.width/i.height,t=5e6,n=4096;let a=Math.floor(Math.sqrt(t*e)),s=Math.floor(t/Math.sqrt(t*e));if(a>n&&(a=n,s=Math.round(a/e)),s>n&&(s=n,a=Math.round(e*s)),i.width>a){const o=document.createElement("canvas");return o.width=a,o.height=s,o.getContext("2d").drawImage(i,0,0,a,s),o}return i}const bv={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1};class pr extends ye{constructor(e,t){if(super(e,{...bv,...t}),this.onFileAdded=n=>{!n.preview&&n.data&&$a(n.type)&&!n.isRemote&&this.addToQueue(n.id)},this.onCancelRequest=n=>{const a=this.queue.indexOf(n.id);a!==-1&&this.queue.splice(a,1)},this.onFileRemoved=n=>{const a=this.queue.indexOf(n.id);a!==-1&&this.queue.splice(a,1),n.preview&&fl(n.preview)&&URL.revokeObjectURL(n.preview)},this.onRestored=()=>{this.uppy.getFiles().filter(a=>a.isRestored).forEach(a=>{(!a.preview||fl(a.preview))&&this.addToQueue(a.id)})},this.onAllFilesRemoved=()=>{this.queue=[]},this.waitUntilAllProcessed=n=>{n.forEach(s=>{const o=this.uppy.getFile(s);this.uppy.emit("preprocess-progress",o,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});const a=()=>{n.forEach(s=>{const o=this.uppy.getFile(s);this.uppy.emit("preprocess-complete",o)})};return new Promise(s=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{a(),s()}):(a(),s())})},this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=hv,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,n){const a=URL.createObjectURL(e.data),s=new Promise((r,l)=>{const c=new Image;c.src=a,c.addEventListener("load",()=>{URL.revokeObjectURL(a),r(c)}),c.addEventListener("error",p=>{URL.revokeObjectURL(a),l(p.error||new Error("Could not create thumbnail"))})}),o=cv(e.data).catch(()=>1);return Promise.all([s,o]).then(r=>{let[l,c]=r;const p=this.getProportionalDimensions(l,t,n,c.deg),u=gv(l,c),h=this.resizeImage(u,p.width,p.height);return fv(h,this.thumbnailType,80)}).then(r=>URL.createObjectURL(r))}getProportionalDimensions(e,t,n,a){let s=e.width/e.height;return(a===90||a===270)&&(s=e.height/e.width),t!=null?{width:t,height:Math.round(t/s)}:n!=null?{width:Math.round(n*s),height:n}:{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/s)}}resizeImage(e,t,n){let a=vv(e),s=Math.ceil(Math.log2(a.width/t));s<1&&(s=1);let o=t*2**(s-1),r=n*2**(s-1);const l=2;for(;s--;){const c=document.createElement("canvas");c.width=o,c.height=r,c.getContext("2d").drawImage(a,0,0,o,r),a=c,o=Math.round(o/l),r=Math.round(r/l)}return a}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){const e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return $a(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}}pr.VERSION=mv.version;function Cl(i){if(typeof i=="string"){const e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&wu(i)?[i]:null}function ip(i,e,t,n){let{onSuccess:a}=n;i.readEntries(s=>{const o=[...e,...s];s.length?queueMicrotask(()=>{ip(i,o,t,{onSuccess:a})}):a(o)},s=>{t(s),a(e)})}function np(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,n)=>i.file(t,n))},async*values(){const t=i.createReader();yield*await new Promise(a=>{ip(t,[],e,{onSuccess:s=>a(s.map(o=>np(o,e)))})})},isSameEntry:void 0}}function ap(i,e,t){try{return t===void 0&&(t=void 0),async function*(){const n=()=>`${e}/${i.name}`;if(i.kind==="file"){const a=await i.getFile();a!=null?(a.relativePath=e?n():null,yield a):t!=null&&(yield t)}else if(i.kind==="directory")for await(const a of i.values())yield*ap(a,e?n():i.name);else t!=null&&(yield t)}()}catch(n){return Promise.reject(n)}}async function*yv(i,e){const t=await Promise.all(Array.from(i.items,async n=>{var a;let s;const o=()=>typeof n.getAsEntry=="function"?n.getAsEntry():n.webkitGetAsEntry();return(a=s)!=null||(s=np(o(),e)),{fileSystemHandle:s,lastResortFile:n.getAsFile()}}));for(const{lastResortFile:n,fileSystemHandle:a}of t)if(a!=null)try{yield*ap(a,"",n)}catch(s){n!=null?yield n:e(s)}else n!=null&&(yield n)}function xv(i){const e=rt(i.files);return Promise.resolve(e)}async function dr(i,e){var t;const n=(t=e==null?void 0:e.logDropError)!=null?t:Function.prototype;try{const a=[];for await(const s of yv(i,n))a.push(s);return a}catch{return xv(i)}}const sp=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];function op(i,e){if(e){const t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function El(i,e){const t=e[0];t&&(t.focus(),i.preventDefault())}function wv(i,e){const t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function Pv(i){return i.contains(document.activeElement)}function rp(i,e,t){const n=op(t,e),a=rt(n.querySelectorAll(sp)),s=a.indexOf(document.activeElement);Pv(n)?i.shiftKey&&s===0?wv(i,a):!i.shiftKey&&s===a.length-1&&El(i,a):El(i,a)}function Sv(i,e,t){e===null||rp(i,e,t)}function Fv(){let i=!1;return to((t,n)=>{const a=op(t,n),s=a.contains(document.activeElement);if(s&&i)return;const o=a.querySelector("[data-uppy-super-focusable]");if(!(s&&!o))if(o)o.focus({preventScroll:!0}),i=!0;else{const r=a.querySelector(sp);r==null||r.focus({preventScroll:!0}),i=!1}},260)}function lp(){const i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var _v=function(e,t){if(e===t)return!0;for(var n in e)if(!(n in t))return!1;for(var n in t)if(e[n]!==t[n])return!1;return!0};const Cv=tt(_v);function Ev(){return d("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25"},d("g",{fill:"#686DE0",fillRule:"evenodd"},d("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),d("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),d("circle",{cx:"7.5",cy:"9.5",r:"1.5"})))}function kv(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"}))}function Tv(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"}))}function Ov(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"}))}function Av(){return d("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"}))}function Dv(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("g",{fill:"#A7AFB7",fillRule:"nonzero"},d("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),d("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})))}function Rv(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"}))}function hr(i){const e={color:"#838999",icon:Dv()};if(!i)return e;const t=i.split("/")[0],n=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:Rv()}:t==="image"?{color:"#686de0",icon:Ev()}:t==="audio"?{color:"#068dbb",icon:kv()}:t==="video"?{color:"#19af67",icon:Tv()}:t==="application"&&n==="pdf"?{color:"#e25149",icon:Ov()}:t==="application"&&["zip","x-7z-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(n)!==-1?{color:"#00C469",icon:Av()}:e}function cp(i){const{file:e}=i;if(e.preview)return d("img",{className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});const{color:t,icon:n}=hr(e.type);return d("div",{className:"uppy-Dashboard-Item-previewIconWrap"},d("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t}},n),d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76"},d("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})))}const Iv=(i,e)=>(typeof e=="function"?e():e).filter(a=>a.id===i)[0].name;function up(i){const{file:e,toggleFileCard:t,i18n:n,metaFields:a}=i,{missingRequiredMetaFields:s}=e;if(!(s!=null&&s.length))return null;const o=s.map(r=>Iv(r,a)).join(", ");return d("div",{className:"uppy-Dashboard-Item-errorMessage"},n("missingRequiredMetaFields",{smart_count:s.length,fields:o})," ",d("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id)},n("editFile")))}function Uv(i){const{file:e,i18n:t,toggleFileCard:n,metaFields:a,showLinkToFileUploadResult:s}=i,r=e.preview?"rgba(255, 255, 255, 0.5)":hr(e.type).color;return d("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:r}},s&&e.uploadURL&&d("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name},d("span",{hidden:!0},e.meta.name)),d(cp,{file:e}),d(up,{file:e,i18n:t,toggleFileCard:n,metaFields:a}))}function Nv(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function kl(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function Os(i){return d("div",{className:"uppy-Dashboard-Item-progress"},d("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":kl(i),title:kl(i),onClick:()=>Nv(i)},i.children))}function ua(i){let{children:e}=i;return d("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle"},e)}function As(i){let{progress:e}=i;const t=2*Math.PI*15;return d("g",null,d("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),d("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":t,"stroke-dashoffset":t-t/100*e}))}function Lv(i){if(!i.file.progress.uploadStarted)return null;if(i.isUploaded)return d("div",{className:"uppy-Dashboard-Item-progress"},d("div",{className:"uppy-Dashboard-Item-progressIndicator"},d(ua,null,d("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),d("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"}))));if(!i.recoveredState)return i.error&&!i.hideRetryButton?d(Os,i,d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19"},d("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),d("path",{d:"M7.9 3H10v2H7.9z"}),d("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),d("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"}))):i.resumableUploads&&!i.hidePauseResumeButton?d(Os,i,d(ua,null,d(As,{progress:i.file.progress.percentage}),i.file.isPaused?d("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):d("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)"},d("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),d("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})))):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?d(Os,i,d(ua,null,d(As,{progress:i.file.progress.percentage}),d("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"}))):d("div",{className:"uppy-Dashboard-Item-progress"},d("div",{className:"uppy-Dashboard-Item-progressIndicator"},d(ua,null,d(As,{progress:i.file.progress.percentage}))))}const Ds="...";function pp(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=Ds.length+1)return`${i.slice(0,e-1)}…`;const t=e-Ds.length,n=Math.ceil(t/2),a=Math.floor(t/2);return i.slice(0,n)+Ds+i.slice(-a)}const Bv=i=>{const{author:e,name:t}=i.file.meta;function n(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return d("div",{className:"uppy-Dashboard-Item-name",title:t},pp(t,n()))},Mv=i=>{var e;const{author:t}=i.file.meta,n=(e=i.file.remote)==null?void 0:e.providerName,a="·";return t?d("div",{className:"uppy-Dashboard-Item-author"},d("a",{href:`${t.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer"},pp(t.name,13)),n?d(ot,null,` ${a} `,n,` ${a} `):null):null},jv=i=>i.file.size&&d("div",{className:"uppy-Dashboard-Item-statusSize"},vi(i.file.size)),zv=i=>i.file.isGhost&&d("span",null," • ",d("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:i.toggleAddFilesPanel},i.i18n("reSelect"))),$v=i=>{let{file:e,onClick:t}=i;return e.error?d("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":e.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:t,type:"button"},"?"):null};function qv(i){const{file:e}=i;return d("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source},d("div",{className:"uppy-Dashboard-Item-fileName"},Bv(i),d($v,{file:i.file,onClick:()=>alert(i.file.error)})),d("div",{className:"uppy-Dashboard-Item-status"},Mv(i),jv(i),zv(i)),d(up,{file:i.file,i18n:i.i18n,toggleFileCard:i.toggleFileCard,metaFields:i.metaFields}))}function Hv(i,e){return e===void 0&&(e="Copy the URL below"),new Promise(t=>{const n=document.createElement("textarea");n.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),n.value=i,document.body.appendChild(n),n.select();const a=s=>{document.body.removeChild(n),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(n),t()):a("copy command unavailable")}catch{return document.body.removeChild(n),a()}})}function Vv(i){let{file:e,uploadInProgressOrComplete:t,metaFields:n,canEditFile:a,i18n:s,onClick:o}=i;return!t&&n&&n.length>0||!t&&a(e)?d("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:e.meta.name}),title:s("editFileWithFilename",{file:e.meta.name}),onClick:()=>o()},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14"},d("g",{fillRule:"evenodd"},d("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),d("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),d("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})))):null}function Wv(i){let{i18n:e,onClick:t,file:n}=i;return d("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":e("removeFile",{file:n.meta.name}),title:e("removeFile",{file:n.meta.name}),onClick:()=>t()},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18"},d("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),d("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})))}const Gv=(i,e)=>{Hv(e.file.uploadURL,e.i18n("copyLinkToClipboardFallback")).then(()=>{e.uppy.log("Link copied to clipboard."),e.uppy.info(e.i18n("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.uppy.log).then(()=>i.target.focus({preventScroll:!0}))};function Kv(i){const{i18n:e}=i;return d("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":e("copyLink"),title:e("copyLink"),onClick:t=>Gv(t,i)},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12"},d("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})))}function Xv(i){const{uppy:e,file:t,uploadInProgressOrComplete:n,canEditFile:a,metaFields:s,showLinkToFileUploadResult:o,showRemoveButton:r,i18n:l,toggleFileCard:c,openFileEditor:p}=i;return d("div",{className:"uppy-Dashboard-Item-actionWrapper"},d(Vv,{i18n:l,file:t,uploadInProgressOrComplete:n,canEditFile:a,metaFields:s,onClick:()=>{s&&s.length>0?c(!0,t.id):p(t)}}),o&&t.uploadURL?d(Kv,{file:t,uppy:e,i18n:l}):null,r?d(Wv,{i18n:l,file:t,uppy:e,onClick:()=>e.removeFile(t.id,"removed-by-user")}):null)}class Qv extends dt{componentDidMount(){const{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!Cv(this.props,e)}componentDidUpdate(){const{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){const{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){const{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,n=e.progress.uploadComplete&&!t&&!e.error,a=e.progress.uploadStarted||t,s=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:r}=e;let l=(this.props.individualCancellation||!s)&&!n;n&&this.props.showRemoveButtonAfterComplete&&(l=!0);const c=fe({"uppy-Dashboard-Item":!0,"is-inprogress":s&&!this.props.recoveredState,"is-processing":t,"is-complete":n,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":r});return d("div",{className:c,id:`uppy_${e.id}`,role:this.props.role},d("div",{className:"uppy-Dashboard-Item-preview"},d(Uv,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),d(Lv,{uppy:this.props.uppy,file:e,error:o,isUploaded:n,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,showRemoveButtonAfterComplete:this.props.showRemoveButtonAfterComplete,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})),d("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons"},d(qv,{file:e,id:this.props.id,acquirers:this.props.acquirers,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),d(Xv,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:a,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})))}}function Yv(i,e){const t=[];let n=[];return i.forEach(a=>{n.length<e?n.push(a):(t.push(n),n=[a])}),n.length&&t.push(n),t}function Jv(i){let{id:e,error:t,i18n:n,uppy:a,files:s,acquirers:o,resumableUploads:r,hideRetryButton:l,hidePauseResumeButton:c,hideCancelButton:p,showLinkToFileUploadResult:u,showRemoveButtonAfterComplete:h,isWide:g,metaFields:m,isSingleFile:v,toggleFileCard:f,handleRequestThumbnail:y,handleCancelThumbnail:F,recoveredState:S,individualCancellation:A,itemsPerRow:D,openFileEditor:x,canEditFile:_,toggleAddFilesPanel:O,containerWidth:L,containerHeight:z}=i;const K=D===1?71:200,Z=Wn(()=>{const j=(P,b)=>s[b].isGhost-s[P].isGhost,$=Object.keys(s);return S&&$.sort(j),Yv($,D)},[s,D,S]),G=j=>d("div",{class:"uppy-Dashboard-filesInner",role:"presentation",key:j[0]},j.map($=>d(Qv,{key:$,uppy:a,id:e,error:t,i18n:n,acquirers:o,resumableUploads:r,individualCancellation:A,hideRetryButton:l,hidePauseResumeButton:c,hideCancelButton:p,showLinkToFileUploadResult:u,showRemoveButtonAfterComplete:h,isWide:g,metaFields:m,recoveredState:S,isSingleFile:v,containerWidth:L,containerHeight:z,toggleFileCard:f,handleRequestThumbnail:y,handleCancelThumbnail:F,role:"listitem",openFileEditor:x,canEditFile:_,toggleAddFilesPanel:O,file:s[$]})));return v?d("div",{class:"uppy-Dashboard-files"},G(Z[0])):d(ar,{class:"uppy-Dashboard-files",role:"list",data:Z,renderRow:G,rowHeight:K})}let dp;dp=Symbol.for("uppy test: disable unused locale key warning");class hp extends dt{constructor(){super(...arguments),this.triggerFileInputClick=()=>{this.fileInput.click()},this.triggerFolderInputClick=()=>{this.folderInput.click()},this.triggerVideoCameraInputClick=()=>{this.mobileVideoFileInput.click()},this.triggerPhotoCameraInputClick=()=>{this.mobilePhotoFileInput.click()},this.onFileInputChange=e=>{this.props.handleInputChange(e),e.target.value=null},this.renderHiddenInput=(e,t)=>d("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes,ref:t}),this.renderHiddenCameraInput=(e,t,n)=>{const s={photo:"image/*",video:"video/*"}[e];return d("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t,accept:s,ref:n})},this.renderMyDeviceAcquirer=()=>d("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick},d("div",{className:"uppy-DashboardTab-inner"},d("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"}))),d("div",{className:"uppy-DashboardTab-name"},this.props.i18n("myDevice")))),this.renderPhotoCamera=()=>d("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick},d("div",{className:"uppy-DashboardTab-inner"},d("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"}))),d("div",{className:"uppy-DashboardTab-name"},this.props.i18n("takePictureBtn")))),this.renderVideoCamera=()=>d("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick},d("div",{className:"uppy-DashboardTab-inner"},d("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "}))),d("div",{className:"uppy-DashboardTab-name"},this.props.i18n("recordVideoBtn")))),this.renderBrowseButton=(e,t)=>{const n=this.props.acquirers.length;return d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":n===0},e)},this.renderDropPasteBrowseTagline=e=>{const t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),n=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),a=this.props.fileManagerSelectionType,s=a.charAt(0).toUpperCase()+a.slice(1);return d("div",{class:"uppy-Dashboard-AddFiles-title"},this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${s}`,{browseFiles:t,browseFolders:n,browse:t}):this.props.i18nArray(`dropPaste${s}`,{browseFiles:t,browseFolders:n,browse:t}))},this.renderAcquirer=e=>{var t;return d("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":((t=this.props.activePickerPanel)==null?void 0:t.id)===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id)},d("div",{className:"uppy-DashboardTab-inner"},e.icon()),d("div",{className:"uppy-DashboardTab-name"},e.name)))},this.renderAcquirers=e=>{const t=[...e],n=t.splice(e.length-2,e.length);return d(ot,null,t.map(a=>this.renderAcquirer(a)),d("span",{role:"presentation",style:{"white-space":"nowrap"}},n.map(a=>this.renderAcquirer(a))))},this.renderSourcesList=(e,t)=>{const{showNativePhotoCameraButton:n,showNativeVideoCameraButton:a}=this.props;let s=[];const o="myDevice";t||s.push({key:o,elements:this.renderMyDeviceAcquirer()}),n&&s.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),a&&s.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),s.push(...e.map(u=>({key:u.id,elements:this.renderAcquirer(u)}))),s.length===1&&s[0].key===o&&(s=[]);const l=[...s],c=l.splice(s.length-2,s.length),p=u=>u.map(h=>{let{key:g,elements:m}=h;return d(ot,{key:g},m)});return d(ot,null,this.renderDropPasteBrowseTagline(s.length),d("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist"},p(l),d("span",{role:"presentation",style:{"white-space":"nowrap"}},p(c))))}}[dp](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderPoweredByUppy(){const{i18nArray:e}=this.props,t=d("span",null,d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11"},d("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})),d("span",{className:"uppy-Dashboard-poweredByUppy"},"Uppy")),n=e("poweredBy",{uppy:t});return d("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy"},n)}render(){const{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:n}=this.props;return d("div",{className:"uppy-Dashboard-AddFiles"},this.renderHiddenInput(!1,a=>{this.fileInput=a}),this.renderHiddenInput(!0,a=>{this.folderInput=a}),e&&this.renderHiddenCameraInput("photo",n,a=>{this.mobilePhotoFileInput=a}),t&&this.renderHiddenCameraInput("video",n,a=>{this.mobileVideoFileInput=a}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),d("div",{className:"uppy-Dashboard-AddFiles-info"},this.props.note&&d("div",{className:"uppy-Dashboard-note"},this.props.note),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy(this.props)))}}const Zv=i=>d("div",{className:fe("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel},d("div",{className:"uppy-DashboardContent-bar"},d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},i.i18n("addingMoreFiles")),d("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1)},i.i18n("back"))),d(hp,i));function Bt(i){const{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}function eb(i){let{activePickerPanel:e,className:t,hideAllPanels:n,i18n:a,state:s,uppy:o}=i;return d("div",{className:fe("uppy-DashboardContent-panel",t),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${e.id}`,onDragOver:Bt,onDragLeave:Bt,onDrop:Bt,onPaste:Bt},d("div",{className:"uppy-DashboardContent-bar"},d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},a("importFrom",{name:e.name})),d("button",{className:"uppy-DashboardContent-back",type:"button",onClick:n},a("cancel"))),d("div",{className:"uppy-DashboardContent-panelBody"},o.getPlugin(e.id).render(s)))}function tb(i){const e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return d("div",{className:fe("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor"},d("div",{className:"uppy-DashboardContent-bar"},d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},i.i18nArray("editing",{file:d("span",{className:"uppy-DashboardContent-titleFile"},e.meta?e.meta.name:e.name)})),d("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t},i.i18n("cancel")),d("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor},i.i18n("save"))),d("div",{className:"uppy-DashboardContent-panelBody"},i.editors.map(n=>i.uppy.getPlugin(n.id).render(i.state))))}const nt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function ib(i,e,t,n){if(n===void 0&&(n={}),i)return nt.STATE_ERROR;if(e)return nt.STATE_COMPLETE;if(t)return nt.STATE_PAUSED;let a=nt.STATE_WAITING;const s=Object.keys(n);for(let o=0;o<s.length;o++){const{progress:r}=n[s[o]];if(r.uploadStarted&&!r.uploadComplete)return nt.STATE_UPLOADING;r.preprocess&&a!==nt.STATE_UPLOADING&&(a=nt.STATE_PREPROCESSING),r.postprocess&&a!==nt.STATE_UPLOADING&&a!==nt.STATE_PREPROCESSING&&(a=nt.STATE_POSTPROCESSING)}return a}function nb(i){let{files:e,i18n:t,isAllComplete:n,isAllErrored:a,isAllPaused:s,inProgressNotPausedFiles:o,newFiles:r,processingFiles:l}=i;switch(ib(a,n,s,e)){case"uploading":return t("uploadingXFiles",{smart_count:o.length});case"preprocessing":case"postprocessing":return t("processingXFiles",{smart_count:l.length});case"paused":return t("uploadPaused");case"waiting":return t("xFilesSelected",{smart_count:r.length});case"complete":return t("uploadComplete");case"error":return t("error")}}function ab(i){const{i18n:e,isAllComplete:t,hideCancelButton:n,maxNumberOfFiles:a,toggleAddFilesPanel:s,uppy:o}=i;let{allowNewUpload:r}=i;return r&&a&&(r=i.totalFileCount<i.maxNumberOfFiles),d("div",{className:"uppy-DashboardContent-bar"},!t&&!n?d("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll()},e("cancel")):d("div",null),d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},d(nb,i)),r?d("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>s(!0)},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15"},d("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})),d("span",{className:"uppy-DashboardContent-addMoreCaption"},e("addMore"))):d("div",null))}function sb(i){const{computedMetaFields:e,requiredMetaFields:t,updateMeta:n,form:a,formState:s}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(r=>{const l=`uppy-Dashboard-FileCard-input-${r.id}`,c=t.includes(r.id);return d("fieldset",{key:r.id,className:"uppy-Dashboard-FileCard-fieldset"},d("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l},r.name),r.render!==void 0?r.render({value:s[r.id],onChange:p=>n(p,r.id),fieldCSSClasses:o,required:c,form:a.id},d):d("input",{className:o.text,id:l,form:a.id,type:r.type||"text",required:c,value:s[r.id],placeholder:r.placeholder,onInput:p=>n(p.target.value,r.id),"data-uppy-super-focusable":!0}))})}function ob(i){var e;const{files:t,fileCardFor:n,toggleFileCard:a,saveFileCard:s,metaFields:o,requiredMetaFields:r,openFileEditor:l,i18n:c,i18nArray:p,className:u,canEditFile:h}=i,g=()=>typeof o=="function"?o(t[n]):o,m=t[n],v=(e=g())!=null?e:[],f=h(m),y={};v.forEach(O=>{var L;y[O.id]=(L=m.meta[O.id])!=null?L:""});const[F,S]=zt(y),A=wi(O=>{O.preventDefault(),s(F,n)},[s,F,n]),D=(O,L)=>{S({...F,[L]:O})},x=()=>{a(!1)},[_]=zt(()=>{const O=document.createElement("form");return O.setAttribute("tabindex","-1"),O.id=Ci(),O});return An(()=>(document.body.appendChild(_),_.addEventListener("submit",A),()=>{_.removeEventListener("submit",A),document.body.removeChild(_)}),[_,A]),d("div",{className:fe("uppy-Dashboard-FileCard",u),"data-uppy-panelType":"FileCard",onDragOver:Bt,onDragLeave:Bt,onDrop:Bt,onPaste:Bt},d("div",{className:"uppy-DashboardContent-bar"},d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},p("editing",{file:d("span",{className:"uppy-DashboardContent-titleFile"},m.meta?m.meta.name:m.name)})),d("button",{className:"uppy-DashboardContent-back",type:"button",form:_.id,title:c("finishEditingFile"),onClick:x},c("cancel"))),d("div",{className:"uppy-Dashboard-FileCard-inner"},d("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:hr(m.type).color}},d(cp,{file:m}),f&&d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:O=>{A(O),l(m)}},c("editImage"))),d("div",{className:"uppy-Dashboard-FileCard-info"},d(sb,{computedMetaFields:v,requiredMetaFields:r,updateMeta:D,form:_,formState:F})),d("div",{className:"uppy-Dashboard-FileCard-actions"},d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:_.id},c("saveChanges")),d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:x,form:_.id},c("cancel")))))}const ci="uppy-transition-slideDownUp",Tl=250;function pa(i){let{children:e}=i;const[t,n]=zt(null),[a,s]=zt(""),o=Ps(),r=Ps(),l=Ps(),c=()=>{s(`${ci}-enter`),cancelAnimationFrame(l.current),clearTimeout(r.current),r.current=void 0,l.current=requestAnimationFrame(()=>{s(`${ci}-enter ${ci}-enter-active`),o.current=setTimeout(()=>{s("")},Tl)})},p=()=>{s(`${ci}-leave`),cancelAnimationFrame(l.current),clearTimeout(o.current),o.current=void 0,l.current=requestAnimationFrame(()=>{s(`${ci}-leave ${ci}-leave-active`),r.current=setTimeout(()=>{n(null),s("")},Tl)})};return An(()=>{const u=Ct(e)[0];t!==u&&(u&&!t?c():t&&!u&&!r.current&&p(),n(u))},[e,t]),An(()=>()=>{clearTimeout(o.current),clearTimeout(r.current),cancelAnimationFrame(l.current)},[]),t?lu(t,{className:fe(a,t.props.className)}):null}function ni(){return ni=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},ni.apply(this,arguments)}const Ol=900,Al=700,Rs=576,Dl=330;function rb(i){const e=i.totalFileCount===0,t=i.totalFileCount===1,n=i.containerWidth>Rs,a=i.containerHeight>Dl,s=fe({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>Rs,"uppy-size--lg":i.containerWidth>Al,"uppy-size--xl":i.containerWidth>Ol,"uppy-size--height-md":i.containerHeight>Dl,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&a});let o=1;i.containerWidth>Ol?o=5:i.containerWidth>Al?o=4:i.containerWidth>Rs&&(o=3);const r=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,c=i.files?Object.keys(i.files).filter(h=>i.files[h].isGhost).length:null,p=()=>c>0?i.i18n("recoveredXFiles",{smart_count:c}):i.i18n("recoveredAllFiles");return d("div",{className:s,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&lp(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop},d("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),d("div",{className:"uppy-Dashboard-inner","aria-modal":!i.inline&&"true",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""}},i.inline?null:d("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal},d("span",{"aria-hidden":"true"},"×")),d("div",{className:"uppy-Dashboard-innerWrap"},d("div",{className:"uppy-Dashboard-dropFilesHereHint"},i.i18n("dropHint")),r&&d(ab,i),l&&d("div",{className:"uppy-Dashboard-serviceMsg"},d("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19"},d("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd"},d("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),d("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),d("circle",{fill:"#000",cx:"12",cy:"17",r:"1"}))),d("strong",{className:"uppy-Dashboard-serviceMsg-title"},i.i18n("sessionRestored")),d("div",{className:"uppy-Dashboard-serviceMsg-text"},p())),r?d(Jv,{id:i.id,error:i.error,i18n:i.i18n,uppy:i.uppy,files:i.files,acquirers:i.acquirers,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,isWide:i.isWide,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o}):d(hp,ni({},i,{isSizeMD:n})),d(pa,null,i.showAddFilesPanel?d(Zv,ni({key:"AddFiles"},i,{isSizeMD:n})):null),d(pa,null,i.fileCardFor?d(ob,ni({key:"FileCard"},i)):null),d(pa,null,i.activePickerPanel?d(eb,ni({key:"Picker"},i)):null),d(pa,null,i.showFileEditor?d(tb,ni({key:"Editor"},i)):null),d("div",{className:"uppy-Dashboard-progressindicators"},i.progressindicators.map(h=>i.uppy.getPlugin(h.id).render(i.state))))))}const lb={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};function Q(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var cb=0;function it(i){return"__private_"+cb+++"_"+i}const ub={version:"3.8.0"},Is=Mr.default||Mr,Rl=9,pb=27;function Il(){const i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}const db={target:"body",metaFields:[],inline:!1,width:750,height:550,thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:ju,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,closeModalOnClickOutside:!1,closeAfterFinish:!1,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,disablePageScrollWhenModalOpen:!0,animateOpenClose:!0,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,browserBackButtonClose:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,autoOpenFileEditor:!1,disabled:!1,disableLocalFiles:!1,doneButtonHandler:null,onRequestCloseModal:null};var qt=it("disabledNodes"),yt=it("generateLargeThumbnailIfSingleFile"),Xi=it("openFileEditorWhenFilesAdded"),Ht=it("attachRenderFunctionToTarget"),Us=it("isTargetSupported"),Ns=it("getAcquirers"),Ls=it("getProgressIndicators"),xt=it("getEditors"),Bs=it("addSpecifiedPluginsFromOptions"),Ms=it("autoDiscoverPlugins"),Vt=it("addSupportedPluginIfNoTarget");let mr=class extends ye{constructor(e,t){var n,a,s,o;let r;t?t.autoOpen===void 0?r=t.autoOpenFileEditor?"imageEditor":null:r=t.autoOpen:r=null,super(e,{...db,...t,autoOpen:r}),Object.defineProperty(this,qt,{writable:!0,value:void 0}),this.modalName=`uppy-Dashboard-${Ci()}`,this.superFocus=Fv(),this.ifFocusedOnUppyRecently=!1,this.removeTarget=l=>{const p=this.getPluginState().targets.filter(u=>u.id!==l.id);this.setPluginState({targets:p})},this.addTarget=l=>{const c=l.id||l.constructor.name,p=l.title||c,u=l.type;if(u!=="acquirer"&&u!=="progressindicator"&&u!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;const h={id:c,name:p,type:u},m=this.getPluginState().targets.slice();return m.push(h),this.setPluginState({targets:m}),this.el},this.hideAllPanels=()=>{var l;const c=this.getPluginState(),p={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};c.activePickerPanel===p.activePickerPanel&&c.showAddFilesPanel===p.showAddFilesPanel&&c.showFileEditor===p.showFileEditor&&c.activeOverlayType===p.activeOverlayType||(this.setPluginState(p),this.uppy.emit("dashboard:close-panel",(l=c.activePickerPanel)==null?void 0:l.id))},this.showPanel=l=>{const{targets:c}=this.getPluginState(),p=c.find(u=>u.type==="acquirer"&&u.id===l);this.setPluginState({activePickerPanel:p,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",l)},this.canEditFile=l=>{const{targets:c}=this.getPluginState();return Q(this,xt)[xt](c).some(u=>this.uppy.getPlugin(u.id).canEditFile(l))},this.openFileEditor=l=>{const{targets:c}=this.getPluginState(),p=Q(this,xt)[xt](c);this.setPluginState({showFileEditor:!0,fileCardFor:l.id||null,activeOverlayType:"FileEditor"}),p.forEach(u=>{this.uppy.getPlugin(u.id).selectFile(l)})},this.closeFileEditor=()=>{const{metaFields:l}=this.getPluginState();l&&l.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})},this.saveFileEditor=()=>{const{targets:l}=this.getPluginState();Q(this,xt)[xt](l).forEach(p=>{this.uppy.getPlugin(p.id).save()}),this.closeFileEditor()},this.openModal=()=>{const{promise:l,resolve:c}=Il();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){const p=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",p,!1),c()};this.el.addEventListener("animationend",p,!1)}else this.setPluginState({isHidden:!1}),c();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),l},this.closeModal=l=>{var c;const p=(c=l==null?void 0:l.manualClose)!=null?c:!0,{isHidden:u,isClosing:h}=this.getPluginState();if(u||h)return;const{promise:g,resolve:m}=Il();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});const f=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",f,!1),m()};this.el.addEventListener("animationend",f,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),m();if(document.removeEventListener("keydown",this.handleKeyDownInModal),p&&this.opts.browserBackButtonClose){var v;(v=history.state)!=null&&v[this.modalName]&&history.back()}return this.uppy.emit("dashboard:modal-closed"),g},this.isModalOpen=()=>!this.getPluginState().isHidden||!1,this.requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal(),this.setDarkModeCapability=l=>{const{capabilities:c}=this.uppy.getState();this.uppy.setState({capabilities:{...c,darkMode:l}})},this.handleSystemDarkModeChange=l=>{const c=l.matches;this.uppy.log(`[Dashboard] Dark mode is ${c?"on":"off"}`),this.setDarkModeCapability(c)},this.toggleFileCard=(l,c)=>{const p=this.uppy.getFile(c);l?this.uppy.emit("dashboard:file-edit-start",p):this.uppy.emit("dashboard:file-edit-complete",p),this.setPluginState({fileCardFor:l?c:null,activeOverlayType:l?"FileCard":null})},this.toggleAddFilesPanel=l=>{this.setPluginState({showAddFilesPanel:l,activeOverlayType:l?"AddFiles":null})},this.addFiles=l=>{const c=l.map(p=>({source:this.id,name:p.name,type:p.type,data:p,meta:{relativePath:p.relativePath||p.webkitRelativePath||null}}));try{this.uppy.addFiles(c)}catch(p){this.uppy.log(p)}},this.startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(l=>{const c=l[0],{width:p,height:u}=c.contentRect;this.setPluginState({containerWidth:p,containerHeight:u,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{const l=this.getPluginState(),c=!this.opts.inline&&l.isHidden;!l.areInsidesReadyToBeVisible&&!c&&(this.uppy.log("[Dashboard] resize event didn’t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)},this.stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)},this.recordIfFocusedOnUppyRecently=l=>{this.el.contains(l.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())},this.disableInteractiveElements=l=>{var c;const p=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],u=(c=Q(this,qt)[qt])!=null?c:rt(this.el.querySelectorAll(p)).filter(h=>!h.classList.contains("uppy-Dashboard-close"));for(const h of u)h.tagName==="A"?h.setAttribute("aria-disabled",l):h.disabled=l;l?Q(this,qt)[qt]=u:Q(this,qt)[qt]=null,this.dashboardIsDisabled=l},this.updateBrowserHistory=()=>{var l;(l=history.state)!=null&&l[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)},this.handlePopState=l=>{var c;this.isModalOpen()&&(!l.state||!l.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&(c=l.state)!=null&&c[this.modalName]&&history.back()},this.handleKeyDownInModal=l=>{l.keyCode===pb&&this.requestCloseModal(),l.keyCode===Rl&&rp(l,this.getPluginState().activeOverlayType,this.el)},this.handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()},this.handlePaste=l=>{this.uppy.iteratePlugins(p=>{p.type==="acquirer"&&(p.handleRootPaste==null||p.handleRootPaste(l))});const c=rt(l.clipboardData.files);c.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(c))},this.handleInputChange=l=>{l.preventDefault();const c=rt(l.target.files);c.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(c))},this.handleDragOver=l=>{var c,p;l.preventDefault(),l.stopPropagation();const u=()=>{let v=!0;return this.uppy.iteratePlugins(f=>{f.canHandleRootDrop!=null&&f.canHandleRootDrop(l)&&(v=!0)}),v},h=()=>{const{types:v}=l.dataTransfer;return v.some(f=>f==="Files")},g=u(),m=h();if(!g&&!m||this.opts.disabled||this.opts.disableLocalFiles&&(m||!g)||!this.uppy.getState().allowNewUpload){l.dataTransfer.dropEffect="none",clearTimeout(this.removeDragOverClassTimeout);return}l.dataTransfer.dropEffect="copy",clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!0}),(c=(p=this.opts).onDragOver)==null||c.call(p,l)},this.handleDragLeave=l=>{var c,p;l.preventDefault(),l.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.removeDragOverClassTimeout=setTimeout(()=>{this.setPluginState({isDraggingOver:!1})},50),(c=(p=this.opts).onDragLeave)==null||c.call(p,l)},this.handleDrop=async l=>{var c,p;l.preventDefault(),l.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(m=>{m.type==="acquirer"&&(m.handleRootDrop==null||m.handleRootDrop(l))});let u=!1;const h=m=>{this.uppy.log(m,"error"),u||(this.uppy.info(m.message,"error"),u=!0)};this.uppy.log("[Dashboard] Processing dropped files");const g=await dr(l.dataTransfer,{logDropError:h});g.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(g)),(c=(p=this.opts).onDrop)==null||c.call(p,l)},this.handleRequestThumbnail=l=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",l)},this.handleCancelThumbnail=l=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",l)},this.handleKeyDownInInline=l=>{l.keyCode===Rl&&Sv(l,this.getPluginState().activeOverlayType,this.el)},this.handlePasteOnBody=l=>{this.el.contains(document.activeElement)&&this.handlePaste(l)},this.handleComplete=l=>{let{failed:c}=l;this.opts.closeAfterFinish&&!(c!=null&&c.length)&&this.requestCloseModal()},this.handleCancelRestore=()=>{this.uppy.emit("restore-canceled")},Object.defineProperty(this,yt,{writable:!0,value:()=>{if(this.opts.disableThumbnailGenerator)return;const l=600,c=this.uppy.getFiles();if(c.length===1){const p=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);p==null||p.setOptions({thumbnailWidth:l});const u={...c[0],preview:void 0};p==null||p.requestThumbnail(u).then(()=>{p==null||p.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}}}),Object.defineProperty(this,Xi,{writable:!0,value:l=>{const c=l[0],{metaFields:p}=this.getPluginState(),u=p&&p.length>0,h=this.canEditFile(c);u&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,c.id):h&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(c)}}),this.initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){const l=Cl(this.opts.trigger);l?l.forEach(c=>c.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",Q(this,Vt)[Vt]),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",Q(this,yt)[yt]),this.uppy.on("file-removed",Q(this,yt)[yt]),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",Q(this,Xi)[Xi])},this.removeEvents=()=>{const l=Cl(this.opts.trigger);!this.opts.inline&&l&&l.forEach(c=>c.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",Q(this,Vt)[Vt]),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",Q(this,yt)[yt]),this.uppy.off("file-removed",Q(this,yt)[yt]),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",Q(this,Xi)[Xi])},this.superFocusOnEachUpdate=()=>{const l=this.el.contains(document.activeElement),c=document.activeElement===document.body||document.activeElement===null,p=this.uppy.getState().info.length===0,u=!this.opts.inline;p&&(u||l||c&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()},this.afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()},this.saveFileCard=(l,c)=>{this.uppy.setFileMeta(c,l),this.toggleFileCard(!1,c)},Object.defineProperty(this,Ht,{writable:!0,value:l=>{const c=this.uppy.getPlugin(l.id);return{...l,icon:c.icon||this.opts.defaultPickerIcon,render:c.render}}}),Object.defineProperty(this,Us,{writable:!0,value:l=>{const c=this.uppy.getPlugin(l.id);return typeof c.isSupported!="function"?!0:c.isSupported()}}),Object.defineProperty(this,Ns,{writable:!0,value:Is(l=>l.filter(c=>c.type==="acquirer"&&Q(this,Us)[Us](c)).map(Q(this,Ht)[Ht]))}),Object.defineProperty(this,Ls,{writable:!0,value:Is(l=>l.filter(c=>c.type==="progressindicator").map(Q(this,Ht)[Ht]))}),Object.defineProperty(this,xt,{writable:!0,value:Is(l=>l.filter(c=>c.type==="editor").map(Q(this,Ht)[Ht]))}),this.render=l=>{const c=this.getPluginState(),{files:p,capabilities:u,allowNewUpload:h}=l,{newFiles:g,uploadStartedFiles:m,completeFiles:v,erroredFiles:f,inProgressFiles:y,inProgressNotPausedFiles:F,processingFiles:S,isUploadStarted:A,isAllComplete:D,isAllErrored:x,isAllPaused:_}=this.uppy.getObjectOfFilesPerState(),O=Q(this,Ns)[Ns](c.targets),L=Q(this,Ls)[Ls](c.targets),z=Q(this,xt)[xt](c.targets);let K;return this.opts.theme==="auto"?K=u.darkMode?"dark":"light":K=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),rb({state:l,isHidden:c.isHidden,files:p,newFiles:g,uploadStartedFiles:m,completeFiles:v,erroredFiles:f,inProgressFiles:y,inProgressNotPausedFiles:F,processingFiles:S,isUploadStarted:A,isAllComplete:D,isAllErrored:x,isAllPaused:_,totalFileCount:Object.keys(p).length,totalProgress:l.totalProgress,allowNewUpload:h,acquirers:O,theme:K,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:c.activePickerPanel,showFileEditor:c.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:c.isClosing,progressindicators:L,editors:z,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:l.recoveredState,metaFields:c.metaFields,resumableUploads:u.resumableUploads||!1,individualCancellation:u.individualCancellation,isMobileDevice:u.isMobileDevice,fileCardFor:c.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:c.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:c.containerWidth,containerHeight:c.containerHeight,areInsidesReadyToBeVisible:c.areInsidesReadyToBeVisible,isTargetDOMEl:this.isTargetDOMEl,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:c.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})},Object.defineProperty(this,Bs,{writable:!0,value:()=>{(this.opts.plugins||[]).forEach(c=>{const p=this.uppy.getPlugin(c);p?p.mount(this,p):this.uppy.log(`[Uppy] Dashboard could not find plugin '${c}', make sure to uppy.use() the plugins you are specifying`,"warning")})}}),Object.defineProperty(this,Ms,{writable:!0,value:()=>{this.uppy.iteratePlugins(Q(this,Vt)[Vt])}}),Object.defineProperty(this,Vt,{writable:!0,value:l=>{var c;const p=["acquirer","editor"];l&&!((c=l.opts)!=null&&c.target)&&p.includes(l.type)&&(this.getPluginState().targets.some(h=>l.id===h.id)||l.mount(this,l))}}),this.install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});const{inline:l,closeAfterFinish:c}=this.opts;if(l&&c)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");const{allowMultipleUploads:p,allowMultipleUploadBatches:u}=this.uppy.opts;(p||u)&&c&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");const{target:h}=this.opts;h&&this.mount(h,this),this.opts.disableStatusBar||this.uppy.use(sr,{id:`${this.id}:StatusBar`,target:this,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,showProgressDetails:this.opts.showProgressDetails,hideAfterFinish:this.opts.hideProgressAfterFinish,locale:this.opts.locale,doneButtonHandler:this.opts.doneButtonHandler}),this.opts.disableInformer||this.uppy.use(Gu,{id:`${this.id}:Informer`,target:this}),this.opts.disableThumbnailGenerator||this.uppy.use(pr,{id:`${this.id}:ThumbnailGenerator`,thumbnailWidth:this.opts.thumbnailWidth,thumbnailHeight:this.opts.thumbnailHeight,thumbnailType:this.opts.thumbnailType,waitForThumbnailsBeforeUpload:this.opts.waitForThumbnailsBeforeUpload,lazy:!this.opts.waitForThumbnailsBeforeUpload}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;const g=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;if(this.uppy.log(`[Dashboard] Dark mode is ${g?"on":"off"}`),this.setDarkModeCapability(g),this.opts.theme==="auto"){var m;(m=this.darkModeMediaQuery)==null||m.addListener(this.handleSystemDarkModeChange)}Q(this,Bs)[Bs](),Q(this,Ms)[Ms](),this.initEvents()},this.uninstall=()=>{if(!this.opts.disableInformer){const p=this.uppy.getPlugin(`${this.id}:Informer`);p&&this.uppy.removePlugin(p)}if(!this.opts.disableStatusBar){const p=this.uppy.getPlugin(`${this.id}:StatusBar`);p&&this.uppy.removePlugin(p)}if(!this.opts.disableThumbnailGenerator){const p=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);p&&this.uppy.removePlugin(p)}if((this.opts.plugins||[]).forEach(p=>{const u=this.uppy.getPlugin(p);u&&u.unmount()}),this.opts.theme==="auto"){var c;(c=this.darkModeMediaQuery)==null||c.removeListener(this.handleSystemDarkModeChange)}this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()},this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=lb,(a=(n=this.opts).doneButtonHandler)!=null||(n.doneButtonHandler=()=>{this.uppy.clearUploadedFiles(),this.requestCloseModal()}),(o=(s=this.opts).onRequestCloseModal)!=null||(s.onRequestCloseModal=()=>this.closeModal()),this.i18nInit()}};mr.VERSION=ub.version;const ki=R.instanceOf(xu),mp=R.arrayOf(R.string),is=R.shape({strings:R.object,pluralize:R.func}),hb=R.shape({id:R.string.isRequired,name:R.string.isRequired,placeholder:R.string}),fp=R.oneOfType([R.arrayOf(hb),R.func]),Ha=R.oneOfType([R.string,R.number]),mb=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],fb=/^(aria-|data-)/,Kn=i=>Object.fromEntries(Object.entries(i).filter(e=>{let[t]=e;return fb.test(t)||mb.includes(t)}));function Xn(i,e){return Object.keys(i).some(t=>!Object.hasOwn(i,t)&&i[t]!==e[t])}class gp extends ne.Component{componentDidMount(){this.installPlugin()}componentDidUpdate(e){if(e.uppy!==this.props.uppy)this.uninstallPlugin(e),this.installPlugin();else if(Xn(this.props,e)){const{uppy:t,...n}={...this.props,target:this.container};this.plugin.setOptions(n)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:e,...t}={id:"react:Dashboard",inline:!0,...this.props,target:this.container};e.use(mr,t),this.plugin=e.getPlugin(t.id)}uninstallPlugin(e){e===void 0&&(e=this.props);const{uppy:t}=e;t.removePlugin(this.plugin)}render(){return ne.createElement("div",{className:"uppy-Container",ref:e=>{this.container=e},...Kn(this.props)})}}gp.propsTypes={uppy:ki,disableInformer:R.bool,disableStatusBar:R.bool,disableThumbnailGenerator:R.bool,height:Ha,hideProgressAfterFinish:R.bool,hideUploadButton:R.bool,locale:is,metaFields:fp,note:R.string,plugins:mp,proudlyDisplayPoweredByUppy:R.bool,showProgressDetails:R.bool,width:Ha,thumbnailType:R.string,thumbnailWidth:R.number};class vp extends ne.Component{componentDidMount(){this.installPlugin()}componentDidUpdate(e){const{uppy:t,open:n,onRequestClose:a}=this.props;if(e.uppy!==t)this.uninstallPlugin(e),this.installPlugin();else if(Xn(this.props,e)){const{uppy:s,...o}={...this.props,inline:!1,onRequestCloseModal:a};this.plugin.setOptions(o)}e.open&&!n?this.plugin.closeModal():!e.open&&n&&this.plugin.openModal()}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{target:e=this.container,open:t,onRequestClose:n,uppy:a,...s}=this.props,o={...s,id:"react:DashboardModal",inline:!1,target:e,open:t,onRequestCloseModal:n};a.use(mr,o),this.plugin=a.getPlugin(o.id),t&&this.plugin.openModal()}uninstallPlugin(e){e===void 0&&(e=this.props);const{uppy:t}=e;t.removePlugin(this.plugin)}render(){return ne.createElement("div",{className:"uppy-Container",ref:e=>{this.container=e},...Kn(this.props)})}}vp.propTypes={uppy:ki.isRequired,target:typeof window<"u"?R.instanceOf(window.HTMLElement):R.any,open:R.bool,onRequestClose:R.func,closeModalOnClickOutside:R.bool,disablePageScrollWhenModalOpen:R.bool,plugins:mp,width:Ha,height:Ha,showProgressDetails:R.bool,note:R.string,metaFields:fp,proudlyDisplayPoweredByUppy:R.bool,autoOpenFileEditor:R.bool,animateOpenClose:R.bool,browserBackButtonClose:R.bool,closeAfterFinish:R.bool,disableStatusBar:R.bool,disableInformer:R.bool,disableThumbnailGenerator:R.bool,disableLocalFiles:R.bool,disabled:R.bool,hideCancelButton:R.bool,hidePauseResumeButton:R.bool,hideProgressAfterFinish:R.bool,hideRetryButton:R.bool,hideUploadButton:R.bool,showLinkToFileUploadResult:R.bool,showRemoveButtonAfterComplete:R.bool,showSelectedFiles:R.bool,waitForThumbnailsBeforeUpload:R.bool,fileManagerSelectionType:R.string,theme:R.string,thumbnailType:R.string,thumbnailWidth:R.number,locale:is};vp.defaultProps={metaFields:[],plugins:[],width:750,height:550,thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,closeModalOnClickOutside:!1,closeAfterFinish:!1,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,disablePageScrollWhenModalOpen:!0,animateOpenClose:!0,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,browserBackButtonClose:!1,theme:"light",autoOpenFileEditor:!1,disabled:!1,disableLocalFiles:!1,open:void 0,target:void 0,locale:null,onRequestClose:void 0};const gb={strings:{dropHereOr:"Drop here or %{browse}",browse:"browse"}},vb={version:"3.1.0"},bb={inputName:"files[]",width:"100%",height:"100%"};let bp=class yp extends ye{constructor(e,t){super(e,{...bb,...t}),this.isDragDropSupported=lp(),this.addFiles=n=>{const a=n.map(s=>({source:this.id,name:s.name,type:s.type,data:s,meta:{relativePath:s.relativePath||null}}));try{this.uppy.addFiles(a)}catch(s){this.uppy.log(s)}},this.onInputChange=n=>{const a=rt(n.target.files);a.length>0&&(this.uppy.log("[DragDrop] Files selected through input"),this.addFiles(a)),n.target.value=null},this.handleDragOver=n=>{var a,s;n.preventDefault(),n.stopPropagation();const{types:o}=n.dataTransfer,r=o.some(c=>c==="Files"),{allowNewUpload:l}=this.uppy.getState();if(!r||!l){n.dataTransfer.dropEffect="none",clearTimeout(this.removeDragOverClassTimeout);return}n.dataTransfer.dropEffect="copy",clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!0}),(a=(s=this.opts).onDragOver)==null||a.call(s,n)},this.handleDragLeave=n=>{var a,s;n.preventDefault(),n.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.removeDragOverClassTimeout=setTimeout(()=>{this.setPluginState({isDraggingOver:!1})},50),(a=(s=this.opts).onDragLeave)==null||a.call(s,n)},this.handleDrop=async n=>{var a,s;n.preventDefault(),n.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!1});const o=l=>{this.uppy.log(l,"error")},r=await dr(n.dataTransfer,{logDropError:o});r.length>0&&(this.uppy.log("[DragDrop] Files dropped"),this.addFiles(r)),(a=(s=this.opts).onDrop)==null||a.call(s,n)},this.type="acquirer",this.id=this.opts.id||"DragDrop",this.title="Drag & Drop",this.defaultLocale=gb,this.i18nInit()}renderHiddenFileInput(){const{restrictions:e}=this.uppy.opts;return d("input",{className:"uppy-DragDrop-input",type:"file",hidden:!0,ref:t=>{this.fileInputRef=t},name:this.opts.inputName,multiple:e.maxNumberOfFiles!==1,accept:e.allowedFileTypes,onChange:this.onInputChange})}static renderArrowSvg(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16"},d("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0",fillRule:"evenodd"}))}renderLabel(){return d("div",{className:"uppy-DragDrop-label"},this.i18nArray("dropHereOr",{browse:d("span",{className:"uppy-DragDrop-browse"},this.i18n("browse"))}))}renderNote(){return d("span",{className:"uppy-DragDrop-note"},this.opts.note)}render(){const e=`uppy-u-reset
|
|
26
|
+
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,vl(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,vl(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let n=e.get(t);n&&n.length===1&&e.set(t,n[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",Fl(...e.get(2),e.get(1))),e.set("longitude",Fl(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,n,a={};for(t of ge)if(e=this[t],!Yu(e))if(n=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(a,n)}else a[t]=n;return this.makerNote&&(a.makerNote=this.makerNote),this.userComment&&(a.userComment=this.userComment),a}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[n,a]of Object.entries(t))this.assignObjectToOutput(e,n,a)}}function Fl(i,e,t,n){var a=i+e/60+t/3600;return n!=="S"&&n!=="W"||(a*=-1),a}X(Ts,"type","tiff"),X(Ts,"headerLength",10),Je.set("tiff",Ts);const ur={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1};Object.assign({},ur,{firstChunkSize:4e4,gps:[1,2,3,4]});Object.assign({},ur,{tiff:!1,ifd1:!0,mergeOutput:!1});const ov=Object.assign({},ur,{firstChunkSize:4e4,ifd0:[274]});async function rv(i){let e=new ev(ov);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}const lv=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}});let rn=!0,ln=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,n]=e;rn=Number(t)+.1*Number(n)<13.4,ln=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);rn=ln=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);rn=ln=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);rn=ln=Number(e)<77}}async function cv(i){let e=await rv(i);return Object.assign({canvas:rn,css:ln},lv[e])}class uv extends et{constructor(...e){super(...e),X(this,"ranges",new pv),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,n){if(e===0&&this.byteLength===0&&n){let a=new DataView(n.buffer||n,n.byteOffset,n.byteLength);this._swapDataView(a)}else{let a=e+t;if(a>this.byteLength){let{dataView:s}=this._extend(a);this._swapDataView(s)}}}_extend(e){let t;t=Qu?Xu.allocUnsafe(e):new Uint8Array(e);let n=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:n}}subarray(e,t,n=!1){return t=t||this._lengthToEnd(e),n&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,n=!1){n&&this._tryExtend(t,e.byteLength,e);let a=super.set(e,t);return this.ranges.add(t,a.byteLength),a}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}}class pv{constructor(){X(this,"list",[])}get length(){return this.list.length}add(e,t,n=0){let a=e+t,s=this.list.filter(o=>_l(e,o.offset,a)||_l(e,o.end,a));if(s.length>0){e=Math.min(e,...s.map(r=>r.offset)),a=Math.max(a,...s.map(r=>r.end)),t=a-e;let o=s.shift();o.offset=e,o.length=t,o.end=a,this.list=this.list.filter(r=>!s.includes(r))}else this.list.push({offset:e,length:t,end:a})}available(e,t){let n=e+t;return this.list.some(a=>a.offset<=e&&n<=a.end)}}function _l(i,e,t){return i<=e&&e<=t}class dv extends uv{constructor(e,t){super(0),X(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,n=await this.readChunk(e,t);return!!n&&n.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}}rr.set("blob",class extends dv{async readWhole(){this.chunked=!1;let i=await go(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,n=this.input.slice(i,t),a=await go(n);return this.set(a,i,!0)}});const hv={strings:{generatingThumbnails:"Generating thumbnails..."}},mv={version:"3.1.0"};function fv(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(n){if(n.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(n=>{i.toBlob(n,e,t)}).then(n=>{if(n===null)throw new Error("cannot read image, probably an svg with external resources");return n}):Promise.resolve().then(()=>Kg(i.toDataURL(e,t),{})).then(n=>{if(n===null)throw new Error("could not extract blob, probably an old browser");return n})}function gv(i,e){let t=i.width,n=i.height;(e.deg===90||e.deg===270)&&(t=i.height,n=i.width);const a=document.createElement("canvas");a.width=t,a.height=n;const s=a.getContext("2d");return s.translate(t/2,n/2),e.canvas&&(s.rotate(e.rad),s.scale(e.scaleX,e.scaleY)),s.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),a}function vv(i){const e=i.width/i.height,t=5e6,n=4096;let a=Math.floor(Math.sqrt(t*e)),s=Math.floor(t/Math.sqrt(t*e));if(a>n&&(a=n,s=Math.round(a/e)),s>n&&(s=n,a=Math.round(e*s)),i.width>a){const o=document.createElement("canvas");return o.width=a,o.height=s,o.getContext("2d").drawImage(i,0,0,a,s),o}return i}const bv={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1};class pr extends ye{constructor(e,t){if(super(e,{...bv,...t}),this.onFileAdded=n=>{!n.preview&&n.data&&$a(n.type)&&!n.isRemote&&this.addToQueue(n.id)},this.onCancelRequest=n=>{const a=this.queue.indexOf(n.id);a!==-1&&this.queue.splice(a,1)},this.onFileRemoved=n=>{const a=this.queue.indexOf(n.id);a!==-1&&this.queue.splice(a,1),n.preview&&fl(n.preview)&&URL.revokeObjectURL(n.preview)},this.onRestored=()=>{this.uppy.getFiles().filter(a=>a.isRestored).forEach(a=>{(!a.preview||fl(a.preview))&&this.addToQueue(a.id)})},this.onAllFilesRemoved=()=>{this.queue=[]},this.waitUntilAllProcessed=n=>{n.forEach(s=>{const o=this.uppy.getFile(s);this.uppy.emit("preprocess-progress",o,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});const a=()=>{n.forEach(s=>{const o=this.uppy.getFile(s);this.uppy.emit("preprocess-complete",o)})};return new Promise(s=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{a(),s()}):(a(),s())})},this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=hv,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,n){const a=URL.createObjectURL(e.data),s=new Promise((r,l)=>{const c=new Image;c.src=a,c.addEventListener("load",()=>{URL.revokeObjectURL(a),r(c)}),c.addEventListener("error",p=>{URL.revokeObjectURL(a),l(p.error||new Error("Could not create thumbnail"))})}),o=cv(e.data).catch(()=>1);return Promise.all([s,o]).then(r=>{let[l,c]=r;const p=this.getProportionalDimensions(l,t,n,c.deg),u=gv(l,c),h=this.resizeImage(u,p.width,p.height);return fv(h,this.thumbnailType,80)}).then(r=>URL.createObjectURL(r))}getProportionalDimensions(e,t,n,a){let s=e.width/e.height;return(a===90||a===270)&&(s=e.height/e.width),t!=null?{width:t,height:Math.round(t/s)}:n!=null?{width:Math.round(n*s),height:n}:{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/s)}}resizeImage(e,t,n){let a=vv(e),s=Math.ceil(Math.log2(a.width/t));s<1&&(s=1);let o=t*2**(s-1),r=n*2**(s-1);const l=2;for(;s--;){const c=document.createElement("canvas");c.width=o,c.height=r,c.getContext("2d").drawImage(a,0,0,o,r),a=c,o=Math.round(o/l),r=Math.round(r/l)}return a}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){const e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return $a(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}}pr.VERSION=mv.version;function Cl(i){if(typeof i=="string"){const e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&wu(i)?[i]:null}function ip(i,e,t,n){let{onSuccess:a}=n;i.readEntries(s=>{const o=[...e,...s];s.length?queueMicrotask(()=>{ip(i,o,t,{onSuccess:a})}):a(o)},s=>{t(s),a(e)})}function np(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,n)=>i.file(t,n))},async*values(){const t=i.createReader();yield*await new Promise(a=>{ip(t,[],e,{onSuccess:s=>a(s.map(o=>np(o,e)))})})},isSameEntry:void 0}}function ap(i,e,t){try{return t===void 0&&(t=void 0),async function*(){const n=()=>`${e}/${i.name}`;if(i.kind==="file"){const a=await i.getFile();a!=null?(a.relativePath=e?n():null,yield a):t!=null&&(yield t)}else if(i.kind==="directory")for await(const a of i.values())yield*ap(a,e?n():i.name);else t!=null&&(yield t)}()}catch(n){return Promise.reject(n)}}async function*yv(i,e){const t=await Promise.all(Array.from(i.items,async n=>{var a;let s;const o=()=>typeof n.getAsEntry=="function"?n.getAsEntry():n.webkitGetAsEntry();return(a=s)!=null||(s=np(o(),e)),{fileSystemHandle:s,lastResortFile:n.getAsFile()}}));for(const{lastResortFile:n,fileSystemHandle:a}of t)if(a!=null)try{yield*ap(a,"",n)}catch(s){n!=null?yield n:e(s)}else n!=null&&(yield n)}function xv(i){const e=rt(i.files);return Promise.resolve(e)}async function dr(i,e){var t;const n=(t=e==null?void 0:e.logDropError)!=null?t:Function.prototype;try{const a=[];for await(const s of yv(i,n))a.push(s);return a}catch{return xv(i)}}const sp=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];function op(i,e){if(e){const t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function El(i,e){const t=e[0];t&&(t.focus(),i.preventDefault())}function wv(i,e){const t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function Pv(i){return i.contains(document.activeElement)}function rp(i,e,t){const n=op(t,e),a=rt(n.querySelectorAll(sp)),s=a.indexOf(document.activeElement);Pv(n)?i.shiftKey&&s===0?wv(i,a):!i.shiftKey&&s===a.length-1&&El(i,a):El(i,a)}function Sv(i,e,t){e===null||rp(i,e,t)}function Fv(){let i=!1;return to((t,n)=>{const a=op(t,n),s=a.contains(document.activeElement);if(s&&i)return;const o=a.querySelector("[data-uppy-super-focusable]");if(!(s&&!o))if(o)o.focus({preventScroll:!0}),i=!0;else{const r=a.querySelector(sp);r==null||r.focus({preventScroll:!0}),i=!1}},260)}function lp(){const i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var _v=function(e,t){if(e===t)return!0;for(var n in e)if(!(n in t))return!1;for(var n in t)if(e[n]!==t[n])return!1;return!0};const Cv=tt(_v);function Ev(){return d("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25"},d("g",{fill:"#686DE0",fillRule:"evenodd"},d("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),d("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),d("circle",{cx:"7.5",cy:"9.5",r:"1.5"})))}function kv(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"}))}function Tv(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"}))}function Ov(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"}))}function Av(){return d("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"}))}function Dv(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("g",{fill:"#A7AFB7",fillRule:"nonzero"},d("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),d("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})))}function Rv(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},d("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"}))}function hr(i){const e={color:"#838999",icon:Dv()};if(!i)return e;const t=i.split("/")[0],n=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:Rv()}:t==="image"?{color:"#686de0",icon:Ev()}:t==="audio"?{color:"#068dbb",icon:kv()}:t==="video"?{color:"#19af67",icon:Tv()}:t==="application"&&n==="pdf"?{color:"#e25149",icon:Ov()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(n)!==-1?{color:"#00C469",icon:Av()}:e}function cp(i){const{file:e}=i;if(e.preview)return d("img",{className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});const{color:t,icon:n}=hr(e.type);return d("div",{className:"uppy-Dashboard-Item-previewIconWrap"},d("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t}},n),d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76"},d("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})))}const Iv=(i,e)=>(typeof e=="function"?e():e).filter(a=>a.id===i)[0].name;function up(i){const{file:e,toggleFileCard:t,i18n:n,metaFields:a}=i,{missingRequiredMetaFields:s}=e;if(!(s!=null&&s.length))return null;const o=s.map(r=>Iv(r,a)).join(", ");return d("div",{className:"uppy-Dashboard-Item-errorMessage"},n("missingRequiredMetaFields",{smart_count:s.length,fields:o})," ",d("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id)},n("editFile")))}function Uv(i){const{file:e,i18n:t,toggleFileCard:n,metaFields:a,showLinkToFileUploadResult:s}=i,r=e.preview?"rgba(255, 255, 255, 0.5)":hr(e.type).color;return d("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:r}},s&&e.uploadURL&&d("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name},d("span",{hidden:!0},e.meta.name)),d(cp,{file:e}),d(up,{file:e,i18n:t,toggleFileCard:n,metaFields:a}))}function Nv(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function kl(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function Os(i){return d("div",{className:"uppy-Dashboard-Item-progress"},d("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":kl(i),title:kl(i),onClick:()=>Nv(i)},i.children))}function ua(i){let{children:e}=i;return d("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle"},e)}function As(i){let{progress:e}=i;const t=2*Math.PI*15;return d("g",null,d("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),d("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":t,"stroke-dashoffset":t-t/100*e}))}function Lv(i){if(!i.file.progress.uploadStarted)return null;if(i.isUploaded)return d("div",{className:"uppy-Dashboard-Item-progress"},d("div",{className:"uppy-Dashboard-Item-progressIndicator"},d(ua,null,d("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),d("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"}))));if(!i.recoveredState)return i.error&&!i.hideRetryButton?d(Os,i,d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19"},d("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),d("path",{d:"M7.9 3H10v2H7.9z"}),d("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),d("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"}))):i.resumableUploads&&!i.hidePauseResumeButton?d(Os,i,d(ua,null,d(As,{progress:i.file.progress.percentage}),i.file.isPaused?d("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):d("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)"},d("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),d("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})))):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?d(Os,i,d(ua,null,d(As,{progress:i.file.progress.percentage}),d("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"}))):d("div",{className:"uppy-Dashboard-Item-progress"},d("div",{className:"uppy-Dashboard-Item-progressIndicator"},d(ua,null,d(As,{progress:i.file.progress.percentage}))))}const Ds="...";function pp(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=Ds.length+1)return`${i.slice(0,e-1)}…`;const t=e-Ds.length,n=Math.ceil(t/2),a=Math.floor(t/2);return i.slice(0,n)+Ds+i.slice(-a)}const Bv=i=>{const{author:e,name:t}=i.file.meta;function n(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return d("div",{className:"uppy-Dashboard-Item-name",title:t},pp(t,n()))},Mv=i=>{var e;const{author:t}=i.file.meta,n=(e=i.file.remote)==null?void 0:e.providerName,a="·";return t?d("div",{className:"uppy-Dashboard-Item-author"},d("a",{href:`${t.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer"},pp(t.name,13)),n?d(ot,null,` ${a} `,n,` ${a} `):null):null},jv=i=>i.file.size&&d("div",{className:"uppy-Dashboard-Item-statusSize"},vi(i.file.size)),zv=i=>i.file.isGhost&&d("span",null," • ",d("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:i.toggleAddFilesPanel},i.i18n("reSelect"))),$v=i=>{let{file:e,onClick:t}=i;return e.error?d("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":e.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:t,type:"button"},"?"):null};function qv(i){const{file:e}=i;return d("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source},d("div",{className:"uppy-Dashboard-Item-fileName"},Bv(i),d($v,{file:i.file,onClick:()=>alert(i.file.error)})),d("div",{className:"uppy-Dashboard-Item-status"},Mv(i),jv(i),zv(i)),d(up,{file:i.file,i18n:i.i18n,toggleFileCard:i.toggleFileCard,metaFields:i.metaFields}))}function Hv(i,e){return e===void 0&&(e="Copy the URL below"),new Promise(t=>{const n=document.createElement("textarea");n.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),n.value=i,document.body.appendChild(n),n.select();const a=s=>{document.body.removeChild(n),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(n),t()):a("copy command unavailable")}catch{return document.body.removeChild(n),a()}})}function Vv(i){let{file:e,uploadInProgressOrComplete:t,metaFields:n,canEditFile:a,i18n:s,onClick:o}=i;return!t&&n&&n.length>0||!t&&a(e)?d("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:e.meta.name}),title:s("editFileWithFilename",{file:e.meta.name}),onClick:()=>o()},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14"},d("g",{fillRule:"evenodd"},d("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),d("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),d("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})))):null}function Wv(i){let{i18n:e,onClick:t,file:n}=i;return d("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":e("removeFile",{file:n.meta.name}),title:e("removeFile",{file:n.meta.name}),onClick:()=>t()},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18"},d("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),d("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})))}const Gv=(i,e)=>{Hv(e.file.uploadURL,e.i18n("copyLinkToClipboardFallback")).then(()=>{e.uppy.log("Link copied to clipboard."),e.uppy.info(e.i18n("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.uppy.log).then(()=>i.target.focus({preventScroll:!0}))};function Kv(i){const{i18n:e}=i;return d("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":e("copyLink"),title:e("copyLink"),onClick:t=>Gv(t,i)},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12"},d("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})))}function Xv(i){const{uppy:e,file:t,uploadInProgressOrComplete:n,canEditFile:a,metaFields:s,showLinkToFileUploadResult:o,showRemoveButton:r,i18n:l,toggleFileCard:c,openFileEditor:p}=i;return d("div",{className:"uppy-Dashboard-Item-actionWrapper"},d(Vv,{i18n:l,file:t,uploadInProgressOrComplete:n,canEditFile:a,metaFields:s,onClick:()=>{s&&s.length>0?c(!0,t.id):p(t)}}),o&&t.uploadURL?d(Kv,{file:t,uppy:e,i18n:l}):null,r?d(Wv,{i18n:l,file:t,uppy:e,onClick:()=>e.removeFile(t.id,"removed-by-user")}):null)}class Qv extends dt{componentDidMount(){const{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!Cv(this.props,e)}componentDidUpdate(){const{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){const{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){const{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,n=e.progress.uploadComplete&&!t&&!e.error,a=e.progress.uploadStarted||t,s=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:r}=e;let l=(this.props.individualCancellation||!s)&&!n;n&&this.props.showRemoveButtonAfterComplete&&(l=!0);const c=fe({"uppy-Dashboard-Item":!0,"is-inprogress":s&&!this.props.recoveredState,"is-processing":t,"is-complete":n,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":r});return d("div",{className:c,id:`uppy_${e.id}`,role:this.props.role},d("div",{className:"uppy-Dashboard-Item-preview"},d(Uv,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),d(Lv,{uppy:this.props.uppy,file:e,error:o,isUploaded:n,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,showRemoveButtonAfterComplete:this.props.showRemoveButtonAfterComplete,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})),d("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons"},d(qv,{file:e,id:this.props.id,acquirers:this.props.acquirers,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),d(Xv,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:a,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})))}}function Yv(i,e){const t=[];let n=[];return i.forEach(a=>{n.length<e?n.push(a):(t.push(n),n=[a])}),n.length&&t.push(n),t}function Jv(i){let{id:e,error:t,i18n:n,uppy:a,files:s,acquirers:o,resumableUploads:r,hideRetryButton:l,hidePauseResumeButton:c,hideCancelButton:p,showLinkToFileUploadResult:u,showRemoveButtonAfterComplete:h,isWide:g,metaFields:m,isSingleFile:v,toggleFileCard:f,handleRequestThumbnail:y,handleCancelThumbnail:F,recoveredState:S,individualCancellation:A,itemsPerRow:D,openFileEditor:x,canEditFile:_,toggleAddFilesPanel:O,containerWidth:L,containerHeight:z}=i;const K=D===1?71:200,Z=Wn(()=>{const j=(P,b)=>s[b].isGhost-s[P].isGhost,$=Object.keys(s);return S&&$.sort(j),Yv($,D)},[s,D,S]),G=j=>d("div",{class:"uppy-Dashboard-filesInner",role:"presentation",key:j[0]},j.map($=>d(Qv,{key:$,uppy:a,id:e,error:t,i18n:n,acquirers:o,resumableUploads:r,individualCancellation:A,hideRetryButton:l,hidePauseResumeButton:c,hideCancelButton:p,showLinkToFileUploadResult:u,showRemoveButtonAfterComplete:h,isWide:g,metaFields:m,recoveredState:S,isSingleFile:v,containerWidth:L,containerHeight:z,toggleFileCard:f,handleRequestThumbnail:y,handleCancelThumbnail:F,role:"listitem",openFileEditor:x,canEditFile:_,toggleAddFilesPanel:O,file:s[$]})));return v?d("div",{class:"uppy-Dashboard-files"},G(Z[0])):d(ar,{class:"uppy-Dashboard-files",role:"list",data:Z,renderRow:G,rowHeight:K})}let dp;dp=Symbol.for("uppy test: disable unused locale key warning");class hp extends dt{constructor(){super(...arguments),this.triggerFileInputClick=()=>{this.fileInput.click()},this.triggerFolderInputClick=()=>{this.folderInput.click()},this.triggerVideoCameraInputClick=()=>{this.mobileVideoFileInput.click()},this.triggerPhotoCameraInputClick=()=>{this.mobilePhotoFileInput.click()},this.onFileInputChange=e=>{this.props.handleInputChange(e),e.target.value=null},this.renderHiddenInput=(e,t)=>d("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes,ref:t}),this.renderHiddenCameraInput=(e,t,n)=>{const s={photo:"image/*",video:"video/*"}[e];return d("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t,accept:s,ref:n})},this.renderMyDeviceAcquirer=()=>d("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick},d("div",{className:"uppy-DashboardTab-inner"},d("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"}))),d("div",{className:"uppy-DashboardTab-name"},this.props.i18n("myDevice")))),this.renderPhotoCamera=()=>d("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick},d("div",{className:"uppy-DashboardTab-inner"},d("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"}))),d("div",{className:"uppy-DashboardTab-name"},this.props.i18n("takePictureBtn")))),this.renderVideoCamera=()=>d("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick},d("div",{className:"uppy-DashboardTab-inner"},d("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32"},d("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "}))),d("div",{className:"uppy-DashboardTab-name"},this.props.i18n("recordVideoBtn")))),this.renderBrowseButton=(e,t)=>{const n=this.props.acquirers.length;return d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":n===0},e)},this.renderDropPasteBrowseTagline=e=>{const t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),n=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),a=this.props.fileManagerSelectionType,s=a.charAt(0).toUpperCase()+a.slice(1);return d("div",{class:"uppy-Dashboard-AddFiles-title"},this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${s}`,{browseFiles:t,browseFolders:n,browse:t}):this.props.i18nArray(`dropPaste${s}`,{browseFiles:t,browseFolders:n,browse:t}))},this.renderAcquirer=e=>{var t;return d("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":((t=this.props.activePickerPanel)==null?void 0:t.id)===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id)},d("div",{className:"uppy-DashboardTab-inner"},e.icon()),d("div",{className:"uppy-DashboardTab-name"},e.name)))},this.renderAcquirers=e=>{const t=[...e],n=t.splice(e.length-2,e.length);return d(ot,null,t.map(a=>this.renderAcquirer(a)),d("span",{role:"presentation",style:{"white-space":"nowrap"}},n.map(a=>this.renderAcquirer(a))))},this.renderSourcesList=(e,t)=>{const{showNativePhotoCameraButton:n,showNativeVideoCameraButton:a}=this.props;let s=[];const o="myDevice";t||s.push({key:o,elements:this.renderMyDeviceAcquirer()}),n&&s.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),a&&s.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),s.push(...e.map(u=>({key:u.id,elements:this.renderAcquirer(u)}))),s.length===1&&s[0].key===o&&(s=[]);const l=[...s],c=l.splice(s.length-2,s.length),p=u=>u.map(h=>{let{key:g,elements:m}=h;return d(ot,{key:g},m)});return d(ot,null,this.renderDropPasteBrowseTagline(s.length),d("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist"},p(l),d("span",{role:"presentation",style:{"white-space":"nowrap"}},p(c))))}}[dp](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderPoweredByUppy(){const{i18nArray:e}=this.props,t=d("span",null,d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11"},d("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})),d("span",{className:"uppy-Dashboard-poweredByUppy"},"Uppy")),n=e("poweredBy",{uppy:t});return d("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy"},n)}render(){const{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:n}=this.props;return d("div",{className:"uppy-Dashboard-AddFiles"},this.renderHiddenInput(!1,a=>{this.fileInput=a}),this.renderHiddenInput(!0,a=>{this.folderInput=a}),e&&this.renderHiddenCameraInput("photo",n,a=>{this.mobilePhotoFileInput=a}),t&&this.renderHiddenCameraInput("video",n,a=>{this.mobileVideoFileInput=a}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),d("div",{className:"uppy-Dashboard-AddFiles-info"},this.props.note&&d("div",{className:"uppy-Dashboard-note"},this.props.note),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy(this.props)))}}const Zv=i=>d("div",{className:fe("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel},d("div",{className:"uppy-DashboardContent-bar"},d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},i.i18n("addingMoreFiles")),d("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1)},i.i18n("back"))),d(hp,i));function Bt(i){const{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}function eb(i){let{activePickerPanel:e,className:t,hideAllPanels:n,i18n:a,state:s,uppy:o}=i;return d("div",{className:fe("uppy-DashboardContent-panel",t),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${e.id}`,onDragOver:Bt,onDragLeave:Bt,onDrop:Bt,onPaste:Bt},d("div",{className:"uppy-DashboardContent-bar"},d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},a("importFrom",{name:e.name})),d("button",{className:"uppy-DashboardContent-back",type:"button",onClick:n},a("cancel"))),d("div",{className:"uppy-DashboardContent-panelBody"},o.getPlugin(e.id).render(s)))}function tb(i){const e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return d("div",{className:fe("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor"},d("div",{className:"uppy-DashboardContent-bar"},d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},i.i18nArray("editing",{file:d("span",{className:"uppy-DashboardContent-titleFile"},e.meta?e.meta.name:e.name)})),d("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t},i.i18n("cancel")),d("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor},i.i18n("save"))),d("div",{className:"uppy-DashboardContent-panelBody"},i.editors.map(n=>i.uppy.getPlugin(n.id).render(i.state))))}const nt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function ib(i,e,t,n){if(n===void 0&&(n={}),i)return nt.STATE_ERROR;if(e)return nt.STATE_COMPLETE;if(t)return nt.STATE_PAUSED;let a=nt.STATE_WAITING;const s=Object.keys(n);for(let o=0;o<s.length;o++){const{progress:r}=n[s[o]];if(r.uploadStarted&&!r.uploadComplete)return nt.STATE_UPLOADING;r.preprocess&&a!==nt.STATE_UPLOADING&&(a=nt.STATE_PREPROCESSING),r.postprocess&&a!==nt.STATE_UPLOADING&&a!==nt.STATE_PREPROCESSING&&(a=nt.STATE_POSTPROCESSING)}return a}function nb(i){let{files:e,i18n:t,isAllComplete:n,isAllErrored:a,isAllPaused:s,inProgressNotPausedFiles:o,newFiles:r,processingFiles:l}=i;switch(ib(a,n,s,e)){case"uploading":return t("uploadingXFiles",{smart_count:o.length});case"preprocessing":case"postprocessing":return t("processingXFiles",{smart_count:l.length});case"paused":return t("uploadPaused");case"waiting":return t("xFilesSelected",{smart_count:r.length});case"complete":return t("uploadComplete");case"error":return t("error")}}function ab(i){const{i18n:e,isAllComplete:t,hideCancelButton:n,maxNumberOfFiles:a,toggleAddFilesPanel:s,uppy:o}=i;let{allowNewUpload:r}=i;return r&&a&&(r=i.totalFileCount<i.maxNumberOfFiles),d("div",{className:"uppy-DashboardContent-bar"},!t&&!n?d("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll()},e("cancel")):d("div",null),d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},d(nb,i)),r?d("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>s(!0)},d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15"},d("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})),d("span",{className:"uppy-DashboardContent-addMoreCaption"},e("addMore"))):d("div",null))}function sb(i){const{computedMetaFields:e,requiredMetaFields:t,updateMeta:n,form:a,formState:s}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(r=>{const l=`uppy-Dashboard-FileCard-input-${r.id}`,c=t.includes(r.id);return d("fieldset",{key:r.id,className:"uppy-Dashboard-FileCard-fieldset"},d("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l},r.name),r.render!==void 0?r.render({value:s[r.id],onChange:p=>n(p,r.id),fieldCSSClasses:o,required:c,form:a.id},d):d("input",{className:o.text,id:l,form:a.id,type:r.type||"text",required:c,value:s[r.id],placeholder:r.placeholder,onInput:p=>n(p.target.value,r.id),"data-uppy-super-focusable":!0}))})}function ob(i){var e;const{files:t,fileCardFor:n,toggleFileCard:a,saveFileCard:s,metaFields:o,requiredMetaFields:r,openFileEditor:l,i18n:c,i18nArray:p,className:u,canEditFile:h}=i,g=()=>typeof o=="function"?o(t[n]):o,m=t[n],v=(e=g())!=null?e:[],f=h(m),y={};v.forEach(O=>{var L;y[O.id]=(L=m.meta[O.id])!=null?L:""});const[F,S]=zt(y),A=wi(O=>{O.preventDefault(),s(F,n)},[s,F,n]),D=(O,L)=>{S({...F,[L]:O})},x=()=>{a(!1)},[_]=zt(()=>{const O=document.createElement("form");return O.setAttribute("tabindex","-1"),O.id=Ci(),O});return An(()=>(document.body.appendChild(_),_.addEventListener("submit",A),()=>{_.removeEventListener("submit",A),document.body.removeChild(_)}),[_,A]),d("div",{className:fe("uppy-Dashboard-FileCard",u),"data-uppy-panelType":"FileCard",onDragOver:Bt,onDragLeave:Bt,onDrop:Bt,onPaste:Bt},d("div",{className:"uppy-DashboardContent-bar"},d("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},p("editing",{file:d("span",{className:"uppy-DashboardContent-titleFile"},m.meta?m.meta.name:m.name)})),d("button",{className:"uppy-DashboardContent-back",type:"button",form:_.id,title:c("finishEditingFile"),onClick:x},c("cancel"))),d("div",{className:"uppy-Dashboard-FileCard-inner"},d("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:hr(m.type).color}},d(cp,{file:m}),f&&d("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:O=>{A(O),l(m)}},c("editImage"))),d("div",{className:"uppy-Dashboard-FileCard-info"},d(sb,{computedMetaFields:v,requiredMetaFields:r,updateMeta:D,form:_,formState:F})),d("div",{className:"uppy-Dashboard-FileCard-actions"},d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:_.id},c("saveChanges")),d("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:x,form:_.id},c("cancel")))))}const ci="uppy-transition-slideDownUp",Tl=250;function pa(i){let{children:e}=i;const[t,n]=zt(null),[a,s]=zt(""),o=Ps(),r=Ps(),l=Ps(),c=()=>{s(`${ci}-enter`),cancelAnimationFrame(l.current),clearTimeout(r.current),r.current=void 0,l.current=requestAnimationFrame(()=>{s(`${ci}-enter ${ci}-enter-active`),o.current=setTimeout(()=>{s("")},Tl)})},p=()=>{s(`${ci}-leave`),cancelAnimationFrame(l.current),clearTimeout(o.current),o.current=void 0,l.current=requestAnimationFrame(()=>{s(`${ci}-leave ${ci}-leave-active`),r.current=setTimeout(()=>{n(null),s("")},Tl)})};return An(()=>{const u=Ct(e)[0];t!==u&&(u&&!t?c():t&&!u&&!r.current&&p(),n(u))},[e,t]),An(()=>()=>{clearTimeout(o.current),clearTimeout(r.current),cancelAnimationFrame(l.current)},[]),t?lu(t,{className:fe(a,t.props.className)}):null}function ni(){return ni=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},ni.apply(this,arguments)}const Ol=900,Al=700,Rs=576,Dl=330;function rb(i){const e=i.totalFileCount===0,t=i.totalFileCount===1,n=i.containerWidth>Rs,a=i.containerHeight>Dl,s=fe({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>Rs,"uppy-size--lg":i.containerWidth>Al,"uppy-size--xl":i.containerWidth>Ol,"uppy-size--height-md":i.containerHeight>Dl,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&a});let o=1;i.containerWidth>Ol?o=5:i.containerWidth>Al?o=4:i.containerWidth>Rs&&(o=3);const r=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,c=i.files?Object.keys(i.files).filter(h=>i.files[h].isGhost).length:null,p=()=>c>0?i.i18n("recoveredXFiles",{smart_count:c}):i.i18n("recoveredAllFiles");return d("div",{className:s,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&lp(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop},d("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),d("div",{className:"uppy-Dashboard-inner","aria-modal":!i.inline&&"true",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""}},i.inline?null:d("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal},d("span",{"aria-hidden":"true"},"×")),d("div",{className:"uppy-Dashboard-innerWrap"},d("div",{className:"uppy-Dashboard-dropFilesHereHint"},i.i18n("dropHint")),r&&d(ab,i),l&&d("div",{className:"uppy-Dashboard-serviceMsg"},d("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19"},d("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd"},d("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),d("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),d("circle",{fill:"#000",cx:"12",cy:"17",r:"1"}))),d("strong",{className:"uppy-Dashboard-serviceMsg-title"},i.i18n("sessionRestored")),d("div",{className:"uppy-Dashboard-serviceMsg-text"},p())),r?d(Jv,{id:i.id,error:i.error,i18n:i.i18n,uppy:i.uppy,files:i.files,acquirers:i.acquirers,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,isWide:i.isWide,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o}):d(hp,ni({},i,{isSizeMD:n})),d(pa,null,i.showAddFilesPanel?d(Zv,ni({key:"AddFiles"},i,{isSizeMD:n})):null),d(pa,null,i.fileCardFor?d(ob,ni({key:"FileCard"},i)):null),d(pa,null,i.activePickerPanel?d(eb,ni({key:"Picker"},i)):null),d(pa,null,i.showFileEditor?d(tb,ni({key:"Editor"},i)):null),d("div",{className:"uppy-Dashboard-progressindicators"},i.progressindicators.map(h=>i.uppy.getPlugin(h.id).render(i.state))))))}const lb={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};function Q(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var cb=0;function it(i){return"__private_"+cb+++"_"+i}const ub={version:"3.8.1"},Is=Mr.default||Mr,Rl=9,pb=27;function Il(){const i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}const db={target:"body",metaFields:[],inline:!1,width:750,height:550,thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:ju,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,closeModalOnClickOutside:!1,closeAfterFinish:!1,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,disablePageScrollWhenModalOpen:!0,animateOpenClose:!0,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,browserBackButtonClose:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,autoOpenFileEditor:!1,disabled:!1,disableLocalFiles:!1,doneButtonHandler:null,onRequestCloseModal:null};var qt=it("disabledNodes"),yt=it("generateLargeThumbnailIfSingleFile"),Xi=it("openFileEditorWhenFilesAdded"),Ht=it("attachRenderFunctionToTarget"),Us=it("isTargetSupported"),Ns=it("getAcquirers"),Ls=it("getProgressIndicators"),xt=it("getEditors"),Bs=it("addSpecifiedPluginsFromOptions"),Ms=it("autoDiscoverPlugins"),Vt=it("addSupportedPluginIfNoTarget");let mr=class extends ye{constructor(e,t){var n,a,s,o;let r;t?t.autoOpen===void 0?r=t.autoOpenFileEditor?"imageEditor":null:r=t.autoOpen:r=null,super(e,{...db,...t,autoOpen:r}),Object.defineProperty(this,qt,{writable:!0,value:void 0}),this.modalName=`uppy-Dashboard-${Ci()}`,this.superFocus=Fv(),this.ifFocusedOnUppyRecently=!1,this.removeTarget=l=>{const p=this.getPluginState().targets.filter(u=>u.id!==l.id);this.setPluginState({targets:p})},this.addTarget=l=>{const c=l.id||l.constructor.name,p=l.title||c,u=l.type;if(u!=="acquirer"&&u!=="progressindicator"&&u!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;const h={id:c,name:p,type:u},m=this.getPluginState().targets.slice();return m.push(h),this.setPluginState({targets:m}),this.el},this.hideAllPanels=()=>{var l;const c=this.getPluginState(),p={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};c.activePickerPanel===p.activePickerPanel&&c.showAddFilesPanel===p.showAddFilesPanel&&c.showFileEditor===p.showFileEditor&&c.activeOverlayType===p.activeOverlayType||(this.setPluginState(p),this.uppy.emit("dashboard:close-panel",(l=c.activePickerPanel)==null?void 0:l.id))},this.showPanel=l=>{const{targets:c}=this.getPluginState(),p=c.find(u=>u.type==="acquirer"&&u.id===l);this.setPluginState({activePickerPanel:p,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",l)},this.canEditFile=l=>{const{targets:c}=this.getPluginState();return Q(this,xt)[xt](c).some(u=>this.uppy.getPlugin(u.id).canEditFile(l))},this.openFileEditor=l=>{const{targets:c}=this.getPluginState(),p=Q(this,xt)[xt](c);this.setPluginState({showFileEditor:!0,fileCardFor:l.id||null,activeOverlayType:"FileEditor"}),p.forEach(u=>{this.uppy.getPlugin(u.id).selectFile(l)})},this.closeFileEditor=()=>{const{metaFields:l}=this.getPluginState();l&&l.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})},this.saveFileEditor=()=>{const{targets:l}=this.getPluginState();Q(this,xt)[xt](l).forEach(p=>{this.uppy.getPlugin(p.id).save()}),this.closeFileEditor()},this.openModal=()=>{const{promise:l,resolve:c}=Il();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){const p=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",p,!1),c()};this.el.addEventListener("animationend",p,!1)}else this.setPluginState({isHidden:!1}),c();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),l},this.closeModal=l=>{var c;const p=(c=l==null?void 0:l.manualClose)!=null?c:!0,{isHidden:u,isClosing:h}=this.getPluginState();if(u||h)return;const{promise:g,resolve:m}=Il();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});const f=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",f,!1),m()};this.el.addEventListener("animationend",f,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),m();if(document.removeEventListener("keydown",this.handleKeyDownInModal),p&&this.opts.browserBackButtonClose){var v;(v=history.state)!=null&&v[this.modalName]&&history.back()}return this.uppy.emit("dashboard:modal-closed"),g},this.isModalOpen=()=>!this.getPluginState().isHidden||!1,this.requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal(),this.setDarkModeCapability=l=>{const{capabilities:c}=this.uppy.getState();this.uppy.setState({capabilities:{...c,darkMode:l}})},this.handleSystemDarkModeChange=l=>{const c=l.matches;this.uppy.log(`[Dashboard] Dark mode is ${c?"on":"off"}`),this.setDarkModeCapability(c)},this.toggleFileCard=(l,c)=>{const p=this.uppy.getFile(c);l?this.uppy.emit("dashboard:file-edit-start",p):this.uppy.emit("dashboard:file-edit-complete",p),this.setPluginState({fileCardFor:l?c:null,activeOverlayType:l?"FileCard":null})},this.toggleAddFilesPanel=l=>{this.setPluginState({showAddFilesPanel:l,activeOverlayType:l?"AddFiles":null})},this.addFiles=l=>{const c=l.map(p=>({source:this.id,name:p.name,type:p.type,data:p,meta:{relativePath:p.relativePath||p.webkitRelativePath||null}}));try{this.uppy.addFiles(c)}catch(p){this.uppy.log(p)}},this.startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(l=>{const c=l[0],{width:p,height:u}=c.contentRect;this.setPluginState({containerWidth:p,containerHeight:u,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{const l=this.getPluginState(),c=!this.opts.inline&&l.isHidden;!l.areInsidesReadyToBeVisible&&!c&&(this.uppy.log("[Dashboard] resize event didn’t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)},this.stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)},this.recordIfFocusedOnUppyRecently=l=>{this.el.contains(l.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())},this.disableInteractiveElements=l=>{var c;const p=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],u=(c=Q(this,qt)[qt])!=null?c:rt(this.el.querySelectorAll(p)).filter(h=>!h.classList.contains("uppy-Dashboard-close"));for(const h of u)h.tagName==="A"?h.setAttribute("aria-disabled",l):h.disabled=l;l?Q(this,qt)[qt]=u:Q(this,qt)[qt]=null,this.dashboardIsDisabled=l},this.updateBrowserHistory=()=>{var l;(l=history.state)!=null&&l[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)},this.handlePopState=l=>{var c;this.isModalOpen()&&(!l.state||!l.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&(c=l.state)!=null&&c[this.modalName]&&history.back()},this.handleKeyDownInModal=l=>{l.keyCode===pb&&this.requestCloseModal(),l.keyCode===Rl&&rp(l,this.getPluginState().activeOverlayType,this.el)},this.handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()},this.handlePaste=l=>{this.uppy.iteratePlugins(p=>{p.type==="acquirer"&&(p.handleRootPaste==null||p.handleRootPaste(l))});const c=rt(l.clipboardData.files);c.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(c))},this.handleInputChange=l=>{l.preventDefault();const c=rt(l.target.files);c.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(c))},this.handleDragOver=l=>{var c,p;l.preventDefault(),l.stopPropagation();const u=()=>{let v=!0;return this.uppy.iteratePlugins(f=>{f.canHandleRootDrop!=null&&f.canHandleRootDrop(l)&&(v=!0)}),v},h=()=>{const{types:v}=l.dataTransfer;return v.some(f=>f==="Files")},g=u(),m=h();if(!g&&!m||this.opts.disabled||this.opts.disableLocalFiles&&(m||!g)||!this.uppy.getState().allowNewUpload){l.dataTransfer.dropEffect="none",clearTimeout(this.removeDragOverClassTimeout);return}l.dataTransfer.dropEffect="copy",clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!0}),(c=(p=this.opts).onDragOver)==null||c.call(p,l)},this.handleDragLeave=l=>{var c,p;l.preventDefault(),l.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.removeDragOverClassTimeout=setTimeout(()=>{this.setPluginState({isDraggingOver:!1})},50),(c=(p=this.opts).onDragLeave)==null||c.call(p,l)},this.handleDrop=async l=>{var c,p;l.preventDefault(),l.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(m=>{m.type==="acquirer"&&(m.handleRootDrop==null||m.handleRootDrop(l))});let u=!1;const h=m=>{this.uppy.log(m,"error"),u||(this.uppy.info(m.message,"error"),u=!0)};this.uppy.log("[Dashboard] Processing dropped files");const g=await dr(l.dataTransfer,{logDropError:h});g.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(g)),(c=(p=this.opts).onDrop)==null||c.call(p,l)},this.handleRequestThumbnail=l=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",l)},this.handleCancelThumbnail=l=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",l)},this.handleKeyDownInInline=l=>{l.keyCode===Rl&&Sv(l,this.getPluginState().activeOverlayType,this.el)},this.handlePasteOnBody=l=>{this.el.contains(document.activeElement)&&this.handlePaste(l)},this.handleComplete=l=>{let{failed:c}=l;this.opts.closeAfterFinish&&!(c!=null&&c.length)&&this.requestCloseModal()},this.handleCancelRestore=()=>{this.uppy.emit("restore-canceled")},Object.defineProperty(this,yt,{writable:!0,value:()=>{if(this.opts.disableThumbnailGenerator)return;const l=600,c=this.uppy.getFiles();if(c.length===1){const p=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);p==null||p.setOptions({thumbnailWidth:l});const u={...c[0],preview:void 0};p==null||p.requestThumbnail(u).then(()=>{p==null||p.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}}}),Object.defineProperty(this,Xi,{writable:!0,value:l=>{const c=l[0],{metaFields:p}=this.getPluginState(),u=p&&p.length>0,h=this.canEditFile(c);u&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,c.id):h&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(c)}}),this.initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){const l=Cl(this.opts.trigger);l?l.forEach(c=>c.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",Q(this,Vt)[Vt]),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",Q(this,yt)[yt]),this.uppy.on("file-removed",Q(this,yt)[yt]),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",Q(this,Xi)[Xi])},this.removeEvents=()=>{const l=Cl(this.opts.trigger);!this.opts.inline&&l&&l.forEach(c=>c.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",Q(this,Vt)[Vt]),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",Q(this,yt)[yt]),this.uppy.off("file-removed",Q(this,yt)[yt]),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",Q(this,Xi)[Xi])},this.superFocusOnEachUpdate=()=>{const l=this.el.contains(document.activeElement),c=document.activeElement===document.body||document.activeElement===null,p=this.uppy.getState().info.length===0,u=!this.opts.inline;p&&(u||l||c&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()},this.afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()},this.saveFileCard=(l,c)=>{this.uppy.setFileMeta(c,l),this.toggleFileCard(!1,c)},Object.defineProperty(this,Ht,{writable:!0,value:l=>{const c=this.uppy.getPlugin(l.id);return{...l,icon:c.icon||this.opts.defaultPickerIcon,render:c.render}}}),Object.defineProperty(this,Us,{writable:!0,value:l=>{const c=this.uppy.getPlugin(l.id);return typeof c.isSupported!="function"?!0:c.isSupported()}}),Object.defineProperty(this,Ns,{writable:!0,value:Is(l=>l.filter(c=>c.type==="acquirer"&&Q(this,Us)[Us](c)).map(Q(this,Ht)[Ht]))}),Object.defineProperty(this,Ls,{writable:!0,value:Is(l=>l.filter(c=>c.type==="progressindicator").map(Q(this,Ht)[Ht]))}),Object.defineProperty(this,xt,{writable:!0,value:Is(l=>l.filter(c=>c.type==="editor").map(Q(this,Ht)[Ht]))}),this.render=l=>{const c=this.getPluginState(),{files:p,capabilities:u,allowNewUpload:h}=l,{newFiles:g,uploadStartedFiles:m,completeFiles:v,erroredFiles:f,inProgressFiles:y,inProgressNotPausedFiles:F,processingFiles:S,isUploadStarted:A,isAllComplete:D,isAllErrored:x,isAllPaused:_}=this.uppy.getObjectOfFilesPerState(),O=Q(this,Ns)[Ns](c.targets),L=Q(this,Ls)[Ls](c.targets),z=Q(this,xt)[xt](c.targets);let K;return this.opts.theme==="auto"?K=u.darkMode?"dark":"light":K=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),rb({state:l,isHidden:c.isHidden,files:p,newFiles:g,uploadStartedFiles:m,completeFiles:v,erroredFiles:f,inProgressFiles:y,inProgressNotPausedFiles:F,processingFiles:S,isUploadStarted:A,isAllComplete:D,isAllErrored:x,isAllPaused:_,totalFileCount:Object.keys(p).length,totalProgress:l.totalProgress,allowNewUpload:h,acquirers:O,theme:K,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:c.activePickerPanel,showFileEditor:c.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:c.isClosing,progressindicators:L,editors:z,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:l.recoveredState,metaFields:c.metaFields,resumableUploads:u.resumableUploads||!1,individualCancellation:u.individualCancellation,isMobileDevice:u.isMobileDevice,fileCardFor:c.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:c.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:c.containerWidth,containerHeight:c.containerHeight,areInsidesReadyToBeVisible:c.areInsidesReadyToBeVisible,isTargetDOMEl:this.isTargetDOMEl,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:c.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})},Object.defineProperty(this,Bs,{writable:!0,value:()=>{(this.opts.plugins||[]).forEach(c=>{const p=this.uppy.getPlugin(c);p?p.mount(this,p):this.uppy.log(`[Uppy] Dashboard could not find plugin '${c}', make sure to uppy.use() the plugins you are specifying`,"warning")})}}),Object.defineProperty(this,Ms,{writable:!0,value:()=>{this.uppy.iteratePlugins(Q(this,Vt)[Vt])}}),Object.defineProperty(this,Vt,{writable:!0,value:l=>{var c;const p=["acquirer","editor"];l&&!((c=l.opts)!=null&&c.target)&&p.includes(l.type)&&(this.getPluginState().targets.some(h=>l.id===h.id)||l.mount(this,l))}}),this.install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});const{inline:l,closeAfterFinish:c}=this.opts;if(l&&c)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");const{allowMultipleUploads:p,allowMultipleUploadBatches:u}=this.uppy.opts;(p||u)&&c&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");const{target:h}=this.opts;h&&this.mount(h,this),this.opts.disableStatusBar||this.uppy.use(sr,{id:`${this.id}:StatusBar`,target:this,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,showProgressDetails:this.opts.showProgressDetails,hideAfterFinish:this.opts.hideProgressAfterFinish,locale:this.opts.locale,doneButtonHandler:this.opts.doneButtonHandler}),this.opts.disableInformer||this.uppy.use(Gu,{id:`${this.id}:Informer`,target:this}),this.opts.disableThumbnailGenerator||this.uppy.use(pr,{id:`${this.id}:ThumbnailGenerator`,thumbnailWidth:this.opts.thumbnailWidth,thumbnailHeight:this.opts.thumbnailHeight,thumbnailType:this.opts.thumbnailType,waitForThumbnailsBeforeUpload:this.opts.waitForThumbnailsBeforeUpload,lazy:!this.opts.waitForThumbnailsBeforeUpload}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;const g=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;if(this.uppy.log(`[Dashboard] Dark mode is ${g?"on":"off"}`),this.setDarkModeCapability(g),this.opts.theme==="auto"){var m;(m=this.darkModeMediaQuery)==null||m.addListener(this.handleSystemDarkModeChange)}Q(this,Bs)[Bs](),Q(this,Ms)[Ms](),this.initEvents()},this.uninstall=()=>{if(!this.opts.disableInformer){const p=this.uppy.getPlugin(`${this.id}:Informer`);p&&this.uppy.removePlugin(p)}if(!this.opts.disableStatusBar){const p=this.uppy.getPlugin(`${this.id}:StatusBar`);p&&this.uppy.removePlugin(p)}if(!this.opts.disableThumbnailGenerator){const p=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);p&&this.uppy.removePlugin(p)}if((this.opts.plugins||[]).forEach(p=>{const u=this.uppy.getPlugin(p);u&&u.unmount()}),this.opts.theme==="auto"){var c;(c=this.darkModeMediaQuery)==null||c.removeListener(this.handleSystemDarkModeChange)}this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()},this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=lb,(a=(n=this.opts).doneButtonHandler)!=null||(n.doneButtonHandler=()=>{this.uppy.clearUploadedFiles(),this.requestCloseModal()}),(o=(s=this.opts).onRequestCloseModal)!=null||(s.onRequestCloseModal=()=>this.closeModal()),this.i18nInit()}};mr.VERSION=ub.version;const ki=R.instanceOf(xu),mp=R.arrayOf(R.string),is=R.shape({strings:R.object,pluralize:R.func}),hb=R.shape({id:R.string.isRequired,name:R.string.isRequired,placeholder:R.string}),fp=R.oneOfType([R.arrayOf(hb),R.func]),Ha=R.oneOfType([R.string,R.number]),mb=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],fb=/^(aria-|data-)/,Kn=i=>Object.fromEntries(Object.entries(i).filter(e=>{let[t]=e;return fb.test(t)||mb.includes(t)}));function Xn(i,e){return Object.keys(i).some(t=>!Object.hasOwn(i,t)&&i[t]!==e[t])}class gp extends ne.Component{componentDidMount(){this.installPlugin()}componentDidUpdate(e){if(e.uppy!==this.props.uppy)this.uninstallPlugin(e),this.installPlugin();else if(Xn(this.props,e)){const{uppy:t,...n}={...this.props,target:this.container};this.plugin.setOptions(n)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:e,...t}={id:"react:Dashboard",inline:!0,...this.props,target:this.container};e.use(mr,t),this.plugin=e.getPlugin(t.id)}uninstallPlugin(e){e===void 0&&(e=this.props);const{uppy:t}=e;t.removePlugin(this.plugin)}render(){return ne.createElement("div",{className:"uppy-Container",ref:e=>{this.container=e},...Kn(this.props)})}}gp.propsTypes={uppy:ki,disableInformer:R.bool,disableStatusBar:R.bool,disableThumbnailGenerator:R.bool,height:Ha,hideProgressAfterFinish:R.bool,hideUploadButton:R.bool,locale:is,metaFields:fp,note:R.string,plugins:mp,proudlyDisplayPoweredByUppy:R.bool,showProgressDetails:R.bool,width:Ha,thumbnailType:R.string,thumbnailWidth:R.number};class vp extends ne.Component{componentDidMount(){this.installPlugin()}componentDidUpdate(e){const{uppy:t,open:n,onRequestClose:a}=this.props;if(e.uppy!==t)this.uninstallPlugin(e),this.installPlugin();else if(Xn(this.props,e)){const{uppy:s,...o}={...this.props,inline:!1,onRequestCloseModal:a};this.plugin.setOptions(o)}e.open&&!n?this.plugin.closeModal():!e.open&&n&&this.plugin.openModal()}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{target:e=this.container,open:t,onRequestClose:n,uppy:a,...s}=this.props,o={...s,id:"react:DashboardModal",inline:!1,target:e,open:t,onRequestCloseModal:n};a.use(mr,o),this.plugin=a.getPlugin(o.id),t&&this.plugin.openModal()}uninstallPlugin(e){e===void 0&&(e=this.props);const{uppy:t}=e;t.removePlugin(this.plugin)}render(){return ne.createElement("div",{className:"uppy-Container",ref:e=>{this.container=e},...Kn(this.props)})}}vp.propTypes={uppy:ki.isRequired,target:typeof window<"u"?R.instanceOf(window.HTMLElement):R.any,open:R.bool,onRequestClose:R.func,closeModalOnClickOutside:R.bool,disablePageScrollWhenModalOpen:R.bool,plugins:mp,width:Ha,height:Ha,showProgressDetails:R.bool,note:R.string,metaFields:fp,proudlyDisplayPoweredByUppy:R.bool,autoOpenFileEditor:R.bool,animateOpenClose:R.bool,browserBackButtonClose:R.bool,closeAfterFinish:R.bool,disableStatusBar:R.bool,disableInformer:R.bool,disableThumbnailGenerator:R.bool,disableLocalFiles:R.bool,disabled:R.bool,hideCancelButton:R.bool,hidePauseResumeButton:R.bool,hideProgressAfterFinish:R.bool,hideRetryButton:R.bool,hideUploadButton:R.bool,showLinkToFileUploadResult:R.bool,showRemoveButtonAfterComplete:R.bool,showSelectedFiles:R.bool,waitForThumbnailsBeforeUpload:R.bool,fileManagerSelectionType:R.string,theme:R.string,thumbnailType:R.string,thumbnailWidth:R.number,locale:is};vp.defaultProps={metaFields:[],plugins:[],width:750,height:550,thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,closeModalOnClickOutside:!1,closeAfterFinish:!1,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,disablePageScrollWhenModalOpen:!0,animateOpenClose:!0,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,browserBackButtonClose:!1,theme:"light",autoOpenFileEditor:!1,disabled:!1,disableLocalFiles:!1,open:void 0,target:void 0,locale:null,onRequestClose:void 0};const gb={strings:{dropHereOr:"Drop here or %{browse}",browse:"browse"}},vb={version:"3.1.0"},bb={inputName:"files[]",width:"100%",height:"100%"};let bp=class yp extends ye{constructor(e,t){super(e,{...bb,...t}),this.isDragDropSupported=lp(),this.addFiles=n=>{const a=n.map(s=>({source:this.id,name:s.name,type:s.type,data:s,meta:{relativePath:s.relativePath||null}}));try{this.uppy.addFiles(a)}catch(s){this.uppy.log(s)}},this.onInputChange=n=>{const a=rt(n.target.files);a.length>0&&(this.uppy.log("[DragDrop] Files selected through input"),this.addFiles(a)),n.target.value=null},this.handleDragOver=n=>{var a,s;n.preventDefault(),n.stopPropagation();const{types:o}=n.dataTransfer,r=o.some(c=>c==="Files"),{allowNewUpload:l}=this.uppy.getState();if(!r||!l){n.dataTransfer.dropEffect="none",clearTimeout(this.removeDragOverClassTimeout);return}n.dataTransfer.dropEffect="copy",clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!0}),(a=(s=this.opts).onDragOver)==null||a.call(s,n)},this.handleDragLeave=n=>{var a,s;n.preventDefault(),n.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.removeDragOverClassTimeout=setTimeout(()=>{this.setPluginState({isDraggingOver:!1})},50),(a=(s=this.opts).onDragLeave)==null||a.call(s,n)},this.handleDrop=async n=>{var a,s;n.preventDefault(),n.stopPropagation(),clearTimeout(this.removeDragOverClassTimeout),this.setPluginState({isDraggingOver:!1});const o=l=>{this.uppy.log(l,"error")},r=await dr(n.dataTransfer,{logDropError:o});r.length>0&&(this.uppy.log("[DragDrop] Files dropped"),this.addFiles(r)),(a=(s=this.opts).onDrop)==null||a.call(s,n)},this.type="acquirer",this.id=this.opts.id||"DragDrop",this.title="Drag & Drop",this.defaultLocale=gb,this.i18nInit()}renderHiddenFileInput(){const{restrictions:e}=this.uppy.opts;return d("input",{className:"uppy-DragDrop-input",type:"file",hidden:!0,ref:t=>{this.fileInputRef=t},name:this.opts.inputName,multiple:e.maxNumberOfFiles!==1,accept:e.allowedFileTypes,onChange:this.onInputChange})}static renderArrowSvg(){return d("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16"},d("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0",fillRule:"evenodd"}))}renderLabel(){return d("div",{className:"uppy-DragDrop-label"},this.i18nArray("dropHereOr",{browse:d("span",{className:"uppy-DragDrop-browse"},this.i18n("browse"))}))}renderNote(){return d("span",{className:"uppy-DragDrop-note"},this.opts.note)}render(){const e=`uppy-u-reset
|
|
27
27
|
uppy-DragDrop-container
|
|
28
28
|
${this.isDragDropSupported?"uppy-DragDrop--isDragDropSupported":""}
|
|
29
29
|
${this.getPluginState().isDraggingOver?"uppy-DragDrop--isDraggingOver":""}
|
|
@@ -36,8 +36,8 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&
|
|
|
36
36
|
*
|
|
37
37
|
* Date: 2020-05-23T05:23:00.081Z
|
|
38
38
|
*/function ka(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ka=function(e){return typeof e}:ka=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ka(i)}function Cb(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Ul(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,n.key,n)}}function Eb(i,e,t){return e&&Ul(i.prototype,e),t&&Ul(i,t),i}function kb(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Nl(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function Ep(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Nl(Object(t),!0).forEach(function(n){kb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Nl(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function kp(i){return Tb(i)||Ob(i)||Ab(i)||Db()}function Tb(i){if(Array.isArray(i))return bo(i)}function Ob(i){if(typeof Symbol<"u"&&Symbol.iterator in Object(i))return Array.from(i)}function Ab(i,e){if(i){if(typeof i=="string")return bo(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return bo(i,e)}}function bo(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=i[t];return n}function Db(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
39
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ns=typeof window<"u"&&typeof window.document<"u",ut=ns?window:{},fr=ns&&ut.document.documentElement?"ontouchstart"in ut.document.documentElement:!1,gr=ns?"PointerEvent"in ut:!1,Y="cropper",vr="all",Tp="crop",Op="move",Ap="zoom",Wt="e",Gt="w",ui="s",Dt="n",Qi="ne",Yi="nw",Ji="se",Zi="sw",yo="".concat(Y,"-crop"),Ll="".concat(Y,"-disabled"),ke="".concat(Y,"-hidden"),Bl="".concat(Y,"-hide"),Rb="".concat(Y,"-invisible"),Va="".concat(Y,"-modal"),xo="".concat(Y,"-move"),In="".concat(Y,"Action"),da="".concat(Y,"Preview"),br="crop",Dp="move",Rp="none",wo="crop",Po="cropend",So="cropmove",Fo="cropstart",Ml="dblclick",Ib=fr?"touchstart":"mousedown",Ub=fr?"touchmove":"mousemove",Nb=fr?"touchend touchcancel":"mouseup",jl=gr?"pointerdown":Ib,zl=gr?"pointermove":Ub,$l=gr?"pointerup pointercancel":Nb,ql="ready",Hl="resize",Vl="wheel",_o="zoom",Wl="image/jpeg",Lb=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Bb=/^data:/,Mb=/^data:image\/jpeg;base64,/,jb=/^img|canvas$/i,Gl={viewMode:0,dragMode:br,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},zb='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',$b=Number.isNaN||ut.isNaN;function H(i){return typeof i=="number"&&!$b(i)}var Kl=function(e){return e>0&&e<1/0};function zs(i){return typeof i>"u"}function oi(i){return ka(i)==="object"&&i!==null}var qb=Object.prototype.hasOwnProperty;function mi(i){if(!oi(i))return!1;try{var e=i.constructor,t=e.prototype;return e&&t&&qb.call(t,"isPrototypeOf")}catch{return!1}}function Ce(i){return typeof i=="function"}var Hb=Array.prototype.slice;function Ip(i){return Array.from?Array.from(i):Hb.call(i)}function ue(i,e){return i&&Ce(e)&&(Array.isArray(i)||H(i.length)?Ip(i).forEach(function(t,n){e.call(i,t,n,i)}):oi(i)&&Object.keys(i).forEach(function(t){e.call(i,i[t],t,i)})),i}var J=Object.assign||function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return oi(e)&&n.length>0&&n.forEach(function(s){oi(s)&&Object.keys(s).forEach(function(o){e[o]=s[o]})}),e},Vb=/\.\d*(?:0|9){12}\d*$/;function bi(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Vb.test(i)?Math.round(i*e)/e:i}var Wb=/^width|height|left|top|marginLeft|marginTop$/;function Mt(i,e){var t=i.style;ue(e,function(n,a){Wb.test(a)&&H(n)&&(n="".concat(n,"px")),t[a]=n})}function Gb(i,e){return i.classList?i.classList.contains(e):i.className.indexOf(e)>-1}function ve(i,e){if(e){if(H(i.length)){ue(i,function(n){ve(n,e)});return}if(i.classList){i.classList.add(e);return}var t=i.className.trim();t?t.indexOf(e)<0&&(i.className="".concat(t," ").concat(e)):i.className=e}}function lt(i,e){if(e){if(H(i.length)){ue(i,function(t){lt(t,e)});return}if(i.classList){i.classList.remove(e);return}i.className.indexOf(e)>=0&&(i.className=i.className.replace(e,""))}}function fi(i,e,t){if(e){if(H(i.length)){ue(i,function(n){fi(n,e,t)});return}t?ve(i,e):lt(i,e)}}var Kb=/([a-z\d])([A-Z])/g;function yr(i){return i.replace(Kb,"$1-$2").toLowerCase()}function Co(i,e){return oi(i[e])?i[e]:i.dataset?i.dataset[e]:i.getAttribute("data-".concat(yr(e)))}function Un(i,e,t){oi(t)?i[e]=t:i.dataset?i.dataset[e]=t:i.setAttribute("data-".concat(yr(e)),t)}function Xb(i,e){if(oi(i[e]))try{delete i[e]}catch{i[e]=void 0}else if(i.dataset)try{delete i.dataset[e]}catch{i.dataset[e]=void 0}else i.removeAttribute("data-".concat(yr(e)))}var Up=/\s\s*/,Np=function(){var i=!1;if(ns){var e=!1,t=function(){},n=Object.defineProperty({},"once",{get:function(){return i=!0,e},set:function(s){e=s}});ut.addEventListener("test",t,n),ut.removeEventListener("test",t,n)}return i}();function Ge(i,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=t;e.trim().split(Up).forEach(function(s){if(!Np){var o=i.listeners;o&&o[s]&&o[s][t]&&(a=o[s][t],delete o[s][t],Object.keys(o[s]).length===0&&delete o[s],Object.keys(o).length===0&&delete i.listeners)}i.removeEventListener(s,a,n)})}function ze(i,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=t;e.trim().split(Up).forEach(function(s){if(n.once&&!Np){var o=i.listeners,r=o===void 0?{}:o;a=function(){delete r[s][t],i.removeEventListener(s,a,n);for(var c=arguments.length,p=new Array(c),u=0;u<c;u++)p[u]=arguments[u];t.apply(i,p)},r[s]||(r[s]={}),r[s][t]&&i.removeEventListener(s,r[s][t],n),r[s][t]=a,i.listeners=r}i.addEventListener(s,a,n)})}function yi(i,e,t){var n;return Ce(Event)&&Ce(CustomEvent)?n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(e,!0,!0,t)),i.dispatchEvent(n)}function Lp(i){var e=i.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var $s=ut.location,Qb=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Xl(i){var e=i.match(Qb);return e!==null&&(e[1]!==$s.protocol||e[2]!==$s.hostname||e[3]!==$s.port)}function Ql(i){var e="timestamp=".concat(new Date().getTime());return i+(i.indexOf("?")===-1?"?":"&")+e}function vn(i){var e=i.rotate,t=i.scaleX,n=i.scaleY,a=i.translateX,s=i.translateY,o=[];H(a)&&a!==0&&o.push("translateX(".concat(a,"px)")),H(s)&&s!==0&&o.push("translateY(".concat(s,"px)")),H(e)&&e!==0&&o.push("rotate(".concat(e,"deg)")),H(t)&&t!==1&&o.push("scaleX(".concat(t,")")),H(n)&&n!==1&&o.push("scaleY(".concat(n,")"));var r=o.length?o.join(" "):"none";return{WebkitTransform:r,msTransform:r,transform:r}}function Yb(i){var e=Ep({},i),t=[];return ue(i,function(n,a){delete e[a],ue(e,function(s){var o=Math.abs(n.startX-s.startX),r=Math.abs(n.startY-s.startY),l=Math.abs(n.endX-s.endX),c=Math.abs(n.endY-s.endY),p=Math.sqrt(o*o+r*r),u=Math.sqrt(l*l+c*c),h=(u-p)/p;t.push(h)})}),t.sort(function(n,a){return Math.abs(n)<Math.abs(a)}),t[0]}function ha(i,e){var t=i.pageX,n=i.pageY,a={endX:t,endY:n};return e?a:Ep({startX:t,startY:n},a)}function Jb(i){var e=0,t=0,n=0;return ue(i,function(a){var s=a.startX,o=a.startY;e+=s,t+=o,n+=1}),e/=n,t/=n,{pageX:e,pageY:t}}function jt(i){var e=i.aspectRatio,t=i.height,n=i.width,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",s=Kl(n),o=Kl(t);if(s&&o){var r=t*e;a==="contain"&&r>n||a==="cover"&&r<n?t=n/e:n=t*e}else s?t=n/e:o&&(n=t*e);return{width:n,height:t}}function Zb(i){var e=i.width,t=i.height,n=i.degree;if(n=Math.abs(n)%180,n===90)return{width:t,height:e};var a=n%90*Math.PI/180,s=Math.sin(a),o=Math.cos(a),r=e*o+t*s,l=e*s+t*o;return n>90?{width:l,height:r}:{width:r,height:l}}function ey(i,e,t,n){var a=e.aspectRatio,s=e.naturalWidth,o=e.naturalHeight,r=e.rotate,l=r===void 0?0:r,c=e.scaleX,p=c===void 0?1:c,u=e.scaleY,h=u===void 0?1:u,g=t.aspectRatio,m=t.naturalWidth,v=t.naturalHeight,f=n.fillColor,y=f===void 0?"transparent":f,F=n.imageSmoothingEnabled,S=F===void 0?!0:F,A=n.imageSmoothingQuality,D=A===void 0?"low":A,x=n.maxWidth,_=x===void 0?1/0:x,O=n.maxHeight,L=O===void 0?1/0:O,z=n.minWidth,K=z===void 0?0:z,Z=n.minHeight,G=Z===void 0?0:Z,j=document.createElement("canvas"),$=j.getContext("2d"),P=jt({aspectRatio:g,width:_,height:L}),b=jt({aspectRatio:g,width:K,height:G},"cover"),w=Math.min(P.width,Math.max(b.width,m)),E=Math.min(P.height,Math.max(b.height,v)),T=jt({aspectRatio:a,width:_,height:L}),k=jt({aspectRatio:a,width:K,height:G},"cover"),M=Math.min(T.width,Math.max(k.width,s)),q=Math.min(T.height,Math.max(k.height,o)),W=[-M/2,-q/2,M,q];return j.width=bi(w),j.height=bi(E),$.fillStyle=y,$.fillRect(0,0,w,E),$.save(),$.translate(w/2,E/2),$.rotate(l*Math.PI/180),$.scale(p,h),$.imageSmoothingEnabled=S,$.imageSmoothingQuality=D,$.drawImage.apply($,[i].concat(kp(W.map(function(de){return Math.floor(bi(de))})))),$.restore(),j}var Bp=String.fromCharCode;function ty(i,e,t){var n="";t+=e;for(var a=e;a<t;a+=1)n+=Bp(i.getUint8(a));return n}var iy=/^data:.*,/;function ny(i){var e=i.replace(iy,""),t=atob(e),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return ue(a,function(s,o){a[o]=t.charCodeAt(o)}),n}function ay(i,e){for(var t=[],n=8192,a=new Uint8Array(i);a.length>0;)t.push(Bp.apply(null,Ip(a.subarray(0,n)))),a=a.subarray(n);return"data:".concat(e,";base64,").concat(btoa(t.join("")))}function sy(i){var e=new DataView(i),t;try{var n,a,s;if(e.getUint8(0)===255&&e.getUint8(1)===216)for(var o=e.byteLength,r=2;r+1<o;){if(e.getUint8(r)===255&&e.getUint8(r+1)===225){a=r;break}r+=1}if(a){var l=a+4,c=a+10;if(ty(e,l,4)==="Exif"){var p=e.getUint16(c);if(n=p===18761,(n||p===19789)&&e.getUint16(c+2,n)===42){var u=e.getUint32(c+4,n);u>=8&&(s=c+u)}}}if(s){var h=e.getUint16(s,n),g,m;for(m=0;m<h;m+=1)if(g=s+m*12+2,e.getUint16(g,n)===274){g+=8,t=e.getUint16(g,n),e.setUint16(g,1,n);break}}}catch{t=1}return t}function oy(i){var e=0,t=1,n=1;switch(i){case 2:t=-1;break;case 3:e=-180;break;case 4:n=-1;break;case 5:e=90,n=-1;break;case 6:e=90;break;case 7:e=90,t=-1;break;case 8:e=-90;break}return{rotate:e,scaleX:t,scaleY:n}}var ry={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var e=this.element,t=this.options,n=this.container,a=this.cropper;ve(a,ke),lt(e,ke);var s={width:Math.max(n.offsetWidth,Number(t.minContainerWidth)||200),height:Math.max(n.offsetHeight,Number(t.minContainerHeight)||100)};this.containerData=s,Mt(a,{width:s.width,height:s.height}),ve(e,ke),lt(a,ke)},initCanvas:function(){var e=this.containerData,t=this.imageData,n=this.options.viewMode,a=Math.abs(t.rotate)%180===90,s=a?t.naturalHeight:t.naturalWidth,o=a?t.naturalWidth:t.naturalHeight,r=s/o,l=e.width,c=e.height;e.height*r>e.width?n===3?l=e.height*r:c=e.width/r:n===3?c=e.width/r:l=e.height*r;var p={aspectRatio:r,naturalWidth:s,naturalHeight:o,width:l,height:c};p.left=(e.width-l)/2,p.top=(e.height-c)/2,p.oldLeft=p.left,p.oldTop=p.top,this.canvasData=p,this.limited=n===1||n===2,this.limitCanvas(!0,!0),this.initialImageData=J({},t),this.initialCanvasData=J({},p)},limitCanvas:function(e,t){var n=this.options,a=this.containerData,s=this.canvasData,o=this.cropBoxData,r=n.viewMode,l=s.aspectRatio,c=this.cropped&&o;if(e){var p=Number(n.minCanvasWidth)||0,u=Number(n.minCanvasHeight)||0;r>1?(p=Math.max(p,a.width),u=Math.max(u,a.height),r===3&&(u*l>p?p=u*l:u=p/l)):r>0&&(p?p=Math.max(p,c?o.width:0):u?u=Math.max(u,c?o.height:0):c&&(p=o.width,u=o.height,u*l>p?p=u*l:u=p/l));var h=jt({aspectRatio:l,width:p,height:u});p=h.width,u=h.height,s.minWidth=p,s.minHeight=u,s.maxWidth=1/0,s.maxHeight=1/0}if(t)if(r>(c?0:1)){var g=a.width-s.width,m=a.height-s.height;s.minLeft=Math.min(0,g),s.minTop=Math.min(0,m),s.maxLeft=Math.max(0,g),s.maxTop=Math.max(0,m),c&&this.limited&&(s.minLeft=Math.min(o.left,o.left+(o.width-s.width)),s.minTop=Math.min(o.top,o.top+(o.height-s.height)),s.maxLeft=o.left,s.maxTop=o.top,r===2&&(s.width>=a.width&&(s.minLeft=Math.min(0,g),s.maxLeft=Math.max(0,g)),s.height>=a.height&&(s.minTop=Math.min(0,m),s.maxTop=Math.max(0,m))))}else s.minLeft=-s.width,s.minTop=-s.height,s.maxLeft=a.width,s.maxTop=a.height},renderCanvas:function(e,t){var n=this.canvasData,a=this.imageData;if(t){var s=Zb({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),o=s.width,r=s.height,l=n.width*(o/n.naturalWidth),c=n.height*(r/n.naturalHeight);n.left-=(l-n.width)/2,n.top-=(c-n.height)/2,n.width=l,n.height=c,n.aspectRatio=o/r,n.naturalWidth=o,n.naturalHeight=r,this.limitCanvas(!0,!1)}(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCanvas(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,Mt(this.canvas,J({width:n.width,height:n.height},vn({translateX:n.left,translateY:n.top}))),this.renderImage(e),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(e){var t=this.canvasData,n=this.imageData,a=n.naturalWidth*(t.width/t.naturalWidth),s=n.naturalHeight*(t.height/t.naturalHeight);J(n,{width:a,height:s,left:(t.width-a)/2,top:(t.height-s)/2}),Mt(this.image,J({width:n.width,height:n.height},vn(J({translateX:n.left,translateY:n.top},n)))),e&&this.output()},initCropBox:function(){var e=this.options,t=this.canvasData,n=e.aspectRatio||e.initialAspectRatio,a=Number(e.autoCropArea)||.8,s={width:t.width,height:t.height};n&&(t.height*n>t.width?s.height=s.width/n:s.width=s.height*n),this.cropBoxData=s,this.limitCropBox(!0,!0),s.width=Math.min(Math.max(s.width,s.minWidth),s.maxWidth),s.height=Math.min(Math.max(s.height,s.minHeight),s.maxHeight),s.width=Math.max(s.minWidth,s.width*a),s.height=Math.max(s.minHeight,s.height*a),s.left=t.left+(t.width-s.width)/2,s.top=t.top+(t.height-s.height)/2,s.oldLeft=s.left,s.oldTop=s.top,this.initialCropBoxData=J({},s)},limitCropBox:function(e,t){var n=this.options,a=this.containerData,s=this.canvasData,o=this.cropBoxData,r=this.limited,l=n.aspectRatio;if(e){var c=Number(n.minCropBoxWidth)||0,p=Number(n.minCropBoxHeight)||0,u=r?Math.min(a.width,s.width,s.width+s.left,a.width-s.left):a.width,h=r?Math.min(a.height,s.height,s.height+s.top,a.height-s.top):a.height;c=Math.min(c,a.width),p=Math.min(p,a.height),l&&(c&&p?p*l>c?p=c/l:c=p*l:c?p=c/l:p&&(c=p*l),h*l>u?h=u/l:u=h*l),o.minWidth=Math.min(c,u),o.minHeight=Math.min(p,h),o.maxWidth=u,o.maxHeight=h}t&&(r?(o.minLeft=Math.max(0,s.left),o.minTop=Math.max(0,s.top),o.maxLeft=Math.min(a.width,s.left+s.width)-o.width,o.maxTop=Math.min(a.height,s.top+s.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=a.width-o.width,o.maxTop=a.height-o.height))},renderCropBox:function(){var e=this.options,t=this.containerData,n=this.cropBoxData;(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCropBox(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,e.movable&&e.cropBoxMovable&&Un(this.face,In,n.width>=t.width&&n.height>=t.height?Op:vr),Mt(this.cropBox,J({width:n.width,height:n.height},vn({translateX:n.left,translateY:n.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),yi(this.element,wo,this.getData())}},ly={initPreview:function(){var e=this.element,t=this.crossOrigin,n=this.options.preview,a=t?this.crossOriginUrl:this.url,s=e.alt||"The image to preview",o=document.createElement("img");if(t&&(o.crossOrigin=t),o.src=a,o.alt=s,this.viewBox.appendChild(o),this.viewBoxImage=o,!!n){var r=n;typeof n=="string"?r=e.ownerDocument.querySelectorAll(n):n.querySelector&&(r=[n]),this.previews=r,ue(r,function(l){var c=document.createElement("img");Un(l,da,{width:l.offsetWidth,height:l.offsetHeight,html:l.innerHTML}),t&&(c.crossOrigin=t),c.src=a,c.alt=s,c.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',l.innerHTML="",l.appendChild(c)})}},resetPreview:function(){ue(this.previews,function(e){var t=Co(e,da);Mt(e,{width:t.width,height:t.height}),e.innerHTML=t.html,Xb(e,da)})},preview:function(){var e=this.imageData,t=this.canvasData,n=this.cropBoxData,a=n.width,s=n.height,o=e.width,r=e.height,l=n.left-t.left-e.left,c=n.top-t.top-e.top;!this.cropped||this.disabled||(Mt(this.viewBoxImage,J({width:o,height:r},vn(J({translateX:-l,translateY:-c},e)))),ue(this.previews,function(p){var u=Co(p,da),h=u.width,g=u.height,m=h,v=g,f=1;a&&(f=h/a,v=s*f),s&&v>g&&(f=g/s,m=a*f,v=g),Mt(p,{width:m,height:v}),Mt(p.getElementsByTagName("img")[0],J({width:o*f,height:r*f},vn(J({translateX:-l*f,translateY:-c*f},e))))}))}},cy={bind:function(){var e=this.element,t=this.options,n=this.cropper;Ce(t.cropstart)&&ze(e,Fo,t.cropstart),Ce(t.cropmove)&&ze(e,So,t.cropmove),Ce(t.cropend)&&ze(e,Po,t.cropend),Ce(t.crop)&&ze(e,wo,t.crop),Ce(t.zoom)&&ze(e,_o,t.zoom),ze(n,jl,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&ze(n,Vl,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&ze(n,Ml,this.onDblclick=this.dblclick.bind(this)),ze(e.ownerDocument,zl,this.onCropMove=this.cropMove.bind(this)),ze(e.ownerDocument,$l,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&ze(window,Hl,this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,n=this.cropper;Ce(t.cropstart)&&Ge(e,Fo,t.cropstart),Ce(t.cropmove)&&Ge(e,So,t.cropmove),Ce(t.cropend)&&Ge(e,Po,t.cropend),Ce(t.crop)&&Ge(e,wo,t.crop),Ce(t.zoom)&&Ge(e,_o,t.zoom),Ge(n,jl,this.onCropStart),t.zoomable&&t.zoomOnWheel&&Ge(n,Vl,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&Ge(n,Ml,this.onDblclick),Ge(e.ownerDocument,zl,this.onCropMove),Ge(e.ownerDocument,$l,this.onCropEnd),t.responsive&&Ge(window,Hl,this.onResize)}},uy={resize:function(){if(!this.disabled){var e=this.options,t=this.container,n=this.containerData,a=t.offsetWidth/n.width;if(a!==1||t.offsetHeight!==n.height){var s,o;e.restore&&(s=this.getCanvasData(),o=this.getCropBoxData()),this.render(),e.restore&&(this.setCanvasData(ue(s,function(r,l){s[l]=r*a})),this.setCropBoxData(ue(o,function(r,l){o[l]=r*a})))}}},dblclick:function(){this.disabled||this.options.dragMode===Rp||this.setDragMode(Gb(this.dragBox,yo)?Dp:br)},wheel:function(e){var t=this,n=Number(this.options.wheelZoomRatio)||.1,a=1;this.disabled||(e.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){t.wheeling=!1},50),e.deltaY?a=e.deltaY>0?1:-1:e.wheelDelta?a=-e.wheelDelta/120:e.detail&&(a=e.detail>0?1:-1),this.zoom(-a*n,e)))},cropStart:function(e){var t=e.buttons,n=e.button;if(!(this.disabled||(e.type==="mousedown"||e.type==="pointerdown"&&e.pointerType==="mouse")&&(H(t)&&t!==1||H(n)&&n!==0||e.ctrlKey))){var a=this.options,s=this.pointers,o;e.changedTouches?ue(e.changedTouches,function(r){s[r.identifier]=ha(r)}):s[e.pointerId||0]=ha(e),Object.keys(s).length>1&&a.zoomable&&a.zoomOnTouch?o=Ap:o=Co(e.target,In),Lb.test(o)&&yi(this.element,Fo,{originalEvent:e,action:o})!==!1&&(e.preventDefault(),this.action=o,this.cropping=!1,o===Tp&&(this.cropping=!0,ve(this.dragBox,Va)))}},cropMove:function(e){var t=this.action;if(!(this.disabled||!t)){var n=this.pointers;e.preventDefault(),yi(this.element,So,{originalEvent:e,action:t})!==!1&&(e.changedTouches?ue(e.changedTouches,function(a){J(n[a.identifier]||{},ha(a,!0))}):J(n[e.pointerId||0]||{},ha(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,n=this.pointers;e.changedTouches?ue(e.changedTouches,function(a){delete n[a.identifier]}):delete n[e.pointerId||0],t&&(e.preventDefault(),Object.keys(n).length||(this.action=""),this.cropping&&(this.cropping=!1,fi(this.dragBox,Va,this.cropped&&this.options.modal)),yi(this.element,Po,{originalEvent:e,action:t}))}}},py={change:function(e){var t=this.options,n=this.canvasData,a=this.containerData,s=this.cropBoxData,o=this.pointers,r=this.action,l=t.aspectRatio,c=s.left,p=s.top,u=s.width,h=s.height,g=c+u,m=p+h,v=0,f=0,y=a.width,F=a.height,S=!0,A;!l&&e.shiftKey&&(l=u&&h?u/h:1),this.limited&&(v=s.minLeft,f=s.minTop,y=v+Math.min(a.width,n.width,n.left+n.width),F=f+Math.min(a.height,n.height,n.top+n.height));var D=o[Object.keys(o)[0]],x={x:D.endX-D.startX,y:D.endY-D.startY},_=function(L){switch(L){case Wt:g+x.x>y&&(x.x=y-g);break;case Gt:c+x.x<v&&(x.x=v-c);break;case Dt:p+x.y<f&&(x.y=f-p);break;case ui:m+x.y>F&&(x.y=F-m);break}};switch(r){case vr:c+=x.x,p+=x.y;break;case Wt:if(x.x>=0&&(g>=y||l&&(p<=f||m>=F))){S=!1;break}_(Wt),u+=x.x,u<0&&(r=Gt,u=-u,c-=u),l&&(h=u/l,p+=(s.height-h)/2);break;case Dt:if(x.y<=0&&(p<=f||l&&(c<=v||g>=y))){S=!1;break}_(Dt),h-=x.y,p+=x.y,h<0&&(r=ui,h=-h,p-=h),l&&(u=h*l,c+=(s.width-u)/2);break;case Gt:if(x.x<=0&&(c<=v||l&&(p<=f||m>=F))){S=!1;break}_(Gt),u-=x.x,c+=x.x,u<0&&(r=Wt,u=-u,c-=u),l&&(h=u/l,p+=(s.height-h)/2);break;case ui:if(x.y>=0&&(m>=F||l&&(c<=v||g>=y))){S=!1;break}_(ui),h+=x.y,h<0&&(r=Dt,h=-h,p-=h),l&&(u=h*l,c+=(s.width-u)/2);break;case Qi:if(l){if(x.y<=0&&(p<=f||g>=y)){S=!1;break}_(Dt),h-=x.y,p+=x.y,u=h*l}else _(Dt),_(Wt),x.x>=0?g<y?u+=x.x:x.y<=0&&p<=f&&(S=!1):u+=x.x,x.y<=0?p>f&&(h-=x.y,p+=x.y):(h-=x.y,p+=x.y);u<0&&h<0?(r=Zi,h=-h,u=-u,p-=h,c-=u):u<0?(r=Yi,u=-u,c-=u):h<0&&(r=Ji,h=-h,p-=h);break;case Yi:if(l){if(x.y<=0&&(p<=f||c<=v)){S=!1;break}_(Dt),h-=x.y,p+=x.y,u=h*l,c+=s.width-u}else _(Dt),_(Gt),x.x<=0?c>v?(u-=x.x,c+=x.x):x.y<=0&&p<=f&&(S=!1):(u-=x.x,c+=x.x),x.y<=0?p>f&&(h-=x.y,p+=x.y):(h-=x.y,p+=x.y);u<0&&h<0?(r=Ji,h=-h,u=-u,p-=h,c-=u):u<0?(r=Qi,u=-u,c-=u):h<0&&(r=Zi,h=-h,p-=h);break;case Zi:if(l){if(x.x<=0&&(c<=v||m>=F)){S=!1;break}_(Gt),u-=x.x,c+=x.x,h=u/l}else _(ui),_(Gt),x.x<=0?c>v?(u-=x.x,c+=x.x):x.y>=0&&m>=F&&(S=!1):(u-=x.x,c+=x.x),x.y>=0?m<F&&(h+=x.y):h+=x.y;u<0&&h<0?(r=Qi,h=-h,u=-u,p-=h,c-=u):u<0?(r=Ji,u=-u,c-=u):h<0&&(r=Yi,h=-h,p-=h);break;case Ji:if(l){if(x.x>=0&&(g>=y||m>=F)){S=!1;break}_(Wt),u+=x.x,h=u/l}else _(ui),_(Wt),x.x>=0?g<y?u+=x.x:x.y>=0&&m>=F&&(S=!1):u+=x.x,x.y>=0?m<F&&(h+=x.y):h+=x.y;u<0&&h<0?(r=Yi,h=-h,u=-u,p-=h,c-=u):u<0?(r=Zi,u=-u,c-=u):h<0&&(r=Qi,h=-h,p-=h);break;case Op:this.move(x.x,x.y),S=!1;break;case Ap:this.zoom(Yb(o),e),S=!1;break;case Tp:if(!x.x||!x.y){S=!1;break}A=Lp(this.cropper),c=D.startX-A.left,p=D.startY-A.top,u=s.minWidth,h=s.minHeight,x.x>0?r=x.y>0?Ji:Qi:x.x<0&&(c-=u,r=x.y>0?Zi:Yi),x.y<0&&(p-=h),this.cropped||(lt(this.cropBox,ke),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}S&&(s.width=u,s.height=h,s.left=c,s.top=p,this.action=r,this.renderCropBox()),ue(o,function(O){O.startX=O.endX,O.startY=O.endY})}},dy={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&ve(this.dragBox,Va),lt(this.cropBox,ke),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=J({},this.initialImageData),this.canvasData=J({},this.initialCanvasData),this.cropBoxData=J({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(J(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),lt(this.dragBox,Va),ve(this.cropBox,ke)),this},replace:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,ue(this.previews,function(n){n.getElementsByTagName("img")[0].src=e}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,lt(this.cropper,Ll)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,ve(this.cropper,Ll)),this},destroy:function(){var e=this.element;return e[Y]?(e[Y]=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.canvasData,a=n.left,s=n.top;return this.moveTo(zs(e)?e:a+Number(e),zs(t)?t:s+Number(t))},moveTo:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.canvasData,a=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(H(e)&&(n.left=e,a=!0),H(t)&&(n.top=t,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(e,t){var n=this.canvasData;return e=Number(e),e<0?e=1/(1-e):e=1+e,this.zoomTo(n.width*e/n.naturalWidth,null,t)},zoomTo:function(e,t,n){var a=this.options,s=this.canvasData,o=s.width,r=s.height,l=s.naturalWidth,c=s.naturalHeight;if(e=Number(e),e>=0&&this.ready&&!this.disabled&&a.zoomable){var p=l*e,u=c*e;if(yi(this.element,_o,{ratio:e,oldRatio:o/l,originalEvent:n})===!1)return this;if(n){var h=this.pointers,g=Lp(this.cropper),m=h&&Object.keys(h).length?Jb(h):{pageX:n.pageX,pageY:n.pageY};s.left-=(p-o)*((m.pageX-g.left-s.left)/o),s.top-=(u-r)*((m.pageY-g.top-s.top)/r)}else mi(t)&&H(t.x)&&H(t.y)?(s.left-=(p-o)*((t.x-s.left)/o),s.top-=(u-r)*((t.y-s.top)/r)):(s.left-=(p-o)/2,s.top-=(u-r)/2);s.width=p,s.height=u,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return e=Number(e),H(e)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,H(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(H(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.imageData,a=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(H(e)&&(n.scaleX=e,a=!0),H(t)&&(n.scaleY=t,a=!0),a&&this.renderCanvas(!0,!0)),this},getData:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.options,n=this.imageData,a=this.canvasData,s=this.cropBoxData,o;if(this.ready&&this.cropped){o={x:s.left-a.left,y:s.top-a.top,width:s.width,height:s.height};var r=n.width/n.naturalWidth;if(ue(o,function(p,u){o[u]=p/r}),e){var l=Math.round(o.y+o.height),c=Math.round(o.x+o.width);o.x=Math.round(o.x),o.y=Math.round(o.y),o.width=c-o.x,o.height=l-o.y}}else o={x:0,y:0,width:0,height:0};return t.rotatable&&(o.rotate=n.rotate||0),t.scalable&&(o.scaleX=n.scaleX||1,o.scaleY=n.scaleY||1),o},setData:function(e){var t=this.options,n=this.imageData,a=this.canvasData,s={};if(this.ready&&!this.disabled&&mi(e)){var o=!1;t.rotatable&&H(e.rotate)&&e.rotate!==n.rotate&&(n.rotate=e.rotate,o=!0),t.scalable&&(H(e.scaleX)&&e.scaleX!==n.scaleX&&(n.scaleX=e.scaleX,o=!0),H(e.scaleY)&&e.scaleY!==n.scaleY&&(n.scaleY=e.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var r=n.width/n.naturalWidth;H(e.x)&&(s.left=e.x*r+a.left),H(e.y)&&(s.top=e.y*r+a.top),H(e.width)&&(s.width=e.width*r),H(e.height)&&(s.height=e.height*r),this.setCropBoxData(s)}return this},getContainerData:function(){return this.ready?J({},this.containerData):{}},getImageData:function(){return this.sized?J({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&ue(["left","top","width","height","naturalWidth","naturalHeight"],function(n){t[n]=e[n]}),t},setCanvasData:function(e){var t=this.canvasData,n=t.aspectRatio;return this.ready&&!this.disabled&&mi(e)&&(H(e.left)&&(t.left=e.left),H(e.top)&&(t.top=e.top),H(e.width)?(t.width=e.width,t.height=e.width/n):H(e.height)&&(t.height=e.height,t.width=e.height*n),this.renderCanvas(!0)),this},getCropBoxData:function(){var e=this.cropBoxData,t;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(e){var t=this.cropBoxData,n=this.options.aspectRatio,a,s;return this.ready&&this.cropped&&!this.disabled&&mi(e)&&(H(e.left)&&(t.left=e.left),H(e.top)&&(t.top=e.top),H(e.width)&&e.width!==t.width&&(a=!0,t.width=e.width),H(e.height)&&e.height!==t.height&&(s=!0,t.height=e.height),n&&(a?t.height=t.width/n:s&&(t.width=t.height*n)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,n=ey(this.image,this.imageData,t,e);if(!this.cropped)return n;var a=this.getData(),s=a.x,o=a.y,r=a.width,l=a.height,c=n.width/Math.floor(t.naturalWidth);c!==1&&(s*=c,o*=c,r*=c,l*=c);var p=r/l,u=jt({aspectRatio:p,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),h=jt({aspectRatio:p,width:e.minWidth||0,height:e.minHeight||0},"cover"),g=jt({aspectRatio:p,width:e.width||(c!==1?n.width:r),height:e.height||(c!==1?n.height:l)}),m=g.width,v=g.height;m=Math.min(u.width,Math.max(h.width,m)),v=Math.min(u.height,Math.max(h.height,v));var f=document.createElement("canvas"),y=f.getContext("2d");f.width=bi(m),f.height=bi(v),y.fillStyle=e.fillColor||"transparent",y.fillRect(0,0,m,v);var F=e.imageSmoothingEnabled,S=F===void 0?!0:F,A=e.imageSmoothingQuality;y.imageSmoothingEnabled=S,A&&(y.imageSmoothingQuality=A);var D=n.width,x=n.height,_=s,O=o,L,z,K,Z,G,j;_<=-r||_>D?(_=0,L=0,K=0,G=0):_<=0?(K=-_,_=0,L=Math.min(D,r+_),G=L):_<=D&&(K=0,L=Math.min(r,D-_),G=L),L<=0||O<=-l||O>x?(O=0,z=0,Z=0,j=0):O<=0?(Z=-O,O=0,z=Math.min(x,l+O),j=z):O<=x&&(Z=0,z=Math.min(l,x-O),j=z);var $=[_,O,L,z];if(G>0&&j>0){var P=m/r;$.push(K*P,Z*P,G*P,j*P)}return y.drawImage.apply(y,[n].concat(kp($.map(function(b){return Math.floor(bi(b))})))),f},setAspectRatio:function(e){var t=this.options;return!this.disabled&&!zs(e)&&(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,n=this.dragBox,a=this.face;if(this.ready&&!this.disabled){var s=e===br,o=t.movable&&e===Dp;e=s||o?e:Rp,t.dragMode=e,Un(n,In,e),fi(n,yo,s),fi(n,xo,o),t.cropBoxMovable||(Un(a,In,e),fi(a,yo,s),fi(a,xo,o))}return this}},hy=ut.Cropper,Mp=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Cb(this,i),!e||!jb.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=J({},Gl,mi(t)&&t),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return Eb(i,[{key:"init",value:function(){var t=this.element,n=t.tagName.toLowerCase(),a;if(!t[Y]){if(t[Y]=this,n==="img"){if(this.isImg=!0,a=t.getAttribute("src")||"",this.originalUrl=a,!a)return;a=t.src}else n==="canvas"&&window.HTMLCanvasElement&&(a=t.toDataURL());this.load(a)}}},{key:"load",value:function(t){var n=this;if(t){this.url=t,this.imageData={};var a=this.element,s=this.options;if(!s.rotatable&&!s.scalable&&(s.checkOrientation=!1),!s.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Bb.test(t)){Mb.test(t)?this.read(ny(t)):this.clone();return}var o=new XMLHttpRequest,r=this.clone.bind(this);this.reloading=!0,this.xhr=o,o.onabort=r,o.onerror=r,o.ontimeout=r,o.onprogress=function(){o.getResponseHeader("content-type")!==Wl&&o.abort()},o.onload=function(){n.read(o.response)},o.onloadend=function(){n.reloading=!1,n.xhr=null},s.checkCrossOrigin&&Xl(t)&&a.crossOrigin&&(t=Ql(t)),o.open("GET",t),o.responseType="arraybuffer",o.withCredentials=a.crossOrigin==="use-credentials",o.send()}}},{key:"read",value:function(t){var n=this.options,a=this.imageData,s=sy(t),o=0,r=1,l=1;if(s>1){this.url=ay(t,Wl);var c=oy(s);o=c.rotate,r=c.scaleX,l=c.scaleY}n.rotatable&&(a.rotate=o),n.scalable&&(a.scaleX=r,a.scaleY=l),this.clone()}},{key:"clone",value:function(){var t=this.element,n=this.url,a=t.crossOrigin,s=n;this.options.checkCrossOrigin&&Xl(n)&&(a||(a="anonymous"),s=Ql(n)),this.crossOrigin=a,this.crossOriginUrl=s;var o=document.createElement("img");a&&(o.crossOrigin=a),o.src=s||n,o.alt=t.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),ve(o,Bl),t.parentNode.insertBefore(o,t.nextSibling)}},{key:"start",value:function(){var t=this,n=this.image;n.onload=null,n.onerror=null,this.sizing=!0;var a=ut.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(ut.navigator.userAgent),s=function(c,p){J(t.imageData,{naturalWidth:c,naturalHeight:p,aspectRatio:c/p}),t.sizing=!1,t.sized=!0,t.build()};if(n.naturalWidth&&!a){s(n.naturalWidth,n.naturalHeight);return}var o=document.createElement("img"),r=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){s(o.width,o.height),a||r.removeChild(o)},o.src=n.src,a||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",r.appendChild(o))}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var t=this.element,n=this.options,a=this.image,s=t.parentNode,o=document.createElement("div");o.innerHTML=zb;var r=o.querySelector(".".concat(Y,"-container")),l=r.querySelector(".".concat(Y,"-canvas")),c=r.querySelector(".".concat(Y,"-drag-box")),p=r.querySelector(".".concat(Y,"-crop-box")),u=p.querySelector(".".concat(Y,"-face"));this.container=s,this.cropper=r,this.canvas=l,this.dragBox=c,this.cropBox=p,this.viewBox=r.querySelector(".".concat(Y,"-view-box")),this.face=u,l.appendChild(a),ve(t,ke),s.insertBefore(r,t.nextSibling),this.isImg||lt(a,Bl),this.initPreview(),this.bind(),n.initialAspectRatio=Math.max(0,n.initialAspectRatio)||NaN,n.aspectRatio=Math.max(0,n.aspectRatio)||NaN,n.viewMode=Math.max(0,Math.min(3,Math.round(n.viewMode)))||0,ve(p,ke),n.guides||ve(p.getElementsByClassName("".concat(Y,"-dashed")),ke),n.center||ve(p.getElementsByClassName("".concat(Y,"-center")),ke),n.background&&ve(r,"".concat(Y,"-bg")),n.highlight||ve(u,Rb),n.cropBoxMovable&&(ve(u,xo),Un(u,In,vr)),n.cropBoxResizable||(ve(p.getElementsByClassName("".concat(Y,"-line")),ke),ve(p.getElementsByClassName("".concat(Y,"-point")),ke)),this.render(),this.ready=!0,this.setDragMode(n.dragMode),n.autoCrop&&this.crop(),this.setData(n.data),Ce(n.ready)&&ze(t,ql,n.ready,{once:!0}),yi(t,ql)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),lt(this.element,ke))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=hy,i}},{key:"setDefaults",value:function(t){J(Gl,mi(t)&&t)}}]),i}();J(Mp.prototype,ry,ly,cy,uy,py,dy);function my(i,e){const t=i.width/e.width,n=i.height/e.height,a=Math.min(t,n),s=e.width*a,o=e.height*a,r=(i.width-s)/2,l=(i.height-o)/2;return{width:s,height:o,left:r,top:l}}function fy(i){return i*(Math.PI/180)}function gy(i,e,t){const n=Math.abs(fy(t));return Math.max((Math.sin(n)*i+Math.cos(n)*e)/e,(Math.sin(n)*e+Math.cos(n)*i)/i)}function vy(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}function by(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}class yy extends dt{constructor(e){super(e),this.onRotate90Deg=()=>{const{angle90Deg:t}=this.state,n=t-90;this.setState({angle90Deg:n,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(n);const a=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),o=my(s,a);this.cropper.setCanvasData(o),this.cropper.setCropBoxData(o)},this.onRotateGranular=t=>{const n=Number(t.target.value);this.setState({angleGranular:n});const{angle90Deg:a}=this.state,s=a+n;this.cropper.rotateTo(s);const o=this.cropper.getImageData(),r=gy(o.naturalWidth,o.naturalHeight,n),l=this.cropper.getImageData().scaleX<0?-r:r;this.cropper.scale(l,r)},this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){const{opts:e,storeCropperInstance:t}=this.props;this.cropper=new Mp(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){const t=this.cropper.getCanvasData(),n=this.cropper.getCropBoxData(),{prevCropboxData:a}=this.state;if(e.detail.action==="all"){const s=vy(t,n,a);s&&this.cropper.setCropBoxData(s)}else{const s=by(t,n,a);s&&this.cropper.setCropBoxData(s)}}renderGranularRotate(){const{i18n:e}=this.props,{angleGranular:t}=this.state;return d("label",{role:"tooltip","aria-label":`${t}º`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper"},d("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")}))}renderRevert(){const{i18n:e,opts:t}=this.props;return d("label",{role:"tooltip","aria-label":e("revert"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})}},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0z",fill:"none"}),d("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"}))))}renderRotate(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("rotate"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:this.onRotate90Deg},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),d("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"}))))}renderFlip(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("flipHorizontal"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0z",fill:"none"}),d("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}))))}renderZoomIn(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("zoomIn"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.zoom(.1)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24"},d("path",{d:"M0 0h24v24H0V0z",fill:"none"}),d("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),d("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))))}renderZoomOut(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("zoomOut"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.zoom(-.1)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0V0z",fill:"none"}),d("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"}))))}renderCropSquare(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("aspectRatioSquare"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(1)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0z",fill:"none"}),d("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}))))}renderCropWidescreen(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("aspectRatioLandscape"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(16/9)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),d("path",{fill:"none",d:"M0 0h24v24H0z"}))))}renderCropWidescreenVertical(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("aspectRatioPortrait"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),d("path",{d:"M0 0h24v24H0z",fill:"none"}))))}render(){const{currentImage:e,opts:t}=this.props,{actions:n}=t,a=URL.createObjectURL(e.data);return d("div",{className:"uppy-ImageCropper"},d("div",{className:"uppy-ImageCropper-container"},d("img",{className:"uppy-ImageCropper-image",alt:e.name,src:a,ref:s=>{this.imgElement=s}})),d("div",{className:"uppy-ImageCropper-controls"},n.revert&&this.renderRevert(),n.rotate&&this.renderRotate(),n.granularRotate&&this.renderGranularRotate(),n.flip&&this.renderFlip(),n.zoomIn&&this.renderZoomIn(),n.zoomOut&&this.renderZoomOut(),n.cropSquare&&this.renderCropSquare(),n.cropWidescreen&&this.renderCropWidescreen(),n.cropWidescreenVertical&&this.renderCropWidescreenVertical()))}}const xy={strings:{revert:"Reset",rotate:"Rotate 90°",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}},wy={version:"2.4.4"},jp={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},zp={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},Py={quality:.8,actions:zp,cropperOptions:jp};class $p extends ye{constructor(e,t){super(e,{...Py,...t,actions:{...zp,...t==null?void 0:t.actions},cropperOptions:{...jp,...t==null?void 0:t.cropperOptions}}),this.save=()=>{const n=o=>{const{currentImage:r}=this.getPluginState();this.uppy.setFileState(r.id,{data:new File([o],r.name,{type:o.type}),size:o.size,preview:void 0});const l=this.uppy.getFile(r.id);this.uppy.emit("thumbnail:request",l),this.setPluginState({currentImage:l}),this.uppy.emit("file-editor:complete",l)},{currentImage:a}=this.getPluginState(),s=this.cropper.getCroppedCanvas({});s.width%2!==0&&this.cropper.setData({width:s.width-1}),s.height%2!==0&&this.cropper.setData({height:s.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(n,a.type,this.opts.quality)},this.storeCropperInstance=n=>{this.cropper=n},this.selectFile=n=>{this.uppy.emit("file-editor:start",n),this.setPluginState({currentImage:n})},this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=xy,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;const t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}install(){this.setPluginState({currentImage:null});const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){const{currentImage:e}=this.getPluginState();if(e){const t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){const{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:d(yy,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}}$p.VERSION=wy.version;const qp="3.7.5",Sy=qp,Fy=typeof atob=="function",_y=typeof btoa=="function",Ti=typeof At=="function",Yl=typeof TextDecoder=="function"?new TextDecoder:void 0,Jl=typeof TextEncoder=="function"?new TextEncoder:void 0,Cy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",cn=Array.prototype.slice.call(Cy),ma=(i=>{let e={};return i.forEach((t,n)=>e[t]=n),e})(cn),Ey=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,we=String.fromCharCode.bind(String),Zl=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),Hp=i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),Vp=i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),Wp=i=>{let e,t,n,a,s="";const o=i.length%3;for(let r=0;r<i.length;){if((t=i.charCodeAt(r++))>255||(n=i.charCodeAt(r++))>255||(a=i.charCodeAt(r++))>255)throw new TypeError("invalid character found");e=t<<16|n<<8|a,s+=cn[e>>18&63]+cn[e>>12&63]+cn[e>>6&63]+cn[e&63]}return o?s.slice(0,o-3)+"===".substring(o):s},xr=_y?i=>btoa(i):Ti?i=>At.from(i,"binary").toString("base64"):Wp,Eo=Ti?i=>At.from(i).toString("base64"):i=>{let t=[];for(let n=0,a=i.length;n<a;n+=4096)t.push(we.apply(null,i.subarray(n,n+4096)));return xr(t.join(""))},Ta=(i,e=!1)=>e?Hp(Eo(i)):Eo(i),ky=i=>{if(i.length<2){var e=i.charCodeAt(0);return e<128?i:e<2048?we(192|e>>>6)+we(128|e&63):we(224|e>>>12&15)+we(128|e>>>6&63)+we(128|e&63)}else{var e=65536+(i.charCodeAt(0)-55296)*1024+(i.charCodeAt(1)-56320);return we(240|e>>>18&7)+we(128|e>>>12&63)+we(128|e>>>6&63)+we(128|e&63)}},Ty=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Gp=i=>i.replace(Ty,ky),ec=Ti?i=>At.from(i,"utf8").toString("base64"):Jl?i=>Eo(Jl.encode(i)):i=>xr(Gp(i)),xi=(i,e=!1)=>e?Hp(ec(i)):ec(i),tc=i=>xi(i,!0),Oy=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ay=i=>{switch(i.length){case 4:var e=(7&i.charCodeAt(0))<<18|(63&i.charCodeAt(1))<<12|(63&i.charCodeAt(2))<<6|63&i.charCodeAt(3),t=e-65536;return we((t>>>10)+55296)+we((t&1023)+56320);case 3:return we((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return we((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},Kp=i=>i.replace(Oy,Ay),Xp=i=>{if(i=i.replace(/\s+/g,""),!Ey.test(i))throw new TypeError("malformed base64.");i+="==".slice(2-(i.length&3));let e,t="",n,a;for(let s=0;s<i.length;)e=ma[i.charAt(s++)]<<18|ma[i.charAt(s++)]<<12|(n=ma[i.charAt(s++)])<<6|(a=ma[i.charAt(s++)]),t+=n===64?we(e>>16&255):a===64?we(e>>16&255,e>>8&255):we(e>>16&255,e>>8&255,e&255);return t},wr=Fy?i=>atob(Vp(i)):Ti?i=>At.from(i,"base64").toString("binary"):Xp,Qp=Ti?i=>Zl(At.from(i,"base64")):i=>Zl(wr(i).split("").map(e=>e.charCodeAt(0))),Yp=i=>Qp(Jp(i)),Dy=Ti?i=>At.from(i,"base64").toString("utf8"):Yl?i=>Yl.decode(Qp(i)):i=>Kp(wr(i)),Jp=i=>Vp(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),ko=i=>Dy(Jp(i)),Ry=i=>{if(typeof i!="string")return!1;const e=i.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},Zp=i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),ed=function(){const i=(e,t)=>Object.defineProperty(String.prototype,e,Zp(t));i("fromBase64",function(){return ko(this)}),i("toBase64",function(e){return xi(this,e)}),i("toBase64URI",function(){return xi(this,!0)}),i("toBase64URL",function(){return xi(this,!0)}),i("toUint8Array",function(){return Yp(this)})},td=function(){const i=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Zp(t));i("toBase64",function(e){return Ta(this,e)}),i("toBase64URI",function(){return Ta(this,!0)}),i("toBase64URL",function(){return Ta(this,!0)})},Iy=()=>{ed(),td()},Uy={version:qp,VERSION:Sy,atob:wr,atobPolyfill:Xp,btoa:xr,btoaPolyfill:Wp,fromBase64:ko,toBase64:xi,encode:xi,encodeURI:tc,encodeURL:tc,utob:Gp,btou:Kp,decode:ko,isValid:Ry,fromUint8Array:Ta,toUint8Array:Yp,extendString:ed,extendUint8Array:td,extendBuiltins:Iy};var Ny=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0},Pr={},Ly=Object.prototype.hasOwnProperty,By;function ic(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function nc(i){try{return encodeURIComponent(i)}catch{return null}}function My(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},n;n=e.exec(i);){var a=ic(n[1]),s=ic(n[2]);a===null||s===null||a in t||(t[a]=s)}return t}function jy(i,e){e=e||"";var t=[],n,a;typeof e!="string"&&(e="?");for(a in i)if(Ly.call(i,a)){if(n=i[a],!n&&(n===null||n===By||isNaN(n))&&(n=""),a=nc(a),n=nc(n),a===null||n===null)continue;t.push(a+"="+n)}return t.length?e+t.join("&"):""}Pr.stringify=jy;Pr.parse=My;var id=Ny,as=Pr,zy=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,nd=/[\n\r\t]/g,$y=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,ad=/:\d+$/,qy=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Hy=/^[a-zA-Z]:/;function Sr(i){return(i||"").toString().replace(zy,"")}var To=[["#","hash"],["?","query"],function(e,t){return ct(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],ac={hash:1,query:1};function sd(i){var e;typeof window<"u"?e=window:typeof Nr<"u"?e=Nr:typeof self<"u"?e=self:e={};var t=e.location||{};i=i||t;var n={},a=typeof i,s;if(i.protocol==="blob:")n=new pt(unescape(i.pathname),{});else if(a==="string"){n=new pt(i,{});for(s in ac)delete n[s]}else if(a==="object"){for(s in i)s in ac||(n[s]=i[s]);n.slashes===void 0&&(n.slashes=$y.test(i.href))}return n}function ct(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}function od(i,e){i=Sr(i),i=i.replace(nd,""),e=e||{};var t=qy.exec(i),n=t[1]?t[1].toLowerCase():"",a=!!t[2],s=!!t[3],o=0,r;return a?s?(r=t[2]+t[3]+t[4],o=t[2].length+t[3].length):(r=t[2]+t[4],o=t[2].length):s?(r=t[3]+t[4],o=t[3].length):r=t[4],n==="file:"?o>=2&&(r=r.slice(2)):ct(n)?r=t[4]:n?a&&(r=r.slice(2)):o>=2&&ct(e.protocol)&&(r=t[4]),{protocol:n,slashes:a||ct(n),slashesCount:o,rest:r}}function Vy(i,e){if(i==="")return e;for(var t=(e||"/").split("/").slice(0,-1).concat(i.split("/")),n=t.length,a=t[n-1],s=!1,o=0;n--;)t[n]==="."?t.splice(n,1):t[n]===".."?(t.splice(n,1),o++):o&&(n===0&&(s=!0),t.splice(n,1),o--);return s&&t.unshift(""),(a==="."||a==="..")&&t.push(""),t.join("/")}function pt(i,e,t){if(i=Sr(i),i=i.replace(nd,""),!(this instanceof pt))return new pt(i,e,t);var n,a,s,o,r,l,c=To.slice(),p=typeof e,u=this,h=0;for(p!=="object"&&p!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=as.parse),e=sd(e),a=od(i||"",e),n=!a.protocol&&!a.slashes,u.slashes=a.slashes||n&&e.slashes,u.protocol=a.protocol||e.protocol||"",i=a.rest,(a.protocol==="file:"&&(a.slashesCount!==2||Hy.test(i))||!a.slashes&&(a.protocol||a.slashesCount<2||!ct(u.protocol)))&&(c[3]=[/(.*)/,"pathname"]);h<c.length;h++){if(o=c[h],typeof o=="function"){i=o(i,u);continue}s=o[0],l=o[1],s!==s?u[l]=i:typeof s=="string"?(r=s==="@"?i.lastIndexOf(s):i.indexOf(s),~r&&(typeof o[2]=="number"?(u[l]=i.slice(0,r),i=i.slice(r+o[2])):(u[l]=i.slice(r),i=i.slice(0,r)))):(r=s.exec(i))&&(u[l]=r[1],i=i.slice(0,r.index)),u[l]=u[l]||n&&o[3]&&e[l]||"",o[4]&&(u[l]=u[l].toLowerCase())}t&&(u.query=t(u.query)),n&&e.slashes&&u.pathname.charAt(0)!=="/"&&(u.pathname!==""||e.pathname!=="")&&(u.pathname=Vy(u.pathname,e.pathname)),u.pathname.charAt(0)!=="/"&&ct(u.protocol)&&(u.pathname="/"+u.pathname),id(u.port,u.protocol)||(u.host=u.hostname,u.port=""),u.username=u.password="",u.auth&&(r=u.auth.indexOf(":"),~r?(u.username=u.auth.slice(0,r),u.username=encodeURIComponent(decodeURIComponent(u.username)),u.password=u.auth.slice(r+1),u.password=encodeURIComponent(decodeURIComponent(u.password))):u.username=encodeURIComponent(decodeURIComponent(u.auth)),u.auth=u.password?u.username+":"+u.password:u.username),u.origin=u.protocol!=="file:"&&ct(u.protocol)&&u.host?u.protocol+"//"+u.host:"null",u.href=u.toString()}function Wy(i,e,t){var n=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||as.parse)(e)),n[i]=e;break;case"port":n[i]=e,id(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[i]="");break;case"hostname":n[i]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[i]=e,ad.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!t;break;case"pathname":case"hash":if(e){var a=i==="pathname"?"/":"#";n[i]=e.charAt(0)!==a?a+e:e}else n[i]=e;break;case"username":case"password":n[i]=encodeURIComponent(e);break;case"auth":var s=e.indexOf(":");~s?(n.username=e.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var o=0;o<To.length;o++){var r=To[o];r[4]&&(n[r[1]]=n[r[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&ct(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function Gy(i){(!i||typeof i!="function")&&(i=as.stringify);var e,t=this,n=t.host,a=t.protocol;a&&a.charAt(a.length-1)!==":"&&(a+=":");var s=a+(t.protocol&&t.slashes||ct(t.protocol)?"//":"");return t.username?(s+=t.username,t.password&&(s+=":"+t.password),s+="@"):t.password?(s+=":"+t.password,s+="@"):t.protocol!=="file:"&&ct(t.protocol)&&!n&&t.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||ad.test(t.hostname)&&!t.port)&&(n+=":"),s+=n+t.pathname,e=typeof t.query=="object"?i(t.query):t.query,e&&(s+=e.charAt(0)!=="?"?"?"+e:e),t.hash&&(s+=t.hash),s}pt.prototype={set:Wy,toString:Gy};pt.extractProtocol=od;pt.location=sd;pt.trimLeft=Sr;pt.qs=as;var Ky=pt;const Xy=tt(Ky);function Pi(i){"@babel/helpers - typeof";return Pi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pi(i)}function sc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Yy(n.key),n)}}function Qy(i,e,t){return e&&sc(i.prototype,e),t&&sc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Yy(i){var e=Jy(i,"string");return Pi(e)==="symbol"?e:String(e)}function Jy(i,e){if(Pi(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(Pi(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Zy(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function e0(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Nn(i,e)}function t0(i){var e=rd();return function(){var n=Ln(i),a;if(e){var s=Ln(this).constructor;a=Reflect.construct(n,arguments,s)}else a=n.apply(this,arguments);return i0(this,a)}}function i0(i,e){if(e&&(Pi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return n0(i)}function n0(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Oo(i){var e=typeof Map=="function"?new Map:void 0;return Oo=function(n){if(n===null||!a0(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,a)}function a(){return Oa(n,arguments,Ln(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),Nn(a,n)},Oo(i)}function Oa(i,e,t){return rd()?Oa=Reflect.construct.bind():Oa=function(a,s,o){var r=[null];r.push.apply(r,s);var l=Function.bind.apply(a,r),c=new l;return o&&Nn(c,o.prototype),c},Oa.apply(null,arguments)}function rd(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function a0(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function Nn(i,e){return Nn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Nn(i,e)}function Ln(i){return Ln=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ln(i)}var fa=function(i){e0(t,i);var e=t0(t);function t(n){var a,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(Zy(this,t),a=e.call(this,n),a.originalRequest=o,a.originalResponse=r,a.causingError=s,s!=null&&(n+=", caused by ".concat(s.toString())),o!=null){var l=o.getHeader("X-Request-ID")||"n/a",c=o.getMethod(),p=o.getURL(),u=r?r.getStatus():"n/a",h=r?r.getBody()||"":"n/a";n+=", originated from request (method: ".concat(c,", url: ").concat(p,", response code: ").concat(u,", response text: ").concat(h,", request id: ").concat(l,")")}return a.message=n,a}return Qy(t)}(Oo(Error));function s0(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var e=Math.random()*16|0,t=i==="x"?e:e&3|8;return t.toString(16)})}function Ao(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ao=function(){return e};var i,e={},t=Object.prototype,n=t.hasOwnProperty,a=Object.defineProperty||function(P,b,w){P[b]=w.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",r=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function c(P,b,w){return Object.defineProperty(P,b,{value:w,enumerable:!0,configurable:!0,writable:!0}),P[b]}try{c({},"")}catch{c=function(w,E,T){return w[E]=T}}function p(P,b,w,E){var T=b&&b.prototype instanceof y?b:y,k=Object.create(T.prototype),M=new j(E||[]);return a(k,"_invoke",{value:z(P,w,M)}),k}function u(P,b,w){try{return{type:"normal",arg:P.call(b,w)}}catch(E){return{type:"throw",arg:E}}}e.wrap=p;var h="suspendedStart",g="suspendedYield",m="executing",v="completed",f={};function y(){}function F(){}function S(){}var A={};c(A,o,function(){return this});var D=Object.getPrototypeOf,x=D&&D(D($([])));x&&x!==t&&n.call(x,o)&&(A=x);var _=S.prototype=y.prototype=Object.create(A);function O(P){["next","throw","return"].forEach(function(b){c(P,b,function(w){return this._invoke(b,w)})})}function L(P,b){function w(T,k,M,q){var W=u(P[T],P,k);if(W.type!=="throw"){var de=W.arg,he=de.value;return he&&ri(he)=="object"&&n.call(he,"__await")?b.resolve(he.__await).then(function(le){w("next",le,M,q)},function(le){w("throw",le,M,q)}):b.resolve(he).then(function(le){de.value=le,M(de)},function(le){return w("throw",le,M,q)})}q(W.arg)}var E;a(this,"_invoke",{value:function(k,M){function q(){return new b(function(W,de){w(k,M,W,de)})}return E=E?E.then(q,q):q()}})}function z(P,b,w){var E=h;return function(T,k){if(E===m)throw new Error("Generator is already running");if(E===v){if(T==="throw")throw k;return{value:i,done:!0}}for(w.method=T,w.arg=k;;){var M=w.delegate;if(M){var q=K(M,w);if(q){if(q===f)continue;return q}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(E===h)throw E=v,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);E=m;var W=u(P,b,w);if(W.type==="normal"){if(E=w.done?v:g,W.arg===f)continue;return{value:W.arg,done:w.done}}W.type==="throw"&&(E=v,w.method="throw",w.arg=W.arg)}}}function K(P,b){var w=b.method,E=P.iterator[w];if(E===i)return b.delegate=null,w==="throw"&&P.iterator.return&&(b.method="return",b.arg=i,K(P,b),b.method==="throw")||w!=="return"&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+w+"' method")),f;var T=u(E,P.iterator,b.arg);if(T.type==="throw")return b.method="throw",b.arg=T.arg,b.delegate=null,f;var k=T.arg;return k?k.done?(b[P.resultName]=k.value,b.next=P.nextLoc,b.method!=="return"&&(b.method="next",b.arg=i),b.delegate=null,f):k:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,f)}function Z(P){var b={tryLoc:P[0]};1 in P&&(b.catchLoc=P[1]),2 in P&&(b.finallyLoc=P[2],b.afterLoc=P[3]),this.tryEntries.push(b)}function G(P){var b=P.completion||{};b.type="normal",delete b.arg,P.completion=b}function j(P){this.tryEntries=[{tryLoc:"root"}],P.forEach(Z,this),this.reset(!0)}function $(P){if(P||P===""){var b=P[o];if(b)return b.call(P);if(typeof P.next=="function")return P;if(!isNaN(P.length)){var w=-1,E=function T(){for(;++w<P.length;)if(n.call(P,w))return T.value=P[w],T.done=!1,T;return T.value=i,T.done=!0,T};return E.next=E}}throw new TypeError(ri(P)+" is not iterable")}return F.prototype=S,a(_,"constructor",{value:S,configurable:!0}),a(S,"constructor",{value:F,configurable:!0}),F.displayName=c(S,l,"GeneratorFunction"),e.isGeneratorFunction=function(P){var b=typeof P=="function"&&P.constructor;return!!b&&(b===F||(b.displayName||b.name)==="GeneratorFunction")},e.mark=function(P){return Object.setPrototypeOf?Object.setPrototypeOf(P,S):(P.__proto__=S,c(P,l,"GeneratorFunction")),P.prototype=Object.create(_),P},e.awrap=function(P){return{__await:P}},O(L.prototype),c(L.prototype,r,function(){return this}),e.AsyncIterator=L,e.async=function(P,b,w,E,T){T===void 0&&(T=Promise);var k=new L(p(P,b,w,E),T);return e.isGeneratorFunction(b)?k:k.next().then(function(M){return M.done?M.value:k.next()})},O(_),c(_,l,"Generator"),c(_,o,function(){return this}),c(_,"toString",function(){return"[object Generator]"}),e.keys=function(P){var b=Object(P),w=[];for(var E in b)w.push(E);return w.reverse(),function T(){for(;w.length;){var k=w.pop();if(k in b)return T.value=k,T.done=!1,T}return T.done=!0,T}},e.values=$,j.prototype={constructor:j,reset:function(b){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(G),!b)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=i)},stop:function(){this.done=!0;var b=this.tryEntries[0].completion;if(b.type==="throw")throw b.arg;return this.rval},dispatchException:function(b){if(this.done)throw b;var w=this;function E(de,he){return M.type="throw",M.arg=b,w.next=de,he&&(w.method="next",w.arg=i),!!he}for(var T=this.tryEntries.length-1;T>=0;--T){var k=this.tryEntries[T],M=k.completion;if(k.tryLoc==="root")return E("end");if(k.tryLoc<=this.prev){var q=n.call(k,"catchLoc"),W=n.call(k,"finallyLoc");if(q&&W){if(this.prev<k.catchLoc)return E(k.catchLoc,!0);if(this.prev<k.finallyLoc)return E(k.finallyLoc)}else if(q){if(this.prev<k.catchLoc)return E(k.catchLoc,!0)}else{if(!W)throw new Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return E(k.finallyLoc)}}}},abrupt:function(b,w){for(var E=this.tryEntries.length-1;E>=0;--E){var T=this.tryEntries[E];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var k=T;break}}k&&(b==="break"||b==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var M=k?k.completion:{};return M.type=b,M.arg=w,k?(this.method="next",this.next=k.finallyLoc,f):this.complete(M)},complete:function(b,w){if(b.type==="throw")throw b.arg;return b.type==="break"||b.type==="continue"?this.next=b.arg:b.type==="return"?(this.rval=this.arg=b.arg,this.method="return",this.next="end"):b.type==="normal"&&w&&(this.next=w),f},finish:function(b){for(var w=this.tryEntries.length-1;w>=0;--w){var E=this.tryEntries[w];if(E.finallyLoc===b)return this.complete(E.completion,E.afterLoc),G(E),f}},catch:function(b){for(var w=this.tryEntries.length-1;w>=0;--w){var E=this.tryEntries[w];if(E.tryLoc===b){var T=E.completion;if(T.type==="throw"){var k=T.arg;G(E)}return k}}throw new Error("illegal catch attempt")},delegateYield:function(b,w,E){return this.delegate={iterator:$(b),resultName:w,nextLoc:E},this.method==="next"&&(this.arg=i),f}},e}function oc(i,e,t,n,a,s,o){try{var r=i[s](o),l=r.value}catch(c){t(c);return}r.done?e(l):Promise.resolve(l).then(n,a)}function o0(i){return function(){var e=this,t=arguments;return new Promise(function(n,a){var s=i.apply(e,t);function o(l){oc(s,n,a,o,r,"next",l)}function r(l){oc(s,n,a,o,r,"throw",l)}o(void 0)})}}function ld(i,e){return u0(i)||c0(i,e)||l0(i,e)||r0()}function r0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
40
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l0(i,e){if(i){if(typeof i=="string")return rc(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return rc(i,e)}}function rc(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=i[t];return n}function c0(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,a,s,o,r=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(r.push(n.value),r.length!==e);l=!0);}catch(p){c=!0,a=p}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw a}}return r}}function u0(i){if(Array.isArray(i))return i}function ri(i){"@babel/helpers - typeof";return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ri(i)}function lc(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function pi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lc(Object(t),!0).forEach(function(n){p0(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):lc(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function p0(i,e,t){return e=cd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function d0(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function cc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,cd(n.key),n)}}function h0(i,e,t){return e&&cc(i.prototype,e),t&&cc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function cd(i){var e=m0(i,"string");return ri(e)==="symbol"?e:String(e)}function m0(i,e){if(ri(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(ri(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var f0={endpoint:null,uploadUrl:null,metadata:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:ud,chunkSize:1/0,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null},Wa=function(){function i(e,t){d0(this,i),"resume"in t&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=t,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return h0(i,[{key:"findPreviousUploads",value:function(){var t=this;return this.options.fingerprint(this.file,this.options).then(function(n){return t._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey}},{key:"start",value:function(){var t=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var a=this.options.retryDelays;if(a!=null&&Object.prototype.toString.call(a)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var s=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];s<o.length;s++){var r=o[s];if(this.options[r]){this._emitError(new Error("tus: cannot use the ".concat(r," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(l){return t._fingerprint=l,t._source?t._source:t.options.fileReader.openFile(n,t.options.chunkSize)}).then(function(l){if(t._source=l,t.options.uploadLengthDeferred)t._size=null;else if(t.options.uploadSize!=null){if(t._size=Number(t.options.uploadSize),Number.isNaN(t._size)){t._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(t._size=t._source.size,t._size==null){t._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}t.options.parallelUploads>1||t._parallelUploadUrls!=null?t._startParallelUpload():t._startSingleUpload()}).catch(function(l){t._emitError(l)})}},{key:"_startParallelUpload",value:function(){var t,n=this,a=this._size,s=0;this._parallelUploads=[];var o=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,r=(t=this.options.parallelUploadBoundaries)!==null&&t!==void 0?t:v0(this._source.size,o);this._parallelUploadUrls&&r.forEach(function(p,u){p.uploadUrl=n._parallelUploadUrls[u]||null}),this._parallelUploadUrls=new Array(r.length);var l=r.map(function(p,u){var h=0;return n._source.slice(p.start,p.end).then(function(g){var m=g.value;return new Promise(function(v,f){var y=pi(pi({},n.options),{},{uploadUrl:p.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:{},headers:pi(pi({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:v,onError:f,onProgress:function(A){s=s-h+A,h=A,n._emitProgress(s,a)},onUploadUrlAvailable:function(){n._parallelUploadUrls[u]=F.url,n._parallelUploadUrls.filter(function(A){return!!A}).length===r.length&&n._saveUploadInUrlStorage()}}),F=new i(m,y);F.start(),n._parallelUploads.push(F)})})}),c;Promise.all(l).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var p=uc(n.options.metadata);return p!==""&&c.setHeader("Upload-Metadata",p),n._sendRequest(c,null)}).then(function(p){if(!di(p.getStatus(),200)){n._emitHttpError(c,p,"tus: unexpected response while creating upload");return}var u=p.getHeader("Location");if(u==null){n._emitHttpError(c,p,"tus: invalid or missing Location header");return}n.url=mc(n.options.endpoint,u),"Created upload at ".concat(n.url),n._emitSuccess()}).catch(function(p){n._emitError(p)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){"Resuming upload from previous URL: ".concat(this.url),this._resumeUpload();return}if(this.options.uploadUrl!=null){"Resuming upload from provided URL: ".concat(this.options.uploadUrl),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload()}},{key:"abort",value:function(t){var n=this;return this._parallelUploads!=null&&this._parallelUploads.forEach(function(a){a.abort(t)}),this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!t||this.url==null?Promise.resolve():i.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(t,n,a,s){this._emitError(new fa(a,s,t,n))}},{key:"_emitError",value:function(t){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var a=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(a&&(this._retryAttempt=0),hc(t,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},s);return}}if(typeof this.options.onError=="function")this.options.onError(t);else throw t}}},{key:"_emitSuccess",value:function(){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess()}},{key:"_emitProgress",value:function(t,n){typeof this.options.onProgress=="function"&&this.options.onProgress(t,n)}},{key:"_emitChunkComplete",value:function(t,n,a){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(t,n,a)}},{key:"_createUpload",value:function(){var t=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length",1):n.setHeader("Upload-Length",this._size);var a=uc(this.options.metadata);a!==""&&n.setHeader("Upload-Metadata",a);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):s=this._sendRequest(n,null),s.then(function(o){if(!di(o.getStatus(),200)){t._emitHttpError(n,o,"tus: unexpected response while creating upload");return}var r=o.getHeader("Location");if(r==null){t._emitHttpError(n,o,"tus: invalid or missing Location header");return}if(t.url=mc(t.options.endpoint,r),"Created upload at ".concat(t.url),typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._size===0){t._emitSuccess(),t._source.close();return}t._saveUploadInUrlStorage().then(function(){t.options.uploadDataDuringCreation?t._handleUploadResponse(n,o):(t._offset=0,t._performUpload())})}).catch(function(o){t._emitHttpError(n,null,"tus: failed to create upload",o)})}},{key:"_resumeUpload",value:function(){var t=this,n=this._openRequest("HEAD",this.url),a=this._sendRequest(n,null);a.then(function(s){var o=s.getStatus();if(!di(o,200)){if(o===423){t._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(di(o,400)&&t._removeFromUrlStorage(),!t.options.endpoint){t._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}t.url=null,t._createUpload();return}var r=parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(r)){t._emitHttpError(n,s,"tus: invalid or missing offset value");return}var l=parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(l)&&!t.options.uploadLengthDeferred){t._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._saveUploadInUrlStorage().then(function(){if(r===l){t._emitProgress(l,l),t._emitSuccess();return}t._offset=r,t._performUpload()})}).catch(function(s){t._emitHttpError(n,null,"tus: failed to resume upload",s)})}},{key:"_performUpload",value:function(){var t=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset",this._offset);var a=this._addChunkToRequest(n);a.then(function(s){if(!di(s.getStatus(),200)){t._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}t._handleUploadResponse(n,s)}).catch(function(s){t._aborted||t._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(t._offset),s)})}}},{key:"_addChunkToRequest",value:function(t){var n=this,a=this._offset,s=this._offset+this.options.chunkSize;return t.setProgressHandler(function(o){n._emitProgress(a+o,n._size)}),t.setHeader("Content-Type","application/offset+octet-stream"),(s===1/0||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(a,s).then(function(o){var r=o.value,l=o.done,c=r&&r.size?r.size:0;n.options.uploadLengthDeferred&&l&&(n._size=n._offset+c,t.setHeader("Upload-Length",n._size));var p=n._offset+c;return!n.options.uploadLengthDeferred&&l&&p!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(p," bytes"))):r===null?n._sendRequest(t):(n._emitProgress(n._offset,n._size),n._sendRequest(t,r))})}},{key:"_handleUploadResponse",value:function(t,n){var a=parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(a)){this._emitHttpError(t,n,"tus: invalid or missing offset value");return}if(this._emitProgress(a,this._size),this._emitChunkComplete(a-this._offset,a,this._size),this._offset=a,a===this._size){this._emitSuccess(),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(t,n){var a=pc(t,n,this.options);return this._req=a,a}},{key:"_removeFromUrlStorage",value:function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){t._emitError(n)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(a){t._urlStorageKey=a})}},{key:"_sendRequest",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return dc(t,n,this.options)}}],[{key:"terminate",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=pc("DELETE",t,n);return dc(a,null,n).then(function(s){if(s.getStatus()!==204)throw new fa("tus: unexpected response while terminating upload",null,a,s)}).catch(function(s){if(s instanceof fa||(s=new fa("tus: failed to terminate upload",s,a,null)),!hc(s,0,n))throw s;var o=n.retryDelays[0],r=n.retryDelays.slice(1),l=pi(pi({},n),{},{retryDelays:r});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return i.terminate(t,l)})})}}]),i}();function uc(i){return Object.entries(i).map(function(e){var t=ld(e,2),n=t[0],a=t[1];return"".concat(n," ").concat(Uy.encode(String(a)))}).join(",")}function di(i,e){return i>=e&&i<e+100}function pc(i,e,t){var n=t.httpStack.createRequest(i,e);n.setHeader("Tus-Resumable","1.0.0");var a=t.headers||{};if(Object.entries(a).forEach(function(o){var r=ld(o,2),l=r[0],c=r[1];n.setHeader(l,c)}),t.addRequestId){var s=s0();n.setHeader("X-Request-ID",s)}return n}function dc(i,e,t){return Do.apply(this,arguments)}function Do(){return Do=o0(Ao().mark(function i(e,t,n){var a;return Ao().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(typeof n.onBeforeRequest!="function"){o.next=3;break}return o.next=3,n.onBeforeRequest(e);case 3:return o.next=5,e.send(t);case 5:if(a=o.sent,typeof n.onAfterResponse!="function"){o.next=9;break}return o.next=9,n.onAfterResponse(e,a);case 9:return o.abrupt("return",a);case 10:case"end":return o.stop()}},i)})),Do.apply(this,arguments)}function g0(){var i=!0;return typeof window<"u"&&"navigator"in window&&window.navigator.onLine===!1&&(i=!1),i}function hc(i,e,t){return t.retryDelays==null||e>=t.retryDelays.length||i.originalRequest==null?!1:t&&typeof t.onShouldRetry=="function"?t.onShouldRetry(i,e,t):ud(i)}function ud(i){var e=i.originalResponse?i.originalResponse.getStatus():0;return(!di(e,400)||e===409||e===423)&&g0()}function mc(i,e){return new Xy(e,i).toString()}function v0(i,e){for(var t=Math.floor(i/e),n=[],a=0;a<e;a++)n.push({start:t*a,end:t*(a+1)});return n[e-1].end=i,n}Wa.defaultOptions=f0;function Bn(i){"@babel/helpers - typeof";return Bn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bn(i)}function b0(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function fc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,x0(n.key),n)}}function y0(i,e,t){return e&&fc(i.prototype,e),t&&fc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function x0(i){var e=w0(i,"string");return Bn(e)==="symbol"?e:String(e)}function w0(i,e){if(Bn(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(Bn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var P0=function(){function i(){b0(this,i)}return y0(i,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(t){return Promise.resolve([])}},{key:"removeUpload",value:function(t){return Promise.resolve()}},{key:"addUpload",value:function(t,n){return Promise.resolve(null)}}]),i}();function Mn(i){"@babel/helpers - typeof";return Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mn(i)}function S0(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function gc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,_0(n.key),n)}}function F0(i,e,t){return e&&gc(i.prototype,e),t&&gc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function _0(i){var e=C0(i,"string");return Mn(e)==="symbol"?e:String(e)}function C0(i,e){if(Mn(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(Mn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ro=!1;try{Ro="localStorage"in window;var qs="tusSupport",vc=localStorage.getItem(qs);localStorage.setItem(qs,vc),vc===null&&localStorage.removeItem(qs)}catch(i){if(i.code===i.SECURITY_ERR||i.code===i.QUOTA_EXCEEDED_ERR)Ro=!1;else throw i}var E0=Ro,k0=function(){function i(){S0(this,i)}return F0(i,[{key:"findAllUploads",value:function(){var t=this._findEntries("tus::");return Promise.resolve(t)}},{key:"findUploadsByFingerprint",value:function(t){var n=this._findEntries("tus::".concat(t,"::"));return Promise.resolve(n)}},{key:"removeUpload",value:function(t){return localStorage.removeItem(t),Promise.resolve()}},{key:"addUpload",value:function(t,n){var a=Math.round(Math.random()*1e12),s="tus::".concat(t,"::").concat(a);return localStorage.setItem(s,JSON.stringify(n)),Promise.resolve(s)}},{key:"_findEntries",value:function(t){for(var n=[],a=0;a<localStorage.length;a++){var s=localStorage.key(a);if(s.indexOf(t)===0)try{var o=JSON.parse(localStorage.getItem(s));o.urlStorageKey=s,n.push(o)}catch{}}return n}}]),i}();function jn(i){"@babel/helpers - typeof";return jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jn(i)}function Fr(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function bc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,T0(n.key),n)}}function _r(i,e,t){return e&&bc(i.prototype,e),t&&bc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function T0(i){var e=O0(i,"string");return jn(e)==="symbol"?e:String(e)}function O0(i,e){if(jn(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(jn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var A0=function(){function i(){Fr(this,i)}return _r(i,[{key:"createRequest",value:function(t,n){return new D0(t,n)}},{key:"getName",value:function(){return"XHRHttpStack"}}]),i}(),D0=function(){function i(e,t){Fr(this,i),this._xhr=new XMLHttpRequest,this._xhr.open(e,t,!0),this._method=e,this._url=t,this._headers={}}return _r(i,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(t,n){this._xhr.setRequestHeader(t,n),this._headers[t]=n}},{key:"getHeader",value:function(t){return this._headers[t]}},{key:"setProgressHandler",value:function(t){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(n){n.lengthComputable&&t(n.loaded)})}},{key:"send",value:function(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(a,s){t._xhr.onload=function(){a(new R0(t._xhr))},t._xhr.onerror=function(o){s(o)},t._xhr.send(n)})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),i}(),R0=function(){function i(e){Fr(this,i),this._xhr=e}return _r(i,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(t){return this._xhr.getResponseHeader(t)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),i}(),pd=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"};function I0(i){return new Promise(function(e,t){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var a=n.response;e(a)},n.onerror=function(a){t(a)},n.open("GET",i),n.send()})}var U0=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")};function N0(i){return new Promise(function(e,t){var n=new FileReader;n.onload=function(){var a=new Uint8Array(n.result);e({value:a})},n.onerror=function(a){t(a)},n.readAsArrayBuffer(i)})}function zn(i){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zn(i)}function L0(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function yc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,M0(n.key),n)}}function B0(i,e,t){return e&&yc(i.prototype,e),t&&yc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function M0(i){var e=j0(i,"string");return zn(e)==="symbol"?e:String(e)}function j0(i,e){if(zn(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(zn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var xc=function(){function i(e){L0(this,i),this._file=e,this.size=e.size}return B0(i,[{key:"slice",value:function(t,n){if(U0())return N0(this._file.slice(t,n));var a=this._file.slice(t,n),s=n>=this.size;return Promise.resolve({value:a,done:s})}},{key:"close",value:function(){}}]),i}();function $n(i){"@babel/helpers - typeof";return $n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$n(i)}function z0(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function wc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,q0(n.key),n)}}function $0(i,e,t){return e&&wc(i.prototype,e),t&&wc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function q0(i){var e=H0(i,"string");return $n(e)==="symbol"?e:String(e)}function H0(i,e){if($n(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if($n(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Pc(i){return i===void 0?0:i.size!==void 0?i.size:i.length}function V0(i,e){if(i.concat)return i.concat(e);if(i instanceof Blob)return new Blob([i,e],{type:i.type});if(i.set){var t=new i.constructor(i.length+e.length);return t.set(i),t.set(e,i.length),t}throw new Error("Unknown data type")}var W0=function(){function i(e){z0(this,i),this._buffer=void 0,this._bufferOffset=0,this._reader=e,this._done=!1}return $0(i,[{key:"slice",value:function(t,n){return t<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(t,n)}},{key:"_readUntilEnoughDataOrDone",value:function(t,n){var a=this,s=n<=this._bufferOffset+Pc(this._buffer);if(this._done||s){var o=this._getDataFromBuffer(t,n),r=o==null?this._done:!1;return Promise.resolve({value:o,done:r})}return this._reader.read().then(function(l){var c=l.value,p=l.done;return p?a._done=!0:a._buffer===void 0?a._buffer=c:a._buffer=V0(a._buffer,c),a._readUntilEnoughDataOrDone(t,n)})}},{key:"_getDataFromBuffer",value:function(t,n){t>this._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var a=Pc(this._buffer)===0;return this._done&&a?null:this._buffer.slice(0,n-t)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}]),i}();function li(i){"@babel/helpers - typeof";return li=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},li(i)}function Io(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Io=function(){return e};var i,e={},t=Object.prototype,n=t.hasOwnProperty,a=Object.defineProperty||function(P,b,w){P[b]=w.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",r=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function c(P,b,w){return Object.defineProperty(P,b,{value:w,enumerable:!0,configurable:!0,writable:!0}),P[b]}try{c({},"")}catch{c=function(w,E,T){return w[E]=T}}function p(P,b,w,E){var T=b&&b.prototype instanceof y?b:y,k=Object.create(T.prototype),M=new j(E||[]);return a(k,"_invoke",{value:z(P,w,M)}),k}function u(P,b,w){try{return{type:"normal",arg:P.call(b,w)}}catch(E){return{type:"throw",arg:E}}}e.wrap=p;var h="suspendedStart",g="suspendedYield",m="executing",v="completed",f={};function y(){}function F(){}function S(){}var A={};c(A,o,function(){return this});var D=Object.getPrototypeOf,x=D&&D(D($([])));x&&x!==t&&n.call(x,o)&&(A=x);var _=S.prototype=y.prototype=Object.create(A);function O(P){["next","throw","return"].forEach(function(b){c(P,b,function(w){return this._invoke(b,w)})})}function L(P,b){function w(T,k,M,q){var W=u(P[T],P,k);if(W.type!=="throw"){var de=W.arg,he=de.value;return he&&li(he)=="object"&&n.call(he,"__await")?b.resolve(he.__await).then(function(le){w("next",le,M,q)},function(le){w("throw",le,M,q)}):b.resolve(he).then(function(le){de.value=le,M(de)},function(le){return w("throw",le,M,q)})}q(W.arg)}var E;a(this,"_invoke",{value:function(k,M){function q(){return new b(function(W,de){w(k,M,W,de)})}return E=E?E.then(q,q):q()}})}function z(P,b,w){var E=h;return function(T,k){if(E===m)throw new Error("Generator is already running");if(E===v){if(T==="throw")throw k;return{value:i,done:!0}}for(w.method=T,w.arg=k;;){var M=w.delegate;if(M){var q=K(M,w);if(q){if(q===f)continue;return q}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(E===h)throw E=v,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);E=m;var W=u(P,b,w);if(W.type==="normal"){if(E=w.done?v:g,W.arg===f)continue;return{value:W.arg,done:w.done}}W.type==="throw"&&(E=v,w.method="throw",w.arg=W.arg)}}}function K(P,b){var w=b.method,E=P.iterator[w];if(E===i)return b.delegate=null,w==="throw"&&P.iterator.return&&(b.method="return",b.arg=i,K(P,b),b.method==="throw")||w!=="return"&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+w+"' method")),f;var T=u(E,P.iterator,b.arg);if(T.type==="throw")return b.method="throw",b.arg=T.arg,b.delegate=null,f;var k=T.arg;return k?k.done?(b[P.resultName]=k.value,b.next=P.nextLoc,b.method!=="return"&&(b.method="next",b.arg=i),b.delegate=null,f):k:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,f)}function Z(P){var b={tryLoc:P[0]};1 in P&&(b.catchLoc=P[1]),2 in P&&(b.finallyLoc=P[2],b.afterLoc=P[3]),this.tryEntries.push(b)}function G(P){var b=P.completion||{};b.type="normal",delete b.arg,P.completion=b}function j(P){this.tryEntries=[{tryLoc:"root"}],P.forEach(Z,this),this.reset(!0)}function $(P){if(P||P===""){var b=P[o];if(b)return b.call(P);if(typeof P.next=="function")return P;if(!isNaN(P.length)){var w=-1,E=function T(){for(;++w<P.length;)if(n.call(P,w))return T.value=P[w],T.done=!1,T;return T.value=i,T.done=!0,T};return E.next=E}}throw new TypeError(li(P)+" is not iterable")}return F.prototype=S,a(_,"constructor",{value:S,configurable:!0}),a(S,"constructor",{value:F,configurable:!0}),F.displayName=c(S,l,"GeneratorFunction"),e.isGeneratorFunction=function(P){var b=typeof P=="function"&&P.constructor;return!!b&&(b===F||(b.displayName||b.name)==="GeneratorFunction")},e.mark=function(P){return Object.setPrototypeOf?Object.setPrototypeOf(P,S):(P.__proto__=S,c(P,l,"GeneratorFunction")),P.prototype=Object.create(_),P},e.awrap=function(P){return{__await:P}},O(L.prototype),c(L.prototype,r,function(){return this}),e.AsyncIterator=L,e.async=function(P,b,w,E,T){T===void 0&&(T=Promise);var k=new L(p(P,b,w,E),T);return e.isGeneratorFunction(b)?k:k.next().then(function(M){return M.done?M.value:k.next()})},O(_),c(_,l,"Generator"),c(_,o,function(){return this}),c(_,"toString",function(){return"[object Generator]"}),e.keys=function(P){var b=Object(P),w=[];for(var E in b)w.push(E);return w.reverse(),function T(){for(;w.length;){var k=w.pop();if(k in b)return T.value=k,T.done=!1,T}return T.done=!0,T}},e.values=$,j.prototype={constructor:j,reset:function(b){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(G),!b)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=i)},stop:function(){this.done=!0;var b=this.tryEntries[0].completion;if(b.type==="throw")throw b.arg;return this.rval},dispatchException:function(b){if(this.done)throw b;var w=this;function E(de,he){return M.type="throw",M.arg=b,w.next=de,he&&(w.method="next",w.arg=i),!!he}for(var T=this.tryEntries.length-1;T>=0;--T){var k=this.tryEntries[T],M=k.completion;if(k.tryLoc==="root")return E("end");if(k.tryLoc<=this.prev){var q=n.call(k,"catchLoc"),W=n.call(k,"finallyLoc");if(q&&W){if(this.prev<k.catchLoc)return E(k.catchLoc,!0);if(this.prev<k.finallyLoc)return E(k.finallyLoc)}else if(q){if(this.prev<k.catchLoc)return E(k.catchLoc,!0)}else{if(!W)throw new Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return E(k.finallyLoc)}}}},abrupt:function(b,w){for(var E=this.tryEntries.length-1;E>=0;--E){var T=this.tryEntries[E];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var k=T;break}}k&&(b==="break"||b==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var M=k?k.completion:{};return M.type=b,M.arg=w,k?(this.method="next",this.next=k.finallyLoc,f):this.complete(M)},complete:function(b,w){if(b.type==="throw")throw b.arg;return b.type==="break"||b.type==="continue"?this.next=b.arg:b.type==="return"?(this.rval=this.arg=b.arg,this.method="return",this.next="end"):b.type==="normal"&&w&&(this.next=w),f},finish:function(b){for(var w=this.tryEntries.length-1;w>=0;--w){var E=this.tryEntries[w];if(E.finallyLoc===b)return this.complete(E.completion,E.afterLoc),G(E),f}},catch:function(b){for(var w=this.tryEntries.length-1;w>=0;--w){var E=this.tryEntries[w];if(E.tryLoc===b){var T=E.completion;if(T.type==="throw"){var k=T.arg;G(E)}return k}}throw new Error("illegal catch attempt")},delegateYield:function(b,w,E){return this.delegate={iterator:$(b),resultName:w,nextLoc:E},this.method==="next"&&(this.arg=i),f}},e}function Sc(i,e,t,n,a,s,o){try{var r=i[s](o),l=r.value}catch(c){t(c);return}r.done?e(l):Promise.resolve(l).then(n,a)}function G0(i){return function(){var e=this,t=arguments;return new Promise(function(n,a){var s=i.apply(e,t);function o(l){Sc(s,n,a,o,r,"next",l)}function r(l){Sc(s,n,a,o,r,"throw",l)}o(void 0)})}}function K0(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Fc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Q0(n.key),n)}}function X0(i,e,t){return e&&Fc(i.prototype,e),t&&Fc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Q0(i){var e=Y0(i,"string");return li(e)==="symbol"?e:String(e)}function Y0(i,e){if(li(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(li(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var J0=function(){function i(){K0(this,i)}return X0(i,[{key:"openFile",value:function(){var e=G0(Io().mark(function n(a,s){var o;return Io().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(!(pd()&&a&&typeof a.uri<"u")){l.next=11;break}return l.prev=1,l.next=4,I0(a.uri);case 4:return o=l.sent,l.abrupt("return",new xc(o));case 8:throw l.prev=8,l.t0=l.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(l.t0));case 11:if(!(typeof a.slice=="function"&&typeof a.size<"u")){l.next=13;break}return l.abrupt("return",Promise.resolve(new xc(a)));case 13:if(typeof a.read!="function"){l.next=18;break}if(s=Number(s),Number.isFinite(s)){l.next=17;break}return l.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return l.abrupt("return",Promise.resolve(new W0(a,s)));case 18:return l.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case"end":return l.stop()}},n,null,[[1,8]])}));function t(n,a){return e.apply(this,arguments)}return t}()}]),i}();function Z0(i,e){return pd()?Promise.resolve(ex(i,e)):Promise.resolve(["tus-br",i.name,i.type,i.size,i.lastModified,e.endpoint].join("-"))}function ex(i,e){var t=i.exif?tx(JSON.stringify(i.exif)):"noexif";return["tus-rn",i.name||"noname",i.size||"nosize",t,e.endpoint].join("/")}function tx(i){var e=0;if(i.length===0)return e;for(var t=0;t<i.length;t++){var n=i.charCodeAt(t);e=(e<<5)-e+n,e&=e}return e}function Si(i){"@babel/helpers - typeof";return Si=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Si(i)}function ix(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function _c(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,dd(n.key),n)}}function nx(i,e,t){return e&&_c(i.prototype,e),t&&_c(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function ax(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Uo(i,e)}function Uo(i,e){return Uo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Uo(i,e)}function sx(i){var e=lx();return function(){var n=Ga(i),a;if(e){var s=Ga(this).constructor;a=Reflect.construct(n,arguments,s)}else a=n.apply(this,arguments);return ox(this,a)}}function ox(i,e){if(e&&(Si(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rx(i)}function rx(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function lx(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ga(i){return Ga=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ga(i)}function Cc(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function gi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Cc(Object(t),!0).forEach(function(n){cx(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Cc(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function cx(i,e,t){return e=dd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function dd(i){var e=ux(i,"string");return Si(e)==="symbol"?e:String(e)}function ux(i,e){if(Si(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(Si(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var No=gi(gi({},Wa.defaultOptions),{},{httpStack:new A0,fileReader:new J0,urlStorage:E0?new k0:new P0,fingerprint:Z0}),px=function(i){ax(t,i);var e=sx(t);function t(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ix(this,t),a=gi(gi({},No),a),e.call(this,n,a)}return nx(t,null,[{key:"terminate",value:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s=gi(gi({},No),s),Wa.terminate(a,s)}}]),t}(Wa);function wt(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var dx=0;function hd(i){return"__private_"+dx+++"_"+i}var Pe=hd("uppy"),en=hd("events");class hx{constructor(e){Object.defineProperty(this,Pe,{writable:!0,value:void 0}),Object.defineProperty(this,en,{writable:!0,value:[]}),wt(this,Pe)[Pe]=e}on(e,t){return wt(this,en)[en].push([e,t]),wt(this,Pe)[Pe].on(e,t)}remove(){for(const[e,t]of wt(this,en)[en].splice(0))wt(this,Pe)[Pe].off(e,t)}onFilePause(e,t){this.on("upload-pause",(n,a)=>{e===n&&t(a)})}onFileRemove(e,t){this.on("file-removed",n=>{e===n.id&&t(n.id)})}onPause(e,t){this.on("upload-pause",(n,a)=>{e===n&&t(a)})}onRetry(e,t){this.on("upload-retry",n=>{e===n&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{wt(this,Pe)[Pe].getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{wt(this,Pe)[Pe].getFile(e)&&t()})}onCancelAll(e,t){var n=this;this.on("cancel-all",function(){wt(n,Pe)[Pe].getFile(e)&&t(...arguments)})}onResumeAll(e,t){this.on("resume-all",()=>{wt(this,Pe)[Pe].getFile(e)&&t()})}}function mx(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}function B(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var fx=0;function Te(i){return"__private_"+fx+++"_"+i}function gx(i){return new Error("Cancelled",{cause:i})}function Ec(i){if(i!=null){var e;const t=()=>this.abort(i.reason);i.addEventListener("abort",t,{once:!0});const n=()=>{i.removeEventListener("abort",t)};(e=this.then)==null||e.call(this,n,n)}return this}var Ne=Te("activeRequests"),_e=Te("queuedHandlers"),Ae=Te("paused"),Kt=Te("pauseTimer"),Se=Te("downLimit"),Xt=Te("upperLimit"),Pt=Te("rateLimitingTimer"),bn=Te("call"),Tt=Te("queueNext"),Lo=Te("next"),Hs=Te("queue"),Bo=Te("dequeue"),Vs=Te("resume"),Qt=Te("increaseLimit");class vx{constructor(e){Object.defineProperty(this,Bo,{value:Px}),Object.defineProperty(this,Hs,{value:wx}),Object.defineProperty(this,Lo,{value:xx}),Object.defineProperty(this,Tt,{value:yx}),Object.defineProperty(this,bn,{value:bx}),Object.defineProperty(this,Ne,{writable:!0,value:0}),Object.defineProperty(this,_e,{writable:!0,value:[]}),Object.defineProperty(this,Ae,{writable:!0,value:!1}),Object.defineProperty(this,Kt,{writable:!0,value:void 0}),Object.defineProperty(this,Se,{writable:!0,value:1}),Object.defineProperty(this,Xt,{writable:!0,value:void 0}),Object.defineProperty(this,Pt,{writable:!0,value:void 0}),Object.defineProperty(this,Vs,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,Qt,{writable:!0,value:()=>{if(B(this,Ae)[Ae]){B(this,Pt)[Pt]=setTimeout(B(this,Qt)[Qt],0);return}B(this,Se)[Se]=this.limit,this.limit=Math.ceil((B(this,Xt)[Xt]+B(this,Se)[Se])/2);for(let t=B(this,Se)[Se];t<=this.limit;t++)B(this,Tt)[Tt]();B(this,Xt)[Xt]-B(this,Se)[Se]>3?B(this,Pt)[Pt]=setTimeout(B(this,Qt)[Qt],2e3):B(this,Se)[Se]=Math.floor(B(this,Se)[Se]/2)}}),typeof e!="number"||e===0?this.limit=1/0:this.limit=e}run(e,t){return!B(this,Ae)[Ae]&&B(this,Ne)[Ne]<this.limit?B(this,bn)[bn](e):B(this,Hs)[Hs](e,t)}wrapSyncFunction(e,t){var n=this;return function(){for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];const r=n.run(()=>(e(...s),queueMicrotask(()=>r.done()),()=>{}),t);return{abortOn:Ec,abort(){r.abort()}}}}wrapPromiseFunction(e,t){var n=this;return function(){for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];let r;const l=new Promise((c,p)=>{r=n.run(()=>{let u,h;try{h=Promise.resolve(e(...s))}catch(g){h=Promise.reject(g)}return h.then(g=>{u?p(u):(r.done(),c(g))},g=>{u?p(u):(r.done(),p(g))}),g=>{u=gx(g)}},t)});return l.abort=c=>{r.abort(c)},l.abortOn=Ec,l}}resume(){B(this,Ae)[Ae]=!1,clearTimeout(B(this,Kt)[Kt]);for(let e=0;e<this.limit;e++)B(this,Tt)[Tt]()}pause(e){e===void 0&&(e=null),B(this,Ae)[Ae]=!0,clearTimeout(B(this,Kt)[Kt]),e!=null&&(B(this,Kt)[Kt]=setTimeout(B(this,Vs)[Vs],e))}rateLimit(e){clearTimeout(B(this,Pt)[Pt]),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(B(this,Xt)[Xt]=this.limit-1,this.limit=B(this,Se)[Se],B(this,Pt)[Pt]=setTimeout(B(this,Qt)[Qt],e))}get isPaused(){return B(this,Ae)[Ae]}}function bx(i){B(this,Ne)[Ne]+=1;let e=!1,t;try{t=i()}catch(n){throw B(this,Ne)[Ne]-=1,n}return{abort:n=>{e||(e=!0,B(this,Ne)[Ne]-=1,t==null||t(n),B(this,Tt)[Tt]())},done:()=>{e||(e=!0,B(this,Ne)[Ne]-=1,B(this,Tt)[Tt]())}}}function yx(){queueMicrotask(()=>B(this,Lo)[Lo]())}function xx(){if(B(this,Ae)[Ae]||B(this,Ne)[Ne]>=this.limit||B(this,_e)[_e].length===0)return;const i=B(this,_e)[_e].shift();if(i==null)throw new Error("Invariant violation: next is null");const e=B(this,bn)[bn](i.fn);i.abort=e.abort,i.done=e.done}function wx(i,e){const t={fn:i,priority:(e==null?void 0:e.priority)||0,abort:()=>{B(this,Bo)[Bo](t)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},n=B(this,_e)[_e].findIndex(a=>t.priority>a.priority);return n===-1?B(this,_e)[_e].push(t):B(this,_e)[_e].splice(n,0,t),t}function Px(i){const e=B(this,_e)[_e].indexOf(i);e!==-1&&B(this,_e)[_e].splice(e,1)}function Sx(i){const e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function Fx(i){return i.filter(e=>{var t;return!((t=e.progress)!=null&&t.uploadStarted)||!e.isRestored})}function _x(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")}function Cx(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"}function Ex(i){return(e,t)=>{if(_x()||Cx())return No.fingerprint(e,t);const n=["tus",i.id,t.endpoint].join("-");return Promise.resolve(n)}}function si(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var kx=0;function Qn(i){return"__private_"+kx+++"_"+i}const Tx={version:"3.5.4"},md={endpoint:"",uploadUrl:null,metadata:{},uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,overridePatchMethod:!1,headers:{},addRequestId:!1,chunkSize:1/0,retryDelays:[100,1e3,3e3,5e3],parallelUploads:1,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1},Ox={limit:20,retryDelays:md.retryDelays,withCredentials:!1};var yn=Qn("retryDelayIterator"),Mo=Qn("uploadLocalFile"),jo=Qn("getCompanionClientArgs"),Ws=Qn("uploadFiles"),tn=Qn("handleUpload");class fd extends er{constructor(e,t){var n,a;if(super(e,{...Ox,...t}),Object.defineProperty(this,Ws,{value:Rx}),Object.defineProperty(this,jo,{value:Dx}),Object.defineProperty(this,Mo,{value:Ax}),Object.defineProperty(this,yn,{writable:!0,value:void 0}),Object.defineProperty(this,tn,{writable:!0,value:async s=>{if(s.length===0){this.uppy.log("[Tus] No files to upload");return}this.opts.limit===0&&this.uppy.log("[Tus] 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/tus/#limit-0","warning"),this.uppy.log("[Tus] Uploading...");const o=this.uppy.getFilesByIds(s);await si(this,Ws)[Ws](o)}}),this.type="uploader",this.id=this.opts.id||"Tus",(t==null?void 0:t.allowedMetaFields)===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");if("autoRetry"in t)throw new Error("The `autoRetry` option was deprecated and has been removed.");this.requests=(n=this.opts.rateLimitedQueue)!=null?n:new vx(this.opts.limit),si(this,yn)[yn]=(a=this.opts.retryDelays)==null?void 0:a.values(),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null),this.handleResetProgress=this.handleResetProgress.bind(this)}handleResetProgress(){const e={...this.uppy.getState().files};Object.keys(e).forEach(t=>{var n;if((n=e[t])!=null&&(n=n.tus)!=null&&n.uploadUrl){const a={...e[t].tus};delete a.uploadUrl,e[t]={...e[t],tus:a}}}),this.uppy.setState({files:e})}resetUploaderReferences(e,t){const n=this.uploaders[e];n&&(n.abort(),t!=null&&t.abort&&n.abort(!0),this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null)}onReceiveUploadUrl(e,t){const n=this.uppy.getFile(e.id);n&&(!n.tus||n.tus.uploadUrl!==t)&&(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(n.id,{tus:{...n.tus,uploadUrl:t}}))}install(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!0}}),this.uppy.addUploader(si(this,tn)[tn]),this.uppy.on("reset-progress",this.handleResetProgress)}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(si(this,tn)[tn])}}function Ax(i){var e=this;return this.resetUploaderReferences(i.id),new Promise((t,n)=>{let a,s,o;const r={...this.opts,...i.tus||{}};typeof r.headers=="function"&&(r.headers=r.headers(i));const{onShouldRetry:l,onBeforeRequest:c,...p}=r,u={...md,...p};u.fingerprint=Ex(i),u.onBeforeRequest=async y=>{const F=y.getUnderlyingObject();F.withCredentials=!!r.withCredentials;let S;if(typeof c=="function"&&(S=c(y,i)),xa(a,"shouldBeRequeued")){if(!a.shouldBeRequeued)return Promise.reject();let A;const D=new Promise(x=>{A=x});a=this.requests.run(()=>(i.isPaused&&a.abort(),A(),()=>{})),await Promise.all([D,S]);return}return S},u.onError=y=>{var F;this.uppy.log(y);const S=y.originalRequest!=null?y.originalRequest.getUnderlyingObject():null;mx(S)&&(y=new Cu(y,S)),this.resetUploaderReferences(i.id),(F=a)==null||F.abort(),this.uppy.emit("upload-error",i,y),typeof r.onError=="function"&&r.onError(y),n(y)},u.onProgress=(y,F)=>{this.onReceiveUploadUrl(i,o.url),typeof r.onProgress=="function"&&r.onProgress(y,F),this.uppy.emit("upload-progress",this.uppy.getFile(i.id),{uploader:this,bytesUploaded:y,bytesTotal:F})},u.onSuccess=()=>{var y;const F={uploadURL:(y=o.url)!=null?y:void 0,status:200,body:{}};if(this.resetUploaderReferences(i.id),a.done(),this.uppy.emit("upload-success",this.uppy.getFile(i.id),F),o.url){const{name:S}=o.file;this.uppy.log(`Download ${S} from ${o.url}`)}typeof r.onSuccess=="function"&&r.onSuccess(),t(o)};const h=y=>{var F;const S=y==null||(F=y.originalResponse)==null?void 0:F.getStatus();if(S===429){if(!this.requests.isPaused){var A;const D=(A=si(this,yn)[yn])==null?void 0:A.next();if(D==null||D.done)return!1;this.requests.rateLimit(D.value)}}else{if(S!=null&&S>400&&S<500&&S!==409&&S!==423)return!1;typeof navigator<"u"&&navigator.onLine===!1&&(this.requests.isPaused||(this.requests.pause(),window.addEventListener("online",()=>{this.requests.resume()},{once:!0})))}return a.abort(),a={shouldBeRequeued:!0,abort(){this.shouldBeRequeued=!1},done(){throw new Error("Cannot mark a queued request as done: this indicates a bug")},fn(){throw new Error("Cannot run a queued request: this indicates a bug")}},!0};l!=null?u.onShouldRetry=(y,F)=>l(y,F,r,h):u.onShouldRetry=h;const g=(y,F,S)=>{xa(y,F)&&!xa(y,S)&&(y[S]=y[F])},m={};(Array.isArray(r.allowedMetaFields)?r.allowedMetaFields:Object.keys(i.meta)).forEach(y=>{m[y]=String(i.meta[y])}),g(m,"type","filetype"),g(m,"name","filename"),u.metadata=m,o=new px(i.data,u),this.uploaders[i.id]=o;const f=new hx(this.uppy);this.uploaderEvents[i.id]=f,s=()=>(i.isPaused||o.start(),()=>{}),o.findPreviousUploads().then(y=>{const F=y[0];F&&(this.uppy.log(`[Tus] Resuming upload of ${i.id} started at ${F.creationTime}`),o.resumeFromPreviousUpload(F))}),a=this.requests.run(s),f.onFileRemove(i.id,y=>{a.abort(),this.resetUploaderReferences(i.id,{abort:!!o.url}),t(`upload ${y} was removed`)}),f.onPause(i.id,y=>{a.abort(),y?o.abort():a=this.requests.run(s)}),f.onPauseAll(i.id,()=>{a.abort(),o.abort()}),f.onCancelAll(i.id,function(y){let{reason:F}=y===void 0?{}:y;F==="user"&&(a.abort(),e.resetUploaderReferences(i.id,{abort:!!o.url})),t(`upload ${i.id} was canceled`)}),f.onResumeAll(i.id,()=>{a.abort(),i.error&&o.abort(),a=this.requests.run(s)})}).catch(t=>{throw this.uppy.emit("upload-error",i,t),t})}function Dx(i){var e;const t={...this.opts};return i.tus&&Object.assign(t,i.tus),{...(e=i.remote)==null?void 0:e.body,endpoint:t.endpoint,uploadUrl:t.uploadUrl,protocol:"tus",size:i.data.size,headers:t.headers,metadata:i.meta}}async function Rx(i){const e=Sx(i),t=Fx(e);this.uppy.emit("upload-start",t),await Promise.allSettled(e.map(n=>{if(n.isRemote){const a=()=>this.requests,s=new AbortController,o=l=>{l.id===n.id&&s.abort()};this.uppy.on("file-removed",o);const r=this.uppy.getRequestClientForFile(n).uploadRemoteFile(n,si(this,jo)[jo](n),{signal:s.signal,getQueue:a});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",o)},{priority:-1})(),r}return si(this,Mo)[Mo](n)}))}fd.VERSION=Tx.version;const Cr={strings:{},pluralize(){return 0}};Cr.strings={addBulkFilesFailed:"内部错误导致添加 %{smart_count} 个文件失败",addMore:"添加更多文件",addMoreFiles:"添加更多文件",addingMoreFiles:"添加更多文件",allowAccessDescription:"为了通过您的相机进行拍照或录像,请给网站相机的访问权限",allowAccessTitle:"请允许对相机的访问权限",authenticateWith:"连接到 %{pluginName}",authenticateWithTitle:"请使用 %{pluginName} 进行认证以选择文件",back:"返回",browse:"浏览",browseFiles:"浏览",cancel:"取消",cancelUpload:"取消上传",chooseFiles:"选择文件",closeModal:"关闭窗口",companionError:"和 Companion 连接失败了",companionUnauthorizeHint:"请访问 %{url} 以认证您的 %{provider} 账户",complete:"上传完毕",connectedToInternet:"连接至网络",copyLink:"复制链接",copyLinkToClipboardFallback:"复制以下网址",copyLinkToClipboardSuccess:"链接已复制到剪贴板",creatingAssembly:"正在准备上传…",creatingAssemblyFailed:"Transloadit:无法创建程序集",dashboardTitle:"文件上传工具",dashboardWindowTitle:"文件上传工具窗口(点击离开以关闭)",dataUploadedOfTotal:"%{total} / %{complete}",done:"完成",dropHereOr:"拖拽文件到这里,或%{browse}",dropHint:"拖拽文件到这里",dropPasteBoth:"拖拽文件到这里,或者%{browse}文件",dropPasteFiles:"拖拽文件到这里,或者%{browse}文件",dropPasteFolders:"拖拽文件到这里,或者%{browse}文件",dropPasteImportBoth:"拖拽文件到这里,粘贴、%{browse}或者导入",dropPasteImportFiles:"拖拽文件到这里,粘贴、%{browse}或者导入",dropPasteImportFolders:"拖拽文件到这里,粘贴、%{browse}或者导入",editFile:"编辑文件",editImage:"编辑图片",editing:"正在编辑 %{file}",emptyFolderAdded:"无法从空文件夹添加文件",encoding:"正在编码…",enterCorrectUrl:"错误链接: 请确认您输入的是文件的链接",enterUrlToImport:"输入链接或者导入文件",exceedsSize:"文件超过了最大尺寸限制 %{size}",failedToFetch:"Companion 无法抓取此链接,请确保它是正确的",failedToUpload:"上传 %{file} 失败",fileSource:"文件源:%{name}",filesUploadedOfTotal:"已上传 %{smart_count} 个文件中的 %{complete} 个",filter:"筛选器",finishEditingFile:"完成文件编辑",folderAdded:"从 %{folder} 添加了 %{smart_count} 个文件",generatingThumbnails:"正在生成缩略图…",import:"导入",importFrom:"从 %{name} 导入",inferiorSize:"文件大小必须超过 %{size}",loading:"正在载入…",logOut:"登出",micDisabled:"麦克风的权限访问被用户拒绝",myDevice:"我的设备",noCameraDescription:"为了拍摄照片或录制视频,请连接一个摄像设备",noCameraTitle:"摄像头不可用",noDuplicates:"无法添加重复文件 %{fileName},该文件已存在",noFilesFound:"这里空空如也",noInternetConnection:"无法连接到网络",noMoreFilesAllowed:"无法添加新文件:已正在上传文件",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"强力驱动于 %{uppy}",processingXFiles:"正在处理 %{smart_count} 个文件",recording:"正在录制",recordingLength:"录制长度 %{recording_length}",recordingStoppedMaxSize:"录像已停止,文件大小即将超过限制",removeFile:"删除文件",resetFilter:"重置筛选器",resume:"恢复",resumeUpload:"恢复上传",retry:"重试",retryUpload:"重试",saveChanges:"保存变更",selectFileNamed:"选择文件 %{name}",selectX:"选择 %{smart_count}",smile:"笑一笑!",startCapturing:"开始屏幕录制",startRecording:"开始视频录制",stopCapturing:"停止屏幕录制",stopRecording:"停止视频录制",streamActive:"视频流已激活",streamPassive:"视频流未激活",submitRecordedFile:"提交已录制视频",takePicture:"拍照",timedOut:"上传已超时 %{seconds} 秒,中止上传",unselectFileNamed:"取消选择文件 %{name}",upload:"上传",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传暂停",uploadXFiles:"上传 %{smart_count} 个文件",uploadXNewFiles:"新上传了 %{smart_count} 个文件",uploading:"正在上传",uploadingXFiles:"正在上传 %{smart_count} 个文件",xFilesSelected:"%{smart_count} 个文件待上传",xMoreFilesAdded:"又有 %{smart_count} 个文件被添加",xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传这些文件类型:%{types}",youCanOnlyUploadX:"您只能上传 %{smart_count} 个文件",youHaveToAtLeastSelectX:"您至少要选择 %{smart_count} 个文件"};typeof Uppy<"u"&&(globalThis.Uppy.locales.zh_CN=Cr);const Ix=Cr,Er={strings:{},pluralize(i){return i===1?0:1}};Er.strings={addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},addedNumFiles:"Added %{numFiles} file(s)",addingMoreFiles:"Adding more files",additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",addMore:"Add more",addMoreFiles:"Add more files",allFilesFromFolderNamed:"All files from folder %{name}",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site.",allowAccessTitle:"Please allow access to your camera",allowAudioAccessDescription:"In order to record audio, please allow microphone access for this site.",allowAudioAccessTitle:"Please allow access to your microphone",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)",aspectRatioSquare:"Crop square",authAborted:"Authentication aborted",authenticateWith:"Connect to %{pluginName}",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",back:"Back",browse:"browse",browseFiles:"browse files",browseFolders:"browse folders",cancel:"Cancel",cancelUpload:"Cancel upload",chooseFiles:"Choose files",closeModal:"Close Modal",companionError:"Connection with Companion failed",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",complete:"Complete",compressedX:"Saved %{size} by compressing images",compressingImages:"Compressing images...",connectedToInternet:"Connected to the Internet",copyLink:"Copy link",copyLinkToClipboardFallback:"Copy the URL below",copyLinkToClipboardSuccess:"Link copied to clipboard.",creatingAssembly:"Preparing upload...",creatingAssemblyFailed:"Transloadit: Could not create Assembly",dashboardTitle:"Uppy Dashboard",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dataUploadedOfTotal:"%{complete} of %{total}",discardRecordedFile:"Discard recorded file",done:"Done",dropHereOr:"Drop here or %{browse}",dropHint:"Drop your files here",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",editFile:"Edit file",editImage:"Edit image",editFileWithFilename:"Edit file %{file}",editing:"Editing %{file}",emptyFolderAdded:"No files were added from empty folder",encoding:"Encoding...",enterCorrectUrl:"Incorrect URL: Please make sure you are entering a direct link to a file",enterTextToSearch:"Enter text to search for images",enterUrlToImport:"Enter URL to import a file",error:"Error",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",failedToFetch:"Companion failed to fetch this URL, please make sure it’s correct",failedToUpload:"Failed to upload %{file}",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},filter:"Filter",finishEditingFile:"Finish editing file",flipHorizontal:"Flip horizontal",folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},folderAlreadyAdded:'The folder "%{folder}" was already added',generatingThumbnails:"Generating thumbnails...",import:"Import",importFiles:"Import files from:",importFrom:"Import from %{name}",inferiorSize:"This file is smaller than the allowed size of %{size}",loadedXFiles:"Loaded %{numFiles} files",loading:"Loading...",logOut:"Log out",micDisabled:"Microphone access denied by user",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},myDevice:"My Device",noAudioDescription:"In order to record audio, please connect a microphone or another audio input device",noAudioTitle:"Microphone Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",noCameraTitle:"Camera Not Available",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",noFilesFound:"You have no files or folders here",noInternetConnection:"No Internet connection",noMoreFilesAllowed:"Cannot add more files",noSearchResults:"Unfortunately, there are no results for this search",openFolderNamed:"Open folder %{name}",pause:"Pause",paused:"Paused",pauseUpload:"Pause upload",pluginNameAudio:"Audio",pluginNameBox:"Box",pluginNameCamera:"Camera",pluginNameDropbox:"Dropbox",pluginNameFacebook:"Facebook",pluginNameGoogleDrive:"Google Drive",pluginNameInstagram:"Instagram",pluginNameOneDrive:"OneDrive",pluginNameZoom:"Zoom",poweredBy:"Powered by %{uppy}",processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},recording:"Recording",recordingLength:"Recording length %{recording_length}",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",recordVideoBtn:"Record Video",recoveredAllFiles:"We restored all files. You can now resume the upload.",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},removeFile:"Remove file",reSelect:"Re-select",resetFilter:"Reset filter",resetSearch:"Reset search",resume:"Resume",resumeUpload:"Resume upload",retry:"Retry",retryUpload:"Retry upload",revert:"Revert",rotate:"Rotate",save:"Save",saveChanges:"Save changes",search:"Search",searchImages:"Search for images",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},sessionRestored:"Session restored",showErrorDetails:"Show error details",signInWithGoogle:"Sign in with Google",smile:"Smile!",startAudioRecording:"Begin audio recording",startCapturing:"Begin screen capturing",startRecording:"Begin video recording",stopAudioRecording:"Stop audio recording",stopCapturing:"Stop screen capturing",stopRecording:"Stop video recording",streamActive:"Stream active",streamPassive:"Stream passive",submitRecordedFile:"Submit recorded file",takePicture:"Take a picture",takePictureBtn:"Take Picture",timedOut:"Upload stalled for %{seconds} seconds, aborting.",upload:"Upload",uploadComplete:"Upload complete",uploadFailed:"Upload failed",uploading:"Uploading",uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},uploadPaused:"Upload paused",uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it.",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},xTimeLeft:"%{time} left",youCanOnlyUploadFileTypes:"You can only upload: %{types}",youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},zoomIn:"Zoom in",zoomOut:"Zoom out"};typeof Uppy<"u"&&(globalThis.Uppy.locales.en_US=Er);const Ux=Er,Nx={zh:Lr({...Ix},{strings:{aiKitRequired:"请先安装并配置 AI Kit",aiImageSelectedUse:"使用已选择的图片",aiImageSelectedTip:"请选择心仪的图片",aiImagePrompt:"提示词",aiImagePromptTip:"请输入提示词",aiImageSize:"图片尺寸",aiImageModel:"图片模型",aiImageNumber:"生成数量",aiImageGenerate:"生成图片",aiImageGenerating:"正在生成图片...",browse:"浏览",browseFiles:"浏览文件",browseFolders:"浏览文件夹",dropHereOr:"拖拽文件到这里,或%{browse}",dropHint:"拖拽文件到这里",dropPasteBoth:"拖拽文件到这里、%{browseFiles}或者%{browseFolders}",dropPasteFiles:"拖拽文件到这里或者%{browseFiles}",dropPasteFolders:"拖拽文件到这里或者%{browseFolders}",dropPasteImportBoth:"拖拽文件到这里、粘贴、%{browseFiles}、%{browseFolders}或者通过下方导入:",dropPasteImportFiles:"拖拽文件到这里、粘贴、%{browseFiles}或者通过下方导入:",dropPasteImportFolders:"拖拽文件到这里、粘贴、%{browseFolders}或者通过下方导入:"}}),en:Lr({...Ux},{strings:{aiKitRequired:"Install and config the AI Kit component first",aiImageSelectedUse:"Use selected images",aiImageSelectedTip:"Please select images",aiImagePrompt:"Prompt",aiImagePromptTip:"Please enter the prompt",aiImageSize:"Size",aiImageModel:"Model",aiImageNumber:"Number of images",aiImageGenerate:"Generate",aiImageGenerating:"Generating...",browse:"browse",browseFiles:"browse files",browseFolders:"browse folders",dropHint:"Drop your files here",dropPasteBoth:"Drop files here, paste, %{browseFiles} or %{browseFolders}",dropPasteFiles:"Drop files here, paste or %{browseFiles}",dropPasteFolders:"Drop files here, paste or %{browseFolders}",dropPasteImportBoth:"Drop files here, paste, %{browseFiles}, %{browseFolders} or import from:",dropPasteImportFiles:"Drop files here, paste, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, paste, %{browseFolders} or import from:"}})};function gd(i,e){return function(){return i.apply(e,arguments)}}const{toString:Lx}=Object.prototype,{getPrototypeOf:kr}=Object,ss=(i=>e=>{const t=Lx.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ht=i=>(i=i.toLowerCase(),e=>ss(e)===i),os=i=>e=>typeof e===i,{isArray:Oi}=Array,qn=os("undefined");function Bx(i){return i!==null&&!qn(i)&&i.constructor!==null&&!qn(i.constructor)&&He(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const vd=ht("ArrayBuffer");function Mx(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&vd(i.buffer),e}const jx=os("string"),He=os("function"),bd=os("number"),rs=i=>i!==null&&typeof i=="object",zx=i=>i===!0||i===!1,Aa=i=>{if(ss(i)!=="object")return!1;const e=kr(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},$x=ht("Date"),qx=ht("File"),Hx=ht("Blob"),Vx=ht("FileList"),Wx=i=>rs(i)&&He(i.pipe),Gx=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||He(i.append)&&((e=ss(i))==="formdata"||e==="object"&&He(i.toString)&&i.toString()==="[object FormData]"))},Kx=ht("URLSearchParams"),Xx=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Yn(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let n,a;if(typeof i!="object"&&(i=[i]),Oi(i))for(n=0,a=i.length;n<a;n++)e.call(null,i[n],n,i);else{const s=t?Object.getOwnPropertyNames(i):Object.keys(i),o=s.length;let r;for(n=0;n<o;n++)r=s[n],e.call(null,i[r],r,i)}}function yd(i,e){e=e.toLowerCase();const t=Object.keys(i);let n=t.length,a;for(;n-- >0;)if(a=t[n],e===a.toLowerCase())return a;return null}const xd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Qo,wd=i=>!qn(i)&&i!==xd;function zo(){const{caseless:i}=wd(this)&&this||{},e={},t=(n,a)=>{const s=i&&yd(e,a)||a;Aa(e[s])&&Aa(n)?e[s]=zo(e[s],n):Aa(n)?e[s]=zo({},n):Oi(n)?e[s]=n.slice():e[s]=n};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&Yn(arguments[n],t);return e}const Qx=(i,e,t,{allOwnKeys:n}={})=>(Yn(e,(a,s)=>{t&&He(a)?i[s]=gd(a,t):i[s]=a},{allOwnKeys:n}),i),Yx=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Jx=(i,e,t,n)=>{i.prototype=Object.create(e.prototype,n),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},Zx=(i,e,t,n)=>{let a,s,o;const r={};if(e=e||{},i==null)return e;do{for(a=Object.getOwnPropertyNames(i),s=a.length;s-- >0;)o=a[s],(!n||n(o,i,e))&&!r[o]&&(e[o]=i[o],r[o]=!0);i=t!==!1&&kr(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},e1=(i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;const n=i.indexOf(e,t);return n!==-1&&n===t},t1=i=>{if(!i)return null;if(Oi(i))return i;let e=i.length;if(!bd(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},i1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&kr(Uint8Array)),n1=(i,e)=>{const n=(i&&i[Symbol.iterator]).call(i);let a;for(;(a=n.next())&&!a.done;){const s=a.value;e.call(i,s[0],s[1])}},a1=(i,e)=>{let t;const n=[];for(;(t=i.exec(e))!==null;)n.push(t);return n},s1=ht("HTMLFormElement"),o1=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,a){return n.toUpperCase()+a}),kc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),r1=ht("RegExp"),Pd=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),n={};Yn(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(n[s]=o||a)}),Object.defineProperties(i,n)},l1=i=>{Pd(i,(e,t)=>{if(He(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=i[t];if(He(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},c1=(i,e)=>{const t={},n=a=>{a.forEach(s=>{t[s]=!0})};return Oi(i)?n(i):n(String(i).split(e)),t},u1=()=>{},p1=(i,e)=>(i=+i,Number.isFinite(i)?i:e),Gs="abcdefghijklmnopqrstuvwxyz",Tc="0123456789",Sd={DIGIT:Tc,ALPHA:Gs,ALPHA_DIGIT:Gs+Gs.toUpperCase()+Tc},d1=(i=16,e=Sd.ALPHA_DIGIT)=>{let t="";const{length:n}=e;for(;i--;)t+=e[Math.random()*n|0];return t};function h1(i){return!!(i&&He(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}const m1=i=>{const e=new Array(10),t=(n,a)=>{if(rs(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[a]=n;const s=Oi(n)?[]:{};return Yn(n,(o,r)=>{const l=t(o,a+1);!qn(l)&&(s[r]=l)}),e[a]=void 0,s}}return n};return t(i,0)},f1=ht("AsyncFunction"),g1=i=>i&&(rs(i)||He(i))&&He(i.then)&&He(i.catch),C={isArray:Oi,isArrayBuffer:vd,isBuffer:Bx,isFormData:Gx,isArrayBufferView:Mx,isString:jx,isNumber:bd,isBoolean:zx,isObject:rs,isPlainObject:Aa,isUndefined:qn,isDate:$x,isFile:qx,isBlob:Hx,isRegExp:r1,isFunction:He,isStream:Wx,isURLSearchParams:Kx,isTypedArray:i1,isFileList:Vx,forEach:Yn,merge:zo,extend:Qx,trim:Xx,stripBOM:Yx,inherits:Jx,toFlatObject:Zx,kindOf:ss,kindOfTest:ht,endsWith:e1,toArray:t1,forEachEntry:n1,matchAll:a1,isHTMLForm:s1,hasOwnProperty:kc,hasOwnProp:kc,reduceDescriptors:Pd,freezeMethods:l1,toObjectSet:c1,toCamelCase:o1,noop:u1,toFiniteNumber:p1,findKey:yd,global:xd,isContextDefined:wd,ALPHABET:Sd,generateString:d1,isSpecCompliantForm:h1,toJSONObject:m1,isAsyncFn:f1,isThenable:g1};function V(i,e,t,n,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),a&&(this.response=a)}C.inherits(V,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:C.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Fd=V.prototype,_d={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{_d[i]={value:i}});Object.defineProperties(V,_d);Object.defineProperty(Fd,"isAxiosError",{value:!0});V.from=(i,e,t,n,a,s)=>{const o=Object.create(Fd);return C.toFlatObject(i,o,function(l){return l!==Error.prototype},r=>r!=="isAxiosError"),V.call(o,i.message,e,t,n,a),o.cause=i,o.name=i.name,s&&Object.assign(o,s),o};const v1=null;function $o(i){return C.isPlainObject(i)||C.isArray(i)}function Cd(i){return C.endsWith(i,"[]")?i.slice(0,-2):i}function Oc(i,e,t){return i?i.concat(e).map(function(a,s){return a=Cd(a),!t&&s?"["+a+"]":a}).join(t?".":""):e}function b1(i){return C.isArray(i)&&!i.some($o)}const y1=C.toFlatObject(C,{},null,function(e){return/^is[A-Z]/.test(e)});function ls(i,e,t){if(!C.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=C.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,f){return!C.isUndefined(f[v])});const n=t.metaTokens,a=t.visitor||p,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&C.isSpecCompliantForm(e);if(!C.isFunction(a))throw new TypeError("visitor must be a function");function c(m){if(m===null)return"";if(C.isDate(m))return m.toISOString();if(!l&&C.isBlob(m))throw new V("Blob is not supported. Use a Buffer instead.");return C.isArrayBuffer(m)||C.isTypedArray(m)?l&&typeof Blob=="function"?new Blob([m]):At.from(m):m}function p(m,v,f){let y=m;if(m&&!f&&typeof m=="object"){if(C.endsWith(v,"{}"))v=n?v:v.slice(0,-2),m=JSON.stringify(m);else if(C.isArray(m)&&b1(m)||(C.isFileList(m)||C.endsWith(v,"[]"))&&(y=C.toArray(m)))return v=Cd(v),y.forEach(function(S,A){!(C.isUndefined(S)||S===null)&&e.append(o===!0?Oc([v],A,s):o===null?v:v+"[]",c(S))}),!1}return $o(m)?!0:(e.append(Oc(f,v,s),c(m)),!1)}const u=[],h=Object.assign(y1,{defaultVisitor:p,convertValue:c,isVisitable:$o});function g(m,v){if(!C.isUndefined(m)){if(u.indexOf(m)!==-1)throw Error("Circular reference detected in "+v.join("."));u.push(m),C.forEach(m,function(y,F){(!(C.isUndefined(y)||y===null)&&a.call(e,y,C.isString(F)?F.trim():F,v,h))===!0&&g(y,v?v.concat(F):[F])}),u.pop()}}if(!C.isObject(i))throw new TypeError("data must be an object");return g(i),e}function Ac(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Tr(i,e){this._pairs=[],i&&ls(i,this,e)}const Ed=Tr.prototype;Ed.append=function(e,t){this._pairs.push([e,t])};Ed.toString=function(e){const t=e?function(n){return e.call(this,n,Ac)}:Ac;return this._pairs.map(function(a){return t(a[0])+"="+t(a[1])},"").join("&")};function x1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function kd(i,e,t){if(!e)return i;const n=t&&t.encode||x1,a=t&&t.serialize;let s;if(a?s=a(e,t):s=C.isURLSearchParams(e)?e.toString():new Tr(e,t).toString(n),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Dc{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){C.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Td={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},w1=typeof URLSearchParams<"u"?URLSearchParams:Tr,P1=typeof FormData<"u"?FormData:null,S1=typeof Blob<"u"?Blob:null,F1={isBrowser:!0,classes:{URLSearchParams:w1,FormData:P1,Blob:S1},protocols:["http","https","file","blob","url","data"]},Od=typeof window<"u"&&typeof document<"u",_1=(i=>Od&&["ReactNative","NativeScript","NS"].indexOf(i)<0)(typeof navigator<"u"&&navigator.product),C1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",E1=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Od,hasStandardBrowserEnv:_1,hasStandardBrowserWebWorkerEnv:C1},Symbol.toStringTag,{value:"Module"})),st={...E1,...F1};function k1(i,e){return ls(i,new st.classes.URLSearchParams,Object.assign({visitor:function(t,n,a,s){return st.isNode&&C.isBuffer(t)?(this.append(n,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function T1(i){return C.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function O1(i){const e={},t=Object.keys(i);let n;const a=t.length;let s;for(n=0;n<a;n++)s=t[n],e[s]=i[s];return e}function Ad(i){function e(t,n,a,s){let o=t[s++];if(o==="__proto__")return!0;const r=Number.isFinite(+o),l=s>=t.length;return o=!o&&C.isArray(a)?a.length:o,l?(C.hasOwnProp(a,o)?a[o]=[a[o],n]:a[o]=n,!r):((!a[o]||!C.isObject(a[o]))&&(a[o]=[]),e(t,n,a[o],s)&&C.isArray(a[o])&&(a[o]=O1(a[o])),!r)}if(C.isFormData(i)&&C.isFunction(i.entries)){const t={};return C.forEachEntry(i,(n,a)=>{e(T1(n),a,t,0)}),t}return null}function A1(i,e,t){if(C.isString(i))try{return(e||JSON.parse)(i),C.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(i)}const Or={transitional:Td,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",a=n.indexOf("application/json")>-1,s=C.isObject(e);if(s&&C.isHTMLForm(e)&&(e=new FormData(e)),C.isFormData(e))return a?JSON.stringify(Ad(e)):e;if(C.isArrayBuffer(e)||C.isBuffer(e)||C.isStream(e)||C.isFile(e)||C.isBlob(e))return e;if(C.isArrayBufferView(e))return e.buffer;if(C.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let r;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return k1(e,this.formSerializer).toString();if((r=C.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return ls(r?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||a?(t.setContentType("application/json",!1),A1(e)):e}],transformResponse:[function(e){const t=this.transitional||Or.transitional,n=t&&t.forcedJSONParsing,a=this.responseType==="json";if(e&&C.isString(e)&&(n&&!this.responseType||a)){const o=!(t&&t.silentJSONParsing)&&a;try{return JSON.parse(e)}catch(r){if(o)throw r.name==="SyntaxError"?V.from(r,V.ERR_BAD_RESPONSE,this,null,this.response):r}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:st.classes.FormData,Blob:st.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};C.forEach(["delete","get","head","post","put","patch"],i=>{Or.headers[i]={}});const Ar=Or,D1=C.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),R1=i=>{const e={};let t,n,a;return i&&i.split(`
|
|
39
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ns=typeof window<"u"&&typeof window.document<"u",ut=ns?window:{},fr=ns&&ut.document.documentElement?"ontouchstart"in ut.document.documentElement:!1,gr=ns?"PointerEvent"in ut:!1,Y="cropper",vr="all",Tp="crop",Op="move",Ap="zoom",Wt="e",Gt="w",ui="s",Dt="n",Qi="ne",Yi="nw",Ji="se",Zi="sw",yo="".concat(Y,"-crop"),Ll="".concat(Y,"-disabled"),ke="".concat(Y,"-hidden"),Bl="".concat(Y,"-hide"),Rb="".concat(Y,"-invisible"),Va="".concat(Y,"-modal"),xo="".concat(Y,"-move"),In="".concat(Y,"Action"),da="".concat(Y,"Preview"),br="crop",Dp="move",Rp="none",wo="crop",Po="cropend",So="cropmove",Fo="cropstart",Ml="dblclick",Ib=fr?"touchstart":"mousedown",Ub=fr?"touchmove":"mousemove",Nb=fr?"touchend touchcancel":"mouseup",jl=gr?"pointerdown":Ib,zl=gr?"pointermove":Ub,$l=gr?"pointerup pointercancel":Nb,ql="ready",Hl="resize",Vl="wheel",_o="zoom",Wl="image/jpeg",Lb=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Bb=/^data:/,Mb=/^data:image\/jpeg;base64,/,jb=/^img|canvas$/i,Gl={viewMode:0,dragMode:br,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},zb='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',$b=Number.isNaN||ut.isNaN;function H(i){return typeof i=="number"&&!$b(i)}var Kl=function(e){return e>0&&e<1/0};function zs(i){return typeof i>"u"}function oi(i){return ka(i)==="object"&&i!==null}var qb=Object.prototype.hasOwnProperty;function mi(i){if(!oi(i))return!1;try{var e=i.constructor,t=e.prototype;return e&&t&&qb.call(t,"isPrototypeOf")}catch{return!1}}function Ce(i){return typeof i=="function"}var Hb=Array.prototype.slice;function Ip(i){return Array.from?Array.from(i):Hb.call(i)}function ue(i,e){return i&&Ce(e)&&(Array.isArray(i)||H(i.length)?Ip(i).forEach(function(t,n){e.call(i,t,n,i)}):oi(i)&&Object.keys(i).forEach(function(t){e.call(i,i[t],t,i)})),i}var J=Object.assign||function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return oi(e)&&n.length>0&&n.forEach(function(s){oi(s)&&Object.keys(s).forEach(function(o){e[o]=s[o]})}),e},Vb=/\.\d*(?:0|9){12}\d*$/;function bi(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Vb.test(i)?Math.round(i*e)/e:i}var Wb=/^width|height|left|top|marginLeft|marginTop$/;function Mt(i,e){var t=i.style;ue(e,function(n,a){Wb.test(a)&&H(n)&&(n="".concat(n,"px")),t[a]=n})}function Gb(i,e){return i.classList?i.classList.contains(e):i.className.indexOf(e)>-1}function ve(i,e){if(e){if(H(i.length)){ue(i,function(n){ve(n,e)});return}if(i.classList){i.classList.add(e);return}var t=i.className.trim();t?t.indexOf(e)<0&&(i.className="".concat(t," ").concat(e)):i.className=e}}function lt(i,e){if(e){if(H(i.length)){ue(i,function(t){lt(t,e)});return}if(i.classList){i.classList.remove(e);return}i.className.indexOf(e)>=0&&(i.className=i.className.replace(e,""))}}function fi(i,e,t){if(e){if(H(i.length)){ue(i,function(n){fi(n,e,t)});return}t?ve(i,e):lt(i,e)}}var Kb=/([a-z\d])([A-Z])/g;function yr(i){return i.replace(Kb,"$1-$2").toLowerCase()}function Co(i,e){return oi(i[e])?i[e]:i.dataset?i.dataset[e]:i.getAttribute("data-".concat(yr(e)))}function Un(i,e,t){oi(t)?i[e]=t:i.dataset?i.dataset[e]=t:i.setAttribute("data-".concat(yr(e)),t)}function Xb(i,e){if(oi(i[e]))try{delete i[e]}catch{i[e]=void 0}else if(i.dataset)try{delete i.dataset[e]}catch{i.dataset[e]=void 0}else i.removeAttribute("data-".concat(yr(e)))}var Up=/\s\s*/,Np=function(){var i=!1;if(ns){var e=!1,t=function(){},n=Object.defineProperty({},"once",{get:function(){return i=!0,e},set:function(s){e=s}});ut.addEventListener("test",t,n),ut.removeEventListener("test",t,n)}return i}();function Ge(i,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=t;e.trim().split(Up).forEach(function(s){if(!Np){var o=i.listeners;o&&o[s]&&o[s][t]&&(a=o[s][t],delete o[s][t],Object.keys(o[s]).length===0&&delete o[s],Object.keys(o).length===0&&delete i.listeners)}i.removeEventListener(s,a,n)})}function ze(i,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=t;e.trim().split(Up).forEach(function(s){if(n.once&&!Np){var o=i.listeners,r=o===void 0?{}:o;a=function(){delete r[s][t],i.removeEventListener(s,a,n);for(var c=arguments.length,p=new Array(c),u=0;u<c;u++)p[u]=arguments[u];t.apply(i,p)},r[s]||(r[s]={}),r[s][t]&&i.removeEventListener(s,r[s][t],n),r[s][t]=a,i.listeners=r}i.addEventListener(s,a,n)})}function yi(i,e,t){var n;return Ce(Event)&&Ce(CustomEvent)?n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(e,!0,!0,t)),i.dispatchEvent(n)}function Lp(i){var e=i.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var $s=ut.location,Qb=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Xl(i){var e=i.match(Qb);return e!==null&&(e[1]!==$s.protocol||e[2]!==$s.hostname||e[3]!==$s.port)}function Ql(i){var e="timestamp=".concat(new Date().getTime());return i+(i.indexOf("?")===-1?"?":"&")+e}function vn(i){var e=i.rotate,t=i.scaleX,n=i.scaleY,a=i.translateX,s=i.translateY,o=[];H(a)&&a!==0&&o.push("translateX(".concat(a,"px)")),H(s)&&s!==0&&o.push("translateY(".concat(s,"px)")),H(e)&&e!==0&&o.push("rotate(".concat(e,"deg)")),H(t)&&t!==1&&o.push("scaleX(".concat(t,")")),H(n)&&n!==1&&o.push("scaleY(".concat(n,")"));var r=o.length?o.join(" "):"none";return{WebkitTransform:r,msTransform:r,transform:r}}function Yb(i){var e=Ep({},i),t=[];return ue(i,function(n,a){delete e[a],ue(e,function(s){var o=Math.abs(n.startX-s.startX),r=Math.abs(n.startY-s.startY),l=Math.abs(n.endX-s.endX),c=Math.abs(n.endY-s.endY),p=Math.sqrt(o*o+r*r),u=Math.sqrt(l*l+c*c),h=(u-p)/p;t.push(h)})}),t.sort(function(n,a){return Math.abs(n)<Math.abs(a)}),t[0]}function ha(i,e){var t=i.pageX,n=i.pageY,a={endX:t,endY:n};return e?a:Ep({startX:t,startY:n},a)}function Jb(i){var e=0,t=0,n=0;return ue(i,function(a){var s=a.startX,o=a.startY;e+=s,t+=o,n+=1}),e/=n,t/=n,{pageX:e,pageY:t}}function jt(i){var e=i.aspectRatio,t=i.height,n=i.width,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",s=Kl(n),o=Kl(t);if(s&&o){var r=t*e;a==="contain"&&r>n||a==="cover"&&r<n?t=n/e:n=t*e}else s?t=n/e:o&&(n=t*e);return{width:n,height:t}}function Zb(i){var e=i.width,t=i.height,n=i.degree;if(n=Math.abs(n)%180,n===90)return{width:t,height:e};var a=n%90*Math.PI/180,s=Math.sin(a),o=Math.cos(a),r=e*o+t*s,l=e*s+t*o;return n>90?{width:l,height:r}:{width:r,height:l}}function ey(i,e,t,n){var a=e.aspectRatio,s=e.naturalWidth,o=e.naturalHeight,r=e.rotate,l=r===void 0?0:r,c=e.scaleX,p=c===void 0?1:c,u=e.scaleY,h=u===void 0?1:u,g=t.aspectRatio,m=t.naturalWidth,v=t.naturalHeight,f=n.fillColor,y=f===void 0?"transparent":f,F=n.imageSmoothingEnabled,S=F===void 0?!0:F,A=n.imageSmoothingQuality,D=A===void 0?"low":A,x=n.maxWidth,_=x===void 0?1/0:x,O=n.maxHeight,L=O===void 0?1/0:O,z=n.minWidth,K=z===void 0?0:z,Z=n.minHeight,G=Z===void 0?0:Z,j=document.createElement("canvas"),$=j.getContext("2d"),P=jt({aspectRatio:g,width:_,height:L}),b=jt({aspectRatio:g,width:K,height:G},"cover"),w=Math.min(P.width,Math.max(b.width,m)),E=Math.min(P.height,Math.max(b.height,v)),T=jt({aspectRatio:a,width:_,height:L}),k=jt({aspectRatio:a,width:K,height:G},"cover"),M=Math.min(T.width,Math.max(k.width,s)),q=Math.min(T.height,Math.max(k.height,o)),W=[-M/2,-q/2,M,q];return j.width=bi(w),j.height=bi(E),$.fillStyle=y,$.fillRect(0,0,w,E),$.save(),$.translate(w/2,E/2),$.rotate(l*Math.PI/180),$.scale(p,h),$.imageSmoothingEnabled=S,$.imageSmoothingQuality=D,$.drawImage.apply($,[i].concat(kp(W.map(function(de){return Math.floor(bi(de))})))),$.restore(),j}var Bp=String.fromCharCode;function ty(i,e,t){var n="";t+=e;for(var a=e;a<t;a+=1)n+=Bp(i.getUint8(a));return n}var iy=/^data:.*,/;function ny(i){var e=i.replace(iy,""),t=atob(e),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return ue(a,function(s,o){a[o]=t.charCodeAt(o)}),n}function ay(i,e){for(var t=[],n=8192,a=new Uint8Array(i);a.length>0;)t.push(Bp.apply(null,Ip(a.subarray(0,n)))),a=a.subarray(n);return"data:".concat(e,";base64,").concat(btoa(t.join("")))}function sy(i){var e=new DataView(i),t;try{var n,a,s;if(e.getUint8(0)===255&&e.getUint8(1)===216)for(var o=e.byteLength,r=2;r+1<o;){if(e.getUint8(r)===255&&e.getUint8(r+1)===225){a=r;break}r+=1}if(a){var l=a+4,c=a+10;if(ty(e,l,4)==="Exif"){var p=e.getUint16(c);if(n=p===18761,(n||p===19789)&&e.getUint16(c+2,n)===42){var u=e.getUint32(c+4,n);u>=8&&(s=c+u)}}}if(s){var h=e.getUint16(s,n),g,m;for(m=0;m<h;m+=1)if(g=s+m*12+2,e.getUint16(g,n)===274){g+=8,t=e.getUint16(g,n),e.setUint16(g,1,n);break}}}catch{t=1}return t}function oy(i){var e=0,t=1,n=1;switch(i){case 2:t=-1;break;case 3:e=-180;break;case 4:n=-1;break;case 5:e=90,n=-1;break;case 6:e=90;break;case 7:e=90,t=-1;break;case 8:e=-90;break}return{rotate:e,scaleX:t,scaleY:n}}var ry={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var e=this.element,t=this.options,n=this.container,a=this.cropper;ve(a,ke),lt(e,ke);var s={width:Math.max(n.offsetWidth,Number(t.minContainerWidth)||200),height:Math.max(n.offsetHeight,Number(t.minContainerHeight)||100)};this.containerData=s,Mt(a,{width:s.width,height:s.height}),ve(e,ke),lt(a,ke)},initCanvas:function(){var e=this.containerData,t=this.imageData,n=this.options.viewMode,a=Math.abs(t.rotate)%180===90,s=a?t.naturalHeight:t.naturalWidth,o=a?t.naturalWidth:t.naturalHeight,r=s/o,l=e.width,c=e.height;e.height*r>e.width?n===3?l=e.height*r:c=e.width/r:n===3?c=e.width/r:l=e.height*r;var p={aspectRatio:r,naturalWidth:s,naturalHeight:o,width:l,height:c};p.left=(e.width-l)/2,p.top=(e.height-c)/2,p.oldLeft=p.left,p.oldTop=p.top,this.canvasData=p,this.limited=n===1||n===2,this.limitCanvas(!0,!0),this.initialImageData=J({},t),this.initialCanvasData=J({},p)},limitCanvas:function(e,t){var n=this.options,a=this.containerData,s=this.canvasData,o=this.cropBoxData,r=n.viewMode,l=s.aspectRatio,c=this.cropped&&o;if(e){var p=Number(n.minCanvasWidth)||0,u=Number(n.minCanvasHeight)||0;r>1?(p=Math.max(p,a.width),u=Math.max(u,a.height),r===3&&(u*l>p?p=u*l:u=p/l)):r>0&&(p?p=Math.max(p,c?o.width:0):u?u=Math.max(u,c?o.height:0):c&&(p=o.width,u=o.height,u*l>p?p=u*l:u=p/l));var h=jt({aspectRatio:l,width:p,height:u});p=h.width,u=h.height,s.minWidth=p,s.minHeight=u,s.maxWidth=1/0,s.maxHeight=1/0}if(t)if(r>(c?0:1)){var g=a.width-s.width,m=a.height-s.height;s.minLeft=Math.min(0,g),s.minTop=Math.min(0,m),s.maxLeft=Math.max(0,g),s.maxTop=Math.max(0,m),c&&this.limited&&(s.minLeft=Math.min(o.left,o.left+(o.width-s.width)),s.minTop=Math.min(o.top,o.top+(o.height-s.height)),s.maxLeft=o.left,s.maxTop=o.top,r===2&&(s.width>=a.width&&(s.minLeft=Math.min(0,g),s.maxLeft=Math.max(0,g)),s.height>=a.height&&(s.minTop=Math.min(0,m),s.maxTop=Math.max(0,m))))}else s.minLeft=-s.width,s.minTop=-s.height,s.maxLeft=a.width,s.maxTop=a.height},renderCanvas:function(e,t){var n=this.canvasData,a=this.imageData;if(t){var s=Zb({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),o=s.width,r=s.height,l=n.width*(o/n.naturalWidth),c=n.height*(r/n.naturalHeight);n.left-=(l-n.width)/2,n.top-=(c-n.height)/2,n.width=l,n.height=c,n.aspectRatio=o/r,n.naturalWidth=o,n.naturalHeight=r,this.limitCanvas(!0,!1)}(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCanvas(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,Mt(this.canvas,J({width:n.width,height:n.height},vn({translateX:n.left,translateY:n.top}))),this.renderImage(e),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(e){var t=this.canvasData,n=this.imageData,a=n.naturalWidth*(t.width/t.naturalWidth),s=n.naturalHeight*(t.height/t.naturalHeight);J(n,{width:a,height:s,left:(t.width-a)/2,top:(t.height-s)/2}),Mt(this.image,J({width:n.width,height:n.height},vn(J({translateX:n.left,translateY:n.top},n)))),e&&this.output()},initCropBox:function(){var e=this.options,t=this.canvasData,n=e.aspectRatio||e.initialAspectRatio,a=Number(e.autoCropArea)||.8,s={width:t.width,height:t.height};n&&(t.height*n>t.width?s.height=s.width/n:s.width=s.height*n),this.cropBoxData=s,this.limitCropBox(!0,!0),s.width=Math.min(Math.max(s.width,s.minWidth),s.maxWidth),s.height=Math.min(Math.max(s.height,s.minHeight),s.maxHeight),s.width=Math.max(s.minWidth,s.width*a),s.height=Math.max(s.minHeight,s.height*a),s.left=t.left+(t.width-s.width)/2,s.top=t.top+(t.height-s.height)/2,s.oldLeft=s.left,s.oldTop=s.top,this.initialCropBoxData=J({},s)},limitCropBox:function(e,t){var n=this.options,a=this.containerData,s=this.canvasData,o=this.cropBoxData,r=this.limited,l=n.aspectRatio;if(e){var c=Number(n.minCropBoxWidth)||0,p=Number(n.minCropBoxHeight)||0,u=r?Math.min(a.width,s.width,s.width+s.left,a.width-s.left):a.width,h=r?Math.min(a.height,s.height,s.height+s.top,a.height-s.top):a.height;c=Math.min(c,a.width),p=Math.min(p,a.height),l&&(c&&p?p*l>c?p=c/l:c=p*l:c?p=c/l:p&&(c=p*l),h*l>u?h=u/l:u=h*l),o.minWidth=Math.min(c,u),o.minHeight=Math.min(p,h),o.maxWidth=u,o.maxHeight=h}t&&(r?(o.minLeft=Math.max(0,s.left),o.minTop=Math.max(0,s.top),o.maxLeft=Math.min(a.width,s.left+s.width)-o.width,o.maxTop=Math.min(a.height,s.top+s.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=a.width-o.width,o.maxTop=a.height-o.height))},renderCropBox:function(){var e=this.options,t=this.containerData,n=this.cropBoxData;(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCropBox(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,e.movable&&e.cropBoxMovable&&Un(this.face,In,n.width>=t.width&&n.height>=t.height?Op:vr),Mt(this.cropBox,J({width:n.width,height:n.height},vn({translateX:n.left,translateY:n.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),yi(this.element,wo,this.getData())}},ly={initPreview:function(){var e=this.element,t=this.crossOrigin,n=this.options.preview,a=t?this.crossOriginUrl:this.url,s=e.alt||"The image to preview",o=document.createElement("img");if(t&&(o.crossOrigin=t),o.src=a,o.alt=s,this.viewBox.appendChild(o),this.viewBoxImage=o,!!n){var r=n;typeof n=="string"?r=e.ownerDocument.querySelectorAll(n):n.querySelector&&(r=[n]),this.previews=r,ue(r,function(l){var c=document.createElement("img");Un(l,da,{width:l.offsetWidth,height:l.offsetHeight,html:l.innerHTML}),t&&(c.crossOrigin=t),c.src=a,c.alt=s,c.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',l.innerHTML="",l.appendChild(c)})}},resetPreview:function(){ue(this.previews,function(e){var t=Co(e,da);Mt(e,{width:t.width,height:t.height}),e.innerHTML=t.html,Xb(e,da)})},preview:function(){var e=this.imageData,t=this.canvasData,n=this.cropBoxData,a=n.width,s=n.height,o=e.width,r=e.height,l=n.left-t.left-e.left,c=n.top-t.top-e.top;!this.cropped||this.disabled||(Mt(this.viewBoxImage,J({width:o,height:r},vn(J({translateX:-l,translateY:-c},e)))),ue(this.previews,function(p){var u=Co(p,da),h=u.width,g=u.height,m=h,v=g,f=1;a&&(f=h/a,v=s*f),s&&v>g&&(f=g/s,m=a*f,v=g),Mt(p,{width:m,height:v}),Mt(p.getElementsByTagName("img")[0],J({width:o*f,height:r*f},vn(J({translateX:-l*f,translateY:-c*f},e))))}))}},cy={bind:function(){var e=this.element,t=this.options,n=this.cropper;Ce(t.cropstart)&&ze(e,Fo,t.cropstart),Ce(t.cropmove)&&ze(e,So,t.cropmove),Ce(t.cropend)&&ze(e,Po,t.cropend),Ce(t.crop)&&ze(e,wo,t.crop),Ce(t.zoom)&&ze(e,_o,t.zoom),ze(n,jl,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&ze(n,Vl,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&ze(n,Ml,this.onDblclick=this.dblclick.bind(this)),ze(e.ownerDocument,zl,this.onCropMove=this.cropMove.bind(this)),ze(e.ownerDocument,$l,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&ze(window,Hl,this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,n=this.cropper;Ce(t.cropstart)&&Ge(e,Fo,t.cropstart),Ce(t.cropmove)&&Ge(e,So,t.cropmove),Ce(t.cropend)&&Ge(e,Po,t.cropend),Ce(t.crop)&&Ge(e,wo,t.crop),Ce(t.zoom)&&Ge(e,_o,t.zoom),Ge(n,jl,this.onCropStart),t.zoomable&&t.zoomOnWheel&&Ge(n,Vl,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&Ge(n,Ml,this.onDblclick),Ge(e.ownerDocument,zl,this.onCropMove),Ge(e.ownerDocument,$l,this.onCropEnd),t.responsive&&Ge(window,Hl,this.onResize)}},uy={resize:function(){if(!this.disabled){var e=this.options,t=this.container,n=this.containerData,a=t.offsetWidth/n.width;if(a!==1||t.offsetHeight!==n.height){var s,o;e.restore&&(s=this.getCanvasData(),o=this.getCropBoxData()),this.render(),e.restore&&(this.setCanvasData(ue(s,function(r,l){s[l]=r*a})),this.setCropBoxData(ue(o,function(r,l){o[l]=r*a})))}}},dblclick:function(){this.disabled||this.options.dragMode===Rp||this.setDragMode(Gb(this.dragBox,yo)?Dp:br)},wheel:function(e){var t=this,n=Number(this.options.wheelZoomRatio)||.1,a=1;this.disabled||(e.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){t.wheeling=!1},50),e.deltaY?a=e.deltaY>0?1:-1:e.wheelDelta?a=-e.wheelDelta/120:e.detail&&(a=e.detail>0?1:-1),this.zoom(-a*n,e)))},cropStart:function(e){var t=e.buttons,n=e.button;if(!(this.disabled||(e.type==="mousedown"||e.type==="pointerdown"&&e.pointerType==="mouse")&&(H(t)&&t!==1||H(n)&&n!==0||e.ctrlKey))){var a=this.options,s=this.pointers,o;e.changedTouches?ue(e.changedTouches,function(r){s[r.identifier]=ha(r)}):s[e.pointerId||0]=ha(e),Object.keys(s).length>1&&a.zoomable&&a.zoomOnTouch?o=Ap:o=Co(e.target,In),Lb.test(o)&&yi(this.element,Fo,{originalEvent:e,action:o})!==!1&&(e.preventDefault(),this.action=o,this.cropping=!1,o===Tp&&(this.cropping=!0,ve(this.dragBox,Va)))}},cropMove:function(e){var t=this.action;if(!(this.disabled||!t)){var n=this.pointers;e.preventDefault(),yi(this.element,So,{originalEvent:e,action:t})!==!1&&(e.changedTouches?ue(e.changedTouches,function(a){J(n[a.identifier]||{},ha(a,!0))}):J(n[e.pointerId||0]||{},ha(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,n=this.pointers;e.changedTouches?ue(e.changedTouches,function(a){delete n[a.identifier]}):delete n[e.pointerId||0],t&&(e.preventDefault(),Object.keys(n).length||(this.action=""),this.cropping&&(this.cropping=!1,fi(this.dragBox,Va,this.cropped&&this.options.modal)),yi(this.element,Po,{originalEvent:e,action:t}))}}},py={change:function(e){var t=this.options,n=this.canvasData,a=this.containerData,s=this.cropBoxData,o=this.pointers,r=this.action,l=t.aspectRatio,c=s.left,p=s.top,u=s.width,h=s.height,g=c+u,m=p+h,v=0,f=0,y=a.width,F=a.height,S=!0,A;!l&&e.shiftKey&&(l=u&&h?u/h:1),this.limited&&(v=s.minLeft,f=s.minTop,y=v+Math.min(a.width,n.width,n.left+n.width),F=f+Math.min(a.height,n.height,n.top+n.height));var D=o[Object.keys(o)[0]],x={x:D.endX-D.startX,y:D.endY-D.startY},_=function(L){switch(L){case Wt:g+x.x>y&&(x.x=y-g);break;case Gt:c+x.x<v&&(x.x=v-c);break;case Dt:p+x.y<f&&(x.y=f-p);break;case ui:m+x.y>F&&(x.y=F-m);break}};switch(r){case vr:c+=x.x,p+=x.y;break;case Wt:if(x.x>=0&&(g>=y||l&&(p<=f||m>=F))){S=!1;break}_(Wt),u+=x.x,u<0&&(r=Gt,u=-u,c-=u),l&&(h=u/l,p+=(s.height-h)/2);break;case Dt:if(x.y<=0&&(p<=f||l&&(c<=v||g>=y))){S=!1;break}_(Dt),h-=x.y,p+=x.y,h<0&&(r=ui,h=-h,p-=h),l&&(u=h*l,c+=(s.width-u)/2);break;case Gt:if(x.x<=0&&(c<=v||l&&(p<=f||m>=F))){S=!1;break}_(Gt),u-=x.x,c+=x.x,u<0&&(r=Wt,u=-u,c-=u),l&&(h=u/l,p+=(s.height-h)/2);break;case ui:if(x.y>=0&&(m>=F||l&&(c<=v||g>=y))){S=!1;break}_(ui),h+=x.y,h<0&&(r=Dt,h=-h,p-=h),l&&(u=h*l,c+=(s.width-u)/2);break;case Qi:if(l){if(x.y<=0&&(p<=f||g>=y)){S=!1;break}_(Dt),h-=x.y,p+=x.y,u=h*l}else _(Dt),_(Wt),x.x>=0?g<y?u+=x.x:x.y<=0&&p<=f&&(S=!1):u+=x.x,x.y<=0?p>f&&(h-=x.y,p+=x.y):(h-=x.y,p+=x.y);u<0&&h<0?(r=Zi,h=-h,u=-u,p-=h,c-=u):u<0?(r=Yi,u=-u,c-=u):h<0&&(r=Ji,h=-h,p-=h);break;case Yi:if(l){if(x.y<=0&&(p<=f||c<=v)){S=!1;break}_(Dt),h-=x.y,p+=x.y,u=h*l,c+=s.width-u}else _(Dt),_(Gt),x.x<=0?c>v?(u-=x.x,c+=x.x):x.y<=0&&p<=f&&(S=!1):(u-=x.x,c+=x.x),x.y<=0?p>f&&(h-=x.y,p+=x.y):(h-=x.y,p+=x.y);u<0&&h<0?(r=Ji,h=-h,u=-u,p-=h,c-=u):u<0?(r=Qi,u=-u,c-=u):h<0&&(r=Zi,h=-h,p-=h);break;case Zi:if(l){if(x.x<=0&&(c<=v||m>=F)){S=!1;break}_(Gt),u-=x.x,c+=x.x,h=u/l}else _(ui),_(Gt),x.x<=0?c>v?(u-=x.x,c+=x.x):x.y>=0&&m>=F&&(S=!1):(u-=x.x,c+=x.x),x.y>=0?m<F&&(h+=x.y):h+=x.y;u<0&&h<0?(r=Qi,h=-h,u=-u,p-=h,c-=u):u<0?(r=Ji,u=-u,c-=u):h<0&&(r=Yi,h=-h,p-=h);break;case Ji:if(l){if(x.x>=0&&(g>=y||m>=F)){S=!1;break}_(Wt),u+=x.x,h=u/l}else _(ui),_(Wt),x.x>=0?g<y?u+=x.x:x.y>=0&&m>=F&&(S=!1):u+=x.x,x.y>=0?m<F&&(h+=x.y):h+=x.y;u<0&&h<0?(r=Yi,h=-h,u=-u,p-=h,c-=u):u<0?(r=Zi,u=-u,c-=u):h<0&&(r=Qi,h=-h,p-=h);break;case Op:this.move(x.x,x.y),S=!1;break;case Ap:this.zoom(Yb(o),e),S=!1;break;case Tp:if(!x.x||!x.y){S=!1;break}A=Lp(this.cropper),c=D.startX-A.left,p=D.startY-A.top,u=s.minWidth,h=s.minHeight,x.x>0?r=x.y>0?Ji:Qi:x.x<0&&(c-=u,r=x.y>0?Zi:Yi),x.y<0&&(p-=h),this.cropped||(lt(this.cropBox,ke),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}S&&(s.width=u,s.height=h,s.left=c,s.top=p,this.action=r,this.renderCropBox()),ue(o,function(O){O.startX=O.endX,O.startY=O.endY})}},dy={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&ve(this.dragBox,Va),lt(this.cropBox,ke),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=J({},this.initialImageData),this.canvasData=J({},this.initialCanvasData),this.cropBoxData=J({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(J(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),lt(this.dragBox,Va),ve(this.cropBox,ke)),this},replace:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,ue(this.previews,function(n){n.getElementsByTagName("img")[0].src=e}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,lt(this.cropper,Ll)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,ve(this.cropper,Ll)),this},destroy:function(){var e=this.element;return e[Y]?(e[Y]=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.canvasData,a=n.left,s=n.top;return this.moveTo(zs(e)?e:a+Number(e),zs(t)?t:s+Number(t))},moveTo:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.canvasData,a=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(H(e)&&(n.left=e,a=!0),H(t)&&(n.top=t,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(e,t){var n=this.canvasData;return e=Number(e),e<0?e=1/(1-e):e=1+e,this.zoomTo(n.width*e/n.naturalWidth,null,t)},zoomTo:function(e,t,n){var a=this.options,s=this.canvasData,o=s.width,r=s.height,l=s.naturalWidth,c=s.naturalHeight;if(e=Number(e),e>=0&&this.ready&&!this.disabled&&a.zoomable){var p=l*e,u=c*e;if(yi(this.element,_o,{ratio:e,oldRatio:o/l,originalEvent:n})===!1)return this;if(n){var h=this.pointers,g=Lp(this.cropper),m=h&&Object.keys(h).length?Jb(h):{pageX:n.pageX,pageY:n.pageY};s.left-=(p-o)*((m.pageX-g.left-s.left)/o),s.top-=(u-r)*((m.pageY-g.top-s.top)/r)}else mi(t)&&H(t.x)&&H(t.y)?(s.left-=(p-o)*((t.x-s.left)/o),s.top-=(u-r)*((t.y-s.top)/r)):(s.left-=(p-o)/2,s.top-=(u-r)/2);s.width=p,s.height=u,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return e=Number(e),H(e)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,H(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(H(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.imageData,a=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(H(e)&&(n.scaleX=e,a=!0),H(t)&&(n.scaleY=t,a=!0),a&&this.renderCanvas(!0,!0)),this},getData:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.options,n=this.imageData,a=this.canvasData,s=this.cropBoxData,o;if(this.ready&&this.cropped){o={x:s.left-a.left,y:s.top-a.top,width:s.width,height:s.height};var r=n.width/n.naturalWidth;if(ue(o,function(p,u){o[u]=p/r}),e){var l=Math.round(o.y+o.height),c=Math.round(o.x+o.width);o.x=Math.round(o.x),o.y=Math.round(o.y),o.width=c-o.x,o.height=l-o.y}}else o={x:0,y:0,width:0,height:0};return t.rotatable&&(o.rotate=n.rotate||0),t.scalable&&(o.scaleX=n.scaleX||1,o.scaleY=n.scaleY||1),o},setData:function(e){var t=this.options,n=this.imageData,a=this.canvasData,s={};if(this.ready&&!this.disabled&&mi(e)){var o=!1;t.rotatable&&H(e.rotate)&&e.rotate!==n.rotate&&(n.rotate=e.rotate,o=!0),t.scalable&&(H(e.scaleX)&&e.scaleX!==n.scaleX&&(n.scaleX=e.scaleX,o=!0),H(e.scaleY)&&e.scaleY!==n.scaleY&&(n.scaleY=e.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var r=n.width/n.naturalWidth;H(e.x)&&(s.left=e.x*r+a.left),H(e.y)&&(s.top=e.y*r+a.top),H(e.width)&&(s.width=e.width*r),H(e.height)&&(s.height=e.height*r),this.setCropBoxData(s)}return this},getContainerData:function(){return this.ready?J({},this.containerData):{}},getImageData:function(){return this.sized?J({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&ue(["left","top","width","height","naturalWidth","naturalHeight"],function(n){t[n]=e[n]}),t},setCanvasData:function(e){var t=this.canvasData,n=t.aspectRatio;return this.ready&&!this.disabled&&mi(e)&&(H(e.left)&&(t.left=e.left),H(e.top)&&(t.top=e.top),H(e.width)?(t.width=e.width,t.height=e.width/n):H(e.height)&&(t.height=e.height,t.width=e.height*n),this.renderCanvas(!0)),this},getCropBoxData:function(){var e=this.cropBoxData,t;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(e){var t=this.cropBoxData,n=this.options.aspectRatio,a,s;return this.ready&&this.cropped&&!this.disabled&&mi(e)&&(H(e.left)&&(t.left=e.left),H(e.top)&&(t.top=e.top),H(e.width)&&e.width!==t.width&&(a=!0,t.width=e.width),H(e.height)&&e.height!==t.height&&(s=!0,t.height=e.height),n&&(a?t.height=t.width/n:s&&(t.width=t.height*n)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,n=ey(this.image,this.imageData,t,e);if(!this.cropped)return n;var a=this.getData(),s=a.x,o=a.y,r=a.width,l=a.height,c=n.width/Math.floor(t.naturalWidth);c!==1&&(s*=c,o*=c,r*=c,l*=c);var p=r/l,u=jt({aspectRatio:p,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),h=jt({aspectRatio:p,width:e.minWidth||0,height:e.minHeight||0},"cover"),g=jt({aspectRatio:p,width:e.width||(c!==1?n.width:r),height:e.height||(c!==1?n.height:l)}),m=g.width,v=g.height;m=Math.min(u.width,Math.max(h.width,m)),v=Math.min(u.height,Math.max(h.height,v));var f=document.createElement("canvas"),y=f.getContext("2d");f.width=bi(m),f.height=bi(v),y.fillStyle=e.fillColor||"transparent",y.fillRect(0,0,m,v);var F=e.imageSmoothingEnabled,S=F===void 0?!0:F,A=e.imageSmoothingQuality;y.imageSmoothingEnabled=S,A&&(y.imageSmoothingQuality=A);var D=n.width,x=n.height,_=s,O=o,L,z,K,Z,G,j;_<=-r||_>D?(_=0,L=0,K=0,G=0):_<=0?(K=-_,_=0,L=Math.min(D,r+_),G=L):_<=D&&(K=0,L=Math.min(r,D-_),G=L),L<=0||O<=-l||O>x?(O=0,z=0,Z=0,j=0):O<=0?(Z=-O,O=0,z=Math.min(x,l+O),j=z):O<=x&&(Z=0,z=Math.min(l,x-O),j=z);var $=[_,O,L,z];if(G>0&&j>0){var P=m/r;$.push(K*P,Z*P,G*P,j*P)}return y.drawImage.apply(y,[n].concat(kp($.map(function(b){return Math.floor(bi(b))})))),f},setAspectRatio:function(e){var t=this.options;return!this.disabled&&!zs(e)&&(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,n=this.dragBox,a=this.face;if(this.ready&&!this.disabled){var s=e===br,o=t.movable&&e===Dp;e=s||o?e:Rp,t.dragMode=e,Un(n,In,e),fi(n,yo,s),fi(n,xo,o),t.cropBoxMovable||(Un(a,In,e),fi(a,yo,s),fi(a,xo,o))}return this}},hy=ut.Cropper,Mp=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Cb(this,i),!e||!jb.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=J({},Gl,mi(t)&&t),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return Eb(i,[{key:"init",value:function(){var t=this.element,n=t.tagName.toLowerCase(),a;if(!t[Y]){if(t[Y]=this,n==="img"){if(this.isImg=!0,a=t.getAttribute("src")||"",this.originalUrl=a,!a)return;a=t.src}else n==="canvas"&&window.HTMLCanvasElement&&(a=t.toDataURL());this.load(a)}}},{key:"load",value:function(t){var n=this;if(t){this.url=t,this.imageData={};var a=this.element,s=this.options;if(!s.rotatable&&!s.scalable&&(s.checkOrientation=!1),!s.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Bb.test(t)){Mb.test(t)?this.read(ny(t)):this.clone();return}var o=new XMLHttpRequest,r=this.clone.bind(this);this.reloading=!0,this.xhr=o,o.onabort=r,o.onerror=r,o.ontimeout=r,o.onprogress=function(){o.getResponseHeader("content-type")!==Wl&&o.abort()},o.onload=function(){n.read(o.response)},o.onloadend=function(){n.reloading=!1,n.xhr=null},s.checkCrossOrigin&&Xl(t)&&a.crossOrigin&&(t=Ql(t)),o.open("GET",t),o.responseType="arraybuffer",o.withCredentials=a.crossOrigin==="use-credentials",o.send()}}},{key:"read",value:function(t){var n=this.options,a=this.imageData,s=sy(t),o=0,r=1,l=1;if(s>1){this.url=ay(t,Wl);var c=oy(s);o=c.rotate,r=c.scaleX,l=c.scaleY}n.rotatable&&(a.rotate=o),n.scalable&&(a.scaleX=r,a.scaleY=l),this.clone()}},{key:"clone",value:function(){var t=this.element,n=this.url,a=t.crossOrigin,s=n;this.options.checkCrossOrigin&&Xl(n)&&(a||(a="anonymous"),s=Ql(n)),this.crossOrigin=a,this.crossOriginUrl=s;var o=document.createElement("img");a&&(o.crossOrigin=a),o.src=s||n,o.alt=t.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),ve(o,Bl),t.parentNode.insertBefore(o,t.nextSibling)}},{key:"start",value:function(){var t=this,n=this.image;n.onload=null,n.onerror=null,this.sizing=!0;var a=ut.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(ut.navigator.userAgent),s=function(c,p){J(t.imageData,{naturalWidth:c,naturalHeight:p,aspectRatio:c/p}),t.sizing=!1,t.sized=!0,t.build()};if(n.naturalWidth&&!a){s(n.naturalWidth,n.naturalHeight);return}var o=document.createElement("img"),r=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){s(o.width,o.height),a||r.removeChild(o)},o.src=n.src,a||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",r.appendChild(o))}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var t=this.element,n=this.options,a=this.image,s=t.parentNode,o=document.createElement("div");o.innerHTML=zb;var r=o.querySelector(".".concat(Y,"-container")),l=r.querySelector(".".concat(Y,"-canvas")),c=r.querySelector(".".concat(Y,"-drag-box")),p=r.querySelector(".".concat(Y,"-crop-box")),u=p.querySelector(".".concat(Y,"-face"));this.container=s,this.cropper=r,this.canvas=l,this.dragBox=c,this.cropBox=p,this.viewBox=r.querySelector(".".concat(Y,"-view-box")),this.face=u,l.appendChild(a),ve(t,ke),s.insertBefore(r,t.nextSibling),this.isImg||lt(a,Bl),this.initPreview(),this.bind(),n.initialAspectRatio=Math.max(0,n.initialAspectRatio)||NaN,n.aspectRatio=Math.max(0,n.aspectRatio)||NaN,n.viewMode=Math.max(0,Math.min(3,Math.round(n.viewMode)))||0,ve(p,ke),n.guides||ve(p.getElementsByClassName("".concat(Y,"-dashed")),ke),n.center||ve(p.getElementsByClassName("".concat(Y,"-center")),ke),n.background&&ve(r,"".concat(Y,"-bg")),n.highlight||ve(u,Rb),n.cropBoxMovable&&(ve(u,xo),Un(u,In,vr)),n.cropBoxResizable||(ve(p.getElementsByClassName("".concat(Y,"-line")),ke),ve(p.getElementsByClassName("".concat(Y,"-point")),ke)),this.render(),this.ready=!0,this.setDragMode(n.dragMode),n.autoCrop&&this.crop(),this.setData(n.data),Ce(n.ready)&&ze(t,ql,n.ready,{once:!0}),yi(t,ql)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),lt(this.element,ke))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=hy,i}},{key:"setDefaults",value:function(t){J(Gl,mi(t)&&t)}}]),i}();J(Mp.prototype,ry,ly,cy,uy,py,dy);function my(i,e){const t=i.width/e.width,n=i.height/e.height,a=Math.min(t,n),s=e.width*a,o=e.height*a,r=(i.width-s)/2,l=(i.height-o)/2;return{width:s,height:o,left:r,top:l}}function fy(i){return i*(Math.PI/180)}function gy(i,e,t){const n=Math.abs(fy(t));return Math.max((Math.sin(n)*i+Math.cos(n)*e)/e,(Math.sin(n)*e+Math.cos(n)*i)/i)}function vy(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}function by(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}class yy extends dt{constructor(e){super(e),this.onRotate90Deg=()=>{const{angle90Deg:t}=this.state,n=t-90;this.setState({angle90Deg:n,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(n);const a=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),o=my(s,a);this.cropper.setCanvasData(o),this.cropper.setCropBoxData(o)},this.onRotateGranular=t=>{const n=Number(t.target.value);this.setState({angleGranular:n});const{angle90Deg:a}=this.state,s=a+n;this.cropper.rotateTo(s);const o=this.cropper.getImageData(),r=gy(o.naturalWidth,o.naturalHeight,n),l=this.cropper.getImageData().scaleX<0?-r:r;this.cropper.scale(l,r)},this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){const{opts:e,storeCropperInstance:t}=this.props;this.cropper=new Mp(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){const t=this.cropper.getCanvasData(),n=this.cropper.getCropBoxData(),{prevCropboxData:a}=this.state;if(e.detail.action==="all"){const s=vy(t,n,a);s&&this.cropper.setCropBoxData(s)}else{const s=by(t,n,a);s&&this.cropper.setCropBoxData(s)}}renderGranularRotate(){const{i18n:e}=this.props,{angleGranular:t}=this.state;return d("label",{role:"tooltip","aria-label":`${t}º`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper"},d("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")}))}renderRevert(){const{i18n:e,opts:t}=this.props;return d("label",{role:"tooltip","aria-label":e("revert"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})}},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0z",fill:"none"}),d("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"}))))}renderRotate(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("rotate"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:this.onRotate90Deg},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),d("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"}))))}renderFlip(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("flipHorizontal"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0z",fill:"none"}),d("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}))))}renderZoomIn(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("zoomIn"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.zoom(.1)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24"},d("path",{d:"M0 0h24v24H0V0z",fill:"none"}),d("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),d("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))))}renderZoomOut(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("zoomOut"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.zoom(-.1)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0V0z",fill:"none"}),d("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"}))))}renderCropSquare(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("aspectRatioSquare"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(1)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M0 0h24v24H0z",fill:"none"}),d("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}))))}renderCropWidescreen(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("aspectRatioLandscape"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(16/9)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),d("path",{fill:"none",d:"M0 0h24v24H0z"}))))}renderCropWidescreenVertical(){const{i18n:e}=this.props;return d("label",{role:"tooltip","aria-label":e("aspectRatioPortrait"),"data-microtip-position":"top"},d("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16)},d("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},d("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),d("path",{d:"M0 0h24v24H0z",fill:"none"}))))}render(){const{currentImage:e,opts:t}=this.props,{actions:n}=t,a=URL.createObjectURL(e.data);return d("div",{className:"uppy-ImageCropper"},d("div",{className:"uppy-ImageCropper-container"},d("img",{className:"uppy-ImageCropper-image",alt:e.name,src:a,ref:s=>{this.imgElement=s}})),d("div",{className:"uppy-ImageCropper-controls"},n.revert&&this.renderRevert(),n.rotate&&this.renderRotate(),n.granularRotate&&this.renderGranularRotate(),n.flip&&this.renderFlip(),n.zoomIn&&this.renderZoomIn(),n.zoomOut&&this.renderZoomOut(),n.cropSquare&&this.renderCropSquare(),n.cropWidescreen&&this.renderCropWidescreen(),n.cropWidescreenVertical&&this.renderCropWidescreenVertical()))}}const xy={strings:{revert:"Reset",rotate:"Rotate 90°",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}},wy={version:"2.4.4"},jp={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},zp={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},Py={quality:.8,actions:zp,cropperOptions:jp};class $p extends ye{constructor(e,t){super(e,{...Py,...t,actions:{...zp,...t==null?void 0:t.actions},cropperOptions:{...jp,...t==null?void 0:t.cropperOptions}}),this.save=()=>{const n=o=>{const{currentImage:r}=this.getPluginState();this.uppy.setFileState(r.id,{data:new File([o],r.name,{type:o.type}),size:o.size,preview:void 0});const l=this.uppy.getFile(r.id);this.uppy.emit("thumbnail:request",l),this.setPluginState({currentImage:l}),this.uppy.emit("file-editor:complete",l)},{currentImage:a}=this.getPluginState(),s=this.cropper.getCroppedCanvas({});s.width%2!==0&&this.cropper.setData({width:s.width-1}),s.height%2!==0&&this.cropper.setData({height:s.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(n,a.type,this.opts.quality)},this.storeCropperInstance=n=>{this.cropper=n},this.selectFile=n=>{this.uppy.emit("file-editor:start",n),this.setPluginState({currentImage:n})},this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=xy,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;const t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}install(){this.setPluginState({currentImage:null});const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){const{currentImage:e}=this.getPluginState();if(e){const t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){const{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:d(yy,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}}$p.VERSION=wy.version;const qp="3.7.5",Sy=qp,Fy=typeof atob=="function",_y=typeof btoa=="function",Ti=typeof At=="function",Yl=typeof TextDecoder=="function"?new TextDecoder:void 0,Jl=typeof TextEncoder=="function"?new TextEncoder:void 0,Cy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",cn=Array.prototype.slice.call(Cy),ma=(i=>{let e={};return i.forEach((t,n)=>e[t]=n),e})(cn),Ey=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,we=String.fromCharCode.bind(String),Zl=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),Hp=i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),Vp=i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),Wp=i=>{let e,t,n,a,s="";const o=i.length%3;for(let r=0;r<i.length;){if((t=i.charCodeAt(r++))>255||(n=i.charCodeAt(r++))>255||(a=i.charCodeAt(r++))>255)throw new TypeError("invalid character found");e=t<<16|n<<8|a,s+=cn[e>>18&63]+cn[e>>12&63]+cn[e>>6&63]+cn[e&63]}return o?s.slice(0,o-3)+"===".substring(o):s},xr=_y?i=>btoa(i):Ti?i=>At.from(i,"binary").toString("base64"):Wp,Eo=Ti?i=>At.from(i).toString("base64"):i=>{let t=[];for(let n=0,a=i.length;n<a;n+=4096)t.push(we.apply(null,i.subarray(n,n+4096)));return xr(t.join(""))},Ta=(i,e=!1)=>e?Hp(Eo(i)):Eo(i),ky=i=>{if(i.length<2){var e=i.charCodeAt(0);return e<128?i:e<2048?we(192|e>>>6)+we(128|e&63):we(224|e>>>12&15)+we(128|e>>>6&63)+we(128|e&63)}else{var e=65536+(i.charCodeAt(0)-55296)*1024+(i.charCodeAt(1)-56320);return we(240|e>>>18&7)+we(128|e>>>12&63)+we(128|e>>>6&63)+we(128|e&63)}},Ty=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Gp=i=>i.replace(Ty,ky),ec=Ti?i=>At.from(i,"utf8").toString("base64"):Jl?i=>Eo(Jl.encode(i)):i=>xr(Gp(i)),xi=(i,e=!1)=>e?Hp(ec(i)):ec(i),tc=i=>xi(i,!0),Oy=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ay=i=>{switch(i.length){case 4:var e=(7&i.charCodeAt(0))<<18|(63&i.charCodeAt(1))<<12|(63&i.charCodeAt(2))<<6|63&i.charCodeAt(3),t=e-65536;return we((t>>>10)+55296)+we((t&1023)+56320);case 3:return we((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return we((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},Kp=i=>i.replace(Oy,Ay),Xp=i=>{if(i=i.replace(/\s+/g,""),!Ey.test(i))throw new TypeError("malformed base64.");i+="==".slice(2-(i.length&3));let e,t="",n,a;for(let s=0;s<i.length;)e=ma[i.charAt(s++)]<<18|ma[i.charAt(s++)]<<12|(n=ma[i.charAt(s++)])<<6|(a=ma[i.charAt(s++)]),t+=n===64?we(e>>16&255):a===64?we(e>>16&255,e>>8&255):we(e>>16&255,e>>8&255,e&255);return t},wr=Fy?i=>atob(Vp(i)):Ti?i=>At.from(i,"base64").toString("binary"):Xp,Qp=Ti?i=>Zl(At.from(i,"base64")):i=>Zl(wr(i).split("").map(e=>e.charCodeAt(0))),Yp=i=>Qp(Jp(i)),Dy=Ti?i=>At.from(i,"base64").toString("utf8"):Yl?i=>Yl.decode(Qp(i)):i=>Kp(wr(i)),Jp=i=>Vp(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),ko=i=>Dy(Jp(i)),Ry=i=>{if(typeof i!="string")return!1;const e=i.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},Zp=i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),ed=function(){const i=(e,t)=>Object.defineProperty(String.prototype,e,Zp(t));i("fromBase64",function(){return ko(this)}),i("toBase64",function(e){return xi(this,e)}),i("toBase64URI",function(){return xi(this,!0)}),i("toBase64URL",function(){return xi(this,!0)}),i("toUint8Array",function(){return Yp(this)})},td=function(){const i=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Zp(t));i("toBase64",function(e){return Ta(this,e)}),i("toBase64URI",function(){return Ta(this,!0)}),i("toBase64URL",function(){return Ta(this,!0)})},Iy=()=>{ed(),td()},Uy={version:qp,VERSION:Sy,atob:wr,atobPolyfill:Xp,btoa:xr,btoaPolyfill:Wp,fromBase64:ko,toBase64:xi,encode:xi,encodeURI:tc,encodeURL:tc,utob:Gp,btou:Kp,decode:ko,isValid:Ry,fromUint8Array:Ta,toUint8Array:Yp,extendString:ed,extendUint8Array:td,extendBuiltins:Iy};var Ny=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0},Pr={},Ly=Object.prototype.hasOwnProperty,By;function ic(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function nc(i){try{return encodeURIComponent(i)}catch{return null}}function My(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},n;n=e.exec(i);){var a=ic(n[1]),s=ic(n[2]);a===null||s===null||a in t||(t[a]=s)}return t}function jy(i,e){e=e||"";var t=[],n,a;typeof e!="string"&&(e="?");for(a in i)if(Ly.call(i,a)){if(n=i[a],!n&&(n===null||n===By||isNaN(n))&&(n=""),a=nc(a),n=nc(n),a===null||n===null)continue;t.push(a+"="+n)}return t.length?e+t.join("&"):""}Pr.stringify=jy;Pr.parse=My;var id=Ny,as=Pr,zy=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,nd=/[\n\r\t]/g,$y=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,ad=/:\d+$/,qy=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Hy=/^[a-zA-Z]:/;function Sr(i){return(i||"").toString().replace(zy,"")}var To=[["#","hash"],["?","query"],function(e,t){return ct(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],ac={hash:1,query:1};function sd(i){var e;typeof window<"u"?e=window:typeof Nr<"u"?e=Nr:typeof self<"u"?e=self:e={};var t=e.location||{};i=i||t;var n={},a=typeof i,s;if(i.protocol==="blob:")n=new pt(unescape(i.pathname),{});else if(a==="string"){n=new pt(i,{});for(s in ac)delete n[s]}else if(a==="object"){for(s in i)s in ac||(n[s]=i[s]);n.slashes===void 0&&(n.slashes=$y.test(i.href))}return n}function ct(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}function od(i,e){i=Sr(i),i=i.replace(nd,""),e=e||{};var t=qy.exec(i),n=t[1]?t[1].toLowerCase():"",a=!!t[2],s=!!t[3],o=0,r;return a?s?(r=t[2]+t[3]+t[4],o=t[2].length+t[3].length):(r=t[2]+t[4],o=t[2].length):s?(r=t[3]+t[4],o=t[3].length):r=t[4],n==="file:"?o>=2&&(r=r.slice(2)):ct(n)?r=t[4]:n?a&&(r=r.slice(2)):o>=2&&ct(e.protocol)&&(r=t[4]),{protocol:n,slashes:a||ct(n),slashesCount:o,rest:r}}function Vy(i,e){if(i==="")return e;for(var t=(e||"/").split("/").slice(0,-1).concat(i.split("/")),n=t.length,a=t[n-1],s=!1,o=0;n--;)t[n]==="."?t.splice(n,1):t[n]===".."?(t.splice(n,1),o++):o&&(n===0&&(s=!0),t.splice(n,1),o--);return s&&t.unshift(""),(a==="."||a==="..")&&t.push(""),t.join("/")}function pt(i,e,t){if(i=Sr(i),i=i.replace(nd,""),!(this instanceof pt))return new pt(i,e,t);var n,a,s,o,r,l,c=To.slice(),p=typeof e,u=this,h=0;for(p!=="object"&&p!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=as.parse),e=sd(e),a=od(i||"",e),n=!a.protocol&&!a.slashes,u.slashes=a.slashes||n&&e.slashes,u.protocol=a.protocol||e.protocol||"",i=a.rest,(a.protocol==="file:"&&(a.slashesCount!==2||Hy.test(i))||!a.slashes&&(a.protocol||a.slashesCount<2||!ct(u.protocol)))&&(c[3]=[/(.*)/,"pathname"]);h<c.length;h++){if(o=c[h],typeof o=="function"){i=o(i,u);continue}s=o[0],l=o[1],s!==s?u[l]=i:typeof s=="string"?(r=s==="@"?i.lastIndexOf(s):i.indexOf(s),~r&&(typeof o[2]=="number"?(u[l]=i.slice(0,r),i=i.slice(r+o[2])):(u[l]=i.slice(r),i=i.slice(0,r)))):(r=s.exec(i))&&(u[l]=r[1],i=i.slice(0,r.index)),u[l]=u[l]||n&&o[3]&&e[l]||"",o[4]&&(u[l]=u[l].toLowerCase())}t&&(u.query=t(u.query)),n&&e.slashes&&u.pathname.charAt(0)!=="/"&&(u.pathname!==""||e.pathname!=="")&&(u.pathname=Vy(u.pathname,e.pathname)),u.pathname.charAt(0)!=="/"&&ct(u.protocol)&&(u.pathname="/"+u.pathname),id(u.port,u.protocol)||(u.host=u.hostname,u.port=""),u.username=u.password="",u.auth&&(r=u.auth.indexOf(":"),~r?(u.username=u.auth.slice(0,r),u.username=encodeURIComponent(decodeURIComponent(u.username)),u.password=u.auth.slice(r+1),u.password=encodeURIComponent(decodeURIComponent(u.password))):u.username=encodeURIComponent(decodeURIComponent(u.auth)),u.auth=u.password?u.username+":"+u.password:u.username),u.origin=u.protocol!=="file:"&&ct(u.protocol)&&u.host?u.protocol+"//"+u.host:"null",u.href=u.toString()}function Wy(i,e,t){var n=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||as.parse)(e)),n[i]=e;break;case"port":n[i]=e,id(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[i]="");break;case"hostname":n[i]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[i]=e,ad.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!t;break;case"pathname":case"hash":if(e){var a=i==="pathname"?"/":"#";n[i]=e.charAt(0)!==a?a+e:e}else n[i]=e;break;case"username":case"password":n[i]=encodeURIComponent(e);break;case"auth":var s=e.indexOf(":");~s?(n.username=e.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var o=0;o<To.length;o++){var r=To[o];r[4]&&(n[r[1]]=n[r[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&ct(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function Gy(i){(!i||typeof i!="function")&&(i=as.stringify);var e,t=this,n=t.host,a=t.protocol;a&&a.charAt(a.length-1)!==":"&&(a+=":");var s=a+(t.protocol&&t.slashes||ct(t.protocol)?"//":"");return t.username?(s+=t.username,t.password&&(s+=":"+t.password),s+="@"):t.password?(s+=":"+t.password,s+="@"):t.protocol!=="file:"&&ct(t.protocol)&&!n&&t.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||ad.test(t.hostname)&&!t.port)&&(n+=":"),s+=n+t.pathname,e=typeof t.query=="object"?i(t.query):t.query,e&&(s+=e.charAt(0)!=="?"?"?"+e:e),t.hash&&(s+=t.hash),s}pt.prototype={set:Wy,toString:Gy};pt.extractProtocol=od;pt.location=sd;pt.trimLeft=Sr;pt.qs=as;var Ky=pt;const Xy=tt(Ky);function Pi(i){"@babel/helpers - typeof";return Pi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pi(i)}function sc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Yy(n.key),n)}}function Qy(i,e,t){return e&&sc(i.prototype,e),t&&sc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Yy(i){var e=Jy(i,"string");return Pi(e)==="symbol"?e:String(e)}function Jy(i,e){if(Pi(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(Pi(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Zy(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ex(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Nn(i,e)}function tx(i){var e=rd();return function(){var n=Ln(i),a;if(e){var s=Ln(this).constructor;a=Reflect.construct(n,arguments,s)}else a=n.apply(this,arguments);return ix(this,a)}}function ix(i,e){if(e&&(Pi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nx(i)}function nx(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Oo(i){var e=typeof Map=="function"?new Map:void 0;return Oo=function(n){if(n===null||!ax(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,a)}function a(){return Oa(n,arguments,Ln(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),Nn(a,n)},Oo(i)}function Oa(i,e,t){return rd()?Oa=Reflect.construct.bind():Oa=function(a,s,o){var r=[null];r.push.apply(r,s);var l=Function.bind.apply(a,r),c=new l;return o&&Nn(c,o.prototype),c},Oa.apply(null,arguments)}function rd(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ax(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function Nn(i,e){return Nn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Nn(i,e)}function Ln(i){return Ln=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ln(i)}var fa=function(i){ex(t,i);var e=tx(t);function t(n){var a,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(Zy(this,t),a=e.call(this,n),a.originalRequest=o,a.originalResponse=r,a.causingError=s,s!=null&&(n+=", caused by ".concat(s.toString())),o!=null){var l=o.getHeader("X-Request-ID")||"n/a",c=o.getMethod(),p=o.getURL(),u=r?r.getStatus():"n/a",h=r?r.getBody()||"":"n/a";n+=", originated from request (method: ".concat(c,", url: ").concat(p,", response code: ").concat(u,", response text: ").concat(h,", request id: ").concat(l,")")}return a.message=n,a}return Qy(t)}(Oo(Error));function sx(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var e=Math.random()*16|0,t=i==="x"?e:e&3|8;return t.toString(16)})}function Ao(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ao=function(){return e};var i,e={},t=Object.prototype,n=t.hasOwnProperty,a=Object.defineProperty||function(P,b,w){P[b]=w.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",r=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function c(P,b,w){return Object.defineProperty(P,b,{value:w,enumerable:!0,configurable:!0,writable:!0}),P[b]}try{c({},"")}catch{c=function(w,E,T){return w[E]=T}}function p(P,b,w,E){var T=b&&b.prototype instanceof y?b:y,k=Object.create(T.prototype),M=new j(E||[]);return a(k,"_invoke",{value:z(P,w,M)}),k}function u(P,b,w){try{return{type:"normal",arg:P.call(b,w)}}catch(E){return{type:"throw",arg:E}}}e.wrap=p;var h="suspendedStart",g="suspendedYield",m="executing",v="completed",f={};function y(){}function F(){}function S(){}var A={};c(A,o,function(){return this});var D=Object.getPrototypeOf,x=D&&D(D($([])));x&&x!==t&&n.call(x,o)&&(A=x);var _=S.prototype=y.prototype=Object.create(A);function O(P){["next","throw","return"].forEach(function(b){c(P,b,function(w){return this._invoke(b,w)})})}function L(P,b){function w(T,k,M,q){var W=u(P[T],P,k);if(W.type!=="throw"){var de=W.arg,he=de.value;return he&&ri(he)=="object"&&n.call(he,"__await")?b.resolve(he.__await).then(function(le){w("next",le,M,q)},function(le){w("throw",le,M,q)}):b.resolve(he).then(function(le){de.value=le,M(de)},function(le){return w("throw",le,M,q)})}q(W.arg)}var E;a(this,"_invoke",{value:function(k,M){function q(){return new b(function(W,de){w(k,M,W,de)})}return E=E?E.then(q,q):q()}})}function z(P,b,w){var E=h;return function(T,k){if(E===m)throw new Error("Generator is already running");if(E===v){if(T==="throw")throw k;return{value:i,done:!0}}for(w.method=T,w.arg=k;;){var M=w.delegate;if(M){var q=K(M,w);if(q){if(q===f)continue;return q}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(E===h)throw E=v,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);E=m;var W=u(P,b,w);if(W.type==="normal"){if(E=w.done?v:g,W.arg===f)continue;return{value:W.arg,done:w.done}}W.type==="throw"&&(E=v,w.method="throw",w.arg=W.arg)}}}function K(P,b){var w=b.method,E=P.iterator[w];if(E===i)return b.delegate=null,w==="throw"&&P.iterator.return&&(b.method="return",b.arg=i,K(P,b),b.method==="throw")||w!=="return"&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+w+"' method")),f;var T=u(E,P.iterator,b.arg);if(T.type==="throw")return b.method="throw",b.arg=T.arg,b.delegate=null,f;var k=T.arg;return k?k.done?(b[P.resultName]=k.value,b.next=P.nextLoc,b.method!=="return"&&(b.method="next",b.arg=i),b.delegate=null,f):k:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,f)}function Z(P){var b={tryLoc:P[0]};1 in P&&(b.catchLoc=P[1]),2 in P&&(b.finallyLoc=P[2],b.afterLoc=P[3]),this.tryEntries.push(b)}function G(P){var b=P.completion||{};b.type="normal",delete b.arg,P.completion=b}function j(P){this.tryEntries=[{tryLoc:"root"}],P.forEach(Z,this),this.reset(!0)}function $(P){if(P||P===""){var b=P[o];if(b)return b.call(P);if(typeof P.next=="function")return P;if(!isNaN(P.length)){var w=-1,E=function T(){for(;++w<P.length;)if(n.call(P,w))return T.value=P[w],T.done=!1,T;return T.value=i,T.done=!0,T};return E.next=E}}throw new TypeError(ri(P)+" is not iterable")}return F.prototype=S,a(_,"constructor",{value:S,configurable:!0}),a(S,"constructor",{value:F,configurable:!0}),F.displayName=c(S,l,"GeneratorFunction"),e.isGeneratorFunction=function(P){var b=typeof P=="function"&&P.constructor;return!!b&&(b===F||(b.displayName||b.name)==="GeneratorFunction")},e.mark=function(P){return Object.setPrototypeOf?Object.setPrototypeOf(P,S):(P.__proto__=S,c(P,l,"GeneratorFunction")),P.prototype=Object.create(_),P},e.awrap=function(P){return{__await:P}},O(L.prototype),c(L.prototype,r,function(){return this}),e.AsyncIterator=L,e.async=function(P,b,w,E,T){T===void 0&&(T=Promise);var k=new L(p(P,b,w,E),T);return e.isGeneratorFunction(b)?k:k.next().then(function(M){return M.done?M.value:k.next()})},O(_),c(_,l,"Generator"),c(_,o,function(){return this}),c(_,"toString",function(){return"[object Generator]"}),e.keys=function(P){var b=Object(P),w=[];for(var E in b)w.push(E);return w.reverse(),function T(){for(;w.length;){var k=w.pop();if(k in b)return T.value=k,T.done=!1,T}return T.done=!0,T}},e.values=$,j.prototype={constructor:j,reset:function(b){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(G),!b)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=i)},stop:function(){this.done=!0;var b=this.tryEntries[0].completion;if(b.type==="throw")throw b.arg;return this.rval},dispatchException:function(b){if(this.done)throw b;var w=this;function E(de,he){return M.type="throw",M.arg=b,w.next=de,he&&(w.method="next",w.arg=i),!!he}for(var T=this.tryEntries.length-1;T>=0;--T){var k=this.tryEntries[T],M=k.completion;if(k.tryLoc==="root")return E("end");if(k.tryLoc<=this.prev){var q=n.call(k,"catchLoc"),W=n.call(k,"finallyLoc");if(q&&W){if(this.prev<k.catchLoc)return E(k.catchLoc,!0);if(this.prev<k.finallyLoc)return E(k.finallyLoc)}else if(q){if(this.prev<k.catchLoc)return E(k.catchLoc,!0)}else{if(!W)throw new Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return E(k.finallyLoc)}}}},abrupt:function(b,w){for(var E=this.tryEntries.length-1;E>=0;--E){var T=this.tryEntries[E];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var k=T;break}}k&&(b==="break"||b==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var M=k?k.completion:{};return M.type=b,M.arg=w,k?(this.method="next",this.next=k.finallyLoc,f):this.complete(M)},complete:function(b,w){if(b.type==="throw")throw b.arg;return b.type==="break"||b.type==="continue"?this.next=b.arg:b.type==="return"?(this.rval=this.arg=b.arg,this.method="return",this.next="end"):b.type==="normal"&&w&&(this.next=w),f},finish:function(b){for(var w=this.tryEntries.length-1;w>=0;--w){var E=this.tryEntries[w];if(E.finallyLoc===b)return this.complete(E.completion,E.afterLoc),G(E),f}},catch:function(b){for(var w=this.tryEntries.length-1;w>=0;--w){var E=this.tryEntries[w];if(E.tryLoc===b){var T=E.completion;if(T.type==="throw"){var k=T.arg;G(E)}return k}}throw new Error("illegal catch attempt")},delegateYield:function(b,w,E){return this.delegate={iterator:$(b),resultName:w,nextLoc:E},this.method==="next"&&(this.arg=i),f}},e}function oc(i,e,t,n,a,s,o){try{var r=i[s](o),l=r.value}catch(c){t(c);return}r.done?e(l):Promise.resolve(l).then(n,a)}function ox(i){return function(){var e=this,t=arguments;return new Promise(function(n,a){var s=i.apply(e,t);function o(l){oc(s,n,a,o,r,"next",l)}function r(l){oc(s,n,a,o,r,"throw",l)}o(void 0)})}}function ld(i,e){return ux(i)||cx(i,e)||lx(i,e)||rx()}function rx(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
40
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lx(i,e){if(i){if(typeof i=="string")return rc(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return rc(i,e)}}function rc(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=i[t];return n}function cx(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,a,s,o,r=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(r.push(n.value),r.length!==e);l=!0);}catch(p){c=!0,a=p}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw a}}return r}}function ux(i){if(Array.isArray(i))return i}function ri(i){"@babel/helpers - typeof";return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ri(i)}function lc(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function pi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lc(Object(t),!0).forEach(function(n){px(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):lc(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function px(i,e,t){return e=cd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function dx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function cc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,cd(n.key),n)}}function hx(i,e,t){return e&&cc(i.prototype,e),t&&cc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function cd(i){var e=mx(i,"string");return ri(e)==="symbol"?e:String(e)}function mx(i,e){if(ri(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(ri(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var fx={endpoint:null,uploadUrl:null,metadata:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:ud,chunkSize:1/0,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null},Wa=function(){function i(e,t){dx(this,i),"resume"in t&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=t,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return hx(i,[{key:"findPreviousUploads",value:function(){var t=this;return this.options.fingerprint(this.file,this.options).then(function(n){return t._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey}},{key:"start",value:function(){var t=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var a=this.options.retryDelays;if(a!=null&&Object.prototype.toString.call(a)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var s=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];s<o.length;s++){var r=o[s];if(this.options[r]){this._emitError(new Error("tus: cannot use the ".concat(r," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(l){return t._fingerprint=l,t._source?t._source:t.options.fileReader.openFile(n,t.options.chunkSize)}).then(function(l){if(t._source=l,t.options.uploadLengthDeferred)t._size=null;else if(t.options.uploadSize!=null){if(t._size=Number(t.options.uploadSize),Number.isNaN(t._size)){t._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(t._size=t._source.size,t._size==null){t._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}t.options.parallelUploads>1||t._parallelUploadUrls!=null?t._startParallelUpload():t._startSingleUpload()}).catch(function(l){t._emitError(l)})}},{key:"_startParallelUpload",value:function(){var t,n=this,a=this._size,s=0;this._parallelUploads=[];var o=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,r=(t=this.options.parallelUploadBoundaries)!==null&&t!==void 0?t:vx(this._source.size,o);this._parallelUploadUrls&&r.forEach(function(p,u){p.uploadUrl=n._parallelUploadUrls[u]||null}),this._parallelUploadUrls=new Array(r.length);var l=r.map(function(p,u){var h=0;return n._source.slice(p.start,p.end).then(function(g){var m=g.value;return new Promise(function(v,f){var y=pi(pi({},n.options),{},{uploadUrl:p.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:{},headers:pi(pi({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:v,onError:f,onProgress:function(A){s=s-h+A,h=A,n._emitProgress(s,a)},onUploadUrlAvailable:function(){n._parallelUploadUrls[u]=F.url,n._parallelUploadUrls.filter(function(A){return!!A}).length===r.length&&n._saveUploadInUrlStorage()}}),F=new i(m,y);F.start(),n._parallelUploads.push(F)})})}),c;Promise.all(l).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var p=uc(n.options.metadata);return p!==""&&c.setHeader("Upload-Metadata",p),n._sendRequest(c,null)}).then(function(p){if(!di(p.getStatus(),200)){n._emitHttpError(c,p,"tus: unexpected response while creating upload");return}var u=p.getHeader("Location");if(u==null){n._emitHttpError(c,p,"tus: invalid or missing Location header");return}n.url=mc(n.options.endpoint,u),"Created upload at ".concat(n.url),n._emitSuccess()}).catch(function(p){n._emitError(p)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){"Resuming upload from previous URL: ".concat(this.url),this._resumeUpload();return}if(this.options.uploadUrl!=null){"Resuming upload from provided URL: ".concat(this.options.uploadUrl),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload()}},{key:"abort",value:function(t){var n=this;return this._parallelUploads!=null&&this._parallelUploads.forEach(function(a){a.abort(t)}),this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!t||this.url==null?Promise.resolve():i.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(t,n,a,s){this._emitError(new fa(a,s,t,n))}},{key:"_emitError",value:function(t){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var a=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(a&&(this._retryAttempt=0),hc(t,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},s);return}}if(typeof this.options.onError=="function")this.options.onError(t);else throw t}}},{key:"_emitSuccess",value:function(){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess()}},{key:"_emitProgress",value:function(t,n){typeof this.options.onProgress=="function"&&this.options.onProgress(t,n)}},{key:"_emitChunkComplete",value:function(t,n,a){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(t,n,a)}},{key:"_createUpload",value:function(){var t=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length",1):n.setHeader("Upload-Length",this._size);var a=uc(this.options.metadata);a!==""&&n.setHeader("Upload-Metadata",a);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):s=this._sendRequest(n,null),s.then(function(o){if(!di(o.getStatus(),200)){t._emitHttpError(n,o,"tus: unexpected response while creating upload");return}var r=o.getHeader("Location");if(r==null){t._emitHttpError(n,o,"tus: invalid or missing Location header");return}if(t.url=mc(t.options.endpoint,r),"Created upload at ".concat(t.url),typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._size===0){t._emitSuccess(),t._source.close();return}t._saveUploadInUrlStorage().then(function(){t.options.uploadDataDuringCreation?t._handleUploadResponse(n,o):(t._offset=0,t._performUpload())})}).catch(function(o){t._emitHttpError(n,null,"tus: failed to create upload",o)})}},{key:"_resumeUpload",value:function(){var t=this,n=this._openRequest("HEAD",this.url),a=this._sendRequest(n,null);a.then(function(s){var o=s.getStatus();if(!di(o,200)){if(o===423){t._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(di(o,400)&&t._removeFromUrlStorage(),!t.options.endpoint){t._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}t.url=null,t._createUpload();return}var r=parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(r)){t._emitHttpError(n,s,"tus: invalid or missing offset value");return}var l=parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(l)&&!t.options.uploadLengthDeferred){t._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._saveUploadInUrlStorage().then(function(){if(r===l){t._emitProgress(l,l),t._emitSuccess();return}t._offset=r,t._performUpload()})}).catch(function(s){t._emitHttpError(n,null,"tus: failed to resume upload",s)})}},{key:"_performUpload",value:function(){var t=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset",this._offset);var a=this._addChunkToRequest(n);a.then(function(s){if(!di(s.getStatus(),200)){t._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}t._handleUploadResponse(n,s)}).catch(function(s){t._aborted||t._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(t._offset),s)})}}},{key:"_addChunkToRequest",value:function(t){var n=this,a=this._offset,s=this._offset+this.options.chunkSize;return t.setProgressHandler(function(o){n._emitProgress(a+o,n._size)}),t.setHeader("Content-Type","application/offset+octet-stream"),(s===1/0||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(a,s).then(function(o){var r=o.value,l=o.done,c=r&&r.size?r.size:0;n.options.uploadLengthDeferred&&l&&(n._size=n._offset+c,t.setHeader("Upload-Length",n._size));var p=n._offset+c;return!n.options.uploadLengthDeferred&&l&&p!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(p," bytes"))):r===null?n._sendRequest(t):(n._emitProgress(n._offset,n._size),n._sendRequest(t,r))})}},{key:"_handleUploadResponse",value:function(t,n){var a=parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(a)){this._emitHttpError(t,n,"tus: invalid or missing offset value");return}if(this._emitProgress(a,this._size),this._emitChunkComplete(a-this._offset,a,this._size),this._offset=a,a===this._size){this._emitSuccess(),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(t,n){var a=pc(t,n,this.options);return this._req=a,a}},{key:"_removeFromUrlStorage",value:function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){t._emitError(n)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(a){t._urlStorageKey=a})}},{key:"_sendRequest",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return dc(t,n,this.options)}}],[{key:"terminate",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=pc("DELETE",t,n);return dc(a,null,n).then(function(s){if(s.getStatus()!==204)throw new fa("tus: unexpected response while terminating upload",null,a,s)}).catch(function(s){if(s instanceof fa||(s=new fa("tus: failed to terminate upload",s,a,null)),!hc(s,0,n))throw s;var o=n.retryDelays[0],r=n.retryDelays.slice(1),l=pi(pi({},n),{},{retryDelays:r});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return i.terminate(t,l)})})}}]),i}();function uc(i){return Object.entries(i).map(function(e){var t=ld(e,2),n=t[0],a=t[1];return"".concat(n," ").concat(Uy.encode(String(a)))}).join(",")}function di(i,e){return i>=e&&i<e+100}function pc(i,e,t){var n=t.httpStack.createRequest(i,e);n.setHeader("Tus-Resumable","1.0.0");var a=t.headers||{};if(Object.entries(a).forEach(function(o){var r=ld(o,2),l=r[0],c=r[1];n.setHeader(l,c)}),t.addRequestId){var s=sx();n.setHeader("X-Request-ID",s)}return n}function dc(i,e,t){return Do.apply(this,arguments)}function Do(){return Do=ox(Ao().mark(function i(e,t,n){var a;return Ao().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(typeof n.onBeforeRequest!="function"){o.next=3;break}return o.next=3,n.onBeforeRequest(e);case 3:return o.next=5,e.send(t);case 5:if(a=o.sent,typeof n.onAfterResponse!="function"){o.next=9;break}return o.next=9,n.onAfterResponse(e,a);case 9:return o.abrupt("return",a);case 10:case"end":return o.stop()}},i)})),Do.apply(this,arguments)}function gx(){var i=!0;return typeof window<"u"&&"navigator"in window&&window.navigator.onLine===!1&&(i=!1),i}function hc(i,e,t){return t.retryDelays==null||e>=t.retryDelays.length||i.originalRequest==null?!1:t&&typeof t.onShouldRetry=="function"?t.onShouldRetry(i,e,t):ud(i)}function ud(i){var e=i.originalResponse?i.originalResponse.getStatus():0;return(!di(e,400)||e===409||e===423)&&gx()}function mc(i,e){return new Xy(e,i).toString()}function vx(i,e){for(var t=Math.floor(i/e),n=[],a=0;a<e;a++)n.push({start:t*a,end:t*(a+1)});return n[e-1].end=i,n}Wa.defaultOptions=fx;function Bn(i){"@babel/helpers - typeof";return Bn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bn(i)}function bx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function fc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,xx(n.key),n)}}function yx(i,e,t){return e&&fc(i.prototype,e),t&&fc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function xx(i){var e=wx(i,"string");return Bn(e)==="symbol"?e:String(e)}function wx(i,e){if(Bn(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(Bn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Px=function(){function i(){bx(this,i)}return yx(i,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(t){return Promise.resolve([])}},{key:"removeUpload",value:function(t){return Promise.resolve()}},{key:"addUpload",value:function(t,n){return Promise.resolve(null)}}]),i}();function Mn(i){"@babel/helpers - typeof";return Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mn(i)}function Sx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function gc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,_x(n.key),n)}}function Fx(i,e,t){return e&&gc(i.prototype,e),t&&gc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function _x(i){var e=Cx(i,"string");return Mn(e)==="symbol"?e:String(e)}function Cx(i,e){if(Mn(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(Mn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ro=!1;try{Ro="localStorage"in window;var qs="tusSupport",vc=localStorage.getItem(qs);localStorage.setItem(qs,vc),vc===null&&localStorage.removeItem(qs)}catch(i){if(i.code===i.SECURITY_ERR||i.code===i.QUOTA_EXCEEDED_ERR)Ro=!1;else throw i}var Ex=Ro,kx=function(){function i(){Sx(this,i)}return Fx(i,[{key:"findAllUploads",value:function(){var t=this._findEntries("tus::");return Promise.resolve(t)}},{key:"findUploadsByFingerprint",value:function(t){var n=this._findEntries("tus::".concat(t,"::"));return Promise.resolve(n)}},{key:"removeUpload",value:function(t){return localStorage.removeItem(t),Promise.resolve()}},{key:"addUpload",value:function(t,n){var a=Math.round(Math.random()*1e12),s="tus::".concat(t,"::").concat(a);return localStorage.setItem(s,JSON.stringify(n)),Promise.resolve(s)}},{key:"_findEntries",value:function(t){for(var n=[],a=0;a<localStorage.length;a++){var s=localStorage.key(a);if(s.indexOf(t)===0)try{var o=JSON.parse(localStorage.getItem(s));o.urlStorageKey=s,n.push(o)}catch{}}return n}}]),i}();function jn(i){"@babel/helpers - typeof";return jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jn(i)}function Fr(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function bc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Tx(n.key),n)}}function _r(i,e,t){return e&&bc(i.prototype,e),t&&bc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Tx(i){var e=Ox(i,"string");return jn(e)==="symbol"?e:String(e)}function Ox(i,e){if(jn(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(jn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ax=function(){function i(){Fr(this,i)}return _r(i,[{key:"createRequest",value:function(t,n){return new Dx(t,n)}},{key:"getName",value:function(){return"XHRHttpStack"}}]),i}(),Dx=function(){function i(e,t){Fr(this,i),this._xhr=new XMLHttpRequest,this._xhr.open(e,t,!0),this._method=e,this._url=t,this._headers={}}return _r(i,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(t,n){this._xhr.setRequestHeader(t,n),this._headers[t]=n}},{key:"getHeader",value:function(t){return this._headers[t]}},{key:"setProgressHandler",value:function(t){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(n){n.lengthComputable&&t(n.loaded)})}},{key:"send",value:function(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(a,s){t._xhr.onload=function(){a(new Rx(t._xhr))},t._xhr.onerror=function(o){s(o)},t._xhr.send(n)})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),i}(),Rx=function(){function i(e){Fr(this,i),this._xhr=e}return _r(i,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(t){return this._xhr.getResponseHeader(t)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),i}(),pd=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"};function Ix(i){return new Promise(function(e,t){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var a=n.response;e(a)},n.onerror=function(a){t(a)},n.open("GET",i),n.send()})}var Ux=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")};function Nx(i){return new Promise(function(e,t){var n=new FileReader;n.onload=function(){var a=new Uint8Array(n.result);e({value:a})},n.onerror=function(a){t(a)},n.readAsArrayBuffer(i)})}function zn(i){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zn(i)}function Lx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function yc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Mx(n.key),n)}}function Bx(i,e,t){return e&&yc(i.prototype,e),t&&yc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Mx(i){var e=jx(i,"string");return zn(e)==="symbol"?e:String(e)}function jx(i,e){if(zn(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(zn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var xc=function(){function i(e){Lx(this,i),this._file=e,this.size=e.size}return Bx(i,[{key:"slice",value:function(t,n){if(Ux())return Nx(this._file.slice(t,n));var a=this._file.slice(t,n),s=n>=this.size;return Promise.resolve({value:a,done:s})}},{key:"close",value:function(){}}]),i}();function $n(i){"@babel/helpers - typeof";return $n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$n(i)}function zx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function wc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,qx(n.key),n)}}function $x(i,e,t){return e&&wc(i.prototype,e),t&&wc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function qx(i){var e=Hx(i,"string");return $n(e)==="symbol"?e:String(e)}function Hx(i,e){if($n(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if($n(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Pc(i){return i===void 0?0:i.size!==void 0?i.size:i.length}function Vx(i,e){if(i.concat)return i.concat(e);if(i instanceof Blob)return new Blob([i,e],{type:i.type});if(i.set){var t=new i.constructor(i.length+e.length);return t.set(i),t.set(e,i.length),t}throw new Error("Unknown data type")}var Wx=function(){function i(e){zx(this,i),this._buffer=void 0,this._bufferOffset=0,this._reader=e,this._done=!1}return $x(i,[{key:"slice",value:function(t,n){return t<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(t,n)}},{key:"_readUntilEnoughDataOrDone",value:function(t,n){var a=this,s=n<=this._bufferOffset+Pc(this._buffer);if(this._done||s){var o=this._getDataFromBuffer(t,n),r=o==null?this._done:!1;return Promise.resolve({value:o,done:r})}return this._reader.read().then(function(l){var c=l.value,p=l.done;return p?a._done=!0:a._buffer===void 0?a._buffer=c:a._buffer=Vx(a._buffer,c),a._readUntilEnoughDataOrDone(t,n)})}},{key:"_getDataFromBuffer",value:function(t,n){t>this._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var a=Pc(this._buffer)===0;return this._done&&a?null:this._buffer.slice(0,n-t)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}]),i}();function li(i){"@babel/helpers - typeof";return li=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},li(i)}function Io(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Io=function(){return e};var i,e={},t=Object.prototype,n=t.hasOwnProperty,a=Object.defineProperty||function(P,b,w){P[b]=w.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",r=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function c(P,b,w){return Object.defineProperty(P,b,{value:w,enumerable:!0,configurable:!0,writable:!0}),P[b]}try{c({},"")}catch{c=function(w,E,T){return w[E]=T}}function p(P,b,w,E){var T=b&&b.prototype instanceof y?b:y,k=Object.create(T.prototype),M=new j(E||[]);return a(k,"_invoke",{value:z(P,w,M)}),k}function u(P,b,w){try{return{type:"normal",arg:P.call(b,w)}}catch(E){return{type:"throw",arg:E}}}e.wrap=p;var h="suspendedStart",g="suspendedYield",m="executing",v="completed",f={};function y(){}function F(){}function S(){}var A={};c(A,o,function(){return this});var D=Object.getPrototypeOf,x=D&&D(D($([])));x&&x!==t&&n.call(x,o)&&(A=x);var _=S.prototype=y.prototype=Object.create(A);function O(P){["next","throw","return"].forEach(function(b){c(P,b,function(w){return this._invoke(b,w)})})}function L(P,b){function w(T,k,M,q){var W=u(P[T],P,k);if(W.type!=="throw"){var de=W.arg,he=de.value;return he&&li(he)=="object"&&n.call(he,"__await")?b.resolve(he.__await).then(function(le){w("next",le,M,q)},function(le){w("throw",le,M,q)}):b.resolve(he).then(function(le){de.value=le,M(de)},function(le){return w("throw",le,M,q)})}q(W.arg)}var E;a(this,"_invoke",{value:function(k,M){function q(){return new b(function(W,de){w(k,M,W,de)})}return E=E?E.then(q,q):q()}})}function z(P,b,w){var E=h;return function(T,k){if(E===m)throw new Error("Generator is already running");if(E===v){if(T==="throw")throw k;return{value:i,done:!0}}for(w.method=T,w.arg=k;;){var M=w.delegate;if(M){var q=K(M,w);if(q){if(q===f)continue;return q}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(E===h)throw E=v,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);E=m;var W=u(P,b,w);if(W.type==="normal"){if(E=w.done?v:g,W.arg===f)continue;return{value:W.arg,done:w.done}}W.type==="throw"&&(E=v,w.method="throw",w.arg=W.arg)}}}function K(P,b){var w=b.method,E=P.iterator[w];if(E===i)return b.delegate=null,w==="throw"&&P.iterator.return&&(b.method="return",b.arg=i,K(P,b),b.method==="throw")||w!=="return"&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+w+"' method")),f;var T=u(E,P.iterator,b.arg);if(T.type==="throw")return b.method="throw",b.arg=T.arg,b.delegate=null,f;var k=T.arg;return k?k.done?(b[P.resultName]=k.value,b.next=P.nextLoc,b.method!=="return"&&(b.method="next",b.arg=i),b.delegate=null,f):k:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,f)}function Z(P){var b={tryLoc:P[0]};1 in P&&(b.catchLoc=P[1]),2 in P&&(b.finallyLoc=P[2],b.afterLoc=P[3]),this.tryEntries.push(b)}function G(P){var b=P.completion||{};b.type="normal",delete b.arg,P.completion=b}function j(P){this.tryEntries=[{tryLoc:"root"}],P.forEach(Z,this),this.reset(!0)}function $(P){if(P||P===""){var b=P[o];if(b)return b.call(P);if(typeof P.next=="function")return P;if(!isNaN(P.length)){var w=-1,E=function T(){for(;++w<P.length;)if(n.call(P,w))return T.value=P[w],T.done=!1,T;return T.value=i,T.done=!0,T};return E.next=E}}throw new TypeError(li(P)+" is not iterable")}return F.prototype=S,a(_,"constructor",{value:S,configurable:!0}),a(S,"constructor",{value:F,configurable:!0}),F.displayName=c(S,l,"GeneratorFunction"),e.isGeneratorFunction=function(P){var b=typeof P=="function"&&P.constructor;return!!b&&(b===F||(b.displayName||b.name)==="GeneratorFunction")},e.mark=function(P){return Object.setPrototypeOf?Object.setPrototypeOf(P,S):(P.__proto__=S,c(P,l,"GeneratorFunction")),P.prototype=Object.create(_),P},e.awrap=function(P){return{__await:P}},O(L.prototype),c(L.prototype,r,function(){return this}),e.AsyncIterator=L,e.async=function(P,b,w,E,T){T===void 0&&(T=Promise);var k=new L(p(P,b,w,E),T);return e.isGeneratorFunction(b)?k:k.next().then(function(M){return M.done?M.value:k.next()})},O(_),c(_,l,"Generator"),c(_,o,function(){return this}),c(_,"toString",function(){return"[object Generator]"}),e.keys=function(P){var b=Object(P),w=[];for(var E in b)w.push(E);return w.reverse(),function T(){for(;w.length;){var k=w.pop();if(k in b)return T.value=k,T.done=!1,T}return T.done=!0,T}},e.values=$,j.prototype={constructor:j,reset:function(b){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(G),!b)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=i)},stop:function(){this.done=!0;var b=this.tryEntries[0].completion;if(b.type==="throw")throw b.arg;return this.rval},dispatchException:function(b){if(this.done)throw b;var w=this;function E(de,he){return M.type="throw",M.arg=b,w.next=de,he&&(w.method="next",w.arg=i),!!he}for(var T=this.tryEntries.length-1;T>=0;--T){var k=this.tryEntries[T],M=k.completion;if(k.tryLoc==="root")return E("end");if(k.tryLoc<=this.prev){var q=n.call(k,"catchLoc"),W=n.call(k,"finallyLoc");if(q&&W){if(this.prev<k.catchLoc)return E(k.catchLoc,!0);if(this.prev<k.finallyLoc)return E(k.finallyLoc)}else if(q){if(this.prev<k.catchLoc)return E(k.catchLoc,!0)}else{if(!W)throw new Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return E(k.finallyLoc)}}}},abrupt:function(b,w){for(var E=this.tryEntries.length-1;E>=0;--E){var T=this.tryEntries[E];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var k=T;break}}k&&(b==="break"||b==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var M=k?k.completion:{};return M.type=b,M.arg=w,k?(this.method="next",this.next=k.finallyLoc,f):this.complete(M)},complete:function(b,w){if(b.type==="throw")throw b.arg;return b.type==="break"||b.type==="continue"?this.next=b.arg:b.type==="return"?(this.rval=this.arg=b.arg,this.method="return",this.next="end"):b.type==="normal"&&w&&(this.next=w),f},finish:function(b){for(var w=this.tryEntries.length-1;w>=0;--w){var E=this.tryEntries[w];if(E.finallyLoc===b)return this.complete(E.completion,E.afterLoc),G(E),f}},catch:function(b){for(var w=this.tryEntries.length-1;w>=0;--w){var E=this.tryEntries[w];if(E.tryLoc===b){var T=E.completion;if(T.type==="throw"){var k=T.arg;G(E)}return k}}throw new Error("illegal catch attempt")},delegateYield:function(b,w,E){return this.delegate={iterator:$(b),resultName:w,nextLoc:E},this.method==="next"&&(this.arg=i),f}},e}function Sc(i,e,t,n,a,s,o){try{var r=i[s](o),l=r.value}catch(c){t(c);return}r.done?e(l):Promise.resolve(l).then(n,a)}function Gx(i){return function(){var e=this,t=arguments;return new Promise(function(n,a){var s=i.apply(e,t);function o(l){Sc(s,n,a,o,r,"next",l)}function r(l){Sc(s,n,a,o,r,"throw",l)}o(void 0)})}}function Kx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Fc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Qx(n.key),n)}}function Xx(i,e,t){return e&&Fc(i.prototype,e),t&&Fc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Qx(i){var e=Yx(i,"string");return li(e)==="symbol"?e:String(e)}function Yx(i,e){if(li(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(li(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Jx=function(){function i(){Kx(this,i)}return Xx(i,[{key:"openFile",value:function(){var e=Gx(Io().mark(function n(a,s){var o;return Io().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(!(pd()&&a&&typeof a.uri<"u")){l.next=11;break}return l.prev=1,l.next=4,Ix(a.uri);case 4:return o=l.sent,l.abrupt("return",new xc(o));case 8:throw l.prev=8,l.t0=l.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(l.t0));case 11:if(!(typeof a.slice=="function"&&typeof a.size<"u")){l.next=13;break}return l.abrupt("return",Promise.resolve(new xc(a)));case 13:if(typeof a.read!="function"){l.next=18;break}if(s=Number(s),Number.isFinite(s)){l.next=17;break}return l.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return l.abrupt("return",Promise.resolve(new Wx(a,s)));case 18:return l.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case"end":return l.stop()}},n,null,[[1,8]])}));function t(n,a){return e.apply(this,arguments)}return t}()}]),i}();function Zx(i,e){return pd()?Promise.resolve(e0(i,e)):Promise.resolve(["tus-br",i.name,i.type,i.size,i.lastModified,e.endpoint].join("-"))}function e0(i,e){var t=i.exif?t0(JSON.stringify(i.exif)):"noexif";return["tus-rn",i.name||"noname",i.size||"nosize",t,e.endpoint].join("/")}function t0(i){var e=0;if(i.length===0)return e;for(var t=0;t<i.length;t++){var n=i.charCodeAt(t);e=(e<<5)-e+n,e&=e}return e}function Si(i){"@babel/helpers - typeof";return Si=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Si(i)}function i0(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function _c(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,dd(n.key),n)}}function n0(i,e,t){return e&&_c(i.prototype,e),t&&_c(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function a0(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Uo(i,e)}function Uo(i,e){return Uo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Uo(i,e)}function s0(i){var e=l0();return function(){var n=Ga(i),a;if(e){var s=Ga(this).constructor;a=Reflect.construct(n,arguments,s)}else a=n.apply(this,arguments);return o0(this,a)}}function o0(i,e){if(e&&(Si(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return r0(i)}function r0(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function l0(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ga(i){return Ga=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ga(i)}function Cc(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function gi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Cc(Object(t),!0).forEach(function(n){c0(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Cc(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function c0(i,e,t){return e=dd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function dd(i){var e=u0(i,"string");return Si(e)==="symbol"?e:String(e)}function u0(i,e){if(Si(i)!=="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(Si(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var No=gi(gi({},Wa.defaultOptions),{},{httpStack:new Ax,fileReader:new Jx,urlStorage:Ex?new kx:new Px,fingerprint:Zx}),p0=function(i){a0(t,i);var e=s0(t);function t(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i0(this,t),a=gi(gi({},No),a),e.call(this,n,a)}return n0(t,null,[{key:"terminate",value:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s=gi(gi({},No),s),Wa.terminate(a,s)}}]),t}(Wa);function wt(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var d0=0;function hd(i){return"__private_"+d0+++"_"+i}var Pe=hd("uppy"),en=hd("events");class h0{constructor(e){Object.defineProperty(this,Pe,{writable:!0,value:void 0}),Object.defineProperty(this,en,{writable:!0,value:[]}),wt(this,Pe)[Pe]=e}on(e,t){return wt(this,en)[en].push([e,t]),wt(this,Pe)[Pe].on(e,t)}remove(){for(const[e,t]of wt(this,en)[en].splice(0))wt(this,Pe)[Pe].off(e,t)}onFilePause(e,t){this.on("upload-pause",(n,a)=>{e===n&&t(a)})}onFileRemove(e,t){this.on("file-removed",n=>{e===n.id&&t(n.id)})}onPause(e,t){this.on("upload-pause",(n,a)=>{e===n&&t(a)})}onRetry(e,t){this.on("upload-retry",n=>{e===n&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{wt(this,Pe)[Pe].getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{wt(this,Pe)[Pe].getFile(e)&&t()})}onCancelAll(e,t){var n=this;this.on("cancel-all",function(){wt(n,Pe)[Pe].getFile(e)&&t(...arguments)})}onResumeAll(e,t){this.on("resume-all",()=>{wt(this,Pe)[Pe].getFile(e)&&t()})}}function m0(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}function B(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var f0=0;function Te(i){return"__private_"+f0+++"_"+i}function g0(i){return new Error("Cancelled",{cause:i})}function Ec(i){if(i!=null){var e;const t=()=>this.abort(i.reason);i.addEventListener("abort",t,{once:!0});const n=()=>{i.removeEventListener("abort",t)};(e=this.then)==null||e.call(this,n,n)}return this}var Ne=Te("activeRequests"),_e=Te("queuedHandlers"),Ae=Te("paused"),Kt=Te("pauseTimer"),Se=Te("downLimit"),Xt=Te("upperLimit"),Pt=Te("rateLimitingTimer"),bn=Te("call"),Tt=Te("queueNext"),Lo=Te("next"),Hs=Te("queue"),Bo=Te("dequeue"),Vs=Te("resume"),Qt=Te("increaseLimit");class v0{constructor(e){Object.defineProperty(this,Bo,{value:P0}),Object.defineProperty(this,Hs,{value:w0}),Object.defineProperty(this,Lo,{value:x0}),Object.defineProperty(this,Tt,{value:y0}),Object.defineProperty(this,bn,{value:b0}),Object.defineProperty(this,Ne,{writable:!0,value:0}),Object.defineProperty(this,_e,{writable:!0,value:[]}),Object.defineProperty(this,Ae,{writable:!0,value:!1}),Object.defineProperty(this,Kt,{writable:!0,value:void 0}),Object.defineProperty(this,Se,{writable:!0,value:1}),Object.defineProperty(this,Xt,{writable:!0,value:void 0}),Object.defineProperty(this,Pt,{writable:!0,value:void 0}),Object.defineProperty(this,Vs,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,Qt,{writable:!0,value:()=>{if(B(this,Ae)[Ae]){B(this,Pt)[Pt]=setTimeout(B(this,Qt)[Qt],0);return}B(this,Se)[Se]=this.limit,this.limit=Math.ceil((B(this,Xt)[Xt]+B(this,Se)[Se])/2);for(let t=B(this,Se)[Se];t<=this.limit;t++)B(this,Tt)[Tt]();B(this,Xt)[Xt]-B(this,Se)[Se]>3?B(this,Pt)[Pt]=setTimeout(B(this,Qt)[Qt],2e3):B(this,Se)[Se]=Math.floor(B(this,Se)[Se]/2)}}),typeof e!="number"||e===0?this.limit=1/0:this.limit=e}run(e,t){return!B(this,Ae)[Ae]&&B(this,Ne)[Ne]<this.limit?B(this,bn)[bn](e):B(this,Hs)[Hs](e,t)}wrapSyncFunction(e,t){var n=this;return function(){for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];const r=n.run(()=>(e(...s),queueMicrotask(()=>r.done()),()=>{}),t);return{abortOn:Ec,abort(){r.abort()}}}}wrapPromiseFunction(e,t){var n=this;return function(){for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];let r;const l=new Promise((c,p)=>{r=n.run(()=>{let u,h;try{h=Promise.resolve(e(...s))}catch(g){h=Promise.reject(g)}return h.then(g=>{u?p(u):(r.done(),c(g))},g=>{u?p(u):(r.done(),p(g))}),g=>{u=g0(g)}},t)});return l.abort=c=>{r.abort(c)},l.abortOn=Ec,l}}resume(){B(this,Ae)[Ae]=!1,clearTimeout(B(this,Kt)[Kt]);for(let e=0;e<this.limit;e++)B(this,Tt)[Tt]()}pause(e){e===void 0&&(e=null),B(this,Ae)[Ae]=!0,clearTimeout(B(this,Kt)[Kt]),e!=null&&(B(this,Kt)[Kt]=setTimeout(B(this,Vs)[Vs],e))}rateLimit(e){clearTimeout(B(this,Pt)[Pt]),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(B(this,Xt)[Xt]=this.limit-1,this.limit=B(this,Se)[Se],B(this,Pt)[Pt]=setTimeout(B(this,Qt)[Qt],e))}get isPaused(){return B(this,Ae)[Ae]}}function b0(i){B(this,Ne)[Ne]+=1;let e=!1,t;try{t=i()}catch(n){throw B(this,Ne)[Ne]-=1,n}return{abort:n=>{e||(e=!0,B(this,Ne)[Ne]-=1,t==null||t(n),B(this,Tt)[Tt]())},done:()=>{e||(e=!0,B(this,Ne)[Ne]-=1,B(this,Tt)[Tt]())}}}function y0(){queueMicrotask(()=>B(this,Lo)[Lo]())}function x0(){if(B(this,Ae)[Ae]||B(this,Ne)[Ne]>=this.limit||B(this,_e)[_e].length===0)return;const i=B(this,_e)[_e].shift();if(i==null)throw new Error("Invariant violation: next is null");const e=B(this,bn)[bn](i.fn);i.abort=e.abort,i.done=e.done}function w0(i,e){const t={fn:i,priority:(e==null?void 0:e.priority)||0,abort:()=>{B(this,Bo)[Bo](t)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},n=B(this,_e)[_e].findIndex(a=>t.priority>a.priority);return n===-1?B(this,_e)[_e].push(t):B(this,_e)[_e].splice(n,0,t),t}function P0(i){const e=B(this,_e)[_e].indexOf(i);e!==-1&&B(this,_e)[_e].splice(e,1)}function S0(i){const e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function F0(i){return i.filter(e=>{var t;return!((t=e.progress)!=null&&t.uploadStarted)||!e.isRestored})}function _0(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")}function C0(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"}function E0(i){return(e,t)=>{if(_0()||C0())return No.fingerprint(e,t);const n=["tus",i.id,t.endpoint].join("-");return Promise.resolve(n)}}function si(i,e){if(!Object.prototype.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var k0=0;function Qn(i){return"__private_"+k0+++"_"+i}const T0={version:"3.5.4"},md={endpoint:"",uploadUrl:null,metadata:{},uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,overridePatchMethod:!1,headers:{},addRequestId:!1,chunkSize:1/0,retryDelays:[100,1e3,3e3,5e3],parallelUploads:1,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1},O0={limit:20,retryDelays:md.retryDelays,withCredentials:!1};var yn=Qn("retryDelayIterator"),Mo=Qn("uploadLocalFile"),jo=Qn("getCompanionClientArgs"),Ws=Qn("uploadFiles"),tn=Qn("handleUpload");class fd extends er{constructor(e,t){var n,a;if(super(e,{...O0,...t}),Object.defineProperty(this,Ws,{value:R0}),Object.defineProperty(this,jo,{value:D0}),Object.defineProperty(this,Mo,{value:A0}),Object.defineProperty(this,yn,{writable:!0,value:void 0}),Object.defineProperty(this,tn,{writable:!0,value:async s=>{if(s.length===0){this.uppy.log("[Tus] No files to upload");return}this.opts.limit===0&&this.uppy.log("[Tus] 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/tus/#limit-0","warning"),this.uppy.log("[Tus] Uploading...");const o=this.uppy.getFilesByIds(s);await si(this,Ws)[Ws](o)}}),this.type="uploader",this.id=this.opts.id||"Tus",(t==null?void 0:t.allowedMetaFields)===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");if("autoRetry"in t)throw new Error("The `autoRetry` option was deprecated and has been removed.");this.requests=(n=this.opts.rateLimitedQueue)!=null?n:new v0(this.opts.limit),si(this,yn)[yn]=(a=this.opts.retryDelays)==null?void 0:a.values(),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null),this.handleResetProgress=this.handleResetProgress.bind(this)}handleResetProgress(){const e={...this.uppy.getState().files};Object.keys(e).forEach(t=>{var n;if((n=e[t])!=null&&(n=n.tus)!=null&&n.uploadUrl){const a={...e[t].tus};delete a.uploadUrl,e[t]={...e[t],tus:a}}}),this.uppy.setState({files:e})}resetUploaderReferences(e,t){const n=this.uploaders[e];n&&(n.abort(),t!=null&&t.abort&&n.abort(!0),this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null)}onReceiveUploadUrl(e,t){const n=this.uppy.getFile(e.id);n&&(!n.tus||n.tus.uploadUrl!==t)&&(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(n.id,{tus:{...n.tus,uploadUrl:t}}))}install(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!0}}),this.uppy.addUploader(si(this,tn)[tn]),this.uppy.on("reset-progress",this.handleResetProgress)}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(si(this,tn)[tn])}}function A0(i){var e=this;return this.resetUploaderReferences(i.id),new Promise((t,n)=>{let a,s,o;const r={...this.opts,...i.tus||{}};typeof r.headers=="function"&&(r.headers=r.headers(i));const{onShouldRetry:l,onBeforeRequest:c,...p}=r,u={...md,...p};u.fingerprint=E0(i),u.onBeforeRequest=async y=>{const F=y.getUnderlyingObject();F.withCredentials=!!r.withCredentials;let S;if(typeof c=="function"&&(S=c(y,i)),xa(a,"shouldBeRequeued")){if(!a.shouldBeRequeued)return Promise.reject();let A;const D=new Promise(x=>{A=x});a=this.requests.run(()=>(i.isPaused&&a.abort(),A(),()=>{})),await Promise.all([D,S]);return}return S},u.onError=y=>{var F;this.uppy.log(y);const S=y.originalRequest!=null?y.originalRequest.getUnderlyingObject():null;m0(S)&&(y=new Cu(y,S)),this.resetUploaderReferences(i.id),(F=a)==null||F.abort(),this.uppy.emit("upload-error",i,y),typeof r.onError=="function"&&r.onError(y),n(y)},u.onProgress=(y,F)=>{this.onReceiveUploadUrl(i,o.url),typeof r.onProgress=="function"&&r.onProgress(y,F),this.uppy.emit("upload-progress",this.uppy.getFile(i.id),{uploader:this,bytesUploaded:y,bytesTotal:F})},u.onSuccess=()=>{var y;const F={uploadURL:(y=o.url)!=null?y:void 0,status:200,body:{}};if(this.resetUploaderReferences(i.id),a.done(),this.uppy.emit("upload-success",this.uppy.getFile(i.id),F),o.url){const{name:S}=o.file;this.uppy.log(`Download ${S} from ${o.url}`)}typeof r.onSuccess=="function"&&r.onSuccess(),t(o)};const h=y=>{var F;const S=y==null||(F=y.originalResponse)==null?void 0:F.getStatus();if(S===429){if(!this.requests.isPaused){var A;const D=(A=si(this,yn)[yn])==null?void 0:A.next();if(D==null||D.done)return!1;this.requests.rateLimit(D.value)}}else{if(S!=null&&S>400&&S<500&&S!==409&&S!==423)return!1;typeof navigator<"u"&&navigator.onLine===!1&&(this.requests.isPaused||(this.requests.pause(),window.addEventListener("online",()=>{this.requests.resume()},{once:!0})))}return a.abort(),a={shouldBeRequeued:!0,abort(){this.shouldBeRequeued=!1},done(){throw new Error("Cannot mark a queued request as done: this indicates a bug")},fn(){throw new Error("Cannot run a queued request: this indicates a bug")}},!0};l!=null?u.onShouldRetry=(y,F)=>l(y,F,r,h):u.onShouldRetry=h;const g=(y,F,S)=>{xa(y,F)&&!xa(y,S)&&(y[S]=y[F])},m={};(Array.isArray(r.allowedMetaFields)?r.allowedMetaFields:Object.keys(i.meta)).forEach(y=>{m[y]=String(i.meta[y])}),g(m,"type","filetype"),g(m,"name","filename"),u.metadata=m,o=new p0(i.data,u),this.uploaders[i.id]=o;const f=new h0(this.uppy);this.uploaderEvents[i.id]=f,s=()=>(i.isPaused||o.start(),()=>{}),o.findPreviousUploads().then(y=>{const F=y[0];F&&(this.uppy.log(`[Tus] Resuming upload of ${i.id} started at ${F.creationTime}`),o.resumeFromPreviousUpload(F))}),a=this.requests.run(s),f.onFileRemove(i.id,y=>{a.abort(),this.resetUploaderReferences(i.id,{abort:!!o.url}),t(`upload ${y} was removed`)}),f.onPause(i.id,y=>{a.abort(),y?o.abort():a=this.requests.run(s)}),f.onPauseAll(i.id,()=>{a.abort(),o.abort()}),f.onCancelAll(i.id,function(y){let{reason:F}=y===void 0?{}:y;F==="user"&&(a.abort(),e.resetUploaderReferences(i.id,{abort:!!o.url})),t(`upload ${i.id} was canceled`)}),f.onResumeAll(i.id,()=>{a.abort(),i.error&&o.abort(),a=this.requests.run(s)})}).catch(t=>{throw this.uppy.emit("upload-error",i,t),t})}function D0(i){var e;const t={...this.opts};return i.tus&&Object.assign(t,i.tus),{...(e=i.remote)==null?void 0:e.body,endpoint:t.endpoint,uploadUrl:t.uploadUrl,protocol:"tus",size:i.data.size,headers:t.headers,metadata:i.meta}}async function R0(i){const e=S0(i),t=F0(e);this.uppy.emit("upload-start",t),await Promise.allSettled(e.map(n=>{if(n.isRemote){const a=()=>this.requests,s=new AbortController,o=l=>{l.id===n.id&&s.abort()};this.uppy.on("file-removed",o);const r=this.uppy.getRequestClientForFile(n).uploadRemoteFile(n,si(this,jo)[jo](n),{signal:s.signal,getQueue:a});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",o)},{priority:-1})(),r}return si(this,Mo)[Mo](n)}))}fd.VERSION=T0.version;const Cr={strings:{},pluralize(){return 0}};Cr.strings={addBulkFilesFailed:"内部错误导致添加 %{smart_count} 个文件失败",addMore:"添加更多文件",addMoreFiles:"添加更多文件",addingMoreFiles:"添加更多文件",allowAccessDescription:"为了通过您的相机进行拍照或录像,请给网站相机的访问权限",allowAccessTitle:"请允许对相机的访问权限",authenticateWith:"连接到 %{pluginName}",authenticateWithTitle:"请使用 %{pluginName} 进行认证以选择文件",back:"返回",browse:"浏览",browseFiles:"浏览",cancel:"取消",cancelUpload:"取消上传",chooseFiles:"选择文件",closeModal:"关闭窗口",companionError:"和 Companion 连接失败了",companionUnauthorizeHint:"请访问 %{url} 以认证您的 %{provider} 账户",complete:"上传完毕",connectedToInternet:"连接至网络",copyLink:"复制链接",copyLinkToClipboardFallback:"复制以下网址",copyLinkToClipboardSuccess:"链接已复制到剪贴板",creatingAssembly:"正在准备上传…",creatingAssemblyFailed:"Transloadit:无法创建程序集",dashboardTitle:"文件上传工具",dashboardWindowTitle:"文件上传工具窗口(点击离开以关闭)",dataUploadedOfTotal:"%{total} / %{complete}",done:"完成",dropHereOr:"拖拽文件到这里,或%{browse}",dropHint:"拖拽文件到这里",dropPasteBoth:"拖拽文件到这里,或者%{browse}文件",dropPasteFiles:"拖拽文件到这里,或者%{browse}文件",dropPasteFolders:"拖拽文件到这里,或者%{browse}文件",dropPasteImportBoth:"拖拽文件到这里,粘贴、%{browse}或者导入",dropPasteImportFiles:"拖拽文件到这里,粘贴、%{browse}或者导入",dropPasteImportFolders:"拖拽文件到这里,粘贴、%{browse}或者导入",editFile:"编辑文件",editImage:"编辑图片",editing:"正在编辑 %{file}",emptyFolderAdded:"无法从空文件夹添加文件",encoding:"正在编码…",enterCorrectUrl:"错误链接: 请确认您输入的是文件的链接",enterUrlToImport:"输入链接或者导入文件",exceedsSize:"文件超过了最大尺寸限制 %{size}",failedToFetch:"Companion 无法抓取此链接,请确保它是正确的",failedToUpload:"上传 %{file} 失败",fileSource:"文件源:%{name}",filesUploadedOfTotal:"已上传 %{smart_count} 个文件中的 %{complete} 个",filter:"筛选器",finishEditingFile:"完成文件编辑",folderAdded:"从 %{folder} 添加了 %{smart_count} 个文件",generatingThumbnails:"正在生成缩略图…",import:"导入",importFrom:"从 %{name} 导入",inferiorSize:"文件大小必须超过 %{size}",loading:"正在载入…",logOut:"登出",micDisabled:"麦克风的权限访问被用户拒绝",myDevice:"我的设备",noCameraDescription:"为了拍摄照片或录制视频,请连接一个摄像设备",noCameraTitle:"摄像头不可用",noDuplicates:"无法添加重复文件 %{fileName},该文件已存在",noFilesFound:"这里空空如也",noInternetConnection:"无法连接到网络",noMoreFilesAllowed:"无法添加新文件:已正在上传文件",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"强力驱动于 %{uppy}",processingXFiles:"正在处理 %{smart_count} 个文件",recording:"正在录制",recordingLength:"录制长度 %{recording_length}",recordingStoppedMaxSize:"录像已停止,文件大小即将超过限制",removeFile:"删除文件",resetFilter:"重置筛选器",resume:"恢复",resumeUpload:"恢复上传",retry:"重试",retryUpload:"重试",saveChanges:"保存变更",selectFileNamed:"选择文件 %{name}",selectX:"选择 %{smart_count}",smile:"笑一笑!",startCapturing:"开始屏幕录制",startRecording:"开始视频录制",stopCapturing:"停止屏幕录制",stopRecording:"停止视频录制",streamActive:"视频流已激活",streamPassive:"视频流未激活",submitRecordedFile:"提交已录制视频",takePicture:"拍照",timedOut:"上传已超时 %{seconds} 秒,中止上传",unselectFileNamed:"取消选择文件 %{name}",upload:"上传",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传暂停",uploadXFiles:"上传 %{smart_count} 个文件",uploadXNewFiles:"新上传了 %{smart_count} 个文件",uploading:"正在上传",uploadingXFiles:"正在上传 %{smart_count} 个文件",xFilesSelected:"%{smart_count} 个文件待上传",xMoreFilesAdded:"又有 %{smart_count} 个文件被添加",xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传这些文件类型:%{types}",youCanOnlyUploadX:"您只能上传 %{smart_count} 个文件",youHaveToAtLeastSelectX:"您至少要选择 %{smart_count} 个文件"};typeof Uppy<"u"&&(globalThis.Uppy.locales.zh_CN=Cr);const I0=Cr,Er={strings:{},pluralize(i){return i===1?0:1}};Er.strings={addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},addedNumFiles:"Added %{numFiles} file(s)",addingMoreFiles:"Adding more files",additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",addMore:"Add more",addMoreFiles:"Add more files",allFilesFromFolderNamed:"All files from folder %{name}",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site.",allowAccessTitle:"Please allow access to your camera",allowAudioAccessDescription:"In order to record audio, please allow microphone access for this site.",allowAudioAccessTitle:"Please allow access to your microphone",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)",aspectRatioSquare:"Crop square",authAborted:"Authentication aborted",authenticateWith:"Connect to %{pluginName}",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",back:"Back",browse:"browse",browseFiles:"browse files",browseFolders:"browse folders",cancel:"Cancel",cancelUpload:"Cancel upload",chooseFiles:"Choose files",closeModal:"Close Modal",companionError:"Connection with Companion failed",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",complete:"Complete",compressedX:"Saved %{size} by compressing images",compressingImages:"Compressing images...",connectedToInternet:"Connected to the Internet",copyLink:"Copy link",copyLinkToClipboardFallback:"Copy the URL below",copyLinkToClipboardSuccess:"Link copied to clipboard.",creatingAssembly:"Preparing upload...",creatingAssemblyFailed:"Transloadit: Could not create Assembly",dashboardTitle:"Uppy Dashboard",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dataUploadedOfTotal:"%{complete} of %{total}",discardRecordedFile:"Discard recorded file",done:"Done",dropHereOr:"Drop here or %{browse}",dropHint:"Drop your files here",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",editFile:"Edit file",editImage:"Edit image",editFileWithFilename:"Edit file %{file}",editing:"Editing %{file}",emptyFolderAdded:"No files were added from empty folder",encoding:"Encoding...",enterCorrectUrl:"Incorrect URL: Please make sure you are entering a direct link to a file",enterTextToSearch:"Enter text to search for images",enterUrlToImport:"Enter URL to import a file",error:"Error",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",failedToFetch:"Companion failed to fetch this URL, please make sure it’s correct",failedToUpload:"Failed to upload %{file}",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},filter:"Filter",finishEditingFile:"Finish editing file",flipHorizontal:"Flip horizontal",folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},folderAlreadyAdded:'The folder "%{folder}" was already added',generatingThumbnails:"Generating thumbnails...",import:"Import",importFiles:"Import files from:",importFrom:"Import from %{name}",inferiorSize:"This file is smaller than the allowed size of %{size}",loadedXFiles:"Loaded %{numFiles} files",loading:"Loading...",logOut:"Log out",micDisabled:"Microphone access denied by user",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},myDevice:"My Device",noAudioDescription:"In order to record audio, please connect a microphone or another audio input device",noAudioTitle:"Microphone Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",noCameraTitle:"Camera Not Available",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",noFilesFound:"You have no files or folders here",noInternetConnection:"No Internet connection",noMoreFilesAllowed:"Cannot add more files",noSearchResults:"Unfortunately, there are no results for this search",openFolderNamed:"Open folder %{name}",pause:"Pause",paused:"Paused",pauseUpload:"Pause upload",pluginNameAudio:"Audio",pluginNameBox:"Box",pluginNameCamera:"Camera",pluginNameDropbox:"Dropbox",pluginNameFacebook:"Facebook",pluginNameGoogleDrive:"Google Drive",pluginNameInstagram:"Instagram",pluginNameOneDrive:"OneDrive",pluginNameZoom:"Zoom",poweredBy:"Powered by %{uppy}",processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},recording:"Recording",recordingLength:"Recording length %{recording_length}",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",recordVideoBtn:"Record Video",recoveredAllFiles:"We restored all files. You can now resume the upload.",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},removeFile:"Remove file",reSelect:"Re-select",resetFilter:"Reset filter",resetSearch:"Reset search",resume:"Resume",resumeUpload:"Resume upload",retry:"Retry",retryUpload:"Retry upload",revert:"Revert",rotate:"Rotate",save:"Save",saveChanges:"Save changes",search:"Search",searchImages:"Search for images",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},sessionRestored:"Session restored",showErrorDetails:"Show error details",signInWithGoogle:"Sign in with Google",smile:"Smile!",startAudioRecording:"Begin audio recording",startCapturing:"Begin screen capturing",startRecording:"Begin video recording",stopAudioRecording:"Stop audio recording",stopCapturing:"Stop screen capturing",stopRecording:"Stop video recording",streamActive:"Stream active",streamPassive:"Stream passive",submitRecordedFile:"Submit recorded file",takePicture:"Take a picture",takePictureBtn:"Take Picture",timedOut:"Upload stalled for %{seconds} seconds, aborting.",upload:"Upload",uploadComplete:"Upload complete",uploadFailed:"Upload failed",uploading:"Uploading",uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},uploadPaused:"Upload paused",uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it.",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},xTimeLeft:"%{time} left",youCanOnlyUploadFileTypes:"You can only upload: %{types}",youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},zoomIn:"Zoom in",zoomOut:"Zoom out"};typeof Uppy<"u"&&(globalThis.Uppy.locales.en_US=Er);const U0=Er,N0={zh:Lr({...I0},{strings:{aiKitRequired:"请先安装并配置 AI Kit",aiImageSelectedUse:"使用已选择的图片",aiImageSelectedTip:"请选择心仪的图片",aiImagePrompt:"提示词",aiImagePromptTip:"请输入提示词",aiImageSize:"图片尺寸",aiImageModel:"图片模型",aiImageNumber:"生成数量",aiImageGenerate:"生成图片",aiImageGenerating:"正在生成图片...",browse:"浏览",browseFiles:"浏览文件",browseFolders:"浏览文件夹",dropHereOr:"拖拽文件到这里,或%{browse}",dropHint:"拖拽文件到这里",dropPasteBoth:"拖拽文件到这里、%{browseFiles}或者%{browseFolders}",dropPasteFiles:"拖拽文件到这里或者%{browseFiles}",dropPasteFolders:"拖拽文件到这里或者%{browseFolders}",dropPasteImportBoth:"拖拽文件到这里、粘贴、%{browseFiles}、%{browseFolders}或者通过下方导入:",dropPasteImportFiles:"拖拽文件到这里、粘贴、%{browseFiles}或者通过下方导入:",dropPasteImportFolders:"拖拽文件到这里、粘贴、%{browseFolders}或者通过下方导入:"}}),en:Lr({...U0},{strings:{aiKitRequired:"Install and config the AI Kit component first",aiImageSelectedUse:"Use selected images",aiImageSelectedTip:"Please select images",aiImagePrompt:"Prompt",aiImagePromptTip:"Please enter the prompt",aiImageSize:"Size",aiImageModel:"Model",aiImageNumber:"Number of images",aiImageGenerate:"Generate",aiImageGenerating:"Generating...",browse:"browse",browseFiles:"browse files",browseFolders:"browse folders",dropHint:"Drop your files here",dropPasteBoth:"Drop files here, paste, %{browseFiles} or %{browseFolders}",dropPasteFiles:"Drop files here, paste or %{browseFiles}",dropPasteFolders:"Drop files here, paste or %{browseFolders}",dropPasteImportBoth:"Drop files here, paste, %{browseFiles}, %{browseFolders} or import from:",dropPasteImportFiles:"Drop files here, paste, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, paste, %{browseFolders} or import from:"}})};function gd(i,e){return function(){return i.apply(e,arguments)}}const{toString:L0}=Object.prototype,{getPrototypeOf:kr}=Object,ss=(i=>e=>{const t=L0.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ht=i=>(i=i.toLowerCase(),e=>ss(e)===i),os=i=>e=>typeof e===i,{isArray:Oi}=Array,qn=os("undefined");function B0(i){return i!==null&&!qn(i)&&i.constructor!==null&&!qn(i.constructor)&&He(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const vd=ht("ArrayBuffer");function M0(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&vd(i.buffer),e}const j0=os("string"),He=os("function"),bd=os("number"),rs=i=>i!==null&&typeof i=="object",z0=i=>i===!0||i===!1,Aa=i=>{if(ss(i)!=="object")return!1;const e=kr(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},$0=ht("Date"),q0=ht("File"),H0=ht("Blob"),V0=ht("FileList"),W0=i=>rs(i)&&He(i.pipe),G0=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||He(i.append)&&((e=ss(i))==="formdata"||e==="object"&&He(i.toString)&&i.toString()==="[object FormData]"))},K0=ht("URLSearchParams"),X0=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Yn(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let n,a;if(typeof i!="object"&&(i=[i]),Oi(i))for(n=0,a=i.length;n<a;n++)e.call(null,i[n],n,i);else{const s=t?Object.getOwnPropertyNames(i):Object.keys(i),o=s.length;let r;for(n=0;n<o;n++)r=s[n],e.call(null,i[r],r,i)}}function yd(i,e){e=e.toLowerCase();const t=Object.keys(i);let n=t.length,a;for(;n-- >0;)if(a=t[n],e===a.toLowerCase())return a;return null}const xd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Qo,wd=i=>!qn(i)&&i!==xd;function zo(){const{caseless:i}=wd(this)&&this||{},e={},t=(n,a)=>{const s=i&&yd(e,a)||a;Aa(e[s])&&Aa(n)?e[s]=zo(e[s],n):Aa(n)?e[s]=zo({},n):Oi(n)?e[s]=n.slice():e[s]=n};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&Yn(arguments[n],t);return e}const Q0=(i,e,t,{allOwnKeys:n}={})=>(Yn(e,(a,s)=>{t&&He(a)?i[s]=gd(a,t):i[s]=a},{allOwnKeys:n}),i),Y0=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),J0=(i,e,t,n)=>{i.prototype=Object.create(e.prototype,n),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},Z0=(i,e,t,n)=>{let a,s,o;const r={};if(e=e||{},i==null)return e;do{for(a=Object.getOwnPropertyNames(i),s=a.length;s-- >0;)o=a[s],(!n||n(o,i,e))&&!r[o]&&(e[o]=i[o],r[o]=!0);i=t!==!1&&kr(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},e1=(i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;const n=i.indexOf(e,t);return n!==-1&&n===t},t1=i=>{if(!i)return null;if(Oi(i))return i;let e=i.length;if(!bd(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},i1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&kr(Uint8Array)),n1=(i,e)=>{const n=(i&&i[Symbol.iterator]).call(i);let a;for(;(a=n.next())&&!a.done;){const s=a.value;e.call(i,s[0],s[1])}},a1=(i,e)=>{let t;const n=[];for(;(t=i.exec(e))!==null;)n.push(t);return n},s1=ht("HTMLFormElement"),o1=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,a){return n.toUpperCase()+a}),kc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),r1=ht("RegExp"),Pd=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),n={};Yn(t,(a,s)=>{let o;(o=e(a,s,i))!==!1&&(n[s]=o||a)}),Object.defineProperties(i,n)},l1=i=>{Pd(i,(e,t)=>{if(He(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=i[t];if(He(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},c1=(i,e)=>{const t={},n=a=>{a.forEach(s=>{t[s]=!0})};return Oi(i)?n(i):n(String(i).split(e)),t},u1=()=>{},p1=(i,e)=>(i=+i,Number.isFinite(i)?i:e),Gs="abcdefghijklmnopqrstuvwxyz",Tc="0123456789",Sd={DIGIT:Tc,ALPHA:Gs,ALPHA_DIGIT:Gs+Gs.toUpperCase()+Tc},d1=(i=16,e=Sd.ALPHA_DIGIT)=>{let t="";const{length:n}=e;for(;i--;)t+=e[Math.random()*n|0];return t};function h1(i){return!!(i&&He(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}const m1=i=>{const e=new Array(10),t=(n,a)=>{if(rs(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[a]=n;const s=Oi(n)?[]:{};return Yn(n,(o,r)=>{const l=t(o,a+1);!qn(l)&&(s[r]=l)}),e[a]=void 0,s}}return n};return t(i,0)},f1=ht("AsyncFunction"),g1=i=>i&&(rs(i)||He(i))&&He(i.then)&&He(i.catch),C={isArray:Oi,isArrayBuffer:vd,isBuffer:B0,isFormData:G0,isArrayBufferView:M0,isString:j0,isNumber:bd,isBoolean:z0,isObject:rs,isPlainObject:Aa,isUndefined:qn,isDate:$0,isFile:q0,isBlob:H0,isRegExp:r1,isFunction:He,isStream:W0,isURLSearchParams:K0,isTypedArray:i1,isFileList:V0,forEach:Yn,merge:zo,extend:Q0,trim:X0,stripBOM:Y0,inherits:J0,toFlatObject:Z0,kindOf:ss,kindOfTest:ht,endsWith:e1,toArray:t1,forEachEntry:n1,matchAll:a1,isHTMLForm:s1,hasOwnProperty:kc,hasOwnProp:kc,reduceDescriptors:Pd,freezeMethods:l1,toObjectSet:c1,toCamelCase:o1,noop:u1,toFiniteNumber:p1,findKey:yd,global:xd,isContextDefined:wd,ALPHABET:Sd,generateString:d1,isSpecCompliantForm:h1,toJSONObject:m1,isAsyncFn:f1,isThenable:g1};function V(i,e,t,n,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),a&&(this.response=a)}C.inherits(V,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:C.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Fd=V.prototype,_d={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{_d[i]={value:i}});Object.defineProperties(V,_d);Object.defineProperty(Fd,"isAxiosError",{value:!0});V.from=(i,e,t,n,a,s)=>{const o=Object.create(Fd);return C.toFlatObject(i,o,function(l){return l!==Error.prototype},r=>r!=="isAxiosError"),V.call(o,i.message,e,t,n,a),o.cause=i,o.name=i.name,s&&Object.assign(o,s),o};const v1=null;function $o(i){return C.isPlainObject(i)||C.isArray(i)}function Cd(i){return C.endsWith(i,"[]")?i.slice(0,-2):i}function Oc(i,e,t){return i?i.concat(e).map(function(a,s){return a=Cd(a),!t&&s?"["+a+"]":a}).join(t?".":""):e}function b1(i){return C.isArray(i)&&!i.some($o)}const y1=C.toFlatObject(C,{},null,function(e){return/^is[A-Z]/.test(e)});function ls(i,e,t){if(!C.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=C.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,f){return!C.isUndefined(f[v])});const n=t.metaTokens,a=t.visitor||p,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&C.isSpecCompliantForm(e);if(!C.isFunction(a))throw new TypeError("visitor must be a function");function c(m){if(m===null)return"";if(C.isDate(m))return m.toISOString();if(!l&&C.isBlob(m))throw new V("Blob is not supported. Use a Buffer instead.");return C.isArrayBuffer(m)||C.isTypedArray(m)?l&&typeof Blob=="function"?new Blob([m]):At.from(m):m}function p(m,v,f){let y=m;if(m&&!f&&typeof m=="object"){if(C.endsWith(v,"{}"))v=n?v:v.slice(0,-2),m=JSON.stringify(m);else if(C.isArray(m)&&b1(m)||(C.isFileList(m)||C.endsWith(v,"[]"))&&(y=C.toArray(m)))return v=Cd(v),y.forEach(function(S,A){!(C.isUndefined(S)||S===null)&&e.append(o===!0?Oc([v],A,s):o===null?v:v+"[]",c(S))}),!1}return $o(m)?!0:(e.append(Oc(f,v,s),c(m)),!1)}const u=[],h=Object.assign(y1,{defaultVisitor:p,convertValue:c,isVisitable:$o});function g(m,v){if(!C.isUndefined(m)){if(u.indexOf(m)!==-1)throw Error("Circular reference detected in "+v.join("."));u.push(m),C.forEach(m,function(y,F){(!(C.isUndefined(y)||y===null)&&a.call(e,y,C.isString(F)?F.trim():F,v,h))===!0&&g(y,v?v.concat(F):[F])}),u.pop()}}if(!C.isObject(i))throw new TypeError("data must be an object");return g(i),e}function Ac(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Tr(i,e){this._pairs=[],i&&ls(i,this,e)}const Ed=Tr.prototype;Ed.append=function(e,t){this._pairs.push([e,t])};Ed.toString=function(e){const t=e?function(n){return e.call(this,n,Ac)}:Ac;return this._pairs.map(function(a){return t(a[0])+"="+t(a[1])},"").join("&")};function x1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function kd(i,e,t){if(!e)return i;const n=t&&t.encode||x1,a=t&&t.serialize;let s;if(a?s=a(e,t):s=C.isURLSearchParams(e)?e.toString():new Tr(e,t).toString(n),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Dc{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){C.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Td={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},w1=typeof URLSearchParams<"u"?URLSearchParams:Tr,P1=typeof FormData<"u"?FormData:null,S1=typeof Blob<"u"?Blob:null,F1={isBrowser:!0,classes:{URLSearchParams:w1,FormData:P1,Blob:S1},protocols:["http","https","file","blob","url","data"]},Od=typeof window<"u"&&typeof document<"u",_1=(i=>Od&&["ReactNative","NativeScript","NS"].indexOf(i)<0)(typeof navigator<"u"&&navigator.product),C1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",E1=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Od,hasStandardBrowserEnv:_1,hasStandardBrowserWebWorkerEnv:C1},Symbol.toStringTag,{value:"Module"})),st={...E1,...F1};function k1(i,e){return ls(i,new st.classes.URLSearchParams,Object.assign({visitor:function(t,n,a,s){return st.isNode&&C.isBuffer(t)?(this.append(n,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function T1(i){return C.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function O1(i){const e={},t=Object.keys(i);let n;const a=t.length;let s;for(n=0;n<a;n++)s=t[n],e[s]=i[s];return e}function Ad(i){function e(t,n,a,s){let o=t[s++];if(o==="__proto__")return!0;const r=Number.isFinite(+o),l=s>=t.length;return o=!o&&C.isArray(a)?a.length:o,l?(C.hasOwnProp(a,o)?a[o]=[a[o],n]:a[o]=n,!r):((!a[o]||!C.isObject(a[o]))&&(a[o]=[]),e(t,n,a[o],s)&&C.isArray(a[o])&&(a[o]=O1(a[o])),!r)}if(C.isFormData(i)&&C.isFunction(i.entries)){const t={};return C.forEachEntry(i,(n,a)=>{e(T1(n),a,t,0)}),t}return null}function A1(i,e,t){if(C.isString(i))try{return(e||JSON.parse)(i),C.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(i)}const Or={transitional:Td,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",a=n.indexOf("application/json")>-1,s=C.isObject(e);if(s&&C.isHTMLForm(e)&&(e=new FormData(e)),C.isFormData(e))return a?JSON.stringify(Ad(e)):e;if(C.isArrayBuffer(e)||C.isBuffer(e)||C.isStream(e)||C.isFile(e)||C.isBlob(e))return e;if(C.isArrayBufferView(e))return e.buffer;if(C.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let r;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return k1(e,this.formSerializer).toString();if((r=C.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return ls(r?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||a?(t.setContentType("application/json",!1),A1(e)):e}],transformResponse:[function(e){const t=this.transitional||Or.transitional,n=t&&t.forcedJSONParsing,a=this.responseType==="json";if(e&&C.isString(e)&&(n&&!this.responseType||a)){const o=!(t&&t.silentJSONParsing)&&a;try{return JSON.parse(e)}catch(r){if(o)throw r.name==="SyntaxError"?V.from(r,V.ERR_BAD_RESPONSE,this,null,this.response):r}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:st.classes.FormData,Blob:st.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};C.forEach(["delete","get","head","post","put","patch"],i=>{Or.headers[i]={}});const Ar=Or,D1=C.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),R1=i=>{const e={};let t,n,a;return i&&i.split(`
|
|
41
41
|
`).forEach(function(o){a=o.indexOf(":"),t=o.substring(0,a).trim().toLowerCase(),n=o.substring(a+1).trim(),!(!t||e[t]&&D1[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},Rc=Symbol("internals");function nn(i){return i&&String(i).trim().toLowerCase()}function Da(i){return i===!1||i==null?i:C.isArray(i)?i.map(Da):String(i)}function I1(i){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=t.exec(i);)e[n[1]]=n[2];return e}const U1=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function Ks(i,e,t,n,a){if(C.isFunction(n))return n.call(this,e,t);if(a&&(e=t),!!C.isString(e)){if(C.isString(n))return e.indexOf(n)!==-1;if(C.isRegExp(n))return n.test(e)}}function N1(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function L1(i,e){const t=C.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(i,n+t,{value:function(a,s,o){return this[n].call(this,e,a,s,o)},configurable:!0})})}class cs{constructor(e){e&&this.set(e)}set(e,t,n){const a=this;function s(r,l,c){const p=nn(l);if(!p)throw new Error("header name must be a non-empty string");const u=C.findKey(a,p);(!u||a[u]===void 0||c===!0||c===void 0&&a[u]!==!1)&&(a[u||l]=Da(r))}const o=(r,l)=>C.forEach(r,(c,p)=>s(c,p,l));return C.isPlainObject(e)||e instanceof this.constructor?o(e,t):C.isString(e)&&(e=e.trim())&&!U1(e)?o(R1(e),t):e!=null&&s(t,e,n),this}get(e,t){if(e=nn(e),e){const n=C.findKey(this,e);if(n){const a=this[n];if(!t)return a;if(t===!0)return I1(a);if(C.isFunction(t))return t.call(this,a,n);if(C.isRegExp(t))return t.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=nn(e),e){const n=C.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Ks(this,this[n],n,t)))}return!1}delete(e,t){const n=this;let a=!1;function s(o){if(o=nn(o),o){const r=C.findKey(n,o);r&&(!t||Ks(n,n[r],r,t))&&(delete n[r],a=!0)}}return C.isArray(e)?e.forEach(s):s(e),a}clear(e){const t=Object.keys(this);let n=t.length,a=!1;for(;n--;){const s=t[n];(!e||Ks(this,this[s],s,e,!0))&&(delete this[s],a=!0)}return a}normalize(e){const t=this,n={};return C.forEach(this,(a,s)=>{const o=C.findKey(n,s);if(o){t[o]=Da(a),delete t[s];return}const r=e?N1(s):String(s).trim();r!==s&&delete t[s],t[r]=Da(a),n[r]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return C.forEach(this,(n,a)=>{n!=null&&n!==!1&&(t[a]=e&&C.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
42
42
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(a=>n.set(a)),n}static accessor(e){const n=(this[Rc]=this[Rc]={accessors:{}}).accessors,a=this.prototype;function s(o){const r=nn(o);n[r]||(L1(a,o),n[r]=!0)}return C.isArray(e)?e.forEach(s):s(e),this}}cs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);C.reduceDescriptors(cs.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(n){this[t]=n}}});C.freezeMethods(cs);const Ot=cs;function Xs(i,e){const t=this||Ar,n=e||t,a=Ot.from(n.headers);let s=n.data;return C.forEach(i,function(r){s=r.call(t,s,a.normalize(),e?e.status:void 0)}),a.normalize(),s}function Dd(i){return!!(i&&i.__CANCEL__)}function Jn(i,e,t){V.call(this,i??"canceled",V.ERR_CANCELED,e,t),this.name="CanceledError"}C.inherits(Jn,V,{__CANCEL__:!0});function B1(i,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?i(t):e(new V("Request failed with status code "+t.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const M1=st.hasStandardBrowserEnv?{write(i,e,t,n,a,s){const o=[i+"="+encodeURIComponent(e)];C.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),C.isString(n)&&o.push("path="+n),C.isString(a)&&o.push("domain="+a),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(i){const e=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(i){this.write(i,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function j1(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function z1(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function Rd(i,e){return i&&!j1(e)?z1(i,e):e}const $1=st.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function a(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=a(window.location.href),function(o){const r=C.isString(o)?a(o):o;return r.protocol===n.protocol&&r.host===n.host}}():function(){return function(){return!0}}();function q1(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function H1(i,e){i=i||10;const t=new Array(i),n=new Array(i);let a=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),p=n[s];o||(o=c),t[a]=l,n[a]=c;let u=s,h=0;for(;u!==a;)h+=t[u++],u=u%i;if(a=(a+1)%i,a===s&&(s=(s+1)%i),c-o<e)return;const g=p&&c-p;return g?Math.round(h*1e3/g):void 0}}function Ic(i,e){let t=0;const n=H1(50,250);return a=>{const s=a.loaded,o=a.lengthComputable?a.total:void 0,r=s-t,l=n(r),c=s<=o;t=s;const p={loaded:s,total:o,progress:o?s/o:void 0,bytes:r,rate:l||void 0,estimated:l&&o&&c?(o-s)/l:void 0,event:a};p[e?"download":"upload"]=!0,i(p)}}const V1=typeof XMLHttpRequest<"u",W1=V1&&function(i){return new Promise(function(t,n){let a=i.data;const s=Ot.from(i.headers).normalize();let{responseType:o,withXSRFToken:r}=i,l;function c(){i.cancelToken&&i.cancelToken.unsubscribe(l),i.signal&&i.signal.removeEventListener("abort",l)}let p;if(C.isFormData(a)){if(st.hasStandardBrowserEnv||st.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((p=s.getContentType())!==!1){const[v,...f]=p?p.split(";").map(y=>y.trim()).filter(Boolean):[];s.setContentType([v||"multipart/form-data",...f].join("; "))}}let u=new XMLHttpRequest;if(i.auth){const v=i.auth.username||"",f=i.auth.password?unescape(encodeURIComponent(i.auth.password)):"";s.set("Authorization","Basic "+btoa(v+":"+f))}const h=Rd(i.baseURL,i.url);u.open(i.method.toUpperCase(),kd(h,i.params,i.paramsSerializer),!0),u.timeout=i.timeout;function g(){if(!u)return;const v=Ot.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),y={data:!o||o==="text"||o==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:v,config:i,request:u};B1(function(S){t(S),c()},function(S){n(S),c()},y),u=null}if("onloadend"in u?u.onloadend=g:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(g)},u.onabort=function(){u&&(n(new V("Request aborted",V.ECONNABORTED,i,u)),u=null)},u.onerror=function(){n(new V("Network Error",V.ERR_NETWORK,i,u)),u=null},u.ontimeout=function(){let f=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const y=i.transitional||Td;i.timeoutErrorMessage&&(f=i.timeoutErrorMessage),n(new V(f,y.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,i,u)),u=null},st.hasStandardBrowserEnv&&(r&&C.isFunction(r)&&(r=r(i)),r||r!==!1&&$1(h))){const v=i.xsrfHeaderName&&i.xsrfCookieName&&M1.read(i.xsrfCookieName);v&&s.set(i.xsrfHeaderName,v)}a===void 0&&s.setContentType(null),"setRequestHeader"in u&&C.forEach(s.toJSON(),function(f,y){u.setRequestHeader(y,f)}),C.isUndefined(i.withCredentials)||(u.withCredentials=!!i.withCredentials),o&&o!=="json"&&(u.responseType=i.responseType),typeof i.onDownloadProgress=="function"&&u.addEventListener("progress",Ic(i.onDownloadProgress,!0)),typeof i.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",Ic(i.onUploadProgress)),(i.cancelToken||i.signal)&&(l=v=>{u&&(n(!v||v.type?new Jn(null,i,u):v),u.abort(),u=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const m=q1(h);if(m&&st.protocols.indexOf(m)===-1){n(new V("Unsupported protocol "+m+":",V.ERR_BAD_REQUEST,i));return}u.send(a||null)})},qo={http:v1,xhr:W1};C.forEach(qo,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const Uc=i=>`- ${i}`,G1=i=>C.isFunction(i)||i===null||i===!1,Id={getAdapter:i=>{i=C.isArray(i)?i:[i];const{length:e}=i;let t,n;const a={};for(let s=0;s<e;s++){t=i[s];let o;if(n=t,!G1(t)&&(n=qo[(o=String(t)).toLowerCase()],n===void 0))throw new V(`Unknown adapter '${o}'`);if(n)break;a[o||"#"+s]=n}if(!n){const s=Object.entries(a).map(([r,l])=>`adapter ${r} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since :
|
|
43
43
|
`+s.map(Uc).join(`
|
|
@@ -56,5 +56,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
56
56
|
<div class="uppy-ProviderBrowserItem-inner uploaded-add-item">
|
|
57
57
|
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="#ffffff"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"/></svg>
|
|
58
58
|
</div>
|
|
59
|
-
`,n.addEventListener("click",async()=>{await this.uppy.openPlugin("My Device")}),t.insertBefore(n,t.firstChild),this.addUploadItemFlag=!1}}},{wait:200}));Oe(this,"convertImgToObject",to(()=>{this.canConvertImgToObject&&(document.querySelectorAll("#uploaded img").forEach(n=>{if([".mp4",".webm"].find(a=>{var s;return((s=n.src)==null?void 0:s.indexOf(a))>-1})){const a=document.createElement("video");a.src=n.src,a.width=n.width,a.height=n.height,a.autoplay=!0,a.muted=!0,a.loop=!0,a.style="pointer-events: none;",n.parentNode.replaceChild(a,n)}}),this.canConvertImgToObject=!1)},{wait:200}));Oe(this,"resetState",()=>{this.uploadedAPIData={...Qc},this.uploaded.setPluginState({...Yc}),this.addUploadItemFlag=!0});this.id=this.opts.id||"Uploaded",this.title=this.opts.title||"Uploaded",this.params=this.opts.params||{},this.type="acquirer",this.uppy=t,this.uploadedAPIData={...Qc},this.addUploadItemFlag=!0,this.icon=()=>me("svg",{"aria-hidden":"true",focusable:"false",width:"18",height:"18",viewBox:"0 0 1024 1024",children:[me("path",{d:"M145.6 0c-44.8 0-80 36.8-80 81.6V944c0 44.8 35.2 80 80 80h732.8c44.8 0 81.6-35.2 81.6-80V326.4L657.6 0h-512z",fill:"#49C9A7"}),me("path",{d:"M960 326.4v16H755.2s-100.8-20.8-99.2-108.8c0 0 4.8 92.8 97.6 92.8H960z",fill:"#49C9A7"}),me("path",{d:"M657.6 0v233.6c0 25.6 17.6 92.8 97.6 92.8H960L657.6 0z",fill:"#37BB91"}),me("path",{d:"M225.6 859.2V524.8H560v334.4H225.6z m300.8-300.8H259.2v201.6h267.2V558.4z m-153.6 134.4l62.4-84.8 20.8 33.6 20.8-6.4 16 89.6H283.2l56-52.8 33.6 20.8z m-60.8-59.2c-14.4 0-27.2-9.6-27.2-24 0-12.8 12.8-24 27.2-24 14.4 0 25.6 11.2 25.6 24 0 14.4-11.2 24-25.6 24z",fill:"#FFFFFF"})]})}render(t){var n;return!this.uploadedAPIData.loading&&((n=this.uploadedAPIData.files)==null?void 0:n.length)===0&&this.queryUploadedFromMediaKit(),me("div",{id:"uploaded",className:"uploaded",children:this.view.render(t)})}update(){this.convertImgToObject(),this.addUploadItem()}onFirstRender(){}install(){this.view=new ea(this,{viewType:"grid",showBreadcrumbs:!1,showFilter:!1}),this.uploaded=this.view.plugin,this.uploaded.setPluginState({...Yc}),this.uploaded.uppy.on("dashboard:show-panel",this.resetState),this.view.toggleCheckbox=(n,a)=>{const{currentSelection:s}=this.uploaded.getPluginState(),o=this.uploaded.uppy.opts.restrictions.maxNumberOfFiles,r=o?s.length<o:!0;s.find(l=>l._id===a._id)?this.uploaded.setPluginState({currentSelection:[...s.filter(l=>l._id!==a._id)]}):(r||s.pop(),this.uploaded.setPluginState({currentSelection:[...s,a]}))},this.view.donePicking=()=>{const{currentSelection:n}=this.uploaded.getPluginState();this.uppy.emit("uploaded:selected",n),this.uploaded.parent.hideAllPanels()},this.uploaded.uppy.validateRestrictions=()=>!1,this.view.handleScroll=n=>{const{scrollHeight:a,scrollTop:s,offsetHeight:o}=n.target;a-(s+o)<30&&this.queryUploadedFromMediaKit()};const{target:t}=this.opts;t&&this.mount(t,this)}uninstall(){this.unmount(),this.uploaded.uppy.off("dashboard:show-panel",this.resetState)}}const qw=$w,Jc={initialized:!1,data:[],files:[],pageSize:16,page:1,loading:!1,hasMore:!0,folderId:"",componentDid:"",components:[]},Zc={authenticated:!0,files:[],folders:[],breadcrumbs:[],filterInput:"",isSearchVisible:!1,currentSelection:[],loading:!0,loadAllFiles:!0},Gd={padding:"5px 15px",marginRight:"8px",marginTop:"8px",borderRadius:"4px",cursor:"pointer",border:"1px solid rgb(29, 193, 199)",color:"rgb(29, 193, 199)",backgroundColor:"transparent",fontSize:"14px",lineHeight:"24.5px",fontWeight:"bold"},Hw={...Gd,color:"#fff",backgroundColor:"rgb(29, 193, 199)"};class Vw extends ye{constructor(t,n){super(t,n);Oe(this,"queryResources",async()=>{if(!this.apiData.loading){this.apiData.loading=!0;const{data:t}=await Ai.get("/api/resources",{params:{componentDid:this.apiData.componentDid}});this.apiData.loading=!1,this.apiData.initialized=!0,this.apiData.components=t.components||[],this.apiData.componentDid=t.componentDid||"",this.apiData.files=cu([...t.resources.map(n=>{let a="file";const{filename:s}=n,o=Xa(s);return a=Xa(s,400),{filename:s,_id:s,id:s,name:s,icon:a,previewUrl:a,fileUrl:o}})],"id"),this.resources.setPluginState({files:this.apiData.files,loading:!1})}});Oe(this,"resetState",()=>{this.apiData={...Jc},this.resources.setPluginState({...Zc})});this.id=this.opts.id||"Resources",this.title=this.opts.title||"Resources",this.params=this.opts.params||{},this.type="acquirer",this.uppy=t,this.componentDid="",this.apiData={...Jc},this.icon=()=>me("svg",{t:"1700146012231",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"15673",width:"200",height:"200",children:[me("path",{d:"M403.2 130.133333h-187.733333c-46.933333 0-85.333333 38.4-85.333334 85.333334v187.733333c0 46.933333 38.4 85.333333 85.333334 85.333333h187.733333c46.933333 0 85.333333-38.4 85.333333-85.333333v-187.733333c0-49.066667-38.4-85.333333-85.333333-85.333334zM426.666667 390.4c0 19.2-17.066667 36.266667-36.266667 36.266667h-160c-21.333333 0-38.4-17.066667-38.4-36.266667v-162.133333c0-19.2 17.066667-36.266667 36.266667-36.266667h160c19.2 0 36.266667 17.066667 36.266666 36.266667v162.133333z",fill:"#0171F1","p-id":"15674"}),me("path",{d:"M808.533333 130.133333h-187.733333c-46.933333 0-85.333333 38.4-85.333333 85.333334v187.733333c0 46.933333 38.4 85.333333 85.333333 85.333333h187.733333c46.933333 0 85.333333-38.4 85.333334-85.333333v-187.733333c0-49.066667-36.266667-85.333333-85.333334-85.333334zM832 390.4c0 19.2-17.066667 36.266667-36.266667 36.266667h-160c-19.2 0-36.266667-17.066667-36.266666-36.266667v-162.133333c-2.133333-19.2 14.933333-36.266667 34.133333-36.266667h160c19.2 0 36.266667 17.066667 36.266667 36.266667v162.133333zM403.2 535.466667h-187.733333c-46.933333 0-85.333333 38.4-85.333334 85.333333V810.666667c0 46.933333 38.4 85.333333 85.333334 85.333333h187.733333c46.933333 0 85.333333-38.4 85.333333-85.333333v-189.866667c0-46.933333-38.4-85.333333-85.333333-85.333333zM426.666667 795.733333c0 21.333333-17.066667 36.266667-36.266667 36.266667h-162.133333c-21.333333 0-36.266667-17.066667-36.266667-36.266667v-162.133333c0-21.333333 17.066667-36.266667 36.266667-36.266667h162.133333c19.2 0 36.266667 17.066667 36.266667 36.266667v162.133333z",fill:"#55ABE5","p-id":"15675"}),me("path",{d:"M808.533333 535.466667h-187.733333c-46.933333 0-85.333333 38.4-85.333333 85.333333V810.666667c0 46.933333 38.4 85.333333 85.333333 85.333333h187.733333c46.933333 0 85.333333-38.4 85.333334-85.333333v-189.866667c0-46.933333-36.266667-85.333333-85.333334-85.333333zM832 795.733333c0 21.333333-17.066667 36.266667-36.266667 36.266667h-162.133333c-19.2 0-36.266667-17.066667-36.266667-36.266667v-162.133333c0-21.333333 17.066667-36.266667 36.266667-36.266667h162.133333c21.333333 0 36.266667 17.066667 36.266667 36.266667v162.133333z",fill:"#0171F1","p-id":"15676"})]})}render(t){return!this.apiData.loading&&!this.apiData.initialized&&this.queryResources(),me("div",{id:"resources",className:"uploaded",children:[me("div",{style:{padding:this.apiData.components.length?"12px":"0",backgroundColor:"#fff",display:"flex",flexWrap:"wrap",marginTop:"-8px"},children:this.apiData.components.map(n=>me("button",{style:this.apiData.componentDid===n.did?Hw:Gd,id:n.componentDid,onClick:()=>{this.apiData.componentDid!==n.did&&(this.apiData.componentDid=n.did,this.queryResources())},children:fh(n.name)}))}),this.view.render(t)]})}update(){}onFirstRender(){}install(){this.view=new ea(this,{viewType:"grid",showBreadcrumbs:!1,showFilter:!1}),this.resources=this.view.plugin,this.resources.setPluginState({...Zc}),this.resources.uppy.on("dashboard:show-panel",this.resetState),this.view.toggleCheckbox=(n,a)=>{const{currentSelection:s}=this.resources.getPluginState(),o=this.resources.uppy.opts.restrictions.maxNumberOfFiles,r=o?s.length<o:!0;s.find(l=>l.id===a.id)?this.resources.setPluginState({currentSelection:[...s.filter(l=>l.id!==a.id)]}):(r||s.pop(),this.resources.setPluginState({currentSelection:[...s,a]}))},this.resources.uppy.validateRestrictions=()=>!1,this.view.donePicking=()=>{const{currentSelection:n}=this.resources.getPluginState();this.uppy.emit("uploaded:selected",n),this.resources.parent.hideAllPanels()};const{target:t}=this.opts;t&&this.mount(t,this)}uninstall(){this.unmount(),this.resources.uppy.off("dashboard:show-panel",this.resetState)}}const Ww=Vw;var Gw=ih();const Kw=tt(Gw);class Xw extends ye{constructor(t,n){super(t,{...{},...n});Oe(this,"setHashFileName",async t=>{const{id:n}=t,a=this.uppy.getFile(n);if(a){const{data:s}=a,o=1024*1024*5,r=s.slice(0,o),l=Kw.createHash("md5").update(await r.text()).digest("hex"),c=Wo(a),p=`${l}${c?`.${c}`:""}`;this.uppy.setFileState(n,{hashFileName:p})}});Oe(this,"setMetaData",async t=>{const{id:n}=t,a=this.uppy.getFile(n);if(a){const{data:{relativePath:s,name:o},hashFileName:r}=a,l=s||o||r;this.uppy.setFileMeta(n,{relativePath:l,name:l})}});Oe(this,"prepareUploadWrapper",async t=>{await this.tryDownloadRemoteFile(t),await this.getPreviewFromData(t),await this.setHashFileName(t),await this.setMetaData(t)});Oe(this,"tryDownloadRemoteFile",async t=>{var A,D;const{type:n,name:a,preview:s,source:o,isRemote:r,isDownloading:l,id:c,isLoading:p,remote:u,meta:h,errorCount:g=0}=t,m=!p&&r,v=`uploader:${c}:downloaded`,f=Wo(t),y=(A=a==null?void 0:a.split("?"))==null?void 0:A[0],S=(()=>{const x=["jpg","jpeg"];return x.includes(f)&&x.some(_=>y==null?void 0:y.endsWith(_))?!0:y==null?void 0:y.endsWith(f)})()?y:`${y}${f?`.${f}`:""}`;if(m){const x=aw(s||((D=u==null?void 0:u.body)==null?void 0:D.url));if(g>=3)throw new Error("Download remote file failure");this.uppy.setFileState(c,{isLoading:!0,isDownloading:!0,size:null,meta:{...h,name:this.i18n("loading")}}),await Ai.get(`${this.opts.companionUrl}/proxy`,{responseType:"blob",params:{url:x}}).then(_=>_==null?void 0:_.data).then(async _=>{const O=iw(_,S);this.uppy.setFileState(c,{name:S,extension:f,type:n,data:O,preview:s||Mc(O),source:o,size:O.size,isDownloading:!1,isRemote:!1,meta:{...h,name:S,filename:S}}),this.uppy.getFile(c),this.uppy.emit(v,c)}).catch(async _=>{console.error("Axios download remote file error: ",_),this.uppy.setFileState(c,{isRemote:!0,isLoading:!1,errorCount:g+1}),await this.tryDownloadRemoteFile(this.uppy.getFile(c))})}else l&&await(async()=>new Promise(_=>{this.uppy.once(v,async()=>{_()})}))()});Oe(this,"getPreviewFromData",t=>{const{id:n}=t,a=this.uppy.getFile(n);if(a){const{data:s,type:o,preview:r}=a;(o.indexOf("gif")>-1||!r)&&s&&o.indexOf("image")>-1&&setTimeout(()=>{this.uppy.setFileState(n,{preview:Mc(s)})},o.indexOf("gif")>-1?1e3:0)}});Oe(this,"prepareUpload",t=>{const n=t.map(async s=>{const o=this.uppy.getFile(s);o.isDownloading&&this.uppy.emit("preprocess-progress",o,{mode:"indeterminate",message:this.i18n("loading")}),await this.prepareUploadWrapper(o)}),a=()=>{t.forEach(s=>{const o=this.uppy.getFile(s);this.uppy.emit("preprocess-complete",o)})};return Promise.all(n).then(a)});this.id=this.opts.id||"DownloadRemoteFiles",this.type="modifier",this.i18nInit()}install(){this.uppy.addPreProcessor(this.prepareUpload),this.uppy.on("file-added",async t=>{setTimeout(()=>{this.prepareUploadWrapper(t)},200)}),this.uppy.on("file-editor:complete",t=>{this.getPreviewFromData(t)})}uninstall(){this.uppy.removePreProcessor(this.prepareUpload)}}const Qw=Xw;class Yw extends ye{constructor(e,t){super(e,t),this.id=this.opts.id||"AIImage",this.title=this.opts.title||"AI Image",this.type="acquirer",this.uppy=e,this.i18nInit(),this.icon=()=>me("svg",{width:"20",height:"20",viewBox:"0 0 24 24",children:me("g",{fill:"none",stroke:"#a482fe","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",children:[me("path",{d:"M15 8h.01M10 21H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v5"}),me("path",{d:"m3 16l5-5c.928-.893 2.072-.893 3 0l1 1m2 9v-4a2 2 0 1 1 4 0v4m-4-2h4m3-4v6"})]})})}render(){return me("div",{id:"ai-image",className:"ai-image",children:me("div",{style:{height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:this.i18n("loading")})})}update(){}onFirstRender(){}install(){const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}}const Jw=Yw,Zw="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9",e3=ne.lazy(()=>ou(()=>import("./index-CJpqNyVi.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47]))),eu="uploader-container",va="uploader-dashboard",Ko=localStorage.getItem("uppy_debug"),t3=i=>{var r,l;const{apiPathProps:e,availablePluginMap:t={},uploadedProps:n}=i,a=Md(e==null?void 0:e.companion),s=async c=>(await Ai.post("/api/image/generations",c)).data,o={maxFileSize:1/0,...(r=i==null?void 0:i.coreProps)==null?void 0:r.restrictions};return[{id:"ImageEditor",plugin:$p,options:{quality:1},alwayUse:!0},(Ko||xn()&&!jc())&&{id:"Uploaded",plugin:qw,options:{params:n==null?void 0:n.params}},(Ko||xn()&&!jc())&&{id:"Resources",plugin:Ww,options:{params:n==null?void 0:n.params}},xn()&&sw()&&t.AIImage&&{id:"AIImage",plugin:Jw,options:{companionUrl:a},onShowPanel:c=>{function p(){setTimeout(()=>{var h,g;const u=document.getElementById("ai-image");u?ch(u).render($e.jsx(e3,{api:s,restrictions:o,i18n:(g=(h=c.current)==null?void 0:h.getUploader())==null?void 0:g.i18n,onSelect:m=>{const v=c.current.getUploader();v==null||v.emit("ai-image:selected",m),m.forEach((f,y)=>{const F=`AI Image [${y+1}].png`,S={name:F,type:"image/png",data:nw(f,F),source:"AIImage",isRemote:!1};v==null||v.addFile(S)})}})):p()},100)}p()}},{id:"Url",plugin:Vn,options:{companionUrl:a}},{id:"Webcam",plugin:Fu,options:{}},!!((l=window==null?void 0:window.blocklet)!=null&&l.UNSPLASH_KEY)&&t.Unsplash&&{id:"Unsplash",plugin:$u,options:{companionUrl:a,companionHeaders:{},companionCookiesRule:"same-origin"}},{id:"PrepareUpload",plugin:Qw,options:{companionUrl:a},alwayUse:!0},{id:"ThumbnailGeneratorNext",plugin:pr,options:{thumbnailType:"image/png",thumbnailWidth:800},alwayUse:!0}].filter(Boolean)};function Ir(i){const{id:e,plugins:t,locale:n,onAfterResponse:a,onUploadFinish:s,coreProps:o,apiPathProps:r,tusProps:l,dropTargetProps:c,pluginList:p}=i,u=uu(p,"id"),h=Md(r==null?void 0:r.uploader);let g=new xu({id:e,meta:{uploaderId:e},debug:["true",!0].includes(Ko||""),locale:Nx[n||"en"],...o}).use(fd,{chunkSize:1024*1024*10,removeFingerprintOnSuccess:!0,withCredentials:!0,endpoint:h,async onBeforeRequest(m,v){var D;const{hashFileName:f,id:y,meta:F}=v,S=Wo(v);m.setHeader("x-uploader-file-name",`${f}`),m.setHeader("x-uploader-file-id",`${y}`),m.setHeader("x-uploader-file-ext",`${S}`),m.setHeader("x-uploader-base-url",new URL(m.getURL()).pathname),m.setHeader("x-uploader-endpoint-url",h),m.setHeader("x-uploader-metadata",JSON.stringify(F,(x,_)=>typeof _=="string"?encodeURIComponent(_):_));const A=(window==null?void 0:window.uploaderComponentId)||((D=window==null?void 0:window.blocklet)==null?void 0:D.componentId);A&&m.setHeader("x-component-did",(A||"").split("/").pop())},onAfterResponse:async(m,v)=>{const f={},y=m.getUnderlyingObject();try{y.response&&(f.data=JSON.parse(y.response))}catch{f.data={}}f.method=m.getMethod().toUpperCase(),f.url=m.getURL(),f.status=y.status,f.headers={...m._headers};const F=y.getAllResponseHeaders();if(F&&F.split(`\r
|
|
59
|
+
`,n.addEventListener("click",async()=>{await this.uppy.openPlugin("My Device")}),t.insertBefore(n,t.firstChild),this.addUploadItemFlag=!1}}},{wait:200}));Oe(this,"convertImgToObject",to(()=>{this.canConvertImgToObject&&(document.querySelectorAll("#uploaded img").forEach(n=>{if([".mp4",".webm"].find(a=>{var s;return((s=n.src)==null?void 0:s.indexOf(a))>-1})){const a=document.createElement("video");a.src=n.src,a.width=n.width,a.height=n.height,a.autoplay=!0,a.muted=!0,a.loop=!0,a.style="pointer-events: none;",n.parentNode.replaceChild(a,n)}}),this.canConvertImgToObject=!1)},{wait:200}));Oe(this,"resetState",()=>{this.uploadedAPIData={...Qc},this.uploaded.setPluginState({...Yc}),this.addUploadItemFlag=!0});this.id=this.opts.id||"Uploaded",this.title=this.opts.title||"Uploaded",this.params=this.opts.params||{},this.type="acquirer",this.uppy=t,this.uploadedAPIData={...Qc},this.addUploadItemFlag=!0,this.icon=()=>me("svg",{"aria-hidden":"true",focusable:"false",width:"18",height:"18",viewBox:"0 0 1024 1024",children:[me("path",{d:"M145.6 0c-44.8 0-80 36.8-80 81.6V944c0 44.8 35.2 80 80 80h732.8c44.8 0 81.6-35.2 81.6-80V326.4L657.6 0h-512z",fill:"#49C9A7"}),me("path",{d:"M960 326.4v16H755.2s-100.8-20.8-99.2-108.8c0 0 4.8 92.8 97.6 92.8H960z",fill:"#49C9A7"}),me("path",{d:"M657.6 0v233.6c0 25.6 17.6 92.8 97.6 92.8H960L657.6 0z",fill:"#37BB91"}),me("path",{d:"M225.6 859.2V524.8H560v334.4H225.6z m300.8-300.8H259.2v201.6h267.2V558.4z m-153.6 134.4l62.4-84.8 20.8 33.6 20.8-6.4 16 89.6H283.2l56-52.8 33.6 20.8z m-60.8-59.2c-14.4 0-27.2-9.6-27.2-24 0-12.8 12.8-24 27.2-24 14.4 0 25.6 11.2 25.6 24 0 14.4-11.2 24-25.6 24z",fill:"#FFFFFF"})]})}render(t){var n;return!this.uploadedAPIData.loading&&((n=this.uploadedAPIData.files)==null?void 0:n.length)===0&&this.queryUploadedFromMediaKit(),me("div",{id:"uploaded",className:"uploaded",children:this.view.render(t)})}update(){this.convertImgToObject(),this.addUploadItem()}onFirstRender(){}install(){this.view=new ea(this,{viewType:"grid",showBreadcrumbs:!1,showFilter:!1}),this.uploaded=this.view.plugin,this.uploaded.setPluginState({...Yc}),this.uploaded.uppy.on("dashboard:show-panel",this.resetState),this.view.toggleCheckbox=(n,a)=>{const{currentSelection:s}=this.uploaded.getPluginState(),o=this.uploaded.uppy.opts.restrictions.maxNumberOfFiles,r=o?s.length<o:!0;s.find(l=>l._id===a._id)?this.uploaded.setPluginState({currentSelection:[...s.filter(l=>l._id!==a._id)]}):(r||s.pop(),this.uploaded.setPluginState({currentSelection:[...s,a]}))},this.view.donePicking=()=>{const{currentSelection:n}=this.uploaded.getPluginState();this.uppy.emit("uploaded:selected",n),this.uploaded.parent.hideAllPanels()},this.uploaded.uppy.validateRestrictions=()=>!1,this.view.handleScroll=n=>{const{scrollHeight:a,scrollTop:s,offsetHeight:o}=n.target;a-(s+o)<30&&this.queryUploadedFromMediaKit()};const{target:t}=this.opts;t&&this.mount(t,this)}uninstall(){this.unmount(),this.uploaded.uppy.off("dashboard:show-panel",this.resetState)}}const qw=$w,Jc={initialized:!1,data:[],files:[],pageSize:16,page:1,loading:!1,hasMore:!0,folderId:"",componentDid:"",components:[]},Zc={authenticated:!0,files:[],folders:[],breadcrumbs:[],filterInput:"",isSearchVisible:!1,currentSelection:[],loading:!0,loadAllFiles:!0},Gd={padding:"5px 15px",marginRight:"8px",marginTop:"8px",borderRadius:"4px",cursor:"pointer",border:"1px solid rgb(29, 193, 199)",color:"rgb(29, 193, 199)",backgroundColor:"transparent",fontSize:"14px",lineHeight:"24.5px",fontWeight:"bold"},Hw={...Gd,color:"#fff",backgroundColor:"rgb(29, 193, 199)"};class Vw extends ye{constructor(t,n){super(t,n);Oe(this,"queryResources",async()=>{if(!this.apiData.loading){this.apiData.loading=!0;const{data:t}=await Ai.get("/api/resources",{params:{componentDid:this.apiData.componentDid}});this.apiData.loading=!1,this.apiData.initialized=!0,this.apiData.components=t.components||[],this.apiData.componentDid=t.componentDid||"",this.apiData.files=cu([...t.resources.map(n=>{let a="file";const{filename:s}=n,o=Xa(s);return a=Xa(s,400),{filename:s,_id:s,id:s,name:s,icon:a,previewUrl:a,fileUrl:o}})],"id"),this.resources.setPluginState({files:this.apiData.files,loading:!1})}});Oe(this,"resetState",()=>{this.apiData={...Jc},this.resources.setPluginState({...Zc})});this.id=this.opts.id||"Resources",this.title=this.opts.title||"Resources",this.params=this.opts.params||{},this.type="acquirer",this.uppy=t,this.componentDid="",this.apiData={...Jc},this.icon=()=>me("svg",{t:"1700146012231",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"15673",width:"200",height:"200",children:[me("path",{d:"M403.2 130.133333h-187.733333c-46.933333 0-85.333333 38.4-85.333334 85.333334v187.733333c0 46.933333 38.4 85.333333 85.333334 85.333333h187.733333c46.933333 0 85.333333-38.4 85.333333-85.333333v-187.733333c0-49.066667-38.4-85.333333-85.333333-85.333334zM426.666667 390.4c0 19.2-17.066667 36.266667-36.266667 36.266667h-160c-21.333333 0-38.4-17.066667-38.4-36.266667v-162.133333c0-19.2 17.066667-36.266667 36.266667-36.266667h160c19.2 0 36.266667 17.066667 36.266666 36.266667v162.133333z",fill:"#0171F1","p-id":"15674"}),me("path",{d:"M808.533333 130.133333h-187.733333c-46.933333 0-85.333333 38.4-85.333333 85.333334v187.733333c0 46.933333 38.4 85.333333 85.333333 85.333333h187.733333c46.933333 0 85.333333-38.4 85.333334-85.333333v-187.733333c0-49.066667-36.266667-85.333333-85.333334-85.333334zM832 390.4c0 19.2-17.066667 36.266667-36.266667 36.266667h-160c-19.2 0-36.266667-17.066667-36.266666-36.266667v-162.133333c-2.133333-19.2 14.933333-36.266667 34.133333-36.266667h160c19.2 0 36.266667 17.066667 36.266667 36.266667v162.133333zM403.2 535.466667h-187.733333c-46.933333 0-85.333333 38.4-85.333334 85.333333V810.666667c0 46.933333 38.4 85.333333 85.333334 85.333333h187.733333c46.933333 0 85.333333-38.4 85.333333-85.333333v-189.866667c0-46.933333-38.4-85.333333-85.333333-85.333333zM426.666667 795.733333c0 21.333333-17.066667 36.266667-36.266667 36.266667h-162.133333c-21.333333 0-36.266667-17.066667-36.266667-36.266667v-162.133333c0-21.333333 17.066667-36.266667 36.266667-36.266667h162.133333c19.2 0 36.266667 17.066667 36.266667 36.266667v162.133333z",fill:"#55ABE5","p-id":"15675"}),me("path",{d:"M808.533333 535.466667h-187.733333c-46.933333 0-85.333333 38.4-85.333333 85.333333V810.666667c0 46.933333 38.4 85.333333 85.333333 85.333333h187.733333c46.933333 0 85.333333-38.4 85.333334-85.333333v-189.866667c0-46.933333-36.266667-85.333333-85.333334-85.333333zM832 795.733333c0 21.333333-17.066667 36.266667-36.266667 36.266667h-162.133333c-19.2 0-36.266667-17.066667-36.266667-36.266667v-162.133333c0-21.333333 17.066667-36.266667 36.266667-36.266667h162.133333c21.333333 0 36.266667 17.066667 36.266667 36.266667v162.133333z",fill:"#0171F1","p-id":"15676"})]})}render(t){return!this.apiData.loading&&!this.apiData.initialized&&this.queryResources(),me("div",{id:"resources",className:"uploaded",children:[me("div",{style:{padding:this.apiData.components.length?"12px":"0",backgroundColor:"#fff",display:"flex",flexWrap:"wrap",marginTop:"-8px"},children:this.apiData.components.map(n=>me("button",{style:this.apiData.componentDid===n.did?Hw:Gd,id:n.componentDid,onClick:()=>{this.apiData.componentDid!==n.did&&(this.apiData.componentDid=n.did,this.queryResources())},children:fh(n.name)}))}),this.view.render(t)]})}update(){}onFirstRender(){}install(){this.view=new ea(this,{viewType:"grid",showBreadcrumbs:!1,showFilter:!1}),this.resources=this.view.plugin,this.resources.setPluginState({...Zc}),this.resources.uppy.on("dashboard:show-panel",this.resetState),this.view.toggleCheckbox=(n,a)=>{const{currentSelection:s}=this.resources.getPluginState(),o=this.resources.uppy.opts.restrictions.maxNumberOfFiles,r=o?s.length<o:!0;s.find(l=>l.id===a.id)?this.resources.setPluginState({currentSelection:[...s.filter(l=>l.id!==a.id)]}):(r||s.pop(),this.resources.setPluginState({currentSelection:[...s,a]}))},this.resources.uppy.validateRestrictions=()=>!1,this.view.donePicking=()=>{const{currentSelection:n}=this.resources.getPluginState();this.uppy.emit("uploaded:selected",n),this.resources.parent.hideAllPanels()};const{target:t}=this.opts;t&&this.mount(t,this)}uninstall(){this.unmount(),this.resources.uppy.off("dashboard:show-panel",this.resetState)}}const Ww=Vw;var Gw=ih();const Kw=tt(Gw);class Xw extends ye{constructor(t,n){super(t,{...{},...n});Oe(this,"setHashFileName",async t=>{const{id:n}=t,a=this.uppy.getFile(n);if(a){const{data:s}=a,o=1024*1024*5,r=s.slice(0,o),l=Kw.createHash("md5").update(await r.text()).digest("hex"),c=Wo(a),p=`${l}${c?`.${c}`:""}`;this.uppy.setFileState(n,{hashFileName:p})}});Oe(this,"setMetaData",async t=>{const{id:n}=t,a=this.uppy.getFile(n);if(a){const{data:{relativePath:s,name:o},hashFileName:r}=a,l=s||o||r;this.uppy.setFileMeta(n,{relativePath:l,name:l})}});Oe(this,"prepareUploadWrapper",async t=>{await this.tryDownloadRemoteFile(t),await this.getPreviewFromData(t),await this.setHashFileName(t),await this.setMetaData(t)});Oe(this,"tryDownloadRemoteFile",async t=>{var A,D;const{type:n,name:a,preview:s,source:o,isRemote:r,isDownloading:l,id:c,isLoading:p,remote:u,meta:h,errorCount:g=0}=t,m=!p&&r,v=`uploader:${c}:downloaded`,f=Wo(t),y=(A=a==null?void 0:a.split("?"))==null?void 0:A[0],S=(()=>{const x=["jpg","jpeg"];return x.includes(f)&&x.some(_=>y==null?void 0:y.endsWith(_))?!0:y==null?void 0:y.endsWith(f)})()?y:`${y}${f?`.${f}`:""}`;if(m){const x=aw(s||((D=u==null?void 0:u.body)==null?void 0:D.url));if(g>=3)throw new Error("Download remote file failure");this.uppy.setFileState(c,{isLoading:!0,isDownloading:!0,size:null,meta:{...h,name:this.i18n("loading")}}),await Ai.get(`${this.opts.companionUrl}/proxy`,{responseType:"blob",params:{url:x}}).then(_=>_==null?void 0:_.data).then(async _=>{const O=iw(_,S);this.uppy.setFileState(c,{name:S,extension:f,type:n,data:O,preview:s||Mc(O),source:o,size:O.size,isDownloading:!1,isRemote:!1,meta:{...h,name:S,filename:S}}),this.uppy.getFile(c),this.uppy.emit(v,c)}).catch(async _=>{console.error("Axios download remote file error: ",_),this.uppy.setFileState(c,{isRemote:!0,isLoading:!1,errorCount:g+1}),await this.tryDownloadRemoteFile(this.uppy.getFile(c))})}else l&&await(async()=>new Promise(_=>{this.uppy.once(v,async()=>{_()})}))()});Oe(this,"getPreviewFromData",t=>{const{id:n}=t,a=this.uppy.getFile(n);if(a){const{data:s,type:o,preview:r}=a;(o.indexOf("gif")>-1||!r)&&s&&o.indexOf("image")>-1&&setTimeout(()=>{this.uppy.setFileState(n,{preview:Mc(s)})},o.indexOf("gif")>-1?1e3:0)}});Oe(this,"prepareUpload",t=>{const n=t.map(async s=>{const o=this.uppy.getFile(s);o.isDownloading&&this.uppy.emit("preprocess-progress",o,{mode:"indeterminate",message:this.i18n("loading")}),await this.prepareUploadWrapper(o)}),a=()=>{t.forEach(s=>{const o=this.uppy.getFile(s);this.uppy.emit("preprocess-complete",o)})};return Promise.all(n).then(a)});this.id=this.opts.id||"DownloadRemoteFiles",this.type="modifier",this.i18nInit()}install(){this.uppy.addPreProcessor(this.prepareUpload),this.uppy.on("file-added",async t=>{setTimeout(()=>{this.prepareUploadWrapper(t)},200)}),this.uppy.on("file-editor:complete",t=>{this.getPreviewFromData(t)})}uninstall(){this.uppy.removePreProcessor(this.prepareUpload)}}const Qw=Xw;class Yw extends ye{constructor(e,t){super(e,t),this.id=this.opts.id||"AIImage",this.title=this.opts.title||"AI Image",this.type="acquirer",this.uppy=e,this.i18nInit(),this.icon=()=>me("svg",{width:"20",height:"20",viewBox:"0 0 24 24",children:me("g",{fill:"none",stroke:"#a482fe","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",children:[me("path",{d:"M15 8h.01M10 21H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v5"}),me("path",{d:"m3 16l5-5c.928-.893 2.072-.893 3 0l1 1m2 9v-4a2 2 0 1 1 4 0v4m-4-2h4m3-4v6"})]})})}render(){return me("div",{id:"ai-image",className:"ai-image",children:me("div",{style:{height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:this.i18n("loading")})})}update(){}onFirstRender(){}install(){const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}}const Jw=Yw,Zw="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9",e3=ne.lazy(()=>ou(()=>import("./index-Bwv7AG9N.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47]))),eu="uploader-container",va="uploader-dashboard",Ko=localStorage.getItem("uppy_debug"),t3=i=>{var r,l;const{apiPathProps:e,availablePluginMap:t={},uploadedProps:n}=i,a=Md(e==null?void 0:e.companion),s=async c=>(await Ai.post("/api/image/generations",c)).data,o={maxFileSize:1/0,...(r=i==null?void 0:i.coreProps)==null?void 0:r.restrictions};return[{id:"ImageEditor",plugin:$p,options:{quality:1},alwayUse:!0},(Ko||xn()&&!jc())&&{id:"Uploaded",plugin:qw,options:{params:n==null?void 0:n.params}},(Ko||xn()&&!jc())&&{id:"Resources",plugin:Ww,options:{params:n==null?void 0:n.params}},xn()&&sw()&&t.AIImage&&{id:"AIImage",plugin:Jw,options:{companionUrl:a},onShowPanel:c=>{function p(){setTimeout(()=>{var h,g;const u=document.getElementById("ai-image");u?ch(u).render($e.jsx(e3,{api:s,restrictions:o,i18n:(g=(h=c.current)==null?void 0:h.getUploader())==null?void 0:g.i18n,onSelect:m=>{const v=c.current.getUploader();v==null||v.emit("ai-image:selected",m),m.forEach((f,y)=>{const F=`AI Image [${y+1}].png`,S={name:F,type:"image/png",data:nw(f,F),source:"AIImage",isRemote:!1};v==null||v.addFile(S)})}})):p()},100)}p()}},{id:"Url",plugin:Vn,options:{companionUrl:a}},{id:"Webcam",plugin:Fu,options:{}},!!((l=window==null?void 0:window.blocklet)!=null&&l.UNSPLASH_KEY)&&t.Unsplash&&{id:"Unsplash",plugin:$u,options:{companionUrl:a,companionHeaders:{},companionCookiesRule:"same-origin"}},{id:"PrepareUpload",plugin:Qw,options:{companionUrl:a},alwayUse:!0},{id:"ThumbnailGeneratorNext",plugin:pr,options:{thumbnailType:"image/png",thumbnailWidth:800},alwayUse:!0}].filter(Boolean)};function Ir(i){const{id:e,plugins:t,locale:n,onAfterResponse:a,onUploadFinish:s,coreProps:o,apiPathProps:r,tusProps:l,dropTargetProps:c,pluginList:p}=i,u=uu(p,"id"),h=Md(r==null?void 0:r.uploader);let g=new xu({id:e,meta:{uploaderId:e},debug:["true",!0].includes(Ko||""),locale:N0[n||"en"],...o}).use(fd,{chunkSize:1024*1024*10,removeFingerprintOnSuccess:!0,withCredentials:!0,endpoint:h,async onBeforeRequest(m,v){var D;const{hashFileName:f,id:y,meta:F}=v,S=Wo(v);m.setHeader("x-uploader-file-name",`${f}`),m.setHeader("x-uploader-file-id",`${y}`),m.setHeader("x-uploader-file-ext",`${S}`),m.setHeader("x-uploader-base-url",new URL(m.getURL()).pathname),m.setHeader("x-uploader-endpoint-url",h),m.setHeader("x-uploader-metadata",JSON.stringify(F,(x,_)=>typeof _=="string"?encodeURIComponent(_):_));const A=(window==null?void 0:window.uploaderComponentId)||((D=window==null?void 0:window.blocklet)==null?void 0:D.componentId);A&&m.setHeader("x-component-did",(A||"").split("/").pop())},onAfterResponse:async(m,v)=>{const f={},y=m.getUnderlyingObject();try{y.response&&(f.data=JSON.parse(y.response))}catch{f.data={}}f.method=m.getMethod().toUpperCase(),f.url=m.getURL(),f.status=y.status,f.headers={...m._headers};const F=y.getAllResponseHeaders();if(F&&F.split(`\r
|
|
60
60
|
`).forEach(x=>{const[_,O]=x.split(": ");_&&O&&(f.headers[_]=O)}),["PATCH","POST"].includes(f.method)&&[200,500].includes(f.status)){const D=[!0,"true"].includes(f.headers["x-uploader-file-exist"]),x=rw(f.url,f.headers["x-uploader-file-name"]),_=g.getFile(f.headers["x-uploader-file-id"]);f.file=_,f.uploadURL=x,D&&_&&(f.method==="POST"&&g.pauseResume(_.id),g.emit("upload-success",_,{uploadURL:x}),g.calculateTotalProgress()),f.status===200&&(await(s==null?void 0:s(f)),g.emitUploadSuccess(_,f))}a&&await(a==null?void 0:a(y));const S=g.getState().totalProgress===100,A=g.getFiles().every(D=>D.source==="DropTarget");S&&A&&g.close()},...l});return c&&g.use(Cp,{target:document.body,onDrop:m=>{var v;(v=g==null?void 0:g.open)==null||v.call(g)},...c}),t==null||t.forEach(m=>{if(m){const{plugin:v,options:f}=u[m]||{};v&&g.use(v,f)}}),lw(g),g}const Xo=ne.forwardRef((i,e)=>{const t={uploader:"/api/uploads",companion:"/api/companion",disableMediaKitPrefix:!1,...i==null?void 0:i.apiPathProps},n=nh({open:!1,uppy:null,availablePluginMap:{}}),a=t3({...i,apiPathProps:t,availablePluginMap:n.availablePluginMap}),{plugins:s=a.map(x=>x.id),id:o="Uploader",popup:r=!1,uploadedProps:l,onOpen:c,onClose:p,locale:u,installerProps:h}=i,g=uu(a,"id"),m=ah(x=>{var _;return(_=x==null?void 0:x.breakpoints)==null?void 0:_.down("md")}),v=sh([...s,...a.filter(x=>x.alwayUse).map(x=>x.id)]);ne.useLayoutEffect(()=>{xn()&&!t.disableMediaKitPrefix&&Ai.get("/api/uploader/status").then(({data:x})=>{n.availablePluginMap=x.availablePluginMap})},[]),dh("esc",x=>{n.open&&(x.stopPropagation(),x.preventDefault(),F())},{useCapture:!0}),ne.useEffect(()=>{n.uppy=Ir({...i,id:o,plugins:v,apiPathProps:t,pluginList:a}),n.uppy.open=y,n.uppy.close=F,n.uppy.openPlugin=f,n.uppy.on("dashboard:show-panel",x=>{const{onShowPanel:_}=g[x];_==null||_(e)}),(v.includes("Uploaded")||v.includes("Resources"))&&(n.uppy.off("uploaded:selected"),n.uppy.on("uploaded:selected",x=>{var _;x.forEach(O=>{n.uppy.emitUploadSuccess({id:O._id},{data:O,isMock:!0})}),(_=l==null?void 0:l.onSelectedFiles)==null||_.call(l,x),F()}))},[JSON.stringify({id:o,plugins:v,apiPathProps:t,locale:u})]);function f(x){var _,O,L;if(x=x.replace(/\s/g,""),["MyDevice",...v].map(z=>z.toLowerCase()).includes(x.toLowerCase())){let z=`div[data-uppy-acquirer-id="${x}"] > button`;(L=(O=(_=document==null?void 0:document.getElementById(va))==null?void 0:_.querySelector(z))==null?void 0:O.click)==null||L.call(O)}}function y(x){var O,L,z,K;n.open=!0,x&&setTimeout(()=>{f(x)},200),n.uppy.emitOpen(),c==null||c(),(L=(O=document.activeElement)==null?void 0:O.blur)==null||L.call(O);const _=n.uppy.getPlugin(va).el;(z=_==null?void 0:_.focus)==null||z.call(_),(K=_==null?void 0:_.click)==null||K.call(_)}function F(){var x;(x=n.uppy.getPlugin(va))==null||x.hideAllPanels(),n.open=!1,n.uppy.emitClose(),p==null||p(),setTimeout(()=>{n.uppy.getState().totalProgress===100&&(n.uppy.setState({files:{},currentUploads:{}}),n.uppy.calculateTotalProgress())},500)}ne.useImperativeHandle(e,()=>({getUploader:()=>n.uppy,open:y,close:F})),ne.useEffect(()=>{ow(t.disableMediaKitPrefix)},[t.disableMediaKitPrefix]);const S=r?lh:ne.Fragment,A=r?{sx:{zIndex:99999999999,background:"rgba(0,0,0,0.5)","& > *":{display:n.open?"block":"none"}},invisible:!0,open:n.open,onClick:x=>{document.activeElement===document.body&&(x.stopPropagation(),F())},...i.wrapperProps}:{...i.wrapperProps},D=m?"42px":"40px";return $e.jsx(S,{...A,children:$e.jsxs(gh,{onClose:F,did:Zw,...h,children:[$e.jsx(oh,{styles:()=>({".uppy-is-drag-over":{"&::after":{transition:"all 0.3s ease-in-out",border:"2px dashed #bbb !important",borderRadius:4,background:"rgba(234, 234, 234, 0.5)"}}})}),$e.jsxs(ru,{id:eu,onClick:x=>x.stopPropagation(),sx:{position:"relative",width:m?"90vw":720,".uppy-Dashboard-Item-previewInnerWrap, .uppy-ProviderBrowserItem-inner img":{background:"repeating-conic-gradient(#bdbdbd33 0 25%,#fff 0 50%) 50%/16px 16px !important"},".uploaded-add-item":{background:"rgba(0,0,0,0.1)",display:"flex",justifyContent:"center",alignItems:"center",transition:"all 0.3s ease-in-out","&:hover":{background:"rgba(0,0,0,0.13)"}},".uppy-StatusBar-actions, .uppy-ProviderBrowser-footer":{justifyContent:"flex-end"},".uppy-ProviderBrowser-footer":{button:{marginRight:"0 !important","&:last-child":{display:"none"}}},".uppy-Dashboard-AddFiles-title":{whiteSpace:"normal"},".uppy-ProviderBrowser-body":{background:"#fff",height:"100%"},".uppy-ProviderBrowser-list":{height:"fit-content",maxHeight:"100%"},".uploaded, .ai-image":{width:"100%",height:"100%",display:"flex",alignItems:"center",flexDirection:"column","& > div":{width:"100%"},"& .uppy-ProviderBrowser-header":{display:"none"}},"& .uppy-Url":{width:"100% !important",display:"flex",justifyContent:"center","& input":{width:"70%"}}},children:[$e.jsx(rh,{"aria-label":"close",onClick:F,sx:{color:"#fafafa",position:"absolute",...m?{bottom:`calc(0px - ${D} - 16px)`,left:`calc(50vw - ${D} - 8px)`}:{right:`calc(0px - ${D} - 16px)`,top:-12}},children:$e.jsx(vh,{sx:{fontSize:D}})}),n.uppy&&$e.jsx(gp,{inline:!0,target:`#${eu}`,id:va,uppy:n.uppy,plugins:v,fileManagerSelectionType:"both",proudlyDisplayPoweredByUppy:!1,showProgressDetails:!0,disableThumbnailGenerator:!0,note:"",doneButtonHandler:F,...i.dashboardProps})]},"uploader-container")]})},"uploader-wrapper")}),i3=Object.freeze(Object.defineProperty({__proto__:null,Uploader:Xo,default:Xo,initUploader:Ir},Symbol.toStringTag,{value:"Module"})),n3=ne.lazy(()=>ou(()=>Promise.resolve().then(()=>i3),void 0).then(i=>({default:i.Uploader}))),Ur=ne.createContext(null);function Kd(){const i=ne.useContext(Ur);if(!i)throw new Error("useUploaderContext must be used within an UploaderProvider");return i}function a3({onChange:i,children:e,...t}){const n=Kd(),a=()=>{var o;const s=(o=n==null?void 0:n.current)==null?void 0:o.getUploader();s==null||s.open(),i&&s.onceUploadSuccess((...r)=>{i(...r)})};return $e.jsx(ru,{onClick:a,...t,children:e})}function s3({children:i,...e}){const t=ne.useRef(null);return $e.jsxs(Ur.Provider,{value:t,children:[i,uh.createPortal($e.jsx(n3,{ref:t,popup:!0,...e},"uploader"),document.body)]})}const I3=Object.freeze(Object.defineProperty({__proto__:null,Uploader:Xo,UploaderContext:Ur,UploaderProvider:s3,UploaderTrigger:a3,initUploader:Ir,useUploaderContext:Kd},Symbol.toStringTag,{value:"Module"}));export{sw as g,I3 as r};
|