@dwelle/excalidraw 0.3.10 → 0.3.14

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README_NEXT.md +32 -0
  3. package/dist/excalidraw-assets/vendor-1018b0a7e7e60d808384.js +2 -0
  4. package/dist/excalidraw-assets/vendor-1018b0a7e7e60d808384.js.LICENSE.txt +14 -0
  5. package/dist/excalidraw-assets-dev/image-9f771c114a0a3ad7b334.js +42 -0
  6. package/dist/excalidraw-assets-dev/vendor-bb07a412033591d5470d.js +344 -0
  7. package/dist/excalidraw.development.js +63 -31
  8. package/dist/excalidraw.production.min.js +1 -1
  9. package/package.json +2 -2
  10. package/types/actions/types.d.ts +3 -1
  11. package/types/appState.d.ts +3 -5
  12. package/types/clipboard.d.ts +3 -3
  13. package/types/components/App.d.ts +2 -1
  14. package/types/components/ClearCanvas.d.ts +6 -0
  15. package/types/components/ImageExportDialog.d.ts +3 -2
  16. package/types/components/JSONExportDialog.d.ts +4 -3
  17. package/types/components/LayerUI.d.ts +3 -2
  18. package/types/components/LibraryUnit.d.ts +2 -2
  19. package/types/constants.d.ts +2 -1
  20. package/types/data/filesystem.d.ts +1 -1
  21. package/types/data/index.d.ts +2 -2
  22. package/types/data/json.d.ts +3 -3
  23. package/types/data/resave.d.ts +2 -2
  24. package/types/data/restore.d.ts +2 -1
  25. package/types/data/types.d.ts +3 -1
  26. package/types/element/image.d.ts +3 -3
  27. package/types/packages/excalidraw/dist/excalidraw-assets/vendor-1018b0a7e7e60d808384.d.ts +0 -0
  28. package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-9f771c114a0a3ad7b334.d.ts +0 -0
  29. package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-bb07a412033591d5470d.d.ts +0 -0
  30. package/types/packages/excalidraw/index.d.ts +2 -1
  31. package/types/packages/utils.d.ts +4 -3
  32. package/types/renderer/renderElement.d.ts +2 -2
  33. package/types/renderer/renderScene.d.ts +2 -2
  34. package/types/scene/export.d.ts +3 -4
  35. package/types/shapes.d.ts +1 -1
  36. package/types/types.d.ts +6 -4
package/CHANGELOG.md CHANGED
@@ -13,10 +13,36 @@ Please add the latest change on the top under the correct section.
13
13
 
14
14
  ## Unreleased
15
15
 
