text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("exifr",["exports"],t):t((e=e||self).exifr={})}(this,(function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}});var n=["prototype","__proto__","caller","arguments","length","name"];Object.getOwnPropertyNames(t).forEach((function(r){-1===n.indexOf(r)&&e[r]!==t[r]&&(e[r]=t[r])})),t&&o(e,t)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function f(e,t,n){return(f=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&o(i,n.prototype),i}).apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return f(e,arguments,s(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,e)})(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function d(e,t,n){return(d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=s(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}var p=Object.values||function(e){var t=[];for(var n in e)t.push(e[n]);return t},v=Object.entries||function(e){var t=[];for(var n in e)t.push([n,e[n]]);return t},g=Object.assign||function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach((function(t){for(var n in t)e[n]=t[n]})),e},y=Object.fromEntries||function(e){var t={};return m(e).forEach((function(e){var n=e[0],r=e[1];t[n]=r})),t},m=Array.from||function(e){if(e instanceof w){var t=[];return e.forEach((function(e,n){return t.push([n,e])})),t}return Array.prototype.slice.call(e)};function k(e){return-1!==this.indexOf(e)}Array.prototype.includes||(Array.prototype.includes=k),String.prototype.includes||(String.prototype.includes=k),String.prototype.startsWith||(String.prototype.startsWith=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.substring(t,t+e.length)===e}),String.prototype.endsWith||(String.prototype.endsWith=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return this.substring(t-e.length,t)===e});var b="undefined"!=typeof self?self:global,S=b.fetch||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,r){var i=new XMLHttpRequest;if(i.open("get",e,!0),i.responseType="arraybuffer",i.onerror=r,t.headers)for(var a in t.headers)i.setRequestHeader(a,t.headers[a]);i.onload=function(){n({ok:i.status>=200&&i.status<300,status:i.status,arrayBuffer:function(){return Promise.resolve(i.response)}})},i.send(null)}))},A=function(e){var t=[];if(Object.defineProperties(t,{size:{get:function(){return this.length}},has:{value:function(e){return-1!==this.indexOf(e)}},add:{value:function(e){this.has(e)||this.push(e)}},delete:{value:function(e){if(this.has(e)){var t=this.indexOf(e);this.splice(t,1)}}}}),Array.isArray(e))for(var n=0;n<e.length;n++)t.add(e[n]);return t},P=function(e){return new w(e)},w=void 0!==b.Map&&void 0!==b.Map.prototype.keys?b.Map:function(){function e(n){if(t(this,e),this.clear(),n)for(var r=0;r<n.length;r++)this.set(n[r][0],n[r][1])}return r(e,[{key:"clear",value:function(){this._map={},this._keys=[]}},{key:"get",value:function(e){return this._map["map_"+e]}},{key:"set",value:function(e,t){return this._map["map_"+e]=t,this._keys.indexOf(e)<0&&this._keys.push(e),this}},{key:"has",value:function(e){return this._keys.indexOf(e)>=0}},{key:"delete",value:function(e){var t=this._keys.indexOf(e);return!(t<0)&&(delete this._map["map_"+e],this._keys.splice(t,1),!0)}},{key:"keys",value:function(){return this._keys.slice(0)}},{key:"values",value:function(){var e=this;return this._keys.map((function(t){return e.get(t)}))}},{key:"entries",value:function(){var e=this;return this._keys.map((function(t){return[t,e.get(t)]}))}},{key:"forEach",value:function(e,t){for(var n=0;n<this._keys.length;n++)e.call(t,this._map["map_"+this._keys[n]],this._keys[n],this)}},{key:"size",get:function(){return this._keys.length}}]),e}(),O="undefined"!=typeof self?self:global,C="undefined"!=typeof navigator,x=C&&"undefined"==typeof HTMLImageElement,B=!("undefined"==typeof global||"undefined"==typeof process||!process.versions||!process.versions.node),U=O.Buffer,I=O.BigInt,F=!!U;function L(e){return D(e)?void 0:e}var j=function(e){return void 0!==e};function D(e){return void 0===e||(e instanceof w?0===e.size:0===p(e).filter(j).length)}function T(e){var t=new Error(e);throw delete t.stack,t}function _(e){return""===(e=function(e){for(;e.endsWith("\0");)e=e.slice(0,-1);return e}(e).trim())?void 0:e}function z(e){var t=function(e){var t=0;return e.ifd0.enabled&&(t+=1024),e.exif.enabled&&(t+=2048),e.makerNote&&(t+=2048),e.userComment&&(t+=1024),e.gps.enabled&&(t+=512),e.interop.enabled&&(t+=100),e.ifd1.enabled&&(t+=1024),t+2048}(e);return e.jfif.enabled&&(t+=50),e.xmp.enabled&&(t+=2e4),e.iptc.enabled&&(t+=14e3),e.icc.enabled&&(t+=6e3),t}var V="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):void 0;function R(e){return V?V.decode(e):F?Buffer.from(e).toString("utf8"):decodeURIComponent(escape(String.fromCharCode.apply(null,e)))}var E=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;if(t(this,e),"boolean"==typeof a&&(this.le=a),Array.isArray(n)&&(n=new Uint8Array(n)),0===n)this.byteOffset=0,this.byteLength=0;else if(n instanceof ArrayBuffer){void 0===i&&(i=n.byteLength-r);var s=new DataView(n,r,i);this._swapDataView(s)}else if(n instanceof Uint8Array||n instanceof DataView||n instanceof e){void 0===i&&(i=n.byteLength-r),(r+=n.byteOffset)+i>n.byteOffset+n.byteLength&&T("Creating view outside of available memory in ArrayBuffer");var o=new DataView(n.buffer,r,i);this._swapDataView(o)}else if("number"==typeof n){var u=new DataView(new ArrayBuffer(n));this._swapDataView(u)}else T("Invalid input argument for BufferView: "+n)}return r(e,null,[{key:"from",value:function(t,n){return t instanceof this&&t.le===n?t:new e(t,void 0,void 0,n)}}]),r(e,[{key:"_swapArrayBuffer",value:function(e){this._swapDataView(new DataView(e))}},{key:"_swapBuffer",value:function(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}},{key:"_swapDataView",value:function(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}},{key:"_lengthToEnd",value:function(e){return this.byteLength-e}},{key:"set",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;t instanceof DataView||t instanceof e?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t instanceof Uint8Array||T("BufferView.set(): Invalid data argument.");var i=this.toUint8();return i.set(t,n),new r(this,n,t.byteLength)}},{key:"subarray",value:function(t,n){return new e(this,t,n=n||this._lengthToEnd(t))}},{key:"toUint8",value:function(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}},{key:"getUint8Array",value:function(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}},{key:"getString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.byteLength,n=this.getUint8Array(e,t);return R(n)}},{key:"getUnicodeString",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.byteLength,n=[],r=0;r<t&&e+r<this.byteLength;r+=2)n.push(this.getUint16(e+r));return n.map((function(e){return String.fromCharCode(e)})).join("")}},{key:"getInt8",value:function(e){return this.dataView.getInt8(e)}},{key:"getUint8",value:function(e){return this.dataView.getUint8(e)}},{key:"getInt16",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getInt16(e,t)}},{key:"getInt32",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getInt32(e,t)}},{key:"getUint16",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getUint16(e,t)}},{key:"getUint32",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getUint32(e,t)}},{key:"getFloat32",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getFloat32(e,t)}},{key:"getFloat64",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getFloat64(e,t)}},{key:"getFloat",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getFloat32(e,t)}},{key:"getDouble",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getFloat64(e,t)}},{key:"getUintBytes",value:function(e,t,n){switch(t){case 1:return this.getUint8(e,n);case 2:return this.getUint16(e,n);case 4:return this.getUint32(e,n);case 8:return this.getUint64&&this.getUint64(e,n)}}},{key:"getUint",value:function(e,t,n){switch(t){case 8:return this.getUint8(e,n);case 16:return this.getUint16(e,n);case 32:return this.getUint32(e,n);case 64:return this.getUint64&&this.getUint64(e,n)}}},{key:"toString",value:function(e){return this.dataView.toString(e,this.constructor.name)}},{key:"ensureChunk",value:function(){}}]),e}();function N(e,t){T("".concat(e," '").concat(t,"' was not loaded, try using full build of exifr."))}var M=function(e){function n(e){var r;return t(this,n),(r=l(this,s(n).call(this))).kind=e,r}return a(n,e),r(n,[{key:"get",value:function(e,t){return this.has(e)||N(this.kind,e),t&&(e in t||function(e,t){T("Unknown ".concat(e," '").concat(t,"'."))}(this.kind,e),t[e].enabled||N(this.kind,e)),d(s(n.prototype),"get",this).call(this,e)}},{key:"keyList",value:function(){return m(this.keys())}}]),n}(c(w)),G=new M("file parser"),H=new M("segment parser"),W=new M("file reader");function K(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function X(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var Y=K((function(e){return new Promise((function(t,n){var r=new FileReader;r.onloadend=function(){return t(r.result||new ArrayBuffer)},r.onerror=n,r.readAsArrayBuffer(e)}))})),q=K((function(e){return S(e).then((function(e){return e.arrayBuffer()}))})),J=K((function(e,t){return X(t(e),(function(e){return new E(e)}))})),Z=K((function(e,t,n){var r=new(W.get(n))(e,t);return X(r.read(),(function(){return r}))})),Q=K((function(e,t,n,r){return W.has(n)?Z(e,t,n):r?J(e,r):(T("Parser ".concat(n," is not loaded")),X())}));function $(e,t){return(n=e).startsWith("data:")||n.length>1e4?Z(e,t,"base64"):C?Q(e,t,"url",q):B?Z(e,t,"fs"):void T("Invalid input argument");var n}var ee=function(e){function n(){return t(this,n),l(this,s(n).apply(this,arguments))}return a(n,e),r(n,[{key:"tagKeys",get:function(){return this.allKeys||(this.allKeys=m(this.keys())),this.allKeys}},{key:"tagValues",get:function(){return this.allValues||(this.allValues=m(this.values())),this.allValues}}]),n}(c(w));function te(e,t,n){var r=new ee,i=n;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=m(i));for(var a=0;a<i.length;a++){var s=i[a],o=s[0],u=s[1];r.set(o,u)}if(Array.isArray(t)){var f=t;Array.isArray(f)||("function"==typeof f.entries&&(f=f.entries()),f=m(f));for(var c=0;c<f.length;c++){var h=f[c];e.set(h,r)}}else e.set(t,r);return r}function ne(e,t,n){var r,i=e.get(t),a=n;Array.isArray(a)||("function"==typeof a.entries&&(a=a.entries()),a=m(a));for(var s=0;s<a.length;s++)r=a[s],i.set(r[0],r[1])}var re=P(),ie=P(),ae=P(),se=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],oe=["jfif","xmp","icc","iptc","ihdr"],ue=["tiff"].concat(oe),fe=["ifd0","ifd1","exif","gps","interop"],ce=[].concat(ue,fe),he=["makerNote","userComment"],le=["translateKeys","translateValues","reviveValues","multiSegment"],de=[].concat(le,["sanitize","mergeOutput","silentErrors"]),pe=function(){function e(){t(this,e)}return r(e,[{key:"translate",get:function(){return this.translateKeys||this.translateValues||this.reviveValues}}]),e}(),ve=function(e){function n(e,r,a,o){var u;if(t(this,n),i(h(u=l(this,s(n).call(this))),"enabled",!1),i(h(u),"skip",A()),i(h(u),"pick",A()),i(h(u),"deps",A()),i(h(u),"translateKeys",!1),i(h(u),"translateValues",!1),i(h(u),"reviveValues",!1),u.key=e,u.enabled=r,u.parse=u.enabled,u.applyInheritables(o),u.canBeFiltered=fe.includes(e),u.canBeFiltered&&(u.dict=re.get(e)),void 0!==a)if(Array.isArray(a))u.parse=u.enabled=!0,u.canBeFiltered&&a.length>0&&u.translateTagSet(a,u.pick);else if("object"==typeof a){if(u.enabled=!0,u.parse=!1!==a.parse,u.canBeFiltered){var f=a.pick,c=a.skip;f&&f.length>0&&u.translateTagSet(f,u.pick),c&&c.length>0&&u.translateTagSet(c,u.skip)}u.applyInheritables(a)}else!0===a||!1===a?u.parse=u.enabled=a:T("Invalid options argument: ".concat(a));return u}return a(n,e),r(n,[{key:"needed",get:function(){return this.enabled||this.deps.size>0}}]),r(n,[{key:"applyInheritables",value:function(e){var t,n,r=le;Array.isArray(r)||("function"==typeof r.entries&&(r=r.entries()),r=m(r));for(var i=0;i<r.length;i++)void 0!==(n=e[t=r[i]])&&(this[t]=n)}},{key:"translateTagSet",value:function(e,t){if(this.dict){var n,r,i=this.dict,a=i.tagKeys,s=i.tagValues,o=e;Array.isArray(o)||("function"==typeof o.entries&&(o=o.entries()),o=m(o));for(var u=0;u<o.length;u++)"string"==typeof(n=o[u])?(-1===(r=s.indexOf(n))&&(r=a.indexOf(Number(n))),-1!==r&&t.add(Number(a[r]))):t.add(n)}else{var f=e;Array.isArray(f)||("function"==typeof f.entries&&(f=f.entries()),f=m(f));for(var c=0;c<f.length;c++){var h=f[c];t.add(h)}}}},{key:"finalizeFilters",value:function(){!this.enabled&&this.deps.size>0?(this.enabled=!0,Se(this.pick,this.deps)):this.enabled&&this.pick.size>0&&Se(this.pick,this.deps)}}]),n}(pe),ge={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},ye=P(),me=function(e){function n(e){var r;return t(this,n),r=l(this,s(n).call(this)),!0===e?r.setupFromTrue():void 0===e?r.setupFromUndefined():Array.isArray(e)?r.setupFromArray(e):"object"==typeof e?r.setupFromObject(e):T("Invalid options argument ".concat(e)),void 0===r.firstChunkSize&&(r.firstChunkSize=C?r.firstChunkSizeBrowser:r.firstChunkSizeNode),r.mergeOutput&&(r.ifd1.enabled=!1),r.filterNestedSegmentTags(),r.traverseTiffDependencyTree(),r.checkLoadedPlugins(),r}return a(n,e),r(n,null,[{key:"useCached",value:function(e){var t=ye.get(e);return void 0!==t?t:(t=new this(e),ye.set(e,t),t)}}]),r(n,[{key:"setupFromUndefined",value:function(){var e,t=se;Array.isArray(t)||("function"==typeof t.entries&&(t=t.entries()),t=m(t));for(var n=0;n<t.length;n++)this[e=t[n]]=ge[e];var r=de;Array.isArray(r)||("function"==typeof r.entries&&(r=r.entries()),r=m(r));for(var i=0;i<r.length;i++)this[e=r[i]]=ge[e];var a=he;Array.isArray(a)||("function"==typeof a.entries&&(a=a.entries()),a=m(a));for(var s=0;s<a.length;s++)this[e=a[s]]=ge[e];var o=ce;Array.isArray(o)||("function"==typeof o.entries&&(o=o.entries()),o=m(o));for(var u=0;u<o.length;u++)this[e=o[u]]=new ve(e,ge[e],void 0,this)}},{key:"setupFromTrue",value:function(){var e,t=se;Array.isArray(t)||("function"==typeof t.entries&&(t=t.entries()),t=m(t));for(var n=0;n<t.length;n++)this[e=t[n]]=ge[e];var r=de;Array.isArray(r)||("function"==typeof r.entries&&(r=r.entries()),r=m(r));for(var i=0;i<r.length;i++)this[e=r[i]]=ge[e];var a=he;Array.isArray(a)||("function"==typeof a.entries&&(a=a.entries()),a=m(a));for(var s=0;s<a.length;s++)this[e=a[s]]=!0;var o=ce;Array.isArray(o)||("function"==typeof o.entries&&(o=o.entries()),o=m(o));for(var u=0;u<o.length;u++)this[e=o[u]]=new ve(e,!0,void 0,this)}},{key:"setupFromArray",value:function(e){var t,n=se;Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=m(n));for(var r=0;r<n.length;r++)this[t=n[r]]=ge[t];var i=de;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=m(i));for(var a=0;a<i.length;a++)this[t=i[a]]=ge[t];var s=he;Array.isArray(s)||("function"==typeof s.entries&&(s=s.entries()),s=m(s));for(var o=0;o<s.length;o++)this[t=s[o]]=ge[t];var u=ce;Array.isArray(u)||("function"==typeof u.entries&&(u=u.entries()),u=m(u));for(var f=0;f<u.length;f++)this[t=u[f]]=new ve(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,fe)}},{key:"setupFromObject",value:function(e){var t;fe.ifd0=fe.ifd0||fe.image,fe.ifd1=fe.ifd1||fe.thumbnail,g(this,e);var n=se;Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=m(n));for(var r=0;r<n.length;r++)this[t=n[r]]=be(e[t],ge[t]);var i=de;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=m(i));for(var a=0;a<i.length;a++)this[t=i[a]]=be(e[t],ge[t]);var s=he;Array.isArray(s)||("function"==typeof s.entries&&(s=s.entries()),s=m(s));for(var o=0;o<s.length;o++)this[t=s[o]]=be(e[t],ge[t]);var u=ue;Array.isArray(u)||("function"==typeof u.entries&&(u=u.entries()),u=m(u));for(var f=0;f<u.length;f++)this[t=u[f]]=new ve(t,ge[t],e[t],this);var c=fe;Array.isArray(c)||("function"==typeof c.entries&&(c=c.entries()),c=m(c));for(var h=0;h<c.length;h++)this[t=c[h]]=new ve(t,ge[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,fe,ce),!0===e.tiff?this.batchEnableWithBool(fe,!0):!1===e.tiff?this.batchEnableWithUserValue(fe,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,fe):"object"==typeof e.tiff&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,fe)}},{key:"batchEnableWithBool",value:function(e,t){var n=e;Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=m(n));for(var r=0;r<n.length;r++){this[n[r]].enabled=t}}},{key:"batchEnableWithUserValue",value:function(e,t){var n=e;Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=m(n));for(var r=0;r<n.length;r++){var i=n[r],a=t[i];this[i].enabled=!1!==a&&void 0!==a}}},{key:"setupGlobalFilters",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n;if(e&&e.length){var i=r;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=m(i));for(var a=0;a<i.length;a++){var s=i[a];this[s].enabled=!1}var o=ke(e,n),u=o;Array.isArray(u)||("function"==typeof u.entries&&(u=u.entries()),u=m(u));for(var f=0;f<u.length;f++){var c=u[f],h=c[0],l=c[1];Se(this[h].pick,l),this[h].enabled=!0}}else if(t&&t.length){var d=ke(t,n),p=d;Array.isArray(p)||("function"==typeof p.entries&&(p=p.entries()),p=m(p));for(var v=0;v<p.length;v++){var g=p[v],y=g[0],k=g[1];Se(this[y].skip,k)}}}},{key:"filterNestedSegmentTags",value:function(){var e=this.ifd0,t=this.exif,n=this.xmp,r=this.iptc,i=this.icc;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),n.enabled||e.skip.add(700),r.enabled||e.skip.add(33723),i.enabled||e.skip.add(34675)}},{key:"traverseTiffDependencyTree",value:function(){var e=this,t=this.ifd0,n=this.exif,r=this.gps;this.interop.needed&&(n.deps.add(40965),t.deps.add(40965)),n.needed&&t.deps.add(34665),r.needed&&t.deps.add(34853),this.tiff.enabled=fe.some((function(t){return!0===e[t].enabled}))||this.makerNote||this.userComment;var i=fe;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=m(i));for(var a=0;a<i.length;a++){this[i[a]].finalizeFilters()}}},{key:"checkLoadedPlugins",value:function(){var e=ue;Array.isArray(e)||("function"==typeof e.entries&&(e=e.entries()),e=m(e));for(var t=0;t<e.length;t++){var n=e[t];this[n].enabled&&!H.has(n)&&N("segment parser",n)}}},{key:"onlyTiff",get:function(){var e=this;return!oe.map((function(t){return e[t].enabled})).some((function(e){return!0===e}))&&this.tiff.enabled}}]),n}(pe);function ke(e,t){var n,r,i,a=[],s=t;Array.isArray(s)||("function"==typeof s.entries&&(s=s.entries()),s=m(s));for(var o=0;o<s.length;o++){r=s[o],n=[];var u=re.get(r);Array.isArray(u)||("function"==typeof u.entries&&(u=u.entries()),u=m(u));for(var f=0;f<u.length;f++)i=u[f],(e.includes(i[0])||e.includes(i[1]))&&n.push(i[0]);n.length&&a.push([r,n])}return a}function be(e,t){return void 0!==e?e:void 0!==t?t:void 0}function Se(e,t){var n=t;Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=m(n));for(var r=0;r<n.length;r++){var i=n[r];e.add(i)}}function Ae(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function Pe(){}function we(e,t){if(!t)return e&&e.then?e.then(Pe):Promise.resolve()}function Oe(e,t){var n=e();return n&&n.then?n.then(t):t(n)}i(me,"default",ge);var Ce=function(){function e(n){t(this,e),i(this,"parsers",{}),this.options=me.useCached(n)}return r(e,[{key:"setup",value:function(){if(!this.fileParser){var e=this.file,t=e.getUint16(0),n=G;Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=m(n));for(var r=0;r<n.length;r++){var i=n[r],a=i[0],s=i[1];if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[a]=!0}T("Unknown file format")}}},{key:"read",value:function(e){try{var t=this;return Ae(function(e,t){return"string"==typeof e?$(e,t):C&&!x&&e instanceof HTMLImageElement?$(e.src,t):e instanceof Uint8Array||e instanceof ArrayBuffer||e instanceof DataView?new E(e):C&&e instanceof Blob?Q(e,t,"blob",Y):void T("Invalid input argument")}(e,t.options),(function(e){t.file=e}))}catch(e){return Promise.reject(e)}}},{key:"parse",value:function(){try{var e=this;e.setup();var t={},n=[];return Oe((function(){return e.options.silentErrors?Ae(e.doParse(t,n).catch((function(e){return n.push(e)})),(function(){n.push.apply(n,e.fileParser.errors)})):we(e.doParse(t,n))}),(function(){return e.file.close&&e.file.close(),e.options.silentErrors&&n.length>0&&(t.errors=n),L(t)}))}catch(e){return Promise.reject(e)}}},{key:"doParse",value:function(e,t){try{var n=this;return Ae(n.fileParser.parse(),(function(){var r,i=p(n.parsers).map((r=function(t){return Ae(t.parse(),(function(n){t.assignToOutput(e,n)}))},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(r.apply(this,e))}catch(e){return Promise.reject(e)}}));if(n.options.silentErrors){var a=function(e){return t.push(e)};i=i.map((function(e){return e.catch(a)}))}return we(Promise.all(i))}))}catch(e){return Promise.reject(e)}}},{key:"extractThumbnail",value:function(){try{var e=this;e.setup();var t,n=e.options,r=e.file,i=H.get("tiff",n);return Oe((function(){if(!r.tiff)return function(e){var t=e();if(t&&t.then)return t.then(Pe)}((function(){if(r.jpeg)return Ae(e.fileParser.getOrFindSegment("tiff"),(function(e){t=e}))}));t={start:0,type:"tiff"}}),(function(){if(void 0!==t)return Ae(e.fileParser.ensureSegmentChunk(t),(function(t){return Ae((e.parsers.tiff=new i(t,n,r)).extractThumbnail(),(function(e){return r.close&&r.close(),e}))}))}))}catch(e){return Promise.reject(e)}}}]),e}();var xe,Be=(xe=function(e,t){var n,r,i,a=new Ce(t);return n=a.read(e),r=function(){return a.parse()},i?r?r(n):n:(n&&n.then||(n=Promise.resolve(n)),r?n.then(r):n)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(xe.apply(this,e))}catch(e){return Promise.reject(e)}}),Ue=Object.freeze({__proto__:null,parse:Be,Exifr:Ce,fileParsers:G,segmentParsers:H,fileReaders:W,tagKeys:re,tagValues:ie,tagRevivers:ae,createDictionary:te,extendDictionary:ne,fetchUrlAsArrayBuffer:q,readBlobAsArrayBuffer:Y,chunkedProps:se,otherSegments:oe,segments:ue,tiffBlocks:fe,segmentsAndBlocks:ce,tiffExtractables:he,inheritables:le,allFormatters:de,Options:me});function Ie(){}var Fe=function(){function e(n,r,a){var s=this;t(this,e),i(this,"errors",[]),i(this,"ensureSegmentChunk",function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e){var t,n,r,i=e.start,a=e.size||65536;return t=function(){if(s.file.chunked)return function(e){var t=e();if(t&&t.then)return t.then(Ie)}((function(){if(!s.file.available(i,a))return function(e){if(e&&e.then)return e.then(Ie)}(function(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}((function(){return t=s.file.readChunk(i,a),n=function(t){e.chunk=t},r?n?n(t):t:(t&&t.then||(t=Promise.resolve(t)),n?t.then(n):t);var t,n,r}),(function(t){T("Couldn't read segment: ".concat(JSON.stringify(e),". ").concat(t.message))})));e.chunk=s.file.subarray(i,a)}));s.file.byteLength>i+a?e.chunk=s.file.subarray(i,a):void 0===e.size?e.chunk=s.file.subarray(i):T("Segment unreachable: "+JSON.stringify(e))},n=function(){return e.chunk},(r=t())&&r.then?r.then(n):n(r)}))),this.extendOptions&&this.extendOptions(n),this.options=n,this.file=r,this.parsers=a}return r(e,[{key:"injectSegment",value:function(e,t){this.options[e].enabled&&this.createParser(e,t)}},{key:"createParser",value:function(e,t){var n=new(H.get(e))(t,this.options,this.file);return this.parsers[e]=n}},{key:"createParsers",value:function(e){var t=e;Array.isArray(t)||("function"==typeof t.entries&&(t=t.entries()),t=m(t));for(var n=0;n<t.length;n++){var r=t[n],i=r.type,a=r.chunk,s=this.options[i];if(s&&s.enabled){var o=this.parsers[i];o&&o.append||o||this.createParser(i,a)}}}},{key:"readSegments",value:function(e){try{var t=e.map(this.ensureSegmentChunk);return function(e,t){if(!t)return e&&e.then?e.then(Ie):Promise.resolve()}(Promise.all(t))}catch(e){return Promise.reject(e)}}}]),e}(),Le=function(){function e(n){var r=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;t(this,e),i(this,"errors",[]),i(this,"raw",P()),i(this,"handleError",(function(e){if(!r.options.silentErrors)throw e;r.errors.push(e.message)})),this.chunk=this.normalizeInput(n),this.file=s,this.type=this.constructor.type,this.globalOptions=this.options=a,this.localOptions=a[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}return r(e,[{key:"normalizeInput",value:function(e){return e instanceof E?e:new E(e)}}],[{key:"findPosition",value:function(e,t){var n=e.getUint16(t+2)+2,r="function"==typeof this.headerLength?this.headerLength(e,t,n):this.headerLength,i=t+r,a=n-r;return{offset:t,length:n,headerLength:r,start:i,size:a,end:i+a}}},{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new me(i({},this.type,t)),r=new this(e,n);return r.parse()}}]),r(e,[{key:"translate",value:function(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}},{key:"translateBlock",value:function(e,t){var n=ae.get(t),r=ie.get(t),i=re.get(t),a=this.options[t],s=a.reviveValues&&!!n,o=a.translateValues&&!!r,u=a.translateKeys&&!!i,f={},c=e;Array.isArray(c)||("function"==typeof c.entries&&(c=c.entries()),c=m(c));for(var h=0;h<c.length;h++){var l=c[h],d=l[0],p=l[1];s&&n.has(d)?p=n.get(d)(p):o&&r.has(d)&&(p=this.translateValue(p,r.get(d))),u&&i.has(d)&&(d=i.get(d)||d),f[d]=p}return f}},{key:"translateValue",value:function(e,t){return t[e]||t.DEFAULT||e}},{key:"assignToOutput",value:function(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}},{key:"assignObjectToOutput",value:function(e,t,n){if(this.globalOptions.mergeOutput)return g(e,n);e[t]?g(e[t],n):e[t]=n}},{key:"output",get:function(){return this.translated?this.translated:this.raw?y(this.raw):void 0}}]),e}();function je(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}i(Le,"headerLength",4),i(Le,"type",void 0),i(Le,"multiSegment",!1),i(Le,"canHandle",(function(){return!1}));function De(){}function Te(e,t){if(!t)return e&&e.then?e.then(De):Promise.resolve()}function _e(e){var t=e();if(t&&t.then)return t.then(De)}function ze(e,t){var n=e();return n&&n.then?n.then(t):t(n)}function Ve(e,t,n){if(!e.s){if(n instanceof Re){if(!n.s)return void(n.o=Ve.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Ve.bind(null,e,t),Ve.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Re=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{Ve(r,1,a(this.v))}catch(e){Ve(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?Ve(r,1,t?t(i):i):n?Ve(r,1,n(i)):Ve(r,2,i)}catch(e){Ve(r,2,e)}},r},e}();function Ee(e){return e instanceof Re&&1&e.s}function Ne(e,t,n){for(var r;;){var i=e();if(Ee(i)&&(i=i.v),!i)return a;if(i.then){r=0;break}var a=n();if(a&&a.then){if(!Ee(a)){r=1;break}a=a.s}if(t){var s=t();if(s&&s.then&&!Ee(s)){r=2;break}}}var o=new Re,u=Ve.bind(null,o,2);return(0===r?i.then(c):1===r?a.then(f):s.then(h)).then(void 0,u),o;function f(r){a=r;do{if(t&&(s=t())&&s.then&&!Ee(s))return void s.then(h).then(void 0,u);if(!(i=e())||Ee(i)&&!i.v)return void Ve(o,1,a);if(i.then)return void i.then(c).then(void 0,u);Ee(a=n())&&(a=a.v)}while(!a||!a.then);a.then(f).then(void 0,u)}function c(e){e?(a=n())&&a.then?a.then(f).then(void 0,u):f(a):Ve(o,1,a)}function h(){(i=e())?i.then?i.then(c).then(void 0,u):c(i):Ve(o,1,a)}}function Me(e){return 192===e||194===e||196===e||219===e||221===e||218===e||254===e}function Ge(e){return e>=224&&e<=239}function He(e,t,n){var r=H;Array.isArray(r)||("function"==typeof r.entries&&(r=r.entries()),r=m(r));for(var i=0;i<r.length;i++){var a=r[i],s=a[0];if(a[1].canHandle(e,t,n))return s}}var We=function(e){function n(){var e,r;t(this,n);for(var a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];return i(h(r=l(this,(e=s(n)).call.apply(e,[this].concat(o)))),"appSegments",[]),i(h(r),"jpegSegments",[]),i(h(r),"unknownSegments",[]),r}return a(n,e),r(n,[{key:"parse",value:function(){try{var e=this;return je(e.findAppSegments(),(function(){return je(e.readSegments(e.appSegments),(function(){e.mergeMultiSegments(),e.createParsers(e.mergedAppSegments||e.appSegments)}))}))}catch(e){return Promise.reject(e)}}},{key:"setupSegmentFinderArgs",value:function(e){var t=this;!0===e?(this.findAll=!0,this.wanted=A(H.keyList())):(e=void 0===e?H.keyList().filter((function(e){return t.options[e].enabled})):e.filter((function(e){return t.options[e].enabled&&H.has(e)})),this.findAll=!1,this.remaining=A(e),this.wanted=A(e)),this.unfinishedMultiSegment=!1}},{key:"findAppSegments",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;try{var n=this;n.setupSegmentFinderArgs(t);var r=n.file,i=n.findAll,a=n.wanted,s=n.remaining;return ze((function(){if(!i&&n.file.chunked)return i=m(a).some((function(e){var t=H.get(e),r=n.options[e];return t.multiSegment&&r.multiSegment})),_e((function(){if(i)return Te(n.file.readWhole())}))}),(function(){var t=!1;if(e=n.findAppSegmentsInRange(e,r.byteLength),!n.options.onlyTiff)return function(){if(r.chunked){var i=!1;return Ne((function(){return!t&&s.size>0&&!i&&(!!r.canReadNextChunk||!!n.unfinishedMultiSegment)}),void 0,(function(){var a=r.nextChunkOffset,s=n.appSegments.some((function(e){return!n.file.available(e.offset||e.start,e.length||e.size)}));return ze((function(){return e>a&&!s?je(r.readNextChunk(e),(function(e){i=!e})):je(r.readNextChunk(a),(function(e){i=!e}))}),(function(){void 0===(e=n.findAppSegmentsInRange(e,r.byteLength))&&(t=!0)}))}))}}()}))}catch(e){return Promise.reject(e)}}},{key:"findAppSegmentsInRange",value:function(e,t){t-=2;for(var n,r,i,a,s,o,u=this.file,f=this.findAll,c=this.wanted,h=this.remaining,l=this.options;e<t;e++)if(255===u.getUint8(e))if(Ge(n=u.getUint8(e+1))){if(r=u.getUint16(e+2),(i=He(u,e,r))&&c.has(i)&&(s=(a=H.get(i)).findPosition(u,e),o=l[i],s.type=i,this.appSegments.push(s),!f&&(a.multiSegment&&o.multiSegment?(this.unfinishedMultiSegment=s.chunkNumber<s.chunkCount,this.unfinishedMultiSegment||h.delete(i)):h.delete(i),0===h.size)))break;l.recordUnknownSegments&&((s=Le.findPosition(u,e)).marker=n,this.unknownSegments.push(s)),e+=r+1}else if(Me(n)){if(r=u.getUint16(e+2),218===n&&!1!==l.stopAfterSos)return;l.recordJpegSegments&&this.jpegSegments.push({offset:e,length:r,marker:n}),e+=r+1}return e}},{key:"mergeMultiSegments",value:function(){var e=this;if(this.appSegments.some((function(e){return e.multiSegment}))){var t=function(e,t){for(var n,r,i,a=P(),s=0;s<e.length;s++)n=e[s],r=n[t],a.has(r)?i=a.get(r):a.set(r,i=[]),i.push(n);return m(a)}(this.appSegments,"type");this.mergedAppSegments=t.map((function(t){var n=t[0],r=t[1],i=H.get(n,e.options);return i.handleMultiSegments?{type:n,chunk:i.handleMultiSegments(r)}:r[0]}))}}},{key:"getSegment",value:function(e){return this.appSegments.find((function(t){return t.type===e}))}},{key:"getOrFindSegment",value:function(e){try{var t=this,n=t.getSegment(e);return ze((function(){if(void 0===n)return je(t.findAppSegments(0,[e]),(function(){n=t.getSegment(e)}))}),(function(){return n}))}catch(e){return Promise.reject(e)}}}],[{key:"canHandle",value:function(e,t){return 65496===t}}]),n}(Fe);function Ke(){}i(We,"type","jpeg"),G.set("jpeg",We);function Xe(e,t){if(!t)return e&&e.then?e.then(Ke):Promise.resolve()}function Ye(e,t){var n=e();return n&&n.then?n.then(t):t(n)}var qe=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4];var Je=function(e){function n(){return t(this,n),l(this,s(n).apply(this,arguments))}return a(n,e),r(n,[{key:"parse",value:function(){try{var e=this;e.parseHeader();var t=e.options;return Ye((function(){if(t.ifd0.enabled)return Xe(e.parseIfd0Block())}),(function(){return Ye((function(){if(t.exif.enabled)return Xe(e.safeParse("parseExifBlock"))}),(function(){return Ye((function(){if(t.gps.enabled)return Xe(e.safeParse("parseGpsBlock"))}),(function(){return Ye((function(){if(t.interop.enabled)return Xe(e.safeParse("parseInteropBlock"))}),(function(){return Ye((function(){if(t.ifd1.enabled)return Xe(e.safeParse("parseThumbnailBlock"))}),(function(){return e.createOutput()}))}))}))}))}))}catch(e){return Promise.reject(e)}}},{key:"safeParse",value:function(e){var t=this[e]();return void 0!==t.catch&&(t=t.catch(this.handleError)),t}},{key:"findIfd0Offset",value:function(){void 0===this.ifd0Offset&&(this.ifd0Offset=this.chunk.getUint32(4))}},{key:"findIfd1Offset",value:function(){if(void 0===this.ifd1Offset){this.findIfd0Offset();var e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}},{key:"parseBlock",value:function(e,t){var n=P();return this[t]=n,this.parseTags(e,t,n),n}},{key:"parseIfd0Block",value:function(){try{var e=this;if(e.ifd0)return;var t=e.file;return e.findIfd0Offset(),e.ifd0Offset<8&&T("Malformed EXIF data"),!t.chunked&&e.ifd0Offset>t.byteLength&&T("IFD0 offset points to outside of file.\nthis.ifd0Offset: ".concat(e.ifd0Offset,", file.byteLength: ").concat(t.byteLength)),Ye((function(){if(t.tiff)return Xe(t.ensureChunk(e.ifd0Offset,z(e.options)))}),(function(){var t=e.parseBlock(e.ifd0Offset,"ifd0");if(0!==t.size)return e.exifOffset=t.get(34665),e.interopOffset=t.get(40965),e.gpsOffset=t.get(34853),e.xmp=t.get(700),e.iptc=t.get(33723),e.icc=t.get(34675),e.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t}))}catch(e){return Promise.reject(e)}}},{key:"parseExifBlock",value:function(){try{var e=this;if(e.exif)return;return Ye((function(){if(!e.ifd0)return Xe(e.parseIfd0Block())}),(function(){if(void 0!==e.exifOffset)return Ye((function(){if(e.file.tiff)return Xe(e.file.ensureChunk(e.exifOffset,z(e.options)))}),(function(){var t=e.parseBlock(e.exifOffset,"exif");return e.interopOffset||(e.interopOffset=t.get(40965)),e.makerNote=t.get(37500),e.userComment=t.get(37510),e.options.sanitize&&(t.delete(40965),t.delete(37500),t.delete(37510)),e.unpack(t,41728),e.unpack(t,41729),t}))}))}catch(e){return Promise.reject(e)}}},{key:"unpack",value:function(e,t){var n=e.get(t);n&&1===n.length&&e.set(t,n[0])}},{key:"parseGpsBlock",value:function(){try{var e=this;if(e.gps)return;return Ye((function(){if(!e.ifd0)return Xe(e.parseIfd0Block())}),(function(){if(void 0!==e.gpsOffset){var t=e.parseBlock(e.gpsOffset,"gps");return t&&t.has(2)&&t.has(4)&&(t.set("latitude",Ze.apply(void 0,t.get(2).concat([t.get(1)]))),t.set("longitude",Ze.apply(void 0,t.get(4).concat([t.get(3)])))),t}}))}catch(e){return Promise.reject(e)}}},{key:"parseInteropBlock",value:function(){try{var e=this;if(e.interop)return;return Ye((function(){if(!e.ifd0)return Xe(e.parseIfd0Block())}),(function(){return Ye((function(){if(void 0===e.interopOffset&&!e.exif)return Xe(e.parseExifBlock())}),(function(){if(void 0!==e.interopOffset)return e.parseBlock(e.interopOffset,"interop")}))}))}catch(e){return Promise.reject(e)}}},{key:"parseThumbnailBlock",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{var t=this;if(t.ifd1||t.ifd1Parsed)return;if(t.options.mergeOutput&&!e)return;return t.findIfd1Offset(),t.ifd1Offset>0&&(t.parseBlock(t.ifd1Offset,"ifd1"),t.ifd1Parsed=!0),t.ifd1}catch(e){return Promise.reject(e)}}},{key:"extractThumbnail",value:function(){try{var e=this;return e.headerParsed||e.parseHeader(),Ye((function(){if(!e.ifd1Parsed)return Xe(e.parseThumbnailBlock(!0))}),(function(){if(void 0!==e.ifd1){var t=e.ifd1.get(513),n=e.ifd1.get(514);return e.chunk.getUint8Array(t,n)}}))}catch(e){return Promise.reject(e)}}},{key:"createOutput",value:function(){var e,t,n,r={},i=fe;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=m(i));for(var a=0;a<i.length;a++)if(!D(e=this[t=i[a]]))if(n=this.canTranslate?this.translateBlock(e,t):y(e),this.options.mergeOutput){if("ifd1"===t)continue;g(r,n)}else r[t]=n;return this.makerNote&&(r.makerNote=this.makerNote),this.userComment&&(r.userComment=this.userComment),r}},{key:"assignToOutput",value:function(e,t){if(this.globalOptions.mergeOutput)g(e,t);else{var n=v(t);Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=m(n));for(var r=0;r<n.length;r++){var i=n[r],a=i[0],s=i[1];this.assignObjectToOutput(e,a,s)}}}},{key:"image",get:function(){return this.ifd0}},{key:"thumbnail",get:function(){return this.ifd1}}],[{key:"canHandle",value:function(e,t){return 225===e.getUint8(t+1)&&1165519206===e.getUint32(t+4)&&0===e.getUint16(t+8)}}]),n}(function(e){function n(){return t(this,n),l(this,s(n).apply(this,arguments))}return a(n,e),r(n,[{key:"parseHeader",value:function(){var e=this.chunk.getUint16();18761===e?this.le=!0:19789===e&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}},{key:"parseTags",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P(),r=this.options[t],i=r.pick,a=r.skip,s=(i=A(i)).size>0,o=0===a.size,u=this.chunk.getUint16(e);e+=2;for(var f=0;f<u;f++){var c=this.chunk.getUint16(e);if(s){if(i.has(c)&&(n.set(c,this.parseTag(e,c,t)),i.delete(c),0===i.size))break}else!o&&a.has(c)||n.set(c,this.parseTag(e,c,t));e+=12}return n}},{key:"parseTag",value:function(e,t,n){var r=this.chunk,i=r.getUint16(e+2),a=r.getUint32(e+4),s=qe[i];if(s*a<=4?e+=8:e=r.getUint32(e+8),(i<1||i>13)&&T("Invalid TIFF value type. block: ".concat(n.toUpperCase(),", tag: ").concat(t.toString(16),", type: ").concat(i,", offset ").concat(e)),e>r.byteLength&&T("Invalid TIFF value offset. block: ".concat(n.toUpperCase(),", tag: ").concat(t.toString(16),", type: ").concat(i,", offset ").concat(e," is outside of chunk size ").concat(r.byteLength)),1===i)return r.getUint8Array(e,a);if(2===i)return _(r.getString(e,a));if(7===i)return r.getUint8Array(e,a);if(1===a)return this.parseTagValue(i,e);for(var o=new(function(e){switch(e){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}}(i))(a),u=s,f=0;f<a;f++)o[f]=this.parseTagValue(i,e),e+=u;return o}},{key:"parseTagValue",value:function(e,t){var n=this.chunk;switch(e){case 1:return n.getUint8(t);case 3:return n.getUint16(t);case 4:return n.getUint32(t);case 5:return n.getUint32(t)/n.getUint32(t+4);case 6:return n.getInt8(t);case 8:return n.getInt16(t);case 9:return n.getInt32(t);case 10:return n.getInt32(t)/n.getInt32(t+4);case 11:return n.getFloat(t);case 12:return n.getDouble(t);case 13:return n.getUint32(t);default:T("Invalid tiff type ".concat(e))}}}]),n}(Le));function Ze(e,t,n,r){var i=e+t/60+n/3600;return"S"!==r&&"W"!==r||(i*=-1),i}i(Je,"type","tiff"),i(Je,"headerLength",10),H.set("tiff",Je);var Qe=Object.freeze({__proto__:null,default:Ue,parse:Be,Exifr:Ce,fileParsers:G,segmentParsers:H,fileReaders:W,tagKeys:re,tagValues:ie,tagRevivers:ae,createDictionary:te,extendDictionary:ne,fetchUrlAsArrayBuffer:q,readBlobAsArrayBuffer:Y,chunkedProps:se,otherSegments:oe,segments:ue,tiffBlocks:fe,segmentsAndBlocks:ce,tiffExtractables:he,inheritables:le,allFormatters:de,Options:me});function $e(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function et(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}var tt=function(t){return $e(nt(t),(function(t){return g({canvas:e.rotateCanvas,css:e.rotateCss},ct[t])}))},nt=et((function(e){var t=new Ce(ut);return $e(t.read(e),(function(){return $e(t.parse(),(function(e){if(e&&e.ifd0)return e.ifd0[274]}))}))})),rt=et((function(e){var t=new Ce(ot);return $e(t.read(e),(function(){return $e(t.parse(),(function(e){if(e&&e.gps){var t=e.gps;return{latitude:t.latitude,longitude:t.longitude}}}))}))})),it=et((function(e){return $e(this.thumbnail(e),(function(e){if(void 0!==e){var t=new Blob([e]);return URL.createObjectURL(t)}}))})),at=et((function(e){var t=new Ce(ft);return $e(t.read(e),(function(){return $e(t.extractThumbnail(),(function(e){return e&&F?U.from(e):e}))}))})),st={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},ot=g({},st,{firstChunkSize:4e4,gps:[1,2,3,4]}),ut=g({},st,{firstChunkSize:4e4,ifd0:[274]}),ft=g({},st,{tiff:!1,ifd1:!0,mergeOutput:!1}),ct={1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}};if(e.rotateCanvas=!0,e.rotateCss=!0,"object"==typeof navigator){var ht=navigator.userAgent;if(ht.includes("iPad")||ht.includes("iPhone")){var lt=ht.match(/OS (\d+)_(\d+)/);if(lt){lt[0];var dt=lt[1],pt=lt[2],vt=Number(dt)+.1*Number(pt);e.rotateCanvas=vt<13.4,e.rotateCss=!1}}if(ht.includes("Chrome/")){var gt=ht.match(/Chrome\/(\d+)/),yt=(gt[0],gt[1]);Number(yt)>=81&&(e.rotateCanvas=e.rotateCss=!1)}else if(ht.includes("Firefox/")){var mt=ht.match(/Firefox\/(\d+)/),kt=(mt[0],mt[1]);Number(kt)>=77&&(e.rotateCanvas=e.rotateCss=!1)}}function bt(){}var St=function(e){function n(){var e,r;t(this,n);for(var a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];return i(h(r=l(this,(e=s(n)).call.apply(e,[this].concat(o)))),"ranges",new At),0!==r.byteLength&&r.ranges.add(0,r.byteLength),r}return a(n,e),r(n,[{key:"_tryExtend",value:function(e,t,n){if(0===e&&0===this.byteLength&&n){var r=new DataView(n.buffer||n,n.byteOffset,n.byteLength);this._swapDataView(r)}else{var i=e+t;if(i>this.byteLength){var a=this._extend(i).dataView;this._swapDataView(a)}}}},{key:"_extend",value:function(e){var t;t=F?U.allocUnsafe(e):new Uint8Array(e);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:n}}},{key:"subarray",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),d(s(n.prototype),"subarray",this).call(this,e,t)}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];r&&this._tryExtend(t,e.byteLength,e);var i=d(s(n.prototype),"set",this).call(this,e,t);return this.ranges.add(t,i.byteLength),i}},{key:"ensureChunk",value:function(e,t){try{if(!this.chunked)return;if(this.ranges.available(e,t))return;return function(e,t){if(!t)return e&&e.then?e.then(bt):Promise.resolve()}(this.readChunk(e,t))}catch(e){return Promise.reject(e)}}},{key:"available",value:function(e,t){return this.ranges.available(e,t)}}]),n}(E),At=function(){function e(){t(this,e),i(this,"list",[])}return r(e,[{key:"add",value:function(e,t){var n=e+t,r=this.list.filter((function(t){return Pt(e,t.offset,n)||Pt(e,t.end,n)}));if(r.length>0){e=Math.min.apply(Math,[e].concat(r.map((function(e){return e.offset})))),t=(n=Math.max.apply(Math,[n].concat(r.map((function(e){return e.end})))))-e;var i=r.shift();i.offset=e,i.length=t,i.end=n,this.list=this.list.filter((function(e){return!r.includes(e)}))}else this.list.push({offset:e,length:t,end:n})}},{key:"available",value:function(e,t){var n=e+t;return this.list.some((function(t){return t.offset<=e&&n<=t.end}))}},{key:"length",get:function(){return this.list.length}}]),e}();function Pt(e,t,n){return e<=t&&t<=n}function wt(){}function Ot(e,t){if(!t)return e&&e.then?e.then(wt):Promise.resolve()}var Ct=function(e){function n(e,r){var a;return t(this,n),i(h(a=l(this,s(n).call(this,0))),"chunksRead",0),a.input=e,a.options=r,a}return a(n,e),r(n,[{key:"readWhole",value:function(){try{return this.chunked=!1,Ot(this.readChunk(this.nextChunkOffset))}catch(e){return Promise.reject(e)}}},{key:"readChunked",value:function(){try{return this.chunked=!0,Ot(this.readChunk(0,this.options.firstChunkSize))}catch(e){return Promise.reject(e)}}},{key:"readNextChunk",value:function(e){try{if(void 0===e&&(e=this.nextChunkOffset),this.fullyRead)return this.chunksRead++,!1;var t=this.options.chunkSize;return n=this.readChunk(e,t),r=function(e){return!!e&&e.byteLength===t},i?r?r(n):n:(n&&n.then||(n=Promise.resolve(n)),r?n.then(r):n)}catch(e){return Promise.reject(e)}var n,r,i}},{key:"readChunk",value:function(e,t){try{if(this.chunksRead++,0===(t=this.safeWrapAddress(e,t)))return;return this._readChunk(e,t)}catch(e){return Promise.reject(e)}}},{key:"safeWrapAddress",value:function(e,t){return void 0!==this.size&&e+t>this.size?Math.max(0,this.size-e):t}},{key:"read",value:function(){return this.options.chunked?this.readChunked():this.readWhole()}},{key:"close",value:function(){}},{key:"nextChunkOffset",get:function(){if(0!==this.ranges.list.length)return this.ranges.list[0].length}},{key:"canReadNextChunk",get:function(){return this.chunksRead<this.options.chunkLimit}},{key:"fullyRead",get:function(){return void 0!==this.size&&this.nextChunkOffset===this.size}}]),n}(St);function xt(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var Bt=function(e){function n(){return t(this,n),l(this,s(n).apply(this,arguments))}return a(n,e),r(n,[{key:"readWhole",value:function(){try{var e=this;return e.chunked=!1,xt(Y(e.input),(function(t){e._swapArrayBuffer(t)}))}catch(e){return Promise.reject(e)}}},{key:"readChunked",value:function(){return this.chunked=!0,this.size=this.input.size,d(s(n.prototype),"readChunked",this).call(this)}},{key:"_readChunk",value:function(e,t){try{var n=this,r=t?e+t:void 0,i=n.input.slice(e,r);return xt(Y(i),(function(t){return n.set(t,e,!0)}))}catch(e){return Promise.reject(e)}}}]),n}(Ct);W.set("blob",Bt);var Ut=Object.freeze({__proto__:null,default:Qe,parse:Be,Exifr:Ce,fileParsers:G,segmentParsers:H,fileReaders:W,tagKeys:re,tagValues:ie,tagRevivers:ae,createDictionary:te,extendDictionary:ne,fetchUrlAsArrayBuffer:q,readBlobAsArrayBuffer:Y,chunkedProps:se,otherSegments:oe,segments:ue,tiffBlocks:fe,segmentsAndBlocks:ce,tiffExtractables:he,inheritables:le,allFormatters:de,Options:me,rotation:tt,orientation:nt,gps:rt,thumbnailUrl:it,thumbnail:at,disableAllOptions:st,gpsOnlyOptions:ot,orientationOnlyOptions:ut,thumbnailOnlyOptions:ft,rotations:ct,get rotateCanvas(){return e.rotateCanvas},get rotateCss(){return e.rotateCss}});function It(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var Ft=function(e){function n(){return t(this,n),l(this,s(n).apply(this,arguments))}return a(n,e),r(n,[{key:"readWhole",value:function(){try{var e=this;return e.chunked=!1,It(q(e.input),(function(t){e._swapArrayBuffer(t)}))}catch(e){return Promise.reject(e)}}},{key:"_readChunk",value:function(e,t){try{var n=this,r=t?e+t-1:void 0,i={};return(e||r)&&(i.range="bytes=".concat([e,r].join("-"))),It(S(n.input,{headers:i}),(function(r){return It(r.arrayBuffer(),(function(i){var a=i.byteLength;if(416!==r.status)return a!==t&&(n.size=e+a),n.set(i,e,!0)}))}))}catch(e){return Promise.reject(e)}}}]),n}(Ct);W.set("url",Ft);function Lt(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}E.prototype.getUint64=function(e){var t=this.getUint32(e),n=this.getUint32(e+4);return t<1048575?t<<32|n:void 0!==typeof I?(console.warn("Using BigInt because of type 64uint but JS can only handle 53b numbers."),I(t)<<I(32)|I(n)):void T("Trying to read 64b value but JS can only handle 53b numbers.")};function jt(e,t,n){if(!e.s){if(n instanceof Dt){if(!n.s)return void(n.o=jt.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(jt.bind(null,e,t),jt.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Dt=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{jt(r,1,a(this.v))}catch(e){jt(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?jt(r,1,t?t(i):i):n?jt(r,1,n(i)):jt(r,2,i)}catch(e){jt(r,2,e)}},r},e}();function Tt(e){return e instanceof Dt&&1&e.s}function _t(){}function zt(e,t){if(!t)return e&&e.then?e.then(_t):Promise.resolve()}var Vt=function(e){function n(){return t(this,n),l(this,s(n).apply(this,arguments))}return a(n,e),r(n,[{key:"parse",value:function(){try{var e=this,t=e.file.getUint32(0),n=e.parseBoxHead(t);return r=function(e,t,n){for(var r;;){var i=e();if(Tt(i)&&(i=i.v),!i)return a;if(i.then){r=0;break}var a=n();if(a&&a.then){if(!Tt(a)){r=1;break}a=a.s}if(t){var s=t();if(s&&s.then&&!Tt(s)){r=2;break}}}var o=new Dt,u=jt.bind(null,o,2);return(0===r?i.then(c):1===r?a.then(f):s.then(h)).then(void 0,u),o;function f(r){a=r;do{if(t&&(s=t())&&s.then&&!Tt(s))return void s.then(h).then(void 0,u);if(!(i=e())||Tt(i)&&!i.v)return void jt(o,1,a);if(i.then)return void i.then(c).then(void 0,u);Tt(a=n())&&(a=a.v)}while(!a||!a.then);a.then(f).then(void 0,u)}function c(e){e?(a=n())&&a.then?a.then(f).then(void 0,u):f(a):jt(o,1,a)}function h(){(i=e())?i.then?i.then(c).then(void 0,u):c(i):jt(o,1,a)}}((function(){return"meta"!==n.kind}),void 0,(function(){return t+=n.length,Lt(e.file.ensureChunk(t,16),(function(){n=e.parseBoxHead(t)}))})),i=function(){return Lt(e.file.ensureChunk(n.offset,n.length),(function(){return e.parseBoxFullHead(n),e.parseSubBoxes(n),t=function(){return function(e){var t=e();if(t&&t.then)return t.then(_t)}((function(){if(e.options.tiff.enabled)return zt(e.findExif(n))}))},(r=function(){if(e.options.icc.enabled)return zt(e.findIcc(n))}())&&r.then?r.then(t):t(r);var t,r}))},r&&r.then?r.then(i):i(r)}catch(e){return Promise.reject(e)}var r,i}},{key:"registerSegment",value:function(e,t,n){try{var r=this;return Lt(r.file.ensureChunk(t,n),(function(){var i=r.file.subarray(t,n);r.createParser(e,i)}))}catch(e){return Promise.reject(e)}}},{key:"findIcc",value:function(e){try{var t=this.findBox(e,"iprp");if(void 0===t)return;var n=this.findBox(t,"ipco");if(void 0===n)return;var r=this.findBox(n,"colr");if(void 0===r)return;return zt(this.registerSegment("icc",r.offset+12,r.length))}catch(e){return Promise.reject(e)}}},{key:"findExif",value:function(e){try{var t=this,n=t.findBox(e,"iinf");if(void 0===n)return;var r=t.findBox(e,"iloc");if(void 0===r)return;var i=t.findExifLocIdInIinf(n),a=t.findExtentInIloc(r,i);if(void 0===a)return;var s=a[0],o=a[1];return Lt(t.file.ensureChunk(s,o),(function(){var e=4+t.file.getUint32(s);return s+=e,o-=e,zt(t.registerSegment("tiff",s,o))}))}catch(e){return Promise.reject(e)}}},{key:"findExifLocIdInIinf",value:function(e){this.parseBoxFullHead(e);var t,n,r,i=e.start,a=this.file.getUint16(i);for(i+=2;a--;){if(t=this.parseBoxHead(i),this.parseBoxFullHead(t),n=t.start,t.version>=2&&(r=3===t.version?4:2,"Exif"===this.file.getString(n+r+2,4)))return this.file.getUintBytes(n,r);i+=t.length}}},{key:"get8bits",value:function(e){var t=this.file.getUint8(e);return[t>>4,15&t]}},{key:"findExtentInIloc",value:function(e,t){this.parseBoxFullHead(e);var n=e.start,r=this.get8bits(n++),i=r[0],a=r[1],s=this.get8bits(n++),o=s[0],u=s[1],f=2===e.version?4:2,c=1===e.version||2===e.version?2:0,h=u+i+a,l=2===e.version?4:2,d=this.file.getUintBytes(n,l);for(n+=l;d--;){var p=this.file.getUintBytes(n,f);n+=f+c+2+o;var v=this.file.getUint16(n);if(n+=2,p===t)return v>1&&console.warn("ILOC box has more than one extent but we're only processing one\nPlease create an issue at https://github.com/MikeKovarik/exifr with this file"),[this.file.getUintBytes(n+u,i),this.file.getUintBytes(n+u+i,a)];n+=v*h}}}],[{key:"canHandle",value:function(e){if(0!==e.getUint16(0))return!1;var t=e.getUint16(2);if(t>50)return!1;for(var n=16,r=[];n<t;)r.push(e.getString(n,4)),n+=4;return r.includes("heic")}}]),n}(function(e){function n(){return t(this,n),l(this,s(n).apply(this,arguments))}return a(n,e),r(n,[{key:"parseBoxes",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=[];e<this.file.byteLength-4;){var n=this.parseBoxHead(e);if(t.push(n),0===n.length)break;e+=n.length}return t}},{key:"parseSubBoxes",value:function(e){e.boxes=this.parseBoxes(e.start)}},{key:"findBox",value:function(e,t){return void 0===e.boxes&&this.parseSubBoxes(e),e.boxes.find((function(e){return e.kind===t}))}},{key:"parseBoxHead",value:function(e){var t=this.file.getUint32(e),n=this.file.getString(e+4,4),r=e+8;return 1===t&&(t=this.file.getUint64(e+8),r+=8),{offset:e,length:t,kind:n,start:r}}},{key:"parseBoxFullHead",value:function(e){var t=this.file.getUint32(e.start);e.version=t>>24,e.start+=4}}]),n}(Fe));i(Vt,"type","heic"),G.set("heic",Vt),te(re,["ifd0","ifd1"],[[256,"ImageWidth"],[257,"ImageHeight"],[258,"BitsPerSample"],[259,"Compression"],[262,"PhotometricInterpretation"],[270,"ImageDescription"],[271,"Make"],[272,"Model"],[273,"StripOffsets"],[274,"Orientation"],[277,"SamplesPerPixel"],[278,"RowsPerStrip"],[279,"StripByteCounts"],[282,"XResolution"],[283,"YResolution"],[284,"PlanarConfiguration"],[296,"ResolutionUnit"],[301,"TransferFunction"],[305,"Software"],[306,"ModifyDate"],[315,"Artist"],[316,"HostComputer"],[317,"Predictor"],[318,"WhitePoint"],[319,"PrimaryChromaticities"],[513,"ThumbnailOffset"],[514,"ThumbnailLength"],[529,"YCbCrCoefficients"],[530,"YCbCrSubSampling"],[531,"YCbCrPositioning"],[532,"ReferenceBlackWhite"],[700,"ApplicationNotes"],[33432,"Copyright"],[33723,"IPTC"],[34665,"ExifIFD"],[34675,"ICC"],[34853,"GpsIFD"],[330,"SubIFD"],[40965,"InteropIFD"],[40091,"XPTitle"],[40092,"XPComment"],[40093,"XPAuthor"],[40094,"XPKeywords"],[40095,"XPSubject"]]),te(re,"exif",[[33434,"ExposureTime"],[33437,"FNumber"],[34850,"ExposureProgram"],[34852,"SpectralSensitivity"],[34855,"ISO"],[34858,"TimeZoneOffset"],[34859,"SelfTimerMode"],[34864,"SensitivityType"],[34865,"StandardOutputSensitivity"],[34866,"RecommendedExposureIndex"],[34867,"ISOSpeed"],[34868,"ISOSpeedLatitudeyyy"],[34869,"ISOSpeedLatitudezzz"],[36864,"ExifVersion"],[36867,"DateTimeOriginal"],[36868,"CreateDate"],[36873,"GooglePlusUploadCode"],[36880,"OffsetTime"],[36881,"OffsetTimeOriginal"],[36882,"OffsetTimeDigitized"],[37121,"ComponentsConfiguration"],[37122,"CompressedBitsPerPixel"],[37377,"ShutterSpeedValue"],[37378,"ApertureValue"],[37379,"BrightnessValue"],[37380,"ExposureCompensation"],[37381,"MaxApertureValue"],[37382,"SubjectDistance"],[37383,"MeteringMode"],[37384,"LightSource"],[37385,"Flash"],[37386,"FocalLength"],[37393,"ImageNumber"],[37394,"SecurityClassification"],[37395,"ImageHistory"],[37396,"SubjectArea"],[37500,"MakerNote"],[37510,"UserComment"],[37520,"SubSecTime"],[37521,"SubSecTimeOriginal"],[37522,"SubSecTimeDigitized"],[37888,"AmbientTemperature"],[37889,"Humidity"],[37890,"Pressure"],[37891,"WaterDepth"],[37892,"Acceleration"],[37893,"CameraElevationAngle"],[40960,"FlashpixVersion"],[40961,"ColorSpace"],[40962,"ExifImageWidth"],[40963,"ExifImageHeight"],[40964,"RelatedSoundFile"],[41483,"FlashEnergy"],[41486,"FocalPlaneXResolution"],[41487,"FocalPlaneYResolution"],[41488,"FocalPlaneResolutionUnit"],[41492,"SubjectLocation"],[41493,"ExposureIndex"],[41495,"SensingMethod"],[41728,"FileSource"],[41729,"SceneType"],[41730,"CFAPattern"],[41985,"CustomRendered"],[41986,"ExposureMode"],[41987,"WhiteBalance"],[41988,"DigitalZoomRatio"],[41989,"FocalLengthIn35mmFormat"],[41990,"SceneCaptureType"],[41991,"GainControl"],[41992,"Contrast"],[41993,"Saturation"],[41994,"Sharpness"],[41996,"SubjectDistanceRange"],[42016,"ImageUniqueID"],[42032,"OwnerName"],[42033,"SerialNumber"],[42034,"LensInfo"],[42035,"LensMake"],[42036,"LensModel"],[42037,"LensSerialNumber"],[42080,"CompositeImage"],[42081,"CompositeImageCount"],[42082,"CompositeImageExposureTimes"],[42240,"Gamma"],[59932,"Padding"],[59933,"OffsetSchema"],[65e3,"OwnerName"],[65001,"SerialNumber"],[65002,"Lens"],[65100,"RawFile"],[65101,"Converter"],[65102,"WhiteBalance"],[65105,"Exposure"],[65106,"Shadows"],[65107,"Brightness"],[65108,"Contrast"],[65109,"Saturation"],[65110,"Sharpness"],[65111,"Smoothness"],[65112,"MoireFilter"],[40965,"InteropIFD"]]),te(re,"gps",[[0,"GPSVersionID"],[1,"GPSLatitudeRef"],[2,"GPSLatitude"],[3,"GPSLongitudeRef"],[4,"GPSLongitude"],[5,"GPSAltitudeRef"],[6,"GPSAltitude"],[7,"GPSTimeStamp"],[8,"GPSSatellites"],[9,"GPSStatus"],[10,"GPSMeasureMode"],[11,"GPSDOP"],[12,"GPSSpeedRef"],[13,"GPSSpeed"],[14,"GPSTrackRef"],[15,"GPSTrack"],[16,"GPSImgDirectionRef"],[17,"GPSImgDirection"],[18,"GPSMapDatum"],[19,"GPSDestLatitudeRef"],[20,"GPSDestLatitude"],[21,"GPSDestLongitudeRef"],[22,"GPSDestLongitude"],[23,"GPSDestBearingRef"],[24,"GPSDestBearing"],[25,"GPSDestDistanceRef"],[26,"GPSDestDistance"],[27,"GPSProcessingMethod"],[28,"GPSAreaInformation"],[29,"GPSDateStamp"],[30,"GPSDifferential"],[31,"GPSHPositioningError"]]),te(ie,["ifd0","ifd1"],[[274,{1:"Horizontal (normal)",2:"Mirror horizontal",3:"Rotate 180",4:"Mirror vertical",5:"Mirror horizontal and rotate 270 CW",6:"Rotate 90 CW",7:"Mirror horizontal and rotate 90 CW",8:"Rotate 270 CW"}],[296,{1:"None",2:"inches",3:"cm"}]]);var Rt=te(ie,"exif",[[34850,{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"}],[37121,{0:"-",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}],[37383,{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"}],[37384,{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"}],[37385,{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"}],[41495,{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"}],[41728,{1:"Film Scanner",2:"Reflection Print Scanner",3:"Digital Camera"}],[41729,{1:"Directly photographed"}],[41985,{0:"Normal",1:"Custom",2:"HDR (no original saved)",3:"HDR (original saved)",4:"Original (for HDR)",6:"Panorama",7:"Portrait HDR",8:"Portrait"}],[41986,{0:"Auto",1:"Manual",2:"Auto bracket"}],[41987,{0:"Auto",1:"Manual"}],[41990,{0:"Standard",1:"Landscape",2:"Portrait",3:"Night",4:"Other"}],[41991,{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"}],[41996,{0:"Unknown",1:"Macro",2:"Close",3:"Distant"}],[42080,{0:"Unknown",1:"Not a Composite Image",2:"General Composite Image",3:"Composite Image Captured While Shooting"}]]),Et={1:"No absolute unit of measurement",2:"Inch",3:"Centimeter"};Rt.set(37392,Et),Rt.set(41488,Et);var Nt={0:"Normal",1:"Low",2:"High"};function Mt(e){return"object"==typeof e&&void 0!==e.length?e[0]:e}function Gt(e){var t=m(e).slice(1);return t[1]>15&&(t=t.map((function(e){return String.fromCharCode(e)}))),"0"!==t[2]&&0!==t[2]||t.pop(),t.join(".")}function Ht(e){if("string"==typeof e){var t=e.trim().split(/[-: ]/g).map(Number),n=t[0],r=t[1],i=t[2],a=t[3],s=t[4],o=t[5],u=new Date(n,r-1,i);return isNaN(a)||isNaN(s)||isNaN(o)||(u.setHours(a),u.setMinutes(s),u.setSeconds(o)),isNaN(+u)?e:u}}function Wt(e){if("string"==typeof e)return e;var t=[];if(0===e[1]&&0===e[e.length-1])for(var n=0;n<e.length;n+=2)t.push(Kt(e[n+1],e[n]));else for(var r=0;r<e.length;r+=2)t.push(Kt(e[r],e[r+1]));return _(String.fromCodePoint.apply(String,t))}function Kt(e,t){return e<<8|t}Rt.set(41992,Nt),Rt.set(41993,Nt),Rt.set(41994,Nt),te(ae,["ifd0","ifd1"],[[50827,function(e){return"string"!=typeof e?R(e):e}],[306,Ht],[40091,Wt],[40092,Wt],[40093,Wt],[40094,Wt],[40095,Wt]]),te(ae,"exif",[[40960,Gt],[36864,Gt],[36867,Ht],[36868,Ht],[40962,Mt],[40963,Mt]]),te(ae,"gps",[[0,function(e){return m(e).join(".")}],[7,function(e){return m(e).join(":")}]]);var Xt=function(e){function n(){return t(this,n),l(this,s(n).apply(this,arguments))}return a(n,e),r(n,[{key:"normalizeInput",value:function(e){return"string"==typeof e?e:e.getString&&e.getString()}},{key:"parse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.chunk;if(!this.localOptions.parse)return e;e=an(e);var t=Jt.findAll(e,"rdf","Description");0===t.length&&t.push(new Jt("rdf","Description",void 0,e));var n={},r=t;Array.isArray(r)||("function"==typeof r.entries&&(r=r.entries()),r=m(r));for(var i=0;i<r.length;i++){var a=r[i],s=a.properties;Array.isArray(s)||("function"==typeof s.entries&&(s=s.entries()),s=m(s));for(var o=0;o<s.length;o++){var u=s[o];Zt(u,en(u.ns,n))}}return Yt(n)}},{key:"assignToOutput",value:function(e,t){if(this.localOptions.parse){var n=v(t);Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=m(n));for(var r=0;r<n.length;r++){var i=n[r],a=i[0],s=i[1];switch(a){case"tiff":this.assignObjectToOutput(e,"ifd0",s);break;case"exif":this.assignObjectToOutput(e,"exif",s);break;case"xmlns":break;default:this.assignObjectToOutput(e,a,s)}}}else e.xmp=t}}],[{key:"canHandle",value:function(e,t){return 225===e.getUint8(t+1)&&1752462448===e.getUint32(t+4)&&"http://ns.adobe.com/"===e.getString(t+4,"http://ns.adobe.com/".length)}},{key:"headerLength",value:function(e,t){return"http://ns.adobe.com/xmp/extension/"===e.getString(t+4,"http://ns.adobe.com/xmp/extension/".length)?79:4+"http://ns.adobe.com/xap/1.0/".length+1}},{key:"findPosition",value:function(e,t){var r=d(s(n),"findPosition",this).call(this,e,t);return r.multiSegment=r.extended=79===r.headerLength,r.multiSegment?(r.chunkCount=e.getUint8(t+72),r.chunkNumber=e.getUint8(t+76),0!==e.getUint8(t+77)&&r.chunkNumber++):(r.chunkCount=1/0,r.chunkNumber=-1),r}},{key:"handleMultiSegments",value:function(e){return e.map((function(e){return e.chunk.getString()})).join("")}}]),n}(Le);function Yt(e){for(var t in e)void 0===(e[t]=L(e[t]))&&delete e[t];return L(e)}i(Xt,"type","xmp"),i(Xt,"multiSegment",!0),H.set("xmp",Xt);var qt=function(){function e(n,r,i){t(this,e),this.ns=n,this.name=r,this.value=i}return r(e,null,[{key:"findAll",value:function(t){return tn(t,/([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(e.unpackMatch)}},{key:"unpackMatch",value:function(t){var n=t[1],r=t[2],i=t[3].slice(1,-1);return new e(n,r,i=nn(i))}}]),r(e,[{key:"serialize",value:function(){return this.value}}]),e}(),Jt=function(){function e(n,r,i,a){t(this,e),this.ns=n,this.name=r,this.attrString=i,this.innerXml=a,this.attrs=qt.findAll(i),this.children=e.findAll(a),this.value=0===this.children.length?nn(a):void 0,this.properties=[].concat(this.attrs,this.children)}return r(e,null,[{key:"findAll",value:function(t,n,r){if(void 0!==n||void 0!==r){n=n||"[\\w\\d-]+",r=r||"[\\w\\d-]+";var i=new RegExp("<(".concat(n,"):(").concat(r,")(#\\d+)?((\\s+?[\\w\\d-:]+=(\"[^\"]*\"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)"),"gm")}else i=/<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;return tn(t,i).map(e.unpackMatch)}},{key:"unpackMatch",value:function(t){return new e(t[1],t[2],t[4],t[8])}}]),r(e,[{key:"serialize",value:function(){if(0!==this.properties.length||void 0!==this.value){if(this.isPrimitive)return this.value;if(this.isListContainer)return this.children[0].serialize();if(this.isList)return $t(this.children.map(Qt));if(this.isListItem&&1===this.children.length&&0===this.attrs.length)return this.children[0].serialize();var e={},t=this.properties;Array.isArray(t)||("function"==typeof t.entries&&(t=t.entries()),t=m(t));for(var n=0;n<t.length;n++){Zt(t[n],e)}return void 0!==this.value&&(e.value=this.value),L(e)}}},{key:"isPrimitive",get:function(){return void 0!==this.value&&0===this.attrs.length&&0===this.children.length}},{key:"isListContainer",get:function(){return 1===this.children.length&&this.children[0].isList}},{key:"isList",get:function(){var e=this.ns,t=this.name;return"rdf"===e&&("Seq"===t||"Bag"===t||"Alt"===t)}},{key:"isListItem",get:function(){return"rdf"===this.ns&&"li"===this.name}}]),e}();function Zt(e,t){var n=e.serialize();void 0!==n&&(t[e.name]=n)}var Qt=function(e){return e.serialize()},$t=function(e){return 1===e.length?e[0]:e},en=function(e,t){return t[e]?t[e]:t[e]={}};function tn(e,t){var n,r=[];if(!e)return r;for(;null!==(n=t.exec(e));)r.push(n);return r}function nn(e){if(!function(e){return null==e||"null"===e||"undefined"===e||""===e||""===e.trim()}(e)){var t=Number(e);if(!isNaN(t))return t;var n=e.toLowerCase();return"true"===n||"false"!==n&&e.trim()}}var rn=/(<|\/)(rdf:li|rdf:Seq|rdf:Bag|rdf:Alt)/g;function an(e){var t={"rdf:li":1,"rdf:Seq":1,"rdf:Bag":1,"rdf:Alt":1};return e.replace(rn,(function(e,n,r){return"<"===n?"".concat(e,"#").concat(t[r]++):"".concat(e,"#").concat(--t[r])}))}e.Exifr=Ce,e.Options=me,e.allFormatters=de,e.chunkedProps=se,e.createDictionary=te,e.default=Ut,e.disableAllOptions=st,e.extendDictionary=ne,e.fetchUrlAsArrayBuffer=q,e.fileParsers=G,e.fileReaders=W,e.gps=rt,e.gpsOnlyOptions=ot,e.inheritables=le,e.orientation=nt,e.orientationOnlyOptions=ut,e.otherSegments=oe,e.parse=Be,e.readBlobAsArrayBuffer=Y,e.rotation=tt,e.rotations=ct,e.segmentParsers=H,e.segments=ue,e.segmentsAndBlocks=ce,e.tagKeys=re,e.tagRevivers=ae,e.tagValues=ie,e.thumbnail=at,e.thumbnailOnlyOptions=ft,e.thumbnailUrl=it,e.tiffBlocks=fe,e.tiffExtractables=he,Object.defineProperty(e,"__esModule",{value:!0})}));
  