utopia-ui 3.0.97 → 3.0.99

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.
@@ -1,9 +1,9 @@
1
1
  import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { useState, useEffect, cloneElement, useRef, useCallback, useDebugValue, forwardRef, useLayoutEffect, createContext, useContext } from 'react';
3
+ import React__default, { useState, useEffect, cloneElement, useRef, useCallback, useMemo, useReducer, forwardRef, useImperativeHandle, Fragment as Fragment$2, useDebugValue, useLayoutEffect, createContext, useContext } from 'react';
4
4
  import { useNavigate, Link as Link$3, useLocation } from 'react-router-dom';
5
5
  import { toast } from 'react-toastify';
6
- import { g as useAuth, R as MapOverlayPage, V as TextInput, a2 as hashTagRegex, a3 as randomColor, ab as encodeTag, j as useAppState, n as useItems, _ as StartEndView, B as TextView, b as useHasUserPermission, W as useGetItemTags, X as ForwardRef$c, ad as DialogModal, Z as HeaderView, Q as ForwardRef$d, p as useAddFilterTag, Y as timeAgo, a4 as TagView, a5 as useUpdateItem, t as useSelectPosition, a0 as useRemoveItem, m as useTags, v as useSetSelectPosition, x as useClusterRef, o as useLeafletRefs, u as useLayers, a1 as PopupStartEndInput, U as TextAreaInput, q as decodeTag, $ as useAddItem, H as useAddTag } from './TagView-oMANewyq.js';
6
+ import { g as useAuth, R as MapOverlayPage, V as TextInput, a2 as hashTagRegex, a3 as randomColor, ab as encodeTag, j as useAppState, n as useItems, _ as StartEndView, B as TextView, b as useHasUserPermission, W as useGetItemTags, X as ForwardRef$c, ad as DialogModal, Z as HeaderView, Q as ForwardRef$d, p as useAddFilterTag, Y as timeAgo, a4 as TagView, a5 as useUpdateItem, t as useSelectPosition, a0 as useRemoveItem, m as useTags, v as useSetSelectPosition, x as useClusterRef, o as useLeafletRefs, u as useLayers, ae as ForwardRef$e, a1 as PopupStartEndInput, U as TextAreaInput, q as decodeTag, $ as useAddItem, H as useAddTag } from './TagView-B8qr_QIZ.js';
7
7
  import { LatLng } from 'leaflet';
8
8
  import axios from 'axios';
9
9
  import 'react-inlinesvg';
@@ -14,6 +14,7 @@ import { RowsPhotoAlbum } from 'react-photo-album';
14
14
  import ReactLightbox from 'yet-another-react-lightbox';
15
15
  import { centerCrop, makeAspectCrop, ReactCrop } from 'react-image-crop';
16
16
  import { HexColorPicker } from 'react-colorful';
17
+ import PropTypes from 'prop-types';
17
18
  import ReactDOM from 'react-dom';
18
19
 
19
20
  function getDefaultExportFromCjs$1 (x) {
@@ -75,7 +76,7 @@ function UserSettings() {
75
76
  // eslint-disable-next-line promise/avoid-new
76
77
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
77
78
  const linkItem = async (id, item, updateItem) => {
78
- const newRelations = item.relations || [];
79
+ const newRelations = item.relations ?? [];
79
80
  newRelations?.push({ items_id: item.id, related_items_id: id });
80
81
  const updatedItem = { id: item.id, relations: newRelations };
81
82
  let success = false;
@@ -135,18 +136,18 @@ const onUpdateItem = async (state, item, tags, addTag, setLoading, navigate, upd
135
136
  let changedItem = {};
136
137
  const offerUpdates = [];
137
138
  // check for new offers
138
- await state.offers?.map((o) => {
139
+ state.offers?.map((o) => {
139
140
  const existingOffer = item?.offers?.find((t) => t.tags_id === o.id);
140
- existingOffer && offerUpdates.push(existingOffer.id);
141
+ existingOffer && offerUpdates.push(existingOffer.tags_id);
141
142
  if (!existingOffer && !tags.some((t) => t.id === o.id))
142
143
  addTag({ ...o, offer_or_need: true });
143
144
  !existingOffer && offerUpdates.push({ items_id: item?.id, tags_id: o.id });
144
145
  return null;
145
146
  });
146
147
  const needsUpdates = [];
147
- await state.needs?.map((n) => {
148
+ state.needs?.map((n) => {
148
149
  const existingNeed = item?.needs?.find((t) => t.tags_id === n.id);
149
- existingNeed && needsUpdates.push(existingNeed.id);
150
+ existingNeed && needsUpdates.push(existingNeed.tags_id);
150
151
  !existingNeed && needsUpdates.push({ items_id: item?.id, tags_id: n.id });
151
152
  !existingNeed && !tags.some((t) => t.id === n.id) && addTag({ ...n, offer_or_need: true });
152
153
  return null;
@@ -165,12 +166,13 @@ const onUpdateItem = async (state, item, tags, addTag, setLoading, navigate, upd
165
166
  telephone: state.telephone,
166
167
  ...(state.end && { end: state.end }),
167
168
  ...(state.start && { start: state.start }),
168
- ...(state.marker_icon && { markerIcon: state.marker_icon }),
169
+ ...(state.marker_icon && { markerIcon: state.marker_icon.id }),
169
170
  next_appointment: state.next_appointment,
170
171
  ...(state.image.length > 10 && { image: state.image }),
171
172
  ...(state.offers.length > 0 && { offers: offerUpdates }),
172
173
  ...(state.needs.length > 0 && { needs: needsUpdates }),
173
174
  ...(state.openCollectiveSlug && { openCollectiveSlug: state.openCollectiveSlug }),
175
+ gallery: state.gallery,
174
176
  };
175
177
  const offersState = [];
176
178
  const needsState = [];
@@ -184,7 +186,7 @@ const onUpdateItem = async (state, item, tags, addTag, setLoading, navigate, upd
184
186
  });
185
187
  changedItem = { ...changedItem, offers: offersState, needs: needsState };
186
188
  setLoading(true);
187
- await state.text
189
+ state.text
188
190
  .toLocaleLowerCase()
189
191
  .match(hashTagRegex)
190
192
  ?.map((tag) => {
@@ -200,7 +202,7 @@ const onUpdateItem = async (state, item, tags, addTag, setLoading, navigate, upd
200
202
  // take care that addTag request comes before item request
201
203
  await sleep(200);
202
204
  if (!item.new) {
203
- item?.layer?.api?.updateItem &&
205
+ await (item?.layer?.api?.updateItem &&
204
206
  toast
205
207
  .promise(item?.layer?.api?.updateItem(changedItem), {
206
208
  pending: 'updating Item ...',
@@ -212,16 +214,16 @@ const onUpdateItem = async (state, item, tags, addTag, setLoading, navigate, upd
212
214
  },
213
215
  })
214
216
  .catch(setLoading(false))
215
- .then(() => item && updateItem({ ...item, ...changedItem }))
217
+ .then(() => item && updateItem({ ...item, ...changedItem, markerIcon: state.marker_icon }))
216
218
  .then(() => {
217
219
  setLoading(false);
218
220
  navigate(`/item/${item.id}${params && '?' + params}`);
219
221
  return null;
220
- });
222
+ }));
221
223
  }
222
224
  else {
223
225
  item.new = false;
224
- item.layer?.api?.createItem &&
226
+ await (item.layer?.api?.createItem &&
225
227
  toast
226
228
  .promise(item.layer?.api?.createItem(changedItem), {
227
229
  pending: 'updating Item ...',
@@ -244,7 +246,7 @@ const onUpdateItem = async (state, item, tags, addTag, setLoading, navigate, upd
244
246
  setLoading(false);
245
247
  navigate(`/${params && '?' + params}`);
246
248
  return null;
247
- });
249
+ }));
248
250
  }
249
251
  };
250
252
 
@@ -843,6 +845,93 @@ function ProfileView({ attestationApi }) {
843
845
  }, big: true, truncateSubname: false }) }), template === 'onepager' && jsx(OnepagerView, { item: item }), template === 'simple' && jsx(SimpleView, { item: item }), template === 'flex' && jsx(FlexView, { item: item }), template === 'tabs' && (jsx(TabsView, { attestations: attestations, item: item, loading: loading, offers: offers, needs: needs, relations: relations, updatePermission: updatePermission, linkItem: (id) => linkItem(id, item, updateItem), unlinkItem: (id) => unlinkItem(id, item, updateItem) }))] }) }, item.id)) }));
844
846
  }
845
847
 
848
+ var classnames = {exports: {}};
849
+
850
+ /*!
851
+ Copyright (c) 2018 Jed Watson.
852
+ Licensed under the MIT License (MIT), see
853
+ http://jedwatson.github.io/classnames
854
+ */
855
+
856
+ var hasRequiredClassnames;
857
+
858
+ function requireClassnames () {
859
+ if (hasRequiredClassnames) return classnames.exports;
860
+ hasRequiredClassnames = 1;
861
+ (function (module) {
862
+ /* global define */
863
+
864
+ (function () {
865
+
866
+ var hasOwn = {}.hasOwnProperty;
867
+
868
+ function classNames () {
869
+ var classes = '';
870
+
871
+ for (var i = 0; i < arguments.length; i++) {
872
+ var arg = arguments[i];
873
+ if (arg) {
874
+ classes = appendClass(classes, parseValue(arg));
875
+ }
876
+ }
877
+
878
+ return classes;
879
+ }
880
+
881
+ function parseValue (arg) {
882
+ if (typeof arg === 'string' || typeof arg === 'number') {
883
+ return arg;
884
+ }
885
+
886
+ if (typeof arg !== 'object') {
887
+ return '';
888
+ }
889
+
890
+ if (Array.isArray(arg)) {
891
+ return classNames.apply(null, arg);
892
+ }
893
+
894
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
895
+ return arg.toString();
896
+ }
897
+
898
+ var classes = '';
899
+
900
+ for (var key in arg) {
901
+ if (hasOwn.call(arg, key) && arg[key]) {
902
+ classes = appendClass(classes, key);
903
+ }
904
+ }
905
+
906
+ return classes;
907
+ }
908
+
909
+ function appendClass (value, newClass) {
910
+ if (!newClass) {
911
+ return value;
912
+ }
913
+
914
+ if (value) {
915
+ return value + ' ' + newClass;
916
+ }
917
+
918
+ return value + newClass;
919
+ }
920
+
921
+ if (module.exports) {
922
+ classNames.default = classNames;
923
+ module.exports = classNames;
924
+ } else {
925
+ window.classNames = classNames;
926
+ }
927
+ }());
928
+ } (classnames));
929
+ return classnames.exports;
930
+ }
931
+
932
+ var classnamesExports = requireClassnames();
933
+ var classNames = /*@__PURE__*/getDefaultExportFromCjs$1(classnamesExports);
934
+
846
935
  function ArrowUpTrayIcon({
847
936
  title,
848
937
  titleId,
@@ -1037,10 +1126,10 @@ const FormHeader = ({ item, state, setState }) => {
1037
1126
  })) }), jsx(ColorPicker, { color: state.color, onChange: (c) => setState((prevState) => ({
1038
1127
  ...prevState,
1039
1128
  color: c,
1040
- })), className: 'tw:-left-6 tw:top-14 tw:-mr-6' }), jsxs("div", { className: 'tw:grow tw:mr-4 tw:pt-1', children: [jsx(TextInput, { placeholder: 'Name', defaultValue: item?.name ? item.name : '', updateFormValue: (v) => setState((prevState) => ({
1129
+ })), className: 'tw:-left-6 tw:top-14 tw:-mr-6' }), jsxs("div", { className: 'tw:grow tw:mr-4 tw:pt-1', children: [jsx(TextInput, { placeholder: 'Name', defaultValue: item.name ? item.name : '', updateFormValue: (v) => setState((prevState) => ({
1041
1130
  ...prevState,
1042
1131
  name: v,
1043
- })), containerStyle: 'tw:grow tw:px-4', inputStyle: 'tw:input-md' }), jsx(TextInput, { placeholder: 'Subtitle', required: false, defaultValue: item?.subname ? item.subname : '', updateFormValue: (v) => setState((prevState) => ({
1132
+ })), containerStyle: 'tw:grow tw:px-4', inputStyle: 'tw:input-md' }), jsx(TextInput, { placeholder: 'Subtitle', required: false, defaultValue: item.subname ? item.subname : '', updateFormValue: (v) => setState((prevState) => ({
1044
1133
  ...prevState,
1045
1134
  subname: v,
1046
1135
  })), containerStyle: 'tw:grow tw:px-4 tw:mt-1', inputStyle: 'tw:input-sm' })] })] }) }));
@@ -1063,6 +1152,2988 @@ const CrowdfundingForm = ({ state, setState, }) => {
1063
1152
  })) })] }) }));
1064
1153
  };
1065
1154
 
