@abtnode/blocklet-services 1.16.51-beta-20250904-031834-c611f059 → 1.16.51-beta-20250905-023351-70af144b
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/index.js +1 -1
- package/api/routes/ocap.js +53 -5
- package/api/routes/user.js +83 -149
- package/api/services/auth/session.js +4 -4
- package/api/util/check-user.js +64 -0
- package/dist/assets/{AdapterDayjs-CFnh9vjd.js → AdapterDayjs-CC5qW8X_.js} +1 -1
- package/dist/assets/{Google-CW-20wJE.js → Google-BTGwy4Tl.js} +1 -1
- package/dist/assets/{access-control-BizMX9Jn.js → access-control-6ZXyzt4u.js} +1 -1
- package/dist/assets/{actions-DAS8NTxZ.js → actions-Cqn-jwqV.js} +1 -1
- package/dist/assets/{add-component-core-DehX9hAF.js → add-component-core-YkDFxrKl.js} +35 -35
- package/dist/assets/{add-resource-cFXEx4Mb.js → add-resource-OQ7hF_IO.js} +1 -1
- package/dist/assets/{addon-CuC7As5-.js → addon-BkKDTdVJ.js} +1 -1
- package/dist/assets/{advanced-B7LnG-Wt.js → advanced-CT4_Pijp.js} +1 -1
- package/dist/assets/{aigne-CGcWPgm4.js → aigne-DnDNvsxR.js} +1 -1
- package/dist/assets/api-sewNv0AE.js +1 -0
- package/dist/assets/{appearance-CMbl6GXr.js → appearance-D4izVpn9.js} +1 -1
- package/dist/assets/{arrow-down.svg-C5U2GopL.js → arrow-down.svg-CmUDD5Ct.js} +1 -1
- package/dist/assets/{audit-logs-BR5IC8uX.js → audit-logs-BYmYxN_X.js} +1 -1
- package/dist/assets/{authorize-BbkMLYEs.js → authorize-DZtDnqj7.js} +1 -1
- package/dist/assets/{base-chart-DF3hJ1RO.js → base-chart-o9AZYZ--.js} +1 -1
- package/dist/assets/{base32-YcmXpCcj.js → base32-DBozFUZ2.js} +1 -1
- package/dist/assets/bedrock-yFRPpe__.png +0 -0
- package/dist/assets/{bind-account-OAALSOef.js → bind-account-DtwFMPu6.js} +1 -1
- package/dist/assets/branding-BOVSmux-.js +1 -0
- package/dist/assets/{branding-F8Vu_6kc.js → branding-CsRcDE0s.js} +2 -2
- package/dist/assets/{branding-CV15gC6i.js → branding-yPr_q0Uc.js} +1 -1
- package/dist/assets/{bundle-avatar-Bj24dA31.js → bundle-avatar-RF-josr5.js} +1 -1
- package/dist/assets/button-DY13Itzc.js +1 -0
- package/dist/assets/{click-to-copy-BMR8lTEv.js → click-to-copy-fi9Ffgbr.js} +1 -1
- package/dist/assets/{cloneDeep-CXHTtsEc.js → cloneDeep-sSKmkjV3.js} +1 -1
- package/dist/assets/{collapse-8NywKzkD.js → collapse-Cf8moIch.js} +1 -1
- package/dist/assets/{complete-MnVDnuuG.js → complete-e6hBRX3N.js} +1 -1
- package/dist/assets/{component-Bk_-E4gg.js → component-XnltTgOf.js} +3 -3
- package/dist/assets/{config-Dr92nV4I.js → config-BGwcsbBr.js} +1 -1
- package/dist/assets/{config-Bn0_m02e.js → config-BppSCyM-.js} +1 -1
- package/dist/assets/{config-BTL01fgU.js → config-ChvIwoil.js} +1 -1
- package/dist/assets/{config-navigation-DqeOzGVr.js → config-navigation-vJrJrwXE.js} +9 -9
- package/dist/assets/{config-space-O69Nv0aB.js → config-space-CTTPnPjr.js} +1 -1
- package/dist/assets/{confirm-DG4ITIko.js → confirm-CylT1MuR.js} +1 -1
- package/dist/assets/{connect-DL2dlLBg.js → connect-D1U71zMh.js} +1 -1
- package/dist/assets/{connect-ChI6OGaf.js → connect-D9SITMTZ.js} +1 -1
- package/dist/assets/{connect-to-C2mb3SLL.js → connect-to-B7H-Chnx.js} +1 -1
- package/dist/assets/{content-layout-C8_nylvn.js → content-layout-CotAwqHA.js} +1 -1
- package/dist/assets/{createClass-BQk0eOTp.js → createClass-CedsFAiy.js} +1 -1
- package/dist/assets/{dashboard-DV0LBHTV.js → dashboard-hbcsb63I.js} +3 -3
- package/dist/assets/deepseek-C3x42pq3.png +0 -0
- package/dist/assets/{delete-confirm-DWLdmGwG.js → delete-confirm-CsNBLZ0O.js} +1 -1
- package/dist/assets/{did-address-Df2xj-8v.js → did-address-BZQ3OHpT.js} +1 -1
- package/dist/assets/{domain-DpAqDcFt.js → domain-0OPS16_V.js} +1 -1
- package/dist/assets/{domain-action-card-BNiWQCQ3.js → domain-action-card-DNug7dz9.js} +2 -2
- package/dist/assets/domains-Ds15DpYS.js +1 -0
- package/dist/assets/doubao-yPqHSkLx.png +0 -0
- package/dist/assets/{email-CklgLemm.js → email-CRS4tNpx.js} +1 -1
- package/dist/assets/{empty-spinner-8MrwYy6o.js → empty-spinner-DYg7efl9.js} +1 -1
- package/dist/assets/engine-FgocryKo.js +1 -0
- package/dist/assets/{exchange-passport-WsgMY25n.js → exchange-passport-GffYf_m-.js} +1 -1
- package/dist/assets/{form-DI2NdlIg.js → form-DlK4omzK.js} +1 -1
- package/dist/assets/{form-text-input-D3GvGNCj.js → form-text-input-Dhhcv8eW.js} +1 -1
- package/dist/assets/{form-wrapper-CyRbKpkJ.js → form-wrapper-BEhcx7Ef.js} +1 -1
- package/dist/assets/{fuel-B9OsPuGR.js → fuel-CqQax_BS.js} +1 -1
- package/dist/assets/gemini-DffKpc81.png +0 -0
- package/dist/assets/{gen-access-key-CxfRvtHl.js → gen-access-key-DgO3So4-.js} +1 -1
- package/dist/assets/{gen-simple-access-key-CkVVA533.js → gen-simple-access-key-CLexjALx.js} +1 -1
- package/dist/assets/get-safe-url-DXqaEhFh.js +1 -0
- package/dist/assets/google-DT1VSJ0m.png +0 -0
- package/dist/assets/{hdkey-CRIWCUzf.js → hdkey-CHxXj9P3.js} +1 -1
- package/dist/assets/{home-CL12xJFi.js → home-CJwCCJel.js} +1 -1
- package/dist/assets/ideogram-REIjy0Er.png +0 -0
- package/dist/assets/{iframe-C5cUHhd8.js → iframe-BTIpP4Hw.js} +1 -1
- package/dist/assets/{index-ggMl8oln.js → index-7ggrWc16.js} +4 -4
- package/dist/assets/{index-BEhPdNPV.js → index-AlukFQyB.js} +1 -1
- package/dist/assets/index-BH75RD8c.js +30 -0
- package/dist/assets/{index-CTJcDBG9.js → index-BMJ9thMh.js} +1 -1
- package/dist/assets/{index-B_XelxpM.js → index-BPzAOInQ.js} +1 -1
- package/dist/assets/index-BRKdK9jJ.js +177 -0
- package/dist/assets/{index-yBrWp7fO.js → index-BWQTJ4kw.js} +1 -1
- package/dist/assets/{index-UylIOMye.js → index-BamsQCM-.js} +113 -113
- package/dist/assets/{index-BGrrYkUR.js → index-BiB2e8Yu.js} +4 -4
- package/dist/assets/index-BoOZkuTi.js +1 -0
- package/dist/assets/index-BvdzRjbh.js +271 -0
- package/dist/assets/{index-DTsM42Id.js → index-CZyIUWF0.js} +1 -1
- package/dist/assets/{index-cZYnZ4B7.js → index-CjfDGq-5.js} +1 -1
- package/dist/assets/{index-8fv-5AAQ.js → index-Ct3iQdTC.js} +1 -1
- package/dist/assets/{index-CFLZaEiL.js → index-DAxAF51T.js} +1 -1
- package/dist/assets/{index-BORYB__L.js → index-DO9UDa6G.js} +1 -1
- package/dist/assets/{index-D6ay4OGg.js → index-DOLfG_0X.js} +8 -8
- package/dist/assets/{index-oUY4wc3e.js → index-DQ60VjsN.js} +1 -1
- package/dist/assets/{index-TvxuFSBz.js → index-DSrm_rK4.js} +4 -4
- package/dist/assets/{index-BOtYQVYn.js → index-DYfNv4CN.js} +1 -1
- package/dist/assets/{index-Ch35mI2K.js → index-DdXpn59U.js} +1 -1
- package/dist/assets/{index-DDc4xNxF.js → index-Dh4j6qyG.js} +3 -3
- package/dist/assets/{index-BoHT1W-z.js → index-Dn1L9Nu2.js} +1 -1
- package/dist/assets/{index-DkalauYm.js → index-K-GfrQtE.js} +1 -1
- package/dist/assets/{index-BlUSkcPF.js → index-LrrgtY15.js} +2 -2
- package/dist/assets/{index-D12D99od.js → index-R5F7CSrk.js} +1 -1
- package/dist/assets/{index-Dnk-V5A3.js → index-eF2PLa8g.js} +1 -1
- package/dist/assets/{index--e0vFPst.js → index-lPzqDjdD.js} +1 -1
- package/dist/assets/{index-qbpx4ho0.js → index-m4b2voqL.js} +9 -9
- package/dist/assets/{index--dY679jL.js → index-vnGvaRYC.js} +1 -1
- package/dist/assets/{invitation-Dw_3wbU_.js → invitation-CpSWefdW.js} +1 -1
- package/dist/assets/{invite-D2VAra9S.js → invite-AYEjhFQ0.js} +1 -1
- package/dist/assets/{isURL-BXV7aNks.js → isURL-BNktOhyT.js} +1 -1
- package/dist/assets/{issue-passport-YNIfHEWU.js → issue-passport-FIUqn8xz.js} +1 -1
- package/dist/assets/{item-CRkxqMEd.js → item-PqlihMZp.js} +1 -1
- package/dist/assets/{landing-page-axrQrFAe.js → landing-page-iAUVw0Ie.js} +1 -1
- package/dist/assets/{launch-result-message-CYwb6iA9.js → launch-result-message-CFpqIQB2.js} +1 -1
- package/dist/assets/{layout-DHabex9A.js → layout-BzSJPpmA.js} +1 -1
- package/dist/assets/list-0sUwxo0D.js +4 -0
- package/dist/assets/{list-LS9VMpKO.js → list-DiTAJfbm.js} +2 -2
- package/dist/assets/{list-header-DdgW2mjM.js → list-header-DELs3iEf.js} +1 -1
- package/dist/assets/localization-Bo7Gfk7M.js +1 -0
- package/dist/assets/{log-BqfK7lKM.js → log-BP8tEg4T.js} +1 -1
- package/dist/assets/logger-CvoADwsx.js +1 -0
- package/dist/assets/{login-MUf1UgXC.js → login-BhegLCH_.js} +1 -1
- package/dist/assets/{login-oauth-callback-nvA1-MHC.js → login-oauth-callback-CPTNuxD4.js} +1 -1
- package/dist/assets/{logo-uploader-COwE7-CG.js → logo-uploader-CJlzjDbr.js} +2 -2
- package/dist/assets/{lost-passport-15i-h32g.js → lost-passport-BJcnymBH.js} +1 -1
- package/dist/assets/{observability-4ZKd3ESd.js → observability-CarzdE5-.js} +1 -1
- package/dist/assets/ollama-C7MZn2d_.png +0 -0
- package/dist/assets/{omit-s-NbcM4Z.js → omit-C2ouGG7F.js} +1 -1
- package/dist/assets/{open-window-CG51J4gC.js → open-window--cmVNAN5.js} +1 -1
- package/dist/assets/openai-DlpqJdrb.png +0 -0
- package/dist/assets/{over-due-invoice-payment-DBpVXkfx.js → over-due-invoice-payment-Cr2kTw63.js} +1 -1
- package/dist/assets/{overview-B9lpCSRm.js → overview-BQiifSE9.js} +1 -1
- package/dist/assets/{page-header-CyNE6Ofr.js → page-header-CIjuv0WX.js} +1 -1
- package/dist/assets/{passport-item-DybEL-4U.js → passport-item-u44phIJc.js} +1 -1
- package/dist/assets/{permission-BFrFUit7.js → permission-DCakrWTT.js} +1 -1
- package/dist/assets/{playground-DeasY3DH.js → playground-6dTtbzYq.js} +1 -1
- package/dist/assets/poe-B588TgZu.png +0 -0
- package/dist/assets/preferences-eL-qWovr.js +1 -0
- package/dist/assets/profile-embed-CG26T6ks.js +1 -0
- package/dist/assets/publish-resource-sC6DGUJ-.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CiUp8xsU.js → react-beautiful-dnd.esm-CQcgZoy2.js} +1 -1
- package/dist/assets/{react-stripe.esm-CvJuW6o6.js → react-stripe.esm-BHOF7FLg.js} +1 -1
- package/dist/assets/{required-McYgDRcp.js → required-CtPXGgxr.js} +1 -1
- package/dist/assets/{runtime-DRKR2vcm.js → runtime-D6AwdQxS.js} +1 -1
- package/dist/assets/{sanitize-BSfQHy23.js → sanitize-BwaMGjTb.js} +1 -1
- package/dist/assets/sdk-D1Af0QY_.js +1 -0
- package/dist/assets/{section-DSgkHUgY.js → section-4lLmF6fb.js} +1 -1
- package/dist/assets/{security-6K3NLRV1.js → security-BA1zPj2C.js} +1 -1
- package/dist/assets/{session-HjmNdK0I.js → session-t9gAHtO2.js} +1 -1
- package/dist/assets/{setup-Cmh0SuN8.js → setup-HVlps4V-.js} +1 -1
- package/dist/assets/{shorten-label-CphpNRtN.js → shorten-label-BYntTWDs.js} +1 -1
- package/dist/assets/{simple-select-B6PbGWwo.js → simple-select-3dAlIQHx.js} +1 -1
- package/dist/assets/{spaces-BODiJUEs.js → spaces-DH0QfvNS.js} +1 -1
- package/dist/assets/{start-B1fjvXGG.js → start-BuDZLaw8.js} +1 -1
- package/dist/assets/{starting-progress-CCfzhLUS.js → starting-progress-DSrsuJKX.js} +1 -1
- package/dist/assets/{status-C8JIpIsB.js → status-DMVFJ7Ns.js} +1 -1
- package/dist/assets/{step-actions-DSUIHhcl.js → step-actions-viiOlGZP.js} +1 -1
- package/dist/assets/{studio-BP9bO0-g.js → studio-MPC5GOTw.js} +1 -1
- package/dist/assets/{switch-control-BAMq90al.js → switch-control-DhPPQXXT.js} +1 -1
- package/dist/assets/{table-tips-DyJrgU_f.js → table-tips-DHbTBOnI.js} +1 -1
- package/dist/assets/{team-BD_3DJh4.js → team-PwzFoyAO.js} +1 -1
- package/dist/assets/{traffic-CzjP91eE.js → traffic-BTX68PbB.js} +1 -1
- package/dist/assets/{transfer-BNGu3nRa.js → transfer-CaVw1Uf4.js} +1 -1
- package/dist/assets/{unsubscribe-BsWf1MUr.js → unsubscribe-uHK5uqdd.js} +1 -1
- package/dist/assets/{use-app-logo-CaQrhdt8.js → use-app-logo-CNyOsQwv.js} +1 -1
- package/dist/assets/{use-mobile-BTugf2DR.js → use-mobile-C8UweHoJ.js} +1 -1
- package/dist/assets/{use-mobile-BjYFyM2N.js → use-mobile-D2h0sedv.js} +1 -1
- package/dist/assets/{use-server-logo-B7LbKzj5.js → use-server-logo-D2sYKpzr.js} +1 -1
- package/dist/assets/{use-window-close-BSqwQaeS.js → use-window-close-6fEaqfn0.js} +1 -1
- package/dist/assets/{useAsync-BGvZXHet.js → useAsync-CNAYLnLm.js} +1 -1
- package/dist/assets/{useAsync-BWNXO1rj.js → useAsync-DZevTxbv.js} +1 -1
- package/dist/assets/{useAsyncRetry-CpdhLok_.js → useAsyncRetry-ODp5sGTA.js} +1 -1
- package/dist/assets/{useLocalStorage-DVau1hEB.js → useLocalStorage-QnmPEXnx.js} +1 -1
- package/dist/assets/{user-center-CuEVuAdh.js → user-center-MGVe1Tl4.js} +3 -3
- package/dist/assets/user-follower-DnS-dznO.js +32 -0
- package/dist/assets/{user-sessions-CatK1_Zw.js → user-sessions-UGCijU4z.js} +1 -1
- package/dist/assets/{util-CUI_ZmDM.js → util-BT_TGAHY.js} +1 -1
- package/dist/assets/{util-DuIMhFew.js → util-xXS8bje8.js} +1 -1
- package/dist/assets/{vendor-arcblock-CpQy1iPf.js → vendor-arcblock-Gj9ygDGP.js} +1 -1
- package/dist/assets/{vendor-hooks-BCWx0EFG.js → vendor-hooks-DLNZ8kxG.js} +2 -2
- package/dist/assets/{vendor-mui-core-BkVXEDpj.js → vendor-mui-core-Bq_sfmbr.js} +1 -1
- package/dist/assets/{vendor-mui-x-DiiSwpci.js → vendor-mui-x-BbwECMfi.js} +1 -1
- package/dist/assets/{vendor-utils-Vg_blW2I.js → vendor-utils-DQK0pEML.js} +1 -1
- package/dist/assets/{vendor-ux-BuVrSS5Q.js → vendor-ux-BagecGKr.js} +2 -2
- package/dist/assets/{wait-connect-BA3jKwDf.js → wait-connect-B5cBJUbg.js} +1 -1
- package/dist/assets/{wizard-DJpPahxg.js → wizard-DmXX1YRu.js} +2 -2
- package/dist/assets/{wizard-components-CJnpL0XW.js → wizard-components-DK6w0tqC.js} +2 -2
- package/dist/assets/{wrap-locale-CVa5Q-hE.js → wrap-locale-As5nSm9H.js} +1 -1
- package/dist/assets/{zh-CdNKkRMR.js → zh-DilEt4P2.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +37 -37
- package/dist/assets/api-UEK-NQqw.js +0 -1
- package/dist/assets/branding-BiutQrwI.js +0 -1
- package/dist/assets/button-AjggtWPi.js +0 -1
- package/dist/assets/domains-B_SpbTrj.js +0 -1
- package/dist/assets/engine-GV-p3Fxn.js +0 -1
- package/dist/assets/get-safe-url-BXm7L7_P.js +0 -1
- package/dist/assets/index-BOu91gPz.js +0 -30
- package/dist/assets/index-BYbLccyT.js +0 -161
- package/dist/assets/index-BzsXxOiG.js +0 -271
- package/dist/assets/index-DCrnmu85.js +0 -1
- package/dist/assets/list-wxt9eC9U.js +0 -4
- package/dist/assets/localization-D_4reWfj.js +0 -1
- package/dist/assets/logger-B9nd1rH0.js +0 -1
- package/dist/assets/preferences-rTRVaG_q.js +0 -1
- package/dist/assets/profile-embed-DZX01PjZ.js +0 -1
- package/dist/assets/publish-resource-CJTUgGn8.js +0 -1
- package/dist/assets/sdk-xBIHQiyx.js +0 -1
- package/dist/assets/user-follower-D-nWZARf.js +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{cw as Lh,cx as Nh,W as Bh,bl as Zu,bD as hi,cy as jh}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BRKdK9jJ.js","assets/vendor-mui-core-Bq_sfmbr.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-hooks-DLNZ8kxG.js","assets/vendor-utils-DQK0pEML.js","assets/vendor-ux-BagecGKr.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/index-BPy8_fa2.js","assets/index-BamsQCM-.js","assets/vendor-arcblock-Gj9ygDGP.js","assets/index-DrVXX4fX.css","assets/index-DRYJ0xIl.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{cw as Lh,cx as Nh,W as Bh,bl as Zu,bD as hi,cy as jh}from"./index-BamsQCM-.js";import{j as qn}from"./vendor-arcblock-Gj9ygDGP.js";import{g as ft,p as Ci,r as Y,f as Pl,c as zh}from"./vendor-react-Dvs43sk9.js";import{r as $h}from"./index-BPy8_fa2.js";import{t as ep,B as mt,g as us,d as Vn,C as Cl,Q as Fl,R as tp,av as Hh,ac as ip,G as ys,Z as xs,b as ws,e as tn}from"./vendor-utils-DQK0pEML.js";import{bk as qh,bl as Vh,P as De,ab as Wn,T as Wh,a5 as Gh,bm as Kh,_ as Xh}from"./vendor-ux-BagecGKr.js";import{W as R,D as ap,j as N,ak as ee,Q as Ss,ai as Yh,E as Qh,P as Jh,I as Ao,aj as _l,J as Zh,d8 as ef,ae as tf,dU as af,a6 as nf,T as sf}from"./vendor-mui-core-Bq_sfmbr.js";import{b as of,g as rf,k as lf,z as cf}from"./vendor-hooks-DLNZ8kxG.js";import{x as uf}from"./index-DRYJ0xIl.js";import"./lottie-web-4koyQiv_.js";function an(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 np(i){return"__private_"+pf+++"_"+i}function df(i,e,t){const a=[];return i.forEach(n=>typeof n!="string"?a.push(n):e[Symbol.split](n).forEach((s,o,r)=>{s!==""&&a.push(s),o<r.length-1&&a.push(t)})),a}/**
|
|
3
3
|
* Takes a string with placeholder variables like `%{smart_count} file selected`
|
|
4
4
|
* and replaces it with values from options `{smart_count: 5}`
|
|
5
5
|
*
|
|
@@ -42,7 +42,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
42
42
|
* Copyright(c) 2014 Jonathan Ong
|
|
43
43
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
44
44
|
* MIT Licensed
|
|
45
|
-
*/var Pu;function fx(){return Pu||(Pu=1,function(i){var e=hx(),t=$h().extname,a=/^\s*([^;\s]*)(?:;|\s|$)/,n=/^text\//i;i.charset=s,i.charsets={lookup:s},i.contentType=o,i.extension=r,i.extensions=Object.create(null),i.lookup=l,i.types=Object.create(null),c(i.extensions,i.types);function s(p){if(!p||typeof p!="string")return!1;var u=a.exec(p),f=u&&e[u[1].toLowerCase()];return f&&f.charset?f.charset:u&&n.test(u[1])?"UTF-8":!1}function o(p){if(!p||typeof p!="string")return!1;var u=p.indexOf("/")===-1?i.lookup(p):p;if(!u)return!1;if(u.indexOf("charset")===-1){var f=i.charset(u);f&&(u+="; charset="+f.toLowerCase())}return u}function r(p){if(!p||typeof p!="string")return!1;var u=a.exec(p),f=u&&i.extensions[u[1].toLowerCase()];return!f||!f.length?!1:f[0]}function l(p){if(!p||typeof p!="string")return!1;var u=t("x."+p).toLowerCase().substr(1);return u&&i.types[u]||!1}function c(p,u){var f=["nginx","apache",void 0,"iana"];Object.keys(e).forEach(function(S){var _=e[S],w=_.extensions;if(!(!w||!w.length)){p[S]=w;for(var y=0;y<w.length;y++){var b=w[y];if(u[b]){var h=f.indexOf(e[u[b]].source),m=f.indexOf(_.source);if(u[b]!=="application/octet-stream"&&(h>m||h===m&&u[b].substr(0,12)==="application/"))continue}u[b]=S}}})}}(mo)),mo}var mx=fx();const Ke=ft(mx);/*! js-cookie v3.0.5 | MIT */function xn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var a in t)i[a]=t[a]}return i}var gx={read:function(i){return i[0]==='"'&&(i=i.slice(1,-1)),i.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(i){return encodeURIComponent(i).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function yr(i,e){function t(n,s,o){if(!(typeof document>"u")){o=xn({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var l in o)o[l]&&(r+="; "+l,o[l]!==!0&&(r+="="+o[l].split(";")[0]));return document.cookie=n+"="+i.write(s,n)+r}}function a(n){if(!(typeof document>"u"||arguments.length&&!n)){for(var s=document.cookie?document.cookie.split("; "):[],o={},r=0;r<s.length;r++){var l=s[r].split("="),c=l.slice(1).join("=");try{var p=decodeURIComponent(l[0]);if(o[p]=i.read(c,p),n===p)break}catch{}}return n?o[n]:o}}return Object.create({set:t,get:a,remove:function(n,s){t(n,"",xn({},s,{expires:-1}))},withAttributes:function(n){return yr(this.converter,xn({},this.attributes,n))},withConverter:function(n){return yr(xn({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(i)}})}var xr=yr(gx,{path:"/"});const cl={strings:{},pluralize(){return 0}};cl.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=cl);const ul={strings:{},pluralize(i){return i===1?0:1}};ul.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=ul);const ha={zh:Fl({...cl},{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}或者通过下方导入:",cancel:"返回",loadingStatus:"正在获取状态...",aspectRatioMessage:"请编辑图片适配所需比例,目前图片比例为 %{imageAspectRatio},需要 %{aspectRatio}",editorLoading:"等待图片编辑...",downloadRemoteFileFailure:"获取远程文件失败 ❌",noAllowedFileTypes:"不允许上传任何文件类型",allowedFileTypes:"允许上传的文件类型:",error:"初始化失败,请检查相关服务(Media Kit)运行状态是否正常"}}),en:Fl({...ul},{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:",cancel:"Back",loadingStatus:"Getting status...",aspectRatioMessage:"Please edit the required ratio for image, currently the image ratio is %{imageAspectRatio}, need %{aspectRatio}",editorLoading:"Waiting for image editor...",downloadRemoteFileFailure:"Failure to get remote file ❌",noAllowedFileTypes:"No allowed any file types",allowedFileTypes:"Allowed file types: ",error:"Failed to initialize, please check if the related service (Media Kit) is running normally"}})},wn=i=>{let e=null;return!i||!vx(i)?null:(window?.createObjectURL?e=window.createObjectURL(i):window?.URL?.createObjectURL?e=window.URL.createObjectURL(i):window?.webkitURL?.createObjectURL&&(e=window.webkitURL.createObjectURL(i)),e)},_a=i=>{const{type:e,name:t}=i;if(t.startsWith(".")&&!Ke.lookup(t))return!1;const a=Ke.lookup(t);return a?Ke.extension(a)||"":Ke.extension(e)};function vx(i){return i instanceof Blob}function vo(i,e){return new File([i],e,{type:i.type})}function bx(i,e){let t=i.split(","),a=t[0].match(/:(.*?);/)?.[1],n=atob(t[1]),s=n.length,o=new Uint8Array(s);for(;s--;)o[s]=n.charCodeAt(s);return new File([o],e,{type:a})}function yx(i){const e=new URL(i);return e.searchParams.delete("w"),e.searchParams.delete("h"),e.searchParams.delete("q"),e.href}const xx=()=>window?.blocklet?.componentMountPoints?.find(i=>i.did==="z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ"),ka=()=>window?.blocklet?.componentMountPoints?.find(i=>i.did==="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9"),Cu=()=>window?.blocklet?.componentId.indexOf("z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9")>-1,Ot=ka()?.mountPoint||"/";let pi=Ot;const wx=i=>{if(i.disableMediaKitPrefix){pi=window?.blocklet?.prefix||"/";return}pi=Ot},Sx=Zu({timeout:2e5});Sx.interceptors.request.use(i=>(i.baseURL=pi||"/",i.timeout=2e5,i),i=>Promise.reject(i));const Za=Zu({timeout:2e5});Za.interceptors.request.use(i=>{i.baseURL=Ot;const e=window?.uploaderComponentId||(window?.blocklet?.componentId||"").split("/").pop();return i.headers["x-component-did"]=e,i},i=>Promise.reject(i));function gh(i){const e=qn(window.location.origin,pi==="/"||i.disableAutoPrefix?"":pi,i.uploader||""),t=qn(window.location.origin,Ot==="/"||i.disableAutoPrefix?"":Ot,i.companion||"");return{uploaderUrl:e,companionUrl:t}}function Px(...i){const e=i.filter(Boolean).map(t=>t==="/"?"":t);return qn(...e)}function ns(i,e=0,t=0,a=""){const{CDN_HOST:n=""}=window?.blocklet||{},s=new URL(n||window.location.origin);let o=pi==="/"?"":pi;a&&(o=a),s.pathname=qn(o,"/uploads/",i);const r=i.split(".").pop()||"";return["png","jpg","jpeg","webp"].includes(r)&&(e&&(s.searchParams.set("imageFilter","resize"),s.searchParams.set("w",e.toString())),t&&(s.searchParams.set("imageFilter","resize"),s.searchParams.set("h",t.toString()))),s.href}const Fu="uploader-upload-success",bo="uploader-open",yo="uploader-close";function Cx(i){i.getUploadSuccessKey=a=>a?.id?`${Fu}:${a.id}`:Fu,i.offUploadSuccess=a=>{i.off(i.getUploadSuccessKey(a))},i.uploadSuccessHandler=(a,n,s)=>{typeof a=="function"&&(n=a,a={});const o=i.getUploadSuccessKey(a);i.offUploadSuccess(a),s?i.once(o,(r,l)=>{n({file:r,response:l})}):i.on(o,(r,l)=>{n({file:r,response:l})})},i.onceUploadSuccess=(a,n)=>{i.uploadSuccessHandler(a,n,!0)},i.onUploadSuccess=(a,n)=>{i.uploadSuccessHandler(a,n,!1)},i.emitUploadSuccess=(a,n)=>{const s=i.getUploadSuccessKey(a);i.emit(s,a,n)};const e=Vn(i.addFiles,50);i.addFiles=a=>{e.call(i,a)},i.uploadFile=async a=>new Promise((n,s)=>{const{name:o,type:r}=a,l=i.addFile({name:`${new Date().valueOf()}-${o}`,type:r,data:a,source:"function-upload-file",isRemote:!1}),c=i.getFile(l);i.onceUploadSuccess(c,p=>{i.removeFiles([l]),n(p)}),i.once("error",p=>{i.offUploadSuccess(c),i.removeFiles([l]),s(p)}),i.upload()}),i.removeFiles=a=>{const{files:n,currentUploads:s}=i.getState(),o={...n},r={...s},l=Object.create(null);a.forEach(f=>{n[f]&&(l[f]=n[f],delete o[f])});function c(f){return l[f]===void 0}Object.keys(r).forEach(f=>{const x=s[f].fileIDs.filter(c);if(x.length===0){delete r[f];return}const{capabilities:S}=i.getState();if(x.length!==s[f].fileIDs.length&&!S.individualCancellation)throw new Error("individualCancellation is disabled");r[f]={...s[f],fileIDs:x}});const p={currentUploads:r,files:o};Object.keys(o).length===0&&(p.allowNewUpload=!0,p.error=null,p.recoveredState=null),i.setState(p),i.calculateTotalProgress();const u=Object.keys(l);u.forEach(f=>{i.emit("file-removed-success",l[f])}),u.length>5?i.log(`Removed ${u.length} files`):i.log(`Removed files: ${u.join(", ")}`)},i.emitOpen=(...a)=>{i.emit(bo,...a)},i.onOpen=a=>{i.off(bo),i.once(bo,a)},i.emitClose=(...a)=>{i.emit(yo,...a)},i.onClose=a=>{i.off(yo),i.once(yo,a)},i.calculateTotalProgress=()=>{const a=i.getFiles(),n=a.filter(x=>x.progress.uploadStarted||x.progress.preprocess||x.progress.postprocess);if(n.length===0){i.emit("progress",0),i.setState({totalProgress:0});return}const s=n.filter(x=>x.progress.bytesTotal!=null),o=n.filter(x=>x.progress.bytesTotal==null);if(s.length===0){const x=n.length*100,S=o.reduce((w,y)=>w+y.progress.percentage,0),_=Math.round(S/x*100);i.setState({totalProgress:_});return}let r=s.reduce((x,S)=>x+S.progress.bytesTotal,0);const l=r/s.length;r+=l*o.length;let c=0;s.forEach(x=>{c+=x.progress.bytesUploaded}),o.forEach(x=>{c+=l*(x.progress.percentage||0)/100});const u=a.filter(x=>x.progress.uploadComplete).length===a.length;let f=r===0?u?100:0:Math.round(c/r*100);f>100&&(f=100),i.setState({totalProgress:f}),i.emit("progress",f)};const t=i.upload.bind(i);return i.upload=async()=>(i.getFiles().forEach(n=>{i.setFileState(n.id,{progress:{uploadComplete:!1,uploadStarted:!1},error:null})}),await t()),i}function Fx(i){return typeof i!="string"?"":i&&i.length>12?i.substring(0,7)+"..."+i.substring(i.length-5):i}const _x=async i=>{if(i.type?.toLowerCase().includes("svg")||i.name?.toLowerCase().endsWith(".svg"))return!0;try{const t=i.data?.slice(0,524288);if(!t)return!1;const a=await t.text();return a?/<svg[^>]*?(?:>|\/>)|<\?xml[^>]*>\s*<svg[^>]*?(?:>|\/?>)/i.test(a):!1}catch{return!1}},kx=i=>{if(!i)return null;try{const e={fileUrl:i.fileUrl||i.icon||"",mimetype:i.mimetype||Ke.lookup(i.fileUrl),originalname:i.originalname||i.name||"unknown",filename:i.filename||i._id||`${Date.now()}.unknown`,size:i.size||0,remark:i.remark||"",tags:Array.isArray(i.tags)?i.tags:[],folderId:i.folderId||"",createdAt:i.createdAt||new Date().toISOString(),updatedAt:i.updatedAt||new Date().toISOString(),createdBy:i.createdBy||"",updatedBy:i.updatedBy||"",_id:i._id||i.id||`${Date.now()}`,previewUrl:i.previewUrl||i.icon||i.fileUrl||""};let t="";try{t=new URL(e.fileUrl).origin}catch{t=window.location.origin}const a=`Uploader-${e.originalname.toLowerCase().replace(/[^a-z0-9]/g,"")}-${Date.now()}`,n=`Mock-${Math.random().toString(36).substring(2,15)}`,s={url:e.fileUrl,mimetype:e.mimetype,originalname:e.originalname,filename:e.filename,size:e.size,remark:e.remark,tags:e.tags,folderId:e.folderId,createdAt:e.createdAt,updatedAt:e.updatedAt,createdBy:e.createdBy,updatedBy:e.updatedBy,_id:e._id},o=`${t}/image-bin/api/uploads/${e.filename}`,r={"Tus-Resumable":"1.0.0","Upload-Length":String(e.size),"x-uploader-file-name":e.filename,"x-uploader-file-id":a,"x-uploader-file-ext":e.filename.split(".").pop()||"unknown","x-uploader-base-url":"/image-bin/api/uploads","x-uploader-endpoint-url":t+"/image-bin/api/uploads","x-uploader-metadata":JSON.stringify({uploaderId:"Uploader",relativePath:e.originalname,name:e.originalname,type:e.mimetype}),"x-component-did":e.folderId,"x-uploader-file-exist":"true"},l={uploadStarted:Date.now(),uploadComplete:!0,percentage:100,bytesUploaded:e.size,bytesTotal:e.size},c={source:"uploader-dashboard",id:a,name:e.originalname,extension:e.filename.split(".").pop()||"unknown",meta:{uploaderId:"Uploader",relativePath:e.originalname,name:e.originalname,type:e.mimetype},type:e.mimetype,data:s,progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size},size:e.size,isGhost:!1,isRemote:!1,remote:"",preview:e.previewUrl,hashFileName:e.filename,error:null,uploadID:n,tus:{uploadUrl:o}};return{data:s,method:"POST",url:t+"/image-bin/api/uploads",status:200,headers:r,source:"uploader-dashboard",id:a,name:e.originalname,extension:e.filename.split(".").pop()||"unknown",file:c,meta:{uploaderId:"Uploader",relativePath:e.originalname,name:e.originalname,type:e.mimetype},type:e.mimetype,progress:l,size:e.size,isGhost:!1,isRemote:!1,remote:"",preview:e.previewUrl,hashFileName:e.filename,error:null,uploadID:n,tus:{uploadUrl:o},responseResult:{uploadURL:o,data:s,method:"POST",url:t+"/image-bin/api/uploads",status:200,headers:r,file:c},response:{uploadURL:o,status:200,body:{}},uploadURL:o,isPaused:!1}}catch(e){return console.error("Error in mockResponse:",e),null}};var wr;function Tx(i){return i.children}wr={__e:function(i,e,t,a){for(var n,s,o;e=e.__;)if((n=e.__c)&&!n.__)try{if((s=n.constructor)&&s.getDerivedStateFromError!=null&&(n.setState(s.getDerivedStateFromError(i)),o=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(i,a||{}),o=n.__d),o)return n.__E=n}catch(r){i=r}throw i}},typeof Promise=="function"&&Promise.prototype.then.bind(Promise.resolve());var Ex=0;function le(i,e,t,a,n,s){var o,r,l={};for(r in e)r=="ref"?o=e[r]:l[r]=e[r];var c={type:i,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ex,__i:-1,__u:0,__source:n,__self:s};if(typeof i=="function"&&(o=i.defaultProps))for(r in o)l[r]===void 0&&(l[r]=o[r]);return wr.vnode&&wr.vnode(c),c}const _u={data:[],files:[],pageSize:16,page:1,loading:!1,hasMore:!0,folderId:""},ku={authenticated:!0,files:[],folders:[],breadcrumbs:[],filterInput:"",isSearchVisible:!1,currentSelection:[],loading:!0,loadAllFiles:!0},Dx=`
|
|
45
|
+
*/var Pu;function fx(){return Pu||(Pu=1,function(i){var e=hx(),t=$h().extname,a=/^\s*([^;\s]*)(?:;|\s|$)/,n=/^text\//i;i.charset=s,i.charsets={lookup:s},i.contentType=o,i.extension=r,i.extensions=Object.create(null),i.lookup=l,i.types=Object.create(null),c(i.extensions,i.types);function s(p){if(!p||typeof p!="string")return!1;var u=a.exec(p),f=u&&e[u[1].toLowerCase()];return f&&f.charset?f.charset:u&&n.test(u[1])?"UTF-8":!1}function o(p){if(!p||typeof p!="string")return!1;var u=p.indexOf("/")===-1?i.lookup(p):p;if(!u)return!1;if(u.indexOf("charset")===-1){var f=i.charset(u);f&&(u+="; charset="+f.toLowerCase())}return u}function r(p){if(!p||typeof p!="string")return!1;var u=a.exec(p),f=u&&i.extensions[u[1].toLowerCase()];return!f||!f.length?!1:f[0]}function l(p){if(!p||typeof p!="string")return!1;var u=t("x."+p).toLowerCase().substr(1);return u&&i.types[u]||!1}function c(p,u){var f=["nginx","apache",void 0,"iana"];Object.keys(e).forEach(function(S){var _=e[S],w=_.extensions;if(!(!w||!w.length)){p[S]=w;for(var y=0;y<w.length;y++){var b=w[y];if(u[b]){var h=f.indexOf(e[u[b]].source),m=f.indexOf(_.source);if(u[b]!=="application/octet-stream"&&(h>m||h===m&&u[b].substr(0,12)==="application/"))continue}u[b]=S}}})}}(mo)),mo}var mx=fx();const Ke=ft(mx);/*! js-cookie v3.0.5 | MIT */function xn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var a in t)i[a]=t[a]}return i}var gx={read:function(i){return i[0]==='"'&&(i=i.slice(1,-1)),i.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(i){return encodeURIComponent(i).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function yr(i,e){function t(n,s,o){if(!(typeof document>"u")){o=xn({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var l in o)o[l]&&(r+="; "+l,o[l]!==!0&&(r+="="+o[l].split(";")[0]));return document.cookie=n+"="+i.write(s,n)+r}}function a(n){if(!(typeof document>"u"||arguments.length&&!n)){for(var s=document.cookie?document.cookie.split("; "):[],o={},r=0;r<s.length;r++){var l=s[r].split("="),c=l.slice(1).join("=");try{var p=decodeURIComponent(l[0]);if(o[p]=i.read(c,p),n===p)break}catch{}}return n?o[n]:o}}return Object.create({set:t,get:a,remove:function(n,s){t(n,"",xn({},s,{expires:-1}))},withAttributes:function(n){return yr(this.converter,xn({},this.attributes,n))},withConverter:function(n){return yr(xn({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(i)}})}var xr=yr(gx,{path:"/"});const cl={strings:{},pluralize(){return 0}};cl.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=cl);const ul={strings:{},pluralize(i){return i===1?0:1}};ul.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=ul);const ha={zh:Fl({...cl},{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}或者通过下方导入:",cancel:"返回",loadingStatus:"正在获取状态...",aspectRatioMessage:"请编辑图片适配所需比例,目前图片比例为 %{imageAspectRatio},需要 %{aspectRatio}",editorLoading:"等待图片编辑...",downloadRemoteFileFailure:"获取远程文件失败 ❌",noAllowedFileTypes:"不允许上传任何文件类型",allowedFileTypes:"允许上传的文件类型:",error:"初始化失败,请检查相关服务(Media Kit)运行状态是否正常"}}),en:Fl({...ul},{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:",cancel:"Back",loadingStatus:"Getting status...",aspectRatioMessage:"Please edit the required ratio for image, currently the image ratio is %{imageAspectRatio}, need %{aspectRatio}",editorLoading:"Waiting for image editor...",downloadRemoteFileFailure:"Failure to get remote file ❌",noAllowedFileTypes:"No allowed any file types",allowedFileTypes:"Allowed file types: ",error:"Failed to initialize, please check if the related service (Media Kit) is running normally"}})},wn=i=>{let e=null;return!i||!vx(i)?null:(window?.createObjectURL?e=window.createObjectURL(i):window?.URL?.createObjectURL?e=window.URL.createObjectURL(i):window?.webkitURL?.createObjectURL&&(e=window.webkitURL.createObjectURL(i)),e)},_a=i=>{const{type:e,name:t}=i;if(t.startsWith(".")&&!Ke.lookup(t))return!1;const a=Ke.lookup(t);return a?Ke.extension(a)||"":Ke.extension(e)};function vx(i){return i instanceof Blob}function vo(i,e){return new File([i],e,{type:i.type})}function bx(i,e){let t=i.split(","),a=t[0].match(/:(.*?);/)?.[1],n=atob(t[1]),s=n.length,o=new Uint8Array(s);for(;s--;)o[s]=n.charCodeAt(s);return new File([o],e,{type:a})}function yx(i){const e=new URL(i);return e.searchParams.delete("w"),e.searchParams.delete("h"),e.searchParams.delete("q"),e.href}const ka=()=>window?.blocklet?.componentMountPoints?.find(i=>i.did==="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9"),Cu=()=>window?.blocklet?.componentId.indexOf("z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9")>-1,Ot=ka()?.mountPoint||"/";let pi=Ot;const xx=i=>{if(i.disableMediaKitPrefix){pi=window?.blocklet?.prefix||"/";return}pi=Ot},wx=Zu({timeout:2e5});wx.interceptors.request.use(i=>(i.baseURL=pi||"/",i.timeout=2e5,i),i=>Promise.reject(i));const Za=Zu({timeout:2e5});Za.interceptors.request.use(i=>{i.baseURL=Ot;const e=window?.uploaderComponentId||(window?.blocklet?.componentId||"").split("/").pop();return i.headers["x-component-did"]=e,i},i=>Promise.reject(i));function gh(i){const e=qn(window.location.origin,pi==="/"||i.disableAutoPrefix?"":pi,i.uploader||""),t=qn(window.location.origin,Ot==="/"||i.disableAutoPrefix?"":Ot,i.companion||"");return{uploaderUrl:e,companionUrl:t}}function Sx(...i){const e=i.filter(Boolean).map(t=>t==="/"?"":t);return qn(...e)}function ns(i,e=0,t=0,a=""){const{CDN_HOST:n=""}=window?.blocklet||{},s=new URL(n||window.location.origin);let o=pi==="/"?"":pi;a&&(o=a),s.pathname=qn(o,"/uploads/",i);const r=i.split(".").pop()||"";return["png","jpg","jpeg","webp"].includes(r)&&(e&&(s.searchParams.set("imageFilter","resize"),s.searchParams.set("w",e.toString())),t&&(s.searchParams.set("imageFilter","resize"),s.searchParams.set("h",t.toString()))),s.href}const Fu="uploader-upload-success",bo="uploader-open",yo="uploader-close";function Px(i){i.getUploadSuccessKey=a=>a?.id?`${Fu}:${a.id}`:Fu,i.offUploadSuccess=a=>{i.off(i.getUploadSuccessKey(a))},i.uploadSuccessHandler=(a,n,s)=>{typeof a=="function"&&(n=a,a={});const o=i.getUploadSuccessKey(a);i.offUploadSuccess(a),s?i.once(o,(r,l)=>{n({file:r,response:l})}):i.on(o,(r,l)=>{n({file:r,response:l})})},i.onceUploadSuccess=(a,n)=>{i.uploadSuccessHandler(a,n,!0)},i.onUploadSuccess=(a,n)=>{i.uploadSuccessHandler(a,n,!1)},i.emitUploadSuccess=(a,n)=>{const s=i.getUploadSuccessKey(a);i.emit(s,a,n)};const e=Vn(i.addFiles,50);i.addFiles=a=>{e.call(i,a)},i.uploadFile=async a=>new Promise((n,s)=>{const{name:o,type:r}=a,l=i.addFile({name:`${new Date().valueOf()}-${o}`,type:r,data:a,source:"function-upload-file",isRemote:!1}),c=i.getFile(l);i.onceUploadSuccess(c,p=>{i.removeFiles([l]),n(p)}),i.once("error",p=>{i.offUploadSuccess(c),i.removeFiles([l]),s(p)}),i.upload()}),i.removeFiles=a=>{const{files:n,currentUploads:s}=i.getState(),o={...n},r={...s},l=Object.create(null);a.forEach(f=>{n[f]&&(l[f]=n[f],delete o[f])});function c(f){return l[f]===void 0}Object.keys(r).forEach(f=>{const x=s[f].fileIDs.filter(c);if(x.length===0){delete r[f];return}const{capabilities:S}=i.getState();if(x.length!==s[f].fileIDs.length&&!S.individualCancellation)throw new Error("individualCancellation is disabled");r[f]={...s[f],fileIDs:x}});const p={currentUploads:r,files:o};Object.keys(o).length===0&&(p.allowNewUpload=!0,p.error=null,p.recoveredState=null),i.setState(p),i.calculateTotalProgress();const u=Object.keys(l);u.forEach(f=>{i.emit("file-removed-success",l[f])}),u.length>5?i.log(`Removed ${u.length} files`):i.log(`Removed files: ${u.join(", ")}`)},i.emitOpen=(...a)=>{i.emit(bo,...a)},i.onOpen=a=>{i.off(bo),i.once(bo,a)},i.emitClose=(...a)=>{i.emit(yo,...a)},i.onClose=a=>{i.off(yo),i.once(yo,a)},i.calculateTotalProgress=()=>{const a=i.getFiles(),n=a.filter(x=>x.progress.uploadStarted||x.progress.preprocess||x.progress.postprocess);if(n.length===0){i.emit("progress",0),i.setState({totalProgress:0});return}const s=n.filter(x=>x.progress.bytesTotal!=null),o=n.filter(x=>x.progress.bytesTotal==null);if(s.length===0){const x=n.length*100,S=o.reduce((w,y)=>w+y.progress.percentage,0),_=Math.round(S/x*100);i.setState({totalProgress:_});return}let r=s.reduce((x,S)=>x+S.progress.bytesTotal,0);const l=r/s.length;r+=l*o.length;let c=0;s.forEach(x=>{c+=x.progress.bytesUploaded}),o.forEach(x=>{c+=l*(x.progress.percentage||0)/100});const u=a.filter(x=>x.progress.uploadComplete).length===a.length;let f=r===0?u?100:0:Math.round(c/r*100);f>100&&(f=100),i.setState({totalProgress:f}),i.emit("progress",f)};const t=i.upload.bind(i);return i.upload=async()=>(i.getFiles().forEach(n=>{i.setFileState(n.id,{progress:{uploadComplete:!1,uploadStarted:!1},error:null})}),await t()),i}function Cx(i){return typeof i!="string"?"":i&&i.length>12?i.substring(0,7)+"..."+i.substring(i.length-5):i}const Fx=async i=>{if(i.type?.toLowerCase().includes("svg")||i.name?.toLowerCase().endsWith(".svg"))return!0;try{const t=i.data?.slice(0,524288);if(!t)return!1;const a=await t.text();return a?/<svg[^>]*?(?:>|\/>)|<\?xml[^>]*>\s*<svg[^>]*?(?:>|\/?>)/i.test(a):!1}catch{return!1}},_x=i=>{if(!i)return null;try{const e={fileUrl:i.fileUrl||i.icon||"",mimetype:i.mimetype||Ke.lookup(i.fileUrl),originalname:i.originalname||i.name||"unknown",filename:i.filename||i._id||`${Date.now()}.unknown`,size:i.size||0,remark:i.remark||"",tags:Array.isArray(i.tags)?i.tags:[],folderId:i.folderId||"",createdAt:i.createdAt||new Date().toISOString(),updatedAt:i.updatedAt||new Date().toISOString(),createdBy:i.createdBy||"",updatedBy:i.updatedBy||"",_id:i._id||i.id||`${Date.now()}`,previewUrl:i.previewUrl||i.icon||i.fileUrl||""};let t="";try{t=new URL(e.fileUrl).origin}catch{t=window.location.origin}const a=`Uploader-${e.originalname.toLowerCase().replace(/[^a-z0-9]/g,"")}-${Date.now()}`,n=`Mock-${Math.random().toString(36).substring(2,15)}`,s={url:e.fileUrl,mimetype:e.mimetype,originalname:e.originalname,filename:e.filename,size:e.size,remark:e.remark,tags:e.tags,folderId:e.folderId,createdAt:e.createdAt,updatedAt:e.updatedAt,createdBy:e.createdBy,updatedBy:e.updatedBy,_id:e._id},o=`${t}/image-bin/api/uploads/${e.filename}`,r={"Tus-Resumable":"1.0.0","Upload-Length":String(e.size),"x-uploader-file-name":e.filename,"x-uploader-file-id":a,"x-uploader-file-ext":e.filename.split(".").pop()||"unknown","x-uploader-base-url":"/image-bin/api/uploads","x-uploader-endpoint-url":t+"/image-bin/api/uploads","x-uploader-metadata":JSON.stringify({uploaderId:"Uploader",relativePath:e.originalname,name:e.originalname,type:e.mimetype}),"x-component-did":e.folderId,"x-uploader-file-exist":"true"},l={uploadStarted:Date.now(),uploadComplete:!0,percentage:100,bytesUploaded:e.size,bytesTotal:e.size},c={source:"uploader-dashboard",id:a,name:e.originalname,extension:e.filename.split(".").pop()||"unknown",meta:{uploaderId:"Uploader",relativePath:e.originalname,name:e.originalname,type:e.mimetype},type:e.mimetype,data:s,progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size},size:e.size,isGhost:!1,isRemote:!1,remote:"",preview:e.previewUrl,hashFileName:e.filename,error:null,uploadID:n,tus:{uploadUrl:o}};return{data:s,method:"POST",url:t+"/image-bin/api/uploads",status:200,headers:r,source:"uploader-dashboard",id:a,name:e.originalname,extension:e.filename.split(".").pop()||"unknown",file:c,meta:{uploaderId:"Uploader",relativePath:e.originalname,name:e.originalname,type:e.mimetype},type:e.mimetype,progress:l,size:e.size,isGhost:!1,isRemote:!1,remote:"",preview:e.previewUrl,hashFileName:e.filename,error:null,uploadID:n,tus:{uploadUrl:o},responseResult:{uploadURL:o,data:s,method:"POST",url:t+"/image-bin/api/uploads",status:200,headers:r,file:c},response:{uploadURL:o,status:200,body:{}},uploadURL:o,isPaused:!1}}catch(e){return console.error("Error in mockResponse:",e),null}};var wr;function kx(i){return i.children}wr={__e:function(i,e,t,a){for(var n,s,o;e=e.__;)if((n=e.__c)&&!n.__)try{if((s=n.constructor)&&s.getDerivedStateFromError!=null&&(n.setState(s.getDerivedStateFromError(i)),o=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(i,a||{}),o=n.__d),o)return n.__E=n}catch(r){i=r}throw i}},typeof Promise=="function"&&Promise.prototype.then.bind(Promise.resolve());var Tx=0;function le(i,e,t,a,n,s){var o,r,l={};for(r in e)r=="ref"?o=e[r]:l[r]=e[r];var c={type:i,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Tx,__i:-1,__u:0,__source:n,__self:s};if(typeof i=="function"&&(o=i.defaultProps))for(r in o)l[r]===void 0&&(l[r]=o[r]);return wr.vnode&&wr.vnode(c),c}const _u={data:[],files:[],pageSize:16,page:1,loading:!1,hasMore:!0,folderId:""},ku={authenticated:!0,files:[],folders:[],breadcrumbs:[],filterInput:"",isSearchVisible:!1,currentSelection:[],loading:!0,loadAllFiles:!0},Ex=`
|
|
46
46
|
<svg
|
|
47
47
|
xmlns="http://www.w3.org/2000/svg"
|
|
48
48
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
@@ -67,11 +67,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
67
67
|
<path
|
|
68
68
|
fill="#fff"
|
|
69
69
|
d="M8.975 4.457H7.668v4.8H8.7V7.639l.228.013a2 2 0 0 0 .647-.117a1.4 1.4 0 0 0 .493-.291a1.2 1.2 0 0 0 .332-.454a2.1 2.1 0 0 0 .105-.908a2.2 2.2 0 0 0-.114-.644a1.17 1.17 0 0 0-.687-.65a2 2 0 0 0-.411-.105a2 2 0 0 0-.319-.026m-.189 2.294h-.089v-1.48h.194a.57.57 0 0 1 .459.181a.92.92 0 0 1 .183.558c0 .246 0 .469-.222.626a.94.94 0 0 1-.524.114m3.67-2.306c-.111 0-.219.008-.295.011l-.235.006h-.78v4.8h.918a2.7 2.7 0 0 0 1.028-.175a1.7 1.7 0 0 0 .68-.491a1.9 1.9 0 0 0 .373-.749a3.7 3.7 0 0 0 .114-.949a4.4 4.4 0 0 0-.087-1.127a1.8 1.8 0 0 0-.4-.733a1.6 1.6 0 0 0-.535-.4a2.4 2.4 0 0 0-.549-.178a1.3 1.3 0 0 0-.228-.017m-.182 3.937h-.1V5.315h.013a1.06 1.06 0 0 1 .6.107a1.2 1.2 0 0 1 .324.4a1.3 1.3 0 0 1 .142.526c.009.22 0 .4 0 .549a3 3 0 0 1-.033.513a1.8 1.8 0 0 1-.169.5a1.1 1.1 0 0 1-.363.36a.67.67 0 0 1-.416.106m5.077-3.915h-2.43v4.8h1.028V7.357h1.3v-.892h-1.3V5.353h1.4v-.892"></path>
|
|
70
|
-
</svg>`;class
|
|
70
|
+
</svg>`;class Dx extends me{constructor(e,t){super(e,t),this.id=this.opts.id||"Uploaded",this.title=this.opts.title||"Uploaded",this.params=this.opts.params||{},this.type="acquirer",this.uppy=e,this.uploadedAPIData={..._u},this.addUploadItemFlag=!0,this.icon=()=>le("svg",{"aria-hidden":"true",focusable:"false",width:"18",height:"18",viewBox:"0 0 1024 1024",children:[le("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"}),le("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"}),le("path",{d:"M657.6 0v233.6c0 25.6 17.6 92.8 97.6 92.8H960L657.6 0z",fill:"#37BB91"}),le("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(e){return!this.uploadedAPIData.loading&&this.uploadedAPIData.files?.length===0&&this.queryUploadedFromMediaKit(),le("div",{id:"uploaded",className:"uploaded",children:this.view.render(e)})}queryUploadedFromMediaKit=async()=>{const{pageSize:e,page:t,files:a,hasMore:n,loading:s}=this.uploadedAPIData;if(n&&!s){this.uploadedAPIData.loading=!0,this.uploadedAPIData.page+=1;const{data:o}=await Za.get("/api/uploads",{params:{page:t,pageSize:e,...this.params}});this.uploadedAPIData.loading=!1,this.uploadedAPIData.hasMore=this.uploadedAPIData.page<=o.pageCount,this.uploadedAPIData.files=tp([...a,...o.uploads.map(r=>{let l="file";const{filename:c,_id:p,originalname:u}=r,f=ns(c,0,0,Ot);return l=ns(c,400,0,Ot),{...r,id:p,icon:l,previewUrl:l,fileUrl:f}})],"_id"),this.uploaded.setPluginState({files:this.uploadedAPIData.files,loading:!1}),this.canConvertImgToObject=!0}};addUploadItem=Vn(()=>{if(this.addUploadItemFlag){const e=document.querySelector("#uploaded .uppy-ProviderBrowser-list");if(e){const t=document.createElement("li");t.className="uppy-ProviderBrowserItem",t.innerHTML=`
|
|
71
71
|
<div class="uppy-ProviderBrowserItem-inner uploaded-add-item">
|
|
72
72
|
<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>
|
|
73
73
|
</div>
|
|
74
|
-
`,t.addEventListener("click",async()=>{await this.uppy.openPlugin("My Device")}),e.insertBefore(t,e.firstChild),this.addUploadItemFlag=!1}}},{wait:200});convertImgToObject=Vn(()=>{this.canConvertImgToObject&&(document.querySelectorAll("#uploaded img").forEach(t=>{if(!t?.src)return;const{src:a}=t,n=this.uploadedAPIData.files?.find(r=>r.previewUrl===a),s=document.createElement("div");s.style="width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; ";const o=document.createElement("div");if(o.className="uppy-ProviderBrowserItem-name",o.style="pointer-events: none; position: absolute; bottom: 0; left: 0; right: 0; padding: 5px; background: #0000004d; color: #fff; ",o.innerHTML=Fx(n.originalname),[".mp4",".webm"].find(r=>t.src?.endsWith(r))){const r=document.createElement("video");r.src=t.src,r.width=t.width,r.height=t.height,r.autoplay=!0,r.setAttribute("playsinline","playsinline"),r.muted=!0,r.loop=!0,r.style="pointer-events: none;",s.appendChild(r)}else if([".pdf"].find(r=>t.src?.endsWith(r))){const r=document.createElement("div");r.className="pdf-icon",r.innerHTML=Dx,s.appendChild(r)}else{const r=document.createElement("object");r.data=a,r.type=n.mimetype||"image/png",r.alt=n.originalname,r.style="pointer-events: none; max-width: 100%; max-height: 100%; webkit-user-drag: none; object-fit: contain;",r.loading="lazy",s.appendChild(r)}s.appendChild(o),t.parentNode.replaceChild(s,t)}),this.canConvertImgToObject=!1)},{wait:200});update(){this.convertImgToObject(),this.addUploadItem()}onFirstRender(){}resetState=()=>{this.uploadedAPIData={..._u},this.uploaded.setPluginState({...ku}),this.addUploadItemFlag=!0};install(){this.view=new $r(this,{provider:{},viewType:"grid",showBreadcrumbs:!1,showFilter:!1}),this.uploaded=this.view.plugin,this.uploaded.setPluginState({...ku}),this.uploaded.uppy.on("dashboard:show-panel",this.resetState),this.view.toggleCheckbox=(t,a)=>{const{currentSelection:n}=this.uploaded.getPluginState(),s=this.uploaded.uppy.opts.restrictions.maxNumberOfFiles,o=s?n.length<s:!0;n.find(r=>r._id===a._id)?this.uploaded.setPluginState({currentSelection:[...n.filter(r=>r._id!==a._id)]}):(o||n.pop(),this.uploaded.setPluginState({currentSelection:[...n,a]}))},this.view.donePicking=()=>{const{currentSelection:t}=this.uploaded.getPluginState();this.uppy.emit("uploaded:selected",t),this.uploaded.parent.hideAllPanels()},this.uploaded.uppy.validateRestrictions=()=>!1,this.view.handleScroll=t=>{const{scrollHeight:a,scrollTop:n,offsetHeight:s}=t.target;a-(n+s)<30&&this.queryUploadedFromMediaKit()};const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount(),this.uploaded.uppy.off("dashboard:show-panel",this.resetState)}}const Tu={initialized:!1,data:[],files:[],pageSize:16,page:1,loading:!1,hasMore:!0,componentDid:"",components:[]},Eu={authenticated:!0,files:[],folders:[],breadcrumbs:[],filterInput:"",isSearchVisible:!1,currentSelection:[],loading:!0,loadAllFiles:!0},Ax={padding:"5px 15px",marginRight:"8px",marginTop:"8px",borderRadius:"4px",cursor:"pointer",fontSize:"14px",lineHeight:"24.5px",fontWeight:"bold"};class Ox extends me{constructor(e,t){super(e,t),this.id=this.opts.id||"Resources",this.title=this.opts.title||"Resources",this.params=this.opts.params||{},this.type="acquirer",this.uppy=e,this.componentDid="",this.apiData={...Tu},this.icon=()=>le("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:[le("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"}),le("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"}),le("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(e){return!this.apiData.loading&&!this.apiData.initialized&&this.queryResources(),le("div",{id:"resources",className:"uploaded",children:[le("div",{style:{padding:this.apiData.components.length?"12px":"0",display:"flex",flexWrap:"wrap",marginTop:"-8px"},children:this.apiData.components.map(t=>le("button",{className:this.apiData.componentDid===t.did?"button-color-style button-color-style-active":"button-color-style",style:Ax,id:t.componentDid,onClick:()=>{this.apiData.componentDid!==t.did&&(this.apiData.componentDid=t.did,this.queryResources())},children:Hh(t.name)}))}),this.view.render(e)]})}queryResources=async()=>{if(!this.apiData.loading){this.apiData.loading=!0;const{data:e}=await Za.get("/api/resources",{params:{componentDid:this.apiData.componentDid}});this.apiData.loading=!1,this.apiData.initialized=!0,this.apiData.components=e.components||[],this.apiData.componentDid=e.componentDid||"",this.apiData.files=tp([...e.resources.map(t=>{let a="file";const{filename:n}=t,s=ns(n,0,0,Ot);return a=ns(n,400,0,Ot),{filename:n,_id:n,id:n,name:n,icon:a,previewUrl:a,fileUrl:s}})],"id"),this.resources.setPluginState({files:this.apiData.files,loading:!1})}};update(){}onFirstRender(){}resetState=()=>{this.apiData={...Tu},this.resources.setPluginState({...Eu})};install(){this.view=new $r(this,{provider:{},viewType:"grid",showBreadcrumbs:!1,showFilter:!1}),this.resources=this.view.plugin,this.resources.setPluginState({...Eu}),this.resources.uppy.on("dashboard:show-panel",this.resetState),this.view.toggleCheckbox=(t,a)=>{const{currentSelection:n}=this.resources.getPluginState(),s=this.resources.uppy.opts.restrictions.maxNumberOfFiles,o=s?n.length<s:!0;n.find(r=>r.id===a.id)?this.resources.setPluginState({currentSelection:[...n.filter(r=>r.id!==a.id)]}):(o||n.pop(),this.resources.setPluginState({currentSelection:[...n,a]}))},this.resources.uppy.validateRestrictions=()=>!1,this.view.donePicking=()=>{const{currentSelection:t}=this.resources.getPluginState();this.uppy.emit("resources:selected",t),this.resources.parent.hideAllPanels()};const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount(),this.resources.uppy.off("dashboard:show-panel",this.resetState)}}var Re=Uint8Array,Pi=Uint16Array,Rx=Int32Array,vh=new Re([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bh=new Re([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ux=new Re([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yh=function(i,e){for(var t=new Pi(31),a=0;a<31;++a)t[a]=e+=1<<i[a-1];for(var n=new Rx(t[30]),a=1;a<30;++a)for(var s=t[a];s<t[a+1];++s)n[s]=s-t[a]<<5|a;return{b:t,r:n}},xh=yh(vh,2),wh=xh.b,Mx=xh.r;wh[28]=258,Mx[258]=28;var Lx=yh(bh,0),Nx=Lx.b,Sr=new Pi(32768);for(var te=0;te<32768;++te){var Ut=(te&43690)>>1|(te&21845)<<1;Ut=(Ut&52428)>>2|(Ut&13107)<<2,Ut=(Ut&61680)>>4|(Ut&3855)<<4,Sr[te]=((Ut&65280)>>8|(Ut&255)<<8)>>1}var Ta=function(i,e,t){for(var a=i.length,n=0,s=new Pi(e);n<a;++n)i[n]&&++s[i[n]-1];var o=new Pi(e);for(n=1;n<e;++n)o[n]=o[n-1]+s[n-1]<<1;var r;if(t){r=new Pi(1<<e);var l=15-e;for(n=0;n<a;++n)if(i[n])for(var c=n<<4|i[n],p=e-i[n],u=o[i[n]-1]++<<p,f=u|(1<<p)-1;u<=f;++u)r[Sr[u]>>l]=c}else for(r=new Pi(a),n=0;n<a;++n)i[n]&&(r[n]=Sr[o[i[n]-1]++]>>15-i[n]);return r},en=new Re(288);for(var te=0;te<144;++te)en[te]=8;for(var te=144;te<256;++te)en[te]=9;for(var te=256;te<280;++te)en[te]=7;for(var te=280;te<288;++te)en[te]=8;var Sh=new Re(32);for(var te=0;te<32;++te)Sh[te]=5;var Bx=Ta(en,9,1),jx=Ta(Sh,5,1),xo=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},Ze=function(i,e,t){var a=e/8|0;return(i[a]|i[a+1]<<8)>>(e&7)&t},wo=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},zx=function(i){return(i+7)/8|0},pl=function(i,e,t){return(e==null||e<0)&&(e=0),(t==null||t>i.length)&&(t=i.length),new Re(i.subarray(e,t))},$x=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Pe=function(i,e,t){var a=new Error(e||$x[i]);if(a.code=i,Error.captureStackTrace&&Error.captureStackTrace(a,Pe),!t)throw a;return a},dl=function(i,e,t,a){var n=i.length,s=a?a.length:0;if(!n||e.f&&!e.l)return t||new Re(0);var o=!t,r=o||e.i!=2,l=e.i;o&&(t=new Re(n*3));var c=function(xl){var wl=t.length;if(xl>wl){var Sl=new Re(Math.max(wl*2,xl));Sl.set(t),t=Sl}},p=e.f||0,u=e.p||0,f=e.b||0,x=e.l,S=e.d,_=e.m,w=e.n,y=n*8;do{if(!x){p=Ze(i,u,1);var b=Ze(i,u+1,3);if(u+=3,b)if(b==1)x=Bx,S=jx,_=9,w=5;else if(b==2){var g=Ze(i,u,31)+257,k=Ze(i,u+10,15)+4,T=g+Ze(i,u+5,31)+1;u+=14;for(var D=new Re(T),L=new Re(19),B=0;B<k;++B)L[Ux[B]]=Ze(i,u+B*3,7);u+=k*3;for(var V=xo(L),I=(1<<V)-1,$=Ta(L,V,1),B=0;B<T;){var U=$[Ze(i,u,I)];u+=U&15;var h=U>>4;if(h<16)D[B++]=h;else{var C=0,P=0;for(h==16?(P=3+Ze(i,u,3),u+=2,C=D[B-1]):h==17?(P=3+Ze(i,u,7),u+=3):h==18&&(P=11+Ze(i,u,127),u+=7);P--;)D[B++]=C}}var F=D.subarray(0,g),E=D.subarray(g);_=xo(F),w=xo(E),x=Ta(F,_,1),S=Ta(E,w,1)}else Pe(1);else{var h=zx(u)+4,m=i[h-4]|i[h-3]<<8,v=h+m;if(v>n){l&&Pe(0);break}r&&c(f+m),t.set(i.subarray(h,v),f),e.b=f+=m,e.p=u=v*8,e.f=p;continue}if(u>y){l&&Pe(0);break}}r&&c(f+131072);for(var O=(1<<_)-1,A=(1<<w)-1,z=u;;z=u){var C=x[wo(i,u)&O],W=C>>4;if(u+=C&15,u>y){l&&Pe(0);break}if(C||Pe(2),W<256)t[f++]=W;else if(W==256){z=u,x=null;break}else{var G=W-254;if(W>264){var B=W-257,X=vh[B];G=Ze(i,u,(1<<X)-1)+wh[B],u+=X}var J=S[wo(i,u)&A],Z=J>>4;J||Pe(3),u+=J&15;var E=Nx[Z];if(Z>3){var X=bh[Z];E+=wo(i,u)&(1<<X)-1,u+=X}if(u>y){l&&Pe(0);break}r&&c(f+131072);var gt=f+G;if(f<E){var yl=s-E,Mh=Math.min(E,gt);for(yl+f<0&&Pe(3);f<Mh;++f)t[f]=a[yl+f]}for(;f<gt;++f)t[f]=t[f-E]}}e.l=x,e.p=z,e.b=f,e.f=p,x&&(p=1,e.m=_,e.d=S,e.n=w)}while(!p);return f!=t.length&&o?pl(t,0,f):t.subarray(0,f)},Hx=new Re(0),ut=function(i,e){return i[e]|i[e+1]<<8},st=function(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24)>>>0},So=function(i,e){return st(i,e)+st(i,e+4)*4294967296},qx=function(i){(i[0]!=31||i[1]!=139||i[2]!=8)&&Pe(6,"invalid gzip data");var e=i[3],t=10;e&4&&(t+=(i[10]|i[11]<<8)+2);for(var a=(e>>3&1)+(e>>4&1);a>0;a-=!i[t++]);return t+(e&2)},Vx=function(i){var e=i.length;return(i[e-4]|i[e-3]<<8|i[e-2]<<16|i[e-1]<<24)>>>0},Wx=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Pe(6,"invalid zlib data"),(i[1]>>5&1)==+!e&&Pe(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ph(i,e){return dl(i,{i:2},e&&e.out,e&&e.dictionary)}function Gx(i,e){var t=qx(i);return t+8>i.length&&Pe(6,"invalid gzip data"),dl(i.subarray(t,-8),{i:2},e&&e.out||new Re(Vx(i)),e&&e.dictionary)}function Kx(i,e){return dl(i.subarray(Wx(i,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function Po(i,e){return i[0]==31&&i[1]==139&&i[2]==8?Gx(i,e):(i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31?Ph(i,e):Kx(i,e)}var Pr=typeof TextDecoder<"u"&&new TextDecoder,Xx=0;try{Pr.decode(Hx,{stream:!0}),Xx=1}catch{}var Yx=function(i){for(var e="",t=0;;){var a=i[t++],n=(a>127)+(a>223)+(a>239);if(t+n>i.length)return{s:e,r:pl(i,t-1)};n?n==3?(a=((a&15)<<18|(i[t++]&63)<<12|(i[t++]&63)<<6|i[t++]&63)-65536,e+=String.fromCharCode(55296|a>>10,56320|a&1023)):n&1?e+=String.fromCharCode((a&31)<<6|i[t++]&63):e+=String.fromCharCode((a&15)<<12|(i[t++]&63)<<6|i[t++]&63):e+=String.fromCharCode(a)}};function Qx(i,e){if(e){for(var t="",a=0;a<i.length;a+=16384)t+=String.fromCharCode.apply(null,i.subarray(a,a+16384));return t}else{if(Pr)return Pr.decode(i);var n=Yx(i),s=n.s,t=n.r;return t.length&&Pe(8),s}}var Jx=function(i,e){return e+30+ut(i,e+26)+ut(i,e+28)},Zx=function(i,e,t){var a=ut(i,e+28),n=Qx(i.subarray(e+46,e+46+a),!(ut(i,e+8)&2048)),s=e+46+a,o=st(i,e+20),r=t&&o==4294967295?ew(i,s):[o,st(i,e+24),st(i,e+42)],l=r[0],c=r[1],p=r[2];return[ut(i,e+10),l,c,n,s+ut(i,e+30)+ut(i,e+32),p]},ew=function(i,e){for(;ut(i,e)!=1;e+=4+ut(i,e+2));return[So(i,e+12),So(i,e+4),So(i,e+20)]};function tw(i,e){for(var t={},a=i.length-22;st(i,a)!=101010256;--a)(!a||i.length-a>65558)&&Pe(13);var n=ut(i,a+8);if(!n)return{};var s=st(i,a+16),o=s==4294967295||n==65535;if(o){var r=st(i,a-12);o=st(i,r)==101075792,o&&(n=st(i,r+32),s=st(i,r+48))}for(var l=e&&e.filter,c=0;c<n;++c){var p=Zx(i,s,o),u=p[0],f=p[1],x=p[2],S=p[3],_=p[4],w=p[5],y=Jx(i,w);s=_,(!l||l({name:S,size:f,originalSize:x,compression:u}))&&(u?u==8?t[S]=Ph(i.subarray(y,y+f),{out:new Re(x)}):Pe(14,"unknown compression type "+u):t[S]=pl(i,y,y+f))}return t}var Co={exports:{}},Du;function iw(){return Du||(Du=1,function(i,e){(function(t){i.exports=t()})(function(t){var a=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(y,b){var h=y[0],m=y[1],v=y[2],g=y[3];h+=(m&v|~m&g)+b[0]-680876936|0,h=(h<<7|h>>>25)+m|0,g+=(h&m|~h&v)+b[1]-389564586|0,g=(g<<12|g>>>20)+h|0,v+=(g&h|~g&m)+b[2]+606105819|0,v=(v<<17|v>>>15)+g|0,m+=(v&g|~v&h)+b[3]-1044525330|0,m=(m<<22|m>>>10)+v|0,h+=(m&v|~m&g)+b[4]-176418897|0,h=(h<<7|h>>>25)+m|0,g+=(h&m|~h&v)+b[5]+1200080426|0,g=(g<<12|g>>>20)+h|0,v+=(g&h|~g&m)+b[6]-1473231341|0,v=(v<<17|v>>>15)+g|0,m+=(v&g|~v&h)+b[7]-45705983|0,m=(m<<22|m>>>10)+v|0,h+=(m&v|~m&g)+b[8]+1770035416|0,h=(h<<7|h>>>25)+m|0,g+=(h&m|~h&v)+b[9]-1958414417|0,g=(g<<12|g>>>20)+h|0,v+=(g&h|~g&m)+b[10]-42063|0,v=(v<<17|v>>>15)+g|0,m+=(v&g|~v&h)+b[11]-1990404162|0,m=(m<<22|m>>>10)+v|0,h+=(m&v|~m&g)+b[12]+1804603682|0,h=(h<<7|h>>>25)+m|0,g+=(h&m|~h&v)+b[13]-40341101|0,g=(g<<12|g>>>20)+h|0,v+=(g&h|~g&m)+b[14]-1502002290|0,v=(v<<17|v>>>15)+g|0,m+=(v&g|~v&h)+b[15]+1236535329|0,m=(m<<22|m>>>10)+v|0,h+=(m&g|v&~g)+b[1]-165796510|0,h=(h<<5|h>>>27)+m|0,g+=(h&v|m&~v)+b[6]-1069501632|0,g=(g<<9|g>>>23)+h|0,v+=(g&m|h&~m)+b[11]+643717713|0,v=(v<<14|v>>>18)+g|0,m+=(v&h|g&~h)+b[0]-373897302|0,m=(m<<20|m>>>12)+v|0,h+=(m&g|v&~g)+b[5]-701558691|0,h=(h<<5|h>>>27)+m|0,g+=(h&v|m&~v)+b[10]+38016083|0,g=(g<<9|g>>>23)+h|0,v+=(g&m|h&~m)+b[15]-660478335|0,v=(v<<14|v>>>18)+g|0,m+=(v&h|g&~h)+b[4]-405537848|0,m=(m<<20|m>>>12)+v|0,h+=(m&g|v&~g)+b[9]+568446438|0,h=(h<<5|h>>>27)+m|0,g+=(h&v|m&~v)+b[14]-1019803690|0,g=(g<<9|g>>>23)+h|0,v+=(g&m|h&~m)+b[3]-187363961|0,v=(v<<14|v>>>18)+g|0,m+=(v&h|g&~h)+b[8]+1163531501|0,m=(m<<20|m>>>12)+v|0,h+=(m&g|v&~g)+b[13]-1444681467|0,h=(h<<5|h>>>27)+m|0,g+=(h&v|m&~v)+b[2]-51403784|0,g=(g<<9|g>>>23)+h|0,v+=(g&m|h&~m)+b[7]+1735328473|0,v=(v<<14|v>>>18)+g|0,m+=(v&h|g&~h)+b[12]-1926607734|0,m=(m<<20|m>>>12)+v|0,h+=(m^v^g)+b[5]-378558|0,h=(h<<4|h>>>28)+m|0,g+=(h^m^v)+b[8]-2022574463|0,g=(g<<11|g>>>21)+h|0,v+=(g^h^m)+b[11]+1839030562|0,v=(v<<16|v>>>16)+g|0,m+=(v^g^h)+b[14]-35309556|0,m=(m<<23|m>>>9)+v|0,h+=(m^v^g)+b[1]-1530992060|0,h=(h<<4|h>>>28)+m|0,g+=(h^m^v)+b[4]+1272893353|0,g=(g<<11|g>>>21)+h|0,v+=(g^h^m)+b[7]-155497632|0,v=(v<<16|v>>>16)+g|0,m+=(v^g^h)+b[10]-1094730640|0,m=(m<<23|m>>>9)+v|0,h+=(m^v^g)+b[13]+681279174|0,h=(h<<4|h>>>28)+m|0,g+=(h^m^v)+b[0]-358537222|0,g=(g<<11|g>>>21)+h|0,v+=(g^h^m)+b[3]-722521979|0,v=(v<<16|v>>>16)+g|0,m+=(v^g^h)+b[6]+76029189|0,m=(m<<23|m>>>9)+v|0,h+=(m^v^g)+b[9]-640364487|0,h=(h<<4|h>>>28)+m|0,g+=(h^m^v)+b[12]-421815835|0,g=(g<<11|g>>>21)+h|0,v+=(g^h^m)+b[15]+530742520|0,v=(v<<16|v>>>16)+g|0,m+=(v^g^h)+b[2]-995338651|0,m=(m<<23|m>>>9)+v|0,h+=(v^(m|~g))+b[0]-198630844|0,h=(h<<6|h>>>26)+m|0,g+=(m^(h|~v))+b[7]+1126891415|0,g=(g<<10|g>>>22)+h|0,v+=(h^(g|~m))+b[14]-1416354905|0,v=(v<<15|v>>>17)+g|0,m+=(g^(v|~h))+b[5]-57434055|0,m=(m<<21|m>>>11)+v|0,h+=(v^(m|~g))+b[12]+1700485571|0,h=(h<<6|h>>>26)+m|0,g+=(m^(h|~v))+b[3]-1894986606|0,g=(g<<10|g>>>22)+h|0,v+=(h^(g|~m))+b[10]-1051523|0,v=(v<<15|v>>>17)+g|0,m+=(g^(v|~h))+b[1]-2054922799|0,m=(m<<21|m>>>11)+v|0,h+=(v^(m|~g))+b[8]+1873313359|0,h=(h<<6|h>>>26)+m|0,g+=(m^(h|~v))+b[15]-30611744|0,g=(g<<10|g>>>22)+h|0,v+=(h^(g|~m))+b[6]-1560198380|0,v=(v<<15|v>>>17)+g|0,m+=(g^(v|~h))+b[13]+1309151649|0,m=(m<<21|m>>>11)+v|0,h+=(v^(m|~g))+b[4]-145523070|0,h=(h<<6|h>>>26)+m|0,g+=(m^(h|~v))+b[11]-1120210379|0,g=(g<<10|g>>>22)+h|0,v+=(h^(g|~m))+b[2]+718787259|0,v=(v<<15|v>>>17)+g|0,m+=(g^(v|~h))+b[9]-343485551|0,m=(m<<21|m>>>11)+v|0,y[0]=h+y[0]|0,y[1]=m+y[1]|0,y[2]=v+y[2]|0,y[3]=g+y[3]|0}function s(y){var b=[],h;for(h=0;h<64;h+=4)b[h>>2]=y.charCodeAt(h)+(y.charCodeAt(h+1)<<8)+(y.charCodeAt(h+2)<<16)+(y.charCodeAt(h+3)<<24);return b}function o(y){var b=[],h;for(h=0;h<64;h+=4)b[h>>2]=y[h]+(y[h+1]<<8)+(y[h+2]<<16)+(y[h+3]<<24);return b}function r(y){var b=y.length,h=[1732584193,-271733879,-1732584194,271733878],m,v,g,k,T,D;for(m=64;m<=b;m+=64)n(h,s(y.substring(m-64,m)));for(y=y.substring(m-64),v=y.length,g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=0;m<v;m+=1)g[m>>2]|=y.charCodeAt(m)<<(m%4<<3);if(g[m>>2]|=128<<(m%4<<3),m>55)for(n(h,g),m=0;m<16;m+=1)g[m]=0;return k=b*8,k=k.toString(16).match(/(.*?)(.{0,8})$/),T=parseInt(k[2],16),D=parseInt(k[1],16)||0,g[14]=T,g[15]=D,n(h,g),h}function l(y){var b=y.length,h=[1732584193,-271733879,-1732584194,271733878],m,v,g,k,T,D;for(m=64;m<=b;m+=64)n(h,o(y.subarray(m-64,m)));for(y=m-64<b?y.subarray(m-64):new Uint8Array(0),v=y.length,g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=0;m<v;m+=1)g[m>>2]|=y[m]<<(m%4<<3);if(g[m>>2]|=128<<(m%4<<3),m>55)for(n(h,g),m=0;m<16;m+=1)g[m]=0;return k=b*8,k=k.toString(16).match(/(.*?)(.{0,8})$/),T=parseInt(k[2],16),D=parseInt(k[1],16)||0,g[14]=T,g[15]=D,n(h,g),h}function c(y){var b="",h;for(h=0;h<4;h+=1)b+=a[y>>h*8+4&15]+a[y>>h*8&15];return b}function p(y){var b;for(b=0;b<y.length;b+=1)y[b]=c(y[b]);return y.join("")}p(r("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function y(b,h){return b=b|0||0,b<0?Math.max(b+h,0):Math.min(b,h)}ArrayBuffer.prototype.slice=function(b,h){var m=this.byteLength,v=y(b,m),g=m,k,T,D,L;return h!==t&&(g=y(h,m)),v>g?new ArrayBuffer(0):(k=g-v,T=new ArrayBuffer(k),D=new Uint8Array(T),L=new Uint8Array(this,v,k),D.set(L),T)}}();function u(y){return/[\u0080-\uFFFF]/.test(y)&&(y=unescape(encodeURIComponent(y))),y}function f(y,b){var h=y.length,m=new ArrayBuffer(h),v=new Uint8Array(m),g;for(g=0;g<h;g+=1)v[g]=y.charCodeAt(g);return b?v:m}function x(y){return String.fromCharCode.apply(null,new Uint8Array(y))}function S(y,b,h){var m=new Uint8Array(y.byteLength+b.byteLength);return m.set(new Uint8Array(y)),m.set(new Uint8Array(b),y.byteLength),m}function _(y){var b=[],h=y.length,m;for(m=0;m<h-1;m+=2)b.push(parseInt(y.substr(m,2),16));return String.fromCharCode.apply(String,b)}function w(){this.reset()}return w.prototype.append=function(y){return this.appendBinary(u(y)),this},w.prototype.appendBinary=function(y){this._buff+=y,this._length+=y.length;var b=this._buff.length,h;for(h=64;h<=b;h+=64)n(this._hash,s(this._buff.substring(h-64,h)));return this._buff=this._buff.substring(h-64),this},w.prototype.end=function(y){var b=this._buff,h=b.length,m,v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g;for(m=0;m<h;m+=1)v[m>>2]|=b.charCodeAt(m)<<(m%4<<3);return this._finish(v,h),g=p(this._hash),y&&(g=_(g)),this.reset(),g},w.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},w.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},w.prototype.setState=function(y){return this._buff=y.buff,this._length=y.length,this._hash=y.hash,this},w.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},w.prototype._finish=function(y,b){var h=b,m,v,g;if(y[h>>2]|=128<<(h%4<<3),h>55)for(n(this._hash,y),h=0;h<16;h+=1)y[h]=0;m=this._length*8,m=m.toString(16).match(/(.*?)(.{0,8})$/),v=parseInt(m[2],16),g=parseInt(m[1],16)||0,y[14]=v,y[15]=g,n(this._hash,y)},w.hash=function(y,b){return w.hashBinary(u(y),b)},w.hashBinary=function(y,b){var h=r(y),m=p(h);return b?_(m):m},w.ArrayBuffer=function(){this.reset()},w.ArrayBuffer.prototype.append=function(y){var b=S(this._buff.buffer,y),h=b.length,m;for(this._length+=y.byteLength,m=64;m<=h;m+=64)n(this._hash,o(b.subarray(m-64,m)));return this._buff=m-64<h?new Uint8Array(b.buffer.slice(m-64)):new Uint8Array(0),this},w.ArrayBuffer.prototype.end=function(y){var b=this._buff,h=b.length,m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],v,g;for(v=0;v<h;v+=1)m[v>>2]|=b[v]<<(v%4<<3);return this._finish(m,h),g=p(this._hash),y&&(g=_(g)),this.reset(),g},w.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},w.ArrayBuffer.prototype.getState=function(){var y=w.prototype.getState.call(this);return y.buff=x(y.buff),y},w.ArrayBuffer.prototype.setState=function(y){return y.buff=f(y.buff,!0),w.prototype.setState.call(this,y)},w.ArrayBuffer.prototype.destroy=w.prototype.destroy,w.ArrayBuffer.prototype._finish=w.prototype._finish,w.ArrayBuffer.hash=function(y,b){var h=l(new Uint8Array(y)),m=p(h);return b?_(m):m},w})}(Co)),Co.exports}var aw=iw();const nw=ft(aw);var gs=typeof self<"u"?self:us;const Wa=typeof navigator<"u",sw=Wa&&typeof HTMLImageElement>"u",ss=!(typeof us>"u"||typeof Ci>"u"||!Ci.versions||!Ci.versions.node),hl=gs.Buffer,Sn=gs.BigInt,fl=!!hl,ow=i=>i;function os(i,e=ow){if(ss)try{return typeof require=="function"?Promise.resolve(e(require(i))):import(i).then(e)}catch{console.warn(`Couldn't load ${i}`)}}let ml=gs.fetch;const rw=i=>ml=i;if(!gs.fetch){const i=os("http",a=>a),e=os("https",a=>a),t=(a,{headers:n}={})=>new Promise(async(s,o)=>{let{port:r,hostname:l,pathname:c,protocol:p,search:u}=new URL(a);const f={method:"GET",hostname:l,path:encodeURI(c)+u,headers:n};r!==""&&(f.port=Number(r));const x=(p==="https:"?await e:await i).request(f,S=>{if(S.statusCode===301||S.statusCode===302){let _=new URL(S.headers.location,a).toString();return t(_,{headers:n}).then(s).catch(o)}s({status:S.statusCode,arrayBuffer:()=>new Promise(_=>{let w=[];S.on("data",y=>w.push(y)),S.on("end",()=>_(mt.concat(w)))})})});x.on("error",o),x.end()});rw(t)}function q(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}const rs=i=>Ch(i)?void 0:i,lw=i=>i!==void 0;function Ch(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(lw).length===0)}function fe(i){let e=new Error(i);throw delete e.stack,e}function oi(i){return(i=function(e){for(;e.endsWith("\0");)e=e.slice(0,-1);return e}(i).trim())===""?void 0:i}function Cr(i){let e=function(t){let a=0;return t.ifd0.enabled&&(a+=1024),t.exif.enabled&&(a+=2048),t.makerNote&&(a+=2048),t.userComment&&(a+=1024),t.gps.enabled&&(a+=512),t.interop.enabled&&(a+=100),t.ifd1.enabled&&(a+=1024),a+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 Fr=i=>String.fromCharCode.apply(null,i),Iu=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0;function Fh(i){return Iu?Iu.decode(i):fl?mt.from(i).toString("utf8"):decodeURIComponent(escape(Fr(i)))}class Ue{static from(e,t){return e instanceof this&&e.le===t?e:new Ue(e,void 0,void 0,t)}constructor(e,t=0,a,n){if(typeof n=="boolean"&&(this.le=n),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){a===void 0&&(a=e.byteLength-t);let s=new DataView(e,t,a);this._swapDataView(s)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof Ue){a===void 0&&(a=e.byteLength-t),(t+=e.byteOffset)+a>e.byteOffset+e.byteLength&&fe("Creating view outside of available memory in ArrayBuffer");let s=new DataView(e.buffer,t,a);this._swapDataView(s)}else if(typeof e=="number"){let s=new DataView(new ArrayBuffer(e));this._swapDataView(s)}else fe("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,a=Ue){return e instanceof DataView||e instanceof Ue?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||fe("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new a(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new Ue(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 Fh(this.getUint8Array(e,t))}getLatin1String(e=0,t=this.byteLength){let a=this.getUint8Array(e,t);return Fr(a)}getUnicodeString(e=0,t=this.byteLength){const a=[];for(let n=0;n<t&&e+n<this.byteLength;n+=2)a.push(this.getUint16(e+n));return Fr(a)}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,a){switch(t){case 1:return this.getUint8(e,a);case 2:return this.getUint16(e,a);case 4:return this.getUint32(e,a);case 8:return this.getUint64&&this.getUint64(e,a)}}getUint(e,t,a){switch(t){case 8:return this.getUint8(e,a);case 16:return this.getUint16(e,a);case 32:return this.getUint32(e,a);case 64:return this.getUint64&&this.getUint64(e,a)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}}function _r(i,e){fe(`${i} '${e}' was not loaded, try using full build of exifr.`)}class gl extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||_r(this.kind,e),t&&(e in t||function(a,n){fe(`Unknown ${a} '${n}'.`)}(this.kind,e),t[e].enabled||_r(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}}var Ii=new gl("file parser"),Ce=new gl("segment parser"),Ui=new gl("file reader");function cw(i,e){return typeof i=="string"?Au(i,e):Wa&&!sw&&i instanceof HTMLImageElement?Au(i.src,e):i instanceof Uint8Array||i instanceof ArrayBuffer||i instanceof DataView?new Ue(i):Wa&&i instanceof Blob?kr(i,e,"blob",Dr):void fe("Invalid input argument")}function Au(i,e){return(t=i).startsWith("data:")||t.length>1e4?Tr(i,e,"base64"):ss&&i.includes("://")?kr(i,e,"url",Er):ss?Tr(i,e,"fs"):Wa?kr(i,e,"url",Er):void fe("Invalid input argument");var t}async function kr(i,e,t,a){return Ui.has(t)?Tr(i,e,t):a?async function(n,s){let o=await s(n);return new Ue(o)}(i,a):void fe(`Parser ${t} is not loaded`)}async function Tr(i,e,t){let a=new(Ui.get(t))(i,e);return await a.read(),a}const Er=i=>ml(i).then(e=>e.arrayBuffer()),Dr=i=>new Promise((e,t)=>{let a=new FileReader;a.onloadend=()=>e(a.result||new ArrayBuffer),a.onerror=t,a.readAsArrayBuffer(i)});class uw extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}}function Se(i,e,t){let a=new uw;for(let[n,s]of t)a.set(n,s);if(Array.isArray(e))for(let n of e)i.set(n,a);else i.set(e,a);return a}function Ir(i,e,t){let a,n=i.get(e);for(a of t)n.set(a[0],a[1])}const Me=new Map,di=new Map,$n=new Map,Pn=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],_h=["jfif","xmp","icc","iptc","ihdr"],Ar=["tiff",..._h],ve=["ifd0","ifd1","exif","gps","interop"],Cn=[...Ar,...ve],Fn=["makerNote","userComment"],kh=["translateKeys","translateValues","reviveValues","multiSegment"],_n=[...kh,"sanitize","mergeOutput","silentErrors"];class Th{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}}class ra extends Th{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,a,n){if(super(),q(this,"enabled",!1),q(this,"skip",new Set),q(this,"pick",new Set),q(this,"deps",new Set),q(this,"translateKeys",!1),q(this,"translateValues",!1),q(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(n),this.canBeFiltered=ve.includes(e),this.canBeFiltered&&(this.dict=Me.get(e)),a!==void 0)if(Array.isArray(a))this.parse=this.enabled=!0,this.canBeFiltered&&a.length>0&&this.translateTagSet(a,this.pick);else if(typeof a=="object"){if(this.enabled=!0,this.parse=a.parse!==!1,this.canBeFiltered){let{pick:s,skip:o}=a;s&&s.length>0&&this.translateTagSet(s,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(a)}else a===!0||a===!1?this.parse=this.enabled=a:fe(`Invalid options argument: ${a}`)}applyInheritables(e){let t,a;for(t of kh)a=e[t],a!==void 0&&(this[t]=a)}translateTagSet(e,t){if(this.dict){let a,n,{tagKeys:s,tagValues:o}=this.dict;for(a of e)typeof a=="string"?(n=o.indexOf(a),n===-1&&(n=s.indexOf(Number(a))),n!==-1&&t.add(Number(s[n]))):t.add(a)}else for(let a of e)t.add(a)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,ls(this.pick,this.deps)):this.enabled&&this.pick.size>0&&ls(this.pick,this.deps)}}var Te={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},Ou=new Map;class vl extends Th{static useCached(e){let t=Ou.get(e);return t!==void 0||(t=new this(e),Ou.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):fe(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=Wa?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of Pn)this[e]=Te[e];for(e of _n)this[e]=Te[e];for(e of Fn)this[e]=Te[e];for(e of Cn)this[e]=new ra(e,Te[e],void 0,this)}setupFromTrue(){let e;for(e of Pn)this[e]=Te[e];for(e of _n)this[e]=Te[e];for(e of Fn)this[e]=!0;for(e of Cn)this[e]=new ra(e,!0,void 0,this)}setupFromArray(e){let t;for(t of Pn)this[t]=Te[t];for(t of _n)this[t]=Te[t];for(t of Fn)this[t]=Te[t];for(t of Cn)this[t]=new ra(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,ve)}setupFromObject(e){let t;for(t of(ve.ifd0=ve.ifd0||ve.image,ve.ifd1=ve.ifd1||ve.thumbnail,Object.assign(this,e),Pn))this[t]=Fo(e[t],Te[t]);for(t of _n)this[t]=Fo(e[t],Te[t]);for(t of Fn)this[t]=Fo(e[t],Te[t]);for(t of Ar)this[t]=new ra(t,Te[t],e[t],this);for(t of ve)this[t]=new ra(t,Te[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,ve,Cn),e.tiff===!0?this.batchEnableWithBool(ve,!0):e.tiff===!1?this.batchEnableWithUserValue(ve,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,ve):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,ve)}batchEnableWithBool(e,t){for(let a of e)this[a].enabled=t}batchEnableWithUserValue(e,t){for(let a of e){let n=t[a];this[a].enabled=n!==!1&&n!==void 0}}setupGlobalFilters(e,t,a,n=a){if(e&&e.length){for(let o of n)this[o].enabled=!1;let s=Ru(e,a);for(let[o,r]of s)ls(this[o].pick,r),this[o].enabled=!0}else if(t&&t.length){let s=Ru(t,a);for(let[o,r]of s)ls(this[o].skip,r)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:a,iptc:n,icc:s}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),a.enabled||e.skip.add(700),n.enabled||e.skip.add(33723),s.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:a,interop:n}=this;n.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),a.needed&&e.deps.add(34853),this.tiff.enabled=ve.some(s=>this[s].enabled===!0)||this.makerNote||this.userComment;for(let s of ve)this[s].finalizeFilters()}get onlyTiff(){return!_h.map(e=>this[e].enabled).some(e=>e===!0)&&this.tiff.enabled}checkLoadedPlugins(){for(let e of Ar)this[e].enabled&&!Ce.has(e)&&_r("segment parser",e)}}function Ru(i,e){let t,a,n,s,o=[];for(n of e){for(s of(t=Me.get(n),a=[],t))(i.includes(s[0])||i.includes(s[1]))&&a.push(s[0]);a.length&&o.push([n,a])}return o}function Fo(i,e){return i!==void 0?i:e!==void 0?e:void 0}function ls(i,e){for(let t of e)i.add(t)}q(vl,"default",Te);class pw{constructor(e){q(this,"parsers",{}),q(this,"output",{}),q(this,"errors",[]),q(this,"pushToErrors",t=>this.errors.push(t)),this.options=vl.useCached(e)}async read(e){this.file=await cw(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[a,n]of Ii)if(n.canHandle(e,t))return this.fileParser=new n(this.options,this.file,this.parsers),e[a]=!0;this.file.close&&this.file.close(),fe("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),rs(e)}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map(async a=>{let n=await a.parse();a.assignToOutput(e,n)});this.options.silentErrors&&(t=t.map(a=>a.catch(this.pushToErrors))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,a=Ce.get("tiff",e);var n;if(t.tiff?n={start:0,type:"tiff"}:t.jpeg&&(n=await this.fileParser.getOrFindSegment("tiff")),n===void 0)return;let s=await this.fileParser.ensureSegmentChunk(n),o=this.parsers.tiff=new a(s,e,t),r=await o.extractThumbnail();return t.close&&t.close(),r}}class vs{constructor(e,t,a){q(this,"errors",[]),q(this,"ensureSegmentChunk",async n=>{let s=n.start,o=n.size||65536;if(this.file.chunked)if(this.file.available(s,o))n.chunk=this.file.subarray(s,o);else try{n.chunk=await this.file.readChunk(s,o)}catch(r){fe(`Couldn't read segment: ${JSON.stringify(n)}. ${r.message}`)}else this.file.byteLength>s+o?n.chunk=this.file.subarray(s,o):n.size===void 0?n.chunk=this.file.subarray(s):fe("Segment unreachable: "+JSON.stringify(n));return n.chunk}),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=a}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let a=new(Ce.get(e))(t,this.options,this.file);return this.parsers[e]=a}createParsers(e){for(let t of e){let{type:a,chunk:n}=t,s=this.options[a];if(s&&s.enabled){let o=this.parsers[a];o&&o.append||o||this.createParser(a,n)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}class ot{static findPosition(e,t){let a=e.getUint16(t+2)+2,n=typeof this.headerLength=="function"?this.headerLength(e,t,a):this.headerLength,s=t+n,o=a-n;return{offset:t,length:a,headerLength:n,start:s,size:o,end:s+o}}static parse(e,t={}){return new this(e,new vl({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof Ue?e:new Ue(e)}constructor(e,t={},a){q(this,"errors",[]),q(this,"raw",new Map),q(this,"handleError",n=>{if(!this.options.silentErrors)throw n;this.errors.push(n.message)}),this.chunk=this.normalizeInput(e),this.file=a,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 a=$n.get(t),n=di.get(t),s=Me.get(t),o=this.options[t],r=o.reviveValues&&!!a,l=o.translateValues&&!!n,c=o.translateKeys&&!!s,p={};for(let[u,f]of e)r&&a.has(u)?f=a.get(u)(f):l&&n.has(u)&&(f=this.translateValue(f,n.get(u))),c&&s.has(u)&&(u=s.get(u)||u),p[u]=f;return p}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,a){if(this.globalOptions.mergeOutput)return Object.assign(e,a);e[t]?Object.assign(e[t],a):e[t]=a}}q(ot,"headerLength",4),q(ot,"type",void 0),q(ot,"multiSegment",!1),q(ot,"canHandle",()=>!1);function dw(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function hw(i){return i>=224&&i<=239}function fw(i,e,t){for(let[a,n]of Ce)if(n.canHandle(i,e,t))return a}class Uu extends vs{constructor(...e){super(...e),q(this,"appSegments",[]),q(this,"jpegSegments",[]),q(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(Ce.keyList())):(e=e===void 0?Ce.keyList().filter(t=>this.options[t].enabled):e.filter(t=>this.options[t].enabled&&Ce.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:a,findAll:n,wanted:s,remaining:o}=this;if(!n&&this.file.chunked&&(n=Array.from(s).some(r=>{let l=Ce.get(r),c=this.options[r];return l.multiSegment&&c.multiSegment}),n&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,a.byteLength),!this.options.onlyTiff&&a.chunked){let r=!1;for(;o.size>0&&!r&&(a.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=a,c=this.appSegments.some(p=>!this.file.available(p.offset||p.start,p.length||p.size));if(r=e>l&&!c?!await a.readNextChunk(e):!await a.readNextChunk(l),(e=this.findAppSegmentsInRange(e,a.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let a,n,s,o,r,l,{file:c,findAll:p,wanted:u,remaining:f,options:x}=this;for(;e<t;e++)if(c.getUint8(e)===255){if(a=c.getUint8(e+1),hw(a)){if(n=c.getUint16(e+2),s=fw(c,e,n),s&&u.has(s)&&(o=Ce.get(s),r=o.findPosition(c,e),l=x[s],r.type=s,this.appSegments.push(r),!p&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=r.chunkNumber<r.chunkCount,this.unfinishedMultiSegment||f.delete(s)):f.delete(s),f.size===0)))break;x.recordUnknownSegments&&(r=ot.findPosition(c,e),r.marker=a,this.unknownSegments.push(r)),e+=n+1}else if(dw(a)){if(n=c.getUint16(e+2),a===218&&x.stopAfterSos!==!1)return;x.recordJpegSegments&&this.jpegSegments.push({offset:e,length:n,marker:a}),e+=n+1}}return e}mergeMultiSegments(){if(!this.appSegments.some(t=>t.multiSegment))return;let e=function(t,a){let n,s,o,r=new Map;for(let l=0;l<t.length;l++)n=t[l],s=n[a],r.has(s)?o=r.get(s):r.set(s,o=[]),o.push(n);return Array.from(r)}(this.appSegments,"type");this.mergedAppSegments=e.map(([t,a])=>{let n=Ce.get(t,this.options);return n.handleMultiSegments?{type:t,chunk:n.handleMultiSegments(a)}:a[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}}q(Uu,"type","jpeg"),Ii.set("jpeg",Uu);const mw=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4];class gw extends ot{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,a=new Map){let{pick:n,skip:s}=this.options[t];n=new Set(n);let o=n.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(n.has(p)&&(a.set(p,this.parseTag(e,p,t)),n.delete(p),n.size===0))break}else!r&&s.has(p)||a.set(p,this.parseTag(e,p,t));e+=12}return a}parseTag(e,t,a){let{chunk:n}=this,s=n.getUint16(e+2),o=n.getUint32(e+4),r=mw[s];if(r*o<=4?e+=8:e=n.getUint32(e+8),(s<1||s>13)&&fe(`Invalid TIFF value type. block: ${a.toUpperCase()}, tag: ${t.toString(16)}, type: ${s}, offset ${e}`),e>n.byteLength&&fe(`Invalid TIFF value offset. block: ${a.toUpperCase()}, tag: ${t.toString(16)}, type: ${s}, offset ${e} is outside of chunk size ${n.byteLength}`),s===1)return n.getUint8Array(e,o);if(s===2)return oi(n.getString(e,o));if(s===7)return n.getUint8Array(e,o);if(o===1)return this.parseTagValue(s,e);{let l=new(function(p){switch(p){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),c=r;for(let p=0;p<o;p++)l[p]=this.parseTagValue(s,e),e+=c;return l}}parseTagValue(e,t){let{chunk:a}=this;switch(e){case 1:return a.getUint8(t);case 3:return a.getUint16(t);case 4:return a.getUint32(t);case 5:return a.getUint32(t)/a.getUint32(t+4);case 6:return a.getInt8(t);case 8:return a.getInt16(t);case 9:return a.getInt32(t);case 10:return a.getInt32(t)/a.getInt32(t+4);case 11:return a.getFloat(t);case 12:return a.getDouble(t);case 13:return a.getUint32(t);default:fe(`Invalid tiff type ${e}`)}}}class _o extends gw{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 a=new Map;return this[t]=a,this.parseTags(e,t,a),a}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&fe("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&fe(`IFD0 offset points to outside of file.
|
|
75
|
-
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,Cr(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,Cr(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 a=e.get(t);a&&a.length===1&&e.set(t,a[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",Mu(...e.get(2),e.get(1))),e.set("longitude",Mu(...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,a,n={};for(t of ve)if(e=this[t],!Ch(e))if(a=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(n,a)}else n[t]=a;return this.makerNote&&(n.makerNote=this.makerNote),this.userComment&&(n.userComment=this.userComment),n}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[a,n]of Object.entries(t))this.assignObjectToOutput(e,a,n)}}function Mu(i,e,t,a){var n=i+e/60+t/3600;return a!=="S"&&a!=="W"||(n*=-1),n}q(_o,"type","tiff"),q(_o,"headerLength",10),Ce.set("tiff",_o);const bl={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1};Object.assign({},bl,{firstChunkSize:4e4,gps:[1,2,3,4]});Object.assign({},bl,{tiff:!1,ifd1:!0,mergeOutput:!1});const vw=Object.assign({},bl,{firstChunkSize:4e4,ifd0:[274]});async function bw(i){let e=new pw(vw);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}const yw=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 fa=!0,ma=!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,a]=e;fa=Number(t)+.1*Number(a)<13.4,ma=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);fa=ma=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);fa=ma=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);fa=ma=Number(e)<77}}async function xw(i){let e=await bw(i);return Object.assign({canvas:fa,css:ma},yw[e])}class ww extends Ue{constructor(...e){super(...e),q(this,"ranges",new Sw),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,a){if(e===0&&this.byteLength===0&&a){let n=new DataView(a.buffer||a,a.byteOffset,a.byteLength);this._swapDataView(n)}else{let n=e+t;if(n>this.byteLength){let{dataView:s}=this._extend(n);this._swapDataView(s)}}}_extend(e){let t;t=fl?hl.allocUnsafe(e):new Uint8Array(e);let a=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:a}}subarray(e,t,a=!1){return t=t||this._lengthToEnd(e),a&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,a=!1){a&&this._tryExtend(t,e.byteLength,e);let n=super.set(e,t);return this.ranges.add(t,n.byteLength),n}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 Sw{constructor(){q(this,"list",[])}get length(){return this.list.length}add(e,t,a=0){let n=e+t,s=this.list.filter(o=>Lu(e,o.offset,n)||Lu(e,o.end,n));if(s.length>0){e=Math.min(e,...s.map(r=>r.offset)),n=Math.max(n,...s.map(r=>r.end)),t=n-e;let o=s.shift();o.offset=e,o.length=t,o.end=n,this.list=this.list.filter(r=>!s.includes(r))}else this.list.push({offset:e,length:t,end:n})}available(e,t){let a=e+t;return this.list.some(n=>n.offset<=e&&a<=n.end)}}function Lu(i,e,t){return i<=e&&e<=t}class bs extends ww{constructor(e,t){super(0),q(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,a=await this.readChunk(e,t);return!!a&&a.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(){}}Ui.set("blob",class extends bs{async readWhole(){this.chunked=!1;let i=await Dr(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,a=this.input.slice(i,t),n=await Dr(a);return this.set(n,i,!0)}});Ui.set("url",class extends bs{async readWhole(){this.chunked=!1;let i=await Er(this.input);i instanceof ArrayBuffer?this._swapArrayBuffer(i):i instanceof Uint8Array&&this._swapBuffer(i)}async _readChunk(i,e){let t=e?i+e-1:void 0,a=this.options.httpHeaders||{};(i||t)&&(a.range=`bytes=${[i,t].join("-")}`);let n=await ml(this.input,{headers:a}),s=await n.arrayBuffer(),o=s.byteLength;if(n.status!==416)return o!==e&&(this.size=i+o),this.set(s,i,!0)}});Ue.prototype.getUint64=function(i){let e=this.getUint32(i),t=this.getUint32(i+4);return e<1048575?e<<32|t:typeof Sn!==void 0?(console.warn("Using BigInt because of type 64uint but JS can only handle 53b numbers."),Sn(e)<<Sn(32)|Sn(t)):void fe("Trying to read 64b value but JS can only handle 53b numbers.")};class Pw extends vs{parseBoxes(e=0){let t=[];for(;e<this.file.byteLength-4;){let a=this.parseBoxHead(e);if(t.push(a),a.length===0)break;e+=a.length}return t}parseSubBoxes(e){e.boxes=this.parseBoxes(e.start)}findBox(e,t){return e.boxes===void 0&&this.parseSubBoxes(e),e.boxes.find(a=>a.kind===t)}parseBoxHead(e){let t=this.file.getUint32(e),a=this.file.getString(e+4,4),n=e+8;return t===1&&(t=this.file.getUint64(e+8),n+=8),{offset:e,length:t,kind:a,start:n}}parseBoxFullHead(e){if(e.version!==void 0)return;let t=this.file.getUint32(e.start);e.version=t>>24,e.start+=4}}class Eh extends Pw{static canHandle(e,t){if(t!==0)return!1;let a=e.getUint16(2);if(a>50)return!1;let n=16,s=[];for(;n<a;)s.push(e.getString(n,4)),n+=4;return s.includes(this.type)}async parse(){let e=this.file.getUint32(0),t=this.parseBoxHead(e);for(;t.kind!=="meta";)e+=t.length,await this.file.ensureChunk(e,16),t=this.parseBoxHead(e);await this.file.ensureChunk(t.offset,t.length),this.parseBoxFullHead(t),this.parseSubBoxes(t),this.options.icc.enabled&&await this.findIcc(t),this.options.tiff.enabled&&await this.findExif(t)}async registerSegment(e,t,a){await this.file.ensureChunk(t,a);let n=this.file.subarray(t,a);this.createParser(e,n)}async findIcc(e){let t=this.findBox(e,"iprp");if(t===void 0)return;let a=this.findBox(t,"ipco");if(a===void 0)return;let n=this.findBox(a,"colr");n!==void 0&&await this.registerSegment("icc",n.offset+12,n.length)}async findExif(e){let t=this.findBox(e,"iinf");if(t===void 0)return;let a=this.findBox(e,"iloc");if(a===void 0)return;let n=this.findExifLocIdInIinf(t),s=this.findExtentInIloc(a,n);if(s===void 0)return;let[o,r]=s;await this.file.ensureChunk(o,r);let l=4+this.file.getUint32(o);o+=l,r-=l,await this.registerSegment("tiff",o,r)}findExifLocIdInIinf(e){this.parseBoxFullHead(e);let t,a,n,s,o=e.start,r=this.file.getUint16(o);for(o+=2;r--;){if(t=this.parseBoxHead(o),this.parseBoxFullHead(t),a=t.start,t.version>=2&&(n=t.version===3?4:2,s=this.file.getString(a+n+2,4),s==="Exif"))return this.file.getUintBytes(a,n);o+=t.length}}get8bits(e){let t=this.file.getUint8(e);return[t>>4,15&t]}findExtentInIloc(e,t){this.parseBoxFullHead(e);let a=e.start,[n,s]=this.get8bits(a++),[o,r]=this.get8bits(a++),l=e.version===2?4:2,c=e.version===1||e.version===2?2:0,p=r+n+s,u=e.version===2?4:2,f=this.file.getUintBytes(a,u);for(a+=u;f--;){let x=this.file.getUintBytes(a,l);a+=l+c+2+o;let S=this.file.getUint16(a);if(a+=2,x===t)return S>1&&console.warn(`ILOC box has more than one extent but we're only processing one
|
|
76
|
-
Please create an issue at https://github.com/MikeKovarik/exifr with this file`),[this.file.getUintBytes(a+r,n),this.file.getUintBytes(a+r+n,s)];a+=S*p}}}class Dh extends Eh{}q(Dh,"type","heic");class Nu extends Eh{}q(Nu,"type","avif"),Ii.set("heic",Dh),Ii.set("avif",Nu),Se(Me,["ifd0","ifd1"],[[256,"ImageWidth"],[257,"ImageHeight"],[258,"BitsPerSample"],[259,"Compression"],[262,"PhotometricInterpretation"],[270,"ImageDescription"],[271,"Make"],[272,"Model"],[273,"StripOffsets"],[274,"Orientation"],[277,"SamplesPerPixel"],[278,"RowsPerStrip"],[279,"StripByteCounts"],[282,"XResolution"],[283,"YResolution"],[284,"PlanarConfiguration"],[296,"ResolutionUnit"],[301,"TransferFunction"],[305,"Software"],[306,"ModifyDate"],[315,"Artist"],[316,"HostComputer"],[317,"Predictor"],[318,"WhitePoint"],[319,"PrimaryChromaticities"],[513,"ThumbnailOffset"],[514,"ThumbnailLength"],[529,"YCbCrCoefficients"],[530,"YCbCrSubSampling"],[531,"YCbCrPositioning"],[532,"ReferenceBlackWhite"],[700,"ApplicationNotes"],[33432,"Copyright"],[33723,"IPTC"],[34665,"ExifIFD"],[34675,"ICC"],[34853,"GpsIFD"],[330,"SubIFD"],[40965,"InteropIFD"],[40091,"XPTitle"],[40092,"XPComment"],[40093,"XPAuthor"],[40094,"XPKeywords"],[40095,"XPSubject"]]),Se(Me,"exif",[[33434,"ExposureTime"],[33437,"FNumber"],[34850,"ExposureProgram"],[34852,"SpectralSensitivity"],[34855,"ISO"],[34858,"TimeZoneOffset"],[34859,"SelfTimerMode"],[34864,"SensitivityType"],[34865,"StandardOutputSensitivity"],[34866,"RecommendedExposureIndex"],[34867,"ISOSpeed"],[34868,"ISOSpeedLatitudeyyy"],[34869,"ISOSpeedLatitudezzz"],[36864,"ExifVersion"],[36867,"DateTimeOriginal"],[36868,"CreateDate"],[36873,"GooglePlusUploadCode"],[36880,"OffsetTime"],[36881,"OffsetTimeOriginal"],[36882,"OffsetTimeDigitized"],[37121,"ComponentsConfiguration"],[37122,"CompressedBitsPerPixel"],[37377,"ShutterSpeedValue"],[37378,"ApertureValue"],[37379,"BrightnessValue"],[37380,"ExposureCompensation"],[37381,"MaxApertureValue"],[37382,"SubjectDistance"],[37383,"MeteringMode"],[37384,"LightSource"],[37385,"Flash"],[37386,"FocalLength"],[37393,"ImageNumber"],[37394,"SecurityClassification"],[37395,"ImageHistory"],[37396,"SubjectArea"],[37500,"MakerNote"],[37510,"UserComment"],[37520,"SubSecTime"],[37521,"SubSecTimeOriginal"],[37522,"SubSecTimeDigitized"],[37888,"AmbientTemperature"],[37889,"Humidity"],[37890,"Pressure"],[37891,"WaterDepth"],[37892,"Acceleration"],[37893,"CameraElevationAngle"],[40960,"FlashpixVersion"],[40961,"ColorSpace"],[40962,"ExifImageWidth"],[40963,"ExifImageHeight"],[40964,"RelatedSoundFile"],[41483,"FlashEnergy"],[41486,"FocalPlaneXResolution"],[41487,"FocalPlaneYResolution"],[41488,"FocalPlaneResolutionUnit"],[41492,"SubjectLocation"],[41493,"ExposureIndex"],[41495,"SensingMethod"],[41728,"FileSource"],[41729,"SceneType"],[41730,"CFAPattern"],[41985,"CustomRendered"],[41986,"ExposureMode"],[41987,"WhiteBalance"],[41988,"DigitalZoomRatio"],[41989,"FocalLengthIn35mmFormat"],[41990,"SceneCaptureType"],[41991,"GainControl"],[41992,"Contrast"],[41993,"Saturation"],[41994,"Sharpness"],[41996,"SubjectDistanceRange"],[42016,"ImageUniqueID"],[42032,"OwnerName"],[42033,"SerialNumber"],[42034,"LensInfo"],[42035,"LensMake"],[42036,"LensModel"],[42037,"LensSerialNumber"],[42080,"CompositeImage"],[42081,"CompositeImageCount"],[42082,"CompositeImageExposureTimes"],[42240,"Gamma"],[59932,"Padding"],[59933,"OffsetSchema"],[65e3,"OwnerName"],[65001,"SerialNumber"],[65002,"Lens"],[65100,"RawFile"],[65101,"Converter"],[65102,"WhiteBalance"],[65105,"Exposure"],[65106,"Shadows"],[65107,"Brightness"],[65108,"Contrast"],[65109,"Saturation"],[65110,"Sharpness"],[65111,"Smoothness"],[65112,"MoireFilter"],[40965,"InteropIFD"]]),Se(Me,"gps",[[0,"GPSVersionID"],[1,"GPSLatitudeRef"],[2,"GPSLatitude"],[3,"GPSLongitudeRef"],[4,"GPSLongitude"],[5,"GPSAltitudeRef"],[6,"GPSAltitude"],[7,"GPSTimeStamp"],[8,"GPSSatellites"],[9,"GPSStatus"],[10,"GPSMeasureMode"],[11,"GPSDOP"],[12,"GPSSpeedRef"],[13,"GPSSpeed"],[14,"GPSTrackRef"],[15,"GPSTrack"],[16,"GPSImgDirectionRef"],[17,"GPSImgDirection"],[18,"GPSMapDatum"],[19,"GPSDestLatitudeRef"],[20,"GPSDestLatitude"],[21,"GPSDestLongitudeRef"],[22,"GPSDestLongitude"],[23,"GPSDestBearingRef"],[24,"GPSDestBearing"],[25,"GPSDestDistanceRef"],[26,"GPSDestDistance"],[27,"GPSProcessingMethod"],[28,"GPSAreaInformation"],[29,"GPSDateStamp"],[30,"GPSDifferential"],[31,"GPSHPositioningError"]]),Se(di,["ifd0","ifd1"],[[274,{1:"Horizontal (normal)",2:"Mirror horizontal",3:"Rotate 180",4:"Mirror vertical",5:"Mirror horizontal and rotate 270 CW",6:"Rotate 90 CW",7:"Mirror horizontal and rotate 90 CW",8:"Rotate 270 CW"}],[296,{1:"None",2:"inches",3:"cm"}]]);let Ea=Se(di,"exif",[[34850,{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"}],[37121,{0:"-",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}],[37383,{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"}],[37384,{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"}],[37385,{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"}],[41495,{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"}],[41728,{1:"Film Scanner",2:"Reflection Print Scanner",3:"Digital Camera"}],[41729,{1:"Directly photographed"}],[41985,{0:"Normal",1:"Custom",2:"HDR (no original saved)",3:"HDR (original saved)",4:"Original (for HDR)",6:"Panorama",7:"Portrait HDR",8:"Portrait"}],[41986,{0:"Auto",1:"Manual",2:"Auto bracket"}],[41987,{0:"Auto",1:"Manual"}],[41990,{0:"Standard",1:"Landscape",2:"Portrait",3:"Night",4:"Other"}],[41991,{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"}],[41996,{0:"Unknown",1:"Macro",2:"Close",3:"Distant"}],[42080,{0:"Unknown",1:"Not a Composite Image",2:"General Composite Image",3:"Composite Image Captured While Shooting"}]]);const Bu={1:"No absolute unit of measurement",2:"Inch",3:"Centimeter"};Ea.set(37392,Bu),Ea.set(41488,Bu);const ko={0:"Normal",1:"Low",2:"High"};function ju(i){return typeof i=="object"&&i.length!==void 0?i[0]:i}function zu(i){let e=Array.from(i).slice(1);return e[1]>15&&(e=e.map(t=>String.fromCharCode(t))),e[2]!=="0"&&e[2]!==0||e.pop(),e.join(".")}function To(i){if(typeof i=="string"){var[e,t,a,n,s,o]=i.trim().split(/[-: ]/g).map(Number),r=new Date(e,t-1,a);return Number.isNaN(n)||Number.isNaN(s)||Number.isNaN(o)||(r.setHours(n),r.setMinutes(s),r.setSeconds(o)),Number.isNaN(+r)?i:r}}function la(i){if(typeof i=="string")return i;let e=[];if(i[1]===0&&i[i.length-1]===0)for(let t=0;t<i.length;t+=2)e.push($u(i[t+1],i[t]));else for(let t=0;t<i.length;t+=2)e.push($u(i[t],i[t+1]));return oi(String.fromCodePoint(...e))}function $u(i,e){return i<<8|e}Ea.set(41992,ko),Ea.set(41993,ko),Ea.set(41994,ko),Se($n,["ifd0","ifd1"],[[50827,function(i){return typeof i!="string"?Fh(i):i}],[306,To],[40091,la],[40092,la],[40093,la],[40094,la],[40095,la]]),Se($n,"exif",[[40960,zu],[36864,zu],[36867,To],[36868,To],[40962,ju],[40963,ju]]),Se($n,"gps",[[0,i=>Array.from(i).join(".")],[7,i=>Array.from(i).join(":")]]);class Eo extends ot{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1752462448&&e.getString(t+4,20)==="http://ns.adobe.com/"}static headerLength(e,t){return e.getString(t+4,34)==="http://ns.adobe.com/xmp/extension/"?79:33}static findPosition(e,t){let a=super.findPosition(e,t);return a.multiSegment=a.extended=a.headerLength===79,a.multiSegment?(a.chunkCount=e.getUint8(t+72),a.chunkNumber=e.getUint8(t+76),e.getUint8(t+77)!==0&&a.chunkNumber++):(a.chunkCount=1/0,a.chunkNumber=-1),a}static handleMultiSegments(e){return e.map(t=>t.chunk.getString()).join("")}normalizeInput(e){return typeof e=="string"?e:Ue.from(e).getString()}parse(e=this.chunk){if(!this.localOptions.parse)return e;e=function(s){let o={},r={};for(let l of Rh)o[l]=[],r[l]=0;return s.replace(kw,(l,c,p)=>{if(c==="<"){let u=++r[p];return o[p].push(u),`${l}#${u}`}return`${l}#${o[p].pop()}`})}(e);let t=Ti.findAll(e,"rdf","Description");t.length===0&&t.push(new Ti("rdf","Description",void 0,e));let a,n={};for(let s of t)for(let o of s.properties)a=_w(o.ns,n),Ih(o,a);return function(s){let o;for(let r in s)o=s[r]=rs(s[r]),o===void 0&&delete s[r];return rs(s)}(n)}assignToOutput(e,t){if(this.localOptions.parse)for(let[a,n]of Object.entries(t))switch(a){case"tiff":this.assignObjectToOutput(e,"ifd0",n);break;case"exif":this.assignObjectToOutput(e,"exif",n);break;case"xmlns":break;default:this.assignObjectToOutput(e,a,n)}else e.xmp=t}}q(Eo,"type","xmp"),q(Eo,"multiSegment",!0),Ce.set("xmp",Eo);class cs{static findAll(e){return Ah(e,/([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(cs.unpackMatch)}static unpackMatch(e){let t=e[1],a=e[2],n=e[3].slice(1,-1);return n=Oh(n),new cs(t,a,n)}constructor(e,t,a){this.ns=e,this.name=t,this.value=a}serialize(){return this.value}}class Ti{static findAll(e,t,a){if(t!==void 0||a!==void 0){t=t||"[\\w\\d-]+",a=a||"[\\w\\d-]+";var n=new RegExp(`<(${t}):(${a})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`,"gm")}else n=/<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;return Ah(e,n).map(Ti.unpackMatch)}static unpackMatch(e){let t=e[1],a=e[2],n=e[4],s=e[8];return new Ti(t,a,n,s)}constructor(e,t,a,n){this.ns=e,this.name=t,this.attrString=a,this.innerXml=n,this.attrs=cs.findAll(a),this.children=Ti.findAll(n),this.value=this.children.length===0?Oh(n):void 0,this.properties=[...this.attrs,...this.children]}get isPrimitive(){return this.value!==void 0&&this.attrs.length===0&&this.children.length===0}get isListContainer(){return this.children.length===1&&this.children[0].isList}get isList(){let{ns:e,name:t}=this;return e==="rdf"&&(t==="Seq"||t==="Bag"||t==="Alt")}get isListItem(){return this.ns==="rdf"&&this.name==="li"}serialize(){if(this.properties.length===0&&this.value===void 0)return;if(this.isPrimitive)return this.value;if(this.isListContainer)return this.children[0].serialize();if(this.isList)return Fw(this.children.map(Cw));if(this.isListItem&&this.children.length===1&&this.attrs.length===0)return this.children[0].serialize();let e={};for(let t of this.properties)Ih(t,e);return this.value!==void 0&&(e.value=this.value),rs(e)}}function Ih(i,e){let t=i.serialize();t!==void 0&&(e[i.name]=t)}var Cw=i=>i.serialize(),Fw=i=>i.length===1?i[0]:i,_w=(i,e)=>e[i]?e[i]:e[i]={};function Ah(i,e){let t,a=[];if(!i)return a;for(;(t=e.exec(i))!==null;)a.push(t);return a}function Oh(i){if(function(a){return a==null||a==="null"||a==="undefined"||a===""||a.trim()===""}(i))return;let e=Number(i);if(!Number.isNaN(e))return e;let t=i.toLowerCase();return t==="true"||t!=="false"&&i.trim()}const Rh=["rdf:li","rdf:Seq","rdf:Bag","rdf:Alt","rdf:Description"],kw=new RegExp(`(<|\\/)(${Rh.join("|")})`,"g");let Hu=os("fs",i=>i.promises);Ui.set("fs",class extends bs{async readWhole(){this.chunked=!1,this.fs=await Hu;let i=await this.fs.readFile(this.input);this._swapBuffer(i)}async readChunked(){this.chunked=!0,this.fs=await Hu,await this.open(),await this.readChunk(0,this.options.firstChunkSize)}async open(){this.fh===void 0&&(this.fh=await this.fs.open(this.input,"r"),this.size=(await this.fh.stat(this.input)).size)}async _readChunk(i,e){this.fh===void 0&&await this.open(),i+e>this.size&&(e=this.size-i);var t=this.subarray(i,e,!0);return await this.fh.read(t.dataView,0,e,i),t}async close(){if(this.fh){let i=this.fh;this.fh=void 0,await i.close()}}});Ui.set("base64",class extends bs{constructor(...i){super(...i),this.input=this.input.replace(/^data:([^;]+);base64,/gim,""),this.size=this.input.length/4*3,this.input.endsWith("==")?this.size-=2:this.input.endsWith("=")&&(this.size-=1)}async _readChunk(i,e){let t,a,n=this.input;i===void 0?(i=0,t=0,a=0):(t=4*Math.floor(i/3),a=i-t/4*3),e===void 0&&(e=this.size);let s=i+e,o=t+4*Math.ceil(s/3);n=n.slice(t,o);let r=Math.min(e,this.size-i);if(fl){let l=hl.from(n,"base64").slice(a,a+r);return this.set(l,i,!0)}{let l=this.subarray(i,r,!0),c=atob(n),p=l.toUint8();for(let u=0;u<r;u++)p[u]=c.charCodeAt(a+u);return l}}});class qu extends vs{static canHandle(e,t){return t===18761||t===19789}extendOptions(e){let{ifd0:t,xmp:a,iptc:n,icc:s}=e;a.enabled&&t.deps.add(700),n.enabled&&t.deps.add(33723),s.enabled&&t.deps.add(34675),t.finalizeFilters()}async parse(){let{tiff:e,xmp:t,iptc:a,icc:n}=this.options;if(e.enabled||t.enabled||a.enabled||n.enabled){let s=Math.max(Cr(this.options),this.options.chunkSize);await this.file.ensureChunk(0,s),this.createParser("tiff",this.file),this.parsers.tiff.parseHeader(),await this.parsers.tiff.parseIfd0Block(),this.adaptTiffPropAsSegment("xmp"),this.adaptTiffPropAsSegment("iptc"),this.adaptTiffPropAsSegment("icc")}}adaptTiffPropAsSegment(e){if(this.parsers.tiff[e]){let t=this.parsers.tiff[e];this.injectSegment(e,t)}}}q(qu,"type","tiff"),Ii.set("tiff",qu);let Tw=os("zlib");const Ew=["ihdr","iccp","text","itxt","exif"];class Vu extends vs{constructor(...e){super(...e),q(this,"catchError",t=>this.errors.push(t)),q(this,"metaChunks",[]),q(this,"unknownChunks",[])}static canHandle(e,t){return t===35152&&e.getUint32(0)===2303741511&&e.getUint32(4)===218765834}async parse(){let{file:e}=this;await this.findPngChunksInRange(8,e.byteLength),await this.readSegments(this.metaChunks),this.findIhdr(),this.parseTextChunks(),await this.findExif().catch(this.catchError),await this.findXmp().catch(this.catchError),await this.findIcc().catch(this.catchError)}async findPngChunksInRange(e,t){let{file:a}=this;for(;e<t;){let n=a.getUint32(e),s=a.getUint32(e+4),o=a.getString(e+4,4).toLowerCase(),r=n+4+4+4,l={type:o,offset:e,length:r,start:e+4+4,size:n,marker:s};Ew.includes(o)?this.metaChunks.push(l):this.unknownChunks.push(l),e+=r}}parseTextChunks(){let e=this.metaChunks.filter(t=>t.type==="text");for(let t of e){let[a,n]=this.file.getString(t.start,t.size).split("\0");this.injectKeyValToIhdr(a,n)}}injectKeyValToIhdr(e,t){let a=this.parsers.ihdr;a&&a.raw.set(e,t)}findIhdr(){let e=this.metaChunks.find(t=>t.type==="ihdr");e&&this.options.ihdr.enabled!==!1&&this.createParser("ihdr",e.chunk)}async findExif(){let e=this.metaChunks.find(t=>t.type==="exif");e&&this.injectSegment("tiff",e.chunk)}async findXmp(){let e=this.metaChunks.filter(t=>t.type==="itxt");for(let t of e)t.chunk.getString(0,17)==="XML:com.adobe.xmp"&&this.injectSegment("xmp",t.chunk)}async findIcc(){let e=this.metaChunks.find(r=>r.type==="iccp");if(!e)return;let{chunk:t}=e,a=t.getUint8Array(0,81),n=0;for(;n<80&&a[n]!==0;)n++;let s=n+2,o=t.getString(0,n);if(this.injectKeyValToIhdr("ProfileName",o),ss){let r=await Tw,l=t.getUint8Array(s);l=r.inflateSync(l),this.injectSegment("icc",l)}}}q(Vu,"type","png"),Ii.set("png",Vu),Se(Me,"interop",[[1,"InteropIndex"],[2,"InteropVersion"],[4096,"RelatedImageFileFormat"],[4097,"RelatedImageWidth"],[4098,"RelatedImageHeight"]]),Ir(Me,"ifd0",[[11,"ProcessingSoftware"],[254,"SubfileType"],[255,"OldSubfileType"],[263,"Thresholding"],[264,"CellWidth"],[265,"CellLength"],[266,"FillOrder"],[269,"DocumentName"],[280,"MinSampleValue"],[281,"MaxSampleValue"],[285,"PageName"],[286,"XPosition"],[287,"YPosition"],[290,"GrayResponseUnit"],[297,"PageNumber"],[321,"HalftoneHints"],[322,"TileWidth"],[323,"TileLength"],[332,"InkSet"],[337,"TargetPrinter"],[18246,"Rating"],[18249,"RatingPercent"],[33550,"PixelScale"],[34264,"ModelTransform"],[34377,"PhotoshopSettings"],[50706,"DNGVersion"],[50707,"DNGBackwardVersion"],[50708,"UniqueCameraModel"],[50709,"LocalizedCameraModel"],[50736,"DNGLensInfo"],[50739,"ShadowScale"],[50740,"DNGPrivateData"],[33920,"IntergraphMatrix"],[33922,"ModelTiePoint"],[34118,"SEMInfo"],[34735,"GeoTiffDirectory"],[34736,"GeoTiffDoubleParams"],[34737,"GeoTiffAsciiParams"],[50341,"PrintIM"],[50721,"ColorMatrix1"],[50722,"ColorMatrix2"],[50723,"CameraCalibration1"],[50724,"CameraCalibration2"],[50725,"ReductionMatrix1"],[50726,"ReductionMatrix2"],[50727,"AnalogBalance"],[50728,"AsShotNeutral"],[50729,"AsShotWhiteXY"],[50730,"BaselineExposure"],[50731,"BaselineNoise"],[50732,"BaselineSharpness"],[50734,"LinearResponseLimit"],[50735,"CameraSerialNumber"],[50741,"MakerNoteSafety"],[50778,"CalibrationIlluminant1"],[50779,"CalibrationIlluminant2"],[50781,"RawDataUniqueID"],[50827,"OriginalRawFileName"],[50828,"OriginalRawFileData"],[50831,"AsShotICCProfile"],[50832,"AsShotPreProfileMatrix"],[50833,"CurrentICCProfile"],[50834,"CurrentPreProfileMatrix"],[50879,"ColorimetricReference"],[50885,"SRawType"],[50898,"PanasonicTitle"],[50899,"PanasonicTitle2"],[50931,"CameraCalibrationSig"],[50932,"ProfileCalibrationSig"],[50933,"ProfileIFD"],[50934,"AsShotProfileName"],[50936,"ProfileName"],[50937,"ProfileHueSatMapDims"],[50938,"ProfileHueSatMapData1"],[50939,"ProfileHueSatMapData2"],[50940,"ProfileToneCurve"],[50941,"ProfileEmbedPolicy"],[50942,"ProfileCopyright"],[50964,"ForwardMatrix1"],[50965,"ForwardMatrix2"],[50966,"PreviewApplicationName"],[50967,"PreviewApplicationVersion"],[50968,"PreviewSettingsName"],[50969,"PreviewSettingsDigest"],[50970,"PreviewColorSpace"],[50971,"PreviewDateTime"],[50972,"RawImageDigest"],[50973,"OriginalRawFileDigest"],[50981,"ProfileLookTableDims"],[50982,"ProfileLookTableData"],[51043,"TimeCodes"],[51044,"FrameRate"],[51058,"TStop"],[51081,"ReelName"],[51089,"OriginalDefaultFinalSize"],[51090,"OriginalBestQualitySize"],[51091,"OriginalDefaultCropSize"],[51105,"CameraLabel"],[51107,"ProfileHueSatMapEncoding"],[51108,"ProfileLookTableEncoding"],[51109,"BaselineExposureOffset"],[51110,"DefaultBlackRender"],[51111,"NewRawImageDigest"],[51112,"RawToPreviewGain"]]);let Wu=[[273,"StripOffsets"],[279,"StripByteCounts"],[288,"FreeOffsets"],[289,"FreeByteCounts"],[291,"GrayResponseCurve"],[292,"T4Options"],[293,"T6Options"],[300,"ColorResponseUnit"],[320,"ColorMap"],[324,"TileOffsets"],[325,"TileByteCounts"],[326,"BadFaxLines"],[327,"CleanFaxData"],[328,"ConsecutiveBadFaxLines"],[330,"SubIFD"],[333,"InkNames"],[334,"NumberofInks"],[336,"DotRange"],[338,"ExtraSamples"],[339,"SampleFormat"],[340,"SMinSampleValue"],[341,"SMaxSampleValue"],[342,"TransferRange"],[343,"ClipPath"],[344,"XClipPathUnits"],[345,"YClipPathUnits"],[346,"Indexed"],[347,"JPEGTables"],[351,"OPIProxy"],[400,"GlobalParametersIFD"],[401,"ProfileType"],[402,"FaxProfile"],[403,"CodingMethods"],[404,"VersionYear"],[405,"ModeNumber"],[433,"Decode"],[434,"DefaultImageColor"],[435,"T82Options"],[437,"JPEGTables"],[512,"JPEGProc"],[515,"JPEGRestartInterval"],[517,"JPEGLosslessPredictors"],[518,"JPEGPointTransforms"],[519,"JPEGQTables"],[520,"JPEGDCTables"],[521,"JPEGACTables"],[559,"StripRowCounts"],[999,"USPTOMiscellaneous"],[18247,"XP_DIP_XML"],[18248,"StitchInfo"],[28672,"SonyRawFileType"],[28688,"SonyToneCurve"],[28721,"VignettingCorrection"],[28722,"VignettingCorrParams"],[28724,"ChromaticAberrationCorrection"],[28725,"ChromaticAberrationCorrParams"],[28726,"DistortionCorrection"],[28727,"DistortionCorrParams"],[29895,"SonyCropTopLeft"],[29896,"SonyCropSize"],[32781,"ImageID"],[32931,"WangTag1"],[32932,"WangAnnotation"],[32933,"WangTag3"],[32934,"WangTag4"],[32953,"ImageReferencePoints"],[32954,"RegionXformTackPoint"],[32955,"WarpQuadrilateral"],[32956,"AffineTransformMat"],[32995,"Matteing"],[32996,"DataType"],[32997,"ImageDepth"],[32998,"TileDepth"],[33300,"ImageFullWidth"],[33301,"ImageFullHeight"],[33302,"TextureFormat"],[33303,"WrapModes"],[33304,"FovCot"],[33305,"MatrixWorldToScreen"],[33306,"MatrixWorldToCamera"],[33405,"Model2"],[33421,"CFARepeatPatternDim"],[33422,"CFAPattern2"],[33423,"BatteryLevel"],[33424,"KodakIFD"],[33445,"MDFileTag"],[33446,"MDScalePixel"],[33447,"MDColorTable"],[33448,"MDLabName"],[33449,"MDSampleInfo"],[33450,"MDPrepDate"],[33451,"MDPrepTime"],[33452,"MDFileUnits"],[33589,"AdventScale"],[33590,"AdventRevision"],[33628,"UIC1Tag"],[33629,"UIC2Tag"],[33630,"UIC3Tag"],[33631,"UIC4Tag"],[33918,"IntergraphPacketData"],[33919,"IntergraphFlagRegisters"],[33921,"INGRReserved"],[34016,"Site"],[34017,"ColorSequence"],[34018,"IT8Header"],[34019,"RasterPadding"],[34020,"BitsPerRunLength"],[34021,"BitsPerExtendedRunLength"],[34022,"ColorTable"],[34023,"ImageColorIndicator"],[34024,"BackgroundColorIndicator"],[34025,"ImageColorValue"],[34026,"BackgroundColorValue"],[34027,"PixelIntensityRange"],[34028,"TransparencyIndicator"],[34029,"ColorCharacterization"],[34030,"HCUsage"],[34031,"TrapIndicator"],[34032,"CMYKEquivalent"],[34152,"AFCP_IPTC"],[34232,"PixelMagicJBIGOptions"],[34263,"JPLCartoIFD"],[34306,"WB_GRGBLevels"],[34310,"LeafData"],[34687,"TIFF_FXExtensions"],[34688,"MultiProfiles"],[34689,"SharedData"],[34690,"T88Options"],[34732,"ImageLayer"],[34750,"JBIGOptions"],[34856,"Opto-ElectricConvFactor"],[34857,"Interlace"],[34908,"FaxRecvParams"],[34909,"FaxSubAddress"],[34910,"FaxRecvTime"],[34929,"FedexEDR"],[34954,"LeafSubIFD"],[37387,"FlashEnergy"],[37388,"SpatialFrequencyResponse"],[37389,"Noise"],[37390,"FocalPlaneXResolution"],[37391,"FocalPlaneYResolution"],[37392,"FocalPlaneResolutionUnit"],[37397,"ExposureIndex"],[37398,"TIFF-EPStandardID"],[37399,"SensingMethod"],[37434,"CIP3DataFile"],[37435,"CIP3Sheet"],[37436,"CIP3Side"],[37439,"StoNits"],[37679,"MSDocumentText"],[37680,"MSPropertySetStorage"],[37681,"MSDocumentTextPosition"],[37724,"ImageSourceData"],[40965,"InteropIFD"],[40976,"SamsungRawPointersOffset"],[40977,"SamsungRawPointersLength"],[41217,"SamsungRawByteOrder"],[41218,"SamsungRawUnknown"],[41484,"SpatialFrequencyResponse"],[41485,"Noise"],[41489,"ImageNumber"],[41490,"SecurityClassification"],[41491,"ImageHistory"],[41494,"TIFF-EPStandardID"],[41995,"DeviceSettingDescription"],[42112,"GDALMetadata"],[42113,"GDALNoData"],[44992,"ExpandSoftware"],[44993,"ExpandLens"],[44994,"ExpandFilm"],[44995,"ExpandFilterLens"],[44996,"ExpandScanner"],[44997,"ExpandFlashLamp"],[46275,"HasselbladRawImage"],[48129,"PixelFormat"],[48130,"Transformation"],[48131,"Uncompressed"],[48132,"ImageType"],[48256,"ImageWidth"],[48257,"ImageHeight"],[48258,"WidthResolution"],[48259,"HeightResolution"],[48320,"ImageOffset"],[48321,"ImageByteCount"],[48322,"AlphaOffset"],[48323,"AlphaByteCount"],[48324,"ImageDataDiscard"],[48325,"AlphaDataDiscard"],[50215,"OceScanjobDesc"],[50216,"OceApplicationSelector"],[50217,"OceIDNumber"],[50218,"OceImageLogic"],[50255,"Annotations"],[50459,"HasselbladExif"],[50547,"OriginalFileName"],[50560,"USPTOOriginalContentType"],[50656,"CR2CFAPattern"],[50710,"CFAPlaneColor"],[50711,"CFALayout"],[50712,"LinearizationTable"],[50713,"BlackLevelRepeatDim"],[50714,"BlackLevel"],[50715,"BlackLevelDeltaH"],[50716,"BlackLevelDeltaV"],[50717,"WhiteLevel"],[50718,"DefaultScale"],[50719,"DefaultCropOrigin"],[50720,"DefaultCropSize"],[50733,"BayerGreenSplit"],[50737,"ChromaBlurRadius"],[50738,"AntiAliasStrength"],[50752,"RawImageSegmentation"],[50780,"BestQualityScale"],[50784,"AliasLayerMetadata"],[50829,"ActiveArea"],[50830,"MaskedAreas"],[50935,"NoiseReductionApplied"],[50974,"SubTileBlockSize"],[50975,"RowInterleaveFactor"],[51008,"OpcodeList1"],[51009,"OpcodeList2"],[51022,"OpcodeList3"],[51041,"NoiseProfile"],[51114,"CacheVersion"],[51125,"DefaultUserCrop"],[51157,"NikonNEFInfo"],[65024,"KdcIFD"]];Ir(Me,"ifd0",Wu),Ir(Me,"exif",Wu),Se(di,"gps",[[23,{M:"Magnetic North",T:"True North"}],[25,{K:"Kilometers",M:"Miles",N:"Nautical Miles"}]]);class Do extends ot{static canHandle(e,t){return e.getUint8(t+1)===224&&e.getUint32(t+4)===1246120262&&e.getUint8(t+8)===0}parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint16(0)],[2,this.chunk.getUint8(2)],[3,this.chunk.getUint16(3)],[5,this.chunk.getUint16(5)],[7,this.chunk.getUint8(7)],[8,this.chunk.getUint8(8)]])}}q(Do,"type","jfif"),q(Do,"headerLength",9),Ce.set("jfif",Do),Se(Me,"jfif",[[0,"JFIFVersion"],[2,"ResolutionUnit"],[3,"XResolution"],[5,"YResolution"],[7,"ThumbnailWidth"],[8,"ThumbnailHeight"]]);class Gu extends ot{parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint32(0)],[4,this.chunk.getUint32(4)],[8,this.chunk.getUint8(8)],[9,this.chunk.getUint8(9)],[10,this.chunk.getUint8(10)],[11,this.chunk.getUint8(11)],[12,this.chunk.getUint8(12)],...Array.from(this.raw)])}}q(Gu,"type","ihdr"),Ce.set("ihdr",Gu),Se(Me,"ihdr",[[0,"ImageWidth"],[4,"ImageHeight"],[8,"BitDepth"],[9,"ColorType"],[10,"Compression"],[11,"Filter"],[12,"Interlace"]]),Se(di,"ihdr",[[9,{0:"Grayscale",2:"RGB",3:"Palette",4:"Grayscale with Alpha",6:"RGB with Alpha",DEFAULT:"Unknown"}],[10,{0:"Deflate/Inflate",DEFAULT:"Unknown"}],[11,{0:"Adaptive",DEFAULT:"Unknown"}],[12,{0:"Noninterlaced",1:"Adam7 Interlace",DEFAULT:"Unknown"}]]);class Hn extends ot{static canHandle(e,t){return e.getUint8(t+1)===226&&e.getUint32(t+4)===1229144927}static findPosition(e,t){let a=super.findPosition(e,t);return a.chunkNumber=e.getUint8(t+16),a.chunkCount=e.getUint8(t+17),a.multiSegment=a.chunkCount>1,a}static handleMultiSegments(e){return function(t){let a=function(n){let s=n[0].constructor,o=0;for(let c of n)o+=c.length;let r=new s(o),l=0;for(let c of n)r.set(c,l),l+=c.length;return r}(t.map(n=>n.chunk.toUint8()));return new Ue(a)}(e)}parse(){return this.raw=new Map,this.parseHeader(),this.parseTags(),this.translate(),this.output}parseHeader(){let{raw:e}=this;this.chunk.byteLength<84&&fe("ICC header is too short");for(let[t,a]of Object.entries(Dw)){t=parseInt(t,10);let n=a(this.chunk,t);n!=="\0\0\0\0"&&e.set(t,n)}}parseTags(){let e,t,a,n,s,{raw:o}=this,r=this.chunk.getUint32(128),l=132,c=this.chunk.byteLength;for(;r--;){if(e=this.chunk.getString(l,4),t=this.chunk.getUint32(l+4),a=this.chunk.getUint32(l+8),n=this.chunk.getString(t,4),t+a>c)return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");s=this.parseTag(n,t,a),s!==void 0&&s!=="\0\0\0\0"&&o.set(e,s),l+=12}}parseTag(e,t,a){switch(e){case"desc":return this.parseDesc(t);case"mluc":return this.parseMluc(t);case"text":return this.parseText(t,a);case"sig ":return this.parseSig(t)}if(!(t+a>this.chunk.byteLength))return this.chunk.getUint8Array(t,a)}parseDesc(e){let t=this.chunk.getUint32(e+8)-1;return oi(this.chunk.getString(e+12,t))}parseText(e,t){return oi(this.chunk.getString(e+8,t-8))}parseSig(e){return oi(this.chunk.getString(e+8,4))}parseMluc(e){let{chunk:t}=this,a=t.getUint32(e+8),n=t.getUint32(e+12),s=e+16,o=[];for(let r=0;r<a;r++){let l=t.getString(s+0,2),c=t.getString(s+2,2),p=t.getUint32(s+4),u=t.getUint32(s+8)+e,f=oi(t.getUnicodeString(u,p));o.push({lang:l,country:c,text:f}),s+=n}return a===1?o[0].text:o}translateValue(e,t){return typeof e=="string"?t[e]||t[e.toLowerCase()]||e:t[e]||e}}q(Hn,"type","icc"),q(Hn,"multiSegment",!0),q(Hn,"headerLength",18);const Dw={4:_t,8:function(i,e){return[i.getUint8(e),i.getUint8(e+1)>>4,i.getUint8(e+1)%16].map(t=>t.toString(10)).join(".")},12:_t,16:_t,20:_t,24:function(i,e){const t=i.getUint16(e),a=i.getUint16(e+2)-1,n=i.getUint16(e+4),s=i.getUint16(e+6),o=i.getUint16(e+8),r=i.getUint16(e+10);return new Date(Date.UTC(t,a,n,s,o,r))},36:_t,40:_t,48:_t,52:_t,64:(i,e)=>i.getUint32(e),80:_t};function _t(i,e){return oi(i.getString(e,4))}Ce.set("icc",Hn),Se(Me,"icc",[[4,"ProfileCMMType"],[8,"ProfileVersion"],[12,"ProfileClass"],[16,"ColorSpaceData"],[20,"ProfileConnectionSpace"],[24,"ProfileDateTime"],[36,"ProfileFileSignature"],[40,"PrimaryPlatform"],[44,"CMMFlags"],[48,"DeviceManufacturer"],[52,"DeviceModel"],[56,"DeviceAttributes"],[64,"RenderingIntent"],[68,"ConnectionSpaceIlluminant"],[80,"ProfileCreator"],[84,"ProfileID"],["Header","ProfileHeader"],["MS00","WCSProfiles"],["bTRC","BlueTRC"],["bXYZ","BlueMatrixColumn"],["bfd","UCRBG"],["bkpt","MediaBlackPoint"],["calt","CalibrationDateTime"],["chad","ChromaticAdaptation"],["chrm","Chromaticity"],["ciis","ColorimetricIntentImageState"],["clot","ColorantTableOut"],["clro","ColorantOrder"],["clrt","ColorantTable"],["cprt","ProfileCopyright"],["crdi","CRDInfo"],["desc","ProfileDescription"],["devs","DeviceSettings"],["dmdd","DeviceModelDesc"],["dmnd","DeviceMfgDesc"],["dscm","ProfileDescriptionML"],["fpce","FocalPlaneColorimetryEstimates"],["gTRC","GreenTRC"],["gXYZ","GreenMatrixColumn"],["gamt","Gamut"],["kTRC","GrayTRC"],["lumi","Luminance"],["meas","Measurement"],["meta","Metadata"],["mmod","MakeAndModel"],["ncl2","NamedColor2"],["ncol","NamedColor"],["ndin","NativeDisplayInfo"],["pre0","Preview0"],["pre1","Preview1"],["pre2","Preview2"],["ps2i","PS2RenderingIntent"],["ps2s","PostScript2CSA"],["psd0","PostScript2CRD0"],["psd1","PostScript2CRD1"],["psd2","PostScript2CRD2"],["psd3","PostScript2CRD3"],["pseq","ProfileSequenceDesc"],["psid","ProfileSequenceIdentifier"],["psvm","PS2CRDVMSize"],["rTRC","RedTRC"],["rXYZ","RedMatrixColumn"],["resp","OutputResponse"],["rhoc","ReflectionHardcopyOrigColorimetry"],["rig0","PerceptualRenderingIntentGamut"],["rig2","SaturationRenderingIntentGamut"],["rpoc","ReflectionPrintOutputColorimetry"],["sape","SceneAppearanceEstimates"],["scoe","SceneColorimetryEstimates"],["scrd","ScreeningDesc"],["scrn","Screening"],["targ","CharTarget"],["tech","Technology"],["vcgt","VideoCardGamma"],["view","ViewingConditions"],["vued","ViewingCondDesc"],["wtpt","MediaWhitePoint"]]);const kn={"4d2p":"Erdt Systems",AAMA:"Aamazing Technologies",ACER:"Acer",ACLT:"Acolyte Color Research",ACTI:"Actix Sytems",ADAR:"Adara Technology",ADBE:"Adobe",ADI:"ADI Systems",AGFA:"Agfa Graphics",ALMD:"Alps Electric",ALPS:"Alps Electric",ALWN:"Alwan Color Expertise",AMTI:"Amiable Technologies",AOC:"AOC International",APAG:"Apago",APPL:"Apple Computer",AST:"AST","AT&T":"AT&T",BAEL:"BARBIERI electronic",BRCO:"Barco NV",BRKP:"Breakpoint",BROT:"Brother",BULL:"Bull",BUS:"Bus Computer Systems","C-IT":"C-Itoh",CAMR:"Intel",CANO:"Canon",CARR:"Carroll Touch",CASI:"Casio",CBUS:"Colorbus PL",CEL:"Crossfield",CELx:"Crossfield",CGS:"CGS Publishing Technologies International",CHM:"Rochester Robotics",CIGL:"Colour Imaging Group, London",CITI:"Citizen",CL00:"Candela",CLIQ:"Color IQ",CMCO:"Chromaco",CMiX:"CHROMiX",COLO:"Colorgraphic Communications",COMP:"Compaq",COMp:"Compeq/Focus Technology",CONR:"Conrac Display Products",CORD:"Cordata Technologies",CPQ:"Compaq",CPRO:"ColorPro",CRN:"Cornerstone",CTX:"CTX International",CVIS:"ColorVision",CWC:"Fujitsu Laboratories",DARI:"Darius Technology",DATA:"Dataproducts",DCP:"Dry Creek Photo",DCRC:"Digital Contents Resource Center, Chung-Ang University",DELL:"Dell Computer",DIC:"Dainippon Ink and Chemicals",DICO:"Diconix",DIGI:"Digital","DL&C":"Digital Light & Color",DPLG:"Doppelganger",DS:"Dainippon Screen",DSOL:"DOOSOL",DUPN:"DuPont",EPSO:"Epson",ESKO:"Esko-Graphics",ETRI:"Electronics and Telecommunications Research Institute",EVER:"Everex Systems",EXAC:"ExactCODE",Eizo:"Eizo",FALC:"Falco Data Products",FF:"Fuji Photo Film",FFEI:"FujiFilm Electronic Imaging",FNRD:"Fnord Software",FORA:"Fora",FORE:"Forefront Technology",FP:"Fujitsu",FPA:"WayTech Development",FUJI:"Fujitsu",FX:"Fuji Xerox",GCC:"GCC Technologies",GGSL:"Global Graphics Software",GMB:"Gretagmacbeth",GMG:"GMG",GOLD:"GoldStar Technology",GOOG:"Google",GPRT:"Giantprint",GTMB:"Gretagmacbeth",GVC:"WayTech Development",GW2K:"Sony",HCI:"HCI",HDM:"Heidelberger Druckmaschinen",HERM:"Hermes",HITA:"Hitachi America",HP:"Hewlett-Packard",HTC:"Hitachi",HiTi:"HiTi Digital",IBM:"IBM",IDNT:"Scitex",IEC:"Hewlett-Packard",IIYA:"Iiyama North America",IKEG:"Ikegami Electronics",IMAG:"Image Systems",IMI:"Ingram Micro",INTC:"Intel",INTL:"N/A (INTL)",INTR:"Intra Electronics",IOCO:"Iocomm International Technology",IPS:"InfoPrint Solutions Company",IRIS:"Scitex",ISL:"Ichikawa Soft Laboratory",ITNL:"N/A (ITNL)",IVM:"IVM",IWAT:"Iwatsu Electric",Idnt:"Scitex",Inca:"Inca Digital Printers",Iris:"Scitex",JPEG:"Joint Photographic Experts Group",JSFT:"Jetsoft Development",JVC:"JVC Information Products",KART:"Scitex",KFC:"KFC Computek Components",KLH:"KLH Computers",KMHD:"Konica Minolta",KNCA:"Konica",KODA:"Kodak",KYOC:"Kyocera",Kart:"Scitex",LCAG:"Leica",LCCD:"Leeds Colour",LDAK:"Left Dakota",LEAD:"Leading Technology",LEXM:"Lexmark International",LINK:"Link Computer",LINO:"Linotronic",LITE:"Lite-On",Leaf:"Leaf",Lino:"Linotronic",MAGC:"Mag Computronic",MAGI:"MAG Innovision",MANN:"Mannesmann",MICN:"Micron Technology",MICR:"Microtek",MICV:"Microvitec",MINO:"Minolta",MITS:"Mitsubishi Electronics America",MITs:"Mitsuba",MNLT:"Minolta",MODG:"Modgraph",MONI:"Monitronix",MONS:"Monaco Systems",MORS:"Morse Technology",MOTI:"Motive Systems",MSFT:"Microsoft",MUTO:"MUTOH INDUSTRIES",Mits:"Mitsubishi Electric",NANA:"NANAO",NEC:"NEC",NEXP:"NexPress Solutions",NISS:"Nissei Sangyo America",NKON:"Nikon",NONE:"none",OCE:"Oce Technologies",OCEC:"OceColor",OKI:"Oki",OKID:"Okidata",OKIP:"Okidata",OLIV:"Olivetti",OLYM:"Olympus",ONYX:"Onyx Graphics",OPTI:"Optiquest",PACK:"Packard Bell",PANA:"Matsushita Electric Industrial",PANT:"Pantone",PBN:"Packard Bell",PFU:"PFU",PHIL:"Philips Consumer Electronics",PNTX:"HOYA",POne:"Phase One A/S",PREM:"Premier Computer Innovations",PRIN:"Princeton Graphic Systems",PRIP:"Princeton Publishing Labs",QLUX:"Hong Kong",QMS:"QMS",QPCD:"QPcard AB",QUAD:"QuadLaser",QUME:"Qume",RADI:"Radius",RDDx:"Integrated Color Solutions",RDG:"Roland DG",REDM:"REDMS Group",RELI:"Relisys",RGMS:"Rolf Gierling Multitools",RICO:"Ricoh",RNLD:"Edmund Ronald",ROYA:"Royal",RPC:"Ricoh Printing Systems",RTL:"Royal Information Electronics",SAMP:"Sampo",SAMS:"Samsung",SANT:"Jaime Santana Pomares",SCIT:"Scitex",SCRN:"Dainippon Screen",SDP:"Scitex",SEC:"Samsung",SEIK:"Seiko Instruments",SEIk:"Seikosha",SGUY:"ScanGuy.com",SHAR:"Sharp Laboratories",SICC:"International Color Consortium",SONY:"Sony",SPCL:"SpectraCal",STAR:"Star",STC:"Sampo Technology",Scit:"Scitex",Sdp:"Scitex",Sony:"Sony",TALO:"Talon Technology",TAND:"Tandy",TATU:"Tatung",TAXA:"TAXAN America",TDS:"Tokyo Denshi Sekei",TECO:"TECO Information Systems",TEGR:"Tegra",TEKT:"Tektronix",TI:"Texas Instruments",TMKR:"TypeMaker",TOSB:"Toshiba",TOSH:"Toshiba",TOTK:"TOTOKU ELECTRIC",TRIU:"Triumph",TSBT:"Toshiba",TTX:"TTX Computer Products",TVM:"TVM Professional Monitor",TW:"TW Casper",ULSX:"Ulead Systems",UNIS:"Unisys",UTZF:"Utz Fehlau & Sohn",VARI:"Varityper",VIEW:"Viewsonic",VISL:"Visual communication",VIVO:"Vivo Mobile Communication",WANG:"Wang",WLBR:"Wilbur Imaging",WTG2:"Ware To Go",WYSE:"WYSE Technology",XERX:"Xerox",XRIT:"X-Rite",ZRAN:"Zoran",Zebr:"Zebra Technologies",appl:"Apple Computer",bICC:"basICColor",berg:"bergdesign",ceyd:"Integrated Color Solutions",clsp:"MacDermid ColorSpan",ds:"Dainippon Screen",dupn:"DuPont",ffei:"FujiFilm Electronic Imaging",flux:"FluxData",iris:"Scitex",kart:"Scitex",lcms:"Little CMS",lino:"Linotronic",none:"none",ob4d:"Erdt Systems",obic:"Medigraph",quby:"Qubyx Sarl",scit:"Scitex",scrn:"Dainippon Screen",sdp:"Scitex",siwi:"SIWI GRAFIKA",yxym:"YxyMaster"},Ku={scnr:"Scanner",mntr:"Monitor",prtr:"Printer",link:"Device Link",abst:"Abstract",spac:"Color Space Conversion Profile",nmcl:"Named Color",cenc:"ColorEncodingSpace profile",mid:"MultiplexIdentification profile",mlnk:"MultiplexLink profile",mvis:"MultiplexVisualization profile",nkpf:"Nikon Input Device Profile (NON-STANDARD!)"};Se(di,"icc",[[4,kn],[12,Ku],[40,Object.assign({},kn,Ku)],[48,kn],[80,kn],[64,{0:"Perceptual",1:"Relative Colorimetric",2:"Saturation",3:"Absolute Colorimetric"}],["tech",{amd:"Active Matrix Display",crt:"Cathode Ray Tube Display",kpcd:"Photo CD",pmd:"Passive Matrix Display",dcam:"Digital Camera",dcpj:"Digital Cinema Projector",dmpc:"Digital Motion Picture Camera",dsub:"Dye Sublimation Printer",epho:"Electrophotographic Printer",esta:"Electrostatic Printer",flex:"Flexography",fprn:"Film Writer",fscn:"Film Scanner",grav:"Gravure",ijet:"Ink Jet Printer",imgs:"Photo Image Setter",mpfr:"Motion Picture Film Recorder",mpfs:"Motion Picture Film Scanner",offs:"Offset Lithography",pjtv:"Projection Television",rpho:"Photographic Paper Printer",rscn:"Reflective Scanner",silk:"Silkscreen",twax:"Thermal Wax Printer",vidc:"Video Camera",vidm:"Video Monitor"}]]);class Tn extends ot{static canHandle(e,t,a){return e.getUint8(t+1)===237&&e.getString(t+4,9)==="Photoshop"&&this.containsIptc8bim(e,t,a)!==void 0}static headerLength(e,t,a){let n,s=this.containsIptc8bim(e,t,a);if(s!==void 0)return n=e.getUint8(t+s+7),n%2!=0&&(n+=1),n===0&&(n=4),s+8+n}static containsIptc8bim(e,t,a){for(let n=0;n<a;n++)if(this.isIptcSegmentHead(e,t+n))return n}static isIptcSegmentHead(e,t){return e.getUint8(t)===56&&e.getUint32(t)===943868237&&e.getUint16(t+4)===1028}parse(){let{raw:e}=this,t=this.chunk.byteLength-1,a=!1;for(let n=0;n<t;n++)if(this.chunk.getUint8(n)===28&&this.chunk.getUint8(n+1)===2){a=!0;let s=this.chunk.getUint16(n+3),o=this.chunk.getUint8(n+2),r=this.chunk.getLatin1String(n+5,s);e.set(o,this.pluralizeValue(e.get(o),r)),n+=4+s}else if(a)break;return this.translate(),this.output}pluralizeValue(e,t){return e!==void 0?e instanceof Array?(e.push(t),e):[e,t]:t}}q(Tn,"type","iptc"),q(Tn,"translateValues",!1),q(Tn,"reviveValues",!1),Ce.set("iptc",Tn),Se(Me,"iptc",[[0,"ApplicationRecordVersion"],[3,"ObjectTypeReference"],[4,"ObjectAttributeReference"],[5,"ObjectName"],[7,"EditStatus"],[8,"EditorialUpdate"],[10,"Urgency"],[12,"SubjectReference"],[15,"Category"],[20,"SupplementalCategories"],[22,"FixtureIdentifier"],[25,"Keywords"],[26,"ContentLocationCode"],[27,"ContentLocationName"],[30,"ReleaseDate"],[35,"ReleaseTime"],[37,"ExpirationDate"],[38,"ExpirationTime"],[40,"SpecialInstructions"],[42,"ActionAdvised"],[45,"ReferenceService"],[47,"ReferenceDate"],[50,"ReferenceNumber"],[55,"DateCreated"],[60,"TimeCreated"],[62,"DigitalCreationDate"],[63,"DigitalCreationTime"],[65,"OriginatingProgram"],[70,"ProgramVersion"],[75,"ObjectCycle"],[80,"Byline"],[85,"BylineTitle"],[90,"City"],[92,"Sublocation"],[95,"State"],[100,"CountryCode"],[101,"Country"],[103,"OriginalTransmissionReference"],[105,"Headline"],[110,"Credit"],[115,"Source"],[116,"CopyrightNotice"],[118,"Contact"],[120,"Caption"],[121,"LocalCaption"],[122,"Writer"],[125,"RasterizedCaption"],[130,"ImageType"],[131,"ImageOrientation"],[135,"LanguageIdentifier"],[150,"AudioType"],[151,"AudioSamplingRate"],[152,"AudioSamplingResolution"],[153,"AudioDuration"],[154,"AudioOutcue"],[184,"JobID"],[185,"MasterDocumentID"],[186,"ShortDocumentID"],[187,"UniqueDocumentID"],[188,"OwnerID"],[200,"ObjectPreviewFileFormat"],[201,"ObjectPreviewFileVersion"],[202,"ObjectPreviewData"],[221,"Prefs"],[225,"ClassifyState"],[228,"SimilarityIndex"],[230,"DocumentNotes"],[231,"DocumentHistory"],[232,"ExifCameraInfo"],[255,"CatalogSets"]]),Se(di,"iptc",[[10,{0:"0 (reserved)",1:"1 (most urgent)",2:"2",3:"3",4:"4",5:"5 (normal urgency)",6:"6",7:"7",8:"8 (least urgent)",9:"9 (user-defined priority)"}],[75,{a:"Morning",b:"Both Morning and Evening",p:"Evening"}],[131,{L:"Landscape",P:"Portrait",S:"Square"}]]);const En={zip:tw,gz:Po,tgz:Po,deflate:Po};class Iw extends me{constructor(e,t){const a={};super(e,{...a,...t}),this.id=this.opts.id||"PrepareUpload",this.type="progressindicator",this.i18nInit()}setHashFileName=async e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a){const{data:n}=a,s=1024*1024*5,r=await n.slice(0,s).text(),l=new nw;l.append(r);const c=l.end(),p=_a(a),u=`${c}${p?`.${p}`:""}`;this.uppy.setFileState(t,{hashFileName:u})}};setMetaData=async e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a){const{data:{webkitRelativePath:n,relativePath:s,name:o},hashFileName:r,size:l}=a,c=s||n||o||r;this.uppy.setFileMeta(t,{relativePath:c,name:c})}};preventXssAttack=async e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a){const{name:n,meta:s}=this.uppy.getFile(t),o=hi.sanitize(n);if(n!==o){const l=_a(a),c=o.endsWith(`.${l}`)?o:`${o}.${l}`;this.uppy.setFileState(t,{name:c,meta:{...s,name:c,filename:c}})}if(await _x(a)){const{data:l,name:c,type:p}=this.uppy.getFile(t),u=await l.text(),f=new Set;new DOMParser().parseFromString(u,"image/svg+xml").querySelectorAll("[id]").forEach(w=>f.add(w.id)),hi.addHook("uponSanitizeElement",(w,y)=>{if(y.tagName==="use"){const b=w.getAttribute("xlink:href")||w.getAttribute("href");if(b&&b.startsWith("#")){const h=b.substring(1);f.has(h)&&(y.allowedTags.use=!0,y.forceKeepNode=!0)}}}),hi.addHook("uponSanitizeAttribute",(w,y)=>{if(y.attrName==="xlink:href"&&y.attrValue){if(y.attrValue.startsWith("#")){const b=y.attrValue.substring(1);if(f.has(b)){y.forceKeepAttr=!0;return}}y.keepAttr=!1}["width","height"].includes(y.attrName)&&y.attrValue==="100%"&&(y.forceKeepAttr=!0),y.attrName==="style"&&y.attrValue==="overflow:visible"&&(y.forceKeepAttr=!0)});const _=hi.sanitize(u,{USE_PROFILES:{svg:!0,svgFilters:!0},ALLOWED_TAGS:["svg","circle","ellipse","line","path","polygon","polyline","rect","g","text","use","defs","clipPath","mask","pattern","linearGradient","radialGradient","stop"],ALLOWED_ATTR:["d","points","x","y","width","height","r","cx","cy","rx","ry","x1","y1","x2","y2","transform","fill","stroke","stroke-width","viewBox","xmlns","xmlns:xlink","xml:space","style","id","class","offset","stop-color","stop-opacity","clip-path","mask","fill-opacity","stroke-opacity","gradientTransform","gradientUnits","xlink:href"],FORBID_TAGS:["a","script","iframe","image","foreignObject"],FORBID_ATTR:["href","onclick","onload","onerror"]});if(hi.removeHook("uponSanitizeElement"),hi.removeHook("uponSanitizeAttribute"),u!==_){const w=new Blob([_],{type:p}),y=vo(w,c);this.uppy.setFileState(t,{...this.uppy.getFile(t),data:y,preview:wn(y)}),console.info("clean svg file xss attack",{name:c,originalFile:a.data.text(),cleanFile:_})}}}};preventZipBombAttack=async e=>{const{id:t}=e,a=this.uppy.getFile(t);try{if(a&&En[a.extension]){const{data:n}=a,s=En[a.extension](new Uint8Array(await n.arrayBuffer())),o=(l,c,p=0)=>Object.entries(l instanceof Uint8Array?{[c||a.name]:l}:l).reduce((u,[f,x])=>{if(!x||x.byteLength===0)return console.warn("Invalid or empty item in unzipped content",{name:f,item:x}),u;const S=u+x.byteLength;if(p>=5||S>a.size*100)throw console.error("Zip bomb detected, please check your file",{depth:p,baseAcc:S,fileSize:a.size}),new Error("Zip bomb detected, please check your file");const _=Ke.extension(Ke.lookup(f));if(En[_]){const w=En[_](x);return S+o(w,f,p+1)}return S},0);if(o(s)>a.size*100)throw new Error("Zip bomb detected, please check your file")}}catch(n){if(n.message.includes("Zip bomb detected"))throw n}};validateImagesRespectCropperOptions=async()=>this.uppy.getFiles().reduce(async(e,t)=>{await e;const{id:a}=t;let n=this.uppy.getFile(a);if(n.isRemote&&(await this.tryDownloadRemoteFile(n),n=this.uppy.getFile(a)),!this.opts.cropperOptions?.aspectRatio||!n?.type?.includes("image")||n.type?.includes("image/svg"))return Promise.resolve();const{aspectRatio:s}=this.opts.cropperOptions,o=this.uppy.getPlugin("ImageEditor"),r=document.querySelector(`[src="${n.preview}"]`)||document.getElementById("uppy_"+a).querySelector("img"),l=r?.naturalWidth,c=r?.naturalHeight,p=Number(l/c).toFixed(2),u=Number(s).toFixed(2);if(p===u)return Promise.resolve();this.uppy.emit("preprocess-progress",n,{mode:"indeterminate",message:this.i18n("editorLoading")}),o.parent.openFileEditor(n);const x=this.i18n("aspectRatioMessage",{imageAspectRatio:p,aspectRatio:u});return this.uppy.info({message:x,details:x}),new Promise((S,_)=>{this.uppy.once("file-editor:complete",()=>{setTimeout(()=>{S()},200)}),this.uppy.once("file-editor:cancel",()=>{})})},Promise.resolve());checkImageOrientation=async e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a?.type?.startsWith("image/"))try{if(!(await xw(a.data).catch(()=>({deg:0}))).deg)return;const s=a.data.size*.98,o=await new Promise((_,w)=>{const y=new Image;let b=URL.createObjectURL(a.data);y.src=b,y.onload=()=>{URL.revokeObjectURL(b),b=null,_(y)},y.onerror=h=>{b&&(URL.revokeObjectURL(b),b=null),w(new Error(`Image load failed: ${h.message}`))}}),r=o.width/o.height;let l=Math.sqrt(s*r),c=l/r;const p=8096;if(l>p||c>p){const _=p/Math.max(l,c);l*=_,c*=_}const u=document.createElement("canvas");u.width=l,u.height=c;const f=u.getContext("2d",{willReadFrequently:!0,alpha:a.type==="image/png"});f.imageSmoothingEnabled=!0,f.imageSmoothingQuality="high",f.translate(u.width/2,u.height/2),f.drawImage(o,-l/2,-c/2,l,c);const x=1,S=await new Promise(_=>{u.toBlob(_,a.type,x)});this.uppy.setFileState(t,{data:S,size:S.size})}catch(n){console.error("Image rotation processing failed:",n);return}};prepareUploadWrapper=async e=>{await this.tryDownloadRemoteFile(e),await this.checkImageOrientation(e),await this.getPreviewFromData(e),await this.setHashFileName(e),await this.preventXssAttack(e),await this.preventZipBombAttack(e),await this.setMetaData(e)};tryDownloadRemoteFile=async e=>{const{type:t,name:a,preview:n,source:s,isRemote:o,isDownloading:r,id:l,isLoading:c,remote:p,meta:u,errorCount:f=0}=e,x=!c&&o,S=`uploader:${l}:downloaded`,_=_a(e),w=a?.split("?")?.[0],b=(()=>{const h=["jpg","jpeg"];return h.includes(_)&&h.some(m=>w?.endsWith(m))?!0:w?.endsWith(_)})()?w:`${w}${_?`.${_}`:""}`;if(x){const h=yx(n||p?.body?.url);if(f>=3)throw this.uppy.setFileState(l,{error:this.i18n("downloadRemoteFileFailure"),meta:{...u,name:this.i18n("downloadRemoteFileFailure")}}),new Error("Download remote file failure");this.uppy.setFileState(l,{isLoading:!0,isDownloading:!0,size:null,meta:{...u,name:this.i18n("loading")}}),await fetch(h).then(async m=>await m.blob()).then(async m=>{const v=vo(m,b);this.uppy.setFileState(l,{name:b,extension:_,type:t,data:v,preview:n||wn(v),source:s,size:v.size,isDownloading:!1,isRemote:!1,meta:{...u,name:b,filename:b}}),this.uppy.getFile(l),this.uppy.emit(S,l)}).catch(async m=>{if(console.error("Axios download remote file error: ",m),t.startsWith("image/")){const v=t.includes("svg")?"image/png":t,g=b.endsWith(".svg")?b.replace(".svg",".png"):b;try{const k=await new Promise((L,B)=>{const V=new Image;V.crossOrigin="anonymous",V.onload=()=>{const I=document.createElement("canvas");I.width=V.width,I.height=V.height;const $=I.getContext("2d");$.translate(I.width/2,I.height/2),$.drawImage(V,-V.width/2,-V.height/2,V.width,V.height),I.toBlob(L,v)},V.onerror=B,V.src=h});let T=vo(k,g);this.uppy.setFileState(l,{name:g,extension:_,type:v,data:T,preview:n||wn(T),source:s,size:T.size,isDownloading:!1,isRemote:!1,meta:{...u,name:g,filename:g}});const D=this.uppy.getFile(l);this.uppy.emit(S,l);return}catch{}}this.uppy.setFileState(l,{isRemote:!0,isLoading:!1,errorCount:f+1}),await this.tryDownloadRemoteFile(this.uppy.getFile(l))})}else r&&await(async()=>new Promise(m=>{this.uppy.once(S,async()=>{m()})}))()};getPreviewFromData=e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a){const{data:n,type:s,preview:o}=a;(s.indexOf("gif")>-1||!o)&&n&&s.indexOf("image")>-1&&setTimeout(()=>{this.uppy.setFileState(t,{preview:wn(n)})},s.indexOf("gif")>-1?1e3:0)}};prepareUpload=async e=>{await this.validateImagesRespectCropperOptions();const t=e.map(async n=>{const s=this.uppy.getFile(n);s.isDownloading&&this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("loading")}),await this.prepareUploadWrapper(s)}),a=()=>{e.forEach(n=>{const s=this.uppy.getFile(n);this.uppy.emit("preprocess-complete",s)})};return Promise.all(t).then(a)};install(){this.uppy.addPreProcessor(this.prepareUpload),this.uppy.on("file-added",async e=>{setTimeout(()=>{this.prepareUploadWrapper(e)},200)}),this.uppy.on("file-editor:complete",e=>{this.getPreviewFromData(e)})}uninstall(){this.uppy.removePreProcessor(this.prepareUpload)}render(){return le(Tx,{})}}class Aw extends me{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=()=>le("svg",{width:"20",height:"20",viewBox:"0 0 24 24",children:le("g",{fill:"none",stroke:"#a482fe","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",children:[le("path",{d:"M15 8h.01M10 21H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v5"}),le("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 le("div",{id:"ai-image",className:"ai-image",children:le("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()}}class Ow extends me{constructor(e,t){super(e,t),this.id=t.id,this.title=t.title,this.type="acquirer",this.uppy=e,this.i18nInit(),this.autoHide=t.autoHide??!0,typeof t.icon=="string"&&(this.icon=()=>le("div",{dangerouslySetInnerHTML:{__html:t.icon},style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}}))}getDashboard(){return this.uppy.getPlugin(this.id)?.parent}render(){return this.autoHide&&this.getDashboard()?.hideAllPanels&&this.getDashboard().hideAllPanels(),le("div",{id:this.id,className:"uppy-VirtualPlugin"})}update(){}onFirstRender(){}uninstall(){this.unmount()}}const Xu=()=>navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome");class Rw extends me{constructor(e,t){super(e,t),this.id=t?.id||"safari-paste",this.type="modifier"}onMount(){Xu()&&this.parent?.handlePaste&&document.addEventListener("paste",this.parent.handlePaste)}onUnmount(){Xu()&&this.parent?.handlePaste&&document.removeEventListener("paste",this.parent.handlePaste)}}const Uw="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9",Mw=Y.lazy(()=>Xh(()=>import("./index-BYbLccyT.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),Yu="uploader-container",Io="uploader-dashboard",Lw='div[tabindex="-1"]',Qu=50,Nw=10,Or=localStorage.getItem("uppy_debug"),Bw=()=>xr.get("x-csrf-token")?{"x-csrf-token":xr.get("x-csrf-token")}:{},jw=i=>{const{apiPathProps:e,availablePluginMap:t={},uploadedProps:a,resourcesProps:n,imageEditorProps:s={},theme:o,plugins:r}=i,{companionUrl:l}=gh(e),c=Bw(),p=async f=>(await Za.post("/api/image/generations",f)).data,u={...i?.restrictions,maxFileSize:1/0};return[{id:"ImageEditor",plugin:Vd,options:{quality:1,...s},alwayUse:!0},(Or||ka()&&t.Uploaded&&!Cu())&&{id:"Uploaded",plugin:Ix,options:{params:a?.params}},(Or||ka()&&t.Resources&&!Cu())&&{id:"Resources",plugin:Ox,options:{params:n?.params}},ka()&&xx()&&t.AIImage&&{id:"AIImage",plugin:Aw,options:{companionUrl:l,companionHeaders:c},onShowPanel:f=>{function x(){setTimeout(()=>{const S=document.getElementById("ai-image");S?jh.createRoot(S).render(N.jsx(Mw,{theme:o,api:p,restrictions:u,i18n:f.current?.getUploader()?.i18n,onSelect:_=>{const w=f.current.getUploader();w?.emit("ai-image:selected",_),_.forEach(({src:y,alt:b},h)=>{const m=k=>k?.length>16?`${k?.slice(0,8)}...${k?.slice(-4)}`:k,v=`${m(b)||m(y)}.png`,g={name:v,type:"image/png",data:bx(y,v),source:"AIImage",isRemote:!1};w?.addFile(g)})}})):x()},100)}x()}},{id:"Url",plugin:zt,options:{companionUrl:l,companionHeaders:c}},{id:"Webcam",plugin:Fp,options:{showVideoSourceDropdown:!0,showRecordingLength:!0,mirror:!1,videoConstraints:{facingMode:"environment"}}},!!window?.blocklet?.UNSPLASH_KEY&&t.Unsplash&&{id:"Unsplash",plugin:Vp,options:{companionUrl:l,companionHeaders:c,companionCookiesRule:"same-origin"}},{id:"PrepareUpload",plugin:Iw,options:{companionUrl:l,companionHeaders:c,cropperOptions:s?.cropperOptions||null},alwayUse:!0},{id:"ThumbnailGeneratorNext",plugin:Xr,options:{thumbnailType:"image/png",thumbnailWidth:"100%"},alwayUse:!0},...(r||[]).filter(f=>f?.id).map(f=>{const{id:x,options:S,onShowPanel:_}=f;return{id:x,plugin:Ow,options:S,onShowPanel:_}}),{id:"safari-paste",plugin:Rw,alwayUse:!0}].filter(Boolean)};function zw(i){const{id:e,plugins:t,locale:a="en",onAfterResponse:n,onUploadFinish:s,coreProps:o,apiPathProps:r,tusProps:l,dropTargetProps:c,pluginList:p,restrictions:u,onChange:f,initialFiles:x}=i,S=ip(p,"id"),{uploaderUrl:_}=gh(r);let w=new Ur({id:e,meta:{uploaderId:e},debug:["true",!0].includes(Or||""),locale:ha[a],onBeforeFileAdded:(h,m)=>{if(Object.hasOwn(m,h.id))return!1;const v=!!Ke.extension(h.type),g=Ke.lookup(h.name)||"";if(!v&&g&&g!==h.type){const k=_a(h);k&&(h.extension=k),h.type=g}return h},...o,restrictions:u}).use(hh,{chunkSize:1024*1024*10,removeFingerprintOnSuccess:!0,withCredentials:!0,endpoint:_,async onBeforeRequest(h,m){const{hashFileName:v,id:g,meta:k}=m,T=w.getFile(g)?.mockResponse||null;h.getMethod()==="PATCH"&&T&&(h.send=()=>T);const D=_a(m);h.setHeader("x-uploader-file-name",`${v}`),h.setHeader("x-uploader-file-id",`${g}`),h.setHeader("x-uploader-file-ext",`${D}`),h.setHeader("x-uploader-base-url",new URL(h.getURL()).pathname),h.setHeader("x-uploader-endpoint-url",_),h.setHeader("x-uploader-metadata",JSON.stringify(k,(V,I)=>typeof I=="string"?encodeURIComponent(I):I));const L=xr.get("x-csrf-token");L&&h.setHeader("x-csrf-token",L);const B=window?.uploaderComponentId||window?.blocklet?.componentId;B&&h.setHeader("x-component-did",(B||"").split("/").pop())},onAfterResponse:async(h,m)=>{const v={},g=h.getUnderlyingObject();try{g.response&&(v.data=JSON.parse(g.response))}catch{v.data={}}v.method=h.getMethod().toUpperCase(),v.url=h.getURL(),v.status=g.status,v.headers={...h._headers};const k=g.getAllResponseHeaders();k&&k.split(`\r
|
|
77
|
-
`).forEach(V=>{const[I,$]=V.split(": ");I&&$&&(v.headers[I]=$)});const T=w.getFile(v.headers["x-uploader-file-id"]);if(h.getMethod()==="PATCH"&&T.mockResponse)return;if(["PATCH","POST"].includes(v.method)&&[200,500].includes(v.status)){const B=[!0,"true"].includes(v.headers["x-uploader-file-exist"]),V=Px(v.url,v.headers["x-uploader-file-name"]);v.file=T,v.uploadURL=V;const I={uploadURL:V,...v};w.setFileState(T.id,{responseResult:I}),B&&T&&(v.method==="POST"&&w.setFileState(T.id,{mockResponse:m}),w.emit("upload-success",w.getFile(T.id),{...I,body:v.data}),w.emit("postprocess-complete",w.getFile(T.id)),w.calculateTotalProgress()),v.status===200&&(await s?.(v),w.emitUploadSuccess(T,v))}n&&await n?.(g);const D=w.getState().totalProgress===100,L=w.getFiles().every(B=>B.source==="DropTarget");D&&L&&w.close()},...l});const y=({fileIDs:h,id:m})=>{h.forEach(v=>{w.setFileState(v,{uploadID:m})})};w.off("upload",y),w.on("upload",y);const b=h=>{typeof f=="function"&&f(h,w.getFiles())};return w.off("file-added",b),w.on("file-added",b),w.off("file-removed-success",b),w.on("file-removed-success",b),c&&w.use(Ed,{target:document.body,onDrop:h=>{w?.open?.()},...c}),t?.forEach(h=>{if(h?.id||h){const{plugin:m,options:v}=S[h?.id||h]||{};m&&w.use(m,v)}}),Cx(w),x&&x?.length>0&&w.addFiles(x),w}function Ju({ref:i=void 0,...e}){const t={uploader:"/api/uploads",companion:"/api/companion",disableMediaKitPrefix:!1,disableMediaKitStatus:!1,...e?.apiPathProps},a=Y.useRef(null),n=Y.useRef(null),s=Y.useRef(0),o=rf({open:!1,uppy:null,availablePluginMap:{},restrictions:ys(e?.coreProps?.restrictions)||{},isError:!1}),r=ap(),l=r?.palette?.mode,c=jw({...e,apiPathProps:t,availablePluginMap:o.availablePluginMap,restrictions:o.restrictions,theme:r}),{plugins:p=c.map(U=>U.id),id:u="Uploader",popup:f=!1,onUploadFinish:x,onOpen:S,onClose:_,locale:w="en",installerProps:y}=e,b=ip(c,"id"),h=Zh(U=>U?.breakpoints?.down("md")),m=xs([...p,...c.filter(U=>U.alwayUse).map(U=>U.id)]),{loading:v}=lf(async()=>{let U=ws(e?.coreProps?.restrictions)?{}:ys(e?.coreProps?.restrictions);if(!t.disableMediaKitStatus&&ka())try{await Za.get("/api/uploader/status").then(({data:C})=>{o.availablePluginMap=C.availablePluginMap,!t.disableMediaKitPrefix&&ws(e?.coreProps?.restrictions)&&(U=C.restrictions||{})}),o.isError=!1}catch{o.isError=!0}!U?.allowedFileTypes?.length&&U?.allowedFileExts&&(U.allowedFileTypes=xs(((typeof U?.allowedFileExts=="string"?U?.allowedFileExts.split(","):U?.allowedFileExts)||[])?.map(C=>Ke.lookup(C?.replaceAll(" ","")||""))?.filter(C=>C)),delete U.allowedFileExts),U.maxFileSize&&typeof U.maxFileSize=="string"&&(U.maxFileSize=uf.parseSize(U.maxFileSize,{iec:!1})||void 0),o.restrictions=ys(U)},{refreshDeps:[JSON.stringify({apiPathProps:t,restrictionsProps:e?.coreProps?.restrictions})]}),g=typeof o.restrictions?.allowedFileTypes=="object"&&o.restrictions?.allowedFileTypes?.length===0,k=Y.useMemo(()=>xs(o.restrictions?.allowedFileTypes?.flatMap(U=>{if(U.endsWith("/*")){const C=U.split("/")?.[0];switch(C){case"image":return["jpg","jpeg","png","gif","svg","webp","bmp","tiff","avif","heic","ico","apng"];case"video":return["mp4","webm","mov","avi","wmv","flv","mkv","mpg","mpeg","3gp","m4v","ts","m2ts"];case"audio":return["mp3","wav","ogg","aac","flac","m4a","wma","opus","mid","midi","amr"];case"text":return["txt","html","htm","css","csv","md","rtf","xml","json","js","ts","jsx","tsx"];case"application":return["pdf","doc","docx","xls","xlsx","ppt","pptx","zip","rar","7z","tar","gz","exe","msi","apk","dmg","iso"];case"font":return["ttf","otf","woff","woff2","eot"];case"chemical":return["mol","pdb","cml","xyz"];case"model":return["obj","stl","gltf","glb","fbx","3ds","dae"];case"message":return["eml","msg","vcf","ics"];default:return C}}return Ke.extension(U)})||[])?.filter(Boolean)?.join(", ")||"",[o.restrictions?.allowedFileTypes]);let T="";g?T=tn(ha,`${w}.strings.noAllowedFileTypes`,"No allowed file types"):o.restrictions?.allowedFileTypes?.length&&k&&(T=tn(ha,`${w}.strings.allowedFileTypes`,"Allowed file types: ")+k),(ws(T)||["undefined","null",void 0,null].includes(T))&&(T=""),cf("esc",U=>{o.open&&(U.stopPropagation(),U.preventDefault(),B())},{useCapture:!0}),Y.useEffect(()=>{wx(t),o.uppy=zw({...e,id:u,plugins:m,apiPathProps:t,pluginList:c,restrictions:o.restrictions}),o.uppy.open=L,o.uppy.close=B,o.uppy.openPlugin=D;const U=F=>{const{onShowPanel:E}=b[F];E?.(i)};o.uppy.off("dashboard:show-panel",U),o.uppy.on("dashboard:show-panel",U);const C=(F,E,O,A)=>{const z=`${A.toLowerCase()}Props`,W=O[z]?.onSelectedFiles;if(typeof W=="function"){const G=F.map(X=>{const J={name:X.id||X.fileUrl?.split("/")?.slice(-1)?.[0],type:X.mimetype||Ke.lookup(X.fileUrl),data:"",preview:X.fileUrl,source:A,isRemote:!0},Z=E.uppy.addFile(J);return{...X,uppyFile:E.uppy.getFile(Z)}});W?.(G)}else{const G=[],X=[],J=`Mock-${Math.random().toString(36).substring(2,15)}`;Promise.all(F.map(async Z=>{const gt=kx(Z);gt&&(gt.uploadID=J,G.push(gt)),await x?.(gt),E.uppy.emitUploadSuccess(gt.file,gt)})).then(()=>{E.uppy.close()}).finally(()=>{E.uppy.emit("complete",{failed:X,successful:G,uploadID:J})})}};[{name:"Uploaded",event:"uploaded:selected"},{name:"Resources",event:"resources:selected"}].forEach(({name:F,event:E})=>{m.includes(F)&&(o.uppy.off(E),o.uppy.on(E,O=>C(O,o,e,F)))})},[JSON.stringify({id:u,plugins:m,apiPathProps:t,locale:w,restrictions:o.restrictions,theme:r})]);function D(U){if(U=U.replace(/\s/g,""),["MyDevice",...m.map(P=>P.id||P)].map(P=>P.toLowerCase()).includes(U.toLowerCase())){let P=`div[data-uppy-acquirer-id="${U}"] > button`;document?.getElementById(Io)?.querySelector(P)?.click?.()}}function L(U){o.open=!0,U&&setTimeout(()=>{D(U)},200),o.uppy.emitOpen(),S?.(),n.current&&(clearInterval(n.current),n.current=null),s.current=0,n.current=setInterval(()=>{const C=a.current?.querySelector(Lw);s.current+=1,(s.current>Qu||C&&C!==document.activeElement)&&(C&&C!==document.activeElement?(C.focus?.(),console.info("[Uploader] Trigger auto focus overlay success")):s.current>Qu&&console.info("[Uploader] Auto focus overlay failed after maximum attempts"),clearInterval(n.current),n.current=null)},Nw)}function B(){n.current&&(clearInterval(n.current),n.current=null),o.uppy.getPlugin(Io)?.hideAllPanels(),o.open=!1,o.uppy.emitClose(),_?.(),setTimeout(()=>{o.uppy.getState().totalProgress===100&&(o.uppy.setState({files:{},currentUploads:{}}),o.uppy.calculateTotalProgress())},500)}Y.useImperativeHandle(i,()=>({getUploader:()=>o.uppy,open:L,close:B}));const V=f?ef:Y.Fragment,I=f?{sx:{zIndex:99999999999,"& > *":{display:o.open?"block":"none"},display:"flex",justifyContent:"center",alignItems:"center",...e?.wrapperProps?.sx},invisible:!0,open:o.open,onClick:U=>{document.activeElement===document.body&&(U.stopPropagation(),B())},...e.wrapperProps}:{...e.wrapperProps},$=h?"42px":"40px";return N.jsx(V,{...I,children:N.jsxs(mh,{onClose:B,did:Uw,disabled:!o.open,...y,children:[N.jsx(tf,{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)"}}})}),N.jsxs(ee,{className:"uploader-container",ref:a,id:Yu,onClick:U=>U.stopPropagation(),sx:{position:"relative",width:h?"90vw":720,animation:o.open?"uppy-Dashboard-fadeIn 150ms ease-in-out":"none","@keyframes uppy-Dashboard-fadeIn":{from:{opacity:0},to:{opacity:1}},".uppy-Dashboard-inner":{borderColor:"divider"},".uppy-ProviderBrowserItem > *":{transition:"all 0.3s ease-in-out"},".uppy-ProviderBrowserItem-inner":{flex:1,color:"transparent","img, object":{objectFit:"contain !important"}},".uppy-ProviderBrowserItem-checkbox":{backgroundColor:`${r?.palette?.primary?.main} !important`},".uppy-Dashboard-Item-previewInnerWrap, .uppy-ProviderBrowserItem-inner":{boxShadow:"none !important",background:"repeating-conic-gradient(#e0e0e0 0 25%,#fff 0 50%) 50%/18px 18px !important"},".uppy-ProviderBrowserItem--selected .uppy-ProviderBrowserItem-inner":{boxShadow:U=>`0 0 0 3px ${U.palette.primary.main} !important`},".uploaded-add-item":{background:r.palette.mode==="dark"?"rgba(255,255,255,0.1) !important":"rgba(0,0,0,0.1) !important",display:"flex",justifyContent:"center",alignItems:"center",transition:"all 0.3s ease-in-out","&:hover":{background:r.palette.mode==="dark"?"rgba(255,255,255,0.13) !important":"rgba(0,0,0,0.13) !important"}},".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":{height:"100%"},".uppy-ProviderBrowser-list":{height:"fit-content",maxHeight:"100%",bgcolor:"background.paper"},".uploaded, .ai-image":{width:"100%",height:"100%",display:"flex",alignItems:"center",flexDirection:"column","& > div":{width:"100%",bgcolor:"background.paper"},"& .uppy-ProviderBrowser-header":{display:"none"}},"& .uppy-Url":{width:"100% !important",display:"flex",justifyContent:"center","& input":{width:"70%"}},"& .uppy-Dashboard-browse, & .uppy-DashboardContent-addMore, & .uppy-DashboardContent-back, & .uppy-StatusBar-actionBtn--done, & .uppy-DashboardContent-save, & .uppy-StatusBar-actionBtn--upload":{color:`${r?.palette?.primary?.main}`,transition:"all 0.3s ease-in-out","&:hover, &:focus":{color:`${r?.palette?.primary?.main}`,filter:"brightness(1.2)"}},"& .uppy-Dashboard-browse":{textDecoration:"underline !important"},"& .uppy-c-btn-primary":{backgroundColor:`${r?.palette?.primary?.main} !important`,transition:"all 0.3s ease-in-out","&:hover, &:focus":{backgroundColor:`${r?.palette?.primary?.main} !important`,filter:"brightness(1.2)"}},"& .button-color-style":{border:"1px solid",borderColor:"primary.main",color:"primary.main",backgroundColor:"transparent",transition:"all 0.3s ease-in-out","&:hover":{filter:"brightness(1.2)"}},"& .button-color-style-active":{backgroundColor:"primary.main",color:"white"}},children:[f&&N.jsx(Ao,{"aria-label":"close",onClick:B,sx:{color:l==="dark"?"#ddd":"#fafafa",position:"absolute",...h?{bottom:`calc(0px - ${$} - 16px)`,left:`calc(50vw - ${$} - 8px)`}:{right:`calc(0px - ${$} - 16px)`,top:-12}},children:N.jsx(af,{sx:{fontSize:$}})}),v&&N.jsxs(ee,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",zIndex:99999999999,flexDirection:"column",background:"rgba(256, 256, 256, 0.2)",backdropFilter:"blur(4px)",borderRadius:1,pointerEvents:"none"},children:[N.jsx(nf,{size:32}),N.jsx(sf,{variant:"body2",color:"primary",sx:{mt:1.5,fontWeight:"bold"},children:tn(ha,`${w}.strings.loadingStatus`,"Loading...")})]}),o.uppy&&N.jsx(yd,{inline:!0,target:`#${Yu}`,id:Io,disabled:g||o.isError,uppy:o.uppy,plugins:m,fileManagerSelectionType:o.restrictions?.maxNumberOfFiles===1?"files":"both",proudlyDisplayPoweredByUppy:!1,showProgressDetails:!0,disableThumbnailGenerator:!0,theme:l==="dark"?"dark":"light",note:o.isError?tn(ha,`${w}.strings.error`,"Error"):T,doneButtonHandler:B,...e.dashboardProps})]},"uploader-container")]})},"uploader-wrapper")}const Uh=Y.createContext(null);function $w(){const i=Y.useContext(Uh);if(!i)throw new Error("useUploaderContext must be used within an UploaderProvider");return i}function f2({onChange:i,children:e,...t}){const a=$w(),n=()=>{const s=a?.current?.getUploader();s?.open(),i&&s.onceUploadSuccess((...o)=>{i(...o)})};return N.jsx(ee,{onClick:n,...t,children:e})}function m2({children:i,popup:e,...t}){const a=Y.useRef(null),n=Y.useMemo(()=>e?zh.createPortal(N.jsx(Ju,{ref:a,popup:!0,...t},"uploader"),document.body):N.jsx(Ju,{ref:a,popup:!1,...t},"uploader"),[a,e,t]);return N.jsxs(Uh.Provider,{value:a,children:[i,n]})}export{yo as CLOSE,bo as OPEN,Fu as UPLOADER_UPLOAD_SUCCESS,Ju as Uploader,Uh as UploaderContext,m2 as UploaderProvider,f2 as UploaderTrigger,Sx as api,bx as base64ToFile,vo as blobToFile,ns as createImageUrl,xx as getAIKitComponent,yx as getDownloadUrl,_a as getExt,ka as getMediaKitComponent,wn as getObjectURL,gh as getUploaderEndpoint,Px as getUrl,zw as initUploader,Cx as initUppy,vx as isBlob,Cu as isMediaKit,_x as isSvgFile,Za as mediaKitApi,Ot as mediaKitMountPoint,kx as mockUploaderFileResponse,Fx as parseStringToDot,pi as prefixPath,wx as setPrefixPath,$w as useUploaderContext};
|
|
74
|
+
`,t.addEventListener("click",async()=>{await this.uppy.openPlugin("My Device")}),e.insertBefore(t,e.firstChild),this.addUploadItemFlag=!1}}},{wait:200});convertImgToObject=Vn(()=>{this.canConvertImgToObject&&(document.querySelectorAll("#uploaded img").forEach(t=>{if(!t?.src)return;const{src:a}=t,n=this.uploadedAPIData.files?.find(r=>r.previewUrl===a),s=document.createElement("div");s.style="width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; ";const o=document.createElement("div");if(o.className="uppy-ProviderBrowserItem-name",o.style="pointer-events: none; position: absolute; bottom: 0; left: 0; right: 0; padding: 5px; background: #0000004d; color: #fff; ",o.innerHTML=Cx(n.originalname),[".mp4",".webm"].find(r=>t.src?.endsWith(r))){const r=document.createElement("video");r.src=t.src,r.width=t.width,r.height=t.height,r.autoplay=!0,r.setAttribute("playsinline","playsinline"),r.muted=!0,r.loop=!0,r.style="pointer-events: none;",s.appendChild(r)}else if([".pdf"].find(r=>t.src?.endsWith(r))){const r=document.createElement("div");r.className="pdf-icon",r.innerHTML=Ex,s.appendChild(r)}else{const r=document.createElement("object");r.data=a,r.type=n.mimetype||"image/png",r.alt=n.originalname,r.style="pointer-events: none; max-width: 100%; max-height: 100%; webkit-user-drag: none; object-fit: contain;",r.loading="lazy",s.appendChild(r)}s.appendChild(o),t.parentNode.replaceChild(s,t)}),this.canConvertImgToObject=!1)},{wait:200});update(){this.convertImgToObject(),this.addUploadItem()}onFirstRender(){}resetState=()=>{this.uploadedAPIData={..._u},this.uploaded.setPluginState({...ku}),this.addUploadItemFlag=!0};install(){this.view=new $r(this,{provider:{},viewType:"grid",showBreadcrumbs:!1,showFilter:!1}),this.uploaded=this.view.plugin,this.uploaded.setPluginState({...ku}),this.uploaded.uppy.on("dashboard:show-panel",this.resetState),this.view.toggleCheckbox=(t,a)=>{const{currentSelection:n}=this.uploaded.getPluginState(),s=this.uploaded.uppy.opts.restrictions.maxNumberOfFiles,o=s?n.length<s:!0;n.find(r=>r._id===a._id)?this.uploaded.setPluginState({currentSelection:[...n.filter(r=>r._id!==a._id)]}):(o||n.pop(),this.uploaded.setPluginState({currentSelection:[...n,a]}))},this.view.donePicking=()=>{const{currentSelection:t}=this.uploaded.getPluginState();this.uppy.emit("uploaded:selected",t),this.uploaded.parent.hideAllPanels()},this.uploaded.uppy.validateRestrictions=()=>!1,this.view.handleScroll=t=>{const{scrollHeight:a,scrollTop:n,offsetHeight:s}=t.target;a-(n+s)<30&&this.queryUploadedFromMediaKit()};const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount(),this.uploaded.uppy.off("dashboard:show-panel",this.resetState)}}const Tu={initialized:!1,data:[],files:[],pageSize:16,page:1,loading:!1,hasMore:!0,componentDid:"",components:[]},Eu={authenticated:!0,files:[],folders:[],breadcrumbs:[],filterInput:"",isSearchVisible:!1,currentSelection:[],loading:!0,loadAllFiles:!0},Ix={padding:"5px 15px",marginRight:"8px",marginTop:"8px",borderRadius:"4px",cursor:"pointer",fontSize:"14px",lineHeight:"24.5px",fontWeight:"bold"};class Ax extends me{constructor(e,t){super(e,t),this.id=this.opts.id||"Resources",this.title=this.opts.title||"Resources",this.params=this.opts.params||{},this.type="acquirer",this.uppy=e,this.componentDid="",this.apiData={...Tu},this.icon=()=>le("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:[le("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"}),le("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"}),le("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(e){return!this.apiData.loading&&!this.apiData.initialized&&this.queryResources(),le("div",{id:"resources",className:"uploaded",children:[le("div",{style:{padding:this.apiData.components.length?"12px":"0",display:"flex",flexWrap:"wrap",marginTop:"-8px"},children:this.apiData.components.map(t=>le("button",{className:this.apiData.componentDid===t.did?"button-color-style button-color-style-active":"button-color-style",style:Ix,id:t.componentDid,onClick:()=>{this.apiData.componentDid!==t.did&&(this.apiData.componentDid=t.did,this.queryResources())},children:Hh(t.name)}))}),this.view.render(e)]})}queryResources=async()=>{if(!this.apiData.loading){this.apiData.loading=!0;const{data:e}=await Za.get("/api/resources",{params:{componentDid:this.apiData.componentDid}});this.apiData.loading=!1,this.apiData.initialized=!0,this.apiData.components=e.components||[],this.apiData.componentDid=e.componentDid||"",this.apiData.files=tp([...e.resources.map(t=>{let a="file";const{filename:n}=t,s=ns(n,0,0,Ot);return a=ns(n,400,0,Ot),{filename:n,_id:n,id:n,name:n,icon:a,previewUrl:a,fileUrl:s}})],"id"),this.resources.setPluginState({files:this.apiData.files,loading:!1})}};update(){}onFirstRender(){}resetState=()=>{this.apiData={...Tu},this.resources.setPluginState({...Eu})};install(){this.view=new $r(this,{provider:{},viewType:"grid",showBreadcrumbs:!1,showFilter:!1}),this.resources=this.view.plugin,this.resources.setPluginState({...Eu}),this.resources.uppy.on("dashboard:show-panel",this.resetState),this.view.toggleCheckbox=(t,a)=>{const{currentSelection:n}=this.resources.getPluginState(),s=this.resources.uppy.opts.restrictions.maxNumberOfFiles,o=s?n.length<s:!0;n.find(r=>r.id===a.id)?this.resources.setPluginState({currentSelection:[...n.filter(r=>r.id!==a.id)]}):(o||n.pop(),this.resources.setPluginState({currentSelection:[...n,a]}))},this.resources.uppy.validateRestrictions=()=>!1,this.view.donePicking=()=>{const{currentSelection:t}=this.resources.getPluginState();this.uppy.emit("resources:selected",t),this.resources.parent.hideAllPanels()};const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount(),this.resources.uppy.off("dashboard:show-panel",this.resetState)}}var Re=Uint8Array,Pi=Uint16Array,Ox=Int32Array,vh=new Re([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bh=new Re([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Rx=new Re([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yh=function(i,e){for(var t=new Pi(31),a=0;a<31;++a)t[a]=e+=1<<i[a-1];for(var n=new Ox(t[30]),a=1;a<30;++a)for(var s=t[a];s<t[a+1];++s)n[s]=s-t[a]<<5|a;return{b:t,r:n}},xh=yh(vh,2),wh=xh.b,Ux=xh.r;wh[28]=258,Ux[258]=28;var Mx=yh(bh,0),Lx=Mx.b,Sr=new Pi(32768);for(var te=0;te<32768;++te){var Ut=(te&43690)>>1|(te&21845)<<1;Ut=(Ut&52428)>>2|(Ut&13107)<<2,Ut=(Ut&61680)>>4|(Ut&3855)<<4,Sr[te]=((Ut&65280)>>8|(Ut&255)<<8)>>1}var Ta=function(i,e,t){for(var a=i.length,n=0,s=new Pi(e);n<a;++n)i[n]&&++s[i[n]-1];var o=new Pi(e);for(n=1;n<e;++n)o[n]=o[n-1]+s[n-1]<<1;var r;if(t){r=new Pi(1<<e);var l=15-e;for(n=0;n<a;++n)if(i[n])for(var c=n<<4|i[n],p=e-i[n],u=o[i[n]-1]++<<p,f=u|(1<<p)-1;u<=f;++u)r[Sr[u]>>l]=c}else for(r=new Pi(a),n=0;n<a;++n)i[n]&&(r[n]=Sr[o[i[n]-1]++]>>15-i[n]);return r},en=new Re(288);for(var te=0;te<144;++te)en[te]=8;for(var te=144;te<256;++te)en[te]=9;for(var te=256;te<280;++te)en[te]=7;for(var te=280;te<288;++te)en[te]=8;var Sh=new Re(32);for(var te=0;te<32;++te)Sh[te]=5;var Nx=Ta(en,9,1),Bx=Ta(Sh,5,1),xo=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},Ze=function(i,e,t){var a=e/8|0;return(i[a]|i[a+1]<<8)>>(e&7)&t},wo=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},jx=function(i){return(i+7)/8|0},pl=function(i,e,t){return(e==null||e<0)&&(e=0),(t==null||t>i.length)&&(t=i.length),new Re(i.subarray(e,t))},zx=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Pe=function(i,e,t){var a=new Error(e||zx[i]);if(a.code=i,Error.captureStackTrace&&Error.captureStackTrace(a,Pe),!t)throw a;return a},dl=function(i,e,t,a){var n=i.length,s=a?a.length:0;if(!n||e.f&&!e.l)return t||new Re(0);var o=!t,r=o||e.i!=2,l=e.i;o&&(t=new Re(n*3));var c=function(xl){var wl=t.length;if(xl>wl){var Sl=new Re(Math.max(wl*2,xl));Sl.set(t),t=Sl}},p=e.f||0,u=e.p||0,f=e.b||0,x=e.l,S=e.d,_=e.m,w=e.n,y=n*8;do{if(!x){p=Ze(i,u,1);var b=Ze(i,u+1,3);if(u+=3,b)if(b==1)x=Nx,S=Bx,_=9,w=5;else if(b==2){var g=Ze(i,u,31)+257,k=Ze(i,u+10,15)+4,T=g+Ze(i,u+5,31)+1;u+=14;for(var D=new Re(T),L=new Re(19),B=0;B<k;++B)L[Rx[B]]=Ze(i,u+B*3,7);u+=k*3;for(var V=xo(L),I=(1<<V)-1,$=Ta(L,V,1),B=0;B<T;){var U=$[Ze(i,u,I)];u+=U&15;var h=U>>4;if(h<16)D[B++]=h;else{var C=0,P=0;for(h==16?(P=3+Ze(i,u,3),u+=2,C=D[B-1]):h==17?(P=3+Ze(i,u,7),u+=3):h==18&&(P=11+Ze(i,u,127),u+=7);P--;)D[B++]=C}}var F=D.subarray(0,g),E=D.subarray(g);_=xo(F),w=xo(E),x=Ta(F,_,1),S=Ta(E,w,1)}else Pe(1);else{var h=jx(u)+4,m=i[h-4]|i[h-3]<<8,v=h+m;if(v>n){l&&Pe(0);break}r&&c(f+m),t.set(i.subarray(h,v),f),e.b=f+=m,e.p=u=v*8,e.f=p;continue}if(u>y){l&&Pe(0);break}}r&&c(f+131072);for(var O=(1<<_)-1,A=(1<<w)-1,z=u;;z=u){var C=x[wo(i,u)&O],W=C>>4;if(u+=C&15,u>y){l&&Pe(0);break}if(C||Pe(2),W<256)t[f++]=W;else if(W==256){z=u,x=null;break}else{var G=W-254;if(W>264){var B=W-257,X=vh[B];G=Ze(i,u,(1<<X)-1)+wh[B],u+=X}var J=S[wo(i,u)&A],Z=J>>4;J||Pe(3),u+=J&15;var E=Lx[Z];if(Z>3){var X=bh[Z];E+=wo(i,u)&(1<<X)-1,u+=X}if(u>y){l&&Pe(0);break}r&&c(f+131072);var gt=f+G;if(f<E){var yl=s-E,Mh=Math.min(E,gt);for(yl+f<0&&Pe(3);f<Mh;++f)t[f]=a[yl+f]}for(;f<gt;++f)t[f]=t[f-E]}}e.l=x,e.p=z,e.b=f,e.f=p,x&&(p=1,e.m=_,e.d=S,e.n=w)}while(!p);return f!=t.length&&o?pl(t,0,f):t.subarray(0,f)},$x=new Re(0),ut=function(i,e){return i[e]|i[e+1]<<8},st=function(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24)>>>0},So=function(i,e){return st(i,e)+st(i,e+4)*4294967296},Hx=function(i){(i[0]!=31||i[1]!=139||i[2]!=8)&&Pe(6,"invalid gzip data");var e=i[3],t=10;e&4&&(t+=(i[10]|i[11]<<8)+2);for(var a=(e>>3&1)+(e>>4&1);a>0;a-=!i[t++]);return t+(e&2)},qx=function(i){var e=i.length;return(i[e-4]|i[e-3]<<8|i[e-2]<<16|i[e-1]<<24)>>>0},Vx=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Pe(6,"invalid zlib data"),(i[1]>>5&1)==+!e&&Pe(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ph(i,e){return dl(i,{i:2},e&&e.out,e&&e.dictionary)}function Wx(i,e){var t=Hx(i);return t+8>i.length&&Pe(6,"invalid gzip data"),dl(i.subarray(t,-8),{i:2},e&&e.out||new Re(qx(i)),e&&e.dictionary)}function Gx(i,e){return dl(i.subarray(Vx(i,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function Po(i,e){return i[0]==31&&i[1]==139&&i[2]==8?Wx(i,e):(i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31?Ph(i,e):Gx(i,e)}var Pr=typeof TextDecoder<"u"&&new TextDecoder,Kx=0;try{Pr.decode($x,{stream:!0}),Kx=1}catch{}var Xx=function(i){for(var e="",t=0;;){var a=i[t++],n=(a>127)+(a>223)+(a>239);if(t+n>i.length)return{s:e,r:pl(i,t-1)};n?n==3?(a=((a&15)<<18|(i[t++]&63)<<12|(i[t++]&63)<<6|i[t++]&63)-65536,e+=String.fromCharCode(55296|a>>10,56320|a&1023)):n&1?e+=String.fromCharCode((a&31)<<6|i[t++]&63):e+=String.fromCharCode((a&15)<<12|(i[t++]&63)<<6|i[t++]&63):e+=String.fromCharCode(a)}};function Yx(i,e){if(e){for(var t="",a=0;a<i.length;a+=16384)t+=String.fromCharCode.apply(null,i.subarray(a,a+16384));return t}else{if(Pr)return Pr.decode(i);var n=Xx(i),s=n.s,t=n.r;return t.length&&Pe(8),s}}var Qx=function(i,e){return e+30+ut(i,e+26)+ut(i,e+28)},Jx=function(i,e,t){var a=ut(i,e+28),n=Yx(i.subarray(e+46,e+46+a),!(ut(i,e+8)&2048)),s=e+46+a,o=st(i,e+20),r=t&&o==4294967295?Zx(i,s):[o,st(i,e+24),st(i,e+42)],l=r[0],c=r[1],p=r[2];return[ut(i,e+10),l,c,n,s+ut(i,e+30)+ut(i,e+32),p]},Zx=function(i,e){for(;ut(i,e)!=1;e+=4+ut(i,e+2));return[So(i,e+12),So(i,e+4),So(i,e+20)]};function ew(i,e){for(var t={},a=i.length-22;st(i,a)!=101010256;--a)(!a||i.length-a>65558)&&Pe(13);var n=ut(i,a+8);if(!n)return{};var s=st(i,a+16),o=s==4294967295||n==65535;if(o){var r=st(i,a-12);o=st(i,r)==101075792,o&&(n=st(i,r+32),s=st(i,r+48))}for(var l=e&&e.filter,c=0;c<n;++c){var p=Jx(i,s,o),u=p[0],f=p[1],x=p[2],S=p[3],_=p[4],w=p[5],y=Qx(i,w);s=_,(!l||l({name:S,size:f,originalSize:x,compression:u}))&&(u?u==8?t[S]=Ph(i.subarray(y,y+f),{out:new Re(x)}):Pe(14,"unknown compression type "+u):t[S]=pl(i,y,y+f))}return t}var Co={exports:{}},Du;function tw(){return Du||(Du=1,function(i,e){(function(t){i.exports=t()})(function(t){var a=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(y,b){var h=y[0],m=y[1],v=y[2],g=y[3];h+=(m&v|~m&g)+b[0]-680876936|0,h=(h<<7|h>>>25)+m|0,g+=(h&m|~h&v)+b[1]-389564586|0,g=(g<<12|g>>>20)+h|0,v+=(g&h|~g&m)+b[2]+606105819|0,v=(v<<17|v>>>15)+g|0,m+=(v&g|~v&h)+b[3]-1044525330|0,m=(m<<22|m>>>10)+v|0,h+=(m&v|~m&g)+b[4]-176418897|0,h=(h<<7|h>>>25)+m|0,g+=(h&m|~h&v)+b[5]+1200080426|0,g=(g<<12|g>>>20)+h|0,v+=(g&h|~g&m)+b[6]-1473231341|0,v=(v<<17|v>>>15)+g|0,m+=(v&g|~v&h)+b[7]-45705983|0,m=(m<<22|m>>>10)+v|0,h+=(m&v|~m&g)+b[8]+1770035416|0,h=(h<<7|h>>>25)+m|0,g+=(h&m|~h&v)+b[9]-1958414417|0,g=(g<<12|g>>>20)+h|0,v+=(g&h|~g&m)+b[10]-42063|0,v=(v<<17|v>>>15)+g|0,m+=(v&g|~v&h)+b[11]-1990404162|0,m=(m<<22|m>>>10)+v|0,h+=(m&v|~m&g)+b[12]+1804603682|0,h=(h<<7|h>>>25)+m|0,g+=(h&m|~h&v)+b[13]-40341101|0,g=(g<<12|g>>>20)+h|0,v+=(g&h|~g&m)+b[14]-1502002290|0,v=(v<<17|v>>>15)+g|0,m+=(v&g|~v&h)+b[15]+1236535329|0,m=(m<<22|m>>>10)+v|0,h+=(m&g|v&~g)+b[1]-165796510|0,h=(h<<5|h>>>27)+m|0,g+=(h&v|m&~v)+b[6]-1069501632|0,g=(g<<9|g>>>23)+h|0,v+=(g&m|h&~m)+b[11]+643717713|0,v=(v<<14|v>>>18)+g|0,m+=(v&h|g&~h)+b[0]-373897302|0,m=(m<<20|m>>>12)+v|0,h+=(m&g|v&~g)+b[5]-701558691|0,h=(h<<5|h>>>27)+m|0,g+=(h&v|m&~v)+b[10]+38016083|0,g=(g<<9|g>>>23)+h|0,v+=(g&m|h&~m)+b[15]-660478335|0,v=(v<<14|v>>>18)+g|0,m+=(v&h|g&~h)+b[4]-405537848|0,m=(m<<20|m>>>12)+v|0,h+=(m&g|v&~g)+b[9]+568446438|0,h=(h<<5|h>>>27)+m|0,g+=(h&v|m&~v)+b[14]-1019803690|0,g=(g<<9|g>>>23)+h|0,v+=(g&m|h&~m)+b[3]-187363961|0,v=(v<<14|v>>>18)+g|0,m+=(v&h|g&~h)+b[8]+1163531501|0,m=(m<<20|m>>>12)+v|0,h+=(m&g|v&~g)+b[13]-1444681467|0,h=(h<<5|h>>>27)+m|0,g+=(h&v|m&~v)+b[2]-51403784|0,g=(g<<9|g>>>23)+h|0,v+=(g&m|h&~m)+b[7]+1735328473|0,v=(v<<14|v>>>18)+g|0,m+=(v&h|g&~h)+b[12]-1926607734|0,m=(m<<20|m>>>12)+v|0,h+=(m^v^g)+b[5]-378558|0,h=(h<<4|h>>>28)+m|0,g+=(h^m^v)+b[8]-2022574463|0,g=(g<<11|g>>>21)+h|0,v+=(g^h^m)+b[11]+1839030562|0,v=(v<<16|v>>>16)+g|0,m+=(v^g^h)+b[14]-35309556|0,m=(m<<23|m>>>9)+v|0,h+=(m^v^g)+b[1]-1530992060|0,h=(h<<4|h>>>28)+m|0,g+=(h^m^v)+b[4]+1272893353|0,g=(g<<11|g>>>21)+h|0,v+=(g^h^m)+b[7]-155497632|0,v=(v<<16|v>>>16)+g|0,m+=(v^g^h)+b[10]-1094730640|0,m=(m<<23|m>>>9)+v|0,h+=(m^v^g)+b[13]+681279174|0,h=(h<<4|h>>>28)+m|0,g+=(h^m^v)+b[0]-358537222|0,g=(g<<11|g>>>21)+h|0,v+=(g^h^m)+b[3]-722521979|0,v=(v<<16|v>>>16)+g|0,m+=(v^g^h)+b[6]+76029189|0,m=(m<<23|m>>>9)+v|0,h+=(m^v^g)+b[9]-640364487|0,h=(h<<4|h>>>28)+m|0,g+=(h^m^v)+b[12]-421815835|0,g=(g<<11|g>>>21)+h|0,v+=(g^h^m)+b[15]+530742520|0,v=(v<<16|v>>>16)+g|0,m+=(v^g^h)+b[2]-995338651|0,m=(m<<23|m>>>9)+v|0,h+=(v^(m|~g))+b[0]-198630844|0,h=(h<<6|h>>>26)+m|0,g+=(m^(h|~v))+b[7]+1126891415|0,g=(g<<10|g>>>22)+h|0,v+=(h^(g|~m))+b[14]-1416354905|0,v=(v<<15|v>>>17)+g|0,m+=(g^(v|~h))+b[5]-57434055|0,m=(m<<21|m>>>11)+v|0,h+=(v^(m|~g))+b[12]+1700485571|0,h=(h<<6|h>>>26)+m|0,g+=(m^(h|~v))+b[3]-1894986606|0,g=(g<<10|g>>>22)+h|0,v+=(h^(g|~m))+b[10]-1051523|0,v=(v<<15|v>>>17)+g|0,m+=(g^(v|~h))+b[1]-2054922799|0,m=(m<<21|m>>>11)+v|0,h+=(v^(m|~g))+b[8]+1873313359|0,h=(h<<6|h>>>26)+m|0,g+=(m^(h|~v))+b[15]-30611744|0,g=(g<<10|g>>>22)+h|0,v+=(h^(g|~m))+b[6]-1560198380|0,v=(v<<15|v>>>17)+g|0,m+=(g^(v|~h))+b[13]+1309151649|0,m=(m<<21|m>>>11)+v|0,h+=(v^(m|~g))+b[4]-145523070|0,h=(h<<6|h>>>26)+m|0,g+=(m^(h|~v))+b[11]-1120210379|0,g=(g<<10|g>>>22)+h|0,v+=(h^(g|~m))+b[2]+718787259|0,v=(v<<15|v>>>17)+g|0,m+=(g^(v|~h))+b[9]-343485551|0,m=(m<<21|m>>>11)+v|0,y[0]=h+y[0]|0,y[1]=m+y[1]|0,y[2]=v+y[2]|0,y[3]=g+y[3]|0}function s(y){var b=[],h;for(h=0;h<64;h+=4)b[h>>2]=y.charCodeAt(h)+(y.charCodeAt(h+1)<<8)+(y.charCodeAt(h+2)<<16)+(y.charCodeAt(h+3)<<24);return b}function o(y){var b=[],h;for(h=0;h<64;h+=4)b[h>>2]=y[h]+(y[h+1]<<8)+(y[h+2]<<16)+(y[h+3]<<24);return b}function r(y){var b=y.length,h=[1732584193,-271733879,-1732584194,271733878],m,v,g,k,T,D;for(m=64;m<=b;m+=64)n(h,s(y.substring(m-64,m)));for(y=y.substring(m-64),v=y.length,g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=0;m<v;m+=1)g[m>>2]|=y.charCodeAt(m)<<(m%4<<3);if(g[m>>2]|=128<<(m%4<<3),m>55)for(n(h,g),m=0;m<16;m+=1)g[m]=0;return k=b*8,k=k.toString(16).match(/(.*?)(.{0,8})$/),T=parseInt(k[2],16),D=parseInt(k[1],16)||0,g[14]=T,g[15]=D,n(h,g),h}function l(y){var b=y.length,h=[1732584193,-271733879,-1732584194,271733878],m,v,g,k,T,D;for(m=64;m<=b;m+=64)n(h,o(y.subarray(m-64,m)));for(y=m-64<b?y.subarray(m-64):new Uint8Array(0),v=y.length,g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=0;m<v;m+=1)g[m>>2]|=y[m]<<(m%4<<3);if(g[m>>2]|=128<<(m%4<<3),m>55)for(n(h,g),m=0;m<16;m+=1)g[m]=0;return k=b*8,k=k.toString(16).match(/(.*?)(.{0,8})$/),T=parseInt(k[2],16),D=parseInt(k[1],16)||0,g[14]=T,g[15]=D,n(h,g),h}function c(y){var b="",h;for(h=0;h<4;h+=1)b+=a[y>>h*8+4&15]+a[y>>h*8&15];return b}function p(y){var b;for(b=0;b<y.length;b+=1)y[b]=c(y[b]);return y.join("")}p(r("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function y(b,h){return b=b|0||0,b<0?Math.max(b+h,0):Math.min(b,h)}ArrayBuffer.prototype.slice=function(b,h){var m=this.byteLength,v=y(b,m),g=m,k,T,D,L;return h!==t&&(g=y(h,m)),v>g?new ArrayBuffer(0):(k=g-v,T=new ArrayBuffer(k),D=new Uint8Array(T),L=new Uint8Array(this,v,k),D.set(L),T)}}();function u(y){return/[\u0080-\uFFFF]/.test(y)&&(y=unescape(encodeURIComponent(y))),y}function f(y,b){var h=y.length,m=new ArrayBuffer(h),v=new Uint8Array(m),g;for(g=0;g<h;g+=1)v[g]=y.charCodeAt(g);return b?v:m}function x(y){return String.fromCharCode.apply(null,new Uint8Array(y))}function S(y,b,h){var m=new Uint8Array(y.byteLength+b.byteLength);return m.set(new Uint8Array(y)),m.set(new Uint8Array(b),y.byteLength),m}function _(y){var b=[],h=y.length,m;for(m=0;m<h-1;m+=2)b.push(parseInt(y.substr(m,2),16));return String.fromCharCode.apply(String,b)}function w(){this.reset()}return w.prototype.append=function(y){return this.appendBinary(u(y)),this},w.prototype.appendBinary=function(y){this._buff+=y,this._length+=y.length;var b=this._buff.length,h;for(h=64;h<=b;h+=64)n(this._hash,s(this._buff.substring(h-64,h)));return this._buff=this._buff.substring(h-64),this},w.prototype.end=function(y){var b=this._buff,h=b.length,m,v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g;for(m=0;m<h;m+=1)v[m>>2]|=b.charCodeAt(m)<<(m%4<<3);return this._finish(v,h),g=p(this._hash),y&&(g=_(g)),this.reset(),g},w.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},w.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},w.prototype.setState=function(y){return this._buff=y.buff,this._length=y.length,this._hash=y.hash,this},w.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},w.prototype._finish=function(y,b){var h=b,m,v,g;if(y[h>>2]|=128<<(h%4<<3),h>55)for(n(this._hash,y),h=0;h<16;h+=1)y[h]=0;m=this._length*8,m=m.toString(16).match(/(.*?)(.{0,8})$/),v=parseInt(m[2],16),g=parseInt(m[1],16)||0,y[14]=v,y[15]=g,n(this._hash,y)},w.hash=function(y,b){return w.hashBinary(u(y),b)},w.hashBinary=function(y,b){var h=r(y),m=p(h);return b?_(m):m},w.ArrayBuffer=function(){this.reset()},w.ArrayBuffer.prototype.append=function(y){var b=S(this._buff.buffer,y),h=b.length,m;for(this._length+=y.byteLength,m=64;m<=h;m+=64)n(this._hash,o(b.subarray(m-64,m)));return this._buff=m-64<h?new Uint8Array(b.buffer.slice(m-64)):new Uint8Array(0),this},w.ArrayBuffer.prototype.end=function(y){var b=this._buff,h=b.length,m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],v,g;for(v=0;v<h;v+=1)m[v>>2]|=b[v]<<(v%4<<3);return this._finish(m,h),g=p(this._hash),y&&(g=_(g)),this.reset(),g},w.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},w.ArrayBuffer.prototype.getState=function(){var y=w.prototype.getState.call(this);return y.buff=x(y.buff),y},w.ArrayBuffer.prototype.setState=function(y){return y.buff=f(y.buff,!0),w.prototype.setState.call(this,y)},w.ArrayBuffer.prototype.destroy=w.prototype.destroy,w.ArrayBuffer.prototype._finish=w.prototype._finish,w.ArrayBuffer.hash=function(y,b){var h=l(new Uint8Array(y)),m=p(h);return b?_(m):m},w})}(Co)),Co.exports}var iw=tw();const aw=ft(iw);var gs=typeof self<"u"?self:us;const Wa=typeof navigator<"u",nw=Wa&&typeof HTMLImageElement>"u",ss=!(typeof us>"u"||typeof Ci>"u"||!Ci.versions||!Ci.versions.node),hl=gs.Buffer,Sn=gs.BigInt,fl=!!hl,sw=i=>i;function os(i,e=sw){if(ss)try{return typeof require=="function"?Promise.resolve(e(require(i))):import(i).then(e)}catch{console.warn(`Couldn't load ${i}`)}}let ml=gs.fetch;const ow=i=>ml=i;if(!gs.fetch){const i=os("http",a=>a),e=os("https",a=>a),t=(a,{headers:n}={})=>new Promise(async(s,o)=>{let{port:r,hostname:l,pathname:c,protocol:p,search:u}=new URL(a);const f={method:"GET",hostname:l,path:encodeURI(c)+u,headers:n};r!==""&&(f.port=Number(r));const x=(p==="https:"?await e:await i).request(f,S=>{if(S.statusCode===301||S.statusCode===302){let _=new URL(S.headers.location,a).toString();return t(_,{headers:n}).then(s).catch(o)}s({status:S.statusCode,arrayBuffer:()=>new Promise(_=>{let w=[];S.on("data",y=>w.push(y)),S.on("end",()=>_(mt.concat(w)))})})});x.on("error",o),x.end()});ow(t)}function q(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}const rs=i=>Ch(i)?void 0:i,rw=i=>i!==void 0;function Ch(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(rw).length===0)}function fe(i){let e=new Error(i);throw delete e.stack,e}function oi(i){return(i=function(e){for(;e.endsWith("\0");)e=e.slice(0,-1);return e}(i).trim())===""?void 0:i}function Cr(i){let e=function(t){let a=0;return t.ifd0.enabled&&(a+=1024),t.exif.enabled&&(a+=2048),t.makerNote&&(a+=2048),t.userComment&&(a+=1024),t.gps.enabled&&(a+=512),t.interop.enabled&&(a+=100),t.ifd1.enabled&&(a+=1024),a+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 Fr=i=>String.fromCharCode.apply(null,i),Iu=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0;function Fh(i){return Iu?Iu.decode(i):fl?mt.from(i).toString("utf8"):decodeURIComponent(escape(Fr(i)))}class Ue{static from(e,t){return e instanceof this&&e.le===t?e:new Ue(e,void 0,void 0,t)}constructor(e,t=0,a,n){if(typeof n=="boolean"&&(this.le=n),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){a===void 0&&(a=e.byteLength-t);let s=new DataView(e,t,a);this._swapDataView(s)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof Ue){a===void 0&&(a=e.byteLength-t),(t+=e.byteOffset)+a>e.byteOffset+e.byteLength&&fe("Creating view outside of available memory in ArrayBuffer");let s=new DataView(e.buffer,t,a);this._swapDataView(s)}else if(typeof e=="number"){let s=new DataView(new ArrayBuffer(e));this._swapDataView(s)}else fe("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,a=Ue){return e instanceof DataView||e instanceof Ue?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||fe("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new a(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new Ue(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 Fh(this.getUint8Array(e,t))}getLatin1String(e=0,t=this.byteLength){let a=this.getUint8Array(e,t);return Fr(a)}getUnicodeString(e=0,t=this.byteLength){const a=[];for(let n=0;n<t&&e+n<this.byteLength;n+=2)a.push(this.getUint16(e+n));return Fr(a)}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,a){switch(t){case 1:return this.getUint8(e,a);case 2:return this.getUint16(e,a);case 4:return this.getUint32(e,a);case 8:return this.getUint64&&this.getUint64(e,a)}}getUint(e,t,a){switch(t){case 8:return this.getUint8(e,a);case 16:return this.getUint16(e,a);case 32:return this.getUint32(e,a);case 64:return this.getUint64&&this.getUint64(e,a)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}}function _r(i,e){fe(`${i} '${e}' was not loaded, try using full build of exifr.`)}class gl extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||_r(this.kind,e),t&&(e in t||function(a,n){fe(`Unknown ${a} '${n}'.`)}(this.kind,e),t[e].enabled||_r(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}}var Ii=new gl("file parser"),Ce=new gl("segment parser"),Ui=new gl("file reader");function lw(i,e){return typeof i=="string"?Au(i,e):Wa&&!nw&&i instanceof HTMLImageElement?Au(i.src,e):i instanceof Uint8Array||i instanceof ArrayBuffer||i instanceof DataView?new Ue(i):Wa&&i instanceof Blob?kr(i,e,"blob",Dr):void fe("Invalid input argument")}function Au(i,e){return(t=i).startsWith("data:")||t.length>1e4?Tr(i,e,"base64"):ss&&i.includes("://")?kr(i,e,"url",Er):ss?Tr(i,e,"fs"):Wa?kr(i,e,"url",Er):void fe("Invalid input argument");var t}async function kr(i,e,t,a){return Ui.has(t)?Tr(i,e,t):a?async function(n,s){let o=await s(n);return new Ue(o)}(i,a):void fe(`Parser ${t} is not loaded`)}async function Tr(i,e,t){let a=new(Ui.get(t))(i,e);return await a.read(),a}const Er=i=>ml(i).then(e=>e.arrayBuffer()),Dr=i=>new Promise((e,t)=>{let a=new FileReader;a.onloadend=()=>e(a.result||new ArrayBuffer),a.onerror=t,a.readAsArrayBuffer(i)});class cw extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}}function Se(i,e,t){let a=new cw;for(let[n,s]of t)a.set(n,s);if(Array.isArray(e))for(let n of e)i.set(n,a);else i.set(e,a);return a}function Ir(i,e,t){let a,n=i.get(e);for(a of t)n.set(a[0],a[1])}const Me=new Map,di=new Map,$n=new Map,Pn=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],_h=["jfif","xmp","icc","iptc","ihdr"],Ar=["tiff",..._h],ve=["ifd0","ifd1","exif","gps","interop"],Cn=[...Ar,...ve],Fn=["makerNote","userComment"],kh=["translateKeys","translateValues","reviveValues","multiSegment"],_n=[...kh,"sanitize","mergeOutput","silentErrors"];class Th{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}}class ra extends Th{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,a,n){if(super(),q(this,"enabled",!1),q(this,"skip",new Set),q(this,"pick",new Set),q(this,"deps",new Set),q(this,"translateKeys",!1),q(this,"translateValues",!1),q(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(n),this.canBeFiltered=ve.includes(e),this.canBeFiltered&&(this.dict=Me.get(e)),a!==void 0)if(Array.isArray(a))this.parse=this.enabled=!0,this.canBeFiltered&&a.length>0&&this.translateTagSet(a,this.pick);else if(typeof a=="object"){if(this.enabled=!0,this.parse=a.parse!==!1,this.canBeFiltered){let{pick:s,skip:o}=a;s&&s.length>0&&this.translateTagSet(s,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(a)}else a===!0||a===!1?this.parse=this.enabled=a:fe(`Invalid options argument: ${a}`)}applyInheritables(e){let t,a;for(t of kh)a=e[t],a!==void 0&&(this[t]=a)}translateTagSet(e,t){if(this.dict){let a,n,{tagKeys:s,tagValues:o}=this.dict;for(a of e)typeof a=="string"?(n=o.indexOf(a),n===-1&&(n=s.indexOf(Number(a))),n!==-1&&t.add(Number(s[n]))):t.add(a)}else for(let a of e)t.add(a)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,ls(this.pick,this.deps)):this.enabled&&this.pick.size>0&&ls(this.pick,this.deps)}}var Te={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},Ou=new Map;class vl extends Th{static useCached(e){let t=Ou.get(e);return t!==void 0||(t=new this(e),Ou.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):fe(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=Wa?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of Pn)this[e]=Te[e];for(e of _n)this[e]=Te[e];for(e of Fn)this[e]=Te[e];for(e of Cn)this[e]=new ra(e,Te[e],void 0,this)}setupFromTrue(){let e;for(e of Pn)this[e]=Te[e];for(e of _n)this[e]=Te[e];for(e of Fn)this[e]=!0;for(e of Cn)this[e]=new ra(e,!0,void 0,this)}setupFromArray(e){let t;for(t of Pn)this[t]=Te[t];for(t of _n)this[t]=Te[t];for(t of Fn)this[t]=Te[t];for(t of Cn)this[t]=new ra(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,ve)}setupFromObject(e){let t;for(t of(ve.ifd0=ve.ifd0||ve.image,ve.ifd1=ve.ifd1||ve.thumbnail,Object.assign(this,e),Pn))this[t]=Fo(e[t],Te[t]);for(t of _n)this[t]=Fo(e[t],Te[t]);for(t of Fn)this[t]=Fo(e[t],Te[t]);for(t of Ar)this[t]=new ra(t,Te[t],e[t],this);for(t of ve)this[t]=new ra(t,Te[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,ve,Cn),e.tiff===!0?this.batchEnableWithBool(ve,!0):e.tiff===!1?this.batchEnableWithUserValue(ve,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,ve):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,ve)}batchEnableWithBool(e,t){for(let a of e)this[a].enabled=t}batchEnableWithUserValue(e,t){for(let a of e){let n=t[a];this[a].enabled=n!==!1&&n!==void 0}}setupGlobalFilters(e,t,a,n=a){if(e&&e.length){for(let o of n)this[o].enabled=!1;let s=Ru(e,a);for(let[o,r]of s)ls(this[o].pick,r),this[o].enabled=!0}else if(t&&t.length){let s=Ru(t,a);for(let[o,r]of s)ls(this[o].skip,r)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:a,iptc:n,icc:s}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),a.enabled||e.skip.add(700),n.enabled||e.skip.add(33723),s.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:a,interop:n}=this;n.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),a.needed&&e.deps.add(34853),this.tiff.enabled=ve.some(s=>this[s].enabled===!0)||this.makerNote||this.userComment;for(let s of ve)this[s].finalizeFilters()}get onlyTiff(){return!_h.map(e=>this[e].enabled).some(e=>e===!0)&&this.tiff.enabled}checkLoadedPlugins(){for(let e of Ar)this[e].enabled&&!Ce.has(e)&&_r("segment parser",e)}}function Ru(i,e){let t,a,n,s,o=[];for(n of e){for(s of(t=Me.get(n),a=[],t))(i.includes(s[0])||i.includes(s[1]))&&a.push(s[0]);a.length&&o.push([n,a])}return o}function Fo(i,e){return i!==void 0?i:e!==void 0?e:void 0}function ls(i,e){for(let t of e)i.add(t)}q(vl,"default",Te);class uw{constructor(e){q(this,"parsers",{}),q(this,"output",{}),q(this,"errors",[]),q(this,"pushToErrors",t=>this.errors.push(t)),this.options=vl.useCached(e)}async read(e){this.file=await lw(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[a,n]of Ii)if(n.canHandle(e,t))return this.fileParser=new n(this.options,this.file,this.parsers),e[a]=!0;this.file.close&&this.file.close(),fe("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),rs(e)}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map(async a=>{let n=await a.parse();a.assignToOutput(e,n)});this.options.silentErrors&&(t=t.map(a=>a.catch(this.pushToErrors))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,a=Ce.get("tiff",e);var n;if(t.tiff?n={start:0,type:"tiff"}:t.jpeg&&(n=await this.fileParser.getOrFindSegment("tiff")),n===void 0)return;let s=await this.fileParser.ensureSegmentChunk(n),o=this.parsers.tiff=new a(s,e,t),r=await o.extractThumbnail();return t.close&&t.close(),r}}class vs{constructor(e,t,a){q(this,"errors",[]),q(this,"ensureSegmentChunk",async n=>{let s=n.start,o=n.size||65536;if(this.file.chunked)if(this.file.available(s,o))n.chunk=this.file.subarray(s,o);else try{n.chunk=await this.file.readChunk(s,o)}catch(r){fe(`Couldn't read segment: ${JSON.stringify(n)}. ${r.message}`)}else this.file.byteLength>s+o?n.chunk=this.file.subarray(s,o):n.size===void 0?n.chunk=this.file.subarray(s):fe("Segment unreachable: "+JSON.stringify(n));return n.chunk}),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=a}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let a=new(Ce.get(e))(t,this.options,this.file);return this.parsers[e]=a}createParsers(e){for(let t of e){let{type:a,chunk:n}=t,s=this.options[a];if(s&&s.enabled){let o=this.parsers[a];o&&o.append||o||this.createParser(a,n)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}class ot{static findPosition(e,t){let a=e.getUint16(t+2)+2,n=typeof this.headerLength=="function"?this.headerLength(e,t,a):this.headerLength,s=t+n,o=a-n;return{offset:t,length:a,headerLength:n,start:s,size:o,end:s+o}}static parse(e,t={}){return new this(e,new vl({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof Ue?e:new Ue(e)}constructor(e,t={},a){q(this,"errors",[]),q(this,"raw",new Map),q(this,"handleError",n=>{if(!this.options.silentErrors)throw n;this.errors.push(n.message)}),this.chunk=this.normalizeInput(e),this.file=a,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 a=$n.get(t),n=di.get(t),s=Me.get(t),o=this.options[t],r=o.reviveValues&&!!a,l=o.translateValues&&!!n,c=o.translateKeys&&!!s,p={};for(let[u,f]of e)r&&a.has(u)?f=a.get(u)(f):l&&n.has(u)&&(f=this.translateValue(f,n.get(u))),c&&s.has(u)&&(u=s.get(u)||u),p[u]=f;return p}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,a){if(this.globalOptions.mergeOutput)return Object.assign(e,a);e[t]?Object.assign(e[t],a):e[t]=a}}q(ot,"headerLength",4),q(ot,"type",void 0),q(ot,"multiSegment",!1),q(ot,"canHandle",()=>!1);function pw(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function dw(i){return i>=224&&i<=239}function hw(i,e,t){for(let[a,n]of Ce)if(n.canHandle(i,e,t))return a}class Uu extends vs{constructor(...e){super(...e),q(this,"appSegments",[]),q(this,"jpegSegments",[]),q(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(Ce.keyList())):(e=e===void 0?Ce.keyList().filter(t=>this.options[t].enabled):e.filter(t=>this.options[t].enabled&&Ce.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:a,findAll:n,wanted:s,remaining:o}=this;if(!n&&this.file.chunked&&(n=Array.from(s).some(r=>{let l=Ce.get(r),c=this.options[r];return l.multiSegment&&c.multiSegment}),n&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,a.byteLength),!this.options.onlyTiff&&a.chunked){let r=!1;for(;o.size>0&&!r&&(a.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=a,c=this.appSegments.some(p=>!this.file.available(p.offset||p.start,p.length||p.size));if(r=e>l&&!c?!await a.readNextChunk(e):!await a.readNextChunk(l),(e=this.findAppSegmentsInRange(e,a.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let a,n,s,o,r,l,{file:c,findAll:p,wanted:u,remaining:f,options:x}=this;for(;e<t;e++)if(c.getUint8(e)===255){if(a=c.getUint8(e+1),dw(a)){if(n=c.getUint16(e+2),s=hw(c,e,n),s&&u.has(s)&&(o=Ce.get(s),r=o.findPosition(c,e),l=x[s],r.type=s,this.appSegments.push(r),!p&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=r.chunkNumber<r.chunkCount,this.unfinishedMultiSegment||f.delete(s)):f.delete(s),f.size===0)))break;x.recordUnknownSegments&&(r=ot.findPosition(c,e),r.marker=a,this.unknownSegments.push(r)),e+=n+1}else if(pw(a)){if(n=c.getUint16(e+2),a===218&&x.stopAfterSos!==!1)return;x.recordJpegSegments&&this.jpegSegments.push({offset:e,length:n,marker:a}),e+=n+1}}return e}mergeMultiSegments(){if(!this.appSegments.some(t=>t.multiSegment))return;let e=function(t,a){let n,s,o,r=new Map;for(let l=0;l<t.length;l++)n=t[l],s=n[a],r.has(s)?o=r.get(s):r.set(s,o=[]),o.push(n);return Array.from(r)}(this.appSegments,"type");this.mergedAppSegments=e.map(([t,a])=>{let n=Ce.get(t,this.options);return n.handleMultiSegments?{type:t,chunk:n.handleMultiSegments(a)}:a[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}}q(Uu,"type","jpeg"),Ii.set("jpeg",Uu);const fw=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4];class mw extends ot{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,a=new Map){let{pick:n,skip:s}=this.options[t];n=new Set(n);let o=n.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(n.has(p)&&(a.set(p,this.parseTag(e,p,t)),n.delete(p),n.size===0))break}else!r&&s.has(p)||a.set(p,this.parseTag(e,p,t));e+=12}return a}parseTag(e,t,a){let{chunk:n}=this,s=n.getUint16(e+2),o=n.getUint32(e+4),r=fw[s];if(r*o<=4?e+=8:e=n.getUint32(e+8),(s<1||s>13)&&fe(`Invalid TIFF value type. block: ${a.toUpperCase()}, tag: ${t.toString(16)}, type: ${s}, offset ${e}`),e>n.byteLength&&fe(`Invalid TIFF value offset. block: ${a.toUpperCase()}, tag: ${t.toString(16)}, type: ${s}, offset ${e} is outside of chunk size ${n.byteLength}`),s===1)return n.getUint8Array(e,o);if(s===2)return oi(n.getString(e,o));if(s===7)return n.getUint8Array(e,o);if(o===1)return this.parseTagValue(s,e);{let l=new(function(p){switch(p){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),c=r;for(let p=0;p<o;p++)l[p]=this.parseTagValue(s,e),e+=c;return l}}parseTagValue(e,t){let{chunk:a}=this;switch(e){case 1:return a.getUint8(t);case 3:return a.getUint16(t);case 4:return a.getUint32(t);case 5:return a.getUint32(t)/a.getUint32(t+4);case 6:return a.getInt8(t);case 8:return a.getInt16(t);case 9:return a.getInt32(t);case 10:return a.getInt32(t)/a.getInt32(t+4);case 11:return a.getFloat(t);case 12:return a.getDouble(t);case 13:return a.getUint32(t);default:fe(`Invalid tiff type ${e}`)}}}class _o extends mw{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 a=new Map;return this[t]=a,this.parseTags(e,t,a),a}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&fe("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&fe(`IFD0 offset points to outside of file.
|
|
75
|
+
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,Cr(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,Cr(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 a=e.get(t);a&&a.length===1&&e.set(t,a[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",Mu(...e.get(2),e.get(1))),e.set("longitude",Mu(...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,a,n={};for(t of ve)if(e=this[t],!Ch(e))if(a=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(n,a)}else n[t]=a;return this.makerNote&&(n.makerNote=this.makerNote),this.userComment&&(n.userComment=this.userComment),n}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[a,n]of Object.entries(t))this.assignObjectToOutput(e,a,n)}}function Mu(i,e,t,a){var n=i+e/60+t/3600;return a!=="S"&&a!=="W"||(n*=-1),n}q(_o,"type","tiff"),q(_o,"headerLength",10),Ce.set("tiff",_o);const bl={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1};Object.assign({},bl,{firstChunkSize:4e4,gps:[1,2,3,4]});Object.assign({},bl,{tiff:!1,ifd1:!0,mergeOutput:!1});const gw=Object.assign({},bl,{firstChunkSize:4e4,ifd0:[274]});async function vw(i){let e=new uw(gw);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}const bw=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 fa=!0,ma=!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,a]=e;fa=Number(t)+.1*Number(a)<13.4,ma=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);fa=ma=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);fa=ma=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);fa=ma=Number(e)<77}}async function yw(i){let e=await vw(i);return Object.assign({canvas:fa,css:ma},bw[e])}class xw extends Ue{constructor(...e){super(...e),q(this,"ranges",new ww),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,a){if(e===0&&this.byteLength===0&&a){let n=new DataView(a.buffer||a,a.byteOffset,a.byteLength);this._swapDataView(n)}else{let n=e+t;if(n>this.byteLength){let{dataView:s}=this._extend(n);this._swapDataView(s)}}}_extend(e){let t;t=fl?hl.allocUnsafe(e):new Uint8Array(e);let a=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:a}}subarray(e,t,a=!1){return t=t||this._lengthToEnd(e),a&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,a=!1){a&&this._tryExtend(t,e.byteLength,e);let n=super.set(e,t);return this.ranges.add(t,n.byteLength),n}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 ww{constructor(){q(this,"list",[])}get length(){return this.list.length}add(e,t,a=0){let n=e+t,s=this.list.filter(o=>Lu(e,o.offset,n)||Lu(e,o.end,n));if(s.length>0){e=Math.min(e,...s.map(r=>r.offset)),n=Math.max(n,...s.map(r=>r.end)),t=n-e;let o=s.shift();o.offset=e,o.length=t,o.end=n,this.list=this.list.filter(r=>!s.includes(r))}else this.list.push({offset:e,length:t,end:n})}available(e,t){let a=e+t;return this.list.some(n=>n.offset<=e&&a<=n.end)}}function Lu(i,e,t){return i<=e&&e<=t}class bs extends xw{constructor(e,t){super(0),q(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,a=await this.readChunk(e,t);return!!a&&a.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(){}}Ui.set("blob",class extends bs{async readWhole(){this.chunked=!1;let i=await Dr(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,a=this.input.slice(i,t),n=await Dr(a);return this.set(n,i,!0)}});Ui.set("url",class extends bs{async readWhole(){this.chunked=!1;let i=await Er(this.input);i instanceof ArrayBuffer?this._swapArrayBuffer(i):i instanceof Uint8Array&&this._swapBuffer(i)}async _readChunk(i,e){let t=e?i+e-1:void 0,a=this.options.httpHeaders||{};(i||t)&&(a.range=`bytes=${[i,t].join("-")}`);let n=await ml(this.input,{headers:a}),s=await n.arrayBuffer(),o=s.byteLength;if(n.status!==416)return o!==e&&(this.size=i+o),this.set(s,i,!0)}});Ue.prototype.getUint64=function(i){let e=this.getUint32(i),t=this.getUint32(i+4);return e<1048575?e<<32|t:typeof Sn!==void 0?(console.warn("Using BigInt because of type 64uint but JS can only handle 53b numbers."),Sn(e)<<Sn(32)|Sn(t)):void fe("Trying to read 64b value but JS can only handle 53b numbers.")};class Sw extends vs{parseBoxes(e=0){let t=[];for(;e<this.file.byteLength-4;){let a=this.parseBoxHead(e);if(t.push(a),a.length===0)break;e+=a.length}return t}parseSubBoxes(e){e.boxes=this.parseBoxes(e.start)}findBox(e,t){return e.boxes===void 0&&this.parseSubBoxes(e),e.boxes.find(a=>a.kind===t)}parseBoxHead(e){let t=this.file.getUint32(e),a=this.file.getString(e+4,4),n=e+8;return t===1&&(t=this.file.getUint64(e+8),n+=8),{offset:e,length:t,kind:a,start:n}}parseBoxFullHead(e){if(e.version!==void 0)return;let t=this.file.getUint32(e.start);e.version=t>>24,e.start+=4}}class Eh extends Sw{static canHandle(e,t){if(t!==0)return!1;let a=e.getUint16(2);if(a>50)return!1;let n=16,s=[];for(;n<a;)s.push(e.getString(n,4)),n+=4;return s.includes(this.type)}async parse(){let e=this.file.getUint32(0),t=this.parseBoxHead(e);for(;t.kind!=="meta";)e+=t.length,await this.file.ensureChunk(e,16),t=this.parseBoxHead(e);await this.file.ensureChunk(t.offset,t.length),this.parseBoxFullHead(t),this.parseSubBoxes(t),this.options.icc.enabled&&await this.findIcc(t),this.options.tiff.enabled&&await this.findExif(t)}async registerSegment(e,t,a){await this.file.ensureChunk(t,a);let n=this.file.subarray(t,a);this.createParser(e,n)}async findIcc(e){let t=this.findBox(e,"iprp");if(t===void 0)return;let a=this.findBox(t,"ipco");if(a===void 0)return;let n=this.findBox(a,"colr");n!==void 0&&await this.registerSegment("icc",n.offset+12,n.length)}async findExif(e){let t=this.findBox(e,"iinf");if(t===void 0)return;let a=this.findBox(e,"iloc");if(a===void 0)return;let n=this.findExifLocIdInIinf(t),s=this.findExtentInIloc(a,n);if(s===void 0)return;let[o,r]=s;await this.file.ensureChunk(o,r);let l=4+this.file.getUint32(o);o+=l,r-=l,await this.registerSegment("tiff",o,r)}findExifLocIdInIinf(e){this.parseBoxFullHead(e);let t,a,n,s,o=e.start,r=this.file.getUint16(o);for(o+=2;r--;){if(t=this.parseBoxHead(o),this.parseBoxFullHead(t),a=t.start,t.version>=2&&(n=t.version===3?4:2,s=this.file.getString(a+n+2,4),s==="Exif"))return this.file.getUintBytes(a,n);o+=t.length}}get8bits(e){let t=this.file.getUint8(e);return[t>>4,15&t]}findExtentInIloc(e,t){this.parseBoxFullHead(e);let a=e.start,[n,s]=this.get8bits(a++),[o,r]=this.get8bits(a++),l=e.version===2?4:2,c=e.version===1||e.version===2?2:0,p=r+n+s,u=e.version===2?4:2,f=this.file.getUintBytes(a,u);for(a+=u;f--;){let x=this.file.getUintBytes(a,l);a+=l+c+2+o;let S=this.file.getUint16(a);if(a+=2,x===t)return S>1&&console.warn(`ILOC box has more than one extent but we're only processing one
|
|
76
|
+
Please create an issue at https://github.com/MikeKovarik/exifr with this file`),[this.file.getUintBytes(a+r,n),this.file.getUintBytes(a+r+n,s)];a+=S*p}}}class Dh extends Eh{}q(Dh,"type","heic");class Nu extends Eh{}q(Nu,"type","avif"),Ii.set("heic",Dh),Ii.set("avif",Nu),Se(Me,["ifd0","ifd1"],[[256,"ImageWidth"],[257,"ImageHeight"],[258,"BitsPerSample"],[259,"Compression"],[262,"PhotometricInterpretation"],[270,"ImageDescription"],[271,"Make"],[272,"Model"],[273,"StripOffsets"],[274,"Orientation"],[277,"SamplesPerPixel"],[278,"RowsPerStrip"],[279,"StripByteCounts"],[282,"XResolution"],[283,"YResolution"],[284,"PlanarConfiguration"],[296,"ResolutionUnit"],[301,"TransferFunction"],[305,"Software"],[306,"ModifyDate"],[315,"Artist"],[316,"HostComputer"],[317,"Predictor"],[318,"WhitePoint"],[319,"PrimaryChromaticities"],[513,"ThumbnailOffset"],[514,"ThumbnailLength"],[529,"YCbCrCoefficients"],[530,"YCbCrSubSampling"],[531,"YCbCrPositioning"],[532,"ReferenceBlackWhite"],[700,"ApplicationNotes"],[33432,"Copyright"],[33723,"IPTC"],[34665,"ExifIFD"],[34675,"ICC"],[34853,"GpsIFD"],[330,"SubIFD"],[40965,"InteropIFD"],[40091,"XPTitle"],[40092,"XPComment"],[40093,"XPAuthor"],[40094,"XPKeywords"],[40095,"XPSubject"]]),Se(Me,"exif",[[33434,"ExposureTime"],[33437,"FNumber"],[34850,"ExposureProgram"],[34852,"SpectralSensitivity"],[34855,"ISO"],[34858,"TimeZoneOffset"],[34859,"SelfTimerMode"],[34864,"SensitivityType"],[34865,"StandardOutputSensitivity"],[34866,"RecommendedExposureIndex"],[34867,"ISOSpeed"],[34868,"ISOSpeedLatitudeyyy"],[34869,"ISOSpeedLatitudezzz"],[36864,"ExifVersion"],[36867,"DateTimeOriginal"],[36868,"CreateDate"],[36873,"GooglePlusUploadCode"],[36880,"OffsetTime"],[36881,"OffsetTimeOriginal"],[36882,"OffsetTimeDigitized"],[37121,"ComponentsConfiguration"],[37122,"CompressedBitsPerPixel"],[37377,"ShutterSpeedValue"],[37378,"ApertureValue"],[37379,"BrightnessValue"],[37380,"ExposureCompensation"],[37381,"MaxApertureValue"],[37382,"SubjectDistance"],[37383,"MeteringMode"],[37384,"LightSource"],[37385,"Flash"],[37386,"FocalLength"],[37393,"ImageNumber"],[37394,"SecurityClassification"],[37395,"ImageHistory"],[37396,"SubjectArea"],[37500,"MakerNote"],[37510,"UserComment"],[37520,"SubSecTime"],[37521,"SubSecTimeOriginal"],[37522,"SubSecTimeDigitized"],[37888,"AmbientTemperature"],[37889,"Humidity"],[37890,"Pressure"],[37891,"WaterDepth"],[37892,"Acceleration"],[37893,"CameraElevationAngle"],[40960,"FlashpixVersion"],[40961,"ColorSpace"],[40962,"ExifImageWidth"],[40963,"ExifImageHeight"],[40964,"RelatedSoundFile"],[41483,"FlashEnergy"],[41486,"FocalPlaneXResolution"],[41487,"FocalPlaneYResolution"],[41488,"FocalPlaneResolutionUnit"],[41492,"SubjectLocation"],[41493,"ExposureIndex"],[41495,"SensingMethod"],[41728,"FileSource"],[41729,"SceneType"],[41730,"CFAPattern"],[41985,"CustomRendered"],[41986,"ExposureMode"],[41987,"WhiteBalance"],[41988,"DigitalZoomRatio"],[41989,"FocalLengthIn35mmFormat"],[41990,"SceneCaptureType"],[41991,"GainControl"],[41992,"Contrast"],[41993,"Saturation"],[41994,"Sharpness"],[41996,"SubjectDistanceRange"],[42016,"ImageUniqueID"],[42032,"OwnerName"],[42033,"SerialNumber"],[42034,"LensInfo"],[42035,"LensMake"],[42036,"LensModel"],[42037,"LensSerialNumber"],[42080,"CompositeImage"],[42081,"CompositeImageCount"],[42082,"CompositeImageExposureTimes"],[42240,"Gamma"],[59932,"Padding"],[59933,"OffsetSchema"],[65e3,"OwnerName"],[65001,"SerialNumber"],[65002,"Lens"],[65100,"RawFile"],[65101,"Converter"],[65102,"WhiteBalance"],[65105,"Exposure"],[65106,"Shadows"],[65107,"Brightness"],[65108,"Contrast"],[65109,"Saturation"],[65110,"Sharpness"],[65111,"Smoothness"],[65112,"MoireFilter"],[40965,"InteropIFD"]]),Se(Me,"gps",[[0,"GPSVersionID"],[1,"GPSLatitudeRef"],[2,"GPSLatitude"],[3,"GPSLongitudeRef"],[4,"GPSLongitude"],[5,"GPSAltitudeRef"],[6,"GPSAltitude"],[7,"GPSTimeStamp"],[8,"GPSSatellites"],[9,"GPSStatus"],[10,"GPSMeasureMode"],[11,"GPSDOP"],[12,"GPSSpeedRef"],[13,"GPSSpeed"],[14,"GPSTrackRef"],[15,"GPSTrack"],[16,"GPSImgDirectionRef"],[17,"GPSImgDirection"],[18,"GPSMapDatum"],[19,"GPSDestLatitudeRef"],[20,"GPSDestLatitude"],[21,"GPSDestLongitudeRef"],[22,"GPSDestLongitude"],[23,"GPSDestBearingRef"],[24,"GPSDestBearing"],[25,"GPSDestDistanceRef"],[26,"GPSDestDistance"],[27,"GPSProcessingMethod"],[28,"GPSAreaInformation"],[29,"GPSDateStamp"],[30,"GPSDifferential"],[31,"GPSHPositioningError"]]),Se(di,["ifd0","ifd1"],[[274,{1:"Horizontal (normal)",2:"Mirror horizontal",3:"Rotate 180",4:"Mirror vertical",5:"Mirror horizontal and rotate 270 CW",6:"Rotate 90 CW",7:"Mirror horizontal and rotate 90 CW",8:"Rotate 270 CW"}],[296,{1:"None",2:"inches",3:"cm"}]]);let Ea=Se(di,"exif",[[34850,{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"}],[37121,{0:"-",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}],[37383,{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"}],[37384,{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"}],[37385,{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"}],[41495,{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"}],[41728,{1:"Film Scanner",2:"Reflection Print Scanner",3:"Digital Camera"}],[41729,{1:"Directly photographed"}],[41985,{0:"Normal",1:"Custom",2:"HDR (no original saved)",3:"HDR (original saved)",4:"Original (for HDR)",6:"Panorama",7:"Portrait HDR",8:"Portrait"}],[41986,{0:"Auto",1:"Manual",2:"Auto bracket"}],[41987,{0:"Auto",1:"Manual"}],[41990,{0:"Standard",1:"Landscape",2:"Portrait",3:"Night",4:"Other"}],[41991,{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"}],[41996,{0:"Unknown",1:"Macro",2:"Close",3:"Distant"}],[42080,{0:"Unknown",1:"Not a Composite Image",2:"General Composite Image",3:"Composite Image Captured While Shooting"}]]);const Bu={1:"No absolute unit of measurement",2:"Inch",3:"Centimeter"};Ea.set(37392,Bu),Ea.set(41488,Bu);const ko={0:"Normal",1:"Low",2:"High"};function ju(i){return typeof i=="object"&&i.length!==void 0?i[0]:i}function zu(i){let e=Array.from(i).slice(1);return e[1]>15&&(e=e.map(t=>String.fromCharCode(t))),e[2]!=="0"&&e[2]!==0||e.pop(),e.join(".")}function To(i){if(typeof i=="string"){var[e,t,a,n,s,o]=i.trim().split(/[-: ]/g).map(Number),r=new Date(e,t-1,a);return Number.isNaN(n)||Number.isNaN(s)||Number.isNaN(o)||(r.setHours(n),r.setMinutes(s),r.setSeconds(o)),Number.isNaN(+r)?i:r}}function la(i){if(typeof i=="string")return i;let e=[];if(i[1]===0&&i[i.length-1]===0)for(let t=0;t<i.length;t+=2)e.push($u(i[t+1],i[t]));else for(let t=0;t<i.length;t+=2)e.push($u(i[t],i[t+1]));return oi(String.fromCodePoint(...e))}function $u(i,e){return i<<8|e}Ea.set(41992,ko),Ea.set(41993,ko),Ea.set(41994,ko),Se($n,["ifd0","ifd1"],[[50827,function(i){return typeof i!="string"?Fh(i):i}],[306,To],[40091,la],[40092,la],[40093,la],[40094,la],[40095,la]]),Se($n,"exif",[[40960,zu],[36864,zu],[36867,To],[36868,To],[40962,ju],[40963,ju]]),Se($n,"gps",[[0,i=>Array.from(i).join(".")],[7,i=>Array.from(i).join(":")]]);class Eo extends ot{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1752462448&&e.getString(t+4,20)==="http://ns.adobe.com/"}static headerLength(e,t){return e.getString(t+4,34)==="http://ns.adobe.com/xmp/extension/"?79:33}static findPosition(e,t){let a=super.findPosition(e,t);return a.multiSegment=a.extended=a.headerLength===79,a.multiSegment?(a.chunkCount=e.getUint8(t+72),a.chunkNumber=e.getUint8(t+76),e.getUint8(t+77)!==0&&a.chunkNumber++):(a.chunkCount=1/0,a.chunkNumber=-1),a}static handleMultiSegments(e){return e.map(t=>t.chunk.getString()).join("")}normalizeInput(e){return typeof e=="string"?e:Ue.from(e).getString()}parse(e=this.chunk){if(!this.localOptions.parse)return e;e=function(s){let o={},r={};for(let l of Rh)o[l]=[],r[l]=0;return s.replace(_w,(l,c,p)=>{if(c==="<"){let u=++r[p];return o[p].push(u),`${l}#${u}`}return`${l}#${o[p].pop()}`})}(e);let t=Ti.findAll(e,"rdf","Description");t.length===0&&t.push(new Ti("rdf","Description",void 0,e));let a,n={};for(let s of t)for(let o of s.properties)a=Fw(o.ns,n),Ih(o,a);return function(s){let o;for(let r in s)o=s[r]=rs(s[r]),o===void 0&&delete s[r];return rs(s)}(n)}assignToOutput(e,t){if(this.localOptions.parse)for(let[a,n]of Object.entries(t))switch(a){case"tiff":this.assignObjectToOutput(e,"ifd0",n);break;case"exif":this.assignObjectToOutput(e,"exif",n);break;case"xmlns":break;default:this.assignObjectToOutput(e,a,n)}else e.xmp=t}}q(Eo,"type","xmp"),q(Eo,"multiSegment",!0),Ce.set("xmp",Eo);class cs{static findAll(e){return Ah(e,/([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(cs.unpackMatch)}static unpackMatch(e){let t=e[1],a=e[2],n=e[3].slice(1,-1);return n=Oh(n),new cs(t,a,n)}constructor(e,t,a){this.ns=e,this.name=t,this.value=a}serialize(){return this.value}}class Ti{static findAll(e,t,a){if(t!==void 0||a!==void 0){t=t||"[\\w\\d-]+",a=a||"[\\w\\d-]+";var n=new RegExp(`<(${t}):(${a})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`,"gm")}else n=/<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;return Ah(e,n).map(Ti.unpackMatch)}static unpackMatch(e){let t=e[1],a=e[2],n=e[4],s=e[8];return new Ti(t,a,n,s)}constructor(e,t,a,n){this.ns=e,this.name=t,this.attrString=a,this.innerXml=n,this.attrs=cs.findAll(a),this.children=Ti.findAll(n),this.value=this.children.length===0?Oh(n):void 0,this.properties=[...this.attrs,...this.children]}get isPrimitive(){return this.value!==void 0&&this.attrs.length===0&&this.children.length===0}get isListContainer(){return this.children.length===1&&this.children[0].isList}get isList(){let{ns:e,name:t}=this;return e==="rdf"&&(t==="Seq"||t==="Bag"||t==="Alt")}get isListItem(){return this.ns==="rdf"&&this.name==="li"}serialize(){if(this.properties.length===0&&this.value===void 0)return;if(this.isPrimitive)return this.value;if(this.isListContainer)return this.children[0].serialize();if(this.isList)return Cw(this.children.map(Pw));if(this.isListItem&&this.children.length===1&&this.attrs.length===0)return this.children[0].serialize();let e={};for(let t of this.properties)Ih(t,e);return this.value!==void 0&&(e.value=this.value),rs(e)}}function Ih(i,e){let t=i.serialize();t!==void 0&&(e[i.name]=t)}var Pw=i=>i.serialize(),Cw=i=>i.length===1?i[0]:i,Fw=(i,e)=>e[i]?e[i]:e[i]={};function Ah(i,e){let t,a=[];if(!i)return a;for(;(t=e.exec(i))!==null;)a.push(t);return a}function Oh(i){if(function(a){return a==null||a==="null"||a==="undefined"||a===""||a.trim()===""}(i))return;let e=Number(i);if(!Number.isNaN(e))return e;let t=i.toLowerCase();return t==="true"||t!=="false"&&i.trim()}const Rh=["rdf:li","rdf:Seq","rdf:Bag","rdf:Alt","rdf:Description"],_w=new RegExp(`(<|\\/)(${Rh.join("|")})`,"g");let Hu=os("fs",i=>i.promises);Ui.set("fs",class extends bs{async readWhole(){this.chunked=!1,this.fs=await Hu;let i=await this.fs.readFile(this.input);this._swapBuffer(i)}async readChunked(){this.chunked=!0,this.fs=await Hu,await this.open(),await this.readChunk(0,this.options.firstChunkSize)}async open(){this.fh===void 0&&(this.fh=await this.fs.open(this.input,"r"),this.size=(await this.fh.stat(this.input)).size)}async _readChunk(i,e){this.fh===void 0&&await this.open(),i+e>this.size&&(e=this.size-i);var t=this.subarray(i,e,!0);return await this.fh.read(t.dataView,0,e,i),t}async close(){if(this.fh){let i=this.fh;this.fh=void 0,await i.close()}}});Ui.set("base64",class extends bs{constructor(...i){super(...i),this.input=this.input.replace(/^data:([^;]+);base64,/gim,""),this.size=this.input.length/4*3,this.input.endsWith("==")?this.size-=2:this.input.endsWith("=")&&(this.size-=1)}async _readChunk(i,e){let t,a,n=this.input;i===void 0?(i=0,t=0,a=0):(t=4*Math.floor(i/3),a=i-t/4*3),e===void 0&&(e=this.size);let s=i+e,o=t+4*Math.ceil(s/3);n=n.slice(t,o);let r=Math.min(e,this.size-i);if(fl){let l=hl.from(n,"base64").slice(a,a+r);return this.set(l,i,!0)}{let l=this.subarray(i,r,!0),c=atob(n),p=l.toUint8();for(let u=0;u<r;u++)p[u]=c.charCodeAt(a+u);return l}}});class qu extends vs{static canHandle(e,t){return t===18761||t===19789}extendOptions(e){let{ifd0:t,xmp:a,iptc:n,icc:s}=e;a.enabled&&t.deps.add(700),n.enabled&&t.deps.add(33723),s.enabled&&t.deps.add(34675),t.finalizeFilters()}async parse(){let{tiff:e,xmp:t,iptc:a,icc:n}=this.options;if(e.enabled||t.enabled||a.enabled||n.enabled){let s=Math.max(Cr(this.options),this.options.chunkSize);await this.file.ensureChunk(0,s),this.createParser("tiff",this.file),this.parsers.tiff.parseHeader(),await this.parsers.tiff.parseIfd0Block(),this.adaptTiffPropAsSegment("xmp"),this.adaptTiffPropAsSegment("iptc"),this.adaptTiffPropAsSegment("icc")}}adaptTiffPropAsSegment(e){if(this.parsers.tiff[e]){let t=this.parsers.tiff[e];this.injectSegment(e,t)}}}q(qu,"type","tiff"),Ii.set("tiff",qu);let kw=os("zlib");const Tw=["ihdr","iccp","text","itxt","exif"];class Vu extends vs{constructor(...e){super(...e),q(this,"catchError",t=>this.errors.push(t)),q(this,"metaChunks",[]),q(this,"unknownChunks",[])}static canHandle(e,t){return t===35152&&e.getUint32(0)===2303741511&&e.getUint32(4)===218765834}async parse(){let{file:e}=this;await this.findPngChunksInRange(8,e.byteLength),await this.readSegments(this.metaChunks),this.findIhdr(),this.parseTextChunks(),await this.findExif().catch(this.catchError),await this.findXmp().catch(this.catchError),await this.findIcc().catch(this.catchError)}async findPngChunksInRange(e,t){let{file:a}=this;for(;e<t;){let n=a.getUint32(e),s=a.getUint32(e+4),o=a.getString(e+4,4).toLowerCase(),r=n+4+4+4,l={type:o,offset:e,length:r,start:e+4+4,size:n,marker:s};Tw.includes(o)?this.metaChunks.push(l):this.unknownChunks.push(l),e+=r}}parseTextChunks(){let e=this.metaChunks.filter(t=>t.type==="text");for(let t of e){let[a,n]=this.file.getString(t.start,t.size).split("\0");this.injectKeyValToIhdr(a,n)}}injectKeyValToIhdr(e,t){let a=this.parsers.ihdr;a&&a.raw.set(e,t)}findIhdr(){let e=this.metaChunks.find(t=>t.type==="ihdr");e&&this.options.ihdr.enabled!==!1&&this.createParser("ihdr",e.chunk)}async findExif(){let e=this.metaChunks.find(t=>t.type==="exif");e&&this.injectSegment("tiff",e.chunk)}async findXmp(){let e=this.metaChunks.filter(t=>t.type==="itxt");for(let t of e)t.chunk.getString(0,17)==="XML:com.adobe.xmp"&&this.injectSegment("xmp",t.chunk)}async findIcc(){let e=this.metaChunks.find(r=>r.type==="iccp");if(!e)return;let{chunk:t}=e,a=t.getUint8Array(0,81),n=0;for(;n<80&&a[n]!==0;)n++;let s=n+2,o=t.getString(0,n);if(this.injectKeyValToIhdr("ProfileName",o),ss){let r=await kw,l=t.getUint8Array(s);l=r.inflateSync(l),this.injectSegment("icc",l)}}}q(Vu,"type","png"),Ii.set("png",Vu),Se(Me,"interop",[[1,"InteropIndex"],[2,"InteropVersion"],[4096,"RelatedImageFileFormat"],[4097,"RelatedImageWidth"],[4098,"RelatedImageHeight"]]),Ir(Me,"ifd0",[[11,"ProcessingSoftware"],[254,"SubfileType"],[255,"OldSubfileType"],[263,"Thresholding"],[264,"CellWidth"],[265,"CellLength"],[266,"FillOrder"],[269,"DocumentName"],[280,"MinSampleValue"],[281,"MaxSampleValue"],[285,"PageName"],[286,"XPosition"],[287,"YPosition"],[290,"GrayResponseUnit"],[297,"PageNumber"],[321,"HalftoneHints"],[322,"TileWidth"],[323,"TileLength"],[332,"InkSet"],[337,"TargetPrinter"],[18246,"Rating"],[18249,"RatingPercent"],[33550,"PixelScale"],[34264,"ModelTransform"],[34377,"PhotoshopSettings"],[50706,"DNGVersion"],[50707,"DNGBackwardVersion"],[50708,"UniqueCameraModel"],[50709,"LocalizedCameraModel"],[50736,"DNGLensInfo"],[50739,"ShadowScale"],[50740,"DNGPrivateData"],[33920,"IntergraphMatrix"],[33922,"ModelTiePoint"],[34118,"SEMInfo"],[34735,"GeoTiffDirectory"],[34736,"GeoTiffDoubleParams"],[34737,"GeoTiffAsciiParams"],[50341,"PrintIM"],[50721,"ColorMatrix1"],[50722,"ColorMatrix2"],[50723,"CameraCalibration1"],[50724,"CameraCalibration2"],[50725,"ReductionMatrix1"],[50726,"ReductionMatrix2"],[50727,"AnalogBalance"],[50728,"AsShotNeutral"],[50729,"AsShotWhiteXY"],[50730,"BaselineExposure"],[50731,"BaselineNoise"],[50732,"BaselineSharpness"],[50734,"LinearResponseLimit"],[50735,"CameraSerialNumber"],[50741,"MakerNoteSafety"],[50778,"CalibrationIlluminant1"],[50779,"CalibrationIlluminant2"],[50781,"RawDataUniqueID"],[50827,"OriginalRawFileName"],[50828,"OriginalRawFileData"],[50831,"AsShotICCProfile"],[50832,"AsShotPreProfileMatrix"],[50833,"CurrentICCProfile"],[50834,"CurrentPreProfileMatrix"],[50879,"ColorimetricReference"],[50885,"SRawType"],[50898,"PanasonicTitle"],[50899,"PanasonicTitle2"],[50931,"CameraCalibrationSig"],[50932,"ProfileCalibrationSig"],[50933,"ProfileIFD"],[50934,"AsShotProfileName"],[50936,"ProfileName"],[50937,"ProfileHueSatMapDims"],[50938,"ProfileHueSatMapData1"],[50939,"ProfileHueSatMapData2"],[50940,"ProfileToneCurve"],[50941,"ProfileEmbedPolicy"],[50942,"ProfileCopyright"],[50964,"ForwardMatrix1"],[50965,"ForwardMatrix2"],[50966,"PreviewApplicationName"],[50967,"PreviewApplicationVersion"],[50968,"PreviewSettingsName"],[50969,"PreviewSettingsDigest"],[50970,"PreviewColorSpace"],[50971,"PreviewDateTime"],[50972,"RawImageDigest"],[50973,"OriginalRawFileDigest"],[50981,"ProfileLookTableDims"],[50982,"ProfileLookTableData"],[51043,"TimeCodes"],[51044,"FrameRate"],[51058,"TStop"],[51081,"ReelName"],[51089,"OriginalDefaultFinalSize"],[51090,"OriginalBestQualitySize"],[51091,"OriginalDefaultCropSize"],[51105,"CameraLabel"],[51107,"ProfileHueSatMapEncoding"],[51108,"ProfileLookTableEncoding"],[51109,"BaselineExposureOffset"],[51110,"DefaultBlackRender"],[51111,"NewRawImageDigest"],[51112,"RawToPreviewGain"]]);let Wu=[[273,"StripOffsets"],[279,"StripByteCounts"],[288,"FreeOffsets"],[289,"FreeByteCounts"],[291,"GrayResponseCurve"],[292,"T4Options"],[293,"T6Options"],[300,"ColorResponseUnit"],[320,"ColorMap"],[324,"TileOffsets"],[325,"TileByteCounts"],[326,"BadFaxLines"],[327,"CleanFaxData"],[328,"ConsecutiveBadFaxLines"],[330,"SubIFD"],[333,"InkNames"],[334,"NumberofInks"],[336,"DotRange"],[338,"ExtraSamples"],[339,"SampleFormat"],[340,"SMinSampleValue"],[341,"SMaxSampleValue"],[342,"TransferRange"],[343,"ClipPath"],[344,"XClipPathUnits"],[345,"YClipPathUnits"],[346,"Indexed"],[347,"JPEGTables"],[351,"OPIProxy"],[400,"GlobalParametersIFD"],[401,"ProfileType"],[402,"FaxProfile"],[403,"CodingMethods"],[404,"VersionYear"],[405,"ModeNumber"],[433,"Decode"],[434,"DefaultImageColor"],[435,"T82Options"],[437,"JPEGTables"],[512,"JPEGProc"],[515,"JPEGRestartInterval"],[517,"JPEGLosslessPredictors"],[518,"JPEGPointTransforms"],[519,"JPEGQTables"],[520,"JPEGDCTables"],[521,"JPEGACTables"],[559,"StripRowCounts"],[999,"USPTOMiscellaneous"],[18247,"XP_DIP_XML"],[18248,"StitchInfo"],[28672,"SonyRawFileType"],[28688,"SonyToneCurve"],[28721,"VignettingCorrection"],[28722,"VignettingCorrParams"],[28724,"ChromaticAberrationCorrection"],[28725,"ChromaticAberrationCorrParams"],[28726,"DistortionCorrection"],[28727,"DistortionCorrParams"],[29895,"SonyCropTopLeft"],[29896,"SonyCropSize"],[32781,"ImageID"],[32931,"WangTag1"],[32932,"WangAnnotation"],[32933,"WangTag3"],[32934,"WangTag4"],[32953,"ImageReferencePoints"],[32954,"RegionXformTackPoint"],[32955,"WarpQuadrilateral"],[32956,"AffineTransformMat"],[32995,"Matteing"],[32996,"DataType"],[32997,"ImageDepth"],[32998,"TileDepth"],[33300,"ImageFullWidth"],[33301,"ImageFullHeight"],[33302,"TextureFormat"],[33303,"WrapModes"],[33304,"FovCot"],[33305,"MatrixWorldToScreen"],[33306,"MatrixWorldToCamera"],[33405,"Model2"],[33421,"CFARepeatPatternDim"],[33422,"CFAPattern2"],[33423,"BatteryLevel"],[33424,"KodakIFD"],[33445,"MDFileTag"],[33446,"MDScalePixel"],[33447,"MDColorTable"],[33448,"MDLabName"],[33449,"MDSampleInfo"],[33450,"MDPrepDate"],[33451,"MDPrepTime"],[33452,"MDFileUnits"],[33589,"AdventScale"],[33590,"AdventRevision"],[33628,"UIC1Tag"],[33629,"UIC2Tag"],[33630,"UIC3Tag"],[33631,"UIC4Tag"],[33918,"IntergraphPacketData"],[33919,"IntergraphFlagRegisters"],[33921,"INGRReserved"],[34016,"Site"],[34017,"ColorSequence"],[34018,"IT8Header"],[34019,"RasterPadding"],[34020,"BitsPerRunLength"],[34021,"BitsPerExtendedRunLength"],[34022,"ColorTable"],[34023,"ImageColorIndicator"],[34024,"BackgroundColorIndicator"],[34025,"ImageColorValue"],[34026,"BackgroundColorValue"],[34027,"PixelIntensityRange"],[34028,"TransparencyIndicator"],[34029,"ColorCharacterization"],[34030,"HCUsage"],[34031,"TrapIndicator"],[34032,"CMYKEquivalent"],[34152,"AFCP_IPTC"],[34232,"PixelMagicJBIGOptions"],[34263,"JPLCartoIFD"],[34306,"WB_GRGBLevels"],[34310,"LeafData"],[34687,"TIFF_FXExtensions"],[34688,"MultiProfiles"],[34689,"SharedData"],[34690,"T88Options"],[34732,"ImageLayer"],[34750,"JBIGOptions"],[34856,"Opto-ElectricConvFactor"],[34857,"Interlace"],[34908,"FaxRecvParams"],[34909,"FaxSubAddress"],[34910,"FaxRecvTime"],[34929,"FedexEDR"],[34954,"LeafSubIFD"],[37387,"FlashEnergy"],[37388,"SpatialFrequencyResponse"],[37389,"Noise"],[37390,"FocalPlaneXResolution"],[37391,"FocalPlaneYResolution"],[37392,"FocalPlaneResolutionUnit"],[37397,"ExposureIndex"],[37398,"TIFF-EPStandardID"],[37399,"SensingMethod"],[37434,"CIP3DataFile"],[37435,"CIP3Sheet"],[37436,"CIP3Side"],[37439,"StoNits"],[37679,"MSDocumentText"],[37680,"MSPropertySetStorage"],[37681,"MSDocumentTextPosition"],[37724,"ImageSourceData"],[40965,"InteropIFD"],[40976,"SamsungRawPointersOffset"],[40977,"SamsungRawPointersLength"],[41217,"SamsungRawByteOrder"],[41218,"SamsungRawUnknown"],[41484,"SpatialFrequencyResponse"],[41485,"Noise"],[41489,"ImageNumber"],[41490,"SecurityClassification"],[41491,"ImageHistory"],[41494,"TIFF-EPStandardID"],[41995,"DeviceSettingDescription"],[42112,"GDALMetadata"],[42113,"GDALNoData"],[44992,"ExpandSoftware"],[44993,"ExpandLens"],[44994,"ExpandFilm"],[44995,"ExpandFilterLens"],[44996,"ExpandScanner"],[44997,"ExpandFlashLamp"],[46275,"HasselbladRawImage"],[48129,"PixelFormat"],[48130,"Transformation"],[48131,"Uncompressed"],[48132,"ImageType"],[48256,"ImageWidth"],[48257,"ImageHeight"],[48258,"WidthResolution"],[48259,"HeightResolution"],[48320,"ImageOffset"],[48321,"ImageByteCount"],[48322,"AlphaOffset"],[48323,"AlphaByteCount"],[48324,"ImageDataDiscard"],[48325,"AlphaDataDiscard"],[50215,"OceScanjobDesc"],[50216,"OceApplicationSelector"],[50217,"OceIDNumber"],[50218,"OceImageLogic"],[50255,"Annotations"],[50459,"HasselbladExif"],[50547,"OriginalFileName"],[50560,"USPTOOriginalContentType"],[50656,"CR2CFAPattern"],[50710,"CFAPlaneColor"],[50711,"CFALayout"],[50712,"LinearizationTable"],[50713,"BlackLevelRepeatDim"],[50714,"BlackLevel"],[50715,"BlackLevelDeltaH"],[50716,"BlackLevelDeltaV"],[50717,"WhiteLevel"],[50718,"DefaultScale"],[50719,"DefaultCropOrigin"],[50720,"DefaultCropSize"],[50733,"BayerGreenSplit"],[50737,"ChromaBlurRadius"],[50738,"AntiAliasStrength"],[50752,"RawImageSegmentation"],[50780,"BestQualityScale"],[50784,"AliasLayerMetadata"],[50829,"ActiveArea"],[50830,"MaskedAreas"],[50935,"NoiseReductionApplied"],[50974,"SubTileBlockSize"],[50975,"RowInterleaveFactor"],[51008,"OpcodeList1"],[51009,"OpcodeList2"],[51022,"OpcodeList3"],[51041,"NoiseProfile"],[51114,"CacheVersion"],[51125,"DefaultUserCrop"],[51157,"NikonNEFInfo"],[65024,"KdcIFD"]];Ir(Me,"ifd0",Wu),Ir(Me,"exif",Wu),Se(di,"gps",[[23,{M:"Magnetic North",T:"True North"}],[25,{K:"Kilometers",M:"Miles",N:"Nautical Miles"}]]);class Do extends ot{static canHandle(e,t){return e.getUint8(t+1)===224&&e.getUint32(t+4)===1246120262&&e.getUint8(t+8)===0}parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint16(0)],[2,this.chunk.getUint8(2)],[3,this.chunk.getUint16(3)],[5,this.chunk.getUint16(5)],[7,this.chunk.getUint8(7)],[8,this.chunk.getUint8(8)]])}}q(Do,"type","jfif"),q(Do,"headerLength",9),Ce.set("jfif",Do),Se(Me,"jfif",[[0,"JFIFVersion"],[2,"ResolutionUnit"],[3,"XResolution"],[5,"YResolution"],[7,"ThumbnailWidth"],[8,"ThumbnailHeight"]]);class Gu extends ot{parse(){return this.parseTags(),this.translate(),this.output}parseTags(){this.raw=new Map([[0,this.chunk.getUint32(0)],[4,this.chunk.getUint32(4)],[8,this.chunk.getUint8(8)],[9,this.chunk.getUint8(9)],[10,this.chunk.getUint8(10)],[11,this.chunk.getUint8(11)],[12,this.chunk.getUint8(12)],...Array.from(this.raw)])}}q(Gu,"type","ihdr"),Ce.set("ihdr",Gu),Se(Me,"ihdr",[[0,"ImageWidth"],[4,"ImageHeight"],[8,"BitDepth"],[9,"ColorType"],[10,"Compression"],[11,"Filter"],[12,"Interlace"]]),Se(di,"ihdr",[[9,{0:"Grayscale",2:"RGB",3:"Palette",4:"Grayscale with Alpha",6:"RGB with Alpha",DEFAULT:"Unknown"}],[10,{0:"Deflate/Inflate",DEFAULT:"Unknown"}],[11,{0:"Adaptive",DEFAULT:"Unknown"}],[12,{0:"Noninterlaced",1:"Adam7 Interlace",DEFAULT:"Unknown"}]]);class Hn extends ot{static canHandle(e,t){return e.getUint8(t+1)===226&&e.getUint32(t+4)===1229144927}static findPosition(e,t){let a=super.findPosition(e,t);return a.chunkNumber=e.getUint8(t+16),a.chunkCount=e.getUint8(t+17),a.multiSegment=a.chunkCount>1,a}static handleMultiSegments(e){return function(t){let a=function(n){let s=n[0].constructor,o=0;for(let c of n)o+=c.length;let r=new s(o),l=0;for(let c of n)r.set(c,l),l+=c.length;return r}(t.map(n=>n.chunk.toUint8()));return new Ue(a)}(e)}parse(){return this.raw=new Map,this.parseHeader(),this.parseTags(),this.translate(),this.output}parseHeader(){let{raw:e}=this;this.chunk.byteLength<84&&fe("ICC header is too short");for(let[t,a]of Object.entries(Ew)){t=parseInt(t,10);let n=a(this.chunk,t);n!=="\0\0\0\0"&&e.set(t,n)}}parseTags(){let e,t,a,n,s,{raw:o}=this,r=this.chunk.getUint32(128),l=132,c=this.chunk.byteLength;for(;r--;){if(e=this.chunk.getString(l,4),t=this.chunk.getUint32(l+4),a=this.chunk.getUint32(l+8),n=this.chunk.getString(t,4),t+a>c)return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");s=this.parseTag(n,t,a),s!==void 0&&s!=="\0\0\0\0"&&o.set(e,s),l+=12}}parseTag(e,t,a){switch(e){case"desc":return this.parseDesc(t);case"mluc":return this.parseMluc(t);case"text":return this.parseText(t,a);case"sig ":return this.parseSig(t)}if(!(t+a>this.chunk.byteLength))return this.chunk.getUint8Array(t,a)}parseDesc(e){let t=this.chunk.getUint32(e+8)-1;return oi(this.chunk.getString(e+12,t))}parseText(e,t){return oi(this.chunk.getString(e+8,t-8))}parseSig(e){return oi(this.chunk.getString(e+8,4))}parseMluc(e){let{chunk:t}=this,a=t.getUint32(e+8),n=t.getUint32(e+12),s=e+16,o=[];for(let r=0;r<a;r++){let l=t.getString(s+0,2),c=t.getString(s+2,2),p=t.getUint32(s+4),u=t.getUint32(s+8)+e,f=oi(t.getUnicodeString(u,p));o.push({lang:l,country:c,text:f}),s+=n}return a===1?o[0].text:o}translateValue(e,t){return typeof e=="string"?t[e]||t[e.toLowerCase()]||e:t[e]||e}}q(Hn,"type","icc"),q(Hn,"multiSegment",!0),q(Hn,"headerLength",18);const Ew={4:_t,8:function(i,e){return[i.getUint8(e),i.getUint8(e+1)>>4,i.getUint8(e+1)%16].map(t=>t.toString(10)).join(".")},12:_t,16:_t,20:_t,24:function(i,e){const t=i.getUint16(e),a=i.getUint16(e+2)-1,n=i.getUint16(e+4),s=i.getUint16(e+6),o=i.getUint16(e+8),r=i.getUint16(e+10);return new Date(Date.UTC(t,a,n,s,o,r))},36:_t,40:_t,48:_t,52:_t,64:(i,e)=>i.getUint32(e),80:_t};function _t(i,e){return oi(i.getString(e,4))}Ce.set("icc",Hn),Se(Me,"icc",[[4,"ProfileCMMType"],[8,"ProfileVersion"],[12,"ProfileClass"],[16,"ColorSpaceData"],[20,"ProfileConnectionSpace"],[24,"ProfileDateTime"],[36,"ProfileFileSignature"],[40,"PrimaryPlatform"],[44,"CMMFlags"],[48,"DeviceManufacturer"],[52,"DeviceModel"],[56,"DeviceAttributes"],[64,"RenderingIntent"],[68,"ConnectionSpaceIlluminant"],[80,"ProfileCreator"],[84,"ProfileID"],["Header","ProfileHeader"],["MS00","WCSProfiles"],["bTRC","BlueTRC"],["bXYZ","BlueMatrixColumn"],["bfd","UCRBG"],["bkpt","MediaBlackPoint"],["calt","CalibrationDateTime"],["chad","ChromaticAdaptation"],["chrm","Chromaticity"],["ciis","ColorimetricIntentImageState"],["clot","ColorantTableOut"],["clro","ColorantOrder"],["clrt","ColorantTable"],["cprt","ProfileCopyright"],["crdi","CRDInfo"],["desc","ProfileDescription"],["devs","DeviceSettings"],["dmdd","DeviceModelDesc"],["dmnd","DeviceMfgDesc"],["dscm","ProfileDescriptionML"],["fpce","FocalPlaneColorimetryEstimates"],["gTRC","GreenTRC"],["gXYZ","GreenMatrixColumn"],["gamt","Gamut"],["kTRC","GrayTRC"],["lumi","Luminance"],["meas","Measurement"],["meta","Metadata"],["mmod","MakeAndModel"],["ncl2","NamedColor2"],["ncol","NamedColor"],["ndin","NativeDisplayInfo"],["pre0","Preview0"],["pre1","Preview1"],["pre2","Preview2"],["ps2i","PS2RenderingIntent"],["ps2s","PostScript2CSA"],["psd0","PostScript2CRD0"],["psd1","PostScript2CRD1"],["psd2","PostScript2CRD2"],["psd3","PostScript2CRD3"],["pseq","ProfileSequenceDesc"],["psid","ProfileSequenceIdentifier"],["psvm","PS2CRDVMSize"],["rTRC","RedTRC"],["rXYZ","RedMatrixColumn"],["resp","OutputResponse"],["rhoc","ReflectionHardcopyOrigColorimetry"],["rig0","PerceptualRenderingIntentGamut"],["rig2","SaturationRenderingIntentGamut"],["rpoc","ReflectionPrintOutputColorimetry"],["sape","SceneAppearanceEstimates"],["scoe","SceneColorimetryEstimates"],["scrd","ScreeningDesc"],["scrn","Screening"],["targ","CharTarget"],["tech","Technology"],["vcgt","VideoCardGamma"],["view","ViewingConditions"],["vued","ViewingCondDesc"],["wtpt","MediaWhitePoint"]]);const kn={"4d2p":"Erdt Systems",AAMA:"Aamazing Technologies",ACER:"Acer",ACLT:"Acolyte Color Research",ACTI:"Actix Sytems",ADAR:"Adara Technology",ADBE:"Adobe",ADI:"ADI Systems",AGFA:"Agfa Graphics",ALMD:"Alps Electric",ALPS:"Alps Electric",ALWN:"Alwan Color Expertise",AMTI:"Amiable Technologies",AOC:"AOC International",APAG:"Apago",APPL:"Apple Computer",AST:"AST","AT&T":"AT&T",BAEL:"BARBIERI electronic",BRCO:"Barco NV",BRKP:"Breakpoint",BROT:"Brother",BULL:"Bull",BUS:"Bus Computer Systems","C-IT":"C-Itoh",CAMR:"Intel",CANO:"Canon",CARR:"Carroll Touch",CASI:"Casio",CBUS:"Colorbus PL",CEL:"Crossfield",CELx:"Crossfield",CGS:"CGS Publishing Technologies International",CHM:"Rochester Robotics",CIGL:"Colour Imaging Group, London",CITI:"Citizen",CL00:"Candela",CLIQ:"Color IQ",CMCO:"Chromaco",CMiX:"CHROMiX",COLO:"Colorgraphic Communications",COMP:"Compaq",COMp:"Compeq/Focus Technology",CONR:"Conrac Display Products",CORD:"Cordata Technologies",CPQ:"Compaq",CPRO:"ColorPro",CRN:"Cornerstone",CTX:"CTX International",CVIS:"ColorVision",CWC:"Fujitsu Laboratories",DARI:"Darius Technology",DATA:"Dataproducts",DCP:"Dry Creek Photo",DCRC:"Digital Contents Resource Center, Chung-Ang University",DELL:"Dell Computer",DIC:"Dainippon Ink and Chemicals",DICO:"Diconix",DIGI:"Digital","DL&C":"Digital Light & Color",DPLG:"Doppelganger",DS:"Dainippon Screen",DSOL:"DOOSOL",DUPN:"DuPont",EPSO:"Epson",ESKO:"Esko-Graphics",ETRI:"Electronics and Telecommunications Research Institute",EVER:"Everex Systems",EXAC:"ExactCODE",Eizo:"Eizo",FALC:"Falco Data Products",FF:"Fuji Photo Film",FFEI:"FujiFilm Electronic Imaging",FNRD:"Fnord Software",FORA:"Fora",FORE:"Forefront Technology",FP:"Fujitsu",FPA:"WayTech Development",FUJI:"Fujitsu",FX:"Fuji Xerox",GCC:"GCC Technologies",GGSL:"Global Graphics Software",GMB:"Gretagmacbeth",GMG:"GMG",GOLD:"GoldStar Technology",GOOG:"Google",GPRT:"Giantprint",GTMB:"Gretagmacbeth",GVC:"WayTech Development",GW2K:"Sony",HCI:"HCI",HDM:"Heidelberger Druckmaschinen",HERM:"Hermes",HITA:"Hitachi America",HP:"Hewlett-Packard",HTC:"Hitachi",HiTi:"HiTi Digital",IBM:"IBM",IDNT:"Scitex",IEC:"Hewlett-Packard",IIYA:"Iiyama North America",IKEG:"Ikegami Electronics",IMAG:"Image Systems",IMI:"Ingram Micro",INTC:"Intel",INTL:"N/A (INTL)",INTR:"Intra Electronics",IOCO:"Iocomm International Technology",IPS:"InfoPrint Solutions Company",IRIS:"Scitex",ISL:"Ichikawa Soft Laboratory",ITNL:"N/A (ITNL)",IVM:"IVM",IWAT:"Iwatsu Electric",Idnt:"Scitex",Inca:"Inca Digital Printers",Iris:"Scitex",JPEG:"Joint Photographic Experts Group",JSFT:"Jetsoft Development",JVC:"JVC Information Products",KART:"Scitex",KFC:"KFC Computek Components",KLH:"KLH Computers",KMHD:"Konica Minolta",KNCA:"Konica",KODA:"Kodak",KYOC:"Kyocera",Kart:"Scitex",LCAG:"Leica",LCCD:"Leeds Colour",LDAK:"Left Dakota",LEAD:"Leading Technology",LEXM:"Lexmark International",LINK:"Link Computer",LINO:"Linotronic",LITE:"Lite-On",Leaf:"Leaf",Lino:"Linotronic",MAGC:"Mag Computronic",MAGI:"MAG Innovision",MANN:"Mannesmann",MICN:"Micron Technology",MICR:"Microtek",MICV:"Microvitec",MINO:"Minolta",MITS:"Mitsubishi Electronics America",MITs:"Mitsuba",MNLT:"Minolta",MODG:"Modgraph",MONI:"Monitronix",MONS:"Monaco Systems",MORS:"Morse Technology",MOTI:"Motive Systems",MSFT:"Microsoft",MUTO:"MUTOH INDUSTRIES",Mits:"Mitsubishi Electric",NANA:"NANAO",NEC:"NEC",NEXP:"NexPress Solutions",NISS:"Nissei Sangyo America",NKON:"Nikon",NONE:"none",OCE:"Oce Technologies",OCEC:"OceColor",OKI:"Oki",OKID:"Okidata",OKIP:"Okidata",OLIV:"Olivetti",OLYM:"Olympus",ONYX:"Onyx Graphics",OPTI:"Optiquest",PACK:"Packard Bell",PANA:"Matsushita Electric Industrial",PANT:"Pantone",PBN:"Packard Bell",PFU:"PFU",PHIL:"Philips Consumer Electronics",PNTX:"HOYA",POne:"Phase One A/S",PREM:"Premier Computer Innovations",PRIN:"Princeton Graphic Systems",PRIP:"Princeton Publishing Labs",QLUX:"Hong Kong",QMS:"QMS",QPCD:"QPcard AB",QUAD:"QuadLaser",QUME:"Qume",RADI:"Radius",RDDx:"Integrated Color Solutions",RDG:"Roland DG",REDM:"REDMS Group",RELI:"Relisys",RGMS:"Rolf Gierling Multitools",RICO:"Ricoh",RNLD:"Edmund Ronald",ROYA:"Royal",RPC:"Ricoh Printing Systems",RTL:"Royal Information Electronics",SAMP:"Sampo",SAMS:"Samsung",SANT:"Jaime Santana Pomares",SCIT:"Scitex",SCRN:"Dainippon Screen",SDP:"Scitex",SEC:"Samsung",SEIK:"Seiko Instruments",SEIk:"Seikosha",SGUY:"ScanGuy.com",SHAR:"Sharp Laboratories",SICC:"International Color Consortium",SONY:"Sony",SPCL:"SpectraCal",STAR:"Star",STC:"Sampo Technology",Scit:"Scitex",Sdp:"Scitex",Sony:"Sony",TALO:"Talon Technology",TAND:"Tandy",TATU:"Tatung",TAXA:"TAXAN America",TDS:"Tokyo Denshi Sekei",TECO:"TECO Information Systems",TEGR:"Tegra",TEKT:"Tektronix",TI:"Texas Instruments",TMKR:"TypeMaker",TOSB:"Toshiba",TOSH:"Toshiba",TOTK:"TOTOKU ELECTRIC",TRIU:"Triumph",TSBT:"Toshiba",TTX:"TTX Computer Products",TVM:"TVM Professional Monitor",TW:"TW Casper",ULSX:"Ulead Systems",UNIS:"Unisys",UTZF:"Utz Fehlau & Sohn",VARI:"Varityper",VIEW:"Viewsonic",VISL:"Visual communication",VIVO:"Vivo Mobile Communication",WANG:"Wang",WLBR:"Wilbur Imaging",WTG2:"Ware To Go",WYSE:"WYSE Technology",XERX:"Xerox",XRIT:"X-Rite",ZRAN:"Zoran",Zebr:"Zebra Technologies",appl:"Apple Computer",bICC:"basICColor",berg:"bergdesign",ceyd:"Integrated Color Solutions",clsp:"MacDermid ColorSpan",ds:"Dainippon Screen",dupn:"DuPont",ffei:"FujiFilm Electronic Imaging",flux:"FluxData",iris:"Scitex",kart:"Scitex",lcms:"Little CMS",lino:"Linotronic",none:"none",ob4d:"Erdt Systems",obic:"Medigraph",quby:"Qubyx Sarl",scit:"Scitex",scrn:"Dainippon Screen",sdp:"Scitex",siwi:"SIWI GRAFIKA",yxym:"YxyMaster"},Ku={scnr:"Scanner",mntr:"Monitor",prtr:"Printer",link:"Device Link",abst:"Abstract",spac:"Color Space Conversion Profile",nmcl:"Named Color",cenc:"ColorEncodingSpace profile",mid:"MultiplexIdentification profile",mlnk:"MultiplexLink profile",mvis:"MultiplexVisualization profile",nkpf:"Nikon Input Device Profile (NON-STANDARD!)"};Se(di,"icc",[[4,kn],[12,Ku],[40,Object.assign({},kn,Ku)],[48,kn],[80,kn],[64,{0:"Perceptual",1:"Relative Colorimetric",2:"Saturation",3:"Absolute Colorimetric"}],["tech",{amd:"Active Matrix Display",crt:"Cathode Ray Tube Display",kpcd:"Photo CD",pmd:"Passive Matrix Display",dcam:"Digital Camera",dcpj:"Digital Cinema Projector",dmpc:"Digital Motion Picture Camera",dsub:"Dye Sublimation Printer",epho:"Electrophotographic Printer",esta:"Electrostatic Printer",flex:"Flexography",fprn:"Film Writer",fscn:"Film Scanner",grav:"Gravure",ijet:"Ink Jet Printer",imgs:"Photo Image Setter",mpfr:"Motion Picture Film Recorder",mpfs:"Motion Picture Film Scanner",offs:"Offset Lithography",pjtv:"Projection Television",rpho:"Photographic Paper Printer",rscn:"Reflective Scanner",silk:"Silkscreen",twax:"Thermal Wax Printer",vidc:"Video Camera",vidm:"Video Monitor"}]]);class Tn extends ot{static canHandle(e,t,a){return e.getUint8(t+1)===237&&e.getString(t+4,9)==="Photoshop"&&this.containsIptc8bim(e,t,a)!==void 0}static headerLength(e,t,a){let n,s=this.containsIptc8bim(e,t,a);if(s!==void 0)return n=e.getUint8(t+s+7),n%2!=0&&(n+=1),n===0&&(n=4),s+8+n}static containsIptc8bim(e,t,a){for(let n=0;n<a;n++)if(this.isIptcSegmentHead(e,t+n))return n}static isIptcSegmentHead(e,t){return e.getUint8(t)===56&&e.getUint32(t)===943868237&&e.getUint16(t+4)===1028}parse(){let{raw:e}=this,t=this.chunk.byteLength-1,a=!1;for(let n=0;n<t;n++)if(this.chunk.getUint8(n)===28&&this.chunk.getUint8(n+1)===2){a=!0;let s=this.chunk.getUint16(n+3),o=this.chunk.getUint8(n+2),r=this.chunk.getLatin1String(n+5,s);e.set(o,this.pluralizeValue(e.get(o),r)),n+=4+s}else if(a)break;return this.translate(),this.output}pluralizeValue(e,t){return e!==void 0?e instanceof Array?(e.push(t),e):[e,t]:t}}q(Tn,"type","iptc"),q(Tn,"translateValues",!1),q(Tn,"reviveValues",!1),Ce.set("iptc",Tn),Se(Me,"iptc",[[0,"ApplicationRecordVersion"],[3,"ObjectTypeReference"],[4,"ObjectAttributeReference"],[5,"ObjectName"],[7,"EditStatus"],[8,"EditorialUpdate"],[10,"Urgency"],[12,"SubjectReference"],[15,"Category"],[20,"SupplementalCategories"],[22,"FixtureIdentifier"],[25,"Keywords"],[26,"ContentLocationCode"],[27,"ContentLocationName"],[30,"ReleaseDate"],[35,"ReleaseTime"],[37,"ExpirationDate"],[38,"ExpirationTime"],[40,"SpecialInstructions"],[42,"ActionAdvised"],[45,"ReferenceService"],[47,"ReferenceDate"],[50,"ReferenceNumber"],[55,"DateCreated"],[60,"TimeCreated"],[62,"DigitalCreationDate"],[63,"DigitalCreationTime"],[65,"OriginatingProgram"],[70,"ProgramVersion"],[75,"ObjectCycle"],[80,"Byline"],[85,"BylineTitle"],[90,"City"],[92,"Sublocation"],[95,"State"],[100,"CountryCode"],[101,"Country"],[103,"OriginalTransmissionReference"],[105,"Headline"],[110,"Credit"],[115,"Source"],[116,"CopyrightNotice"],[118,"Contact"],[120,"Caption"],[121,"LocalCaption"],[122,"Writer"],[125,"RasterizedCaption"],[130,"ImageType"],[131,"ImageOrientation"],[135,"LanguageIdentifier"],[150,"AudioType"],[151,"AudioSamplingRate"],[152,"AudioSamplingResolution"],[153,"AudioDuration"],[154,"AudioOutcue"],[184,"JobID"],[185,"MasterDocumentID"],[186,"ShortDocumentID"],[187,"UniqueDocumentID"],[188,"OwnerID"],[200,"ObjectPreviewFileFormat"],[201,"ObjectPreviewFileVersion"],[202,"ObjectPreviewData"],[221,"Prefs"],[225,"ClassifyState"],[228,"SimilarityIndex"],[230,"DocumentNotes"],[231,"DocumentHistory"],[232,"ExifCameraInfo"],[255,"CatalogSets"]]),Se(di,"iptc",[[10,{0:"0 (reserved)",1:"1 (most urgent)",2:"2",3:"3",4:"4",5:"5 (normal urgency)",6:"6",7:"7",8:"8 (least urgent)",9:"9 (user-defined priority)"}],[75,{a:"Morning",b:"Both Morning and Evening",p:"Evening"}],[131,{L:"Landscape",P:"Portrait",S:"Square"}]]);const En={zip:ew,gz:Po,tgz:Po,deflate:Po};class Dw extends me{constructor(e,t){const a={};super(e,{...a,...t}),this.id=this.opts.id||"PrepareUpload",this.type="progressindicator",this.i18nInit()}setHashFileName=async e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a){const{data:n}=a,s=1024*1024*5,r=await n.slice(0,s).text(),l=new aw;l.append(r);const c=l.end(),p=_a(a),u=`${c}${p?`.${p}`:""}`;this.uppy.setFileState(t,{hashFileName:u})}};setMetaData=async e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a){const{data:{webkitRelativePath:n,relativePath:s,name:o},hashFileName:r,size:l}=a,c=s||n||o||r;this.uppy.setFileMeta(t,{relativePath:c,name:c})}};preventXssAttack=async e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a){const{name:n,meta:s}=this.uppy.getFile(t),o=hi.sanitize(n);if(n!==o){const l=_a(a),c=o.endsWith(`.${l}`)?o:`${o}.${l}`;this.uppy.setFileState(t,{name:c,meta:{...s,name:c,filename:c}})}if(await Fx(a)){const{data:l,name:c,type:p}=this.uppy.getFile(t),u=await l.text(),f=new Set;new DOMParser().parseFromString(u,"image/svg+xml").querySelectorAll("[id]").forEach(w=>f.add(w.id)),hi.addHook("uponSanitizeElement",(w,y)=>{if(y.tagName==="use"){const b=w.getAttribute("xlink:href")||w.getAttribute("href");if(b&&b.startsWith("#")){const h=b.substring(1);f.has(h)&&(y.allowedTags.use=!0,y.forceKeepNode=!0)}}}),hi.addHook("uponSanitizeAttribute",(w,y)=>{if(y.attrName==="xlink:href"&&y.attrValue){if(y.attrValue.startsWith("#")){const b=y.attrValue.substring(1);if(f.has(b)){y.forceKeepAttr=!0;return}}y.keepAttr=!1}["width","height"].includes(y.attrName)&&y.attrValue==="100%"&&(y.forceKeepAttr=!0),y.attrName==="style"&&y.attrValue==="overflow:visible"&&(y.forceKeepAttr=!0)});const _=hi.sanitize(u,{USE_PROFILES:{svg:!0,svgFilters:!0},ALLOWED_TAGS:["svg","circle","ellipse","line","path","polygon","polyline","rect","g","text","use","defs","clipPath","mask","pattern","linearGradient","radialGradient","stop"],ALLOWED_ATTR:["d","points","x","y","width","height","r","cx","cy","rx","ry","x1","y1","x2","y2","transform","fill","stroke","stroke-width","viewBox","xmlns","xmlns:xlink","xml:space","style","id","class","offset","stop-color","stop-opacity","clip-path","mask","fill-opacity","stroke-opacity","gradientTransform","gradientUnits","xlink:href"],FORBID_TAGS:["a","script","iframe","image","foreignObject"],FORBID_ATTR:["href","onclick","onload","onerror"]});if(hi.removeHook("uponSanitizeElement"),hi.removeHook("uponSanitizeAttribute"),u!==_){const w=new Blob([_],{type:p}),y=vo(w,c);this.uppy.setFileState(t,{...this.uppy.getFile(t),data:y,preview:wn(y)}),console.info("clean svg file xss attack",{name:c,originalFile:a.data.text(),cleanFile:_})}}}};preventZipBombAttack=async e=>{const{id:t}=e,a=this.uppy.getFile(t);try{if(a&&En[a.extension]){const{data:n}=a,s=En[a.extension](new Uint8Array(await n.arrayBuffer())),o=(l,c,p=0)=>Object.entries(l instanceof Uint8Array?{[c||a.name]:l}:l).reduce((u,[f,x])=>{if(!x||x.byteLength===0)return console.warn("Invalid or empty item in unzipped content",{name:f,item:x}),u;const S=u+x.byteLength;if(p>=5||S>a.size*100)throw console.error("Zip bomb detected, please check your file",{depth:p,baseAcc:S,fileSize:a.size}),new Error("Zip bomb detected, please check your file");const _=Ke.extension(Ke.lookup(f));if(En[_]){const w=En[_](x);return S+o(w,f,p+1)}return S},0);if(o(s)>a.size*100)throw new Error("Zip bomb detected, please check your file")}}catch(n){if(n.message.includes("Zip bomb detected"))throw n}};validateImagesRespectCropperOptions=async()=>this.uppy.getFiles().reduce(async(e,t)=>{await e;const{id:a}=t;let n=this.uppy.getFile(a);if(n.isRemote&&(await this.tryDownloadRemoteFile(n),n=this.uppy.getFile(a)),!this.opts.cropperOptions?.aspectRatio||!n?.type?.includes("image")||n.type?.includes("image/svg"))return Promise.resolve();const{aspectRatio:s}=this.opts.cropperOptions,o=this.uppy.getPlugin("ImageEditor"),r=document.querySelector(`[src="${n.preview}"]`)||document.getElementById("uppy_"+a).querySelector("img"),l=r?.naturalWidth,c=r?.naturalHeight,p=Number(l/c).toFixed(2),u=Number(s).toFixed(2);if(p===u)return Promise.resolve();this.uppy.emit("preprocess-progress",n,{mode:"indeterminate",message:this.i18n("editorLoading")}),o.parent.openFileEditor(n);const x=this.i18n("aspectRatioMessage",{imageAspectRatio:p,aspectRatio:u});return this.uppy.info({message:x,details:x}),new Promise((S,_)=>{this.uppy.once("file-editor:complete",()=>{setTimeout(()=>{S()},200)}),this.uppy.once("file-editor:cancel",()=>{})})},Promise.resolve());checkImageOrientation=async e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a?.type?.startsWith("image/"))try{if(!(await yw(a.data).catch(()=>({deg:0}))).deg)return;const s=a.data.size*.98,o=await new Promise((_,w)=>{const y=new Image;let b=URL.createObjectURL(a.data);y.src=b,y.onload=()=>{URL.revokeObjectURL(b),b=null,_(y)},y.onerror=h=>{b&&(URL.revokeObjectURL(b),b=null),w(new Error(`Image load failed: ${h.message}`))}}),r=o.width/o.height;let l=Math.sqrt(s*r),c=l/r;const p=8096;if(l>p||c>p){const _=p/Math.max(l,c);l*=_,c*=_}const u=document.createElement("canvas");u.width=l,u.height=c;const f=u.getContext("2d",{willReadFrequently:!0,alpha:a.type==="image/png"});f.imageSmoothingEnabled=!0,f.imageSmoothingQuality="high",f.translate(u.width/2,u.height/2),f.drawImage(o,-l/2,-c/2,l,c);const x=1,S=await new Promise(_=>{u.toBlob(_,a.type,x)});this.uppy.setFileState(t,{data:S,size:S.size})}catch(n){console.error("Image rotation processing failed:",n);return}};prepareUploadWrapper=async e=>{await this.tryDownloadRemoteFile(e),await this.checkImageOrientation(e),await this.getPreviewFromData(e),await this.setHashFileName(e),await this.preventXssAttack(e),await this.preventZipBombAttack(e),await this.setMetaData(e)};tryDownloadRemoteFile=async e=>{const{type:t,name:a,preview:n,source:s,isRemote:o,isDownloading:r,id:l,isLoading:c,remote:p,meta:u,errorCount:f=0}=e,x=!c&&o,S=`uploader:${l}:downloaded`,_=_a(e),w=a?.split("?")?.[0],b=(()=>{const h=["jpg","jpeg"];return h.includes(_)&&h.some(m=>w?.endsWith(m))?!0:w?.endsWith(_)})()?w:`${w}${_?`.${_}`:""}`;if(x){const h=yx(n||p?.body?.url);if(f>=3)throw this.uppy.setFileState(l,{error:this.i18n("downloadRemoteFileFailure"),meta:{...u,name:this.i18n("downloadRemoteFileFailure")}}),new Error("Download remote file failure");this.uppy.setFileState(l,{isLoading:!0,isDownloading:!0,size:null,meta:{...u,name:this.i18n("loading")}}),await fetch(h).then(async m=>await m.blob()).then(async m=>{const v=vo(m,b);this.uppy.setFileState(l,{name:b,extension:_,type:t,data:v,preview:n||wn(v),source:s,size:v.size,isDownloading:!1,isRemote:!1,meta:{...u,name:b,filename:b}}),this.uppy.getFile(l),this.uppy.emit(S,l)}).catch(async m=>{if(console.error("Axios download remote file error: ",m),t.startsWith("image/")){const v=t.includes("svg")?"image/png":t,g=b.endsWith(".svg")?b.replace(".svg",".png"):b;try{const k=await new Promise((L,B)=>{const V=new Image;V.crossOrigin="anonymous",V.onload=()=>{const I=document.createElement("canvas");I.width=V.width,I.height=V.height;const $=I.getContext("2d");$.translate(I.width/2,I.height/2),$.drawImage(V,-V.width/2,-V.height/2,V.width,V.height),I.toBlob(L,v)},V.onerror=B,V.src=h});let T=vo(k,g);this.uppy.setFileState(l,{name:g,extension:_,type:v,data:T,preview:n||wn(T),source:s,size:T.size,isDownloading:!1,isRemote:!1,meta:{...u,name:g,filename:g}});const D=this.uppy.getFile(l);this.uppy.emit(S,l);return}catch{}}this.uppy.setFileState(l,{isRemote:!0,isLoading:!1,errorCount:f+1}),await this.tryDownloadRemoteFile(this.uppy.getFile(l))})}else r&&await(async()=>new Promise(m=>{this.uppy.once(S,async()=>{m()})}))()};getPreviewFromData=e=>{const{id:t}=e,a=this.uppy.getFile(t);if(a){const{data:n,type:s,preview:o}=a;(s.indexOf("gif")>-1||!o)&&n&&s.indexOf("image")>-1&&setTimeout(()=>{this.uppy.setFileState(t,{preview:wn(n)})},s.indexOf("gif")>-1?1e3:0)}};prepareUpload=async e=>{await this.validateImagesRespectCropperOptions();const t=e.map(async n=>{const s=this.uppy.getFile(n);s.isDownloading&&this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("loading")}),await this.prepareUploadWrapper(s)}),a=()=>{e.forEach(n=>{const s=this.uppy.getFile(n);this.uppy.emit("preprocess-complete",s)})};return Promise.all(t).then(a)};install(){this.uppy.addPreProcessor(this.prepareUpload),this.uppy.on("file-added",async e=>{setTimeout(()=>{this.prepareUploadWrapper(e)},200)}),this.uppy.on("file-editor:complete",e=>{this.getPreviewFromData(e)})}uninstall(){this.uppy.removePreProcessor(this.prepareUpload)}render(){return le(kx,{})}}class Iw extends me{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=()=>le("svg",{width:"20",height:"20",viewBox:"0 0 24 24",children:le("g",{fill:"none",stroke:"#a482fe","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",children:[le("path",{d:"M15 8h.01M10 21H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v5"}),le("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 le("div",{id:"ai-image",className:"ai-image",children:le("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()}}class Aw extends me{constructor(e,t){super(e,t),this.id=t.id,this.title=t.title,this.type="acquirer",this.uppy=e,this.i18nInit(),this.autoHide=t.autoHide??!0,typeof t.icon=="string"&&(this.icon=()=>le("div",{dangerouslySetInnerHTML:{__html:t.icon},style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}}))}getDashboard(){return this.uppy.getPlugin(this.id)?.parent}render(){return this.autoHide&&this.getDashboard()?.hideAllPanels&&this.getDashboard().hideAllPanels(),le("div",{id:this.id,className:"uppy-VirtualPlugin"})}update(){}onFirstRender(){}uninstall(){this.unmount()}}const Xu=()=>navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome");class Ow extends me{constructor(e,t){super(e,t),this.id=t?.id||"safari-paste",this.type="modifier"}onMount(){Xu()&&this.parent?.handlePaste&&document.addEventListener("paste",this.parent.handlePaste)}onUnmount(){Xu()&&this.parent?.handlePaste&&document.removeEventListener("paste",this.parent.handlePaste)}}const Rw="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9",Uw=Y.lazy(()=>Xh(()=>import("./index-BRKdK9jJ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),Yu="uploader-container",Io="uploader-dashboard",Mw='div[tabindex="-1"]',Qu=50,Lw=10,Or=localStorage.getItem("uppy_debug"),Nw=()=>xr.get("x-csrf-token")?{"x-csrf-token":xr.get("x-csrf-token")}:{},Bw=i=>{const{apiPathProps:e,availablePluginMap:t={},uploadedProps:a,resourcesProps:n,imageEditorProps:s={},theme:o,plugins:r}=i,{companionUrl:l}=gh(e),c=Nw(),p=async f=>(await Za.post("/api/image/generations",f)).data,u={...i?.restrictions,maxFileSize:1/0};return[{id:"ImageEditor",plugin:Vd,options:{quality:1,...s},alwayUse:!0},(Or||ka()&&t.Uploaded&&!Cu())&&{id:"Uploaded",plugin:Dx,options:{params:a?.params}},(Or||ka()&&t.Resources&&!Cu())&&{id:"Resources",plugin:Ax,options:{params:n?.params}},ka()&&(window.blocklet?.preferences?.useAiImage||t.AIImage)&&{id:"AIImage",plugin:Iw,options:{companionUrl:l,companionHeaders:c},onShowPanel:f=>{function x(){setTimeout(()=>{const S=document.getElementById("ai-image");S?jh.createRoot(S).render(N.jsx(Uw,{theme:o,api:p,restrictions:u,i18n:f.current?.getUploader()?.i18n,onSelect:_=>{const w=f.current.getUploader();w?.emit("ai-image:selected",_),_.forEach(({src:y,alt:b},h)=>{const m=k=>k?.length>16?`${k?.slice(0,8)}...${k?.slice(-4)}`:k,v=`${m(b)||m(y)}.png`,g={name:v,type:"image/png",data:bx(y,v),source:"AIImage",isRemote:!1};w?.addFile(g)})}})):x()},100)}x()}},{id:"Url",plugin:zt,options:{companionUrl:l,companionHeaders:c}},{id:"Webcam",plugin:Fp,options:{showVideoSourceDropdown:!0,showRecordingLength:!0,mirror:!1,videoConstraints:{facingMode:"environment"}}},!!window?.blocklet?.UNSPLASH_KEY&&t.Unsplash&&{id:"Unsplash",plugin:Vp,options:{companionUrl:l,companionHeaders:c,companionCookiesRule:"same-origin"}},{id:"PrepareUpload",plugin:Dw,options:{companionUrl:l,companionHeaders:c,cropperOptions:s?.cropperOptions||null},alwayUse:!0},{id:"ThumbnailGeneratorNext",plugin:Xr,options:{thumbnailType:"image/png",thumbnailWidth:"100%"},alwayUse:!0},...(r||[]).filter(f=>f?.id).map(f=>{const{id:x,options:S,onShowPanel:_}=f;return{id:x,plugin:Aw,options:S,onShowPanel:_}}),{id:"safari-paste",plugin:Ow,alwayUse:!0}].filter(Boolean)};function jw(i){const{id:e,plugins:t,locale:a="en",onAfterResponse:n,onUploadFinish:s,coreProps:o,apiPathProps:r,tusProps:l,dropTargetProps:c,pluginList:p,restrictions:u,onChange:f,initialFiles:x}=i,S=ip(p,"id"),{uploaderUrl:_}=gh(r);let w=new Ur({id:e,meta:{uploaderId:e},debug:["true",!0].includes(Or||""),locale:ha[a],onBeforeFileAdded:(h,m)=>{if(Object.hasOwn(m,h.id))return!1;const v=!!Ke.extension(h.type),g=Ke.lookup(h.name)||"";if(!v&&g&&g!==h.type){const k=_a(h);k&&(h.extension=k),h.type=g}return h},...o,restrictions:u}).use(hh,{chunkSize:1024*1024*10,removeFingerprintOnSuccess:!0,withCredentials:!0,endpoint:_,async onBeforeRequest(h,m){const{hashFileName:v,id:g,meta:k}=m,T=w.getFile(g)?.mockResponse||null;h.getMethod()==="PATCH"&&T&&(h.send=()=>T);const D=_a(m);h.setHeader("x-uploader-file-name",`${v}`),h.setHeader("x-uploader-file-id",`${g}`),h.setHeader("x-uploader-file-ext",`${D}`),h.setHeader("x-uploader-base-url",new URL(h.getURL()).pathname),h.setHeader("x-uploader-endpoint-url",_),h.setHeader("x-uploader-metadata",JSON.stringify(k,(V,I)=>typeof I=="string"?encodeURIComponent(I):I));const L=xr.get("x-csrf-token");L&&h.setHeader("x-csrf-token",L);const B=window?.uploaderComponentId||window?.blocklet?.componentId;B&&h.setHeader("x-component-did",(B||"").split("/").pop())},onAfterResponse:async(h,m)=>{const v={},g=h.getUnderlyingObject();try{g.response&&(v.data=JSON.parse(g.response))}catch{v.data={}}v.method=h.getMethod().toUpperCase(),v.url=h.getURL(),v.status=g.status,v.headers={...h._headers};const k=g.getAllResponseHeaders();k&&k.split(`\r
|
|
77
|
+
`).forEach(V=>{const[I,$]=V.split(": ");I&&$&&(v.headers[I]=$)});const T=w.getFile(v.headers["x-uploader-file-id"]);if(h.getMethod()==="PATCH"&&T.mockResponse)return;if(["PATCH","POST"].includes(v.method)&&[200,500].includes(v.status)){const B=[!0,"true"].includes(v.headers["x-uploader-file-exist"]),V=Sx(v.url,v.headers["x-uploader-file-name"]);v.file=T,v.uploadURL=V;const I={uploadURL:V,...v};w.setFileState(T.id,{responseResult:I}),B&&T&&(v.method==="POST"&&w.setFileState(T.id,{mockResponse:m}),w.emit("upload-success",w.getFile(T.id),{...I,body:v.data}),w.emit("postprocess-complete",w.getFile(T.id)),w.calculateTotalProgress()),v.status===200&&(await s?.(v),w.emitUploadSuccess(T,v))}n&&await n?.(g);const D=w.getState().totalProgress===100,L=w.getFiles().every(B=>B.source==="DropTarget");D&&L&&w.close()},...l});const y=({fileIDs:h,id:m})=>{h.forEach(v=>{w.setFileState(v,{uploadID:m})})};w.off("upload",y),w.on("upload",y);const b=h=>{typeof f=="function"&&f(h,w.getFiles())};return w.off("file-added",b),w.on("file-added",b),w.off("file-removed-success",b),w.on("file-removed-success",b),c&&w.use(Ed,{target:document.body,onDrop:h=>{w?.open?.()},...c}),t?.forEach(h=>{if(h?.id||h){const{plugin:m,options:v}=S[h?.id||h]||{};m&&w.use(m,v)}}),Px(w),x&&x?.length>0&&w.addFiles(x),w}function Ju({ref:i=void 0,...e}){const t={uploader:"/api/uploads",companion:"/api/companion",disableMediaKitPrefix:!1,disableMediaKitStatus:!1,...e?.apiPathProps},a=Y.useRef(null),n=Y.useRef(null),s=Y.useRef(0),o=rf({open:!1,uppy:null,availablePluginMap:{},restrictions:ys(e?.coreProps?.restrictions)||{},isError:!1}),r=ap(),l=r?.palette?.mode,c=Bw({...e,apiPathProps:t,availablePluginMap:o.availablePluginMap,restrictions:o.restrictions,theme:r}),{plugins:p=c.map(U=>U.id),id:u="Uploader",popup:f=!1,onUploadFinish:x,onOpen:S,onClose:_,locale:w="en",installerProps:y}=e,b=ip(c,"id"),h=Zh(U=>U?.breakpoints?.down("md")),m=xs([...p,...c.filter(U=>U.alwayUse).map(U=>U.id)]),{loading:v}=lf(async()=>{let U=ws(e?.coreProps?.restrictions)?{}:ys(e?.coreProps?.restrictions);if(!t.disableMediaKitStatus&&ka())try{await Za.get("/api/uploader/status").then(({data:C})=>{o.availablePluginMap=C.availablePluginMap,!t.disableMediaKitPrefix&&ws(e?.coreProps?.restrictions)&&(U=C.restrictions||{})}),o.isError=!1}catch{o.isError=!0}!U?.allowedFileTypes?.length&&U?.allowedFileExts&&(U.allowedFileTypes=xs(((typeof U?.allowedFileExts=="string"?U?.allowedFileExts.split(","):U?.allowedFileExts)||[])?.map(C=>Ke.lookup(C?.replaceAll(" ","")||""))?.filter(C=>C)),delete U.allowedFileExts),U.maxFileSize&&typeof U.maxFileSize=="string"&&(U.maxFileSize=uf.parseSize(U.maxFileSize,{iec:!1})||void 0),o.restrictions=ys(U)},{refreshDeps:[JSON.stringify({apiPathProps:t,restrictionsProps:e?.coreProps?.restrictions})]}),g=typeof o.restrictions?.allowedFileTypes=="object"&&o.restrictions?.allowedFileTypes?.length===0,k=Y.useMemo(()=>xs(o.restrictions?.allowedFileTypes?.flatMap(U=>{if(U.endsWith("/*")){const C=U.split("/")?.[0];switch(C){case"image":return["jpg","jpeg","png","gif","svg","webp","bmp","tiff","avif","heic","ico","apng"];case"video":return["mp4","webm","mov","avi","wmv","flv","mkv","mpg","mpeg","3gp","m4v","ts","m2ts"];case"audio":return["mp3","wav","ogg","aac","flac","m4a","wma","opus","mid","midi","amr"];case"text":return["txt","html","htm","css","csv","md","rtf","xml","json","js","ts","jsx","tsx"];case"application":return["pdf","doc","docx","xls","xlsx","ppt","pptx","zip","rar","7z","tar","gz","exe","msi","apk","dmg","iso"];case"font":return["ttf","otf","woff","woff2","eot"];case"chemical":return["mol","pdb","cml","xyz"];case"model":return["obj","stl","gltf","glb","fbx","3ds","dae"];case"message":return["eml","msg","vcf","ics"];default:return C}}return Ke.extension(U)})||[])?.filter(Boolean)?.join(", ")||"",[o.restrictions?.allowedFileTypes]);let T="";g?T=tn(ha,`${w}.strings.noAllowedFileTypes`,"No allowed file types"):o.restrictions?.allowedFileTypes?.length&&k&&(T=tn(ha,`${w}.strings.allowedFileTypes`,"Allowed file types: ")+k),(ws(T)||["undefined","null",void 0,null].includes(T))&&(T=""),cf("esc",U=>{o.open&&(U.stopPropagation(),U.preventDefault(),B())},{useCapture:!0}),Y.useEffect(()=>{xx(t),o.uppy=jw({...e,id:u,plugins:m,apiPathProps:t,pluginList:c,restrictions:o.restrictions}),o.uppy.open=L,o.uppy.close=B,o.uppy.openPlugin=D;const U=F=>{const{onShowPanel:E}=b[F];E?.(i)};o.uppy.off("dashboard:show-panel",U),o.uppy.on("dashboard:show-panel",U);const C=(F,E,O,A)=>{const z=`${A.toLowerCase()}Props`,W=O[z]?.onSelectedFiles;if(typeof W=="function"){const G=F.map(X=>{const J={name:X.id||X.fileUrl?.split("/")?.slice(-1)?.[0],type:X.mimetype||Ke.lookup(X.fileUrl),data:"",preview:X.fileUrl,source:A,isRemote:!0},Z=E.uppy.addFile(J);return{...X,uppyFile:E.uppy.getFile(Z)}});W?.(G)}else{const G=[],X=[],J=`Mock-${Math.random().toString(36).substring(2,15)}`;Promise.all(F.map(async Z=>{const gt=_x(Z);gt&&(gt.uploadID=J,G.push(gt)),await x?.(gt),E.uppy.emitUploadSuccess(gt.file,gt)})).then(()=>{E.uppy.close()}).finally(()=>{E.uppy.emit("complete",{failed:X,successful:G,uploadID:J})})}};[{name:"Uploaded",event:"uploaded:selected"},{name:"Resources",event:"resources:selected"}].forEach(({name:F,event:E})=>{m.includes(F)&&(o.uppy.off(E),o.uppy.on(E,O=>C(O,o,e,F)))})},[JSON.stringify({id:u,plugins:m,apiPathProps:t,locale:w,restrictions:o.restrictions,theme:r})]);function D(U){if(U=U.replace(/\s/g,""),["MyDevice",...m.map(P=>P.id||P)].map(P=>P.toLowerCase()).includes(U.toLowerCase())){let P=`div[data-uppy-acquirer-id="${U}"] > button`;document?.getElementById(Io)?.querySelector(P)?.click?.()}}function L(U){o.open=!0,U&&setTimeout(()=>{D(U)},200),o.uppy.emitOpen(),S?.(),n.current&&(clearInterval(n.current),n.current=null),s.current=0,n.current=setInterval(()=>{const C=a.current?.querySelector(Mw);s.current+=1,(s.current>Qu||C&&C!==document.activeElement)&&(C&&C!==document.activeElement?(C.focus?.(),console.info("[Uploader] Trigger auto focus overlay success")):s.current>Qu&&console.info("[Uploader] Auto focus overlay failed after maximum attempts"),clearInterval(n.current),n.current=null)},Lw)}function B(){n.current&&(clearInterval(n.current),n.current=null),o.uppy.getPlugin(Io)?.hideAllPanels(),o.open=!1,o.uppy.emitClose(),_?.(),setTimeout(()=>{o.uppy.getState().totalProgress===100&&(o.uppy.setState({files:{},currentUploads:{}}),o.uppy.calculateTotalProgress())},500)}Y.useImperativeHandle(i,()=>({getUploader:()=>o.uppy,open:L,close:B}));const V=f?ef:Y.Fragment,I=f?{sx:{zIndex:99999999999,"& > *":{display:o.open?"block":"none"},display:"flex",justifyContent:"center",alignItems:"center",...e?.wrapperProps?.sx},invisible:!0,open:o.open,onClick:U=>{document.activeElement===document.body&&(U.stopPropagation(),B())},...e.wrapperProps}:{...e.wrapperProps},$=h?"42px":"40px";return N.jsx(V,{...I,children:N.jsxs(mh,{onClose:B,did:Rw,disabled:!o.open,...y,children:[N.jsx(tf,{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)"}}})}),N.jsxs(ee,{className:"uploader-container",ref:a,id:Yu,onClick:U=>U.stopPropagation(),sx:{position:"relative",width:h?"90vw":720,animation:o.open?"uppy-Dashboard-fadeIn 150ms ease-in-out":"none","@keyframes uppy-Dashboard-fadeIn":{from:{opacity:0},to:{opacity:1}},".uppy-Dashboard-inner":{borderColor:"divider"},".uppy-ProviderBrowserItem > *":{transition:"all 0.3s ease-in-out"},".uppy-ProviderBrowserItem-inner":{flex:1,color:"transparent","img, object":{objectFit:"contain !important"}},".uppy-ProviderBrowserItem-checkbox":{backgroundColor:`${r?.palette?.primary?.main} !important`},".uppy-Dashboard-Item-previewInnerWrap, .uppy-ProviderBrowserItem-inner":{boxShadow:"none !important",background:"repeating-conic-gradient(#e0e0e0 0 25%,#fff 0 50%) 50%/18px 18px !important"},".uppy-ProviderBrowserItem--selected .uppy-ProviderBrowserItem-inner":{boxShadow:U=>`0 0 0 3px ${U.palette.primary.main} !important`},".uploaded-add-item":{background:r.palette.mode==="dark"?"rgba(255,255,255,0.1) !important":"rgba(0,0,0,0.1) !important",display:"flex",justifyContent:"center",alignItems:"center",transition:"all 0.3s ease-in-out","&:hover":{background:r.palette.mode==="dark"?"rgba(255,255,255,0.13) !important":"rgba(0,0,0,0.13) !important"}},".uppy-StatusBar-actions, .uppy-ProviderBrowser-footer":{justifyContent:"flex-end"},".uppy-ProviderBrowser-footer":{button:{marginRight:"0 !important","&:last-child":{display:"none"}}},".uppy-DashboardContent-panelBody":{height:0},".uppy-Dashboard-AddFiles-title":{whiteSpace:"normal"},".uppy-ProviderBrowser-body":{height:"100%"},".uppy-ProviderBrowser-list":{height:"fit-content",maxHeight:"100%",bgcolor:"background.paper"},".uploaded, .ai-image":{width:"100%",height:"100%",display:"flex",alignItems:"center",flexDirection:"column","& > div":{width:"100%",bgcolor:"background.paper"},"& .uppy-ProviderBrowser-header":{display:"none"}},"& .uppy-Url":{width:"100% !important",display:"flex",justifyContent:"center","& input":{width:"70%"}},"& .uppy-Dashboard-browse, & .uppy-DashboardContent-addMore, & .uppy-DashboardContent-back, & .uppy-StatusBar-actionBtn--done, & .uppy-DashboardContent-save, & .uppy-StatusBar-actionBtn--upload":{color:`${r?.palette?.primary?.main}`,transition:"all 0.3s ease-in-out","&:hover, &:focus":{color:`${r?.palette?.primary?.main}`,filter:"brightness(1.2)"}},"& .uppy-Dashboard-browse":{textDecoration:"underline !important"},"& .uppy-c-btn-primary":{backgroundColor:`${r?.palette?.primary?.main} !important`,transition:"all 0.3s ease-in-out","&:hover, &:focus":{backgroundColor:`${r?.palette?.primary?.main} !important`,filter:"brightness(1.2)"}},"& .button-color-style":{border:"1px solid",borderColor:"primary.main",color:"primary.main",backgroundColor:"transparent",transition:"all 0.3s ease-in-out","&:hover":{filter:"brightness(1.2)"}},"& .button-color-style-active":{backgroundColor:"primary.main",color:"white"}},children:[f&&N.jsx(Ao,{"aria-label":"close",onClick:B,sx:{color:l==="dark"?"#ddd":"#fafafa",position:"absolute",...h?{bottom:`calc(0px - ${$} - 16px)`,left:`calc(50vw - ${$} - 8px)`}:{right:`calc(0px - ${$} - 16px)`,top:-12}},children:N.jsx(af,{sx:{fontSize:$}})}),v&&N.jsxs(ee,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",zIndex:99999999999,flexDirection:"column",background:"rgba(256, 256, 256, 0.2)",backdropFilter:"blur(4px)",borderRadius:1,pointerEvents:"none"},children:[N.jsx(nf,{size:32}),N.jsx(sf,{variant:"body2",color:"primary",sx:{mt:1.5,fontWeight:"bold"},children:tn(ha,`${w}.strings.loadingStatus`,"Loading...")})]}),o.uppy&&N.jsx(yd,{inline:!0,target:`#${Yu}`,id:Io,disabled:g||o.isError,uppy:o.uppy,plugins:m,fileManagerSelectionType:o.restrictions?.maxNumberOfFiles===1?"files":"both",proudlyDisplayPoweredByUppy:!1,showProgressDetails:!0,disableThumbnailGenerator:!0,theme:l==="dark"?"dark":"light",note:o.isError?tn(ha,`${w}.strings.error`,"Error"):T,doneButtonHandler:B,...e.dashboardProps})]},"uploader-container")]})},"uploader-wrapper")}const Uh=Y.createContext(null);function zw(){const i=Y.useContext(Uh);if(!i)throw new Error("useUploaderContext must be used within an UploaderProvider");return i}function h2({onChange:i,children:e,...t}){const a=zw(),n=()=>{const s=a?.current?.getUploader();s?.open(),i&&s.onceUploadSuccess((...o)=>{i(...o)})};return N.jsx(ee,{onClick:n,...t,children:e})}function f2({children:i,popup:e,...t}){const a=Y.useRef(null),n=Y.useMemo(()=>e?zh.createPortal(N.jsx(Ju,{ref:a,popup:!0,...t},"uploader"),document.body):N.jsx(Ju,{ref:a,popup:!1,...t},"uploader"),[a,e,t]);return N.jsxs(Uh.Provider,{value:a,children:[i,n]})}export{yo as CLOSE,bo as OPEN,Fu as UPLOADER_UPLOAD_SUCCESS,Ju as Uploader,Uh as UploaderContext,f2 as UploaderProvider,h2 as UploaderTrigger,wx as api,bx as base64ToFile,vo as blobToFile,ns as createImageUrl,yx as getDownloadUrl,_a as getExt,ka as getMediaKitComponent,wn as getObjectURL,gh as getUploaderEndpoint,Sx as getUrl,jw as initUploader,Px as initUppy,vx as isBlob,Cu as isMediaKit,Fx as isSvgFile,Za as mediaKitApi,Ot as mediaKitMountPoint,_x as mockUploaderFileResponse,Cx as parseStringToDot,pi as prefixPath,xx as setPrefixPath,zw as useUploaderContext};
|