(function(){function x(a,c){c||a.match(/^data\:([^\;]+)\;base64,/mi);a=a.replace(/^data\:([^\;]+)\;base64,/gmi,"");for(var b=atob(a),f=b.length,d=new ArrayBuffer(f),e=new Uint8Array(d),q=0;q<f;q++)e[q]=b.charCodeAt(q);return d}function y(a,c){var b=new XMLHttpRequest;b.open("GET",a,!0);b.responseType="blob";b.onload=function(a){200!=this.status&&0!==this.status||c(this.response)};b.send()}function z(a,c){function b(b){var e=v(b);a:{var d=new DataView(b);if(255!=d.getUint8(0)||216!=d.getUint8(1))b=
!1;else{for(var f=2,g=b.byteLength;f<g;){var h=d,k=f;if(56===h.getUint8(k)&&66===h.getUint8(k+1)&&73===h.getUint8(k+2)&&77===h.getUint8(k+3)&&4===h.getUint8(k+4)&&4===h.getUint8(k+5)){h=d.getUint8(f+7);0!==h%2&&(h+=1);0===h&&(h=4);g=f+8+h;f=d.getUint16(f+6+h);d=g;b=new DataView(b);for(var g={},p=void 0,k=p=k=void 0,h=d;h<d+f;)28===b.getUint8(h)&&2===b.getUint8(h+1)&&(k=b.getUint8(h+2),k in w&&(p=b.getInt16(h+3),k=w[k],p=t(b,h+5,p),g.hasOwnProperty(k)?g[k]instanceof Array?g[k].push(p):g[k]=[g[k],p]:
g[k]=p)),h++;b=g;break a}f++}b=void 0}}a.exifdata=e||{};a.iptcdata=b||{};c&&c.call(a)}if(a.src)if(/^data\:/i.test(a.src)){var f=x(a.src);b(f)}else if(/^blob\:/i.test(a.src)){var d=new FileReader;d.onload=function(a){b(a.target.result)};y(a.src,function(a){d.readAsArrayBuffer(a)})}else{var e=new XMLHttpRequest;e.onload=function(){if(200==this.status||0===this.status)b(e.response);else throw"Could not load image";e=null};e.open("GET",a.src,!0);e.responseType="arraybuffer";e.send(null)}else window.FileReader&&
(a instanceof window.Blob||a instanceof window.File)&&(d=new FileReader,d.onload=function(a){b(a.target.result)},d.readAsArrayBuffer(a))}function v(a){var c=new DataView(a);if(255!=c.getUint8(0)||216!=c.getUint8(1))return!1;var b=2;a=a.byteLength;for(var f;b<a;){if(255!=c.getUint8(b))return!1;f=c.getUint8(b+1);if(225==f)return A(c,b+4,c.getUint16(b+2)-2);b+=2+c.getUint16(b+2)}}function u(a,c,b,f,d){var e=a.getUint16(b,!d),g={},l,m,r;for(r=0;r<e;r++)l=b+12*r+2,m=f[a.getUint16(l,!d)],g[m]=B(a,l,c,b,
d);return g}function B(a,c,b,f,d){var e=a.getUint16(c+2,!d);f=a.getUint32(c+4,!d);b=a.getUint32(c+8,!d)+b;var g,l;switch(e){case 1:case 7:if(1==f)return a.getUint8(c+8,!d);b=4<f?b:c+8;c=[];for(e=0;e<f;e++)c[e]=a.getUint8(b+e);return c;case 2:return t(a,4<f?b:c+8,f-1);case 3:if(1==f)return a.getUint16(c+8,!d);b=2<f?b:c+8;c=[];for(e=0;e<f;e++)c[e]=a.getUint16(b+2*e,!d);return c;case 4:if(1==f)return a.getUint32(c+8,!d);c=[];for(e=0;e<f;e++)c[e]=a.getUint32(b+4*e,!d);return c;case 5:if(1==f)return g=
a.getUint32(b,!d),l=a.getUint32(b+4,!d),a=new Number(g/l),a.numerator=g,a.denominator=l,a;c=[];for(e=0;e<f;e++)g=a.getUint32(b+8*e,!d),l=a.getUint32(b+4+8*e,!d),c[e]=new Number(g/l),c[e].numerator=g,c[e].denominator=l;return c;case 9:if(1==f)return a.getInt32(c+8,!d);c=[];for(e=0;e<f;e++)c[e]=a.getInt32(b+4*e,!d);return c;case 10:if(1==f)return a.getInt32(b,!d)/a.getInt32(b+4,!d);c=[];for(e=0;e<f;e++)c[e]=a.getInt32(b+8*e,!d)/a.getInt32(b+4+8*e,!d);return c}}function t(a,c,b){var f="";for(n=c;n<c+
b;n++)f+=String.fromCharCode(a.getUint8(n));return f}function A(a,c){if("Exif"!=t(a,c,4))return!1;var b,f,d,e,g=c+6;if(18761==a.getUint16(g))b=!1;else if(19789==a.getUint16(g))b=!0;else return!1;if(42!=a.getUint16(g+2,!b))return!1;f=a.getUint32(g+4,!b);if(8>f)return!1;f=u(a,g,g+f,C,b);if(f.ExifIFDPointer)for(d in e=u(a,g,g+f.ExifIFDPointer,D,b),e){switch(d){case "LightSource":case "Flash":case "MeteringMode":case "ExposureProgram":case "SensingMethod":case "SceneCaptureType":case "SceneType":case "CustomRendered":case "WhiteBalance":case "GainControl":case "Contrast":case "Saturation":case "Sharpness":case "SubjectDistanceRange":case "FileSource":e[d]=
m[d][e[d]];break;case "ExifVersion":case "FlashpixVersion":e[d]=String.fromCharCode(e[d][0],e[d][1],e[d][2],e[d][3]);break;case "ComponentsConfiguration":e[d]=m.Components[e[d][0]]+m.Components[e[d][1]]+m.Components[e[d][2]]+m.Components[e[d][3]]}f[d]=e[d]}if(f.GPSInfoIFDPointer)for(d in b=u(a,g,g+f.GPSInfoIFDPointer,E,b),b){switch(d){case "GPSVersionID":b[d]=b[d][0]+"."+b[d][1]+"."+b[d][2]+"."+b[d][3]}f[d]=b[d]}return f}var g=function(a){if(a instanceof g)return a;if(!(this instanceof g))return new g(a);
this.EXIFwrapped=a};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=g),exports.EXIF=g):this.EXIF=g;var D=g.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",
33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",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:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},C=g.TiffTags={256:"ImageWidth",257:"ImageHeight",
34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",
529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},E=g.GPSTags={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"},m=g.StringValues={ExposureProgram:{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"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",
3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{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"},Flash:{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"},SensingMethod:{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"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},
GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}},w={120:"caption",110:"credit",25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",122:"captionWriter",
105:"headline",116:"copyright",15:"category"};g.getData=function(a,c){if((a instanceof Image||a instanceof HTMLImageElement)&&!a.complete)return!1;a.exifdata?c&&c.call(a):z(a,c);return!0};g.getTag=function(a,c){if(a.exifdata)return a.exifdata[c]};g.getAllTags=function(a){if(!a.exifdata)return{};var c;a=a.exifdata;var b={};for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b};g.pretty=function(a){if(!a.exifdata)return"";var c;a=a.exifdata;var b="";for(c in a)a.hasOwnProperty(c)&&(b="object"==typeof a[c]?
a[c]instanceof Number?b+(c+" : "+a[c]+" ["+a[c].numerator+"/"+a[c].denominator+"]\r\n"):b+(c+" : ["+a[c].length+" values]\r\n"):b+(c+" : "+a[c]+"\r\n"));return b};g.readFromBinaryFile=function(a){return v(a)};"function"===typeof define&&define.amd&&define("exif-js",[],function(){return g})}).call(this);