!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t()
else if("function"==typeof define&&define.amd)define([],t)
else{var i=t()
for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(global,(()=>(()=>{var e={964:(e,t,i)=>{const n=i(716).buildOptions
const r={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataTagName:!1,cdataPositionChar:"\\c",format:!1,indentBy:"  ",supressEmptyNode:!1,tagValueProcessor:function(e){return e},attrValueProcessor:function(e){return e}}
const o=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","cdataTagName","cdataPositionChar","format","indentBy","supressEmptyNode","tagValueProcessor","attrValueProcessor","rootNodeName"]
function s(e){this.options=n(e,r,o)
if(this.options.ignoreAttributes||this.options.attrNodeName)this.isAttribute=function(){return!1}
else{this.attrPrefixLen=this.options.attributeNamePrefix.length
this.isAttribute=h}this.options.cdataTagName?this.isCDATA=g:this.isCDATA=function(){return!1}
this.replaceCDATAstr=c
this.replaceCDATAarr=f
this.processTextOrObjNode=a
if(this.options.format){this.indentate=d
this.tagEndChar=">\n"
this.newLine="\n"}else{this.indentate=function(){return""}
this.tagEndChar=">"
this.newLine=""}if(this.options.supressEmptyNode){this.buildTextNode=m
this.buildObjNode=u}else{this.buildTextNode=p
this.buildObjNode=l}this.buildTextValNode=p
this.buildObjectNode=l}s.prototype.parse=function(e){Array.isArray(e)&&this.options.rootNodeName&&this.options.rootNodeName.length>1&&(e={[this.options.rootNodeName]:e})
return this.j2x(e,0).val}
s.prototype.j2x=function(e,t){let i=""
let n=""
for(let r in e)if(void 0===e[r]);else if(null===e[r])n+=this.indentate(t)+"<"+r+"/"+this.tagEndChar
else if(e[r]instanceof Date)n+=this.buildTextNode(e[r],r,"",t)
else if("object"!=typeof e[r]){const o=this.isAttribute(r)
o?i+=" "+o+'="'+this.options.attrValueProcessor(""+e[r])+'"':this.isCDATA(r)?e[this.options.textNodeName]?n+=this.replaceCDATAstr(e[this.options.textNodeName],e[r]):n+=this.replaceCDATAstr("",e[r]):r===this.options.textNodeName?e[this.options.cdataTagName]||(n+=this.options.tagValueProcessor(""+e[r])):n+=this.buildTextNode(e[r],r,"",t)}else if(Array.isArray(e[r]))if(this.isCDATA(r)){n+=this.indentate(t)
e[this.options.textNodeName]?n+=this.replaceCDATAarr(e[this.options.textNodeName],e[r]):n+=this.replaceCDATAarr("",e[r])}else{const i=e[r].length
for(let o=0;o<i;o++){const i=e[r][o]
void 0===i||(n+=null===i?this.indentate(t)+"<"+r+"/"+this.tagEndChar:"object"==typeof i?this.processTextOrObjNode(i,r,t):this.buildTextNode(i,r,"",t))}}else if(this.options.attrNodeName&&r===this.options.attrNodeName){const t=Object.keys(e[r])
const n=t.length
for(let o=0;o<n;o++)i+=" "+t[o]+'="'+this.options.attrValueProcessor(""+e[r][t[o]])+'"'}else n+=this.processTextOrObjNode(e[r],r,t)
return{attrStr:i,val:n}}
function a(e,t,i){const n=this.j2x(e,i+1)
return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextNode(n.val,t,n.attrStr,i):this.buildObjNode(n.val,t,n.attrStr,i)}function c(e,t){e=this.options.tagValueProcessor(""+e)
return""===this.options.cdataPositionChar||""===e?e+"<![CDATA["+t+"]]"+this.tagEndChar:e.replace(this.options.cdataPositionChar,"<![CDATA["+t+"]]"+this.tagEndChar)}function f(e,t){e=this.options.tagValueProcessor(""+e)
if(""===this.options.cdataPositionChar||""===e)return e+"<![CDATA["+t.join("]]><![CDATA[")+"]]"+this.tagEndChar
for(let i in t)e=e.replace(this.options.cdataPositionChar,"<![CDATA["+t[i]+"]]>")
return e+this.newLine}function l(e,t,i,n){return i&&-1===e.indexOf("<")?this.indentate(n)+"<"+t+i+">"+e+"</"+t+this.tagEndChar:this.indentate(n)+"<"+t+i+this.tagEndChar+e+this.indentate(n)+"</"+t+this.tagEndChar}function u(e,t,i,n){return""!==e?this.buildObjectNode(e,t,i,n):this.indentate(n)+"<"+t+i+"/"+this.tagEndChar}function p(e,t,i,n){return this.indentate(n)+"<"+t+i+">"+this.options.tagValueProcessor(e)+"</"+t+this.tagEndChar}function m(e,t,i,n){return""!==e?this.buildTextValNode(e,t,i,n):this.indentate(n)+"<"+t+i+"/"+this.tagEndChar}function d(e){return this.options.indentBy.repeat(e)}function h(e){return!!e.startsWith(this.options.attributeNamePrefix)&&e.substr(this.attrPrefixLen)}function g(e){return e===this.options.cdataTagName}e.exports=s},521:(e,t,i)=>{const n=function(e){return String.fromCharCode(e)}
const r={nilChar:n(176),missingChar:n(201),nilPremitive:n(175),missingPremitive:n(200),emptyChar:n(178),emptyValue:n(177),boundryChar:n(179),objStart:n(198),arrStart:n(204),arrayEnd:n(185)}
const o=[r.nilChar,r.nilPremitive,r.missingChar,r.missingPremitive,r.boundryChar,r.emptyChar,r.emptyValue,r.arrayEnd,r.objStart,r.arrStart]
const s=function(e,t,i){if("string"==typeof t)return e&&e[0]&&void 0!==e[0].val?a(e[0].val,t):a(e,t)
{const o=void 0===(n=e)?r.missingChar:null===n?r.nilChar:!(n.child&&0===Object.keys(n.child).length&&(!n.attrsMap||0===Object.keys(n.attrsMap).length))||r.emptyChar
if(!0===o){let n=""
if(Array.isArray(t)){n+=r.arrStart
const o=t[0]
const f=e.length
if("string"==typeof o)for(let t=0;t<f;t++){const i=a(e[t].val,o)
n=c(n,i)}else for(let t=0;t<f;t++){const r=s(e[t],o,i)
n=c(n,r)}n+=r.arrayEnd}else{n+=r.objStart
const o=Object.keys(t)
Array.isArray(e)&&(e=e[0])
for(let r in o){const a=o[r]
let f
f=!i.ignoreAttributes&&e.attrsMap&&e.attrsMap[a]?s(e.attrsMap[a],t[a],i):a===i.textNodeName?s(e.val,t[a],i):s(e.child[a],t[a],i)
n=c(n,f)}}return n}return o}var n}
const a=function(e){switch(e){case void 0:return r.missingPremitive
case null:return r.nilPremitive
case"":return r.emptyValue
default:return e}}
const c=function(e,t){f(t[0])||f(e[e.length-1])||(e+=r.boundryChar)
return e+t}
const f=function(e){return-1!==o.indexOf(e)}
const l=i(912)
const u=i(716).buildOptions
t.convert2nimn=function(e,t,i){i=u(i,l.defaultOptions,l.props)
return s(e,t,i)}},259:(e,t,i)=>{const n=i(716)
const r=function(e,t,i){const o={}
if(!t.alwaysCreateTextNode&&(!e.child||n.isEmptyObject(e.child))&&(!e.attrsMap||n.isEmptyObject(e.attrsMap)))return n.isExist(e.val)?e.val:""
if(n.isExist(e.val)&&("string"!=typeof e.val||""!==e.val&&e.val!==t.cdataPositionChar)){const r=n.isTagNameInArrayMode(e.tagname,t.arrayMode,i)
o[t.textNodeName]=r?[e.val]:e.val}n.merge(o,e.attrsMap,t.arrayMode)
const s=Object.keys(e.child)
for(let a=0;a<s.length;a++){const c=s[a]
if(e.child[c]&&e.child[c].length>1){o[c]=[]
for(let i in e.child[c])e.child[c].hasOwnProperty(i)&&o[c].push(r(e.child[c][i],t,c))}else{const s=r(e.child[c][0],t,c)
const a=!0===t.arrayMode&&"object"==typeof s||n.isTagNameInArrayMode(c,t.arrayMode,i)
o[c]=a?[s]:s}}return o}
t.convertToJson=r},159:(e,t,i)=>{const n=i(716)
const r=i(716).buildOptions
const o=i(912)
const s=function(e,t,i){let r="{"
const o=Object.keys(e.child)
for(let i=0;i<o.length;i++){const n=o[i]
if(e.child[n]&&e.child[n].length>1){r+='"'+n+'" : [ '
for(let i in e.child[n])r+=s(e.child[n][i],t)+" , "
r=r.substr(0,r.length-1)+" ] "}else r+='"'+n+'" : '+s(e.child[n][0],t)+" ,"}n.merge(r,e.attrsMap)
if(n.isEmptyObject(r))return n.isExist(e.val)?e.val:""
n.isExist(e.val)&&("string"!=typeof e.val||""!==e.val&&e.val!==t.cdataPositionChar)&&(r+='"'+t.textNodeName+'" : '+(!0!==(a=e.val)&&!1!==a&&isNaN(a)?'"'+a+'"':a))
var a
","===r[r.length-1]&&(r=r.substr(0,r.length-2))
return r+"}"}
t.convertToJsonString=function(e,t){(t=r(t,o.defaultOptions,o.props)).indentBy=t.indentBy||""
return s(e,t,0)}},993:(e,t,i)=>{const n=i(259)
const r=i(912)
const o=i(912)
const s=i(716).buildOptions
const a=i(130)
t.parse=function(e,t={},i){if(i){!0===i&&(i={})
const t=a.validate(e,i)
if(!0!==t)throw Error(t.err.msg)}t.parseTrueNumberOnly&&!1!==t.parseNodeValue&&!t.numParseOptions&&(t.numParseOptions={leadingZeros:!1})
let c=s(t,o.defaultOptions,o.props)
const f=r.getTraversalObj(e,c)
return n.convertToJson(f,c)}
t.convertTonimn=i(521).convert2nimn
t.getTraversalObj=r.getTraversalObj
t.convertToJson=n.convertToJson
t.convertToJsonString=i(159).convertToJsonString
t.validate=a.validate
t.j2xParser=i(964)
t.parseToNimn=function(e,i,n){return t.convertTonimn(t.getTraversalObj(e,n),i,n)}},716:(e,t)=>{const i=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"
const n="["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*"
const r=new RegExp("^"+n+"$")
t.isExist=function(e){return void 0!==e}
t.isEmptyObject=function(e){return 0===Object.keys(e).length}
t.merge=function(e,t,i){if(t){const n=Object.keys(t)
const r=n.length
for(let o=0;o<r;o++)e[n[o]]="strict"===i?[t[n[o]]]:t[n[o]]}}
t.getValue=function(e){return t.isExist(e)?e:""}
t.buildOptions=function(e,t,i){let n={}
if(!e)return t
for(let r=0;r<i.length;r++)void 0!==e[i[r]]?n[i[r]]=e[i[r]]:n[i[r]]=t[i[r]]
return n}
t.isTagNameInArrayMode=function(e,t,i){return!1!==t&&(t instanceof RegExp?t.test(e):"function"==typeof t?!!t(e,i):"strict"===t)}
t.isName=function(e){return!(null==r.exec(e))}
t.getAllMatches=function(e,t){const i=[]
let n=t.exec(e)
for(;n;){const r=[]
r.startIndex=t.lastIndex-n[0].length
const o=n.length
for(let e=0;e<o;e++)r.push(n[e])
i.push(r)
n=t.exec(e)}return i}
t.nameRegexp=n},130:(e,t,i)=>{const n=i(716)
const r={allowBooleanAttributes:!1}
const o=["allowBooleanAttributes"]
t.validate=function(e,t){t=n.buildOptions(t,r,o)
const i=[]
let f=!1
let m=!1
"\ufeff"===e[0]&&(e=e.substr(1))
for(let r=0;r<e.length;r++)if("<"===e[r]&&"?"===e[r+1]){r+=2
r=s(e,r)
if(r.err)return r}else{if("<"!==e[r]){if(" "===e[r]||"\t"===e[r]||"\n"===e[r]||"\r"===e[r])continue
return p("InvalidChar","char '"+e[r]+"' is not expected.",d(e,r))}{let o=r
r++
if("!"===e[r]){r=a(e,r)
continue}{let g=!1
if("/"===e[r]){g=!0
r++}let x=""
for(;r<e.length&&">"!==e[r]&&" "!==e[r]&&"\t"!==e[r]&&"\n"!==e[r]&&"\r"!==e[r];r++)x+=e[r]
x=x.trim()
if("/"===x[x.length-1]){x=x.substring(0,x.length-1)
r--}if(!(h=x,n.isName(h))){let t
t=0===x.trim().length?"Invalid space after '<'.":"Tag '"+x+"' is an invalid name."
return p("InvalidTag",t,d(e,r))}const v=c(e,r)
if(!1===v)return p("InvalidAttr","Attributes for '"+x+"' have open quote.",d(e,r))
let b=v.value
r=v.index
if("/"===b[b.length-1]){const i=r-b.length
b=b.substring(0,b.length-1)
const n=l(b,t)
if(!0!==n)return p(n.err.code,n.err.msg,d(e,i+n.err.line))
f=!0}else if(g){if(!v.tagClosed)return p("InvalidTag","Closing tag '"+x+"' doesn't have proper closing.",d(e,r))
if(b.trim().length>0)return p("InvalidTag","Closing tag '"+x+"' can't have attributes or invalid starting.",d(e,o))
{const t=i.pop()
if(x!==t.tagName){let i=d(e,t.tagStartPos)
return p("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+x+"'.",d(e,o))}0==i.length&&(m=!0)}}else{const n=l(b,t)
if(!0!==n)return p(n.err.code,n.err.msg,d(e,r-b.length+n.err.line))
if(!0===m)return p("InvalidXml","Multiple possible root nodes found.",d(e,r))
i.push({tagName:x,tagStartPos:o})
f=!0}for(r++;r<e.length;r++)if("<"===e[r]){if("!"===e[r+1]){r++
r=a(e,r)
continue}if("?"!==e[r+1])break
r=s(e,++r)
if(r.err)return r}else if("&"===e[r]){const t=u(e,r)
if(-1==t)return p("InvalidChar","char '&' is not expected.",d(e,r))
r=t}"<"===e[r]&&r--}}}var h
return f?1==i.length?p("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",d(e,i[0].tagStartPos)):!(i.length>0)||p("InvalidXml","Invalid '"+JSON.stringify(i.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):p("InvalidXml","Start tag expected.",1)}
function s(e,t){const i=t
for(;t<e.length;t++)if("?"!=e[t]&&" "!=e[t]);else{const n=e.substr(i,t-i)
if(t>5&&"xml"===n)return p("InvalidXml","XML declaration allowed only at the start of the document.",d(e,t))
if("?"==e[t]&&">"==e[t+1]){t++
break}}return t}function a(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2
break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let i=1
for(t+=8;t<e.length;t++)if("<"===e[t])i++
else if(">"===e[t]){i--
if(0===i)break}}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2
break}return t}function c(e,t){let i=""
let n=""
let r=!1
for(;t<e.length;t++){if('"'===e[t]||"'"===e[t])""===n?n=e[t]:n!==e[t]||(n="")
else if(">"===e[t]&&""===n){r=!0
break}i+=e[t]}return""===n&&{value:i,index:t,tagClosed:r}}const f=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g")
function l(e,t){const i=n.getAllMatches(e,f)
const r={}
for(let e=0;e<i.length;e++){if(0===i[e][1].length)return p("InvalidAttr","Attribute '"+i[e][2]+"' has no space in starting.",h(i[e]))
if(void 0===i[e][3]&&!t.allowBooleanAttributes)return p("InvalidAttr","boolean attribute '"+i[e][2]+"' is not allowed.",h(i[e]))
const n=i[e][2]
if(!m(n))return p("InvalidAttr","Attribute '"+n+"' is an invalid name.",h(i[e]))
if(r.hasOwnProperty(n))return p("InvalidAttr","Attribute '"+n+"' is repeated.",h(i[e]))
r[n]=1}return!0}function u(e,t){if(";"===e[++t])return-1
if("#"===e[t])return function(e,t){let i=/\d/
if("x"===e[t]){t++
i=/[\da-fA-F]/}for(;t<e.length;t++){if(";"===e[t])return t
if(!e[t].match(i))break}return-1}(e,++t)
let i=0
for(;t<e.length;t++,i++)if(!(e[t].match(/\w/)&&i<20)){if(";"===e[t])break
return-1}return t}function p(e,t,i){return{err:{code:e,msg:t,line:i.line||i,col:i.col}}}function m(e){return n.isName(e)}function d(e,t){const i=e.substring(0,t).split(/\r?\n/)
return{line:i.length,col:i[i.length-1].length+1}}function h(e){return e.startIndex+e[1].length}},198:e=>{e.exports=function(e,t,i){this.tagname=e
this.parent=t
this.child={}
this.attrsMap={}
this.val=i
this.addChild=function(e){Array.isArray(this.child[e.tagname])?this.child[e.tagname].push(e):this.child[e.tagname]=[e]}}},912:(e,t,i)=>{const n=i(716)
const r=i(716).buildOptions
const o=i(198)
const s=i(359)
"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,n.nameRegexp)
!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt)
!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat)
const a={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:"\\c",numParseOptions:{hex:!0,leadingZeros:!0},tagValueProcessor:function(e,t){return e},attrValueProcessor:function(e,t){return e},stopNodes:[],alwaysCreateTextNode:!1}
t.defaultOptions=a
const c=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","tagValueProcessor","attrValueProcessor","parseTrueNumberOnly","numParseOptions","stopNodes","alwaysCreateTextNode"]
t.props=c
function f(e,t,i){if(t){i.trimValues&&(t=t.trim())
t=u(t=i.tagValueProcessor(t,e),i.parseNodeValue,i.numParseOptions)}return t}function l(e,t){if(t.ignoreNameSpace){const t=e.split(":")
const i="/"===e.charAt(0)?"/":""
if("xmlns"===t[0])return""
2===t.length&&(e=i+t[1])}return e}function u(e,t,i){if(t&&"string"==typeof e){const t=e.trim()
return"true"===t||"false"!==t&&s(e,i)}return n.isExist(e)?e:""}const p=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g")
function m(e,t){if(!t.ignoreAttributes&&"string"==typeof e){e=e.replace(/\r?\n/g," ")
const i=n.getAllMatches(e,p)
const r=i.length
const o={}
for(let e=0;e<r;e++){const n=l(i[e][1],t)
if(n.length)if(void 0!==i[e][4]){t.trimValues&&(i[e][4]=i[e][4].trim())
i[e][4]=t.attrValueProcessor(i[e][4],n)
o[t.attributeNamePrefix+n]=u(i[e][4],t.parseAttributeValue,t.numParseOptions)}else t.allowBooleanAttributes&&(o[t.attributeNamePrefix+n]=!0)}if(!Object.keys(o).length)return
if(t.attrNodeName){const e={}
e[t.attrNodeName]=o
return e}return o}}function d(e,t){let i
let n=""
for(let r=t;r<e.length;r++){let t=e[r]
if(i)t===i&&(i="")
else if('"'===t||"'"===t)i=t
else{if(">"===t)return{data:n,index:r}
"\t"===t&&(t=" ")}n+=t}}function h(e,t,i,n){const r=e.indexOf(t,i)
if(-1===r)throw new Error(n)
return r+t.length-1}t.getTraversalObj=function(e,t){e=e.replace(/\r\n?/g,"\n")
t=r(t,a,c)
const i=new o("!xml")
let s=i
let l=""
for(let i=0;i<e.length;i++)if("<"===e[i])if("/"===e[i+1]){const r=h(e,">",i,"Closing Tag is not closed.")
let o=e.substring(i+2,r).trim()
if(t.ignoreNameSpace){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}s&&(s.val?s.val=n.getValue(s.val)+""+f(o,l,t):s.val=f(o,l,t))
if(t.stopNodes.length&&t.stopNodes.includes(s.tagname)){s.child=[]
null==s.attrsMap&&(s.attrsMap={})
s.val=e.substr(s.startIndex+1,i-s.startIndex-1)}s=s.parent
l=""
i=r}else if("?"===e[i+1])i=h(e,"?>",i,"Pi Tag is not closed.")
else if("!--"===e.substr(i+1,3))i=h(e,"--\x3e",i,"Comment is not closed.")
else if("!D"===e.substr(i+1,2)){const t=h(e,">",i,"DOCTYPE is not closed.")
i=e.substring(i,t).indexOf("[")>=0?e.indexOf("]>",i)+1:t}else if("!["===e.substr(i+1,2)){const r=h(e,"]]>",i,"CDATA is not closed.")-2
const a=e.substring(i+9,r)
if(l){s.val=n.getValue(s.val)+""+f(s.tagname,l,t)
l=""}if(t.cdataTagName){const e=new o(t.cdataTagName,s,a)
s.addChild(e)
s.val=n.getValue(s.val)+t.cdataPositionChar
a&&(e.val=a)}else s.val=(s.val||"")+(a||"")
i=r+2}else{const r=d(e,i+1)
let a=r.data
const c=r.index
const u=a.indexOf(" ")
let p=a
let h=!0
if(-1!==u){p=a.substr(0,u).replace(/\s\s*$/,"")
a=a.substr(u+1)}if(t.ignoreNameSpace){const e=p.indexOf(":")
if(-1!==e){p=p.substr(e+1)
h=p!==r.data.substr(e+1)}}s&&l&&"!xml"!==s.tagname&&(s.val=n.getValue(s.val)+""+f(s.tagname,l,t))
if(a.length>0&&a.lastIndexOf("/")===a.length-1){if("/"===p[p.length-1]){p=p.substr(0,p.length-1)
a=p}else a=a.substr(0,a.length-1)
const e=new o(p,s,"")
p!==a&&(e.attrsMap=m(a,t))
s.addChild(e)}else{const e=new o(p,s)
t.stopNodes.length&&t.stopNodes.includes(e.tagname)&&(e.startIndex=c)
p!==a&&h&&(e.attrsMap=m(a,t))
s.addChild(e)
s=e}l=""
i=c}else l+=e[i]
return i}},226:(e,t)=>{t.i=function(e,t,i,n,r){var o,s
var a=8*r-n-1
var c=(1<<a)-1
var f=c>>1
var l=-7
var u=i?r-1:0
var p=i?-1:1
var m=e[t+u]
u+=p
o=m&(1<<-l)-1
m>>=-l
l+=a
for(;l>0;o=256*o+e[t+u],u+=p,l-=8);s=o&(1<<-l)-1
o>>=-l
l+=n
for(;l>0;s=256*s+e[t+u],u+=p,l-=8);if(0===o)o=1-f
else{if(o===c)return s?NaN:1/0*(m?-1:1)
s+=Math.pow(2,n)
o-=f}return(m?-1:1)*s*Math.pow(2,o-n)}
t.c=function(e,t,i,n,r,o){var s,a,c
var f=8*o-r-1
var l=(1<<f)-1
var u=l>>1
var p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0
var m=n?0:o-1
var d=n?1:-1
var h=t<0||0===t&&1/t<0?1:0
t=Math.abs(t)
if(isNaN(t)||t===1/0){a=isNaN(t)?1:0
s=l}else{s=Math.floor(Math.log(t)/Math.LN2)
if(t*(c=Math.pow(2,-s))<1){s--
c*=2}if((t+=s+u>=1?p/c:p*Math.pow(2,1-u))*c>=2){s++
c/=2}if(s+u>=l){a=0
s=l}else if(s+u>=1){a=(t*c-1)*Math.pow(2,r)
s+=u}else{a=t*Math.pow(2,u-1)*Math.pow(2,r)
s=0}}for(;r>=8;e[i+m]=255&a,m+=d,a/=256,r-=8);s=s<<r|a
f+=r
for(;f>0;e[i+m]=255&s,m+=d,s/=256,f-=8);e[i+m-d]|=128*h}},134:(e,t,i)=>{const n=i(993)
const r=e=>{if(null==e)return!1
if(0===(e=e.toString().trim().replace(/\n/g," ")).length)return!1
if(!0!==n.validate(e))return!1
let t
try{t=n.parse(e)}catch(e){return!1}return!!t&&"svg"in t}
e.exports=r
e.exports.default=r},359:e=>{const t=/^[-+]?0x[a-fA-F0-9]+$/
const i=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/
!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt)
!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat)
const n={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0}
e.exports=function(e,r={}){r=Object.assign({},n,r)
if(!e||"string"!=typeof e)return e
let o=e.trim()
if(void 0!==r.skipLike&&r.skipLike.test(o))return e
if(r.hex&&t.test(o))return Number.parseInt(o,16)
{const t=i.exec(o)
if(t){const i=t[1]
const n=t[2]
let s=function(e){if(e&&-1!==e.indexOf(".")){"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1))
return e}return e}(t[3])
const a=t[4]||t[6]
if(!r.leadingZeros&&n.length>0&&i&&"."!==o[2])return e
if(!r.leadingZeros&&n.length>0&&!i&&"."!==o[1])return e
{const t=Number(o)
const c=""+t
return-1!==c.search(/[eE]/)||a?r.eNotation?t:e:-1!==o.indexOf(".")?"0"===c&&""===s||c===s||i&&c==="-"+s?t:e:n?s===c||i+s===c?t:e:o===c||o===i+c?t:e}}return e}}},492:e=>{e.exports=require("node:stream")}}
var t={}
function i(n){var r=t[n]
if(void 0!==r)return r.exports
var o=t[n]={exports:{}}
e[n](o,o.exports,i)
return o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e
i.d(t,{a:t})
return t}
n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,t){1&t&&(e=this(e))
if(8&t)return e
if("object"==typeof e&&e){if(4&t&&e.__esModule)return e
if(16&t&&"function"==typeof e.then)return e}var o=Object.create(null)
i.r(o)
var s={}
r=r||[null,n({}),n([]),n(n)]
for(var a=2&t&&e;"object"==typeof a&&!~r.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((t=>s[t]=()=>e[t]))
s.default=()=>e
i.d(o,s)
return o}
var n,r
i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}
i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)
i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})
Object.defineProperty(e,"__esModule",{value:!0})}
var o={};(()=>{i.r(o)
i.d(o,{createBufferProcessorAsync:()=>H,fileTypeFromBuffer:()=>U,isSvg:()=>Z()})
const e=require("node:path")
const t=require("node:fs")
const n=require("node:child_process")
var r=i(492)
require("node:readline")
const s=()=>{let e,t
return{promise:new Promise(((i,n)=>{e=i
t=n})),resolve:e,reject:t}}
const a=()=>{const e=new Map
return{clear:()=>{e.clear()},delete:(t,i)=>{const n=e.get(t)
if(!n||!n.delete(i))return!1
0===n.size&&e.delete(t)
return!0},set:(t,i,n)=>{let r=e.get(t)
void 0===r&&e.set(t,r=new Map)
r.set(i,n)},get:(t,i)=>{const n=e.get(t)
return n&&n.get(i)},getSet:(t,i,n)=>{let r=e.get(t)
void 0===r&&e.set(t,r=new Map)
let o=r.get(i)
void 0===o&&r.set(i,o=n())
return o},has:(t,i)=>{const n=e.get(t)
return!!n&&n.has(i)},forEach:t=>{e.forEach(((e,i)=>e.forEach(((e,n)=>t(e,n,i)))))},forEachSubMap:t=>{e.forEach(t)},forEachOfSubMap:(t,i)=>{const n=e.get(t)
n&&n.forEach(i)}}}
const c=Symbol("runlet:hint:end")
const f=Symbol("runlet:hint:skip")
const l=Symbol("runlet:hint:redo")
const u=e=>{console.error(e)
throw e}
const p=(e,t)=>[e,t,void 0]
const m=e=>{const[,t]=e
t===c&&(e[0]=void 0)
t===l&&(e[1]=void 0)
e[2]=void 0
return e}
const d=e=>e?`${e[0]&&JSON.stringify(String(e[0]).slice(0,16))}|${String(e[1]||"-")}|${e[2]?"RUN":"IDLE"}`:""
const h=({poolMap:e=new Map,chipMap:t=new Map,endChipKeySet:i=new Set,runningChipMap:n=new Map,onError:r=u})=>{const o=new Map
const s=a()
let h=!1
let g=!0
const x=a()
const v=new Map
const b=[]
const k=[]
let w=!1
const y=()=>{if(!0===w||0===b.length&&0===k.length)return
w=!0
let e
for(;void 0!==(e=b.shift()||k.shift());)o.get(e)()
w=!1}
const P=(e,t,i)=>{void 0!==e&&b.unshift(e)
if(void 0!==t){for(const e of t)b.push(e)
t.clear()}if(void 0!==i){for(const e of i)k.push(e)
i.clear()}y()}
const S=(e,t,r,o,s,{pack:a,state:u})=>{if(!1===g)return
const[d,x]=a
if(x!==f){x===c&&i.add(e.key)
r.pushPend(e.nextPendKey,m(a))
if(x===c&&d>=2){let t=d-1
for(;(t-=1)>=0;)r.pushPend(e.nextPendKey,p(void 0,c))}x===l&&m(n.get(e.key))}x!==l&&n.delete(e.key)
e.state=u
h||(x===c?P(void 0,o,s):x===l?P(e.key,o,void 0):P(e.key,x===f?void 0:o,s))}
const N=(e,o)=>{if(!1===g)return r(o)
g=!1
for(const s of t.values()){if(i.has(s.key))continue
i.add(s.key)
const t=s===e?void 0:n.get(s.key)
if(s.sync)try{s.process(t,s.state,o)}catch(o){r(o)}else s.process(t,s.state,o).catch(r)}}
const O=(e,t,r,o,s)=>{let a=n.get(e.key)
if(h||i.has(e.key)||void 0!==a&&void 0!==a[2]);else{if(void 0===a){if(void 0===(a=t.pullPend(e.prevPendKey))){o.add(e.key)
return}n.set(e.key,a)}if(!r.isPendLimited(e.nextPendKey))return a
s.add(e.key)}}
const I=(e,t,i,n)=>{const r=t()
if(void 0===r)return
const o=e.process(r,e.state,void 0)
o.then(i,n)
r[2]=o}
const A=(e,t,i,n)=>{const r=t()
if(void 0!==r)try{i(e.process(r,e.state,void 0))}catch(e){n(e)}}
const E=e=>{h||P(void 0,void 0,e)}
const T=e=>{h||P(void 0,e,void 0)}
const z=(e,t)=>{let i=s.get(e,t)
if(void 0===i){const n=T.bind(null,x.get(e,t))
const r=E.bind(null,v.get(e))
s.set(e,t,i={onPendPull:r,onPendPush:n})}return i}
return{poolMap:e,chipMap:t,getIsValid:()=>g,getIsPause:()=>h,setIsPause:e=>{h=e},pause:()=>{h=!0},resume:()=>{h=!1},attach:()=>{o.clear()
s.clear()
x.clear()
v.clear()
for(const t of e.values()){v.set(t.key,new Set)
if(t.pendKeyGroupMap)for(const e of t.pendKeyGroupMap.values()){const i=new Set
for(const n of e)x.set(t.key,n,i)}}for(const i of t.values()){const{key:t,prevPoolKey:n,prevPendKey:r,nextPoolKey:s,nextPendKey:a}=i
const c=e.get(n)
const f=e.get(s)
if(!c)throw new Error(`missing prevPool: ${r}`)
if(!f)throw new Error(`missing nextPool: ${s}`)
const l=x.getSet(n,r,(()=>new Set))
const u=x.getSet(s,a,(()=>new Set))
const p=v.get(n)
const m=v.get(s)
const d=O.bind(null,i,c,f,l,m)
const h=S.bind(null,i,c,f,u,p)
const g=N.bind(null,i)
const b=(i.sync?A:I).bind(null,i,d,h,g)
o.set(t,b)}},detach:()=>{g=!1
return{poolMap:e,chipMap:t,endChipKeySet:i,runningChipMap:n}},trigger:()=>(e=>{for(const t of e)k.push(t)
y()})(t.keys()),createPendInput:(t,i)=>{const{onPendPush:n}=z(t,i)
const r=e.get(t)
return{pool:r,push:e=>{r.pushPend(i,e)
n()
return e},canPush:()=>!r.isPendLimited(i)}},createPendOutput:(t,i)=>{const{onPendPull:n}=z(t,i)
const r=e.get(t)
return{pool:r,pull:()=>{const e=r.pullPend(i)
n()
return e},canPull:()=>Boolean(r.getPendSize(i))}},describe:(r=[])=>{g||r.push("[DETACHED]")
for(const e of t.values())r.push([`#${e.key}`,`[${i.has(e.key)?"END":d(n.get(e.key))}]`,`${String(e.prevPendKey)}@${String(e.prevPoolKey)} >> ${String(e.nextPendKey)}@${String(e.nextPoolKey)}`,e.describe&&e.describe()].filter(Boolean).join(" "))
for(const t of e.values())r=t.describe(r,(e=>`pullWake[${[...v.get(e)]}]`),((e,t)=>`pushWake[${[...x.get(e,t)||["EXTERNAL"]]}]`))
return r}}}
const g=({key:e="default",sizeLimit:t})=>{let i=0
const n=new Map
return{key:e,pendKeyGroupMap:void 0,reset:()=>{i=0
n.clear()},getPoolSize:()=>i,configPend:(e,t=0,r=1/0)=>{n.has(e)&&(i-=n.get(e).sizePrivate)
n.set(e,{packQueue:[],size:0,sizePrivate:t,sizeLimit:r})
i+=t},isPendLimited:e=>{const{size:r,sizePrivate:o,sizeLimit:s}=n.get(e)
return r>o&&(i>=t||r>=s)},getPendSize:e=>n.get(e).size,pushPend:(e,t)=>{const r=n.get(e)
r.packQueue.push(t)
r.size++
r.size>r.sizePrivate&&i++},pullPend:e=>{const t=n.get(e)
if(0!==t.packQueue.length){t.size>t.sizePrivate&&i--
t.size--
return t.packQueue.shift()}},describe:(r=[],o,s)=>{r.push(`@${String(e)} ${i}/${t} ${o(e)}`)
for(const[t,{packQueue:i,size:o,sizePrivate:a}]of n)r.push(` -${String(t)} ${o},${a}P [${i.map(d).join(", ")}] ${s(e,t)}`)
return r}}}
const x=Symbol("runlet:pool:io")
const v=Symbol("runlet:pend:input")
const b=Symbol("runlet:pend:output")
const k={key:x,pendKeyGroupMap:void 0,reset:()=>{},getPoolSize:()=>0,configPend:(e,t=0)=>{if(e!==v&&e!==b)throw new Error(`invalid IO config pendKey: ${String(e)}`)
if(t)throw new Error(`invalid IO config sizePrivate: ${t} for pendKey: ${String(e)}`)},isPendLimited:e=>e!==b,getPendSize:e=>e===v?1:0,pushPend:(e,t)=>{if(e!==b||t[1]!==c)throw new Error(`invalid IO push pendKey: ${String(e)}, value: ${String(t)}`)},pullPend:e=>{if(e===v)return p(void 0,f)
throw new Error(`invalid IO shift pendKey: ${String(e)}`)},describe:(e=[],t,i)=>{e.push(`@${String(x)}`)
return e}}
Symbol("runlet:pend:logical:pendview")
Symbol("runlet:pend:logical:pendviewee")
const w=e=>{const t=new r.Readable
t.push(e)
t.push(null)
return t}
const y=e=>new Promise(((t,i)=>{const n=[]
e.on("error",i)
e.on("close",(()=>i(new Error("unexpected stream close"))))
e.on("end",(()=>t(Buffer.concat(n))))
e.on("data",(e=>n.push(e)))}))
const P=({stream:e,readSize:t,key:i="chip:input:stream-readable",...n})=>{const r={error:void 0,isEnd:!1,isReadable:!1,eventIOP:void 0}
const o=e=>{r.error=e
void 0!==r.eventIOP&&r.eventIOP.reject(e)}
const a=()=>{r.isEnd=!0
void 0!==r.eventIOP&&r.eventIOP.resolve()}
const f=()=>{r.isReadable=!0
void 0!==r.eventIOP&&r.eventIOP.resolve()}
e.on("error",o)
e.on("end",a)
e.on("readable",f)
const l=()=>{e.off("error",o)
e.off("end",a)
e.off("readable",f)}
return{...n,key:i,prevPoolKey:x,prevPendKey:v,stream:e,state:r,process:async(i,n,r)=>{if(r)return l()
if(void 0!==n.error)throw n.error
if(!1===n.isEnd&&!1===n.isReadable){void 0===n.eventIOP&&(n.eventIOP=s())
await n.eventIOP.promise
n.eventIOP=void 0}if(!1===n.isReadable&&!0===n.isEnd){l()
i[1]=c}else if(!0===n.isReadable){n.isReadable=!1
const r=[]
let o
for(;null!==(o=e.read(t));)r.push(o)
i[0]=1===r.length?r[0]:Buffer.concat(r)
i[1]=void 0}return{pack:i,state:n}}}}
const S=({stream:e,keepOpen:t=[process.stdout,process.stderr].includes(e),IOP:i=s(),key:n="chip:output:stream-writable",...r})=>{const o={error:void 0,isFinish:!1,isDrain:!0,eventIOP:void 0}
const a=e=>{o.error=e
void 0!==o.eventIOP&&o.eventIOP.reject(e)}
const l=()=>{o.isFinish=!0
void 0!==o.eventIOP&&o.eventIOP.resolve()}
const u=()=>{o.isDrain=!0
void 0!==o.eventIOP&&o.eventIOP.resolve()}
e.on("error",a)
e.on("finish",l)
e.on("drain",u)
const p=()=>{e.off("error",a)
e.off("finish",l)
e.off("drain",u)}
const m=async()=>{o.eventIOP=s()
await o.eventIOP.promise
o.eventIOP=void 0}
return{...r,key:n,nextPoolKey:x,nextPendKey:b,stream:e,state:o,process:async(n,r,o)=>{if(o){p()
return i.reject(o)}if(void 0!==r.error)throw r.error
if(n[1]===c){!t&&e.end()
for(;!1===(t?r.isDrain:r.isFinish);)await m()
p()
i.resolve()}else{!1===r.isDrain&&await m()
r.isDrain=e.write(n[0])
n[0]=void 0
n[1]=f}return{pack:n,state:r}},promise:i.promise}}
const N=(...e)=>{if(e.length<2)throw new Error("need at least 2 stream in streamList")
const t=e.shift()
const i=e.pop()
const n=((e=[])=>{const t=new Map
for(const i of e){if(t.has(i.key))throw new Error(`duplicated pool key: ${i.key}`)
t.set(i.key,i)}return t})([k,g({sizeLimit:8})])
const r=((e=[])=>{const t=new Map
for(const i of e){if(t.has(i.key))throw new Error(`duplicated chip key: ${i.key}`)
t.set(i.key,i)}return t})(((e,{poolKey:t="default",pendKeyBase:i="pend:",chipKeyBase:n="chip:",counter:r=0}={})=>{for(const o of e){void 0===o.prevPoolKey&&(o.prevPoolKey=t)
void 0===o.prevPendKey&&(o.prevPendKey=`${i}${r}`)
r++
void 0===o.key&&(o.key=`${n}${r}`)
void 0===o.nextPoolKey&&(o.nextPoolKey=t)
void 0===o.nextPendKey&&(o.nextPendKey=`${i}${r}`)}return e})([P({stream:t}),...e.map(((e,t)=>(({stream:e,readSize:t,key:i="chip:stream-transform",...n})=>{const r={error:void 0,isDrain:!0,isWriteEnd:!1,isEnd:!1,isReadable:!1,eventIOP:void 0}
const o=e=>{r.error=e
void 0!==r.eventIOP&&r.eventIOP.reject(e)}
const a=()=>{r.isDrain=!0
void 0!==r.eventIOP&&r.eventIOP.resolve()}
const u=()=>{r.isEnd=!0
void 0!==r.eventIOP&&r.eventIOP.resolve()}
const m=()=>{r.isReadable=!0
void 0!==r.eventIOP&&r.eventIOP.resolve()}
e.on("error",o)
e.on("drain",a)
e.on("end",u)
e.on("readable",m)
const d=()=>{e.off("error",o)
e.off("drain",a)
e.off("end",u)
e.off("readable",m)}
return{...n,key:i,stream:e,state:r,process:async(i,n,r)=>{if(r)return d()
if(void 0!==n.error)throw n.error
if(i[1]===c&&!1===n.isWriteEnd){n.isWriteEnd=!0
e.end()}if((!0===n.isWriteEnd||!1===n.isDrain)&&!1===n.isEnd&&!1===n.isReadable){void 0===n.eventIOP&&(n.eventIOP=s())
await n.eventIOP.promise
n.eventIOP=void 0}let o=!0
if(i[1]!==c&&!0===n.isDrain){n.isDrain=e.write(i[0])
o=!1}if(!1===n.isReadable&&!0===n.isEnd)d()
else if(!0===n.isReadable){n.isReadable=!1
const r=[]
let s
for(;null!==(s=e.read(t));)r.push(s)
const a=1===r.length?r[0]:Buffer.concat(r)
if(!0===o)i=p(a,l)
else{i[0]=a
i[1]=void 0}}else{i[0]=void 0
i[1]=f}return{pack:i,state:n}}}})({stream:e,key:`chip:transform-${t}`}))),S({key:"out",stream:i})]))
const{attach:o,trigger:a,describe:u}=h(((e,t,i)=>{for(const i of t.values())e.get(i.prevPoolKey).configPend(i.prevPendKey,i.prevPendSizePrivate,i.prevPendSizeLimit,i.prevPendLogic)
for(const i of t.values())e.get(i.nextPoolKey).configPend(i.nextPendKey,i.nextPendSizePrivate,i.nextPendSizeLimit,i.nextPendLogic)
return{poolMap:e,chipMap:t}})(n,r))
o()
a()
return r.get("out").promise}
const O=(e,t)=>Object.assign(e||new Error(`exit with code: ${t.code}, signal: ${t.signal}`),t)
const I=e=>{if(void 0===e.describeOutcome){const{message:t,stack:i,code:n,signal:r,command:o,argList:s=[],stdout:a,stderr:c}=e
e.describeOutcome=[i||t,void 0!==r&&`[code] ${n} [signal] ${r}`,`[args] ${A(o)} ${s.map(A).join(" ")}`,a&&a.length&&`[stdout] ${a}`,c&&c.length&&`[stderr] ${c}`].filter(Boolean).join("\n")}return e.describeOutcome}
const A=e=>JSON.stringify(e)
t.existsSync
t.createReadStream
class E extends Error{constructor(){super("End-Of-Stream")}}const T=require("node:buffer")
class z{constructor(e){this.position=0
this.numBuffer=new Uint8Array(8)
this.fileInfo=e||{}}async readToken(e,t=this.position){const i=T.Buffer.alloc(e.len)
if(await this.readBuffer(i,{position:t})<e.len)throw new E
return e.get(i,0)}async peekToken(e,t=this.position){const i=T.Buffer.alloc(e.len)
if(await this.peekBuffer(i,{position:t})<e.len)throw new E
return e.get(i,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new E
return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new E
return e.get(this.numBuffer,0)}async ignore(e){if(void 0!==this.fileInfo.size){const t=this.fileInfo.size-this.position
if(e>t){this.position+=t
return t}}this.position+=e
return e}async close(){}normalizeOptions(e,t){if(t&&void 0!==t.position&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`")
return t?{mayBeLess:!0===t.mayBeLess,offset:t.offset?t.offset:0,length:t.length?t.length:e.length-(t.offset?t.offset:0),position:t.position?t.position:this.position}:{mayBeLess:!1,offset:0,length:e.length,position:this.position}}}class M extends z{constructor(e,t){super(t)
this.uint8Array=e
this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:e.length}async readBuffer(e,t){if(t&&t.position){if(t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`")
this.position=t.position}const i=await this.peekBuffer(e,t)
this.position+=i
return i}async peekBuffer(e,t){const i=this.normalizeOptions(e,t)
const n=Math.min(this.uint8Array.length-i.position,i.length)
if(!i.mayBeLess&&n<i.length)throw new E
e.set(this.uint8Array.subarray(i.position,i.position+n),i.offset)
return n}async close(){}}i(226)
function j(e){return new DataView(e.buffer,e.byteOffset)}const C={len:1,get:(e,t)=>j(e).getUint8(t),put(e,t,i){j(e).setUint8(t,i)
return t+1}}
const B={len:2,get:(e,t)=>j(e).getUint16(t,!0),put(e,t,i){j(e).setUint16(t,i,!0)
return t+2}}
const D={len:2,get:(e,t)=>j(e).getUint16(t),put(e,t,i){j(e).setUint16(t,i)
return t+2}}
const F={len:4,get:(e,t)=>j(e).getUint32(t,!0),put(e,t,i){j(e).setUint32(t,i,!0)
return t+4}}
const $={len:4,get:(e,t)=>j(e).getUint32(t),put(e,t,i){j(e).setUint32(t,i)
return t+4}}
const L={len:4,get:(e,t)=>j(e).getInt32(t),put(e,t,i){j(e).setInt32(t,i)
return t+4}}
const V={len:8,get:(e,t)=>j(e).getBigUint64(t,!0),put(e,t,i){j(e).setBigUint64(t,i,!0)
return t+8}}
class K{constructor(e,t){this.len=e
this.encoding=t}get(e,t){return T.Buffer.from(e).toString(this.encoding,t,t+this.len)}}class R{constructor(e){this.len=e}static decode(e,t,i){let n=""
for(let r=t;r<i;++r)n+=R.codePointToString(R.singleByteDecoder(e[r]))
return n}static inRange(e,t,i){return t<=e&&e<=i}static codePointToString(e){if(e<=65535)return String.fromCharCode(e)
e-=65536
return String.fromCharCode(55296+(e>>10),56320+(1023&e))}static singleByteDecoder(e){if(R.inRange(e,0,127))return e
const t=R.windows1252[e-128]
if(null===t)throw Error("invaliding encoding")
return t}get(e,t=0){return R.decode(e,t,t+this.len)}}R.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]
const q={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}
async function U(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof e}\``)
const t=e instanceof Uint8Array?e:new Uint8Array(e)
if((null==t?void 0:t.length)>1)return _(new M(t,void 0))}function W(e,t,i){i={offset:0,...i}
for(const[n,r]of t.entries())if(i.mask){if(r!==(i.mask[n]&e[n+i.offset]))return!1}else if(r!==e[n+i.offset])return!1
return!0}async function _(e){try{return(new J).parse(e)}catch(e){if(!(e instanceof E))throw e}}class J{check(e,t){return W(this.buffer,e,t)}checkString(e,t){return this.check((i=e,[...i].map((e=>e.charCodeAt(0)))),t)
var i}async parse(e){this.buffer=T.Buffer.alloc(4100)
void 0===e.fileInfo.size&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER)
this.tokenizer=e
await e.peekBuffer(this.buffer,{length:12,mayBeLess:!0})
if(this.check([66,77]))return{ext:"bmp",mime:"image/bmp"}
if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"}
if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"}
if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"}
if(this.check([37,33])){await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0})
return this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"}}if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"}
if(this.check([239,187,191])){this.tokenizer.ignore(3)
return this.parse(e)}if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"}
if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"}
if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"}
if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"}
if(this.checkString("ID3")){await e.ignore(6)
const t=await e.readToken(q)
if(e.position+t>e.fileInfo.size)return{ext:"mp3",mime:"audio/mpeg"}
await e.ignore(t)
return _(e)}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"}
if((67===this.buffer[0]||70===this.buffer[0])&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"}
if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"}
if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"}
if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"}
if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"}
if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"}
if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"}
if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"}
if(this.check([80,75,3,4])){try{for(;e.position+30<e.fileInfo.size;){await e.readBuffer(this.buffer,{length:30})
const i={compressedSize:this.buffer.readUInt32LE(18),uncompressedSize:this.buffer.readUInt32LE(22),filenameLength:this.buffer.readUInt16LE(26),extraFieldLength:this.buffer.readUInt16LE(28)}
i.filename=await e.readToken(new K(i.filenameLength,"utf-8"))
await e.ignore(i.extraFieldLength)
if("META-INF/mozilla.rsa"===i.filename)return{ext:"xpi",mime:"application/x-xpinstall"}
if(i.filename.endsWith(".rels")||i.filename.endsWith(".xml"))switch(i.filename.split("/")[0]){case"_rels":default:break
case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}
case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}
case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}}if(i.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}
if(i.filename.startsWith("3D/")&&i.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"}
if("mimetype"===i.filename&&i.compressedSize===i.uncompressedSize){let n=await e.readToken(new K(i.compressedSize,"utf-8"))
n=n.trim()
switch(n){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"}
case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"}
case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"}
case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"}}}if(0===i.compressedSize){let r=-1
for(;r<0&&e.position<e.fileInfo.size;){await e.peekBuffer(this.buffer,{mayBeLess:!0})
r=this.buffer.indexOf("504B0304",0,"hex")
await e.ignore(r>=0?r:this.buffer.length)}}else await e.ignore(i.compressedSize)}}catch(o){if(!(o instanceof E))throw o}return{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28)
const s=T.Buffer.alloc(8)
await e.readBuffer(s)
return W(s,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:W(s,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:W(s,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:W(s,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:W(s,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:W(s,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(3===this.buffer[2]||5===this.buffer[2]||7===this.buffer[2])&&(4===this.buffer[3]||6===this.buffer[3]||8===this.buffer[3]))return{ext:"zip",mime:"application/zip"}
if(this.checkString("ftyp",{offset:4})&&0!=(96&this.buffer[8])){const a=this.buffer.toString("binary",8,12).replace("\0"," ").trim()
switch(a){case"avif":case"avis":return{ext:"avif",mime:"image/avif"}
case"mif1":return{ext:"heic",mime:"image/heif"}
case"msf1":return{ext:"heic",mime:"image/heif-sequence"}
case"heic":case"heix":return{ext:"heic",mime:"image/heic"}
case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"}
case"qt":return{ext:"mov",mime:"video/quicktime"}
case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"}
case"M4P":return{ext:"m4p",mime:"video/mp4"}
case"M4B":return{ext:"m4b",mime:"audio/mp4"}
case"M4A":return{ext:"m4a",mime:"audio/x-m4a"}
case"F4V":return{ext:"f4v",mime:"video/mp4"}
case"F4P":return{ext:"f4p",mime:"video/mp4"}
case"F4A":return{ext:"f4a",mime:"audio/mp4"}
case"F4B":return{ext:"f4b",mime:"audio/mp4"}
case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"}
default:return a.startsWith("3g")?a.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"}
if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"}
if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"}
if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"}
if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"}
if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"}
if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"}
if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"}
if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"}
if(this.checkString("%PDF")){await e.ignore(1350)
const c=10485760
const f=T.Buffer.alloc(Math.min(c,e.fileInfo.size))
await e.readBuffer(f,{mayBeLess:!0})
return f.includes(T.Buffer.from("AIPrivateData"))?{ext:"ai",mime:"application/postscript"}:{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"}
if(this.check([73,73])){const l=await this.readTiffHeader(!1)
if(l)return l}if(this.check([77,77])){const u=await this.readTiffHeader(!0)
if(u)return u}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"}
if(this.check([26,69,223,163])){async function p(){const t=await e.peekNumber(C)
let i=128
let n=0
for(;0==(t&i)&&0!==i;){++n
i>>=1}const r=T.Buffer.alloc(n+1)
await e.readBuffer(r)
return r}async function m(){const e=await p()
const t=await p()
t[0]^=128>>t.length-1
const i=Math.min(6,t.length)
return{id:e.readUIntBE(0,e.length),len:t.readUIntBE(t.length-i,i)}}async function d(t){for(;t>0;){const i=await m()
if(17026===i.id)return(await e.readToken(new K(i.len,"utf-8"))).replace(/\00.*$/g,"")
await e.ignore(i.len);--t}}const h=await m()
switch(await d(h.len)){case"webm":return{ext:"webm",mime:"video/webm"}
case"matroska":return{ext:"mkv",mime:"video/x-matroska"}
default:return}}if(this.check([82,73,70,70])){if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"}
if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"}
if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"}
if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"}
if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"}
if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"}
if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"}
if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"}
if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"}
if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"}
if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"}
if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"}
if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"}
if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"}
if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"}
if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"}
if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"}
if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"}
if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"}
if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"}
if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"}
if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"}
if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"}
if(this.check([82,97,114,33,26,7])&&(0===this.buffer[6]||1===this.buffer[6]))return{ext:"rar",mime:"application/x-rar-compressed"}
if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"}
if(this.checkString("AC")){const g=this.buffer.toString("binary",2,6)
if(g.match("^d*")&&g>=1e3&&g<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"}
if(this.checkString("!<arch>")){await e.ignore(8)
return"debian-binary"===await e.readToken(new K(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"}}if(this.check([137,80,78,71,13,10,26,10])){await e.ignore(8)
async function x(){return{length:await e.readToken(L),type:await e.readToken(new K(4,"binary"))}}do{const v=await x()
if(v.length<0)return
switch(v.type){case"IDAT":return{ext:"png",mime:"image/png"}
case"acTL":return{ext:"apng",mime:"image/apng"}
default:await e.ignore(v.length+4)}}while(e.position+8<e.fileInfo.size)
return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"}
if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"}
if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"}
if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"}
if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"}
if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"}
if(this.check([48,38,178,117,142,102,207,17,166,217])){async function b(){const t=T.Buffer.alloc(16)
await e.readBuffer(t)
return{id:t,size:Number(await e.readToken(V))}}await e.ignore(30)
for(;e.position+24<e.fileInfo.size;){const k=await b()
let w=k.size-24
if(W(k.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const y=T.Buffer.alloc(16)
w-=await e.readBuffer(y)
if(W(y,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"}
if(W(y,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"}
break}await e.ignore(w)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"}
if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"}
if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"}
if(this.check([0,0,0,12,106,80,32,32,13,10,135,10])){await e.ignore(20)
switch(await e.readToken(new K(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"}
case"jpx ":return{ext:"jpx",mime:"image/jpx"}
case"jpm ":return{ext:"jpm",mime:"image/jpm"}
case"mjp2":return{ext:"mj2",mime:"image/mj2"}
default:return}}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"}
if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0
if(this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"}
if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"}
if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"}
if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"}
if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"}
await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0})
if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"}
if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"}
if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"}
if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"}
if(this.check([4,0,0,0])&&this.buffer.length>=16){const P=this.buffer.readUInt32LE(12)
if(P>12&&this.buffer.length>=P+16)try{const S=this.buffer.slice(16,P+16).toString()
if(JSON.parse(S).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"}
if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"}
if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"}
if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"}
if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"}
if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"}
if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"}
if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"}
if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"}
if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"}
await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0})
if(function(e,t=0){const i=Number.parseInt(e.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8)
if(Number.isNaN(i))return!1
let n=256
for(let i=t;i<t+148;i++)n+=e[i]
for(let i=t+156;i<t+512;i++)n+=e[i]
return i===n}(this.buffer))return{ext:"tar",mime:"application/x-tar"}
if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0
if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}
if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]}),{ext:"aac",mime:"audio/aac"}
if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"}
if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"}
if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}async readTiffTag(e){const t=await this.tokenizer.readToken(e?D:B)
this.tokenizer.ignore(10)
switch(t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"}
case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(e){const t=await this.tokenizer.readToken(e?D:B)
for(let i=0;i<t;++i){const t=await this.readTiffTag(e)
if(t)return t}}async readTiffHeader(e){const t=(e?D:B).get(this.buffer,2)
const i=(e?$:F).get(this.buffer,4)
if(42===t){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"}
if(i>=8&&(this.check([28,0,254,0],{offset:8})||this.check([31,0,11,0],{offset:8})))return{ext:"nef",mime:"image/x-nikon-nef"}}await this.tokenizer.ignore(i)
const t=await this.readTiffIFD(e)
return null!=t?t:{ext:"tif",mime:"image/tiff"}}if(43===t)return{ext:"tif",mime:"image/tiff"}}}new Set(["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet"])
new Set(["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet"])
var G=i(134)
var Z=i.n(G)
const X=`${process.platform}|${process.arch}`
const Q=async(e,t=null)=>{const{subProcess:i,promise:r,stdoutPromise:o,stderrPromise:s}=(([e,...t],{quiet:i=!1,describeError:r=i,...o}={})=>{const s=(0,n.spawn)(e,t,((e,t)=>({stdio:t?["ignore","pipe","pipe"]:"inherit",...e}))(o,i))
const a=i?y(s.stdout):void 0
const c=i?y(s.stderr):void 0
const f=()=>({code:s.exitCode,signal:s.signalCode,command:e,argList:t,stdoutPromise:a,stderrPromise:c})
let l=new Promise(((e,t)=>{s.on("error",(e=>t(O(e,f()))))
s.on("exit",((i,n)=>0===i?e(f()):t(O(null,f()))))}))
r&&(l=l.catch((async e=>{throw((e,t)=>{e.message&&e.stack&&(e.stack=e.stack.replace(e.message,t))
e.message=t
return e})(e,await(t=e,t.describeOutcome||(t.stdoutPromise?Promise.all([t.stdoutPromise,t.stderrPromise]).then((([e,i])=>I(Object.assign(t,{stdout:e,stderr:i})))):I(t))))
var t})))
return{subProcess:s,promise:l,stdoutPromise:a,stderrPromise:c}})(e,{quiet:!0,describeError:!1,...t&&{stdio:"pipe"}})
t?await Promise.all([N(w(t),i.stdin),r]):await r
return[await o,await s]}
const H=async(t,i,n,r,o)=>{const s=((t={},i=".")=>{for(const[n,r]of Object.entries(t))if(X.startsWith(n))return(0,e.join)(i,r)
throw new Error(`unsupported env ${X}`)})(t,i)
const[a,c]=await Q([s,...n])
if(!String(a).includes(r)&&!String(c).includes(r))throw new Error(`expect test run output: "${r}", but get: [STDOUT] ${String(a)}\n[STDERR] ${String(c)}`)
return async e=>{const[t]=await Q([s,...o],e)
return t}}})()
return o})()))
