(function(pt,_t){typeof exports=="object"&&typeof module<"u"?_t(exports):typeof define=="function"&&define.amd?define(["exports"],_t):(pt=typeof globalThis<"u"?globalThis:pt||self,_t(pt["dji-kmz-parser"]={}))})(this,function(pt){"use strict";var _t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}function yt($){throw new Error('Could not dynamically require "'+$+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Et={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function($,rt){(function(p){$.exports=p()})(function(){return function p(O,y,h){function o(g,b){if(!y[g]){if(!O[g]){var m=typeof yt=="function"&&yt;if(!b&&m)return m(g,!0);if(r)return r(g,!0);var v=new Error("Cannot find module '"+g+"'");throw v.code="MODULE_NOT_FOUND",v}var i=y[g]={exports:{}};O[g][0].call(i.exports,function(c){var n=O[g][1][c];return o(n||c)},i,i.exports,p,O,y,h)}return y[g].exports}for(var r=typeof yt=="function"&&yt,l=0;l>2,i=(3&g)<<4|b>>4,c=1>6:64,n=2>4,b=(15&v)<<4|(i=r.indexOf(l.charAt(n++)))>>2,m=(3&i)<<6|(c=r.indexOf(l.charAt(n++))),d[u++]=g,i!==64&&(d[u++]=b),c!==64&&(d[u++]=m);return d}},{"./support":30,"./utils":32}],2:[function(p,O,y){var h=p("./external"),o=p("./stream/DataWorker"),r=p("./stream/Crc32Probe"),l=p("./stream/DataLengthProbe");function g(b,m,v,i,c){this.compressedSize=b,this.uncompressedSize=m,this.crc32=v,this.compression=i,this.compressedContent=c}g.prototype={getContentWorker:function(){var b=new o(h.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),m=this;return b.on("end",function(){if(this.streamInfo.data_length!==m.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),b},getCompressedWorker:function(){return new o(h.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},g.createWorkerFrom=function(b,m,v){return b.pipe(new r).pipe(new l("uncompressedSize")).pipe(m.compressWorker(v)).pipe(new l("compressedSize")).withStreamInfo("compression",m)},O.exports=g},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(p,O,y){var h=p("./stream/GenericWorker");y.STORE={magic:"\0\0",compressWorker:function(){return new h("STORE compression")},uncompressWorker:function(){return new h("STORE decompression")}},y.DEFLATE=p("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(p,O,y){var h=p("./utils"),o=function(){for(var r,l=[],g=0;g<256;g++){r=g;for(var b=0;b<8;b++)r=1&r?3988292384^r>>>1:r>>>1;l[g]=r}return l}();O.exports=function(r,l){return r!==void 0&&r.length?h.getTypeOf(r)!=="string"?function(g,b,m,v){var i=o,c=v+m;g^=-1;for(var n=v;n>>8^i[255&(g^b[n])];return-1^g}(0|l,r,r.length,0):function(g,b,m,v){var i=o,c=v+m;g^=-1;for(var n=v;n>>8^i[255&(g^b.charCodeAt(n))];return-1^g}(0|l,r,r.length,0):0}},{"./utils":32}],5:[function(p,O,y){y.base64=!1,y.binary=!1,y.dir=!1,y.createFolders=!0,y.date=null,y.compression=null,y.compressionOptions=null,y.comment=null,y.unixPermissions=null,y.dosPermissions=null},{}],6:[function(p,O,y){var h=null;h=typeof Promise<"u"?Promise:p("lie"),O.exports={Promise:h}},{lie:37}],7:[function(p,O,y){var h=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=p("pako"),r=p("./utils"),l=p("./stream/GenericWorker"),g=h?"uint8array":"array";function b(m,v){l.call(this,"FlateWorker/"+m),this._pako=null,this._pakoAction=m,this._pakoOptions=v,this.meta={}}y.magic="\b\0",r.inherits(b,l),b.prototype.processChunk=function(m){this.meta=m.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(g,m.data),!1)},b.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},b.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},b.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var m=this;this._pako.onData=function(v){m.push({data:v,meta:m.meta})}},y.compressWorker=function(m){return new b("Deflate",m)},y.uncompressWorker=function(){return new b("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(p,O,y){function h(i,c){var n,u="";for(n=0;n>>=8;return u}function o(i,c,n,u,s,d){var w,S,x=i.file,F=i.compression,B=d!==g.utf8encode,j=r.transformTo("string",d(x.name)),I=r.transformTo("string",g.utf8encode(x.name)),M=x.comment,V=r.transformTo("string",d(M)),_=r.transformTo("string",g.utf8encode(M)),T=I.length!==x.name.length,e=_.length!==M.length,D="",q="",U="",Q=x.dir,L=x.date,J={crc32:0,compressedSize:0,uncompressedSize:0};c&&!n||(J.crc32=i.crc32,J.compressedSize=i.compressedSize,J.uncompressedSize=i.uncompressedSize);var E=0;c&&(E|=8),B||!T&&!e||(E|=2048);var C=0,Y=0;Q&&(C|=16),s==="UNIX"?(Y=798,C|=function(H,st){var lt=H;return H||(lt=st?16893:33204),(65535<)<<16}(x.unixPermissions,Q)):(Y=20,C|=function(H){return 63&(H||0)}(x.dosPermissions)),w=L.getUTCHours(),w<<=6,w|=L.getUTCMinutes(),w<<=5,w|=L.getUTCSeconds()/2,S=L.getUTCFullYear()-1980,S<<=4,S|=L.getUTCMonth()+1,S<<=5,S|=L.getUTCDate(),T&&(q=h(1,1)+h(b(j),4)+I,D+="up"+h(q.length,2)+q),e&&(U=h(1,1)+h(b(V),4)+_,D+="uc"+h(U.length,2)+U);var G="";return G+=` \0`,G+=h(E,2),G+=F.magic,G+=h(w,2),G+=h(S,2),G+=h(J.crc32,4),G+=h(J.compressedSize,4),G+=h(J.uncompressedSize,4),G+=h(j.length,2),G+=h(D.length,2),{fileRecord:m.LOCAL_FILE_HEADER+G+j+D,dirRecord:m.CENTRAL_FILE_HEADER+h(Y,2)+G+h(V.length,2)+"\0\0\0\0"+h(C,4)+h(u,4)+j+D+V}}var r=p("../utils"),l=p("../stream/GenericWorker"),g=p("../utf8"),b=p("../crc32"),m=p("../signature");function v(i,c,n,u){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=c,this.zipPlatform=n,this.encodeFileName=u,this.streamFiles=i,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(v,l),v.prototype.push=function(i){var c=i.meta.percent||0,n=this.entriesCount,u=this._sources.length;this.accumulate?this.contentBuffer.push(i):(this.bytesWritten+=i.data.length,l.prototype.push.call(this,{data:i.data,meta:{currentFile:this.currentFile,percent:n?(c+100*(n-u-1))/n:100}}))},v.prototype.openedSource=function(i){this.currentSourceOffset=this.bytesWritten,this.currentFile=i.file.name;var c=this.streamFiles&&!i.file.dir;if(c){var n=o(i,c,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},v.prototype.closedSource=function(i){this.accumulate=!1;var c=this.streamFiles&&!i.file.dir,n=o(i,c,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),c)this.push({data:function(u){return m.DATA_DESCRIPTOR+h(u.crc32,4)+h(u.compressedSize,4)+h(u.uncompressedSize,4)}(i),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},v.prototype.flush=function(){for(var i=this.bytesWritten,c=0;c=this.index;l--)g=(g<<8)+this.byteAt(l);return this.index+=r,g},readString:function(r){return h.transformTo("string",this.readData(r))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var r=this.readInt(4);return new Date(Date.UTC(1980+(r>>25&127),(r>>21&15)-1,r>>16&31,r>>11&31,r>>5&63,(31&r)<<1))}},O.exports=o},{"../utils":32}],19:[function(p,O,y){var h=p("./Uint8ArrayReader");function o(r){h.call(this,r)}p("../utils").inherits(o,h),o.prototype.readData=function(r){this.checkOffset(r);var l=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,l},O.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(p,O,y){var h=p("./DataReader");function o(r){h.call(this,r)}p("../utils").inherits(o,h),o.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},o.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},o.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},o.prototype.readData=function(r){this.checkOffset(r);var l=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,l},O.exports=o},{"../utils":32,"./DataReader":18}],21:[function(p,O,y){var h=p("./ArrayReader");function o(r){h.call(this,r)}p("../utils").inherits(o,h),o.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,l},O.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(p,O,y){var h=p("../utils"),o=p("../support"),r=p("./ArrayReader"),l=p("./StringReader"),g=p("./NodeBufferReader"),b=p("./Uint8ArrayReader");O.exports=function(m){var v=h.getTypeOf(m);return h.checkSupport(v),v!=="string"||o.uint8array?v==="nodebuffer"?new g(m):o.uint8array?new b(h.transformTo("uint8array",m)):new r(h.transformTo("array",m)):new l(m)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(p,O,y){y.LOCAL_FILE_HEADER="PK",y.CENTRAL_FILE_HEADER="PK",y.CENTRAL_DIRECTORY_END="PK",y.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",y.ZIP64_CENTRAL_DIRECTORY_END="PK",y.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(p,O,y){var h=p("./GenericWorker"),o=p("../utils");function r(l){h.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(r,h),r.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},O.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(p,O,y){var h=p("./GenericWorker"),o=p("../crc32");function r(){h.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}p("../utils").inherits(r,h),r.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},O.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(p,O,y){var h=p("../utils"),o=p("./GenericWorker");function r(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}h.inherits(r,o),r.prototype.processChunk=function(l){if(l){var g=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=g+l.data.length}o.prototype.processChunk.call(this,l)},O.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(p,O,y){var h=p("../utils"),o=p("./GenericWorker");function r(l){o.call(this,"DataWorker");var g=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(b){g.dataIsReady=!0,g.data=b,g.max=b&&b.length||0,g.type=h.getTypeOf(b),g.isPaused||g._tickAndRepeat()},function(b){g.error(b)})}h.inherits(r,o),r.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,h.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(h.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,g=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,g);break;case"uint8array":l=this.data.subarray(this.index,g);break;case"array":case"nodebuffer":l=this.data.slice(this.index,g)}return this.index=g,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},O.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(p,O,y){function h(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}h.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,r){return this._listeners[o].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,r){if(this._listeners[o])for(var l=0;l "+o:o}},O.exports=h},{}],29:[function(p,O,y){var h=p("../utils"),o=p("./ConvertWorker"),r=p("./GenericWorker"),l=p("../base64"),g=p("../support"),b=p("../external"),m=null;if(g.nodestream)try{m=p("../nodejs/NodejsStreamOutputAdapter")}catch{}function v(c,n){return new b.Promise(function(u,s){var d=[],w=c._internalType,S=c._outputType,x=c._mimeType;c.on("data",function(F,B){d.push(F),n&&n(B)}).on("error",function(F){d=[],s(F)}).on("end",function(){try{var F=function(B,j,I){switch(B){case"blob":return h.newBlob(h.transformTo("arraybuffer",j),I);case"base64":return l.encode(j);default:return h.transformTo(B,j)}}(S,function(B,j){var I,M=0,V=null,_=0;for(I=0;I"u")y.blob=!1;else{var h=new ArrayBuffer(0);try{y.blob=new Blob([h],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(h),y.blob=o.getBlob("application/zip").size===0}catch{y.blob=!1}}}try{y.nodestream=!!p("readable-stream").Readable}catch{y.nodestream=!1}},{"readable-stream":16}],31:[function(p,O,y){for(var h=p("./utils"),o=p("./support"),r=p("./nodejsUtils"),l=p("./stream/GenericWorker"),g=new Array(256),b=0;b<256;b++)g[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;g[254]=g[254]=1;function m(){l.call(this,"utf-8 decode"),this.leftOver=null}function v(){l.call(this,"utf-8 encode")}y.utf8encode=function(i){return o.nodebuffer?r.newBufferFrom(i,"utf-8"):function(c){var n,u,s,d,w,S=c.length,x=0;for(d=0;d>>6:(u<65536?n[w++]=224|u>>>12:(n[w++]=240|u>>>18,n[w++]=128|u>>>12&63),n[w++]=128|u>>>6&63),n[w++]=128|63&u);return n}(i)},y.utf8decode=function(i){return o.nodebuffer?h.transformTo("nodebuffer",i).toString("utf-8"):function(c){var n,u,s,d,w=c.length,S=new Array(2*w);for(n=u=0;n>10&1023,S[u++]=56320|1023&s)}return S.length!==u&&(S.subarray?S=S.subarray(0,u):S.length=u),h.applyFromCharCode(S)}(i=h.transformTo(o.uint8array?"uint8array":"array",i))},h.inherits(m,l),m.prototype.processChunk=function(i){var c=h.transformTo(o.uint8array?"uint8array":"array",i.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var n=c;(c=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),c.set(n,this.leftOver.length)}else c=this.leftOver.concat(c);this.leftOver=null}var u=function(d,w){var S;for((w=w||d.length)>d.length&&(w=d.length),S=w-1;0<=S&&(192&d[S])==128;)S--;return S<0||S===0?w:S+g[d[S]]>w?S:w}(c),s=c;u!==c.length&&(o.uint8array?(s=c.subarray(0,u),this.leftOver=c.subarray(u,c.length)):(s=c.slice(0,u),this.leftOver=c.slice(u,c.length))),this.push({data:y.utf8decode(s),meta:i.meta})},m.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:y.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},y.Utf8DecodeWorker=m,h.inherits(v,l),v.prototype.processChunk=function(i){this.push({data:y.utf8encode(i.data),meta:i.meta})},y.Utf8EncodeWorker=v},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(p,O,y){var h=p("./support"),o=p("./base64"),r=p("./nodejsUtils"),l=p("./external");function g(n){return n}function b(n,u){for(var s=0;s>8;this.dir=!!(16&this.externalFileAttributes),i==0&&(this.dosPermissions=63&this.externalFileAttributes),i==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var i=h(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=i.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=i.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=i.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=i.readInt(4))}},readExtraFields:function(i){var c,n,u,s=i.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});i.index+4>>6:(i<65536?v[u++]=224|i>>>12:(v[u++]=240|i>>>18,v[u++]=128|i>>>12&63),v[u++]=128|i>>>6&63),v[u++]=128|63&i);return v},y.buf2binstring=function(m){return b(m,m.length)},y.binstring2buf=function(m){for(var v=new h.Buf8(m.length),i=0,c=v.length;i>10&1023,d[c++]=56320|1023&n)}return b(d,c)},y.utf8border=function(m,v){var i;for((v=v||m.length)>m.length&&(v=m.length),i=v-1;0<=i&&(192&m[i])==128;)i--;return i<0||i===0?v:i+l[m[i]]>v?i:v}},{"./common":41}],43:[function(p,O,y){O.exports=function(h,o,r,l){for(var g=65535&h|0,b=h>>>16&65535|0,m=0;r!==0;){for(r-=m=2e3>>1:o>>>1;r[l]=o}return r}();O.exports=function(o,r,l,g){var b=h,m=g+l;o^=-1;for(var v=g;v>>8^b[255&(o^r[v])];return-1^o}},{}],46:[function(p,O,y){var h,o=p("../utils/common"),r=p("./trees"),l=p("./adler32"),g=p("./crc32"),b=p("./messages"),m=0,v=4,i=0,c=-2,n=-1,u=4,s=2,d=8,w=9,S=286,x=30,F=19,B=2*S+1,j=15,I=3,M=258,V=M+I+1,_=42,T=113,e=1,D=2,q=3,U=4;function Q(t,R){return t.msg=b[R],R}function L(t){return(t<<1)-(4t.avail_out&&(A=t.avail_out),A!==0&&(o.arraySet(t.output,R.pending_buf,R.pending_out,A,t.next_out),t.next_out+=A,R.pending_out+=A,t.total_out+=A,t.avail_out-=A,R.pending-=A,R.pending===0&&(R.pending_out=0))}function C(t,R){r._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,R),t.block_start=t.strstart,E(t.strm)}function Y(t,R){t.pending_buf[t.pending++]=R}function G(t,R){t.pending_buf[t.pending++]=R>>>8&255,t.pending_buf[t.pending++]=255&R}function H(t,R){var A,f,a=t.max_chain_length,k=t.strstart,N=t.prev_length,P=t.nice_match,z=t.strstart>t.w_size-V?t.strstart-(t.w_size-V):0,Z=t.window,K=t.w_mask,W=t.prev,X=t.strstart+M,it=Z[k+N-1],et=Z[k+N];t.prev_length>=t.good_match&&(a>>=2),P>t.lookahead&&(P=t.lookahead);do if(Z[(A=R)+N]===et&&Z[A+N-1]===it&&Z[A]===Z[k]&&Z[++A]===Z[k+1]){k+=2,A++;do;while(Z[++k]===Z[++A]&&Z[++k]===Z[++A]&&Z[++k]===Z[++A]&&Z[++k]===Z[++A]&&Z[++k]===Z[++A]&&Z[++k]===Z[++A]&&Z[++k]===Z[++A]&&Z[++k]===Z[++A]&&kz&&--a!=0);return N<=t.lookahead?N:t.lookahead}function st(t){var R,A,f,a,k,N,P,z,Z,K,W=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=W+(W-V)){for(o.arraySet(t.window,t.window,W,W,0),t.match_start-=W,t.strstart-=W,t.block_start-=W,R=A=t.hash_size;f=t.head[--R],t.head[R]=W<=f?f-W:0,--A;);for(R=A=W;f=t.prev[--R],t.prev[R]=W<=f?f-W:0,--A;);a+=W}if(t.strm.avail_in===0)break;if(N=t.strm,P=t.window,z=t.strstart+t.lookahead,Z=a,K=void 0,K=N.avail_in,Z=I)for(k=t.strstart-t.insert,t.ins_h=t.window[k],t.ins_h=(t.ins_h<=I&&(t.ins_h=(t.ins_h<=I)if(f=r._tr_tally(t,t.strstart-t.match_start,t.match_length-I),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=I){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=I&&(t.ins_h=(t.ins_h<=I&&t.match_length<=t.prev_length){for(a=t.strstart+t.lookahead-I,f=r._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-I),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=a&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(A=t.pending_buf_size-5);;){if(t.lookahead<=1){if(st(t),t.lookahead===0&&R===m)return e;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var f=t.block_start+A;if((t.strstart===0||t.strstart>=f)&&(t.lookahead=t.strstart-f,t.strstart=f,C(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-V&&(C(t,!1),t.strm.avail_out===0))return e}return t.insert=0,R===v?(C(t,!0),t.strm.avail_out===0?q:U):(t.strstart>t.block_start&&(C(t,!1),t.strm.avail_out),e)}),new nt(4,4,8,4,lt),new nt(4,5,16,8,lt),new nt(4,6,32,32,lt),new nt(4,4,16,16,tt),new nt(8,16,32,32,tt),new nt(8,16,128,128,tt),new nt(8,32,128,256,tt),new nt(32,128,258,1024,tt),new nt(32,258,258,4096,tt)],y.deflateInit=function(t,R){return ft(t,R,d,15,8,0)},y.deflateInit2=ft,y.deflateReset=ct,y.deflateResetKeep=at,y.deflateSetHeader=function(t,R){return t&&t.state?t.state.wrap!==2?c:(t.state.gzhead=R,i):c},y.deflate=function(t,R){var A,f,a,k;if(!t||!t.state||5>8&255),Y(f,f.gzhead.time>>16&255),Y(f,f.gzhead.time>>24&255),Y(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),Y(f,255&f.gzhead.os),f.gzhead.extra&&f.gzhead.extra.length&&(Y(f,255&f.gzhead.extra.length),Y(f,f.gzhead.extra.length>>8&255)),f.gzhead.hcrc&&(t.adler=g(t.adler,f.pending_buf,f.pending,0)),f.gzindex=0,f.status=69):(Y(f,0),Y(f,0),Y(f,0),Y(f,0),Y(f,0),Y(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),Y(f,3),f.status=T);else{var N=d+(f.w_bits-8<<4)<<8;N|=(2<=f.strategy||f.level<2?0:f.level<6?1:f.level===6?2:3)<<6,f.strstart!==0&&(N|=32),N+=31-N%31,f.status=T,G(f,N),f.strstart!==0&&(G(f,t.adler>>>16),G(f,65535&t.adler)),t.adler=1}if(f.status===69)if(f.gzhead.extra){for(a=f.pending;f.gzindex<(65535&f.gzhead.extra.length)&&(f.pending!==f.pending_buf_size||(f.gzhead.hcrc&&f.pending>a&&(t.adler=g(t.adler,f.pending_buf,f.pending-a,a)),E(t),a=f.pending,f.pending!==f.pending_buf_size));)Y(f,255&f.gzhead.extra[f.gzindex]),f.gzindex++;f.gzhead.hcrc&&f.pending>a&&(t.adler=g(t.adler,f.pending_buf,f.pending-a,a)),f.gzindex===f.gzhead.extra.length&&(f.gzindex=0,f.status=73)}else f.status=73;if(f.status===73)if(f.gzhead.name){a=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>a&&(t.adler=g(t.adler,f.pending_buf,f.pending-a,a)),E(t),a=f.pending,f.pending===f.pending_buf_size)){k=1;break}k=f.gzindexa&&(t.adler=g(t.adler,f.pending_buf,f.pending-a,a)),k===0&&(f.gzindex=0,f.status=91)}else f.status=91;if(f.status===91)if(f.gzhead.comment){a=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>a&&(t.adler=g(t.adler,f.pending_buf,f.pending-a,a)),E(t),a=f.pending,f.pending===f.pending_buf_size)){k=1;break}k=f.gzindexa&&(t.adler=g(t.adler,f.pending_buf,f.pending-a,a)),k===0&&(f.status=103)}else f.status=103;if(f.status===103&&(f.gzhead.hcrc?(f.pending+2>f.pending_buf_size&&E(t),f.pending+2<=f.pending_buf_size&&(Y(f,255&t.adler),Y(f,t.adler>>8&255),t.adler=0,f.status=T)):f.status=T),f.pending!==0){if(E(t),t.avail_out===0)return f.last_flush=-1,i}else if(t.avail_in===0&&L(R)<=L(A)&&R!==v)return Q(t,-5);if(f.status===666&&t.avail_in!==0)return Q(t,-5);if(t.avail_in!==0||f.lookahead!==0||R!==m&&f.status!==666){var P=f.strategy===2?function(z,Z){for(var K;;){if(z.lookahead===0&&(st(z),z.lookahead===0)){if(Z===m)return e;break}if(z.match_length=0,K=r._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,K&&(C(z,!1),z.strm.avail_out===0))return e}return z.insert=0,Z===v?(C(z,!0),z.strm.avail_out===0?q:U):z.last_lit&&(C(z,!1),z.strm.avail_out===0)?e:D}(f,R):f.strategy===3?function(z,Z){for(var K,W,X,it,et=z.window;;){if(z.lookahead<=M){if(st(z),z.lookahead<=M&&Z===m)return e;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=I&&0z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=I?(K=r._tr_tally(z,1,z.match_length-I),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(K=r._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),K&&(C(z,!1),z.strm.avail_out===0))return e}return z.insert=0,Z===v?(C(z,!0),z.strm.avail_out===0?q:U):z.last_lit&&(C(z,!1),z.strm.avail_out===0)?e:D}(f,R):h[f.level].func(f,R);if(P!==q&&P!==U||(f.status=666),P===e||P===q)return t.avail_out===0&&(f.last_flush=-1),i;if(P===D&&(R===1?r._tr_align(f):R!==5&&(r._tr_stored_block(f,0,0,!1),R===3&&(J(f.head),f.lookahead===0&&(f.strstart=0,f.block_start=0,f.insert=0))),E(t),t.avail_out===0))return f.last_flush=-1,i}return R!==v?i:f.wrap<=0?1:(f.wrap===2?(Y(f,255&t.adler),Y(f,t.adler>>8&255),Y(f,t.adler>>16&255),Y(f,t.adler>>24&255),Y(f,255&t.total_in),Y(f,t.total_in>>8&255),Y(f,t.total_in>>16&255),Y(f,t.total_in>>24&255)):(G(f,t.adler>>>16),G(f,65535&t.adler)),E(t),0=A.w_size&&(k===0&&(J(A.head),A.strstart=0,A.block_start=0,A.insert=0),Z=new o.Buf8(A.w_size),o.arraySet(Z,R,K-A.w_size,A.w_size,0),R=Z,K=A.w_size),N=t.avail_in,P=t.next_in,z=t.input,t.avail_in=K,t.next_in=0,t.input=R,st(A);A.lookahead>=I;){for(f=A.strstart,a=A.lookahead-(I-1);A.ins_h=(A.ins_h<>>=I=j>>>24,w-=I,(I=j>>>16&255)===0)D[b++]=65535&j;else{if(!(16&I)){if(!(64&I)){j=S[(65535&j)+(d&(1<>>=I,w-=I),w<15&&(d+=e[l++]<>>=I=j>>>24,w-=I,!(16&(I=j>>>16&255))){if(!(64&I)){j=x[(65535&j)+(d&(1<>>=I,w-=I,(I=b-m)>3,d&=(1<<(w-=M<<3))-1,h.next_in=l,h.next_out=b,h.avail_in=l>>24&255)+(_>>>8&65280)+((65280&_)<<8)+((255&_)<<24)}function d(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new h.Buf16(320),this.work=new h.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(_){var T;return _&&_.state?(T=_.state,_.total_in=_.total_out=T.total=0,_.msg="",T.wrap&&(_.adler=1&T.wrap),T.mode=c,T.last=0,T.havedict=0,T.dmax=32768,T.head=null,T.hold=0,T.bits=0,T.lencode=T.lendyn=new h.Buf32(n),T.distcode=T.distdyn=new h.Buf32(u),T.sane=1,T.back=-1,v):i}function S(_){var T;return _&&_.state?((T=_.state).wsize=0,T.whave=0,T.wnext=0,w(_)):i}function x(_,T){var e,D;return _&&_.state?(D=_.state,T<0?(e=0,T=-T):(e=1+(T>>4),T<48&&(T&=15)),T&&(T<8||15=U.wsize?(h.arraySet(U.window,T,e-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(D<(q=U.wsize-U.wnext)&&(q=D),h.arraySet(U.window,T,e-D,q,U.wnext),(D-=q)?(h.arraySet(U.window,T,e-D,D,0),U.wnext=D,U.whave=U.wsize):(U.wnext+=q,U.wnext===U.wsize&&(U.wnext=0),U.whave>>8&255,e.check=r(e.check,k,2,0),C=E=0,e.mode=2;break}if(e.flags=0,e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&E)<<8)+(E>>8))%31){_.msg="incorrect header check",e.mode=30;break}if((15&E)!=8){_.msg="unknown compression method",e.mode=30;break}if(C-=4,t=8+(15&(E>>>=4)),e.wbits===0)e.wbits=t;else if(t>e.wbits){_.msg="invalid window size",e.mode=30;break}e.dmax=1<>8&1),512&e.flags&&(k[0]=255&E,k[1]=E>>>8&255,e.check=r(e.check,k,2,0)),C=E=0,e.mode=3;case 3:for(;C<32;){if(L===0)break t;L--,E+=D[U++]<>>8&255,k[2]=E>>>16&255,k[3]=E>>>24&255,e.check=r(e.check,k,4,0)),C=E=0,e.mode=4;case 4:for(;C<16;){if(L===0)break t;L--,E+=D[U++]<>8),512&e.flags&&(k[0]=255&E,k[1]=E>>>8&255,e.check=r(e.check,k,2,0)),C=E=0,e.mode=5;case 5:if(1024&e.flags){for(;C<16;){if(L===0)break t;L--,E+=D[U++]<>>8&255,e.check=r(e.check,k,2,0)),C=E=0}else e.head&&(e.head.extra=null);e.mode=6;case 6:if(1024&e.flags&&(L<(H=e.length)&&(H=L),H&&(e.head&&(t=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Array(e.head.extra_len)),h.arraySet(e.head.extra,D,U,H,t)),512&e.flags&&(e.check=r(e.check,D,H,U)),L-=H,U+=H,e.length-=H),e.length))break t;e.length=0,e.mode=7;case 7:if(2048&e.flags){if(L===0)break t;for(H=0;t=D[U+H++],e.head&&t&&e.length<65536&&(e.head.name+=String.fromCharCode(t)),t&&H>9&1,e.head.done=!0),_.adler=e.check=0,e.mode=12;break;case 10:for(;C<32;){if(L===0)break t;L--,E+=D[U++]<>>=7&C,C-=7&C,e.mode=27;break}for(;C<3;){if(L===0)break t;L--,E+=D[U++]<>>=1)){case 0:e.mode=14;break;case 1:if(M(e),e.mode=20,T!==6)break;E>>>=2,C-=2;break t;case 2:e.mode=17;break;case 3:_.msg="invalid block type",e.mode=30}E>>>=2,C-=2;break;case 14:for(E>>>=7&C,C-=7&C;C<32;){if(L===0)break t;L--,E+=D[U++]<>>16^65535)){_.msg="invalid stored block lengths",e.mode=30;break}if(e.length=65535&E,C=E=0,e.mode=15,T===6)break t;case 15:e.mode=16;case 16:if(H=e.length){if(L>>=5,C-=5,e.ndist=1+(31&E),E>>>=5,C-=5,e.ncode=4+(15&E),E>>>=4,C-=4,286>>=3,C-=3}for(;e.have<19;)e.lens[N[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,A={bits:e.lenbits},R=g(0,e.lens,0,19,e.lencode,0,e.work,A),e.lenbits=A.bits,R){_.msg="invalid code lengths set",e.mode=30;break}e.have=0,e.mode=19;case 19:for(;e.have>>16&255,ht=65535&a,!((tt=a>>>24)<=C);){if(L===0)break t;L--,E+=D[U++]<>>=tt,C-=tt,e.lens[e.have++]=ht;else{if(ht===16){for(f=tt+2;C>>=tt,C-=tt,e.have===0){_.msg="invalid bit length repeat",e.mode=30;break}t=e.lens[e.have-1],H=3+(3&E),E>>>=2,C-=2}else if(ht===17){for(f=tt+3;C>>=tt)),E>>>=3,C-=3}else{for(f=tt+7;C>>=tt)),E>>>=7,C-=7}if(e.have+H>e.nlen+e.ndist){_.msg="invalid bit length repeat",e.mode=30;break}for(;H--;)e.lens[e.have++]=t}}if(e.mode===30)break;if(e.lens[256]===0){_.msg="invalid code -- missing end-of-block",e.mode=30;break}if(e.lenbits=9,A={bits:e.lenbits},R=g(b,e.lens,0,e.nlen,e.lencode,0,e.work,A),e.lenbits=A.bits,R){_.msg="invalid literal/lengths set",e.mode=30;break}if(e.distbits=6,e.distcode=e.distdyn,A={bits:e.distbits},R=g(m,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,A),e.distbits=A.bits,R){_.msg="invalid distances set",e.mode=30;break}if(e.mode=20,T===6)break t;case 20:e.mode=21;case 21:if(6<=L&&258<=J){_.next_out=Q,_.avail_out=J,_.next_in=U,_.avail_in=L,e.hold=E,e.bits=C,l(_,G),Q=_.next_out,q=_.output,J=_.avail_out,U=_.next_in,D=_.input,L=_.avail_in,E=e.hold,C=e.bits,e.mode===12&&(e.back=-1);break}for(e.back=0;nt=(a=e.lencode[E&(1<>>16&255,ht=65535&a,!((tt=a>>>24)<=C);){if(L===0)break t;L--,E+=D[U++]<>at)])>>>16&255,ht=65535&a,!(at+(tt=a>>>24)<=C);){if(L===0)break t;L--,E+=D[U++]<>>=at,C-=at,e.back+=at}if(E>>>=tt,C-=tt,e.back+=tt,e.length=ht,nt===0){e.mode=26;break}if(32&nt){e.back=-1,e.mode=12;break}if(64&nt){_.msg="invalid literal/length code",e.mode=30;break}e.extra=15&nt,e.mode=22;case 22:if(e.extra){for(f=e.extra;C>>=e.extra,C-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=23;case 23:for(;nt=(a=e.distcode[E&(1<>>16&255,ht=65535&a,!((tt=a>>>24)<=C);){if(L===0)break t;L--,E+=D[U++]<>at)])>>>16&255,ht=65535&a,!(at+(tt=a>>>24)<=C);){if(L===0)break t;L--,E+=D[U++]<>>=at,C-=at,e.back+=at}if(E>>>=tt,C-=tt,e.back+=tt,64&nt){_.msg="invalid distance code",e.mode=30;break}e.offset=ht,e.extra=15&nt,e.mode=24;case 24:if(e.extra){for(f=e.extra;C>>=e.extra,C-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){_.msg="invalid distance too far back",e.mode=30;break}e.mode=25;case 25:if(J===0)break t;if(H=G-J,e.offset>H){if((H=e.offset-H)>e.whave&&e.sane){_.msg="invalid distance too far back",e.mode=30;break}st=H>e.wnext?(H-=e.wnext,e.wsize-H):e.wnext-H,H>e.length&&(H=e.length),lt=e.window}else lt=q,st=Q-e.offset,H=e.length;for(JB?(I=st[lt+u[T]],C[Y+u[T]]):(I=96,0),d=1<<_-Q,e=w=1<>Q)+(w-=d)]=j<<24|I<<16|M|0,w!==0;);for(d=1<<_-1;E&d;)d>>=1;if(d!==0?(E&=d-1,E+=d):E=0,T++,--G[_]==0){if(_===D)break;_=m[v+u[T]]}if(q<_&&(E&x)!==S){for(Q===0&&(Q=q),F+=e,L=1<<(U=_-Q);U+Q>>7)]}function Y(a,k){a.pending_buf[a.pending++]=255&k,a.pending_buf[a.pending++]=k>>>8&255}function G(a,k,N){a.bi_valid>s-N?(a.bi_buf|=k<>s-a.bi_valid,a.bi_valid+=N-s):(a.bi_buf|=k<>>=1,N<<=1,0<--k;);return N>>>1}function lt(a,k,N){var P,z,Z=new Array(u+1),K=0;for(P=1;P<=u;P++)Z[P]=K=K+N[P-1]<<1;for(z=0;z<=k;z++){var W=a[2*z+1];W!==0&&(a[2*z]=st(Z[W]++,W))}}function tt(a){var k;for(k=0;k>1;1<=N;N--)at(a,Z,N);for(z=X;N=a.heap[1],a.heap[1]=a.heap[a.heap_len--],at(a,Z,1),P=a.heap[1],a.heap[--a.heap_max]=N,a.heap[--a.heap_max]=P,Z[2*z]=Z[2*N]+Z[2*P],a.depth[z]=(a.depth[N]>=a.depth[P]?a.depth[N]:a.depth[P])+1,Z[2*N+1]=Z[2*P+1]=z,a.heap[1]=z++,at(a,Z,1),2<=a.heap_len;);a.heap[--a.heap_max]=a.heap[1],function(et,ut){var gt,dt,vt,ot,wt,Ct,mt=ut.dyn_tree,It=ut.max_code,Zt=ut.stat_desc.static_tree,Wt=ut.stat_desc.has_stree,Mt=ut.stat_desc.extra_bits,Ot=ut.stat_desc.extra_base,bt=ut.stat_desc.max_length,kt=0;for(ot=0;ot<=u;ot++)et.bl_count[ot]=0;for(mt[2*et.heap[et.heap_max]+1]=0,gt=et.heap_max+1;gt>=7;z>>=1)if(1&it&&W.dyn_ltree[2*X]!==0)return o;if(W.dyn_ltree[18]!==0||W.dyn_ltree[20]!==0||W.dyn_ltree[26]!==0)return r;for(X=32;X>>3,(Z=a.static_len+3+7>>>3)<=z&&(z=Z)):z=Z=N+5,N+4<=z&&k!==-1?f(a,k,N,P):a.strategy===4||Z===z?(G(a,2+(P?1:0),3),ct(a,V,_)):(G(a,4+(P?1:0),3),function(W,X,it,et){var ut;for(G(W,X-257,5),G(W,it-1,5),G(W,et-4,4),ut=0;ut>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&k,a.pending_buf[a.l_buf+a.last_lit]=255&N,a.last_lit++,k===0?a.dyn_ltree[2*N]++:(a.matches++,k--,a.dyn_ltree[2*(e[N]+m+1)]++,a.dyn_dtree[2*C(k)]++),a.last_lit===a.lit_bufsize-1},y._tr_align=function(a){G(a,2,3),H(a,w,V),function(k){k.bi_valid===16?(Y(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)}(a)}},{"../utils/common":41}],53:[function(p,O,y){O.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(p,O,y){(function(h){(function(o,r){if(!o.setImmediate){var l,g,b,m,v=1,i={},c=!1,n=o.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(o);u=u&&u.setTimeout?u:o,l={}.toString.call(o.process)==="[object process]"?function(S){process.nextTick(function(){d(S)})}:function(){if(o.postMessage&&!o.importScripts){var S=!0,x=o.onmessage;return o.onmessage=function(){S=!1},o.postMessage("","*"),o.onmessage=x,S}}()?(m="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(S){o.postMessage(m+S,"*")}):o.MessageChannel?((b=new MessageChannel).port1.onmessage=function(S){d(S.data)},function(S){b.port2.postMessage(S)}):n&&"onreadystatechange"in n.createElement("script")?(g=n.documentElement,function(S){var x=n.createElement("script");x.onreadystatechange=function(){d(S),x.onreadystatechange=null,g.removeChild(x),x=null},g.appendChild(x)}):function(S){setTimeout(d,0,S)},u.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var x=new Array(arguments.length-1),F=0;F"u"?h===void 0?this:h:self)}).call(this,typeof _t<"u"?_t:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Et);var Tt=Et.exports;const At=Bt(Tt),Rt=["Folder","Placemark","Point","coordinates","Polygon","outerBoundaryIs","LinearRing"],Dt=["Placemark","actionGroup","action"],xt=($,rt)=>{const p=$.nodeName.replace("wpml:","");if(!$.childNodes.length)rt[p]=void 0;else if($.childNodes[0].nodeType===Node.TEXT_NODE)rt[p]=$.childNodes[0].nodeValue;else{Dt.includes(p)?rt[p]?.length?rt[p].push({}):rt[p]=[{}]:rt[p]={};for(const O of $.childNodes)xt(O,Array.isArray(rt[p])?rt[p].at(-1):rt[p])}},Ft=async $=>{let rt;$ instanceof Response?rt=await $.text():rt=$,rt=rt.replaceAll(` `,"").replaceAll(" ","").replace(/((?<=>)\x20)|(\x20(?=<))|((?<=\x20)\x20)|(\x20(?=\x20))/g,"");const O=new DOMParser().parseFromString(rt,"text/xml"),y={};return xt(O,y),Promise.resolve(y["#document"].kml.Document)},Nt=async $=>{let rt;if($ instanceof Response)rt=await $.blob();else if($ instanceof Blob)rt=$;else return Promise.reject("zip is missing");if(rt){const p={};let O;try{O=await At.loadAsync(rt)}catch{return Promise.reject("zip is missing")}const y=[];return O.forEach((h,o)=>{o.dir||y.push(O.file(o.name).async("string").then(r=>r.replaceAll(` `,"").replaceAll(" ","").replace(/((?<=>)\x20)|(\x20(?=<))|((?<=\x20)\x20)|(\x20(?=\x20))/g,"")).then(r=>{const g=new DOMParser().parseFromString(r,"text/xml"),b={};xt(g,b);const m=o.name.replace("wpmz/","").split(".")[0];Object.assign(p,{[m]:b["#document"].kml.Document})}))}),await Promise.all(y),Promise.resolve(p)}else return Promise.reject("zip is missing")},Pt=$=>typeof $=="string",Ut=$=>Array.isArray($),jt=$=>!Array.isArray($)&&typeof $=="object",St=($,rt)=>{const p=new Document;for(let O in rt){const y=Rt.includes(O)?O:`wpml:${O}`;if(Pt(rt[O])){const h=p.createElement(y),o=p.createTextNode(rt[O]);h.appendChild(o),$.appendChild(h)}else if(Ut(rt[O]))for(let h in rt[O]){const o=p.createElement(y);$.appendChild(o),St(o,rt[O][h])}else if(jt(rt[O])){const h=p.createElement(y);$.appendChild(h),St(h,rt[O])}}},zt=$=>{const p=new DOMParser().parseFromString('',"text/xml");return p.childNodes[0].appendChild(p.createElement("Document")),St(p.childNodes[0].childNodes[0],$),p},Lt=async $=>{try{const rt=zt($.template),p=zt($.waylines),O=new XMLSerializer,y=O.serializeToString(rt),h=O.serializeToString(p),o=new At;o.folder("wpmz").file("template.kml",y),o.folder("wpmz").file("waylines.wpml",h);const r=await o.generateAsync({type:"blob"});return Promise.resolve(r)}catch{return Promise.reject("something error")}};pt.jsonToKmz=Lt,pt.jsonToXml=zt,pt.kmzToJson=Nt,pt.xmlToJson=Ft,Object.defineProperty(pt,Symbol.toStringTag,{value:"Module"})});