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