16
+ - Image support.
17
+
18
+ NOTE: the unreleased API is highly unstable and may change significantly before the next stable release. As such it's largely undocumented at this point. You are encouraged to read through the [PR](https://github.com/excalidraw/excalidraw/pull/4011) description if you want to know more about the internals.
19
+
20
+ General notes:
21
+
22
+ - File data are encoded as DataURLs (base64) for portability reasons.
23
+
24
+ [ExcalidrawAPI](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#onLibraryChange):
25
+
26
+ - added `getFiles()` to get current `BinaryFiles` (`Record<FileId, BinaryFileData>`). It may contain files that aren't referenced by any element, so if you're persisting the files to a storage, you should compare them against stored elements.
27
+
28
+ Excalidraw app props:
29
+
30
+ - added `generateIdForFile(file: File)` optional prop so you can generate your own ids for added files.
31
+ - `onChange(elements, appState, files)` prop callback is now passed `BinaryFiles` as third argument.
32
+ - `onPaste(data, event)` data prop should contain `data.files` (`BinaryFiles`) if the elements pasted are referencing new files.
33
+ - `initialData` object now supports additional `files` (`BinaryFiles`) attribute.
34
+
35
+ Other notes:
36
+
37
+ - `.excalidraw` files may now contain top-level `files` key in format of `Record<FileId, BinaryFileData>` when exporting any (image) elements.
38
+ - Changes were made to various export utilityies exported from the package so that they take `files`. For now, TypeScript should help you figure the changes out.
39
+
16
40
  ## Excalidraw API
17
41
 
18
42
  ### Features
19
43
 
44
+ - Export [`isLinearElement`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#isLinearElement) and [`getNonDeletedElements`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#getNonDeletedElements).
45
+
20
46
  - Support [`renderTopRightUI`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#renderTopRightUI) in mobile UI.
21
47
 
22
48
  - Export `THEME` constant from the package so host can use this when passing the theme.
@@ -33,6 +59,8 @@ Please add the latest change on the top under the correct section.
33
59
 
34
60
  ### Fixes
35
61
 
62
+ - Don't show save file to disk button in export dialog when `saveFileToDisk` passed as `false` in [`UIOptions.canvasActions.export`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#exportOpts).
63
+
36
64
  - [`onPaste`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#onPaste) prop should return false to prevent the native excalidraw paste action [#3974](https://github.com/excalidraw/excalidraw/pull/3974).
37
65
 
38
66
  #### BREAKING CHANGE
package/README_NEXT.md CHANGED
@@ -926,6 +926,38 @@ getFreeDrawSvgPath(element: <a href="https://github.com/excalidraw/excalidraw/bl
926
926
 
927
927
  This function returns the free draw svg path for the element.
928
928
 
929
+ #### `isLinearElement`
930
+
931
+ **How to use**
932
+
933
+ ```js
934
+ import { isLinearElement } from "@excalidraw/excalidraw-next";
935
+ ```
936
+
937
+ **Signature**
938
+
939
+ <pre>
940
+ isLinearElement(elementType?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L80">ExcalidrawElement</a>): boolean
941
+ </pre>
942
+
943
+ This function returns true if the element is linear type (`arrow` |`line`) else returns false.
944
+
945
+ #### `getNonDeletedElements`
946
+
947
+ **How to use**
948
+
949
+ ```js
950
+ import { getNonDeletedElements } from "@excalidraw/excalidraw-next";
951
+ ```
952
+
953
+ **Signature**
954
+
955
+ <pre>
956
+ getNonDeletedElements(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L80"> readonly ExcalidrawElement[]</a>): as readonly <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L90">NonDeletedExcalidrawElement[]</a>
957
+ </pre>
958
+
959
+ This function returns an array of deleted elements.
960
+
929
961
  ### Exported constants
930
962
 
931
963
  #### `FONT_FAMILY`
@@ -0,0 +1,2 @@
1
+ /*! For license information please see vendor-1018b0a7e7e60d808384.js.LICENSE.txt */
2
+ (self.webpackChunkExcalidraw=self.webpackChunkExcalidraw||[]).push([[736],{6233:function(t,e){var n;n=function(t){t.version="0.3.0";var e=function(){for(var t=0,e=new Array(256),n=0;256!=n;++n)t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=n)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1,e[n]=t;return"undefined"!=typeof Int32Array?new Int32Array(e):e}(),n="undefined"!=typeof Buffer;function r(t){for(var n=-1,r=0,i=t.length-7;r<i;)n=(n=(n=(n=(n=(n=(n=(n=n>>>8^e[255&(n^t[r++])])>>>8^e[255&(n^t[r++])])>>>8^e[255&(n^t[r++])])>>>8^e[255&(n^t[r++])])>>>8^e[255&(n^t[r++])])>>>8^e[255&(n^t[r++])])>>>8^e[255&(n^t[r++])])>>>8^e[255&(n^t[r++])];for(;r<i+7;)n=n>>>8^e[255&(n^t[r++])];return-1^n}t.table=e,t.bstr=function(t){if(t.length>32768&&n)return r(new Buffer(t));for(var i=-1,a=t.length-1,o=0;o<a;)i=e[255&(i^t.charCodeAt(o++))]^i>>>8,i=e[255&(i^t.charCodeAt(o++))]^i>>>8;return o===a&&(i=i>>>8^e[255&(i^t.charCodeAt(o))]),-1^i},t.buf=function(t){if(t.length>1e4)return r(t);for(var n=-1,i=0,a=t.length-3;i<a;)n=(n=(n=(n=n>>>8^e[255&(n^t[i++])])>>>8^e[255&(n^t[i++])])>>>8^e[255&(n^t[i++])])>>>8^e[255&(n^t[i++])];for(;i<a+3;)n=n>>>8^e[255&(n^t[i++])];return-1^n},t.str=function(t){for(var n,r,i=-1,a=0,o=t.length;a<o;)(n=t.charCodeAt(a++))<128?i=i>>>8^e[255&(i^n)]:n<2048?i=(i=i>>>8^e[255&(i^(192|n>>6&31))])>>>8^e[255&(i^(128|63&n))]:n>=55296&&n<57344?(n=64+(1023&n),r=1023&t.charCodeAt(a++),i=(i=(i=(i=i>>>8^e[255&(i^(240|n>>8&7))])>>>8^e[255&(i^(128|n>>2&63))])>>>8^e[255&(i^(128|r>>6&15|3&n))])>>>8^e[255&(i^(128|63&r))]):i=(i=(i=i>>>8^e[255&(i^(224|n>>12&15))])>>>8^e[255&(i^(128|n>>6&63))])>>>8^e[255&(i^(128|63&n))];return-1^i}},"undefined"==typeof DO_NOT_EXPORT_CRC?n(e):n({})},2744:function(t,e,n){"use strict";var r={};(0,n(9187).assign)(r,n(4395),n(578),n(2684)),t.exports=r},4395:function(t,e,n){"use strict";var r=n(7651),i=n(9187),a=n(8592),o=n(5604),s=n(249),h=Object.prototype.toString;function A(t){if(!(this instanceof A))return new A(t);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==n)throw new Error(o[n]);if(e.header&&r.deflateSetHeader(this.strm,e.header),e.dictionary){var u;if(u="string"==typeof e.dictionary?a.string2buf(e.dictionary):"[object ArrayBuffer]"===h.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(n=r.deflateSetDictionary(this.strm,u)))throw new Error(o[n]);this._dict_set=!0}}function u(t,e){var n=new A(e);if(n.push(t,!0),n.err)throw n.msg||o[n.err];return n.result}A.prototype.push=function(t,e){var n,o,s=this.strm,A=this.options.chunkSize;if(this.ended)return!1;o=e===~~e?e:!0===e?4:0,"string"==typeof t?s.input=a.string2buf(t):"[object ArrayBuffer]"===h.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new i.Buf8(A),s.next_out=0,s.avail_out=A),1!==(n=r.deflate(s,o))&&0!==n)return this.onEnd(n),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(a.buf2binstring(i.shrinkBuf(s.output,s.next_out))):this.onData(i.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&1!==n);return 4===o?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==o||(this.onEnd(0),s.avail_out=0,!0)},A.prototype.onData=function(t){this.chunks.push(t)},A.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=A,e.deflate=u,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,u(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,u(t,e)}},578:function(t,e,n){"use strict";var r=n(7823),i=n(9187),a=n(8592),o=n(2684),s=n(5604),h=n(249),A=n(9968),u=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(t);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,e.windowBits);if(n!==o.Z_OK)throw new Error(s[n]);if(this.header=new A,r.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=a.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=r.inflateSetDictionary(this.strm,e.dictionary))!==o.Z_OK))throw new Error(s[n])}function f(t,e){var n=new l(e);if(n.push(t,!0),n.err)throw n.msg||s[n.err];return n.result}l.prototype.push=function(t,e){var n,s,h,A,l,f=this.strm,c=this.options.chunkSize,d=this.options.dictionary,g=!1;if(this.ended)return!1;s=e===~~e?e:!0===e?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof t?f.input=a.binstring2buf(t):"[object ArrayBuffer]"===u.call(t)?f.input=new Uint8Array(t):f.input=t,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new i.Buf8(c),f.next_out=0,f.avail_out=c),(n=r.inflate(f,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&d&&(n=r.inflateSetDictionary(this.strm,d)),n===o.Z_BUF_ERROR&&!0===g&&(n=o.Z_OK,g=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),this.ended=!0,!1;f.next_out&&(0!==f.avail_out&&n!==o.Z_STREAM_END&&(0!==f.avail_in||s!==o.Z_FINISH&&s!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(h=a.utf8border(f.output,f.next_out),A=f.next_out-h,l=a.buf2string(f.output,h),f.next_out=A,f.avail_out=c-A,A&&i.arraySet(f.output,f.output,h,A,0),this.onData(l)):this.onData(i.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(g=!0)}while((f.avail_in>0||0===f.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(s=o.Z_FINISH),s===o.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):s!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),f.avail_out=0,!0)},l.prototype.onData=function(t){this.chunks.push(t)},l.prototype.onEnd=function(t){t===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=l,e.inflate=f,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,f(t,e)},e.ungzip=f},9187:function(t,e){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(t[i]=n[i])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var a=0;a<r;a++)t[i+a]=e[n+a]},flattenChunks:function(t){var e,n,r,i,a,o;for(r=0,e=0,n=t.length;e<n;e++)r+=t[e].length;for(o=new Uint8Array(r),i=0,e=0,n=t.length;e<n;e++)a=t[e],o.set(a,i),i+=a.length;return o}},a={arraySet:function(t,e,n,r,i){for(var a=0;a<r;a++)t[i+a]=e[n+a]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,i)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,a))},e.setTyped(n)},8592:function(t,e,n){"use strict";var r=n(9187),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(t){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){a=!1}for(var o=new r.Buf8(256),s=0;s<256;s++)o[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function h(t,e){if(e<65534&&(t.subarray&&a||!t.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var n="",o=0;o<e;o++)n+=String.fromCharCode(t[o]);return n}o[254]=o[254]=1,e.string2buf=function(t){var e,n,i,a,o,s=t.length,h=0;for(a=0;a<s;a++)55296==(64512&(n=t.charCodeAt(a)))&&a+1<s&&56320==(64512&(i=t.charCodeAt(a+1)))&&(n=65536+(n-55296<<10)+(i-56320),a++),h+=n<128?1:n<2048?2:n<65536?3:4;for(e=new r.Buf8(h),o=0,a=0;o<h;a++)55296==(64512&(n=t.charCodeAt(a)))&&a+1<s&&56320==(64512&(i=t.charCodeAt(a+1)))&&(n=65536+(n-55296<<10)+(i-56320),a++),n<128?e[o++]=n:n<2048?(e[o++]=192|n>>>6,e[o++]=128|63&n):n<65536?(e[o++]=224|n>>>12,e[o++]=128|n>>>6&63,e[o++]=128|63&n):(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63,e[o++]=128|n>>>6&63,e[o++]=128|63&n);return e},e.buf2binstring=function(t){return h(t,t.length)},e.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n<i;n++)e[n]=t.charCodeAt(n);return e},e.buf2string=function(t,e){var n,r,i,a,s=e||t.length,A=new Array(2*s);for(r=0,n=0;n<s;)if((i=t[n++])<128)A[r++]=i;else if((a=o[i])>4)A[r++]=65533,n+=a-1;else{for(i&=2===a?31:3===a?15:7;a>1&&n<s;)i=i<<6|63&t[n++],a--;a>1?A[r++]=65533:i<65536?A[r++]=i:(i-=65536,A[r++]=55296|i>>10&1023,A[r++]=56320|1023&i)}return h(A,r)},e.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+o[t[n]]>e?n:e}},3693:function(t){"use strict";t.exports=function(t,e,n,r){for(var i=65535&t|0,a=t>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(i=i+e[r++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0}},2684:function(t){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},8464:function(t){"use strict";var e=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();t.exports=function(t,n,r,i){var a=e,o=i+r;t^=-1;for(var s=i;s<o;s++)t=t>>>8^a[255&(t^n[s])];return-1^t}},7651:function(t,e,n){"use strict";var r,i=n(9187),a=n(8676),o=n(3693),s=n(8464),h=n(5604),A=-2,u=258,l=262,f=103,c=113,d=666;function g(t,e){return t.msg=h[e],e}function _(t){return(t<<1)-(t>4?9:0)}function p(t){for(var e=t.length;--e>=0;)t[e]=0}function m(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(i.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function w(t,e){a._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,m(t.strm)}function b(t,e){t.pending_buf[t.pending++]=e}function v(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function I(t,e){var n,r,i=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,h=t.strstart>t.w_size-l?t.strstart-(t.w_size-l):0,A=t.window,f=t.w_mask,c=t.prev,d=t.strstart+u,g=A[a+o-1],_=A[a+o];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(A[(n=e)+o]===_&&A[n+o-1]===g&&A[n]===A[a]&&A[++n]===A[a+1]){a+=2,n++;do{}while(A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&A[++a]===A[++n]&&a<d);if(r=u-(d-a),a=d-u,r>o){if(t.match_start=e,o=r,r>=s)break;g=A[a+o-1],_=A[a+o]}}}while((e=c[e&f])>h&&0!=--i);return o<=t.lookahead?o:t.lookahead}function y(t){var e,n,r,a,h,A,u,f,c,d,g=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=g+(g-l)){i.arraySet(t.window,t.window,g,g,0),t.match_start-=g,t.strstart-=g,t.block_start-=g,e=n=t.hash_size;do{r=t.head[--e],t.head[e]=r>=g?r-g:0}while(--n);e=n=g;do{r=t.prev[--e],t.prev[e]=r>=g?r-g:0}while(--n);a+=g}if(0===t.strm.avail_in)break;if(A=t.strm,u=t.window,f=t.strstart+t.lookahead,c=a,d=void 0,(d=A.avail_in)>c&&(d=c),n=0===d?0:(A.avail_in-=d,i.arraySet(u,A.input,A.next_in,d,f),1===A.state.wrap?A.adler=o(A.adler,u,d,f):2===A.state.wrap&&(A.adler=s(A.adler,u,d,f)),A.next_in+=d,A.total_in+=d,d),t.lookahead+=n,t.lookahead+t.insert>=3)for(h=t.strstart-t.insert,t.ins_h=t.window[h],t.ins_h=(t.ins_h<<t.hash_shift^t.window[h+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[h+3-1])&t.hash_mask,t.prev[h&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=h,h++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<l&&0!==t.strm.avail_in)}function B(t,e){for(var n,r;;){if(t.lookahead<l){if(y(t),t.lookahead<l&&0===e)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-l&&(t.match_length=I(t,n)),t.match_length>=3)if(r=a._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(w(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(w(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(w(t,!1),0===t.strm.avail_out)?1:2}function E(t,e){for(var n,r,i;;){if(t.lookahead<l){if(y(t),t.lookahead<l&&0===e)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-l&&(t.match_length=I(t,n),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,r=a._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(w(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((r=a._tr_tally(t,0,t.window[t.strstart-1]))&&w(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=a._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(w(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(w(t,!1),0===t.strm.avail_out)?1:2}function C(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}function x(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),p(this.dyn_ltree),p(this.dyn_dtree),p(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),p(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),p(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:c,t.adler=2===e.wrap?0:1,e.last_flush=0,a._tr_init(e),0):g(t,A)}function Q(t){var e,n=k(t);return 0===n&&((e=t.state).window_size=2*e.w_size,p(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),n}function D(t,e,n,r,a,o){if(!t)return A;var s=1;if(-1===e&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),a<1||a>9||8!==n||r<8||r>15||e<0||e>9||o<0||o>4)return g(t,A);8===r&&(r=9);var h=new x;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=r,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=a+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+3-1)/3),h.window=new i.Buf8(2*h.w_size),h.head=new i.Buf16(h.hash_size),h.prev=new i.Buf16(h.w_size),h.lit_bufsize=1<<a+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new i.Buf8(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=o,h.method=n,Q(t)}r=[new C(0,0,0,0,(function(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(y(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,w(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-l&&(w(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(w(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(w(t,!1),t.strm.avail_out),1)})),new C(4,4,8,4,B),new C(4,5,16,8,B),new C(4,6,32,32,B),new C(4,4,16,16,E),new C(8,16,32,32,E),new C(8,16,128,128,E),new C(8,32,128,256,E),new C(32,128,258,1024,E),new C(32,258,258,4096,E)],e.deflateInit=function(t,e){return D(t,e,8,15,8,0)},e.deflateInit2=D,e.deflateReset=Q,e.deflateResetKeep=k,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?A:(t.state.gzhead=e,0):A},e.deflate=function(t,e){var n,i,o,h;if(!t||!t.state||e>5||e<0)return t?g(t,A):A;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||i.status===d&&4!==e)return g(t,0===t.avail_out?-5:A);if(i.strm=t,n=i.last_flush,i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,b(i,31),b(i,139),b(i,8),i.gzhead?(b(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),b(i,255&i.gzhead.time),b(i,i.gzhead.time>>8&255),b(i,i.gzhead.time>>16&255),b(i,i.gzhead.time>>24&255),b(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),b(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(b(i,255&i.gzhead.extra.length),b(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(b(i,0),b(i,0),b(i,0),b(i,0),b(i,0),b(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),b(i,3),i.status=c);else{var l=8+(i.w_bits-8<<4)<<8;l|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(l|=32),l+=31-l%31,i.status=c,v(i,l),0!==i.strstart&&(v(i,t.adler>>>16),v(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),m(t),o=i.pending,i.pending!==i.pending_buf_size));)b(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),m(t),o=i.pending,i.pending===i.pending_buf_size)){h=1;break}h=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,b(i,h)}while(0!==h);i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),0===h&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),m(t),o=i.pending,i.pending===i.pending_buf_size)){h=1;break}h=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,b(i,h)}while(0!==h);i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),0===h&&(i.status=f)}else i.status=f;if(i.status===f&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&m(t),i.pending+2<=i.pending_buf_size&&(b(i,255&t.adler),b(i,t.adler>>8&255),t.adler=0,i.status=c)):i.status=c),0!==i.pending){if(m(t),0===t.avail_out)return i.last_flush=-1,0}else if(0===t.avail_in&&_(e)<=_(n)&&4!==e)return g(t,-5);if(i.status===d&&0!==t.avail_in)return g(t,-5);if(0!==t.avail_in||0!==i.lookahead||0!==e&&i.status!==d){var I=2===i.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(y(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,n=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(w(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(w(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(w(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var n,r,i,o,s=t.window;;){if(t.lookahead<=u){if(y(t),t.lookahead<=u&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=s[i=t.strstart-1])===s[++i]&&r===s[++i]&&r===s[++i]){o=t.strstart+u;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&i<o);t.match_length=u-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=a._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(w(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(w(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(w(t,!1),0===t.strm.avail_out)?1:2}(i,e):r[i.level].func(i,e);if(3!==I&&4!==I||(i.status=d),1===I||3===I)return 0===t.avail_out&&(i.last_flush=-1),0;if(2===I&&(1===e?a._tr_align(i):5!==e&&(a._tr_stored_block(i,0,0,!1),3===e&&(p(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),m(t),0===t.avail_out))return i.last_flush=-1,0}return 4!==e?0:i.wrap<=0?1:(2===i.wrap?(b(i,255&t.adler),b(i,t.adler>>8&255),b(i,t.adler>>16&255),b(i,t.adler>>24&255),b(i,255&t.total_in),b(i,t.total_in>>8&255),b(i,t.total_in>>16&255),b(i,t.total_in>>24&255)):(v(i,t.adler>>>16),v(i,65535&t.adler)),m(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&e!==f&&e!==c&&e!==d?g(t,A):(t.state=null,e===c?g(t,-3):0):A},e.deflateSetDictionary=function(t,e){var n,r,a,s,h,u,l,f,c=e.length;if(!t||!t.state)return A;if(2===(s=(n=t.state).wrap)||1===s&&42!==n.status||n.lookahead)return A;for(1===s&&(t.adler=o(t.adler,e,c,0)),n.wrap=0,c>=n.w_size&&(0===s&&(p(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,e,c-n.w_size,n.w_size,0),e=f,c=n.w_size),h=t.avail_in,u=t.next_in,l=t.input,t.avail_in=c,t.next_in=0,t.input=e,y(n);n.lookahead>=3;){r=n.strstart,a=n.lookahead-2;do{n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+3-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++}while(--a);n.strstart=r,n.lookahead=2,y(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=u,t.input=l,t.avail_in=h,n.wrap=s,0},e.deflateInfo="pako deflate (from Nodeca project)"},9968:function(t){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},9365:function(t){"use strict";t.exports=function(t,e){var n,r,i,a,o,s,h,A,u,l,f,c,d,g,_,p,m,w,b,v,I,y,B,E,C;n=t.state,r=t.next_in,E=t.input,i=r+(t.avail_in-5),a=t.next_out,C=t.output,o=a-(e-t.avail_out),s=a+(t.avail_out-257),h=n.dmax,A=n.wsize,u=n.whave,l=n.wnext,f=n.window,c=n.hold,d=n.bits,g=n.lencode,_=n.distcode,p=(1<<n.lenbits)-1,m=(1<<n.distbits)-1;t:do{d<15&&(c+=E[r++]<<d,d+=8,c+=E[r++]<<d,d+=8),w=g[c&p];e:for(;;){if(c>>>=b=w>>>24,d-=b,0===(b=w>>>16&255))C[a++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=g[(65535&w)+(c&(1<<b)-1)];continue e}if(32&b){n.mode=12;break t}t.msg="invalid literal/length code",n.mode=30;break t}v=65535&w,(b&=15)&&(d<b&&(c+=E[r++]<<d,d+=8),v+=c&(1<<b)-1,c>>>=b,d-=b),d<15&&(c+=E[r++]<<d,d+=8,c+=E[r++]<<d,d+=8),w=_[c&m];n:for(;;){if(c>>>=b=w>>>24,d-=b,!(16&(b=w>>>16&255))){if(0==(64&b)){w=_[(65535&w)+(c&(1<<b)-1)];continue n}t.msg="invalid distance code",n.mode=30;break t}if(I=65535&w,d<(b&=15)&&(c+=E[r++]<<d,(d+=8)<b&&(c+=E[r++]<<d,d+=8)),(I+=c&(1<<b)-1)>h){t.msg="invalid distance too far back",n.mode=30;break t}if(c>>>=b,d-=b,I>(b=a-o)){if((b=I-b)>u&&n.sane){t.msg="invalid distance too far back",n.mode=30;break t}if(y=0,B=f,0===l){if(y+=A-b,b<v){v-=b;do{C[a++]=f[y++]}while(--b);y=a-I,B=C}}else if(l<b){if(y+=A+l-b,(b-=l)<v){v-=b;do{C[a++]=f[y++]}while(--b);if(y=0,l<v){v-=b=l;do{C[a++]=f[y++]}while(--b);y=a-I,B=C}}}else if(y+=l-b,b<v){v-=b;do{C[a++]=f[y++]}while(--b);y=a-I,B=C}for(;v>2;)C[a++]=B[y++],C[a++]=B[y++],C[a++]=B[y++],v-=3;v&&(C[a++]=B[y++],v>1&&(C[a++]=B[y++]))}else{y=a-I;do{C[a++]=C[y++],C[a++]=C[y++],C[a++]=C[y++],v-=3}while(v>2);v&&(C[a++]=C[y++],v>1&&(C[a++]=C[y++]))}break}}break}}while(r<i&&a<s);r-=v=d>>3,c&=(1<<(d-=v<<3))-1,t.next_in=r,t.next_out=a,t.avail_in=r<i?i-r+5:5-(r-i),t.avail_out=a<s?s-a+257:257-(a-s),n.hold=c,n.bits=d}},7823:function(t,e,n){"use strict";var r=n(9187),i=n(3693),a=n(8464),o=n(9365),s=n(6446),h=-2,A=12,u=30;function l(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function f(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function c(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(852),e.distcode=e.distdyn=new r.Buf32(592),e.sane=1,e.back=-1,0):h}function d(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,c(t)):h}function g(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?h:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,d(t))):h}function _(t,e){var n,r;return t?(r=new f,t.state=r,r.window=null,0!==(n=g(t,e))&&(t.state=null),n):h}var p,m,w=!0;function b(t){if(w){var e;for(p=new r.Buf32(512),m=new r.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,p,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,m,0,t.work,{bits:5}),w=!1}t.lencode=p,t.lenbits=9,t.distcode=m,t.distbits=5}function v(t,e,n,i){var a,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),i>=o.wsize?(r.arraySet(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>i&&(a=i),r.arraySet(o.window,e,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,e,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=a))),0}e.inflateReset=d,e.inflateReset2=g,e.inflateResetKeep=c,e.inflateInit=function(t){return _(t,15)},e.inflateInit2=_,e.inflate=function(t,e){var n,f,c,d,g,_,p,m,w,I,y,B,E,C,x,k,Q,D,M,z,U,R,j,O,G=0,S=new r.Buf8(4),H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return h;(n=t.state).mode===A&&(n.mode=13),g=t.next_out,c=t.output,p=t.avail_out,d=t.next_in,f=t.input,_=t.avail_in,m=n.hold,w=n.bits,I=_,y=p,R=0;t:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;w<16;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if(2&n.wrap&&35615===m){n.check=0,S[0]=255&m,S[1]=m>>>8&255,n.check=a(n.check,S,2,0),m=0,w=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&m)<<8)+(m>>8))%31){t.msg="incorrect header check",n.mode=u;break}if(8!=(15&m)){t.msg="unknown compression method",n.mode=u;break}if(w-=4,U=8+(15&(m>>>=4)),0===n.wbits)n.wbits=U;else if(U>n.wbits){t.msg="invalid window size",n.mode=u;break}n.dmax=1<<U,t.adler=n.check=1,n.mode=512&m?10:A,m=0,w=0;break;case 2:for(;w<16;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if(n.flags=m,8!=(255&n.flags)){t.msg="unknown compression method",n.mode=u;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=u;break}n.head&&(n.head.text=m>>8&1),512&n.flags&&(S[0]=255&m,S[1]=m>>>8&255,n.check=a(n.check,S,2,0)),m=0,w=0,n.mode=3;case 3:for(;w<32;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}n.head&&(n.head.time=m),512&n.flags&&(S[0]=255&m,S[1]=m>>>8&255,S[2]=m>>>16&255,S[3]=m>>>24&255,n.check=a(n.check,S,4,0)),m=0,w=0,n.mode=4;case 4:for(;w<16;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}n.head&&(n.head.xflags=255&m,n.head.os=m>>8),512&n.flags&&(S[0]=255&m,S[1]=m>>>8&255,n.check=a(n.check,S,2,0)),m=0,w=0,n.mode=5;case 5:if(1024&n.flags){for(;w<16;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}n.length=m,n.head&&(n.head.extra_len=m),512&n.flags&&(S[0]=255&m,S[1]=m>>>8&255,n.check=a(n.check,S,2,0)),m=0,w=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((B=n.length)>_&&(B=_),B&&(n.head&&(U=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,f,d,B,U)),512&n.flags&&(n.check=a(n.check,f,B,d)),_-=B,d+=B,n.length-=B),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===_)break t;B=0;do{U=f[d+B++],n.head&&U&&n.length<65536&&(n.head.name+=String.fromCharCode(U))}while(U&&B<_);if(512&n.flags&&(n.check=a(n.check,f,B,d)),_-=B,d+=B,U)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===_)break t;B=0;do{U=f[d+B++],n.head&&U&&n.length<65536&&(n.head.comment+=String.fromCharCode(U))}while(U&&B<_);if(512&n.flags&&(n.check=a(n.check,f,B,d)),_-=B,d+=B,U)break t}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;w<16;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if(m!==(65535&n.check)){t.msg="header crc mismatch",n.mode=u;break}m=0,w=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=A;break;case 10:for(;w<32;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}t.adler=n.check=l(m),m=0,w=0,n.mode=11;case 11:if(0===n.havedict)return t.next_out=g,t.avail_out=p,t.next_in=d,t.avail_in=_,n.hold=m,n.bits=w,2;t.adler=n.check=1,n.mode=A;case A:if(5===e||6===e)break t;case 13:if(n.last){m>>>=7&w,w-=7&w,n.mode=27;break}for(;w<3;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}switch(n.last=1&m,w-=1,3&(m>>>=1)){case 0:n.mode=14;break;case 1:if(b(n),n.mode=20,6===e){m>>>=2,w-=2;break t}break;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=u}m>>>=2,w-=2;break;case 14:for(m>>>=7&w,w-=7&w;w<32;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if((65535&m)!=(m>>>16^65535)){t.msg="invalid stored block lengths",n.mode=u;break}if(n.length=65535&m,m=0,w=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(B=n.length){if(B>_&&(B=_),B>p&&(B=p),0===B)break t;r.arraySet(c,f,d,B,g),_-=B,d+=B,p-=B,g+=B,n.length-=B;break}n.mode=A;break;case 17:for(;w<14;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if(n.nlen=257+(31&m),m>>>=5,w-=5,n.ndist=1+(31&m),m>>>=5,w-=5,n.ncode=4+(15&m),m>>>=4,w-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=u;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;w<3;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}n.lens[H[n.have++]]=7&m,m>>>=3,w-=3}for(;n.have<19;)n.lens[H[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,j={bits:n.lenbits},R=s(0,n.lens,0,19,n.lencode,0,n.work,j),n.lenbits=j.bits,R){t.msg="invalid code lengths set",n.mode=u;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;k=(G=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,Q=65535&G,!((x=G>>>24)<=w);){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if(Q<16)m>>>=x,w-=x,n.lens[n.have++]=Q;else{if(16===Q){for(O=x+2;w<O;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if(m>>>=x,w-=x,0===n.have){t.msg="invalid bit length repeat",n.mode=u;break}U=n.lens[n.have-1],B=3+(3&m),m>>>=2,w-=2}else if(17===Q){for(O=x+3;w<O;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}w-=x,U=0,B=3+(7&(m>>>=x)),m>>>=3,w-=3}else{for(O=x+7;w<O;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}w-=x,U=0,B=11+(127&(m>>>=x)),m>>>=7,w-=7}if(n.have+B>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=u;break}for(;B--;)n.lens[n.have++]=U}}if(n.mode===u)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=u;break}if(n.lenbits=9,j={bits:n.lenbits},R=s(1,n.lens,0,n.nlen,n.lencode,0,n.work,j),n.lenbits=j.bits,R){t.msg="invalid literal/lengths set",n.mode=u;break}if(n.distbits=6,n.distcode=n.distdyn,j={bits:n.distbits},R=s(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,j),n.distbits=j.bits,R){t.msg="invalid distances set",n.mode=u;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(_>=6&&p>=258){t.next_out=g,t.avail_out=p,t.next_in=d,t.avail_in=_,n.hold=m,n.bits=w,o(t,y),g=t.next_out,c=t.output,p=t.avail_out,d=t.next_in,f=t.input,_=t.avail_in,m=n.hold,w=n.bits,n.mode===A&&(n.back=-1);break}for(n.back=0;k=(G=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,Q=65535&G,!((x=G>>>24)<=w);){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if(k&&0==(240&k)){for(D=x,M=k,z=Q;k=(G=n.lencode[z+((m&(1<<D+M)-1)>>D)])>>>16&255,Q=65535&G,!(D+(x=G>>>24)<=w);){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}m>>>=D,w-=D,n.back+=D}if(m>>>=x,w-=x,n.back+=x,n.length=Q,0===k){n.mode=26;break}if(32&k){n.back=-1,n.mode=A;break}if(64&k){t.msg="invalid literal/length code",n.mode=u;break}n.extra=15&k,n.mode=22;case 22:if(n.extra){for(O=n.extra;w<O;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}n.length+=m&(1<<n.extra)-1,m>>>=n.extra,w-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;k=(G=n.distcode[m&(1<<n.distbits)-1])>>>16&255,Q=65535&G,!((x=G>>>24)<=w);){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if(0==(240&k)){for(D=x,M=k,z=Q;k=(G=n.distcode[z+((m&(1<<D+M)-1)>>D)])>>>16&255,Q=65535&G,!(D+(x=G>>>24)<=w);){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}m>>>=D,w-=D,n.back+=D}if(m>>>=x,w-=x,n.back+=x,64&k){t.msg="invalid distance code",n.mode=u;break}n.offset=Q,n.extra=15&k,n.mode=24;case 24:if(n.extra){for(O=n.extra;w<O;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}n.offset+=m&(1<<n.extra)-1,m>>>=n.extra,w-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=u;break}n.mode=25;case 25:if(0===p)break t;if(B=y-p,n.offset>B){if((B=n.offset-B)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=u;break}B>n.wnext?(B-=n.wnext,E=n.wsize-B):E=n.wnext-B,B>n.length&&(B=n.length),C=n.window}else C=c,E=g-n.offset,B=n.length;B>p&&(B=p),p-=B,n.length-=B;do{c[g++]=C[E++]}while(--B);0===n.length&&(n.mode=21);break;case 26:if(0===p)break t;c[g++]=n.length,p--,n.mode=21;break;case 27:if(n.wrap){for(;w<32;){if(0===_)break t;_--,m|=f[d++]<<w,w+=8}if(y-=p,t.total_out+=y,n.total+=y,y&&(t.adler=n.check=n.flags?a(n.check,c,y,g-y):i(n.check,c,y,g-y)),y=p,(n.flags?m:l(m))!==n.check){t.msg="incorrect data check",n.mode=u;break}m=0,w=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;w<32;){if(0===_)break t;_--,m+=f[d++]<<w,w+=8}if(m!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=u;break}m=0,w=0}n.mode=29;case 29:R=1;break t;case u:R=-3;break t;case 31:return-4;case 32:default:return h}return t.next_out=g,t.avail_out=p,t.next_in=d,t.avail_in=_,n.hold=m,n.bits=w,(n.wsize||y!==t.avail_out&&n.mode<u&&(n.mode<27||4!==e))&&v(t,t.output,t.next_out,y-t.avail_out)?(n.mode=31,-4):(I-=t.avail_in,y-=t.avail_out,t.total_in+=I,t.total_out+=y,n.total+=y,n.wrap&&y&&(t.adler=n.check=n.flags?a(n.check,c,y,t.next_out-y):i(n.check,c,y,t.next_out-y)),t.data_type=n.bits+(n.last?64:0)+(n.mode===A?128:0)+(20===n.mode||15===n.mode?256:0),(0===I&&0===y||4===e)&&0===R&&(R=-5),R)},e.inflateEnd=function(t){if(!t||!t.state)return h;var e=t.state;return e.window&&(e.window=null),t.state=null,0},e.inflateGetHeader=function(t,e){var n;return t&&t.state?0==(2&(n=t.state).wrap)?h:(n.head=e,e.done=!1,0):h},e.inflateSetDictionary=function(t,e){var n,r=e.length;return t&&t.state?0!==(n=t.state).wrap&&11!==n.mode?h:11===n.mode&&i(1,e,r,0)!==n.check?-3:v(t,e,r,r)?(n.mode=31,-4):(n.havedict=1,0):h},e.inflateInfo="pako inflate (from Nodeca project)"},6446:function(t,e,n){"use strict";var r=n(9187),i=15,a=[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,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[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,0,0],h=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,n,A,u,l,f,c){var d,g,_,p,m,w,b,v,I,y=c.bits,B=0,E=0,C=0,x=0,k=0,Q=0,D=0,M=0,z=0,U=0,R=null,j=0,O=new r.Buf16(16),G=new r.Buf16(16),S=null,H=0;for(B=0;B<=i;B++)O[B]=0;for(E=0;E<A;E++)O[e[n+E]]++;for(k=y,x=i;x>=1&&0===O[x];x--);if(k>x&&(k=x),0===x)return u[l++]=20971520,u[l++]=20971520,c.bits=1,0;for(C=1;C<x&&0===O[C];C++);for(k<C&&(k=C),M=1,B=1;B<=i;B++)if(M<<=1,(M-=O[B])<0)return-1;if(M>0&&(0===t||1!==x))return-1;for(G[1]=0,B=1;B<i;B++)G[B+1]=G[B]+O[B];for(E=0;E<A;E++)0!==e[n+E]&&(f[G[e[n+E]]++]=E);if(0===t?(R=S=f,w=19):1===t?(R=a,j-=257,S=o,H-=257,w=256):(R=s,S=h,w=-1),U=0,E=0,B=C,m=l,Q=k,D=0,_=-1,p=(z=1<<k)-1,1===t&&z>852||2===t&&z>592)return 1;for(;;){b=B-D,f[E]<w?(v=0,I=f[E]):f[E]>w?(v=S[H+f[E]],I=R[j+f[E]]):(v=96,I=0),d=1<<B-D,C=g=1<<Q;do{u[m+(U>>D)+(g-=d)]=b<<24|v<<16|I|0}while(0!==g);for(d=1<<B-1;U&d;)d>>=1;if(0!==d?(U&=d-1,U+=d):U=0,E++,0==--O[B]){if(B===x)break;B=e[n+f[E]]}if(B>k&&(U&p)!==_){for(0===D&&(D=k),m+=C,M=1<<(Q=B-D);Q+D<x&&!((M-=O[Q+D])<=0);)Q++,M<<=1;if(z+=1<<Q,1===t&&z>852||2===t&&z>592)return 1;u[_=U&p]=k<<24|Q<<16|m-l|0}}return 0!==U&&(u[m+U]=B-D<<24|64<<16|0),c.bits=k,0}},5604:function(t){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},8676:function(t,e,n){"use strict";var r=n(9187);function i(t){for(var e=t.length;--e>=0;)t[e]=0}var a=256,o=286,s=30,h=15,A=[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],u=[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],l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],c=new Array(576);i(c);var d=new Array(60);i(d);var g=new Array(512);i(g);var _=new Array(256);i(_);var p=new Array(29);i(p);var m,w,b,v=new Array(s);function I(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function y(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function B(t){return t<256?g[t]:g[256+(t>>>7)]}function E(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function C(t,e,n){t.bi_valid>16-n?(t.bi_buf|=e<<t.bi_valid&65535,E(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function x(t,e,n){C(t,n[2*e],n[2*e+1])}function k(t,e){var n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1}function Q(t,e,n){var r,i,a=new Array(16),o=0;for(r=1;r<=h;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=k(a[s]++,s))}}function D(t){var e;for(e=0;e<o;e++)t.dyn_ltree[2*e]=0;for(e=0;e<s;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function M(t){t.bi_valid>8?E(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function z(t,e,n,r){var i=2*e,a=2*n;return t[i]<t[a]||t[i]===t[a]&&r[e]<=r[n]}function U(t,e,n){for(var r=t.heap[n],i=n<<1;i<=t.heap_len&&(i<t.heap_len&&z(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!z(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r}function R(t,e,n){var r,i,o,s,h=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*h]<<8|t.pending_buf[t.d_buf+2*h+1],i=t.pending_buf[t.l_buf+h],h++,0===r?x(t,i,e):(x(t,(o=_[i])+a+1,e),0!==(s=A[o])&&C(t,i-=p[o],s),x(t,o=B(--r),n),0!==(s=u[o])&&C(t,r-=v[o],s))}while(h<t.last_lit);x(t,256,e)}function j(t,e){var n,r,i,a=e.dyn_tree,o=e.stat_desc.static_tree,s=e.stat_desc.has_stree,A=e.stat_desc.elems,u=-1;for(t.heap_len=0,t.heap_max=573,n=0;n<A;n++)0!==a[2*n]?(t.heap[++t.heap_len]=u=n,t.depth[n]=0):a[2*n+1]=0;for(;t.heap_len<2;)a[2*(i=t.heap[++t.heap_len]=u<2?++u:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=o[2*i+1]);for(e.max_code=u,n=t.heap_len>>1;n>=1;n--)U(t,a,n);i=A;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],U(t,a,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,a[2*i]=a[2*n]+a[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,a[2*n+1]=a[2*r+1]=i,t.heap[1]=i++,U(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,a,o,s,A=e.dyn_tree,u=e.max_code,l=e.stat_desc.static_tree,f=e.stat_desc.has_stree,c=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,g=e.stat_desc.max_length,_=0;for(a=0;a<=h;a++)t.bl_count[a]=0;for(A[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<573;n++)(a=A[2*A[2*(r=t.heap[n])+1]+1]+1)>g&&(a=g,_++),A[2*r+1]=a,r>u||(t.bl_count[a]++,o=0,r>=d&&(o=c[r-d]),s=A[2*r],t.opt_len+=s*(a+o),f&&(t.static_len+=s*(l[2*r+1]+o)));if(0!==_){do{for(a=g-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[g]--,_-=2}while(_>0);for(a=g;0!==a;a--)for(r=t.bl_count[a];0!==r;)(i=t.heap[--n])>u||(A[2*i+1]!==a&&(t.opt_len+=(a-A[2*i+1])*A[2*i],A[2*i+1]=a),r--)}}(t,e),Q(a,u,t.bl_count)}function O(t,e,n){var r,i,a=-1,o=e[1],s=0,h=7,A=4;for(0===o&&(h=138,A=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=e[2*(r+1)+1],++s<h&&i===o||(s<A?t.bl_tree[2*i]+=s:0!==i?(i!==a&&t.bl_tree[2*i]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,a=i,0===o?(h=138,A=3):i===o?(h=6,A=3):(h=7,A=4))}function G(t,e,n){var r,i,a=-1,o=e[1],s=0,h=7,A=4;for(0===o&&(h=138,A=3),r=0;r<=n;r++)if(i=o,o=e[2*(r+1)+1],!(++s<h&&i===o)){if(s<A)do{x(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==a&&(x(t,i,t.bl_tree),s--),x(t,16,t.bl_tree),C(t,s-3,2)):s<=10?(x(t,17,t.bl_tree),C(t,s-3,3)):(x(t,18,t.bl_tree),C(t,s-11,7));s=0,a=i,0===o?(h=138,A=3):i===o?(h=6,A=3):(h=7,A=4)}}i(v);var S=!1;function H(t,e,n,i){C(t,0+(i?1:0),3),function(t,e,n,i){M(t),i&&(E(t,n),E(t,~n)),r.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}(t,e,n,!0)}e._tr_init=function(t){S||(!function(){var t,e,n,r,i,a=new Array(16);for(n=0,r=0;r<28;r++)for(p[r]=n,t=0;t<1<<A[r];t++)_[n++]=r;for(_[n-1]=r,i=0,r=0;r<16;r++)for(v[r]=i,t=0;t<1<<u[r];t++)g[i++]=r;for(i>>=7;r<s;r++)for(v[r]=i<<7,t=0;t<1<<u[r]-7;t++)g[256+i++]=r;for(e=0;e<=h;e++)a[e]=0;for(t=0;t<=143;)c[2*t+1]=8,t++,a[8]++;for(;t<=255;)c[2*t+1]=9,t++,a[9]++;for(;t<=279;)c[2*t+1]=7,t++,a[7]++;for(;t<=287;)c[2*t+1]=8,t++,a[8]++;for(Q(c,287,a),t=0;t<s;t++)d[2*t+1]=5,d[2*t]=k(t,5);m=new I(c,A,257,o,h),w=new I(d,u,0,s,h),b=new I(new Array(0),l,0,19,7)}(),S=!0),t.l_desc=new y(t.dyn_ltree,m),t.d_desc=new y(t.dyn_dtree,w),t.bl_desc=new y(t.bl_tree,b),t.bi_buf=0,t.bi_valid=0,D(t)},e._tr_stored_block=H,e._tr_flush_block=function(t,e,n,r){var i,o,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),j(t,t.l_desc),j(t,t.d_desc),s=function(t){var e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),j(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*f[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==e?H(t,e,n,r):4===t.strategy||o===i?(C(t,2+(r?1:0),3),R(t,c,d)):(C(t,4+(r?1:0),3),function(t,e,n,r){var i;for(C(t,e-257,5),C(t,n-1,5),C(t,r-4,4),i=0;i<r;i++)C(t,t.bl_tree[2*f[i]+1],3);G(t,t.dyn_ltree,e-1),G(t,t.dyn_dtree,n-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),R(t,t.dyn_ltree,t.dyn_dtree)),D(t),r&&M(t)},e._tr_tally=function(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(_[n]+a+1)]++,t.dyn_dtree[2*B(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){C(t,2,3),x(t,256,c),function(t){16===t.bi_valid?(E(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},249:function(t){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},4881:function(t){t.exports=function(){function t(e,n,r){function i(o,s){if(!n[o]){if(!e[o]){if(a)return a(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var A=n[o]={exports:{}};e[o][0].call(A.exports,(function(t){return i(e[o][1][t]||t)}),A,A.exports,t,e,n,r)}return n[o].exports}for(var a=void 0,o=0;o<r.length;o++)i(r[o]);return i}return t}()({1:[function(t,e,n){"use strict";var r=t("inherits"),i=t("multimath"),a=t("./mm_unsharp_mask"),o=t("./mm_resize");function s(t){var e=t||[],n={js:e.indexOf("js")>=0,wasm:e.indexOf("wasm")>=0};i.call(this,n),this.features={js:n.js,wasm:n.wasm&&this.has_wasm()},this.use(a),this.use(o)}r(s,i),s.prototype.resizeAndUnsharp=function(t,e){var n=this.resize(t,e);return t.unsharpAmount&&this.unsharp_mask(n,t.toWidth,t.toHeight,t.unsharpAmount,t.unsharpRadius,t.unsharpThreshold),n},e.exports=s},{"./mm_resize":4,"./mm_unsharp_mask":9,inherits:19,multimath:20}],2:[function(t,e,n){"use strict";function r(t){return t<0?0:t>255?255:t}function i(t,e,n,i,a,o){var s,h,A,u,l,f,c,d,g,_,p,m=0,w=0;for(g=0;g<i;g++){for(l=0,_=0;_<a;_++){for(f=o[l++],c=o[l++],d=m+4*f|0,s=h=A=u=0;c>0;c--)u=u+(p=o[l++])*t[d+3]|0,A=A+p*t[d+2]|0,h=h+p*t[d+1]|0,s=s+p*t[d]|0,d=d+4|0;e[w+3]=r(u+8192>>14),e[w+2]=r(A+8192>>14),e[w+1]=r(h+8192>>14),e[w]=r(s+8192>>14),w=w+4*i|0}w=4*(g+1)|0,m=(g+1)*n*4|0}}function a(t,e,n,i,a,o){var s,h,A,u,l,f,c,d,g,_,p,m=0,w=0;for(g=0;g<i;g++){for(l=0,_=0;_<a;_++){for(f=o[l++],c=o[l++],d=m+4*f|0,s=h=A=u=0;c>0;c--)u=u+(p=o[l++])*t[d+3]|0,A=A+p*t[d+2]|0,h=h+p*t[d+1]|0,s=s+p*t[d]|0,d=d+4|0;e[w+3]=r(u+8192>>14),e[w+2]=r(A+8192>>14),e[w+1]=r(h+8192>>14),e[w]=r(s+8192>>14),w=w+4*i|0}w=4*(g+1)|0,m=(g+1)*n*4|0}}e.exports={convolveHorizontally:i,convolveVertically:a}},{}],3:[function(t,e,n){"use strict";e.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAEXA2AAAGAGf39/f39/AGAHf39/f39/fwACDwEDZW52Bm1lbW9yeQIAAAMEAwABAgYGAX8AQQALB1cFEV9fd2FzbV9jYWxsX2N0b3JzAAAIY29udm9sdmUAAQpjb252b2x2ZUhWAAIMX19kc29faGFuZGxlAwAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAAK7AMDAwABC8YDAQ9/AkAgA0UNACAERQ0AA0AgDCENQQAhE0EAIQcDQCAHQQJqIQYCfyAHQQF0IAVqIgcuAQIiFEUEQEGAwAAhCEGAwAAhCUGAwAAhCkGAwAAhCyAGDAELIBIgBy4BAGohCEEAIQsgFCEHQQAhDiAGIQlBACEPQQAhEANAIAUgCUEBdGouAQAiESAAIAhBAnRqKAIAIgpBGHZsIBBqIRAgCkH/AXEgEWwgC2ohCyAKQRB2Qf8BcSARbCAPaiEPIApBCHZB/wFxIBFsIA5qIQ4gCEEBaiEIIAlBAWohCSAHQQFrIgcNAAsgC0GAQGshCCAOQYBAayEJIA9BgEBrIQogEEGAQGshCyAGIBRqCyEHIAEgDUECdGogCUEOdSIGQf8BIAZB/wFIGyIGQQAgBkEAShtBCHRBgP4DcSAKQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EQdEGAgPwHcSALQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EYdHJyIAhBDnUiBkH/ASAGQf8BSBsiBkEAIAZBAEobcjYCACADIA1qIQ0gE0EBaiITIARHDQALIAxBAWoiDCACbCESIAMgDEcNAAsLCx4AQQAgAiADIAQgBSAAEAEgAkEAIAQgBSAGIAEQAQs="},{}],4:[function(t,e,n){"use strict";e.exports={name:"resize",fn:t("./resize"),wasm_fn:t("./resize_wasm"),wasm_src:t("./convolve_wasm_base64")}},{"./convolve_wasm_base64":3,"./resize":5,"./resize_wasm":8}],5:[function(t,e,n){"use strict";var r=t("./resize_filter_gen"),i=t("./convolve").convolveHorizontally,a=t("./convolve").convolveVertically;function o(t,e,n){for(var r=3,i=e*n*4|0;r<i;)t[r]=255,r=r+4|0}e.exports=function(t){var e=t.src,n=t.width,s=t.height,h=t.toWidth,A=t.toHeight,u=t.scaleX||t.toWidth/t.width,l=t.scaleY||t.toHeight/t.height,f=t.offsetX||0,c=t.offsetY||0,d=t.dest||new Uint8Array(h*A*4),g=void 0===t.quality?3:t.quality,_=t.alpha||!1,p=r(g,n,h,u,f),m=r(g,s,A,l,c),w=new Uint8Array(h*s*4);return i(e,w,n,s,h,p),a(w,d,s,h,A,m),_||o(d,h,A),d}},{"./convolve":2,"./resize_filter_gen":6}],6:[function(t,e,n){"use strict";var r=t("./resize_filter_info"),i=14;function a(t){return Math.round(t*((1<<i)-1))}e.exports=function(t,e,n,i,o){var s,h,A,u,l,f,c,d,g,_,p,m,w,b,v,I,y,B=r[t].filter,E=1/i,C=Math.min(1,i),x=r[t].win/C,k=Math.floor(2*(x+1)),Q=new Int16Array((k+2)*n),D=0,M=!Q.subarray||!Q.set;for(s=0;s<n;s++){for(h=(s+.5)*E+o,A=Math.max(0,Math.floor(h-x)),l=(u=Math.min(e-1,Math.ceil(h+x)))-A+1,f=new Float32Array(l),c=new Int16Array(l),d=0,g=A,_=0;g<=u;g++,_++)d+=p=B((g+.5-h)*C),f[_]=p;for(m=0,_=0;_<f.length;_++)m+=w=f[_]/d,c[_]=a(w);for(c[n>>1]+=a(1-m),b=0;b<c.length&&0===c[b];)b++;if(b<c.length){for(v=c.length-1;v>0&&0===c[v];)v--;if(I=A+b,y=v-b+1,Q[D++]=I,Q[D++]=y,M)for(_=b;_<=v;_++)Q[D++]=c[_];else Q.set(c.subarray(b,v+1),D),D+=y}else Q[D++]=0,Q[D++]=0}return Q}},{"./resize_filter_info":7}],7:[function(t,e,n){"use strict";e.exports=[{win:.5,filter:function(t){return t>=-.5&&t<.5?1:0}},{win:1,filter:function(t){if(t<=-1||t>=1)return 0;if(t>-1.1920929e-7&&t<1.1920929e-7)return 1;var e=t*Math.PI;return Math.sin(e)/e*(.54+.46*Math.cos(e/1))}},{win:2,filter:function(t){if(t<=-2||t>=2)return 0;if(t>-1.1920929e-7&&t<1.1920929e-7)return 1;var e=t*Math.PI;return Math.sin(e)/e*Math.sin(e/2)/(e/2)}},{win:3,filter:function(t){if(t<=-3||t>=3)return 0;if(t>-1.1920929e-7&&t<1.1920929e-7)return 1;var e=t*Math.PI;return Math.sin(e)/e*Math.sin(e/3)/(e/3)}}]},{}],8:[function(t,e,n){"use strict";var r=t("./resize_filter_gen");function i(t,e,n){for(var r=3,i=e*n*4|0;r<i;)t[r]=255,r=r+4|0}function a(t){return new Uint8Array(t.buffer,0,t.byteLength)}var o=!0;try{o=1===new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0]}catch(t){}function s(t,e,n){if(o)e.set(a(t),n);else for(var r=n,i=0;i<t.length;i++){var s=t[i];e[r++]=255&s,e[r++]=s>>8&255}}e.exports=function(t){var e=t.src,n=t.width,a=t.height,o=t.toWidth,h=t.toHeight,A=t.scaleX||t.toWidth/t.width,u=t.scaleY||t.toHeight/t.height,l=t.offsetX||0,f=t.offsetY||0,c=t.dest||new Uint8Array(o*h*4),d=void 0===t.quality?3:t.quality,g=t.alpha||!1,_=r(d,n,o,A,l),p=r(d,a,h,u,f),m=0,w=this.__align(m+Math.max(e.byteLength,c.byteLength)),b=this.__align(w+a*o*4),v=this.__align(b+_.byteLength),I=v+p.byteLength,y=this.__instance("resize",I),B=new Uint8Array(this.__memory.buffer),E=new Uint32Array(this.__memory.buffer),C=new Uint32Array(e.buffer);return E.set(C),s(_,B,b),s(p,B,v),(y.exports.convolveHV||y.exports._convolveHV)(b,v,w,n,a,o,h),new Uint32Array(c.buffer).set(new Uint32Array(this.__memory.buffer,0,h*o)),g||i(c,o,h),c}},{"./resize_filter_gen":6}],9:[function(t,e,n){"use strict";e.exports={name:"unsharp_mask",fn:t("./unsharp_mask"),wasm_fn:t("./unsharp_mask_wasm"),wasm_src:t("./unsharp_mask_wasm_base64")}},{"./unsharp_mask":10,"./unsharp_mask_wasm":11,"./unsharp_mask_wasm_base64":12}],10:[function(t,e,n){"use strict";var r=t("glur/mono16");function i(t,e,n){for(var r,i,a,o,s=e*n,h=new Uint16Array(s),A=0;A<s;A++)r=t[4*A],i=t[4*A+1],a=t[4*A+2],o=r>=i&&r>=a?r:i>=a&&i>=r?i:a,h[A]=o<<8;return h}e.exports=function(t,e,n,a,o,s){var h,A,u,l,f;if(!(0===a||o<.5)){o>2&&(o=2);var c=i(t,e,n),d=new Uint16Array(c);r(d,e,n,o);for(var g=a/100*4096+.5|0,_=s<<8,p=e*n,m=0;m<p;m++)l=(h=c[m])-d[m],Math.abs(l)>=_&&(u=((A=(A=(A=h+(g*l+2048>>12))>65280?65280:A)<0?0:A)<<12)/(h=0!==h?h:1)|0,t[f=4*m]=t[f]*u+2048>>12,t[f+1]=t[f+1]*u+2048>>12,t[f+2]=t[f+2]*u+2048>>12)}}},{"glur/mono16":18}],11:[function(t,e,n){"use strict";e.exports=function(t,e,n,r,i,a){if(!(0===r||i<.5)){i>2&&(i=2);var o=e*n,s=4*o,h=2*o,A=2*o,u=4*Math.max(e,n),l=32,f=0,c=s,d=c+h,g=d+A,_=g+A,p=_+u,m=this.__instance("unsharp_mask",s+h+2*A+u+l,{exp:Math.exp}),w=new Uint32Array(t.buffer);new Uint32Array(this.__memory.buffer).set(w);var b=m.exports.hsv_v16||m.exports._hsv_v16;b(f,c,e,n),(b=m.exports.blurMono16||m.exports._blurMono16)(c,d,g,_,p,e,n,i),(b=m.exports.unsharp||m.exports._unsharp)(f,f,c,d,e,n,r,a),w.set(new Uint32Array(this.__memory.buffer,0,o))}}},{}],12:[function(t,e,n){"use strict";e.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAE0B2AAAGAEf39/fwBgBn9/f39/fwBgCH9/f39/f39/AGAIf39/f39/f30AYAJ9fwBgAXwBfAIZAgNlbnYDZXhwAAYDZW52Bm1lbW9yeQIAAAMHBgAFAgQBAwYGAX8AQQALB4oBCBFfX3dhc21fY2FsbF9jdG9ycwABFl9fYnVpbGRfZ2F1c3NpYW5fY29lZnMAAg5fX2dhdXNzMTZfbGluZQADCmJsdXJNb25vMTYABAdoc3ZfdjE2AAUHdW5zaGFycAAGDF9fZHNvX2hhbmRsZQMAGF9fd2FzbV9hcHBseV9kYXRhX3JlbG9jcwABCsUMBgMAAQvWAQEHfCABRNuGukOCGvs/IAC7oyICRAAAAAAAAADAohAAIgW2jDgCFCABIAKaEAAiAyADoCIGtjgCECABRAAAAAAAAPA/IAOhIgQgBKIgAyACIAKgokQAAAAAAADwP6AgBaGjIgS2OAIAIAEgBSAEmqIiB7Y4AgwgASADIAJEAAAAAAAA8D+gIASioiIItjgCCCABIAMgAkQAAAAAAADwv6AgBKKiIgK2OAIEIAEgByAIoCAFRAAAAAAAAPA/IAahoCIDo7Y4AhwgASAEIAKgIAOjtjgCGAuGBQMGfwl8An0gAyoCDCEVIAMqAgghFiADKgIUuyERIAMqAhC7IRACQCAEQQFrIghBAEgiCQRAIAIhByAAIQYMAQsgAiAALwEAuCIPIAMqAhi7oiIMIBGiIg0gDCAQoiAPIAMqAgS7IhOiIhQgAyoCALsiEiAPoqCgoCIOtjgCACACQQRqIQcgAEECaiEGIAhFDQAgCEEBIAhBAUgbIgpBf3MhCwJ/IAQgCmtBAXFFBEAgDiENIAgMAQsgAiANIA4gEKIgFCASIAAvAQK4Ig+ioKCgIg22OAIEIAJBCGohByAAQQRqIQYgDiEMIARBAmsLIQIgC0EAIARrRg0AA0AgByAMIBGiIA0gEKIgDyAToiASIAYvAQC4Ig6ioKCgIgy2OAIAIAcgDSARoiAMIBCiIA4gE6IgEiAGLwECuCIPoqCgoCINtjgCBCAHQQhqIQcgBkEEaiEGIAJBAkohACACQQJrIQIgAA0ACwsCQCAJDQAgASAFIAhsQQF0aiIAAn8gBkECay8BACICuCINIBW7IhKiIA0gFrsiE6KgIA0gAyoCHLuiIgwgEKKgIAwgEaKgIg8gB0EEayIHKgIAu6AiDkQAAAAAAADwQWMgDkQAAAAAAAAAAGZxBEAgDqsMAQtBAAs7AQAgCEUNACAGQQRrIQZBACAFa0EBdCEBA0ACfyANIBKiIAJB//8DcbgiDSAToqAgDyIOIBCioCAMIBGioCIPIAdBBGsiByoCALugIgxEAAAAAAAA8EFjIAxEAAAAAAAAAABmcQRAIAyrDAELQQALIQMgBi8BACECIAAgAWoiACADOwEAIAZBAmshBiAIQQFKIQMgDiEMIAhBAWshCCADDQALCwvRAgIBfwd8AkAgB0MAAAAAWw0AIARE24a6Q4Ia+z8gB0MAAAA/l7ujIglEAAAAAAAAAMCiEAAiDLaMOAIUIAQgCZoQACIKIAqgIg22OAIQIAREAAAAAAAA8D8gCqEiCyALoiAKIAkgCaCiRAAAAAAAAPA/oCAMoaMiC7Y4AgAgBCAMIAuaoiIOtjgCDCAEIAogCUQAAAAAAADwP6AgC6KiIg+2OAIIIAQgCiAJRAAAAAAAAPC/oCALoqIiCbY4AgQgBCAOIA+gIAxEAAAAAAAA8D8gDaGgIgqjtjgCHCAEIAsgCaAgCqO2OAIYIAYEQANAIAAgBSAIbEEBdGogAiAIQQF0aiADIAQgBSAGEAMgCEEBaiIIIAZHDQALCyAFRQ0AQQAhCANAIAIgBiAIbEEBdGogASAIQQF0aiADIAQgBiAFEAMgCEEBaiIIIAVHDQALCwtxAQN/IAIgA2wiBQRAA0AgASAAKAIAIgRBEHZB/wFxIgIgAiAEQQh2Qf8BcSIDIAMgBEH/AXEiBEkbIAIgA0sbIgYgBiAEIAIgBEsbIAMgBEsbQQh0OwEAIAFBAmohASAAQQRqIQAgBUEBayIFDQALCwuZAgIDfwF8IAQgBWwhBAJ/IAazQwAAgEWUQwAAyEKVu0QAAAAAAADgP6AiC5lEAAAAAAAA4EFjBEAgC6oMAQtBgICAgHgLIQUgBARAIAdBCHQhCUEAIQYDQCAJIAIgBkEBdCIHai8BACIBIAMgB2ovAQBrIgcgB0EfdSIIaiAIc00EQCAAIAZBAnQiCGoiCiAFIAdsQYAQakEMdSABaiIHQYD+AyAHQYD+A0gbIgdBACAHQQBKG0EMdCABQQEgARtuIgEgCi0AAGxBgBBqQQx2OgAAIAAgCEEBcmoiByABIActAABsQYAQakEMdjoAACAAIAhBAnJqIgcgASAHLQAAbEGAEGpBDHY6AAALIAZBAWoiBiAERw0ACwsL"},{}],13:[function(t,e,n){"use strict";var r=100;function i(t,e){this.create=t,this.available=[],this.acquired={},this.lastId=1,this.timeoutId=0,this.idle=e||2e3}i.prototype.acquire=function(){var t,e=this;return 0!==this.available.length?t=this.available.pop():((t=this.create()).id=this.lastId++,t.release=function(){return e.release(t)}),this.acquired[t.id]=t,t},i.prototype.release=function(t){var e=this;delete this.acquired[t.id],t.lastUsed=Date.now(),this.available.push(t),0===this.timeoutId&&(this.timeoutId=setTimeout((function(){return e.gc()}),r))},i.prototype.gc=function(){var t=this,e=Date.now();this.available=this.available.filter((function(n){return!(e-n.lastUsed>t.idle&&(n.destroy(),1))})),0!==this.available.length?this.timeoutId=setTimeout((function(){return t.gc()}),r):this.timeoutId=0},e.exports=i},{}],14:[function(t,e,n){"use strict";var r=2;e.exports=function(t,e,n,i,a,o){var s=n/t,h=i/e,A=(2*o+r+1)/a;if(A>.5)return[[n,i]];var u=Math.ceil(Math.log(Math.min(s,h))/Math.log(A));if(u<=1)return[[n,i]];for(var l=[],f=0;f<u;f++){var c=Math.round(Math.pow(Math.pow(t,u-f-1)*Math.pow(n,f+1),1/u)),d=Math.round(Math.pow(Math.pow(e,u-f-1)*Math.pow(i,f+1),1/u));l.push([c,d])}return l}},{}],15:[function(t,e,n){"use strict";var r=1e-5;function i(t){var e=Math.round(t);return Math.abs(t-e)<r?e:Math.floor(t)}function a(t){var e=Math.round(t);return Math.abs(t-e)<r?e:Math.ceil(t)}e.exports=function(t){var e,n,r,o,s,h,A=t.toWidth/t.width,u=t.toHeight/t.height,l=i(t.srcTileSize*A)-2*t.destTileBorder,f=i(t.srcTileSize*u)-2*t.destTileBorder;if(l<1||f<1)throw new Error("Internal error in pica: target tile width/height is too small.");var c,d=[];for(o=0;o<t.toHeight;o+=f)for(r=0;r<t.toWidth;r+=l)(e=r-t.destTileBorder)<0&&(e=0),e+(s=r+l+t.destTileBorder-e)>=t.toWidth&&(s=t.toWidth-e),(n=o-t.destTileBorder)<0&&(n=0),n+(h=o+f+t.destTileBorder-n)>=t.toHeight&&(h=t.toHeight-n),c={toX:e,toY:n,toWidth:s,toHeight:h,toInnerX:r,toInnerY:o,toInnerWidth:l,toInnerHeight:f,offsetX:e/A-i(e/A),offsetY:n/u-i(n/u),scaleX:A,scaleY:u,x:i(e/A),y:i(n/u),width:a(s/A),height:a(h/u)},d.push(c);return d}},{}],16:[function(t,e,n){"use strict";function r(t){return Object.prototype.toString.call(t)}e.exports.isCanvas=function(t){var e=r(t);return"[object HTMLCanvasElement]"===e||"[object OffscreenCanvas]"===e||"[object Canvas]"===e},e.exports.isImage=function(t){return"[object HTMLImageElement]"===r(t)},e.exports.isImageBitmap=function(t){return"[object ImageBitmap]"===r(t)},e.exports.limiter=function(t){var e=0,n=[];function r(){e<t&&n.length&&(e++,n.shift()())}return function(t){return new Promise((function(i,a){n.push((function(){t().then((function(t){i(t),e--,r()}),(function(t){a(t),e--,r()}))})),r()}))}},e.exports.cib_quality_name=function(t){switch(t){case 0:return"pixelated";case 1:return"low";case 2:return"medium"}return"high"},e.exports.cib_support=function(t){return Promise.resolve().then((function(){if("undefined"==typeof createImageBitmap)return!1;var e=t(100,100);return createImageBitmap(e,0,0,100,100,{resizeWidth:10,resizeHeight:10,resizeQuality:"high"}).then((function(t){var n=10===t.width;return t.close(),e=null,n}))})).catch((function(){return!1}))},e.exports.worker_offscreen_canvas_support=function(){return new Promise((function(t,e){if("undefined"!=typeof OffscreenCanvas){var n=btoa("(".concat(i.toString(),")(self);")),r=new Worker("data:text/javascript;base64,".concat(n));r.onmessage=function(e){return t(e.data)},r.onerror=e}else t(!1);function i(t){"undefined"!=typeof createImageBitmap?Promise.resolve().then((function(){var t=new OffscreenCanvas(10,10);return t.getContext("2d").rect(0,0,1,1),createImageBitmap(t,0,0,1,1)})).then((function(){return t.postMessage(!0)}),(function(){return t.postMessage(!1)})):t.postMessage(!1)}})).then((function(t){return t}),(function(){return!1}))},e.exports.can_use_canvas=function(t){var e=!1;try{var n=t(2,1).getContext("2d"),r=n.createImageData(2,1);r.data[0]=12,r.data[1]=23,r.data[2]=34,r.data[3]=255,r.data[4]=45,r.data[5]=56,r.data[6]=67,r.data[7]=255,n.putImageData(r,0,0),r=null,12===(r=n.getImageData(0,0,2,1)).data[0]&&23===r.data[1]&&34===r.data[2]&&255===r.data[3]&&45===r.data[4]&&56===r.data[5]&&67===r.data[6]&&255===r.data[7]&&(e=!0)}catch(t){}return e},e.exports.cib_can_use_region=function(){return new Promise((function(t){if("undefined"!=typeof createImageBitmap){var e=new Image;e.src="data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z",e.onload=function(){createImageBitmap(e,0,0,e.width,e.height).then((function(n){n.width===e.width&&n.height===e.height?t(!0):t(!1)}),(function(){return t(!1)}))},e.onerror=function(){return t(!1)}}else t(!1)}))}},{}],17:[function(t,e,n){"use strict";e.exports=function(){var e,n=t("./mathlib");onmessage=function(t){var r=t.data.opts,i=!1;if(!r.src&&r.srcBitmap){var a=new OffscreenCanvas(r.width,r.height),o=a.getContext("2d",{alpha:Boolean(r.alpha)});o.drawImage(r.srcBitmap,0,0),r.src=o.getImageData(0,0,r.width,r.height).data,a.width=a.height=0,a=null,r.srcBitmap.close(),r.srcBitmap=null,i=!0}e||(e=new n(t.data.features));var s=e.resizeAndUnsharp(r);if(i){var h=new ImageData(new Uint8ClampedArray(s),r.toWidth,r.toHeight),A=new OffscreenCanvas(r.toWidth,r.toHeight);A.getContext("2d",{alpha:Boolean(r.alpha)}).putImageData(h,0,0),createImageBitmap(A).then((function(t){postMessage({bitmap:t},[t])}))}else postMessage({data:s},[s.buffer])}}},{"./mathlib":1}],18:[function(t,e,n){var r,i,a,o,s,h;function A(t){t<.5&&(t=.5);var e=Math.exp(.527076)/t,n=Math.exp(-e),A=Math.exp(-2*e),u=(1-n)*(1-n)/(1+2*e*n-A);return r=u,i=u*(e-1)*n,a=u*(e+1)*n,o=-u*A,s=2*n,h=-A,new Float32Array([r,i,a,o,s,h,(r+i)/(1-s-h),(a+o)/(1-s-h)])}function u(t,e,n,r,i,a){var o,s,h,A,u,l,f,c,d,g,_,p,m,w;for(d=0;d<a;d++){for(f=d,c=0,A=u=(o=t[l=d*i])*r[6],_=r[0],p=r[1],m=r[4],w=r[5],g=0;g<i;g++)h=(s=t[l])*_+o*p+A*m+u*w,u=A,A=h,o=s,n[c]=A,c++,l++;for(c--,f+=a*(i-1),A=u=(o=t[--l])*r[7],s=o,_=r[2],p=r[3],g=i-1;g>=0;g--)h=s*_+o*p+A*m+u*w,u=A,A=h,o=s,s=t[l],e[f]=n[c]+A,l--,c--,f-=a}}function l(t,e,n,r){if(r){var i=new Uint16Array(t.length),a=new Float32Array(Math.max(e,n)),o=A(r);u(t,i,a,o,e,n,r),u(i,t,a,o,n,e,r)}}e.exports=l},{}],19:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},{}],20:[function(t,e,n){"use strict";var r=t("object-assign"),i=t("./lib/base64decode"),a=t("./lib/wa_detect"),o={js:!0,wasm:!0};function s(t){if(!(this instanceof s))return new s(t);var e=r({},o,t||{});if(this.options=e,this.__cache={},this.__init_promise=null,this.__modules=e.modules||{},this.__memory=null,this.__wasm={},this.__isLE=1===new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0],!this.options.js&&!this.options.wasm)throw new Error('mathlib: at least "js" or "wasm" should be enabled')}s.prototype.has_wasm=a,s.prototype.use=function(t){return this.__modules[t.name]=t,this.options.wasm&&this.has_wasm()&&t.wasm_fn?this[t.name]=t.wasm_fn:this[t.name]=t.fn,this},s.prototype.init=function(){if(this.__init_promise)return this.__init_promise;if(!this.options.js&&this.options.wasm&&!this.has_wasm())return Promise.reject(new Error('mathlib: only "wasm" was enabled, but it\'s not supported'));var t=this;return this.__init_promise=Promise.all(Object.keys(t.__modules).map((function(e){var n=t.__modules[e];return t.options.wasm&&t.has_wasm()&&n.wasm_fn?t.__wasm[e]?null:WebAssembly.compile(t.__base64decode(n.wasm_src)).then((function(n){t.__wasm[e]=n})):null}))).then((function(){return t})),this.__init_promise},s.prototype.__base64decode=i,s.prototype.__reallocate=function(t){if(!this.__memory)return this.__memory=new WebAssembly.Memory({initial:Math.ceil(t/65536)}),this.__memory;var e=this.__memory.buffer.byteLength;return e<t&&this.__memory.grow(Math.ceil((t-e)/65536)),this.__memory},s.prototype.__instance=function(t,e,n){if(e&&this.__reallocate(e),!this.__wasm[t]){var i=this.__modules[t];this.__wasm[t]=new WebAssembly.Module(this.__base64decode(i.wasm_src))}if(!this.__cache[t]){var a={memoryBase:0,memory:this.__memory,tableBase:0,table:new WebAssembly.Table({initial:0,element:"anyfunc"})};this.__cache[t]=new WebAssembly.Instance(this.__wasm[t],{env:r(a,n||{})})}return this.__cache[t]},s.prototype.__align=function(t,e){var n=t%(e=e||8);return t+(n?e-n:0)},e.exports=s},{"./lib/base64decode":21,"./lib/wa_detect":22,"object-assign":23}],21:[function(t,e,n){"use strict";var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";e.exports=function(t){for(var e=t.replace(/[\r\n=]/g,""),n=e.length,i=new Uint8Array(3*n>>2),a=0,o=0,s=0;s<n;s++)s%4==0&&s&&(i[o++]=a>>16&255,i[o++]=a>>8&255,i[o++]=255&a),a=a<<6|r.indexOf(e.charAt(s));var h=n%4*6;return 0===h?(i[o++]=a>>16&255,i[o++]=a>>8&255,i[o++]=255&a):18===h?(i[o++]=a>>10&255,i[o++]=a>>2&255):12===h&&(i[o++]=a>>4&255),i}},{}],22:[function(t,e,n){"use strict";var r;e.exports=function(){if(void 0!==r)return r;if(r=!1,"undefined"==typeof WebAssembly)return r;try{var t=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),e=new WebAssembly.Module(t);return 0!==new WebAssembly.Instance(e,{}).exports.test(4)&&(r=!0),r}catch(t){}return r}},{}],23:[function(t,e,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function s(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}e.exports=s()?Object.assign:function(t,e){for(var n,s,h=o(t),A=1;A<arguments.length;A++){for(var u in n=Object(arguments[A]))i.call(n,u)&&(h[u]=n[u]);if(r){s=r(n);for(var l=0;l<s.length;l++)a.call(n,s[l])&&(h[s[l]]=n[s[l]])}}return h}},{}],24:[function(t,e,n){var r=arguments[3],i=arguments[4],a=arguments[5],o=JSON.stringify;e.exports=function(t,e){for(var n,s=Object.keys(a),h=0,A=s.length;h<A;h++){var u=s[h],l=a[u].exports;if(l===t||l&&l.default===t){n=u;break}}if(!n){n=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var f={};for(h=0,A=s.length;h<A;h++)f[u=s[h]]=u;i[n]=["function(require,module,exports){"+t+"(self); }",f]}var c=Math.floor(Math.pow(16,8)*Math.random()).toString(16),d={};d[n]=n,i[c]=["function(require,module,exports){var f = require("+o(n)+");(f.default ? f.default : f)(self);}",d];var g={};function _(t){for(var e in g[t]=!0,i[t][1]){var n=i[t][1][e];g[n]||_(n)}}_(c);var p="("+r+")({"+Object.keys(g).map((function(t){return o(t)+":["+i[t][0]+","+o(i[t][1])+"]"})).join(",")+"},{},["+o(c)+"])",m=window.URL||window.webkitURL||window.mozURL||window.msURL,w=new Blob([p],{type:"text/javascript"});if(e&&e.bare)return w;var b=m.createObjectURL(w),v=new Worker(b);return v.objectURL=b,v}},{}],"/index.js":[function(t,e,n){"use strict";function r(t,e){return h(t)||s(t,e)||a(t,e)||i()}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}function h(t){if(Array.isArray(t))return t}var A=t("object-assign"),u=t("webworkify"),l=t("./lib/mathlib"),f=t("./lib/pool"),c=t("./lib/utils"),d=t("./lib/worker"),g=t("./lib/stepper"),_=t("./lib/tiler"),p={},m=!1;try{"undefined"!=typeof navigator&&navigator.userAgent&&(m=navigator.userAgent.indexOf("Safari")>=0)}catch(t){}var w=1;"undefined"!=typeof navigator&&(w=Math.min(navigator.hardwareConcurrency||1,4));var b={tile:1024,concurrency:w,features:["js","wasm","ww"],idle:2e3,createCanvas:function(t,e){var n=document.createElement("canvas");return n.width=t,n.height=e,n}},v={quality:3,alpha:!1,unsharpAmount:0,unsharpRadius:0,unsharpThreshold:0},I=!1,y=!1,B=!1,E=!1,C=!1;function x(){return{value:u(d),destroy:function(){if(this.value.terminate(),"undefined"!=typeof window){var t=window.URL||window.webkitURL||window.mozURL||window.msURL;t&&t.revokeObjectURL&&this.value.objectURL&&t.revokeObjectURL(this.value.objectURL)}}}}function k(t){if(!(this instanceof k))return new k(t);this.options=A({},b,t||{});var e="lk_".concat(this.options.concurrency);this.__limit=p[e]||c.limiter(this.options.concurrency),p[e]||(p[e]=this.__limit),this.features={js:!1,wasm:!1,cib:!1,ww:!1},this.__workersPool=null,this.__requested_features=[],this.__mathlib=null}k.prototype.init=function(){var e=this;if(this.__initPromise)return this.__initPromise;if("undefined"!=typeof ImageData&&"undefined"!=typeof Uint8ClampedArray)try{new ImageData(new Uint8ClampedArray(400),10,10),I=!0}catch(t){}"undefined"!=typeof ImageBitmap&&(ImageBitmap.prototype&&ImageBitmap.prototype.close?y=!0:this.debug("ImageBitmap does not support .close(), disabled"));var n=this.options.features.slice();if(n.indexOf("all")>=0&&(n=["cib","wasm","js","ww"]),this.__requested_features=n,this.__mathlib=new l(n),n.indexOf("ww")>=0&&"undefined"!=typeof window&&"Worker"in window)try{t("webworkify")((function(){})).terminate(),this.features.ww=!0;var r="wp_".concat(JSON.stringify(this.options));p[r]?this.__workersPool=p[r]:(this.__workersPool=new f(x,this.options.idle),p[r]=this.__workersPool)}catch(t){}var i,a,o=this.__mathlib.init().then((function(t){A(e.features,t.features)}));i=y?c.cib_support(this.options.createCanvas).then((function(t){e.features.cib&&n.indexOf("cib")<0?e.debug("createImageBitmap() resize supported, but disabled by config"):n.indexOf("cib")>=0&&(e.features.cib=t)})):Promise.resolve(!1),B=c.can_use_canvas(this.options.createCanvas),a=(a=y&&I&&-1!==n.indexOf("ww")?c.worker_offscreen_canvas_support():Promise.resolve(!1)).then((function(t){E=t}));var s=c.cib_can_use_region().then((function(t){C=t}));return this.__initPromise=Promise.all([o,i,a,s]).then((function(){return e})),this.__initPromise},k.prototype.__invokeResize=function(t,e){var n=this;return e.__mathCache=e.__mathCache||{},Promise.resolve().then((function(){return n.features.ww?new Promise((function(r,i){var a=n.__workersPool.acquire();e.cancelToken&&e.cancelToken.catch((function(t){return i(t)})),a.value.onmessage=function(t){a.release(),t.data.err?i(t.data.err):r(t.data)};var o=[];t.src&&o.push(t.src.buffer),t.srcBitmap&&o.push(t.srcBitmap),a.value.postMessage({opts:t,features:n.__requested_features,preload:{wasm_nodule:n.__mathlib.__}},o)})):{data:n.__mathlib.resizeAndUnsharp(t,e.__mathCache)}}))},k.prototype.__extractTileData=function(t,e,n,r,i){if(this.features.ww&&E&&(c.isCanvas(e)||C))return this.debug("Create tile for OffscreenCanvas"),createImageBitmap(r.srcImageBitmap||e,t.x,t.y,t.width,t.height).then((function(t){return i.srcBitmap=t,i}));if(c.isCanvas(e))return r.srcCtx||(r.srcCtx=e.getContext("2d",{alpha:Boolean(n.alpha)})),this.debug("Get tile pixel data"),i.src=r.srcCtx.getImageData(t.x,t.y,t.width,t.height).data,i;this.debug("Draw tile imageBitmap/image to temporary canvas");var a=this.options.createCanvas(t.width,t.height),o=a.getContext("2d",{alpha:Boolean(n.alpha)});return o.globalCompositeOperation="copy",o.drawImage(r.srcImageBitmap||e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),this.debug("Get tile pixel data"),i.src=o.getImageData(0,0,t.width,t.height).data,a.width=a.height=0,i},k.prototype.__landTileData=function(t,e,n){var r;if(this.debug("Convert raw rgba tile result to ImageData"),e.bitmap)return n.toCtx.drawImage(e.bitmap,t.toX,t.toY),null;if(I)r=new ImageData(new Uint8ClampedArray(e.data),t.toWidth,t.toHeight);else if((r=n.toCtx.createImageData(t.toWidth,t.toHeight)).data.set)r.data.set(e.data);else for(var i=r.data.length-1;i>=0;i--)r.data[i]=e.data[i];return this.debug("Draw tile"),m?n.toCtx.putImageData(r,t.toX,t.toY,t.toInnerX-t.toX,t.toInnerY-t.toY,t.toInnerWidth+1e-5,t.toInnerHeight+1e-5):n.toCtx.putImageData(r,t.toX,t.toY,t.toInnerX-t.toX,t.toInnerY-t.toY,t.toInnerWidth,t.toInnerHeight),null},k.prototype.__tileAndResize=function(t,e,n){var r=this,i={srcCtx:null,srcImageBitmap:null,isImageBitmapReused:!1,toCtx:null},a=function(e){return r.__limit((function(){if(n.canceled)return n.cancelToken;var a={width:e.width,height:e.height,toWidth:e.toWidth,toHeight:e.toHeight,scaleX:e.scaleX,scaleY:e.scaleY,offsetX:e.offsetX,offsetY:e.offsetY,quality:n.quality,alpha:n.alpha,unsharpAmount:n.unsharpAmount,unsharpRadius:n.unsharpRadius,unsharpThreshold:n.unsharpThreshold};return r.debug("Invoke resize math"),Promise.resolve(a).then((function(a){return r.__extractTileData(e,t,n,i,a)})).then((function(t){return r.debug("Invoke resize math"),r.__invokeResize(t,n)})).then((function(t){return n.canceled?n.cancelToken:(i.srcImageData=null,r.__landTileData(e,t,i))}))}))};return Promise.resolve().then((function(){if(i.toCtx=e.getContext("2d",{alpha:Boolean(n.alpha)}),c.isCanvas(t))return null;if(c.isImageBitmap(t))return i.srcImageBitmap=t,i.isImageBitmapReused=!0,null;if(c.isImage(t))return y?(r.debug("Decode image via createImageBitmap"),createImageBitmap(t).then((function(t){i.srcImageBitmap=t})).catch((function(t){return null}))):null;throw new Error('Pica: ".from" should be Image, Canvas or ImageBitmap')})).then((function(){if(n.canceled)return n.cancelToken;r.debug("Calculate tiles");var t=_({width:n.width,height:n.height,srcTileSize:r.options.tile,toWidth:n.toWidth,toHeight:n.toHeight,destTileBorder:n.__destTileBorder}).map((function(t){return a(t)}));function o(t){t.srcImageBitmap&&(t.isImageBitmapReused||t.srcImageBitmap.close(),t.srcImageBitmap=null)}return r.debug("Process tiles"),Promise.all(t).then((function(){return r.debug("Finished!"),o(i),e}),(function(t){throw o(i),t}))}))},k.prototype.__processStages=function(t,e,n,i){var a=this;if(i.canceled)return i.cancelToken;var o,s=r(t.shift(),2),h=s[0],u=s[1],l=0===t.length;return i=A({},i,{toWidth:h,toHeight:u,quality:l?i.quality:Math.min(1,i.quality)}),l||(o=this.options.createCanvas(h,u)),this.__tileAndResize(e,l?n:o,i).then((function(){return l?n:(i.width=h,i.height=u,a.__processStages(t,o,n,i))})).then((function(t){return o&&(o.width=o.height=0),t}))},k.prototype.__resizeViaCreateImageBitmap=function(t,e,n){var r=this,i=e.getContext("2d",{alpha:Boolean(n.alpha)});return this.debug("Resize via createImageBitmap()"),createImageBitmap(t,{resizeWidth:n.toWidth,resizeHeight:n.toHeight,resizeQuality:c.cib_quality_name(n.quality)}).then((function(t){if(n.canceled)return n.cancelToken;if(!n.unsharpAmount)return i.drawImage(t,0,0),t.close(),i=null,r.debug("Finished!"),e;r.debug("Unsharp result");var a=r.options.createCanvas(n.toWidth,n.toHeight),o=a.getContext("2d",{alpha:Boolean(n.alpha)});o.drawImage(t,0,0),t.close();var s=o.getImageData(0,0,n.toWidth,n.toHeight);return r.__mathlib.unsharp_mask(s.data,n.toWidth,n.toHeight,n.unsharpAmount,n.unsharpRadius,n.unsharpThreshold),i.putImageData(s,0,0),a.width=a.height=0,s=o=a=i=null,r.debug("Finished!"),e}))},k.prototype.resize=function(t,e,n){var r=this;this.debug("Start resize...");var i=A({},v);if(isNaN(n)?n&&(i=A(i,n)):i=A(i,{quality:n}),i.toWidth=e.width,i.toHeight=e.height,i.width=t.naturalWidth||t.width,i.height=t.naturalHeight||t.height,0===e.width||0===e.height)return Promise.reject(new Error("Invalid output size: ".concat(e.width,"x").concat(e.height)));i.unsharpRadius>2&&(i.unsharpRadius=2),i.canceled=!1,i.cancelToken&&(i.cancelToken=i.cancelToken.then((function(t){throw i.canceled=!0,t}),(function(t){throw i.canceled=!0,t})));var a=3;return i.__destTileBorder=Math.ceil(Math.max(a,2.5*i.unsharpRadius|0)),this.init().then((function(){if(i.canceled)return i.cancelToken;if(r.features.cib)return r.__resizeViaCreateImageBitmap(t,e,i);if(!B){var n=new Error("Pica: cannot use getImageData on canvas, make sure fingerprinting protection isn't enabled");throw n.code="ERR_GET_IMAGE_DATA",n}var a=g(i.width,i.height,i.toWidth,i.toHeight,r.options.tile,i.__destTileBorder);return r.__processStages(a,t,e,i)}))},k.prototype.resizeBuffer=function(t){var e=this,n=A({},v,t);return this.init().then((function(){return e.__mathlib.resizeAndUnsharp(n)}))},k.prototype.toBlob=function(t,e,n){return e=e||"image/png",new Promise((function(r){if(t.toBlob)t.toBlob((function(t){return r(t)}),e,n);else if(t.convertToBlob)r(t.convertToBlob({type:e,quality:n}));else{for(var i=atob(t.toDataURL(e,n).split(",")[1]),a=i.length,o=new Uint8Array(a),s=0;s<a;s++)o[s]=i.charCodeAt(s);r(new Blob([o],{type:e}))}}))},k.prototype.debug=function(){},e.exports=k},{"./lib/mathlib":1,"./lib/pool":13,"./lib/stepper":14,"./lib/tiler":15,"./lib/utils":16,"./lib/worker":17,"object-assign":23,webworkify:24}]},{},[])("/index.js")},9066:function(t){t.exports=function(t){t.data&&t.name&&(t=t.data);for(var e=!0,n="",r="",i=0;i<t.length;i++){var a=t[i];if(e)a?r+=String.fromCharCode(a):e=!1;else{if(!a)throw new Error("Invalid NULL character found. 0x00 character is not permitted in tEXt content");n+=String.fromCharCode(a)}}return{keyword:r,text:n}}},9686:function(t){t.exports=function(t,e){if(t=String(t),e=String(e),!/^[\x00-\xFF]+$/.test(t)||!/^[\x00-\xFF]+$/.test(e))throw new Error("Only Latin-1 characters are permitted in PNG tEXt chunks. You might want to consider base64 encoding and/or zEXt compression");if(t.length>=80)throw new Error('Keyword "'+t+'" is longer than the 79-character limit imposed by the PNG specification');for(var n,r=t.length+e.length+1,i=new Uint8Array(r),a=0,o=0;o<t.length;o++){if(!(n=t.charCodeAt(o)))throw new Error("0x00 character is not permitted in tEXt keywords");i[a++]=n}i[a++]=0;for(var s=0;s<e.length;s++){if(!(n=e.charCodeAt(s)))throw new Error("0x00 character is not permitted in tEXt content");i[a++]=n}return{name:"tEXt",data:i}}},1194:function(t,e,n){e.encode=n(9686),e.decode=n(9066)},3434:function(t,e,n){var r=n(5714),i=n(6233);t.exports=function(t){var e,n=8,h=n;for(e=0;e<t.length;e++)n+=t[e].data.length,n+=12;var A=new Uint8Array(n);for(A[0]=137,A[1]=80,A[2]=78,A[3]=71,A[4]=13,A[5]=10,A[6]=26,A[7]=10,e=0;e<t.length;e++){var u=t[e],l=u.name,f=u.data,c=f.length,d=[l.charCodeAt(0),l.charCodeAt(1),l.charCodeAt(2),l.charCodeAt(3)];s[0]=c,A[h++]=a[3],A[h++]=a[2],A[h++]=a[1],A[h++]=a[0],A[h++]=d[0],A[h++]=d[1],A[h++]=d[2],A[h++]=d[3];for(var g=0;g<c;)A[h++]=f[g++];var _=d.concat(r(f)),p=i.buf(_);o[0]=p,A[h++]=a[3],A[h++]=a[2],A[h++]=a[1],A[h++]=a[0]}return A};var a=new Uint8Array(4),o=new Int32Array(a.buffer),s=new Uint32Array(a.buffer)},2983:function(t,e,n){var r=n(6233);t.exports=function(t){if(137!==t[0])throw new Error("Invalid .png file header");if(80!==t[1])throw new Error("Invalid .png file header");if(78!==t[2])throw new Error("Invalid .png file header");if(71!==t[3])throw new Error("Invalid .png file header");if(13!==t[4])throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(10!==t[5])throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(26!==t[6])throw new Error("Invalid .png file header");if(10!==t[7])throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");var e=!1,n=[],s=8;for(;s<t.length;){i[3]=t[s++],i[2]=t[s++],i[1]=t[s++],i[0]=t[s++];var h=o[0]+4,A=new Uint8Array(h);A[0]=t[s++],A[1]=t[s++],A[2]=t[s++],A[3]=t[s++];var u=String.fromCharCode(A[0])+String.fromCharCode(A[1])+String.fromCharCode(A[2])+String.fromCharCode(A[3]);if(!n.length&&"IHDR"!==u)throw new Error("IHDR header missing");if("IEND"===u){e=!0,n.push({name:u,data:new Uint8Array(0)});break}for(var l=4;l<h;l++)A[l]=t[s++];i[3]=t[s++],i[2]=t[s++],i[1]=t[s++],i[0]=t[s++];var f=a[0];if(r.buf(A)!==f)throw new Error("CRC values for "+u+" header do not match, PNG file is likely corrupted");var c=new Uint8Array(A.buffer.slice(4));n.push({name:u,data:c})}if(!e)throw new Error(".png file ended prematurely: no IEND header was found");return n};var i=new Uint8Array(4),a=new Int32Array(i.buffer),o=new Uint32Array(i.buffer)},5714:function(t){t.exports=function(t,e,n){var r=[],i=t.length;if(0===i)return r;var a=e<0?Math.max(0,e+i):e||0;for(void 0!==n&&(i=n<0?n+i:n);i-- >a;)r[i-a]=t[i];return r}},5756:function(t,e,n){"use strict";n.r(e);const r=async(t,e,n=t.name)=>{const i=[],a=[];for await(const o of t.values()){const s=`${n}/${o.name}`;"file"===o.kind?a.push(o.getFile().then((e=>(e.directoryHandle=t,Object.defineProperty(e,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>s}))))):"directory"===o.kind&&e&&i.push(r(o,e,s))}return[...(await Promise.all(i)).flat(),...await Promise.all(a)]};e.default=async(t={})=>{t.recursive=t.recursive||!1;const e=await window.showDirectoryPicker({id:t.id,startIn:t.startIn});return r(e,t.recursive)}},6629:function(t,e,n){"use strict";n.r(e);const r=async t=>{const e=await t.getFile();return e.handle=t,e};e.default=async(t=[{}])=>{Array.isArray(t)||(t=[t]);const e=[];t.forEach(((t,n)=>{e[n]={description:t.description||"",accept:{}},t.mimeTypes?t.mimeTypes.map((r=>{e[n].accept[r]=t.extensions||[]})):e[n].accept["*/*"]=t.extensions||[]}));const n=await window.showOpenFilePicker({id:t[0].id,startIn:t[0].startIn,types:e,multiple:t[0].multiple||!1,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1}),i=await Promise.all(n.map(r));return t[0].multiple?i:i[0]}},4868:function(t,e,n){"use strict";n.r(e),e.default=async(t,e=[{}],n=null,r=!1)=>{Array.isArray(e)||(e=[e]),e[0].fileName=e[0].fileName||"Untitled";const i=[];if(e.forEach(((e,n)=>{i[n]={description:e.description||"",accept:{}},e.mimeTypes?(0===n&&e.mimeTypes.push(t.type),e.mimeTypes.map((t=>{i[n].accept[t]=e.extensions||[]}))):i[n].accept[t.type]=e.extensions||[]})),n)try{await n.getFile()}catch(t){if(n=null,r)throw t}const a=n||await window.showSaveFilePicker({suggestedName:e[0].fileName,id:e[0].id,startIn:e[0].startIn,types:i,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),o=await a.createWritable();return await o.write(t),await o.close(),a}},8396:function(t,e,n){"use strict";n.r(e),e.default=async(t=[{}])=>(Array.isArray(t)||(t=[t]),t[0].recursive=t[0].recursive||!1,new Promise(((e,n)=>{const r=document.createElement("input");r.type="file",r.webkitdirectory=!0;const i=t=>{"function"==typeof a&&a(),e(t)},a=t[0].legacySetup&&t[0].legacySetup(i,(()=>a(n)),r);r.addEventListener("change",(()=>{i(r.multiple?Array.from(r.files):r.files[0])})),r.addEventListener("change",(()=>{let e=Array.from(r.files);t[0].recursive||(e=e.filter((t=>2===t.webkitRelativePath.split("/").length))),i(e)})),r.click()})))},3112:function(t,e,n){"use strict";n.r(e),e.default=async(t=[{}])=>(Array.isArray(t)||(t=[t]),new Promise(((e,n)=>{const r=document.createElement("input");r.type="file";const i=[...t.map((t=>t.mimeTypes||[])).join(),t.map((t=>t.extensions||[])).join()].join();r.multiple=t[0].multiple||!1,r.accept=i||"";const a=t=>{"function"==typeof o&&o(),e(t)},o=t[0].legacySetup&&t[0].legacySetup(a,(()=>o(n)),r);r.addEventListener("change",(()=>{a(r.multiple?Array.from(r.files):r.files[0])})),r.click()})))},6882:function(t,e,n){"use strict";n.r(e),e.default=async(t,e={})=>{Array.isArray(e)&&(e=e[0]);const n=document.createElement("a");n.download=e.fileName||"Untitled",n.href=URL.createObjectURL(t);const r=t=>{"function"==typeof i&&i(),resolve(t)},i=e.legacySetup&&e.legacySetup(r,(()=>i(reject)),n);return n.addEventListener("click",(()=>{setTimeout((()=>URL.revokeObjectURL(n.href)),3e4),r(null)})),n.click(),null}},100:function(t,e,n){"use strict";n.r(e);function r(t,e){var n={};return e.forEach((function(e){Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})),n}var i={assign:function(t){for(var e,n=1;n<arguments.length;n++)for(var r in e=Object(arguments[n]))Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},pick:r,pick_pica_resize_options:function(t){return r(t,["alpha","unsharpAmount","unsharpRadius","unsharpThreshold","cancelToken"])}};function a(t){var e={exports:{}};return t(e,e.exports),e.exports}function o(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}var s=a((function(t,e){t.exports=function(){function t(e,n,r){function i(s,h){if(!n[s]){if(!e[s]){if(!h&&o)return o(s);if(a)return a(s,!0);var A=new Error("Cannot find module '"+s+"'");throw A.code="MODULE_NOT_FOUND",A}var u=n[s]={exports:{}};e[s][0].call(u.exports,(function(t){return i(e[s][1][t]||t)}),u,u.exports,t,e,n,r)}return n[s].exports}for(var a=o,s=0;s<r.length;s++)i(r[s]);return i}return t}()({1:[function(t,e,n){var r=t("inherits"),i=t("multimath"),a=t("./mm_unsharp_mask"),o=t("./mm_resize");function s(t){var e=t||[],n={js:e.indexOf("js")>=0,wasm:e.indexOf("wasm")>=0};i.call(this,n),this.features={js:n.js,wasm:n.wasm&&this.has_wasm()},this.use(a),this.use(o)}r(s,i),s.prototype.resizeAndUnsharp=function(t,e){var n=this.resize(t,e);return t.unsharpAmount&&this.unsharp_mask(n,t.toWidth,t.toHeight,t.unsharpAmount,t.unsharpRadius,t.unsharpThreshold),n},e.exports=s},{"./mm_resize":4,"./mm_unsharp_mask":9,inherits:19,multimath:20}],2:[function(t,e,n){function r(t){return t<0?0:t>255?255:t}function i(t,e,n,i,a,o){var s,h,A,u,l,f,c,d,g,_,p,m=0,w=0;for(g=0;g<i;g++){for(l=0,_=0;_<a;_++){for(f=o[l++],c=o[l++],d=m+4*f|0,s=h=A=u=0;c>0;c--)u=u+(p=o[l++])*t[d+3]|0,A=A+p*t[d+2]|0,h=h+p*t[d+1]|0,s=s+p*t[d]|0,d=d+4|0;e[w+3]=r(u+8192>>14),e[w+2]=r(A+8192>>14),e[w+1]=r(h+8192>>14),e[w]=r(s+8192>>14),w=w+4*i|0}w=4*(g+1)|0,m=(g+1)*n*4|0}}function a(t,e,n,i,a,o){var s,h,A,u,l,f,c,d,g,_,p,m=0,w=0;for(g=0;g<i;g++){for(l=0,_=0;_<a;_++){for(f=o[l++],c=o[l++],d=m+4*f|0,s=h=A=u=0;c>0;c--)u=u+(p=o[l++])*t[d+3]|0,A=A+p*t[d+2]|0,h=h+p*t[d+1]|0,s=s+p*t[d]|0,d=d+4|0;e[w+3]=r(u+8192>>14),e[w+2]=r(A+8192>>14),e[w+1]=r(h+8192>>14),e[w]=r(s+8192>>14),w=w+4*i|0}w=4*(g+1)|0,m=(g+1)*n*4|0}}e.exports={convolveHorizontally:i,convolveVertically:a}},{}],3:[function(t,e,n){e.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAEXA2AAAGAGf39/f39/AGAHf39/f39/fwACDwEDZW52Bm1lbW9yeQIAAAMEAwABAgYGAX8AQQALB1cFEV9fd2FzbV9jYWxsX2N0b3JzAAAIY29udm9sdmUAAQpjb252b2x2ZUhWAAIMX19kc29faGFuZGxlAwAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAAK7AMDAwABC8YDAQ9/AkAgA0UNACAERQ0AA0AgDCENQQAhE0EAIQcDQCAHQQJqIQYCfyAHQQF0IAVqIgcuAQIiFEUEQEGAwAAhCEGAwAAhCUGAwAAhCkGAwAAhCyAGDAELIBIgBy4BAGohCEEAIQsgFCEHQQAhDiAGIQlBACEPQQAhEANAIAUgCUEBdGouAQAiESAAIAhBAnRqKAIAIgpBGHZsIBBqIRAgCkH/AXEgEWwgC2ohCyAKQRB2Qf8BcSARbCAPaiEPIApBCHZB/wFxIBFsIA5qIQ4gCEEBaiEIIAlBAWohCSAHQQFrIgcNAAsgC0GAQGshCCAOQYBAayEJIA9BgEBrIQogEEGAQGshCyAGIBRqCyEHIAEgDUECdGogCUEOdSIGQf8BIAZB/wFIGyIGQQAgBkEAShtBCHRBgP4DcSAKQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EQdEGAgPwHcSALQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EYdHJyIAhBDnUiBkH/ASAGQf8BSBsiBkEAIAZBAEobcjYCACADIA1qIQ0gE0EBaiITIARHDQALIAxBAWoiDCACbCESIAMgDEcNAAsLCx4AQQAgAiADIAQgBSAAEAEgAkEAIAQgBSAGIAEQAQs="},{}],4:[function(t,e,n){e.exports={name:"resize",fn:t("./resize"),wasm_fn:t("./resize_wasm"),wasm_src:t("./convolve_wasm_base64")}},{"./convolve_wasm_base64":3,"./resize":5,"./resize_wasm":8}],5:[function(t,e,n){var r=t("./resize_filter_gen"),i=t("./convolve").convolveHorizontally,a=t("./convolve").convolveVertically;function o(t,e,n){for(var r=3,i=e*n*4|0;r<i;)t[r]=255,r=r+4|0}e.exports=function(t){var e=t.src,n=t.width,s=t.height,h=t.toWidth,A=t.toHeight,u=t.scaleX||t.toWidth/t.width,l=t.scaleY||t.toHeight/t.height,f=t.offsetX||0,c=t.offsetY||0,d=t.dest||new Uint8Array(h*A*4),g=void 0===t.quality?3:t.quality,_=t.alpha||!1,p=r(g,n,h,u,f),m=r(g,s,A,l,c),w=new Uint8Array(h*s*4);return i(e,w,n,s,h,p),a(w,d,s,h,A,m),_||o(d,h,A),d}},{"./convolve":2,"./resize_filter_gen":6}],6:[function(t,e,n){var r=t("./resize_filter_info"),i=14;function a(t){return Math.round(t*((1<<i)-1))}e.exports=function(t,e,n,i,o){var s,h,A,u,l,f,c,d,g,_,p,m,w,b,v,I,y,B=r[t].filter,E=1/i,C=Math.min(1,i),x=r[t].win/C,k=Math.floor(2*(x+1)),Q=new Int16Array((k+2)*n),D=0,M=!Q.subarray||!Q.set;for(s=0;s<n;s++){for(h=(s+.5)*E+o,A=Math.max(0,Math.floor(h-x)),l=(u=Math.min(e-1,Math.ceil(h+x)))-A+1,f=new Float32Array(l),c=new Int16Array(l),d=0,g=A,_=0;g<=u;g++,_++)d+=p=B((g+.5-h)*C),f[_]=p;for(m=0,_=0;_<f.length;_++)m+=w=f[_]/d,c[_]=a(w);for(c[n>>1]+=a(1-m),b=0;b<c.length&&0===c[b];)b++;if(b<c.length){for(v=c.length-1;v>0&&0===c[v];)v--;if(I=A+b,y=v-b+1,Q[D++]=I,Q[D++]=y,M)for(_=b;_<=v;_++)Q[D++]=c[_];else Q.set(c.subarray(b,v+1),D),D+=y}else Q[D++]=0,Q[D++]=0}return Q}},{"./resize_filter_info":7}],7:[function(t,e,n){e.exports=[{win:.5,filter:function(t){return t>=-.5&&t<.5?1:0}},{win:1,filter:function(t){if(t<=-1||t>=1)return 0;if(t>-1.1920929e-7&&t<1.1920929e-7)return 1;var e=t*Math.PI;return Math.sin(e)/e*(.54+.46*Math.cos(e/1))}},{win:2,filter:function(t){if(t<=-2||t>=2)return 0;if(t>-1.1920929e-7&&t<1.1920929e-7)return 1;var e=t*Math.PI;return Math.sin(e)/e*Math.sin(e/2)/(e/2)}},{win:3,filter:function(t){if(t<=-3||t>=3)return 0;if(t>-1.1920929e-7&&t<1.1920929e-7)return 1;var e=t*Math.PI;return Math.sin(e)/e*Math.sin(e/3)/(e/3)}}]},{}],8:[function(t,e,n){var r=t("./resize_filter_gen");function i(t,e,n){for(var r=3,i=e*n*4|0;r<i;)t[r]=255,r=r+4|0}function a(t){return new Uint8Array(t.buffer,0,t.byteLength)}var o=!0;try{o=1===new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0]}catch(t){}function s(t,e,n){if(o)e.set(a(t),n);else for(var r=n,i=0;i<t.length;i++){var s=t[i];e[r++]=255&s,e[r++]=s>>8&255}}e.exports=function(t){var e=t.src,n=t.width,a=t.height,o=t.toWidth,h=t.toHeight,A=t.scaleX||t.toWidth/t.width,u=t.scaleY||t.toHeight/t.height,l=t.offsetX||0,f=t.offsetY||0,c=t.dest||new Uint8Array(o*h*4),d=void 0===t.quality?3:t.quality,g=t.alpha||!1,_=r(d,n,o,A,l),p=r(d,a,h,u,f),m=0,w=this.__align(m+Math.max(e.byteLength,c.byteLength)),b=this.__align(w+a*o*4),v=this.__align(b+_.byteLength),I=v+p.byteLength,y=this.__instance("resize",I),B=new Uint8Array(this.__memory.buffer),E=new Uint32Array(this.__memory.buffer),C=new Uint32Array(e.buffer);return E.set(C),s(_,B,b),s(p,B,v),(y.exports.convolveHV||y.exports._convolveHV)(b,v,w,n,a,o,h),new Uint32Array(c.buffer).set(new Uint32Array(this.__memory.buffer,0,h*o)),g||i(c,o,h),c}},{"./resize_filter_gen":6}],9:[function(t,e,n){e.exports={name:"unsharp_mask",fn:t("./unsharp_mask"),wasm_fn:t("./unsharp_mask_wasm"),wasm_src:t("./unsharp_mask_wasm_base64")}},{"./unsharp_mask":10,"./unsharp_mask_wasm":11,"./unsharp_mask_wasm_base64":12}],10:[function(t,e,n){var r=t("glur/mono16");function i(t,e,n){for(var r,i,a,o,s=e*n,h=new Uint16Array(s),A=0;A<s;A++)r=t[4*A],i=t[4*A+1],a=t[4*A+2],o=r>=i&&r>=a?r:i>=a&&i>=r?i:a,h[A]=o<<8;return h}e.exports=function(t,e,n,a,o,s){var h,A,u,l,f;if(!(0===a||o<.5)){o>2&&(o=2);var c=i(t,e,n),d=new Uint16Array(c);r(d,e,n,o);for(var g=a/100*4096+.5|0,_=s<<8,p=e*n,m=0;m<p;m++)l=(h=c[m])-d[m],Math.abs(l)>=_&&(u=((A=(A=(A=h+(g*l+2048>>12))>65280?65280:A)<0?0:A)<<12)/(h=0!==h?h:1)|0,t[f=4*m]=t[f]*u+2048>>12,t[f+1]=t[f+1]*u+2048>>12,t[f+2]=t[f+2]*u+2048>>12)}}},{"glur/mono16":18}],11:[function(t,e,n){e.exports=function(t,e,n,r,i,a){if(!(0===r||i<.5)){i>2&&(i=2);var o=e*n,s=4*o,h=2*o,A=2*o,u=4*Math.max(e,n),l=32,f=0,c=s,d=c+h,g=d+A,_=g+A,p=_+u,m=this.__instance("unsharp_mask",s+h+2*A+u+l,{exp:Math.exp}),w=new Uint32Array(t.buffer);new Uint32Array(this.__memory.buffer).set(w);var b=m.exports.hsv_v16||m.exports._hsv_v16;b(f,c,e,n),(b=m.exports.blurMono16||m.exports._blurMono16)(c,d,g,_,p,e,n,i),(b=m.exports.unsharp||m.exports._unsharp)(f,f,c,d,e,n,r,a),w.set(new Uint32Array(this.__memory.buffer,0,o))}}},{}],12:[function(t,e,n){e.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAE0B2AAAGAEf39/fwBgBn9/f39/fwBgCH9/f39/f39/AGAIf39/f39/f30AYAJ9fwBgAXwBfAIZAgNlbnYDZXhwAAYDZW52Bm1lbW9yeQIAAAMHBgAFAgQBAwYGAX8AQQALB4oBCBFfX3dhc21fY2FsbF9jdG9ycwABFl9fYnVpbGRfZ2F1c3NpYW5fY29lZnMAAg5fX2dhdXNzMTZfbGluZQADCmJsdXJNb25vMTYABAdoc3ZfdjE2AAUHdW5zaGFycAAGDF9fZHNvX2hhbmRsZQMAGF9fd2FzbV9hcHBseV9kYXRhX3JlbG9jcwABCsUMBgMAAQvWAQEHfCABRNuGukOCGvs/IAC7oyICRAAAAAAAAADAohAAIgW2jDgCFCABIAKaEAAiAyADoCIGtjgCECABRAAAAAAAAPA/IAOhIgQgBKIgAyACIAKgokQAAAAAAADwP6AgBaGjIgS2OAIAIAEgBSAEmqIiB7Y4AgwgASADIAJEAAAAAAAA8D+gIASioiIItjgCCCABIAMgAkQAAAAAAADwv6AgBKKiIgK2OAIEIAEgByAIoCAFRAAAAAAAAPA/IAahoCIDo7Y4AhwgASAEIAKgIAOjtjgCGAuGBQMGfwl8An0gAyoCDCEVIAMqAgghFiADKgIUuyERIAMqAhC7IRACQCAEQQFrIghBAEgiCQRAIAIhByAAIQYMAQsgAiAALwEAuCIPIAMqAhi7oiIMIBGiIg0gDCAQoiAPIAMqAgS7IhOiIhQgAyoCALsiEiAPoqCgoCIOtjgCACACQQRqIQcgAEECaiEGIAhFDQAgCEEBIAhBAUgbIgpBf3MhCwJ/IAQgCmtBAXFFBEAgDiENIAgMAQsgAiANIA4gEKIgFCASIAAvAQK4Ig+ioKCgIg22OAIEIAJBCGohByAAQQRqIQYgDiEMIARBAmsLIQIgC0EAIARrRg0AA0AgByAMIBGiIA0gEKIgDyAToiASIAYvAQC4Ig6ioKCgIgy2OAIAIAcgDSARoiAMIBCiIA4gE6IgEiAGLwECuCIPoqCgoCINtjgCBCAHQQhqIQcgBkEEaiEGIAJBAkohACACQQJrIQIgAA0ACwsCQCAJDQAgASAFIAhsQQF0aiIAAn8gBkECay8BACICuCINIBW7IhKiIA0gFrsiE6KgIA0gAyoCHLuiIgwgEKKgIAwgEaKgIg8gB0EEayIHKgIAu6AiDkQAAAAAAADwQWMgDkQAAAAAAAAAAGZxBEAgDqsMAQtBAAs7AQAgCEUNACAGQQRrIQZBACAFa0EBdCEBA0ACfyANIBKiIAJB//8DcbgiDSAToqAgDyIOIBCioCAMIBGioCIPIAdBBGsiByoCALugIgxEAAAAAAAA8EFjIAxEAAAAAAAAAABmcQRAIAyrDAELQQALIQMgBi8BACECIAAgAWoiACADOwEAIAZBAmshBiAIQQFKIQMgDiEMIAhBAWshCCADDQALCwvRAgIBfwd8AkAgB0MAAAAAWw0AIARE24a6Q4Ia+z8gB0MAAAA/l7ujIglEAAAAAAAAAMCiEAAiDLaMOAIUIAQgCZoQACIKIAqgIg22OAIQIAREAAAAAAAA8D8gCqEiCyALoiAKIAkgCaCiRAAAAAAAAPA/oCAMoaMiC7Y4AgAgBCAMIAuaoiIOtjgCDCAEIAogCUQAAAAAAADwP6AgC6KiIg+2OAIIIAQgCiAJRAAAAAAAAPC/oCALoqIiCbY4AgQgBCAOIA+gIAxEAAAAAAAA8D8gDaGgIgqjtjgCHCAEIAsgCaAgCqO2OAIYIAYEQANAIAAgBSAIbEEBdGogAiAIQQF0aiADIAQgBSAGEAMgCEEBaiIIIAZHDQALCyAFRQ0AQQAhCANAIAIgBiAIbEEBdGogASAIQQF0aiADIAQgBiAFEAMgCEEBaiIIIAVHDQALCwtxAQN/IAIgA2wiBQRAA0AgASAAKAIAIgRBEHZB/wFxIgIgAiAEQQh2Qf8BcSIDIAMgBEH/AXEiBEkbIAIgA0sbIgYgBiAEIAIgBEsbIAMgBEsbQQh0OwEAIAFBAmohASAAQQRqIQAgBUEBayIFDQALCwuZAgIDfwF8IAQgBWwhBAJ/IAazQwAAgEWUQwAAyEKVu0QAAAAAAADgP6AiC5lEAAAAAAAA4EFjBEAgC6oMAQtBgICAgHgLIQUgBARAIAdBCHQhCUEAIQYDQCAJIAIgBkEBdCIHai8BACIBIAMgB2ovAQBrIgcgB0EfdSIIaiAIc00EQCAAIAZBAnQiCGoiCiAFIAdsQYAQakEMdSABaiIHQYD+AyAHQYD+A0gbIgdBACAHQQBKG0EMdCABQQEgARtuIgEgCi0AAGxBgBBqQQx2OgAAIAAgCEEBcmoiByABIActAABsQYAQakEMdjoAACAAIAhBAnJqIgcgASAHLQAAbEGAEGpBDHY6AAALIAZBAWoiBiAERw0ACwsL"},{}],13:[function(t,e,n){var r=100;function i(t,e){this.create=t,this.available=[],this.acquired={},this.lastId=1,this.timeoutId=0,this.idle=e||2e3}i.prototype.acquire=function(){var t,e=this;return 0!==this.available.length?t=this.available.pop():((t=this.create()).id=this.lastId++,t.release=function(){return e.release(t)}),this.acquired[t.id]=t,t},i.prototype.release=function(t){var e=this;delete this.acquired[t.id],t.lastUsed=Date.now(),this.available.push(t),0===this.timeoutId&&(this.timeoutId=setTimeout((function(){return e.gc()}),r))},i.prototype.gc=function(){var t=this,e=Date.now();this.available=this.available.filter((function(n){return!(e-n.lastUsed>t.idle&&(n.destroy(),1))})),0!==this.available.length?this.timeoutId=setTimeout((function(){return t.gc()}),r):this.timeoutId=0},e.exports=i},{}],14:[function(t,e,n){var r=2;e.exports=function(t,e,n,i,a,o){var s=n/t,h=i/e,A=(2*o+r+1)/a;if(A>.5)return[[n,i]];var u=Math.ceil(Math.log(Math.min(s,h))/Math.log(A));if(u<=1)return[[n,i]];for(var l=[],f=0;f<u;f++){var c=Math.round(Math.pow(Math.pow(t,u-f-1)*Math.pow(n,f+1),1/u)),d=Math.round(Math.pow(Math.pow(e,u-f-1)*Math.pow(i,f+1),1/u));l.push([c,d])}return l}},{}],15:[function(t,e,n){var r=1e-5;function i(t){var e=Math.round(t);return Math.abs(t-e)<r?e:Math.floor(t)}function a(t){var e=Math.round(t);return Math.abs(t-e)<r?e:Math.ceil(t)}e.exports=function(t){var e,n,r,o,s,h,A=t.toWidth/t.width,u=t.toHeight/t.height,l=i(t.srcTileSize*A)-2*t.destTileBorder,f=i(t.srcTileSize*u)-2*t.destTileBorder;if(l<1||f<1)throw new Error("Internal error in pica: target tile width/height is too small.");var c,d=[];for(o=0;o<t.toHeight;o+=f)for(r=0;r<t.toWidth;r+=l)(e=r-t.destTileBorder)<0&&(e=0),e+(s=r+l+t.destTileBorder-e)>=t.toWidth&&(s=t.toWidth-e),(n=o-t.destTileBorder)<0&&(n=0),n+(h=o+f+t.destTileBorder-n)>=t.toHeight&&(h=t.toHeight-n),c={toX:e,toY:n,toWidth:s,toHeight:h,toInnerX:r,toInnerY:o,toInnerWidth:l,toInnerHeight:f,offsetX:e/A-i(e/A),offsetY:n/u-i(n/u),scaleX:A,scaleY:u,x:i(e/A),y:i(n/u),width:a(s/A),height:a(h/u)},d.push(c);return d}},{}],16:[function(t,e,n){function r(t){return Object.prototype.toString.call(t)}e.exports.isCanvas=function(t){var e=r(t);return"[object HTMLCanvasElement]"===e||"[object OffscreenCanvas]"===e||"[object Canvas]"===e},e.exports.isImage=function(t){return"[object HTMLImageElement]"===r(t)},e.exports.isImageBitmap=function(t){return"[object ImageBitmap]"===r(t)},e.exports.limiter=function(t){var e=0,n=[];function r(){e<t&&n.length&&(e++,n.shift()())}return function(t){return new Promise((function(i,a){n.push((function(){t().then((function(t){i(t),e--,r()}),(function(t){a(t),e--,r()}))})),r()}))}},e.exports.cib_quality_name=function(t){switch(t){case 0:return"pixelated";case 1:return"low";case 2:return"medium"}return"high"},e.exports.cib_support=function(t){return Promise.resolve().then((function(){if("undefined"==typeof createImageBitmap)return!1;var e=t(100,100);return createImageBitmap(e,0,0,100,100,{resizeWidth:10,resizeHeight:10,resizeQuality:"high"}).then((function(t){var n=10===t.width;return t.close(),e=null,n}))})).catch((function(){return!1}))},e.exports.worker_offscreen_canvas_support=function(){return new Promise((function(t,e){if("undefined"!=typeof OffscreenCanvas){var n=btoa("(".concat(i.toString(),")(self);")),r=new Worker("data:text/javascript;base64,".concat(n));r.onmessage=function(e){return t(e.data)},r.onerror=e}else t(!1);function i(t){"undefined"!=typeof createImageBitmap?Promise.resolve().then((function(){var t=new OffscreenCanvas(10,10);return t.getContext("2d").rect(0,0,1,1),createImageBitmap(t,0,0,1,1)})).then((function(){return t.postMessage(!0)}),(function(){return t.postMessage(!1)})):t.postMessage(!1)}})).then((function(t){return t}),(function(){return!1}))},e.exports.can_use_canvas=function(t){var e=!1;try{var n=t(2,1).getContext("2d"),r=n.createImageData(2,1);r.data[0]=12,r.data[1]=23,r.data[2]=34,r.data[3]=255,r.data[4]=45,r.data[5]=56,r.data[6]=67,r.data[7]=255,n.putImageData(r,0,0),r=null,12===(r=n.getImageData(0,0,2,1)).data[0]&&23===r.data[1]&&34===r.data[2]&&255===r.data[3]&&45===r.data[4]&&56===r.data[5]&&67===r.data[6]&&255===r.data[7]&&(e=!0)}catch(t){}return e},e.exports.cib_can_use_region=function(){return new Promise((function(t){if("undefined"!=typeof createImageBitmap){var e=new Image;e.src="data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z",e.onload=function(){createImageBitmap(e,0,0,e.width,e.height).then((function(n){n.width===e.width&&n.height===e.height?t(!0):t(!1)}),(function(){return t(!1)}))},e.onerror=function(){return t(!1)}}else t(!1)}))}},{}],17:[function(t,e,n){e.exports=function(){var e,n=t("./mathlib");onmessage=function(t){var r=t.data.opts,i=!1;if(!r.src&&r.srcBitmap){var a=new OffscreenCanvas(r.width,r.height),o=a.getContext("2d",{alpha:Boolean(r.alpha)});o.drawImage(r.srcBitmap,0,0),r.src=o.getImageData(0,0,r.width,r.height).data,a.width=a.height=0,a=null,r.srcBitmap.close(),r.srcBitmap=null,i=!0}e||(e=new n(t.data.features));var s=e.resizeAndUnsharp(r);if(i){var h=new ImageData(new Uint8ClampedArray(s),r.toWidth,r.toHeight),A=new OffscreenCanvas(r.toWidth,r.toHeight);A.getContext("2d",{alpha:Boolean(r.alpha)}).putImageData(h,0,0),createImageBitmap(A).then((function(t){postMessage({bitmap:t},[t])}))}else postMessage({data:s},[s.buffer])}}},{"./mathlib":1}],18:[function(t,e,n){var r,i,a,o,s,h;function A(t){t<.5&&(t=.5);var e=Math.exp(.527076)/t,n=Math.exp(-e),A=Math.exp(-2*e),u=(1-n)*(1-n)/(1+2*e*n-A);return r=u,i=u*(e-1)*n,a=u*(e+1)*n,o=-u*A,s=2*n,h=-A,new Float32Array([r,i,a,o,s,h,(r+i)/(1-s-h),(a+o)/(1-s-h)])}function u(t,e,n,r,i,a){var o,s,h,A,u,l,f,c,d,g,_,p,m,w;for(d=0;d<a;d++){for(f=d,c=0,A=u=(o=t[l=d*i])*r[6],_=r[0],p=r[1],m=r[4],w=r[5],g=0;g<i;g++)h=(s=t[l])*_+o*p+A*m+u*w,u=A,A=h,o=s,n[c]=A,c++,l++;for(c--,f+=a*(i-1),A=u=(o=t[--l])*r[7],s=o,_=r[2],p=r[3],g=i-1;g>=0;g--)h=s*_+o*p+A*m+u*w,u=A,A=h,o=s,s=t[l],e[f]=n[c]+A,l--,c--,f-=a}}function l(t,e,n,r){if(r){var i=new Uint16Array(t.length),a=new Float32Array(Math.max(e,n)),o=A(r);u(t,i,a,o,e,n),u(i,t,a,o,n,e)}}e.exports=l},{}],19:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},{}],20:[function(t,e,n){var r=t("object-assign"),i=t("./lib/base64decode"),a=t("./lib/wa_detect"),o={js:!0,wasm:!0};function s(t){if(!(this instanceof s))return new s(t);var e=r({},o,t||{});if(this.options=e,this.__cache={},this.__init_promise=null,this.__modules=e.modules||{},this.__memory=null,this.__wasm={},this.__isLE=1===new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0],!this.options.js&&!this.options.wasm)throw new Error('mathlib: at least "js" or "wasm" should be enabled')}s.prototype.has_wasm=a,s.prototype.use=function(t){return this.__modules[t.name]=t,this.options.wasm&&this.has_wasm()&&t.wasm_fn?this[t.name]=t.wasm_fn:this[t.name]=t.fn,this},s.prototype.init=function(){if(this.__init_promise)return this.__init_promise;if(!this.options.js&&this.options.wasm&&!this.has_wasm())return Promise.reject(new Error('mathlib: only "wasm" was enabled, but it\'s not supported'));var t=this;return this.__init_promise=Promise.all(Object.keys(t.__modules).map((function(e){var n=t.__modules[e];return t.options.wasm&&t.has_wasm()&&n.wasm_fn?t.__wasm[e]?null:WebAssembly.compile(t.__base64decode(n.wasm_src)).then((function(n){t.__wasm[e]=n})):null}))).then((function(){return t})),this.__init_promise},s.prototype.__base64decode=i,s.prototype.__reallocate=function(t){if(!this.__memory)return this.__memory=new WebAssembly.Memory({initial:Math.ceil(t/65536)}),this.__memory;var e=this.__memory.buffer.byteLength;return e<t&&this.__memory.grow(Math.ceil((t-e)/65536)),this.__memory},s.prototype.__instance=function(t,e,n){if(e&&this.__reallocate(e),!this.__wasm[t]){var i=this.__modules[t];this.__wasm[t]=new WebAssembly.Module(this.__base64decode(i.wasm_src))}if(!this.__cache[t]){var a={memoryBase:0,memory:this.__memory,tableBase:0,table:new WebAssembly.Table({initial:0,element:"anyfunc"})};this.__cache[t]=new WebAssembly.Instance(this.__wasm[t],{env:r(a,n||{})})}return this.__cache[t]},s.prototype.__align=function(t,e){var n=t%(e=e||8);return t+(n?e-n:0)},e.exports=s},{"./lib/base64decode":21,"./lib/wa_detect":22,"object-assign":23}],21:[function(t,e,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";e.exports=function(t){for(var e=t.replace(/[\r\n=]/g,""),n=e.length,i=new Uint8Array(3*n>>2),a=0,o=0,s=0;s<n;s++)s%4==0&&s&&(i[o++]=a>>16&255,i[o++]=a>>8&255,i[o++]=255&a),a=a<<6|r.indexOf(e.charAt(s));var h=n%4*6;return 0===h?(i[o++]=a>>16&255,i[o++]=a>>8&255,i[o++]=255&a):18===h?(i[o++]=a>>10&255,i[o++]=a>>2&255):12===h&&(i[o++]=a>>4&255),i}},{}],22:[function(t,e,n){var r;e.exports=function(){if(void 0!==r)return r;if(r=!1,"undefined"==typeof WebAssembly)return r;try{var t=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),e=new WebAssembly.Module(t);return 0!==new WebAssembly.Instance(e,{}).exports.test(4)&&(r=!0),r}catch(t){}return r}},{}],23:[function(t,e,n){var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function s(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}e.exports=s()?Object.assign:function(t,e){for(var n,s,h=o(t),A=1;A<arguments.length;A++){for(var u in n=Object(arguments[A]))i.call(n,u)&&(h[u]=n[u]);if(r){s=r(n);for(var l=0;l<s.length;l++)a.call(n,s[l])&&(h[s[l]]=n[s[l]])}}return h}},{}],24:[function(t,e,n){var r=arguments[3],i=arguments[4],a=arguments[5],o=JSON.stringify;e.exports=function(t,e){for(var n,s=Object.keys(a),h=0,A=s.length;h<A;h++){var u=s[h],l=a[u].exports;if(l===t||l&&l.default===t){n=u;break}}if(!n){n=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var f={};for(h=0,A=s.length;h<A;h++)f[u=s[h]]=u;i[n]=["function(require,module,exports){"+t+"(self); }",f]}var c=Math.floor(Math.pow(16,8)*Math.random()).toString(16),d={};d[n]=n,i[c]=["function(require,module,exports){var f = require("+o(n)+");(f.default ? f.default : f)(self);}",d];var g={};function _(t){for(var e in g[t]=!0,i[t][1]){var n=i[t][1][e];g[n]||_(n)}}_(c);var p="("+r+")({"+Object.keys(g).map((function(t){return o(t)+":["+i[t][0]+","+o(i[t][1])+"]"})).join(",")+"},{},["+o(c)+"])",m=window.URL||window.webkitURL||window.mozURL||window.msURL,w=new Blob([p],{type:"text/javascript"});if(e&&e.bare)return w;var b=m.createObjectURL(w),v=new Worker(b);return v.objectURL=b,v}},{}],"/index.js":[function(t,e,n){function r(t,e){return h(t)||s(t,e)||a(t,e)||i()}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}function h(t){if(Array.isArray(t))return t}var A=t("object-assign"),u=t("webworkify"),l=t("./lib/mathlib"),f=t("./lib/pool"),c=t("./lib/utils"),d=t("./lib/worker"),g=t("./lib/stepper"),_=t("./lib/tiler"),p={},m=!1;try{"undefined"!=typeof navigator&&navigator.userAgent&&(m=navigator.userAgent.indexOf("Safari")>=0)}catch(t){}var w=1;"undefined"!=typeof navigator&&(w=Math.min(navigator.hardwareConcurrency||1,4));var b={tile:1024,concurrency:w,features:["js","wasm","ww"],idle:2e3,createCanvas:function(t,e){var n=document.createElement("canvas");return n.width=t,n.height=e,n}},v={quality:3,alpha:!1,unsharpAmount:0,unsharpRadius:0,unsharpThreshold:0},I=!1,y=!1,B=!1,E=!1,C=!1;function x(){return{value:u(d),destroy:function(){if(this.value.terminate(),"undefined"!=typeof window){var t=window.URL||window.webkitURL||window.mozURL||window.msURL;t&&t.revokeObjectURL&&this.value.objectURL&&t.revokeObjectURL(this.value.objectURL)}}}}function k(t){if(!(this instanceof k))return new k(t);this.options=A({},b,t||{});var e="lk_".concat(this.options.concurrency);this.__limit=p[e]||c.limiter(this.options.concurrency),p[e]||(p[e]=this.__limit),this.features={js:!1,wasm:!1,cib:!1,ww:!1},this.__workersPool=null,this.__requested_features=[],this.__mathlib=null}k.prototype.init=function(){var e=this;if(this.__initPromise)return this.__initPromise;if("undefined"!=typeof ImageData&&"undefined"!=typeof Uint8ClampedArray)try{new ImageData(new Uint8ClampedArray(400),10,10),I=!0}catch(t){}"undefined"!=typeof ImageBitmap&&(ImageBitmap.prototype&&ImageBitmap.prototype.close?y=!0:this.debug("ImageBitmap does not support .close(), disabled"));var n=this.options.features.slice();if(n.indexOf("all")>=0&&(n=["cib","wasm","js","ww"]),this.__requested_features=n,this.__mathlib=new l(n),n.indexOf("ww")>=0&&"undefined"!=typeof window&&"Worker"in window)try{t("webworkify")((function(){})).terminate(),this.features.ww=!0;var r="wp_".concat(JSON.stringify(this.options));p[r]?this.__workersPool=p[r]:(this.__workersPool=new f(x,this.options.idle),p[r]=this.__workersPool)}catch(t){}var i,a,o=this.__mathlib.init().then((function(t){A(e.features,t.features)}));i=y?c.cib_support(this.options.createCanvas).then((function(t){e.features.cib&&n.indexOf("cib")<0?e.debug("createImageBitmap() resize supported, but disabled by config"):n.indexOf("cib")>=0&&(e.features.cib=t)})):Promise.resolve(!1),B=c.can_use_canvas(this.options.createCanvas),a=(a=y&&I&&-1!==n.indexOf("ww")?c.worker_offscreen_canvas_support():Promise.resolve(!1)).then((function(t){E=t}));var s=c.cib_can_use_region().then((function(t){C=t}));return this.__initPromise=Promise.all([o,i,a,s]).then((function(){return e})),this.__initPromise},k.prototype.__invokeResize=function(t,e){var n=this;return e.__mathCache=e.__mathCache||{},Promise.resolve().then((function(){return n.features.ww?new Promise((function(r,i){var a=n.__workersPool.acquire();e.cancelToken&&e.cancelToken.catch((function(t){return i(t)})),a.value.onmessage=function(t){a.release(),t.data.err?i(t.data.err):r(t.data)};var o=[];t.src&&o.push(t.src.buffer),t.srcBitmap&&o.push(t.srcBitmap),a.value.postMessage({opts:t,features:n.__requested_features,preload:{wasm_nodule:n.__mathlib.__}},o)})):{data:n.__mathlib.resizeAndUnsharp(t,e.__mathCache)}}))},k.prototype.__extractTileData=function(t,e,n,r,i){if(this.features.ww&&E&&(c.isCanvas(e)||C))return this.debug("Create tile for OffscreenCanvas"),createImageBitmap(r.srcImageBitmap||e,t.x,t.y,t.width,t.height).then((function(t){return i.srcBitmap=t,i}));if(c.isCanvas(e))return r.srcCtx||(r.srcCtx=e.getContext("2d",{alpha:Boolean(n.alpha)})),this.debug("Get tile pixel data"),i.src=r.srcCtx.getImageData(t.x,t.y,t.width,t.height).data,i;this.debug("Draw tile imageBitmap/image to temporary canvas");var a=this.options.createCanvas(t.width,t.height),o=a.getContext("2d",{alpha:Boolean(n.alpha)});return o.globalCompositeOperation="copy",o.drawImage(r.srcImageBitmap||e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),this.debug("Get tile pixel data"),i.src=o.getImageData(0,0,t.width,t.height).data,a.width=a.height=0,i},k.prototype.__landTileData=function(t,e,n){var r;if(this.debug("Convert raw rgba tile result to ImageData"),e.bitmap)return n.toCtx.drawImage(e.bitmap,t.toX,t.toY),null;if(I)r=new ImageData(new Uint8ClampedArray(e.data),t.toWidth,t.toHeight);else if((r=n.toCtx.createImageData(t.toWidth,t.toHeight)).data.set)r.data.set(e.data);else for(var i=r.data.length-1;i>=0;i--)r.data[i]=e.data[i];return this.debug("Draw tile"),m?n.toCtx.putImageData(r,t.toX,t.toY,t.toInnerX-t.toX,t.toInnerY-t.toY,t.toInnerWidth+1e-5,t.toInnerHeight+1e-5):n.toCtx.putImageData(r,t.toX,t.toY,t.toInnerX-t.toX,t.toInnerY-t.toY,t.toInnerWidth,t.toInnerHeight),null},k.prototype.__tileAndResize=function(t,e,n){var r=this,i={srcCtx:null,srcImageBitmap:null,isImageBitmapReused:!1,toCtx:null},a=function(e){return r.__limit((function(){if(n.canceled)return n.cancelToken;var a={width:e.width,height:e.height,toWidth:e.toWidth,toHeight:e.toHeight,scaleX:e.scaleX,scaleY:e.scaleY,offsetX:e.offsetX,offsetY:e.offsetY,quality:n.quality,alpha:n.alpha,unsharpAmount:n.unsharpAmount,unsharpRadius:n.unsharpRadius,unsharpThreshold:n.unsharpThreshold};return r.debug("Invoke resize math"),Promise.resolve(a).then((function(a){return r.__extractTileData(e,t,n,i,a)})).then((function(t){return r.debug("Invoke resize math"),r.__invokeResize(t,n)})).then((function(t){return n.canceled?n.cancelToken:(i.srcImageData=null,r.__landTileData(e,t,i))}))}))};return Promise.resolve().then((function(){if(i.toCtx=e.getContext("2d",{alpha:Boolean(n.alpha)}),c.isCanvas(t))return null;if(c.isImageBitmap(t))return i.srcImageBitmap=t,i.isImageBitmapReused=!0,null;if(c.isImage(t))return y?(r.debug("Decode image via createImageBitmap"),createImageBitmap(t).then((function(t){i.srcImageBitmap=t})).catch((function(t){return null}))):null;throw new Error('Pica: ".from" should be Image, Canvas or ImageBitmap')})).then((function(){if(n.canceled)return n.cancelToken;r.debug("Calculate tiles");var t=_({width:n.width,height:n.height,srcTileSize:r.options.tile,toWidth:n.toWidth,toHeight:n.toHeight,destTileBorder:n.__destTileBorder}).map((function(t){return a(t)}));function o(t){t.srcImageBitmap&&(t.isImageBitmapReused||t.srcImageBitmap.close(),t.srcImageBitmap=null)}return r.debug("Process tiles"),Promise.all(t).then((function(){return r.debug("Finished!"),o(i),e}),(function(t){throw o(i),t}))}))},k.prototype.__processStages=function(t,e,n,i){var a=this;if(i.canceled)return i.cancelToken;var o,s=r(t.shift(),2),h=s[0],u=s[1],l=0===t.length;return i=A({},i,{toWidth:h,toHeight:u,quality:l?i.quality:Math.min(1,i.quality)}),l||(o=this.options.createCanvas(h,u)),this.__tileAndResize(e,l?n:o,i).then((function(){return l?n:(i.width=h,i.height=u,a.__processStages(t,o,n,i))})).then((function(t){return o&&(o.width=o.height=0),t}))},k.prototype.__resizeViaCreateImageBitmap=function(t,e,n){var r=this,i=e.getContext("2d",{alpha:Boolean(n.alpha)});return this.debug("Resize via createImageBitmap()"),createImageBitmap(t,{resizeWidth:n.toWidth,resizeHeight:n.toHeight,resizeQuality:c.cib_quality_name(n.quality)}).then((function(t){if(n.canceled)return n.cancelToken;if(!n.unsharpAmount)return i.drawImage(t,0,0),t.close(),i=null,r.debug("Finished!"),e;r.debug("Unsharp result");var a=r.options.createCanvas(n.toWidth,n.toHeight),o=a.getContext("2d",{alpha:Boolean(n.alpha)});o.drawImage(t,0,0),t.close();var s=o.getImageData(0,0,n.toWidth,n.toHeight);return r.__mathlib.unsharp_mask(s.data,n.toWidth,n.toHeight,n.unsharpAmount,n.unsharpRadius,n.unsharpThreshold),i.putImageData(s,0,0),a.width=a.height=0,s=o=a=i=null,r.debug("Finished!"),e}))},k.prototype.resize=function(t,e,n){var r=this;this.debug("Start resize...");var i=A({},v);if(isNaN(n)?n&&(i=A(i,n)):i=A(i,{quality:n}),i.toWidth=e.width,i.toHeight=e.height,i.width=t.naturalWidth||t.width,i.height=t.naturalHeight||t.height,0===e.width||0===e.height)return Promise.reject(new Error("Invalid output size: ".concat(e.width,"x").concat(e.height)));i.unsharpRadius>2&&(i.unsharpRadius=2),i.canceled=!1,i.cancelToken&&(i.cancelToken=i.cancelToken.then((function(t){throw i.canceled=!0,t}),(function(t){throw i.canceled=!0,t})));var a=3;return i.__destTileBorder=Math.ceil(Math.max(a,2.5*i.unsharpRadius|0)),this.init().then((function(){if(i.canceled)return i.cancelToken;if(r.features.cib)return r.__resizeViaCreateImageBitmap(t,e,i);if(!B){var n=new Error("Pica: cannot use getImageData on canvas, make sure fingerprinting protection isn't enabled");throw n.code="ERR_GET_IMAGE_DATA",n}var a=g(i.width,i.height,i.toWidth,i.toHeight,r.options.tile,i.__destTileBorder);return r.__processStages(a,t,e,i)}))},k.prototype.resizeBuffer=function(t){var e=this,n=A({},v,t);return this.init().then((function(){return e.__mathlib.resizeAndUnsharp(n)}))},k.prototype.toBlob=function(t,e,n){return e=e||"image/png",new Promise((function(r){if(t.toBlob)t.toBlob((function(t){return r(t)}),e,n);else if(t.convertToBlob)r(t.convertToBlob({type:e,quality:n}));else{for(var i=atob(t.toDataURL(e,n).split(",")[1]),a=i.length,o=new Uint8Array(a),s=0;s<a;s++)o[s]=i.charCodeAt(s);r(new Blob([o],{type:e}))}}))},k.prototype.debug=function(){},e.exports=k},{"./lib/mathlib":1,"./lib/pool":13,"./lib/stepper":14,"./lib/tiler":15,"./lib/utils":16,"./lib/worker":17,"object-assign":23,webworkify:24}]},{},[])("/index.js")})),h=a((function(t){function e(t,e){var n=new Error(t);return n.code=e,n}function n(t){for(var e=t.toString(16).toUpperCase(),n=2-e.length;n>0;n--)e="0"+e;return"0x"+e}function r(t){try{return decodeURIComponent(escape(t))}catch(e){return t}}function i(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function a(t,n,r){this.input=t.subarray(n,r),this.start=n;var i=String.fromCharCode.apply(null,this.input.subarray(0,4));if("II*\0"!==i&&"MM\0*"!==i)throw e("invalid TIFF signature","EBADDATA");this.big_endian="M"===i[0]}a.prototype.each=function(t){this.aborted=!1;var e=this.read_uint32(4);for(this.ifds_to_read=[{id:0,offset:e}];this.ifds_to_read.length>0&&!this.aborted;){var n=this.ifds_to_read.shift();n.offset&&this.scan_ifd(n.id,n.offset,t)}},a.prototype.filter=function(t){var n={ifd0:{id:0,entries:[]}};this.each((function(e){(!1!==t(e)||e.is_subifd_link)&&(e.is_subifd_link&&1!==e.count&&4!==e.format||(n["ifd"+e.ifd]||(n["ifd"+e.ifd]={id:e.ifd,entries:[]}),n["ifd"+e.ifd].entries.push(e)))})),delete n.ifd1;var r=8;Object.keys(n).forEach((function(t){r+=2,n[t].entries.forEach((function(t){r+=12+(t.data_length>4?2*Math.ceil(t.data_length/2):0)})),r+=4})),this.output=new Uint8Array(r),this.output[0]=this.output[1]=(this.big_endian?"M":"I").charCodeAt(0),this.write_uint16(2,42);var i=8,a=this;if(this.write_uint32(4,i),Object.keys(n).forEach((function(t){n[t].written_offset=i;var e=i,r=e+2+12*n[t].entries.length+4;i=r,a.write_uint16(e,n[t].entries.length),n[t].entries.sort((function(t,e){return t.tag-e.tag})).forEach((function(t,r){var o=e+2+12*r;a.write_uint16(o,t.tag),a.write_uint16(o+2,t.format),a.write_uint32(o+4,t.count),t.is_subifd_link?n["ifd"+t.tag]&&(n["ifd"+t.tag].link_offset=o+8):t.data_length<=4?a.output.set(a.input.subarray(t.data_offset-a.start,t.data_offset-a.start+4),o+8):(a.write_uint32(o+8,i),a.output.set(a.input.subarray(t.data_offset-a.start,t.data_offset-a.start+t.data_length),i),i+=2*Math.ceil(t.data_length/2))}));var o=n["ifd"+(n[t].id+1)];o&&(o.link_offset=r-4)})),Object.keys(n).forEach((function(t){n[t].written_offset&&n[t].link_offset&&a.write_uint32(n[t].link_offset,n[t].written_offset)})),this.output.length!==i)throw e("internal error: incorrect buffer size allocated");return this.output},a.prototype.read_uint16=function(t){var n=this.input;if(t+2>n.length)throw e("unexpected EOF","EBADDATA");return this.big_endian?256*n[t]+n[t+1]:n[t]+256*n[t+1]},a.prototype.read_uint32=function(t){var n=this.input;if(t+4>n.length)throw e("unexpected EOF","EBADDATA");return this.big_endian?16777216*n[t]+65536*n[t+1]+256*n[t+2]+n[t+3]:n[t]+256*n[t+1]+65536*n[t+2]+16777216*n[t+3]},a.prototype.write_uint16=function(t,e){var n=this.output;this.big_endian?(n[t]=e>>>8&255,n[t+1]=255&e):(n[t]=255&e,n[t+1]=e>>>8&255)},a.prototype.write_uint32=function(t,e){var n=this.output;this.big_endian?(n[t]=e>>>24&255,n[t+1]=e>>>16&255,n[t+2]=e>>>8&255,n[t+3]=255&e):(n[t]=255&e,n[t+1]=e>>>8&255,n[t+2]=e>>>16&255,n[t+3]=e>>>24&255)},a.prototype.is_subifd_link=function(t,e){return 0===t&&34665===e||0===t&&34853===e||34665===t&&40965===e},a.prototype.exif_format_length=function(t){switch(t){case 1:case 2:case 6:case 7:return 1;case 3:case 8:return 2;case 4:case 9:case 11:return 4;case 5:case 10:case 12:return 8;default:return 0}},a.prototype.exif_format_read=function(t,e){var n;switch(t){case 1:case 2:return n=this.input[e];case 6:return(n=this.input[e])|33554430*(128&n);case 3:return n=this.read_uint16(e);case 8:return(n=this.read_uint16(e))|131070*(32768&n);case 4:return n=this.read_uint32(e);case 9:return 0|(n=this.read_uint32(e));case 5:case 10:case 11:case 12:case 7:default:return null}},a.prototype.scan_ifd=function(t,n,i){var a=this.read_uint16(n);n+=2;for(var o=0;o<a;o++){var s=this.read_uint16(n),h=this.read_uint16(n+2),A=this.read_uint32(n+4),u=this.exif_format_length(h),l=A*u,f=l<=4?n+8:this.read_uint32(n+8),c=!1;if(f+l>this.input.length)throw e("unexpected EOF","EBADDATA");for(var d=[],g=f,_=0;_<A;_++,g+=u){var p=this.exif_format_read(h,g);if(null===p){d=null;break}d.push(p)}if(Array.isArray(d)&&2===h){try{d=r(String.fromCharCode.apply(null,d))}catch(t){d=null}d&&"\0"===d[d.length-1]&&(d=d.slice(0,-1))}if(this.is_subifd_link(t,s)&&Array.isArray(d)&&Number.isInteger(d[0])&&d[0]>0&&(this.ifds_to_read.push({id:s,offset:d[0]}),c=!0),!1===i({is_big_endian:this.big_endian,ifd:t,tag:s,format:h,count:A,entry_offset:n+this.start,data_length:l,data_offset:f+this.start,value:d,is_subifd_link:c}))return void(this.aborted=!0);n+=12}0===t&&this.ifds_to_read.push({id:1,offset:this.read_uint32(n)})},t.exports.is_jpeg=function(t){return t.length>=4&&255===t[0]&&216===t[1]&&255===t[2]},t.exports.jpeg_segments_each=function(r,a){if(!i(r))throw e("Invalid argument (jpeg_bin), Uint8Array expected","EINVAL");if("function"!=typeof a)throw e("Invalid argument (on_segment), Function expected","EINVAL");if(!t.exports.is_jpeg(r))throw e("Unknown file format","ENOTJPEG");for(var o=0,s=r.length,h=!1;;){var A,u;if(o+1>=s)throw e("Unexpected EOF","EBADDATA");var l=r[o],f=r[o+1];if(255===l&&255===f)A=255,u=1;else if(255===l&&0!==f){if(u=2,208<=(A=f)&&A<=217||1===A);else{if(o+3>=s)throw e("Unexpected EOF","EBADDATA");if((u+=256*r[o+2]+r[o+3])<2)throw e("Invalid segment length","EBADDATA");if(o+u-1>=s)throw e("Unexpected EOF","EBADDATA")}h&&(A>=208&&A<=215||(h=!1)),218===A&&(h=!0)}else{if(!h)throw e("Unexpected byte at segment start: "+n(l)+" (offset "+n(o)+")","EBADDATA");for(var c=o+1;;c++){if(c>=s)throw e("Unexpected EOF","EBADDATA");if(255===r[c]){if(c+1>=s)throw e("Unexpected EOF","EBADDATA");if(0!==r[c+1]){A=0,u=c-o;break}}}}if(!1===a({code:A,offset:o,length:u}))break;if(217===A)break;o+=u}},t.exports.jpeg_segments_filter=function(n,r){if(!i(n))throw e("Invalid argument (jpeg_bin), Uint8Array expected","EINVAL");if("function"!=typeof r)throw e("Invalid argument (on_segment), Function expected","EINVAL");var a=[],o=0;t.exports.jpeg_segments_each(n,(function(t){var e=r(t);if(i(e))a.push({data:e}),o+=e.length;else if(Array.isArray(e))e.filter(i).forEach((function(t){a.push({data:t}),o+=t.length}));else if(!1!==e){var n={start:t.offset,end:t.offset+t.length};a.length>0&&a[a.length-1].end===n.start?a[a.length-1].end=n.end:a.push(n),o+=t.length}}));var s=new Uint8Array(o),h=0;return a.forEach((function(t){var e=t.data||n.subarray(t.start,t.end);s.set(e,h),h+=e.length})),s},t.exports.jpeg_exif_tags_each=function(n,r){if(!i(n))throw e("Invalid argument (jpeg_bin), Uint8Array expected","EINVAL");if("function"!=typeof r)throw e("Invalid argument (on_exif_entry), Function expected","EINVAL");t.exports.jpeg_segments_each(n,(function(t){return 218!==t.code&&(225===t.code&&t.length>=10&&69===n[t.offset+4]&&120===n[t.offset+5]&&105===n[t.offset+6]&&102===n[t.offset+7]&&0===n[t.offset+8]&&0===n[t.offset+9]?(new a(n,t.offset+10,t.offset+t.length).each(r),!1):void 0)}))},t.exports.jpeg_exif_tags_filter=function(n,r){if(!i(n))throw e("Invalid argument (jpeg_bin), Uint8Array expected","EINVAL");if("function"!=typeof r)throw e("Invalid argument (on_exif_entry), Function expected","EINVAL");var o=!1;return t.exports.jpeg_segments_filter(n,(function(t){if(!o&&(218===t.code&&(o=!0),225===t.code&&t.length>=10&&69===n[t.offset+4]&&120===n[t.offset+5]&&105===n[t.offset+6]&&102===n[t.offset+7]&&0===n[t.offset+8]&&0===n[t.offset+9])){var e=new a(n,t.offset+10,t.offset+t.length).filter(r);if(!e)return!1;var i=new Uint8Array(10);return i.set(n.slice(t.offset,t.offset+10)),i[2]=e.length+8>>>8&255,i[3]=e.length+8&255,o=!0,[i,e]}}))},t.exports.jpeg_add_comment=function(e,n){var r=!1,i=0;return t.exports.jpeg_segments_filter(e,(function(t){if(!(1===++i&&216===t.code||2===i&&224===t.code||r)){n=function(t){try{return unescape(encodeURIComponent(t))}catch(e){return t}}(n);var a=new Uint8Array(5+n.length),o=0;return a[o++]=255,a[o++]=254,a[o++]=n.length+3>>>8&255,a[o++]=n.length+3&255,n.split("").forEach((function(t){a[o++]=255&t.charCodeAt(0)})),a[o++]=0,r=!0,[a,e.subarray(t.offset,t.offset+t.length)]}}))}}));function A(t){return this._getUint8Array(t.blob).then((function(e){if(t.is_jpeg=h.is_jpeg(e),!t.is_jpeg)return Promise.resolve(t);t.orig_blob=t.blob;try{var n,r;if(h.jpeg_exif_tags_each(e,(function(e){if(0===e.ifd&&274===e.tag&&Array.isArray(e.value))return t.orientation=e.value[0]||1,n=e.is_big_endian,r=e.data_offset,!1})),r){var i=n?new Uint8Array([0,1]):new Uint8Array([1,0]);t.blob=new Blob([e.slice(0,r),i,e.slice(r+2)],{type:"image/jpeg"})}}catch(t){}return t}))}function u(t){if(!t.is_jpeg)return Promise.resolve(t);var e,n=t.orientation-1;if(!n)return Promise.resolve(t);var r=(e=4&n?this.pica.options.createCanvas(t.out_canvas.height,t.out_canvas.width):this.pica.options.createCanvas(t.out_canvas.width,t.out_canvas.height)).getContext("2d");return r.save(),1&n&&r.transform(-1,0,0,1,e.width,0),2&n&&r.transform(-1,0,0,-1,e.width,e.height),4&n&&r.transform(0,1,1,0,0,0),r.drawImage(t.out_canvas,0,0),r.restore(),t.out_canvas.width=t.out_canvas.height=0,t.out_canvas=e,Promise.resolve(t)}function l(t){return t.is_jpeg?Promise.all([this._getUint8Array(t.blob),this._getUint8Array(t.out_blob)]).then((function(e){var n=e[0],r=e[1];if(!h.is_jpeg(n))return Promise.resolve(t);var i=[];return h.jpeg_segments_each(n,(function(t){if(218===t.code)return!1;i.push(t)})),i=i.filter((function(t){return 226!==t.code&&(t.code>=224&&t.code<240||254===t.code)})).map((function(t){return n.slice(t.offset,t.offset+t.length)})),t.out_blob=new Blob([r.slice(0,2)].concat(i).concat([r.slice(20)]),{type:"image/jpeg"}),t})):Promise.resolve(t)}var f={jpeg_patch_exif:A,jpeg_rotate_canvas:u,jpeg_attach_orig_segments:l,assign:function(t){t.before("_blob_to_image",A),t.after("_transform",u),t.after("_create_blob",l)}};function c(t){if(!(this instanceof c))return new c(t);t=t||{},this.pica=t.pica||s({}),this.initialized=!1,this.utils=i}c.prototype.use=function(t){var e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},c.prototype.init=function(){this.use(f.assign)},c.prototype.toBlob=function(t,e){var n={blob:t,opts:i.assign({max:1/0},e)};return this.initialized||(this.init(),this.initialized=!0),Promise.resolve(n).then(this._blob_to_image).then(this._calculate_size).then(this._transform).then(this._cleanup).then(this._create_blob).then((function(t){return t.out_canvas.width=t.out_canvas.height=0,t.out_blob}))},c.prototype.toCanvas=function(t,e){var n={blob:t,opts:i.assign({max:1/0},e)};return this.initialized||(this.init(),this.initialized=!0),Promise.resolve(n).then(this._blob_to_image).then(this._calculate_size).then(this._transform).then(this._cleanup).then((function(t){return t.out_canvas}))},c.prototype.before=function(t,e){if(!this[t])throw new Error('Method "'+t+'" does not exist');if("function"!=typeof e)throw new Error('Invalid argument "fn", function expected');var n=this[t],r=this;return this[t]=function(t){return e.call(r,t).then((function(t){return n.call(r,t)}))},this},c.prototype.after=function(t,e){if(!this[t])throw new Error('Method "'+t+'" does not exist');if("function"!=typeof e)throw new Error('Invalid argument "fn", function expected');var n=this[t],r=this;return this[t]=function(t){return n.call(r,t).then((function(t){return e.call(r,t)}))},this},c.prototype._blob_to_image=function(t){var e=window.URL||window.webkitURL||window.mozURL||window.msURL;return t.image=document.createElement("img"),t.image_url=e.createObjectURL(t.blob),t.image.src=t.image_url,new Promise((function(e,n){t.image.onerror=function(){n(new Error("ImageBlobReduce: failed to create Image() from blob"))},t.image.onload=function(){e(t)}}))},c.prototype._calculate_size=function(t){var e=t.opts.max/Math.max(t.image.width,t.image.height);return e>1&&(e=1),t.transform_width=Math.max(Math.round(t.image.width*e),1),t.transform_height=Math.max(Math.round(t.image.height*e),1),t.scale_factor=e,Promise.resolve(t)},c.prototype._transform=function(t){t.out_canvas=this.pica.options.createCanvas(t.transform_width,t.transform_height),t.transform_width=null,t.transform_height=null;var e={alpha:"image/png"===t.blob.type};return this.utils.assign(e,this.utils.pick_pica_resize_options(t.opts)),this.pica.resize(t.image,t.out_canvas,e).then((function(){return t}))},c.prototype._cleanup=function(t){t.image.src="",t.image=null;var e=window.URL||window.webkitURL||window.mozURL||window.msURL;return e.revokeObjectURL&&e.revokeObjectURL(t.image_url),t.image_url=null,Promise.resolve(t)},c.prototype._create_blob=function(t){return this.pica.toBlob(t.out_canvas,t.blob.type).then((function(e){return t.out_blob=e,t}))},c.prototype._getUint8Array=function(t){return t.arrayBuffer?t.arrayBuffer().then((function(t){return new Uint8Array(t)})):new Promise((function(e,n){var r=new FileReader;r.readAsArrayBuffer(t),r.onload=function(){e(new Uint8Array(r.result))},r.onerror=function(){n(new Error("ImageBlobReduce: failed to load data from input blob")),r.abort()},r.onabort=function(){n(new Error("ImageBlobReduce: failed to load data from input blob (aborted)"))}}))},c.pica=s;var d=c;e.default=d}}]);
@@ -0,0 +1,14 @@
1
+ /*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+
7
+ /*!
8
+
9
+ pica
10
+ https://github.com/nodeca/pica
11
+
12
+ */
13
+
14
+ // @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.