Y-SLD/assets/playkit/vendor/blueimp-file-upload/js/load-image.all.min.js

2 lines
17 KiB
JavaScript
Raw Permalink Normal View History

2024-03-01 11:23:55 +00:00
!function(e){"use strict";function t(e,i,o){var a,n=document.createElement("img");return n.onerror=function(a){return t.onerror(n,a,e,i,o)},n.onload=function(a){return t.onload(n,a,e,i,o)},"string"==typeof e?(t.fetchBlob(e,function(i){i?(e=i,a=t.createObjectURL(e)):(a=e,o&&o.crossOrigin&&(n.crossOrigin=o.crossOrigin)),n.src=a},o),n):t.isInstanceOf("Blob",e)||t.isInstanceOf("File",e)?(a=n._objectURL=t.createObjectURL(e),a?(n.src=a,n):t.readFile(e,function(e){var t=e.target;t&&t.result?n.src=t.result:i&&i(e)})):void 0}function i(e,i){!e._objectURL||i&&i.noRevoke||(t.revokeObjectURL(e._objectURL),delete e._objectURL)}var o=window.createObjectURL&&window||window.URL&&URL.revokeObjectURL&&URL||window.webkitURL&&webkitURL;t.fetchBlob=function(e,t,i){t()},t.isInstanceOf=function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},t.transform=function(e,t,i,o,a){i(e,a)},t.onerror=function(e,t,o,a,n){i(e,n),a&&a.call(e,t)},t.onload=function(e,o,a,n,r){i(e,r),n&&t.transform(e,r,n,a,{})},t.createObjectURL=function(e){return!!o&&o.createObjectURL(e)},t.revokeObjectURL=function(e){return!!o&&o.revokeObjectURL(e)},t.readFile=function(e,t,i){if(window.FileReader){var o=new FileReader;if(o.onload=o.onerror=t,i=i||"readAsDataURL",o[i])return o[i](e),o}return!1},"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:e.loadImage=t}(window),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image"],e):e("object"==typeof module&&module.exports?require("./load-image"):window.loadImage)}(function(e){"use strict";var t=e.transform;e.transform=function(i,o,a,n,r){t.call(e,e.scale(i,o,r),o,a,n,r)},e.transformCoordinates=function(){},e.getTransformedOptions=function(e,t){var i,o,a,n,r=t.aspectRatio;if(!r)return t;i={};for(o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);return i.crop=!0,a=e.naturalWidth||e.width,n=e.naturalHeight||e.height,a/n>r?(i.maxWidth=n*r,i.maxHeight=n):(i.maxWidth=a,i.maxHeight=a/r),i},e.renderImageToCanvas=function(e,t,i,o,a,n,r,s,l,d){return e.getContext("2d").drawImage(t,i,o,a,n,r,s,l,d),e},e.hasCanvasOption=function(e){return e.canvas||e.crop||!!e.aspectRatio},e.scale=function(t,i,o){function a(){var e=Math.max((l||v)/v,(d||w)/w);e>1&&(v*=e,w*=e)}function n(){var e=Math.min((r||v)/v,(s||w)/w);e<1&&(v*=e,w*=e)}i=i||{};var r,s,l,d,c,u,f,g,h,m,p,S=document.createElement("canvas"),b=t.getContext||e.hasCanvasOption(i)&&S.getContext,x=t.naturalWidth||t.width,y=t.naturalHeight||t.height,v=x,w=y;if(b&&(i=e.getTransformedOptions(t,i,o),f=i.left||0,g=i.top||0,i.sourceWidth?(c=i.sourceWidth,void 0!==i.right&&void 0===i.left&&(f=x-c-i.right)):c=x-f-(i.right||0),i.sourceHeight?(u=i.sourceHeight,void 0!==i.bottom&&void 0===i.top&&(g=y-u-i.bottom)):u=y-g-(i.bottom||0),v=c,w=u),r=i.maxWidth,s=i.maxHeight,l=i.minWidth,d=i.minHeight,b&&r&&s&&i.crop?(v=r,w=s,p=c/u-r/s,p<0?(u=s*c/r,void 0===i.top&&void 0===i.bottom&&(g=(y-u)/2)):p>0&&(c=r*u/s,void 0===i.left&&void 0===i.right&&(f=(x-c)/2))):((i.contain||i.cover)&&(l=r=r||l,d=s=s||d),i.cover?(n(),a()):(a(),n())),b){if(h=i.pixelRatio,h>1&&(S.style.width=v+"px",S.style.height=w+"px",v*=h,w*=h,S.getContext("2d").scale(h,h)),m=i.downsamplingRatio,m>0&&m<1&&v<c&&w<u)for(;c*m>v;)S.width=c*m,S.height=u*m,e.renderImageToCanvas(S,t,f,g,c,u,0,0,S.width,S.height),f=0,g=0,c=S.width,u=S.height,t=document.createElement("canvas"),t.width=c,t.height=u,e.renderImageToCanvas(t,S,0,0,c,u,0,0,c,u);return S.width=v,S.height=w,e.transformCoordinates(S,i),e.renderImageToCanvas(S,t,f,g,c,u,0,0,v,w)}return t.width=v,t.height=w,t}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image"],e):e("object"==typeof module&&module.exports?require("./load-image"):window.loadImage)}(function(e){"use strict";var t=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);e.blobSlice=t&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},e.metaDataParsers={jpeg:{65505:[]}},e.parseMetaData=function(t,i,o,a){o=o||{},a=a||{};va
//# sourceMappingURL=load-image.all.min.js.map