1155
+ /**
1156
+ * Browser Image Compression
1157
+ * v2.0.2
1158
+ * by Donald <donaldcwl@gmail.com>
1159
+ * https://github.com/Donaldcwl/browser-image-compression
1160
+ */
1161
+
1162
+ function _mergeNamespaces(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:true,get:function(){return t[r]}});}}));})),Object.freeze(e)}function copyExifWithoutOrientation(e,t){return new Promise((function(r,i){let o;return getApp1Segment(e).then((function(e){try{return o=e,r(new Blob([t.slice(0,2),o,t.slice(2)],{type:"image/jpeg"}))}catch(e){return i(e)}}),i)}))}const getApp1Segment=e=>new Promise(((t,r)=>{const i=new FileReader;i.addEventListener("load",(({target:{result:e}})=>{const i=new DataView(e);let o=0;if(65496!==i.getUint16(o))return r("not a valid JPEG");for(o+=2;;){const a=i.getUint16(o);if(65498===a)break;const s=i.getUint16(o+2);if(65505===a&&1165519206===i.getUint32(o+4)){const a=o+10;let f;switch(i.getUint16(a)){case 18761:f=true;break;case 19789:f=false;break;default:return r("TIFF header contains invalid endian")}if(42!==i.getUint16(a+2,f))return r("TIFF header contains invalid version");const l=i.getUint32(a+4,f),c=a+l+2+12*i.getUint16(a+l,f);for(let e=a+l+2;e<c;e+=12){if(274==i.getUint16(e,f)){if(3!==i.getUint16(e+2,f))return r("Orientation data type is invalid");if(1!==i.getUint32(e+4,f))return r("Orientation data count is invalid");i.setUint16(e+8,1,f);break}}return t(e.slice(o,o+2+s))}o+=2+s;}return t(new Blob)})),i.readAsArrayBuffer(e);}));var e={},t={get exports(){return e},set exports(t){e=t;}};!function(e){var r,i,UZIP={};t.exports=UZIP,UZIP.parse=function(e,t){for(var r=UZIP.bin.readUshort,i=UZIP.bin.readUint,o=0,a={},s=new Uint8Array(e),f=s.length-4;101010256!=i(s,f);)f--;o=f;o+=4;var l=r(s,o+=4);r(s,o+=2);var c=i(s,o+=2),u=i(s,o+=4);o+=4,o=u;for(var h=0;h<l;h++){i(s,o),o+=4,o+=4,o+=4,i(s,o+=4);c=i(s,o+=4);var d=i(s,o+=4),A=r(s,o+=4),g=r(s,o+2),p=r(s,o+4);o+=6;var m=i(s,o+=8);o+=4,o+=A+g+p,UZIP._readLocal(s,m,a,c,d,t);}return a},UZIP._readLocal=function(e,t,r,i,o,a){var s=UZIP.bin.readUshort,f=UZIP.bin.readUint;f(e,t),s(e,t+=4),s(e,t+=2);var l=s(e,t+=2);f(e,t+=2),f(e,t+=4),t+=4;var c=s(e,t+=8),u=s(e,t+=2);t+=2;var h=UZIP.bin.readUTF8(e,t,c);if(t+=c,t+=u,a)r[h]={size:o,csize:i};else {var d=new Uint8Array(e.buffer,t);if(0==l)r[h]=new Uint8Array(d.buffer.slice(t,t+i));else {if(8!=l)throw "unknown compression method: "+l;var A=new Uint8Array(o);UZIP.inflateRaw(d,A),r[h]=A;}}},UZIP.inflateRaw=function(e,t){return UZIP.F.inflate(e,t)},UZIP.inflate=function(e,t){return e[0],e[1],UZIP.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),t)},UZIP.deflate=function(e,t){null==t&&(t={level:6});var r=0,i=new Uint8Array(50+Math.floor(1.1*e.length));i[r]=120,i[r+1]=156,r+=2,r=UZIP.F.deflateRaw(e,i,r,t.level);var o=UZIP.adler(e,0,e.length);return i[r+0]=o>>>24&255,i[r+1]=o>>>16&255,i[r+2]=o>>>8&255,i[r+3]=o>>>0&255,new Uint8Array(i.buffer,0,r+4)},UZIP.deflateRaw=function(e,t){null==t&&(t={level:6});var r=new Uint8Array(50+Math.floor(1.1*e.length)),i=UZIP.F.deflateRaw(e,r,i,t.level);return new Uint8Array(r.buffer,0,i)},UZIP.encode=function(e,t){null==t&&(t=false);var r=0,i=UZIP.bin.writeUint,o=UZIP.bin.writeUshort,a={};for(var s in e){var f=!UZIP._noNeed(s)&&!t,l=e[s],c=UZIP.crc.crc(l,0,l.length);a[s]={cpr:f,usize:l.length,crc:c,file:f?UZIP.deflateRaw(l):l};}for(var s in a)r+=a[s].file.length+30+46+2*UZIP.bin.sizeUTF8(s);r+=22;var u=new Uint8Array(r),h=0,d=[];for(var s in a){var A=a[s];d.push(h),h=UZIP._writeHeader(u,h,s,A,0);}var g=0,p=h;for(var s in a){A=a[s];d.push(h),h=UZIP._writeHeader(u,h,s,A,1,d[g++]);}var m=h-p;return i(u,h,101010256),h+=4,o(u,h+=4,g),o(u,h+=2,g),i(u,h+=2,m),i(u,h+=4,p),h+=4,h+=2,u.buffer},UZIP._noNeed=function(e){var t=e.split(".").pop().toLowerCase();return -1!="png,jpg,jpeg,zip".indexOf(t)},UZIP._writeHeader=function(e,t,r,i,o,a){var s=UZIP.bin.writeUint,f=UZIP.bin.writeUshort,l=i.file;return s(e,t,0==o?67324752:33639248),t+=4,1==o&&(t+=2),f(e,t,20),f(e,t+=2,0),f(e,t+=2,i.cpr?8:0),s(e,t+=2,0),s(e,t+=4,i.crc),s(e,t+=4,l.length),s(e,t+=4,i.usize),f(e,t+=4,UZIP.bin.sizeUTF8(r)),f(e,t+=2,0),t+=2,1==o&&(t+=2,t+=2,s(e,t+=6,a),t+=4),t+=UZIP.bin.writeUTF8(e,t,r),0==o&&(e.set(l,t),t+=l.length),t},UZIP.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var r=t,i=0;i<8;i++)1&r?r=3988292384^r>>>1:r>>>=1;e[t]=r;}return e}(),update:function(e,t,r,i){for(var o=0;o<i;o++)e=UZIP.crc.table[255&(e^t[r+o])]^e>>>8;return e},crc:function(e,t,r){return 4294967295^UZIP.crc.update(4294967295,e,t,r)}},UZIP.adler=function(e,t,r){for(var i=1,o=0,a=t,s=t+r;a<s;){for(var f=Math.min(a+5552,s);a<f;)o+=i+=e[a++];i%=65521,o%=65521;}return o<<16|i},UZIP.bin={readUshort:function(e,t){return e[t]|e[t+1]<<8},writeUshort:function(e,t,r){e[t]=255&r,e[t+1]=r>>8&255;},readUint:function(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])},writeUint:function(e,t,r){e[t]=255&r,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255;},readASCII:function(e,t,r){for(var i="",o=0;o<r;o++)i+=String.fromCharCode(e[t+o]);return i},writeASCII:function(e,t,r){for(var i=0;i<r.length;i++)e[t+i]=r.charCodeAt(i);},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,r){for(var i,o="",a=0;a<r;a++)o+="%"+UZIP.bin.pad(e[t+a].toString(16));try{i=decodeURIComponent(o);}catch(i){return UZIP.bin.readASCII(e,t,r)}return i},writeUTF8:function(e,t,r){for(var i=r.length,o=0,a=0;a<i;a++){var s=r.charCodeAt(a);if(0==(4294967168&s))e[t+o]=s,o++;else if(0==(4294965248&s))e[t+o]=192|s>>6,e[t+o+1]=128|s>>0&63,o+=2;else if(0==(4294901760&s))e[t+o]=224|s>>12,e[t+o+1]=128|s>>6&63,e[t+o+2]=128|s>>0&63,o+=3;else {if(0!=(4292870144&s))throw "e";e[t+o]=240|s>>18,e[t+o+1]=128|s>>12&63,e[t+o+2]=128|s>>6&63,e[t+o+3]=128|s>>0&63,o+=4;}}return o},sizeUTF8:function(e){for(var t=e.length,r=0,i=0;i<t;i++){var o=e.charCodeAt(i);if(0==(4294967168&o))r++;else if(0==(4294965248&o))r+=2;else if(0==(4294901760&o))r+=3;else {if(0!=(4292870144&o))throw "e";r+=4;}}return r}},UZIP.F={},UZIP.F.deflateRaw=function(e,t,r,i){var o=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],a=UZIP.F.U,s=UZIP.F._goodIndex;UZIP.F._hash;var f=UZIP.F._putsE,l=0,c=r<<3,u=0,h=e.length;if(0==i){for(;l<h;){f(t,c,l+(_=Math.min(65535,h-l))==h?1:0),c=UZIP.F._copyExact(e,l,_,t,c+8),l+=_;}return c>>>3}var d=a.lits,A=a.strt,g=a.prev,p=0,m=0,w=0,v=0,b=0,y=0;for(h>2&&(A[y=UZIP.F._hash(e,0)]=0),l=0;l<h;l++){if(b=y,l+1<h-2){y=UZIP.F._hash(e,l+1);var E=l+1&32767;g[E]=A[y],A[y]=E;}if(u<=l){(p>14e3||m>26697)&&h-l>100&&(u<l&&(d[p]=l-u,p+=2,u=l),c=UZIP.F._writeBlock(l==h-1||u==h?1:0,d,p,v,e,w,l-w,t,c),p=m=v=0,w=l);var F=0;l<h-2&&(F=UZIP.F._bestMatch(e,l,g,b,Math.min(o[2],h-l),o[3]));var _=F>>>16,B=65535&F;if(0!=F){B=65535&F;var U=s(_=F>>>16,a.of0);a.lhst[257+U]++;var C=s(B,a.df0);a.dhst[C]++,v+=a.exb[U]+a.dxb[C],d[p]=_<<23|l-u,d[p+1]=B<<16|U<<8|C,p+=2,u=l+_;}else a.lhst[e[l]]++;m++;}}for(w==l&&0!=e.length||(u<l&&(d[p]=l-u,p+=2,u=l),c=UZIP.F._writeBlock(1,d,p,v,e,w,l-w,t,c),p=0,m=0,p=m=v=0,w=l);0!=(7&c);)c++;return c>>>3},UZIP.F._bestMatch=function(e,t,r,i,o,a){var s=32767&t,f=r[s],l=s-f+32768&32767;if(f==s||i!=UZIP.F._hash(e,t-l))return 0;for(var c=0,u=0,h=Math.min(32767,t);l<=h&&0!=--a&&f!=s;){if(0==c||e[t+c]==e[t+c-l]){var d=UZIP.F._howLong(e,t,l);if(d>c){if(u=l,(c=d)>=o)break;l+2<d&&(d=l+2);for(var A=0,g=0;g<d-2;g++){var p=t-l+g+32768&32767,m=p-r[p]+32768&32767;m>A&&(A=m,f=p);}}}l+=(s=f)-(f=r[s])+32768&32767;}return c<<16|u},UZIP.F._howLong=function(e,t,r){if(e[t]!=e[t-r]||e[t+1]!=e[t+1-r]||e[t+2]!=e[t+2-r])return 0;var i=t,o=Math.min(e.length,t+258);for(t+=3;t<o&&e[t]==e[t-r];)t++;return t-i},UZIP.F._hash=function(e,t){return (e[t]<<8|e[t+1])+(e[t+2]<<4)&65535},UZIP.saved=0,UZIP.F._writeBlock=function(e,t,r,i,o,a,s,f,l){var c,u,h,d,A,g,p,m,w,v=UZIP.F.U,b=UZIP.F._putsF,y=UZIP.F._putsE;v.lhst[256]++,u=(c=UZIP.F.getTrees())[0],h=c[1],d=c[2],A=c[3],g=c[4],p=c[5],m=c[6],w=c[7];var E=32+(0==(l+3&7)?0:8-(l+3&7))+(s<<3),F=i+UZIP.F.contSize(v.fltree,v.lhst)+UZIP.F.contSize(v.fdtree,v.dhst),_=i+UZIP.F.contSize(v.ltree,v.lhst)+UZIP.F.contSize(v.dtree,v.dhst);_+=14+3*p+UZIP.F.contSize(v.itree,v.ihst)+(2*v.ihst[16]+3*v.ihst[17]+7*v.ihst[18]);for(var B=0;B<286;B++)v.lhst[B]=0;for(B=0;B<30;B++)v.dhst[B]=0;for(B=0;B<19;B++)v.ihst[B]=0;var U=E<F&&E<_?0:F<_?1:2;if(b(f,l,e),b(f,l+1,U),l+=3,0==U){for(;0!=(7&l);)l++;l=UZIP.F._copyExact(o,a,s,f,l);}else {var C,I;if(1==U&&(C=v.fltree,I=v.fdtree),2==U){UZIP.F.makeCodes(v.ltree,u),UZIP.F.revCodes(v.ltree,u),UZIP.F.makeCodes(v.dtree,h),UZIP.F.revCodes(v.dtree,h),UZIP.F.makeCodes(v.itree,d),UZIP.F.revCodes(v.itree,d),C=v.ltree,I=v.dtree,y(f,l,A-257),y(f,l+=5,g-1),y(f,l+=5,p-4),l+=4;for(var Q=0;Q<p;Q++)y(f,l+3*Q,v.itree[1+(v.ordr[Q]<<1)]);l+=3*p,l=UZIP.F._codeTiny(m,v.itree,f,l),l=UZIP.F._codeTiny(w,v.itree,f,l);}for(var M=a,x=0;x<r;x+=2){for(var S=t[x],R=S>>>23,T=M+(8388607&S);M<T;)l=UZIP.F._writeLit(o[M++],C,f,l);if(0!=R){var O=t[x+1],P=O>>16,H=O>>8&255,L=255&O;y(f,l=UZIP.F._writeLit(257+H,C,f,l),R-v.of0[H]),l+=v.exb[H],b(f,l=UZIP.F._writeLit(L,I,f,l),P-v.df0[L]),l+=v.dxb[L],M+=R;}}l=UZIP.F._writeLit(256,C,f,l);}return l},UZIP.F._copyExact=function(e,t,r,i,o){var a=o>>>3;return i[a]=r,i[a+1]=r>>>8,i[a+2]=255-i[a],i[a+3]=255-i[a+1],a+=4,i.set(new Uint8Array(e.buffer,t,r),a),o+(r+4<<3)},UZIP.F.getTrees=function(){for(var e=UZIP.F.U,t=UZIP.F._hufTree(e.lhst,e.ltree,15),r=UZIP.F._hufTree(e.dhst,e.dtree,15),i=[],o=UZIP.F._lenCodes(e.ltree,i),a=[],s=UZIP.F._lenCodes(e.dtree,a),f=0;f<i.length;f+=2)e.ihst[i[f]]++;for(f=0;f<a.length;f+=2)e.ihst[a[f]]++;for(var l=UZIP.F._hufTree(e.ihst,e.itree,7),c=19;c>4&&0==e.itree[1+(e.ordr[c-1]<<1)];)c--;return [t,r,l,o,s,c,i,a]},UZIP.F.getSecond=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(e[r+1]);return t},UZIP.F.nonZero=function(e){for(var t="",r=0;r<e.length;r+=2)0!=e[r+1]&&(t+=(r>>1)+",");return t},UZIP.F.contSize=function(e,t){for(var r=0,i=0;i<t.length;i++)r+=t[i]*e[1+(i<<1)];return r},UZIP.F._codeTiny=function(e,t,r,i){for(var o=0;o<e.length;o+=2){var a=e[o],s=e[o+1];i=UZIP.F._writeLit(a,t,r,i);var f=16==a?2:17==a?3:7;a>15&&(UZIP.F._putsE(r,i,s,f),i+=f);}return i},UZIP.F._lenCodes=function(e,t){for(var r=e.length;2!=r&&0==e[r-1];)r-=2;for(var i=0;i<r;i+=2){var o=e[i+1],a=i+3<r?e[i+3]:-1,s=i+5<r?e[i+5]:-1,f=0==i?-1:e[i-1];if(0==o&&a==o&&s==o){for(var l=i+5;l+2<r&&e[l+2]==o;)l+=2;(c=Math.min(l+1-i>>>1,138))<11?t.push(17,c-3):t.push(18,c-11),i+=2*c-2;}else if(o==f&&a==o&&s==o){for(l=i+5;l+2<r&&e[l+2]==o;)l+=2;var c=Math.min(l+1-i>>>1,6);t.push(16,c-3),i+=2*c-2;}else t.push(o,0);}return r>>>1},UZIP.F._hufTree=function(e,t,r){var i=[],o=e.length,a=t.length,s=0;for(s=0;s<a;s+=2)t[s]=0,t[s+1]=0;for(s=0;s<o;s++)0!=e[s]&&i.push({lit:s,f:e[s]});var f=i.length,l=i.slice(0);if(0==f)return 0;if(1==f){var c=i[0].lit;l=0==c?1:0;return t[1+(c<<1)]=1,t[1+(l<<1)]=1,1}i.sort((function(e,t){return e.f-t.f}));var u=i[0],h=i[1],d=0,A=1,g=2;for(i[0]={lit:-1,f:u.f+h.f,l:u,r:h,d:0};A!=f-1;)u=d!=A&&(g==f||i[d].f<i[g].f)?i[d++]:i[g++],h=d!=A&&(g==f||i[d].f<i[g].f)?i[d++]:i[g++],i[A++]={lit:-1,f:u.f+h.f,l:u,r:h};var p=UZIP.F.setDepth(i[A-1],0);for(p>r&&(UZIP.F.restrictDepth(l,r,p),p=r),s=0;s<f;s++)t[1+(l[s].lit<<1)]=l[s].d;return p},UZIP.F.setDepth=function(e,t){return -1!=e.lit?(e.d=t,t):Math.max(UZIP.F.setDepth(e.l,t+1),UZIP.F.setDepth(e.r,t+1))},UZIP.F.restrictDepth=function(e,t,r){var i=0,o=1<<r-t,a=0;for(e.sort((function(e,t){return t.d==e.d?e.f-t.f:t.d-e.d})),i=0;i<e.length&&e[i].d>t;i++){var s=e[i].d;e[i].d=t,a+=o-(1<<r-s);}for(a>>>=r-t;a>0;){(s=e[i].d)<t?(e[i].d++,a-=1<<t-s-1):i++;}for(;i>=0;i--)e[i].d==t&&a<0&&(e[i].d--,a++);0!=a&&console.log("debt left");},UZIP.F._goodIndex=function(e,t){var r=0;return t[16|r]<=e&&(r|=16),t[8|r]<=e&&(r|=8),t[4|r]<=e&&(r|=4),t[2|r]<=e&&(r|=2),t[1|r]<=e&&(r|=1),r},UZIP.F._writeLit=function(e,t,r,i){return UZIP.F._putsF(r,i,t[e<<1]),i+t[1+(e<<1)]},UZIP.F.inflate=function(e,t){var r=Uint8Array;if(3==e[0]&&0==e[1])return t||new r(0);var i=UZIP.F,o=i._bitsF,a=i._bitsE,s=i._decodeTiny,f=i.makeCodes,l=i.codes2map,c=i._get17,u=i.U,h=null==t;h&&(t=new r(e.length>>>2<<3));for(var d,A,g=0,p=0,m=0,w=0,v=0,b=0,y=0,E=0,F=0;0==g;)if(g=o(e,F,1),p=o(e,F+1,2),F+=3,0!=p){if(h&&(t=UZIP.F._check(t,E+(1<<17))),1==p&&(d=u.flmap,A=u.fdmap,b=511,y=31),2==p){m=a(e,F,5)+257,w=a(e,F+5,5)+1,v=a(e,F+10,4)+4,F+=14;for(var _=0;_<38;_+=2)u.itree[_]=0,u.itree[_+1]=0;var B=1;for(_=0;_<v;_++){var U=a(e,F+3*_,3);u.itree[1+(u.ordr[_]<<1)]=U,U>B&&(B=U);}F+=3*v,f(u.itree,B),l(u.itree,B,u.imap),d=u.lmap,A=u.dmap,F=s(u.imap,(1<<B)-1,m+w,e,F,u.ttree);var C=i._copyOut(u.ttree,0,m,u.ltree);b=(1<<C)-1;var I=i._copyOut(u.ttree,m,w,u.dtree);y=(1<<I)-1,f(u.ltree,C),l(u.ltree,C,d),f(u.dtree,I),l(u.dtree,I,A);}for(;;){var Q=d[c(e,F)&b];F+=15&Q;var M=Q>>>4;if(M>>>8==0)t[E++]=M;else {if(256==M)break;var x=E+M-254;if(M>264){var S=u.ldef[M-257];x=E+(S>>>3)+a(e,F,7&S),F+=7&S;}var R=A[c(e,F)&y];F+=15&R;var T=R>>>4,O=u.ddef[T],P=(O>>>4)+o(e,F,15&O);for(F+=15&O,h&&(t=UZIP.F._check(t,E+(1<<17)));E<x;)t[E]=t[E++-P],t[E]=t[E++-P],t[E]=t[E++-P],t[E]=t[E++-P];E=x;}}}else {0!=(7&F)&&(F+=8-(7&F));var H=4+(F>>>3),L=e[H-4]|e[H-3]<<8;h&&(t=UZIP.F._check(t,E+L)),t.set(new r(e.buffer,e.byteOffset+H,L),E),F=H+L<<3,E+=L;}return t.length==E?t:t.slice(0,E)},UZIP.F._check=function(e,t){var r=e.length;if(t<=r)return e;var i=new Uint8Array(Math.max(r<<1,t));return i.set(e,0),i},UZIP.F._decodeTiny=function(e,t,r,i,o,a){for(var s=UZIP.F._bitsE,f=UZIP.F._get17,l=0;l<r;){var c=e[f(i,o)&t];o+=15&c;var u=c>>>4;if(u<=15)a[l]=u,l++;else {var h=0,d=0;16==u?(d=3+s(i,o,2),o+=2,h=a[l-1]):17==u?(d=3+s(i,o,3),o+=3):18==u&&(d=11+s(i,o,7),o+=7);for(var A=l+d;l<A;)a[l]=h,l++;}}return o},UZIP.F._copyOut=function(e,t,r,i){for(var o=0,a=0,s=i.length>>>1;a<r;){var f=e[a+t];i[a<<1]=0,i[1+(a<<1)]=f,f>o&&(o=f),a++;}for(;a<s;)i[a<<1]=0,i[1+(a<<1)]=0,a++;return o},UZIP.F.makeCodes=function(e,t){for(var r,i,o,a,s=UZIP.F.U,f=e.length,l=s.bl_count,c=0;c<=t;c++)l[c]=0;for(c=1;c<f;c+=2)l[e[c]]++;var u=s.next_code;for(r=0,l[0]=0,i=1;i<=t;i++)r=r+l[i-1]<<1,u[i]=r;for(o=0;o<f;o+=2)0!=(a=e[o+1])&&(e[o]=u[a],u[a]++);},UZIP.F.codes2map=function(e,t,r){for(var i=e.length,o=UZIP.F.U.rev15,a=0;a<i;a+=2)if(0!=e[a+1])for(var s=a>>1,f=e[a+1],l=s<<4|f,c=t-f,u=e[a]<<c,h=u+(1<<c);u!=h;){r[o[u]>>>15-t]=l,u++;}},UZIP.F.revCodes=function(e,t){for(var r=UZIP.F.U.rev15,i=15-t,o=0;o<e.length;o+=2){var a=e[o]<<t-e[o+1];e[o]=r[a]>>>i;}},UZIP.F._putsE=function(e,t,r){r<<=7&t;var i=t>>>3;e[i]|=r,e[i+1]|=r>>>8;},UZIP.F._putsF=function(e,t,r){r<<=7&t;var i=t>>>3;e[i]|=r,e[i+1]|=r>>>8,e[i+2]|=r>>>16;},UZIP.F._bitsE=function(e,t,r){return (e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<r)-1},UZIP.F._bitsF=function(e,t,r){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<r)-1},UZIP.F._get17=function(e,t){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},UZIP.F._get25=function(e,t){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},UZIP.F.U=(r=Uint16Array,i=Uint32Array,{next_code:new r(16),bl_count:new r(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[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],ldef:new r(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[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],ddef:new i(32),flmap:new r(512),fltree:[],fdmap:new r(32),fdtree:[],lmap:new r(32768),ltree:[],ttree:[],dmap:new r(32768),dtree:[],imap:new r(512),itree:[],rev15:new r(32768),lhst:new i(286),dhst:new i(30),ihst:new i(19),lits:new i(15e3),strt:new r(65536),prev:new r(32768)}),function(){for(var e=UZIP.F.U,t=0;t<32768;t++){var r=t;r=(4278255360&(r=(4042322160&(r=(3435973836&(r=(2863311530&r)>>>1|(1431655765&r)<<1))>>>2|(858993459&r)<<2))>>>4|(252645135&r)<<4))>>>8|(16711935&r)<<8,e.rev15[t]=(r>>>16|r<<16)>>>17;}function pushV(e,t,r){for(;0!=t--;)e.push(0,r);}for(t=0;t<32;t++)e.ldef[t]=e.of0[t]<<3|e.exb[t],e.ddef[t]=e.df0[t]<<4|e.dxb[t];pushV(e.fltree,144,8),pushV(e.fltree,112,9),pushV(e.fltree,24,7),pushV(e.fltree,8,8),UZIP.F.makeCodes(e.fltree,9),UZIP.F.codes2map(e.fltree,9,e.flmap),UZIP.F.revCodes(e.fltree,9),pushV(e.fdtree,32,5),UZIP.F.makeCodes(e.fdtree,5),UZIP.F.codes2map(e.fdtree,5,e.fdmap),UZIP.F.revCodes(e.fdtree,5),pushV(e.itree,19,0),pushV(e.ltree,286,0),pushV(e.dtree,30,0),pushV(e.ttree,320,0);}();}();var UZIP=_mergeNamespaces({__proto__:null,default:e},[e]);const UPNG=function(){var e={nextZero(e,t){for(;0!=e[t];)t++;return t},readUshort:(e,t)=>e[t]<<8|e[t+1],writeUshort(e,t,r){e[t]=r>>8&255,e[t+1]=255&r;},readUint:(e,t)=>16777216*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3]),writeUint(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r;},readASCII(e,t,r){let i="";for(let o=0;o<r;o++)i+=String.fromCharCode(e[t+o]);return i},writeASCII(e,t,r){for(let i=0;i<r.length;i++)e[t+i]=r.charCodeAt(i);},readBytes(e,t,r){const i=[];for(let o=0;o<r;o++)i.push(e[t+o]);return i},pad:e=>e.length<2?`0${e}`:e,readUTF8(t,r,i){let o,a="";for(let o=0;o<i;o++)a+=`%${e.pad(t[r+o].toString(16))}`;try{o=decodeURIComponent(a);}catch(o){return e.readASCII(t,r,i)}return o}};function decodeImage(t,r,i,o){const a=r*i,s=_getBPP(o),f=Math.ceil(r*s/8),l=new Uint8Array(4*a),c=new Uint32Array(l.buffer),{ctype:u}=o,{depth:h}=o,d=e.readUshort;if(6==u){const e=a<<2;if(8==h)for(var A=0;A<e;A+=4)l[A]=t[A],l[A+1]=t[A+1],l[A+2]=t[A+2],l[A+3]=t[A+3];if(16==h)for(A=0;A<e;A++)l[A]=t[A<<1];}else if(2==u){const e=o.tabs.tRNS;if(null==e){if(8==h)for(A=0;A<a;A++){var g=3*A;c[A]=255<<24|t[g+2]<<16|t[g+1]<<8|t[g];}if(16==h)for(A=0;A<a;A++){g=6*A;c[A]=255<<24|t[g+4]<<16|t[g+2]<<8|t[g];}}else {var p=e[0];const r=e[1],i=e[2];if(8==h)for(A=0;A<a;A++){var m=A<<2;g=3*A;c[A]=255<<24|t[g+2]<<16|t[g+1]<<8|t[g],t[g]==p&&t[g+1]==r&&t[g+2]==i&&(l[m+3]=0);}if(16==h)for(A=0;A<a;A++){m=A<<2,g=6*A;c[A]=255<<24|t[g+4]<<16|t[g+2]<<8|t[g],d(t,g)==p&&d(t,g+2)==r&&d(t,g+4)==i&&(l[m+3]=0);}}}else if(3==u){const e=o.tabs.PLTE,s=o.tabs.tRNS,c=s?s.length:0;if(1==h)for(var w=0;w<i;w++){var v=w*f,b=w*r;for(A=0;A<r;A++){m=b+A<<2;var y=3*(E=t[v+(A>>3)]>>7-((7&A)<<0)&1);l[m]=e[y],l[m+1]=e[y+1],l[m+2]=e[y+2],l[m+3]=E<c?s[E]:255;}}if(2==h)for(w=0;w<i;w++)for(v=w*f,b=w*r,A=0;A<r;A++){m=b+A<<2,y=3*(E=t[v+(A>>2)]>>6-((3&A)<<1)&3);l[m]=e[y],l[m+1]=e[y+1],l[m+2]=e[y+2],l[m+3]=E<c?s[E]:255;}if(4==h)for(w=0;w<i;w++)for(v=w*f,b=w*r,A=0;A<r;A++){m=b+A<<2,y=3*(E=t[v+(A>>1)]>>4-((1&A)<<2)&15);l[m]=e[y],l[m+1]=e[y+1],l[m+2]=e[y+2],l[m+3]=E<c?s[E]:255;}if(8==h)for(A=0;A<a;A++){var E;m=A<<2,y=3*(E=t[A]);l[m]=e[y],l[m+1]=e[y+1],l[m+2]=e[y+2],l[m+3]=E<c?s[E]:255;}}else if(4==u){if(8==h)for(A=0;A<a;A++){m=A<<2;var F=t[_=A<<1];l[m]=F,l[m+1]=F,l[m+2]=F,l[m+3]=t[_+1];}if(16==h)for(A=0;A<a;A++){var _;m=A<<2,F=t[_=A<<2];l[m]=F,l[m+1]=F,l[m+2]=F,l[m+3]=t[_+2];}}else if(0==u)for(p=o.tabs.tRNS?o.tabs.tRNS:-1,w=0;w<i;w++){const e=w*f,i=w*r;if(1==h)for(var B=0;B<r;B++){var U=(F=255*(t[e+(B>>>3)]>>>7-(7&B)&1))==255*p?0:255;c[i+B]=U<<24|F<<16|F<<8|F;}else if(2==h)for(B=0;B<r;B++){U=(F=85*(t[e+(B>>>2)]>>>6-((3&B)<<1)&3))==85*p?0:255;c[i+B]=U<<24|F<<16|F<<8|F;}else if(4==h)for(B=0;B<r;B++){U=(F=17*(t[e+(B>>>1)]>>>4-((1&B)<<2)&15))==17*p?0:255;c[i+B]=U<<24|F<<16|F<<8|F;}else if(8==h)for(B=0;B<r;B++){U=(F=t[e+B])==p?0:255;c[i+B]=U<<24|F<<16|F<<8|F;}else if(16==h)for(B=0;B<r;B++){F=t[e+(B<<1)],U=d(t,e+(B<<1))==p?0:255;c[i+B]=U<<24|F<<16|F<<8|F;}}return l}function _decompress(e,r,i,o){const a=_getBPP(e),s=Math.ceil(i*a/8),f=new Uint8Array((s+1+e.interlace)*o);return r=e.tabs.CgBI?t(r,f):_inflate(r,f),0==e.interlace?r=_filterZero(r,e,0,i,o):1==e.interlace&&(r=function _readInterlace(e,t){const r=t.width,i=t.height,o=_getBPP(t),a=o>>3,s=Math.ceil(r*o/8),f=new Uint8Array(i*s);let l=0;const c=[0,0,4,0,2,0,1],u=[0,4,0,2,0,1,0],h=[8,8,8,4,4,2,2],d=[8,8,4,4,2,2,1];let A=0;for(;A<7;){const p=h[A],m=d[A];let w=0,v=0,b=c[A];for(;b<i;)b+=p,v++;let y=u[A];for(;y<r;)y+=m,w++;const E=Math.ceil(w*o/8);_filterZero(e,t,l,w,v);let F=0,_=c[A];for(;_<i;){let t=u[A],i=l+F*E<<3;for(;t<r;){var g;if(1==o)g=(g=e[i>>3])>>7-(7&i)&1,f[_*s+(t>>3)]|=g<<7-((7&t)<<0);if(2==o)g=(g=e[i>>3])>>6-(7&i)&3,f[_*s+(t>>2)]|=g<<6-((3&t)<<1);if(4==o)g=(g=e[i>>3])>>4-(7&i)&15,f[_*s+(t>>1)]|=g<<4-((1&t)<<2);if(o>=8){const r=_*s+t*a;for(let t=0;t<a;t++)f[r+t]=e[(i>>3)+t];}i+=o,t+=m;}F++,_+=p;}w*v!=0&&(l+=v*(1+E)),A+=1;}return f}(r,e)),r}function _inflate(e,r){return t(new Uint8Array(e.buffer,2,e.length-6),r)}var t=function(){const e={H:{}};return e.H.N=function(t,r){const i=Uint8Array;let o,a,s=0,f=0,l=0,c=0,u=0,h=0,d=0,A=0,g=0;if(3==t[0]&&0==t[1])return r||new i(0);const p=e.H,m=p.b,w=p.e,v=p.R,b=p.n,y=p.A,E=p.Z,F=p.m,_=null==r;for(_&&(r=new i(t.length>>>2<<5));0==s;)if(s=m(t,g,1),f=m(t,g+1,2),g+=3,0!=f){if(_&&(r=e.H.W(r,A+(1<<17))),1==f&&(o=F.J,a=F.h,h=511,d=31),2==f){l=w(t,g,5)+257,c=w(t,g+5,5)+1,u=w(t,g+10,4)+4,g+=14;let e=1;for(var B=0;B<38;B+=2)F.Q[B]=0,F.Q[B+1]=0;for(B=0;B<u;B++){const r=w(t,g+3*B,3);F.Q[1+(F.X[B]<<1)]=r,r>e&&(e=r);}g+=3*u,b(F.Q,e),y(F.Q,e,F.u),o=F.w,a=F.d,g=v(F.u,(1<<e)-1,l+c,t,g,F.v);const r=p.V(F.v,0,l,F.C);h=(1<<r)-1;const i=p.V(F.v,l,c,F.D);d=(1<<i)-1,b(F.C,r),y(F.C,r,o),b(F.D,i),y(F.D,i,a);}for(;;){const e=o[E(t,g)&h];g+=15&e;const i=e>>>4;if(i>>>8==0)r[A++]=i;else {if(256==i)break;{let e=A+i-254;if(i>264){const r=F.q[i-257];e=A+(r>>>3)+w(t,g,7&r),g+=7&r;}const o=a[E(t,g)&d];g+=15&o;const s=o>>>4,f=F.c[s],l=(f>>>4)+m(t,g,15&f);for(g+=15&f;A<e;)r[A]=r[A++-l],r[A]=r[A++-l],r[A]=r[A++-l],r[A]=r[A++-l];A=e;}}}}else {0!=(7&g)&&(g+=8-(7&g));const o=4+(g>>>3),a=t[o-4]|t[o-3]<<8;_&&(r=e.H.W(r,A+a)),r.set(new i(t.buffer,t.byteOffset+o,a),A),g=o+a<<3,A+=a;}return r.length==A?r:r.slice(0,A)},e.H.W=function(e,t){const r=e.length;if(t<=r)return e;const i=new Uint8Array(r<<1);return i.set(e,0),i},e.H.R=function(t,r,i,o,a,s){const f=e.H.e,l=e.H.Z;let c=0;for(;c<i;){const e=t[l(o,a)&r];a+=15&e;const i=e>>>4;if(i<=15)s[c]=i,c++;else {let e=0,t=0;16==i?(t=3+f(o,a,2),a+=2,e=s[c-1]):17==i?(t=3+f(o,a,3),a+=3):18==i&&(t=11+f(o,a,7),a+=7);const r=c+t;for(;c<r;)s[c]=e,c++;}}return a},e.H.V=function(e,t,r,i){let o=0,a=0;const s=i.length>>>1;for(;a<r;){const r=e[a+t];i[a<<1]=0,i[1+(a<<1)]=r,r>o&&(o=r),a++;}for(;a<s;)i[a<<1]=0,i[1+(a<<1)]=0,a++;return o},e.H.n=function(t,r){const i=e.H.m,o=t.length;let a,s,f;let l;const c=i.j;for(var u=0;u<=r;u++)c[u]=0;for(u=1;u<o;u+=2)c[t[u]]++;const h=i.K;for(a=0,c[0]=0,s=1;s<=r;s++)a=a+c[s-1]<<1,h[s]=a;for(f=0;f<o;f+=2)l=t[f+1],0!=l&&(t[f]=h[l],h[l]++);},e.H.A=function(t,r,i){const o=t.length,a=e.H.m.r;for(let e=0;e<o;e+=2)if(0!=t[e+1]){const o=e>>1,s=t[e+1],f=o<<4|s,l=r-s;let c=t[e]<<l;const u=c+(1<<l);for(;c!=u;){i[a[c]>>>15-r]=f,c++;}}},e.H.l=function(t,r){const i=e.H.m.r,o=15-r;for(let e=0;e<t.length;e+=2){const a=t[e]<<r-t[e+1];t[e]=i[a]>>>o;}},e.H.M=function(e,t,r){r<<=7&t;const i=t>>>3;e[i]|=r,e[i+1]|=r>>>8;},e.H.I=function(e,t,r){r<<=7&t;const i=t>>>3;e[i]|=r,e[i+1]|=r>>>8,e[i+2]|=r>>>16;},e.H.e=function(e,t,r){return (e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<r)-1},e.H.b=function(e,t,r){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<r)-1},e.H.Z=function(e,t){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},e.H.i=function(e,t){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},e.H.m=function(){const e=Uint16Array,t=Uint32Array;return {K:new e(16),j:new e(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[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],q:new e(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[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],c:new t(32),J:new e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new t(286),Y:new t(30),a:new t(19),t:new t(15e3),k:new e(65536),g:new e(32768)}}(),function(){const t=e.H.m;for(var r=0;r<32768;r++){let e=r;e=(2863311530&e)>>>1|(1431655765&e)<<1,e=(3435973836&e)>>>2|(858993459&e)<<2,e=(4042322160&e)>>>4|(252645135&e)<<4,e=(4278255360&e)>>>8|(16711935&e)<<8,t.r[r]=(e>>>16|e<<16)>>>17;}function n(e,t,r){for(;0!=t--;)e.push(0,r);}for(r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];n(t._,144,8),n(t._,112,9),n(t._,24,7),n(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),n(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),n(t.Q,19,0),n(t.C,286,0),n(t.D,30,0),n(t.v,320,0);}(),e.H.N}();function _getBPP(e){return [1,null,3,1,2,null,4][e.ctype]*e.depth}function _filterZero(e,t,r,i,o){let a=_getBPP(t);const s=Math.ceil(i*a/8);let f,l;a=Math.ceil(a/8);let c=e[r],u=0;if(c>1&&(e[r]=[0,0,1][c-2]),3==c)for(u=a;u<s;u++)e[u+1]=e[u+1]+(e[u+1-a]>>>1)&255;for(let t=0;t<o;t++)if(f=r+t*s,l=f+t+1,c=e[l-1],u=0,0==c)for(;u<s;u++)e[f+u]=e[l+u];else if(1==c){for(;u<a;u++)e[f+u]=e[l+u];for(;u<s;u++)e[f+u]=e[l+u]+e[f+u-a];}else if(2==c)for(;u<s;u++)e[f+u]=e[l+u]+e[f+u-s];else if(3==c){for(;u<a;u++)e[f+u]=e[l+u]+(e[f+u-s]>>>1);for(;u<s;u++)e[f+u]=e[l+u]+(e[f+u-s]+e[f+u-a]>>>1);}else {for(;u<a;u++)e[f+u]=e[l+u]+_paeth(0,e[f+u-s],0);for(;u<s;u++)e[f+u]=e[l+u]+_paeth(e[f+u-a],e[f+u-s],e[f+u-a-s]);}return e}function _paeth(e,t,r){const i=e+t-r,o=i-e,a=i-t,s=i-r;return o*o<=a*a&&o*o<=s*s?e:a*a<=s*s?t:r}function _IHDR(t,r,i){i.width=e.readUint(t,r),r+=4,i.height=e.readUint(t,r),r+=4,i.depth=t[r],r++,i.ctype=t[r],r++,i.compress=t[r],r++,i.filter=t[r],r++,i.interlace=t[r],r++;}function _copyTile(e,t,r,i,o,a,s,f,l){const c=Math.min(t,o),u=Math.min(r,a);let h=0,d=0;for(let r=0;r<u;r++)for(let a=0;a<c;a++)if(s>=0&&f>=0?(h=r*t+a<<2,d=(f+r)*o+s+a<<2):(h=(-f+r)*t-s+a<<2,d=r*o+a<<2),0==l)i[d]=e[h],i[d+1]=e[h+1],i[d+2]=e[h+2],i[d+3]=e[h+3];else if(1==l){var A=e[h+3]*(1/255),g=e[h]*A,p=e[h+1]*A,m=e[h+2]*A,w=i[d+3]*(1/255),v=i[d]*w,b=i[d+1]*w,y=i[d+2]*w;const t=1-A,r=A+w*t,o=0==r?0:1/r;i[d+3]=255*r,i[d+0]=(g+v*t)*o,i[d+1]=(p+b*t)*o,i[d+2]=(m+y*t)*o;}else if(2==l){A=e[h+3],g=e[h],p=e[h+1],m=e[h+2],w=i[d+3],v=i[d],b=i[d+1],y=i[d+2];A==w&&g==v&&p==b&&m==y?(i[d]=0,i[d+1]=0,i[d+2]=0,i[d+3]=0):(i[d]=g,i[d+1]=p,i[d+2]=m,i[d+3]=A);}else if(3==l){A=e[h+3],g=e[h],p=e[h+1],m=e[h+2],w=i[d+3],v=i[d],b=i[d+1],y=i[d+2];if(A==w&&g==v&&p==b&&m==y)continue;if(A<220&&w>20)return false}return true}return {decode:function decode(r){const i=new Uint8Array(r);let o=8;const a=e,s=a.readUshort,f=a.readUint,l={tabs:{},frames:[]},c=new Uint8Array(i.length);let u,h=0,d=0;const A=[137,80,78,71,13,10,26,10];for(var g=0;g<8;g++)if(i[g]!=A[g])throw "The input is not a PNG file!";for(;o<i.length;){const e=a.readUint(i,o);o+=4;const r=a.readASCII(i,o,4);if(o+=4,"IHDR"==r)_IHDR(i,o,l);else if("iCCP"==r){for(var p=o;0!=i[p];)p++;a.readASCII(i,o,p-o),i[p+1];const s=i.slice(p+2,o+e);let f=null;try{f=_inflate(s);}catch(e){f=t(s);}l.tabs[r]=f;}else if("CgBI"==r)l.tabs[r]=i.slice(o,o+4);else if("IDAT"==r){for(g=0;g<e;g++)c[h+g]=i[o+g];h+=e;}else if("acTL"==r)l.tabs[r]={num_frames:f(i,o),num_plays:f(i,o+4)},u=new Uint8Array(i.length);else if("fcTL"==r){if(0!=d)(E=l.frames[l.frames.length-1]).data=_decompress(l,u.slice(0,d),E.rect.width,E.rect.height),d=0;const e={x:f(i,o+12),y:f(i,o+16),width:f(i,o+4),height:f(i,o+8)};let t=s(i,o+22);t=s(i,o+20)/(0==t?100:t);const r={rect:e,delay:Math.round(1e3*t),dispose:i[o+24],blend:i[o+25]};l.frames.push(r);}else if("fdAT"==r){for(g=0;g<e-4;g++)u[d+g]=i[o+g+4];d+=e-4;}else if("pHYs"==r)l.tabs[r]=[a.readUint(i,o),a.readUint(i,o+4),i[o+8]];else if("cHRM"==r){l.tabs[r]=[];for(g=0;g<8;g++)l.tabs[r].push(a.readUint(i,o+4*g));}else if("tEXt"==r||"zTXt"==r){null==l.tabs[r]&&(l.tabs[r]={});var m=a.nextZero(i,o),w=a.readASCII(i,o,m-o),v=o+e-m-1;if("tEXt"==r)y=a.readASCII(i,m+1,v);else {var b=_inflate(i.slice(m+2,m+2+v));y=a.readUTF8(b,0,b.length);}l.tabs[r][w]=y;}else if("iTXt"==r){null==l.tabs[r]&&(l.tabs[r]={});m=0,p=o;m=a.nextZero(i,p);w=a.readASCII(i,p,m-p);const t=i[p=m+1];var y;i[p+1],p+=2,m=a.nextZero(i,p),a.readASCII(i,p,m-p),p=m+1,m=a.nextZero(i,p),a.readUTF8(i,p,m-p);v=e-((p=m+1)-o);if(0==t)y=a.readUTF8(i,p,v);else {b=_inflate(i.slice(p,p+v));y=a.readUTF8(b,0,b.length);}l.tabs[r][w]=y;}else if("PLTE"==r)l.tabs[r]=a.readBytes(i,o,e);else if("hIST"==r){const e=l.tabs.PLTE.length/3;l.tabs[r]=[];for(g=0;g<e;g++)l.tabs[r].push(s(i,o+2*g));}else if("tRNS"==r)3==l.ctype?l.tabs[r]=a.readBytes(i,o,e):0==l.ctype?l.tabs[r]=s(i,o):2==l.ctype&&(l.tabs[r]=[s(i,o),s(i,o+2),s(i,o+4)]);else if("gAMA"==r)l.tabs[r]=a.readUint(i,o)/1e5;else if("sRGB"==r)l.tabs[r]=i[o];else if("bKGD"==r)0==l.ctype||4==l.ctype?l.tabs[r]=[s(i,o)]:2==l.ctype||6==l.ctype?l.tabs[r]=[s(i,o),s(i,o+2),s(i,o+4)]:3==l.ctype&&(l.tabs[r]=i[o]);else if("IEND"==r)break;o+=e,a.readUint(i,o),o+=4;}var E;return 0!=d&&((E=l.frames[l.frames.length-1]).data=_decompress(l,u.slice(0,d),E.rect.width,E.rect.height)),l.data=_decompress(l,c,l.width,l.height),delete l.compress,delete l.interlace,delete l.filter,l},toRGBA8:function toRGBA8(e){const t=e.width,r=e.height;if(null==e.tabs.acTL)return [decodeImage(e.data,t,r,e).buffer];const i=[];null==e.frames[0].data&&(e.frames[0].data=e.data);const o=t*r*4,a=new Uint8Array(o),s=new Uint8Array(o),f=new Uint8Array(o);for(let c=0;c<e.frames.length;c++){const u=e.frames[c],h=u.rect.x,d=u.rect.y,A=u.rect.width,g=u.rect.height,p=decodeImage(u.data,A,g,e);if(0!=c)for(var l=0;l<o;l++)f[l]=a[l];if(0==u.blend?_copyTile(p,A,g,a,t,r,h,d,0):1==u.blend&&_copyTile(p,A,g,a,t,r,h,d,1),i.push(a.buffer.slice(0)),0==u.dispose);else if(1==u.dispose)_copyTile(s,A,g,a,t,r,h,d,0);else if(2==u.dispose)for(l=0;l<o;l++)a[l]=f[l];}return i},_paeth:_paeth,_copyTile:_copyTile,_bin:e}}();!function(){const{_copyTile:e}=UPNG,{_bin:t}=UPNG,r=UPNG._paeth;var i={table:function(){const e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t;for(let e=0;e<8;e++)1&r?r=3988292384^r>>>1:r>>>=1;e[t]=r;}return e}(),update(e,t,r,o){for(let a=0;a<o;a++)e=i.table[255&(e^t[r+a])]^e>>>8;return e},crc:(e,t,r)=>4294967295^i.update(4294967295,e,t,r)};function addErr(e,t,r,i){t[r]+=e[0]*i>>4,t[r+1]+=e[1]*i>>4,t[r+2]+=e[2]*i>>4,t[r+3]+=e[3]*i>>4;}function N(e){return Math.max(0,Math.min(255,e))}function D(e,t){const r=e[0]-t[0],i=e[1]-t[1],o=e[2]-t[2],a=e[3]-t[3];return r*r+i*i+o*o+a*a}function dither(e,t,r,i,o,a,s){null==s&&(s=1);const f=i.length,l=[];for(var c=0;c<f;c++){const e=i[c];l.push([e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255]);}for(c=0;c<f;c++){let e=4294967295;for(var u=0,h=0;h<f;h++){var d=D(l[c],l[h]);h!=c&&d<e&&(e=d,u=h);}}const A=new Uint32Array(o.buffer),g=new Int16Array(t*r*4),p=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(c=0;c<p.length;c++)p[c]=255*((p[c]+.5)/16-.5);for(let o=0;o<r;o++)for(let w=0;w<t;w++){var m;c=4*(o*t+w);if(2!=s)m=[N(e[c]+g[c]),N(e[c+1]+g[c+1]),N(e[c+2]+g[c+2]),N(e[c+3]+g[c+3])];else {d=p[4*(3&o)+(3&w)];m=[N(e[c]+d),N(e[c+1]+d),N(e[c+2]+d),N(e[c+3]+d)];}u=0;let v=16777215;for(h=0;h<f;h++){const e=D(m,l[h]);e<v&&(v=e,u=h);}const b=l[u],y=[m[0]-b[0],m[1]-b[1],m[2]-b[2],m[3]-b[3]];1==s&&(w!=t-1&&addErr(y,g,c+4,7),o!=r-1&&(0!=w&&addErr(y,g,c+4*t-4,3),addErr(y,g,c+4*t,5),w!=t-1&&addErr(y,g,c+4*t+4,1))),a[c>>2]=u,A[c>>2]=i[u];}}function _main(e,r,o,a,s){null==s&&(s={});const{crc:f}=i,l=t.writeUint,c=t.writeUshort,u=t.writeASCII;let h=8;const d=e.frames.length>1;let A,g=false,p=33+(d?20:0);if(null!=s.sRGB&&(p+=13),null!=s.pHYs&&(p+=21),null!=s.iCCP&&(A=pako.deflate(s.iCCP),p+=21+A.length+4),3==e.ctype){for(var m=e.plte.length,w=0;w<m;w++)e.plte[w]>>>24!=255&&(g=true);p+=8+3*m+4+(g?8+1*m+4:0);}for(var v=0;v<e.frames.length;v++){d&&(p+=38),p+=(F=e.frames[v]).cimg.length+12,0!=v&&(p+=4);}p+=12;const b=new Uint8Array(p),y=[137,80,78,71,13,10,26,10];for(w=0;w<8;w++)b[w]=y[w];if(l(b,h,13),h+=4,u(b,h,"IHDR"),h+=4,l(b,h,r),h+=4,l(b,h,o),h+=4,b[h]=e.depth,h++,b[h]=e.ctype,h++,b[h]=0,h++,b[h]=0,h++,b[h]=0,h++,l(b,h,f(b,h-17,17)),h+=4,null!=s.sRGB&&(l(b,h,1),h+=4,u(b,h,"sRGB"),h+=4,b[h]=s.sRGB,h++,l(b,h,f(b,h-5,5)),h+=4),null!=s.iCCP){const e=13+A.length;l(b,h,e),h+=4,u(b,h,"iCCP"),h+=4,u(b,h,"ICC profile"),h+=11,h+=2,b.set(A,h),h+=A.length,l(b,h,f(b,h-(e+4),e+4)),h+=4;}if(null!=s.pHYs&&(l(b,h,9),h+=4,u(b,h,"pHYs"),h+=4,l(b,h,s.pHYs[0]),h+=4,l(b,h,s.pHYs[1]),h+=4,b[h]=s.pHYs[2],h++,l(b,h,f(b,h-13,13)),h+=4),d&&(l(b,h,8),h+=4,u(b,h,"acTL"),h+=4,l(b,h,e.frames.length),h+=4,l(b,h,null!=s.loop?s.loop:0),h+=4,l(b,h,f(b,h-12,12)),h+=4),3==e.ctype){l(b,h,3*(m=e.plte.length)),h+=4,u(b,h,"PLTE"),h+=4;for(w=0;w<m;w++){const t=3*w,r=e.plte[w],i=255&r,o=r>>>8&255,a=r>>>16&255;b[h+t+0]=i,b[h+t+1]=o,b[h+t+2]=a;}if(h+=3*m,l(b,h,f(b,h-3*m-4,3*m+4)),h+=4,g){l(b,h,m),h+=4,u(b,h,"tRNS"),h+=4;for(w=0;w<m;w++)b[h+w]=e.plte[w]>>>24&255;h+=m,l(b,h,f(b,h-m-4,m+4)),h+=4;}}let E=0;for(v=0;v<e.frames.length;v++){var F=e.frames[v];d&&(l(b,h,26),h+=4,u(b,h,"fcTL"),h+=4,l(b,h,E++),h+=4,l(b,h,F.rect.width),h+=4,l(b,h,F.rect.height),h+=4,l(b,h,F.rect.x),h+=4,l(b,h,F.rect.y),h+=4,c(b,h,a[v]),h+=2,c(b,h,1e3),h+=2,b[h]=F.dispose,h++,b[h]=F.blend,h++,l(b,h,f(b,h-30,30)),h+=4);const t=F.cimg;l(b,h,(m=t.length)+(0==v?0:4)),h+=4;const r=h;u(b,h,0==v?"IDAT":"fdAT"),h+=4,0!=v&&(l(b,h,E++),h+=4),b.set(t,h),h+=m,l(b,h,f(b,r,h-r)),h+=4;}return l(b,h,0),h+=4,u(b,h,"IEND"),h+=4,l(b,h,f(b,h-4,4)),h+=4,b.buffer}function compressPNG(e,t,r){for(let i=0;i<e.frames.length;i++){const o=e.frames[i];o.rect.width;const a=o.rect.height,s=new Uint8Array(a*o.bpl+a);o.cimg=_filterZero(o.img,a,o.bpp,o.bpl,s,t,r);}}function compress(t,r,i,o,a){const s=a[0],f=a[1],l=a[2],c=a[3],u=a[4],h=a[5];let d=6,A=8,g=255;for(var p=0;p<t.length;p++){const e=new Uint8Array(t[p]);for(var m=e.length,w=0;w<m;w+=4)g&=e[w+3];}const v=255!=g,b=function framize(t,r,i,o,a,s){const f=[];for(var l=0;l<t.length;l++){const h=new Uint8Array(t[l]),A=new Uint32Array(h.buffer);var c;let g=0,p=0,m=r,w=i,v=o?1:0;if(0!=l){const b=s||o||1==l||0!=f[l-2].dispose?1:2;let y=0,E=1e9;for(let e=0;e<b;e++){var u=new Uint8Array(t[l-1-e]);const o=new Uint32Array(t[l-1-e]);let s=r,f=i,c=-1,h=-1;for(let e=0;e<i;e++)for(let t=0;t<r;t++){A[d=e*r+t]!=o[d]&&(t<s&&(s=t),t>c&&(c=t),e<f&&(f=e),e>h&&(h=e));} -1==c&&(s=f=c=h=0),a&&(1==(1&s)&&s--,1==(1&f)&&f--);const v=(c-s+1)*(h-f+1);v<E&&(E=v,y=e,g=s,p=f,m=c-s+1,w=h-f+1);}u=new Uint8Array(t[l-1-y]);1==y&&(f[l-1].dispose=2),c=new Uint8Array(m*w*4),e(u,r,i,c,m,w,-g,-p,0),v=e(h,r,i,c,m,w,-g,-p,3)?1:0,1==v?_prepareDiff(h,r,i,c,{x:g,y:p,width:m,height:w}):e(h,r,i,c,m,w,-g,-p,0);}else c=h.slice(0);f.push({rect:{x:g,y:p,width:m,height:w},img:c,blend:v,dispose:0});}if(o)for(l=0;l<f.length;l++){if(1==(A=f[l]).blend)continue;const e=A.rect,o=f[l-1].rect,s=Math.min(e.x,o.x),c=Math.min(e.y,o.y),u={x:s,y:c,width:Math.max(e.x+e.width,o.x+o.width)-s,height:Math.max(e.y+e.height,o.y+o.height)-c};f[l-1].dispose=1,l-1!=0&&_updateFrame(t,r,i,f,l-1,u,a),_updateFrame(t,r,i,f,l,u,a);}let h=0;if(1!=t.length)for(var d=0;d<f.length;d++){var A;h+=(A=f[d]).rect.width*A.rect.height;}return f}(t,r,i,s,f,l),y={},E=[],F=[];if(0!=o){const e=[];for(w=0;w<b.length;w++)e.push(b[w].img.buffer);const t=function concatRGBA(e){let t=0;for(var r=0;r<e.length;r++)t+=e[r].byteLength;const i=new Uint8Array(t);let o=0;for(r=0;r<e.length;r++){const t=new Uint8Array(e[r]),a=t.length;for(let e=0;e<a;e+=4){let r=t[e],a=t[e+1],s=t[e+2];const f=t[e+3];0==f&&(r=a=s=0),i[o+e]=r,i[o+e+1]=a,i[o+e+2]=s,i[o+e+3]=f;}o+=a;}return i.buffer}(e),r=quantize(t,o);for(w=0;w<r.plte.length;w++)E.push(r.plte[w].est.rgba);let i=0;for(w=0;w<b.length;w++){const e=(B=b[w]).img.length;var _=new Uint8Array(r.inds.buffer,i>>2,e>>2);F.push(_);const t=new Uint8Array(r.abuf,i,e);h&&dither(B.img,B.rect.width,B.rect.height,E,t,_),B.img.set(t),i+=e;}}else for(p=0;p<b.length;p++){var B=b[p];const e=new Uint32Array(B.img.buffer);var U=B.rect.width;m=e.length,_=new Uint8Array(m);F.push(_);for(w=0;w<m;w++){const t=e[w];if(0!=w&&t==e[w-1])_[w]=_[w-1];else if(w>U&&t==e[w-U])_[w]=_[w-U];else {let e=y[t];if(null==e&&(y[t]=e=E.length,E.push(t),E.length>=300))break;_[w]=e;}}}const C=E.length;C<=256&&0==u&&(A=C<=2?1:C<=4?2:C<=16?4:8,A=Math.max(A,c));for(p=0;p<b.length;p++){(B=b[p]).rect.x,B.rect.y;U=B.rect.width;const e=B.rect.height;let t=B.img;new Uint32Array(t.buffer);let r=4*U,i=4;if(C<=256&&0==u){r=Math.ceil(A*U/8);var I=new Uint8Array(r*e);const o=F[p];for(let t=0;t<e;t++){w=t*r;const e=t*U;if(8==A)for(var Q=0;Q<U;Q++)I[w+Q]=o[e+Q];else if(4==A)for(Q=0;Q<U;Q++)I[w+(Q>>1)]|=o[e+Q]<<4-4*(1&Q);else if(2==A)for(Q=0;Q<U;Q++)I[w+(Q>>2)]|=o[e+Q]<<6-2*(3&Q);else if(1==A)for(Q=0;Q<U;Q++)I[w+(Q>>3)]|=o[e+Q]<<7-1*(7&Q);}t=I,d=3,i=1;}else if(0==v&&1==b.length){I=new Uint8Array(U*e*3);const o=U*e;for(w=0;w<o;w++){const e=3*w,r=4*w;I[e]=t[r],I[e+1]=t[r+1],I[e+2]=t[r+2];}t=I,d=2,i=3,r=3*U;}B.img=t,B.bpl=r,B.bpp=i;}return {ctype:d,depth:A,plte:E,frames:b}}function _updateFrame(t,r,i,o,a,s,f){const l=Uint8Array,c=Uint32Array,u=new l(t[a-1]),h=new c(t[a-1]),d=a+1<t.length?new l(t[a+1]):null,A=new l(t[a]),g=new c(A.buffer);let p=r,m=i,w=-1,v=-1;for(let e=0;e<s.height;e++)for(let t=0;t<s.width;t++){const i=s.x+t,f=s.y+e,l=f*r+i,c=g[l];0==c||0==o[a-1].dispose&&h[l]==c&&(null==d||0!=d[4*l+3])||(i<p&&(p=i),i>w&&(w=i),f<m&&(m=f),f>v&&(v=f));} -1==w&&(p=m=w=v=0),f&&(1==(1&p)&&p--,1==(1&m)&&m--),s={x:p,y:m,width:w-p+1,height:v-m+1};const b=o[a];b.rect=s,b.blend=1,b.img=new Uint8Array(s.width*s.height*4),0==o[a-1].dispose?(e(u,r,i,b.img,s.width,s.height,-s.x,-s.y,0),_prepareDiff(A,r,i,b.img,s)):e(A,r,i,b.img,s.width,s.height,-s.x,-s.y,0);}function _prepareDiff(t,r,i,o,a){e(t,r,i,o,a.width,a.height,-a.x,-a.y,2);}function _filterZero(e,t,r,i,o,a,s){const f=[];let l,c=[0,1,2,3,4];-1!=a?c=[a]:(t*i>5e5||1==r)&&(c=[0]),s&&(l={level:0});const u=UZIP;for(var h=0;h<c.length;h++){for(let a=0;a<t;a++)_filterLine(o,e,a,i,r,c[h]);f.push(u.deflate(o,l));}let d,A=1e9;for(h=0;h<f.length;h++)f[h].length<A&&(d=h,A=f[h].length);return f[d]}function _filterLine(e,t,i,o,a,s){const f=i*o;let l=f+i;if(e[l]=s,l++,0==s)if(o<500)for(var c=0;c<o;c++)e[l+c]=t[f+c];else e.set(new Uint8Array(t.buffer,f,o),l);else if(1==s){for(c=0;c<a;c++)e[l+c]=t[f+c];for(c=a;c<o;c++)e[l+c]=t[f+c]-t[f+c-a]+256&255;}else if(0==i){for(c=0;c<a;c++)e[l+c]=t[f+c];if(2==s)for(c=a;c<o;c++)e[l+c]=t[f+c];if(3==s)for(c=a;c<o;c++)e[l+c]=t[f+c]-(t[f+c-a]>>1)+256&255;if(4==s)for(c=a;c<o;c++)e[l+c]=t[f+c]-r(t[f+c-a],0,0)+256&255;}else {if(2==s)for(c=0;c<o;c++)e[l+c]=t[f+c]+256-t[f+c-o]&255;if(3==s){for(c=0;c<a;c++)e[l+c]=t[f+c]+256-(t[f+c-o]>>1)&255;for(c=a;c<o;c++)e[l+c]=t[f+c]+256-(t[f+c-o]+t[f+c-a]>>1)&255;}if(4==s){for(c=0;c<a;c++)e[l+c]=t[f+c]+256-r(0,t[f+c-o],0)&255;for(c=a;c<o;c++)e[l+c]=t[f+c]+256-r(t[f+c-a],t[f+c-o],t[f+c-a-o])&255;}}}function quantize(e,t){const r=new Uint8Array(e),i=r.slice(0),o=new Uint32Array(i.buffer),a=getKDtree(i,t),s=a[0],f=a[1],l=r.length,c=new Uint8Array(l>>2);let u;if(r.length<2e7)for(var h=0;h<l;h+=4){u=getNearest(s,d=r[h]*(1/255),A=r[h+1]*(1/255),g=r[h+2]*(1/255),p=r[h+3]*(1/255)),c[h>>2]=u.ind,o[h>>2]=u.est.rgba;}else for(h=0;h<l;h+=4){var d=r[h]*(1/255),A=r[h+1]*(1/255),g=r[h+2]*(1/255),p=r[h+3]*(1/255);for(u=s;u.left;)u=planeDst(u.est,d,A,g,p)<=0?u.left:u.right;c[h>>2]=u.ind,o[h>>2]=u.est.rgba;}return {abuf:i.buffer,inds:c,plte:f}}function getKDtree(e,t,r){null==r&&(r=1e-4);const i=new Uint32Array(e.buffer),o={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};o.bst=stats(e,o.i0,o.i1),o.est=estats(o.bst);const a=[o];for(;a.length<t;){let t=0,o=0;for(var s=0;s<a.length;s++)a[s].est.L>t&&(t=a[s].est.L,o=s);if(t<r)break;const f=a[o],l=splitPixels(e,i,f.i0,f.i1,f.est.e,f.est.eMq255);if(f.i0>=l||f.i1<=l){f.est.L=0;continue}const c={i0:f.i0,i1:l,bst:null,est:null,tdst:0,left:null,right:null};c.bst=stats(e,c.i0,c.i1),c.est=estats(c.bst);const u={i0:l,i1:f.i1,bst:null,est:null,tdst:0,left:null,right:null};u.bst={R:[],m:[],N:f.bst.N-c.bst.N};for(s=0;s<16;s++)u.bst.R[s]=f.bst.R[s]-c.bst.R[s];for(s=0;s<4;s++)u.bst.m[s]=f.bst.m[s]-c.bst.m[s];u.est=estats(u.bst),f.left=c,f.right=u,a[o]=c,a.push(u);}a.sort(((e,t)=>t.bst.N-e.bst.N));for(s=0;s<a.length;s++)a[s].ind=s;return [o,a]}function getNearest(e,t,r,i,o){if(null==e.left)return e.tdst=function dist(e,t,r,i,o){const a=t-e[0],s=r-e[1],f=i-e[2],l=o-e[3];return a*a+s*s+f*f+l*l}(e.est.q,t,r,i,o),e;const a=planeDst(e.est,t,r,i,o);let s=e.left,f=e.right;a>0&&(s=e.right,f=e.left);const l=getNearest(s,t,r,i,o);if(l.tdst<=a*a)return l;const c=getNearest(f,t,r,i,o);return c.tdst<l.tdst?c:l}function planeDst(e,t,r,i,o){const{e:a}=e;return a[0]*t+a[1]*r+a[2]*i+a[3]*o-e.eMq}function splitPixels(e,t,r,i,o,a){for(i-=4;r<i;){for(;vecDot(e,r,o)<=a;)r+=4;for(;vecDot(e,i,o)>a;)i-=4;if(r>=i)break;const s=t[r>>2];t[r>>2]=t[i>>2],t[i>>2]=s,r+=4,i-=4;}for(;vecDot(e,r,o)>a;)r-=4;return r+4}function vecDot(e,t,r){return e[t]*r[0]+e[t+1]*r[1]+e[t+2]*r[2]+e[t+3]*r[3]}function stats(e,t,r){const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=[0,0,0,0],a=r-t>>2;for(let a=t;a<r;a+=4){const t=e[a]*(1/255),r=e[a+1]*(1/255),s=e[a+2]*(1/255),f=e[a+3]*(1/255);o[0]+=t,o[1]+=r,o[2]+=s,o[3]+=f,i[0]+=t*t,i[1]+=t*r,i[2]+=t*s,i[3]+=t*f,i[5]+=r*r,i[6]+=r*s,i[7]+=r*f,i[10]+=s*s,i[11]+=s*f,i[15]+=f*f;}return i[4]=i[1],i[8]=i[2],i[9]=i[6],i[12]=i[3],i[13]=i[7],i[14]=i[11],{R:i,m:o,N:a}}function estats(e){const{R:t}=e,{m:r}=e,{N:i}=e,a=r[0],s=r[1],f=r[2],l=r[3],c=0==i?0:1/i,u=[t[0]-a*a*c,t[1]-a*s*c,t[2]-a*f*c,t[3]-a*l*c,t[4]-s*a*c,t[5]-s*s*c,t[6]-s*f*c,t[7]-s*l*c,t[8]-f*a*c,t[9]-f*s*c,t[10]-f*f*c,t[11]-f*l*c,t[12]-l*a*c,t[13]-l*s*c,t[14]-l*f*c,t[15]-l*l*c],h=u,d=o;let A=[Math.random(),Math.random(),Math.random(),Math.random()],g=0,p=0;if(0!=i)for(let e=0;e<16&&(A=d.multVec(h,A),p=Math.sqrt(d.dot(A,A)),A=d.sml(1/p,A),!(0!=e&&Math.abs(p-g)<1e-9));e++)g=p;const m=[a*c,s*c,f*c,l*c];return {Cov:u,q:m,e:A,L:g,eMq255:d.dot(d.sml(255,m),A),eMq:d.dot(A,m),rgba:(Math.round(255*m[3])<<24|Math.round(255*m[2])<<16|Math.round(255*m[1])<<8|Math.round(255*m[0])<<0)>>>0}}var o={multVec:(e,t)=>[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]],dot:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],sml:(e,t)=>[e*t[0],e*t[1],e*t[2],e*t[3]]};UPNG.encode=function encode(e,t,r,i,o,a,s){null==i&&(i=0),null==s&&(s=false);const f=compress(e,t,r,i,[false,false,false,0,s,false]);return compressPNG(f,-1),_main(f,t,r,o,a)},UPNG.encodeLL=function encodeLL(e,t,r,i,o,a,s,f){const l={ctype:0+(1==i?0:2)+(0==o?0:4),depth:a,frames:[]},c=(i+o)*a,u=c*t;for(let i=0;i<e.length;i++)l.frames.push({rect:{x:0,y:0,width:t,height:r},img:new Uint8Array(e[i]),blend:0,dispose:1,bpp:Math.ceil(c/8),bpl:Math.ceil(u/8)});return compressPNG(l,0,true),_main(l,t,r,s,f)},UPNG.encode.compress=compress,UPNG.encode.dither=dither,UPNG.quantize=quantize,UPNG.quantize.getKDtree=getKDtree,UPNG.quantize.getNearest=getNearest;}();const r={toArrayBuffer(e,t){const i=e.width,o=e.height,a=i<<2,s=e.getContext("2d").getImageData(0,0,i,o),f=new Uint32Array(s.data.buffer),l=(32*i+31)/32<<2,c=l*o,u=122+c,h=new ArrayBuffer(u),d=new DataView(h),A=1<<20;let g,p,m,w,v=A,b=0,y=0,E=0;function set16(e){d.setUint16(y,e,true),y+=2;}function set32(e){d.setUint32(y,e,true),y+=4;}function seek(e){y+=e;}set16(19778),set32(u),seek(4),set32(122),set32(108),set32(i),set32(-o>>>0),set16(1),set16(32),set32(3),set32(c),set32(2835),set32(2835),seek(8),set32(16711680),set32(65280),set32(255),set32(4278190080),set32(1466527264),function convert(){for(;b<o&&v>0;){for(w=122+b*l,g=0;g<a;)v--,p=f[E++],m=p>>>24,d.setUint32(w+g,p<<8|m),g+=4;b++;}E<f.length?(v=A,setTimeout(convert,r._dly)):t(h);}();},toBlob(e,t){this.toArrayBuffer(e,(e=>{t(new Blob([e],{type:"image/bmp"}));}));},_dly:9};var i$1={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},o={[i$1.CHROME]:16384,[i$1.FIREFOX]:11180,[i$1.DESKTOP_SAFARI]:16384,[i$1.IE]:8192,[i$1.IOS]:4096,[i$1.ETC]:8192};const a="undefined"!=typeof window,s="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,f=a&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),CustomFile=(a||s)&&(f&&f.getOriginalSymbol(window,"File")||"undefined"!=typeof File&&File),CustomFileReader=(a||s)&&(f&&f.getOriginalSymbol(window,"FileReader")||"undefined"!=typeof FileReader&&FileReader);function getFilefromDataUrl(e,t,r=Date.now()){return new Promise((i=>{const o=e.split(","),a=o[0].match(/:(.*?);/)[1],s=globalThis.atob(o[1]);let f=s.length;const l=new Uint8Array(f);for(;f--;)l[f]=s.charCodeAt(f);const c=new Blob([l],{type:a});c.name=t,c.lastModified=r,i(c);}))}function getDataUrlFromFile(e){return new Promise(((t,r)=>{const i=new CustomFileReader;i.onload=()=>t(i.result),i.onerror=e=>r(e),i.readAsDataURL(e);}))}function loadImage(e){return new Promise(((t,r)=>{const i=new Image;i.onload=()=>t(i),i.onerror=e=>r(e),i.src=e;}))}function getBrowserName(){if(void 0!==getBrowserName.cachedResult)return getBrowserName.cachedResult;let e=i$1.ETC;const{userAgent:t}=navigator;return /Chrom(e|ium)/i.test(t)?e=i$1.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=i$1.IOS:/Safari/i.test(t)?e=i$1.DESKTOP_SAFARI:/Firefox/i.test(t)?e=i$1.FIREFOX:(/MSIE/i.test(t)||true==!!document.documentMode)&&(e=i$1.IE),getBrowserName.cachedResult=e,getBrowserName.cachedResult}function approximateBelowMaximumCanvasSizeOfBrowser(e,t){const r=getBrowserName(),i=o[r];let a=e,s=t,f=a*s;const l=a>s?s/a:a/s;for(;f>i*i;){const e=(i+a)/2,t=(i+s)/2;e<t?(s=t,a=t*l):(s=e*l,a=e),f=a*s;}return {width:a,height:s}}function getNewCanvasAndCtx(e,t){let r,i;try{if(r=new OffscreenCanvas(e,t),i=r.getContext("2d"),null===i)throw new Error("getContext of OffscreenCanvas returns null")}catch(e){r=document.createElement("canvas"),i=r.getContext("2d");}return r.width=e,r.height=t,[r,i]}function drawImageInCanvas(e,t){const{width:r,height:i}=approximateBelowMaximumCanvasSizeOfBrowser(e.width,e.height),[o,a]=getNewCanvasAndCtx(r,i);return t&&/jpe?g/.test(t)&&(a.fillStyle="white",a.fillRect(0,0,o.width,o.height)),a.drawImage(e,0,0,o.width,o.height),o}function isIOS(){return void 0!==isIOS.cachedResult||(isIOS.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"undefined"!=typeof document&&"ontouchend"in document),isIOS.cachedResult}function drawFileInCanvas(e,t={}){return new Promise((function(r,o){let a,s;var $Try_2_Post=function(){try{return s=drawImageInCanvas(a,t.fileType||e.type),r([a,s])}catch(e){return o(e)}},$Try_2_Catch=function(t){try{0;var $Try_3_Catch=function(e){try{throw e}catch(e){return o(e)}};try{let t;return getDataUrlFromFile(e).then((function(e){try{return t=e,loadImage(t).then((function(e){try{return a=e,function(){try{return $Try_2_Post()}catch(e){return o(e)}}()}catch(e){return $Try_3_Catch(e)}}),$Try_3_Catch)}catch(e){return $Try_3_Catch(e)}}),$Try_3_Catch)}catch(e){$Try_3_Catch(e);}}catch(e){return o(e)}};try{if(isIOS()||[i$1.DESKTOP_SAFARI,i$1.MOBILE_SAFARI].includes(getBrowserName()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(e){try{return a=e,$Try_2_Post()}catch(e){return $Try_2_Catch()}}),$Try_2_Catch)}catch(e){$Try_2_Catch();}}))}function canvasToFile(e,t,i,o,a=1){return new Promise((function(s,f){let l;if("image/png"===t){let c,u,h;return c=e.getContext("2d"),({data:u}=c.getImageData(0,0,e.width,e.height)),h=UPNG.encode([u.buffer],e.width,e.height,4096*a),l=new Blob([h],{type:t}),l.name=i,l.lastModified=o,$If_4.call(this)}{if("image/bmp"===t)return new Promise((t=>r.toBlob(e,t))).then(function(e){try{return l=e,l.name=i,l.lastModified=o,$If_5.call(this)}catch(e){return f(e)}}.bind(this),f);{if("function"==typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:a}).then(function(e){try{return l=e,l.name=i,l.lastModified=o,$If_6.call(this)}catch(e){return f(e)}}.bind(this),f);{let d;return d=e.toDataURL(t,a),getFilefromDataUrl(d,i,o).then(function(e){try{return l=e,$If_6.call(this)}catch(e){return f(e)}}.bind(this),f)}function $If_6(){return $If_5.call(this)}}function $If_5(){return $If_4.call(this)}}function $If_4(){return s(l)}}))}function cleanupCanvasMemory(e){e.width=0,e.height=0;}function isAutoOrientationInBrowser(){return new Promise((function(e,t){let i,o,a,s;return void 0!==isAutoOrientationInBrowser.cachedResult?e(isAutoOrientationInBrowser.cachedResult):(getFilefromDataUrl("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(r){try{return i=r,drawFileInCanvas(i).then((function(r){try{return o=r[1],canvasToFile(o,i.type,i.name,i.lastModified).then((function(r){try{return a=r,cleanupCanvasMemory(o),drawFileInCanvas(a).then((function(r){try{return s=r[0],isAutoOrientationInBrowser.cachedResult=1===s.width&&2===s.height,e(isAutoOrientationInBrowser.cachedResult)}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t))}))}function getExifOrientation(e){return new Promise(((t,r)=>{const i=new CustomFileReader;i.onload=e=>{const r=new DataView(e.target.result);if(65496!=r.getUint16(0,false))return t(-2);const i=r.byteLength;let o=2;for(;o<i;){if(r.getUint16(o+2,false)<=8)return t(-1);const e=r.getUint16(o,false);if(o+=2,65505==e){if(1165519206!=r.getUint32(o+=2,false))return t(-1);const e=18761==r.getUint16(o+=6,false);o+=r.getUint32(o+4,e);const i=r.getUint16(o,e);o+=2;for(let a=0;a<i;a++)if(274==r.getUint16(o+12*a,e))return t(r.getUint16(o+12*a+8,e))}else {if(65280!=(65280&e))break;o+=r.getUint16(o,false);}}return t(-1)},i.onerror=e=>r(e),i.readAsArrayBuffer(e);}))}function handleMaxWidthOrHeight(e,t){const{width:r}=e,{height:i}=e,{maxWidthOrHeight:o}=t;let a,s=e;return isFinite(o)&&(r>o||i>o)&&([s,a]=getNewCanvasAndCtx(r,i),r>i?(s.width=o,s.height=i/r*o):(s.width=r/i*o,s.height=o),a.drawImage(e,0,0,s.width,s.height),cleanupCanvasMemory(e)),s}function followExifOrientation(e,t){const{width:r}=e,{height:i}=e,[o,a]=getNewCanvasAndCtx(r,i);switch(t>4&&t<9?(o.width=i,o.height=r):(o.width=r,o.height=i),t){case 2:a.transform(-1,0,0,1,r,0);break;case 3:a.transform(-1,0,0,-1,r,i);break;case 4:a.transform(1,0,0,-1,0,i);break;case 5:a.transform(0,1,1,0,0,0);break;case 6:a.transform(0,1,-1,0,i,0);break;case 7:a.transform(0,-1,-1,0,i,r);break;case 8:a.transform(0,-1,1,0,0,r);}return a.drawImage(e,0,0,r,i),cleanupCanvasMemory(e),o}function compress(e,t,r=0){return new Promise((function(i,o){let a,s,f,l,c,u,h,d,A,g,p,m,w,v,b,y,E,F,_,B;function incProgress(e=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=e,t.onProgress(Math.min(a,100));}function setProgress(e){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(e,a),100),t.onProgress(a);}return a=r,s=t.maxIteration||10,f=1024*t.maxSizeMB*1024,incProgress(),drawFileInCanvas(e,t).then(function(r){try{return [,l]=r,incProgress(),c=handleMaxWidthOrHeight(l,t),incProgress(),new Promise((function(r,i){var o;if(!(o=t.exifOrientation))return getExifOrientation(e).then(function(e){try{return o=e,$If_2.call(this)}catch(e){return i(e)}}.bind(this),i);function $If_2(){return r(o)}return $If_2.call(this)})).then(function(r){try{return u=r,incProgress(),isAutoOrientationInBrowser().then(function(r){try{return h=r?c:followExifOrientation(c,u),incProgress(),d=t.initialQuality||1,A=t.fileType||e.type,canvasToFile(h,A,e.name,e.lastModified,d).then(function(r){try{{if(g=r,incProgress(),p=g.size>f,m=g.size>e.size,!p&&!m)return setProgress(100),i(g);var a;function $Loop_3(){if(s--&&(b>f||b>w)){let t,r;return t=B?.95*_.width:_.width,r=B?.95*_.height:_.height,[E,F]=getNewCanvasAndCtx(t,r),F.drawImage(_,0,0,t,r),d*="image/png"===A?.85:.95,canvasToFile(E,A,e.name,e.lastModified,d).then((function(e){try{return y=e,cleanupCanvasMemory(_),_=E,b=y.size,setProgress(Math.min(99,Math.floor((v-b)/(v-f)*100))),$Loop_3}catch(e){return o(e)}}),o)}return [1]}return w=e.size,v=g.size,b=v,_=h,B=!t.alwaysKeepResolution&&p,(a=function(e){for(;e;){if(e.then)return void e.then(a,o);try{if(e.pop){if(e.length)return e.pop()?$Loop_3_exit.call(this):e;e=$Loop_3;}else e=e.call(this);}catch(e){return o(e)}}}.bind(this))($Loop_3);function $Loop_3_exit(){return cleanupCanvasMemory(_),cleanupCanvasMemory(E),cleanupCanvasMemory(c),cleanupCanvasMemory(h),cleanupCanvasMemory(l),setProgress(100),i(y)}}}catch(u){return o(u)}}.bind(this),o)}catch(e){return o(e)}}.bind(this),o)}catch(e){return o(e)}}.bind(this),o)}catch(e){return o(e)}}.bind(this),o)}))}const l="\nlet scriptImported = false\nself.addEventListener('message', async (e) => {\n const { file, id, imageCompressionLibUrl, options } = e.data\n options.onProgress = (progress) => self.postMessage({ progress, id })\n try {\n if (!scriptImported) {\n // console.log('[worker] importScripts', imageCompressionLibUrl)\n self.importScripts(imageCompressionLibUrl)\n scriptImported = true\n }\n // console.log('[worker] self', self)\n const compressedFile = await imageCompression(file, options)\n self.postMessage({ file: compressedFile, id })\n } catch (e) {\n // console.error('[worker] error', e)\n self.postMessage({ error: e.message + '\\n' + e.stack, id })\n }\n})\n";let c;function compressOnWebWorker(e,t){return new Promise(((r,i)=>{c||(c=function createWorkerScriptURL(e){const t=[];return t.push(e),URL.createObjectURL(new Blob(t))}(l));const o=new Worker(c);o.addEventListener("message",(function handler(e){if(t.signal&&t.signal.aborted)o.terminate();else if(void 0===e.data.progress){if(e.data.error)return i(new Error(e.data.error)),void o.terminate();r(e.data.file),o.terminate();}else t.onProgress(e.data.progress);})),o.addEventListener("error",i),t.signal&&t.signal.addEventListener("abort",(()=>{i(t.signal.reason),o.terminate();})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}});}))}function imageCompression(e,t){return new Promise((function(r,i){let o,a,s,f,l,c;if(o={...t},s=0,({onProgress:f}=o),o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,l="boolean"!=typeof o.useWebWorker||o.useWebWorker,delete o.useWebWorker,o.onProgress=e=>{s=e,"function"==typeof f&&f(s);},!(e instanceof Blob||e instanceof CustomFile))return i(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return i(new Error("The file given is not an image"));if(c="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,!l||"function"!=typeof Worker||c)return compress(e,o).then(function(e){try{return a=e,$If_4.call(this)}catch(e){return i(e)}}.bind(this),i);var u=function(){try{return $If_4.call(this)}catch(e){return i(e)}}.bind(this),$Try_1_Catch=function(t){try{return compress(e,o).then((function(e){try{return a=e,u()}catch(e){return i(e)}}),i)}catch(e){return i(e)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",compressOnWebWorker(e,o).then((function(e){try{return a=e,u()}catch(e){return $Try_1_Catch()}}),$Try_1_Catch)}catch(e){$Try_1_Catch();}function $If_4(){try{a.name=e.name,a.lastModified=e.lastModified;}catch(e){}try{o.preserveExif&&"image/jpeg"===e.type&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(a=copyExifWithoutOrientation(e,a));}catch(e){}return r(a)}}))}imageCompression.getDataUrlFromFile=getDataUrlFromFile,imageCompression.getFilefromDataUrl=getFilefromDataUrl,imageCompression.loadImage=loadImage,imageCompression.drawImageInCanvas=drawImageInCanvas,imageCompression.drawFileInCanvas=drawFileInCanvas,imageCompression.canvasToFile=canvasToFile,imageCompression.getExifOrientation=getExifOrientation,imageCompression.handleMaxWidthOrHeight=handleMaxWidthOrHeight,imageCompression.followExifOrientation=followExifOrientation,imageCompression.cleanupCanvasMemory=cleanupCanvasMemory,imageCompression.isAutoOrientationInBrowser=isAutoOrientationInBrowser,imageCompression.approximateBelowMaximumCanvasSizeOfBrowser=approximateBelowMaximumCanvasSizeOfBrowser,imageCompression.copyExifWithoutOrientation=copyExifWithoutOrientation,imageCompression.getBrowserName=getBrowserName,imageCompression.version="2.0.2";
1163
+
1164
+ /******************************************************************************
1165
+ Copyright (c) Microsoft Corporation.
1166
+
1167
+ Permission to use, copy, modify, and/or distribute this software for any
1168
+ purpose with or without fee is hereby granted.
1169
+
1170
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1171
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1172
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1173
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1174
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1175
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1176
+ PERFORMANCE OF THIS SOFTWARE.
1177
+ ***************************************************************************** */
1178
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1179
+
1180
+
1181
+ function __awaiter(thisArg, _arguments, P, generator) {
1182
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1183
+ return new (P || (P = Promise))(function (resolve, reject) {
1184
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1185
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1186
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1187
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1188
+ });
1189
+ }
1190
+
1191
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1192
+ var e = new Error(message);
1193
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1194
+ };
1195
+
1196
+ const COMMON_MIME_TYPES = new Map([
1197
+ // https://github.com/guzzle/psr7/blob/2d9260799e713f1c475d3c5fdc3d6561ff7441b2/src/MimeType.php
1198
+ ['1km', 'application/vnd.1000minds.decision-model+xml'],
1199
+ ['3dml', 'text/vnd.in3d.3dml'],
1200
+ ['3ds', 'image/x-3ds'],
1201
+ ['3g2', 'video/3gpp2'],
1202
+ ['3gp', 'video/3gp'],
1203
+ ['3gpp', 'video/3gpp'],
1204
+ ['3mf', 'model/3mf'],
1205
+ ['7z', 'application/x-7z-compressed'],
1206
+ ['7zip', 'application/x-7z-compressed'],
1207
+ ['123', 'application/vnd.lotus-1-2-3'],
1208
+ ['aab', 'application/x-authorware-bin'],
1209
+ ['aac', 'audio/x-acc'],
1210
+ ['aam', 'application/x-authorware-map'],
1211
+ ['aas', 'application/x-authorware-seg'],
1212
+ ['abw', 'application/x-abiword'],
1213
+ ['ac', 'application/vnd.nokia.n-gage.ac+xml'],
1214
+ ['ac3', 'audio/ac3'],
1215
+ ['acc', 'application/vnd.americandynamics.acc'],
1216
+ ['ace', 'application/x-ace-compressed'],
1217
+ ['acu', 'application/vnd.acucobol'],
1218
+ ['acutc', 'application/vnd.acucorp'],
1219
+ ['adp', 'audio/adpcm'],
1220
+ ['aep', 'application/vnd.audiograph'],
1221
+ ['afm', 'application/x-font-type1'],
1222
+ ['afp', 'application/vnd.ibm.modcap'],
1223
+ ['ahead', 'application/vnd.ahead.space'],
1224
+ ['ai', 'application/pdf'],
1225
+ ['aif', 'audio/x-aiff'],
1226
+ ['aifc', 'audio/x-aiff'],
1227
+ ['aiff', 'audio/x-aiff'],
1228
+ ['air', 'application/vnd.adobe.air-application-installer-package+zip'],
1229
+ ['ait', 'application/vnd.dvb.ait'],
1230
+ ['ami', 'application/vnd.amiga.ami'],
1231
+ ['amr', 'audio/amr'],
1232
+ ['apk', 'application/vnd.android.package-archive'],
1233
+ ['apng', 'image/apng'],
1234
+ ['appcache', 'text/cache-manifest'],
1235
+ ['application', 'application/x-ms-application'],
1236
+ ['apr', 'application/vnd.lotus-approach'],
1237
+ ['arc', 'application/x-freearc'],
1238
+ ['arj', 'application/x-arj'],
1239
+ ['asc', 'application/pgp-signature'],
1240
+ ['asf', 'video/x-ms-asf'],
1241
+ ['asm', 'text/x-asm'],
1242
+ ['aso', 'application/vnd.accpac.simply.aso'],
1243
+ ['asx', 'video/x-ms-asf'],
1244
+ ['atc', 'application/vnd.acucorp'],
1245
+ ['atom', 'application/atom+xml'],
1246
+ ['atomcat', 'application/atomcat+xml'],
1247
+ ['atomdeleted', 'application/atomdeleted+xml'],
1248
+ ['atomsvc', 'application/atomsvc+xml'],
1249
+ ['atx', 'application/vnd.antix.game-component'],
1250
+ ['au', 'audio/x-au'],
1251
+ ['avi', 'video/x-msvideo'],
1252
+ ['avif', 'image/avif'],
1253
+ ['aw', 'application/applixware'],
1254
+ ['azf', 'application/vnd.airzip.filesecure.azf'],
1255
+ ['azs', 'application/vnd.airzip.filesecure.azs'],
1256
+ ['azv', 'image/vnd.airzip.accelerator.azv'],
1257
+ ['azw', 'application/vnd.amazon.ebook'],
1258
+ ['b16', 'image/vnd.pco.b16'],
1259
+ ['bat', 'application/x-msdownload'],
1260
+ ['bcpio', 'application/x-bcpio'],
1261
+ ['bdf', 'application/x-font-bdf'],
1262
+ ['bdm', 'application/vnd.syncml.dm+wbxml'],
1263
+ ['bdoc', 'application/x-bdoc'],
1264
+ ['bed', 'application/vnd.realvnc.bed'],
1265
+ ['bh2', 'application/vnd.fujitsu.oasysprs'],
1266
+ ['bin', 'application/octet-stream'],
1267
+ ['blb', 'application/x-blorb'],
1268
+ ['blorb', 'application/x-blorb'],
1269
+ ['bmi', 'application/vnd.bmi'],
1270
+ ['bmml', 'application/vnd.balsamiq.bmml+xml'],
1271
+ ['bmp', 'image/bmp'],
1272
+ ['book', 'application/vnd.framemaker'],
1273
+ ['box', 'application/vnd.previewsystems.box'],
1274
+ ['boz', 'application/x-bzip2'],
1275
+ ['bpk', 'application/octet-stream'],
1276
+ ['bpmn', 'application/octet-stream'],
1277
+ ['bsp', 'model/vnd.valve.source.compiled-map'],
1278
+ ['btif', 'image/prs.btif'],
1279
+ ['buffer', 'application/octet-stream'],
1280
+ ['bz', 'application/x-bzip'],
1281
+ ['bz2', 'application/x-bzip2'],
1282
+ ['c', 'text/x-c'],
1283
+ ['c4d', 'application/vnd.clonk.c4group'],
1284
+ ['c4f', 'application/vnd.clonk.c4group'],
1285
+ ['c4g', 'application/vnd.clonk.c4group'],
1286
+ ['c4p', 'application/vnd.clonk.c4group'],
1287
+ ['c4u', 'application/vnd.clonk.c4group'],
1288
+ ['c11amc', 'application/vnd.cluetrust.cartomobile-config'],
1289
+ ['c11amz', 'application/vnd.cluetrust.cartomobile-config-pkg'],
1290
+ ['cab', 'application/vnd.ms-cab-compressed'],
1291
+ ['caf', 'audio/x-caf'],
1292
+ ['cap', 'application/vnd.tcpdump.pcap'],
1293
+ ['car', 'application/vnd.curl.car'],
1294
+ ['cat', 'application/vnd.ms-pki.seccat'],
1295
+ ['cb7', 'application/x-cbr'],
1296
+ ['cba', 'application/x-cbr'],
1297
+ ['cbr', 'application/x-cbr'],
1298
+ ['cbt', 'application/x-cbr'],
1299
+ ['cbz', 'application/x-cbr'],
1300
+ ['cc', 'text/x-c'],
1301
+ ['cco', 'application/x-cocoa'],
1302
+ ['cct', 'application/x-director'],
1303
+ ['ccxml', 'application/ccxml+xml'],
1304
+ ['cdbcmsg', 'application/vnd.contact.cmsg'],
1305
+ ['cda', 'application/x-cdf'],
1306
+ ['cdf', 'application/x-netcdf'],
1307
+ ['cdfx', 'application/cdfx+xml'],
1308
+ ['cdkey', 'application/vnd.mediastation.cdkey'],
1309
+ ['cdmia', 'application/cdmi-capability'],
1310
+ ['cdmic', 'application/cdmi-container'],
1311
+ ['cdmid', 'application/cdmi-domain'],
1312
+ ['cdmio', 'application/cdmi-object'],
1313
+ ['cdmiq', 'application/cdmi-queue'],
1314
+ ['cdr', 'application/cdr'],
1315
+ ['cdx', 'chemical/x-cdx'],
1316
+ ['cdxml', 'application/vnd.chemdraw+xml'],
1317
+ ['cdy', 'application/vnd.cinderella'],
1318
+ ['cer', 'application/pkix-cert'],
1319
+ ['cfs', 'application/x-cfs-compressed'],
1320
+ ['cgm', 'image/cgm'],
1321
+ ['chat', 'application/x-chat'],
1322
+ ['chm', 'application/vnd.ms-htmlhelp'],
1323
+ ['chrt', 'application/vnd.kde.kchart'],
1324
+ ['cif', 'chemical/x-cif'],
1325
+ ['cii', 'application/vnd.anser-web-certificate-issue-initiation'],
1326
+ ['cil', 'application/vnd.ms-artgalry'],
1327
+ ['cjs', 'application/node'],
1328
+ ['cla', 'application/vnd.claymore'],
1329
+ ['class', 'application/octet-stream'],
1330
+ ['clkk', 'application/vnd.crick.clicker.keyboard'],
1331
+ ['clkp', 'application/vnd.crick.clicker.palette'],
1332
+ ['clkt', 'application/vnd.crick.clicker.template'],
1333
+ ['clkw', 'application/vnd.crick.clicker.wordbank'],
1334
+ ['clkx', 'application/vnd.crick.clicker'],
1335
+ ['clp', 'application/x-msclip'],
1336
+ ['cmc', 'application/vnd.cosmocaller'],
1337
+ ['cmdf', 'chemical/x-cmdf'],
1338
+ ['cml', 'chemical/x-cml'],
1339
+ ['cmp', 'application/vnd.yellowriver-custom-menu'],
1340
+ ['cmx', 'image/x-cmx'],
1341
+ ['cod', 'application/vnd.rim.cod'],
1342
+ ['coffee', 'text/coffeescript'],
1343
+ ['com', 'application/x-msdownload'],
1344
+ ['conf', 'text/plain'],
1345
+ ['cpio', 'application/x-cpio'],
1346
+ ['cpp', 'text/x-c'],
1347
+ ['cpt', 'application/mac-compactpro'],
1348
+ ['crd', 'application/x-mscardfile'],
1349
+ ['crl', 'application/pkix-crl'],
1350
+ ['crt', 'application/x-x509-ca-cert'],
1351
+ ['crx', 'application/x-chrome-extension'],
1352
+ ['cryptonote', 'application/vnd.rig.cryptonote'],
1353
+ ['csh', 'application/x-csh'],
1354
+ ['csl', 'application/vnd.citationstyles.style+xml'],
1355
+ ['csml', 'chemical/x-csml'],
1356
+ ['csp', 'application/vnd.commonspace'],
1357
+ ['csr', 'application/octet-stream'],
1358
+ ['css', 'text/css'],
1359
+ ['cst', 'application/x-director'],
1360
+ ['csv', 'text/csv'],
1361
+ ['cu', 'application/cu-seeme'],
1362
+ ['curl', 'text/vnd.curl'],
1363
+ ['cww', 'application/prs.cww'],
1364
+ ['cxt', 'application/x-director'],
1365
+ ['cxx', 'text/x-c'],
1366
+ ['dae', 'model/vnd.collada+xml'],
1367
+ ['daf', 'application/vnd.mobius.daf'],
1368
+ ['dart', 'application/vnd.dart'],
1369
+ ['dataless', 'application/vnd.fdsn.seed'],
1370
+ ['davmount', 'application/davmount+xml'],
1371
+ ['dbf', 'application/vnd.dbf'],
1372
+ ['dbk', 'application/docbook+xml'],
1373
+ ['dcr', 'application/x-director'],
1374
+ ['dcurl', 'text/vnd.curl.dcurl'],
1375
+ ['dd2', 'application/vnd.oma.dd2+xml'],
1376
+ ['ddd', 'application/vnd.fujixerox.ddd'],
1377
+ ['ddf', 'application/vnd.syncml.dmddf+xml'],
1378
+ ['dds', 'image/vnd.ms-dds'],
1379
+ ['deb', 'application/x-debian-package'],
1380
+ ['def', 'text/plain'],
1381
+ ['deploy', 'application/octet-stream'],
1382
+ ['der', 'application/x-x509-ca-cert'],
1383
+ ['dfac', 'application/vnd.dreamfactory'],
1384
+ ['dgc', 'application/x-dgc-compressed'],
1385
+ ['dic', 'text/x-c'],
1386
+ ['dir', 'application/x-director'],
1387
+ ['dis', 'application/vnd.mobius.dis'],
1388
+ ['disposition-notification', 'message/disposition-notification'],
1389
+ ['dist', 'application/octet-stream'],
1390
+ ['distz', 'application/octet-stream'],
1391
+ ['djv', 'image/vnd.djvu'],
1392
+ ['djvu', 'image/vnd.djvu'],
1393
+ ['dll', 'application/octet-stream'],
1394
+ ['dmg', 'application/x-apple-diskimage'],
1395
+ ['dmn', 'application/octet-stream'],
1396
+ ['dmp', 'application/vnd.tcpdump.pcap'],
1397
+ ['dms', 'application/octet-stream'],
1398
+ ['dna', 'application/vnd.dna'],
1399
+ ['doc', 'application/msword'],
1400
+ ['docm', 'application/vnd.ms-word.template.macroEnabled.12'],
1401
+ ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
1402
+ ['dot', 'application/msword'],
1403
+ ['dotm', 'application/vnd.ms-word.template.macroEnabled.12'],
1404
+ ['dotx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'],
1405
+ ['dp', 'application/vnd.osgi.dp'],
1406
+ ['dpg', 'application/vnd.dpgraph'],
1407
+ ['dra', 'audio/vnd.dra'],
1408
+ ['drle', 'image/dicom-rle'],
1409
+ ['dsc', 'text/prs.lines.tag'],
1410
+ ['dssc', 'application/dssc+der'],
1411
+ ['dtb', 'application/x-dtbook+xml'],
1412
+ ['dtd', 'application/xml-dtd'],
1413
+ ['dts', 'audio/vnd.dts'],
1414
+ ['dtshd', 'audio/vnd.dts.hd'],
1415
+ ['dump', 'application/octet-stream'],
1416
+ ['dvb', 'video/vnd.dvb.file'],
1417
+ ['dvi', 'application/x-dvi'],
1418
+ ['dwd', 'application/atsc-dwd+xml'],
1419
+ ['dwf', 'model/vnd.dwf'],
1420
+ ['dwg', 'image/vnd.dwg'],
1421
+ ['dxf', 'image/vnd.dxf'],
1422
+ ['dxp', 'application/vnd.spotfire.dxp'],
1423
+ ['dxr', 'application/x-director'],
1424
+ ['ear', 'application/java-archive'],
1425
+ ['ecelp4800', 'audio/vnd.nuera.ecelp4800'],
1426
+ ['ecelp7470', 'audio/vnd.nuera.ecelp7470'],
1427
+ ['ecelp9600', 'audio/vnd.nuera.ecelp9600'],
1428
+ ['ecma', 'application/ecmascript'],
1429
+ ['edm', 'application/vnd.novadigm.edm'],
1430
+ ['edx', 'application/vnd.novadigm.edx'],
1431
+ ['efif', 'application/vnd.picsel'],
1432
+ ['ei6', 'application/vnd.pg.osasli'],
1433
+ ['elc', 'application/octet-stream'],
1434
+ ['emf', 'image/emf'],
1435
+ ['eml', 'message/rfc822'],
1436
+ ['emma', 'application/emma+xml'],
1437
+ ['emotionml', 'application/emotionml+xml'],
1438
+ ['emz', 'application/x-msmetafile'],
1439
+ ['eol', 'audio/vnd.digital-winds'],
1440
+ ['eot', 'application/vnd.ms-fontobject'],
1441
+ ['eps', 'application/postscript'],
1442
+ ['epub', 'application/epub+zip'],
1443
+ ['es', 'application/ecmascript'],
1444
+ ['es3', 'application/vnd.eszigno3+xml'],
1445
+ ['esa', 'application/vnd.osgi.subsystem'],
1446
+ ['esf', 'application/vnd.epson.esf'],
1447
+ ['et3', 'application/vnd.eszigno3+xml'],
1448
+ ['etx', 'text/x-setext'],
1449
+ ['eva', 'application/x-eva'],
1450
+ ['evy', 'application/x-envoy'],
1451
+ ['exe', 'application/octet-stream'],
1452
+ ['exi', 'application/exi'],
1453
+ ['exp', 'application/express'],
1454
+ ['exr', 'image/aces'],
1455
+ ['ext', 'application/vnd.novadigm.ext'],
1456
+ ['ez', 'application/andrew-inset'],
1457
+ ['ez2', 'application/vnd.ezpix-album'],
1458
+ ['ez3', 'application/vnd.ezpix-package'],
1459
+ ['f', 'text/x-fortran'],
1460
+ ['f4v', 'video/mp4'],
1461
+ ['f77', 'text/x-fortran'],
1462
+ ['f90', 'text/x-fortran'],
1463
+ ['fbs', 'image/vnd.fastbidsheet'],
1464
+ ['fcdt', 'application/vnd.adobe.formscentral.fcdt'],
1465
+ ['fcs', 'application/vnd.isac.fcs'],
1466
+ ['fdf', 'application/vnd.fdf'],
1467
+ ['fdt', 'application/fdt+xml'],
1468
+ ['fe_launch', 'application/vnd.denovo.fcselayout-link'],
1469
+ ['fg5', 'application/vnd.fujitsu.oasysgp'],
1470
+ ['fgd', 'application/x-director'],
1471
+ ['fh', 'image/x-freehand'],
1472
+ ['fh4', 'image/x-freehand'],
1473
+ ['fh5', 'image/x-freehand'],
1474
+ ['fh7', 'image/x-freehand'],
1475
+ ['fhc', 'image/x-freehand'],
1476
+ ['fig', 'application/x-xfig'],
1477
+ ['fits', 'image/fits'],
1478
+ ['flac', 'audio/x-flac'],
1479
+ ['fli', 'video/x-fli'],
1480
+ ['flo', 'application/vnd.micrografx.flo'],
1481
+ ['flv', 'video/x-flv'],
1482
+ ['flw', 'application/vnd.kde.kivio'],
1483
+ ['flx', 'text/vnd.fmi.flexstor'],
1484
+ ['fly', 'text/vnd.fly'],
1485
+ ['fm', 'application/vnd.framemaker'],
1486
+ ['fnc', 'application/vnd.frogans.fnc'],
1487
+ ['fo', 'application/vnd.software602.filler.form+xml'],
1488
+ ['for', 'text/x-fortran'],
1489
+ ['fpx', 'image/vnd.fpx'],
1490
+ ['frame', 'application/vnd.framemaker'],
1491
+ ['fsc', 'application/vnd.fsc.weblaunch'],
1492
+ ['fst', 'image/vnd.fst'],
1493
+ ['ftc', 'application/vnd.fluxtime.clip'],
1494
+ ['fti', 'application/vnd.anser-web-funds-transfer-initiation'],
1495
+ ['fvt', 'video/vnd.fvt'],
1496
+ ['fxp', 'application/vnd.adobe.fxp'],
1497
+ ['fxpl', 'application/vnd.adobe.fxp'],
1498
+ ['fzs', 'application/vnd.fuzzysheet'],
1499
+ ['g2w', 'application/vnd.geoplan'],
1500
+ ['g3', 'image/g3fax'],
1501
+ ['g3w', 'application/vnd.geospace'],
1502
+ ['gac', 'application/vnd.groove-account'],
1503
+ ['gam', 'application/x-tads'],
1504
+ ['gbr', 'application/rpki-ghostbusters'],
1505
+ ['gca', 'application/x-gca-compressed'],
1506
+ ['gdl', 'model/vnd.gdl'],
1507
+ ['gdoc', 'application/vnd.google-apps.document'],
1508
+ ['geo', 'application/vnd.dynageo'],
1509
+ ['geojson', 'application/geo+json'],
1510
+ ['gex', 'application/vnd.geometry-explorer'],
1511
+ ['ggb', 'application/vnd.geogebra.file'],
1512
+ ['ggt', 'application/vnd.geogebra.tool'],
1513
+ ['ghf', 'application/vnd.groove-help'],
1514
+ ['gif', 'image/gif'],
1515
+ ['gim', 'application/vnd.groove-identity-message'],
1516
+ ['glb', 'model/gltf-binary'],
1517
+ ['gltf', 'model/gltf+json'],
1518
+ ['gml', 'application/gml+xml'],
1519
+ ['gmx', 'application/vnd.gmx'],
1520
+ ['gnumeric', 'application/x-gnumeric'],
1521
+ ['gpg', 'application/gpg-keys'],
1522
+ ['gph', 'application/vnd.flographit'],
1523
+ ['gpx', 'application/gpx+xml'],
1524
+ ['gqf', 'application/vnd.grafeq'],
1525
+ ['gqs', 'application/vnd.grafeq'],
1526
+ ['gram', 'application/srgs'],
1527
+ ['gramps', 'application/x-gramps-xml'],
1528
+ ['gre', 'application/vnd.geometry-explorer'],
1529
+ ['grv', 'application/vnd.groove-injector'],
1530
+ ['grxml', 'application/srgs+xml'],
1531
+ ['gsf', 'application/x-font-ghostscript'],
1532
+ ['gsheet', 'application/vnd.google-apps.spreadsheet'],
1533
+ ['gslides', 'application/vnd.google-apps.presentation'],
1534
+ ['gtar', 'application/x-gtar'],
1535
+ ['gtm', 'application/vnd.groove-tool-message'],
1536
+ ['gtw', 'model/vnd.gtw'],
1537
+ ['gv', 'text/vnd.graphviz'],
1538
+ ['gxf', 'application/gxf'],
1539
+ ['gxt', 'application/vnd.geonext'],
1540
+ ['gz', 'application/gzip'],
1541
+ ['gzip', 'application/gzip'],
1542
+ ['h', 'text/x-c'],
1543
+ ['h261', 'video/h261'],
1544
+ ['h263', 'video/h263'],
1545
+ ['h264', 'video/h264'],
1546
+ ['hal', 'application/vnd.hal+xml'],
1547
+ ['hbci', 'application/vnd.hbci'],
1548
+ ['hbs', 'text/x-handlebars-template'],
1549
+ ['hdd', 'application/x-virtualbox-hdd'],
1550
+ ['hdf', 'application/x-hdf'],
1551
+ ['heic', 'image/heic'],
1552
+ ['heics', 'image/heic-sequence'],
1553
+ ['heif', 'image/heif'],
1554
+ ['heifs', 'image/heif-sequence'],
1555
+ ['hej2', 'image/hej2k'],
1556
+ ['held', 'application/atsc-held+xml'],
1557
+ ['hh', 'text/x-c'],
1558
+ ['hjson', 'application/hjson'],
1559
+ ['hlp', 'application/winhlp'],
1560
+ ['hpgl', 'application/vnd.hp-hpgl'],
1561
+ ['hpid', 'application/vnd.hp-hpid'],
1562
+ ['hps', 'application/vnd.hp-hps'],
1563
+ ['hqx', 'application/mac-binhex40'],
1564
+ ['hsj2', 'image/hsj2'],
1565
+ ['htc', 'text/x-component'],
1566
+ ['htke', 'application/vnd.kenameaapp'],
1567
+ ['htm', 'text/html'],
1568
+ ['html', 'text/html'],
1569
+ ['hvd', 'application/vnd.yamaha.hv-dic'],
1570
+ ['hvp', 'application/vnd.yamaha.hv-voice'],
1571
+ ['hvs', 'application/vnd.yamaha.hv-script'],
1572
+ ['i2g', 'application/vnd.intergeo'],
1573
+ ['icc', 'application/vnd.iccprofile'],
1574
+ ['ice', 'x-conference/x-cooltalk'],
1575
+ ['icm', 'application/vnd.iccprofile'],
1576
+ ['ico', 'image/x-icon'],
1577
+ ['ics', 'text/calendar'],
1578
+ ['ief', 'image/ief'],
1579
+ ['ifb', 'text/calendar'],
1580
+ ['ifm', 'application/vnd.shana.informed.formdata'],
1581
+ ['iges', 'model/iges'],
1582
+ ['igl', 'application/vnd.igloader'],
1583
+ ['igm', 'application/vnd.insors.igm'],
1584
+ ['igs', 'model/iges'],
1585
+ ['igx', 'application/vnd.micrografx.igx'],
1586
+ ['iif', 'application/vnd.shana.informed.interchange'],
1587
+ ['img', 'application/octet-stream'],
1588
+ ['imp', 'application/vnd.accpac.simply.imp'],
1589
+ ['ims', 'application/vnd.ms-ims'],
1590
+ ['in', 'text/plain'],
1591
+ ['ini', 'text/plain'],
1592
+ ['ink', 'application/inkml+xml'],
1593
+ ['inkml', 'application/inkml+xml'],
1594
+ ['install', 'application/x-install-instructions'],
1595
+ ['iota', 'application/vnd.astraea-software.iota'],
1596
+ ['ipfix', 'application/ipfix'],
1597
+ ['ipk', 'application/vnd.shana.informed.package'],
1598
+ ['irm', 'application/vnd.ibm.rights-management'],
1599
+ ['irp', 'application/vnd.irepository.package+xml'],
1600
+ ['iso', 'application/x-iso9660-image'],
1601
+ ['itp', 'application/vnd.shana.informed.formtemplate'],
1602
+ ['its', 'application/its+xml'],
1603
+ ['ivp', 'application/vnd.immervision-ivp'],
1604
+ ['ivu', 'application/vnd.immervision-ivu'],
1605
+ ['jad', 'text/vnd.sun.j2me.app-descriptor'],
1606
+ ['jade', 'text/jade'],
1607
+ ['jam', 'application/vnd.jam'],
1608
+ ['jar', 'application/java-archive'],
1609
+ ['jardiff', 'application/x-java-archive-diff'],
1610
+ ['java', 'text/x-java-source'],
1611
+ ['jhc', 'image/jphc'],
1612
+ ['jisp', 'application/vnd.jisp'],
1613
+ ['jls', 'image/jls'],
1614
+ ['jlt', 'application/vnd.hp-jlyt'],
1615
+ ['jng', 'image/x-jng'],
1616
+ ['jnlp', 'application/x-java-jnlp-file'],
1617
+ ['joda', 'application/vnd.joost.joda-archive'],
1618
+ ['jp2', 'image/jp2'],
1619
+ ['jpe', 'image/jpeg'],
1620
+ ['jpeg', 'image/jpeg'],
1621
+ ['jpf', 'image/jpx'],
1622
+ ['jpg', 'image/jpeg'],
1623
+ ['jpg2', 'image/jp2'],
1624
+ ['jpgm', 'video/jpm'],
1625
+ ['jpgv', 'video/jpeg'],
1626
+ ['jph', 'image/jph'],
1627
+ ['jpm', 'video/jpm'],
1628
+ ['jpx', 'image/jpx'],
1629
+ ['js', 'application/javascript'],
1630
+ ['json', 'application/json'],
1631
+ ['json5', 'application/json5'],
1632
+ ['jsonld', 'application/ld+json'],
1633
+ // https://jsonlines.org/
1634
+ ['jsonl', 'application/jsonl'],
1635
+ ['jsonml', 'application/jsonml+json'],
1636
+ ['jsx', 'text/jsx'],
1637
+ ['jxr', 'image/jxr'],
1638
+ ['jxra', 'image/jxra'],
1639
+ ['jxrs', 'image/jxrs'],
1640
+ ['jxs', 'image/jxs'],
1641
+ ['jxsc', 'image/jxsc'],
1642
+ ['jxsi', 'image/jxsi'],
1643
+ ['jxss', 'image/jxss'],
1644
+ ['kar', 'audio/midi'],
1645
+ ['karbon', 'application/vnd.kde.karbon'],
1646
+ ['kdb', 'application/octet-stream'],
1647
+ ['kdbx', 'application/x-keepass2'],
1648
+ ['key', 'application/x-iwork-keynote-sffkey'],
1649
+ ['kfo', 'application/vnd.kde.kformula'],
1650
+ ['kia', 'application/vnd.kidspiration'],
1651
+ ['kml', 'application/vnd.google-earth.kml+xml'],
1652
+ ['kmz', 'application/vnd.google-earth.kmz'],
1653
+ ['kne', 'application/vnd.kinar'],
1654
+ ['knp', 'application/vnd.kinar'],
1655
+ ['kon', 'application/vnd.kde.kontour'],
1656
+ ['kpr', 'application/vnd.kde.kpresenter'],
1657
+ ['kpt', 'application/vnd.kde.kpresenter'],
1658
+ ['kpxx', 'application/vnd.ds-keypoint'],
1659
+ ['ksp', 'application/vnd.kde.kspread'],
1660
+ ['ktr', 'application/vnd.kahootz'],
1661
+ ['ktx', 'image/ktx'],
1662
+ ['ktx2', 'image/ktx2'],
1663
+ ['ktz', 'application/vnd.kahootz'],
1664
+ ['kwd', 'application/vnd.kde.kword'],
1665
+ ['kwt', 'application/vnd.kde.kword'],
1666
+ ['lasxml', 'application/vnd.las.las+xml'],
1667
+ ['latex', 'application/x-latex'],
1668
+ ['lbd', 'application/vnd.llamagraphics.life-balance.desktop'],
1669
+ ['lbe', 'application/vnd.llamagraphics.life-balance.exchange+xml'],
1670
+ ['les', 'application/vnd.hhe.lesson-player'],
1671
+ ['less', 'text/less'],
1672
+ ['lgr', 'application/lgr+xml'],
1673
+ ['lha', 'application/octet-stream'],
1674
+ ['link66', 'application/vnd.route66.link66+xml'],
1675
+ ['list', 'text/plain'],
1676
+ ['list3820', 'application/vnd.ibm.modcap'],
1677
+ ['listafp', 'application/vnd.ibm.modcap'],
1678
+ ['litcoffee', 'text/coffeescript'],
1679
+ ['lnk', 'application/x-ms-shortcut'],
1680
+ ['log', 'text/plain'],
1681
+ ['lostxml', 'application/lost+xml'],
1682
+ ['lrf', 'application/octet-stream'],
1683
+ ['lrm', 'application/vnd.ms-lrm'],
1684
+ ['ltf', 'application/vnd.frogans.ltf'],
1685
+ ['lua', 'text/x-lua'],
1686
+ ['luac', 'application/x-lua-bytecode'],
1687
+ ['lvp', 'audio/vnd.lucent.voice'],
1688
+ ['lwp', 'application/vnd.lotus-wordpro'],
1689
+ ['lzh', 'application/octet-stream'],
1690
+ ['m1v', 'video/mpeg'],
1691
+ ['m2a', 'audio/mpeg'],
1692
+ ['m2v', 'video/mpeg'],
1693
+ ['m3a', 'audio/mpeg'],
1694
+ ['m3u', 'text/plain'],
1695
+ ['m3u8', 'application/vnd.apple.mpegurl'],
1696
+ ['m4a', 'audio/x-m4a'],
1697
+ ['m4p', 'application/mp4'],
1698
+ ['m4s', 'video/iso.segment'],
1699
+ ['m4u', 'application/vnd.mpegurl'],
1700
+ ['m4v', 'video/x-m4v'],
1701
+ ['m13', 'application/x-msmediaview'],
1702
+ ['m14', 'application/x-msmediaview'],
1703
+ ['m21', 'application/mp21'],
1704
+ ['ma', 'application/mathematica'],
1705
+ ['mads', 'application/mads+xml'],
1706
+ ['maei', 'application/mmt-aei+xml'],
1707
+ ['mag', 'application/vnd.ecowin.chart'],
1708
+ ['maker', 'application/vnd.framemaker'],
1709
+ ['man', 'text/troff'],
1710
+ ['manifest', 'text/cache-manifest'],
1711
+ ['map', 'application/json'],
1712
+ ['mar', 'application/octet-stream'],
1713
+ ['markdown', 'text/markdown'],
1714
+ ['mathml', 'application/mathml+xml'],
1715
+ ['mb', 'application/mathematica'],
1716
+ ['mbk', 'application/vnd.mobius.mbk'],
1717
+ ['mbox', 'application/mbox'],
1718
+ ['mc1', 'application/vnd.medcalcdata'],
1719
+ ['mcd', 'application/vnd.mcd'],
1720
+ ['mcurl', 'text/vnd.curl.mcurl'],
1721
+ ['md', 'text/markdown'],
1722
+ ['mdb', 'application/x-msaccess'],
1723
+ ['mdi', 'image/vnd.ms-modi'],
1724
+ ['mdx', 'text/mdx'],
1725
+ ['me', 'text/troff'],
1726
+ ['mesh', 'model/mesh'],
1727
+ ['meta4', 'application/metalink4+xml'],
1728
+ ['metalink', 'application/metalink+xml'],
1729
+ ['mets', 'application/mets+xml'],
1730
+ ['mfm', 'application/vnd.mfmp'],
1731
+ ['mft', 'application/rpki-manifest'],
1732
+ ['mgp', 'application/vnd.osgeo.mapguide.package'],
1733
+ ['mgz', 'application/vnd.proteus.magazine'],
1734
+ ['mid', 'audio/midi'],
1735
+ ['midi', 'audio/midi'],
1736
+ ['mie', 'application/x-mie'],
1737
+ ['mif', 'application/vnd.mif'],
1738
+ ['mime', 'message/rfc822'],
1739
+ ['mj2', 'video/mj2'],
1740
+ ['mjp2', 'video/mj2'],
1741
+ ['mjs', 'application/javascript'],
1742
+ ['mk3d', 'video/x-matroska'],
1743
+ ['mka', 'audio/x-matroska'],
1744
+ ['mkd', 'text/x-markdown'],
1745
+ ['mks', 'video/x-matroska'],
1746
+ ['mkv', 'video/x-matroska'],
1747
+ ['mlp', 'application/vnd.dolby.mlp'],
1748
+ ['mmd', 'application/vnd.chipnuts.karaoke-mmd'],
1749
+ ['mmf', 'application/vnd.smaf'],
1750
+ ['mml', 'text/mathml'],
1751
+ ['mmr', 'image/vnd.fujixerox.edmics-mmr'],
1752
+ ['mng', 'video/x-mng'],
1753
+ ['mny', 'application/x-msmoney'],
1754
+ ['mobi', 'application/x-mobipocket-ebook'],
1755
+ ['mods', 'application/mods+xml'],
1756
+ ['mov', 'video/quicktime'],
1757
+ ['movie', 'video/x-sgi-movie'],
1758
+ ['mp2', 'audio/mpeg'],
1759
+ ['mp2a', 'audio/mpeg'],
1760
+ ['mp3', 'audio/mpeg'],
1761
+ ['mp4', 'video/mp4'],
1762
+ ['mp4a', 'audio/mp4'],
1763
+ ['mp4s', 'application/mp4'],
1764
+ ['mp4v', 'video/mp4'],
1765
+ ['mp21', 'application/mp21'],
1766
+ ['mpc', 'application/vnd.mophun.certificate'],
1767
+ ['mpd', 'application/dash+xml'],
1768
+ ['mpe', 'video/mpeg'],
1769
+ ['mpeg', 'video/mpeg'],
1770
+ ['mpg', 'video/mpeg'],
1771
+ ['mpg4', 'video/mp4'],
1772
+ ['mpga', 'audio/mpeg'],
1773
+ ['mpkg', 'application/vnd.apple.installer+xml'],
1774
+ ['mpm', 'application/vnd.blueice.multipass'],
1775
+ ['mpn', 'application/vnd.mophun.application'],
1776
+ ['mpp', 'application/vnd.ms-project'],
1777
+ ['mpt', 'application/vnd.ms-project'],
1778
+ ['mpy', 'application/vnd.ibm.minipay'],
1779
+ ['mqy', 'application/vnd.mobius.mqy'],
1780
+ ['mrc', 'application/marc'],
1781
+ ['mrcx', 'application/marcxml+xml'],
1782
+ ['ms', 'text/troff'],
1783
+ ['mscml', 'application/mediaservercontrol+xml'],
1784
+ ['mseed', 'application/vnd.fdsn.mseed'],
1785
+ ['mseq', 'application/vnd.mseq'],
1786
+ ['msf', 'application/vnd.epson.msf'],
1787
+ ['msg', 'application/vnd.ms-outlook'],
1788
+ ['msh', 'model/mesh'],
1789
+ ['msi', 'application/x-msdownload'],
1790
+ ['msl', 'application/vnd.mobius.msl'],
1791
+ ['msm', 'application/octet-stream'],
1792
+ ['msp', 'application/octet-stream'],
1793
+ ['msty', 'application/vnd.muvee.style'],
1794
+ ['mtl', 'model/mtl'],
1795
+ ['mts', 'model/vnd.mts'],
1796
+ ['mus', 'application/vnd.musician'],
1797
+ ['musd', 'application/mmt-usd+xml'],
1798
+ ['musicxml', 'application/vnd.recordare.musicxml+xml'],
1799
+ ['mvb', 'application/x-msmediaview'],
1800
+ ['mvt', 'application/vnd.mapbox-vector-tile'],
1801
+ ['mwf', 'application/vnd.mfer'],
1802
+ ['mxf', 'application/mxf'],
1803
+ ['mxl', 'application/vnd.recordare.musicxml'],
1804
+ ['mxmf', 'audio/mobile-xmf'],
1805
+ ['mxml', 'application/xv+xml'],
1806
+ ['mxs', 'application/vnd.triscape.mxs'],
1807
+ ['mxu', 'video/vnd.mpegurl'],
1808
+ ['n-gage', 'application/vnd.nokia.n-gage.symbian.install'],
1809
+ ['n3', 'text/n3'],
1810
+ ['nb', 'application/mathematica'],
1811
+ ['nbp', 'application/vnd.wolfram.player'],
1812
+ ['nc', 'application/x-netcdf'],
1813
+ ['ncx', 'application/x-dtbncx+xml'],
1814
+ ['nfo', 'text/x-nfo'],
1815
+ ['ngdat', 'application/vnd.nokia.n-gage.data'],
1816
+ ['nitf', 'application/vnd.nitf'],
1817
+ ['nlu', 'application/vnd.neurolanguage.nlu'],
1818
+ ['nml', 'application/vnd.enliven'],
1819
+ ['nnd', 'application/vnd.noblenet-directory'],
1820
+ ['nns', 'application/vnd.noblenet-sealer'],
1821
+ ['nnw', 'application/vnd.noblenet-web'],
1822
+ ['npx', 'image/vnd.net-fpx'],
1823
+ ['nq', 'application/n-quads'],
1824
+ ['nsc', 'application/x-conference'],
1825
+ ['nsf', 'application/vnd.lotus-notes'],
1826
+ ['nt', 'application/n-triples'],
1827
+ ['ntf', 'application/vnd.nitf'],
1828
+ ['numbers', 'application/x-iwork-numbers-sffnumbers'],
1829
+ ['nzb', 'application/x-nzb'],
1830
+ ['oa2', 'application/vnd.fujitsu.oasys2'],
1831
+ ['oa3', 'application/vnd.fujitsu.oasys3'],
1832
+ ['oas', 'application/vnd.fujitsu.oasys'],
1833
+ ['obd', 'application/x-msbinder'],
1834
+ ['obgx', 'application/vnd.openblox.game+xml'],
1835
+ ['obj', 'model/obj'],
1836
+ ['oda', 'application/oda'],
1837
+ ['odb', 'application/vnd.oasis.opendocument.database'],
1838
+ ['odc', 'application/vnd.oasis.opendocument.chart'],
1839
+ ['odf', 'application/vnd.oasis.opendocument.formula'],
1840
+ ['odft', 'application/vnd.oasis.opendocument.formula-template'],
1841
+ ['odg', 'application/vnd.oasis.opendocument.graphics'],
1842
+ ['odi', 'application/vnd.oasis.opendocument.image'],
1843
+ ['odm', 'application/vnd.oasis.opendocument.text-master'],
1844
+ ['odp', 'application/vnd.oasis.opendocument.presentation'],
1845
+ ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
1846
+ ['odt', 'application/vnd.oasis.opendocument.text'],
1847
+ ['oga', 'audio/ogg'],
1848
+ ['ogex', 'model/vnd.opengex'],
1849
+ ['ogg', 'audio/ogg'],
1850
+ ['ogv', 'video/ogg'],
1851
+ ['ogx', 'application/ogg'],
1852
+ ['omdoc', 'application/omdoc+xml'],
1853
+ ['onepkg', 'application/onenote'],
1854
+ ['onetmp', 'application/onenote'],
1855
+ ['onetoc', 'application/onenote'],
1856
+ ['onetoc2', 'application/onenote'],
1857
+ ['opf', 'application/oebps-package+xml'],
1858
+ ['opml', 'text/x-opml'],
1859
+ ['oprc', 'application/vnd.palm'],
1860
+ ['opus', 'audio/ogg'],
1861
+ ['org', 'text/x-org'],
1862
+ ['osf', 'application/vnd.yamaha.openscoreformat'],
1863
+ ['osfpvg', 'application/vnd.yamaha.openscoreformat.osfpvg+xml'],
1864
+ ['osm', 'application/vnd.openstreetmap.data+xml'],
1865
+ ['otc', 'application/vnd.oasis.opendocument.chart-template'],
1866
+ ['otf', 'font/otf'],
1867
+ ['otg', 'application/vnd.oasis.opendocument.graphics-template'],
1868
+ ['oth', 'application/vnd.oasis.opendocument.text-web'],
1869
+ ['oti', 'application/vnd.oasis.opendocument.image-template'],
1870
+ ['otp', 'application/vnd.oasis.opendocument.presentation-template'],
1871
+ ['ots', 'application/vnd.oasis.opendocument.spreadsheet-template'],
1872
+ ['ott', 'application/vnd.oasis.opendocument.text-template'],
1873
+ ['ova', 'application/x-virtualbox-ova'],
1874
+ ['ovf', 'application/x-virtualbox-ovf'],
1875
+ ['owl', 'application/rdf+xml'],
1876
+ ['oxps', 'application/oxps'],
1877
+ ['oxt', 'application/vnd.openofficeorg.extension'],
1878
+ ['p', 'text/x-pascal'],
1879
+ ['p7a', 'application/x-pkcs7-signature'],
1880
+ ['p7b', 'application/x-pkcs7-certificates'],
1881
+ ['p7c', 'application/pkcs7-mime'],
1882
+ ['p7m', 'application/pkcs7-mime'],
1883
+ ['p7r', 'application/x-pkcs7-certreqresp'],
1884
+ ['p7s', 'application/pkcs7-signature'],
1885
+ ['p8', 'application/pkcs8'],
1886
+ ['p10', 'application/x-pkcs10'],
1887
+ ['p12', 'application/x-pkcs12'],
1888
+ ['pac', 'application/x-ns-proxy-autoconfig'],
1889
+ ['pages', 'application/x-iwork-pages-sffpages'],
1890
+ ['pas', 'text/x-pascal'],
1891
+ ['paw', 'application/vnd.pawaafile'],
1892
+ ['pbd', 'application/vnd.powerbuilder6'],
1893
+ ['pbm', 'image/x-portable-bitmap'],
1894
+ ['pcap', 'application/vnd.tcpdump.pcap'],
1895
+ ['pcf', 'application/x-font-pcf'],
1896
+ ['pcl', 'application/vnd.hp-pcl'],
1897
+ ['pclxl', 'application/vnd.hp-pclxl'],
1898
+ ['pct', 'image/x-pict'],
1899
+ ['pcurl', 'application/vnd.curl.pcurl'],
1900
+ ['pcx', 'image/x-pcx'],
1901
+ ['pdb', 'application/x-pilot'],
1902
+ ['pde', 'text/x-processing'],
1903
+ ['pdf', 'application/pdf'],
1904
+ ['pem', 'application/x-x509-user-cert'],
1905
+ ['pfa', 'application/x-font-type1'],
1906
+ ['pfb', 'application/x-font-type1'],
1907
+ ['pfm', 'application/x-font-type1'],
1908
+ ['pfr', 'application/font-tdpfr'],
1909
+ ['pfx', 'application/x-pkcs12'],
1910
+ ['pgm', 'image/x-portable-graymap'],
1911
+ ['pgn', 'application/x-chess-pgn'],
1912
+ ['pgp', 'application/pgp'],
1913
+ ['php', 'application/x-httpd-php'],
1914
+ ['php3', 'application/x-httpd-php'],
1915
+ ['php4', 'application/x-httpd-php'],
1916
+ ['phps', 'application/x-httpd-php-source'],
1917
+ ['phtml', 'application/x-httpd-php'],
1918
+ ['pic', 'image/x-pict'],
1919
+ ['pkg', 'application/octet-stream'],
1920
+ ['pki', 'application/pkixcmp'],
1921
+ ['pkipath', 'application/pkix-pkipath'],
1922
+ ['pkpass', 'application/vnd.apple.pkpass'],
1923
+ ['pl', 'application/x-perl'],
1924
+ ['plb', 'application/vnd.3gpp.pic-bw-large'],
1925
+ ['plc', 'application/vnd.mobius.plc'],
1926
+ ['plf', 'application/vnd.pocketlearn'],
1927
+ ['pls', 'application/pls+xml'],
1928
+ ['pm', 'application/x-perl'],
1929
+ ['pml', 'application/vnd.ctc-posml'],
1930
+ ['png', 'image/png'],
1931
+ ['pnm', 'image/x-portable-anymap'],
1932
+ ['portpkg', 'application/vnd.macports.portpkg'],
1933
+ ['pot', 'application/vnd.ms-powerpoint'],
1934
+ ['potm', 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'],
1935
+ ['potx', 'application/vnd.openxmlformats-officedocument.presentationml.template'],
1936
+ ['ppa', 'application/vnd.ms-powerpoint'],
1937
+ ['ppam', 'application/vnd.ms-powerpoint.addin.macroEnabled.12'],
1938
+ ['ppd', 'application/vnd.cups-ppd'],
1939
+ ['ppm', 'image/x-portable-pixmap'],
1940
+ ['pps', 'application/vnd.ms-powerpoint'],
1941
+ ['ppsm', 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'],
1942
+ ['ppsx', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'],
1943
+ ['ppt', 'application/powerpoint'],
1944
+ ['pptm', 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'],
1945
+ ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
1946
+ ['pqa', 'application/vnd.palm'],
1947
+ ['prc', 'application/x-pilot'],
1948
+ ['pre', 'application/vnd.lotus-freelance'],
1949
+ ['prf', 'application/pics-rules'],
1950
+ ['provx', 'application/provenance+xml'],
1951
+ ['ps', 'application/postscript'],
1952
+ ['psb', 'application/vnd.3gpp.pic-bw-small'],
1953
+ ['psd', 'application/x-photoshop'],
1954
+ ['psf', 'application/x-font-linux-psf'],
1955
+ ['pskcxml', 'application/pskc+xml'],
1956
+ ['pti', 'image/prs.pti'],
1957
+ ['ptid', 'application/vnd.pvi.ptid1'],
1958
+ ['pub', 'application/x-mspublisher'],
1959
+ ['pvb', 'application/vnd.3gpp.pic-bw-var'],
1960
+ ['pwn', 'application/vnd.3m.post-it-notes'],
1961
+ ['pya', 'audio/vnd.ms-playready.media.pya'],
1962
+ ['pyv', 'video/vnd.ms-playready.media.pyv'],
1963
+ ['qam', 'application/vnd.epson.quickanime'],
1964
+ ['qbo', 'application/vnd.intu.qbo'],
1965
+ ['qfx', 'application/vnd.intu.qfx'],
1966
+ ['qps', 'application/vnd.publishare-delta-tree'],
1967
+ ['qt', 'video/quicktime'],
1968
+ ['qwd', 'application/vnd.quark.quarkxpress'],
1969
+ ['qwt', 'application/vnd.quark.quarkxpress'],
1970
+ ['qxb', 'application/vnd.quark.quarkxpress'],
1971
+ ['qxd', 'application/vnd.quark.quarkxpress'],
1972
+ ['qxl', 'application/vnd.quark.quarkxpress'],
1973
+ ['qxt', 'application/vnd.quark.quarkxpress'],
1974
+ ['ra', 'audio/x-realaudio'],
1975
+ ['ram', 'audio/x-pn-realaudio'],
1976
+ ['raml', 'application/raml+yaml'],
1977
+ ['rapd', 'application/route-apd+xml'],
1978
+ ['rar', 'application/x-rar'],
1979
+ ['ras', 'image/x-cmu-raster'],
1980
+ ['rcprofile', 'application/vnd.ipunplugged.rcprofile'],
1981
+ ['rdf', 'application/rdf+xml'],
1982
+ ['rdz', 'application/vnd.data-vision.rdz'],
1983
+ ['relo', 'application/p2p-overlay+xml'],
1984
+ ['rep', 'application/vnd.businessobjects'],
1985
+ ['res', 'application/x-dtbresource+xml'],
1986
+ ['rgb', 'image/x-rgb'],
1987
+ ['rif', 'application/reginfo+xml'],
1988
+ ['rip', 'audio/vnd.rip'],
1989
+ ['ris', 'application/x-research-info-systems'],
1990
+ ['rl', 'application/resource-lists+xml'],
1991
+ ['rlc', 'image/vnd.fujixerox.edmics-rlc'],
1992
+ ['rld', 'application/resource-lists-diff+xml'],
1993
+ ['rm', 'audio/x-pn-realaudio'],
1994
+ ['rmi', 'audio/midi'],
1995
+ ['rmp', 'audio/x-pn-realaudio-plugin'],
1996
+ ['rms', 'application/vnd.jcp.javame.midlet-rms'],
1997
+ ['rmvb', 'application/vnd.rn-realmedia-vbr'],
1998
+ ['rnc', 'application/relax-ng-compact-syntax'],
1999
+ ['rng', 'application/xml'],
2000
+ ['roa', 'application/rpki-roa'],
2001
+ ['roff', 'text/troff'],
2002
+ ['rp9', 'application/vnd.cloanto.rp9'],
2003
+ ['rpm', 'audio/x-pn-realaudio-plugin'],
2004
+ ['rpss', 'application/vnd.nokia.radio-presets'],
2005
+ ['rpst', 'application/vnd.nokia.radio-preset'],
2006
+ ['rq', 'application/sparql-query'],
2007
+ ['rs', 'application/rls-services+xml'],
2008
+ ['rsa', 'application/x-pkcs7'],
2009
+ ['rsat', 'application/atsc-rsat+xml'],
2010
+ ['rsd', 'application/rsd+xml'],
2011
+ ['rsheet', 'application/urc-ressheet+xml'],
2012
+ ['rss', 'application/rss+xml'],
2013
+ ['rtf', 'text/rtf'],
2014
+ ['rtx', 'text/richtext'],
2015
+ ['run', 'application/x-makeself'],
2016
+ ['rusd', 'application/route-usd+xml'],
2017
+ ['rv', 'video/vnd.rn-realvideo'],
2018
+ ['s', 'text/x-asm'],
2019
+ ['s3m', 'audio/s3m'],
2020
+ ['saf', 'application/vnd.yamaha.smaf-audio'],
2021
+ ['sass', 'text/x-sass'],
2022
+ ['sbml', 'application/sbml+xml'],
2023
+ ['sc', 'application/vnd.ibm.secure-container'],
2024
+ ['scd', 'application/x-msschedule'],
2025
+ ['scm', 'application/vnd.lotus-screencam'],
2026
+ ['scq', 'application/scvp-cv-request'],
2027
+ ['scs', 'application/scvp-cv-response'],
2028
+ ['scss', 'text/x-scss'],
2029
+ ['scurl', 'text/vnd.curl.scurl'],
2030
+ ['sda', 'application/vnd.stardivision.draw'],
2031
+ ['sdc', 'application/vnd.stardivision.calc'],
2032
+ ['sdd', 'application/vnd.stardivision.impress'],
2033
+ ['sdkd', 'application/vnd.solent.sdkm+xml'],
2034
+ ['sdkm', 'application/vnd.solent.sdkm+xml'],
2035
+ ['sdp', 'application/sdp'],
2036
+ ['sdw', 'application/vnd.stardivision.writer'],
2037
+ ['sea', 'application/octet-stream'],
2038
+ ['see', 'application/vnd.seemail'],
2039
+ ['seed', 'application/vnd.fdsn.seed'],
2040
+ ['sema', 'application/vnd.sema'],
2041
+ ['semd', 'application/vnd.semd'],
2042
+ ['semf', 'application/vnd.semf'],
2043
+ ['senmlx', 'application/senml+xml'],
2044
+ ['sensmlx', 'application/sensml+xml'],
2045
+ ['ser', 'application/java-serialized-object'],
2046
+ ['setpay', 'application/set-payment-initiation'],
2047
+ ['setreg', 'application/set-registration-initiation'],
2048
+ ['sfd-hdstx', 'application/vnd.hydrostatix.sof-data'],
2049
+ ['sfs', 'application/vnd.spotfire.sfs'],
2050
+ ['sfv', 'text/x-sfv'],
2051
+ ['sgi', 'image/sgi'],
2052
+ ['sgl', 'application/vnd.stardivision.writer-global'],
2053
+ ['sgm', 'text/sgml'],
2054
+ ['sgml', 'text/sgml'],
2055
+ ['sh', 'application/x-sh'],
2056
+ ['shar', 'application/x-shar'],
2057
+ ['shex', 'text/shex'],
2058
+ ['shf', 'application/shf+xml'],
2059
+ ['shtml', 'text/html'],
2060
+ ['sid', 'image/x-mrsid-image'],
2061
+ ['sieve', 'application/sieve'],
2062
+ ['sig', 'application/pgp-signature'],
2063
+ ['sil', 'audio/silk'],
2064
+ ['silo', 'model/mesh'],
2065
+ ['sis', 'application/vnd.symbian.install'],
2066
+ ['sisx', 'application/vnd.symbian.install'],
2067
+ ['sit', 'application/x-stuffit'],
2068
+ ['sitx', 'application/x-stuffitx'],
2069
+ ['siv', 'application/sieve'],
2070
+ ['skd', 'application/vnd.koan'],
2071
+ ['skm', 'application/vnd.koan'],
2072
+ ['skp', 'application/vnd.koan'],
2073
+ ['skt', 'application/vnd.koan'],
2074
+ ['sldm', 'application/vnd.ms-powerpoint.slide.macroenabled.12'],
2075
+ ['sldx', 'application/vnd.openxmlformats-officedocument.presentationml.slide'],
2076
+ ['slim', 'text/slim'],
2077
+ ['slm', 'text/slim'],
2078
+ ['sls', 'application/route-s-tsid+xml'],
2079
+ ['slt', 'application/vnd.epson.salt'],
2080
+ ['sm', 'application/vnd.stepmania.stepchart'],
2081
+ ['smf', 'application/vnd.stardivision.math'],
2082
+ ['smi', 'application/smil'],
2083
+ ['smil', 'application/smil'],
2084
+ ['smv', 'video/x-smv'],
2085
+ ['smzip', 'application/vnd.stepmania.package'],
2086
+ ['snd', 'audio/basic'],
2087
+ ['snf', 'application/x-font-snf'],
2088
+ ['so', 'application/octet-stream'],
2089
+ ['spc', 'application/x-pkcs7-certificates'],
2090
+ ['spdx', 'text/spdx'],
2091
+ ['spf', 'application/vnd.yamaha.smaf-phrase'],
2092
+ ['spl', 'application/x-futuresplash'],
2093
+ ['spot', 'text/vnd.in3d.spot'],
2094
+ ['spp', 'application/scvp-vp-response'],
2095
+ ['spq', 'application/scvp-vp-request'],
2096
+ ['spx', 'audio/ogg'],
2097
+ ['sql', 'application/x-sql'],
2098
+ ['src', 'application/x-wais-source'],
2099
+ ['srt', 'application/x-subrip'],
2100
+ ['sru', 'application/sru+xml'],
2101
+ ['srx', 'application/sparql-results+xml'],
2102
+ ['ssdl', 'application/ssdl+xml'],
2103
+ ['sse', 'application/vnd.kodak-descriptor'],
2104
+ ['ssf', 'application/vnd.epson.ssf'],
2105
+ ['ssml', 'application/ssml+xml'],
2106
+ ['sst', 'application/octet-stream'],
2107
+ ['st', 'application/vnd.sailingtracker.track'],
2108
+ ['stc', 'application/vnd.sun.xml.calc.template'],
2109
+ ['std', 'application/vnd.sun.xml.draw.template'],
2110
+ ['stf', 'application/vnd.wt.stf'],
2111
+ ['sti', 'application/vnd.sun.xml.impress.template'],
2112
+ ['stk', 'application/hyperstudio'],
2113
+ ['stl', 'model/stl'],
2114
+ ['stpx', 'model/step+xml'],
2115
+ ['stpxz', 'model/step-xml+zip'],
2116
+ ['stpz', 'model/step+zip'],
2117
+ ['str', 'application/vnd.pg.format'],
2118
+ ['stw', 'application/vnd.sun.xml.writer.template'],
2119
+ ['styl', 'text/stylus'],
2120
+ ['stylus', 'text/stylus'],
2121
+ ['sub', 'text/vnd.dvb.subtitle'],
2122
+ ['sus', 'application/vnd.sus-calendar'],
2123
+ ['susp', 'application/vnd.sus-calendar'],
2124
+ ['sv4cpio', 'application/x-sv4cpio'],
2125
+ ['sv4crc', 'application/x-sv4crc'],
2126
+ ['svc', 'application/vnd.dvb.service'],
2127
+ ['svd', 'application/vnd.svd'],
2128
+ ['svg', 'image/svg+xml'],
2129
+ ['svgz', 'image/svg+xml'],
2130
+ ['swa', 'application/x-director'],
2131
+ ['swf', 'application/x-shockwave-flash'],
2132
+ ['swi', 'application/vnd.aristanetworks.swi'],
2133
+ ['swidtag', 'application/swid+xml'],
2134
+ ['sxc', 'application/vnd.sun.xml.calc'],
2135
+ ['sxd', 'application/vnd.sun.xml.draw'],
2136
+ ['sxg', 'application/vnd.sun.xml.writer.global'],
2137
+ ['sxi', 'application/vnd.sun.xml.impress'],
2138
+ ['sxm', 'application/vnd.sun.xml.math'],
2139
+ ['sxw', 'application/vnd.sun.xml.writer'],
2140
+ ['t', 'text/troff'],
2141
+ ['t3', 'application/x-t3vm-image'],
2142
+ ['t38', 'image/t38'],
2143
+ ['taglet', 'application/vnd.mynfc'],
2144
+ ['tao', 'application/vnd.tao.intent-module-archive'],
2145
+ ['tap', 'image/vnd.tencent.tap'],
2146
+ ['tar', 'application/x-tar'],
2147
+ ['tcap', 'application/vnd.3gpp2.tcap'],
2148
+ ['tcl', 'application/x-tcl'],
2149
+ ['td', 'application/urc-targetdesc+xml'],
2150
+ ['teacher', 'application/vnd.smart.teacher'],
2151
+ ['tei', 'application/tei+xml'],
2152
+ ['teicorpus', 'application/tei+xml'],
2153
+ ['tex', 'application/x-tex'],
2154
+ ['texi', 'application/x-texinfo'],
2155
+ ['texinfo', 'application/x-texinfo'],
2156
+ ['text', 'text/plain'],
2157
+ ['tfi', 'application/thraud+xml'],
2158
+ ['tfm', 'application/x-tex-tfm'],
2159
+ ['tfx', 'image/tiff-fx'],
2160
+ ['tga', 'image/x-tga'],
2161
+ ['tgz', 'application/x-tar'],
2162
+ ['thmx', 'application/vnd.ms-officetheme'],
2163
+ ['tif', 'image/tiff'],
2164
+ ['tiff', 'image/tiff'],
2165
+ ['tk', 'application/x-tcl'],
2166
+ ['tmo', 'application/vnd.tmobile-livetv'],
2167
+ ['toml', 'application/toml'],
2168
+ ['torrent', 'application/x-bittorrent'],
2169
+ ['tpl', 'application/vnd.groove-tool-template'],
2170
+ ['tpt', 'application/vnd.trid.tpt'],
2171
+ ['tr', 'text/troff'],
2172
+ ['tra', 'application/vnd.trueapp'],
2173
+ ['trig', 'application/trig'],
2174
+ ['trm', 'application/x-msterminal'],
2175
+ ['ts', 'video/mp2t'],
2176
+ ['tsd', 'application/timestamped-data'],
2177
+ ['tsv', 'text/tab-separated-values'],
2178
+ ['ttc', 'font/collection'],
2179
+ ['ttf', 'font/ttf'],
2180
+ ['ttl', 'text/turtle'],
2181
+ ['ttml', 'application/ttml+xml'],
2182
+ ['twd', 'application/vnd.simtech-mindmapper'],
2183
+ ['twds', 'application/vnd.simtech-mindmapper'],
2184
+ ['txd', 'application/vnd.genomatix.tuxedo'],
2185
+ ['txf', 'application/vnd.mobius.txf'],
2186
+ ['txt', 'text/plain'],
2187
+ ['u8dsn', 'message/global-delivery-status'],
2188
+ ['u8hdr', 'message/global-headers'],
2189
+ ['u8mdn', 'message/global-disposition-notification'],
2190
+ ['u8msg', 'message/global'],
2191
+ ['u32', 'application/x-authorware-bin'],
2192
+ ['ubj', 'application/ubjson'],
2193
+ ['udeb', 'application/x-debian-package'],
2194
+ ['ufd', 'application/vnd.ufdl'],
2195
+ ['ufdl', 'application/vnd.ufdl'],
2196
+ ['ulx', 'application/x-glulx'],
2197
+ ['umj', 'application/vnd.umajin'],
2198
+ ['unityweb', 'application/vnd.unity'],
2199
+ ['uoml', 'application/vnd.uoml+xml'],
2200
+ ['uri', 'text/uri-list'],
2201
+ ['uris', 'text/uri-list'],
2202
+ ['urls', 'text/uri-list'],
2203
+ ['usdz', 'model/vnd.usdz+zip'],
2204
+ ['ustar', 'application/x-ustar'],
2205
+ ['utz', 'application/vnd.uiq.theme'],
2206
+ ['uu', 'text/x-uuencode'],
2207
+ ['uva', 'audio/vnd.dece.audio'],
2208
+ ['uvd', 'application/vnd.dece.data'],
2209
+ ['uvf', 'application/vnd.dece.data'],
2210
+ ['uvg', 'image/vnd.dece.graphic'],
2211
+ ['uvh', 'video/vnd.dece.hd'],
2212
+ ['uvi', 'image/vnd.dece.graphic'],
2213
+ ['uvm', 'video/vnd.dece.mobile'],
2214
+ ['uvp', 'video/vnd.dece.pd'],
2215
+ ['uvs', 'video/vnd.dece.sd'],
2216
+ ['uvt', 'application/vnd.dece.ttml+xml'],
2217
+ ['uvu', 'video/vnd.uvvu.mp4'],
2218
+ ['uvv', 'video/vnd.dece.video'],
2219
+ ['uvva', 'audio/vnd.dece.audio'],
2220
+ ['uvvd', 'application/vnd.dece.data'],
2221
+ ['uvvf', 'application/vnd.dece.data'],
2222
+ ['uvvg', 'image/vnd.dece.graphic'],
2223
+ ['uvvh', 'video/vnd.dece.hd'],
2224
+ ['uvvi', 'image/vnd.dece.graphic'],
2225
+ ['uvvm', 'video/vnd.dece.mobile'],
2226
+ ['uvvp', 'video/vnd.dece.pd'],
2227
+ ['uvvs', 'video/vnd.dece.sd'],
2228
+ ['uvvt', 'application/vnd.dece.ttml+xml'],
2229
+ ['uvvu', 'video/vnd.uvvu.mp4'],
2230
+ ['uvvv', 'video/vnd.dece.video'],
2231
+ ['uvvx', 'application/vnd.dece.unspecified'],
2232
+ ['uvvz', 'application/vnd.dece.zip'],
2233
+ ['uvx', 'application/vnd.dece.unspecified'],
2234
+ ['uvz', 'application/vnd.dece.zip'],
2235
+ ['vbox', 'application/x-virtualbox-vbox'],
2236
+ ['vbox-extpack', 'application/x-virtualbox-vbox-extpack'],
2237
+ ['vcard', 'text/vcard'],
2238
+ ['vcd', 'application/x-cdlink'],
2239
+ ['vcf', 'text/x-vcard'],
2240
+ ['vcg', 'application/vnd.groove-vcard'],
2241
+ ['vcs', 'text/x-vcalendar'],
2242
+ ['vcx', 'application/vnd.vcx'],
2243
+ ['vdi', 'application/x-virtualbox-vdi'],
2244
+ ['vds', 'model/vnd.sap.vds'],
2245
+ ['vhd', 'application/x-virtualbox-vhd'],
2246
+ ['vis', 'application/vnd.visionary'],
2247
+ ['viv', 'video/vnd.vivo'],
2248
+ ['vlc', 'application/videolan'],
2249
+ ['vmdk', 'application/x-virtualbox-vmdk'],
2250
+ ['vob', 'video/x-ms-vob'],
2251
+ ['vor', 'application/vnd.stardivision.writer'],
2252
+ ['vox', 'application/x-authorware-bin'],
2253
+ ['vrml', 'model/vrml'],
2254
+ ['vsd', 'application/vnd.visio'],
2255
+ ['vsf', 'application/vnd.vsf'],
2256
+ ['vss', 'application/vnd.visio'],
2257
+ ['vst', 'application/vnd.visio'],
2258
+ ['vsw', 'application/vnd.visio'],
2259
+ ['vtf', 'image/vnd.valve.source.texture'],
2260
+ ['vtt', 'text/vtt'],
2261
+ ['vtu', 'model/vnd.vtu'],
2262
+ ['vxml', 'application/voicexml+xml'],
2263
+ ['w3d', 'application/x-director'],
2264
+ ['wad', 'application/x-doom'],
2265
+ ['wadl', 'application/vnd.sun.wadl+xml'],
2266
+ ['war', 'application/java-archive'],
2267
+ ['wasm', 'application/wasm'],
2268
+ ['wav', 'audio/x-wav'],
2269
+ ['wax', 'audio/x-ms-wax'],
2270
+ ['wbmp', 'image/vnd.wap.wbmp'],
2271
+ ['wbs', 'application/vnd.criticaltools.wbs+xml'],
2272
+ ['wbxml', 'application/wbxml'],
2273
+ ['wcm', 'application/vnd.ms-works'],
2274
+ ['wdb', 'application/vnd.ms-works'],
2275
+ ['wdp', 'image/vnd.ms-photo'],
2276
+ ['weba', 'audio/webm'],
2277
+ ['webapp', 'application/x-web-app-manifest+json'],
2278
+ ['webm', 'video/webm'],
2279
+ ['webmanifest', 'application/manifest+json'],
2280
+ ['webp', 'image/webp'],
2281
+ ['wg', 'application/vnd.pmi.widget'],
2282
+ ['wgt', 'application/widget'],
2283
+ ['wks', 'application/vnd.ms-works'],
2284
+ ['wm', 'video/x-ms-wm'],
2285
+ ['wma', 'audio/x-ms-wma'],
2286
+ ['wmd', 'application/x-ms-wmd'],
2287
+ ['wmf', 'image/wmf'],
2288
+ ['wml', 'text/vnd.wap.wml'],
2289
+ ['wmlc', 'application/wmlc'],
2290
+ ['wmls', 'text/vnd.wap.wmlscript'],
2291
+ ['wmlsc', 'application/vnd.wap.wmlscriptc'],
2292
+ ['wmv', 'video/x-ms-wmv'],
2293
+ ['wmx', 'video/x-ms-wmx'],
2294
+ ['wmz', 'application/x-msmetafile'],
2295
+ ['woff', 'font/woff'],
2296
+ ['woff2', 'font/woff2'],
2297
+ ['word', 'application/msword'],
2298
+ ['wpd', 'application/vnd.wordperfect'],
2299
+ ['wpl', 'application/vnd.ms-wpl'],
2300
+ ['wps', 'application/vnd.ms-works'],
2301
+ ['wqd', 'application/vnd.wqd'],
2302
+ ['wri', 'application/x-mswrite'],
2303
+ ['wrl', 'model/vrml'],
2304
+ ['wsc', 'message/vnd.wfa.wsc'],
2305
+ ['wsdl', 'application/wsdl+xml'],
2306
+ ['wspolicy', 'application/wspolicy+xml'],
2307
+ ['wtb', 'application/vnd.webturbo'],
2308
+ ['wvx', 'video/x-ms-wvx'],
2309
+ ['x3d', 'model/x3d+xml'],
2310
+ ['x3db', 'model/x3d+fastinfoset'],
2311
+ ['x3dbz', 'model/x3d+binary'],
2312
+ ['x3dv', 'model/x3d-vrml'],
2313
+ ['x3dvz', 'model/x3d+vrml'],
2314
+ ['x3dz', 'model/x3d+xml'],
2315
+ ['x32', 'application/x-authorware-bin'],
2316
+ ['x_b', 'model/vnd.parasolid.transmit.binary'],
2317
+ ['x_t', 'model/vnd.parasolid.transmit.text'],
2318
+ ['xaml', 'application/xaml+xml'],
2319
+ ['xap', 'application/x-silverlight-app'],
2320
+ ['xar', 'application/vnd.xara'],
2321
+ ['xav', 'application/xcap-att+xml'],
2322
+ ['xbap', 'application/x-ms-xbap'],
2323
+ ['xbd', 'application/vnd.fujixerox.docuworks.binder'],
2324
+ ['xbm', 'image/x-xbitmap'],
2325
+ ['xca', 'application/xcap-caps+xml'],
2326
+ ['xcs', 'application/calendar+xml'],
2327
+ ['xdf', 'application/xcap-diff+xml'],
2328
+ ['xdm', 'application/vnd.syncml.dm+xml'],
2329
+ ['xdp', 'application/vnd.adobe.xdp+xml'],
2330
+ ['xdssc', 'application/dssc+xml'],
2331
+ ['xdw', 'application/vnd.fujixerox.docuworks'],
2332
+ ['xel', 'application/xcap-el+xml'],
2333
+ ['xenc', 'application/xenc+xml'],
2334
+ ['xer', 'application/patch-ops-error+xml'],
2335
+ ['xfdf', 'application/vnd.adobe.xfdf'],
2336
+ ['xfdl', 'application/vnd.xfdl'],
2337
+ ['xht', 'application/xhtml+xml'],
2338
+ ['xhtml', 'application/xhtml+xml'],
2339
+ ['xhvml', 'application/xv+xml'],
2340
+ ['xif', 'image/vnd.xiff'],
2341
+ ['xl', 'application/excel'],
2342
+ ['xla', 'application/vnd.ms-excel'],
2343
+ ['xlam', 'application/vnd.ms-excel.addin.macroEnabled.12'],
2344
+ ['xlc', 'application/vnd.ms-excel'],
2345
+ ['xlf', 'application/xliff+xml'],
2346
+ ['xlm', 'application/vnd.ms-excel'],
2347
+ ['xls', 'application/vnd.ms-excel'],
2348
+ ['xlsb', 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'],
2349
+ ['xlsm', 'application/vnd.ms-excel.sheet.macroEnabled.12'],
2350
+ ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
2351
+ ['xlt', 'application/vnd.ms-excel'],
2352
+ ['xltm', 'application/vnd.ms-excel.template.macroEnabled.12'],
2353
+ ['xltx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'],
2354
+ ['xlw', 'application/vnd.ms-excel'],
2355
+ ['xm', 'audio/xm'],
2356
+ ['xml', 'application/xml'],
2357
+ ['xns', 'application/xcap-ns+xml'],
2358
+ ['xo', 'application/vnd.olpc-sugar'],
2359
+ ['xop', 'application/xop+xml'],
2360
+ ['xpi', 'application/x-xpinstall'],
2361
+ ['xpl', 'application/xproc+xml'],
2362
+ ['xpm', 'image/x-xpixmap'],
2363
+ ['xpr', 'application/vnd.is-xpr'],
2364
+ ['xps', 'application/vnd.ms-xpsdocument'],
2365
+ ['xpw', 'application/vnd.intercon.formnet'],
2366
+ ['xpx', 'application/vnd.intercon.formnet'],
2367
+ ['xsd', 'application/xml'],
2368
+ ['xsl', 'application/xml'],
2369
+ ['xslt', 'application/xslt+xml'],
2370
+ ['xsm', 'application/vnd.syncml+xml'],
2371
+ ['xspf', 'application/xspf+xml'],
2372
+ ['xul', 'application/vnd.mozilla.xul+xml'],
2373
+ ['xvm', 'application/xv+xml'],
2374
+ ['xvml', 'application/xv+xml'],
2375
+ ['xwd', 'image/x-xwindowdump'],
2376
+ ['xyz', 'chemical/x-xyz'],
2377
+ ['xz', 'application/x-xz'],
2378
+ ['yaml', 'text/yaml'],
2379
+ ['yang', 'application/yang'],
2380
+ ['yin', 'application/yin+xml'],
2381
+ ['yml', 'text/yaml'],
2382
+ ['ymp', 'text/x-suse-ymp'],
2383
+ ['z', 'application/x-compress'],
2384
+ ['z1', 'application/x-zmachine'],
2385
+ ['z2', 'application/x-zmachine'],
2386
+ ['z3', 'application/x-zmachine'],
2387
+ ['z4', 'application/x-zmachine'],
2388
+ ['z5', 'application/x-zmachine'],
2389
+ ['z6', 'application/x-zmachine'],
2390
+ ['z7', 'application/x-zmachine'],
2391
+ ['z8', 'application/x-zmachine'],
2392
+ ['zaz', 'application/vnd.zzazz.deck+xml'],
2393
+ ['zip', 'application/zip'],
2394
+ ['zir', 'application/vnd.zul'],
2395
+ ['zirz', 'application/vnd.zul'],
2396
+ ['zmm', 'application/vnd.handheld-entertainment+xml'],
2397
+ ['zsh', 'text/x-scriptzsh']
2398
+ ]);
2399
+ function toFileWithPath(file, path, h) {
2400
+ const f = withMimeType(file);
2401
+ const { webkitRelativePath } = file;
2402
+ const p = typeof path === 'string'
2403
+ ? path
2404
+ // If <input webkitdirectory> is set,
2405
+ // the File will have a {webkitRelativePath} property
2406
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
2407
+ : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
2408
+ ? webkitRelativePath
2409
+ : `./${file.name}`;
2410
+ if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
2411
+ setObjProp(f, 'path', p);
2412
+ }
2413
+ // Always populate a relative path so that even electron apps have access to a relativePath value
2414
+ setObjProp(f, 'relativePath', p);
2415
+ return f;
2416
+ }
2417
+ function withMimeType(file) {
2418
+ const { name } = file;
2419
+ const hasExtension = name && name.lastIndexOf('.') !== -1;
2420
+ if (hasExtension && !file.type) {
2421
+ const ext = name.split('.')
2422
+ .pop().toLowerCase();
2423
+ const type = COMMON_MIME_TYPES.get(ext);
2424
+ if (type) {
2425
+ Object.defineProperty(file, 'type', {
2426
+ value: type,
2427
+ writable: false,
2428
+ configurable: false,
2429
+ enumerable: true
2430
+ });
2431
+ }
2432
+ }
2433
+ return file;
2434
+ }
2435
+ function setObjProp(f, key, value) {
2436
+ Object.defineProperty(f, key, {
2437
+ value,
2438
+ writable: false,
2439
+ configurable: false,
2440
+ enumerable: true
2441
+ });
2442
+ }
2443
+
2444
+ const FILES_TO_IGNORE = [
2445
+ // Thumbnail cache files for macOS and Windows
2446
+ '.DS_Store', // macOs
2447
+ 'Thumbs.db' // Windows
2448
+ ];
2449
+ /**
2450
+ * Convert a DragEvent's DataTrasfer object to a list of File objects
2451
+ * NOTE: If some of the items are folders,
2452
+ * everything will be flattened and placed in the same list but the paths will be kept as a {path} property.
2453
+ *
2454
+ * EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg
2455
+ * and a list of File objects will be returned.
2456
+ *
2457
+ * @param evt
2458
+ */
2459
+ function fromEvent(evt) {
2460
+ return __awaiter(this, void 0, void 0, function* () {
2461
+ if (isObject$1(evt) && isDataTransfer(evt.dataTransfer)) {
2462
+ return getDataTransferFiles(evt.dataTransfer, evt.type);
2463
+ }
2464
+ else if (isChangeEvt(evt)) {
2465
+ return getInputFiles(evt);
2466
+ }
2467
+ else if (Array.isArray(evt) && evt.every(item => 'getFile' in item && typeof item.getFile === 'function')) {
2468
+ return getFsHandleFiles(evt);
2469
+ }
2470
+ return [];
2471
+ });
2472
+ }
2473
+ function isDataTransfer(value) {
2474
+ return isObject$1(value);
2475
+ }
2476
+ function isChangeEvt(value) {
2477
+ return isObject$1(value) && isObject$1(value.target);
2478
+ }
2479
+ function isObject$1(v) {
2480
+ return typeof v === 'object' && v !== null;
2481
+ }
2482
+ function getInputFiles(evt) {
2483
+ return fromList(evt.target.files).map(file => toFileWithPath(file));
2484
+ }
2485
+ // Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
2486
+ function getFsHandleFiles(handles) {
2487
+ return __awaiter(this, void 0, void 0, function* () {
2488
+ const files = yield Promise.all(handles.map(h => h.getFile()));
2489
+ return files.map(file => toFileWithPath(file));
2490
+ });
2491
+ }
2492
+ function getDataTransferFiles(dt, type) {
2493
+ return __awaiter(this, void 0, void 0, function* () {
2494
+ // IE11 does not support dataTransfer.items
2495
+ // See https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/items#Browser_compatibility
2496
+ if (dt.items) {
2497
+ const items = fromList(dt.items)
2498
+ .filter(item => item.kind === 'file');
2499
+ // According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents,
2500
+ // only 'dragstart' and 'drop' has access to the data (source node)
2501
+ if (type !== 'drop') {
2502
+ return items;
2503
+ }
2504
+ const files = yield Promise.all(items.map(toFilePromises));
2505
+ return noIgnoredFiles(flatten(files));
2506
+ }
2507
+ return noIgnoredFiles(fromList(dt.files)
2508
+ .map(file => toFileWithPath(file)));
2509
+ });
2510
+ }
2511
+ function noIgnoredFiles(files) {
2512
+ return files.filter(file => FILES_TO_IGNORE.indexOf(file.name) === -1);
2513
+ }
2514
+ // IE11 does not support Array.from()
2515
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
2516
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileList
2517
+ // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList
2518
+ function fromList(items) {
2519
+ if (items === null) {
2520
+ return [];
2521
+ }
2522
+ const files = [];
2523
+ // tslint:disable: prefer-for-of
2524
+ for (let i = 0; i < items.length; i++) {
2525
+ const file = items[i];
2526
+ files.push(file);
2527
+ }
2528
+ return files;
2529
+ }
2530
+ // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
2531
+ function toFilePromises(item) {
2532
+ if (typeof item.webkitGetAsEntry !== 'function') {
2533
+ return fromDataTransferItem(item);
2534
+ }
2535
+ const entry = item.webkitGetAsEntry();
2536
+ // Safari supports dropping an image node from a different window and can be retrieved using
2537
+ // the DataTransferItem.getAsFile() API
2538
+ // NOTE: FileSystemEntry.file() throws if trying to get the file
2539
+ if (entry && entry.isDirectory) {
2540
+ return fromDirEntry(entry);
2541
+ }
2542
+ return fromDataTransferItem(item, entry);
2543
+ }
2544
+ function flatten(items) {
2545
+ return items.reduce((acc, files) => [
2546
+ ...acc,
2547
+ ...(Array.isArray(files) ? flatten(files) : [files])
2548
+ ], []);
2549
+ }
2550
+ function fromDataTransferItem(item, entry) {
2551
+ return __awaiter(this, void 0, void 0, function* () {
2552
+ var _a;
2553
+ // Check if we're in a secure context; due to a bug in Chrome (as far as we know)
2554
+ // the browser crashes when calling this API (yet to be confirmed as a consistent behaviour).
2555
+ //
2556
+ // See:
2557
+ // - https://issues.chromium.org/issues/40186242
2558
+ // - https://github.com/react-dropzone/react-dropzone/issues/1397
2559
+ if (globalThis.isSecureContext && typeof item.getAsFileSystemHandle === 'function') {
2560
+ const h = yield item.getAsFileSystemHandle();
2561
+ if (h === null) {
2562
+ throw new Error(`${item} is not a File`);
2563
+ }
2564
+ // It seems that the handle can be `undefined` (see https://github.com/react-dropzone/file-selector/issues/120),
2565
+ // so we check if it isn't; if it is, the code path continues to the next API (`getAsFile`).
2566
+ if (h !== undefined) {
2567
+ const file = yield h.getFile();
2568
+ file.handle = h;
2569
+ return toFileWithPath(file);
2570
+ }
2571
+ }
2572
+ const file = item.getAsFile();
2573
+ if (!file) {
2574
+ throw new Error(`${item} is not a File`);
2575
+ }
2576
+ const fwp = toFileWithPath(file, (_a = entry === null || entry === void 0 ? void 0 : entry.fullPath) !== null && _a !== void 0 ? _a : undefined);
2577
+ return fwp;
2578
+ });
2579
+ }
2580
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
2581
+ function fromEntry(entry) {
2582
+ return __awaiter(this, void 0, void 0, function* () {
2583
+ return entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry);
2584
+ });
2585
+ }
2586
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
2587
+ function fromDirEntry(entry) {
2588
+ const reader = entry.createReader();
2589
+ return new Promise((resolve, reject) => {
2590
+ const entries = [];
2591
+ function readEntries() {
2592
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader
2593
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries
2594
+ reader.readEntries((batch) => __awaiter(this, void 0, void 0, function* () {
2595
+ if (!batch.length) {
2596
+ // Done reading directory
2597
+ try {
2598
+ const files = yield Promise.all(entries);
2599
+ resolve(files);
2600
+ }
2601
+ catch (err) {
2602
+ reject(err);
2603
+ }
2604
+ }
2605
+ else {
2606
+ const items = Promise.all(batch.map(fromEntry));
2607
+ entries.push(items);
2608
+ // Continue reading
2609
+ readEntries();
2610
+ }
2611
+ }), (err) => {
2612
+ reject(err);
2613
+ });
2614
+ }
2615
+ readEntries();
2616
+ });
2617
+ }
2618
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry
2619
+ function fromFileEntry(entry) {
2620
+ return __awaiter(this, void 0, void 0, function* () {
2621
+ return new Promise((resolve, reject) => {
2622
+ entry.file((file) => {
2623
+ const fwp = toFileWithPath(file, entry.fullPath);
2624
+ resolve(fwp);
2625
+ }, (err) => {
2626
+ reject(err);
2627
+ });
2628
+ });
2629
+ });
2630
+ }
2631
+
2632
+ var es = {};
2633
+
2634
+ var hasRequiredEs;
2635
+
2636
+ function requireEs () {
2637
+ if (hasRequiredEs) return es;
2638
+ hasRequiredEs = 1;
2639
+
2640
+ es.__esModule = true;
2641
+
2642
+ es.default = function (file, acceptedFiles) {
2643
+ if (file && acceptedFiles) {
2644
+ var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
2645
+
2646
+ if (acceptedFilesArray.length === 0) {
2647
+ return true;
2648
+ }
2649
+
2650
+ var fileName = file.name || '';
2651
+ var mimeType = (file.type || '').toLowerCase();
2652
+ var baseMimeType = mimeType.replace(/\/.*$/, '');
2653
+ return acceptedFilesArray.some(function (type) {
2654
+ var validType = type.trim().toLowerCase();
2655
+
2656
+ if (validType.charAt(0) === '.') {
2657
+ return fileName.toLowerCase().endsWith(validType);
2658
+ } else if (validType.endsWith('/*')) {
2659
+ // This is something like a image/* mime type
2660
+ return baseMimeType === validType.replace(/\/.*$/, '');
2661
+ }
2662
+
2663
+ return mimeType === validType;
2664
+ });
2665
+ }
2666
+
2667
+ return true;
2668
+ };
2669
+ return es;
2670
+ }
2671
+
2672
+ var esExports = requireEs();
2673
+ var _accepts = /*@__PURE__*/getDefaultExportFromCjs$1(esExports);
2674
+
2675
+ function _toConsumableArray$1(arr) { return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1(); }
2676
+
2677
+ function _nonIterableSpread$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2678
+
2679
+ function _iterableToArray$1(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
2680
+
2681
+ function _arrayWithoutHoles$1(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); }
2682
+
2683
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2684
+
2685
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2686
+
2687
+ function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2688
+
2689
+ function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
2690
+
2691
+ function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2692
+
2693
+ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
2694
+
2695
+ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
2696
+
2697
+ function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
2698
+
2699
+ function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
2700
+ var accepts = typeof _accepts === "function" ? _accepts : _accepts.default; // Error codes
2701
+
2702
+ var FILE_INVALID_TYPE = "file-invalid-type";
2703
+ var FILE_TOO_LARGE = "file-too-large";
2704
+ var FILE_TOO_SMALL = "file-too-small";
2705
+ var TOO_MANY_FILES = "too-many-files";
2706
+ /**
2707
+ *
2708
+ * @param {string} accept
2709
+ */
2710
+
2711
+ var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr() {
2712
+ var accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
2713
+ var acceptArr = accept.split(",");
2714
+ var msg = acceptArr.length > 1 ? "one of ".concat(acceptArr.join(", ")) : acceptArr[0];
2715
+ return {
2716
+ code: FILE_INVALID_TYPE,
2717
+ message: "File type must be ".concat(msg)
2718
+ };
2719
+ };
2720
+ var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
2721
+ return {
2722
+ code: FILE_TOO_LARGE,
2723
+ message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
2724
+ };
2725
+ };
2726
+ var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
2727
+ return {
2728
+ code: FILE_TOO_SMALL,
2729
+ message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
2730
+ };
2731
+ };
2732
+ var TOO_MANY_FILES_REJECTION = {
2733
+ code: TOO_MANY_FILES,
2734
+ message: "Too many files"
2735
+ };
2736
+ /**
2737
+ * Check if file is accepted.
2738
+ *
2739
+ * Firefox versions prior to 53 return a bogus MIME type for every file drag,
2740
+ * so dragovers with that MIME type will always be accepted.
2741
+ *
2742
+ * @param {File} file
2743
+ * @param {string} accept
2744
+ * @returns
2745
+ */
2746
+
2747
+ function fileAccepted(file, accept) {
2748
+ var isAcceptable = file.type === "application/x-moz-file" || accepts(file, accept);
2749
+ return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
2750
+ }
2751
+ function fileMatchSize(file, minSize, maxSize) {
2752
+ if (isDefined(file.size)) {
2753
+ if (isDefined(minSize) && isDefined(maxSize)) {
2754
+ if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
2755
+ if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
2756
+ } else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
2757
+ }
2758
+
2759
+ return [true, null];
2760
+ }
2761
+
2762
+ function isDefined(value) {
2763
+ return value !== undefined && value !== null;
2764
+ }
2765
+ /**
2766
+ *
2767
+ * @param {object} options
2768
+ * @param {File[]} options.files
2769
+ * @param {string} [options.accept]
2770
+ * @param {number} [options.minSize]
2771
+ * @param {number} [options.maxSize]
2772
+ * @param {boolean} [options.multiple]
2773
+ * @param {number} [options.maxFiles]
2774
+ * @param {(f: File) => FileError|FileError[]|null} [options.validator]
2775
+ * @returns
2776
+ */
2777
+
2778
+
2779
+ function allFilesAccepted(_ref) {
2780
+ var files = _ref.files,
2781
+ accept = _ref.accept,
2782
+ minSize = _ref.minSize,
2783
+ maxSize = _ref.maxSize,
2784
+ multiple = _ref.multiple,
2785
+ maxFiles = _ref.maxFiles,
2786
+ validator = _ref.validator;
2787
+
2788
+ if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
2789
+ return false;
2790
+ }
2791
+
2792
+ return files.every(function (file) {
2793
+ var _fileAccepted = fileAccepted(file, accept),
2794
+ _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
2795
+ accepted = _fileAccepted2[0];
2796
+
2797
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
2798
+ _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
2799
+ sizeMatch = _fileMatchSize2[0];
2800
+
2801
+ var customErrors = validator ? validator(file) : null;
2802
+ return accepted && sizeMatch && !customErrors;
2803
+ });
2804
+ } // React's synthetic events has event.isPropagationStopped,
2805
+ // but to remain compatibility with other libs (Preact) fall back
2806
+ // to check event.cancelBubble
2807
+
2808
+ function isPropagationStopped(event) {
2809
+ if (typeof event.isPropagationStopped === "function") {
2810
+ return event.isPropagationStopped();
2811
+ } else if (typeof event.cancelBubble !== "undefined") {
2812
+ return event.cancelBubble;
2813
+ }
2814
+
2815
+ return false;
2816
+ }
2817
+ function isEvtWithFiles(event) {
2818
+ if (!event.dataTransfer) {
2819
+ return !!event.target && !!event.target.files;
2820
+ } // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types
2821
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
2822
+
2823
+
2824
+ return Array.prototype.some.call(event.dataTransfer.types, function (type) {
2825
+ return type === "Files" || type === "application/x-moz-file";
2826
+ });
2827
+ }
2828
+
2829
+ function onDocumentDragOver(event) {
2830
+ event.preventDefault();
2831
+ }
2832
+
2833
+ function isIe(userAgent) {
2834
+ return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
2835
+ }
2836
+
2837
+ function isEdge(userAgent) {
2838
+ return userAgent.indexOf("Edge/") !== -1;
2839
+ }
2840
+
2841
+ function isIeOrEdge() {
2842
+ var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
2843
+ return isIe(userAgent) || isEdge(userAgent);
2844
+ }
2845
+ /**
2846
+ * This is intended to be used to compose event handlers
2847
+ * They are executed in order until one of them calls `event.isPropagationStopped()`.
2848
+ * Note that the check is done on the first invoke too,
2849
+ * meaning that if propagation was stopped before invoking the fns,
2850
+ * no handlers will be executed.
2851
+ *
2852
+ * @param {Function} fns the event hanlder functions
2853
+ * @return {Function} the event handler to add to an element
2854
+ */
2855
+
2856
+ function composeEventHandlers() {
2857
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
2858
+ fns[_key] = arguments[_key];
2859
+ }
2860
+
2861
+ return function (event) {
2862
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2863
+ args[_key2 - 1] = arguments[_key2];
2864
+ }
2865
+
2866
+ return fns.some(function (fn) {
2867
+ if (!isPropagationStopped(event) && fn) {
2868
+ fn.apply(void 0, [event].concat(args));
2869
+ }
2870
+
2871
+ return isPropagationStopped(event);
2872
+ });
2873
+ };
2874
+ }
2875
+ /**
2876
+ * canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
2877
+ * is supported by the browser.
2878
+ * @returns {boolean}
2879
+ */
2880
+
2881
+ function canUseFileSystemAccessAPI() {
2882
+ return "showOpenFilePicker" in window;
2883
+ }
2884
+ /**
2885
+ * Convert the `{accept}` dropzone prop to the
2886
+ * `{types}` option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
2887
+ *
2888
+ * @param {AcceptProp} accept
2889
+ * @returns {{accept: string[]}[]}
2890
+ */
2891
+
2892
+ function pickerOptionsFromAccept(accept) {
2893
+ if (isDefined(accept)) {
2894
+ var acceptForPicker = Object.entries(accept).filter(function (_ref2) {
2895
+ var _ref3 = _slicedToArray$1(_ref2, 2),
2896
+ mimeType = _ref3[0],
2897
+ ext = _ref3[1];
2898
+
2899
+ var ok = true;
2900
+
2901
+ if (!isMIMEType(mimeType)) {
2902
+ console.warn("Skipped \"".concat(mimeType, "\" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types."));
2903
+ ok = false;
2904
+ }
2905
+
2906
+ if (!Array.isArray(ext) || !ext.every(isExt)) {
2907
+ console.warn("Skipped \"".concat(mimeType, "\" because an invalid file extension was provided."));
2908
+ ok = false;
2909
+ }
2910
+
2911
+ return ok;
2912
+ }).reduce(function (agg, _ref4) {
2913
+ var _ref5 = _slicedToArray$1(_ref4, 2),
2914
+ mimeType = _ref5[0],
2915
+ ext = _ref5[1];
2916
+
2917
+ return _objectSpread$2(_objectSpread$2({}, agg), {}, _defineProperty$2({}, mimeType, ext));
2918
+ }, {});
2919
+ return [{
2920
+ // description is required due to https://crbug.com/1264708
2921
+ description: "Files",
2922
+ accept: acceptForPicker
2923
+ }];
2924
+ }
2925
+
2926
+ return accept;
2927
+ }
2928
+ /**
2929
+ * Convert the `{accept}` dropzone prop to an array of MIME types/extensions.
2930
+ * @param {AcceptProp} accept
2931
+ * @returns {string}
2932
+ */
2933
+
2934
+ function acceptPropAsAcceptAttr(accept) {
2935
+ if (isDefined(accept)) {
2936
+ return Object.entries(accept).reduce(function (a, _ref6) {
2937
+ var _ref7 = _slicedToArray$1(_ref6, 2),
2938
+ mimeType = _ref7[0],
2939
+ ext = _ref7[1];
2940
+
2941
+ return [].concat(_toConsumableArray$1(a), [mimeType], _toConsumableArray$1(ext));
2942
+ }, []) // Silently discard invalid entries as pickerOptionsFromAccept warns about these
2943
+ .filter(function (v) {
2944
+ return isMIMEType(v) || isExt(v);
2945
+ }).join(",");
2946
+ }
2947
+
2948
+ return undefined;
2949
+ }
2950
+ /**
2951
+ * Check if v is an exception caused by aborting a request (e.g window.showOpenFilePicker()).
2952
+ *
2953
+ * See https://developer.mozilla.org/en-US/docs/Web/API/DOMException.
2954
+ * @param {any} v
2955
+ * @returns {boolean} True if v is an abort exception.
2956
+ */
2957
+
2958
+ function isAbort(v) {
2959
+ return v instanceof DOMException && (v.name === "AbortError" || v.code === v.ABORT_ERR);
2960
+ }
2961
+ /**
2962
+ * Check if v is a security error.
2963
+ *
2964
+ * See https://developer.mozilla.org/en-US/docs/Web/API/DOMException.
2965
+ * @param {any} v
2966
+ * @returns {boolean} True if v is a security error.
2967
+ */
2968
+
2969
+ function isSecurityError(v) {
2970
+ return v instanceof DOMException && (v.name === "SecurityError" || v.code === v.SECURITY_ERR);
2971
+ }
2972
+ /**
2973
+ * Check if v is a MIME type string.
2974
+ *
2975
+ * See accepted format: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers.
2976
+ *
2977
+ * @param {string} v
2978
+ */
2979
+
2980
+ function isMIMEType(v) {
2981
+ return v === "audio/*" || v === "video/*" || v === "image/*" || v === "text/*" || v === "application/*" || /\w+\/[-+.\w]+/g.test(v);
2982
+ }
2983
+ /**
2984
+ * Check if v is a file extension.
2985
+ * @param {string} v
2986
+ */
2987
+
2988
+ function isExt(v) {
2989
+ return /^.*\.[\w]+$/.test(v);
2990
+ }
2991
+ /**
2992
+ * @typedef {Object.<string, string[]>} AcceptProp
2993
+ */
2994
+
2995
+ /**
2996
+ * @typedef {object} FileError
2997
+ * @property {string} message
2998
+ * @property {ErrorCode|string} code
2999
+ */
3000
+
3001
+ /**
3002
+ * @typedef {"file-invalid-type"|"file-too-large"|"file-too-small"|"too-many-files"} ErrorCode
3003
+ */
3004
+
3005
+ var _excluded$1 = ["children"],
3006
+ _excluded2 = ["open"],
3007
+ _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
3008
+ _excluded4 = ["refKey", "onChange", "onClick"];
3009
+
3010
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3011
+
3012
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3013
+
3014
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
3015
+
3016
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
3017
+
3018
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3019
+
3020
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3021
+
3022
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3023
+
3024
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3025
+
3026
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
3027
+
3028
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3029
+
3030
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3031
+
3032
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3033
+
3034
+ function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3035
+
3036
+ function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3037
+
3038
+ function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
3039
+ /**
3040
+ * Convenience wrapper component for the `useDropzone` hook
3041
+ *
3042
+ * ```jsx
3043
+ * <Dropzone>
3044
+ * {({getRootProps, getInputProps}) => (
3045
+ * <div {...getRootProps()}>
3046
+ * <input {...getInputProps()} />
3047
+ * <p>Drag 'n' drop some files here, or click to select files</p>
3048
+ * </div>
3049
+ * )}
3050
+ * </Dropzone>
3051
+ * ```
3052
+ */
3053
+
3054
+ var Dropzone = /*#__PURE__*/forwardRef(function (_ref, ref) {
3055
+ var children = _ref.children,
3056
+ params = _objectWithoutProperties$1(_ref, _excluded$1);
3057
+
3058
+ var _useDropzone = useDropzone(params),
3059
+ open = _useDropzone.open,
3060
+ props = _objectWithoutProperties$1(_useDropzone, _excluded2);
3061
+
3062
+ useImperativeHandle(ref, function () {
3063
+ return {
3064
+ open: open
3065
+ };
3066
+ }, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
3067
+
3068
+ return /*#__PURE__*/React__default.createElement(Fragment$2, null, children(_objectSpread$1(_objectSpread$1({}, props), {}, {
3069
+ open: open
3070
+ })));
3071
+ });
3072
+ Dropzone.displayName = "Dropzone"; // Add default props for react-docgen
3073
+
3074
+ var defaultProps = {
3075
+ disabled: false,
3076
+ getFilesFromEvent: fromEvent,
3077
+ maxSize: Infinity,
3078
+ minSize: 0,
3079
+ multiple: true,
3080
+ maxFiles: 0,
3081
+ preventDropOnDocument: true,
3082
+ noClick: false,
3083
+ noKeyboard: false,
3084
+ noDrag: false,
3085
+ noDragEventsBubbling: false,
3086
+ validator: null,
3087
+ useFsAccessApi: false,
3088
+ autoFocus: false
3089
+ };
3090
+ Dropzone.defaultProps = defaultProps;
3091
+ Dropzone.propTypes = {
3092
+ /**
3093
+ * Render function that exposes the dropzone state and prop getter fns
3094
+ *
3095
+ * @param {object} params
3096
+ * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
3097
+ * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
3098
+ * @param {Function} params.open Open the native file selection dialog
3099
+ * @param {boolean} params.isFocused Dropzone area is in focus
3100
+ * @param {boolean} params.isFileDialogActive File dialog is opened
3101
+ * @param {boolean} params.isDragActive Active drag is in progress
3102
+ * @param {boolean} params.isDragAccept Dragged files are accepted
3103
+ * @param {boolean} params.isDragReject Some dragged files are rejected
3104
+ * @param {File[]} params.acceptedFiles Accepted files
3105
+ * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
3106
+ */
3107
+ children: PropTypes.func,
3108
+
3109
+ /**
3110
+ * Set accepted file types.
3111
+ * Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
3112
+ * Keep in mind that mime type determination is not reliable across platforms. CSV files,
3113
+ * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
3114
+ * Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
3115
+ */
3116
+ accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),
3117
+
3118
+ /**
3119
+ * Allow drag 'n' drop (or selection from the file dialog) of multiple files
3120
+ */
3121
+ multiple: PropTypes.bool,
3122
+
3123
+ /**
3124
+ * If false, allow dropped items to take over the current browser window
3125
+ */
3126
+ preventDropOnDocument: PropTypes.bool,
3127
+
3128
+ /**
3129
+ * If true, disables click to open the native file selection dialog
3130
+ */
3131
+ noClick: PropTypes.bool,
3132
+
3133
+ /**
3134
+ * If true, disables SPACE/ENTER to open the native file selection dialog.
3135
+ * Note that it also stops tracking the focus state.
3136
+ */
3137
+ noKeyboard: PropTypes.bool,
3138
+
3139
+ /**
3140
+ * If true, disables drag 'n' drop
3141
+ */
3142
+ noDrag: PropTypes.bool,
3143
+
3144
+ /**
3145
+ * If true, stops drag event propagation to parents
3146
+ */
3147
+ noDragEventsBubbling: PropTypes.bool,
3148
+
3149
+ /**
3150
+ * Minimum file size (in bytes)
3151
+ */
3152
+ minSize: PropTypes.number,
3153
+
3154
+ /**
3155
+ * Maximum file size (in bytes)
3156
+ */
3157
+ maxSize: PropTypes.number,
3158
+
3159
+ /**
3160
+ * Maximum accepted number of files
3161
+ * The default value is 0 which means there is no limitation to how many files are accepted.
3162
+ */
3163
+ maxFiles: PropTypes.number,
3164
+
3165
+ /**
3166
+ * Enable/disable the dropzone
3167
+ */
3168
+ disabled: PropTypes.bool,
3169
+
3170
+ /**
3171
+ * Use this to provide a custom file aggregator
3172
+ *
3173
+ * @param {(DragEvent|Event|Array<FileSystemFileHandle>)} event A drag event or input change event (if files were selected via the file dialog)
3174
+ */
3175
+ getFilesFromEvent: PropTypes.func,
3176
+
3177
+ /**
3178
+ * Cb for when closing the file dialog with no selection
3179
+ */
3180
+ onFileDialogCancel: PropTypes.func,
3181
+
3182
+ /**
3183
+ * Cb for when opening the file dialog
3184
+ */
3185
+ onFileDialogOpen: PropTypes.func,
3186
+
3187
+ /**
3188
+ * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
3189
+ * to open the file picker instead of using an `<input type="file">` click event.
3190
+ */
3191
+ useFsAccessApi: PropTypes.bool,
3192
+
3193
+ /**
3194
+ * Set to true to focus the root element on render
3195
+ */
3196
+ autoFocus: PropTypes.bool,
3197
+
3198
+ /**
3199
+ * Cb for when the `dragenter` event occurs.
3200
+ *
3201
+ * @param {DragEvent} event
3202
+ */
3203
+ onDragEnter: PropTypes.func,
3204
+
3205
+ /**
3206
+ * Cb for when the `dragleave` event occurs
3207
+ *
3208
+ * @param {DragEvent} event
3209
+ */
3210
+ onDragLeave: PropTypes.func,
3211
+
3212
+ /**
3213
+ * Cb for when the `dragover` event occurs
3214
+ *
3215
+ * @param {DragEvent} event
3216
+ */
3217
+ onDragOver: PropTypes.func,
3218
+
3219
+ /**
3220
+ * Cb for when the `drop` event occurs.
3221
+ * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
3222
+ *
3223
+ * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
3224
+ * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
3225
+ * If `multiple` is set to false and additional files are dropped,
3226
+ * all files besides the first will be rejected.
3227
+ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
3228
+ *
3229
+ * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
3230
+ * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
3231
+ *
3232
+ * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
3233
+ * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
3234
+ *
3235
+ * ```js
3236
+ * function onDrop(acceptedFiles) {
3237
+ * const req = request.post('/upload')
3238
+ * acceptedFiles.forEach(file => {
3239
+ * req.attach(file.name, file)
3240
+ * })
3241
+ * req.end(callback)
3242
+ * }
3243
+ * ```
3244
+ *
3245
+ * @param {File[]} acceptedFiles
3246
+ * @param {FileRejection[]} fileRejections
3247
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
3248
+ */
3249
+ onDrop: PropTypes.func,
3250
+
3251
+ /**
3252
+ * Cb for when the `drop` event occurs.
3253
+ * Note that if no files are accepted, this callback is not invoked.
3254
+ *
3255
+ * @param {File[]} files
3256
+ * @param {(DragEvent|Event)} event
3257
+ */
3258
+ onDropAccepted: PropTypes.func,
3259
+
3260
+ /**
3261
+ * Cb for when the `drop` event occurs.
3262
+ * Note that if no files are rejected, this callback is not invoked.
3263
+ *
3264
+ * @param {FileRejection[]} fileRejections
3265
+ * @param {(DragEvent|Event)} event
3266
+ */
3267
+ onDropRejected: PropTypes.func,
3268
+
3269
+ /**
3270
+ * Cb for when there's some error from any of the promises.
3271
+ *
3272
+ * @param {Error} error
3273
+ */
3274
+ onError: PropTypes.func,
3275
+
3276
+ /**
3277
+ * Custom validation function. It must return null if there's no errors.
3278
+ * @param {File} file
3279
+ * @returns {FileError|FileError[]|null}
3280
+ */
3281
+ validator: PropTypes.func
3282
+ };
3283
+ /**
3284
+ * A function that is invoked for the `dragenter`,
3285
+ * `dragover` and `dragleave` events.
3286
+ * It is not invoked if the items are not files (such as link, text, etc.).
3287
+ *
3288
+ * @callback dragCb
3289
+ * @param {DragEvent} event
3290
+ */
3291
+
3292
+ /**
3293
+ * A function that is invoked for the `drop` or input change event.
3294
+ * It is not invoked if the items are not files (such as link, text, etc.).
3295
+ *
3296
+ * @callback dropCb
3297
+ * @param {File[]} acceptedFiles List of accepted files
3298
+ * @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
3299
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
3300
+ */
3301
+
3302
+ /**
3303
+ * A function that is invoked for the `drop` or input change event.
3304
+ * It is not invoked if the items are files (such as link, text, etc.).
3305
+ *
3306
+ * @callback dropAcceptedCb
3307
+ * @param {File[]} files List of accepted files that meet the given criteria
3308
+ * (`accept`, `multiple`, `minSize`, `maxSize`)
3309
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
3310
+ */
3311
+
3312
+ /**
3313
+ * A function that is invoked for the `drop` or input change event.
3314
+ *
3315
+ * @callback dropRejectedCb
3316
+ * @param {File[]} files List of rejected files that do not meet the given criteria
3317
+ * (`accept`, `multiple`, `minSize`, `maxSize`)
3318
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
3319
+ */
3320
+
3321
+ /**
3322
+ * A function that is used aggregate files,
3323
+ * in a asynchronous fashion, from drag or input change events.
3324
+ *
3325
+ * @callback getFilesFromEvent
3326
+ * @param {(DragEvent|Event|Array<FileSystemFileHandle>)} event A drag event or input change event (if files were selected via the file dialog)
3327
+ * @returns {(File[]|Promise<File[]>)}
3328
+ */
3329
+
3330
+ /**
3331
+ * An object with the current dropzone state.
3332
+ *
3333
+ * @typedef {object} DropzoneState
3334
+ * @property {boolean} isFocused Dropzone area is in focus
3335
+ * @property {boolean} isFileDialogActive File dialog is opened
3336
+ * @property {boolean} isDragActive Active drag is in progress
3337
+ * @property {boolean} isDragAccept Dragged files are accepted
3338
+ * @property {boolean} isDragReject Some dragged files are rejected
3339
+ * @property {File[]} acceptedFiles Accepted files
3340
+ * @property {FileRejection[]} fileRejections Rejected files and why they were rejected
3341
+ */
3342
+
3343
+ /**
3344
+ * An object with the dropzone methods.
3345
+ *
3346
+ * @typedef {object} DropzoneMethods
3347
+ * @property {Function} getRootProps Returns the props you should apply to the root drop container you render
3348
+ * @property {Function} getInputProps Returns the props you should apply to hidden file input you render
3349
+ * @property {Function} open Open the native file selection dialog
3350
+ */
3351
+
3352
+ var initialState = {
3353
+ isFocused: false,
3354
+ isFileDialogActive: false,
3355
+ isDragActive: false,
3356
+ isDragAccept: false,
3357
+ isDragReject: false,
3358
+ acceptedFiles: [],
3359
+ fileRejections: []
3360
+ };
3361
+ /**
3362
+ * A React hook that creates a drag 'n' drop area.
3363
+ *
3364
+ * ```jsx
3365
+ * function MyDropzone(props) {
3366
+ * const {getRootProps, getInputProps} = useDropzone({
3367
+ * onDrop: acceptedFiles => {
3368
+ * // do something with the File objects, e.g. upload to some server
3369
+ * }
3370
+ * });
3371
+ * return (
3372
+ * <div {...getRootProps()}>
3373
+ * <input {...getInputProps()} />
3374
+ * <p>Drag and drop some files here, or click to select files</p>
3375
+ * </div>
3376
+ * )
3377
+ * }
3378
+ * ```
3379
+ *
3380
+ * @function useDropzone
3381
+ *
3382
+ * @param {object} props
3383
+ * @param {import("./utils").AcceptProp} [props.accept] Set accepted file types.
3384
+ * Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
3385
+ * Keep in mind that mime type determination is not reliable across platforms. CSV files,
3386
+ * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
3387
+ * Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
3388
+ * @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files
3389
+ * @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window
3390
+ * @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog
3391
+ * @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog.
3392
+ * Note that it also stops tracking the focus state.
3393
+ * @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop
3394
+ * @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents
3395
+ * @param {number} [props.minSize=0] Minimum file size (in bytes)
3396
+ * @param {number} [props.maxSize=Infinity] Maximum file size (in bytes)
3397
+ * @param {boolean} [props.disabled=false] Enable/disable the dropzone
3398
+ * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
3399
+ * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
3400
+ * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
3401
+ * to open the file picker instead of using an `<input type="file">` click event.
3402
+ * @param {boolean} autoFocus Set to true to auto focus the root element.
3403
+ * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
3404
+ * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
3405
+ * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
3406
+ * @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs
3407
+ * @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs.
3408
+ * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
3409
+ *
3410
+ * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
3411
+ * `accept` must be an object with keys as a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) and the value an array of file extensions (optional).
3412
+ * If `multiple` is set to false and additional files are dropped,
3413
+ * all files besides the first will be rejected.
3414
+ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
3415
+ *
3416
+ * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
3417
+ * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
3418
+ *
3419
+ * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
3420
+ * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
3421
+ *
3422
+ * ```js
3423
+ * function onDrop(acceptedFiles) {
3424
+ * const req = request.post('/upload')
3425
+ * acceptedFiles.forEach(file => {
3426
+ * req.attach(file.name, file)
3427
+ * })
3428
+ * req.end(callback)
3429
+ * }
3430
+ * ```
3431
+ * @param {dropAcceptedCb} [props.onDropAccepted]
3432
+ * @param {dropRejectedCb} [props.onDropRejected]
3433
+ * @param {(error: Error) => void} [props.onError]
3434
+ *
3435
+ * @returns {DropzoneState & DropzoneMethods}
3436
+ */
3437
+
3438
+ function useDropzone() {
3439
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3440
+
3441
+ var _defaultProps$props = _objectSpread$1(_objectSpread$1({}, defaultProps), props),
3442
+ accept = _defaultProps$props.accept,
3443
+ disabled = _defaultProps$props.disabled,
3444
+ getFilesFromEvent = _defaultProps$props.getFilesFromEvent,
3445
+ maxSize = _defaultProps$props.maxSize,
3446
+ minSize = _defaultProps$props.minSize,
3447
+ multiple = _defaultProps$props.multiple,
3448
+ maxFiles = _defaultProps$props.maxFiles,
3449
+ onDragEnter = _defaultProps$props.onDragEnter,
3450
+ onDragLeave = _defaultProps$props.onDragLeave,
3451
+ onDragOver = _defaultProps$props.onDragOver,
3452
+ onDrop = _defaultProps$props.onDrop,
3453
+ onDropAccepted = _defaultProps$props.onDropAccepted,
3454
+ onDropRejected = _defaultProps$props.onDropRejected,
3455
+ onFileDialogCancel = _defaultProps$props.onFileDialogCancel,
3456
+ onFileDialogOpen = _defaultProps$props.onFileDialogOpen,
3457
+ useFsAccessApi = _defaultProps$props.useFsAccessApi,
3458
+ autoFocus = _defaultProps$props.autoFocus,
3459
+ preventDropOnDocument = _defaultProps$props.preventDropOnDocument,
3460
+ noClick = _defaultProps$props.noClick,
3461
+ noKeyboard = _defaultProps$props.noKeyboard,
3462
+ noDrag = _defaultProps$props.noDrag,
3463
+ noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling,
3464
+ onError = _defaultProps$props.onError,
3465
+ validator = _defaultProps$props.validator;
3466
+
3467
+ var acceptAttr = useMemo(function () {
3468
+ return acceptPropAsAcceptAttr(accept);
3469
+ }, [accept]);
3470
+ var pickerTypes = useMemo(function () {
3471
+ return pickerOptionsFromAccept(accept);
3472
+ }, [accept]);
3473
+ var onFileDialogOpenCb = useMemo(function () {
3474
+ return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop$1;
3475
+ }, [onFileDialogOpen]);
3476
+ var onFileDialogCancelCb = useMemo(function () {
3477
+ return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop$1;
3478
+ }, [onFileDialogCancel]);
3479
+ /**
3480
+ * @constant
3481
+ * @type {React.MutableRefObject<HTMLElement>}
3482
+ */
3483
+
3484
+ var rootRef = useRef(null);
3485
+ var inputRef = useRef(null);
3486
+
3487
+ var _useReducer = useReducer(reducer, initialState),
3488
+ _useReducer2 = _slicedToArray(_useReducer, 2),
3489
+ state = _useReducer2[0],
3490
+ dispatch = _useReducer2[1];
3491
+
3492
+ var isFocused = state.isFocused,
3493
+ isFileDialogActive = state.isFileDialogActive;
3494
+ var fsAccessApiWorksRef = useRef(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI()); // Update file dialog active state when the window is focused on
3495
+
3496
+ var onWindowFocus = function onWindowFocus() {
3497
+ // Execute the timeout only if the file dialog is opened in the browser
3498
+ if (!fsAccessApiWorksRef.current && isFileDialogActive) {
3499
+ setTimeout(function () {
3500
+ if (inputRef.current) {
3501
+ var files = inputRef.current.files;
3502
+
3503
+ if (!files.length) {
3504
+ dispatch({
3505
+ type: "closeDialog"
3506
+ });
3507
+ onFileDialogCancelCb();
3508
+ }
3509
+ }
3510
+ }, 300);
3511
+ }
3512
+ };
3513
+
3514
+ useEffect(function () {
3515
+ window.addEventListener("focus", onWindowFocus, false);
3516
+ return function () {
3517
+ window.removeEventListener("focus", onWindowFocus, false);
3518
+ };
3519
+ }, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
3520
+ var dragTargetsRef = useRef([]);
3521
+
3522
+ var onDocumentDrop = function onDocumentDrop(event) {
3523
+ if (rootRef.current && rootRef.current.contains(event.target)) {
3524
+ // If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler
3525
+ return;
3526
+ }
3527
+
3528
+ event.preventDefault();
3529
+ dragTargetsRef.current = [];
3530
+ };
3531
+
3532
+ useEffect(function () {
3533
+ if (preventDropOnDocument) {
3534
+ document.addEventListener("dragover", onDocumentDragOver, false);
3535
+ document.addEventListener("drop", onDocumentDrop, false);
3536
+ }
3537
+
3538
+ return function () {
3539
+ if (preventDropOnDocument) {
3540
+ document.removeEventListener("dragover", onDocumentDragOver);
3541
+ document.removeEventListener("drop", onDocumentDrop);
3542
+ }
3543
+ };
3544
+ }, [rootRef, preventDropOnDocument]); // Auto focus the root when autoFocus is true
3545
+
3546
+ useEffect(function () {
3547
+ if (!disabled && autoFocus && rootRef.current) {
3548
+ rootRef.current.focus();
3549
+ }
3550
+
3551
+ return function () {};
3552
+ }, [rootRef, autoFocus, disabled]);
3553
+ var onErrCb = useCallback(function (e) {
3554
+ if (onError) {
3555
+ onError(e);
3556
+ } else {
3557
+ // Let the user know something's gone wrong if they haven't provided the onError cb.
3558
+ console.error(e);
3559
+ }
3560
+ }, [onError]);
3561
+ var onDragEnterCb = useCallback(function (event) {
3562
+ event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
3563
+
3564
+ event.persist();
3565
+ stopPropagation(event);
3566
+ dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
3567
+
3568
+ if (isEvtWithFiles(event)) {
3569
+ Promise.resolve(getFilesFromEvent(event)).then(function (files) {
3570
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
3571
+ return;
3572
+ }
3573
+
3574
+ var fileCount = files.length;
3575
+ var isDragAccept = fileCount > 0 && allFilesAccepted({
3576
+ files: files,
3577
+ accept: acceptAttr,
3578
+ minSize: minSize,
3579
+ maxSize: maxSize,
3580
+ multiple: multiple,
3581
+ maxFiles: maxFiles,
3582
+ validator: validator
3583
+ });
3584
+ var isDragReject = fileCount > 0 && !isDragAccept;
3585
+ dispatch({
3586
+ isDragAccept: isDragAccept,
3587
+ isDragReject: isDragReject,
3588
+ isDragActive: true,
3589
+ type: "setDraggedFiles"
3590
+ });
3591
+
3592
+ if (onDragEnter) {
3593
+ onDragEnter(event);
3594
+ }
3595
+ }).catch(function (e) {
3596
+ return onErrCb(e);
3597
+ });
3598
+ }
3599
+ }, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
3600
+ var onDragOverCb = useCallback(function (event) {
3601
+ event.preventDefault();
3602
+ event.persist();
3603
+ stopPropagation(event);
3604
+ var hasFiles = isEvtWithFiles(event);
3605
+
3606
+ if (hasFiles && event.dataTransfer) {
3607
+ try {
3608
+ event.dataTransfer.dropEffect = "copy";
3609
+ } catch (_unused) {}
3610
+ /* eslint-disable-line no-empty */
3611
+
3612
+ }
3613
+
3614
+ if (hasFiles && onDragOver) {
3615
+ onDragOver(event);
3616
+ }
3617
+
3618
+ return false;
3619
+ }, [onDragOver, noDragEventsBubbling]);
3620
+ var onDragLeaveCb = useCallback(function (event) {
3621
+ event.preventDefault();
3622
+ event.persist();
3623
+ stopPropagation(event); // Only deactivate once the dropzone and all children have been left
3624
+
3625
+ var targets = dragTargetsRef.current.filter(function (target) {
3626
+ return rootRef.current && rootRef.current.contains(target);
3627
+ }); // Make sure to remove a target present multiple times only once
3628
+ // (Firefox may fire dragenter/dragleave multiple times on the same element)
3629
+
3630
+ var targetIdx = targets.indexOf(event.target);
3631
+
3632
+ if (targetIdx !== -1) {
3633
+ targets.splice(targetIdx, 1);
3634
+ }
3635
+
3636
+ dragTargetsRef.current = targets;
3637
+
3638
+ if (targets.length > 0) {
3639
+ return;
3640
+ }
3641
+
3642
+ dispatch({
3643
+ type: "setDraggedFiles",
3644
+ isDragActive: false,
3645
+ isDragAccept: false,
3646
+ isDragReject: false
3647
+ });
3648
+
3649
+ if (isEvtWithFiles(event) && onDragLeave) {
3650
+ onDragLeave(event);
3651
+ }
3652
+ }, [rootRef, onDragLeave, noDragEventsBubbling]);
3653
+ var setFiles = useCallback(function (files, event) {
3654
+ var acceptedFiles = [];
3655
+ var fileRejections = [];
3656
+ files.forEach(function (file) {
3657
+ var _fileAccepted = fileAccepted(file, acceptAttr),
3658
+ _fileAccepted2 = _slicedToArray(_fileAccepted, 2),
3659
+ accepted = _fileAccepted2[0],
3660
+ acceptError = _fileAccepted2[1];
3661
+
3662
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
3663
+ _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
3664
+ sizeMatch = _fileMatchSize2[0],
3665
+ sizeError = _fileMatchSize2[1];
3666
+
3667
+ var customErrors = validator ? validator(file) : null;
3668
+
3669
+ if (accepted && sizeMatch && !customErrors) {
3670
+ acceptedFiles.push(file);
3671
+ } else {
3672
+ var errors = [acceptError, sizeError];
3673
+
3674
+ if (customErrors) {
3675
+ errors = errors.concat(customErrors);
3676
+ }
3677
+
3678
+ fileRejections.push({
3679
+ file: file,
3680
+ errors: errors.filter(function (e) {
3681
+ return e;
3682
+ })
3683
+ });
3684
+ }
3685
+ });
3686
+
3687
+ if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
3688
+ // Reject everything and empty accepted files
3689
+ acceptedFiles.forEach(function (file) {
3690
+ fileRejections.push({
3691
+ file: file,
3692
+ errors: [TOO_MANY_FILES_REJECTION]
3693
+ });
3694
+ });
3695
+ acceptedFiles.splice(0);
3696
+ }
3697
+
3698
+ dispatch({
3699
+ acceptedFiles: acceptedFiles,
3700
+ fileRejections: fileRejections,
3701
+ isDragReject: fileRejections.length > 0,
3702
+ type: "setFiles"
3703
+ });
3704
+
3705
+ if (onDrop) {
3706
+ onDrop(acceptedFiles, fileRejections, event);
3707
+ }
3708
+
3709
+ if (fileRejections.length > 0 && onDropRejected) {
3710
+ onDropRejected(fileRejections, event);
3711
+ }
3712
+
3713
+ if (acceptedFiles.length > 0 && onDropAccepted) {
3714
+ onDropAccepted(acceptedFiles, event);
3715
+ }
3716
+ }, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
3717
+ var onDropCb = useCallback(function (event) {
3718
+ event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
3719
+
3720
+ event.persist();
3721
+ stopPropagation(event);
3722
+ dragTargetsRef.current = [];
3723
+
3724
+ if (isEvtWithFiles(event)) {
3725
+ Promise.resolve(getFilesFromEvent(event)).then(function (files) {
3726
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
3727
+ return;
3728
+ }
3729
+
3730
+ setFiles(files, event);
3731
+ }).catch(function (e) {
3732
+ return onErrCb(e);
3733
+ });
3734
+ }
3735
+
3736
+ dispatch({
3737
+ type: "reset"
3738
+ });
3739
+ }, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
3740
+
3741
+ var openFileDialog = useCallback(function () {
3742
+ // No point to use FS access APIs if context is not secure
3743
+ // https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#feature_detection
3744
+ if (fsAccessApiWorksRef.current) {
3745
+ dispatch({
3746
+ type: "openDialog"
3747
+ });
3748
+ onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
3749
+
3750
+ var opts = {
3751
+ multiple: multiple,
3752
+ types: pickerTypes
3753
+ };
3754
+ window.showOpenFilePicker(opts).then(function (handles) {
3755
+ return getFilesFromEvent(handles);
3756
+ }).then(function (files) {
3757
+ setFiles(files, null);
3758
+ dispatch({
3759
+ type: "closeDialog"
3760
+ });
3761
+ }).catch(function (e) {
3762
+ // AbortError means the user canceled
3763
+ if (isAbort(e)) {
3764
+ onFileDialogCancelCb(e);
3765
+ dispatch({
3766
+ type: "closeDialog"
3767
+ });
3768
+ } else if (isSecurityError(e)) {
3769
+ fsAccessApiWorksRef.current = false; // CORS, so cannot use this API
3770
+ // Try using the input
3771
+
3772
+ if (inputRef.current) {
3773
+ inputRef.current.value = null;
3774
+ inputRef.current.click();
3775
+ } else {
3776
+ onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."));
3777
+ }
3778
+ } else {
3779
+ onErrCb(e);
3780
+ }
3781
+ });
3782
+ return;
3783
+ }
3784
+
3785
+ if (inputRef.current) {
3786
+ dispatch({
3787
+ type: "openDialog"
3788
+ });
3789
+ onFileDialogOpenCb();
3790
+ inputRef.current.value = null;
3791
+ inputRef.current.click();
3792
+ }
3793
+ }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
3794
+
3795
+ var onKeyDownCb = useCallback(function (event) {
3796
+ // Ignore keyboard events bubbling up the DOM tree
3797
+ if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
3798
+ return;
3799
+ }
3800
+
3801
+ if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) {
3802
+ event.preventDefault();
3803
+ openFileDialog();
3804
+ }
3805
+ }, [rootRef, openFileDialog]); // Update focus state for the dropzone
3806
+
3807
+ var onFocusCb = useCallback(function () {
3808
+ dispatch({
3809
+ type: "focus"
3810
+ });
3811
+ }, []);
3812
+ var onBlurCb = useCallback(function () {
3813
+ dispatch({
3814
+ type: "blur"
3815
+ });
3816
+ }, []); // Cb to open the file dialog when click occurs on the dropzone
3817
+
3818
+ var onClickCb = useCallback(function () {
3819
+ if (noClick) {
3820
+ return;
3821
+ } // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
3822
+ // to ensure React can handle state changes
3823
+ // See: https://github.com/react-dropzone/react-dropzone/issues/450
3824
+
3825
+
3826
+ if (isIeOrEdge()) {
3827
+ setTimeout(openFileDialog, 0);
3828
+ } else {
3829
+ openFileDialog();
3830
+ }
3831
+ }, [noClick, openFileDialog]);
3832
+
3833
+ var composeHandler = function composeHandler(fn) {
3834
+ return disabled ? null : fn;
3835
+ };
3836
+
3837
+ var composeKeyboardHandler = function composeKeyboardHandler(fn) {
3838
+ return noKeyboard ? null : composeHandler(fn);
3839
+ };
3840
+
3841
+ var composeDragHandler = function composeDragHandler(fn) {
3842
+ return noDrag ? null : composeHandler(fn);
3843
+ };
3844
+
3845
+ var stopPropagation = function stopPropagation(event) {
3846
+ if (noDragEventsBubbling) {
3847
+ event.stopPropagation();
3848
+ }
3849
+ };
3850
+
3851
+ var getRootProps = useMemo(function () {
3852
+ return function () {
3853
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3854
+ _ref2$refKey = _ref2.refKey,
3855
+ refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey,
3856
+ role = _ref2.role,
3857
+ onKeyDown = _ref2.onKeyDown,
3858
+ onFocus = _ref2.onFocus,
3859
+ onBlur = _ref2.onBlur,
3860
+ onClick = _ref2.onClick,
3861
+ onDragEnter = _ref2.onDragEnter,
3862
+ onDragOver = _ref2.onDragOver,
3863
+ onDragLeave = _ref2.onDragLeave,
3864
+ onDrop = _ref2.onDrop,
3865
+ rest = _objectWithoutProperties$1(_ref2, _excluded3);
3866
+
3867
+ return _objectSpread$1(_objectSpread$1(_defineProperty$1({
3868
+ onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
3869
+ onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
3870
+ onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
3871
+ onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
3872
+ onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
3873
+ onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
3874
+ onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
3875
+ onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
3876
+ role: typeof role === "string" && role !== "" ? role : "presentation"
3877
+ }, refKey, rootRef), !disabled && !noKeyboard ? {
3878
+ tabIndex: 0
3879
+ } : {}), rest);
3880
+ };
3881
+ }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
3882
+ var onInputElementClick = useCallback(function (event) {
3883
+ event.stopPropagation();
3884
+ }, []);
3885
+ var getInputProps = useMemo(function () {
3886
+ return function () {
3887
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3888
+ _ref3$refKey = _ref3.refKey,
3889
+ refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey,
3890
+ onChange = _ref3.onChange,
3891
+ onClick = _ref3.onClick,
3892
+ rest = _objectWithoutProperties$1(_ref3, _excluded4);
3893
+
3894
+ var inputProps = _defineProperty$1({
3895
+ accept: acceptAttr,
3896
+ multiple: multiple,
3897
+ type: "file",
3898
+ style: {
3899
+ border: 0,
3900
+ clip: "rect(0, 0, 0, 0)",
3901
+ clipPath: "inset(50%)",
3902
+ height: "1px",
3903
+ margin: "0 -1px -1px 0",
3904
+ overflow: "hidden",
3905
+ padding: 0,
3906
+ position: "absolute",
3907
+ width: "1px",
3908
+ whiteSpace: "nowrap"
3909
+ },
3910
+ onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
3911
+ onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
3912
+ tabIndex: -1
3913
+ }, refKey, inputRef);
3914
+
3915
+ return _objectSpread$1(_objectSpread$1({}, inputProps), rest);
3916
+ };
3917
+ }, [inputRef, accept, multiple, onDropCb, disabled]);
3918
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
3919
+ isFocused: isFocused && !disabled,
3920
+ getRootProps: getRootProps,
3921
+ getInputProps: getInputProps,
3922
+ rootRef: rootRef,
3923
+ inputRef: inputRef,
3924
+ open: composeHandler(openFileDialog)
3925
+ });
3926
+ }
3927
+ /**
3928
+ * @param {DropzoneState} state
3929
+ * @param {{type: string} & DropzoneState} action
3930
+ * @returns {DropzoneState}
3931
+ */
3932
+
3933
+ function reducer(state, action) {
3934
+ /* istanbul ignore next */
3935
+ switch (action.type) {
3936
+ case "focus":
3937
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
3938
+ isFocused: true
3939
+ });
3940
+
3941
+ case "blur":
3942
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
3943
+ isFocused: false
3944
+ });
3945
+
3946
+ case "openDialog":
3947
+ return _objectSpread$1(_objectSpread$1({}, initialState), {}, {
3948
+ isFileDialogActive: true
3949
+ });
3950
+
3951
+ case "closeDialog":
3952
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
3953
+ isFileDialogActive: false
3954
+ });
3955
+
3956
+ case "setDraggedFiles":
3957
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
3958
+ isDragActive: action.isDragActive,
3959
+ isDragAccept: action.isDragAccept,
3960
+ isDragReject: action.isDragReject
3961
+ });
3962
+
3963
+ case "setFiles":
3964
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
3965
+ acceptedFiles: action.acceptedFiles,
3966
+ fileRejections: action.fileRejections,
3967
+ isDragReject: action.isDragReject
3968
+ });
3969
+
3970
+ case "reset":
3971
+ return _objectSpread$1({}, initialState);
3972
+
3973
+ default:
3974
+ return state;
3975
+ }
3976
+ }
3977
+
3978
+ function noop$1() {}
3979
+
3980
+ var DefaultContext = {
3981
+ color: undefined,
3982
+ size: undefined,
3983
+ className: undefined,
3984
+ style: undefined,
3985
+ attr: undefined
3986
+ };
3987
+ var IconContext = React__default.createContext && /*#__PURE__*/React__default.createContext(DefaultContext);
3988
+
3989
+ var _excluded = ["attr", "size", "title"];
3990
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3991
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
3992
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3993
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3994
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3995
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3996
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3997
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3998
+ function Tree2Element(tree) {
3999
+ return tree && tree.map((node, i) => /*#__PURE__*/React__default.createElement(node.tag, _objectSpread({
4000
+ key: i
4001
+ }, node.attr), Tree2Element(node.child)));
4002
+ }
4003
+ function GenIcon(data) {
4004
+ return props => /*#__PURE__*/React__default.createElement(IconBase, _extends({
4005
+ attr: _objectSpread({}, data.attr)
4006
+ }, props), Tree2Element(data.child));
4007
+ }
4008
+ function IconBase(props) {
4009
+ var elem = conf => {
4010
+ var {
4011
+ attr,
4012
+ size,
4013
+ title
4014
+ } = props,
4015
+ svgProps = _objectWithoutProperties(props, _excluded);
4016
+ var computedSize = size || conf.size || "1em";
4017
+ var className;
4018
+ if (conf.className) className = conf.className;
4019
+ if (props.className) className = (className ? className + " " : "") + props.className;
4020
+ return /*#__PURE__*/React__default.createElement("svg", _extends({
4021
+ stroke: "currentColor",
4022
+ fill: "currentColor",
4023
+ strokeWidth: "0"
4024
+ }, conf.attr, attr, svgProps, {
4025
+ className: className,
4026
+ style: _objectSpread(_objectSpread({
4027
+ color: props.color || conf.color
4028
+ }, conf.style), props.style),
4029
+ height: computedSize,
4030
+ width: computedSize,
4031
+ xmlns: "http://www.w3.org/2000/svg"
4032
+ }), title && /*#__PURE__*/React__default.createElement("title", null, title), props.children);
4033
+ };
4034
+ return IconContext !== undefined ? /*#__PURE__*/React__default.createElement(IconContext.Consumer, null, conf => elem(conf)) : elem(DefaultContext);
4035
+ }
4036
+
4037
+ // THIS FILE IS AUTO GENERATED
4038
+ function BiSolidImage (props) {
4039
+ return GenIcon({"attr":{"viewBox":"0 0 24 24"},"child":[{"tag":"path","attr":{"d":"M19.999 4h-16c-1.103 0-2 .897-2 2v12c0 1.103.897 2 2 2h16c1.103 0 2-.897 2-2V6c0-1.103-.897-2-2-2zm-13.5 3a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zm5.5 10h-7l4-5 1.5 2 3-4 5.5 7h-7z"},"child":[]}]})(props);
4040
+ }
4041
+
4042
+ const getImageDimensions = (file) =>
4043
+ // eslint-disable-next-line promise/avoid-new
4044
+ new Promise((resolve, reject) => {
4045
+ try {
4046
+ const fileReader = new FileReader();
4047
+ fileReader.onload = () => {
4048
+ try {
4049
+ const img = new Image();
4050
+ img.onload = () => resolve({ width: img.width, height: img.height });
4051
+ img.src = fileReader.result; // is the data URL because called with readAsDataURL
4052
+ }
4053
+ catch (error) {
4054
+ reject(error);
4055
+ throw new Error('Error loading image');
4056
+ }
4057
+ };
4058
+ fileReader.readAsDataURL(file);
4059
+ }
4060
+ catch (error) {
4061
+ reject(error);
4062
+ throw new Error('Error reading image file');
4063
+ }
4064
+ });
4065
+
4066
+ const compressionOptions = {
4067
+ maxSizeMB: 1,
4068
+ maxWidthOrHeight: 1920,
4069
+ useWebWorker: true,
4070
+ };
4071
+ const GalleryForm = ({ state, setState }) => {
4072
+ const appState = useAppState();
4073
+ const [imageSelectedToDelete, setImageSelectedToDelete] = useState(null);
4074
+ const closeModal = () => setImageSelectedToDelete(null);
4075
+ const upload = async (acceptedFiles) => {
4076
+ setState((prevState) => ({
4077
+ ...prevState,
4078
+ uploadingImages: [...prevState.uploadingImages, ...acceptedFiles],
4079
+ }));
4080
+ const uploads = acceptedFiles.map(async (file) => {
4081
+ const compressedFile = await imageCompression(file, compressionOptions);
4082
+ const { width, height } = await getImageDimensions(compressedFile);
4083
+ return {
4084
+ width,
4085
+ height,
4086
+ asset: await appState.assetsApi.upload(compressedFile, file.name),
4087
+ name: file.name,
4088
+ };
4089
+ });
4090
+ for await (const upload of uploads) {
4091
+ setState((prevState) => ({
4092
+ ...prevState,
4093
+ uploadingImages: prevState.uploadingImages.filter((f) => f.name !== upload.name),
4094
+ gallery: [
4095
+ ...prevState.gallery,
4096
+ {
4097
+ directus_files_id: {
4098
+ id: upload.asset.id,
4099
+ width: upload.width,
4100
+ height: upload.height,
4101
+ },
4102
+ },
4103
+ ],
4104
+ }));
4105
+ }
4106
+ };
4107
+ const { getRootProps, getInputProps } = useDropzone({
4108
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
4109
+ onDrop: upload,
4110
+ accept: {
4111
+ 'image/jpeg': [],
4112
+ },
4113
+ });
4114
+ const images = state.gallery
4115
+ .map((image) => ({
4116
+ src: appState.assetsApi.url + `${image.directus_files_id.id}.jpg`,
4117
+ state: 'uploaded',
4118
+ }))
4119
+ .concat(state.uploadingImages.map((file) => ({
4120
+ src: URL.createObjectURL(file),
4121
+ state: 'uploading',
4122
+ })));
4123
+ const removeImage = (index) => {
4124
+ setState((prevState) => ({
4125
+ ...prevState,
4126
+ gallery: prevState.gallery.filter((_, i) => i !== index),
4127
+ }));
4128
+ };
4129
+ return (jsxs(Fragment$1, { children: [jsxs("div", { className: 'tw:grid tw:grid-cols-2 tw:@md:grid-cols-3 tw:@lg:grid-cols-4 tw:gap-4 tw:my-4', children: [images.map((image, index) => (jsxs("div", { className: 'tw:relative', children: [jsx("img", { src: image.src, alt: `Gallery image ${index + 1}`, className: `tw:w-full tw:h-full tw:object-cover tw:rounded-lg ${image.state === 'uploading' ? 'tw:opacity-50' : ''}` }), image.state === 'uploading' && (jsx("span", { className: 'tw:loading tw:loading-spinner tw:absolute tw:inset-0 tw:m-auto' })), image.state === 'uploaded' && (jsx("button", { className: 'tw:m-2 tw:bg-red-500 tw:text-white tw:p-2 tw:rounded-full tw:absolute tw:top-0 tw:right-0 tw:hover:bg-red-600 tw:cursor-pointer', onClick: () => setImageSelectedToDelete(index), type: 'button', children: jsx(ForwardRef$e, { className: 'tw:h-5 tw:w-5', "data-testid": 'trash' }) }))] }, index))), jsxs("div", { ...getRootProps(), className: 'tw:flex tw:flex-col tw:items-center tw:justify-center tw:text-base-content/50 tw:w-full tw:h-full tw:cursor-pointer tw:card tw:card-body tw:border tw:border-current/50 tw:border-dashed tw:bg-base-200', children: [jsx("input", { ...getInputProps(), "data-testid": 'gallery-upload-input' }), jsxs("div", { children: [jsx(BiSolidImage, { className: 'tw:h-16 tw:w-16 tw:m-auto tw:mb-2' }), jsx("span", { className: 'tw:text-center', children: "Upload\u00A0Image" })] })] })] }), jsx(DialogModal, { isOpened: imageSelectedToDelete !== null, title: 'Are you sure?', showCloseButton: false, onClose: closeModal, children: jsxs("div", { onClick: (e) => e.stopPropagation(), children: [jsx("span", { children: "Do you want to delete this image?" }), jsx("div", { className: 'tw:grid', children: jsxs("div", { className: 'tw:flex tw:justify-between', children: [jsx("label", { className: 'tw:btn tw:mt-4 tw:btn-error', onClick: () => {
4130
+ if (imageSelectedToDelete !== null) {
4131
+ removeImage(imageSelectedToDelete);
4132
+ }
4133
+ closeModal();
4134
+ }, children: "Yes" }), jsx("label", { className: 'tw:btn tw:mt-4', onClick: closeModal, children: "No" })] }) })] }) })] }));
4135
+ };
4136
+
1066
4137
  const ComboBoxInput = ({ id, options, value, onValueChange }) => {
1067
4138
  const handleChange = (e) => {
1068
4139
  onValueChange(e.target.value);
@@ -35818,63 +38889,6 @@ function NumberedListIcon({
35818
38889
  }
35819
38890
  const ForwardRef = /*#__PURE__*/ React.forwardRef(NumberedListIcon);
35820
38891
 
35821
- var DefaultContext = {
35822
- color: undefined,
35823
- size: undefined,
35824
- className: undefined,
35825
- style: undefined,
35826
- attr: undefined
35827
- };
35828
- var IconContext = React__default.createContext && /*#__PURE__*/React__default.createContext(DefaultContext);
35829
-
35830
- var _excluded = ["attr", "size", "title"];
35831
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
35832
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
35833
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
35834
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35835
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
35836
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
35837
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
35838
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
35839
- function Tree2Element(tree) {
35840
- return tree && tree.map((node, i) => /*#__PURE__*/React__default.createElement(node.tag, _objectSpread({
35841
- key: i
35842
- }, node.attr), Tree2Element(node.child)));
35843
- }
35844
- function GenIcon(data) {
35845
- return props => /*#__PURE__*/React__default.createElement(IconBase, _extends({
35846
- attr: _objectSpread({}, data.attr)
35847
- }, props), Tree2Element(data.child));
35848
- }
35849
- function IconBase(props) {
35850
- var elem = conf => {
35851
- var {
35852
- attr,
35853
- size,
35854
- title
35855
- } = props,
35856
- svgProps = _objectWithoutProperties(props, _excluded);
35857
- var computedSize = size || conf.size || "1em";
35858
- var className;
35859
- if (conf.className) className = conf.className;
35860
- if (props.className) className = (className ? className + " " : "") + props.className;
35861
- return /*#__PURE__*/React__default.createElement("svg", _extends({
35862
- stroke: "currentColor",
35863
- fill: "currentColor",
35864
- strokeWidth: "0"
35865
- }, conf.attr, attr, svgProps, {
35866
- className: className,
35867
- style: _objectSpread(_objectSpread({
35868
- color: props.color || conf.color
35869
- }, conf.style), props.style),
35870
- height: computedSize,
35871
- width: computedSize,
35872
- xmlns: "http://www.w3.org/2000/svg"
35873
- }), title && /*#__PURE__*/React__default.createElement("title", null, title), props.children);
35874
- };
35875
- return IconContext !== undefined ? /*#__PURE__*/React__default.createElement(IconContext.Consumer, null, conf => elem(conf)) : elem(DefaultContext);
35876
- }
35877
-
35878
38892
  // THIS FILE IS AUTO GENERATED
35879
38893
  function MdRedo (props) {
35880
38894
  return GenIcon({"attr":{"viewBox":"0 0 24 24"},"child":[{"tag":"path","attr":{"fill":"none","d":"M0 0h24v24H0z"},"child":[]},{"tag":"path","attr":{"d":"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 0 1 7.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"},"child":[]}]})(props);
@@ -36001,6 +39015,7 @@ const componentMap = {
36001
39015
  contactInfos: ContactInfoForm,
36002
39016
  startEnd: ProfileStartEndForm,
36003
39017
  crowdfundings: CrowdfundingForm,
39018
+ gallery: GalleryForm,
36004
39019
  // weitere Komponenten hier
36005
39020
  };
36006
39021
  const FlexForm = ({ item, state, setState, }) => {
@@ -36248,6 +39263,8 @@ function ProfileForm() {
36248
39263
  start: '',
36249
39264
  end: '',
36250
39265
  openCollectiveSlug: '',
39266
+ gallery: [],
39267
+ uploadingImages: [],
36251
39268
  });
36252
39269
  const [updatePermission, setUpdatePermission] = useState(false);
36253
39270
  const [loading, setLoading] = useState(false);
@@ -36330,6 +39347,8 @@ function ProfileForm() {
36330
39347
  start: item.start ?? '',
36331
39348
  end: item.end ?? '',
36332
39349
  openCollectiveSlug: item.openCollectiveSlug ?? '',
39350
+ gallery: item.gallery ?? [],
39351
+ uploadingImages: [],
36333
39352
  });
36334
39353
  // eslint-disable-next-line react-hooks/exhaustive-deps
36335
39354
  }, [item, tags, items]);
@@ -36345,10 +39364,11 @@ function ProfileForm() {
36345
39364
  setTemplate(userLayer.itemType.template);
36346
39365
  }
36347
39366
  }, [item, layers]);
