@mapcatch/util 2.2.9 → 2.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -464,7 +464,7 @@ void main() {
464
464
  `)}function DOMParser$1(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||conventions$1.assign,this.domHandler=r.domHandler||DOMHandler,this.onError=r.onError||r.errorHandler,r.errorHandler&&typeof r.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");r.errorHandler&&r.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=r.normalizeLineEndings||normalizeLineEndings,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}DOMParser$1.prototype.parseFromString=function(r,n){if(!isValidMimeType(n))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+n+'" is not valid.');var o=this.assign(Object.create(null),this.xmlns),l=entities.XML_ENTITIES,s=o[""]||null;hasDefaultHTMLNamespace(n)?(l=entities.HTML_ENTITIES,s=NAMESPACE.HTML):n===MIME_TYPE.XML_SVG_IMAGE&&(s=NAMESPACE.SVG),o[""]=s,o.xml=o.xml||NAMESPACE.XML;var c=new this.domHandler({mimeType:n,defaultNamespace:s,onError:this.onError}),m=this.locator?{}:void 0;this.locator&&c.setDocumentLocator(m);var p=new XMLReader;p.errorHandler=c,p.domBuilder=c;var H=!conventions$1.isHTMLMimeType(n);return H&&typeof r!="string"&&p.errorHandler.fatalError("source is not a string"),p.parse(this.normalizeLineEndings(String(r)),o,l),c.doc.documentElement||p.errorHandler.fatalError("missing root element"),c.doc};function DOMHandler(r){var n=r||{};this.mimeType=n.mimeType||MIME_TYPE.XML_APPLICATION,this.defaultNamespace=n.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=n.onError}function position(r,n){n.lineNumber=r.lineNumber,n.columnNumber=r.columnNumber}DOMHandler.prototype={startDocument:function(){var r=new DOMImplementation;this.doc=isHTMLMimeType(this.mimeType)?r.createHTMLDocument(!1):r.createDocument(this.defaultNamespace,"")},startElement:function(r,n,o,l){var s=this.doc,c=s.createElementNS(r,o||n),m=l.length;appendElement(this,c),this.currentElement=c,this.locator&&position(this.locator,c);for(var p=0;p<m;p++){var r=l.getURI(p),H=l.getValue(p),o=l.getQName(p),d=s.createAttributeNS(r,o);this.locator&&position(l.getLocator(p),d),d.value=d.nodeValue=H,c.setAttributeNode(d)}},endElement:function(r,n,o){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(r,n){},endPrefixMapping:function(r){},processingInstruction:function(r,n){var o=this.doc.createProcessingInstruction(r,n);this.locator&&position(this.locator,o),appendElement(this,o)},ignorableWhitespace:function(r,n,o){},characters:function(r,n,o){if(r=_toString.apply(this,arguments),r){if(this.cdata)var l=this.doc.createCDATASection(r);else var l=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(l):/^\s*$/.test(r)&&this.doc.appendChild(l),this.locator&&position(this.locator,l)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){r&&(r.lineNumber=0),this.locator=r},comment:function(r,n,o){r=_toString.apply(this,arguments);var l=this.doc.createComment(r);this.locator&&position(this.locator,l),appendElement(this,l)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,n,o,l){var s=this.doc.implementation;if(s&&s.createDocumentType){var c=s.createDocumentType(r,n,o,l);this.locator&&position(this.locator,c),appendElement(this,c),this.doc.doctype=c}},reportError:function(r,n){if(typeof this.onError=="function")try{this.onError(r,n,this)}catch(o){throw new ParseError("Reporting "+r+' "'+n+'" caused '+o,this.locator)}else console.error("[xmldom "+r+"] "+n,_locator(this.locator))},warning:function(r){this.reportError("warning",r)},error:function(r){this.reportError("error",r)},fatalError:function(r){throw this.reportError("fatalError",r),new ParseError(r,this.locator)}};function _locator(r){if(r)return`
465
465
  @#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}function _toString(r,n,o){return typeof r=="string"?r.substr(n,o):r.length>=n+o||n?new java.lang.String(r,n,o)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){DOMHandler.prototype[r]=function(){return null}});function appendElement(r,n){r.currentElement?r.currentElement.appendChild(n):r.doc.appendChild(n)}function onErrorStopParsing(r){if(r==="error")throw"onErrorStopParsing"}function onWarningStopParsing(){throw"onWarningStopParsing"}domParser$1.__DOMHandler=DOMHandler;domParser$1.DOMParser=DOMParser$1;domParser$1.normalizeLineEndings=normalizeLineEndings;domParser$1.onErrorStopParsing=onErrorStopParsing;domParser$1.onWarningStopParsing=onWarningStopParsing;var conventions=conventions$5;conventions.assign;conventions.hasDefaultHTMLNamespace;conventions.isHTMLMimeType;conventions.isValidMimeType;conventions.MIME_TYPE;conventions.NAMESPACE;var domParser=domParser$1,DOMParser=domParser.DOMParser;const getData=function(r,n){return util.imageHasData(r)?n&&n(r):getImageData(r,n),!0};function getImageData(r,n){try{var o=findEXIFinJPEG(r);r.exifdata=o.exif,r.xmpdata=o.xmp,n&&n(r)}catch(l){r.exifdata={},r.xmpdata={},n(r,l)}}function findEXIFinJPEG(r){var n=new DataView(r);let o,l;for(var s=2,c=r.byteLength,m=new DOMParser,p;s<c&&n.getUint8(s)==255;){p=n.getUint8(s+1);let E0=n.getUint16(s+2);if(util.getStringFromDB(n,s+4,E0),p==225)if(util.getStringFromDB(n,s+4,4)=="http"){var H=s+3,d=n.getUint16(s+2)-1,x=util.getStringFromDB(n,H,d),Y=x.indexOf("xmpmeta>")+8;x=x.substring(x.indexOf("<x:xmpmeta"),Y);var e0=x.indexOf("x:xmpmeta")+10;x=x.slice(0,e0)+'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tiff="http://ns.adobe.com/tiff/1.0/" xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" xmlns:exif="http://ns.adobe.com/exif/1.0/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '+x.slice(e0);var _0=m.parseFromString(x,"text/xml");l=util.xml2Object(_0)}else o=readEXIFData(n,s+4,n.getUint16(s+2)-2);if(l&&o)break;s+=2+n.getUint16(s+2)}return{exif:o||{},xmp:l||{}}}function readEXIFData(r,n){if(util.getStringFromDB(r,n,4)!="Exif")return!1;var o,l,s,c,m,p=n+6;if(r.getUint16(p)==18761)o=!1;else if(r.getUint16(p)==19789)o=!0;else return!1;if(r.getUint16(p+2,!o)!=42)return!1;var H=r.getUint32(p+4,!o);if(H<8)return!1;if(l=readTags(r,p,p+H,TiffTags,o),l.ExifIFDPointer){c=readTags(r,p,p+l.ExifIFDPointer,ExifTags,o);for(s in c){switch(s){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":c[s]=StringValues[s][c[s]];break;case"ExifVersion":case"FlashpixVersion":c[s]=String.fromCharCode(c[s][0],c[s][1],c[s][2],c[s][3]);break;case"ComponentsConfiguration":c[s]=StringValues.Components[c[s][0]]+StringValues.Components[c[s][1]]+StringValues.Components[c[s][2]]+StringValues.Components[c[s][3]];break}l[s]=c[s]}}if(l.GPSInfoIFDPointer){m=readTags(r,p,p+l.GPSInfoIFDPointer,GPSTags,o);for(s in m){switch(s){case"GPSVersionID":m[s]=m[s][0]+"."+m[s][1]+"."+m[s][2]+"."+m[s][3];break}l[s]=m[s]}}return l}function readTags(r,n,o,l,s){var c=r.getUint16(o,!s),m={},p,H,d;for(d=0;d<c;d++)p=o+d*12+2,H=l[r.getUint16(p,!s)],m[H]=readTagValue(r,p,n,o,s);return m}function readTagValue(r,n,o,l,s){var c=r.getUint16(n+2,!s),m=r.getUint32(n+4,!s),p=r.getUint32(n+8,!s)+o,H,d,x,Y,e0,_0;switch(c){case 1:case 7:if(m==1)return r.getUint8(n+8,!s);for(H=m>4?p:n+8,d=[],Y=0;Y<m;Y++)d[Y]=r.getUint8(H+Y);return d;case 2:return H=m>4?p:n+8,util.getStringFromDB(r,H,m-1);case 3:if(m==1)return r.getUint16(n+8,!s);for(H=m>2?p:n+8,d=[],Y=0;Y<m;Y++)d[Y]=r.getUint16(H+2*Y,!s);return d;case 4:if(m==1)return r.getUint32(n+8,!s);for(d=[],Y=0;Y<m;Y++)d[Y]=r.getUint32(p+4*Y,!s);return d;case 5:if(m==1)return e0=r.getUint32(p,!s),_0=r.getUint32(p+4,!s),x=new Number(e0/_0),x.numerator=e0,x.denominator=_0,x;for(d=[],Y=0;Y<m;Y++)e0=r.getUint32(p+8*Y,!s),_0=r.getUint32(p+4+8*Y,!s),d[Y]=new Number(e0/_0),d[Y].numerator=e0,d[Y].denominator=_0;return d;case 9:if(m==1)return r.getInt32(n+8,!s);for(d=[],Y=0;Y<m;Y++)d[Y]=r.getInt32(p+4*Y,!s);return d;case 10:if(m==1)return r.getInt32(p,!s)/r.getInt32(p+4,!s);for(d=[],Y=0;Y<m;Y++)d[Y]=r.getInt32(p+8*Y,!s)/r.getInt32(p+4+8*Y,!s);return d}}const decoder=new TextDecoder,toUTF8String=(r,n=0,o=r.length)=>decoder.decode(r.slice(n,o)),toHexString=(r,n=0,o=r.length)=>r.slice(n,o).reduce((l,s)=>l+("0"+s.toString(16)).slice(-2),""),readInt16LE=(r,n=0)=>{const o=r[n]+r[n+1]*256;return o|(o&2**15)*131070},readUInt16BE=(r,n=0)=>r[n]*2**8+r[n+1],readUInt16LE=(r,n=0)=>r[n]+r[n+1]*2**8,readUInt24LE=(r,n=0)=>r[n]+r[n+1]*2**8+r[n+2]*2**16,readInt32LE=(r,n=0)=>r[n]+r[n+1]*2**8+r[n+2]*2**16+(r[n+3]<<24),readUInt32BE=(r,n=0)=>r[n]*2**24+r[n+1]*2**16+r[n+2]*2**8+r[n+3],readUInt32LE=(r,n=0)=>r[n]+r[n+1]*2**8+r[n+2]*2**16+r[n+3]*2**24,methods={readUInt16BE,readUInt16LE,readUInt32BE,readUInt32LE};function readUInt(r,n,o,l){o=o||0;const s=l?"BE":"LE",c="readUInt"+n+s;return methods[c](r,o)}function readBox(r,n){if(r.length-n<4)return;const o=readUInt32BE(r,n);if(!(r.length-n<o))return{name:toUTF8String(r,4+n,8+n),offset:n,size:o}}function findBox(r,n,o){for(;o<r.length;){const l=readBox(r,o);if(!l)break;if(l.name===n)return l;o+=l.size}}const BMP={validate:r=>toUTF8String(r,0,2)==="BM",calculate:r=>({height:Math.abs(readInt32LE(r,22)),width:readUInt32LE(r,18)})},TYPE_ICON=1,SIZE_HEADER$1=2+2+2,SIZE_IMAGE_ENTRY=1+1+1+1+2+2+4+4;function getSizeFromOffset(r,n){const o=r[n];return o===0?256:o}function getImageSize$2(r,n){const o=SIZE_HEADER$1+n*SIZE_IMAGE_ENTRY;return{height:getSizeFromOffset(r,o+1),width:getSizeFromOffset(r,o)}}const ICO={validate(r){const n=readUInt16LE(r,0),o=readUInt16LE(r,4);return n!==0||o===0?!1:readUInt16LE(r,2)===TYPE_ICON},calculate(r){const n=readUInt16LE(r,4),o=getImageSize$2(r,0);if(n===1)return o;const l=[o];for(let s=1;s<n;s+=1)l.push(getImageSize$2(r,s));return{height:o.height,images:l,width:o.width}}},TYPE_CURSOR=2,CUR={validate(r){const n=readUInt16LE(r,0),o=readUInt16LE(r,4);return n!==0||o===0?!1:readUInt16LE(r,2)===TYPE_CURSOR},calculate:r=>ICO.calculate(r)},DDS={validate:r=>readUInt32LE(r,0)===542327876,calculate:r=>({height:readUInt32LE(r,12),width:readUInt32LE(r,16)})},gifRegexp=/^GIF8[79]a/,GIF={validate:r=>gifRegexp.test(toUTF8String(r,0,6)),calculate:r=>({height:readUInt16LE(r,8),width:readUInt16LE(r,6)})},brandMap={avif:"avif",mif1:"heif",msf1:"heif",heic:"heic",heix:"heic",hevc:"heic",hevx:"heic"},HEIF={validate(r){const n=toUTF8String(r,4,8),o=toUTF8String(r,8,12);return n==="ftyp"&&o in brandMap},calculate(r){const n=findBox(r,"meta",0),o=n&&findBox(r,"iprp",n.offset+12),l=o&&findBox(r,"ipco",o.offset+8),s=l&&findBox(r,"ispe",l.offset+8);if(s)return{height:readUInt32BE(r,s.offset+16),width:readUInt32BE(r,s.offset+12),type:toUTF8String(r,8,12)};throw new TypeError("Invalid HEIF, no size found")}},SIZE_HEADER=4+4,FILE_LENGTH_OFFSET=4,ENTRY_LENGTH_OFFSET=4,ICON_TYPE_SIZE={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function readImageHeader(r,n){const o=n+ENTRY_LENGTH_OFFSET;return[toUTF8String(r,n,o),readUInt32BE(r,o)]}function getImageSize$1(r){const n=ICON_TYPE_SIZE[r];return{width:n,height:n,type:r}}const ICNS={validate:r=>toUTF8String(r,0,4)==="icns",calculate(r){const n=r.length,o=readUInt32BE(r,FILE_LENGTH_OFFSET);let l=SIZE_HEADER,s=readImageHeader(r,l),c=getImageSize$1(s[0]);if(l+=s[1],l===o)return c;const m={height:c.height,images:[c],width:c.width};for(;l<o&&l<n;)s=readImageHeader(r,l),c=getImageSize$1(s[0]),l+=s[1],m.images.push(c);return m}},J2C={validate:r=>toHexString(r,0,4)==="ff4fff51",calculate:r=>({height:readUInt32BE(r,12),width:readUInt32BE(r,8)})},JP2={validate(r){if(readUInt32BE(r,4)!==1783636e3||readUInt32BE(r,0)<1)return!1;const n=findBox(r,"ftyp",0);return n?readUInt32BE(r,n.offset+4)===1718909296:!1},calculate(r){const n=findBox(r,"jp2h",0),o=n&&findBox(r,"ihdr",n.offset+8);if(o)return{height:readUInt32BE(r,o.offset+8),width:readUInt32BE(r,o.offset+12)};throw new TypeError("Unsupported JPEG 2000 format")}},EXIF_MARKER="45786966",APP1_DATA_SIZE_BYTES=2,EXIF_HEADER_BYTES=6,TIFF_BYTE_ALIGN_BYTES=2,BIG_ENDIAN_BYTE_ALIGN="4d4d",LITTLE_ENDIAN_BYTE_ALIGN="4949",IDF_ENTRY_BYTES=12,NUM_DIRECTORY_ENTRIES_BYTES=2;function isEXIF(r){return toHexString(r,2,6)===EXIF_MARKER}function extractSize(r,n){return{height:readUInt16BE(r,n),width:readUInt16BE(r,n+2)}}function extractOrientation(r,n){const l=EXIF_HEADER_BYTES+8,s=readUInt(r,16,l,n);for(let c=0;c<s;c++){const m=l+NUM_DIRECTORY_ENTRIES_BYTES+c*IDF_ENTRY_BYTES,p=m+IDF_ENTRY_BYTES;if(m>r.length)return;const H=r.slice(m,p);if(readUInt(H,16,0,n)===274)return readUInt(H,16,2,n)!==3||readUInt(H,32,4,n)!==1?void 0:readUInt(H,16,8,n)}}function validateExifBlock(r,n){const o=r.slice(APP1_DATA_SIZE_BYTES,n),l=toHexString(o,EXIF_HEADER_BYTES,EXIF_HEADER_BYTES+TIFF_BYTE_ALIGN_BYTES),s=l===BIG_ENDIAN_BYTE_ALIGN;if(s||l===LITTLE_ENDIAN_BYTE_ALIGN)return extractOrientation(o,s)}function validateInput(r,n){if(n>r.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(r[n]!==255)throw new TypeError("Invalid JPG, marker table corrupted")}const JPG={validate:r=>toHexString(r,0,2)==="ffd8",calculate(r){r=r.slice(4);let n,o;for(;r.length;){const l=readUInt16BE(r,0);if(isEXIF(r)&&(n=validateExifBlock(r,l)),validateInput(r,l),o=r[l+1],o===192||o===193||o===194){const s=extractSize(r,l+5);return n?{height:s.height,orientation:n,width:s.width}:s}r=r.slice(l+2)}throw new TypeError("Invalid JPG, no size found")}},KTX={validate:r=>{const n=toUTF8String(r,1,7);return["KTX 11","KTX 20"].includes(n)},calculate:r=>{const n=r[5]===49?"ktx":"ktx2",o=n==="ktx"?36:20;return{height:readUInt32LE(r,o+4),width:readUInt32LE(r,o),type:n}}},pngSignature=`PNG\r
466
466
  
467
- `,pngImageHeaderChunkName="IHDR",pngFriedChunkName="CgBI",PNG={validate(r){if(pngSignature===toUTF8String(r,1,8)){let n=toUTF8String(r,12,16);if(n===pngFriedChunkName&&(n=toUTF8String(r,28,32)),n!==pngImageHeaderChunkName)throw new TypeError("Invalid PNG");return!0}return!1},calculate(r){return toUTF8String(r,12,16)===pngFriedChunkName?{height:readUInt32BE(r,36),width:readUInt32BE(r,32)}:{height:readUInt32BE(r,20),width:readUInt32BE(r,16)}}},PNMTypes={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},handlers={default:r=>{let n=[];for(;r.length>0;){const o=r.shift();if(o[0]!=="#"){n=o.split(" ");break}}if(n.length===2)return{height:parseInt(n[1],10),width:parseInt(n[0],10)};throw new TypeError("Invalid PNM")},pam:r=>{const n={};for(;r.length>0;){const o=r.shift();if(o.length>16||o.charCodeAt(0)>128)continue;const[l,s]=o.split(" ");if(l&&s&&(n[l.toLowerCase()]=parseInt(s,10)),n.height&&n.width)break}if(n.height&&n.width)return{height:n.height,width:n.width};throw new TypeError("Invalid PAM")}},PNM={validate:r=>toUTF8String(r,0,2)in PNMTypes,calculate(r){const n=toUTF8String(r,0,2),o=PNMTypes[n],l=toUTF8String(r,3).split(/[\r\n]+/);return(handlers[o]||handlers.default)(l)}},PSD={validate:r=>toUTF8String(r,0,4)==="8BPS",calculate:r=>({height:readUInt32BE(r,14),width:readUInt32BE(r,18)})},svgReg=/<svg\s([^>"']|"[^"]*"|'[^']*')*>/,extractorRegExps={height:/\sheight=(['"])([^%]+?)\1/,root:svgReg,viewbox:/\sviewBox=(['"])(.+?)\1/i,width:/\swidth=(['"])([^%]+?)\1/},INCH_CM=2.54,units={in:96,cm:96/INCH_CM,em:16,ex:8,m:96/INCH_CM*100,mm:96/INCH_CM/10,pc:96/72/12,pt:96/72,px:1},unitsReg=new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);function parseLength(r){const n=unitsReg.exec(r);if(!!n)return Math.round(Number(n[1])*(units[n[2]]||1))}function parseViewbox(r){const n=r.split(" ");return{height:parseLength(n[3]),width:parseLength(n[2])}}function parseAttributes(r){const n=r.match(extractorRegExps.width),o=r.match(extractorRegExps.height),l=r.match(extractorRegExps.viewbox);return{height:o&&parseLength(o[2]),viewbox:l&&parseViewbox(l[2]),width:n&&parseLength(n[2])}}function calculateByDimensions(r){return{height:r.height,width:r.width}}function calculateByViewbox(r,n){const o=n.width/n.height;return r.width?{height:Math.floor(r.width/o),width:r.width}:r.height?{height:r.height,width:Math.floor(r.height*o)}:{height:n.height,width:n.width}}const SVG={validate:r=>svgReg.test(toUTF8String(r,0,1e3)),calculate(r){const n=toUTF8String(r).match(extractorRegExps.root);if(n){const o=parseAttributes(n[0]);if(o.width&&o.height)return calculateByDimensions(o);if(o.viewbox)return calculateByViewbox(o,o.viewbox)}throw new TypeError("Invalid SVG")}},TGA={validate(r){return readUInt16LE(r,0)===0&&readUInt16LE(r,4)===0},calculate(r){return{height:readUInt16LE(r,14),width:readUInt16LE(r,12)}}};function readIFD(r,n){const o=readUInt(r,32,4,n);return r.slice(o+2)}function readValue(r,n){const o=readUInt(r,16,8,n);return(readUInt(r,16,10,n)<<16)+o}function nextTag(r){if(r.length>24)return r.slice(12)}function extractTags(r,n){const o={};let l=r;for(;l&&l.length;){const s=readUInt(l,16,0,n),c=readUInt(l,16,2,n),m=readUInt(l,32,4,n);if(s===0)break;m===1&&(c===3||c===4)&&(o[s]=readValue(l,n)),l=nextTag(l)}return o}function determineEndianness(r){const n=toUTF8String(r,0,2);if(n==="II")return"LE";if(n==="MM")return"BE"}const signatures=["49492a00","4d4d002a"],TIFF={validate:r=>signatures.includes(toHexString(r,0,4)),calculate(r){const n=determineEndianness(r)==="BE",o=readIFD(r,n),l=extractTags(o,n),s=l[256],c=l[257];if(!s||!c)throw new TypeError("Invalid Tiff. Missing tags");return{height:c,width:s}}};function calculateExtended(r){return{height:1+readUInt24LE(r,7),width:1+readUInt24LE(r,4)}}function calculateLossless(r){return{height:1+((r[4]&15)<<10|r[3]<<2|(r[2]&192)>>6),width:1+((r[2]&63)<<8|r[1])}}function calculateLossy(r){return{height:readInt16LE(r,8)&16383,width:readInt16LE(r,6)&16383}}const WEBP={validate(r){const n=toUTF8String(r,0,4)==="RIFF",o=toUTF8String(r,8,12)==="WEBP",l=toUTF8String(r,12,15)==="VP8";return n&&o&&l},calculate(r){const n=toUTF8String(r,12,16);if(r=r.slice(20,30),n==="VP8X"){const l=r[0],s=(l&192)===0,c=(l&1)===0;if(s&&c)return calculateExtended(r);throw new TypeError("Invalid WebP")}if(n==="VP8 "&&r[0]!==47)return calculateLossy(r);const o=toHexString(r,3,6);if(n==="VP8L"&&o!=="9d012a")return calculateLossless(r);throw new TypeError("Invalid WebP")}},typeHandlers=new Map([["bmp",BMP],["cur",CUR],["dds",DDS],["gif",GIF],["heif",HEIF],["icns",ICNS],["ico",ICO],["j2c",J2C],["jp2",JP2],["jpg",JPG],["ktx",KTX],["png",PNG],["pnm",PNM],["psd",PSD],["svg",SVG],["tga",TGA],["tiff",TIFF],["webp",WEBP]]),types=Array.from(typeHandlers.keys()),firstBytes=new Map([[56,"psd"],[66,"bmp"],[68,"dds"],[71,"gif"],[73,"tiff"],[77,"tiff"],[82,"webp"],[105,"icns"],[137,"png"],[255,"jpg"]]);function detector(r){const n=r[0],o=firstBytes.get(n);return o&&typeHandlers.get(o).validate(r)?o:types.find(l=>typeHandlers.get(l).validate(r))}const globalOptions={disabledTypes:[]};function lookup(r){const n=detector(r);if(typeof n<"u"){if(globalOptions.disabledTypes.indexOf(n)>-1)throw new TypeError("disabled file type: "+n);const o=typeHandlers.get(n).calculate(r);if(o!==void 0)return o.type=o.type??n,o}throw new TypeError("unsupported file type: "+n)}var sparkMd5={exports:{}};(function(r,n){(function(o){r.exports=o()})(function(o){var l=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(A0,T0){var J=A0[0],o0=A0[1],q=A0[2],S0=A0[3];J+=(o0&q|~o0&S0)+T0[0]-680876936|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[1]-389564586|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[2]+606105819|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[3]-1044525330|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[4]-176418897|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[5]+1200080426|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[6]-1473231341|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[7]-45705983|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[8]+1770035416|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[9]-1958414417|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[10]-42063|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[11]-1990404162|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[12]+1804603682|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[13]-40341101|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[14]-1502002290|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[15]+1236535329|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&S0|q&~S0)+T0[1]-165796510|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[6]-1069501632|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[11]+643717713|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[0]-373897302|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[5]-701558691|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[10]+38016083|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[15]-660478335|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[4]-405537848|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[9]+568446438|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[14]-1019803690|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[3]-187363961|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[8]+1163531501|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[13]-1444681467|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[2]-51403784|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[7]+1735328473|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[12]-1926607734|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0^q^S0)+T0[5]-378558|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[8]-2022574463|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[11]+1839030562|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[14]-35309556|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[1]-1530992060|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[4]+1272893353|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[7]-155497632|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[10]-1094730640|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[13]+681279174|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[0]-358537222|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[3]-722521979|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[6]+76029189|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[9]-640364487|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[12]-421815835|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[15]+530742520|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[2]-995338651|0,o0=(o0<<23|o0>>>9)+q|0,J+=(q^(o0|~S0))+T0[0]-198630844|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[7]+1126891415|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[14]-1416354905|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[5]-57434055|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[12]+1700485571|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[3]-1894986606|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[10]-1051523|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[1]-2054922799|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[8]+1873313359|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[15]-30611744|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[6]-1560198380|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[13]+1309151649|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[4]-145523070|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[11]-1120210379|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[2]+718787259|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[9]-343485551|0,o0=(o0<<21|o0>>>11)+q|0,A0[0]=J+A0[0]|0,A0[1]=o0+A0[1]|0,A0[2]=q+A0[2]|0,A0[3]=S0+A0[3]|0}function c(A0){var T0=[],J;for(J=0;J<64;J+=4)T0[J>>2]=A0.charCodeAt(J)+(A0.charCodeAt(J+1)<<8)+(A0.charCodeAt(J+2)<<16)+(A0.charCodeAt(J+3)<<24);return T0}function m(A0){var T0=[],J;for(J=0;J<64;J+=4)T0[J>>2]=A0[J]+(A0[J+1]<<8)+(A0[J+2]<<16)+(A0[J+3]<<24);return T0}function p(A0){var T0=A0.length,J=[1732584193,-271733879,-1732584194,271733878],o0,q,S0,I0,P0,M0;for(o0=64;o0<=T0;o0+=64)s(J,c(A0.substring(o0-64,o0)));for(A0=A0.substring(o0-64),q=A0.length,S0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o0=0;o0<q;o0+=1)S0[o0>>2]|=A0.charCodeAt(o0)<<(o0%4<<3);if(S0[o0>>2]|=128<<(o0%4<<3),o0>55)for(s(J,S0),o0=0;o0<16;o0+=1)S0[o0]=0;return I0=T0*8,I0=I0.toString(16).match(/(.*?)(.{0,8})$/),P0=parseInt(I0[2],16),M0=parseInt(I0[1],16)||0,S0[14]=P0,S0[15]=M0,s(J,S0),J}function H(A0){var T0=A0.length,J=[1732584193,-271733879,-1732584194,271733878],o0,q,S0,I0,P0,M0;for(o0=64;o0<=T0;o0+=64)s(J,m(A0.subarray(o0-64,o0)));for(A0=o0-64<T0?A0.subarray(o0-64):new Uint8Array(0),q=A0.length,S0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o0=0;o0<q;o0+=1)S0[o0>>2]|=A0[o0]<<(o0%4<<3);if(S0[o0>>2]|=128<<(o0%4<<3),o0>55)for(s(J,S0),o0=0;o0<16;o0+=1)S0[o0]=0;return I0=T0*8,I0=I0.toString(16).match(/(.*?)(.{0,8})$/),P0=parseInt(I0[2],16),M0=parseInt(I0[1],16)||0,S0[14]=P0,S0[15]=M0,s(J,S0),J}function d(A0){var T0="",J;for(J=0;J<4;J+=1)T0+=l[A0>>J*8+4&15]+l[A0>>J*8&15];return T0}function x(A0){var T0;for(T0=0;T0<A0.length;T0+=1)A0[T0]=d(A0[T0]);return A0.join("")}x(p("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function A0(T0,J){return T0=T0|0||0,T0<0?Math.max(T0+J,0):Math.min(T0,J)}ArrayBuffer.prototype.slice=function(T0,J){var o0=this.byteLength,q=A0(T0,o0),S0=o0,I0,P0,M0,H0;return J!==o&&(S0=A0(J,o0)),q>S0?new ArrayBuffer(0):(I0=S0-q,P0=new ArrayBuffer(I0),M0=new Uint8Array(P0),H0=new Uint8Array(this,q,I0),M0.set(H0),P0)}}();function Y(A0){return/[\u0080-\uFFFF]/.test(A0)&&(A0=unescape(encodeURIComponent(A0))),A0}function e0(A0,T0){var J=A0.length,o0=new ArrayBuffer(J),q=new Uint8Array(o0),S0;for(S0=0;S0<J;S0+=1)q[S0]=A0.charCodeAt(S0);return T0?q:o0}function _0(A0){return String.fromCharCode.apply(null,new Uint8Array(A0))}function E0(A0,T0,J){var o0=new Uint8Array(A0.byteLength+T0.byteLength);return o0.set(new Uint8Array(A0)),o0.set(new Uint8Array(T0),A0.byteLength),J?o0:o0.buffer}function n0(A0){var T0=[],J=A0.length,o0;for(o0=0;o0<J-1;o0+=2)T0.push(parseInt(A0.substr(o0,2),16));return String.fromCharCode.apply(String,T0)}function l0(){this.reset()}return l0.prototype.append=function(A0){return this.appendBinary(Y(A0)),this},l0.prototype.appendBinary=function(A0){this._buff+=A0,this._length+=A0.length;var T0=this._buff.length,J;for(J=64;J<=T0;J+=64)s(this._hash,c(this._buff.substring(J-64,J)));return this._buff=this._buff.substring(J-64),this},l0.prototype.end=function(A0){var T0=this._buff,J=T0.length,o0,q=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],S0;for(o0=0;o0<J;o0+=1)q[o0>>2]|=T0.charCodeAt(o0)<<(o0%4<<3);return this._finish(q,J),S0=x(this._hash),A0&&(S0=n0(S0)),this.reset(),S0},l0.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l0.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},l0.prototype.setState=function(A0){return this._buff=A0.buff,this._length=A0.length,this._hash=A0.hash,this},l0.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},l0.prototype._finish=function(A0,T0){var J=T0,o0,q,S0;if(A0[J>>2]|=128<<(J%4<<3),J>55)for(s(this._hash,A0),J=0;J<16;J+=1)A0[J]=0;o0=this._length*8,o0=o0.toString(16).match(/(.*?)(.{0,8})$/),q=parseInt(o0[2],16),S0=parseInt(o0[1],16)||0,A0[14]=q,A0[15]=S0,s(this._hash,A0)},l0.hash=function(A0,T0){return l0.hashBinary(Y(A0),T0)},l0.hashBinary=function(A0,T0){var J=p(A0),o0=x(J);return T0?n0(o0):o0},l0.ArrayBuffer=function(){this.reset()},l0.ArrayBuffer.prototype.append=function(A0){var T0=E0(this._buff.buffer,A0,!0),J=T0.length,o0;for(this._length+=A0.byteLength,o0=64;o0<=J;o0+=64)s(this._hash,m(T0.subarray(o0-64,o0)));return this._buff=o0-64<J?new Uint8Array(T0.buffer.slice(o0-64)):new Uint8Array(0),this},l0.ArrayBuffer.prototype.end=function(A0){var T0=this._buff,J=T0.length,o0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],q,S0;for(q=0;q<J;q+=1)o0[q>>2]|=T0[q]<<(q%4<<3);return this._finish(o0,J),S0=x(this._hash),A0&&(S0=n0(S0)),this.reset(),S0},l0.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l0.ArrayBuffer.prototype.getState=function(){var A0=l0.prototype.getState.call(this);return A0.buff=_0(A0.buff),A0},l0.ArrayBuffer.prototype.setState=function(A0){return A0.buff=e0(A0.buff,!0),l0.prototype.setState.call(this,A0)},l0.ArrayBuffer.prototype.destroy=l0.prototype.destroy,l0.ArrayBuffer.prototype._finish=l0.prototype._finish,l0.ArrayBuffer.hash=function(A0,T0){var J=H(new Uint8Array(A0)),o0=x(J);return T0?n0(o0):o0},l0})})(sparkMd5);const SparkMD5=sparkMd5.exports,getPhotoMetadata=async r=>{let n=getFileExtent(r),o={};if(n==="jpg"||n==="jpeg")try{o=await _formatMetadata(r)}catch{o=await getImageSize(r)}else o=await getImageSize(r);return o.filesize=getFileSize(r),o};async function _formatMetadata(r,n=1){let o=await getFileBuffer(r,n),l=getMd5(o);return new Promise((s,c)=>{getData(o.buffer||o,function(m,p){if(p)return p.message==="Offset is outside the bounds of the DataView"&&n<3?s(_formatMetadata(r,n+1)):c(p);let{exif:H,xmp:d}=getAllTags(m);H=JSON.parse(JSON.stringify(H).replaceAll("\\u0000",""))||{},H.PixelXDimension&&H.PixelYDimension&&H.PixelXDimension!=65535&&H.PixelYDimension!=65535?s({exif:H,xmp:d,width:H.PixelXDimension,height:H.PixelYDimension,md5:l}):getImageSize(r).then(x=>{s({exif:H,xmp:d,width:x.width,height:x.height,md5:l})})})})}async function getImageSize(r){try{let n=await getFileBuffer(r),o=lookup(n),l,s=getFileExtent(r);if(s==="tif"||s==="tiff"||s==="png"){let c;typeof r=="string"?c=r:typeof window<"u"&&r instanceof window.File?c=r.name:c=Buffer.concat([n.subarray(0,10240),n.subarray(n.length/2,10240),n.subarray(-10240)]),typeof c=="string"?typeof Buffer<"u"?l=getMd5(Buffer.from(c)):l=getMd5(new TextEncoder().encode(c)):l=getMd5(c)}else l=getMd5(Buffer.concat([n.subarray(0,10240),n.subarray(n.length/2,10240),n.subarray(-10240)]));return{width:o.width,height:o.height,md5:l}}catch{return{width:0,height:0}}}function getAllTags(r){return util.imageHasData(r)?{exif:r.exifdata||{},xmp:r.xmpdata||{}}:{exif:{},xmp:{}}}function getFileExtent(r){return typeof r=="string"?r.split(".").pop().toLowerCase():typeof window<"u"&&r instanceof window.File?r.name.split(".").pop().toLowerCase():"jpg"}async function getFileBuffer(r,n){if(typeof r=="string")if(n){let o=fs__default.default.openSync(r),l=Buffer.alloc(65536*n);return await new Promise(s=>{fs__default.default.read(o,l,0,l.length,0,()=>{s(),fs__default.default.closeSync(o)})}),l}else return fs__default.default.readFileSync(r);else{if(typeof window<"u"&&r instanceof window.File)return n&&(r=r.slice(0,65536*n)),await new Promise((o,l)=>{var s=new FileReader;s.readAsArrayBuffer(r),s.onload=c=>{o(c.target.result)},s.onerror=c=>{l(c)}});if(Buffer.isBuffer(r))return r}}function getFileSize(r){return typeof r=="string"?fs__default.default.statSync(r).size:r.size||r.length}function getMd5(r){let n=new SparkMD5.ArrayBuffer;return n.append(r),n.end()}async function parsePhoto(r){let n=await getPhotoMetadata(r);const{width:o,height:l,exif:s,xmp:c,filesize:m,md5:p}=n;let H={width:o,height:l,filesize:m,md5:p},d=NaN,x=NaN,Y=NaN,e0=NaN,_0=NaN,E0=NaN,n0=[d,x,Y],l0=flatObject(c),{GPSAltitude:A0,GPSLatitude:T0,GPSLatitudeRef:J,GPSLongitude:o0,GPSLongitudeRef:q}=s||{};o0&&T0&&(n0=[getGeoCoordOperator(q)*toRadian(o0),getGeoCoordOperator(J)*toRadian(T0),+A0]);for(let S0 in l0){let I0=l0[S0];if(S0==="drone-dji:GpsLongtitude"||S0==="drone-dji:GpsLongitude")d=Number(I0);else if(S0==="drone-dji:GpsLatitude")x=Number(I0);else if(S0==="drone-dji:AbsoluteAltitude")Y=Number(I0);else if(S0==="drone-dji:GimbalYawDegree")e0=Number(I0);else if(S0==="drone-dji:GimbalPitchDegree")_0=Number(I0);else if(S0==="drone-dji:GimbalRollDegree")E0=Number(I0);else if(S0==="drone-dji:DewarpFlag")H.dewarp_flag=Boolean(Number(I0));else if(S0==="drone-dji:RtkFlag")H.rtk_flag=Number(I0);else if(S0==="drone-dji:RelativeAltitude")H.relative_altitude=Number(I0);else if(S0==="tiff:Model")H.camera_model=I0;else if(S0==="tiff:Make")H.make=I0;else if(S0==="drone-dji:DewarpData"){let M0=I0.split(";")[1].split(",").map(H0=>Number(H0));!M0[0]&&!M0[1]&&(M0[2]=o/2+M0[2],M0[3]=l/2+M0[3],H.pre_calib_param=M0)}else S0==="drone-dji:CaptureUUID"?H.capture_uuid=I0:S0==="drone-dji:DroneID"?H.drone_id=I0:S0==="drone-dji:DroneSerialNumber"?H.drone_serial_number=I0:S0==="drone-dji:CameraSerialNumber"&&(H.camera_serial_number=I0)}if(!Number.isNaN(e0)&&!Number.isNaN(_0)&&!Number.isNaN(E0)&&(H.pitch_roll_yaw=[_0,E0,e0],H.orientation=getRotationMatrix(_0,E0,e0)),s?.DateTime?H.capture_time=hooks(s.DateTime,"YYYY:MM:DD HH:mm:ss").valueOf():s?.DateTimeOriginal&&(H.capture_time=hooks(s.DateTimeOriginal,"YYYY:MM:DD HH:mm:ss").valueOf()),s?.FocalLengthIn35mmFilm&&(H.focal_length_in_35mm=s.FocalLengthIn35mmFilm,!H.pre_calib_param)){let S0=new Array(10).fill(0),I0=s.FocalLengthIn35mmFilm;S0[0]=S0[1]=I0/35*Math.max(o,l),S0[2]=o/2,S0[3]=l/2,H.pre_calib_param=S0}if(hasNaN(n0)&&(n0=[d,x,Y]),!hasNaN(n0))if(H.pos=n0,H.absolute_altitude=n0[2],H.coordinate_system={type:2,label:"WGS 84",type_name:"Geographic",epsg_code:4326},H.make==="DJI"&&H.rtk_flag){let S0=[];H.rtk_flag===50?S0=[.03,.03,.06]:H.rtk_flag===16?S0=[.5,.5,1]:S0=[2,2,5],H.pos_sigma=S0}else H.pos_sigma=[2,2,5];return H}function parsePhotos(r,n){let o=[],l=r,s=r.length,c=10,m=0;return new Promise(p=>{const H=[],d=()=>{for(let Y=m;Y<c;Y++){let e0=l.pop();if(!e0)break;m++,parsePhoto(e0).then(_0=>{if(!_0.width||!_0.height)throw new Error("broken photo");let E0=e0.split(".").pop(),n0={width:_0.width,height:_0.height,ext:E0,parameters:_0.pre_calib_param||null},l0=o.find(A0=>A0.width===n0.width&&A0.height===n0.height&&A0.ext===n0.ext&&_$1.isEqual(A0.parameters,n0.parameters));l0||(l0=n0,l0.fileList=[],o.push(l0)),l0.fileList.push({name:e0.split("\\").pop(),filesize:_0.filesize,md5:_0.md5,filePath:e0,meta_data:_0})}).catch(_0=>{H.push({file:e0,error:_0?.message||String(_0)})}).finally(()=>{m--,x()})}},x=()=>{l.length?d():m||p({cameras:o,failed:H});let Y=s-l.length-m;n&&n(Y,s,H)};d()})}function _extends(){return _extends=Object.assign?Object.assign.bind():function(r){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var l in o)({}).hasOwnProperty.call(o,l)&&(r[l]=o[l])}return r},_extends.apply(null,arguments)}var DEFAULT_CONFIG={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function isNumber(r){return typeof r=="number"}function isBigNumber(r){return!r||typeof r!="object"||typeof r.constructor!="function"?!1:r.isBigNumber===!0&&typeof r.constructor.prototype=="object"&&r.constructor.prototype.isBigNumber===!0||typeof r.constructor.isDecimal=="function"&&r.constructor.isDecimal(r)===!0}function isComplex(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isComplex===!0||!1}function isFraction(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isFraction===!0||!1}function isUnit(r){return r&&r.constructor.prototype.isUnit===!0||!1}function isString(r){return typeof r=="string"}var isArray=Array.isArray;function isMatrix(r){return r&&r.constructor.prototype.isMatrix===!0||!1}function isCollection(r){return Array.isArray(r)||isMatrix(r)}function isDenseMatrix(r){return r&&r.isDenseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function isSparseMatrix(r){return r&&r.isSparseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function isRange(r){return r&&r.constructor.prototype.isRange===!0||!1}function isIndex(r){return r&&r.constructor.prototype.isIndex===!0||!1}function isBoolean(r){return typeof r=="boolean"}function isResultSet(r){return r&&r.constructor.prototype.isResultSet===!0||!1}function isHelp(r){return r&&r.constructor.prototype.isHelp===!0||!1}function isFunction(r){return typeof r=="function"}function isDate(r){return r instanceof Date}function isRegExp(r){return r instanceof RegExp}function isObject(r){return!!(r&&typeof r=="object"&&r.constructor===Object&&!isComplex(r)&&!isFraction(r))}function isNull(r){return r===null}function isUndefined(r){return r===void 0}function isAccessorNode(r){return r&&r.isAccessorNode===!0&&r.constructor.prototype.isNode===!0||!1}function isArrayNode(r){return r&&r.isArrayNode===!0&&r.constructor.prototype.isNode===!0||!1}function isAssignmentNode(r){return r&&r.isAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function isBlockNode(r){return r&&r.isBlockNode===!0&&r.constructor.prototype.isNode===!0||!1}function isConditionalNode(r){return r&&r.isConditionalNode===!0&&r.constructor.prototype.isNode===!0||!1}function isConstantNode(r){return r&&r.isConstantNode===!0&&r.constructor.prototype.isNode===!0||!1}function isFunctionAssignmentNode(r){return r&&r.isFunctionAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function isFunctionNode(r){return r&&r.isFunctionNode===!0&&r.constructor.prototype.isNode===!0||!1}function isIndexNode(r){return r&&r.isIndexNode===!0&&r.constructor.prototype.isNode===!0||!1}function isNode(r){return r&&r.isNode===!0&&r.constructor.prototype.isNode===!0||!1}function isObjectNode(r){return r&&r.isObjectNode===!0&&r.constructor.prototype.isNode===!0||!1}function isOperatorNode(r){return r&&r.isOperatorNode===!0&&r.constructor.prototype.isNode===!0||!1}function isParenthesisNode(r){return r&&r.isParenthesisNode===!0&&r.constructor.prototype.isNode===!0||!1}function isRangeNode(r){return r&&r.isRangeNode===!0&&r.constructor.prototype.isNode===!0||!1}function isRelationalNode(r){return r&&r.isRelationalNode===!0&&r.constructor.prototype.isNode===!0||!1}function isSymbolNode(r){return r&&r.isSymbolNode===!0&&r.constructor.prototype.isNode===!0||!1}function isChain(r){return r&&r.constructor.prototype.isChain===!0||!1}function typeOf(r){var n=typeof r;return n==="object"?r===null?"null":isBigNumber(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":n}function clone$2(r){var n=typeof r;if(n==="number"||n==="string"||n==="boolean"||r===null||r===void 0)return r;if(typeof r.clone=="function")return r.clone();if(Array.isArray(r))return r.map(function(o){return clone$2(o)});if(r instanceof Date)return new Date(r.valueOf());if(isBigNumber(r))return r;if(isObject(r))return mapObject(r,clone$2);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function mapObject(r,n){var o={};for(var l in r)hasOwnProperty(r,l)&&(o[l]=n(r[l]));return o}function extend(r,n){for(var o in n)hasOwnProperty(n,o)&&(r[o]=n[o]);return r}function deepStrictEqual(r,n){var o,l,s;if(Array.isArray(r)){if(!Array.isArray(n)||r.length!==n.length)return!1;for(l=0,s=r.length;l<s;l++)if(!deepStrictEqual(r[l],n[l]))return!1;return!0}else{if(typeof r=="function")return r===n;if(r instanceof Object){if(Array.isArray(n)||!(n instanceof Object))return!1;for(o in r)if(!(o in n)||!deepStrictEqual(r[o],n[o]))return!1;for(o in n)if(!(o in r))return!1;return!0}else return r===n}}function hasOwnProperty(r,n){return r&&Object.hasOwnProperty.call(r,n)}function pickShallow(r,n){for(var o={},l=0;l<n.length;l++){var s=n[l],c=r[s];c!==void 0&&(o[s]=c)}return o}var MATRIX_OPTIONS=["Matrix","Array"],NUMBER_OPTIONS=["number","BigNumber","Fraction"],config$1=function r(n){if(n)throw new Error(`The global config is readonly.
467
+ `,pngImageHeaderChunkName="IHDR",pngFriedChunkName="CgBI",PNG={validate(r){if(pngSignature===toUTF8String(r,1,8)){let n=toUTF8String(r,12,16);if(n===pngFriedChunkName&&(n=toUTF8String(r,28,32)),n!==pngImageHeaderChunkName)throw new TypeError("Invalid PNG");return!0}return!1},calculate(r){return toUTF8String(r,12,16)===pngFriedChunkName?{height:readUInt32BE(r,36),width:readUInt32BE(r,32)}:{height:readUInt32BE(r,20),width:readUInt32BE(r,16)}}},PNMTypes={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},handlers={default:r=>{let n=[];for(;r.length>0;){const o=r.shift();if(o[0]!=="#"){n=o.split(" ");break}}if(n.length===2)return{height:parseInt(n[1],10),width:parseInt(n[0],10)};throw new TypeError("Invalid PNM")},pam:r=>{const n={};for(;r.length>0;){const o=r.shift();if(o.length>16||o.charCodeAt(0)>128)continue;const[l,s]=o.split(" ");if(l&&s&&(n[l.toLowerCase()]=parseInt(s,10)),n.height&&n.width)break}if(n.height&&n.width)return{height:n.height,width:n.width};throw new TypeError("Invalid PAM")}},PNM={validate:r=>toUTF8String(r,0,2)in PNMTypes,calculate(r){const n=toUTF8String(r,0,2),o=PNMTypes[n],l=toUTF8String(r,3).split(/[\r\n]+/);return(handlers[o]||handlers.default)(l)}},PSD={validate:r=>toUTF8String(r,0,4)==="8BPS",calculate:r=>({height:readUInt32BE(r,14),width:readUInt32BE(r,18)})},svgReg=/<svg\s([^>"']|"[^"]*"|'[^']*')*>/,extractorRegExps={height:/\sheight=(['"])([^%]+?)\1/,root:svgReg,viewbox:/\sviewBox=(['"])(.+?)\1/i,width:/\swidth=(['"])([^%]+?)\1/},INCH_CM=2.54,units={in:96,cm:96/INCH_CM,em:16,ex:8,m:96/INCH_CM*100,mm:96/INCH_CM/10,pc:96/72/12,pt:96/72,px:1},unitsReg=new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);function parseLength(r){const n=unitsReg.exec(r);if(!!n)return Math.round(Number(n[1])*(units[n[2]]||1))}function parseViewbox(r){const n=r.split(" ");return{height:parseLength(n[3]),width:parseLength(n[2])}}function parseAttributes(r){const n=r.match(extractorRegExps.width),o=r.match(extractorRegExps.height),l=r.match(extractorRegExps.viewbox);return{height:o&&parseLength(o[2]),viewbox:l&&parseViewbox(l[2]),width:n&&parseLength(n[2])}}function calculateByDimensions(r){return{height:r.height,width:r.width}}function calculateByViewbox(r,n){const o=n.width/n.height;return r.width?{height:Math.floor(r.width/o),width:r.width}:r.height?{height:r.height,width:Math.floor(r.height*o)}:{height:n.height,width:n.width}}const SVG={validate:r=>svgReg.test(toUTF8String(r,0,1e3)),calculate(r){const n=toUTF8String(r).match(extractorRegExps.root);if(n){const o=parseAttributes(n[0]);if(o.width&&o.height)return calculateByDimensions(o);if(o.viewbox)return calculateByViewbox(o,o.viewbox)}throw new TypeError("Invalid SVG")}},TGA={validate(r){return readUInt16LE(r,0)===0&&readUInt16LE(r,4)===0},calculate(r){return{height:readUInt16LE(r,14),width:readUInt16LE(r,12)}}};function readIFD(r,n){const o=readUInt(r,32,4,n);return r.slice(o+2)}function readValue(r,n){const o=readUInt(r,16,8,n);return(readUInt(r,16,10,n)<<16)+o}function nextTag(r){if(r.length>24)return r.slice(12)}function extractTags(r,n){const o={};let l=r;for(;l&&l.length;){const s=readUInt(l,16,0,n),c=readUInt(l,16,2,n),m=readUInt(l,32,4,n);if(s===0)break;m===1&&(c===3||c===4)&&(o[s]=readValue(l,n)),l=nextTag(l)}return o}function determineEndianness(r){const n=toUTF8String(r,0,2);if(n==="II")return"LE";if(n==="MM")return"BE"}const signatures=["49492a00","4d4d002a"],TIFF={validate:r=>signatures.includes(toHexString(r,0,4)),calculate(r){const n=determineEndianness(r)==="BE",o=readIFD(r,n),l=extractTags(o,n),s=l[256],c=l[257];if(!s||!c)throw new TypeError("Invalid Tiff. Missing tags");return{height:c,width:s}}};function calculateExtended(r){return{height:1+readUInt24LE(r,7),width:1+readUInt24LE(r,4)}}function calculateLossless(r){return{height:1+((r[4]&15)<<10|r[3]<<2|(r[2]&192)>>6),width:1+((r[2]&63)<<8|r[1])}}function calculateLossy(r){return{height:readInt16LE(r,8)&16383,width:readInt16LE(r,6)&16383}}const WEBP={validate(r){const n=toUTF8String(r,0,4)==="RIFF",o=toUTF8String(r,8,12)==="WEBP",l=toUTF8String(r,12,15)==="VP8";return n&&o&&l},calculate(r){const n=toUTF8String(r,12,16);if(r=r.slice(20,30),n==="VP8X"){const l=r[0],s=(l&192)===0,c=(l&1)===0;if(s&&c)return calculateExtended(r);throw new TypeError("Invalid WebP")}if(n==="VP8 "&&r[0]!==47)return calculateLossy(r);const o=toHexString(r,3,6);if(n==="VP8L"&&o!=="9d012a")return calculateLossless(r);throw new TypeError("Invalid WebP")}},typeHandlers=new Map([["bmp",BMP],["cur",CUR],["dds",DDS],["gif",GIF],["heif",HEIF],["icns",ICNS],["ico",ICO],["j2c",J2C],["jp2",JP2],["jpg",JPG],["ktx",KTX],["png",PNG],["pnm",PNM],["psd",PSD],["svg",SVG],["tga",TGA],["tiff",TIFF],["webp",WEBP]]),types=Array.from(typeHandlers.keys()),firstBytes=new Map([[56,"psd"],[66,"bmp"],[68,"dds"],[71,"gif"],[73,"tiff"],[77,"tiff"],[82,"webp"],[105,"icns"],[137,"png"],[255,"jpg"]]);function detector(r){const n=r[0],o=firstBytes.get(n);return o&&typeHandlers.get(o).validate(r)?o:types.find(l=>typeHandlers.get(l).validate(r))}const globalOptions={disabledTypes:[]};function lookup(r){const n=detector(r);if(typeof n<"u"){if(globalOptions.disabledTypes.indexOf(n)>-1)throw new TypeError("disabled file type: "+n);const o=typeHandlers.get(n).calculate(r);if(o!==void 0)return o.type=o.type??n,o}throw new TypeError("unsupported file type: "+n)}var sparkMd5={exports:{}};(function(r,n){(function(o){r.exports=o()})(function(o){var l=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(A0,T0){var J=A0[0],o0=A0[1],q=A0[2],S0=A0[3];J+=(o0&q|~o0&S0)+T0[0]-680876936|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[1]-389564586|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[2]+606105819|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[3]-1044525330|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[4]-176418897|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[5]+1200080426|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[6]-1473231341|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[7]-45705983|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[8]+1770035416|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[9]-1958414417|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[10]-42063|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[11]-1990404162|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[12]+1804603682|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[13]-40341101|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[14]-1502002290|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[15]+1236535329|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&S0|q&~S0)+T0[1]-165796510|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[6]-1069501632|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[11]+643717713|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[0]-373897302|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[5]-701558691|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[10]+38016083|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[15]-660478335|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[4]-405537848|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[9]+568446438|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[14]-1019803690|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[3]-187363961|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[8]+1163531501|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[13]-1444681467|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[2]-51403784|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[7]+1735328473|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[12]-1926607734|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0^q^S0)+T0[5]-378558|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[8]-2022574463|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[11]+1839030562|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[14]-35309556|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[1]-1530992060|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[4]+1272893353|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[7]-155497632|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[10]-1094730640|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[13]+681279174|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[0]-358537222|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[3]-722521979|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[6]+76029189|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[9]-640364487|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[12]-421815835|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[15]+530742520|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[2]-995338651|0,o0=(o0<<23|o0>>>9)+q|0,J+=(q^(o0|~S0))+T0[0]-198630844|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[7]+1126891415|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[14]-1416354905|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[5]-57434055|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[12]+1700485571|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[3]-1894986606|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[10]-1051523|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[1]-2054922799|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[8]+1873313359|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[15]-30611744|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[6]-1560198380|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[13]+1309151649|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[4]-145523070|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[11]-1120210379|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[2]+718787259|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[9]-343485551|0,o0=(o0<<21|o0>>>11)+q|0,A0[0]=J+A0[0]|0,A0[1]=o0+A0[1]|0,A0[2]=q+A0[2]|0,A0[3]=S0+A0[3]|0}function c(A0){var T0=[],J;for(J=0;J<64;J+=4)T0[J>>2]=A0.charCodeAt(J)+(A0.charCodeAt(J+1)<<8)+(A0.charCodeAt(J+2)<<16)+(A0.charCodeAt(J+3)<<24);return T0}function m(A0){var T0=[],J;for(J=0;J<64;J+=4)T0[J>>2]=A0[J]+(A0[J+1]<<8)+(A0[J+2]<<16)+(A0[J+3]<<24);return T0}function p(A0){var T0=A0.length,J=[1732584193,-271733879,-1732584194,271733878],o0,q,S0,I0,P0,M0;for(o0=64;o0<=T0;o0+=64)s(J,c(A0.substring(o0-64,o0)));for(A0=A0.substring(o0-64),q=A0.length,S0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o0=0;o0<q;o0+=1)S0[o0>>2]|=A0.charCodeAt(o0)<<(o0%4<<3);if(S0[o0>>2]|=128<<(o0%4<<3),o0>55)for(s(J,S0),o0=0;o0<16;o0+=1)S0[o0]=0;return I0=T0*8,I0=I0.toString(16).match(/(.*?)(.{0,8})$/),P0=parseInt(I0[2],16),M0=parseInt(I0[1],16)||0,S0[14]=P0,S0[15]=M0,s(J,S0),J}function H(A0){var T0=A0.length,J=[1732584193,-271733879,-1732584194,271733878],o0,q,S0,I0,P0,M0;for(o0=64;o0<=T0;o0+=64)s(J,m(A0.subarray(o0-64,o0)));for(A0=o0-64<T0?A0.subarray(o0-64):new Uint8Array(0),q=A0.length,S0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o0=0;o0<q;o0+=1)S0[o0>>2]|=A0[o0]<<(o0%4<<3);if(S0[o0>>2]|=128<<(o0%4<<3),o0>55)for(s(J,S0),o0=0;o0<16;o0+=1)S0[o0]=0;return I0=T0*8,I0=I0.toString(16).match(/(.*?)(.{0,8})$/),P0=parseInt(I0[2],16),M0=parseInt(I0[1],16)||0,S0[14]=P0,S0[15]=M0,s(J,S0),J}function d(A0){var T0="",J;for(J=0;J<4;J+=1)T0+=l[A0>>J*8+4&15]+l[A0>>J*8&15];return T0}function x(A0){var T0;for(T0=0;T0<A0.length;T0+=1)A0[T0]=d(A0[T0]);return A0.join("")}x(p("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function A0(T0,J){return T0=T0|0||0,T0<0?Math.max(T0+J,0):Math.min(T0,J)}ArrayBuffer.prototype.slice=function(T0,J){var o0=this.byteLength,q=A0(T0,o0),S0=o0,I0,P0,M0,H0;return J!==o&&(S0=A0(J,o0)),q>S0?new ArrayBuffer(0):(I0=S0-q,P0=new ArrayBuffer(I0),M0=new Uint8Array(P0),H0=new Uint8Array(this,q,I0),M0.set(H0),P0)}}();function Y(A0){return/[\u0080-\uFFFF]/.test(A0)&&(A0=unescape(encodeURIComponent(A0))),A0}function e0(A0,T0){var J=A0.length,o0=new ArrayBuffer(J),q=new Uint8Array(o0),S0;for(S0=0;S0<J;S0+=1)q[S0]=A0.charCodeAt(S0);return T0?q:o0}function _0(A0){return String.fromCharCode.apply(null,new Uint8Array(A0))}function E0(A0,T0,J){var o0=new Uint8Array(A0.byteLength+T0.byteLength);return o0.set(new Uint8Array(A0)),o0.set(new Uint8Array(T0),A0.byteLength),J?o0:o0.buffer}function n0(A0){var T0=[],J=A0.length,o0;for(o0=0;o0<J-1;o0+=2)T0.push(parseInt(A0.substr(o0,2),16));return String.fromCharCode.apply(String,T0)}function l0(){this.reset()}return l0.prototype.append=function(A0){return this.appendBinary(Y(A0)),this},l0.prototype.appendBinary=function(A0){this._buff+=A0,this._length+=A0.length;var T0=this._buff.length,J;for(J=64;J<=T0;J+=64)s(this._hash,c(this._buff.substring(J-64,J)));return this._buff=this._buff.substring(J-64),this},l0.prototype.end=function(A0){var T0=this._buff,J=T0.length,o0,q=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],S0;for(o0=0;o0<J;o0+=1)q[o0>>2]|=T0.charCodeAt(o0)<<(o0%4<<3);return this._finish(q,J),S0=x(this._hash),A0&&(S0=n0(S0)),this.reset(),S0},l0.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l0.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},l0.prototype.setState=function(A0){return this._buff=A0.buff,this._length=A0.length,this._hash=A0.hash,this},l0.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},l0.prototype._finish=function(A0,T0){var J=T0,o0,q,S0;if(A0[J>>2]|=128<<(J%4<<3),J>55)for(s(this._hash,A0),J=0;J<16;J+=1)A0[J]=0;o0=this._length*8,o0=o0.toString(16).match(/(.*?)(.{0,8})$/),q=parseInt(o0[2],16),S0=parseInt(o0[1],16)||0,A0[14]=q,A0[15]=S0,s(this._hash,A0)},l0.hash=function(A0,T0){return l0.hashBinary(Y(A0),T0)},l0.hashBinary=function(A0,T0){var J=p(A0),o0=x(J);return T0?n0(o0):o0},l0.ArrayBuffer=function(){this.reset()},l0.ArrayBuffer.prototype.append=function(A0){var T0=E0(this._buff.buffer,A0,!0),J=T0.length,o0;for(this._length+=A0.byteLength,o0=64;o0<=J;o0+=64)s(this._hash,m(T0.subarray(o0-64,o0)));return this._buff=o0-64<J?new Uint8Array(T0.buffer.slice(o0-64)):new Uint8Array(0),this},l0.ArrayBuffer.prototype.end=function(A0){var T0=this._buff,J=T0.length,o0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],q,S0;for(q=0;q<J;q+=1)o0[q>>2]|=T0[q]<<(q%4<<3);return this._finish(o0,J),S0=x(this._hash),A0&&(S0=n0(S0)),this.reset(),S0},l0.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l0.ArrayBuffer.prototype.getState=function(){var A0=l0.prototype.getState.call(this);return A0.buff=_0(A0.buff),A0},l0.ArrayBuffer.prototype.setState=function(A0){return A0.buff=e0(A0.buff,!0),l0.prototype.setState.call(this,A0)},l0.ArrayBuffer.prototype.destroy=l0.prototype.destroy,l0.ArrayBuffer.prototype._finish=l0.prototype._finish,l0.ArrayBuffer.hash=function(A0,T0){var J=H(new Uint8Array(A0)),o0=x(J);return T0?n0(o0):o0},l0})})(sparkMd5);const SparkMD5=sparkMd5.exports,getPhotoMetadata=async r=>{let n=getFileExtent(r),o={};if(n==="jpg"||n==="jpeg")try{o=await _formatMetadata(r)}catch{o=await getImageSize(r)}else o=await getImageSize(r);return o.filesize=getFileSize(r),o};async function _formatMetadata(r,n=1){let o=await getFileBuffer(r,n),l=getMd5(o);return new Promise((s,c)=>{getData(o.buffer||o,function(m,p){if(p)return p.message==="Offset is outside the bounds of the DataView"&&n<3?s(_formatMetadata(r,n+1)):c(p);let{exif:H,xmp:d}=getAllTags(m);H=JSON.parse(JSON.stringify(H).replaceAll("\\u0000",""))||{},H.PixelXDimension&&H.PixelYDimension&&H.PixelXDimension!=65535&&H.PixelYDimension!=65535?s({exif:H,xmp:d,width:H.PixelXDimension,height:H.PixelYDimension,md5:l}):getImageSize(r).then(x=>{s({exif:H,xmp:d,width:x.width,height:x.height,md5:l})})})})}async function getImageSize(r){try{let n=await getFileBuffer(r),o=lookup(n),l,s=getFileExtent(r);if(s==="tif"||s==="tiff"||s==="png"){let c;typeof r=="string"?c=r:typeof window<"u"&&r instanceof window.File?c=r.name:c=Buffer.concat([n.subarray(0,10240),n.subarray(n.length/2,10240),n.subarray(-10240)]),typeof c=="string"?typeof Buffer<"u"?l=getMd5(Buffer.from(c)):l=getMd5(new TextEncoder().encode(c)):l=getMd5(c)}else l=getMd5(Buffer.concat([n.subarray(0,10240),n.subarray(n.length/2,10240),n.subarray(-10240)]));return{width:o.width,height:o.height,md5:l}}catch{return{width:0,height:0}}}function getAllTags(r){return util.imageHasData(r)?{exif:r.exifdata||{},xmp:r.xmpdata||{}}:{exif:{},xmp:{}}}function getFileExtent(r){return typeof r=="string"?r.split(".").pop().toLowerCase():typeof window<"u"&&r instanceof window.File?r.name.split(".").pop().toLowerCase():"jpg"}async function getFileBuffer(r,n){if(typeof r=="string")if(n){let o=fs__default.default.openSync(r),l=Buffer.alloc(65536*n);return await new Promise(s=>{fs__default.default.read(o,l,0,l.length,0,()=>{s(),fs__default.default.closeSync(o)})}),l}else return fs__default.default.readFileSync(r);else{if(typeof window<"u"&&r instanceof window.File)return n&&(r=r.slice(0,65536*n)),await new Promise((o,l)=>{var s=new FileReader;s.readAsArrayBuffer(r),s.onload=c=>{o(c.target.result)},s.onerror=c=>{l(c)}});if(Buffer.isBuffer(r))return r}}function getFileSize(r){return typeof r=="string"?fs__default.default.statSync(r).size:r.size||r.length}function getMd5(r){let n=new SparkMD5.ArrayBuffer;return n.append(r),n.end()}async function parsePhoto(r){let n=await getPhotoMetadata(r);const{width:o,height:l,exif:s,xmp:c,filesize:m,md5:p}=n;let H={width:o,height:l,filesize:m,md5:p},d=NaN,x=NaN,Y=NaN,e0=NaN,_0=NaN,E0=NaN,n0=[d,x,Y],l0=flatObject(c),{GPSAltitude:A0,GPSLatitude:T0,GPSLatitudeRef:J,GPSLongitude:o0,GPSLongitudeRef:q}=s||{};o0&&T0&&(n0=[getGeoCoordOperator(q)*toRadian(o0),getGeoCoordOperator(J)*toRadian(T0),+A0]);for(let S0 in l0){let I0=l0[S0];if(S0==="drone-dji:GpsLongtitude"||S0==="drone-dji:GpsLongitude")d=Number(I0);else if(S0==="drone-dji:GpsLatitude")x=Number(I0);else if(S0==="drone-dji:AbsoluteAltitude")Y=Number(I0);else if(S0==="drone-dji:GimbalYawDegree")e0=Number(I0);else if(S0==="drone-dji:GimbalPitchDegree")_0=Number(I0);else if(S0==="drone-dji:GimbalRollDegree")E0=Number(I0);else if(S0==="drone-dji:DewarpFlag")H.dewarp_flag=Boolean(Number(I0));else if(S0==="drone-dji:RtkFlag")H.rtk_flag=Number(I0);else if(S0==="drone-dji:RelativeAltitude")H.relative_altitude=Number(I0);else if(S0==="tiff:Model")H.camera_model=I0;else if(S0==="tiff:Make")H.make=I0;else if(S0==="drone-dji:DewarpData"){let M0=I0.split(";")[1].split(",").map(H0=>Number(H0));M0[0]&&M0[1]&&(M0[2]=o/2+M0[2],M0[3]=l/2+M0[3],H.pre_calib_param=M0)}else S0==="drone-dji:CaptureUUID"?H.capture_uuid=I0:S0==="drone-dji:DroneID"?H.drone_id=I0:S0==="drone-dji:DroneSerialNumber"?H.drone_serial_number=I0:S0==="drone-dji:CameraSerialNumber"&&(H.camera_serial_number=I0)}if(!Number.isNaN(e0)&&!Number.isNaN(_0)&&!Number.isNaN(E0)&&(H.pitch_roll_yaw=[_0,E0,e0],H.orientation=getRotationMatrix(_0,E0,e0)),s?.DateTime?H.capture_time=hooks(s.DateTime,"YYYY:MM:DD HH:mm:ss").valueOf():s?.DateTimeOriginal&&(H.capture_time=hooks(s.DateTimeOriginal,"YYYY:MM:DD HH:mm:ss").valueOf()),s?.FocalLengthIn35mmFilm&&(H.focal_length_in_35mm=s.FocalLengthIn35mmFilm,!H.pre_calib_param)){let S0=new Array(10).fill(0),I0=s.FocalLengthIn35mmFilm;S0[0]=S0[1]=I0/35*Math.max(o,l),S0[2]=o/2,S0[3]=l/2,H.pre_calib_param=S0}if(hasNaN(n0)&&(n0=[d,x,Y]),!hasNaN(n0))if(H.pos=n0,H.absolute_altitude=n0[2],H.coordinate_system={type:2,label:"WGS 84",type_name:"Geographic",epsg_code:4326},H.make==="DJI"&&H.rtk_flag){let S0=[];H.rtk_flag===50?S0=[.03,.03,.06]:H.rtk_flag>=32?S0=[.5,.5,1]:S0=[2,2,5],H.pos_sigma=S0}else H.pos_sigma=[2,2,5];return H}function parsePhotos(r,n){let o=[],l=r,s=r.length,c=10,m=0;return new Promise(p=>{const H=[],d=()=>{for(let Y=m;Y<c;Y++){let e0=l.pop();if(!e0)break;m++,parsePhoto(e0).then(_0=>{if(!_0.width||!_0.height)throw new Error("broken photo");let E0=e0.split(".").pop(),n0={width:_0.width,height:_0.height,ext:E0,camera_serial_number:_0.camera_serial_number,parameters:_0.pre_calib_param||null},l0=o.find(A0=>A0.width===n0.width&&A0.height===n0.height&&A0.ext===n0.ext&&_$1.isEqual(A0.parameters,n0.parameters)&&A0.camera_serial_number===n0.camera_serial_number);l0||(l0=n0,l0.fileList=[],o.push(l0)),l0.fileList.push({name:e0.split("\\").pop(),filesize:_0.filesize,md5:_0.md5,filePath:e0,meta_data:_0})}).catch(_0=>{H.push({file:e0,error:_0?.message||String(_0)})}).finally(()=>{m--,x()})}},x=()=>{l.length?d():m||p({cameras:o,failed:H});let Y=s-l.length-m;n&&n(Y,s,H)};d()})}function _extends(){return _extends=Object.assign?Object.assign.bind():function(r){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var l in o)({}).hasOwnProperty.call(o,l)&&(r[l]=o[l])}return r},_extends.apply(null,arguments)}var DEFAULT_CONFIG={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function isNumber(r){return typeof r=="number"}function isBigNumber(r){return!r||typeof r!="object"||typeof r.constructor!="function"?!1:r.isBigNumber===!0&&typeof r.constructor.prototype=="object"&&r.constructor.prototype.isBigNumber===!0||typeof r.constructor.isDecimal=="function"&&r.constructor.isDecimal(r)===!0}function isComplex(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isComplex===!0||!1}function isFraction(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isFraction===!0||!1}function isUnit(r){return r&&r.constructor.prototype.isUnit===!0||!1}function isString(r){return typeof r=="string"}var isArray=Array.isArray;function isMatrix(r){return r&&r.constructor.prototype.isMatrix===!0||!1}function isCollection(r){return Array.isArray(r)||isMatrix(r)}function isDenseMatrix(r){return r&&r.isDenseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function isSparseMatrix(r){return r&&r.isSparseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function isRange(r){return r&&r.constructor.prototype.isRange===!0||!1}function isIndex(r){return r&&r.constructor.prototype.isIndex===!0||!1}function isBoolean(r){return typeof r=="boolean"}function isResultSet(r){return r&&r.constructor.prototype.isResultSet===!0||!1}function isHelp(r){return r&&r.constructor.prototype.isHelp===!0||!1}function isFunction(r){return typeof r=="function"}function isDate(r){return r instanceof Date}function isRegExp(r){return r instanceof RegExp}function isObject(r){return!!(r&&typeof r=="object"&&r.constructor===Object&&!isComplex(r)&&!isFraction(r))}function isNull(r){return r===null}function isUndefined(r){return r===void 0}function isAccessorNode(r){return r&&r.isAccessorNode===!0&&r.constructor.prototype.isNode===!0||!1}function isArrayNode(r){return r&&r.isArrayNode===!0&&r.constructor.prototype.isNode===!0||!1}function isAssignmentNode(r){return r&&r.isAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function isBlockNode(r){return r&&r.isBlockNode===!0&&r.constructor.prototype.isNode===!0||!1}function isConditionalNode(r){return r&&r.isConditionalNode===!0&&r.constructor.prototype.isNode===!0||!1}function isConstantNode(r){return r&&r.isConstantNode===!0&&r.constructor.prototype.isNode===!0||!1}function isFunctionAssignmentNode(r){return r&&r.isFunctionAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function isFunctionNode(r){return r&&r.isFunctionNode===!0&&r.constructor.prototype.isNode===!0||!1}function isIndexNode(r){return r&&r.isIndexNode===!0&&r.constructor.prototype.isNode===!0||!1}function isNode(r){return r&&r.isNode===!0&&r.constructor.prototype.isNode===!0||!1}function isObjectNode(r){return r&&r.isObjectNode===!0&&r.constructor.prototype.isNode===!0||!1}function isOperatorNode(r){return r&&r.isOperatorNode===!0&&r.constructor.prototype.isNode===!0||!1}function isParenthesisNode(r){return r&&r.isParenthesisNode===!0&&r.constructor.prototype.isNode===!0||!1}function isRangeNode(r){return r&&r.isRangeNode===!0&&r.constructor.prototype.isNode===!0||!1}function isRelationalNode(r){return r&&r.isRelationalNode===!0&&r.constructor.prototype.isNode===!0||!1}function isSymbolNode(r){return r&&r.isSymbolNode===!0&&r.constructor.prototype.isNode===!0||!1}function isChain(r){return r&&r.constructor.prototype.isChain===!0||!1}function typeOf(r){var n=typeof r;return n==="object"?r===null?"null":isBigNumber(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":n}function clone$2(r){var n=typeof r;if(n==="number"||n==="string"||n==="boolean"||r===null||r===void 0)return r;if(typeof r.clone=="function")return r.clone();if(Array.isArray(r))return r.map(function(o){return clone$2(o)});if(r instanceof Date)return new Date(r.valueOf());if(isBigNumber(r))return r;if(isObject(r))return mapObject(r,clone$2);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function mapObject(r,n){var o={};for(var l in r)hasOwnProperty(r,l)&&(o[l]=n(r[l]));return o}function extend(r,n){for(var o in n)hasOwnProperty(n,o)&&(r[o]=n[o]);return r}function deepStrictEqual(r,n){var o,l,s;if(Array.isArray(r)){if(!Array.isArray(n)||r.length!==n.length)return!1;for(l=0,s=r.length;l<s;l++)if(!deepStrictEqual(r[l],n[l]))return!1;return!0}else{if(typeof r=="function")return r===n;if(r instanceof Object){if(Array.isArray(n)||!(n instanceof Object))return!1;for(o in r)if(!(o in n)||!deepStrictEqual(r[o],n[o]))return!1;for(o in n)if(!(o in r))return!1;return!0}else return r===n}}function hasOwnProperty(r,n){return r&&Object.hasOwnProperty.call(r,n)}function pickShallow(r,n){for(var o={},l=0;l<n.length;l++){var s=n[l],c=r[s];c!==void 0&&(o[s]=c)}return o}var MATRIX_OPTIONS=["Matrix","Array"],NUMBER_OPTIONS=["number","BigNumber","Fraction"],config$1=function r(n){if(n)throw new Error(`The global config is readonly.
468
468
  Please create a mathjs instance if you want to change the default configuration.
469
469
  Example:
470
470
 
@@ -75764,7 +75764,7 @@ async function parsePhoto(r) {
75764
75764
  H.make = I0;
75765
75765
  else if (S0 === "drone-dji:DewarpData") {
75766
75766
  let M0 = I0.split(";")[1].split(",").map((H0) => Number(H0));
75767
- !M0[0] && !M0[1] && (M0[2] = o / 2 + M0[2], M0[3] = l / 2 + M0[3], H.pre_calib_param = M0);
75767
+ M0[0] && M0[1] && (M0[2] = o / 2 + M0[2], M0[3] = l / 2 + M0[3], H.pre_calib_param = M0);
75768
75768
  } else
75769
75769
  S0 === "drone-dji:CaptureUUID" ? H.capture_uuid = I0 : S0 === "drone-dji:DroneID" ? H.drone_id = I0 : S0 === "drone-dji:DroneSerialNumber" ? H.drone_serial_number = I0 : S0 === "drone-dji:CameraSerialNumber" && (H.camera_serial_number = I0);
75770
75770
  }
@@ -75780,7 +75780,7 @@ async function parsePhoto(r) {
75780
75780
  epsg_code: 4326
75781
75781
  }, H.make === "DJI" && H.rtk_flag) {
75782
75782
  let S0 = [];
75783
- H.rtk_flag === 50 ? S0 = [0.03, 0.03, 0.06] : H.rtk_flag === 16 ? S0 = [0.5, 0.5, 1] : S0 = [2, 2, 5], H.pos_sigma = S0;
75783
+ H.rtk_flag === 50 ? S0 = [0.03, 0.03, 0.06] : H.rtk_flag >= 32 ? S0 = [0.5, 0.5, 1] : S0 = [2, 2, 5], H.pos_sigma = S0;
75784
75784
  } else
