@grapecity/gcimageviewer
Advanced tools
Comparing version 7.0.3 to 7.1.0
@@ -7,2 +7,16 @@ # Changelog | ||
## [7.1.0] - 04-Apr-2024 | ||
### Added | ||
- 'Save As' dropdown menu added to the 'Save' button, providing the ability to convert the image to another format. (DOC-5799).\ | ||
The supported formats for conversion include: PNG (image/png), JPEG (image/jpeg), WEBP (image/webp), BMP image/bmp, GIF (image/gif). | ||
Note that WEBP may not be supported on certain platforms, such as Safari for Mac or iOS. | ||
In such cases the 'Save as WEBP' menu item will be hidden. | ||
- The save method has been enhanced to include the ability to specify save options, | ||
allowing you to customize the saving process, including changing the image format via the convertToFormat option. | ||
```javascript | ||
// Example: save the modified image as PNG: | ||
const viewer = DsImageViewer.findControl("#root"); | ||
viewer.save({ convertToFormat: "image/png" }); | ||
``` | ||
## [7.0.3] - 19-Feb-2024 | ||
@@ -24,2 +38,3 @@ ### Fixed | ||
## [7.0.1] - 04-Jan-2024 | ||
@@ -26,0 +41,0 @@ ### Fixed |
{ | ||
"name": "@grapecity/gcimageviewer", | ||
"version": "7.0.3", | ||
"version": "7.1.0", | ||
"description": "Document Solutions Image Viewer", | ||
@@ -5,0 +5,0 @@ "author": "Mescius, inc", |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gcimageviewer=e():t.gcimageviewer=e()}(self,(()=>(()=>{"use strict";var t={83084:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GcImageFormat=void 0,function(t){t[t.Default=0]="Default",t[t.JPEG=1]="JPEG",t[t.PNG=2]="PNG",t[t.TIFF=3]="TIFF",t[t.GIF=4]="GIF",t[t.BMP=5]="BMP",t[t.ICO=6]="ICO",t[t.SVG=7]="SVG",t[t.WEBP=8]="WEBP"}(e.GcImageFormat||(e.GcImageFormat={}))},60873:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.findImageFormat=e.imageFormatToFileExt=e.fileNameWithoutExt=e.imageFormatToMimeType=void 0;var o,a=i(83084);e.imageFormatToMimeType=function(t){switch(t){case a.GcImageFormat.BMP:return"image/bmp";case a.GcImageFormat.GIF:return"image/gif";case a.GcImageFormat.ICO:return"image/ico";case a.GcImageFormat.JPEG:return"image/jpeg";case a.GcImageFormat.PNG:return"image/png";case a.GcImageFormat.SVG:return"image/svg+xml";case a.GcImageFormat.TIFF:return"image/tiff";case a.GcImageFormat.WEBP:return"image/webp";default:return"image/png"}},e.fileNameWithoutExt=function(t,e){void 0===e&&(e=4);var i=t,o=t.lastIndexOf(".");return-1!==o&&t.length-o<=e+1&&(i=t.substr(0,o)),i},e.imageFormatToFileExt=function(t){switch(void 0===t&&(t=a.GcImageFormat.Default),t){case a.GcImageFormat.BMP:return"bmp";case a.GcImageFormat.GIF:return"gif";case a.GcImageFormat.ICO:return"ico";case a.GcImageFormat.JPEG:return"jpg";case a.GcImageFormat.PNG:return"png";case a.GcImageFormat.SVG:return"svg";case a.GcImageFormat.TIFF:return"tiff";case a.GcImageFormat.WEBP:return"webp";default:return"jpg"}},e.findImageFormat=function(t,e){if(void 0===e&&(e=a.GcImageFormat.Default),!t)return e;if("number"==typeof t)return t;var i=[];if("string"==typeof t)i.push(t.toLowerCase().split(".").pop()||t);else{if(t.buffer)return e;t.type&&i.push(t.type.toLowerCase()),t.name&&i.push(t.name.toLowerCase().split(".").pop()||t.name)}for(var r=(o||((o={})[a.GcImageFormat.TIFF]=["tif","tiff","xif","xiff","image/tiff","image/tiff-fx","image/x-tif","image/x-tiff","image/vnd.xiff","images/xif","application/tif","application/tiff","application/x-tif","application/x-tiff"],o[a.GcImageFormat.BMP]=["bmp","bitmap","application/bmp","application/x-bmp","application/x-win-bitmap","image/ms-bmp","image/x-bitmap","image/x-bmp","image/x-ms-bmp","image/x-win-bitmap","image/x-windows-bmp","image/x-xbitmap"],o[a.GcImageFormat.SVG]=["svg","svg+xml","text/xml-svg","text/xml+svg","image/svg","image/svg-xml","image/svg+xml","image/vnd.adobe.svg+xml"],o[a.GcImageFormat.ICO]=["ico","image/ico","image/x-icon","application/ico","application/x-ico"],o[a.GcImageFormat.GIF]=["gif","image/gi_","image/gif"],o[a.GcImageFormat.JPEG]=["jpg","jpeg","image/jp_","image/jpe_","image/jpg","image/jpeg","image/pipeg","image/pjpeg","application/jpg","application/x-jpg","image/vnd.swiftview-jpeg"],o[a.GcImageFormat.PNG]=["png","image/png","application/png","application/x-png"],o[a.GcImageFormat.WEBP]=["webp","image/webp"]),o),n=function(t){for(var e in r)if(r[e].find((function(e){return e===t})))return{value:1*e}},s=0,u=i;s<u.length;s++){var c=n(u[s]);if("object"==typeof c)return c.value}return e}},59535:function(t,e){var i=this&&this.__awaiter||function(t,e,i,o){return new(i||(i=Promise))((function(a,r){function n(t){try{u(o.next(t))}catch(t){r(t)}}function s(t){try{u(o.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?a(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(n,s)}u((o=o.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,o,a,r,n={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,o&&(a=2&r[0]?o.return:r[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,r[1])).done)return a;switch(o=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return n.label++,{value:r[1],done:!1};case 5:n.label++,o=r[1],r=[0];continue;case 7:r=n.ops.pop(),n.trys.pop();continue;default:if(!(a=n.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){n=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){n.label=r[1];break}if(6===r[0]&&n.label<a[1]){n.label=a[1],a=r;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(r);break}a[2]&&n.ops.pop(),n.trys.pop();continue}r=e.call(t,n)}catch(t){r=[6,t],o=0}finally{i=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.ResizeCommand=e.CropCommand=e.RotationCommand=e.FlipCommand=void 0;var a=function(){function t(t,e,i){this.horizontal=t,this.vertical=e,this.rotationPlugin=i,this.name="Flip"}return t.prototype.execute=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.rotationPlugin.flip(this.horizontal,this.vertical)];case 1:return t.sent(),[2]}}))}))},t.prototype.undo=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.rotationPlugin.flip(this.horizontal,this.vertical)];case 1:return t.sent(),[2]}}))}))},t}();e.FlipCommand=a;var r=function(){function t(t,e){this.rotation=t,this.rotationPlugin=e,this.name="Rotation"}return t.prototype.execute=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.rotationPlugin.rotate(this.rotation)];case 1:return t.sent(),[2]}}))}))},t.prototype.undo=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.rotationPlugin.rotate(-this.rotation)];case 1:return t.sent(),[2]}}))}))},t}();e.RotationCommand=r;var n=function(){function t(t,e,i,o,a,r){this.x=t,this.y=e,this.width=i,this.height=o,this.originalImageDataUrl=a,this.pageTools=r,this.name="Crop"}return t.prototype.execute=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.pageTools.crop(this.x,this.y,this.width,this.height)];case 1:return t.sent(),[2]}}))}))},t.prototype.undo=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){return t.setImageDataUrl(this.originalImageDataUrl),[2]}))}))},t}();e.CropCommand=n;var s=function(){function t(t,e,i,o,a){this.width=t,this.height=e,this.keepAspectRatio=i,this.originalImageDataUrl=o,this.pageTools=a,this.name="Resize"}return t.prototype.execute=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.pageTools.resize(this.width,this.height,this.keepAspectRatio)];case 1:return t.sent(),[2]}}))}))},t.prototype.undo=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,t.setImageDataUrl(this.originalImageDataUrl)];case 1:return e.sent(),[2]}}))}))},t}();e.ResizeCommand=s},93329:function(t,e,i){var o=this&&this.__awaiter||function(t,e,i,o){return new(i||(i=Promise))((function(a,r){function n(t){try{u(o.next(t))}catch(t){r(t)}}function s(t){try{u(o.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?a(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(n,s)}u((o=o.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var i,o,a,r,n={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,o&&(a=2&r[0]?o.return:r[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,r[1])).done)return a;switch(o=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return n.label++,{value:r[1],done:!1};case 5:n.label++,o=r[1],r=[0];continue;case 7:r=n.ops.pop(),n.trys.pop();continue;default:if(!(a=n.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){n=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){n.label=r[1];break}if(6===r[0]&&n.label<a[1]){n.label=a[1],a=r;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(r);break}a[2]&&n.ops.pop(),n.trys.pop();continue}r=e.call(t,n)}catch(t){r=[6,t],o=0}finally{i=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.RotationPlugin=e.mirrorImage=void 0;var r=i(83084),n=i(60873),s=i(59535);function u(t){return!1===t?-1:t||0}function c(t,e,i,o,a,r){void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=!1),void 0===r&&(r=!1),t.save(),t.setTransform(a?-1:1,0,0,r?-1:1,i+a?e.width:0,o+r?e.height:0),t.drawImage(e,0,0),t.restore()}e.mirrorImage=c;var l=function(){function t(t){this.id="rotation",t=t||{rotatePosition:1,flipHorizontalPosition:2,flipVerticalPosition:3},this.options=t}return t.prototype.initialize=function(t){this._viewer=t,this._ensureOptions(),t.toolbar.addItem(function(t,e){var i=t.getType("svgIcons");return{key:"rotate-image",icon:{type:"svg",content:i.rotate},title:"Rotate image",checked:!1,enabled:!1,action:function(){e.setRotation(e.getRotation()+90)},onUpdate:function(i){return{title:e.getRotation()?"Rotate image ("+e.getRotation()+"deg)":"Rotate image",enabled:3===i.state.session.status&&t.hasImage&&e.isImageFormatSupported(t.imageFormat)}}}}(t,this)),t.toolbar.addItem(function(t,e){var i=t.getType("svgIcons");return{key:"flip-horizontal",icon:{type:"svg",content:i["flip-horizontal"]},title:"Flip horizontal",checked:!1,enabled:!1,action:function(){e.flipHorizontal()},onUpdate:function(i){return{title:"Flip horizontal",enabled:3===i.state.session.status&&t.hasImage&&e.isImageFormatSupported(t.imageFormat)}}}}(t,this)),t.toolbar.addItem(function(t,e){var i=t.getType("svgIcons");return{key:"flip-vertical",icon:{type:"svg",content:i["flip-vertical"]},title:"Flip vertical",checked:!1,enabled:!1,action:function(){e.flipVertical()},onUpdate:function(i){return{title:"Flip vertical",enabled:3===i.state.session.status&&t.hasImage&&e.isImageFormatSupported(t.imageFormat)}}}}(t,this));var e={"rotate-image":u(this.options.rotatePosition),"flip-horizontal":u(this.options.flipHorizontalPosition),"flip-vertical":u(this.options.flipVerticalPosition)},i=[];for(var o in e){-1!==(a=e[o])&&Number.isFinite(a)&&(i[a]=o)}for(var a=0;a<i.length;a++){(o=i[a])&&((t.toolbarLayout.viewer.default||[]).splice(a,0,o),(t.toolbarLayout.viewer.fullscreen||[]).splice(a,0,o),(t.toolbarLayout.viewer.mobile||[]).splice(a,0,o))}t.applyToolbarLayout(),t.onBeforeOpen.register(this._onBeforeOpen.bind(this)),this._initialized=!0},t.prototype.dispose=function(){this._initialized&&(this._initialized=!1,this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.default||[],"rotate-image"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.fullscreen||[],"rotate-image"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.mobile||[],"rotate-image"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.default||[],"flip-horizontal"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.fullscreen||[],"flip-horizontal"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.mobile||[],"flip-horizontal"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.default||[],"flip-vertical"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.fullscreen||[],"flip-vertical"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.mobile||[],"flip-vertical"),this._viewer.toolbar.removeItem("rotate-image"),this._viewer.toolbar.removeItem("flip-horizontal"),this._viewer.toolbar.removeItem("flip-vertical"),this._viewer=null,this._originalNaturalSize=null)},t.prototype.getRotation=function(){return this._rotation||0},t.prototype.rotate=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){return[2,this.setRotation(this._rotation+t)]}))}))},t.prototype.setRotation=function(t){return o(this,void 0,void 0,(function(){var e;return a(this,(function(i){switch(i.label){case 0:return t%=360,[4,this._rotateImageData(t)];case 1:return(e=i.sent())&&!this._viewer.undoStorage.undoInProgress&&this._viewer.undoStorage.onCommandExecuted(new s.RotationCommand(t,this)),this._rotation=t,[2,e]}}))}))},t.prototype.isImageFormatSupported=function(t){return(t=(0,n.findImageFormat)(t))!==r.GcImageFormat.TIFF&&t!==r.GcImageFormat.SVG&&t!==r.GcImageFormat.ICO&&t!==r.GcImageFormat.GIF},t.prototype.flip=function(t,e){var i=this;return void 0===t&&(t=!0),void 0===e&&(e=!1),new Promise((function(o){var a=i._viewer,r=a.naturalSize,n=document.createElement("canvas");n.width=r.width,n.height=r.height;var u=n.getContext("2d"),l=new Image;l.onload=function(){c(u,l,0,0,t,e);try{var r=a.canvasToDataURL(n);a.setImageDataUrl(r).then((function(){o(!0),i._viewer.undoStorage.undoInProgress||i._viewer.undoStorage.onCommandExecuted(new s.FlipCommand(t,e,i))}))}catch(t){o(!1)}},l.onerror=function(t){o(!1)},l.crossOrigin="Anonymous";try{l.src=a.getImageDataUrl()}catch(t){o(!1)}}))},t.prototype.flipHorizontal=function(){return this.flip(!0,!1)},t.prototype.flipVertical=function(){return this.flip(!1,!0)},t.prototype._removeRotateButtonFromLayout=function(t,e){if(t){var i=t.findIndex((function(t){return t===e}));-1!==i&&t.splice(i,1)}},t.prototype._onBeforeOpen=function(){this._originalNaturalSize=null,this._rotation=0},t.prototype._rotateImageData=function(t){var e=this;return new Promise((function(i){var o=e._viewer,a=e._originalNaturalSize||o.naturalSize;if(e._originalNaturalSize||(e._originalNaturalSize=a),3===o.imageFormat)return alert("Cannot rotate TIFF image."),void i(!1);if(7===o.imageFormat){var r=o.getOriginalImageDataUrl();return t&&(r=r.replace("<svg",'<svg transform="rotate('+t+')"')),o.setImageDataUrl(r),void i(!0)}var n=document.createElement("canvas"),s=e._imageSizeAfterRotation([a.width,a.height],t);n.width=s[0],n.height=s[1];var u=n.getContext("2d");u.translate(n.width/2,n.height/2),u.rotate(t*Math.PI/180);var c=new Image;c.onload=function(){u.drawImage(c,-a.width/2,-a.height/2);try{var t=o.canvasToDataURL(n);o.setImageDataUrl(t),i(!0)}catch(t){alert(t),i(!1)}},c.onerror=function(t){i(!1)},c.crossOrigin="Anonymous";try{c.src=o.getOriginalImageDataUrl()}catch(t){return alert(t),void i(!1)}}))},t.prototype._imageSizeAfterRotation=function(t,e){if((e%=180)<0&&(e=180+e),e>=90&&(t=[t[1],t[0]],e-=90),0===e)return t;var i=e*Math.PI/180;return[t[0]*Math.cos(i)+t[1]*Math.sin(i),t[0]*Math.sin(i)+t[1]*Math.cos(i)]},t.prototype._ensureOptions=function(){var t=this.options||{};void 0===t.rotatePosition&&(t.rotatePosition=1),this.options=t},t}();e.RotationPlugin=l,(window||{}).RotationPlugin=l}},e={};var i=function i(o){var a=e[o];if(void 0!==a)return a.exports;var r=e[o]={exports:{}};return t[o].call(r.exports,r,r.exports,i),r.exports}(93329);return i})())); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gcimageviewer=e():t.gcimageviewer=e()}(self,(()=>{return t={26064:t=>{t.exports='// gif.worker.js 0.2.0 - https://github.com/jnordberg/gif.js\r\n(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module \'"+o+"\'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var NeuQuant=require("./TypedNeuQuant.js");var LZWEncoder=require("./LZWEncoder.js");function ByteArray(){this.page=-1;this.pages=[];this.newPage()}ByteArray.pageSize=4096;ByteArray.charMap={};for(var i=0;i<256;i++)ByteArray.charMap[i]=String.fromCharCode(i);ByteArray.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(ByteArray.pageSize);this.cursor=0};ByteArray.prototype.getData=function(){var rv="";for(var p=0;p<this.pages.length;p++){for(var i=0;i<ByteArray.pageSize;i++){rv+=ByteArray.charMap[this.pages[p][i]]}}return rv};ByteArray.prototype.writeByte=function(val){if(this.cursor>=ByteArray.pageSize)this.newPage();this.pages[this.page][this.cursor++]=val};ByteArray.prototype.writeUTFBytes=function(string){for(var l=string.length,i=0;i<l;i++)this.writeByte(string.charCodeAt(i))};ByteArray.prototype.writeBytes=function(array,offset,length){for(var l=length||array.length,i=offset||0;i<l;i++)this.writeByte(array[i])};function GIFEncoder(width,height){this.width=~~width;this.height=~~height;this.transparent=null;this.transIndex=0;this.repeat=-1;this.delay=0;this.image=null;this.pixels=null;this.indexedPixels=null;this.colorDepth=null;this.colorTab=null;this.neuQuant=null;this.usedEntry=new Array;this.palSize=7;this.dispose=-1;this.firstFrame=true;this.sample=10;this.dither=false;this.globalPalette=false;this.out=new ByteArray}GIFEncoder.prototype.setDelay=function(milliseconds){this.delay=Math.round(milliseconds/10)};GIFEncoder.prototype.setFrameRate=function(fps){this.delay=Math.round(100/fps)};GIFEncoder.prototype.setDispose=function(disposalCode){if(disposalCode>=0)this.dispose=disposalCode};GIFEncoder.prototype.setRepeat=function(repeat){this.repeat=repeat};GIFEncoder.prototype.setTransparent=function(color){this.transparent=color};GIFEncoder.prototype.addFrame=function(imageData){this.image=imageData;this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null;this.getImagePixels();this.analyzePixels();if(this.globalPalette===true)this.globalPalette=this.colorTab;if(this.firstFrame){this.writeLSD();this.writePalette();if(this.repeat>=0){this.writeNetscapeExt()}}this.writeGraphicCtrlExt();this.writeImageDesc();if(!this.firstFrame&&!this.globalPalette)this.writePalette();this.writePixels();this.firstFrame=false};GIFEncoder.prototype.finish=function(){this.out.writeByte(59)};GIFEncoder.prototype.setQuality=function(quality){if(quality<1)quality=1;this.sample=quality};GIFEncoder.prototype.setDither=function(dither){if(dither===true)dither="FloydSteinberg";this.dither=dither};GIFEncoder.prototype.setGlobalPalette=function(palette){this.globalPalette=palette};GIFEncoder.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette};GIFEncoder.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")};GIFEncoder.prototype.analyzePixels=function(){if(!this.colorTab){this.neuQuant=new NeuQuant(this.pixels,this.sample);this.neuQuant.buildColormap();this.colorTab=this.neuQuant.getColormap()}if(this.dither){this.ditherPixels(this.dither.replace("-serpentine",""),this.dither.match(/-serpentine/)!==null)}else{this.indexPixels()}this.pixels=null;this.colorDepth=8;this.palSize=7;if(this.transparent!==null){this.transIndex=this.findClosest(this.transparent,true)}};GIFEncoder.prototype.indexPixels=function(imgq){var nPix=this.pixels.length/3;this.indexedPixels=new Uint8Array(nPix);var k=0;for(var j=0;j<nPix;j++){var index=this.findClosestRGB(this.pixels[k++]&255,this.pixels[k++]&255,this.pixels[k++]&255);this.usedEntry[index]=true;this.indexedPixels[j]=index}};GIFEncoder.prototype.ditherPixels=function(kernel,serpentine){var kernels={FalseFloydSteinberg:[[3/8,1,0],[3/8,0,1],[2/8,1,1]],FloydSteinberg:[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]],Stucki:[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]],Atkinson:[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]]};if(!kernel||!kernels[kernel]){throw"Unknown dithering kernel: "+kernel}var ds=kernels[kernel];var index=0,height=this.height,width=this.width,data=this.pixels;var direction=serpentine?-1:1;this.indexedPixels=new Uint8Array(this.pixels.length/3);for(var y=0;y<height;y++){if(serpentine)direction=direction*-1;for(var x=direction==1?0:width-1,xend=direction==1?width:0;x!==xend;x+=direction){index=y*width+x;var idx=index*3;var r1=data[idx];var g1=data[idx+1];var b1=data[idx+2];idx=this.findClosestRGB(r1,g1,b1);this.usedEntry[idx]=true;this.indexedPixels[index]=idx;idx*=3;var r2=this.colorTab[idx];var g2=this.colorTab[idx+1];var b2=this.colorTab[idx+2];var er=r1-r2;var eg=g1-g2;var eb=b1-b2;for(var i=direction==1?0:ds.length-1,end=direction==1?ds.length:0;i!==end;i+=direction){var x1=ds[i][1];var y1=ds[i][2];if(x1+x>=0&&x1+x<width&&y1+y>=0&&y1+y<height){var d=ds[i][0];idx=index+x1+y1*width;idx*=3;data[idx]=Math.max(0,Math.min(255,data[idx]+er*d));data[idx+1]=Math.max(0,Math.min(255,data[idx+1]+eg*d));data[idx+2]=Math.max(0,Math.min(255,data[idx+2]+eb*d))}}}}};GIFEncoder.prototype.findClosest=function(c,used){return this.findClosestRGB((c&16711680)>>16,(c&65280)>>8,c&255,used)};GIFEncoder.prototype.findClosestRGB=function(r,g,b,used){if(this.colorTab===null)return-1;if(this.neuQuant&&!used){return this.neuQuant.lookupRGB(r,g,b)}var c=b|g<<8|r<<16;var minpos=0;var dmin=256*256*256;var len=this.colorTab.length;for(var i=0,index=0;i<len;index++){var dr=r-(this.colorTab[i++]&255);var dg=g-(this.colorTab[i++]&255);var db=b-(this.colorTab[i++]&255);var d=dr*dr+dg*dg+db*db;if((!used||this.usedEntry[index])&&d<dmin){dmin=d;minpos=index}}return minpos};GIFEncoder.prototype.getImagePixels=function(){var w=this.width;var h=this.height;this.pixels=new Uint8Array(w*h*3);var data=this.image;var srcPos=0;var count=0;for(var i=0;i<h;i++){for(var j=0;j<w;j++){this.pixels[count++]=data[srcPos++];this.pixels[count++]=data[srcPos++];this.pixels[count++]=data[srcPos++];srcPos++}}};GIFEncoder.prototype.writeGraphicCtrlExt=function(){this.out.writeByte(33);this.out.writeByte(249);this.out.writeByte(4);var transp,disp;if(this.transparent===null){transp=0;disp=0}else{transp=1;disp=2}if(this.dispose>=0){disp=dispose&7}disp<<=2;this.out.writeByte(0|disp|0|transp);this.writeShort(this.delay);this.out.writeByte(this.transIndex);this.out.writeByte(0)};GIFEncoder.prototype.writeImageDesc=function(){this.out.writeByte(44);this.writeShort(0);this.writeShort(0);this.writeShort(this.width);this.writeShort(this.height);if(this.firstFrame||this.globalPalette){this.out.writeByte(0)}else{this.out.writeByte(128|0|0|0|this.palSize)}};GIFEncoder.prototype.writeLSD=function(){this.writeShort(this.width);this.writeShort(this.height);this.out.writeByte(128|112|0|this.palSize);this.out.writeByte(0);this.out.writeByte(0)};GIFEncoder.prototype.writeNetscapeExt=function(){this.out.writeByte(33);this.out.writeByte(255);this.out.writeByte(11);this.out.writeUTFBytes("NETSCAPE2.0");this.out.writeByte(3);this.out.writeByte(1);this.writeShort(this.repeat);this.out.writeByte(0)};GIFEncoder.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);var n=3*256-this.colorTab.length;for(var i=0;i<n;i++)this.out.writeByte(0)};GIFEncoder.prototype.writeShort=function(pValue){this.out.writeByte(pValue&255);this.out.writeByte(pValue>>8&255)};GIFEncoder.prototype.writePixels=function(){var enc=new LZWEncoder(this.width,this.height,this.indexedPixels,this.colorDepth);enc.encode(this.out)};GIFEncoder.prototype.stream=function(){return this.out};module.exports=GIFEncoder},{"./LZWEncoder.js":2,"./TypedNeuQuant.js":3}],2:[function(require,module,exports){var EOF=-1;var BITS=12;var HSIZE=5003;var masks=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function LZWEncoder(width,height,pixels,colorDepth){var initCodeSize=Math.max(2,colorDepth);var accum=new Uint8Array(256);var htab=new Int32Array(HSIZE);var codetab=new Int32Array(HSIZE);var cur_accum,cur_bits=0;var a_count;var free_ent=0;var maxcode;var clear_flg=false;var g_init_bits,ClearCode,EOFCode;function char_out(c,outs){accum[a_count++]=c;if(a_count>=254)flush_char(outs)}function cl_block(outs){cl_hash(HSIZE);free_ent=ClearCode+2;clear_flg=true;output(ClearCode,outs)}function cl_hash(hsize){for(var i=0;i<hsize;++i)htab[i]=-1}function compress(init_bits,outs){var fcode,c,i,ent,disp,hsize_reg,hshift;g_init_bits=init_bits;clear_flg=false;n_bits=g_init_bits;maxcode=MAXCODE(n_bits);ClearCode=1<<init_bits-1;EOFCode=ClearCode+1;free_ent=ClearCode+2;a_count=0;ent=nextPixel();hshift=0;for(fcode=HSIZE;fcode<65536;fcode*=2)++hshift;hshift=8-hshift;hsize_reg=HSIZE;cl_hash(hsize_reg);output(ClearCode,outs);outer_loop:while((c=nextPixel())!=EOF){fcode=(c<<BITS)+ent;i=c<<hshift^ent;if(htab[i]===fcode){ent=codetab[i];continue}else if(htab[i]>=0){disp=hsize_reg-i;if(i===0)disp=1;do{if((i-=disp)<0)i+=hsize_reg;if(htab[i]===fcode){ent=codetab[i];continue outer_loop}}while(htab[i]>=0)}output(ent,outs);ent=c;if(free_ent<1<<BITS){codetab[i]=free_ent++;htab[i]=fcode}else{cl_block(outs)}}output(ent,outs);output(EOFCode,outs)}function encode(outs){outs.writeByte(initCodeSize);remaining=width*height;curPixel=0;compress(initCodeSize+1,outs);outs.writeByte(0)}function flush_char(outs){if(a_count>0){outs.writeByte(a_count);outs.writeBytes(accum,0,a_count);a_count=0}}function MAXCODE(n_bits){return(1<<n_bits)-1}function nextPixel(){if(remaining===0)return EOF;--remaining;var pix=pixels[curPixel++];return pix&255}function output(code,outs){cur_accum&=masks[cur_bits];if(cur_bits>0)cur_accum|=code<<cur_bits;else cur_accum=code;cur_bits+=n_bits;while(cur_bits>=8){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}if(free_ent>maxcode||clear_flg){if(clear_flg){maxcode=MAXCODE(n_bits=g_init_bits);clear_flg=false}else{++n_bits;if(n_bits==BITS)maxcode=1<<BITS;else maxcode=MAXCODE(n_bits)}}if(code==EOFCode){while(cur_bits>0){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}flush_char(outs)}}this.encode=encode}module.exports=LZWEncoder},{}],3:[function(require,module,exports){var ncycles=100;var netsize=256;var maxnetpos=netsize-1;var netbiasshift=4;var intbiasshift=16;var intbias=1<<intbiasshift;var gammashift=10;var gamma=1<<gammashift;var betashift=10;var beta=intbias>>betashift;var betagamma=intbias<<gammashift-betashift;var initrad=netsize>>3;var radiusbiasshift=6;var radiusbias=1<<radiusbiasshift;var initradius=initrad*radiusbias;var radiusdec=30;var alphabiasshift=10;var initalpha=1<<alphabiasshift;var alphadec;var radbiasshift=8;var radbias=1<<radbiasshift;var alpharadbshift=alphabiasshift+radbiasshift;var alpharadbias=1<<alpharadbshift;var prime1=499;var prime2=491;var prime3=487;var prime4=503;var minpicturebytes=3*prime4;function NeuQuant(pixels,samplefac){var network;var netindex;var bias;var freq;var radpower;function init(){network=[];netindex=new Int32Array(256);bias=new Int32Array(netsize);freq=new Int32Array(netsize);radpower=new Int32Array(netsize>>3);var i,v;for(i=0;i<netsize;i++){v=(i<<netbiasshift+8)/netsize;network[i]=new Float64Array([v,v,v,0]);freq[i]=intbias/netsize;bias[i]=0}}function unbiasnet(){for(var i=0;i<netsize;i++){network[i][0]>>=netbiasshift;network[i][1]>>=netbiasshift;network[i][2]>>=netbiasshift;network[i][3]=i}}function altersingle(alpha,i,b,g,r){network[i][0]-=alpha*(network[i][0]-b)/initalpha;network[i][1]-=alpha*(network[i][1]-g)/initalpha;network[i][2]-=alpha*(network[i][2]-r)/initalpha}function alterneigh(radius,i,b,g,r){var lo=Math.abs(i-radius);var hi=Math.min(i+radius,netsize);var j=i+1;var k=i-1;var m=1;var p,a;while(j<hi||k>lo){a=radpower[m++];if(j<hi){p=network[j++];p[0]-=a*(p[0]-b)/alpharadbias;p[1]-=a*(p[1]-g)/alpharadbias;p[2]-=a*(p[2]-r)/alpharadbias}if(k>lo){p=network[k--];p[0]-=a*(p[0]-b)/alpharadbias;p[1]-=a*(p[1]-g)/alpharadbias;p[2]-=a*(p[2]-r)/alpharadbias}}}function contest(b,g,r){var bestd=~(1<<31);var bestbiasd=bestd;var bestpos=-1;var bestbiaspos=bestpos;var i,n,dist,biasdist,betafreq;for(i=0;i<netsize;i++){n=network[i];dist=Math.abs(n[0]-b)+Math.abs(n[1]-g)+Math.abs(n[2]-r);if(dist<bestd){bestd=dist;bestpos=i}biasdist=dist-(bias[i]>>intbiasshift-netbiasshift);if(biasdist<bestbiasd){bestbiasd=biasdist;bestbiaspos=i}betafreq=freq[i]>>betashift;freq[i]-=betafreq;bias[i]+=betafreq<<gammashift}freq[bestpos]+=beta;bias[bestpos]-=betagamma;return bestbiaspos}function inxbuild(){var i,j,p,q,smallpos,smallval,previouscol=0,startpos=0;for(i=0;i<netsize;i++){p=network[i];smallpos=i;smallval=p[1];for(j=i+1;j<netsize;j++){q=network[j];if(q[1]<smallval){smallpos=j;smallval=q[1]}}q=network[smallpos];if(i!=smallpos){j=q[0];q[0]=p[0];p[0]=j;j=q[1];q[1]=p[1];p[1]=j;j=q[2];q[2]=p[2];p[2]=j;j=q[3];q[3]=p[3];p[3]=j}if(smallval!=previouscol){netindex[previouscol]=startpos+i>>1;for(j=previouscol+1;j<smallval;j++)netindex[j]=i;previouscol=smallval;startpos=i}}netindex[previouscol]=startpos+maxnetpos>>1;for(j=previouscol+1;j<256;j++)netindex[j]=maxnetpos}function inxsearch(b,g,r){var a,p,dist;var bestd=1e3;var best=-1;var i=netindex[g];var j=i-1;while(i<netsize||j>=0){if(i<netsize){p=network[i];dist=p[1]-g;if(dist>=bestd)i=netsize;else{i++;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist<bestd){a=p[2]-r;if(a<0)a=-a;dist+=a;if(dist<bestd){bestd=dist;best=p[3]}}}}if(j>=0){p=network[j];dist=g-p[1];if(dist>=bestd)j=-1;else{j--;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist<bestd){a=p[2]-r;if(a<0)a=-a;dist+=a;if(dist<bestd){bestd=dist;best=p[3]}}}}}return best}function learn(){var i;var lengthcount=pixels.length;var alphadec=30+(samplefac-1)/3;var samplepixels=lengthcount/(3*samplefac);var delta=~~(samplepixels/ncycles);var alpha=initalpha;var radius=initradius;var rad=radius>>radiusbiasshift;if(rad<=1)rad=0;for(i=0;i<rad;i++)radpower[i]=alpha*((rad*rad-i*i)*radbias/(rad*rad));var step;if(lengthcount<minpicturebytes){samplefac=1;step=3}else if(lengthcount%prime1!==0){step=3*prime1}else if(lengthcount%prime2!==0){step=3*prime2}else if(lengthcount%prime3!==0){step=3*prime3}else{step=3*prime4}var b,g,r,j;var pix=0;i=0;while(i<samplepixels){b=(pixels[pix]&255)<<netbiasshift;g=(pixels[pix+1]&255)<<netbiasshift;r=(pixels[pix+2]&255)<<netbiasshift;j=contest(b,g,r);altersingle(alpha,j,b,g,r);if(rad!==0)alterneigh(rad,j,b,g,r);pix+=step;if(pix>=lengthcount)pix-=lengthcount;i++;if(delta===0)delta=1;if(i%delta===0){alpha-=alpha/alphadec;radius-=radius/radiusdec;rad=radius>>radiusbiasshift;if(rad<=1)rad=0;for(j=0;j<rad;j++)radpower[j]=alpha*((rad*rad-j*j)*radbias/(rad*rad))}}}function buildColormap(){init();learn();unbiasnet();inxbuild()}this.buildColormap=buildColormap;function getColormap(){var map=[];var index=[];for(var i=0;i<netsize;i++)index[network[i][3]]=i;var k=0;for(var l=0;l<netsize;l++){var j=index[l];map[k++]=network[j][0];map[k++]=network[j][1];map[k++]=network[j][2]}return map}this.getColormap=getColormap;this.lookupRGB=inxsearch}module.exports=NeuQuant},{}],4:[function(require,module,exports){var GIFEncoder,renderFrame;GIFEncoder=require("./GIFEncoder.js");renderFrame=function(frame){var encoder,page,stream,transfer;encoder=new GIFEncoder(frame.width,frame.height);if(frame.index===0){encoder.writeHeader()}else{encoder.firstFrame=false}encoder.setTransparent(frame.transparent);encoder.setRepeat(frame.repeat);encoder.setDelay(frame.delay);encoder.setQuality(frame.quality);encoder.setDither(frame.dither);encoder.setGlobalPalette(frame.globalPalette);encoder.addFrame(frame.data);if(frame.last){encoder.finish()}if(frame.globalPalette===true){frame.globalPalette=encoder.getGlobalPalette()}stream=encoder.stream();frame.data=stream.pages;frame.cursor=stream.cursor;frame.pageSize=stream.constructor.pageSize;if(frame.canTransfer){transfer=function(){var i,len,ref,results;ref=frame.data;results=[];for(i=0,len=ref.length;i<len;i++){page=ref[i];results.push(page.buffer)}return results}();return self.postMessage(frame,transfer)}else{return self.postMessage(frame)}};self.onmessage=function(event){return renderFrame(event.data)}},{"./GIFEncoder.js":1}]},{},[4]);\r\n//# sourceMappingURL=gif.worker.js.map\r\n'},83084:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GcImageFormat=void 0,function(t){t[t.Default=0]="Default",t[t.JPEG=1]="JPEG",t[t.PNG=2]="PNG",t[t.TIFF=3]="TIFF",t[t.GIF=4]="GIF",t[t.BMP=5]="BMP",t[t.ICO=6]="ICO",t[t.SVG=7]="SVG",t[t.WEBP=8]="WEBP"}(e.GcImageFormat||(e.GcImageFormat={}))},60253:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.downloadFileFromUrl=e.getDisplayPixelRatio=e.isMobile=e.copyTextToClipboard=e.isIETrident=void 0,e.isIETrident=navigator.userAgent.indexOf("Trident/")>-1,e.copyTextToClipboard=function(t){navigator.clipboard?navigator.clipboard.writeText(t).then((function(){}),(function(t){})):function(t){var e=document.createElement("textarea");e.value=t,e.style.top="0",e.style.left="0",e.style.height="1px",e.style.position="absolute",document.body.appendChild(e),e.focus(),e.select();try{document.execCommand("copy")}catch(t){}document.body.removeChild(e)}(t)},e.isMobile={Android:function(){return!!navigator.userAgent.match(/Android/i)},BlackBerry:function(){return!!navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return!!navigator.userAgent.match(/iPhone|iPad|iPod/i)},iOSDesktopMode:function(){return"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1},iOSVer:function(){if(this.iOS()){var t=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return t?[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3]||"0",10)]:[0,0,0]}return[0,0,0]},likeMac:function(){return!!/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},OperaMini:function(){return!!navigator.userAgent.match(/Opera Mini/i)},WindowsMobile:function(){return!(!navigator.userAgent.match(/IEMobile/i)&&!navigator.userAgent.match(/WPDesktop/i))},WindowsAny:function(){return!!navigator.userAgent.match(/Windows/i)},anyMobile:function(){return!!(e.isMobile.Android()||e.isMobile.BlackBerry()||e.isMobile.iOS()||e.isMobile.iOSDesktopMode()||e.isMobile.OperaMini()||e.isMobile.WindowsMobile())}},e.getDisplayPixelRatio=function(t){if(t||!i){var e=window.devicePixelRatio||1;t||(t=document.createElement("canvas").getContext("2d"));var r=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;i=e/r}return{sx:i,sy:i,scaled:1!==i}},e.downloadFileFromUrl=function(t,i){var r=document.createElement("a");r.href=t,e.isMobile.iOS()&&e.isMobile.iOSVer()[0]<13?r.target="_self":r.target="_blank",r.download=i,document.body.appendChild(r),r.click(),document.body.removeChild(r)}},39273:function(t,e){"use strict";var i=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function o(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}u((r=r.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var i,r,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasToBMPConverter=void 0;var n=function(){function t(){}return t.toArrayBuffer=function(t){return i(this,void 0,void 0,(function(){function e(){return i(this,void 0,void 0,(function(){var t=this;return r(this,(function(n){switch(n.label){case 0:for(;y<u&&w>0;){for(P=122+y*p,x=0;x<l;)w--,_=f[k++],I=_>>>24,v.setUint32(P+x,_<<8|I),x+=4;y++}return k<f.length?(w=b,[4,new Promise((function(n){setTimeout((function(){return i(t,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e()];case 1:return t.sent(),n(),[2]}}))}))}),9)}))]):[3,2];case 1:return n.sent(),[3,3];case 2:case 3:return[2]}}))}))}function n(t){v.setUint16(F,t,!0),F+=2}function a(t){v.setUint32(F,t,!0),F+=4}function o(t){F+=t}var s,u,l,c,h,f,p,d,m,g,v,b,w,y,x,_,I,F,P,k;return r(this,(function(i){switch(i.label){case 0:return s=t.width,u=t.height,l=s<<2,c=t.getContext("2d"),h=c.getImageData(0,0,s,u),f=new Uint32Array(h.data.buffer),m=122+(d=(p=(32*s+31)/32<<2)*u),g=new ArrayBuffer(m),v=new DataView(g),w=b=1<<20,y=0,F=0,k=0,n(19778),a(m),o(4),a(122),a(108),a(s),a(-u>>>0),n(1),n(32),a(3),a(d),a(2835),a(2835),o(8),a(16711680),a(65280),a(255),a(4278190080),a(1466527264),[4,e()];case 1:return i.sent(),[2,g]}}))}))},t.toBlob=function(e){return i(this,void 0,void 0,(function(){var i;return r(this,(function(r){switch(r.label){case 0:return[4,t.toArrayBuffer(e)];case 1:return i=r.sent(),[2,new Blob([i],{type:"image/bmp"})]}}))}))},t}();e.CanvasToBMPConverter=n},57854:function(t,e,i){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.createGifDecoder=e.createGifEncoder=void 0;var n=r(i(52171)),a=i(26064);function o(){var t=new Blob([a],{type:"application/javascript"});return new n.default({workers:2,workerScript:URL.createObjectURL(t),quality:10})}e.createGifEncoder=o,e.createGifDecoder=function(){return o()}},60873:function(t,e,i){"use strict";var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function o(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}u((r=r.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var i,r,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.convertImageToFormat=e.getSupportedImageFormats=e.findImageFormat=e.imageFormatToFileExt=e.fileNameWithoutExt=e.mimeTypeToImageFormat=e.imageFormatToMimeType=void 0;var a,o=i(83084),s=i(39273),u=i(83992),l=i(57854);e.imageFormatToMimeType=function(t){switch(t){case o.GcImageFormat.BMP:return"image/bmp";case o.GcImageFormat.GIF:return"image/gif";case o.GcImageFormat.ICO:return"image/ico";case o.GcImageFormat.JPEG:return"image/jpeg";case o.GcImageFormat.PNG:return"image/png";case o.GcImageFormat.SVG:return"image/svg+xml";case o.GcImageFormat.TIFF:return"image/tiff";case o.GcImageFormat.WEBP:return"image/webp";default:return"image/png"}},e.mimeTypeToImageFormat=function(t,e){switch("image/jpg"===t&&(t="image/jpeg"),t){case"image/bmp":return o.GcImageFormat.BMP;case"image/gif":return o.GcImageFormat.GIF;case"image/ico":return o.GcImageFormat.ICO;case"image/jpeg":return o.GcImageFormat.JPEG;case"image/png":return o.GcImageFormat.PNG;case"image/svg+xml":return o.GcImageFormat.SVG;case"image/tiff":return o.GcImageFormat.TIFF;case"image/webp":return o.GcImageFormat.WEBP;default:return void 0!==e?e:o.GcImageFormat.PNG}},e.fileNameWithoutExt=function(t,e){void 0===e&&(e=4);var i=t,r=t.lastIndexOf(".");return-1!==r&&t.length-r<=e+1&&(i=t.substr(0,r)),i},e.imageFormatToFileExt=function(t){switch(void 0===t&&(t=o.GcImageFormat.Default),t){case o.GcImageFormat.BMP:return"bmp";case o.GcImageFormat.GIF:return"gif";case o.GcImageFormat.ICO:return"ico";case o.GcImageFormat.JPEG:return"jpg";case o.GcImageFormat.PNG:return"png";case o.GcImageFormat.SVG:return"svg";case o.GcImageFormat.TIFF:return"tiff";case o.GcImageFormat.WEBP:return"webp";default:return"jpg"}},e.findImageFormat=function(t,e){if(void 0===e&&(e=o.GcImageFormat.Default),!t)return e;if("number"==typeof t)return t;var i=[];if("string"==typeof t)i.push(t.toLowerCase().split(".").pop()||t);else{if(t.buffer)return e;t.type&&i.push(t.type.toLowerCase()),t.name&&i.push(t.name.toLowerCase().split(".").pop()||t.name)}for(var r=(a||((a={})[o.GcImageFormat.TIFF]=["tif","tiff","xif","xiff","image/tiff","image/tiff-fx","image/x-tif","image/x-tiff","image/vnd.xiff","images/xif","application/tif","application/tiff","application/x-tif","application/x-tiff"],a[o.GcImageFormat.BMP]=["bmp","bitmap","application/bmp","application/x-bmp","application/x-win-bitmap","image/ms-bmp","image/x-bitmap","image/x-bmp","image/x-ms-bmp","image/x-win-bitmap","image/x-windows-bmp","image/x-xbitmap"],a[o.GcImageFormat.SVG]=["svg","svg+xml","text/xml-svg","text/xml+svg","image/svg","image/svg-xml","image/svg+xml","image/vnd.adobe.svg+xml"],a[o.GcImageFormat.ICO]=["ico","image/ico","image/x-icon","application/ico","application/x-ico"],a[o.GcImageFormat.GIF]=["gif","image/gi_","image/gif"],a[o.GcImageFormat.JPEG]=["jpg","jpeg","image/jp_","image/jpe_","image/jpg","image/jpeg","image/pipeg","image/pjpeg","application/jpg","application/x-jpg","image/vnd.swiftview-jpeg"],a[o.GcImageFormat.PNG]=["png","image/png","application/png","application/x-png"],a[o.GcImageFormat.WEBP]=["webp","image/webp"]),a),n=function(t){for(var e in r)if(r[e].find((function(e){return e===t})))return{value:1*e}},s=0,u=i;s<u.length;s++){var l=n(u[s]);if("object"==typeof l)return l.value}return e},e.getSupportedImageFormats=function(){var t=document.createElement("canvas"),e=[];return e.push("image/png"),0===t.toDataURL("image/jpeg",1).indexOf("data:image/jpeg")&&e.push("image/jpeg"),0===t.toDataURL("image/webp").indexOf("data:image/webp")&&e.push("image/webp"),e.push("image/gif"),e.push("image/bmp"),0===t.toDataURL("image/tiff").indexOf("data:image/tiff")&&e.push("image/tiff"),t.width=0,t.height=0,e},e.convertImageToFormat=function(t,e){return r(this,void 0,void 0,(function(){var i,a,o,c,h,f,p,d=this;return n(this,(function(m){switch(m.label){case 0:return m.trys.push([0,8,,9]),"image/bmp"!==e?[3,3]:[4,(0,u.imageDataToCanvas)(t)];case 1:return i=m.sent(),[4,s.CanvasToBMPConverter.toBlob(i)];case 2:return a=m.sent(),i.width=0,i.height=0,[2,a];case 3:return"image/gif"===e?[2,new Promise((function(e){return r(d,void 0,void 0,(function(){var i,r;return n(this,(function(n){switch(n.label){case 0:return i=(0,l.createGifEncoder)(),[4,(0,u.imageDataToCanvas)(t)];case 1:return r=n.sent(),i.addFrame(r),i.on("finished",(function(t){r.width=0,r.height=0,e(t)})),i.render(),[2]}}))}))}))]:[4,fetch(t)];case 4:return[4,m.sent().blob()];case 5:return o=m.sent(),c=new Image,h=new Promise((function(t,e){c.onload=t,c.onerror=e})),c.src=URL.createObjectURL(o),[4,h];case 6:return m.sent(),(f=document.createElement("canvas")).width=c.width,f.height=c.height,f.getContext("2d").drawImage(c,0,0,c.width,c.height),p=f.toDataURL(e),[4,fetch(p).then((function(t){return t.blob()}))];case 7:return[2,m.sent()];case 8:throw m.sent();case 9:return[2]}}))}))}},83992:function(t,e,i){"use strict";var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function o(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}u((r=r.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var i,r,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageUtils=e.safePutImageData=e.getImageCanvasFromClipboard=e.copyImageCanvasToClipboard=e.cropImage=e.resizeImageDataUrl=e.resizeImage=e.imageDataToCanvas=e.dataUrlToImage=e.getImageNaturalSize=e.setDpiAdaptiveSize=e.getDpiAdaptiveSize=e.currentDisplayPxPerInch=void 0;var a,o=i(60253);function s(){return((a=document.getElementById("gcdpitest"))||((a=document.createElement("div")).id="gcdpitest",a.style.cssText="z-index: -100; height: 1in; left: -100px; position: absolute; top: -100px; width: 1in; opacity: 0; margin: 0; padding: 0; border: 0;",document.body.appendChild(a)),a).offsetHeight}function u(t,e,i){var r=s(),n=window.devicePixelRatio;return{width:t*r*n/i,height:e*r*n/i}}function l(t,e){var i=u(t.width,t.height,e);t.width=i.width,t.height=i.height}function c(t){return{width:t.naturalWidth||t.offsetWidth,height:t.naturalHeight||t.offsetHeight}}function h(t,e,i,r,n,a){return new Promise((function(o,s){var u=new Image;u.onload=function(){if(!e){e=document.createElement("canvas");var t=c(u);e.style.width=t.width+"px",e.style.height=t.height+"px",e.width=t.width,e.height=t.height}var s=e.getContext("2d");s&&(void 0!==n&&void 0!==a?s.drawImage(u,i||0,r||0,n,a):s.drawImage(u,i||0,r||0),o(e))},u.onerror=function(t){s(t)},u.crossOrigin="anonymous",u.src=t}))}function f(t,e,i,r,n){void 0===n&&(n=!0);var a=e.getContext("2d"),o=t.naturalWidth,s=t.naturalHeight;(n||void 0===r)&&(r=i/(o/s)),e.width=i,e.height=r,a&&a.drawImage(t,0,0,i,r)}function p(t,e,i,a,o){return void 0===o&&(o=!0),r(this,void 0,void 0,(function(){var r,s;return n(this,(function(n){switch(n.label){case 0:return r=document.createElement("canvas"),[4,new Promise((function(n){r.width=e.width,r.height=e.height;var s=new Image;s.onload=function(){f(s,r,i,a,o);try{n(r.toDataURL())}catch(t){n("")}},s.onerror=function(t){n("")},s.crossOrigin="Anonymous";try{s.src=t}catch(t){n("")}}))];case 1:return s=n.sent(),r.width=0,r.height=0,[2,s]}}))}))}function d(t,e,i,r,n,a){var o=e.getContext("2d"),s=t.naturalWidth,u=t.naturalHeight;void 0===a&&(a=n/(s/u)),e.width=n,e.height=a,o&&o.drawImage(t,i,r,n,a,0,0,n,a)}function m(t,e){void 0===e&&(e="image/png"),t.toBlob((function(t){var i;if(t)try{var r=new ClipboardItem(((i={})[e]=t,i));navigator.clipboard.write([r])}catch(t){}}))}function g(t){return void 0===t&&(t="image/png"),r(this,void 0,void 0,(function(){var e,i,r,a,o,s,u;return n(this,(function(l){switch(l.label){case 0:return l.trys.push([0,6,,7]),[4,navigator.clipboard.read()];case 1:e=l.sent(),i=function(e){var i,r,a,o;return n(this,(function(n){switch(n.label){case 0:return[4,e.getType(t)];case 1:return(i=n.sent())?[4,i.arrayBuffer()]:[3,3];case 2:return r=n.sent(),a=new Image,o=new Blob([r],{type:t}),a.src=URL.createObjectURL(o),[2,{value:new Promise((function(t){a.onload=function(){var e=document.createElement("canvas");e.width=a.width,e.height=a.height,e.getContext("2d").drawImage(a,0,0),t(e)}}))}];case 3:return[2]}}))},r=0,a=e,l.label=2;case 2:return r<a.length?(o=a[r],[5,i(o)]):[3,5];case 3:if("object"==typeof(s=l.sent()))return[2,s.value];l.label=4;case 4:return r++,[3,2];case 5:throw new Error("No image found in clipboard.");case 6:throw u=l.sent(),new Error("Failed to get image from clipboard: ".concat(u));case 7:return[2]}}))}))}e.currentDisplayPxPerInch=s,e.getDpiAdaptiveSize=u,e.setDpiAdaptiveSize=l,e.getImageNaturalSize=c,e.dataUrlToImage=function(t){return new Promise((function(e,i){var r=new Image;r.onload=function(){e(r)},r.onerror=function(t){i(t)},r.crossOrigin="anonymous",r.src=t}))},e.imageDataToCanvas=h,e.resizeImage=f,e.resizeImageDataUrl=p,e.cropImage=d,e.copyImageCanvasToClipboard=m,e.getImageCanvasFromClipboard=g,e.safePutImageData=function(t,e,i){return r(this,void 0,void 0,(function(){var r,a,s,u,l,c,h;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,4,,5]),r=t.width,a=t.height,s=t.getContext("2d"),i||o.isMobile.likeMac()?[3,1]:(s.putImageData(e,0,0,0,0,r,a),[3,3]);case 1:return[4,createImageBitmap(e,0,0,r,a)];case 2:if(u=n.sent(),i){for(s.save(),l=0,c=i;l<c.length;l++)h=c[l],s.clip(h);s.drawImage(u,0,0,r,a),s.restore()}else s.drawImage(u,0,0,r,a);n.label=3;case 3:return[2,!0];case 4:return n.sent(),[2,!1];case 5:return[2]}}))}))},e.ImageUtils={cropImage:d,resizeImage:f,resizeImageDataUrl:p,currentDisplayPxPerInch:s,getImageNaturalSize:c,imageDataToCanvas:h,setDpiAdaptiveSize:l,getDpiAdaptiveSize:u,copyImageCanvasToClipboard:m,getImageCanvasFromClipboard:g}},59535:function(t,e){"use strict";var i=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function o(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}u((r=r.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var i,r,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.ResizeCommand=e.CropCommand=e.RotationCommand=e.FlipCommand=void 0;var n=function(){function t(t,e,i){this.horizontal=t,this.vertical=e,this.rotationPlugin=i,this.name="Flip"}return t.prototype.execute=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.rotationPlugin.flip(this.horizontal,this.vertical)];case 1:return t.sent(),[2]}}))}))},t.prototype.undo=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.rotationPlugin.flip(this.horizontal,this.vertical)];case 1:return t.sent(),[2]}}))}))},t}();e.FlipCommand=n;var a=function(){function t(t,e){this.rotation=t,this.rotationPlugin=e,this.name="Rotation"}return t.prototype.execute=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.rotationPlugin.rotate(this.rotation)];case 1:return t.sent(),[2]}}))}))},t.prototype.undo=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.rotationPlugin.rotate(-this.rotation)];case 1:return t.sent(),[2]}}))}))},t}();e.RotationCommand=a;var o=function(){function t(t,e,i,r,n,a){this.x=t,this.y=e,this.width=i,this.height=r,this.originalImageDataUrl=n,this.pageTools=a,this.name="Crop"}return t.prototype.execute=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.pageTools.crop(this.x,this.y,this.width,this.height)];case 1:return t.sent(),[2]}}))}))},t.prototype.undo=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(e){return t.setImageDataUrl(this.originalImageDataUrl),[2]}))}))},t}();e.CropCommand=o;var s=function(){function t(t,e,i,r,n){this.width=t,this.height=e,this.keepAspectRatio=i,this.originalImageDataUrl=r,this.pageTools=n,this.name="Resize"}return t.prototype.execute=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.pageTools.resize(this.width,this.height,this.keepAspectRatio)];case 1:return t.sent(),[2]}}))}))},t.prototype.undo=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,t.setImageDataUrl(this.originalImageDataUrl)];case 1:return e.sent(),[2]}}))}))},t}();e.ResizeCommand=s},93329:function(t,e,i){"use strict";var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function o(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}u((r=r.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var i,r,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.RotationPlugin=e.mirrorImage=void 0;var a=i(83084),o=i(60873),s=i(59535);function u(t){return!1===t?-1:t||0}function l(t,e,i,r,n,a){void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),void 0===a&&(a=!1),t.save(),t.setTransform(n?-1:1,0,0,a?-1:1,i+n?e.width:0,r+a?e.height:0),t.drawImage(e,0,0),t.restore()}e.mirrorImage=l;var c=function(){function t(t){this.id="rotation",t=t||{rotatePosition:1,flipHorizontalPosition:2,flipVerticalPosition:3},this.options=t}return t.prototype.initialize=function(t){this._viewer=t,this._ensureOptions(),t.toolbar.addItem(function(t,e){var i=t.getType("svgIcons");return{key:"rotate-image",icon:{type:"svg",content:i.rotate},title:"Rotate image",checked:!1,enabled:!1,action:function(){e.setRotation(e.getRotation()+90)},onUpdate:function(i){return{title:e.getRotation()?"Rotate image ("+e.getRotation()+"deg)":"Rotate image",enabled:3===i.state.session.status&&t.hasImage&&e.isImageFormatSupported(t.imageFormat)}}}}(t,this)),t.toolbar.addItem(function(t,e){var i=t.getType("svgIcons");return{key:"flip-horizontal",icon:{type:"svg",content:i["flip-horizontal"]},title:"Flip horizontal",checked:!1,enabled:!1,action:function(){e.flipHorizontal()},onUpdate:function(i){return{title:"Flip horizontal",enabled:3===i.state.session.status&&t.hasImage&&e.isImageFormatSupported(t.imageFormat)}}}}(t,this)),t.toolbar.addItem(function(t,e){var i=t.getType("svgIcons");return{key:"flip-vertical",icon:{type:"svg",content:i["flip-vertical"]},title:"Flip vertical",checked:!1,enabled:!1,action:function(){e.flipVertical()},onUpdate:function(i){return{title:"Flip vertical",enabled:3===i.state.session.status&&t.hasImage&&e.isImageFormatSupported(t.imageFormat)}}}}(t,this));var e={"rotate-image":u(this.options.rotatePosition),"flip-horizontal":u(this.options.flipHorizontalPosition),"flip-vertical":u(this.options.flipVerticalPosition)},i=[];for(var r in e)-1!==(n=e[r])&&Number.isFinite(n)&&(i[n]=r);for(var n=0;n<i.length;n++)(r=i[n])&&((t.toolbarLayout.viewer.default||[]).splice(n,0,r),(t.toolbarLayout.viewer.fullscreen||[]).splice(n,0,r),(t.toolbarLayout.viewer.mobile||[]).splice(n,0,r));t.applyToolbarLayout(),t.onBeforeOpen.register(this._onBeforeOpen.bind(this)),this._initialized=!0},t.prototype.dispose=function(){this._initialized&&(this._initialized=!1,this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.default||[],"rotate-image"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.fullscreen||[],"rotate-image"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.mobile||[],"rotate-image"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.default||[],"flip-horizontal"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.fullscreen||[],"flip-horizontal"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.mobile||[],"flip-horizontal"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.default||[],"flip-vertical"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.fullscreen||[],"flip-vertical"),this._removeRotateButtonFromLayout(this._viewer.toolbarLayout.viewer.mobile||[],"flip-vertical"),this._viewer.toolbar.removeItem("rotate-image"),this._viewer.toolbar.removeItem("flip-horizontal"),this._viewer.toolbar.removeItem("flip-vertical"),this._viewer=null,this._originalNaturalSize=null)},t.prototype.getRotation=function(){return this._rotation||0},t.prototype.rotate=function(t){return r(this,void 0,void 0,(function(){return n(this,(function(e){return[2,this.setRotation(this._rotation+t)]}))}))},t.prototype.setRotation=function(t){return r(this,void 0,void 0,(function(){var e;return n(this,(function(i){switch(i.label){case 0:return t%=360,[4,this._rotateImageData(t)];case 1:return(e=i.sent())&&!this._viewer.undoStorage.undoInProgress&&this._viewer.undoStorage.onCommandExecuted(new s.RotationCommand(t,this)),this._rotation=t,[2,e]}}))}))},t.prototype.isImageFormatSupported=function(t){return(t=(0,o.findImageFormat)(t))!==a.GcImageFormat.TIFF&&t!==a.GcImageFormat.SVG&&t!==a.GcImageFormat.ICO&&t!==a.GcImageFormat.GIF},t.prototype.flip=function(t,e){var i=this;return void 0===t&&(t=!0),void 0===e&&(e=!1),new Promise((function(r){var n=i._viewer,a=n.naturalSize,o=document.createElement("canvas");o.width=a.width,o.height=a.height;var u=o.getContext("2d"),c=new Image;c.onload=function(){l(u,c,0,0,t,e);try{var a=n.canvasToDataURL(o);n.setImageDataUrl(a).then((function(){r(!0),i._viewer.undoStorage.undoInProgress||i._viewer.undoStorage.onCommandExecuted(new s.FlipCommand(t,e,i))}))}catch(t){r(!1)}},c.onerror=function(t){r(!1)},c.crossOrigin="Anonymous";try{c.src=n.getImageDataUrl()}catch(t){r(!1)}}))},t.prototype.flipHorizontal=function(){return this.flip(!0,!1)},t.prototype.flipVertical=function(){return this.flip(!1,!0)},t.prototype._removeRotateButtonFromLayout=function(t,e){if(t){var i=t.findIndex((function(t){return t===e}));-1!==i&&t.splice(i,1)}},t.prototype._onBeforeOpen=function(){this._originalNaturalSize=null,this._rotation=0},t.prototype._rotateImageData=function(t){var e=this;return new Promise((function(i){var r=e._viewer,n=e._originalNaturalSize||r.naturalSize;if(e._originalNaturalSize||(e._originalNaturalSize=n),3===r.imageFormat)return alert("Cannot rotate TIFF image."),void i(!1);if(7===r.imageFormat){var a=r.getOriginalImageDataUrl();return t&&(a=a.replace("<svg",'<svg transform="rotate('+t+')"')),r.setImageDataUrl(a),void i(!0)}var o=document.createElement("canvas"),s=e._imageSizeAfterRotation([n.width,n.height],t);o.width=s[0],o.height=s[1];var u=o.getContext("2d");u.translate(o.width/2,o.height/2),u.rotate(t*Math.PI/180);var l=new Image;l.onload=function(){u.drawImage(l,-n.width/2,-n.height/2);try{var t=r.canvasToDataURL(o);r.setImageDataUrl(t),i(!0)}catch(t){alert(t),i(!1)}},l.onerror=function(t){i(!1)},l.crossOrigin="Anonymous";try{l.src=r.getOriginalImageDataUrl()}catch(t){return alert(t),void i(!1)}}))},t.prototype._imageSizeAfterRotation=function(t,e){if((e%=180)<0&&(e=180+e),e>=90&&(t=[t[1],t[0]],e-=90),0===e)return t;var i=e*Math.PI/180;return[t[0]*Math.cos(i)+t[1]*Math.sin(i),t[0]*Math.sin(i)+t[1]*Math.cos(i)]},t.prototype._ensureOptions=function(){var t=this.options||{};void 0===t.rotatePosition&&(t.rotatePosition=1),this.options=t},t}();e.RotationPlugin=c,(window||{}).RotationPlugin=c},52171:t=>{t.exports=function t(e,i,r){function n(o,s){if(!i[o]){if(!e[o]){if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=i[o]={exports:{}};e[o][0].call(l.exports,(function(t){var i=e[o][1][t];return n(i||t)}),l,l.exports,t,e,i,r)}return i[o].exports}for(var a=void 0,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(t,e,i){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function a(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!a(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,i,r,a,u,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(s(i=this._events[t]))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(o(i))for(a=Array.prototype.slice.call(arguments,1),r=(l=i.slice()).length,u=0;u<r;u++)l[u].apply(this,a);return!0},r.prototype.addListener=function(t,e){var i;if(!n(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,n(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.trace),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){if(!n(e))throw TypeError("listener must be a function");var i=!1;function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var i,r,a,s;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(a=(i=this._events[t]).length,r=-1,i===e||n(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(i)){for(s=a;s-- >0;)if(i[s]===e||i[s].listener&&i[s].listener===e){r=s;break}if(r<0)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n(i=this._events[t]))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],2:[function(t,e,i){var r,n,a,o,s;s=navigator.userAgent.toLowerCase(),o=navigator.platform.toLowerCase(),a="ie"===(r=s.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/)||[null,"unknown",0])[1]&&document.documentMode,(n={name:"version"===r[1]?r[3]:r[1],version:a||parseFloat("opera"===r[1]&&r[4]?r[4]:r[2]),platform:{name:s.match(/ip(?:ad|od|hone)/)?"ios":(s.match(/(?:webos|android)/)||o.match(/mac|win|linux/)||["other"])[0]}})[n.name]=!0,n[n.name+parseInt(n.version,10)]=!0,n.platform[n.platform.name]=!0,e.exports=n},{}],3:[function(t,e,i){var r,n,a,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty,u=[].indexOf||function(t){for(var e=0,i=this.length;e<i;e++)if(e in this&&this[e]===t)return e;return-1},l=[].slice;r=t("events").EventEmitter,a=t("./browser.coffee"),n=function(t){var e,i;function r(t){var i,r,n;for(r in this.running=!1,this.options={},this.frames=[],this.freeWorkers=[],this.activeWorkers=[],this.setOptions(t),e)n=e[r],null==(i=this.options)[r]&&(i[r]=n)}return o(r,t),e={workerScript:"gif.worker.js",workers:2,repeat:0,background:"#fff",quality:10,width:null,height:null,transparent:null,debug:!1,dither:!1},i={delay:500,copy:!1},r.prototype.setOption=function(t,e){if(this.options[t]=e,null!=this._canvas&&("width"===t||"height"===t))return this._canvas[t]=e},r.prototype.setOptions=function(t){var e,i,r;for(e in i=[],t)s.call(t,e)&&(r=t[e],i.push(this.setOption(e,r)));return i},r.prototype.addFrame=function(t,e){var r,n;for(n in null==e&&(e={}),(r={}).transparent=this.options.transparent,i)r[n]=e[n]||i[n];if(null==this.options.width&&this.setOption("width",t.width),null==this.options.height&&this.setOption("height",t.height),"undefined"!=typeof ImageData&&null!==ImageData&&t instanceof ImageData)r.data=t.data;else if("undefined"!=typeof CanvasRenderingContext2D&&null!==CanvasRenderingContext2D&&t instanceof CanvasRenderingContext2D||"undefined"!=typeof WebGLRenderingContext&&null!==WebGLRenderingContext&&t instanceof WebGLRenderingContext)e.copy?r.data=this.getContextData(t):r.context=t;else{if(null==t.childNodes)throw new Error("Invalid image");e.copy?r.data=this.getImageData(t):r.image=t}return this.frames.push(r)},r.prototype.render=function(){var t,e,i;if(this.running)throw new Error("Already running");if(null==this.options.width||null==this.options.height)throw new Error("Width and height must be set prior to rendering");if(this.running=!0,this.nextFrame=0,this.finishedFrames=0,this.imageParts=function(){var t,e,i;for(i=[],t=0,e=this.frames.length;0<=e?t<e:t>e;0<=e?++t:--t)i.push(null);return i}.call(this),e=this.spawnWorkers(),!0===this.options.globalPalette)this.renderNextFrame();else for(t=0,i=e;0<=i?t<i:t>i;0<=i?++t:--t)this.renderNextFrame();return this.emit("start"),this.emit("progress",0)},r.prototype.abort=function(){for(var t;null!=(t=this.activeWorkers.shift());)this.log("killing active worker"),t.terminate();return this.running=!1,this.emit("abort")},r.prototype.spawnWorkers=function(){var t,e,i,r;return t=Math.min(this.options.workers,this.frames.length),function(){i=[];for(var r=e=this.freeWorkers.length;e<=t?r<t:r>t;e<=t?r++:r--)i.push(r);return i}.apply(this).forEach((r=this,function(t){var e;return r.log("spawning worker "+t),(e=new Worker(r.options.workerScript)).onmessage=function(t){return r.activeWorkers.splice(r.activeWorkers.indexOf(e),1),r.freeWorkers.push(e),r.frameFinished(t.data)},r.freeWorkers.push(e)})),t},r.prototype.frameFinished=function(t){var e,i;if(this.log("frame "+t.index+" finished - "+this.activeWorkers.length+" active"),this.finishedFrames++,this.emit("progress",this.finishedFrames/this.frames.length),this.imageParts[t.index]=t,!0===this.options.globalPalette&&(this.options.globalPalette=t.globalPalette,this.log("global palette analyzed"),this.frames.length>2))for(e=1,i=this.freeWorkers.length;1<=i?e<i:e>i;1<=i?++e:--e)this.renderNextFrame();return u.call(this.imageParts,null)>=0?this.renderNextFrame():this.finishRendering()},r.prototype.finishRendering=function(){var t,e,i,r,n,a,o,s,u,l,c,h,f,p,d,m;for(s=0,n=0,u=(p=this.imageParts).length;n<u;n++)s+=((e=p[n]).data.length-1)*e.pageSize+e.cursor;for(s+=e.pageSize-e.cursor,this.log("rendering finished - filesize "+Math.round(s/1e3)+"kb"),t=new Uint8Array(s),h=0,a=0,l=(d=this.imageParts).length;a<l;a++)for(i=o=0,c=(m=(e=d[a]).data).length;o<c;i=++o)f=m[i],t.set(f,h),i===e.data.length-1?h+=e.cursor:h+=e.pageSize;return r=new Blob([t],{type:"image/gif"}),this.emit("finished",r,t)},r.prototype.renderNextFrame=function(){var t,e,i;if(0===this.freeWorkers.length)throw new Error("No free workers");if(!(this.nextFrame>=this.frames.length))return t=this.frames[this.nextFrame++],i=this.freeWorkers.shift(),e=this.getTask(t),this.log("starting frame "+(e.index+1)+" of "+this.frames.length),this.activeWorkers.push(i),i.postMessage(e)},r.prototype.getContextData=function(t){return t.getImageData(0,0,this.options.width,this.options.height).data},r.prototype.getImageData=function(t){var e;return null==this._canvas&&(this._canvas=document.createElement("canvas"),this._canvas.width=this.options.width,this._canvas.height=this.options.height),(e=this._canvas.getContext("2d")).setFill=this.options.background,e.fillRect(0,0,this.options.width,this.options.height),e.drawImage(t,0,0),this.getContextData(e)},r.prototype.getTask=function(t){var e,i;if(i={index:e=this.frames.indexOf(t),last:e===this.frames.length-1,delay:t.delay,transparent:t.transparent,width:this.options.width,height:this.options.height,quality:this.options.quality,dither:this.options.dither,globalPalette:this.options.globalPalette,repeat:this.options.repeat,canTransfer:"chrome"===a.name},null!=t.data)i.data=t.data;else if(null!=t.context)i.data=this.getContextData(t.context);else{if(null==t.image)throw new Error("Invalid frame");i.data=this.getImageData(t.image)}return i},r.prototype.log=function(){1<=arguments.length&&l.call(arguments,0),this.options.debug},r}(r),e.exports=n},{"./browser.coffee":2,events:1}]},{},[3])(3)}},e={},function i(r){var n=e[r];if(void 0!==n)return n.exports;var a=e[r]={exports:{}};return t[r].call(a.exports,a,a.exports,i),a.exports}(93329);var t,e})); |
113
README.md
@@ -41,109 +41,16 @@ # Document Solutions Image Viewer | ||
## [7.0.3] - 19-Feb-2024 | ||
### Fixed | ||
- After using the removePlugins API an exception is thrown if an image filter is used. (DOC-6043) | ||
- The paint tools display is incorrect after the image is rotated. (DOC-5603) | ||
- In image filters preview mode, the display is incorrect after zooming the image in and out by mouse. (DOC-5627) | ||
- The default value of 100% for clone stamp opacity does not take effect. (DOC-5625) | ||
- After using the removePlugins API the paint tools icon is still displayed. (DOC-5648) | ||
- [iOS] There are some issues with the horizontal scrollbar. (DOC-4868) | ||
## [7.0.2] - 25-Jan-2024 | ||
### Fixed | ||
- Display error when zooming while using image filters. (DOC-5989) | ||
- Saving a selection produces a black image. (DOC-5748) | ||
- Selection tools' prompts are inconsistent. (DOC-5755) | ||
- [iOS] Image filters do not work. (DOC-5537) | ||
## [7.0.1] - 04-Jan-2024 | ||
### Fixed | ||
- The second toolbar of an image filter is still displayed when the image filter is folded. (DOC-5968) | ||
- An unexpected black area appears after an image is rotated. (DOC-5753) | ||
## [7.0.0] - 07-Dec-2023 | ||
## [7.1.0] - 04-Apr-2024 | ||
### Added | ||
- Added DsImageViewer class and "@mescius/dsimageviewer" package. Functionally DsImageViewer is identical to GcImageViewer. (DOC-5736) | ||
- Brightness filter. (DOC-5656) | ||
- Contrast filter. (DOC-5657) | ||
- Selection tool, used for cut/copy/paste operations and for applying other tools to selection only. (DOC-5658) | ||
### Changed | ||
- [Paint tools] The "Use original image" toggle now only applies to the eraser tool; for other tools this option is disabled and ignored. | ||
- Improvements to image filters' UI and functionality. | ||
- Some tooltips updated. | ||
### Fixed | ||
- Miscellaneous bug fixes. | ||
## [1.2.5] - 22-Nov-2023 | ||
### Fixed | ||
- An unexpected blank toolbar appears after clicking "Toggle FullScreen". (DOC-5768) | ||
## [1.2.4] - 27-Oct-2023 | ||
### Fixed | ||
- Transparent background becomes solid gray when using the text tool. (DOC-5626) | ||
## [1.2.3] - 28-Sep-2023 | ||
### Fixed | ||
- [Windows Touch] Zooming by hand does not work. (DOC-5712) | ||
## [1.2.1] - 17-Aug-2023 | ||
### Fixed | ||
- Improved layout in full screen mode. (DOC-5599) | ||
- Some text is not visible when using the text tools. (DOC-5489) | ||
- [iOS] The expand button of the second toolbar is not visible. (DOC-5617) | ||
## [1.2.0] - 1-Aug-2023 | ||
### Fixed | ||
- Thumbnail image can be dragged to the viewer area. (DOC-5497) | ||
- Several issues with the image filter plugin when using different themes. (DOC-5453) | ||
- [iOS] Zoom factor jitter during two finger pinch gesture. (ARF-4244) | ||
- Miscellaneous UI/behavior improvements. | ||
### Added | ||
- Paint tools plugin (pencil, brush, clone stamp, eraser). (DOC-4973, DOC-4975) | ||
- Text tools plugin. (DOC-4974) | ||
- Added vibrance and saturation to image filters plugin. (DOC-4971, DOC-4972) | ||
- Added "Save changes" confirmation prompts. | ||
- Added imageQuality option: used for image formats that use lossy compression, such as JPEG and WEBP. | ||
The value should be a number between 0 and 1, where 0 represents the lowest, and 1 the highest quality. | ||
If this option is not specified, the default value of 0.92 is used. | ||
Please note that this option only affects image editing capabilities. | ||
- 'Save As' dropdown menu added to the 'Save' button, providing the ability to convert the image to another format. (DOC-5799).\ | ||
The supported formats for conversion include: PNG (image/png), JPEG (image/jpeg), WEBP (image/webp), BMP image/bmp, GIF (image/gif). | ||
Note that WEBP may not be supported on certain platforms, such as Safari for Mac or iOS. | ||
In such cases the 'Save as WEBP' menu item will be hidden. | ||
- The save method has been enhanced to include the ability to specify save options, | ||
allowing you to customize the saving process, including changing the image format via the convertToFormat option. | ||
```javascript | ||
// Example: | ||
var viewer = new GcImageViewer("#root", { | ||
// Set image quality to 50%: | ||
imageQuality: 0.5 | ||
}); | ||
// Example: save the modified image as PNG: | ||
const viewer = DsImageViewer.findControl("#root"); | ||
viewer.save({ convertToFormat: "image/png" }); | ||
``` | ||
## [1.1.5] - 11-Jul-2023 | ||
### Fixed | ||
- Incorrect display of ICO images with Rgb15 frame encoding. (DOC-5084) | ||
## [1.1.3] - 31-May-2023 | ||
### Fixed | ||
- The expand toolbar of second toolbar is not visible in the theme "dark". (DOC-5340) | ||
- Can not add image filter plugin to left side bar again if it was added and removed before. (DOC-5328) | ||
- Add new PageToolsPlugin will affect old PageToolsPlugin. (DOC-5325) | ||
- The ellipsis button should be hidden for PageTools/ImageFilters toolbars. (DOC-5371) | ||
## [1.1.0] - 03-Apr-2023 | ||
### Added | ||
- Added keyboard shortcuts: Undo/Redo: Ctrl+Z/Ctrl+Y, Rotate: R/Shift+R, | ||
Zoom-in/Zoom-out: Ctrl++/Ctrl+-, Zoom to 100%: Ctrl+0, File open: Ctrl+O. | ||
- [Crop/resize tools] Keyboard shortcuts: Ctrl+Enter to apply changes, Esc to cancel. | ||
- [Resize tool] Press and hold Shift to temporarily toggle the 'keep aspect ratio' setting. | ||
- Added the ability to specify a custom renderer function for the second toolbar layout. | ||
```javascript | ||
// Example: | ||
viewer.secondToolbarLayout["hello-world-toolbar-key"] = (toolbarKey: string) => { | ||
return [<div>Hello world, second toolbar key is {toolbarKey}</div>]; | ||
}; | ||
viewer.showSecondToolbar("hello-world-toolbar-key"); | ||
``` | ||
### Changed | ||
- Crop/resize tools improved (got rid of popup dialogs, toolbars changed). (DOC-4970) | ||
### Fixed | ||
- [Image Filters Plugin] Clicking custom image filter plugin has no effect. (DOC-5329) | ||
- [Page Tools Plugin] After several rotations unexpected white space appears. (DOC-5330) | ||
- Miscellaneous minor fixes. | ||
### See __CHANGELOG.​md__ for previous release notes. | ||
@@ -150,0 +57,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { GcImageFormat, GcImageFormatName, LogLevel, OpenParameters } from './Models/Types'; | ||
import { GcImageFormat, GcImageFormatName, LogLevel, OpenParameters, SaveOptions } from './Models/Types'; | ||
//@ts-ignore | ||
@@ -201,4 +201,4 @@ import { EventFan, PluginModel, ReportViewer, Toolbar, ToolbarLayout, ViewerStatus, ZoomMode } from '@grapecity/viewer-core'; | ||
print(): void; | ||
download(fileName?: string, getInitialVersion?: boolean): void; | ||
save(fileName?: string, getInitialVersion?: boolean): void; | ||
download(fileName?: string, original?: boolean): void; | ||
save(options?: string | SaveOptions, original?: boolean): void; | ||
raiseStateChanged(): void; | ||
@@ -270,2 +270,4 @@ get scrollViewElement(): HTMLElement; | ||
'image-filter-tools': JSX.Element; | ||
'filter-blur': JSX.Element; | ||
'filter-pixelate': JSX.Element; | ||
print: JSX.Element; | ||
@@ -297,2 +299,8 @@ 'edit-undo': JSX.Element; | ||
done: JSX.Element; | ||
'file-png': JSX.Element; | ||
'file-jpeg': JSX.Element; | ||
'file-tiff': JSX.Element; | ||
'file-gif': JSX.Element; | ||
'file-bmp': JSX.Element; | ||
'file-webp': JSX.Element; | ||
} | null; | ||
@@ -299,0 +307,0 @@ get plugin(): ImageReportPlugin; |
@@ -12,2 +12,3 @@ /// <reference path="../../vendor/react/react.d.ts" /> | ||
import { GcPanSupport } from '../Utils/GcPanSupport'; | ||
import { GcImageMimeType } from '../Utils/ImageFormatUtils'; | ||
export declare class ImagePaneView extends Component<any, any> { | ||
@@ -88,3 +89,3 @@ private _openParams; | ||
get fileNameExt(): string; | ||
downloadImage(fileName?: string, getInitialVersion?: boolean): void; | ||
downloadImage(fileName?: string, original?: boolean, convertToFormat?: GcImageFormat | GcImageMimeType): Promise<void>; | ||
dispose(): void; | ||
@@ -91,0 +92,0 @@ private openInternal; |
@@ -21,2 +21,3 @@ import { GcImageViewer } from '../GcImageViewer'; | ||
tool_open(): boolean; | ||
tool_save(): boolean; | ||
tool_rotate(): boolean; | ||
@@ -23,0 +24,0 @@ tool_rotateBackward(): boolean; |
@@ -34,3 +34,3 @@ import { IGcImageViewer } from "../Models/IGcImageViewer"; | ||
export declare type PointerTriggerType = "start" | "move" | "end"; | ||
export declare type PaintCommandName = "Pencil" | "Brush" | "Eraser" | "ErasePath2D" | "CloneStamp" | "TextPaintObject" | "UpdateObjectPosition" | "SetObjectProperty" | "DeleteObject" | "CopySelectedRegion" | "UpdateSelectedRegion" | "ResetSelectedRegion" | "CommitSelectedRegionImage"; | ||
export declare type PaintCommandName = "Pencil" | "Brush" | "Eraser" | "ErasePath2D" | "CloneStamp" | "TextPaintObject" | "UpdateObjectPosition" | "SetObjectProperty" | "DeleteObject" | "CopySelectedRegion" | "UpdateSelectedRegion" | "ResetSelectedRegion" | "CommitSelectedRegionImage" | "UndoSequenceMarker"; | ||
export interface IPaintDesignerContext { | ||
@@ -37,0 +37,0 @@ getPaintObjectDesigners(): any[]; |
@@ -25,3 +25,3 @@ //@ts-ignore | ||
import { IGcSelectionBox, PointLocation, Size } from "./SelectionBoxTypes"; | ||
import { GcImageFormat } from "./Types"; | ||
import { GcImageFormat, SaveOptions } from "./Types"; | ||
export interface IGcImageViewer { | ||
@@ -41,2 +41,3 @@ pluginPanels: { | ||
layoutPanels(layout: string[]): void; | ||
save(options?: string | SaveOptions, original?: boolean): void; | ||
get isFullscreen(): boolean; | ||
@@ -43,0 +44,0 @@ toggleFullscreen(fullscreen?: boolean): void; |
//@ts-ignore | ||
import { CancellationToken, PluginModel } from "@grapecity/viewer-core"; | ||
import { GcImageMimeType } from "../Utils/ImageFormatUtils"; | ||
export declare type GcImageFormatName = "jpg" | "png" | "tiff" | "gif" | "bmp" | "ico" | "svg" | "webp"; | ||
@@ -46,2 +47,13 @@ export declare enum GcImageFormat { | ||
}; | ||
export declare type KeyboardShortcutTool = "zoomIn" | "zoomOut" | "zoomActualSize" | "zoomPageWidth" | "rotate" | "rotateBackward" | "open" | "print" | "undo" | "redo" | "confirmChanges" | "cancelChanges"; | ||
export declare type KeyboardShortcutTool = "zoomIn" | "zoomOut" | "zoomActualSize" | "zoomPageWidth" | "rotate" | "rotateBackward" | "open" | "print" | "undo" | "redo" | "confirmChanges" | "cancelChanges" | "save"; | ||
export declare type SaveOptions = { | ||
convertToFormat?: GcImageFormat | GcImageMimeType; | ||
fileName?: string; | ||
original?: boolean; | ||
}; | ||
export declare type SaveAsMenuOptions = { | ||
availableFormats?: GcImageMimeType[]; | ||
}; | ||
export declare type SaveButtonOptions = { | ||
saveAsMenu?: boolean | SaveAsMenuOptions; | ||
} & SaveOptions; |
@@ -42,2 +42,4 @@ export declare const propertyEditorIcons: { | ||
'image-filter-tools': JSX.Element; | ||
'filter-blur': JSX.Element; | ||
'filter-pixelate': JSX.Element; | ||
print: JSX.Element; | ||
@@ -69,2 +71,8 @@ 'edit-undo': JSX.Element; | ||
done: JSX.Element; | ||
'file-png': JSX.Element; | ||
'file-jpeg': JSX.Element; | ||
'file-tiff': JSX.Element; | ||
'file-gif': JSX.Element; | ||
'file-bmp': JSX.Element; | ||
'file-webp': JSX.Element; | ||
}; | ||
@@ -71,0 +79,0 @@ export declare type SvgIconKey = 'about' | 'download' | 'flip-horizontal' | 'flip-vertical' | 'magnify-minus-outline' | 'magnify-plus-outline' | 'magnify' | 'open' | 'print' | 'rotate' | 'edit-undo' | 'edit-redo'; |
import { GcImageFormat } from "../Models/Types"; | ||
export declare type GcImageMimeType = 'image/png' | 'image/x-png' | 'image/jpeg' | 'image/bmp' | 'image/gif' | 'image/webp' | 'image/svg+xml' | 'image/ico' | 'image/tiff'; | ||
export declare function imageFormatToMimeType(imageFormat: GcImageFormat): GcImageMimeType; | ||
export declare function mimeTypeToImageFormat(mimeType: GcImageMimeType, defaultFormat?: GcImageFormat): GcImageFormat; | ||
export declare function fileNameWithoutExt(filename: string, maxExtLen?: number): string; | ||
export declare function imageFormatToFileExt(imageFormat?: GcImageFormat): string; | ||
export declare function findImageFormat(fileOrName: GcImageFormat | File | Uint8Array | string, defaultImageFormat?: GcImageFormat): GcImageFormat; | ||
export declare function getSupportedImageFormats(): GcImageMimeType[]; | ||
export declare function convertImageToFormat(imageUrl: string, targetMimeType: GcImageMimeType): Promise<Blob>; |
@@ -22,3 +22,3 @@ import { GcImageMimeType } from "./ImageFormatUtils"; | ||
export declare function getImageCanvasFromClipboard(imageType?: GcImageMimeType): Promise<HTMLCanvasElement>; | ||
export declare function safePutImageData(canvas: HTMLCanvasElement, imageData: ImageData): Promise<boolean>; | ||
export declare function safePutImageData(canvas: HTMLCanvasElement, imageData: ImageData, clipPaths?: Path2D[]): Promise<boolean>; | ||
export declare const ImageUtils: { | ||
@@ -25,0 +25,0 @@ cropImage: typeof cropImage; |
import { GifOptions } from "./ImagePanel/Gif/types"; | ||
import { KeyboardShortcutDefinition, LogLevel, OpenParameters } from "./Models/Types"; | ||
import { KeyboardShortcutDefinition, LogLevel, OpenParameters, SaveButtonOptions } from "./Models/Types"; | ||
import { UndoStorageOptions } from "./Undo/types"; | ||
@@ -21,2 +21,3 @@ export declare class ViewerOptions { | ||
onInitialized?: (viewer: any) => void; | ||
saveButton?: SaveButtonOptions; | ||
theme?: string | false; | ||
@@ -23,0 +24,0 @@ requireTheme?: "gc-blue" | "viewer" | "dark" | "dark-yellow" | "light" | "light-blue" | null; |
@@ -8,2 +8,3 @@ import { PaintCommandName, PointerTriggerType } from "../../../ImageViewer/Layers/types"; | ||
y: number; | ||
resetCopiedImage: boolean; | ||
name: PaintCommandName; | ||
@@ -13,4 +14,4 @@ point: PointLocation; | ||
opacity?: number; | ||
constructor(clippedCanvas: HTMLCanvasElement, x: number, y: number); | ||
constructor(clippedCanvas: HTMLCanvasElement, x: number, y: number, resetCopiedImage: boolean); | ||
execute(mainCtx: CanvasRenderingContext2D, backCtx: CanvasRenderingContext2D, options: PaintExecuteOptions): void; | ||
} |
@@ -18,2 +18,3 @@ /// <reference path="../../vendor/react/react.d.ts" /> | ||
import { SelectedRegionsDispatcher } from './Tools/SelectedRegionsDispatcher'; | ||
import { InternalFilterName } from './Tools/InternalFilters'; | ||
export declare class PaintToolbar extends Component<PaintToolbarProps, PaintToolbarState> implements IViewerTransactionSupport, IPaintDesignerContext { | ||
@@ -119,3 +120,2 @@ static instances: { | ||
pasteSelectedRegions(): void; | ||
onDeleteKeyDown(): Promise<void>; | ||
executePaintCommand(cmd: IPaintCommand | null, mainCtx?: CanvasRenderingContext2D, backCtx?: CanvasRenderingContext2D): void; | ||
@@ -126,3 +126,3 @@ storePaintCommand(cmd: IPaintCommand): void; | ||
isObjectCommand(cmd?: IPaintCommand): boolean; | ||
shouldBreakUndoSequence(cmd?: IPaintCommand, prevCmdName?: PaintCommandName): boolean; | ||
shouldBreakUndoSequence(cmd: IPaintCommand | undefined, prevCmdName: PaintCommandName | undefined, sharedHeap: any): boolean; | ||
undoPaint(): Promise<void>; | ||
@@ -190,4 +190,6 @@ redoPaint(): Promise<void>; | ||
onPaste(): void; | ||
applyRegionFilter(filter: InternalFilterName, intencityPercentage?: number): Promise<void>; | ||
onDeleteKeyDown(): Promise<void>; | ||
private _unbindEvents; | ||
} | ||
export declare function renderPenWidthComboBox(controlWidth: number, pencilWidthValue: number | string | undefined, in17n: any, onSelect: (value: any, dirty: boolean) => void, refCallback: LegacyRef<ComboBox>, size?: Size, disabled?: boolean): JSX.Element; |
@@ -7,7 +7,4 @@ /// <reference path="../../vendor/i18next.d.ts" /> | ||
import { IGcImageViewer } from "../../ImageViewer/Models/IGcImageViewer"; | ||
import { PaintToolsPluginOptions } from "./PaintToolsPluginOptions"; | ||
export declare function mirrorImage(ctx: CanvasRenderingContext2D, image: HTMLImageElement, x?: number, y?: number, horizontal?: boolean, vertical?: boolean): void; | ||
export declare type PaintToolsPluginOptions = { | ||
buttonPosition?: number | false; | ||
fontNames?: string[]; | ||
}; | ||
export declare class PaintToolsPlugin { | ||
@@ -14,0 +11,0 @@ readonly id: string; |
@@ -28,3 +28,3 @@ import { IPaintObject, PaintObjectPropertyName } from "../../../ImageViewer/Layers/types"; | ||
pasteCopiedImage(location?: PointLocation): void; | ||
createClippedCanvas(): HTMLCanvasElement; | ||
createClippedCanvas(selectionToolType?: SelectionToolType): HTMLCanvasElement; | ||
get closed(): boolean; | ||
@@ -55,4 +55,4 @@ set closed(closed: boolean); | ||
_marchAnimation(): void; | ||
getSelectedPaths(relativeToBounds?: boolean): Path2D[]; | ||
createSelectionPaths(relativeToBounds?: boolean): Path2D[]; | ||
getSelectedPaths(relativeToBounds?: boolean, selectionToolType?: SelectionToolType): Path2D[]; | ||
createSelectionPaths(relativeToBounds?: boolean, selectionToolType?: SelectionToolType): Path2D[]; | ||
get imagePaneView(): HTMLElement; | ||
@@ -59,0 +59,0 @@ private _createUIControls; |
@@ -5,2 +5,3 @@ import { PointLocation } from "../../../ImageViewer/Models/SelectionBoxTypes"; | ||
import { SelectedRegionState, SelectionToolType } from "./../Tools/Types"; | ||
import { InternalFilterName } from "./InternalFilters"; | ||
export declare class SelectedRegionsDispatcher { | ||
@@ -13,2 +14,3 @@ context: PaintToolbar; | ||
get hasUnclosedRegion(): boolean; | ||
applyRegionFilter(name: InternalFilterName, intencityPercentage?: number): Promise<boolean>; | ||
execCopy(): boolean; | ||
@@ -15,0 +17,0 @@ copyImage(copiedImage?: HTMLCanvasElement): void; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
10248867
283
16806
104
8