39367
+ const isUpdatingGallery = state.uploadingImages.length > 0;
36348
39368
  return (jsx(Fragment$1, { children: jsx(MapOverlayPage, { backdrop: true, className: 'tw:mx-4 tw:mt-4 tw:mb-4 tw:@container tw:overflow-x-hidden tw:w-[calc(100%-32px)] tw:md:w-[calc(50%-32px)] tw:max-w-3xl tw:left-auto! tw:top-0 tw:bottom-0 tw:flex tw:flex-col', children: item ? (jsx("form", { className: 'tw:flex tw:flex-col tw:flex-1 tw:min-h-0', onSubmit: (e) => {
36349
39369
  e.preventDefault();
36350
39370
  void onUpdateItem(state, item, tags, addTag, setLoading, navigate, updateItem, addItem, user, urlParams);
36351
- }, children: jsxs("div", { className: 'tw:flex tw:flex-col tw:flex-1 pb-4', children: [jsx(FormHeader, { item: item, state: state, setState: setState }), template === 'onepager' && (jsx(OnepagerForm, { item: item, state: state, setState: setState })), template === 'simple' && jsx(SimpleForm, { state: state, setState: setState }), template === 'flex' && (jsx(FlexForm, { item: item, state: state, setState: setState })), template === 'tabs' && (jsx(TabsForm, { loading: loading, item: item, state: state, setState: setState, updatePermission: updatePermission, linkItem: (id) => linkItem(id, item, updateItem), unlinkItem: (id) => unlinkItem(id, item, updateItem), setUrlParams: setUrlParams })), jsx("div", { className: 'tw:mb-4 tw:mt-6 tw:flex-none', children: jsx("button", { className: `${loading ? ' tw:loading tw:btn tw:float-right' : 'tw:btn tw:float-right'}`, type: 'submit', style: {
39371
+ }, children: jsxs("div", { className: 'tw:flex tw:flex-col tw:flex-1 pb-4', children: [jsx(FormHeader, { item: item, state: state, setState: setState }), template === 'onepager' && (jsx(OnepagerForm, { item: item, state: state, setState: setState })), template === 'simple' && jsx(SimpleForm, { state: state, setState: setState }), template === 'flex' && (jsx(FlexForm, { item: item, state: state, setState: setState })), template === 'tabs' && (jsx(TabsForm, { loading: loading, item: item, state: state, setState: setState, updatePermission: updatePermission, linkItem: (id) => linkItem(id, item, updateItem), unlinkItem: (id) => unlinkItem(id, item, updateItem), setUrlParams: setUrlParams })), jsx("div", { className: 'tw:mb-4 tw:mt-6 tw:flex-none', children: jsx("button", { className: classNames('tw:btn', 'tw:float-right', { 'tw:loading': loading }, { 'tw:cursor-not-allowed tw:opacity-50': loading || isUpdatingGallery }), type: 'submit', style: {
36352
39372
  // We could refactor this, it is used several times at different locations
36353
39373
  backgroundColor: `${item.color ?? (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor)}`,
36354
39374
  color: '#fff',