@mapcatch/util 2.2.3 → 2.2.4
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.
- package/dist/catchUtil.min.cjs.js +1 -1
- package/dist/catchUtil.min.esm.js +28 -26
- package/dist/catchUtil.min.js +1 -1
- package/package.json +1 -1
|
@@ -464,7 +464,7 @@ void main() {
|
|
|
464
464
|
`)}function DOMParser$1(e){if(e=e||{},e.locator===void 0&&(e.locator=!0),this.assign=e.assign||conventions$1.assign,this.domHandler=e.domHandler||DOMHandler,this.onError=e.onError||e.errorHandler,e.errorHandler&&typeof e.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");e.errorHandler&&e.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=e.normalizeLineEndings||normalizeLineEndings,this.locator=!!e.locator,this.xmlns=this.assign(Object.create(null),e.xmlns)}DOMParser$1.prototype.parseFromString=function(e,r){if(!isValidMimeType(r))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+r+'" is not valid.');var s=this.assign(Object.create(null),this.xmlns),u=entities.XML_ENTITIES,m=s[""]||null;hasDefaultHTMLNamespace(r)?(u=entities.HTML_ENTITIES,m=NAMESPACE.HTML):r===MIME_TYPE.XML_SVG_IMAGE&&(m=NAMESPACE.SVG),s[""]=m,s.xml=s.xml||NAMESPACE.XML;var H=new this.domHandler({mimeType:r,defaultNamespace:m,onError:this.onError}),x=this.locator?{}:void 0;this.locator&&H.setDocumentLocator(x);var o=new XMLReader;o.errorHandler=H,o.domBuilder=H;var F=!conventions$1.isHTMLMimeType(r);return F&&typeof e!="string"&&o.errorHandler.fatalError("source is not a string"),o.parse(this.normalizeLineEndings(String(e)),s,u),H.doc.documentElement||o.errorHandler.fatalError("missing root element"),H.doc};function DOMHandler(e){var r=e||{};this.mimeType=r.mimeType||MIME_TYPE.XML_APPLICATION,this.defaultNamespace=r.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=r.onError}function position(e,r){r.lineNumber=e.lineNumber,r.columnNumber=e.columnNumber}DOMHandler.prototype={startDocument:function(){var e=new DOMImplementation;this.doc=isHTMLMimeType(this.mimeType)?e.createHTMLDocument(!1):e.createDocument(this.defaultNamespace,"")},startElement:function(e,r,s,u){var m=this.doc,H=m.createElementNS(e,s||r),x=u.length;appendElement(this,H),this.currentElement=H,this.locator&&position(this.locator,H);for(var o=0;o<x;o++){var e=u.getURI(o),F=u.getValue(o),s=u.getQName(o),Re=m.createAttributeNS(e,s);this.locator&&position(u.getLocator(o),Re),Re.value=Re.nodeValue=F,H.setAttributeNode(Re)}},endElement:function(e,r,s){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(e,r){},endPrefixMapping:function(e){},processingInstruction:function(e,r){var s=this.doc.createProcessingInstruction(e,r);this.locator&&position(this.locator,s),appendElement(this,s)},ignorableWhitespace:function(e,r,s){},characters:function(e,r,s){if(e=_toString.apply(this,arguments),e){if(this.cdata)var u=this.doc.createCDATASection(e);else var u=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(u):/^\s*$/.test(e)&&this.doc.appendChild(u),this.locator&&position(this.locator,u)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){e&&(e.lineNumber=0),this.locator=e},comment:function(e,r,s){e=_toString.apply(this,arguments);var u=this.doc.createComment(e);this.locator&&position(this.locator,u),appendElement(this,u)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,r,s,u){var m=this.doc.implementation;if(m&&m.createDocumentType){var H=m.createDocumentType(e,r,s,u);this.locator&&position(this.locator,H),appendElement(this,H),this.doc.doctype=H}},reportError:function(e,r){if(typeof this.onError=="function")try{this.onError(e,r,this)}catch(s){throw new ParseError("Reporting "+e+' "'+r+'" caused '+s,this.locator)}else console.error("[xmldom "+e+"] "+r,_locator(this.locator))},warning:function(e){this.reportError("warning",e)},error:function(e){this.reportError("error",e)},fatalError:function(e){throw this.reportError("fatalError",e),new ParseError(e,this.locator)}};function _locator(e){if(e)return`
|
|
465
465
|
@#[line:`+e.lineNumber+",col:"+e.columnNumber+"]"}function _toString(e,r,s){return typeof e=="string"?e.substr(r,s):e.length>=r+s||r?new java.lang.String(e,r,s)+"":e}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){DOMHandler.prototype[e]=function(){return null}});function appendElement(e,r){e.currentElement?e.currentElement.appendChild(r):e.doc.appendChild(r)}function onErrorStopParsing(e){if(e==="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(e,r){return util.imageHasData(e)?r&&r(e):getImageData(e,r),!0};function getImageData(e,r){try{var s=findEXIFinJPEG(e);e.exifdata=s.exif,e.xmpdata=s.xmp,r&&r(e)}catch(u){e.exifdata={},e.xmpdata={},r(e,u)}}function findEXIFinJPEG(e){var r=new DataView(e);let s,u;for(var m=2,H=e.byteLength,x=new DOMParser,o;m<H&&r.getUint8(m)==255;){o=r.getUint8(m+1);let Ze=r.getUint16(m+2);if(util.getStringFromDB(r,m+4,Ze),o==225)if(util.getStringFromDB(r,m+4,4)=="http"){var F=m+3,Re=r.getUint16(m+2)-1,He=util.getStringFromDB(r,F,Re),Ue=He.indexOf("xmpmeta>")+8;He=He.substring(He.indexOf("<x:xmpmeta"),Ue);var Fe=He.indexOf("x:xmpmeta")+10;He=He.slice(0,Fe)+'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/" '+He.slice(Fe);var nt=x.parseFromString(He,"text/xml");u=util.xml2Object(nt)}else s=readEXIFData(r,m+4,r.getUint16(m+2)-2);if(u&&s)break;m+=2+r.getUint16(m+2)}return{exif:s||{},xmp:u||{}}}function readEXIFData(e,r){if(util.getStringFromDB(e,r,4)!="Exif")return!1;var s,u,m,H,x,o=r+6;if(e.getUint16(o)==18761)s=!1;else if(e.getUint16(o)==19789)s=!0;else return!1;if(e.getUint16(o+2,!s)!=42)return!1;var F=e.getUint32(o+4,!s);if(F<8)return!1;if(u=readTags(e,o,o+F,TiffTags,s),u.ExifIFDPointer){H=readTags(e,o,o+u.ExifIFDPointer,ExifTags,s);for(m in H){switch(m){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":H[m]=StringValues[m][H[m]];break;case"ExifVersion":case"FlashpixVersion":H[m]=String.fromCharCode(H[m][0],H[m][1],H[m][2],H[m][3]);break;case"ComponentsConfiguration":H[m]=StringValues.Components[H[m][0]]+StringValues.Components[H[m][1]]+StringValues.Components[H[m][2]]+StringValues.Components[H[m][3]];break}u[m]=H[m]}}if(u.GPSInfoIFDPointer){x=readTags(e,o,o+u.GPSInfoIFDPointer,GPSTags,s);for(m in x){switch(m){case"GPSVersionID":x[m]=x[m][0]+"."+x[m][1]+"."+x[m][2]+"."+x[m][3];break}u[m]=x[m]}}return u}function readTags(e,r,s,u,m){var H=e.getUint16(s,!m),x={},o,F,Re;for(Re=0;Re<H;Re++)o=s+Re*12+2,F=u[e.getUint16(o,!m)],x[F]=readTagValue(e,o,r,s,m);return x}function readTagValue(e,r,s,u,m){var H=e.getUint16(r+2,!m),x=e.getUint32(r+4,!m),o=e.getUint32(r+8,!m)+s,F,Re,He,Ue,Fe,nt;switch(H){case 1:case 7:if(x==1)return e.getUint8(r+8,!m);for(F=x>4?o:r+8,Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getUint8(F+Ue);return Re;case 2:return F=x>4?o:r+8,util.getStringFromDB(e,F,x-1);case 3:if(x==1)return e.getUint16(r+8,!m);for(F=x>2?o:r+8,Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getUint16(F+2*Ue,!m);return Re;case 4:if(x==1)return e.getUint32(r+8,!m);for(Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getUint32(o+4*Ue,!m);return Re;case 5:if(x==1)return Fe=e.getUint32(o,!m),nt=e.getUint32(o+4,!m),He=new Number(Fe/nt),He.numerator=Fe,He.denominator=nt,He;for(Re=[],Ue=0;Ue<x;Ue++)Fe=e.getUint32(o+8*Ue,!m),nt=e.getUint32(o+4+8*Ue,!m),Re[Ue]=new Number(Fe/nt),Re[Ue].numerator=Fe,Re[Ue].denominator=nt;return Re;case 9:if(x==1)return e.getInt32(r+8,!m);for(Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getInt32(o+4*Ue,!m);return Re;case 10:if(x==1)return e.getInt32(o,!m)/e.getInt32(o+4,!m);for(Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getInt32(o+8*Ue,!m)/e.getInt32(o+4+8*Ue,!m);return Re}}const decoder=new TextDecoder,toUTF8String=(e,r=0,s=e.length)=>decoder.decode(e.slice(r,s)),toHexString=(e,r=0,s=e.length)=>e.slice(r,s).reduce((u,m)=>u+("0"+m.toString(16)).slice(-2),""),readInt16LE=(e,r=0)=>{const s=e[r]+e[r+1]*256;return s|(s&2**15)*131070},readUInt16BE=(e,r=0)=>e[r]*2**8+e[r+1],readUInt16LE=(e,r=0)=>e[r]+e[r+1]*2**8,readUInt24LE=(e,r=0)=>e[r]+e[r+1]*2**8+e[r+2]*2**16,readInt32LE=(e,r=0)=>e[r]+e[r+1]*2**8+e[r+2]*2**16+(e[r+3]<<24),readUInt32BE=(e,r=0)=>e[r]*2**24+e[r+1]*2**16+e[r+2]*2**8+e[r+3],readUInt32LE=(e,r=0)=>e[r]+e[r+1]*2**8+e[r+2]*2**16+e[r+3]*2**24,methods={readUInt16BE,readUInt16LE,readUInt32BE,readUInt32LE};function readUInt(e,r,s,u){s=s||0;const m=u?"BE":"LE",H="readUInt"+r+m;return methods[H](e,s)}function readBox(e,r){if(e.length-r<4)return;const s=readUInt32BE(e,r);if(!(e.length-r<s))return{name:toUTF8String(e,4+r,8+r),offset:r,size:s}}function findBox(e,r,s){for(;s<e.length;){const u=readBox(e,s);if(!u)break;if(u.name===r)return u;s+=u.size}}const BMP={validate:e=>toUTF8String(e,0,2)==="BM",calculate:e=>({height:Math.abs(readInt32LE(e,22)),width:readUInt32LE(e,18)})},TYPE_ICON=1,SIZE_HEADER$1=2+2+2,SIZE_IMAGE_ENTRY=1+1+1+1+2+2+4+4;function getSizeFromOffset(e,r){const s=e[r];return s===0?256:s}function getImageSize$2(e,r){const s=SIZE_HEADER$1+r*SIZE_IMAGE_ENTRY;return{height:getSizeFromOffset(e,s+1),width:getSizeFromOffset(e,s)}}const ICO={validate(e){const r=readUInt16LE(e,0),s=readUInt16LE(e,4);return r!==0||s===0?!1:readUInt16LE(e,2)===TYPE_ICON},calculate(e){const r=readUInt16LE(e,4),s=getImageSize$2(e,0);if(r===1)return s;const u=[s];for(let m=1;m<r;m+=1)u.push(getImageSize$2(e,m));return{height:s.height,images:u,width:s.width}}},TYPE_CURSOR=2,CUR={validate(e){const r=readUInt16LE(e,0),s=readUInt16LE(e,4);return r!==0||s===0?!1:readUInt16LE(e,2)===TYPE_CURSOR},calculate:e=>ICO.calculate(e)},DDS={validate:e=>readUInt32LE(e,0)===542327876,calculate:e=>({height:readUInt32LE(e,12),width:readUInt32LE(e,16)})},gifRegexp=/^GIF8[79]a/,GIF={validate:e=>gifRegexp.test(toUTF8String(e,0,6)),calculate:e=>({height:readUInt16LE(e,8),width:readUInt16LE(e,6)})},brandMap={avif:"avif",mif1:"heif",msf1:"heif",heic:"heic",heix:"heic",hevc:"heic",hevx:"heic"},HEIF={validate(e){const r=toUTF8String(e,4,8),s=toUTF8String(e,8,12);return r==="ftyp"&&s in brandMap},calculate(e){const r=findBox(e,"meta",0),s=r&&findBox(e,"iprp",r.offset+12),u=s&&findBox(e,"ipco",s.offset+8),m=u&&findBox(e,"ispe",u.offset+8);if(m)return{height:readUInt32BE(e,m.offset+16),width:readUInt32BE(e,m.offset+12),type:toUTF8String(e,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(e,r){const s=r+ENTRY_LENGTH_OFFSET;return[toUTF8String(e,r,s),readUInt32BE(e,s)]}function getImageSize$1(e){const r=ICON_TYPE_SIZE[e];return{width:r,height:r,type:e}}const ICNS={validate:e=>toUTF8String(e,0,4)==="icns",calculate(e){const r=e.length,s=readUInt32BE(e,FILE_LENGTH_OFFSET);let u=SIZE_HEADER,m=readImageHeader(e,u),H=getImageSize$1(m[0]);if(u+=m[1],u===s)return H;const x={height:H.height,images:[H],width:H.width};for(;u<s&&u<r;)m=readImageHeader(e,u),H=getImageSize$1(m[0]),u+=m[1],x.images.push(H);return x}},J2C={validate:e=>toHexString(e,0,4)==="ff4fff51",calculate:e=>({height:readUInt32BE(e,12),width:readUInt32BE(e,8)})},JP2={validate(e){if(readUInt32BE(e,4)!==1783636e3||readUInt32BE(e,0)<1)return!1;const r=findBox(e,"ftyp",0);return r?readUInt32BE(e,r.offset+4)===1718909296:!1},calculate(e){const r=findBox(e,"jp2h",0),s=r&&findBox(e,"ihdr",r.offset+8);if(s)return{height:readUInt32BE(e,s.offset+8),width:readUInt32BE(e,s.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(e){return toHexString(e,2,6)===EXIF_MARKER}function extractSize(e,r){return{height:readUInt16BE(e,r),width:readUInt16BE(e,r+2)}}function extractOrientation(e,r){const u=EXIF_HEADER_BYTES+8,m=readUInt(e,16,u,r);for(let H=0;H<m;H++){const x=u+NUM_DIRECTORY_ENTRIES_BYTES+H*IDF_ENTRY_BYTES,o=x+IDF_ENTRY_BYTES;if(x>e.length)return;const F=e.slice(x,o);if(readUInt(F,16,0,r)===274)return readUInt(F,16,2,r)!==3||readUInt(F,32,4,r)!==1?void 0:readUInt(F,16,8,r)}}function validateExifBlock(e,r){const s=e.slice(APP1_DATA_SIZE_BYTES,r),u=toHexString(s,EXIF_HEADER_BYTES,EXIF_HEADER_BYTES+TIFF_BYTE_ALIGN_BYTES),m=u===BIG_ENDIAN_BYTE_ALIGN;if(m||u===LITTLE_ENDIAN_BYTE_ALIGN)return extractOrientation(s,m)}function validateInput(e,r){if(r>e.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(e[r]!==255)throw new TypeError("Invalid JPG, marker table corrupted")}const JPG={validate:e=>toHexString(e,0,2)==="ffd8",calculate(e){e=e.slice(4);let r,s;for(;e.length;){const u=readUInt16BE(e,0);if(isEXIF(e)&&(r=validateExifBlock(e,u)),validateInput(e,u),s=e[u+1],s===192||s===193||s===194){const m=extractSize(e,u+5);return r?{height:m.height,orientation:r,width:m.width}:m}e=e.slice(u+2)}throw new TypeError("Invalid JPG, no size found")}},KTX={validate:e=>{const r=toUTF8String(e,1,7);return["KTX 11","KTX 20"].includes(r)},calculate:e=>{const r=e[5]===49?"ktx":"ktx2",s=r==="ktx"?36:20;return{height:readUInt32LE(e,s+4),width:readUInt32LE(e,s),type:r}}},pngSignature=`PNG\r
|
|
466
466
|
|
|
467
|
-
`,pngImageHeaderChunkName="IHDR",pngFriedChunkName="CgBI",PNG={validate(e){if(pngSignature===toUTF8String(e,1,8)){let r=toUTF8String(e,12,16);if(r===pngFriedChunkName&&(r=toUTF8String(e,28,32)),r!==pngImageHeaderChunkName)throw new TypeError("Invalid PNG");return!0}return!1},calculate(e){return toUTF8String(e,12,16)===pngFriedChunkName?{height:readUInt32BE(e,36),width:readUInt32BE(e,32)}:{height:readUInt32BE(e,20),width:readUInt32BE(e,16)}}},PNMTypes={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},handlers={default:e=>{let r=[];for(;e.length>0;){const s=e.shift();if(s[0]!=="#"){r=s.split(" ");break}}if(r.length===2)return{height:parseInt(r[1],10),width:parseInt(r[0],10)};throw new TypeError("Invalid PNM")},pam:e=>{const r={};for(;e.length>0;){const s=e.shift();if(s.length>16||s.charCodeAt(0)>128)continue;const[u,m]=s.split(" ");if(u&&m&&(r[u.toLowerCase()]=parseInt(m,10)),r.height&&r.width)break}if(r.height&&r.width)return{height:r.height,width:r.width};throw new TypeError("Invalid PAM")}},PNM={validate:e=>toUTF8String(e,0,2)in PNMTypes,calculate(e){const r=toUTF8String(e,0,2),s=PNMTypes[r],u=toUTF8String(e,3).split(/[\r\n]+/);return(handlers[s]||handlers.default)(u)}},PSD={validate:e=>toUTF8String(e,0,4)==="8BPS",calculate:e=>({height:readUInt32BE(e,14),width:readUInt32BE(e,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(e){const r=unitsReg.exec(e);if(!!r)return Math.round(Number(r[1])*(units[r[2]]||1))}function parseViewbox(e){const r=e.split(" ");return{height:parseLength(r[3]),width:parseLength(r[2])}}function parseAttributes(e){const r=e.match(extractorRegExps.width),s=e.match(extractorRegExps.height),u=e.match(extractorRegExps.viewbox);return{height:s&&parseLength(s[2]),viewbox:u&&parseViewbox(u[2]),width:r&&parseLength(r[2])}}function calculateByDimensions(e){return{height:e.height,width:e.width}}function calculateByViewbox(e,r){const s=r.width/r.height;return e.width?{height:Math.floor(e.width/s),width:e.width}:e.height?{height:e.height,width:Math.floor(e.height*s)}:{height:r.height,width:r.width}}const SVG={validate:e=>svgReg.test(toUTF8String(e,0,1e3)),calculate(e){const r=toUTF8String(e).match(extractorRegExps.root);if(r){const s=parseAttributes(r[0]);if(s.width&&s.height)return calculateByDimensions(s);if(s.viewbox)return calculateByViewbox(s,s.viewbox)}throw new TypeError("Invalid SVG")}},TGA={validate(e){return readUInt16LE(e,0)===0&&readUInt16LE(e,4)===0},calculate(e){return{height:readUInt16LE(e,14),width:readUInt16LE(e,12)}}};function readIFD(e,r){const s=readUInt(e,32,4,r);return e.slice(s+2)}function readValue(e,r){const s=readUInt(e,16,8,r);return(readUInt(e,16,10,r)<<16)+s}function nextTag(e){if(e.length>24)return e.slice(12)}function extractTags(e,r){const s={};let u=e;for(;u&&u.length;){const m=readUInt(u,16,0,r),H=readUInt(u,16,2,r),x=readUInt(u,32,4,r);if(m===0)break;x===1&&(H===3||H===4)&&(s[m]=readValue(u,r)),u=nextTag(u)}return s}function determineEndianness(e){const r=toUTF8String(e,0,2);if(r==="II")return"LE";if(r==="MM")return"BE"}const signatures=["49492a00","4d4d002a"],TIFF={validate:e=>signatures.includes(toHexString(e,0,4)),calculate(e){const r=determineEndianness(e)==="BE",s=readIFD(e,r),u=extractTags(s,r),m=u[256],H=u[257];if(!m||!H)throw new TypeError("Invalid Tiff. Missing tags");return{height:H,width:m}}};function calculateExtended(e){return{height:1+readUInt24LE(e,7),width:1+readUInt24LE(e,4)}}function calculateLossless(e){return{height:1+((e[4]&15)<<10|e[3]<<2|(e[2]&192)>>6),width:1+((e[2]&63)<<8|e[1])}}function calculateLossy(e){return{height:readInt16LE(e,8)&16383,width:readInt16LE(e,6)&16383}}const WEBP={validate(e){const r=toUTF8String(e,0,4)==="RIFF",s=toUTF8String(e,8,12)==="WEBP",u=toUTF8String(e,12,15)==="VP8";return r&&s&&u},calculate(e){const r=toUTF8String(e,12,16);if(e=e.slice(20,30),r==="VP8X"){const u=e[0],m=(u&192)===0,H=(u&1)===0;if(m&&H)return calculateExtended(e);throw new TypeError("Invalid WebP")}if(r==="VP8 "&&e[0]!==47)return calculateLossy(e);const s=toHexString(e,3,6);if(r==="VP8L"&&s!=="9d012a")return calculateLossless(e);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(e){const r=e[0],s=firstBytes.get(r);return s&&typeHandlers.get(s).validate(e)?s:types.find(u=>typeHandlers.get(u).validate(e))}const globalOptions={disabledTypes:[]};function lookup(e){const r=detector(e);if(typeof r<"u"){if(globalOptions.disabledTypes.indexOf(r)>-1)throw new TypeError("disabled file type: "+r);const s=typeHandlers.get(r).calculate(e);if(s!==void 0)return s.type=s.type??r,s}throw new TypeError("unsupported file type: "+r)}var sparkMd5={exports:{}};(function(e,r){(function(s){e.exports=s()})(function(s){var u=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function m(st,Ke){var Ye=st[0],tt=st[1],Je=st[2],rr=st[3];Ye+=(tt&Je|~tt&rr)+Ke[0]-680876936|0,Ye=(Ye<<7|Ye>>>25)+tt|0,rr+=(Ye&tt|~Ye&Je)+Ke[1]-389564586|0,rr=(rr<<12|rr>>>20)+Ye|0,Je+=(rr&Ye|~rr&tt)+Ke[2]+606105819|0,Je=(Je<<17|Je>>>15)+rr|0,tt+=(Je&rr|~Je&Ye)+Ke[3]-1044525330|0,tt=(tt<<22|tt>>>10)+Je|0,Ye+=(tt&Je|~tt&rr)+Ke[4]-176418897|0,Ye=(Ye<<7|Ye>>>25)+tt|0,rr+=(Ye&tt|~Ye&Je)+Ke[5]+1200080426|0,rr=(rr<<12|rr>>>20)+Ye|0,Je+=(rr&Ye|~rr&tt)+Ke[6]-1473231341|0,Je=(Je<<17|Je>>>15)+rr|0,tt+=(Je&rr|~Je&Ye)+Ke[7]-45705983|0,tt=(tt<<22|tt>>>10)+Je|0,Ye+=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,Ye=(Ye<<4|Ye>>>28)+tt|0,rr+=(Ye^tt^Je)+Ke[12]-421815835|0,rr=(rr<<11|rr>>>21)+Ye|0,Je+=(rr^Ye^tt)+Ke[15]+530742520|0,Je=(Je<<16|Je>>>16)+rr|0,tt+=(Je^rr^Ye)+Ke[2]-995338651|0,tt=(tt<<23|tt>>>9)+Je|0,Ye+=(Je^(tt|~rr))+Ke[0]-198630844|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[7]+1126891415|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[14]-1416354905|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[5]-57434055|0,tt=(tt<<21|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[12]+1700485571|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[3]-1894986606|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[10]-1051523|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[1]-2054922799|0,tt=(tt<<21|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[8]+1873313359|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[15]-30611744|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[6]-1560198380|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[13]+1309151649|0,tt=(tt<<21|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[4]-145523070|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[11]-1120210379|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[2]+718787259|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[9]-343485551|0,tt=(tt<<21|tt>>>11)+Je|0,st[0]=Ye+st[0]|0,st[1]=tt+st[1]|0,st[2]=Je+st[2]|0,st[3]=rr+st[3]|0}function H(st){var Ke=[],Ye;for(Ye=0;Ye<64;Ye+=4)Ke[Ye>>2]=st.charCodeAt(Ye)+(st.charCodeAt(Ye+1)<<8)+(st.charCodeAt(Ye+2)<<16)+(st.charCodeAt(Ye+3)<<24);return Ke}function x(st){var Ke=[],Ye;for(Ye=0;Ye<64;Ye+=4)Ke[Ye>>2]=st[Ye]+(st[Ye+1]<<8)+(st[Ye+2]<<16)+(st[Ye+3]<<24);return Ke}function o(st){var Ke=st.length,Ye=[1732584193,-271733879,-1732584194,271733878],tt,Je,rr,Rr,ar,Ar;for(tt=64;tt<=Ke;tt+=64)m(Ye,H(st.substring(tt-64,tt)));for(st=st.substring(tt-64),Je=st.length,rr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],tt=0;tt<Je;tt+=1)rr[tt>>2]|=st.charCodeAt(tt)<<(tt%4<<3);if(rr[tt>>2]|=128<<(tt%4<<3),tt>55)for(m(Ye,rr),tt=0;tt<16;tt+=1)rr[tt]=0;return Rr=Ke*8,Rr=Rr.toString(16).match(/(.*?)(.{0,8})$/),ar=parseInt(Rr[2],16),Ar=parseInt(Rr[1],16)||0,rr[14]=ar,rr[15]=Ar,m(Ye,rr),Ye}function F(st){var Ke=st.length,Ye=[1732584193,-271733879,-1732584194,271733878],tt,Je,rr,Rr,ar,Ar;for(tt=64;tt<=Ke;tt+=64)m(Ye,x(st.subarray(tt-64,tt)));for(st=tt-64<Ke?st.subarray(tt-64):new Uint8Array(0),Je=st.length,rr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],tt=0;tt<Je;tt+=1)rr[tt>>2]|=st[tt]<<(tt%4<<3);if(rr[tt>>2]|=128<<(tt%4<<3),tt>55)for(m(Ye,rr),tt=0;tt<16;tt+=1)rr[tt]=0;return Rr=Ke*8,Rr=Rr.toString(16).match(/(.*?)(.{0,8})$/),ar=parseInt(Rr[2],16),Ar=parseInt(Rr[1],16)||0,rr[14]=ar,rr[15]=Ar,m(Ye,rr),Ye}function Re(st){var Ke="",Ye;for(Ye=0;Ye<4;Ye+=1)Ke+=u[st>>Ye*8+4&15]+u[st>>Ye*8&15];return Ke}function He(st){var Ke;for(Ke=0;Ke<st.length;Ke+=1)st[Ke]=Re(st[Ke]);return st.join("")}He(o("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function st(Ke,Ye){return Ke=Ke|0||0,Ke<0?Math.max(Ke+Ye,0):Math.min(Ke,Ye)}ArrayBuffer.prototype.slice=function(Ke,Ye){var tt=this.byteLength,Je=st(Ke,tt),rr=tt,Rr,ar,Ar,mr;return Ye!==s&&(rr=st(Ye,tt)),Je>rr?new ArrayBuffer(0):(Rr=rr-Je,ar=new ArrayBuffer(Rr),Ar=new Uint8Array(ar),mr=new Uint8Array(this,Je,Rr),Ar.set(mr),ar)}}();function Ue(st){return/[\u0080-\uFFFF]/.test(st)&&(st=unescape(encodeURIComponent(st))),st}function Fe(st,Ke){var Ye=st.length,tt=new ArrayBuffer(Ye),Je=new Uint8Array(tt),rr;for(rr=0;rr<Ye;rr+=1)Je[rr]=st.charCodeAt(rr);return Ke?Je:tt}function nt(st){return String.fromCharCode.apply(null,new Uint8Array(st))}function Ze(st,Ke,Ye){var tt=new Uint8Array(st.byteLength+Ke.byteLength);return tt.set(new Uint8Array(st)),tt.set(new Uint8Array(Ke),st.byteLength),Ye?tt:tt.buffer}function Ve(st){var Ke=[],Ye=st.length,tt;for(tt=0;tt<Ye-1;tt+=2)Ke.push(parseInt(st.substr(tt,2),16));return String.fromCharCode.apply(String,Ke)}function er(){this.reset()}return er.prototype.append=function(st){return this.appendBinary(Ue(st)),this},er.prototype.appendBinary=function(st){this._buff+=st,this._length+=st.length;var Ke=this._buff.length,Ye;for(Ye=64;Ye<=Ke;Ye+=64)m(this._hash,H(this._buff.substring(Ye-64,Ye)));return this._buff=this._buff.substring(Ye-64),this},er.prototype.end=function(st){var Ke=this._buff,Ye=Ke.length,tt,Je=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],rr;for(tt=0;tt<Ye;tt+=1)Je[tt>>2]|=Ke.charCodeAt(tt)<<(tt%4<<3);return this._finish(Je,Ye),rr=He(this._hash),st&&(rr=Ve(rr)),this.reset(),rr},er.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},er.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},er.prototype.setState=function(st){return this._buff=st.buff,this._length=st.length,this._hash=st.hash,this},er.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},er.prototype._finish=function(st,Ke){var Ye=Ke,tt,Je,rr;if(st[Ye>>2]|=128<<(Ye%4<<3),Ye>55)for(m(this._hash,st),Ye=0;Ye<16;Ye+=1)st[Ye]=0;tt=this._length*8,tt=tt.toString(16).match(/(.*?)(.{0,8})$/),Je=parseInt(tt[2],16),rr=parseInt(tt[1],16)||0,st[14]=Je,st[15]=rr,m(this._hash,st)},er.hash=function(st,Ke){return er.hashBinary(Ue(st),Ke)},er.hashBinary=function(st,Ke){var Ye=o(st),tt=He(Ye);return Ke?Ve(tt):tt},er.ArrayBuffer=function(){this.reset()},er.ArrayBuffer.prototype.append=function(st){var Ke=Ze(this._buff.buffer,st,!0),Ye=Ke.length,tt;for(this._length+=st.byteLength,tt=64;tt<=Ye;tt+=64)m(this._hash,x(Ke.subarray(tt-64,tt)));return this._buff=tt-64<Ye?new Uint8Array(Ke.buffer.slice(tt-64)):new Uint8Array(0),this},er.ArrayBuffer.prototype.end=function(st){var Ke=this._buff,Ye=Ke.length,tt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Je,rr;for(Je=0;Je<Ye;Je+=1)tt[Je>>2]|=Ke[Je]<<(Je%4<<3);return this._finish(tt,Ye),rr=He(this._hash),st&&(rr=Ve(rr)),this.reset(),rr},er.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},er.ArrayBuffer.prototype.getState=function(){var st=er.prototype.getState.call(this);return st.buff=nt(st.buff),st},er.ArrayBuffer.prototype.setState=function(st){return st.buff=Fe(st.buff,!0),er.prototype.setState.call(this,st)},er.ArrayBuffer.prototype.destroy=er.prototype.destroy,er.ArrayBuffer.prototype._finish=er.prototype._finish,er.ArrayBuffer.hash=function(st,Ke){var Ye=F(new Uint8Array(st)),tt=He(Ye);return Ke?Ve(tt):tt},er})})(sparkMd5);const SparkMD5=sparkMd5.exports,getPhotoMetadata=async e=>{let r=getFileExtent(e),s={};if(r==="jpg"||r==="jpeg")try{s=await _formatMetadata(e)}catch{s=await getImageSize(e)}else s=await getImageSize(e);return s.filesize=getFileSize(e),s};async function _formatMetadata(e,r=1){let s=await getFileBuffer(e,r),u=getMd5(s);return new Promise((m,H)=>{getData(s.buffer||s,function(x,o){if(o)return o.message==="Offset is outside the bounds of the DataView"&&r<3?m(_formatMetadata(e,r+1)):H(o);let{exif:F,xmp:Re}=getAllTags(x);F=JSON.parse(JSON.stringify(F).replaceAll("\\u0000",""))||{},F.PixelXDimension&&F.PixelYDimension&&F.PixelXDimension!=65535&&F.PixelYDimension!=65535?m({exif:F,xmp:Re,width:F.PixelXDimension,height:F.PixelYDimension,md5:u}):getImageSize(e).then(He=>{m({exif:F,xmp:Re,width:He.width,height:He.height,md5:u})})})})}async function getImageSize(e){try{let r=await getFileBuffer(e),s=lookup(r),u,m=getFileExtent(e);if(m==="tif"||m==="tiff"){let H;typeof e=="string"?H=e:typeof window<"u"&&e instanceof window.File?H=e.name:H=Buffer.concat([r.subarray(0,10240),r.subarray(r.length/2,10240),r.subarray(-10240)]),typeof H=="string"?typeof Buffer<"u"?u=getMd5(Buffer.from(H)):u=getMd5(new TextEncoder().encode(H)):u=getMd5(H)}else u=getMd5(Buffer.concat([r.subarray(0,10240),r.subarray(r.length/2,10240),r.subarray(-10240)]));return{width:s.width,height:s.height,md5:u}}catch{return{width:0,height:0}}}function getAllTags(e){return util.imageHasData(e)?{exif:e.exifdata||{},xmp:e.xmpdata||{}}:{exif:{},xmp:{}}}function getFileExtent(e){return typeof e=="string"?e.split(".").pop().toLowerCase():typeof window<"u"&&e instanceof window.File?e.name.split(".").pop().toLowerCase():"jpg"}async function getFileBuffer(e,r){if(typeof e=="string")if(r){let s=fs__default.default.openSync(e),u=Buffer.alloc(65536*r);return await new Promise(m=>{fs__default.default.read(s,u,0,u.length,0,()=>{m(),fs__default.default.closeSync(s)})}),u}else return fs__default.default.readFileSync(e);else{if(typeof window<"u"&&e instanceof window.File)return r&&(e=e.slice(0,65536*r)),await new Promise((s,u)=>{var m=new FileReader;m.readAsArrayBuffer(e),m.onload=H=>{s(H.target.result)},m.onerror=H=>{u(H)}});if(Buffer.isBuffer(e))return e}}function getFileSize(e){return typeof e=="string"?fs__default.default.statSync(e).size:e.size||e.length}function getMd5(e){let r=new SparkMD5.ArrayBuffer;return r.append(e),r.end()}async function parsePhoto(e){let r=await getPhotoMetadata(e);const{width:s,height:u,exif:m,xmp:H,filesize:x,md5:o}=r;let F={width:s,height:u,filesize:x,md5:o},Re=NaN,He=NaN,Ue=NaN,Fe=NaN,nt=NaN,Ze=NaN,Ve=[Re,He,Ue],er=flatObject(H),{GPSAltitude:st,GPSLatitude:Ke,GPSLatitudeRef:Ye,GPSLongitude:tt,GPSLongitudeRef:Je}=m||{};tt&&Ke&&(Ve=[getGeoCoordOperator(Je)*toRadian(tt),getGeoCoordOperator(Ye)*toRadian(Ke),+st]);for(let rr in er){let Rr=er[rr];if(rr==="drone-dji:GpsLongtitude"||rr==="drone-dji:GpsLongitude")Re=Number(Rr);else if(rr==="drone-dji:GpsLatitude")He=Number(Rr);else if(rr==="drone-dji:AbsoluteAltitude")Ue=Number(Rr);else if(rr==="drone-dji:GimbalYawDegree")Fe=Number(Rr);else if(rr==="drone-dji:GimbalPitchDegree")nt=Number(Rr);else if(rr==="drone-dji:GimbalRollDegree")Ze=Number(Rr);else if(rr==="drone-dji:DewarpFlag")F.dewarp_flag=Boolean(Number(Rr));else if(rr==="drone-dji:RtkFlag")F.rtk_flag=Number(Rr);else if(rr==="drone-dji:RelativeAltitude")F.relative_altitude=Number(Rr);else if(rr==="tiff:Model")F.camera_model=Rr;else if(rr==="tiff:Make")F.make=Rr;else if(rr==="drone-dji:DewarpData"){let Ar=Rr.split(";")[1].split(",").map(mr=>Number(mr));Ar[2]=s/2+Ar[2],Ar[3]=u/2+Ar[3],F.pre_calib_param=Ar}else rr==="drone-dji:CaptureUUID"?F.capture_uuid=Rr:rr==="drone-dji:DroneID"?F.drone_id=Rr:rr==="drone-dji:DroneSerialNumber"?F.drone_serial_number=Rr:rr==="drone-dji:CameraSerialNumber"&&(F.camera_serial_number=Rr)}if(!Number.isNaN(Fe)&&!Number.isNaN(nt)&&!Number.isNaN(Ze)&&(F.pitch_roll_yaw=[nt,Ze,Fe],F.orientation=getRotationMatrix(nt,Ze,Fe)),m?.DateTime?F.capture_time=hooks(m.DateTime,"YYYY:MM:DD HH:mm:ss").valueOf():m?.DateTimeOriginal&&(F.capture_time=hooks(m.DateTimeOriginal,"YYYY:MM:DD HH:mm:ss").valueOf()),m?.FocalLengthIn35mmFilm&&(F.focal_length_in_35mm=m.FocalLengthIn35mmFilm,!F.pre_calib_param)){let rr=new Array(10).fill(0),Rr=m.FocalLengthIn35mmFilm;rr[0]=rr[1]=Rr/35*Math.max(s,u),rr[2]=s/2,rr[3]=u/2,F.pre_calib_param=rr}if(hasNaN(Ve)&&(Ve=[Re,He,Ue]),!hasNaN(Ve))if(F.pos=Ve,F.absolute_altitude=Ve[2],F.coordinate_system={type:2,label:"WGS 84",type_name:"Geographic",epsg_code:4326},F.make==="DJI"&&F.rtk_flag){let rr=[];F.rtk_flag===50?rr=[.03,.03,.06]:F.rtk_flag===16?rr=[.5,.5,1]:rr=[2,2,5],F.pos_sigma=rr}else F.pos_sigma=[2,2,5];return F}function parsePhotos(e,r){let s=[],u=e,m=e.length,H=10,x=0;return new Promise(o=>{const F=()=>{for(let He=x;He<H;He++){let Ue=u.pop();if(!Ue)break;x++,parsePhoto(Ue).then(Fe=>{if(x--,!Fe.width||!Fe.height)throw new Error("broken photo");let nt=Ue.split(".").pop(),Ze={width:Fe.width,height:Fe.height,ext:nt,parameters:Fe.pre_calib_param||null},Ve=s.find(er=>er.width===Ze.width&&er.height===Ze.height&&er.ext===Ze.ext&&_$1.isEqual(er.parameters,Ze.parameters));Ve||(Ve=Ze,Ve.fileList=[],s.push(Ve)),Ve.fileList.push({name:Ue.split("\\").pop(),filesize:Fe.filesize,md5:Fe.md5,filePath:Ue,meta_data:Fe}),Re()}).catch(Fe=>{x--,Re(),console.error(Fe)})}},Re=()=>{u.length?F():x||o(s);let He=m-u.length-x;r&&r(He,m)};F()})}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var u in s)({}).hasOwnProperty.call(s,u)&&(e[u]=s[u])}return e},_extends.apply(null,arguments)}var DEFAULT_CONFIG={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function isNumber(e){return typeof e=="number"}function isBigNumber(e){return!e||typeof e!="object"||typeof e.constructor!="function"?!1:e.isBigNumber===!0&&typeof e.constructor.prototype=="object"&&e.constructor.prototype.isBigNumber===!0||typeof e.constructor.isDecimal=="function"&&e.constructor.isDecimal(e)===!0}function isComplex(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isComplex===!0||!1}function isFraction(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isFraction===!0||!1}function isUnit(e){return e&&e.constructor.prototype.isUnit===!0||!1}function isString(e){return typeof e=="string"}var isArray=Array.isArray;function isMatrix(e){return e&&e.constructor.prototype.isMatrix===!0||!1}function isCollection(e){return Array.isArray(e)||isMatrix(e)}function isDenseMatrix(e){return e&&e.isDenseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function isSparseMatrix(e){return e&&e.isSparseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function isRange(e){return e&&e.constructor.prototype.isRange===!0||!1}function isIndex(e){return e&&e.constructor.prototype.isIndex===!0||!1}function isBoolean(e){return typeof e=="boolean"}function isResultSet(e){return e&&e.constructor.prototype.isResultSet===!0||!1}function isHelp(e){return e&&e.constructor.prototype.isHelp===!0||!1}function isFunction(e){return typeof e=="function"}function isDate(e){return e instanceof Date}function isRegExp(e){return e instanceof RegExp}function isObject(e){return!!(e&&typeof e=="object"&&e.constructor===Object&&!isComplex(e)&&!isFraction(e))}function isNull(e){return e===null}function isUndefined(e){return e===void 0}function isAccessorNode(e){return e&&e.isAccessorNode===!0&&e.constructor.prototype.isNode===!0||!1}function isArrayNode(e){return e&&e.isArrayNode===!0&&e.constructor.prototype.isNode===!0||!1}function isAssignmentNode(e){return e&&e.isAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function isBlockNode(e){return e&&e.isBlockNode===!0&&e.constructor.prototype.isNode===!0||!1}function isConditionalNode(e){return e&&e.isConditionalNode===!0&&e.constructor.prototype.isNode===!0||!1}function isConstantNode(e){return e&&e.isConstantNode===!0&&e.constructor.prototype.isNode===!0||!1}function isFunctionAssignmentNode(e){return e&&e.isFunctionAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function isFunctionNode(e){return e&&e.isFunctionNode===!0&&e.constructor.prototype.isNode===!0||!1}function isIndexNode(e){return e&&e.isIndexNode===!0&&e.constructor.prototype.isNode===!0||!1}function isNode(e){return e&&e.isNode===!0&&e.constructor.prototype.isNode===!0||!1}function isObjectNode(e){return e&&e.isObjectNode===!0&&e.constructor.prototype.isNode===!0||!1}function isOperatorNode(e){return e&&e.isOperatorNode===!0&&e.constructor.prototype.isNode===!0||!1}function isParenthesisNode(e){return e&&e.isParenthesisNode===!0&&e.constructor.prototype.isNode===!0||!1}function isRangeNode(e){return e&&e.isRangeNode===!0&&e.constructor.prototype.isNode===!0||!1}function isRelationalNode(e){return e&&e.isRelationalNode===!0&&e.constructor.prototype.isNode===!0||!1}function isSymbolNode(e){return e&&e.isSymbolNode===!0&&e.constructor.prototype.isNode===!0||!1}function isChain(e){return e&&e.constructor.prototype.isChain===!0||!1}function typeOf(e){var r=typeof e;return r==="object"?e===null?"null":isBigNumber(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}function clone$2(e){var r=typeof e;if(r==="number"||r==="string"||r==="boolean"||e===null||e===void 0)return e;if(typeof e.clone=="function")return e.clone();if(Array.isArray(e))return e.map(function(s){return clone$2(s)});if(e instanceof Date)return new Date(e.valueOf());if(isBigNumber(e))return e;if(isObject(e))return mapObject(e,clone$2);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function mapObject(e,r){var s={};for(var u in e)hasOwnProperty(e,u)&&(s[u]=r(e[u]));return s}function extend(e,r){for(var s in r)hasOwnProperty(r,s)&&(e[s]=r[s]);return e}function deepStrictEqual(e,r){var s,u,m;if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(u=0,m=e.length;u<m;u++)if(!deepStrictEqual(e[u],r[u]))return!1;return!0}else{if(typeof e=="function")return e===r;if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(s in e)if(!(s in r)||!deepStrictEqual(e[s],r[s]))return!1;for(s in r)if(!(s in e))return!1;return!0}else return e===r}}function hasOwnProperty(e,r){return e&&Object.hasOwnProperty.call(e,r)}function pickShallow(e,r){for(var s={},u=0;u<r.length;u++){var m=r[u],H=e[m];H!==void 0&&(s[m]=H)}return s}var MATRIX_OPTIONS=["Matrix","Array"],NUMBER_OPTIONS=["number","BigNumber","Fraction"],config$1=function e(r){if(r)throw new Error(`The global config is readonly.
|
|
467
|
+
`,pngImageHeaderChunkName="IHDR",pngFriedChunkName="CgBI",PNG={validate(e){if(pngSignature===toUTF8String(e,1,8)){let r=toUTF8String(e,12,16);if(r===pngFriedChunkName&&(r=toUTF8String(e,28,32)),r!==pngImageHeaderChunkName)throw new TypeError("Invalid PNG");return!0}return!1},calculate(e){return toUTF8String(e,12,16)===pngFriedChunkName?{height:readUInt32BE(e,36),width:readUInt32BE(e,32)}:{height:readUInt32BE(e,20),width:readUInt32BE(e,16)}}},PNMTypes={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},handlers={default:e=>{let r=[];for(;e.length>0;){const s=e.shift();if(s[0]!=="#"){r=s.split(" ");break}}if(r.length===2)return{height:parseInt(r[1],10),width:parseInt(r[0],10)};throw new TypeError("Invalid PNM")},pam:e=>{const r={};for(;e.length>0;){const s=e.shift();if(s.length>16||s.charCodeAt(0)>128)continue;const[u,m]=s.split(" ");if(u&&m&&(r[u.toLowerCase()]=parseInt(m,10)),r.height&&r.width)break}if(r.height&&r.width)return{height:r.height,width:r.width};throw new TypeError("Invalid PAM")}},PNM={validate:e=>toUTF8String(e,0,2)in PNMTypes,calculate(e){const r=toUTF8String(e,0,2),s=PNMTypes[r],u=toUTF8String(e,3).split(/[\r\n]+/);return(handlers[s]||handlers.default)(u)}},PSD={validate:e=>toUTF8String(e,0,4)==="8BPS",calculate:e=>({height:readUInt32BE(e,14),width:readUInt32BE(e,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(e){const r=unitsReg.exec(e);if(!!r)return Math.round(Number(r[1])*(units[r[2]]||1))}function parseViewbox(e){const r=e.split(" ");return{height:parseLength(r[3]),width:parseLength(r[2])}}function parseAttributes(e){const r=e.match(extractorRegExps.width),s=e.match(extractorRegExps.height),u=e.match(extractorRegExps.viewbox);return{height:s&&parseLength(s[2]),viewbox:u&&parseViewbox(u[2]),width:r&&parseLength(r[2])}}function calculateByDimensions(e){return{height:e.height,width:e.width}}function calculateByViewbox(e,r){const s=r.width/r.height;return e.width?{height:Math.floor(e.width/s),width:e.width}:e.height?{height:e.height,width:Math.floor(e.height*s)}:{height:r.height,width:r.width}}const SVG={validate:e=>svgReg.test(toUTF8String(e,0,1e3)),calculate(e){const r=toUTF8String(e).match(extractorRegExps.root);if(r){const s=parseAttributes(r[0]);if(s.width&&s.height)return calculateByDimensions(s);if(s.viewbox)return calculateByViewbox(s,s.viewbox)}throw new TypeError("Invalid SVG")}},TGA={validate(e){return readUInt16LE(e,0)===0&&readUInt16LE(e,4)===0},calculate(e){return{height:readUInt16LE(e,14),width:readUInt16LE(e,12)}}};function readIFD(e,r){const s=readUInt(e,32,4,r);return e.slice(s+2)}function readValue(e,r){const s=readUInt(e,16,8,r);return(readUInt(e,16,10,r)<<16)+s}function nextTag(e){if(e.length>24)return e.slice(12)}function extractTags(e,r){const s={};let u=e;for(;u&&u.length;){const m=readUInt(u,16,0,r),H=readUInt(u,16,2,r),x=readUInt(u,32,4,r);if(m===0)break;x===1&&(H===3||H===4)&&(s[m]=readValue(u,r)),u=nextTag(u)}return s}function determineEndianness(e){const r=toUTF8String(e,0,2);if(r==="II")return"LE";if(r==="MM")return"BE"}const signatures=["49492a00","4d4d002a"],TIFF={validate:e=>signatures.includes(toHexString(e,0,4)),calculate(e){const r=determineEndianness(e)==="BE",s=readIFD(e,r),u=extractTags(s,r),m=u[256],H=u[257];if(!m||!H)throw new TypeError("Invalid Tiff. Missing tags");return{height:H,width:m}}};function calculateExtended(e){return{height:1+readUInt24LE(e,7),width:1+readUInt24LE(e,4)}}function calculateLossless(e){return{height:1+((e[4]&15)<<10|e[3]<<2|(e[2]&192)>>6),width:1+((e[2]&63)<<8|e[1])}}function calculateLossy(e){return{height:readInt16LE(e,8)&16383,width:readInt16LE(e,6)&16383}}const WEBP={validate(e){const r=toUTF8String(e,0,4)==="RIFF",s=toUTF8String(e,8,12)==="WEBP",u=toUTF8String(e,12,15)==="VP8";return r&&s&&u},calculate(e){const r=toUTF8String(e,12,16);if(e=e.slice(20,30),r==="VP8X"){const u=e[0],m=(u&192)===0,H=(u&1)===0;if(m&&H)return calculateExtended(e);throw new TypeError("Invalid WebP")}if(r==="VP8 "&&e[0]!==47)return calculateLossy(e);const s=toHexString(e,3,6);if(r==="VP8L"&&s!=="9d012a")return calculateLossless(e);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(e){const r=e[0],s=firstBytes.get(r);return s&&typeHandlers.get(s).validate(e)?s:types.find(u=>typeHandlers.get(u).validate(e))}const globalOptions={disabledTypes:[]};function lookup(e){const r=detector(e);if(typeof r<"u"){if(globalOptions.disabledTypes.indexOf(r)>-1)throw new TypeError("disabled file type: "+r);const s=typeHandlers.get(r).calculate(e);if(s!==void 0)return s.type=s.type??r,s}throw new TypeError("unsupported file type: "+r)}var sparkMd5={exports:{}};(function(e,r){(function(s){e.exports=s()})(function(s){var u=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function m(st,Ke){var Ye=st[0],tt=st[1],Je=st[2],rr=st[3];Ye+=(tt&Je|~tt&rr)+Ke[0]-680876936|0,Ye=(Ye<<7|Ye>>>25)+tt|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|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[8]+1873313359|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[15]-30611744|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[6]-1560198380|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[13]+1309151649|0,tt=(tt<<21|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[4]-145523070|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[11]-1120210379|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[2]+718787259|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[9]-343485551|0,tt=(tt<<21|tt>>>11)+Je|0,st[0]=Ye+st[0]|0,st[1]=tt+st[1]|0,st[2]=Je+st[2]|0,st[3]=rr+st[3]|0}function H(st){var Ke=[],Ye;for(Ye=0;Ye<64;Ye+=4)Ke[Ye>>2]=st.charCodeAt(Ye)+(st.charCodeAt(Ye+1)<<8)+(st.charCodeAt(Ye+2)<<16)+(st.charCodeAt(Ye+3)<<24);return Ke}function x(st){var Ke=[],Ye;for(Ye=0;Ye<64;Ye+=4)Ke[Ye>>2]=st[Ye]+(st[Ye+1]<<8)+(st[Ye+2]<<16)+(st[Ye+3]<<24);return Ke}function o(st){var Ke=st.length,Ye=[1732584193,-271733879,-1732584194,271733878],tt,Je,rr,Rr,ar,Ar;for(tt=64;tt<=Ke;tt+=64)m(Ye,H(st.substring(tt-64,tt)));for(st=st.substring(tt-64),Je=st.length,rr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],tt=0;tt<Je;tt+=1)rr[tt>>2]|=st.charCodeAt(tt)<<(tt%4<<3);if(rr[tt>>2]|=128<<(tt%4<<3),tt>55)for(m(Ye,rr),tt=0;tt<16;tt+=1)rr[tt]=0;return Rr=Ke*8,Rr=Rr.toString(16).match(/(.*?)(.{0,8})$/),ar=parseInt(Rr[2],16),Ar=parseInt(Rr[1],16)||0,rr[14]=ar,rr[15]=Ar,m(Ye,rr),Ye}function F(st){var Ke=st.length,Ye=[1732584193,-271733879,-1732584194,271733878],tt,Je,rr,Rr,ar,Ar;for(tt=64;tt<=Ke;tt+=64)m(Ye,x(st.subarray(tt-64,tt)));for(st=tt-64<Ke?st.subarray(tt-64):new Uint8Array(0),Je=st.length,rr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],tt=0;tt<Je;tt+=1)rr[tt>>2]|=st[tt]<<(tt%4<<3);if(rr[tt>>2]|=128<<(tt%4<<3),tt>55)for(m(Ye,rr),tt=0;tt<16;tt+=1)rr[tt]=0;return Rr=Ke*8,Rr=Rr.toString(16).match(/(.*?)(.{0,8})$/),ar=parseInt(Rr[2],16),Ar=parseInt(Rr[1],16)||0,rr[14]=ar,rr[15]=Ar,m(Ye,rr),Ye}function Re(st){var Ke="",Ye;for(Ye=0;Ye<4;Ye+=1)Ke+=u[st>>Ye*8+4&15]+u[st>>Ye*8&15];return Ke}function He(st){var Ke;for(Ke=0;Ke<st.length;Ke+=1)st[Ke]=Re(st[Ke]);return st.join("")}He(o("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function st(Ke,Ye){return Ke=Ke|0||0,Ke<0?Math.max(Ke+Ye,0):Math.min(Ke,Ye)}ArrayBuffer.prototype.slice=function(Ke,Ye){var tt=this.byteLength,Je=st(Ke,tt),rr=tt,Rr,ar,Ar,mr;return Ye!==s&&(rr=st(Ye,tt)),Je>rr?new ArrayBuffer(0):(Rr=rr-Je,ar=new ArrayBuffer(Rr),Ar=new Uint8Array(ar),mr=new Uint8Array(this,Je,Rr),Ar.set(mr),ar)}}();function Ue(st){return/[\u0080-\uFFFF]/.test(st)&&(st=unescape(encodeURIComponent(st))),st}function Fe(st,Ke){var Ye=st.length,tt=new ArrayBuffer(Ye),Je=new Uint8Array(tt),rr;for(rr=0;rr<Ye;rr+=1)Je[rr]=st.charCodeAt(rr);return Ke?Je:tt}function nt(st){return String.fromCharCode.apply(null,new Uint8Array(st))}function Ze(st,Ke,Ye){var tt=new Uint8Array(st.byteLength+Ke.byteLength);return tt.set(new Uint8Array(st)),tt.set(new Uint8Array(Ke),st.byteLength),Ye?tt:tt.buffer}function Ve(st){var Ke=[],Ye=st.length,tt;for(tt=0;tt<Ye-1;tt+=2)Ke.push(parseInt(st.substr(tt,2),16));return String.fromCharCode.apply(String,Ke)}function er(){this.reset()}return er.prototype.append=function(st){return this.appendBinary(Ue(st)),this},er.prototype.appendBinary=function(st){this._buff+=st,this._length+=st.length;var Ke=this._buff.length,Ye;for(Ye=64;Ye<=Ke;Ye+=64)m(this._hash,H(this._buff.substring(Ye-64,Ye)));return this._buff=this._buff.substring(Ye-64),this},er.prototype.end=function(st){var Ke=this._buff,Ye=Ke.length,tt,Je=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],rr;for(tt=0;tt<Ye;tt+=1)Je[tt>>2]|=Ke.charCodeAt(tt)<<(tt%4<<3);return this._finish(Je,Ye),rr=He(this._hash),st&&(rr=Ve(rr)),this.reset(),rr},er.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},er.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},er.prototype.setState=function(st){return this._buff=st.buff,this._length=st.length,this._hash=st.hash,this},er.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},er.prototype._finish=function(st,Ke){var Ye=Ke,tt,Je,rr;if(st[Ye>>2]|=128<<(Ye%4<<3),Ye>55)for(m(this._hash,st),Ye=0;Ye<16;Ye+=1)st[Ye]=0;tt=this._length*8,tt=tt.toString(16).match(/(.*?)(.{0,8})$/),Je=parseInt(tt[2],16),rr=parseInt(tt[1],16)||0,st[14]=Je,st[15]=rr,m(this._hash,st)},er.hash=function(st,Ke){return er.hashBinary(Ue(st),Ke)},er.hashBinary=function(st,Ke){var Ye=o(st),tt=He(Ye);return Ke?Ve(tt):tt},er.ArrayBuffer=function(){this.reset()},er.ArrayBuffer.prototype.append=function(st){var Ke=Ze(this._buff.buffer,st,!0),Ye=Ke.length,tt;for(this._length+=st.byteLength,tt=64;tt<=Ye;tt+=64)m(this._hash,x(Ke.subarray(tt-64,tt)));return this._buff=tt-64<Ye?new Uint8Array(Ke.buffer.slice(tt-64)):new Uint8Array(0),this},er.ArrayBuffer.prototype.end=function(st){var Ke=this._buff,Ye=Ke.length,tt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Je,rr;for(Je=0;Je<Ye;Je+=1)tt[Je>>2]|=Ke[Je]<<(Je%4<<3);return this._finish(tt,Ye),rr=He(this._hash),st&&(rr=Ve(rr)),this.reset(),rr},er.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},er.ArrayBuffer.prototype.getState=function(){var st=er.prototype.getState.call(this);return st.buff=nt(st.buff),st},er.ArrayBuffer.prototype.setState=function(st){return st.buff=Fe(st.buff,!0),er.prototype.setState.call(this,st)},er.ArrayBuffer.prototype.destroy=er.prototype.destroy,er.ArrayBuffer.prototype._finish=er.prototype._finish,er.ArrayBuffer.hash=function(st,Ke){var Ye=F(new Uint8Array(st)),tt=He(Ye);return Ke?Ve(tt):tt},er})})(sparkMd5);const SparkMD5=sparkMd5.exports,getPhotoMetadata=async e=>{let r=getFileExtent(e),s={};if(r==="jpg"||r==="jpeg")try{s=await _formatMetadata(e)}catch{s=await getImageSize(e)}else s=await getImageSize(e);return s.filesize=getFileSize(e),s};async function _formatMetadata(e,r=1){let s=await getFileBuffer(e,r),u=getMd5(s);return new Promise((m,H)=>{getData(s.buffer||s,function(x,o){if(o)return o.message==="Offset is outside the bounds of the DataView"&&r<3?m(_formatMetadata(e,r+1)):H(o);let{exif:F,xmp:Re}=getAllTags(x);F=JSON.parse(JSON.stringify(F).replaceAll("\\u0000",""))||{},F.PixelXDimension&&F.PixelYDimension&&F.PixelXDimension!=65535&&F.PixelYDimension!=65535?m({exif:F,xmp:Re,width:F.PixelXDimension,height:F.PixelYDimension,md5:u}):getImageSize(e).then(He=>{m({exif:F,xmp:Re,width:He.width,height:He.height,md5:u})})})})}async function getImageSize(e){try{let r=await getFileBuffer(e),s=lookup(r),u,m=getFileExtent(e);if(m==="tif"||m==="tiff"){let H;typeof e=="string"?H=e:typeof window<"u"&&e instanceof window.File?H=e.name:H=Buffer.concat([r.subarray(0,10240),r.subarray(r.length/2,10240),r.subarray(-10240)]),typeof H=="string"?typeof Buffer<"u"?u=getMd5(Buffer.from(H)):u=getMd5(new TextEncoder().encode(H)):u=getMd5(H)}else u=getMd5(Buffer.concat([r.subarray(0,10240),r.subarray(r.length/2,10240),r.subarray(-10240)]));return{width:s.width,height:s.height,md5:u}}catch{return{width:0,height:0}}}function getAllTags(e){return util.imageHasData(e)?{exif:e.exifdata||{},xmp:e.xmpdata||{}}:{exif:{},xmp:{}}}function getFileExtent(e){return typeof e=="string"?e.split(".").pop().toLowerCase():typeof window<"u"&&e instanceof window.File?e.name.split(".").pop().toLowerCase():"jpg"}async function getFileBuffer(e,r){if(typeof e=="string")if(r){let s=fs__default.default.openSync(e),u=Buffer.alloc(65536*r);return await new Promise(m=>{fs__default.default.read(s,u,0,u.length,0,()=>{m(),fs__default.default.closeSync(s)})}),u}else return fs__default.default.readFileSync(e);else{if(typeof window<"u"&&e instanceof window.File)return r&&(e=e.slice(0,65536*r)),await new Promise((s,u)=>{var m=new FileReader;m.readAsArrayBuffer(e),m.onload=H=>{s(H.target.result)},m.onerror=H=>{u(H)}});if(Buffer.isBuffer(e))return e}}function getFileSize(e){return typeof e=="string"?fs__default.default.statSync(e).size:e.size||e.length}function getMd5(e){let r=new SparkMD5.ArrayBuffer;return r.append(e),r.end()}async function parsePhoto(e){let r=await getPhotoMetadata(e);const{width:s,height:u,exif:m,xmp:H,filesize:x,md5:o}=r;let F={width:s,height:u,filesize:x,md5:o},Re=NaN,He=NaN,Ue=NaN,Fe=NaN,nt=NaN,Ze=NaN,Ve=[Re,He,Ue],er=flatObject(H),{GPSAltitude:st,GPSLatitude:Ke,GPSLatitudeRef:Ye,GPSLongitude:tt,GPSLongitudeRef:Je}=m||{};tt&&Ke&&(Ve=[getGeoCoordOperator(Je)*toRadian(tt),getGeoCoordOperator(Ye)*toRadian(Ke),+st]);for(let rr in er){let Rr=er[rr];if(rr==="drone-dji:GpsLongtitude"||rr==="drone-dji:GpsLongitude")Re=Number(Rr);else if(rr==="drone-dji:GpsLatitude")He=Number(Rr);else if(rr==="drone-dji:AbsoluteAltitude")Ue=Number(Rr);else if(rr==="drone-dji:GimbalYawDegree")Fe=Number(Rr);else if(rr==="drone-dji:GimbalPitchDegree")nt=Number(Rr);else if(rr==="drone-dji:GimbalRollDegree")Ze=Number(Rr);else if(rr==="drone-dji:DewarpFlag")F.dewarp_flag=Boolean(Number(Rr));else if(rr==="drone-dji:RtkFlag")F.rtk_flag=Number(Rr);else if(rr==="drone-dji:RelativeAltitude")F.relative_altitude=Number(Rr);else if(rr==="tiff:Model")F.camera_model=Rr;else if(rr==="tiff:Make")F.make=Rr;else if(rr==="drone-dji:DewarpData"){let Ar=Rr.split(";")[1].split(",").map(mr=>Number(mr));Ar[2]=s/2+Ar[2],Ar[3]=u/2+Ar[3],F.pre_calib_param=Ar}else rr==="drone-dji:CaptureUUID"?F.capture_uuid=Rr:rr==="drone-dji:DroneID"?F.drone_id=Rr:rr==="drone-dji:DroneSerialNumber"?F.drone_serial_number=Rr:rr==="drone-dji:CameraSerialNumber"&&(F.camera_serial_number=Rr)}if(!Number.isNaN(Fe)&&!Number.isNaN(nt)&&!Number.isNaN(Ze)&&(F.pitch_roll_yaw=[nt,Ze,Fe],F.orientation=getRotationMatrix(nt,Ze,Fe)),m?.DateTime?F.capture_time=hooks(m.DateTime,"YYYY:MM:DD HH:mm:ss").valueOf():m?.DateTimeOriginal&&(F.capture_time=hooks(m.DateTimeOriginal,"YYYY:MM:DD HH:mm:ss").valueOf()),m?.FocalLengthIn35mmFilm&&(F.focal_length_in_35mm=m.FocalLengthIn35mmFilm,!F.pre_calib_param)){let rr=new Array(10).fill(0),Rr=m.FocalLengthIn35mmFilm;rr[0]=rr[1]=Rr/35*Math.max(s,u),rr[2]=s/2,rr[3]=u/2,F.pre_calib_param=rr}if(hasNaN(Ve)&&(Ve=[Re,He,Ue]),!hasNaN(Ve))if(F.pos=Ve,F.absolute_altitude=Ve[2],F.coordinate_system={type:2,label:"WGS 84",type_name:"Geographic",epsg_code:4326},F.make==="DJI"&&F.rtk_flag){let rr=[];F.rtk_flag===50?rr=[.03,.03,.06]:F.rtk_flag===16?rr=[.5,.5,1]:rr=[2,2,5],F.pos_sigma=rr}else F.pos_sigma=[2,2,5];return F}function parsePhotos(e,r){let s=[],u=e,m=e.length,H=10,x=0;return new Promise(o=>{const F=[],Re=()=>{for(let Ue=x;Ue<H;Ue++){let Fe=u.pop();if(!Fe)break;x++,parsePhoto(Fe).then(nt=>{if(!nt.width||!nt.height)throw new Error("broken photo");let Ze=Fe.split(".").pop(),Ve={width:nt.width,height:nt.height,ext:Ze,parameters:nt.pre_calib_param||null},er=s.find(st=>st.width===Ve.width&&st.height===Ve.height&&st.ext===Ve.ext&&_$1.isEqual(st.parameters,Ve.parameters));er||(er=Ve,er.fileList=[],s.push(er)),er.fileList.push({name:Fe.split("\\").pop(),filesize:nt.filesize,md5:nt.md5,filePath:Fe,meta_data:nt})}).catch(nt=>{F.push({file:Fe,error:nt?.message||String(nt)})}).finally(()=>{x--,He()})}},He=()=>{u.length?Re():x||o({cameras:s,failed:F});let Ue=m-u.length-x;r&&r(Ue,m,F)};Re()})}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var u in s)({}).hasOwnProperty.call(s,u)&&(e[u]=s[u])}return e},_extends.apply(null,arguments)}var DEFAULT_CONFIG={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function isNumber(e){return typeof e=="number"}function isBigNumber(e){return!e||typeof e!="object"||typeof e.constructor!="function"?!1:e.isBigNumber===!0&&typeof e.constructor.prototype=="object"&&e.constructor.prototype.isBigNumber===!0||typeof e.constructor.isDecimal=="function"&&e.constructor.isDecimal(e)===!0}function isComplex(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isComplex===!0||!1}function isFraction(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isFraction===!0||!1}function isUnit(e){return e&&e.constructor.prototype.isUnit===!0||!1}function isString(e){return typeof e=="string"}var isArray=Array.isArray;function isMatrix(e){return e&&e.constructor.prototype.isMatrix===!0||!1}function isCollection(e){return Array.isArray(e)||isMatrix(e)}function isDenseMatrix(e){return e&&e.isDenseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function isSparseMatrix(e){return e&&e.isSparseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function isRange(e){return e&&e.constructor.prototype.isRange===!0||!1}function isIndex(e){return e&&e.constructor.prototype.isIndex===!0||!1}function isBoolean(e){return typeof e=="boolean"}function isResultSet(e){return e&&e.constructor.prototype.isResultSet===!0||!1}function isHelp(e){return e&&e.constructor.prototype.isHelp===!0||!1}function isFunction(e){return typeof e=="function"}function isDate(e){return e instanceof Date}function isRegExp(e){return e instanceof RegExp}function isObject(e){return!!(e&&typeof e=="object"&&e.constructor===Object&&!isComplex(e)&&!isFraction(e))}function isNull(e){return e===null}function isUndefined(e){return e===void 0}function isAccessorNode(e){return e&&e.isAccessorNode===!0&&e.constructor.prototype.isNode===!0||!1}function isArrayNode(e){return e&&e.isArrayNode===!0&&e.constructor.prototype.isNode===!0||!1}function isAssignmentNode(e){return e&&e.isAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function isBlockNode(e){return e&&e.isBlockNode===!0&&e.constructor.prototype.isNode===!0||!1}function isConditionalNode(e){return e&&e.isConditionalNode===!0&&e.constructor.prototype.isNode===!0||!1}function isConstantNode(e){return e&&e.isConstantNode===!0&&e.constructor.prototype.isNode===!0||!1}function isFunctionAssignmentNode(e){return e&&e.isFunctionAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function isFunctionNode(e){return e&&e.isFunctionNode===!0&&e.constructor.prototype.isNode===!0||!1}function isIndexNode(e){return e&&e.isIndexNode===!0&&e.constructor.prototype.isNode===!0||!1}function isNode(e){return e&&e.isNode===!0&&e.constructor.prototype.isNode===!0||!1}function isObjectNode(e){return e&&e.isObjectNode===!0&&e.constructor.prototype.isNode===!0||!1}function isOperatorNode(e){return e&&e.isOperatorNode===!0&&e.constructor.prototype.isNode===!0||!1}function isParenthesisNode(e){return e&&e.isParenthesisNode===!0&&e.constructor.prototype.isNode===!0||!1}function isRangeNode(e){return e&&e.isRangeNode===!0&&e.constructor.prototype.isNode===!0||!1}function isRelationalNode(e){return e&&e.isRelationalNode===!0&&e.constructor.prototype.isNode===!0||!1}function isSymbolNode(e){return e&&e.isSymbolNode===!0&&e.constructor.prototype.isNode===!0||!1}function isChain(e){return e&&e.constructor.prototype.isChain===!0||!1}function typeOf(e){var r=typeof e;return r==="object"?e===null?"null":isBigNumber(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}function clone$2(e){var r=typeof e;if(r==="number"||r==="string"||r==="boolean"||e===null||e===void 0)return e;if(typeof e.clone=="function")return e.clone();if(Array.isArray(e))return e.map(function(s){return clone$2(s)});if(e instanceof Date)return new Date(e.valueOf());if(isBigNumber(e))return e;if(isObject(e))return mapObject(e,clone$2);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function mapObject(e,r){var s={};for(var u in e)hasOwnProperty(e,u)&&(s[u]=r(e[u]));return s}function extend(e,r){for(var s in r)hasOwnProperty(r,s)&&(e[s]=r[s]);return e}function deepStrictEqual(e,r){var s,u,m;if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(u=0,m=e.length;u<m;u++)if(!deepStrictEqual(e[u],r[u]))return!1;return!0}else{if(typeof e=="function")return e===r;if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(s in e)if(!(s in r)||!deepStrictEqual(e[s],r[s]))return!1;for(s in r)if(!(s in e))return!1;return!0}else return e===r}}function hasOwnProperty(e,r){return e&&Object.hasOwnProperty.call(e,r)}function pickShallow(e,r){for(var s={},u=0;u<r.length;u++){var m=r[u],H=e[m];H!==void 0&&(s[m]=H)}return s}var MATRIX_OPTIONS=["Matrix","Array"],NUMBER_OPTIONS=["number","BigNumber","Fraction"],config$1=function e(r){if(r)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
|
|
|
@@ -75687,37 +75687,39 @@ async function parsePhoto(e) {
|
|
|
75687
75687
|
function parsePhotos(e, r) {
|
|
75688
75688
|
let s = [], u = e, m = e.length, H = 10, x = 0;
|
|
75689
75689
|
return new Promise((o) => {
|
|
75690
|
-
const F = () => {
|
|
75691
|
-
for (let
|
|
75692
|
-
let
|
|
75693
|
-
if (!
|
|
75690
|
+
const F = [], Re = () => {
|
|
75691
|
+
for (let Ue = x; Ue < H; Ue++) {
|
|
75692
|
+
let Fe = u.pop();
|
|
75693
|
+
if (!Fe)
|
|
75694
75694
|
break;
|
|
75695
|
-
x++, parsePhoto(
|
|
75696
|
-
if (
|
|
75695
|
+
x++, parsePhoto(Fe).then((nt) => {
|
|
75696
|
+
if (!nt.width || !nt.height)
|
|
75697
75697
|
throw new Error("broken photo");
|
|
75698
|
-
let
|
|
75699
|
-
width:
|
|
75700
|
-
height:
|
|
75701
|
-
ext:
|
|
75702
|
-
parameters:
|
|
75703
|
-
},
|
|
75704
|
-
|
|
75705
|
-
name:
|
|
75706
|
-
filesize:
|
|
75707
|
-
md5:
|
|
75708
|
-
filePath:
|
|
75709
|
-
meta_data:
|
|
75710
|
-
})
|
|
75711
|
-
}).catch((
|
|
75712
|
-
|
|
75698
|
+
let Ze = Fe.split(".").pop(), Ve = {
|
|
75699
|
+
width: nt.width,
|
|
75700
|
+
height: nt.height,
|
|
75701
|
+
ext: Ze,
|
|
75702
|
+
parameters: nt.pre_calib_param || null
|
|
75703
|
+
}, er = s.find((st) => st.width === Ve.width && st.height === Ve.height && st.ext === Ve.ext && _$1.isEqual(st.parameters, Ve.parameters));
|
|
75704
|
+
er || (er = Ve, er.fileList = [], s.push(er)), er.fileList.push({
|
|
75705
|
+
name: Fe.split("\\").pop(),
|
|
75706
|
+
filesize: nt.filesize,
|
|
75707
|
+
md5: nt.md5,
|
|
75708
|
+
filePath: Fe,
|
|
75709
|
+
meta_data: nt
|
|
75710
|
+
});
|
|
75711
|
+
}).catch((nt) => {
|
|
75712
|
+
F.push({ file: Fe, error: nt?.message || String(nt) });
|
|
75713
|
+
}).finally(() => {
|
|
75714
|
+
x--, He();
|
|
75713
75715
|
});
|
|
75714
75716
|
}
|
|
75715
|
-
},
|
|
75716
|
-
u.length ?
|
|
75717
|
-
let
|
|
75718
|
-
r && r(
|
|
75717
|
+
}, He = () => {
|
|
75718
|
+
u.length ? Re() : x || o({ cameras: s, failed: F });
|
|
75719
|
+
let Ue = m - u.length - x;
|
|
75720
|
+
r && r(Ue, m, F);
|
|
75719
75721
|
};
|
|
75720
|
-
|
|
75722
|
+
Re();
|
|
75721
75723
|
});
|
|
75722
75724
|
}
|
|
75723
75725
|
function _extends() {
|
package/dist/catchUtil.min.js
CHANGED
|
@@ -464,7 +464,7 @@ void main() {
|
|
|
464
464
|
`)}function DOMParser$1(e){if(e=e||{},e.locator===void 0&&(e.locator=!0),this.assign=e.assign||conventions$1.assign,this.domHandler=e.domHandler||DOMHandler,this.onError=e.onError||e.errorHandler,e.errorHandler&&typeof e.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");e.errorHandler&&e.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=e.normalizeLineEndings||normalizeLineEndings,this.locator=!!e.locator,this.xmlns=this.assign(Object.create(null),e.xmlns)}DOMParser$1.prototype.parseFromString=function(e,r){if(!isValidMimeType(r))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+r+'" is not valid.');var s=this.assign(Object.create(null),this.xmlns),u=entities.XML_ENTITIES,m=s[""]||null;hasDefaultHTMLNamespace(r)?(u=entities.HTML_ENTITIES,m=NAMESPACE.HTML):r===MIME_TYPE.XML_SVG_IMAGE&&(m=NAMESPACE.SVG),s[""]=m,s.xml=s.xml||NAMESPACE.XML;var H=new this.domHandler({mimeType:r,defaultNamespace:m,onError:this.onError}),x=this.locator?{}:void 0;this.locator&&H.setDocumentLocator(x);var o=new XMLReader;o.errorHandler=H,o.domBuilder=H;var F=!conventions$1.isHTMLMimeType(r);return F&&typeof e!="string"&&o.errorHandler.fatalError("source is not a string"),o.parse(this.normalizeLineEndings(String(e)),s,u),H.doc.documentElement||o.errorHandler.fatalError("missing root element"),H.doc};function DOMHandler(e){var r=e||{};this.mimeType=r.mimeType||MIME_TYPE.XML_APPLICATION,this.defaultNamespace=r.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=r.onError}function position(e,r){r.lineNumber=e.lineNumber,r.columnNumber=e.columnNumber}DOMHandler.prototype={startDocument:function(){var e=new DOMImplementation;this.doc=isHTMLMimeType(this.mimeType)?e.createHTMLDocument(!1):e.createDocument(this.defaultNamespace,"")},startElement:function(e,r,s,u){var m=this.doc,H=m.createElementNS(e,s||r),x=u.length;appendElement(this,H),this.currentElement=H,this.locator&&position(this.locator,H);for(var o=0;o<x;o++){var e=u.getURI(o),F=u.getValue(o),s=u.getQName(o),Re=m.createAttributeNS(e,s);this.locator&&position(u.getLocator(o),Re),Re.value=Re.nodeValue=F,H.setAttributeNode(Re)}},endElement:function(e,r,s){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(e,r){},endPrefixMapping:function(e){},processingInstruction:function(e,r){var s=this.doc.createProcessingInstruction(e,r);this.locator&&position(this.locator,s),appendElement(this,s)},ignorableWhitespace:function(e,r,s){},characters:function(e,r,s){if(e=_toString.apply(this,arguments),e){if(this.cdata)var u=this.doc.createCDATASection(e);else var u=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(u):/^\s*$/.test(e)&&this.doc.appendChild(u),this.locator&&position(this.locator,u)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){e&&(e.lineNumber=0),this.locator=e},comment:function(e,r,s){e=_toString.apply(this,arguments);var u=this.doc.createComment(e);this.locator&&position(this.locator,u),appendElement(this,u)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,r,s,u){var m=this.doc.implementation;if(m&&m.createDocumentType){var H=m.createDocumentType(e,r,s,u);this.locator&&position(this.locator,H),appendElement(this,H),this.doc.doctype=H}},reportError:function(e,r){if(typeof this.onError=="function")try{this.onError(e,r,this)}catch(s){throw new ParseError("Reporting "+e+' "'+r+'" caused '+s,this.locator)}else console.error("[xmldom "+e+"] "+r,_locator(this.locator))},warning:function(e){this.reportError("warning",e)},error:function(e){this.reportError("error",e)},fatalError:function(e){throw this.reportError("fatalError",e),new ParseError(e,this.locator)}};function _locator(e){if(e)return`
|
|
465
465
|
@#[line:`+e.lineNumber+",col:"+e.columnNumber+"]"}function _toString(e,r,s){return typeof e=="string"?e.substr(r,s):e.length>=r+s||r?new java.lang.String(e,r,s)+"":e}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){DOMHandler.prototype[e]=function(){return null}});function appendElement(e,r){e.currentElement?e.currentElement.appendChild(r):e.doc.appendChild(r)}function onErrorStopParsing(e){if(e==="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(e,r){return util.imageHasData(e)?r&&r(e):getImageData(e,r),!0};function getImageData(e,r){try{var s=findEXIFinJPEG(e);e.exifdata=s.exif,e.xmpdata=s.xmp,r&&r(e)}catch(u){e.exifdata={},e.xmpdata={},r(e,u)}}function findEXIFinJPEG(e){var r=new DataView(e);let s,u;for(var m=2,H=e.byteLength,x=new DOMParser,o;m<H&&r.getUint8(m)==255;){o=r.getUint8(m+1);let Ze=r.getUint16(m+2);if(util.getStringFromDB(r,m+4,Ze),o==225)if(util.getStringFromDB(r,m+4,4)=="http"){var F=m+3,Re=r.getUint16(m+2)-1,He=util.getStringFromDB(r,F,Re),Ue=He.indexOf("xmpmeta>")+8;He=He.substring(He.indexOf("<x:xmpmeta"),Ue);var Fe=He.indexOf("x:xmpmeta")+10;He=He.slice(0,Fe)+'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/" '+He.slice(Fe);var nt=x.parseFromString(He,"text/xml");u=util.xml2Object(nt)}else s=readEXIFData(r,m+4,r.getUint16(m+2)-2);if(u&&s)break;m+=2+r.getUint16(m+2)}return{exif:s||{},xmp:u||{}}}function readEXIFData(e,r){if(util.getStringFromDB(e,r,4)!="Exif")return!1;var s,u,m,H,x,o=r+6;if(e.getUint16(o)==18761)s=!1;else if(e.getUint16(o)==19789)s=!0;else return!1;if(e.getUint16(o+2,!s)!=42)return!1;var F=e.getUint32(o+4,!s);if(F<8)return!1;if(u=readTags(e,o,o+F,TiffTags,s),u.ExifIFDPointer){H=readTags(e,o,o+u.ExifIFDPointer,ExifTags,s);for(m in H){switch(m){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":H[m]=StringValues[m][H[m]];break;case"ExifVersion":case"FlashpixVersion":H[m]=String.fromCharCode(H[m][0],H[m][1],H[m][2],H[m][3]);break;case"ComponentsConfiguration":H[m]=StringValues.Components[H[m][0]]+StringValues.Components[H[m][1]]+StringValues.Components[H[m][2]]+StringValues.Components[H[m][3]];break}u[m]=H[m]}}if(u.GPSInfoIFDPointer){x=readTags(e,o,o+u.GPSInfoIFDPointer,GPSTags,s);for(m in x){switch(m){case"GPSVersionID":x[m]=x[m][0]+"."+x[m][1]+"."+x[m][2]+"."+x[m][3];break}u[m]=x[m]}}return u}function readTags(e,r,s,u,m){var H=e.getUint16(s,!m),x={},o,F,Re;for(Re=0;Re<H;Re++)o=s+Re*12+2,F=u[e.getUint16(o,!m)],x[F]=readTagValue(e,o,r,s,m);return x}function readTagValue(e,r,s,u,m){var H=e.getUint16(r+2,!m),x=e.getUint32(r+4,!m),o=e.getUint32(r+8,!m)+s,F,Re,He,Ue,Fe,nt;switch(H){case 1:case 7:if(x==1)return e.getUint8(r+8,!m);for(F=x>4?o:r+8,Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getUint8(F+Ue);return Re;case 2:return F=x>4?o:r+8,util.getStringFromDB(e,F,x-1);case 3:if(x==1)return e.getUint16(r+8,!m);for(F=x>2?o:r+8,Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getUint16(F+2*Ue,!m);return Re;case 4:if(x==1)return e.getUint32(r+8,!m);for(Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getUint32(o+4*Ue,!m);return Re;case 5:if(x==1)return Fe=e.getUint32(o,!m),nt=e.getUint32(o+4,!m),He=new Number(Fe/nt),He.numerator=Fe,He.denominator=nt,He;for(Re=[],Ue=0;Ue<x;Ue++)Fe=e.getUint32(o+8*Ue,!m),nt=e.getUint32(o+4+8*Ue,!m),Re[Ue]=new Number(Fe/nt),Re[Ue].numerator=Fe,Re[Ue].denominator=nt;return Re;case 9:if(x==1)return e.getInt32(r+8,!m);for(Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getInt32(o+4*Ue,!m);return Re;case 10:if(x==1)return e.getInt32(o,!m)/e.getInt32(o+4,!m);for(Re=[],Ue=0;Ue<x;Ue++)Re[Ue]=e.getInt32(o+8*Ue,!m)/e.getInt32(o+4+8*Ue,!m);return Re}}const decoder=new TextDecoder,toUTF8String=(e,r=0,s=e.length)=>decoder.decode(e.slice(r,s)),toHexString=(e,r=0,s=e.length)=>e.slice(r,s).reduce((u,m)=>u+("0"+m.toString(16)).slice(-2),""),readInt16LE=(e,r=0)=>{const s=e[r]+e[r+1]*256;return s|(s&2**15)*131070},readUInt16BE=(e,r=0)=>e[r]*2**8+e[r+1],readUInt16LE=(e,r=0)=>e[r]+e[r+1]*2**8,readUInt24LE=(e,r=0)=>e[r]+e[r+1]*2**8+e[r+2]*2**16,readInt32LE=(e,r=0)=>e[r]+e[r+1]*2**8+e[r+2]*2**16+(e[r+3]<<24),readUInt32BE=(e,r=0)=>e[r]*2**24+e[r+1]*2**16+e[r+2]*2**8+e[r+3],readUInt32LE=(e,r=0)=>e[r]+e[r+1]*2**8+e[r+2]*2**16+e[r+3]*2**24,methods={readUInt16BE,readUInt16LE,readUInt32BE,readUInt32LE};function readUInt(e,r,s,u){s=s||0;const m=u?"BE":"LE",H="readUInt"+r+m;return methods[H](e,s)}function readBox(e,r){if(e.length-r<4)return;const s=readUInt32BE(e,r);if(!(e.length-r<s))return{name:toUTF8String(e,4+r,8+r),offset:r,size:s}}function findBox(e,r,s){for(;s<e.length;){const u=readBox(e,s);if(!u)break;if(u.name===r)return u;s+=u.size}}const BMP={validate:e=>toUTF8String(e,0,2)==="BM",calculate:e=>({height:Math.abs(readInt32LE(e,22)),width:readUInt32LE(e,18)})},TYPE_ICON=1,SIZE_HEADER$1=2+2+2,SIZE_IMAGE_ENTRY=1+1+1+1+2+2+4+4;function getSizeFromOffset(e,r){const s=e[r];return s===0?256:s}function getImageSize$2(e,r){const s=SIZE_HEADER$1+r*SIZE_IMAGE_ENTRY;return{height:getSizeFromOffset(e,s+1),width:getSizeFromOffset(e,s)}}const ICO={validate(e){const r=readUInt16LE(e,0),s=readUInt16LE(e,4);return r!==0||s===0?!1:readUInt16LE(e,2)===TYPE_ICON},calculate(e){const r=readUInt16LE(e,4),s=getImageSize$2(e,0);if(r===1)return s;const u=[s];for(let m=1;m<r;m+=1)u.push(getImageSize$2(e,m));return{height:s.height,images:u,width:s.width}}},TYPE_CURSOR=2,CUR={validate(e){const r=readUInt16LE(e,0),s=readUInt16LE(e,4);return r!==0||s===0?!1:readUInt16LE(e,2)===TYPE_CURSOR},calculate:e=>ICO.calculate(e)},DDS={validate:e=>readUInt32LE(e,0)===542327876,calculate:e=>({height:readUInt32LE(e,12),width:readUInt32LE(e,16)})},gifRegexp=/^GIF8[79]a/,GIF={validate:e=>gifRegexp.test(toUTF8String(e,0,6)),calculate:e=>({height:readUInt16LE(e,8),width:readUInt16LE(e,6)})},brandMap={avif:"avif",mif1:"heif",msf1:"heif",heic:"heic",heix:"heic",hevc:"heic",hevx:"heic"},HEIF={validate(e){const r=toUTF8String(e,4,8),s=toUTF8String(e,8,12);return r==="ftyp"&&s in brandMap},calculate(e){const r=findBox(e,"meta",0),s=r&&findBox(e,"iprp",r.offset+12),u=s&&findBox(e,"ipco",s.offset+8),m=u&&findBox(e,"ispe",u.offset+8);if(m)return{height:readUInt32BE(e,m.offset+16),width:readUInt32BE(e,m.offset+12),type:toUTF8String(e,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(e,r){const s=r+ENTRY_LENGTH_OFFSET;return[toUTF8String(e,r,s),readUInt32BE(e,s)]}function getImageSize$1(e){const r=ICON_TYPE_SIZE[e];return{width:r,height:r,type:e}}const ICNS={validate:e=>toUTF8String(e,0,4)==="icns",calculate(e){const r=e.length,s=readUInt32BE(e,FILE_LENGTH_OFFSET);let u=SIZE_HEADER,m=readImageHeader(e,u),H=getImageSize$1(m[0]);if(u+=m[1],u===s)return H;const x={height:H.height,images:[H],width:H.width};for(;u<s&&u<r;)m=readImageHeader(e,u),H=getImageSize$1(m[0]),u+=m[1],x.images.push(H);return x}},J2C={validate:e=>toHexString(e,0,4)==="ff4fff51",calculate:e=>({height:readUInt32BE(e,12),width:readUInt32BE(e,8)})},JP2={validate(e){if(readUInt32BE(e,4)!==1783636e3||readUInt32BE(e,0)<1)return!1;const r=findBox(e,"ftyp",0);return r?readUInt32BE(e,r.offset+4)===1718909296:!1},calculate(e){const r=findBox(e,"jp2h",0),s=r&&findBox(e,"ihdr",r.offset+8);if(s)return{height:readUInt32BE(e,s.offset+8),width:readUInt32BE(e,s.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(e){return toHexString(e,2,6)===EXIF_MARKER}function extractSize(e,r){return{height:readUInt16BE(e,r),width:readUInt16BE(e,r+2)}}function extractOrientation(e,r){const u=EXIF_HEADER_BYTES+8,m=readUInt(e,16,u,r);for(let H=0;H<m;H++){const x=u+NUM_DIRECTORY_ENTRIES_BYTES+H*IDF_ENTRY_BYTES,o=x+IDF_ENTRY_BYTES;if(x>e.length)return;const F=e.slice(x,o);if(readUInt(F,16,0,r)===274)return readUInt(F,16,2,r)!==3||readUInt(F,32,4,r)!==1?void 0:readUInt(F,16,8,r)}}function validateExifBlock(e,r){const s=e.slice(APP1_DATA_SIZE_BYTES,r),u=toHexString(s,EXIF_HEADER_BYTES,EXIF_HEADER_BYTES+TIFF_BYTE_ALIGN_BYTES),m=u===BIG_ENDIAN_BYTE_ALIGN;if(m||u===LITTLE_ENDIAN_BYTE_ALIGN)return extractOrientation(s,m)}function validateInput(e,r){if(r>e.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(e[r]!==255)throw new TypeError("Invalid JPG, marker table corrupted")}const JPG={validate:e=>toHexString(e,0,2)==="ffd8",calculate(e){e=e.slice(4);let r,s;for(;e.length;){const u=readUInt16BE(e,0);if(isEXIF(e)&&(r=validateExifBlock(e,u)),validateInput(e,u),s=e[u+1],s===192||s===193||s===194){const m=extractSize(e,u+5);return r?{height:m.height,orientation:r,width:m.width}:m}e=e.slice(u+2)}throw new TypeError("Invalid JPG, no size found")}},KTX={validate:e=>{const r=toUTF8String(e,1,7);return["KTX 11","KTX 20"].includes(r)},calculate:e=>{const r=e[5]===49?"ktx":"ktx2",s=r==="ktx"?36:20;return{height:readUInt32LE(e,s+4),width:readUInt32LE(e,s),type:r}}},pngSignature=`PNG\r
|
|
466
466
|
|
|
467
|
-
`,pngImageHeaderChunkName="IHDR",pngFriedChunkName="CgBI",PNG={validate(e){if(pngSignature===toUTF8String(e,1,8)){let r=toUTF8String(e,12,16);if(r===pngFriedChunkName&&(r=toUTF8String(e,28,32)),r!==pngImageHeaderChunkName)throw new TypeError("Invalid PNG");return!0}return!1},calculate(e){return toUTF8String(e,12,16)===pngFriedChunkName?{height:readUInt32BE(e,36),width:readUInt32BE(e,32)}:{height:readUInt32BE(e,20),width:readUInt32BE(e,16)}}},PNMTypes={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},handlers={default:e=>{let r=[];for(;e.length>0;){const s=e.shift();if(s[0]!=="#"){r=s.split(" ");break}}if(r.length===2)return{height:parseInt(r[1],10),width:parseInt(r[0],10)};throw new TypeError("Invalid PNM")},pam:e=>{const r={};for(;e.length>0;){const s=e.shift();if(s.length>16||s.charCodeAt(0)>128)continue;const[u,m]=s.split(" ");if(u&&m&&(r[u.toLowerCase()]=parseInt(m,10)),r.height&&r.width)break}if(r.height&&r.width)return{height:r.height,width:r.width};throw new TypeError("Invalid PAM")}},PNM={validate:e=>toUTF8String(e,0,2)in PNMTypes,calculate(e){const r=toUTF8String(e,0,2),s=PNMTypes[r],u=toUTF8String(e,3).split(/[\r\n]+/);return(handlers[s]||handlers.default)(u)}},PSD={validate:e=>toUTF8String(e,0,4)==="8BPS",calculate:e=>({height:readUInt32BE(e,14),width:readUInt32BE(e,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(e){const r=unitsReg.exec(e);if(!!r)return Math.round(Number(r[1])*(units[r[2]]||1))}function parseViewbox(e){const r=e.split(" ");return{height:parseLength(r[3]),width:parseLength(r[2])}}function parseAttributes(e){const r=e.match(extractorRegExps.width),s=e.match(extractorRegExps.height),u=e.match(extractorRegExps.viewbox);return{height:s&&parseLength(s[2]),viewbox:u&&parseViewbox(u[2]),width:r&&parseLength(r[2])}}function calculateByDimensions(e){return{height:e.height,width:e.width}}function calculateByViewbox(e,r){const s=r.width/r.height;return e.width?{height:Math.floor(e.width/s),width:e.width}:e.height?{height:e.height,width:Math.floor(e.height*s)}:{height:r.height,width:r.width}}const SVG={validate:e=>svgReg.test(toUTF8String(e,0,1e3)),calculate(e){const r=toUTF8String(e).match(extractorRegExps.root);if(r){const s=parseAttributes(r[0]);if(s.width&&s.height)return calculateByDimensions(s);if(s.viewbox)return calculateByViewbox(s,s.viewbox)}throw new TypeError("Invalid SVG")}},TGA={validate(e){return readUInt16LE(e,0)===0&&readUInt16LE(e,4)===0},calculate(e){return{height:readUInt16LE(e,14),width:readUInt16LE(e,12)}}};function readIFD(e,r){const s=readUInt(e,32,4,r);return e.slice(s+2)}function readValue(e,r){const s=readUInt(e,16,8,r);return(readUInt(e,16,10,r)<<16)+s}function nextTag(e){if(e.length>24)return e.slice(12)}function extractTags(e,r){const s={};let u=e;for(;u&&u.length;){const m=readUInt(u,16,0,r),H=readUInt(u,16,2,r),x=readUInt(u,32,4,r);if(m===0)break;x===1&&(H===3||H===4)&&(s[m]=readValue(u,r)),u=nextTag(u)}return s}function determineEndianness(e){const r=toUTF8String(e,0,2);if(r==="II")return"LE";if(r==="MM")return"BE"}const signatures=["49492a00","4d4d002a"],TIFF={validate:e=>signatures.includes(toHexString(e,0,4)),calculate(e){const r=determineEndianness(e)==="BE",s=readIFD(e,r),u=extractTags(s,r),m=u[256],H=u[257];if(!m||!H)throw new TypeError("Invalid Tiff. Missing tags");return{height:H,width:m}}};function calculateExtended(e){return{height:1+readUInt24LE(e,7),width:1+readUInt24LE(e,4)}}function calculateLossless(e){return{height:1+((e[4]&15)<<10|e[3]<<2|(e[2]&192)>>6),width:1+((e[2]&63)<<8|e[1])}}function calculateLossy(e){return{height:readInt16LE(e,8)&16383,width:readInt16LE(e,6)&16383}}const WEBP={validate(e){const r=toUTF8String(e,0,4)==="RIFF",s=toUTF8String(e,8,12)==="WEBP",u=toUTF8String(e,12,15)==="VP8";return r&&s&&u},calculate(e){const r=toUTF8String(e,12,16);if(e=e.slice(20,30),r==="VP8X"){const u=e[0],m=(u&192)===0,H=(u&1)===0;if(m&&H)return calculateExtended(e);throw new TypeError("Invalid WebP")}if(r==="VP8 "&&e[0]!==47)return calculateLossy(e);const s=toHexString(e,3,6);if(r==="VP8L"&&s!=="9d012a")return calculateLossless(e);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(e){const r=e[0],s=firstBytes.get(r);return s&&typeHandlers.get(s).validate(e)?s:types.find(u=>typeHandlers.get(u).validate(e))}const globalOptions={disabledTypes:[]};function lookup(e){const r=detector(e);if(typeof r<"u"){if(globalOptions.disabledTypes.indexOf(r)>-1)throw new TypeError("disabled file type: "+r);const s=typeHandlers.get(r).calculate(e);if(s!==void 0)return s.type=s.type??r,s}throw new TypeError("unsupported file type: "+r)}var sparkMd5={exports:{}};(function(e,r){(function(s){e.exports=s()})(function(s){var u=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function m(st,Ke){var Ye=st[0],tt=st[1],Je=st[2],rr=st[3];Ye+=(tt&Je|~tt&rr)+Ke[0]-680876936|0,Ye=(Ye<<7|Ye>>>25)+tt|0,rr+=(Ye&tt|~Ye&Je)+Ke[1]-389564586|0,rr=(rr<<12|rr>>>20)+Ye|0,Je+=(rr&Ye|~rr&tt)+Ke[2]+606105819|0,Je=(Je<<17|Je>>>15)+rr|0,tt+=(Je&rr|~Je&Ye)+Ke[3]-1044525330|0,tt=(tt<<22|tt>>>10)+Je|0,Ye+=(tt&Je|~tt&rr)+Ke[4]-176418897|0,Ye=(Ye<<7|Ye>>>25)+tt|0,rr+=(Ye&tt|~Ye&Je)+Ke[5]+1200080426|0,rr=(rr<<12|rr>>>20)+Ye|0,Je+=(rr&Ye|~rr&tt)+Ke[6]-1473231341|0,Je=(Je<<17|Je>>>15)+rr|0,tt+=(Je&rr|~Je&Ye)+Ke[7]-45705983|0,tt=(tt<<22|tt>>>10)+Je|0,Ye+=(tt&Je|~tt&rr)+Ke[8]+1770035416|0,Ye=(Ye<<7|Ye>>>25)+tt|0,rr+=(Ye&tt|~Ye&Je)+Ke[9]-1958414417|0,rr=(rr<<12|rr>>>20)+Ye|0,Je+=(rr&Ye|~rr&tt)+Ke[10]-42063|0,Je=(Je<<17|Je>>>15)+rr|0,tt+=(Je&rr|~Je&Ye)+Ke[11]-1990404162|0,tt=(tt<<22|tt>>>10)+Je|0,Ye+=(tt&Je|~tt&rr)+Ke[12]+1804603682|0,Ye=(Ye<<7|Ye>>>25)+tt|0,rr+=(Ye&tt|~Ye&Je)+Ke[13]-40341101|0,rr=(rr<<12|rr>>>20)+Ye|0,Je+=(rr&Ye|~rr&tt)+Ke[14]-1502002290|0,Je=(Je<<17|Je>>>15)+rr|0,tt+=(Je&rr|~Je&Ye)+Ke[15]+1236535329|0,tt=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Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[3]-1894986606|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[10]-1051523|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[1]-2054922799|0,tt=(tt<<21|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[8]+1873313359|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[15]-30611744|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[6]-1560198380|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[13]+1309151649|0,tt=(tt<<21|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[4]-145523070|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[11]-1120210379|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[2]+718787259|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[9]-343485551|0,tt=(tt<<21|tt>>>11)+Je|0,st[0]=Ye+st[0]|0,st[1]=tt+st[1]|0,st[2]=Je+st[2]|0,st[3]=rr+st[3]|0}function H(st){var Ke=[],Ye;for(Ye=0;Ye<64;Ye+=4)Ke[Ye>>2]=st.charCodeAt(Ye)+(st.charCodeAt(Ye+1)<<8)+(st.charCodeAt(Ye+2)<<16)+(st.charCodeAt(Ye+3)<<24);return Ke}function x(st){var Ke=[],Ye;for(Ye=0;Ye<64;Ye+=4)Ke[Ye>>2]=st[Ye]+(st[Ye+1]<<8)+(st[Ye+2]<<16)+(st[Ye+3]<<24);return Ke}function o(st){var Ke=st.length,Ye=[1732584193,-271733879,-1732584194,271733878],tt,Je,rr,Rr,ar,Ar;for(tt=64;tt<=Ke;tt+=64)m(Ye,H(st.substring(tt-64,tt)));for(st=st.substring(tt-64),Je=st.length,rr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],tt=0;tt<Je;tt+=1)rr[tt>>2]|=st.charCodeAt(tt)<<(tt%4<<3);if(rr[tt>>2]|=128<<(tt%4<<3),tt>55)for(m(Ye,rr),tt=0;tt<16;tt+=1)rr[tt]=0;return Rr=Ke*8,Rr=Rr.toString(16).match(/(.*?)(.{0,8})$/),ar=parseInt(Rr[2],16),Ar=parseInt(Rr[1],16)||0,rr[14]=ar,rr[15]=Ar,m(Ye,rr),Ye}function F(st){var Ke=st.length,Ye=[1732584193,-271733879,-1732584194,271733878],tt,Je,rr,Rr,ar,Ar;for(tt=64;tt<=Ke;tt+=64)m(Ye,x(st.subarray(tt-64,tt)));for(st=tt-64<Ke?st.subarray(tt-64):new Uint8Array(0),Je=st.length,rr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],tt=0;tt<Je;tt+=1)rr[tt>>2]|=st[tt]<<(tt%4<<3);if(rr[tt>>2]|=128<<(tt%4<<3),tt>55)for(m(Ye,rr),tt=0;tt<16;tt+=1)rr[tt]=0;return Rr=Ke*8,Rr=Rr.toString(16).match(/(.*?)(.{0,8})$/),ar=parseInt(Rr[2],16),Ar=parseInt(Rr[1],16)||0,rr[14]=ar,rr[15]=Ar,m(Ye,rr),Ye}function Re(st){var Ke="",Ye;for(Ye=0;Ye<4;Ye+=1)Ke+=u[st>>Ye*8+4&15]+u[st>>Ye*8&15];return Ke}function He(st){var Ke;for(Ke=0;Ke<st.length;Ke+=1)st[Ke]=Re(st[Ke]);return st.join("")}He(o("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function st(Ke,Ye){return Ke=Ke|0||0,Ke<0?Math.max(Ke+Ye,0):Math.min(Ke,Ye)}ArrayBuffer.prototype.slice=function(Ke,Ye){var tt=this.byteLength,Je=st(Ke,tt),rr=tt,Rr,ar,Ar,mr;return Ye!==s&&(rr=st(Ye,tt)),Je>rr?new ArrayBuffer(0):(Rr=rr-Je,ar=new ArrayBuffer(Rr),Ar=new Uint8Array(ar),mr=new Uint8Array(this,Je,Rr),Ar.set(mr),ar)}}();function Ue(st){return/[\u0080-\uFFFF]/.test(st)&&(st=unescape(encodeURIComponent(st))),st}function Fe(st,Ke){var Ye=st.length,tt=new ArrayBuffer(Ye),Je=new Uint8Array(tt),rr;for(rr=0;rr<Ye;rr+=1)Je[rr]=st.charCodeAt(rr);return Ke?Je:tt}function nt(st){return String.fromCharCode.apply(null,new Uint8Array(st))}function Ze(st,Ke,Ye){var tt=new Uint8Array(st.byteLength+Ke.byteLength);return tt.set(new Uint8Array(st)),tt.set(new Uint8Array(Ke),st.byteLength),Ye?tt:tt.buffer}function Ve(st){var Ke=[],Ye=st.length,tt;for(tt=0;tt<Ye-1;tt+=2)Ke.push(parseInt(st.substr(tt,2),16));return String.fromCharCode.apply(String,Ke)}function er(){this.reset()}return er.prototype.append=function(st){return this.appendBinary(Ue(st)),this},er.prototype.appendBinary=function(st){this._buff+=st,this._length+=st.length;var Ke=this._buff.length,Ye;for(Ye=64;Ye<=Ke;Ye+=64)m(this._hash,H(this._buff.substring(Ye-64,Ye)));return this._buff=this._buff.substring(Ye-64),this},er.prototype.end=function(st){var Ke=this._buff,Ye=Ke.length,tt,Je=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],rr;for(tt=0;tt<Ye;tt+=1)Je[tt>>2]|=Ke.charCodeAt(tt)<<(tt%4<<3);return this._finish(Je,Ye),rr=He(this._hash),st&&(rr=Ve(rr)),this.reset(),rr},er.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},er.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},er.prototype.setState=function(st){return this._buff=st.buff,this._length=st.length,this._hash=st.hash,this},er.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},er.prototype._finish=function(st,Ke){var Ye=Ke,tt,Je,rr;if(st[Ye>>2]|=128<<(Ye%4<<3),Ye>55)for(m(this._hash,st),Ye=0;Ye<16;Ye+=1)st[Ye]=0;tt=this._length*8,tt=tt.toString(16).match(/(.*?)(.{0,8})$/),Je=parseInt(tt[2],16),rr=parseInt(tt[1],16)||0,st[14]=Je,st[15]=rr,m(this._hash,st)},er.hash=function(st,Ke){return er.hashBinary(Ue(st),Ke)},er.hashBinary=function(st,Ke){var Ye=o(st),tt=He(Ye);return Ke?Ve(tt):tt},er.ArrayBuffer=function(){this.reset()},er.ArrayBuffer.prototype.append=function(st){var Ke=Ze(this._buff.buffer,st,!0),Ye=Ke.length,tt;for(this._length+=st.byteLength,tt=64;tt<=Ye;tt+=64)m(this._hash,x(Ke.subarray(tt-64,tt)));return this._buff=tt-64<Ye?new Uint8Array(Ke.buffer.slice(tt-64)):new Uint8Array(0),this},er.ArrayBuffer.prototype.end=function(st){var Ke=this._buff,Ye=Ke.length,tt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Je,rr;for(Je=0;Je<Ye;Je+=1)tt[Je>>2]|=Ke[Je]<<(Je%4<<3);return this._finish(tt,Ye),rr=He(this._hash),st&&(rr=Ve(rr)),this.reset(),rr},er.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},er.ArrayBuffer.prototype.getState=function(){var st=er.prototype.getState.call(this);return st.buff=nt(st.buff),st},er.ArrayBuffer.prototype.setState=function(st){return st.buff=Fe(st.buff,!0),er.prototype.setState.call(this,st)},er.ArrayBuffer.prototype.destroy=er.prototype.destroy,er.ArrayBuffer.prototype._finish=er.prototype._finish,er.ArrayBuffer.hash=function(st,Ke){var Ye=F(new Uint8Array(st)),tt=He(Ye);return Ke?Ve(tt):tt},er})})(sparkMd5);const SparkMD5=sparkMd5.exports,getPhotoMetadata=async e=>{let r=getFileExtent(e),s={};if(r==="jpg"||r==="jpeg")try{s=await _formatMetadata(e)}catch{s=await getImageSize(e)}else s=await getImageSize(e);return s.filesize=getFileSize(e),s};async function _formatMetadata(e,r=1){let s=await getFileBuffer(e,r),u=getMd5(s);return new Promise((m,H)=>{getData(s.buffer||s,function(x,o){if(o)return o.message==="Offset is outside the bounds of the DataView"&&r<3?m(_formatMetadata(e,r+1)):H(o);let{exif:F,xmp:Re}=getAllTags(x);F=JSON.parse(JSON.stringify(F).replaceAll("\\u0000",""))||{},F.PixelXDimension&&F.PixelYDimension&&F.PixelXDimension!=65535&&F.PixelYDimension!=65535?m({exif:F,xmp:Re,width:F.PixelXDimension,height:F.PixelYDimension,md5:u}):getImageSize(e).then(He=>{m({exif:F,xmp:Re,width:He.width,height:He.height,md5:u})})})})}async function getImageSize(e){try{let r=await getFileBuffer(e),s=lookup(r),u,m=getFileExtent(e);if(m==="tif"||m==="tiff"){let H;typeof e=="string"?H=e:typeof window<"u"&&e instanceof window.File?H=e.name:H=Buffer.concat([r.subarray(0,10240),r.subarray(r.length/2,10240),r.subarray(-10240)]),typeof H=="string"?typeof Buffer<"u"?u=getMd5(Buffer.from(H)):u=getMd5(new TextEncoder().encode(H)):u=getMd5(H)}else u=getMd5(Buffer.concat([r.subarray(0,10240),r.subarray(r.length/2,10240),r.subarray(-10240)]));return{width:s.width,height:s.height,md5:u}}catch{return{width:0,height:0}}}function getAllTags(e){return util.imageHasData(e)?{exif:e.exifdata||{},xmp:e.xmpdata||{}}:{exif:{},xmp:{}}}function getFileExtent(e){return typeof e=="string"?e.split(".").pop().toLowerCase():typeof window<"u"&&e instanceof window.File?e.name.split(".").pop().toLowerCase():"jpg"}async function getFileBuffer(e,r){if(typeof e=="string")if(r){let s=fs__default.default.openSync(e),u=Buffer.alloc(65536*r);return await new Promise(m=>{fs__default.default.read(s,u,0,u.length,0,()=>{m(),fs__default.default.closeSync(s)})}),u}else return fs__default.default.readFileSync(e);else{if(typeof window<"u"&&e instanceof window.File)return r&&(e=e.slice(0,65536*r)),await new Promise((s,u)=>{var m=new FileReader;m.readAsArrayBuffer(e),m.onload=H=>{s(H.target.result)},m.onerror=H=>{u(H)}});if(Buffer.isBuffer(e))return e}}function getFileSize(e){return typeof e=="string"?fs__default.default.statSync(e).size:e.size||e.length}function getMd5(e){let r=new SparkMD5.ArrayBuffer;return r.append(e),r.end()}async function parsePhoto(e){let r=await getPhotoMetadata(e);const{width:s,height:u,exif:m,xmp:H,filesize:x,md5:o}=r;let F={width:s,height:u,filesize:x,md5:o},Re=NaN,He=NaN,Ue=NaN,Fe=NaN,nt=NaN,Ze=NaN,Ve=[Re,He,Ue],er=flatObject(H),{GPSAltitude:st,GPSLatitude:Ke,GPSLatitudeRef:Ye,GPSLongitude:tt,GPSLongitudeRef:Je}=m||{};tt&&Ke&&(Ve=[getGeoCoordOperator(Je)*toRadian(tt),getGeoCoordOperator(Ye)*toRadian(Ke),+st]);for(let rr in er){let Rr=er[rr];if(rr==="drone-dji:GpsLongtitude"||rr==="drone-dji:GpsLongitude")Re=Number(Rr);else if(rr==="drone-dji:GpsLatitude")He=Number(Rr);else if(rr==="drone-dji:AbsoluteAltitude")Ue=Number(Rr);else if(rr==="drone-dji:GimbalYawDegree")Fe=Number(Rr);else if(rr==="drone-dji:GimbalPitchDegree")nt=Number(Rr);else if(rr==="drone-dji:GimbalRollDegree")Ze=Number(Rr);else if(rr==="drone-dji:DewarpFlag")F.dewarp_flag=Boolean(Number(Rr));else if(rr==="drone-dji:RtkFlag")F.rtk_flag=Number(Rr);else if(rr==="drone-dji:RelativeAltitude")F.relative_altitude=Number(Rr);else if(rr==="tiff:Model")F.camera_model=Rr;else if(rr==="tiff:Make")F.make=Rr;else if(rr==="drone-dji:DewarpData"){let Ar=Rr.split(";")[1].split(",").map(mr=>Number(mr));Ar[2]=s/2+Ar[2],Ar[3]=u/2+Ar[3],F.pre_calib_param=Ar}else rr==="drone-dji:CaptureUUID"?F.capture_uuid=Rr:rr==="drone-dji:DroneID"?F.drone_id=Rr:rr==="drone-dji:DroneSerialNumber"?F.drone_serial_number=Rr:rr==="drone-dji:CameraSerialNumber"&&(F.camera_serial_number=Rr)}if(!Number.isNaN(Fe)&&!Number.isNaN(nt)&&!Number.isNaN(Ze)&&(F.pitch_roll_yaw=[nt,Ze,Fe],F.orientation=getRotationMatrix(nt,Ze,Fe)),m?.DateTime?F.capture_time=hooks(m.DateTime,"YYYY:MM:DD HH:mm:ss").valueOf():m?.DateTimeOriginal&&(F.capture_time=hooks(m.DateTimeOriginal,"YYYY:MM:DD HH:mm:ss").valueOf()),m?.FocalLengthIn35mmFilm&&(F.focal_length_in_35mm=m.FocalLengthIn35mmFilm,!F.pre_calib_param)){let rr=new Array(10).fill(0),Rr=m.FocalLengthIn35mmFilm;rr[0]=rr[1]=Rr/35*Math.max(s,u),rr[2]=s/2,rr[3]=u/2,F.pre_calib_param=rr}if(hasNaN(Ve)&&(Ve=[Re,He,Ue]),!hasNaN(Ve))if(F.pos=Ve,F.absolute_altitude=Ve[2],F.coordinate_system={type:2,label:"WGS 84",type_name:"Geographic",epsg_code:4326},F.make==="DJI"&&F.rtk_flag){let rr=[];F.rtk_flag===50?rr=[.03,.03,.06]:F.rtk_flag===16?rr=[.5,.5,1]:rr=[2,2,5],F.pos_sigma=rr}else F.pos_sigma=[2,2,5];return F}function parsePhotos(e,r){let s=[],u=e,m=e.length,H=10,x=0;return new Promise(o=>{const F=()=>{for(let He=x;He<H;He++){let Ue=u.pop();if(!Ue)break;x++,parsePhoto(Ue).then(Fe=>{if(x--,!Fe.width||!Fe.height)throw new Error("broken photo");let nt=Ue.split(".").pop(),Ze={width:Fe.width,height:Fe.height,ext:nt,parameters:Fe.pre_calib_param||null},Ve=s.find(er=>er.width===Ze.width&&er.height===Ze.height&&er.ext===Ze.ext&&_$1.isEqual(er.parameters,Ze.parameters));Ve||(Ve=Ze,Ve.fileList=[],s.push(Ve)),Ve.fileList.push({name:Ue.split("\\").pop(),filesize:Fe.filesize,md5:Fe.md5,filePath:Ue,meta_data:Fe}),Re()}).catch(Fe=>{x--,Re(),console.error(Fe)})}},Re=()=>{u.length?F():x||o(s);let He=m-u.length-x;r&&r(He,m)};F()})}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var u in s)({}).hasOwnProperty.call(s,u)&&(e[u]=s[u])}return e},_extends.apply(null,arguments)}var DEFAULT_CONFIG={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function isNumber(e){return typeof e=="number"}function isBigNumber(e){return!e||typeof e!="object"||typeof e.constructor!="function"?!1:e.isBigNumber===!0&&typeof e.constructor.prototype=="object"&&e.constructor.prototype.isBigNumber===!0||typeof e.constructor.isDecimal=="function"&&e.constructor.isDecimal(e)===!0}function isComplex(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isComplex===!0||!1}function isFraction(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isFraction===!0||!1}function isUnit(e){return e&&e.constructor.prototype.isUnit===!0||!1}function isString(e){return typeof e=="string"}var isArray=Array.isArray;function isMatrix(e){return e&&e.constructor.prototype.isMatrix===!0||!1}function isCollection(e){return Array.isArray(e)||isMatrix(e)}function isDenseMatrix(e){return e&&e.isDenseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function isSparseMatrix(e){return e&&e.isSparseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function isRange(e){return e&&e.constructor.prototype.isRange===!0||!1}function isIndex(e){return e&&e.constructor.prototype.isIndex===!0||!1}function isBoolean(e){return typeof e=="boolean"}function isResultSet(e){return e&&e.constructor.prototype.isResultSet===!0||!1}function isHelp(e){return e&&e.constructor.prototype.isHelp===!0||!1}function isFunction(e){return typeof e=="function"}function isDate(e){return e instanceof Date}function isRegExp(e){return e instanceof RegExp}function isObject(e){return!!(e&&typeof e=="object"&&e.constructor===Object&&!isComplex(e)&&!isFraction(e))}function isNull(e){return e===null}function isUndefined(e){return e===void 0}function isAccessorNode(e){return e&&e.isAccessorNode===!0&&e.constructor.prototype.isNode===!0||!1}function isArrayNode(e){return e&&e.isArrayNode===!0&&e.constructor.prototype.isNode===!0||!1}function isAssignmentNode(e){return e&&e.isAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function isBlockNode(e){return e&&e.isBlockNode===!0&&e.constructor.prototype.isNode===!0||!1}function isConditionalNode(e){return e&&e.isConditionalNode===!0&&e.constructor.prototype.isNode===!0||!1}function isConstantNode(e){return e&&e.isConstantNode===!0&&e.constructor.prototype.isNode===!0||!1}function isFunctionAssignmentNode(e){return e&&e.isFunctionAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function isFunctionNode(e){return e&&e.isFunctionNode===!0&&e.constructor.prototype.isNode===!0||!1}function isIndexNode(e){return e&&e.isIndexNode===!0&&e.constructor.prototype.isNode===!0||!1}function isNode(e){return e&&e.isNode===!0&&e.constructor.prototype.isNode===!0||!1}function isObjectNode(e){return e&&e.isObjectNode===!0&&e.constructor.prototype.isNode===!0||!1}function isOperatorNode(e){return e&&e.isOperatorNode===!0&&e.constructor.prototype.isNode===!0||!1}function isParenthesisNode(e){return e&&e.isParenthesisNode===!0&&e.constructor.prototype.isNode===!0||!1}function isRangeNode(e){return e&&e.isRangeNode===!0&&e.constructor.prototype.isNode===!0||!1}function isRelationalNode(e){return e&&e.isRelationalNode===!0&&e.constructor.prototype.isNode===!0||!1}function isSymbolNode(e){return e&&e.isSymbolNode===!0&&e.constructor.prototype.isNode===!0||!1}function isChain(e){return e&&e.constructor.prototype.isChain===!0||!1}function typeOf(e){var r=typeof e;return r==="object"?e===null?"null":isBigNumber(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}function clone$2(e){var r=typeof e;if(r==="number"||r==="string"||r==="boolean"||e===null||e===void 0)return e;if(typeof e.clone=="function")return e.clone();if(Array.isArray(e))return e.map(function(s){return clone$2(s)});if(e instanceof Date)return new Date(e.valueOf());if(isBigNumber(e))return e;if(isObject(e))return mapObject(e,clone$2);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function mapObject(e,r){var s={};for(var u in e)hasOwnProperty(e,u)&&(s[u]=r(e[u]));return s}function extend(e,r){for(var s in r)hasOwnProperty(r,s)&&(e[s]=r[s]);return e}function deepStrictEqual(e,r){var s,u,m;if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(u=0,m=e.length;u<m;u++)if(!deepStrictEqual(e[u],r[u]))return!1;return!0}else{if(typeof e=="function")return e===r;if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(s in e)if(!(s in r)||!deepStrictEqual(e[s],r[s]))return!1;for(s in r)if(!(s in e))return!1;return!0}else return e===r}}function hasOwnProperty(e,r){return e&&Object.hasOwnProperty.call(e,r)}function pickShallow(e,r){for(var s={},u=0;u<r.length;u++){var m=r[u],H=e[m];H!==void 0&&(s[m]=H)}return s}var MATRIX_OPTIONS=["Matrix","Array"],NUMBER_OPTIONS=["number","BigNumber","Fraction"],config$1=function e(r){if(r)throw new Error(`The global config is readonly.
|
|
467
|
+
`,pngImageHeaderChunkName="IHDR",pngFriedChunkName="CgBI",PNG={validate(e){if(pngSignature===toUTF8String(e,1,8)){let r=toUTF8String(e,12,16);if(r===pngFriedChunkName&&(r=toUTF8String(e,28,32)),r!==pngImageHeaderChunkName)throw new TypeError("Invalid PNG");return!0}return!1},calculate(e){return toUTF8String(e,12,16)===pngFriedChunkName?{height:readUInt32BE(e,36),width:readUInt32BE(e,32)}:{height:readUInt32BE(e,20),width:readUInt32BE(e,16)}}},PNMTypes={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},handlers={default:e=>{let r=[];for(;e.length>0;){const s=e.shift();if(s[0]!=="#"){r=s.split(" ");break}}if(r.length===2)return{height:parseInt(r[1],10),width:parseInt(r[0],10)};throw new TypeError("Invalid PNM")},pam:e=>{const r={};for(;e.length>0;){const s=e.shift();if(s.length>16||s.charCodeAt(0)>128)continue;const[u,m]=s.split(" ");if(u&&m&&(r[u.toLowerCase()]=parseInt(m,10)),r.height&&r.width)break}if(r.height&&r.width)return{height:r.height,width:r.width};throw new TypeError("Invalid PAM")}},PNM={validate:e=>toUTF8String(e,0,2)in PNMTypes,calculate(e){const r=toUTF8String(e,0,2),s=PNMTypes[r],u=toUTF8String(e,3).split(/[\r\n]+/);return(handlers[s]||handlers.default)(u)}},PSD={validate:e=>toUTF8String(e,0,4)==="8BPS",calculate:e=>({height:readUInt32BE(e,14),width:readUInt32BE(e,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(e){const r=unitsReg.exec(e);if(!!r)return Math.round(Number(r[1])*(units[r[2]]||1))}function parseViewbox(e){const r=e.split(" ");return{height:parseLength(r[3]),width:parseLength(r[2])}}function parseAttributes(e){const r=e.match(extractorRegExps.width),s=e.match(extractorRegExps.height),u=e.match(extractorRegExps.viewbox);return{height:s&&parseLength(s[2]),viewbox:u&&parseViewbox(u[2]),width:r&&parseLength(r[2])}}function calculateByDimensions(e){return{height:e.height,width:e.width}}function calculateByViewbox(e,r){const s=r.width/r.height;return e.width?{height:Math.floor(e.width/s),width:e.width}:e.height?{height:e.height,width:Math.floor(e.height*s)}:{height:r.height,width:r.width}}const SVG={validate:e=>svgReg.test(toUTF8String(e,0,1e3)),calculate(e){const r=toUTF8String(e).match(extractorRegExps.root);if(r){const s=parseAttributes(r[0]);if(s.width&&s.height)return calculateByDimensions(s);if(s.viewbox)return calculateByViewbox(s,s.viewbox)}throw new TypeError("Invalid SVG")}},TGA={validate(e){return readUInt16LE(e,0)===0&&readUInt16LE(e,4)===0},calculate(e){return{height:readUInt16LE(e,14),width:readUInt16LE(e,12)}}};function readIFD(e,r){const s=readUInt(e,32,4,r);return e.slice(s+2)}function readValue(e,r){const s=readUInt(e,16,8,r);return(readUInt(e,16,10,r)<<16)+s}function nextTag(e){if(e.length>24)return e.slice(12)}function extractTags(e,r){const s={};let u=e;for(;u&&u.length;){const m=readUInt(u,16,0,r),H=readUInt(u,16,2,r),x=readUInt(u,32,4,r);if(m===0)break;x===1&&(H===3||H===4)&&(s[m]=readValue(u,r)),u=nextTag(u)}return s}function determineEndianness(e){const r=toUTF8String(e,0,2);if(r==="II")return"LE";if(r==="MM")return"BE"}const signatures=["49492a00","4d4d002a"],TIFF={validate:e=>signatures.includes(toHexString(e,0,4)),calculate(e){const r=determineEndianness(e)==="BE",s=readIFD(e,r),u=extractTags(s,r),m=u[256],H=u[257];if(!m||!H)throw new TypeError("Invalid Tiff. Missing tags");return{height:H,width:m}}};function calculateExtended(e){return{height:1+readUInt24LE(e,7),width:1+readUInt24LE(e,4)}}function calculateLossless(e){return{height:1+((e[4]&15)<<10|e[3]<<2|(e[2]&192)>>6),width:1+((e[2]&63)<<8|e[1])}}function calculateLossy(e){return{height:readInt16LE(e,8)&16383,width:readInt16LE(e,6)&16383}}const WEBP={validate(e){const r=toUTF8String(e,0,4)==="RIFF",s=toUTF8String(e,8,12)==="WEBP",u=toUTF8String(e,12,15)==="VP8";return r&&s&&u},calculate(e){const r=toUTF8String(e,12,16);if(e=e.slice(20,30),r==="VP8X"){const u=e[0],m=(u&192)===0,H=(u&1)===0;if(m&&H)return calculateExtended(e);throw new TypeError("Invalid WebP")}if(r==="VP8 "&&e[0]!==47)return calculateLossy(e);const s=toHexString(e,3,6);if(r==="VP8L"&&s!=="9d012a")return calculateLossless(e);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(e){const r=e[0],s=firstBytes.get(r);return s&&typeHandlers.get(s).validate(e)?s:types.find(u=>typeHandlers.get(u).validate(e))}const globalOptions={disabledTypes:[]};function lookup(e){const r=detector(e);if(typeof r<"u"){if(globalOptions.disabledTypes.indexOf(r)>-1)throw new TypeError("disabled file type: "+r);const s=typeHandlers.get(r).calculate(e);if(s!==void 0)return s.type=s.type??r,s}throw new TypeError("unsupported file type: "+r)}var sparkMd5={exports:{}};(function(e,r){(function(s){e.exports=s()})(function(s){var u=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function m(st,Ke){var Ye=st[0],tt=st[1],Je=st[2],rr=st[3];Ye+=(tt&Je|~tt&rr)+Ke[0]-680876936|0,Ye=(Ye<<7|Ye>>>25)+tt|0,rr+=(Ye&tt|~Ye&Je)+Ke[1]-389564586|0,rr=(rr<<12|rr>>>20)+Ye|0,Je+=(rr&Ye|~rr&tt)+Ke[2]+606105819|0,Je=(Je<<17|Je>>>15)+rr|0,tt+=(Je&rr|~Je&Ye)+Ke[3]-1044525330|0,tt=(tt<<22|tt>>>10)+Je|0,Ye+=(tt&Je|~tt&rr)+Ke[4]-176418897|0,Ye=(Ye<<7|Ye>>>25)+tt|0,rr+=(Ye&tt|~Ye&Je)+Ke[5]+1200080426|0,rr=(rr<<12|rr>>>20)+Ye|0,Je+=(rr&Ye|~rr&tt)+Ke[6]-1473231341|0,Je=(Je<<17|Je>>>15)+rr|0,tt+=(Je&rr|~Je&Ye)+Ke[7]-45705983|0,tt=(tt<<22|tt>>>10)+Je|0,Ye+=(tt&Je|~tt&rr)+Ke[8]+1770035416|0,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+=(Ye^tt^Je)+Ke[12]-421815835|0,rr=(rr<<11|rr>>>21)+Ye|0,Je+=(rr^Ye^tt)+Ke[15]+530742520|0,Je=(Je<<16|Je>>>16)+rr|0,tt+=(Je^rr^Ye)+Ke[2]-995338651|0,tt=(tt<<23|tt>>>9)+Je|0,Ye+=(Je^(tt|~rr))+Ke[0]-198630844|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[7]+1126891415|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[14]-1416354905|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[5]-57434055|0,tt=(tt<<21|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[12]+1700485571|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[3]-1894986606|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[10]-1051523|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[1]-2054922799|0,tt=(tt<<21|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[8]+1873313359|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[15]-30611744|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[6]-1560198380|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[13]+1309151649|0,tt=(tt<<21|tt>>>11)+Je|0,Ye+=(Je^(tt|~rr))+Ke[4]-145523070|0,Ye=(Ye<<6|Ye>>>26)+tt|0,rr+=(tt^(Ye|~Je))+Ke[11]-1120210379|0,rr=(rr<<10|rr>>>22)+Ye|0,Je+=(Ye^(rr|~tt))+Ke[2]+718787259|0,Je=(Je<<15|Je>>>17)+rr|0,tt+=(rr^(Je|~Ye))+Ke[9]-343485551|0,tt=(tt<<21|tt>>>11)+Je|0,st[0]=Ye+st[0]|0,st[1]=tt+st[1]|0,st[2]=Je+st[2]|0,st[3]=rr+st[3]|0}function H(st){var Ke=[],Ye;for(Ye=0;Ye<64;Ye+=4)Ke[Ye>>2]=st.charCodeAt(Ye)+(st.charCodeAt(Ye+1)<<8)+(st.charCodeAt(Ye+2)<<16)+(st.charCodeAt(Ye+3)<<24);return Ke}function x(st){var Ke=[],Ye;for(Ye=0;Ye<64;Ye+=4)Ke[Ye>>2]=st[Ye]+(st[Ye+1]<<8)+(st[Ye+2]<<16)+(st[Ye+3]<<24);return Ke}function o(st){var Ke=st.length,Ye=[1732584193,-271733879,-1732584194,271733878],tt,Je,rr,Rr,ar,Ar;for(tt=64;tt<=Ke;tt+=64)m(Ye,H(st.substring(tt-64,tt)));for(st=st.substring(tt-64),Je=st.length,rr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],tt=0;tt<Je;tt+=1)rr[tt>>2]|=st.charCodeAt(tt)<<(tt%4<<3);if(rr[tt>>2]|=128<<(tt%4<<3),tt>55)for(m(Ye,rr),tt=0;tt<16;tt+=1)rr[tt]=0;return Rr=Ke*8,Rr=Rr.toString(16).match(/(.*?)(.{0,8})$/),ar=parseInt(Rr[2],16),Ar=parseInt(Rr[1],16)||0,rr[14]=ar,rr[15]=Ar,m(Ye,rr),Ye}function F(st){var Ke=st.length,Ye=[1732584193,-271733879,-1732584194,271733878],tt,Je,rr,Rr,ar,Ar;for(tt=64;tt<=Ke;tt+=64)m(Ye,x(st.subarray(tt-64,tt)));for(st=tt-64<Ke?st.subarray(tt-64):new Uint8Array(0),Je=st.length,rr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],tt=0;tt<Je;tt+=1)rr[tt>>2]|=st[tt]<<(tt%4<<3);if(rr[tt>>2]|=128<<(tt%4<<3),tt>55)for(m(Ye,rr),tt=0;tt<16;tt+=1)rr[tt]=0;return Rr=Ke*8,Rr=Rr.toString(16).match(/(.*?)(.{0,8})$/),ar=parseInt(Rr[2],16),Ar=parseInt(Rr[1],16)||0,rr[14]=ar,rr[15]=Ar,m(Ye,rr),Ye}function Re(st){var Ke="",Ye;for(Ye=0;Ye<4;Ye+=1)Ke+=u[st>>Ye*8+4&15]+u[st>>Ye*8&15];return Ke}function He(st){var Ke;for(Ke=0;Ke<st.length;Ke+=1)st[Ke]=Re(st[Ke]);return st.join("")}He(o("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function st(Ke,Ye){return Ke=Ke|0||0,Ke<0?Math.max(Ke+Ye,0):Math.min(Ke,Ye)}ArrayBuffer.prototype.slice=function(Ke,Ye){var tt=this.byteLength,Je=st(Ke,tt),rr=tt,Rr,ar,Ar,mr;return Ye!==s&&(rr=st(Ye,tt)),Je>rr?new ArrayBuffer(0):(Rr=rr-Je,ar=new ArrayBuffer(Rr),Ar=new Uint8Array(ar),mr=new Uint8Array(this,Je,Rr),Ar.set(mr),ar)}}();function Ue(st){return/[\u0080-\uFFFF]/.test(st)&&(st=unescape(encodeURIComponent(st))),st}function Fe(st,Ke){var Ye=st.length,tt=new ArrayBuffer(Ye),Je=new Uint8Array(tt),rr;for(rr=0;rr<Ye;rr+=1)Je[rr]=st.charCodeAt(rr);return Ke?Je:tt}function nt(st){return String.fromCharCode.apply(null,new Uint8Array(st))}function Ze(st,Ke,Ye){var tt=new Uint8Array(st.byteLength+Ke.byteLength);return tt.set(new Uint8Array(st)),tt.set(new Uint8Array(Ke),st.byteLength),Ye?tt:tt.buffer}function Ve(st){var Ke=[],Ye=st.length,tt;for(tt=0;tt<Ye-1;tt+=2)Ke.push(parseInt(st.substr(tt,2),16));return String.fromCharCode.apply(String,Ke)}function er(){this.reset()}return er.prototype.append=function(st){return this.appendBinary(Ue(st)),this},er.prototype.appendBinary=function(st){this._buff+=st,this._length+=st.length;var Ke=this._buff.length,Ye;for(Ye=64;Ye<=Ke;Ye+=64)m(this._hash,H(this._buff.substring(Ye-64,Ye)));return this._buff=this._buff.substring(Ye-64),this},er.prototype.end=function(st){var Ke=this._buff,Ye=Ke.length,tt,Je=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],rr;for(tt=0;tt<Ye;tt+=1)Je[tt>>2]|=Ke.charCodeAt(tt)<<(tt%4<<3);return this._finish(Je,Ye),rr=He(this._hash),st&&(rr=Ve(rr)),this.reset(),rr},er.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},er.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},er.prototype.setState=function(st){return this._buff=st.buff,this._length=st.length,this._hash=st.hash,this},er.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},er.prototype._finish=function(st,Ke){var Ye=Ke,tt,Je,rr;if(st[Ye>>2]|=128<<(Ye%4<<3),Ye>55)for(m(this._hash,st),Ye=0;Ye<16;Ye+=1)st[Ye]=0;tt=this._length*8,tt=tt.toString(16).match(/(.*?)(.{0,8})$/),Je=parseInt(tt[2],16),rr=parseInt(tt[1],16)||0,st[14]=Je,st[15]=rr,m(this._hash,st)},er.hash=function(st,Ke){return er.hashBinary(Ue(st),Ke)},er.hashBinary=function(st,Ke){var Ye=o(st),tt=He(Ye);return Ke?Ve(tt):tt},er.ArrayBuffer=function(){this.reset()},er.ArrayBuffer.prototype.append=function(st){var Ke=Ze(this._buff.buffer,st,!0),Ye=Ke.length,tt;for(this._length+=st.byteLength,tt=64;tt<=Ye;tt+=64)m(this._hash,x(Ke.subarray(tt-64,tt)));return this._buff=tt-64<Ye?new Uint8Array(Ke.buffer.slice(tt-64)):new Uint8Array(0),this},er.ArrayBuffer.prototype.end=function(st){var Ke=this._buff,Ye=Ke.length,tt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Je,rr;for(Je=0;Je<Ye;Je+=1)tt[Je>>2]|=Ke[Je]<<(Je%4<<3);return this._finish(tt,Ye),rr=He(this._hash),st&&(rr=Ve(rr)),this.reset(),rr},er.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},er.ArrayBuffer.prototype.getState=function(){var st=er.prototype.getState.call(this);return st.buff=nt(st.buff),st},er.ArrayBuffer.prototype.setState=function(st){return st.buff=Fe(st.buff,!0),er.prototype.setState.call(this,st)},er.ArrayBuffer.prototype.destroy=er.prototype.destroy,er.ArrayBuffer.prototype._finish=er.prototype._finish,er.ArrayBuffer.hash=function(st,Ke){var Ye=F(new Uint8Array(st)),tt=He(Ye);return Ke?Ve(tt):tt},er})})(sparkMd5);const SparkMD5=sparkMd5.exports,getPhotoMetadata=async e=>{let r=getFileExtent(e),s={};if(r==="jpg"||r==="jpeg")try{s=await _formatMetadata(e)}catch{s=await getImageSize(e)}else s=await getImageSize(e);return s.filesize=getFileSize(e),s};async function _formatMetadata(e,r=1){let s=await getFileBuffer(e,r),u=getMd5(s);return new Promise((m,H)=>{getData(s.buffer||s,function(x,o){if(o)return o.message==="Offset is outside the bounds of the DataView"&&r<3?m(_formatMetadata(e,r+1)):H(o);let{exif:F,xmp:Re}=getAllTags(x);F=JSON.parse(JSON.stringify(F).replaceAll("\\u0000",""))||{},F.PixelXDimension&&F.PixelYDimension&&F.PixelXDimension!=65535&&F.PixelYDimension!=65535?m({exif:F,xmp:Re,width:F.PixelXDimension,height:F.PixelYDimension,md5:u}):getImageSize(e).then(He=>{m({exif:F,xmp:Re,width:He.width,height:He.height,md5:u})})})})}async function getImageSize(e){try{let r=await getFileBuffer(e),s=lookup(r),u,m=getFileExtent(e);if(m==="tif"||m==="tiff"){let H;typeof e=="string"?H=e:typeof window<"u"&&e instanceof window.File?H=e.name:H=Buffer.concat([r.subarray(0,10240),r.subarray(r.length/2,10240),r.subarray(-10240)]),typeof H=="string"?typeof Buffer<"u"?u=getMd5(Buffer.from(H)):u=getMd5(new TextEncoder().encode(H)):u=getMd5(H)}else u=getMd5(Buffer.concat([r.subarray(0,10240),r.subarray(r.length/2,10240),r.subarray(-10240)]));return{width:s.width,height:s.height,md5:u}}catch{return{width:0,height:0}}}function getAllTags(e){return util.imageHasData(e)?{exif:e.exifdata||{},xmp:e.xmpdata||{}}:{exif:{},xmp:{}}}function getFileExtent(e){return typeof e=="string"?e.split(".").pop().toLowerCase():typeof window<"u"&&e instanceof window.File?e.name.split(".").pop().toLowerCase():"jpg"}async function getFileBuffer(e,r){if(typeof e=="string")if(r){let s=fs__default.default.openSync(e),u=Buffer.alloc(65536*r);return await new Promise(m=>{fs__default.default.read(s,u,0,u.length,0,()=>{m(),fs__default.default.closeSync(s)})}),u}else return fs__default.default.readFileSync(e);else{if(typeof window<"u"&&e instanceof window.File)return r&&(e=e.slice(0,65536*r)),await new Promise((s,u)=>{var m=new FileReader;m.readAsArrayBuffer(e),m.onload=H=>{s(H.target.result)},m.onerror=H=>{u(H)}});if(Buffer.isBuffer(e))return e}}function getFileSize(e){return typeof e=="string"?fs__default.default.statSync(e).size:e.size||e.length}function getMd5(e){let r=new SparkMD5.ArrayBuffer;return r.append(e),r.end()}async function parsePhoto(e){let r=await getPhotoMetadata(e);const{width:s,height:u,exif:m,xmp:H,filesize:x,md5:o}=r;let F={width:s,height:u,filesize:x,md5:o},Re=NaN,He=NaN,Ue=NaN,Fe=NaN,nt=NaN,Ze=NaN,Ve=[Re,He,Ue],er=flatObject(H),{GPSAltitude:st,GPSLatitude:Ke,GPSLatitudeRef:Ye,GPSLongitude:tt,GPSLongitudeRef:Je}=m||{};tt&&Ke&&(Ve=[getGeoCoordOperator(Je)*toRadian(tt),getGeoCoordOperator(Ye)*toRadian(Ke),+st]);for(let rr in er){let Rr=er[rr];if(rr==="drone-dji:GpsLongtitude"||rr==="drone-dji:GpsLongitude")Re=Number(Rr);else if(rr==="drone-dji:GpsLatitude")He=Number(Rr);else if(rr==="drone-dji:AbsoluteAltitude")Ue=Number(Rr);else if(rr==="drone-dji:GimbalYawDegree")Fe=Number(Rr);else if(rr==="drone-dji:GimbalPitchDegree")nt=Number(Rr);else if(rr==="drone-dji:GimbalRollDegree")Ze=Number(Rr);else if(rr==="drone-dji:DewarpFlag")F.dewarp_flag=Boolean(Number(Rr));else if(rr==="drone-dji:RtkFlag")F.rtk_flag=Number(Rr);else if(rr==="drone-dji:RelativeAltitude")F.relative_altitude=Number(Rr);else if(rr==="tiff:Model")F.camera_model=Rr;else if(rr==="tiff:Make")F.make=Rr;else if(rr==="drone-dji:DewarpData"){let Ar=Rr.split(";")[1].split(",").map(mr=>Number(mr));Ar[2]=s/2+Ar[2],Ar[3]=u/2+Ar[3],F.pre_calib_param=Ar}else rr==="drone-dji:CaptureUUID"?F.capture_uuid=Rr:rr==="drone-dji:DroneID"?F.drone_id=Rr:rr==="drone-dji:DroneSerialNumber"?F.drone_serial_number=Rr:rr==="drone-dji:CameraSerialNumber"&&(F.camera_serial_number=Rr)}if(!Number.isNaN(Fe)&&!Number.isNaN(nt)&&!Number.isNaN(Ze)&&(F.pitch_roll_yaw=[nt,Ze,Fe],F.orientation=getRotationMatrix(nt,Ze,Fe)),m?.DateTime?F.capture_time=hooks(m.DateTime,"YYYY:MM:DD HH:mm:ss").valueOf():m?.DateTimeOriginal&&(F.capture_time=hooks(m.DateTimeOriginal,"YYYY:MM:DD HH:mm:ss").valueOf()),m?.FocalLengthIn35mmFilm&&(F.focal_length_in_35mm=m.FocalLengthIn35mmFilm,!F.pre_calib_param)){let rr=new Array(10).fill(0),Rr=m.FocalLengthIn35mmFilm;rr[0]=rr[1]=Rr/35*Math.max(s,u),rr[2]=s/2,rr[3]=u/2,F.pre_calib_param=rr}if(hasNaN(Ve)&&(Ve=[Re,He,Ue]),!hasNaN(Ve))if(F.pos=Ve,F.absolute_altitude=Ve[2],F.coordinate_system={type:2,label:"WGS 84",type_name:"Geographic",epsg_code:4326},F.make==="DJI"&&F.rtk_flag){let rr=[];F.rtk_flag===50?rr=[.03,.03,.06]:F.rtk_flag===16?rr=[.5,.5,1]:rr=[2,2,5],F.pos_sigma=rr}else F.pos_sigma=[2,2,5];return F}function parsePhotos(e,r){let s=[],u=e,m=e.length,H=10,x=0;return new Promise(o=>{const F=[],Re=()=>{for(let Ue=x;Ue<H;Ue++){let Fe=u.pop();if(!Fe)break;x++,parsePhoto(Fe).then(nt=>{if(!nt.width||!nt.height)throw new Error("broken photo");let Ze=Fe.split(".").pop(),Ve={width:nt.width,height:nt.height,ext:Ze,parameters:nt.pre_calib_param||null},er=s.find(st=>st.width===Ve.width&&st.height===Ve.height&&st.ext===Ve.ext&&_$1.isEqual(st.parameters,Ve.parameters));er||(er=Ve,er.fileList=[],s.push(er)),er.fileList.push({name:Fe.split("\\").pop(),filesize:nt.filesize,md5:nt.md5,filePath:Fe,meta_data:nt})}).catch(nt=>{F.push({file:Fe,error:nt?.message||String(nt)})}).finally(()=>{x--,He()})}},He=()=>{u.length?Re():x||o({cameras:s,failed:F});let Ue=m-u.length-x;r&&r(Ue,m,F)};Re()})}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var u in s)({}).hasOwnProperty.call(s,u)&&(e[u]=s[u])}return e},_extends.apply(null,arguments)}var DEFAULT_CONFIG={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function isNumber(e){return typeof e=="number"}function isBigNumber(e){return!e||typeof e!="object"||typeof e.constructor!="function"?!1:e.isBigNumber===!0&&typeof e.constructor.prototype=="object"&&e.constructor.prototype.isBigNumber===!0||typeof e.constructor.isDecimal=="function"&&e.constructor.isDecimal(e)===!0}function isComplex(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isComplex===!0||!1}function isFraction(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isFraction===!0||!1}function isUnit(e){return e&&e.constructor.prototype.isUnit===!0||!1}function isString(e){return typeof e=="string"}var isArray=Array.isArray;function isMatrix(e){return e&&e.constructor.prototype.isMatrix===!0||!1}function isCollection(e){return Array.isArray(e)||isMatrix(e)}function isDenseMatrix(e){return e&&e.isDenseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function isSparseMatrix(e){return e&&e.isSparseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function isRange(e){return e&&e.constructor.prototype.isRange===!0||!1}function isIndex(e){return e&&e.constructor.prototype.isIndex===!0||!1}function isBoolean(e){return typeof e=="boolean"}function isResultSet(e){return e&&e.constructor.prototype.isResultSet===!0||!1}function isHelp(e){return e&&e.constructor.prototype.isHelp===!0||!1}function isFunction(e){return typeof e=="function"}function isDate(e){return e instanceof Date}function isRegExp(e){return e instanceof RegExp}function isObject(e){return!!(e&&typeof e=="object"&&e.constructor===Object&&!isComplex(e)&&!isFraction(e))}function isNull(e){return e===null}function isUndefined(e){return e===void 0}function isAccessorNode(e){return e&&e.isAccessorNode===!0&&e.constructor.prototype.isNode===!0||!1}function isArrayNode(e){return e&&e.isArrayNode===!0&&e.constructor.prototype.isNode===!0||!1}function isAssignmentNode(e){return e&&e.isAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function isBlockNode(e){return e&&e.isBlockNode===!0&&e.constructor.prototype.isNode===!0||!1}function isConditionalNode(e){return e&&e.isConditionalNode===!0&&e.constructor.prototype.isNode===!0||!1}function isConstantNode(e){return e&&e.isConstantNode===!0&&e.constructor.prototype.isNode===!0||!1}function isFunctionAssignmentNode(e){return e&&e.isFunctionAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function isFunctionNode(e){return e&&e.isFunctionNode===!0&&e.constructor.prototype.isNode===!0||!1}function isIndexNode(e){return e&&e.isIndexNode===!0&&e.constructor.prototype.isNode===!0||!1}function isNode(e){return e&&e.isNode===!0&&e.constructor.prototype.isNode===!0||!1}function isObjectNode(e){return e&&e.isObjectNode===!0&&e.constructor.prototype.isNode===!0||!1}function isOperatorNode(e){return e&&e.isOperatorNode===!0&&e.constructor.prototype.isNode===!0||!1}function isParenthesisNode(e){return e&&e.isParenthesisNode===!0&&e.constructor.prototype.isNode===!0||!1}function isRangeNode(e){return e&&e.isRangeNode===!0&&e.constructor.prototype.isNode===!0||!1}function isRelationalNode(e){return e&&e.isRelationalNode===!0&&e.constructor.prototype.isNode===!0||!1}function isSymbolNode(e){return e&&e.isSymbolNode===!0&&e.constructor.prototype.isNode===!0||!1}function isChain(e){return e&&e.constructor.prototype.isChain===!0||!1}function typeOf(e){var r=typeof e;return r==="object"?e===null?"null":isBigNumber(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}function clone$2(e){var r=typeof e;if(r==="number"||r==="string"||r==="boolean"||e===null||e===void 0)return e;if(typeof e.clone=="function")return e.clone();if(Array.isArray(e))return e.map(function(s){return clone$2(s)});if(e instanceof Date)return new Date(e.valueOf());if(isBigNumber(e))return e;if(isObject(e))return mapObject(e,clone$2);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function mapObject(e,r){var s={};for(var u in e)hasOwnProperty(e,u)&&(s[u]=r(e[u]));return s}function extend(e,r){for(var s in r)hasOwnProperty(r,s)&&(e[s]=r[s]);return e}function deepStrictEqual(e,r){var s,u,m;if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(u=0,m=e.length;u<m;u++)if(!deepStrictEqual(e[u],r[u]))return!1;return!0}else{if(typeof e=="function")return e===r;if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(s in e)if(!(s in r)||!deepStrictEqual(e[s],r[s]))return!1;for(s in r)if(!(s in e))return!1;return!0}else return e===r}}function hasOwnProperty(e,r){return e&&Object.hasOwnProperty.call(e,r)}function pickShallow(e,r){for(var s={},u=0;u<r.length;u++){var m=r[u],H=e[m];H!==void 0&&(s[m]=H)}return s}var MATRIX_OPTIONS=["Matrix","Array"],NUMBER_OPTIONS=["number","BigNumber","Fraction"],config$1=function e(r){if(r)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
|
|