75785
75785
  H.pos_sigma = [2, 2, 5];
75786
75786
  return H;
@@ -75800,8 +75800,9 @@ function parsePhotos(r, n) {
75800
75800
  width: _0.width,
75801
75801
  height: _0.height,
75802
75802
  ext: E0,
75803
+ camera_serial_number: _0.camera_serial_number,
75803
75804
  parameters: _0.pre_calib_param || null
75804
- }, l0 = o.find((A0) => A0.width === n0.width && A0.height === n0.height && A0.ext === n0.ext && _$1.isEqual(A0.parameters, n0.parameters));
75805
+ }, l0 = o.find((A0) => A0.width === n0.width && A0.height === n0.height && A0.ext === n0.ext && _$1.isEqual(A0.parameters, n0.parameters) && A0.camera_serial_number === n0.camera_serial_number);
75805
75806
  l0 || (l0 = n0, l0.fileList = [], o.push(l0)), l0.fileList.push({
75806
75807
  name: e0.split("\\").pop(),
75807
75808
  filesize: _0.filesize,
@@ -464,7 +464,7 @@ void main() {
464
464
  `)}function DOMParser$1(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||conventions$1.assign,this.domHandler=r.domHandler||DOMHandler,this.onError=r.onError||r.errorHandler,r.errorHandler&&typeof r.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");r.errorHandler&&r.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=r.normalizeLineEndings||normalizeLineEndings,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}DOMParser$1.prototype.parseFromString=function(r,n){if(!isValidMimeType(n))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+n+'" is not valid.');var o=this.assign(Object.create(null),this.xmlns),l=entities.XML_ENTITIES,s=o[""]||null;hasDefaultHTMLNamespace(n)?(l=entities.HTML_ENTITIES,s=NAMESPACE.HTML):n===MIME_TYPE.XML_SVG_IMAGE&&(s=NAMESPACE.SVG),o[""]=s,o.xml=o.xml||NAMESPACE.XML;var c=new this.domHandler({mimeType:n,defaultNamespace:s,onError:this.onError}),m=this.locator?{}:void 0;this.locator&&c.setDocumentLocator(m);var p=new XMLReader;p.errorHandler=c,p.domBuilder=c;var H=!conventions$1.isHTMLMimeType(n);return H&&typeof r!="string"&&p.errorHandler.fatalError("source is not a string"),p.parse(this.normalizeLineEndings(String(r)),o,l),c.doc.documentElement||p.errorHandler.fatalError("missing root element"),c.doc};function DOMHandler(r){var n=r||{};this.mimeType=n.mimeType||MIME_TYPE.XML_APPLICATION,this.defaultNamespace=n.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=n.onError}function position(r,n){n.lineNumber=r.lineNumber,n.columnNumber=r.columnNumber}DOMHandler.prototype={startDocument:function(){var r=new DOMImplementation;this.doc=isHTMLMimeType(this.mimeType)?r.createHTMLDocument(!1):r.createDocument(this.defaultNamespace,"")},startElement:function(r,n,o,l){var s=this.doc,c=s.createElementNS(r,o||n),m=l.length;appendElement(this,c),this.currentElement=c,this.locator&&position(this.locator,c);for(var p=0;p<m;p++){var r=l.getURI(p),H=l.getValue(p),o=l.getQName(p),d=s.createAttributeNS(r,o);this.locator&&position(l.getLocator(p),d),d.value=d.nodeValue=H,c.setAttributeNode(d)}},endElement:function(r,n,o){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(r,n){},endPrefixMapping:function(r){},processingInstruction:function(r,n){var o=this.doc.createProcessingInstruction(r,n);this.locator&&position(this.locator,o),appendElement(this,o)},ignorableWhitespace:function(r,n,o){},characters:function(r,n,o){if(r=_toString.apply(this,arguments),r){if(this.cdata)var l=this.doc.createCDATASection(r);else var l=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(l):/^\s*$/.test(r)&&this.doc.appendChild(l),this.locator&&position(this.locator,l)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){r&&(r.lineNumber=0),this.locator=r},comment:function(r,n,o){r=_toString.apply(this,arguments);var l=this.doc.createComment(r);this.locator&&position(this.locator,l),appendElement(this,l)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,n,o,l){var s=this.doc.implementation;if(s&&s.createDocumentType){var c=s.createDocumentType(r,n,o,l);this.locator&&position(this.locator,c),appendElement(this,c),this.doc.doctype=c}},reportError:function(r,n){if(typeof this.onError=="function")try{this.onError(r,n,this)}catch(o){throw new ParseError("Reporting "+r+' "'+n+'" caused '+o,this.locator)}else console.error("[xmldom "+r+"] "+n,_locator(this.locator))},warning:function(r){this.reportError("warning",r)},error:function(r){this.reportError("error",r)},fatalError:function(r){throw this.reportError("fatalError",r),new ParseError(r,this.locator)}};function _locator(r){if(r)return`
465
465
  @#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}function _toString(r,n,o){return typeof r=="string"?r.substr(n,o):r.length>=n+o||n?new java.lang.String(r,n,o)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){DOMHandler.prototype[r]=function(){return null}});function appendElement(r,n){r.currentElement?r.currentElement.appendChild(n):r.doc.appendChild(n)}function onErrorStopParsing(r){if(r==="error")throw"onErrorStopParsing"}function onWarningStopParsing(){throw"onWarningStopParsing"}domParser$1.__DOMHandler=DOMHandler,domParser$1.DOMParser=DOMParser$1,domParser$1.normalizeLineEndings=normalizeLineEndings,domParser$1.onErrorStopParsing=onErrorStopParsing,domParser$1.onWarningStopParsing=onWarningStopParsing;var conventions=conventions$5;conventions.assign,conventions.hasDefaultHTMLNamespace,conventions.isHTMLMimeType,conventions.isValidMimeType,conventions.MIME_TYPE,conventions.NAMESPACE;var domParser=domParser$1,DOMParser=domParser.DOMParser;const getData=function(r,n){return util.imageHasData(r)?n&&n(r):getImageData(r,n),!0};function getImageData(r,n){try{var o=findEXIFinJPEG(r);r.exifdata=o.exif,r.xmpdata=o.xmp,n&&n(r)}catch(l){r.exifdata={},r.xmpdata={},n(r,l)}}function findEXIFinJPEG(r){var n=new DataView(r);let o,l;for(var s=2,c=r.byteLength,m=new DOMParser,p;s<c&&n.getUint8(s)==255;){p=n.getUint8(s+1);let E0=n.getUint16(s+2);if(util.getStringFromDB(n,s+4,E0),p==225)if(util.getStringFromDB(n,s+4,4)=="http"){var H=s+3,d=n.getUint16(s+2)-1,x=util.getStringFromDB(n,H,d),Y=x.indexOf("xmpmeta>")+8;x=x.substring(x.indexOf("<x:xmpmeta"),Y);var e0=x.indexOf("x:xmpmeta")+10;x=x.slice(0,e0)+'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tiff="http://ns.adobe.com/tiff/1.0/" xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" xmlns:exif="http://ns.adobe.com/exif/1.0/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '+x.slice(e0);var _0=m.parseFromString(x,"text/xml");l=util.xml2Object(_0)}else o=readEXIFData(n,s+4,n.getUint16(s+2)-2);if(l&&o)break;s+=2+n.getUint16(s+2)}return{exif:o||{},xmp:l||{}}}function readEXIFData(r,n){if(util.getStringFromDB(r,n,4)!="Exif")return!1;var o,l,s,c,m,p=n+6;if(r.getUint16(p)==18761)o=!1;else if(r.getUint16(p)==19789)o=!0;else return!1;if(r.getUint16(p+2,!o)!=42)return!1;var H=r.getUint32(p+4,!o);if(H<8)return!1;if(l=readTags(r,p,p+H,TiffTags,o),l.ExifIFDPointer){c=readTags(r,p,p+l.ExifIFDPointer,ExifTags,o);for(s in c){switch(s){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":c[s]=StringValues[s][c[s]];break;case"ExifVersion":case"FlashpixVersion":c[s]=String.fromCharCode(c[s][0],c[s][1],c[s][2],c[s][3]);break;case"ComponentsConfiguration":c[s]=StringValues.Components[c[s][0]]+StringValues.Components[c[s][1]]+StringValues.Components[c[s][2]]+StringValues.Components[c[s][3]];break}l[s]=c[s]}}if(l.GPSInfoIFDPointer){m=readTags(r,p,p+l.GPSInfoIFDPointer,GPSTags,o);for(s in m){switch(s){case"GPSVersionID":m[s]=m[s][0]+"."+m[s][1]+"."+m[s][2]+"."+m[s][3];break}l[s]=m[s]}}return l}function readTags(r,n,o,l,s){var c=r.getUint16(o,!s),m={},p,H,d;for(d=0;d<c;d++)p=o+d*12+2,H=l[r.getUint16(p,!s)],m[H]=readTagValue(r,p,n,o,s);return m}function readTagValue(r,n,o,l,s){var c=r.getUint16(n+2,!s),m=r.getUint32(n+4,!s),p=r.getUint32(n+8,!s)+o,H,d,x,Y,e0,_0;switch(c){case 1:case 7:if(m==1)return r.getUint8(n+8,!s);for(H=m>4?p:n+8,d=[],Y=0;Y<m;Y++)d[Y]=r.getUint8(H+Y);return d;case 2:return H=m>4?p:n+8,util.getStringFromDB(r,H,m-1);case 3:if(m==1)return r.getUint16(n+8,!s);for(H=m>2?p:n+8,d=[],Y=0;Y<m;Y++)d[Y]=r.getUint16(H+2*Y,!s);return d;case 4:if(m==1)return r.getUint32(n+8,!s);for(d=[],Y=0;Y<m;Y++)d[Y]=r.getUint32(p+4*Y,!s);return d;case 5:if(m==1)return e0=r.getUint32(p,!s),_0=r.getUint32(p+4,!s),x=new Number(e0/_0),x.numerator=e0,x.denominator=_0,x;for(d=[],Y=0;Y<m;Y++)e0=r.getUint32(p+8*Y,!s),_0=r.getUint32(p+4+8*Y,!s),d[Y]=new Number(e0/_0),d[Y].numerator=e0,d[Y].denominator=_0;return d;case 9:if(m==1)return r.getInt32(n+8,!s);for(d=[],Y=0;Y<m;Y++)d[Y]=r.getInt32(p+4*Y,!s);return d;case 10:if(m==1)return r.getInt32(p,!s)/r.getInt32(p+4,!s);for(d=[],Y=0;Y<m;Y++)d[Y]=r.getInt32(p+8*Y,!s)/r.getInt32(p+4+8*Y,!s);return d}}const decoder=new TextDecoder,toUTF8String=(r,n=0,o=r.length)=>decoder.decode(r.slice(n,o)),toHexString=(r,n=0,o=r.length)=>r.slice(n,o).reduce((l,s)=>l+("0"+s.toString(16)).slice(-2),""),readInt16LE=(r,n=0)=>{const o=r[n]+r[n+1]*256;return o|(o&2**15)*131070},readUInt16BE=(r,n=0)=>r[n]*2**8+r[n+1],readUInt16LE=(r,n=0)=>r[n]+r[n+1]*2**8,readUInt24LE=(r,n=0)=>r[n]+r[n+1]*2**8+r[n+2]*2**16,readInt32LE=(r,n=0)=>r[n]+r[n+1]*2**8+r[n+2]*2**16+(r[n+3]<<24),readUInt32BE=(r,n=0)=>r[n]*2**24+r[n+1]*2**16+r[n+2]*2**8+r[n+3],readUInt32LE=(r,n=0)=>r[n]+r[n+1]*2**8+r[n+2]*2**16+r[n+3]*2**24,methods={readUInt16BE,readUInt16LE,readUInt32BE,readUInt32LE};function readUInt(r,n,o,l){o=o||0;const s=l?"BE":"LE",c="readUInt"+n+s;return methods[c](r,o)}function readBox(r,n){if(r.length-n<4)return;const o=readUInt32BE(r,n);if(!(r.length-n<o))return{name:toUTF8String(r,4+n,8+n),offset:n,size:o}}function findBox(r,n,o){for(;o<r.length;){const l=readBox(r,o);if(!l)break;if(l.name===n)return l;o+=l.size}}const BMP={validate:r=>toUTF8String(r,0,2)==="BM",calculate:r=>({height:Math.abs(readInt32LE(r,22)),width:readUInt32LE(r,18)})},TYPE_ICON=1,SIZE_HEADER$1=2+2+2,SIZE_IMAGE_ENTRY=1+1+1+1+2+2+4+4;function getSizeFromOffset(r,n){const o=r[n];return o===0?256:o}function getImageSize$2(r,n){const o=SIZE_HEADER$1+n*SIZE_IMAGE_ENTRY;return{height:getSizeFromOffset(r,o+1),width:getSizeFromOffset(r,o)}}const ICO={validate(r){const n=readUInt16LE(r,0),o=readUInt16LE(r,4);return n!==0||o===0?!1:readUInt16LE(r,2)===TYPE_ICON},calculate(r){const n=readUInt16LE(r,4),o=getImageSize$2(r,0);if(n===1)return o;const l=[o];for(let s=1;s<n;s+=1)l.push(getImageSize$2(r,s));return{height:o.height,images:l,width:o.width}}},TYPE_CURSOR=2,CUR={validate(r){const n=readUInt16LE(r,0),o=readUInt16LE(r,4);return n!==0||o===0?!1:readUInt16LE(r,2)===TYPE_CURSOR},calculate:r=>ICO.calculate(r)},DDS={validate:r=>readUInt32LE(r,0)===542327876,calculate:r=>({height:readUInt32LE(r,12),width:readUInt32LE(r,16)})},gifRegexp=/^GIF8[79]a/,GIF={validate:r=>gifRegexp.test(toUTF8String(r,0,6)),calculate:r=>({height:readUInt16LE(r,8),width:readUInt16LE(r,6)})},brandMap={avif:"avif",mif1:"heif",msf1:"heif",heic:"heic",heix:"heic",hevc:"heic",hevx:"heic"},HEIF={validate(r){const n=toUTF8String(r,4,8),o=toUTF8String(r,8,12);return n==="ftyp"&&o in brandMap},calculate(r){const n=findBox(r,"meta",0),o=n&&findBox(r,"iprp",n.offset+12),l=o&&findBox(r,"ipco",o.offset+8),s=l&&findBox(r,"ispe",l.offset+8);if(s)return{height:readUInt32BE(r,s.offset+16),width:readUInt32BE(r,s.offset+12),type:toUTF8String(r,8,12)};throw new TypeError("Invalid HEIF, no size found")}},SIZE_HEADER=4+4,FILE_LENGTH_OFFSET=4,ENTRY_LENGTH_OFFSET=4,ICON_TYPE_SIZE={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function readImageHeader(r,n){const o=n+ENTRY_LENGTH_OFFSET;return[toUTF8String(r,n,o),readUInt32BE(r,o)]}function getImageSize$1(r){const n=ICON_TYPE_SIZE[r];return{width:n,height:n,type:r}}const ICNS={validate:r=>toUTF8String(r,0,4)==="icns",calculate(r){const n=r.length,o=readUInt32BE(r,FILE_LENGTH_OFFSET);let l=SIZE_HEADER,s=readImageHeader(r,l),c=getImageSize$1(s[0]);if(l+=s[1],l===o)return c;const m={height:c.height,images:[c],width:c.width};for(;l<o&&l<n;)s=readImageHeader(r,l),c=getImageSize$1(s[0]),l+=s[1],m.images.push(c);return m}},J2C={validate:r=>toHexString(r,0,4)==="ff4fff51",calculate:r=>({height:readUInt32BE(r,12),width:readUInt32BE(r,8)})},JP2={validate(r){if(readUInt32BE(r,4)!==1783636e3||readUInt32BE(r,0)<1)return!1;const n=findBox(r,"ftyp",0);return n?readUInt32BE(r,n.offset+4)===1718909296:!1},calculate(r){const n=findBox(r,"jp2h",0),o=n&&findBox(r,"ihdr",n.offset+8);if(o)return{height:readUInt32BE(r,o.offset+8),width:readUInt32BE(r,o.offset+12)};throw new TypeError("Unsupported JPEG 2000 format")}},EXIF_MARKER="45786966",APP1_DATA_SIZE_BYTES=2,EXIF_HEADER_BYTES=6,TIFF_BYTE_ALIGN_BYTES=2,BIG_ENDIAN_BYTE_ALIGN="4d4d",LITTLE_ENDIAN_BYTE_ALIGN="4949",IDF_ENTRY_BYTES=12,NUM_DIRECTORY_ENTRIES_BYTES=2;function isEXIF(r){return toHexString(r,2,6)===EXIF_MARKER}function extractSize(r,n){return{height:readUInt16BE(r,n),width:readUInt16BE(r,n+2)}}function extractOrientation(r,n){const l=EXIF_HEADER_BYTES+8,s=readUInt(r,16,l,n);for(let c=0;c<s;c++){const m=l+NUM_DIRECTORY_ENTRIES_BYTES+c*IDF_ENTRY_BYTES,p=m+IDF_ENTRY_BYTES;if(m>r.length)return;const H=r.slice(m,p);if(readUInt(H,16,0,n)===274)return readUInt(H,16,2,n)!==3||readUInt(H,32,4,n)!==1?void 0:readUInt(H,16,8,n)}}function validateExifBlock(r,n){const o=r.slice(APP1_DATA_SIZE_BYTES,n),l=toHexString(o,EXIF_HEADER_BYTES,EXIF_HEADER_BYTES+TIFF_BYTE_ALIGN_BYTES),s=l===BIG_ENDIAN_BYTE_ALIGN;if(s||l===LITTLE_ENDIAN_BYTE_ALIGN)return extractOrientation(o,s)}function validateInput(r,n){if(n>r.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(r[n]!==255)throw new TypeError("Invalid JPG, marker table corrupted")}const JPG={validate:r=>toHexString(r,0,2)==="ffd8",calculate(r){r=r.slice(4);let n,o;for(;r.length;){const l=readUInt16BE(r,0);if(isEXIF(r)&&(n=validateExifBlock(r,l)),validateInput(r,l),o=r[l+1],o===192||o===193||o===194){const s=extractSize(r,l+5);return n?{height:s.height,orientation:n,width:s.width}:s}r=r.slice(l+2)}throw new TypeError("Invalid JPG, no size found")}},KTX={validate:r=>{const n=toUTF8String(r,1,7);return["KTX 11","KTX 20"].includes(n)},calculate:r=>{const n=r[5]===49?"ktx":"ktx2",o=n==="ktx"?36:20;return{height:readUInt32LE(r,o+4),width:readUInt32LE(r,o),type:n}}},pngSignature=`PNG\r
466
466
  
467
- `,pngImageHeaderChunkName="IHDR",pngFriedChunkName="CgBI",PNG={validate(r){if(pngSignature===toUTF8String(r,1,8)){let n=toUTF8String(r,12,16);if(n===pngFriedChunkName&&(n=toUTF8String(r,28,32)),n!==pngImageHeaderChunkName)throw new TypeError("Invalid PNG");return!0}return!1},calculate(r){return toUTF8String(r,12,16)===pngFriedChunkName?{height:readUInt32BE(r,36),width:readUInt32BE(r,32)}:{height:readUInt32BE(r,20),width:readUInt32BE(r,16)}}},PNMTypes={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},handlers={default:r=>{let n=[];for(;r.length>0;){const o=r.shift();if(o[0]!=="#"){n=o.split(" ");break}}if(n.length===2)return{height:parseInt(n[1],10),width:parseInt(n[0],10)};throw new TypeError("Invalid PNM")},pam:r=>{const n={};for(;r.length>0;){const o=r.shift();if(o.length>16||o.charCodeAt(0)>128)continue;const[l,s]=o.split(" ");if(l&&s&&(n[l.toLowerCase()]=parseInt(s,10)),n.height&&n.width)break}if(n.height&&n.width)return{height:n.height,width:n.width};throw new TypeError("Invalid PAM")}},PNM={validate:r=>toUTF8String(r,0,2)in PNMTypes,calculate(r){const n=toUTF8String(r,0,2),o=PNMTypes[n],l=toUTF8String(r,3).split(/[\r\n]+/);return(handlers[o]||handlers.default)(l)}},PSD={validate:r=>toUTF8String(r,0,4)==="8BPS",calculate:r=>({height:readUInt32BE(r,14),width:readUInt32BE(r,18)})},svgReg=/<svg\s([^>"']|"[^"]*"|'[^']*')*>/,extractorRegExps={height:/\sheight=(['"])([^%]+?)\1/,root:svgReg,viewbox:/\sviewBox=(['"])(.+?)\1/i,width:/\swidth=(['"])([^%]+?)\1/},INCH_CM=2.54,units={in:96,cm:96/INCH_CM,em:16,ex:8,m:96/INCH_CM*100,mm:96/INCH_CM/10,pc:96/72/12,pt:96/72,px:1},unitsReg=new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);function parseLength(r){const n=unitsReg.exec(r);if(!!n)return Math.round(Number(n[1])*(units[n[2]]||1))}function parseViewbox(r){const n=r.split(" ");return{height:parseLength(n[3]),width:parseLength(n[2])}}function parseAttributes(r){const n=r.match(extractorRegExps.width),o=r.match(extractorRegExps.height),l=r.match(extractorRegExps.viewbox);return{height:o&&parseLength(o[2]),viewbox:l&&parseViewbox(l[2]),width:n&&parseLength(n[2])}}function calculateByDimensions(r){return{height:r.height,width:r.width}}function calculateByViewbox(r,n){const o=n.width/n.height;return r.width?{height:Math.floor(r.width/o),width:r.width}:r.height?{height:r.height,width:Math.floor(r.height*o)}:{height:n.height,width:n.width}}const SVG={validate:r=>svgReg.test(toUTF8String(r,0,1e3)),calculate(r){const n=toUTF8String(r).match(extractorRegExps.root);if(n){const o=parseAttributes(n[0]);if(o.width&&o.height)return calculateByDimensions(o);if(o.viewbox)return calculateByViewbox(o,o.viewbox)}throw new TypeError("Invalid SVG")}},TGA={validate(r){return readUInt16LE(r,0)===0&&readUInt16LE(r,4)===0},calculate(r){return{height:readUInt16LE(r,14),width:readUInt16LE(r,12)}}};function readIFD(r,n){const o=readUInt(r,32,4,n);return r.slice(o+2)}function readValue(r,n){const o=readUInt(r,16,8,n);return(readUInt(r,16,10,n)<<16)+o}function nextTag(r){if(r.length>24)return r.slice(12)}function extractTags(r,n){const o={};let l=r;for(;l&&l.length;){const s=readUInt(l,16,0,n),c=readUInt(l,16,2,n),m=readUInt(l,32,4,n);if(s===0)break;m===1&&(c===3||c===4)&&(o[s]=readValue(l,n)),l=nextTag(l)}return o}function determineEndianness(r){const n=toUTF8String(r,0,2);if(n==="II")return"LE";if(n==="MM")return"BE"}const signatures=["49492a00","4d4d002a"],TIFF={validate:r=>signatures.includes(toHexString(r,0,4)),calculate(r){const n=determineEndianness(r)==="BE",o=readIFD(r,n),l=extractTags(o,n),s=l[256],c=l[257];if(!s||!c)throw new TypeError("Invalid Tiff. Missing tags");return{height:c,width:s}}};function calculateExtended(r){return{height:1+readUInt24LE(r,7),width:1+readUInt24LE(r,4)}}function calculateLossless(r){return{height:1+((r[4]&15)<<10|r[3]<<2|(r[2]&192)>>6),width:1+((r[2]&63)<<8|r[1])}}function calculateLossy(r){return{height:readInt16LE(r,8)&16383,width:readInt16LE(r,6)&16383}}const WEBP={validate(r){const n=toUTF8String(r,0,4)==="RIFF",o=toUTF8String(r,8,12)==="WEBP",l=toUTF8String(r,12,15)==="VP8";return n&&o&&l},calculate(r){const n=toUTF8String(r,12,16);if(r=r.slice(20,30),n==="VP8X"){const l=r[0],s=(l&192)===0,c=(l&1)===0;if(s&&c)return calculateExtended(r);throw new TypeError("Invalid WebP")}if(n==="VP8 "&&r[0]!==47)return calculateLossy(r);const o=toHexString(r,3,6);if(n==="VP8L"&&o!=="9d012a")return calculateLossless(r);throw new TypeError("Invalid WebP")}},typeHandlers=new Map([["bmp",BMP],["cur",CUR],["dds",DDS],["gif",GIF],["heif",HEIF],["icns",ICNS],["ico",ICO],["j2c",J2C],["jp2",JP2],["jpg",JPG],["ktx",KTX],["png",PNG],["pnm",PNM],["psd",PSD],["svg",SVG],["tga",TGA],["tiff",TIFF],["webp",WEBP]]),types=Array.from(typeHandlers.keys()),firstBytes=new Map([[56,"psd"],[66,"bmp"],[68,"dds"],[71,"gif"],[73,"tiff"],[77,"tiff"],[82,"webp"],[105,"icns"],[137,"png"],[255,"jpg"]]);function detector(r){const n=r[0],o=firstBytes.get(n);return o&&typeHandlers.get(o).validate(r)?o:types.find(l=>typeHandlers.get(l).validate(r))}const globalOptions={disabledTypes:[]};function lookup(r){const n=detector(r);if(typeof n<"u"){if(globalOptions.disabledTypes.indexOf(n)>-1)throw new TypeError("disabled file type: "+n);const o=typeHandlers.get(n).calculate(r);if(o!==void 0)return o.type=o.type??n,o}throw new TypeError("unsupported file type: "+n)}var sparkMd5={exports:{}};(function(r,n){(function(o){r.exports=o()})(function(o){var l=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(A0,T0){var J=A0[0],o0=A0[1],q=A0[2],S0=A0[3];J+=(o0&q|~o0&S0)+T0[0]-680876936|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[1]-389564586|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[2]+606105819|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[3]-1044525330|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[4]-176418897|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[5]+1200080426|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[6]-1473231341|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[7]-45705983|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[8]+1770035416|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[9]-1958414417|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[10]-42063|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[11]-1990404162|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[12]+1804603682|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[13]-40341101|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[14]-1502002290|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[15]+1236535329|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&S0|q&~S0)+T0[1]-165796510|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[6]-1069501632|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[11]+643717713|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[0]-373897302|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[5]-701558691|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[10]+38016083|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[15]-660478335|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[4]-405537848|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[9]+568446438|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[14]-1019803690|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[3]-187363961|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[8]+1163531501|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[13]-1444681467|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[2]-51403784|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[7]+1735328473|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[12]-1926607734|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0^q^S0)+T0[5]-378558|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[8]-2022574463|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[11]+1839030562|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[14]-35309556|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[1]-1530992060|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[4]+1272893353|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[7]-155497632|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[10]-1094730640|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[13]+681279174|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[0]-358537222|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[3]-722521979|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[6]+76029189|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[9]-640364487|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[12]-421815835|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[15]+530742520|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[2]-995338651|0,o0=(o0<<23|o0>>>9)+q|0,J+=(q^(o0|~S0))+T0[0]-198630844|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[7]+1126891415|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[14]-1416354905|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[5]-57434055|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[12]+1700485571|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[3]-1894986606|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[10]-1051523|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[1]-2054922799|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[8]+1873313359|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[15]-30611744|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[6]-1560198380|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[13]+1309151649|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[4]-145523070|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[11]-1120210379|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[2]+718787259|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[9]-343485551|0,o0=(o0<<21|o0>>>11)+q|0,A0[0]=J+A0[0]|0,A0[1]=o0+A0[1]|0,A0[2]=q+A0[2]|0,A0[3]=S0+A0[3]|0}function c(A0){var T0=[],J;for(J=0;J<64;J+=4)T0[J>>2]=A0.charCodeAt(J)+(A0.charCodeAt(J+1)<<8)+(A0.charCodeAt(J+2)<<16)+(A0.charCodeAt(J+3)<<24);return T0}function m(A0){var T0=[],J;for(J=0;J<64;J+=4)T0[J>>2]=A0[J]+(A0[J+1]<<8)+(A0[J+2]<<16)+(A0[J+3]<<24);return T0}function p(A0){var T0=A0.length,J=[1732584193,-271733879,-1732584194,271733878],o0,q,S0,I0,P0,M0;for(o0=64;o0<=T0;o0+=64)s(J,c(A0.substring(o0-64,o0)));for(A0=A0.substring(o0-64),q=A0.length,S0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o0=0;o0<q;o0+=1)S0[o0>>2]|=A0.charCodeAt(o0)<<(o0%4<<3);if(S0[o0>>2]|=128<<(o0%4<<3),o0>55)for(s(J,S0),o0=0;o0<16;o0+=1)S0[o0]=0;return I0=T0*8,I0=I0.toString(16).match(/(.*?)(.{0,8})$/),P0=parseInt(I0[2],16),M0=parseInt(I0[1],16)||0,S0[14]=P0,S0[15]=M0,s(J,S0),J}function H(A0){var T0=A0.length,J=[1732584193,-271733879,-1732584194,271733878],o0,q,S0,I0,P0,M0;for(o0=64;o0<=T0;o0+=64)s(J,m(A0.subarray(o0-64,o0)));for(A0=o0-64<T0?A0.subarray(o0-64):new Uint8Array(0),q=A0.length,S0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o0=0;o0<q;o0+=1)S0[o0>>2]|=A0[o0]<<(o0%4<<3);if(S0[o0>>2]|=128<<(o0%4<<3),o0>55)for(s(J,S0),o0=0;o0<16;o0+=1)S0[o0]=0;return I0=T0*8,I0=I0.toString(16).match(/(.*?)(.{0,8})$/),P0=parseInt(I0[2],16),M0=parseInt(I0[1],16)||0,S0[14]=P0,S0[15]=M0,s(J,S0),J}function d(A0){var T0="",J;for(J=0;J<4;J+=1)T0+=l[A0>>J*8+4&15]+l[A0>>J*8&15];return T0}function x(A0){var T0;for(T0=0;T0<A0.length;T0+=1)A0[T0]=d(A0[T0]);return A0.join("")}x(p("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function A0(T0,J){return T0=T0|0||0,T0<0?Math.max(T0+J,0):Math.min(T0,J)}ArrayBuffer.prototype.slice=function(T0,J){var o0=this.byteLength,q=A0(T0,o0),S0=o0,I0,P0,M0,H0;return J!==o&&(S0=A0(J,o0)),q>S0?new ArrayBuffer(0):(I0=S0-q,P0=new ArrayBuffer(I0),M0=new Uint8Array(P0),H0=new Uint8Array(this,q,I0),M0.set(H0),P0)}}();function Y(A0){return/[\u0080-\uFFFF]/.test(A0)&&(A0=unescape(encodeURIComponent(A0))),A0}function e0(A0,T0){var J=A0.length,o0=new ArrayBuffer(J),q=new Uint8Array(o0),S0;for(S0=0;S0<J;S0+=1)q[S0]=A0.charCodeAt(S0);return T0?q:o0}function _0(A0){return String.fromCharCode.apply(null,new Uint8Array(A0))}function E0(A0,T0,J){var o0=new Uint8Array(A0.byteLength+T0.byteLength);return o0.set(new Uint8Array(A0)),o0.set(new Uint8Array(T0),A0.byteLength),J?o0:o0.buffer}function n0(A0){var T0=[],J=A0.length,o0;for(o0=0;o0<J-1;o0+=2)T0.push(parseInt(A0.substr(o0,2),16));return String.fromCharCode.apply(String,T0)}function l0(){this.reset()}return l0.prototype.append=function(A0){return this.appendBinary(Y(A0)),this},l0.prototype.appendBinary=function(A0){this._buff+=A0,this._length+=A0.length;var T0=this._buff.length,J;for(J=64;J<=T0;J+=64)s(this._hash,c(this._buff.substring(J-64,J)));return this._buff=this._buff.substring(J-64),this},l0.prototype.end=function(A0){var T0=this._buff,J=T0.length,o0,q=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],S0;for(o0=0;o0<J;o0+=1)q[o0>>2]|=T0.charCodeAt(o0)<<(o0%4<<3);return this._finish(q,J),S0=x(this._hash),A0&&(S0=n0(S0)),this.reset(),S0},l0.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l0.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},l0.prototype.setState=function(A0){return this._buff=A0.buff,this._length=A0.length,this._hash=A0.hash,this},l0.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},l0.prototype._finish=function(A0,T0){var J=T0,o0,q,S0;if(A0[J>>2]|=128<<(J%4<<3),J>55)for(s(this._hash,A0),J=0;J<16;J+=1)A0[J]=0;o0=this._length*8,o0=o0.toString(16).match(/(.*?)(.{0,8})$/),q=parseInt(o0[2],16),S0=parseInt(o0[1],16)||0,A0[14]=q,A0[15]=S0,s(this._hash,A0)},l0.hash=function(A0,T0){return l0.hashBinary(Y(A0),T0)},l0.hashBinary=function(A0,T0){var J=p(A0),o0=x(J);return T0?n0(o0):o0},l0.ArrayBuffer=function(){this.reset()},l0.ArrayBuffer.prototype.append=function(A0){var T0=E0(this._buff.buffer,A0,!0),J=T0.length,o0;for(this._length+=A0.byteLength,o0=64;o0<=J;o0+=64)s(this._hash,m(T0.subarray(o0-64,o0)));return this._buff=o0-64<J?new Uint8Array(T0.buffer.slice(o0-64)):new Uint8Array(0),this},l0.ArrayBuffer.prototype.end=function(A0){var T0=this._buff,J=T0.length,o0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],q,S0;for(q=0;q<J;q+=1)o0[q>>2]|=T0[q]<<(q%4<<3);return this._finish(o0,J),S0=x(this._hash),A0&&(S0=n0(S0)),this.reset(),S0},l0.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l0.ArrayBuffer.prototype.getState=function(){var A0=l0.prototype.getState.call(this);return A0.buff=_0(A0.buff),A0},l0.ArrayBuffer.prototype.setState=function(A0){return A0.buff=e0(A0.buff,!0),l0.prototype.setState.call(this,A0)},l0.ArrayBuffer.prototype.destroy=l0.prototype.destroy,l0.ArrayBuffer.prototype._finish=l0.prototype._finish,l0.ArrayBuffer.hash=function(A0,T0){var J=H(new Uint8Array(A0)),o0=x(J);return T0?n0(o0):o0},l0})})(sparkMd5);const SparkMD5=sparkMd5.exports,getPhotoMetadata=async r=>{let n=getFileExtent(r),o={};if(n==="jpg"||n==="jpeg")try{o=await _formatMetadata(r)}catch{o=await getImageSize(r)}else o=await getImageSize(r);return o.filesize=getFileSize(r),o};async function _formatMetadata(r,n=1){let o=await getFileBuffer(r,n),l=getMd5(o);return new Promise((s,c)=>{getData(o.buffer||o,function(m,p){if(p)return p.message==="Offset is outside the bounds of the DataView"&&n<3?s(_formatMetadata(r,n+1)):c(p);let{exif:H,xmp:d}=getAllTags(m);H=JSON.parse(JSON.stringify(H).replaceAll("\\u0000",""))||{},H.PixelXDimension&&H.PixelYDimension&&H.PixelXDimension!=65535&&H.PixelYDimension!=65535?s({exif:H,xmp:d,width:H.PixelXDimension,height:H.PixelYDimension,md5:l}):getImageSize(r).then(x=>{s({exif:H,xmp:d,width:x.width,height:x.height,md5:l})})})})}async function getImageSize(r){try{let n=await getFileBuffer(r),o=lookup(n),l,s=getFileExtent(r);if(s==="tif"||s==="tiff"||s==="png"){let c;typeof r=="string"?c=r:typeof window<"u"&&r instanceof window.File?c=r.name:c=Buffer.concat([n.subarray(0,10240),n.subarray(n.length/2,10240),n.subarray(-10240)]),typeof c=="string"?typeof Buffer<"u"?l=getMd5(Buffer.from(c)):l=getMd5(new TextEncoder().encode(c)):l=getMd5(c)}else l=getMd5(Buffer.concat([n.subarray(0,10240),n.subarray(n.length/2,10240),n.subarray(-10240)]));return{width:o.width,height:o.height,md5:l}}catch{return{width:0,height:0}}}function getAllTags(r){return util.imageHasData(r)?{exif:r.exifdata||{},xmp:r.xmpdata||{}}:{exif:{},xmp:{}}}function getFileExtent(r){return typeof r=="string"?r.split(".").pop().toLowerCase():typeof window<"u"&&r instanceof window.File?r.name.split(".").pop().toLowerCase():"jpg"}async function getFileBuffer(r,n){if(typeof r=="string")if(n){let o=fs__default.default.openSync(r),l=Buffer.alloc(65536*n);return await new Promise(s=>{fs__default.default.read(o,l,0,l.length,0,()=>{s(),fs__default.default.closeSync(o)})}),l}else return fs__default.default.readFileSync(r);else{if(typeof window<"u"&&r instanceof window.File)return n&&(r=r.slice(0,65536*n)),await new Promise((o,l)=>{var s=new FileReader;s.readAsArrayBuffer(r),s.onload=c=>{o(c.target.result)},s.onerror=c=>{l(c)}});if(Buffer.isBuffer(r))return r}}function getFileSize(r){return typeof r=="string"?fs__default.default.statSync(r).size:r.size||r.length}function getMd5(r){let n=new SparkMD5.ArrayBuffer;return n.append(r),n.end()}async function parsePhoto(r){let n=await getPhotoMetadata(r);const{width:o,height:l,exif:s,xmp:c,filesize:m,md5:p}=n;let H={width:o,height:l,filesize:m,md5:p},d=NaN,x=NaN,Y=NaN,e0=NaN,_0=NaN,E0=NaN,n0=[d,x,Y],l0=flatObject(c),{GPSAltitude:A0,GPSLatitude:T0,GPSLatitudeRef:J,GPSLongitude:o0,GPSLongitudeRef:q}=s||{};o0&&T0&&(n0=[getGeoCoordOperator(q)*toRadian(o0),getGeoCoordOperator(J)*toRadian(T0),+A0]);for(let S0 in l0){let I0=l0[S0];if(S0==="drone-dji:GpsLongtitude"||S0==="drone-dji:GpsLongitude")d=Number(I0);else if(S0==="drone-dji:GpsLatitude")x=Number(I0);else if(S0==="drone-dji:AbsoluteAltitude")Y=Number(I0);else if(S0==="drone-dji:GimbalYawDegree")e0=Number(I0);else if(S0==="drone-dji:GimbalPitchDegree")_0=Number(I0);else if(S0==="drone-dji:GimbalRollDegree")E0=Number(I0);else if(S0==="drone-dji:DewarpFlag")H.dewarp_flag=Boolean(Number(I0));else if(S0==="drone-dji:RtkFlag")H.rtk_flag=Number(I0);else if(S0==="drone-dji:RelativeAltitude")H.relative_altitude=Number(I0);else if(S0==="tiff:Model")H.camera_model=I0;else if(S0==="tiff:Make")H.make=I0;else if(S0==="drone-dji:DewarpData"){let M0=I0.split(";")[1].split(",").map(H0=>Number(H0));!M0[0]&&!M0[1]&&(M0[2]=o/2+M0[2],M0[3]=l/2+M0[3],H.pre_calib_param=M0)}else S0==="drone-dji:CaptureUUID"?H.capture_uuid=I0:S0==="drone-dji:DroneID"?H.drone_id=I0:S0==="drone-dji:DroneSerialNumber"?H.drone_serial_number=I0:S0==="drone-dji:CameraSerialNumber"&&(H.camera_serial_number=I0)}if(!Number.isNaN(e0)&&!Number.isNaN(_0)&&!Number.isNaN(E0)&&(H.pitch_roll_yaw=[_0,E0,e0],H.orientation=getRotationMatrix(_0,E0,e0)),s?.DateTime?H.capture_time=hooks(s.DateTime,"YYYY:MM:DD HH:mm:ss").valueOf():s?.DateTimeOriginal&&(H.capture_time=hooks(s.DateTimeOriginal,"YYYY:MM:DD HH:mm:ss").valueOf()),s?.FocalLengthIn35mmFilm&&(H.focal_length_in_35mm=s.FocalLengthIn35mmFilm,!H.pre_calib_param)){let S0=new Array(10).fill(0),I0=s.FocalLengthIn35mmFilm;S0[0]=S0[1]=I0/35*Math.max(o,l),S0[2]=o/2,S0[3]=l/2,H.pre_calib_param=S0}if(hasNaN(n0)&&(n0=[d,x,Y]),!hasNaN(n0))if(H.pos=n0,H.absolute_altitude=n0[2],H.coordinate_system={type:2,label:"WGS 84",type_name:"Geographic",epsg_code:4326},H.make==="DJI"&&H.rtk_flag){let S0=[];H.rtk_flag===50?S0=[.03,.03,.06]:H.rtk_flag===16?S0=[.5,.5,1]:S0=[2,2,5],H.pos_sigma=S0}else H.pos_sigma=[2,2,5];return H}function parsePhotos(r,n){let o=[],l=r,s=r.length,c=10,m=0;return new Promise(p=>{const H=[],d=()=>{for(let Y=m;Y<c;Y++){let e0=l.pop();if(!e0)break;m++,parsePhoto(e0).then(_0=>{if(!_0.width||!_0.height)throw new Error("broken photo");let E0=e0.split(".").pop(),n0={width:_0.width,height:_0.height,ext:E0,parameters:_0.pre_calib_param||null},l0=o.find(A0=>A0.width===n0.width&&A0.height===n0.height&&A0.ext===n0.ext&&_$1.isEqual(A0.parameters,n0.parameters));l0||(l0=n0,l0.fileList=[],o.push(l0)),l0.fileList.push({name:e0.split("\\").pop(),filesize:_0.filesize,md5:_0.md5,filePath:e0,meta_data:_0})}).catch(_0=>{H.push({file:e0,error:_0?.message||String(_0)})}).finally(()=>{m--,x()})}},x=()=>{l.length?d():m||p({cameras:o,failed:H});let Y=s-l.length-m;n&&n(Y,s,H)};d()})}function _extends(){return _extends=Object.assign?Object.assign.bind():function(r){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var l in o)({}).hasOwnProperty.call(o,l)&&(r[l]=o[l])}return r},_extends.apply(null,arguments)}var DEFAULT_CONFIG={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function isNumber(r){return typeof r=="number"}function isBigNumber(r){return!r||typeof r!="object"||typeof r.constructor!="function"?!1:r.isBigNumber===!0&&typeof r.constructor.prototype=="object"&&r.constructor.prototype.isBigNumber===!0||typeof r.constructor.isDecimal=="function"&&r.constructor.isDecimal(r)===!0}function isComplex(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isComplex===!0||!1}function isFraction(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isFraction===!0||!1}function isUnit(r){return r&&r.constructor.prototype.isUnit===!0||!1}function isString(r){return typeof r=="string"}var isArray=Array.isArray;function isMatrix(r){return r&&r.constructor.prototype.isMatrix===!0||!1}function isCollection(r){return Array.isArray(r)||isMatrix(r)}function isDenseMatrix(r){return r&&r.isDenseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function isSparseMatrix(r){return r&&r.isSparseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function isRange(r){return r&&r.constructor.prototype.isRange===!0||!1}function isIndex(r){return r&&r.constructor.prototype.isIndex===!0||!1}function isBoolean(r){return typeof r=="boolean"}function isResultSet(r){return r&&r.constructor.prototype.isResultSet===!0||!1}function isHelp(r){return r&&r.constructor.prototype.isHelp===!0||!1}function isFunction(r){return typeof r=="function"}function isDate(r){return r instanceof Date}function isRegExp(r){return r instanceof RegExp}function isObject(r){return!!(r&&typeof r=="object"&&r.constructor===Object&&!isComplex(r)&&!isFraction(r))}function isNull(r){return r===null}function isUndefined(r){return r===void 0}function isAccessorNode(r){return r&&r.isAccessorNode===!0&&r.constructor.prototype.isNode===!0||!1}function isArrayNode(r){return r&&r.isArrayNode===!0&&r.constructor.prototype.isNode===!0||!1}function isAssignmentNode(r){return r&&r.isAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function isBlockNode(r){return r&&r.isBlockNode===!0&&r.constructor.prototype.isNode===!0||!1}function isConditionalNode(r){return r&&r.isConditionalNode===!0&&r.constructor.prototype.isNode===!0||!1}function isConstantNode(r){return r&&r.isConstantNode===!0&&r.constructor.prototype.isNode===!0||!1}function isFunctionAssignmentNode(r){return r&&r.isFunctionAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function isFunctionNode(r){return r&&r.isFunctionNode===!0&&r.constructor.prototype.isNode===!0||!1}function isIndexNode(r){return r&&r.isIndexNode===!0&&r.constructor.prototype.isNode===!0||!1}function isNode(r){return r&&r.isNode===!0&&r.constructor.prototype.isNode===!0||!1}function isObjectNode(r){return r&&r.isObjectNode===!0&&r.constructor.prototype.isNode===!0||!1}function isOperatorNode(r){return r&&r.isOperatorNode===!0&&r.constructor.prototype.isNode===!0||!1}function isParenthesisNode(r){return r&&r.isParenthesisNode===!0&&r.constructor.prototype.isNode===!0||!1}function isRangeNode(r){return r&&r.isRangeNode===!0&&r.constructor.prototype.isNode===!0||!1}function isRelationalNode(r){return r&&r.isRelationalNode===!0&&r.constructor.prototype.isNode===!0||!1}function isSymbolNode(r){return r&&r.isSymbolNode===!0&&r.constructor.prototype.isNode===!0||!1}function isChain(r){return r&&r.constructor.prototype.isChain===!0||!1}function typeOf(r){var n=typeof r;return n==="object"?r===null?"null":isBigNumber(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":n}function clone$2(r){var n=typeof r;if(n==="number"||n==="string"||n==="boolean"||r===null||r===void 0)return r;if(typeof r.clone=="function")return r.clone();if(Array.isArray(r))return r.map(function(o){return clone$2(o)});if(r instanceof Date)return new Date(r.valueOf());if(isBigNumber(r))return r;if(isObject(r))return mapObject(r,clone$2);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function mapObject(r,n){var o={};for(var l in r)hasOwnProperty(r,l)&&(o[l]=n(r[l]));return o}function extend(r,n){for(var o in n)hasOwnProperty(n,o)&&(r[o]=n[o]);return r}function deepStrictEqual(r,n){var o,l,s;if(Array.isArray(r)){if(!Array.isArray(n)||r.length!==n.length)return!1;for(l=0,s=r.length;l<s;l++)if(!deepStrictEqual(r[l],n[l]))return!1;return!0}else{if(typeof r=="function")return r===n;if(r instanceof Object){if(Array.isArray(n)||!(n instanceof Object))return!1;for(o in r)if(!(o in n)||!deepStrictEqual(r[o],n[o]))return!1;for(o in n)if(!(o in r))return!1;return!0}else return r===n}}function hasOwnProperty(r,n){return r&&Object.hasOwnProperty.call(r,n)}function pickShallow(r,n){for(var o={},l=0;l<n.length;l++){var s=n[l],c=r[s];c!==void 0&&(o[s]=c)}return o}var MATRIX_OPTIONS=["Matrix","Array"],NUMBER_OPTIONS=["number","BigNumber","Fraction"],config$1=function r(n){if(n)throw new Error(`The global config is readonly.
467
+ `,pngImageHeaderChunkName="IHDR",pngFriedChunkName="CgBI",PNG={validate(r){if(pngSignature===toUTF8String(r,1,8)){let n=toUTF8String(r,12,16);if(n===pngFriedChunkName&&(n=toUTF8String(r,28,32)),n!==pngImageHeaderChunkName)throw new TypeError("Invalid PNG");return!0}return!1},calculate(r){return toUTF8String(r,12,16)===pngFriedChunkName?{height:readUInt32BE(r,36),width:readUInt32BE(r,32)}:{height:readUInt32BE(r,20),width:readUInt32BE(r,16)}}},PNMTypes={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},handlers={default:r=>{let n=[];for(;r.length>0;){const o=r.shift();if(o[0]!=="#"){n=o.split(" ");break}}if(n.length===2)return{height:parseInt(n[1],10),width:parseInt(n[0],10)};throw new TypeError("Invalid PNM")},pam:r=>{const n={};for(;r.length>0;){const o=r.shift();if(o.length>16||o.charCodeAt(0)>128)continue;const[l,s]=o.split(" ");if(l&&s&&(n[l.toLowerCase()]=parseInt(s,10)),n.height&&n.width)break}if(n.height&&n.width)return{height:n.height,width:n.width};throw new TypeError("Invalid PAM")}},PNM={validate:r=>toUTF8String(r,0,2)in PNMTypes,calculate(r){const n=toUTF8String(r,0,2),o=PNMTypes[n],l=toUTF8String(r,3).split(/[\r\n]+/);return(handlers[o]||handlers.default)(l)}},PSD={validate:r=>toUTF8String(r,0,4)==="8BPS",calculate:r=>({height:readUInt32BE(r,14),width:readUInt32BE(r,18)})},svgReg=/<svg\s([^>"']|"[^"]*"|'[^']*')*>/,extractorRegExps={height:/\sheight=(['"])([^%]+?)\1/,root:svgReg,viewbox:/\sviewBox=(['"])(.+?)\1/i,width:/\swidth=(['"])([^%]+?)\1/},INCH_CM=2.54,units={in:96,cm:96/INCH_CM,em:16,ex:8,m:96/INCH_CM*100,mm:96/INCH_CM/10,pc:96/72/12,pt:96/72,px:1},unitsReg=new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);function parseLength(r){const n=unitsReg.exec(r);if(!!n)return Math.round(Number(n[1])*(units[n[2]]||1))}function parseViewbox(r){const n=r.split(" ");return{height:parseLength(n[3]),width:parseLength(n[2])}}function parseAttributes(r){const n=r.match(extractorRegExps.width),o=r.match(extractorRegExps.height),l=r.match(extractorRegExps.viewbox);return{height:o&&parseLength(o[2]),viewbox:l&&parseViewbox(l[2]),width:n&&parseLength(n[2])}}function calculateByDimensions(r){return{height:r.height,width:r.width}}function calculateByViewbox(r,n){const o=n.width/n.height;return r.width?{height:Math.floor(r.width/o),width:r.width}:r.height?{height:r.height,width:Math.floor(r.height*o)}:{height:n.height,width:n.width}}const SVG={validate:r=>svgReg.test(toUTF8String(r,0,1e3)),calculate(r){const n=toUTF8String(r).match(extractorRegExps.root);if(n){const o=parseAttributes(n[0]);if(o.width&&o.height)return calculateByDimensions(o);if(o.viewbox)return calculateByViewbox(o,o.viewbox)}throw new TypeError("Invalid SVG")}},TGA={validate(r){return readUInt16LE(r,0)===0&&readUInt16LE(r,4)===0},calculate(r){return{height:readUInt16LE(r,14),width:readUInt16LE(r,12)}}};function readIFD(r,n){const o=readUInt(r,32,4,n);return r.slice(o+2)}function readValue(r,n){const o=readUInt(r,16,8,n);return(readUInt(r,16,10,n)<<16)+o}function nextTag(r){if(r.length>24)return r.slice(12)}function extractTags(r,n){const o={};let l=r;for(;l&&l.length;){const s=readUInt(l,16,0,n),c=readUInt(l,16,2,n),m=readUInt(l,32,4,n);if(s===0)break;m===1&&(c===3||c===4)&&(o[s]=readValue(l,n)),l=nextTag(l)}return o}function determineEndianness(r){const n=toUTF8String(r,0,2);if(n==="II")return"LE";if(n==="MM")return"BE"}const signatures=["49492a00","4d4d002a"],TIFF={validate:r=>signatures.includes(toHexString(r,0,4)),calculate(r){const n=determineEndianness(r)==="BE",o=readIFD(r,n),l=extractTags(o,n),s=l[256],c=l[257];if(!s||!c)throw new TypeError("Invalid Tiff. Missing tags");return{height:c,width:s}}};function calculateExtended(r){return{height:1+readUInt24LE(r,7),width:1+readUInt24LE(r,4)}}function calculateLossless(r){return{height:1+((r[4]&15)<<10|r[3]<<2|(r[2]&192)>>6),width:1+((r[2]&63)<<8|r[1])}}function calculateLossy(r){return{height:readInt16LE(r,8)&16383,width:readInt16LE(r,6)&16383}}const WEBP={validate(r){const n=toUTF8String(r,0,4)==="RIFF",o=toUTF8String(r,8,12)==="WEBP",l=toUTF8String(r,12,15)==="VP8";return n&&o&&l},calculate(r){const n=toUTF8String(r,12,16);if(r=r.slice(20,30),n==="VP8X"){const l=r[0],s=(l&192)===0,c=(l&1)===0;if(s&&c)return calculateExtended(r);throw new TypeError("Invalid WebP")}if(n==="VP8 "&&r[0]!==47)return calculateLossy(r);const o=toHexString(r,3,6);if(n==="VP8L"&&o!=="9d012a")return calculateLossless(r);throw new TypeError("Invalid WebP")}},typeHandlers=new Map([["bmp",BMP],["cur",CUR],["dds",DDS],["gif",GIF],["heif",HEIF],["icns",ICNS],["ico",ICO],["j2c",J2C],["jp2",JP2],["jpg",JPG],["ktx",KTX],["png",PNG],["pnm",PNM],["psd",PSD],["svg",SVG],["tga",TGA],["tiff",TIFF],["webp",WEBP]]),types=Array.from(typeHandlers.keys()),firstBytes=new Map([[56,"psd"],[66,"bmp"],[68,"dds"],[71,"gif"],[73,"tiff"],[77,"tiff"],[82,"webp"],[105,"icns"],[137,"png"],[255,"jpg"]]);function detector(r){const n=r[0],o=firstBytes.get(n);return o&&typeHandlers.get(o).validate(r)?o:types.find(l=>typeHandlers.get(l).validate(r))}const globalOptions={disabledTypes:[]};function lookup(r){const n=detector(r);if(typeof n<"u"){if(globalOptions.disabledTypes.indexOf(n)>-1)throw new TypeError("disabled file type: "+n);const o=typeHandlers.get(n).calculate(r);if(o!==void 0)return o.type=o.type??n,o}throw new TypeError("unsupported file type: "+n)}var sparkMd5={exports:{}};(function(r,n){(function(o){r.exports=o()})(function(o){var l=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(A0,T0){var J=A0[0],o0=A0[1],q=A0[2],S0=A0[3];J+=(o0&q|~o0&S0)+T0[0]-680876936|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[1]-389564586|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[2]+606105819|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[3]-1044525330|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[4]-176418897|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[5]+1200080426|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[6]-1473231341|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[7]-45705983|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[8]+1770035416|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[9]-1958414417|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[10]-42063|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[11]-1990404162|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&q|~o0&S0)+T0[12]+1804603682|0,J=(J<<7|J>>>25)+o0|0,S0+=(J&o0|~J&q)+T0[13]-40341101|0,S0=(S0<<12|S0>>>20)+J|0,q+=(S0&J|~S0&o0)+T0[14]-1502002290|0,q=(q<<17|q>>>15)+S0|0,o0+=(q&S0|~q&J)+T0[15]+1236535329|0,o0=(o0<<22|o0>>>10)+q|0,J+=(o0&S0|q&~S0)+T0[1]-165796510|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[6]-1069501632|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[11]+643717713|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[0]-373897302|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[5]-701558691|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[10]+38016083|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[15]-660478335|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[4]-405537848|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[9]+568446438|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[14]-1019803690|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[3]-187363961|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[8]+1163531501|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0&S0|q&~S0)+T0[13]-1444681467|0,J=(J<<5|J>>>27)+o0|0,S0+=(J&q|o0&~q)+T0[2]-51403784|0,S0=(S0<<9|S0>>>23)+J|0,q+=(S0&o0|J&~o0)+T0[7]+1735328473|0,q=(q<<14|q>>>18)+S0|0,o0+=(q&J|S0&~J)+T0[12]-1926607734|0,o0=(o0<<20|o0>>>12)+q|0,J+=(o0^q^S0)+T0[5]-378558|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[8]-2022574463|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[11]+1839030562|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[14]-35309556|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[1]-1530992060|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[4]+1272893353|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[7]-155497632|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[10]-1094730640|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[13]+681279174|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[0]-358537222|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[3]-722521979|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[6]+76029189|0,o0=(o0<<23|o0>>>9)+q|0,J+=(o0^q^S0)+T0[9]-640364487|0,J=(J<<4|J>>>28)+o0|0,S0+=(J^o0^q)+T0[12]-421815835|0,S0=(S0<<11|S0>>>21)+J|0,q+=(S0^J^o0)+T0[15]+530742520|0,q=(q<<16|q>>>16)+S0|0,o0+=(q^S0^J)+T0[2]-995338651|0,o0=(o0<<23|o0>>>9)+q|0,J+=(q^(o0|~S0))+T0[0]-198630844|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[7]+1126891415|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[14]-1416354905|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[5]-57434055|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[12]+1700485571|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[3]-1894986606|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[10]-1051523|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[1]-2054922799|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[8]+1873313359|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[15]-30611744|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[6]-1560198380|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[13]+1309151649|0,o0=(o0<<21|o0>>>11)+q|0,J+=(q^(o0|~S0))+T0[4]-145523070|0,J=(J<<6|J>>>26)+o0|0,S0+=(o0^(J|~q))+T0[11]-1120210379|0,S0=(S0<<10|S0>>>22)+J|0,q+=(J^(S0|~o0))+T0[2]+718787259|0,q=(q<<15|q>>>17)+S0|0,o0+=(S0^(q|~J))+T0[9]-343485551|0,o0=(o0<<21|o0>>>11)+q|0,A0[0]=J+A0[0]|0,A0[1]=o0+A0[1]|0,A0[2]=q+A0[2]|0,A0[3]=S0+A0[3]|0}function c(A0){var T0=[],J;for(J=0;J<64;J+=4)T0[J>>2]=A0.charCodeAt(J)+(A0.charCodeAt(J+1)<<8)+(A0.charCodeAt(J+2)<<16)+(A0.charCodeAt(J+3)<<24);return T0}function m(A0){var T0=[],J;for(J=0;J<64;J+=4)T0[J>>2]=A0[J]+(A0[J+1]<<8)+(A0[J+2]<<16)+(A0[J+3]<<24);return T0}function p(A0){var T0=A0.length,J=[1732584193,-271733879,-1732584194,271733878],o0,q,S0,I0,P0,M0;for(o0=64;o0<=T0;o0+=64)s(J,c(A0.substring(o0-64,o0)));for(A0=A0.substring(o0-64),q=A0.length,S0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o0=0;o0<q;o0+=1)S0[o0>>2]|=A0.charCodeAt(o0)<<(o0%4<<3);if(S0[o0>>2]|=128<<(o0%4<<3),o0>55)for(s(J,S0),o0=0;o0<16;o0+=1)S0[o0]=0;return I0=T0*8,I0=I0.toString(16).match(/(.*?)(.{0,8})$/),P0=parseInt(I0[2],16),M0=parseInt(I0[1],16)||0,S0[14]=P0,S0[15]=M0,s(J,S0),J}function H(A0){var T0=A0.length,J=[1732584193,-271733879,-1732584194,271733878],o0,q,S0,I0,P0,M0;for(o0=64;o0<=T0;o0+=64)s(J,m(A0.subarray(o0-64,o0)));for(A0=o0-64<T0?A0.subarray(o0-64):new Uint8Array(0),q=A0.length,S0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o0=0;o0<q;o0+=1)S0[o0>>2]|=A0[o0]<<(o0%4<<3);if(S0[o0>>2]|=128<<(o0%4<<3),o0>55)for(s(J,S0),o0=0;o0<16;o0+=1)S0[o0]=0;return I0=T0*8,I0=I0.toString(16).match(/(.*?)(.{0,8})$/),P0=parseInt(I0[2],16),M0=parseInt(I0[1],16)||0,S0[14]=P0,S0[15]=M0,s(J,S0),J}function d(A0){var T0="",J;for(J=0;J<4;J+=1)T0+=l[A0>>J*8+4&15]+l[A0>>J*8&15];return T0}function x(A0){var T0;for(T0=0;T0<A0.length;T0+=1)A0[T0]=d(A0[T0]);return A0.join("")}x(p("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function A0(T0,J){return T0=T0|0||0,T0<0?Math.max(T0+J,0):Math.min(T0,J)}ArrayBuffer.prototype.slice=function(T0,J){var o0=this.byteLength,q=A0(T0,o0),S0=o0,I0,P0,M0,H0;return J!==o&&(S0=A0(J,o0)),q>S0?new ArrayBuffer(0):(I0=S0-q,P0=new ArrayBuffer(I0),M0=new Uint8Array(P0),H0=new Uint8Array(this,q,I0),M0.set(H0),P0)}}();function Y(A0){return/[\u0080-\uFFFF]/.test(A0)&&(A0=unescape(encodeURIComponent(A0))),A0}function e0(A0,T0){var J=A0.length,o0=new ArrayBuffer(J),q=new Uint8Array(o0),S0;for(S0=0;S0<J;S0+=1)q[S0]=A0.charCodeAt(S0);return T0?q:o0}function _0(A0){return String.fromCharCode.apply(null,new Uint8Array(A0))}function E0(A0,T0,J){var o0=new Uint8Array(A0.byteLength+T0.byteLength);return o0.set(new Uint8Array(A0)),o0.set(new Uint8Array(T0),A0.byteLength),J?o0:o0.buffer}function n0(A0){var T0=[],J=A0.length,o0;for(o0=0;o0<J-1;o0+=2)T0.push(parseInt(A0.substr(o0,2),16));return String.fromCharCode.apply(String,T0)}function l0(){this.reset()}return l0.prototype.append=function(A0){return this.appendBinary(Y(A0)),this},l0.prototype.appendBinary=function(A0){this._buff+=A0,this._length+=A0.length;var T0=this._buff.length,J;for(J=64;J<=T0;J+=64)s(this._hash,c(this._buff.substring(J-64,J)));return this._buff=this._buff.substring(J-64),this},l0.prototype.end=function(A0){var T0=this._buff,J=T0.length,o0,q=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],S0;for(o0=0;o0<J;o0+=1)q[o0>>2]|=T0.charCodeAt(o0)<<(o0%4<<3);return this._finish(q,J),S0=x(this._hash),A0&&(S0=n0(S0)),this.reset(),S0},l0.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l0.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},l0.prototype.setState=function(A0){return this._buff=A0.buff,this._length=A0.length,this._hash=A0.hash,this},l0.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},l0.prototype._finish=function(A0,T0){var J=T0,o0,q,S0;if(A0[J>>2]|=128<<(J%4<<3),J>55)for(s(this._hash,A0),J=0;J<16;J+=1)A0[J]=0;o0=this._length*8,o0=o0.toString(16).match(/(.*?)(.{0,8})$/),q=parseInt(o0[2],16),S0=parseInt(o0[1],16)||0,A0[14]=q,A0[15]=S0,s(this._hash,A0)},l0.hash=function(A0,T0){return l0.hashBinary(Y(A0),T0)},l0.hashBinary=function(A0,T0){var J=p(A0),o0=x(J);return T0?n0(o0):o0},l0.ArrayBuffer=function(){this.reset()},l0.ArrayBuffer.prototype.append=function(A0){var T0=E0(this._buff.buffer,A0,!0),J=T0.length,o0;for(this._length+=A0.byteLength,o0=64;o0<=J;o0+=64)s(this._hash,m(T0.subarray(o0-64,o0)));return this._buff=o0-64<J?new Uint8Array(T0.buffer.slice(o0-64)):new Uint8Array(0),this},l0.ArrayBuffer.prototype.end=function(A0){var T0=this._buff,J=T0.length,o0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],q,S0;for(q=0;q<J;q+=1)o0[q>>2]|=T0[q]<<(q%4<<3);return this._finish(o0,J),S0=x(this._hash),A0&&(S0=n0(S0)),this.reset(),S0},l0.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l0.ArrayBuffer.prototype.getState=function(){var A0=l0.prototype.getState.call(this);return A0.buff=_0(A0.buff),A0},l0.ArrayBuffer.prototype.setState=function(A0){return A0.buff=e0(A0.buff,!0),l0.prototype.setState.call(this,A0)},l0.ArrayBuffer.prototype.destroy=l0.prototype.destroy,l0.ArrayBuffer.prototype._finish=l0.prototype._finish,l0.ArrayBuffer.hash=function(A0,T0){var J=H(new Uint8Array(A0)),o0=x(J);return T0?n0(o0):o0},l0})})(sparkMd5);const SparkMD5=sparkMd5.exports,getPhotoMetadata=async r=>{let n=getFileExtent(r),o={};if(n==="jpg"||n==="jpeg")try{o=await _formatMetadata(r)}catch{o=await getImageSize(r)}else o=await getImageSize(r);return o.filesize=getFileSize(r),o};async function _formatMetadata(r,n=1){let o=await getFileBuffer(r,n),l=getMd5(o);return new Promise((s,c)=>{getData(o.buffer||o,function(m,p){if(p)return p.message==="Offset is outside the bounds of the DataView"&&n<3?s(_formatMetadata(r,n+1)):c(p);let{exif:H,xmp:d}=getAllTags(m);H=JSON.parse(JSON.stringify(H).replaceAll("\\u0000",""))||{},H.PixelXDimension&&H.PixelYDimension&&H.PixelXDimension!=65535&&H.PixelYDimension!=65535?s({exif:H,xmp:d,width:H.PixelXDimension,height:H.PixelYDimension,md5:l}):getImageSize(r).then(x=>{s({exif:H,xmp:d,width:x.width,height:x.height,md5:l})})})})}async function getImageSize(r){try{let n=await getFileBuffer(r),o=lookup(n),l,s=getFileExtent(r);if(s==="tif"||s==="tiff"||s==="png"){let c;typeof r=="string"?c=r:typeof window<"u"&&r instanceof window.File?c=r.name:c=Buffer.concat([n.subarray(0,10240),n.subarray(n.length/2,10240),n.subarray(-10240)]),typeof c=="string"?typeof Buffer<"u"?l=getMd5(Buffer.from(c)):l=getMd5(new TextEncoder().encode(c)):l=getMd5(c)}else l=getMd5(Buffer.concat([n.subarray(0,10240),n.subarray(n.length/2,10240),n.subarray(-10240)]));return{width:o.width,height:o.height,md5:l}}catch{return{width:0,height:0}}}function getAllTags(r){return util.imageHasData(r)?{exif:r.exifdata||{},xmp:r.xmpdata||{}}:{exif:{},xmp:{}}}function getFileExtent(r){return typeof r=="string"?r.split(".").pop().toLowerCase():typeof window<"u"&&r instanceof window.File?r.name.split(".").pop().toLowerCase():"jpg"}async function getFileBuffer(r,n){if(typeof r=="string")if(n){let o=fs__default.default.openSync(r),l=Buffer.alloc(65536*n);return await new Promise(s=>{fs__default.default.read(o,l,0,l.length,0,()=>{s(),fs__default.default.closeSync(o)})}),l}else return fs__default.default.readFileSync(r);else{if(typeof window<"u"&&r instanceof window.File)return n&&(r=r.slice(0,65536*n)),await new Promise((o,l)=>{var s=new FileReader;s.readAsArrayBuffer(r),s.onload=c=>{o(c.target.result)},s.onerror=c=>{l(c)}});if(Buffer.isBuffer(r))return r}}function getFileSize(r){return typeof r=="string"?fs__default.default.statSync(r).size:r.size||r.length}function getMd5(r){let n=new SparkMD5.ArrayBuffer;return n.append(r),n.end()}async function parsePhoto(r){let n=await getPhotoMetadata(r);const{width:o,height:l,exif:s,xmp:c,filesize:m,md5:p}=n;let H={width:o,height:l,filesize:m,md5:p},d=NaN,x=NaN,Y=NaN,e0=NaN,_0=NaN,E0=NaN,n0=[d,x,Y],l0=flatObject(c),{GPSAltitude:A0,GPSLatitude:T0,GPSLatitudeRef:J,GPSLongitude:o0,GPSLongitudeRef:q}=s||{};o0&&T0&&(n0=[getGeoCoordOperator(q)*toRadian(o0),getGeoCoordOperator(J)*toRadian(T0),+A0]);for(let S0 in l0){let I0=l0[S0];if(S0==="drone-dji:GpsLongtitude"||S0==="drone-dji:GpsLongitude")d=Number(I0);else if(S0==="drone-dji:GpsLatitude")x=Number(I0);else if(S0==="drone-dji:AbsoluteAltitude")Y=Number(I0);else if(S0==="drone-dji:GimbalYawDegree")e0=Number(I0);else if(S0==="drone-dji:GimbalPitchDegree")_0=Number(I0);else if(S0==="drone-dji:GimbalRollDegree")E0=Number(I0);else if(S0==="drone-dji:DewarpFlag")H.dewarp_flag=Boolean(Number(I0));else if(S0==="drone-dji:RtkFlag")H.rtk_flag=Number(I0);else if(S0==="drone-dji:RelativeAltitude")H.relative_altitude=Number(I0);else if(S0==="tiff:Model")H.camera_model=I0;else if(S0==="tiff:Make")H.make=I0;else if(S0==="drone-dji:DewarpData"){let M0=I0.split(";")[1].split(",").map(H0=>Number(H0));M0[0]&&M0[1]&&(M0[2]=o/2+M0[2],M0[3]=l/2+M0[3],H.pre_calib_param=M0)}else S0==="drone-dji:CaptureUUID"?H.capture_uuid=I0:S0==="drone-dji:DroneID"?H.drone_id=I0:S0==="drone-dji:DroneSerialNumber"?H.drone_serial_number=I0:S0==="drone-dji:CameraSerialNumber"&&(H.camera_serial_number=I0)}if(!Number.isNaN(e0)&&!Number.isNaN(_0)&&!Number.isNaN(E0)&&(H.pitch_roll_yaw=[_0,E0,e0],H.orientation=getRotationMatrix(_0,E0,e0)),s?.DateTime?H.capture_time=hooks(s.DateTime,"YYYY:MM:DD HH:mm:ss").valueOf():s?.DateTimeOriginal&&(H.capture_time=hooks(s.DateTimeOriginal,"YYYY:MM:DD HH:mm:ss").valueOf()),s?.FocalLengthIn35mmFilm&&(H.focal_length_in_35mm=s.FocalLengthIn35mmFilm,!H.pre_calib_param)){let S0=new Array(10).fill(0),I0=s.FocalLengthIn35mmFilm;S0[0]=S0[1]=I0/35*Math.max(o,l),S0[2]=o/2,S0[3]=l/2,H.pre_calib_param=S0}if(hasNaN(n0)&&(n0=[d,x,Y]),!hasNaN(n0))if(H.pos=n0,H.absolute_altitude=n0[2],H.coordinate_system={type:2,label:"WGS 84",type_name:"Geographic",epsg_code:4326},H.make==="DJI"&&H.rtk_flag){let S0=[];H.rtk_flag===50?S0=[.03,.03,.06]:H.rtk_flag>=32?S0=[.5,.5,1]:S0=[2,2,5],H.pos_sigma=S0}else H.pos_sigma=[2,2,5];return H}function parsePhotos(r,n){let o=[],l=r,s=r.length,c=10,m=0;return new Promise(p=>{const H=[],d=()=>{for(let Y=m;Y<c;Y++){let e0=l.pop();if(!e0)break;m++,parsePhoto(e0).then(_0=>{if(!_0.width||!_0.height)throw new Error("broken photo");let E0=e0.split(".").pop(),n0={width:_0.width,height:_0.height,ext:E0,camera_serial_number:_0.camera_serial_number,parameters:_0.pre_calib_param||null},l0=o.find(A0=>A0.width===n0.width&&A0.height===n0.height&&A0.ext===n0.ext&&_$1.isEqual(A0.parameters,n0.parameters)&&A0.camera_serial_number===n0.camera_serial_number);l0||(l0=n0,l0.fileList=[],o.push(l0)),l0.fileList.push({name:e0.split("\\").pop(),filesize:_0.filesize,md5:_0.md5,filePath:e0,meta_data:_0})}).catch(_0=>{H.push({file:e0,error:_0?.message||String(_0)})}).finally(()=>{m--,x()})}},x=()=>{l.length?d():m||p({cameras:o,failed:H});let Y=s-l.length-m;n&&n(Y,s,H)};d()})}function _extends(){return _extends=Object.assign?Object.assign.bind():function(r){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var l in o)({}).hasOwnProperty.call(o,l)&&(r[l]=o[l])}return r},_extends.apply(null,arguments)}var DEFAULT_CONFIG={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function isNumber(r){return typeof r=="number"}function isBigNumber(r){return!r||typeof r!="object"||typeof r.constructor!="function"?!1:r.isBigNumber===!0&&typeof r.constructor.prototype=="object"&&r.constructor.prototype.isBigNumber===!0||typeof r.constructor.isDecimal=="function"&&r.constructor.isDecimal(r)===!0}function isComplex(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isComplex===!0||!1}function isFraction(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isFraction===!0||!1}function isUnit(r){return r&&r.constructor.prototype.isUnit===!0||!1}function isString(r){return typeof r=="string"}var isArray=Array.isArray;function isMatrix(r){return r&&r.constructor.prototype.isMatrix===!0||!1}function isCollection(r){return Array.isArray(r)||isMatrix(r)}function isDenseMatrix(r){return r&&r.isDenseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function isSparseMatrix(r){return r&&r.isSparseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function isRange(r){return r&&r.constructor.prototype.isRange===!0||!1}function isIndex(r){return r&&r.constructor.prototype.isIndex===!0||!1}function isBoolean(r){return typeof r=="boolean"}function isResultSet(r){return r&&r.constructor.prototype.isResultSet===!0||!1}function isHelp(r){return r&&r.constructor.prototype.isHelp===!0||!1}function isFunction(r){return typeof r=="function"}function isDate(r){return r instanceof Date}function isRegExp(r){return r instanceof RegExp}function isObject(r){return!!(r&&typeof r=="object"&&r.constructor===Object&&!isComplex(r)&&!isFraction(r))}function isNull(r){return r===null}function isUndefined(r){return r===void 0}function isAccessorNode(r){return r&&r.isAccessorNode===!0&&r.constructor.prototype.isNode===!0||!1}function isArrayNode(r){return r&&r.isArrayNode===!0&&r.constructor.prototype.isNode===!0||!1}function isAssignmentNode(r){return r&&r.isAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function isBlockNode(r){return r&&r.isBlockNode===!0&&r.constructor.prototype.isNode===!0||!1}function isConditionalNode(r){return r&&r.isConditionalNode===!0&&r.constructor.prototype.isNode===!0||!1}function isConstantNode(r){return r&&r.isConstantNode===!0&&r.constructor.prototype.isNode===!0||!1}function isFunctionAssignmentNode(r){return r&&r.isFunctionAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function isFunctionNode(r){return r&&r.isFunctionNode===!0&&r.constructor.prototype.isNode===!0||!1}function isIndexNode(r){return r&&r.isIndexNode===!0&&r.constructor.prototype.isNode===!0||!1}function isNode(r){return r&&r.isNode===!0&&r.constructor.prototype.isNode===!0||!1}function isObjectNode(r){return r&&r.isObjectNode===!0&&r.constructor.prototype.isNode===!0||!1}function isOperatorNode(r){return r&&r.isOperatorNode===!0&&r.constructor.prototype.isNode===!0||!1}function isParenthesisNode(r){return r&&r.isParenthesisNode===!0&&r.constructor.prototype.isNode===!0||!1}function isRangeNode(r){return r&&r.isRangeNode===!0&&r.constructor.prototype.isNode===!0||!1}function isRelationalNode(r){return r&&r.isRelationalNode===!0&&r.constructor.prototype.isNode===!0||!1}function isSymbolNode(r){return r&&r.isSymbolNode===!0&&r.constructor.prototype.isNode===!0||!1}function isChain(r){return r&&r.constructor.prototype.isChain===!0||!1}function typeOf(r){var n=typeof r;return n==="object"?r===null?"null":isBigNumber(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":n}function clone$2(r){var n=typeof r;if(n==="number"||n==="string"||n==="boolean"||r===null||r===void 0)return r;if(typeof r.clone=="function")return r.clone();if(Array.isArray(r))return r.map(function(o){return clone$2(o)});if(r instanceof Date)return new Date(r.valueOf());if(isBigNumber(r))return r;if(isObject(r))return mapObject(r,clone$2);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function mapObject(r,n){var o={};for(var l in r)hasOwnProperty(r,l)&&(o[l]=n(r[l]));return o}function extend(r,n){for(var o in n)hasOwnProperty(n,o)&&(r[o]=n[o]);return r}function deepStrictEqual(r,n){var o,l,s;if(Array.isArray(r)){if(!Array.isArray(n)||r.length!==n.length)return!1;for(l=0,s=r.length;l<s;l++)if(!deepStrictEqual(r[l],n[l]))return!1;return!0}else{if(typeof r=="function")return r===n;if(r instanceof Object){if(Array.isArray(n)||!(n instanceof Object))return!1;for(o in r)if(!(o in n)||!deepStrictEqual(r[o],n[o]))return!1;for(o in n)if(!(o in r))return!1;return!0}else return r===n}}function hasOwnProperty(r,n){return r&&Object.hasOwnProperty.call(r,n)}function pickShallow(r,n){for(var o={},l=0;l<n.length;l++){var s=n[l],c=r[s];c!==void 0&&(o[s]=c)}return o}var MATRIX_OPTIONS=["Matrix","Array"],NUMBER_OPTIONS=["number","BigNumber","Fraction"],config$1=function r(n){if(n)throw new Error(`The global config is readonly.
468
468
  Please create a mathjs instance if you want to change the default configuration.
469
469
  Example:
470
470
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapcatch/util",
3
- "version": "2.2.9",
3
+ "version": "2.2.11",
4
4
  "main": "./dist/catchUtil.min.cjs.js",
5
5
  "module": "./dist/catchUtil.min.esm.js",
6
6
  "browser": "./dist/catchUtil.min.js",
@@ -26,7 +26,6 @@
26
26
  "src/**/*.js": "yarn lint"
27
27
  },
28
28
  "dependencies": {
29
- "geotiff": "2.0.4"
30
29
  },
31
30
  "devDependencies": {
32
31
  "@babel/core": "^7.25.2",
@@ -36,6 +35,7 @@
36
35
  "cdt2d": "^1.0.0",
37
36
  "deepmerge": "^4.3.1",
38
37
  "eslint": "8.22.0",
38
+ "geotiff": "2.0.4",
39
39
  "geotiff-geokeys-to-proj4": "^2024.4.13",
40
40
  "gl-matrix": "^3.4.3",
41
41
  "glsl-float-to-rgba": "^1.0.0",