@es-joy/jsoe 0.24.0 → 0.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +10 -0
- package/README.md +24 -0
- package/badges/coverage-badge.svg +1 -1
- package/dist/fundamentalTypes/blobType.d.ts.map +1 -1
- package/dist/fundamentalTypes/fileType.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/fundamentalTypes/arrayType.js +2 -2
- package/src/fundamentalTypes/blobType.js +11 -3
- package/src/fundamentalTypes/fileType.js +9 -4
- package/src/subTypes/blobHTMLType.js +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"react";let win;"undefined"!=typeof window&&window&&(win=window);let doc="undefined"!=typeof document&&document||win?.document;const possibleOptions=["$plugins","$map"],NS_HTML="http://www.w3.org/1999/xhtml",hyphenForCamelCase=/-([a-z])/gu,ATTR_MAP=new Map([["maxlength","maxLength"],["minlength","minLength"],["readonly","readOnly"]]),BOOL_ATTS=["checked","defaultChecked","defaultSelected","disabled","indeterminate","open","readOnly","selected"],ATTR_DOM=[...BOOL_ATTS,"accessKey","async","autocapitalize","autofocus","contentEditable","defaultValue","defer","draggable","formnovalidate","hidden","innerText","inputMode","ismap","multiple","novalidate","pattern","required","spellcheck","translate","value","willvalidate"],NULLABLES=["autocomplete","dir","integrity","lang","max","min","minLength","maxLength","title"],$$2=g=>{if(!doc)throw new Error("No document object");return doc.querySelector(g)};function _getHTMLNodeName(g){return g.nodeName&&g.nodeName.toLowerCase()}function _appendNode(g,O){"template"!==_getHTMLNodeName(g)?g.append(O):g.content.append(O)}function _addEvent(g,O,L,M){g.addEventListener(O,L,Boolean(M))}function _createSafeReference(g,O,L){if(!doc)throw new Error("No document defined");if(!/^\w+$/u.test(L))throw new TypeError(`Bad ${g} reference; with prefix "${O}" and arg "${L}"`);const M=doc.createElement("div");return M.innerHTML="&"+O+L+";",doc.createTextNode(M.innerHTML)}function _upperCase(g,O){return O.toUpperCase()}function _isNullish(g){return null==g}function _getType(g){const O=typeof g;if("string"==typeof g||void 0===g)return"string";if("object"===O){if(null===g)return"null";if(Array.isArray(g))return"array";if("nodeType"in g)switch(g.nodeType){case 1:return"element";case 9:return"document";case 11:return"fragment";default:return"non-container node"}}return O}function _fragReducer(g,O){return g.append(O),g}function _replaceDefiner(g){return function(...O){const L=O[0];let M=g[""]?' xmlns="'+g[""]+'"':L;for(const[O,L]of Object.entries(g))""!==O&&(M+=" xmlns:"+O+'="'+L+'"');return M}}function _childrenToJML(g){return function(O,L){const M=g.childNodes[L],J=Array.isArray(O)?jml(...O):jml(O);M.replaceWith(J)}}function _appendJML(g){return function(O){if("string"==typeof O||"number"==typeof O)throw new TypeError("Unexpected text string/number in the head");Array.isArray(O)?g.append(jml(...O)):"object"==typeof O&&"nodeType"in O?g.append(O):g.append(jml(O))}}function _appendJMLOrText(g){return function(O){"string"==typeof O||"number"==typeof O?g.append(String(O)):Array.isArray(O)?g.append(jml(...O)):"object"==typeof O&&"nodeType"in O?g.append(O):g.append(jml(O))}}function checkPluginValue(g,O,L,M,J){if(M.$state=J??"attributeValue",L&&"object"==typeof L){const J=getMatchingPlugin(M,Object.keys(L)[0]);if(J)return J.set({opts:M,element:g,attribute:{name:O,value:L}})}return L}function getMatchingPlugin(g,O){return g.$plugins&&g.$plugins.find((g=>g.name===O))}const jml=function jml(...g){if(!win)throw new Error("No window object");if(!doc)throw new Error("No document object");let O=doc.createDocumentFragment();function _checkAtts(ae){if(!doc)throw new Error("No document object");for(let[ie,ne]of Object.entries(ae))if(ie=ATTR_MAP.get(ie)??ie,NULLABLES.includes(ie))ne=checkPluginValue(O,ie,ne,J),_isNullish(ne)||(O[ie]=ne);else if(ATTR_DOM.includes(ie))ne=checkPluginValue(O,ie,ne,J),O[ie]=ne;else switch(ie){case"#":J.$state="fragmentChildren",L[L.length]=jml(J,ne);break;case"$shadow":{const{open:g,closed:L}=ne;let{content:M,template:J}=ne;const ae=O.attachShadow({mode:L||!1===g?"closed":"open"});J?(Array.isArray(J)?J="object"===_getType(J[0])?jml("template",...J,doc.body):jml("template",J,doc.body):"string"==typeof J&&(J=$$2(J)),jml(J.content.cloneNode(!0),ae)):(M||!0!==g&&(M=g||"boolean"==typeof L?M:L),M&&"boolean"!=typeof M&&(Array.isArray(M)?jml({"#":M},ae):jml(M,ae)));break}case"$state":case"is":case"xmlns":break;case"$custom":Object.assign(O,ne);break;case"$define":{if(!("localName"in O))throw new Error("Element expected for `$define`");const L=O.localName.toLowerCase(),M=!L.includes("-");let ie;if(M&&(ie=O.getAttribute("is"),!ie)){if(!Object.hasOwn(ae,"is"))throw new TypeError(`Expected \`is\` with \`$define\` on built-in; args: ${JSON.stringify(g)}`);ae.is=checkPluginValue(O,"is",ae.is,J),O.setAttribute("is",ae.is),({is:ie}=ae)}const oe=M?ie:L;if(window.customElements.get(oe))break;const getConstructor=g=>{if(!doc)throw new Error("No document object");const O="object"==typeof le&&"string"==typeof le.extends?doc.createElement(le.extends).constructor:M?doc.createElement(L).constructor:window.HTMLElement;return g?class extends O{constructor(){super(),g.call(this)}}:class extends O{}};let pe,le,ue;const de=ne;Array.isArray(de)?de.length<=2?([pe,le]=de,"string"==typeof le?le={extends:le}:le&&!Object.hasOwn(le,"extends")&&(ue=le),"object"==typeof pe&&(ue=pe,pe=getConstructor())):([pe,ue,le]=de,"string"==typeof le&&(le={extends:le})):"function"==typeof de?pe=de:(ue=de,pe=getConstructor()),pe.toString().startsWith("class")||(pe=getConstructor(pe)),!le&&M&&(le={extends:L}),ue&&Object.entries(ue).forEach((([g,O])=>{pe.prototype[g]=O})),window.customElements.define(oe,pe,"object"==typeof le?le:void 0);break}case"$symbol":{const[g,L]=ne;if("function"==typeof L){const M=L.bind(O);"string"==typeof g?O[Symbol.for(g)]=M:O[g]=M}else{const M=L;M.elem=O,"string"==typeof g?O[Symbol.for(g)]=M:O[g]=M}break}case"$data":setMap(ne);break;case"$attribute":{const g=ne,O=3===g.length?doc.createAttributeNS(g[0],g[1]):doc.createAttribute(g[0]);O.value=g[g.length-1],L[L.length]=O;break}case"$text":{const g=doc.createTextNode(ne);L[L.length]=g;break}case"$document":{const g=doc.implementation.createHTMLDocument();if(!ne)throw new Error("Bad attribute value");const O=ne;if(O.childNodes){const L=O.childNodes.length;for(;g.childNodes[L];){g.childNodes[L].remove()}O.childNodes.forEach(_childrenToJML(g))}else{if(O.$DOCTYPE){const L={$DOCTYPE:O.$DOCTYPE},M=jml(L);g.firstChild?.replaceWith(M)}const L=g.querySelector("html"),M=L?.querySelector("head"),J=L?.querySelector("body");if(O.title||O.head){const L=doc.createElement("meta");L.setAttribute("charset","utf-8"),M?.append(L),O.title&&(g.title=O.title),O.head&&M&&O.head.forEach(_appendJML(M))}O.body&&J&&O.body.forEach(_appendJMLOrText(J))}L[L.length]=g;break}case"$DOCTYPE":{const g=ne,O=doc.implementation.createDocumentType(g.name,g.publicId||"",g.systemId||"");L[L.length]=O;break}case"$on":for(let[L,M]of Object.entries(ne||{})){if("function"==typeof M&&(M=[M,!1]),"function"!=typeof M[0])throw new TypeError(`Expect a function for \`$on\`; args: ${JSON.stringify(g)}`);_addEvent(O,L,M[0],M[1])}break;case"className":case"class":ne=checkPluginValue(O,ie,ne,J),_isNullish(ne)||(O.className=ne);break;case"dataset":{const recurse=(g,L)=>{let M="";const J=""!==L;Object.keys(g).forEach((ae=>{const ie=g[ae];if(M=J?L+ae.replace(hyphenForCamelCase,_upperCase).replace(/^([a-z])/u,_upperCase):L+ae.replace(hyphenForCamelCase,_upperCase),null===ie||"object"!=typeof ie)return _isNullish(ie)||(O.dataset[M]=ie),void(M=L);recurse(ie,M)}))};recurse(ne,"");break}case"innerHTML":_isNullish(ne)||(O.innerHTML=ne);break;case"htmlFor":case"for":if("label"===M){ne=checkPluginValue(O,ie,ne,J),_isNullish(ne)||(O.htmlFor=ne);break}ne=checkPluginValue(O,ie,ne,J),O.setAttribute(ie,ne);break;default:{if(ie.startsWith("on")){ne=checkPluginValue(O,ie,ne,J),O[ie]=ne;break}if("style"===ie){if(ne=checkPluginValue(O,ie,ne,J),_isNullish(ne))break;if("object"==typeof ne){for(const[g,L]of Object.entries(ne))_isNullish(L)||("float"===g?(O.style.cssFloat=L,O.style.styleFloat=L):O.style[g.replace(hyphenForCamelCase,_upperCase)]=L);break}O.setAttribute(ie,ne);break}const g=ie,M=getMatchingPlugin(J,g);if(M){M.set({opts:J,element:L[0],attribute:{name:g,value:ne}});break}ne=checkPluginValue(O,ie,ne,J),O.setAttribute(ie,ne);break}}}const L=[];let M,J,ae=!1,ie=0;if("object"===_getType(g[0])&&Object.keys(g[0]).some((g=>possibleOptions.includes(g)))){if(J=g[0],void 0===J.$state&&(ae=!0,J.$state="root"),Array.isArray(J.$map)&&(J.$map={root:J.$map}),"$plugins"in J){if(!Array.isArray(J.$plugins))throw new TypeError(`\`$plugins\` must be an array; args: ${JSON.stringify(g)}`);J.$plugins.forEach((O=>{if(!O||"object"!=typeof O)throw new TypeError(`Plugin must be an object; args: ${JSON.stringify(g)}`);if(!O.name||!O.name.startsWith("$_"))throw new TypeError(`Plugin object name must be present and begin with \`$_\`; args: ${JSON.stringify(g)}`);if("function"!=typeof O.set)throw new TypeError(`Plugin object must have a \`set\` method; args: ${JSON.stringify(g)}`)}))}ie=1}else J={$state:void 0};const ne=g.length,oe=J.$map&&J.$map.root,setMap=g=>{let L,M;const ae=oe;if(!0===g)[L,M]=ae;else if(Array.isArray(g)){if("string"==typeof g[0])return void g.forEach((g=>{setMap(J.$map[g])}));L=g[0]||ae[0],M=g[1]||ae[1]}else/^\[object (?:Weak)?Map\]$/u.test([].toString.call(g))?(L=g,M=ae[1]):(L=ae[0],M=g);L.set(O,M)};for(let ae=ie;ae<ne;ae++){let ie=g[ae];const oe=_getType(ie);switch(oe){case"null":if(ae===ne-1)return L.length<=1?L[0]:L.reduce(_fragReducer,doc.createDocumentFragment());throw new TypeError(`\`null\` values not allowed except as final Jamilih argument; index ${ae} on args: ${JSON.stringify(g)}`);case"string":switch(ie){case"!":L[L.length]=doc.createComment(g[++ae]);break;case"?":{ie=g[++ae];let O=g[++ae];const M=O;if(M&&"object"==typeof M){const g=[];for(const[O,L]of Object.entries(M))g.push(O+'="'+L.replace(/"/gu,""")+'"');O=g.join(" ")}try{L[L.length]=doc.createProcessingInstruction(ie,O)}catch(g){L[L.length]=doc.createComment("?"+ie+" "+O+"?")}break}case"&":L[L.length]=_createSafeReference("entity","",g[++ae]);break;case"#":L[L.length]=_createSafeReference("decimal",ie,String(g[++ae]));break;case"#x":L[L.length]=_createSafeReference("hexadecimal",ie,g[++ae]);break;case"![":try{L[L.length]=doc.createCDATASection(g[++ae])}catch(O){L[L.length]=doc.createTextNode(g[ae])}break;case"":L[L.length]=O=doc.createDocumentFragment(),J.$state="fragment";break;default:{M=ie;const ne=g[ae+1];if(ne&&"object"===_getType(ne)&&ne.is){const{is:g}=ne;O=doc.createElementNS?doc.createElementNS(NS_HTML,M,{is:g}):doc.createElement(M,{is:g})}else O=doc.createElementNS?doc.createElementNS(NS_HTML,M):doc.createElement(M);J.$state="element",L[L.length]=O;break}}break;case"object":{if(!ie||"object"!=typeof ie)throw new Error("Null should not reach here");const g=ie;if("xmlns"in g){const M=g,ae=M.xmlns&&"object"==typeof M.xmlns?_replaceDefiner(M.xmlns):' xmlns="'+M.xmlns+'"';O=L[L.length-1]=(new win.DOMParser).parseFromString((new win.XMLSerializer).serializeToString(O).replace(' xmlns="'+NS_HTML+'"',ae),"application/xml").documentElement,J.$state="element"}_checkAtts(g);break}case"document":case"fragment":case"element":if(0===ae&&(O=ie,J.$state="element"),ae===ne-1||ae===ne-2&&null===g[ae+1]){const g=L.length;for(let O=0;O<g;O++)_appendNode(ie,L[O])}else L[L.length]=ie;break;case"array":{const L=ie,M=L.length;for(let ae=0;ae<M;ae++){const M=L[ae],ie=typeof M;if(null===M||_isNullish(M))throw new TypeError(`Bad children (parent array: ${JSON.stringify(g)}; index ${ae} of child: ${JSON.stringify(L)})`);switch(ie){case"string":case"number":case"boolean":_appendNode(O,doc.createTextNode(String(M)));break;default:if("object"!=typeof M)throw new TypeError(`Bad children (parent array: ${JSON.stringify(g)}; index ${ae} of child: ${JSON.stringify(L)})`);if(Array.isArray(M))J.$state="children",_appendNode(O,jml(J,...M));else if("#"in M)J.$state="fragmentChildren",_appendNode(O,jml(J,M["#"]));else{let g;"nodeType"in M||(g=checkPluginValue(O,null,M,J,"children")),_appendNode(O,g||M)}}}break}default:throw new TypeError(`Unexpected type: ${oe}; arg: ${ie}; index ${ae} on args: ${JSON.stringify(g)}`)}}const pe=L[0]||O;return ae&&J.$map&&J.$map.root&&setMap(!0),pe};let DOMException$1=class DOMException extends Error{constructor(g,O){super(g),this.code=0,this.name=O}},body;jml.toJML=function(g,{stringOutput:O=!1,reportInvalidState:L=!0,stripWhitespace:M=!1}={}){if(!win)throw new Error("No window object set");"string"==typeof g&&(g=(new win.DOMParser).parseFromString(g,"text/html"));const J=[];let ae=J,ie=0;function invalidStateError(g){if(L){const O=new DOMException$1(g,"INVALID_STATE_ERR");throw O.code=11,O}}function set(g){ae[ie]=g,ie++}function setChildren(){set([]),ae=ae[ie-1],ie=0}function setObj(g,O){ae=ae[ie-1][g],ie=0,O&&(ae=ae[O])}return function parseDOM(g,O){const L="nodeType"in g?g.nodeType:null;if(!L)throw new TypeError("Not an XML type");if(5===L)return void set(["&",g.nodeName]);let J,ne;function setTemp(){J=ae,ne=ie}function resetTemp(){ae=J,ie=ne,ie++}switch(O={...O},[2,3,4,7,8].includes(L)&&g.nodeValue&&!/^([\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD]|[\uD800-\uDBFF][\uDC00-\uDFFF])*$/u.test(g.nodeValue)&&invalidStateError("Node has bad XML character value"),L){case 1:{const L=g;setTemp();const M=L.nodeName.toLowerCase();setChildren(),set(M);const J={};let ae=!1;O[L.prefix||""]!==L.namespaceURI&&(O[L.prefix||""]=L.namespaceURI,L.prefix?J["xmlns:"+L.prefix]=L.namespaceURI:L.namespaceURI?J.xmlns=L.namespaceURI:J.xmlns=null,ae=!0),L.attributes.length?set([...L.attributes].reduce((function(g,O){return g[O.name]=O.value,g}),J)):ae&&set(J);const{childNodes:ie}=L;ie.length&&(setChildren(),[...ie].forEach((function(g){parseDOM(g,O)}))),resetTemp();break}case 2:{const O=g;set({$attribute:[O.namespaceURI,O.name,O.value]});break}case 3:{const O=g;if(!O.nodeValue)throw new Error("Unexpected null comment value");if(M&&/^\s+$/u.test(O.nodeValue))return void set("");set(O.nodeValue);break}case 4:{const O=g;O.nodeValue?.includes("]]>")&&invalidStateError("CDATA cannot end with closing ]]>"),set(["![",O.nodeValue]);break}case 7:{const O=g;/^xml$/iu.test(O.target)&&invalidStateError('Processing instructions cannot be "xml".'),O.target.includes("?>")&&invalidStateError("Processing instruction targets cannot include ?>"),O.target.includes(":")&&invalidStateError('The processing instruction target cannot include ":"'),O.data.includes("?>")&&invalidStateError("Processing instruction data cannot include ?>"),set(["?",O.target,O.data]);break}case 8:{const O=g;if(!O.nodeValue)throw new Error("Unexpected null comment value");(O.nodeValue.includes("--")||O.nodeValue.length&&O.nodeValue.lastIndexOf("-")===O.nodeValue.length-1)&&invalidStateError("Comments cannot include --"),set(["!",O.nodeValue]);break}case 9:{const L=g;setTemp();set({$document:{childNodes:[]}}),setObj("$document","childNodes");const{childNodes:M}=L;M.length||invalidStateError("Documents must have a child node"),[...M].forEach((function(g){parseDOM(g,O)})),resetTemp();break}case 10:{const O=g;setTemp();const L={$DOCTYPE:{name:O.name}};/^(\u0020|\u000D|\u000A|[a-zA-Z0-9]|[-'()+,./:=?;!*#@$_%])*$/u.test(O.publicId)||invalidStateError("A publicId must have valid characters."),function addExternalID(g,O){O.systemId.includes('"')&&O.systemId.includes("'")&&invalidStateError("systemId cannot have both single and double quotes.");const{publicId:L,systemId:M}=O;M&&(g.systemId=M),L&&(g.publicId=L)}(L.$DOCTYPE,O),set(L),resetTemp();break}case 11:{const L=g;setTemp(),set({"#":[]}),setObj("#");const{childNodes:M}=L;[...M].forEach((function(g){parseDOM(g,O)})),resetTemp();break}default:throw new TypeError("Not an XML type")}}(g,{}),O?JSON.stringify(J[0]):J[0]},jml.toJMLString=function(g,O){return jml.toJML(g,Object.assign(O||{},{stringOutput:!0}))},jml.toDOM=function(...g){return jml(...g)},jml.toHTML=function(...g){const O=jml(...g);switch(O.nodeType){case 1:return O.outerHTML;case 2:return`${O.name}="${O.value.replace(/"/gu,""")}"`;case 3:if(!O.nodeValue)throw new TypeError("Unexpected null Text node");return O.nodeValue;case 9:case 11:return[...O.childNodes].map((g=>jml.toHTML(g))).join("");case 10:{const g=O;return`<!DOCTYPE ${g.name}${g.publicId?` PUBLIC "${g.publicId}" "${g.systemId}"`:g.systemId?` SYSTEM "${g.systemId}"`:""}>`}default:throw new Error("Unexpected node type")}},jml.toDOMString=function(...g){return jml.toHTML(...g)},jml.toXML=function(...g){if(!win)throw new Error("No window object set");const O=jml(...g);return(new win.XMLSerializer).serializeToString(O)},jml.toXMLDOMString=function(...g){return jml.toXML(...g)};class JamilihMap extends Map{get(g){const O="string"==typeof g?$$2(g):g;return super.get.call(this,O)}set(g,O){const L="string"==typeof g?$$2(g):g;return super.set.call(this,L,O)}invoke(g,O,...L){const M="string"==typeof g?$$2(g):g;return this.get(M)[O](M,...L)}}class JamilihWeakMap extends WeakMap{get(g){const O="string"==typeof g?$$2(g):g;if(!O)throw new Error("Can't find the element");return super.get.call(this,O)}set(g,O){const L="string"==typeof g?$$2(g):g;if(!L)throw new Error("Can't find the element");return super.set.call(this,L,O)}invoke(g,O,...L){const M="string"==typeof g?$$2(g):g;if(!M)throw new Error("Can't find the element");return this.get(M)[O](M,...L)}}jml.Map=JamilihMap,jml.WeakMap=JamilihWeakMap,jml.weak=function(g,...O){const L=new JamilihWeakMap;return[L,jml({$map:[L,g]},...O)]},jml.strong=function(g,...O){const L=new JamilihMap;return[L,jml({$map:[L,g]},...O)]},jml.symbol=jml.sym=jml.for=function(g,O){return("string"==typeof g?$$2(g):g)["symbol"==typeof O?O:Symbol.for(O)]},jml.command=function(g,O,L,...M){if(!(g="string"==typeof g?$$2(g):g))throw new Error("No element found");let J;if(["symbol","string"].includes(typeof O))return J=jml.sym(g,O),"function"==typeof J?J(L,...M):J[L](...M);if(J=O.get(g),!J)throw new Error("No map found");return"function"==typeof J?J.call(g,L,...M):J[L](g,...M)},jml.setWindow=g=>{win=g,doc=win?.document,doc&&doc.body&&(body=doc.body)},jml.getWindow=()=>{if(!win)throw new Error("No window object set");return win},doc&&doc.body&&(body=doc.body);const nbsp$1=" ";function ownKeys(g,O){var L=Object.keys(g);if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(g);O&&(M=M.filter((function(O){return Object.getOwnPropertyDescriptor(g,O).enumerable}))),L.push.apply(L,M)}return L}function _objectSpread2(g){for(var O=1;O<arguments.length;O++){var L=null!=arguments[O]?arguments[O]:{};O%2?ownKeys(Object(L),!0).forEach((function(O){_defineProperty(g,O,L[O])})):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(L)):ownKeys(Object(L)).forEach((function(O){Object.defineProperty(g,O,Object.getOwnPropertyDescriptor(L,O))}))}return g}function _typeof(g){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"==typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},_typeof(g)}function _classCallCheck(g,O){if(!(g instanceof O))throw new TypeError("Cannot call a class as a function")}function _createClass(g,O,L){return O&&function _defineProperties(g,O){for(var L=0;L<O.length;L++){var M=O[L];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(g,_toPropertyKey(M.key),M)}}(g.prototype,O),Object.defineProperty(g,"prototype",{writable:!1}),g}function _defineProperty(g,O,L){return(O=_toPropertyKey(O))in g?Object.defineProperty(g,O,{value:L,enumerable:!0,configurable:!0,writable:!0}):g[O]=L,g}function _slicedToArray(g,O){return function _arrayWithHoles(g){if(Array.isArray(g))return g}(g)||function _iterableToArrayLimit(g,O){var L=null==g?null:"undefined"!=typeof Symbol&&g[Symbol.iterator]||g["@@iterator"];if(null!=L){var M,J,ae,ie,ne=[],oe=!0,pe=!1;try{if(ae=(L=L.call(g)).next,0===O){if(Object(L)!==L)return;oe=!1}else for(;!(oe=(M=ae.call(L)).done)&&(ne.push(M.value),ne.length!==O);oe=!0);}catch(g){pe=!0,J=g}finally{try{if(!oe&&null!=L.return&&(ie=L.return(),Object(ie)!==ie))return}finally{if(pe)throw J}}return ne}}(g,O)||_unsupportedIterableToArray(g,O)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(g,O){if(g){if("string"==typeof g)return _arrayLikeToArray(g,O);var L=Object.prototype.toString.call(g).slice(8,-1);return"Object"===L&&g.constructor&&(L=g.constructor.name),"Map"===L||"Set"===L?Array.from(g):"Arguments"===L||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L)?_arrayLikeToArray(g,O):void 0}}function _arrayLikeToArray(g,O){(null==O||O>g.length)&&(O=g.length);for(var L=0,M=new Array(O);L<O;L++)M[L]=g[L];return M}function _toPropertyKey(g){var O=function _toPrimitive(g,O){if("object"!=typeof g||null===g)return g;var L=g[Symbol.toPrimitive];if(void 0!==L){var M=L.call(g,O);if("object"!=typeof M)return M;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(g)}(g,"string");return"symbol"==typeof O?O:String(O)}var e=_createClass((function TypesonPromise(g){_classCallCheck(this,TypesonPromise),this.p=new Promise(g)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(g,O){var L=this;return new e((function(M,J){L.p.then((function(O){M(g?g(O):O)})).catch((function(g){return O?O(g):Promise.reject(g)})).then(M,J)}))},e.prototype.catch=function(g){return this.then((function(){}),g)},e.resolve=function(g){return new e((function(O){O(g)}))},e.reject=function(g){return new e((function(O,L){L(g)}))},e.all=function(g){return new e((function(O,L){Promise.all(g.map((function(g){return null!=g&&g.constructor&&"__typeson__type__"in g.constructor&&"TypesonPromise"===g.constructor.__typeson__type__?g.p:g}))).then(O,L)}))},e.race=function(g){return new e((function(O,L){Promise.race(g.map((function(g){return null!=g&&g.constructor&&"__typeson__type__"in g.constructor&&"TypesonPromise"===g.constructor.__typeson__type__?g.p:g}))).then(O,L)}))},e.allSettled=function(g){return new e((function(O,L){Promise.allSettled(g.map((function(g){return null!=g&&g.constructor&&"__typeson__type__"in g.constructor&&"TypesonPromise"===g.constructor.__typeson__type__?g.p:g}))).then(O,L)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(g,O){return isObject(g)&&"function"==typeof g.then&&!O}function toStringTag(g){return Object.prototype.toString.call(g).slice(8,-1)}function hasConstructorOf(g,O){if(!g||"object"!==_typeof(g))return!1;var L=r(g);if(!L)return null===O;var M=t(L,"constructor")&&L.constructor;return"function"!=typeof M?null===O:O===M||null!==O&&Function.prototype.toString.call(M)===Function.prototype.toString.call(O)||"function"==typeof O&&"string"==typeof M.__typeson__type__&&M.__typeson__type__===O.__typeson__type__}function isPlainObject(g){return!(!g||"Object"!==toStringTag(g))&&(!r(g)||hasConstructorOf(g,Object))}function isUserObject(g){if(!g||"Object"!==toStringTag(g))return!1;var O=r(g);return!O||hasConstructorOf(g,Object)||isUserObject(O)}function isObject(g){return null!==g&&"object"===_typeof(g)}function escapeKeyPathComponent(g){return g.replaceAll("''","''''").replace(/^$/,"''").replaceAll("~","~0").replaceAll(".","~1")}function unescapeKeyPathComponent(g){return g.replaceAll("~1",".").replaceAll("~0","~").replace(/^''$/,"").replaceAll("''''","''")}function getByKeyPath(g,O){if(""===O)return g;if(null===g||"object"!==_typeof(g))throw new TypeError("Unexpected non-object type");var L=O.indexOf(".");if(L>-1){var M=g[unescapeKeyPathComponent(O.slice(0,L))];return void 0===M?void 0:getByKeyPath(M,O.slice(L+1))}return g[unescapeKeyPathComponent(O)]}function setAtKeyPath(g,O,L){if(""===O)return L;if(!g||"object"!==_typeof(g))throw new TypeError("Unexpected non-object type");var M=O.indexOf(".");return M>-1?setAtKeyPath(g[unescapeKeyPathComponent(O.slice(0,M))],O.slice(M+1),L):(g[unescapeKeyPathComponent(O)]=L,g)}function getJSONType(g){return null===g?"null":Array.isArray(g)?"array":_typeof(g)}function _await(g,O,L){return g&&g.then||(g=Promise.resolve(g)),O?g.then(O):g}var n=Object.keys,a=Object.hasOwn,o=Array.isArray,i$1=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(g){return function(){for(var O=[],L=0;L<arguments.length;L++)O[L]=arguments[L];try{return Promise.resolve(g.apply(this,O))}catch(g){return Promise.reject(g)}}}function nestedPathsFirst(g,O){var L,M;if(""===g.keypath)return-1;var J=null!==(L=g.keypath.match(/\./g))&&void 0!==L?L:0,ae=null!==(M=O.keypath.match(/\./g))&&void 0!==M?M:0;return J&&(J=J.length),ae&&(ae=ae.length),J>ae?-1:J<ae?1:g.keypath<O.keypath?-1:g.keypath>O.keypath?1:0}var c=function(){function Typeson(g){_classCallCheck(this,Typeson),this.options=g,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return _createClass(Typeson,[{key:"stringify",value:function stringify(g,O,L,M){M=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),M),{},{stringification:!0});var J=this.encapsulate(g,null,M);return o(J)?JSON.stringify(J[0],O,L):J.then((function(g){return JSON.stringify(g,O,L)}))}},{key:"stringifySync",value:function stringifySync(g,O,L,M){return this.stringify(g,O,L,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},M),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(g,O,L,M){return this.stringify(g,O,L,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},M),{},{sync:!1}))}},{key:"parse",value:function parse(g,O,L){return L=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),L),{},{parse:!0}),this.revive(JSON.parse(g,O),L)}},{key:"parseSync",value:function parseSync(g,O,L){return this.parse(g,O,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},L),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(g,O,L){return this.parse(g,O,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},L),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(g,O){var L=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return L.returnTypeNames=!0,this.encapsulate(g,O,L)}},{key:"rootTypeName",value:function rootTypeName(g,O){var L=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return L.iterateNone=!0,this.encapsulate(g,O,L)}},{key:"encapsulate",value:function encapsulate(g,O,L){var M=this,J=_objectSpread2(_objectSpread2({sync:!0},this.options),L),ae=J.sync,ie={},ne=[],oe=[],pe=[],le=!("cyclic"in J)||J.cyclic,ue=J.encapsulateObserver,de=function finish(g){var O=Object.values(ie);if(J.iterateNone)return O.length?O[0]:getJSONType(g);if(O.length){if(J.returnTypeNames)return function _toConsumableArray(g){return function _arrayWithoutHoles(g){if(Array.isArray(g))return _arrayLikeToArray(g)}(g)||function _iterableToArray(g){if("undefined"!=typeof Symbol&&null!=g[Symbol.iterator]||null!=g["@@iterator"])return Array.from(g)}(g)||_unsupportedIterableToArray(g)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(O));g&&isPlainObject(g)&&!a(g,"$types")?g.$types=ie:g={$:g,$types:{$:ie}}}else isObject(g)&&a(g,"$types")&&(g={$:g,$types:!0});return!J.returnTypeNames&&g},he=_async((function(g,O){return _await(Promise.all(O.map((function(g){return g[1].p}))),(function(L){return _await(Promise.all(L.map(_async((function(L){var M=!1,J=[],ae=_slicedToArray(O.splice(0,1),1),ie=_slicedToArray(ae[0],7),ne=ie[0],oe=ie[2],pe=ie[3],le=ie[4],ue=ie[5],de=ie[6],ye=me(ne,L,oe,pe,J,!0,de),fe=hasConstructorOf(ye,e);return function _invoke(g,O){var L=g();return L&&L.then?L.then(O):O(L)}((function(){if(ne&&fe)return _await(ye.p,(function(O){le[ue]=O;var L=he(g,J);return M=!0,L}))}),(function(O){return M?O:(ne?le[ue]=ye:g=fe?ye.p:ye,he(g,J))}))})))),(function(){return g}))}))})),ye=function _adaptBuiltinStateObjectProperties(g,O,L){Object.assign(g,O);var M=i$1.map((function(O){var L=g[O];return delete g[O],L}));L(),i$1.forEach((function(O,L){g[O]=M[L]}))},me=function _encapsulate(g,O,L,ae,pe,le,de){var he,me={},ge=_typeof(O),ve=ue?function(M){var J,ie=null!==(J=null!=de?de:ae.type)&&void 0!==J?J:getJSONType(O);ue(Object.assign(null!=M?M:me,{keypath:g,value:O,cyclic:L,stateObj:ae,promisesData:pe,resolvingTypesonPromise:le,awaitingTypesonPromise:hasConstructorOf(O,e)},{type:ie}))}:null;if(["string","boolean","number","undefined"].includes(ge))return void 0===O||Number.isNaN(O)||O===Number.NEGATIVE_INFINITY||O===Number.POSITIVE_INFINITY||0===O?(he=ae.replaced?O:fe(g,O,ae,pe,!1,le,ve))!==O&&(me={replaced:he}):he=O,ve&&ve(),he;if(null===O)return ve&&ve(),O;if(L&&!ae.iterateIn&&!ae.iterateUnsetNumeric&&O&&"object"===_typeof(O)){var be=ne.indexOf(O);if(!(be<0))return ie[g]="#",ve&&ve({cyclicKeypath:oe[be]}),"#"+oe[be];!0===L&&(ne.push(O),oe.push(g))}var xe,Se,Te=isPlainObject(O),Ie=o(O),we=(Te||Ie)&&(!M.plainObjectReplacers.length||ae.replaced)||ae.iterateIn?O:fe(g,O,ae,pe,Te||Ie,null,ve);if(we!==O?(he=we,me={replaced:we}):""===g&&hasConstructorOf(O,e)?(pe.push([g,O,L,ae,void 0,void 0,ae.type]),he=O):Ie&&"object"!==ae.iterateIn||"array"===ae.iterateIn?(xe=new Array(O.length),me={clone:xe}):(["function","symbol"].includes(_typeof(O))||"toJSON"in O||hasConstructorOf(O,e)||hasConstructorOf(O,Promise)||hasConstructorOf(O,ArrayBuffer))&&!Te&&"object"!==ae.iterateIn?he=O:(xe={},ae.addLength&&(xe.length=O.length),me={clone:xe}),ve&&ve(),J.iterateNone)return null!==(Se=xe)&&void 0!==Se?Se:he;if(!xe)return he;if(ae.iterateIn){var _e=function _loop(M){var J={ownKeys:a(O,M)};ye(ae,J,(function(){var J=g+(g?".":"")+escapeKeyPathComponent(M),ie=_encapsulate(J,O[M],Boolean(L),ae,pe,le);hasConstructorOf(ie,e)?pe.push([J,ie,Boolean(L),ae,xe,M,ae.type]):void 0!==ie&&(xe[M]=ie)}))};for(var Ee in O)_e(Ee);ve&&ve({endIterateIn:!0,end:!0})}else n(O).forEach((function(M){var J=g+(g?".":"")+escapeKeyPathComponent(M);ye(ae,{ownKeys:!0},(function(){var g=_encapsulate(J,O[M],Boolean(L),ae,pe,le);hasConstructorOf(g,e)?pe.push([J,g,Boolean(L),ae,xe,M,ae.type]):void 0!==g&&(xe[M]=g)}))})),ve&&ve({endIterateOwn:!0,end:!0});if(ae.iterateUnsetNumeric){for(var Ce=O.length,ke=function _loop2(M){if(!(M in O)){var J="".concat(g).concat(g?".":"").concat(M);ye(ae,{ownKeys:!1},(function(){var g=_encapsulate(J,void 0,Boolean(L),ae,pe,le);hasConstructorOf(g,e)?pe.push([J,g,Boolean(L),ae,xe,M,ae.type]):void 0!==g&&(xe[M]=g)}))}},Ne=0;Ne<Ce;Ne++)ke(Ne);ve&&ve({endIterateUnsetNumeric:!0,end:!0})}return xe},fe=function replace(g,O,L,J,ne,oe,pe){for(var ue=ne?M.plainObjectReplacers:M.nonplainObjectReplacers,de=ue.length;de--;){var he=ue[de];if(he.test(O,L)){var ye=he.type;if(M.revivers[ye]){var fe=ie[g];ie[g]=fe?[ye].concat(fe):ye}if(Object.assign(L,{type:ye,replaced:!0}),(ae||!he.replaceAsync)&&!he.replace)return pe&&pe({typeDetected:!0}),me(g,O,le&&"readonly",L,J,oe,ye);pe&&pe({replacing:!0});var ge=void 0;if(ae||!he.replaceAsync){if(void 0===he.replace)throw new TypeError("Missing replacer");ge=he.replace(O,L)}else ge=he.replaceAsync(O,L);return me(g,ge,le&&"readonly",L,J,oe,ye)}}return O},ge=me("",g,le,null!=O?O:{},pe);if(pe.length)return ae&&J.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(he(ge,pe)).then(de);if(!ae&&J.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return J.stringification&&ae?[de(ge)]:ae?de(ge):Promise.resolve(de(ge))}},{key:"encapsulateSync",value:function encapsulateSync(g,O,L){return this.encapsulate(g,O,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},L),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(g,O,L){return this.encapsulate(g,O,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},L),{},{sync:!1}))}},{key:"revive",value:function revive(g,O){var L=this,M=_objectSpread2(_objectSpread2({sync:!0},this.options),O),J=M.sync;function finishRevival(g){if(J)return g;if(M.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(g)}if(!g||"object"!==_typeof(g)||Array.isArray(g))return finishRevival(g);var ae=g.$types;if(!0===ae)return finishRevival(g.$);if(!ae||"object"!==_typeof(ae)||Array.isArray(ae))return finishRevival(g);var ie=[],ne={},oe=!0;ae.$&&isPlainObject(ae.$)&&(g=g.$,ae=ae.$,oe=!1);var pe=function executeReviver(g,O){var M,ae=_slicedToArray(null!==(M=L.revivers[g])&&void 0!==M?M:[],1)[0];if(!ae)throw new Error("Unregistered type: "+g);if(J&&!("revive"in ae))return O;if(!J&&ae.reviveAsync)return ae.reviveAsync(O,ne);if(ae.revive)return ae.revive(O,ne);throw new Error("Missing reviver")},le=[];function checkUndefined(g){return hasConstructorOf(g,s)?void 0:g}var ue,de=function revivePlainObjects(){var O=[];if(!ae)throw new Error("Found bad `types`");if(Object.entries(ae).forEach((function(g){var M=_slicedToArray(g,2),J=M[0],ie=M[1];"#"!==ie&&[].concat(ie).forEach((function(g){var M;_slicedToArray(null!==(M=L.revivers[g])&&void 0!==M?M:[null,{}],2)[1].plain&&(O.push({keypath:J,type:g}),delete ae[J])}))})),O.length)return O.sort(nestedPathsFirst).reduce((function reducer(O,L){var M=L.keypath,J=L.type;if(isThenable(O))return O.then((function(g){return reducer(g,{keypath:M,type:J})}));var ae=getByKeyPath(g,M);if(hasConstructorOf(ae=pe(J,ae),e))return ae.then((function(O){var L=setAtKeyPath(g,M,O);L===O&&(g=L)}));var ie=setAtKeyPath(g,M,ae);ie===ae&&(g=ie)}),void 0)}();return hasConstructorOf(de,e)?ue=de.then((function(){return g})):(ue=function _revive(g,O,L,M,J){if(!oe||"$types"!==g){var ne=ae[g],ue=o(O);if(ue||isPlainObject(O)){var de=ue?new Array(O.length):{};for(n(O).forEach((function(M){var J=_revive(g+(g?".":"")+escapeKeyPathComponent(M),O[M],null!=L?L:de,de,M),ae=function set(g){return hasConstructorOf(g,s)?de[M]=void 0:void 0!==g&&(de[M]=g),g};hasConstructorOf(J,e)?le.push(J.then((function(g){return ae(g)}))):ae(J)})),O=de;ie.length;){var he=_slicedToArray(ie[0],4),ye=he[0],me=he[1],fe=he[2],ge=he[3],ve=getByKeyPath(ye,me);if(void 0===ve)break;fe[ge]=ve,ie.splice(0,1)}}if(!ne)return O;if("#"===ne){var be=getByKeyPath(L,O.slice(1));return void 0===be&&ie.push([L,O.slice(1),M,J]),be}return[].concat(ne).reduce((function reducer(g,O){if(hasConstructorOf(g,e))return g.then((function(g){return reducer(g,O)}));if("string"!=typeof O)throw new TypeError("Bad type JSON");return pe(O,g)}),O)}}("",g,null),le.length&&(ue=e.resolve(ue).then((function(g){return e.all([g].concat(le))})).then((function(g){return _slicedToArray(g,1)[0]})))),isThenable(ue)?J&&M.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(ue,e)?ue.p.then(checkUndefined):ue:!J&&M.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():J?checkUndefined(ue):Promise.resolve(checkUndefined(ue))}},{key:"reviveSync",value:function reviveSync(g,O){return this.revive(g,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},O),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(g,O){return this.revive(g,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},O),{},{sync:!1}))}},{key:"register",value:function register(g,O){var L=this,M=null!=O?O:{},J=function R(g){o(g)?g.forEach((function(g){return R(g)})):n(g).forEach((function(O){var J;if("#"===O)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(O))throw new TypeError("Plain JSON object types are reserved as type names");var ae=g[O],ie=ae&&"function"!=typeof ae&&!Array.isArray(ae)&&ae.testPlainObjects?L.plainObjectReplacers:L.nonplainObjectReplacers,ne=ie.filter((function(g){return g.type===O}));if(ne.length&&(ie.splice(ie.indexOf(ne[0]),1),delete L.revivers[O],delete L.types[O]),"function"==typeof ae){var oe=ae;ae={test:function test(g){return g&&g.constructor===oe},replace:function replace(g){return _objectSpread2({},g)},revive:function revive(g){return Object.assign(Object.create(oe.prototype),g)}}}else if(o(ae)){var pe=_slicedToArray(ae,3);ae={test:pe[0],replace:pe[1],revive:pe[2]}}if(null!==(J=ae)&&void 0!==J&&J.test){var le={type:O,test:ae.test.bind(ae)};ae.replace&&(le.replace=ae.replace.bind(ae)),ae.replaceAsync&&(le.replaceAsync=ae.replaceAsync.bind(ae));var ue="number"==typeof M.fallback?M.fallback:M.fallback?0:Number.POSITIVE_INFINITY;if(ae.testPlainObjects?L.plainObjectReplacers.splice(ue,0,le):L.nonplainObjectReplacers.splice(ue,0,le),ae.revive||ae.reviveAsync){var de={};ae.revive&&(de.revive=ae.revive.bind(ae)),ae.reviveAsync&&(de.reviveAsync=ae.reviveAsync.bind(ae)),L.revivers[O]=[de,{plain:ae.testPlainObjects}]}L.types[O]=ae}}))};return[].concat(g).forEach((function(g){return J(g)})),this}}]),Typeson}(),s=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));s.__typeson__type__="TypesonUndefined";for(var u=["null","boolean","number","string","array","object"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=new Uint8Array(256),y=0;y<64;y++)f[l.codePointAt(y)]=y;var p=function encode(g,O,L){null==L&&(L=g.byteLength);for(var M=new Uint8Array(g,0,L),J=M.length,ae="",ie=0;ie<J;ie+=3)ae+=l[M[ie]>>2],ae+=l[(3&M[ie])<<4|M[ie+1]>>4],ae+=l[(15&M[ie+1])<<2|M[ie+2]>>6],ae+=l[63&M[ie+2]];return J%3==2?ae=ae.slice(0,-1)+"=":J%3==1&&(ae=ae.slice(0,-2)+"=="),ae},d$1=function decode(g,O){var L=g.length;if(L%4)throw new Error("Bad base64 length: not divisible by four");var M,J,ae,ie,ne=.75*g.length,oe=0;"="===g[g.length-1]&&(ne--,"="===g[g.length-2]&&ne--);for(var pe=new ArrayBuffer(ne,O),le=new Uint8Array(pe),ue=0;ue<L;ue+=4)M=f[g.codePointAt(ue)],J=f[g.codePointAt(ue+1)],ae=f[g.codePointAt(ue+2)],ie=f[g.codePointAt(ue+3)],le[oe++]=M<<2|J>>4,le[oe++]=(15&J)<<4|ae>>2,le[oe++]=(3&ae)<<6|63&ie;return pe};const v={arraybuffer:{test:g=>"ArrayBuffer"===toStringTag(g),replace(g,O){O.buffers||(O.buffers=[]);const L=O.buffers.indexOf(g);return L>-1?{index:L}:(O.buffers.push(g),{s:p(g),maxByteLength:g.maxByteLength})},revive(g,O){if(O.buffers||(O.buffers=[]),Object.hasOwn(g,"index"))return O.buffers[g.index];const L=d$1(g.s,{maxByteLength:g.maxByteLength});return O.buffers.push(L),L}}},m={bigintObject:{test:g=>"object"==typeof g&&hasConstructorOf(g,BigInt),replace:String,revive:g=>new Object(BigInt(g))}},b={bigint:{test:g=>"bigint"==typeof g,replace:String,revive:g=>BigInt(g)}};function arraybuffer2string(g){return new Uint8Array(g).reduce(((g,O)=>g+String.fromCodePoint(O)),"")}function string2arraybuffer(g){const O=new Uint8Array(g.length);for(let L=0;L<g.length;L++)O[L]=g.charCodeAt(L);return O.buffer}const h={blob:{test:g=>"Blob"===toStringTag(g),replace(g){const O=new XMLHttpRequest;if(O.overrideMimeType("text/plain; charset=x-user-defined"),O.open("GET",URL.createObjectURL(g),!1),O.send(),200!==O.status&&0!==O.status)throw new Error("Bad Blob access: "+O.status);return{type:g.type,stringContents:O.responseText}},revive(g){const{type:O,stringContents:L}=g;return new Blob([string2arraybuffer(L)],{type:O})},replaceAsync:g=>new e(((O,L)=>{const M=new FileReader;M.addEventListener("load",(()=>{O({type:g.type,stringContents:arraybuffer2string(M.result)})})),M.addEventListener("error",(()=>{L(M.error)})),M.readAsArrayBuffer(g)}))}};function generateUUID(){let g=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/gu,(function(O){const L=Math.trunc((g+16*Math.random())%16);return g=Math.floor(g/16),("x"===O?L:3&L|8).toString(16)}))}const w={cryptokey:{test:g=>"CryptoKey"===toStringTag(g)&&g.extractable,replaceAsync:g=>new e((async(O,L)=>{let M;try{M=await crypto.subtle.exportKey("jwk",g)}catch(O){return void L(O)}O({jwk:M,algorithm:g.algorithm,usages:g.usages})})),revive(g){const{jwk:O,algorithm:L,usages:M}=g;return crypto.subtle.importKey("jwk",O,L,!0,M)}}},_={dataview:{test:g=>"DataView"===toStringTag(g),replace({buffer:g,byteOffset:O,byteLength:L},M){M.buffers||(M.buffers=[]);const J=M.buffers.indexOf(g);return J>-1?{index:J,byteOffset:O,byteLength:L}:(M.buffers.push(g),{encoded:p(g),maxByteLength:g.maxByteLength,byteOffset:O,byteLength:L})},revive(g,O){O.buffers||(O.buffers=[]);const{byteOffset:L,byteLength:M,encoded:J,index:ae,maxByteLength:ie}=g;let ne;return"index"in g?ne=O.buffers[ae]:(ne=d$1(J,void 0===ie?ie:{maxByteLength:ie}),O.buffers.push(ne)),new DataView(ne,L,M)}}},A={date:{test:g=>"Date"===toStringTag(g),replace(g){const O=g.getTime();return Number.isNaN(O)?"NaN":O},revive:g=>"NaN"===g?new Date(Number.NaN):new Date(g)}},S={domexception:{test:g=>"DOMException"===toStringTag(g),replace:g=>({name:g.name,message:g.message}),revive:({message:g,name:O})=>new DOMException(g,O)}},j={};function create$5(g){j[g.name.toLowerCase()]={test:O=>toStringTag(O)===g.name,replace:g=>g.is2D?{a:g.a,b:g.b,c:g.c,d:g.d,e:g.e,f:g.f}:{m11:g.m11,m12:g.m12,m13:g.m13,m14:g.m14,m21:g.m21,m22:g.m22,m23:g.m23,m24:g.m24,m31:g.m31,m32:g.m32,m33:g.m33,m34:g.m34,m41:g.m41,m42:g.m42,m43:g.m43,m44:g.m44},revive:O=>Object.hasOwn(O,"a")?new g([O.a,O.b,O.c,O.d,O.e,O.f]):new g([O.m11,O.m12,O.m13,O.m14,O.m21,O.m22,O.m23,O.m24,O.m31,O.m32,O.m33,O.m34,O.m41,O.m42,O.m43,O.m44])}}"undefined"!=typeof DOMMatrix&&create$5(DOMMatrix),"undefined"!=typeof DOMMatrixReadOnly&&create$5(DOMMatrixReadOnly);const T={};function create$4(g){T[g.name.toLowerCase()]={test:O=>toStringTag(O)===g.name,replace:g=>({x:g.x,y:g.y,z:g.z,w:g.w}),revive:({x:O,y:L,z:M,w:J})=>new g(O,L,M,J)}}"undefined"!=typeof DOMPoint&&create$4(DOMPoint),"undefined"!=typeof DOMPointReadOnly&&create$4(DOMPointReadOnly);const I={domquad:{test:g=>"DOMQuad"===toStringTag(g),replace:g=>({p1:g.p1,p2:g.p2,p3:g.p3,p4:g.p4}),revive:({p1:g,p2:O,p3:L,p4:M})=>new DOMQuad(g,O,L,M)}},N={};function create$3(g){N[g.name.toLowerCase()]={test:O=>toStringTag(O)===g.name,replace:g=>({x:g.x,y:g.y,width:g.width,height:g.height}),revive:({x:O,y:L,width:M,height:J})=>new g(O,L,M,J)}}"undefined"!=typeof DOMRect&&create$3(DOMRect),"undefined"!=typeof DOMRectReadOnly&&create$3(DOMRectReadOnly);const P={error:{test:g=>"Error"===toStringTag(g),replace:({name:g,message:O,cause:L,stack:M,fileName:J,lineNumber:ae,columnNumber:ie})=>({name:g,message:O,cause:L,stack:M,fileName:J,lineNumber:ae,columnNumber:ie}),revive(g){const O=new Error(g.message);return O.name=g.name,O.cause=g.cause,O.stack=g.stack,O.fileName=g.fileName,O.lineNumber=g.lineNumber,O.columnNumber=g.columnNumber,O}}},x={};function create$2(g){x[g.name.toLowerCase()]={test:O=>hasConstructorOf(O,g),replace:({name:g,message:O,cause:L,stack:M,fileName:J,lineNumber:ae,columnNumber:ie,errors:ne})=>({name:g,message:O,cause:L,stack:M,fileName:J,lineNumber:ae,columnNumber:ie,errors:ne}),revive(O){const L="undefined"!=typeof AggregateError&&g===AggregateError?new g(O.errors,O.message):new g(O.message);return L.name=O.name,L.cause=O.cause,L.stack=O.stack,L.fileName=O.fileName,L.lineNumber=O.lineNumber,L.columnNumber=O.columnNumber,L}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((g=>create$2(g))),"undefined"!=typeof AggregateError&&create$2(AggregateError),"function"==typeof InternalError&&create$2(InternalError);const E={file:{test:g=>"File"===toStringTag(g),replace(g){const O=new XMLHttpRequest;if(O.overrideMimeType("text/plain; charset=x-user-defined"),O.open("GET",URL.createObjectURL(g),!1),O.send(),200!==O.status&&0!==O.status)throw new Error("Bad File access: "+O.status);return{type:g.type,stringContents:O.responseText,name:g.name,lastModified:g.lastModified}},revive:({name:g,type:O,stringContents:L,lastModified:M})=>new File([string2arraybuffer(L)],g,{type:O,lastModified:M}),replaceAsync:g=>new e((function(O,L){const M=new FileReader;M.addEventListener("load",(function(){O({type:g.type,stringContents:arraybuffer2string(M.result),name:g.name,lastModified:g.lastModified})})),M.addEventListener("error",(function(){L(M.error)})),M.readAsArrayBuffer(g)}))}},C={file:E.file,filelist:{test:g=>"FileList"===toStringTag(g),replace(g){const O=[];for(let L=0;L<g.length;L++)O[L]=g.item(L);return O},revive(g){class FileList{constructor(){this._files=arguments[0],this.length=this._files.length}item(g){return this._files[g]}get[Symbol.toStringTag](){return"FileList"}}return new FileList(g)}}},B={imagebitmap:{test:g=>"ImageBitmap"===toStringTag(g)||g&&g.dataset&&"ImageBitmap"===g.dataset.toStringTag,replace(g){const O=document.createElement("canvas");return O.getContext("2d").drawImage(g,0,0),{width:g.width,height:g.height,dataURL:O.toDataURL()}},revive(g){const O="undefined"==typeof OffscreenCanvas?document.createElement("canvas"):new OffscreenCanvas(g.width,g.height),L=O.getContext("2d"),M=document.createElement("img");return M.addEventListener("load",(function(){L.drawImage(M,0,0)})),M.src=g.dataURL,"undefined"==typeof OffscreenCanvas?O:O.transferToImageBitmap()},reviveAsync(g){const O=document.createElement("canvas"),L=O.getContext("2d"),M=document.createElement("img");return M.addEventListener("load",(function(){L.drawImage(M,0,0)})),M.src=g.dataURL,new e((async(g,L)=>{try{g(await createImageBitmap(O))}catch(g){L(g)}}))}}},k={imagedata:{test:g=>"ImageData"===toStringTag(g),replace:g=>({array:[...g.data],width:g.width,height:g.height}),revive:g=>new ImageData(new Uint8ClampedArray(g.array),g.width,g.height)}},U$1={infinity:{test:g=>g===Number.POSITIVE_INFINITY,replace:()=>"Infinity",revive:()=>Number.POSITIVE_INFINITY}},D={map:{test:g=>"Map"===toStringTag(g),replace:g=>[...g.entries()],revive:g=>new Map(g)}},K={nan:{test:g=>Number.isNaN(g),replace:()=>"NaN",revive:()=>Number.NaN}},F={negativeInfinity:{test:g=>g===Number.NEGATIVE_INFINITY,replace:()=>"-Infinity",revive:()=>Number.NEGATIVE_INFINITY}},$$1={negativeZero:{test:g=>Object.is(g,-0),replace:()=>0,revive:()=>-0}},V={StringObject:{test:g=>"String"===toStringTag(g)&&"object"==typeof g,replace:String,revive:g=>new String(g)},BooleanObject:{test:g=>"Boolean"===toStringTag(g)&&"object"==typeof g,replace:g=>g.valueOf(),revive:g=>new Boolean(g)},NumberObject:{test:g=>"Number"===toStringTag(g)&&"object"==typeof g,replace:Number,revive:g=>new Number(g)}},q={promise:{test:g=>"Promise"===toStringTag(g),replaceAsync:g=>new e((async O=>{try{O({value:await g})}catch(g){O({error:g})}})),revive:g=>g.error?Promise.reject(g.error):Promise.resolve(g.value)}},Y={regexp:{test:g=>"RegExp"===toStringTag(g),replace:g=>({source:g.source,flags:(g.global?"g":"")+(g.ignoreCase?"i":"")+(g.multiline?"m":"")+(g.sticky?"y":"")+(g.unicode?"u":"")}),revive:({source:g,flags:O})=>new RegExp(g,O)}},W={},G={resurrectable:{test:g=>g&&!Array.isArray(g)&&["object","function","symbol"].includes(typeof g),replace(g){const O=generateUUID();return W[O]=g,O},revive:g=>W[g]}},H={set:{test:g=>"Set"===toStringTag(g),replace:g=>[...g.values()],revive:g=>new Set(g)}},z$1={symbol:{test:g=>"symbol"==typeof g,replace:g=>({global:void 0!==Symbol.keyFor(g),sym:String(g).slice(7,-1)}),revive:g=>g.global?Symbol.for(g.sym):Symbol(g.sym)}},Q={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,..."function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[]].forEach((g=>function create$1(g){const O=g.name;Q[O.toLowerCase()]={test:g=>toStringTag(g)===O,replace:g=>(0===g.byteOffset&&g.byteLength===g.buffer.byteLength?g:g.slice(0)).buffer,revive:O=>"ArrayBuffer"===toStringTag(O)?new g(O):O}}(g)));const X={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,..."function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[]].forEach((g=>function create(g){const O=g.name;X[O.toLowerCase()]={test:g=>toStringTag(g)===O,replace({buffer:g,byteOffset:O,length:L},M){M.buffers||(M.buffers=[]);const J=M.buffers.indexOf(g);return J>-1?{index:J,byteOffset:O,length:L}:(M.buffers.push(g),{maxByteLength:g.maxByteLength,encoded:p(g),byteOffset:O,length:L})},revive(O,L){L.buffers||(L.buffers=[]);const{byteOffset:M,length:J,encoded:ae,index:ie,maxByteLength:ne}=O;let oe;return"index"in O?oe=L.buffers[ie]:(oe=d$1(ae,void 0===ne?void 0:{maxByteLength:ne}),L.buffers.push(oe)),new g(oe,M,J)}}}(g)));const Z={undef:{test:(g,O)=>void 0===g&&(O.ownKeys||!("ownKeys"in O)),replace:()=>0,revive:()=>new s}},ee={userObject:{test:g=>isUserObject(g),replace:g=>({...g}),revive:g=>g}},te=[{arrayNonindexKeys:{testPlainObjects:!0,test:(g,O)=>!!Array.isArray(g)&&(Object.keys(g).some((g=>String(Number.parseInt(g))!==g))&&(O.iterateIn="object",O.addLength=!0),!0),replace:(g,O)=>(O.iterateUnsetNumeric=!0,g),revive(g){if(Array.isArray(g))return g;const O=[];return Object.entries(g).forEach((([g,L])=>{O[g]=L})),O}}},{sparseUndefined:{test:(g,O)=>void 0===g&&!1===O.ownKeys,replace:()=>0,revive(){}}}],re=[K,U$1,F,$$1],ce=[ee,Z,te,V,re,A,Y,k,B,E,C,h,P,x].concat("function"==typeof Map?D:[],"function"==typeof Set?H:[],"function"==typeof ArrayBuffer?v:[],"function"==typeof Uint8Array?X:[],"function"==typeof DataView?_:[],"undefined"!=typeof crypto?w:[],"undefined"!=typeof BigInt?[b,m]:[],"undefined"!=typeof DOMException?S:[],"undefined"!=typeof DOMRect?N:[],"undefined"!=typeof DOMPoint?T:[],"undefined"!=typeof DOMQuad?I:[],"undefined"!=typeof DOMMatrix?j:[]),se=ce.concat({checkDataCloneException:{test(g){const O={}.toString.call(g).slice(8,-1);if(["symbol","function"].includes(typeof g)||["Arguments","Module","Promise","WeakMap","WeakSet","Event","MessageChannel"].includes(O)||g&&"object"==typeof g&&"number"==typeof g.nodeType&&"function"==typeof g.insertBefore)throw new DOMException("The object cannot be cloned.","DataCloneError");return!1}}});var astralIdentifierCodes=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],astralIdentifierStartCodes=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],nonASCIIidentifierChars="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",nonASCIIidentifierStartChars="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",reservedWords={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},ecma5AndLessKeywords="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",keywords$1={5:ecma5AndLessKeywords,"5module":ecma5AndLessKeywords+" export import",6:ecma5AndLessKeywords+" const class extends export import super"},keywordRelationalOperator=/^in(stanceof)?$/,nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]"),nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");function isInAstralSet(g,O){for(var L=65536,M=0;M<O.length;M+=2){if((L+=O[M])>g)return!1;if((L+=O[M+1])>=g)return!0}return!1}function isIdentifierStart(g,O){return g<65?36===g:g<91||(g<97?95===g:g<123||(g<=65535?g>=170&&nonASCIIidentifierStart.test(String.fromCharCode(g)):!1!==O&&isInAstralSet(g,astralIdentifierStartCodes)))}function isIdentifierChar(g,O){return g<48?36===g:g<58||!(g<65)&&(g<91||(g<97?95===g:g<123||(g<=65535?g>=170&&nonASCIIidentifier.test(String.fromCharCode(g)):!1!==O&&(isInAstralSet(g,astralIdentifierStartCodes)||isInAstralSet(g,astralIdentifierCodes)))))}var TokenType=function TokenType(g,O){void 0===O&&(O={}),this.label=g,this.keyword=O.keyword,this.beforeExpr=!!O.beforeExpr,this.startsExpr=!!O.startsExpr,this.isLoop=!!O.isLoop,this.isAssign=!!O.isAssign,this.prefix=!!O.prefix,this.postfix=!!O.postfix,this.binop=O.binop||null,this.updateContext=null};function binop(g,O){return new TokenType(g,{beforeExpr:!0,binop:O})}var beforeExpr={beforeExpr:!0},startsExpr={startsExpr:!0},keywords={};function kw(g,O){return void 0===O&&(O={}),O.keyword=g,keywords[g]=new TokenType(g,O)}var types$1={num:new TokenType("num",startsExpr),regexp:new TokenType("regexp",startsExpr),string:new TokenType("string",startsExpr),name:new TokenType("name",startsExpr),privateId:new TokenType("privateId",startsExpr),eof:new TokenType("eof"),bracketL:new TokenType("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new TokenType("]"),braceL:new TokenType("{",{beforeExpr:!0,startsExpr:!0}),braceR:new TokenType("}"),parenL:new TokenType("(",{beforeExpr:!0,startsExpr:!0}),parenR:new TokenType(")"),comma:new TokenType(",",beforeExpr),semi:new TokenType(";",beforeExpr),colon:new TokenType(":",beforeExpr),dot:new TokenType("."),question:new TokenType("?",beforeExpr),questionDot:new TokenType("?."),arrow:new TokenType("=>",beforeExpr),template:new TokenType("template"),invalidTemplate:new TokenType("invalidTemplate"),ellipsis:new TokenType("...",beforeExpr),backQuote:new TokenType("`",startsExpr),dollarBraceL:new TokenType("${",{beforeExpr:!0,startsExpr:!0}),eq:new TokenType("=",{beforeExpr:!0,isAssign:!0}),assign:new TokenType("_=",{beforeExpr:!0,isAssign:!0}),incDec:new TokenType("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new TokenType("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:binop("||",1),logicalAND:binop("&&",2),bitwiseOR:binop("|",3),bitwiseXOR:binop("^",4),bitwiseAND:binop("&",5),equality:binop("==/!=/===/!==",6),relational:binop("</>/<=/>=",7),bitShift:binop("<</>>/>>>",8),plusMin:new TokenType("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:binop("%",10),star:binop("*",10),slash:binop("/",10),starstar:new TokenType("**",{beforeExpr:!0}),coalesce:binop("??",1),_break:kw("break"),_case:kw("case",beforeExpr),_catch:kw("catch"),_continue:kw("continue"),_debugger:kw("debugger"),_default:kw("default",beforeExpr),_do:kw("do",{isLoop:!0,beforeExpr:!0}),_else:kw("else",beforeExpr),_finally:kw("finally"),_for:kw("for",{isLoop:!0}),_function:kw("function",startsExpr),_if:kw("if"),_return:kw("return",beforeExpr),_switch:kw("switch"),_throw:kw("throw",beforeExpr),_try:kw("try"),_var:kw("var"),_const:kw("const"),_while:kw("while",{isLoop:!0}),_with:kw("with"),_new:kw("new",{beforeExpr:!0,startsExpr:!0}),_this:kw("this",startsExpr),_super:kw("super",startsExpr),_class:kw("class",startsExpr),_extends:kw("extends",beforeExpr),_export:kw("export"),_import:kw("import",startsExpr),_null:kw("null",startsExpr),_true:kw("true",startsExpr),_false:kw("false",startsExpr),_in:kw("in",{beforeExpr:!0,binop:7}),_instanceof:kw("instanceof",{beforeExpr:!0,binop:7}),_typeof:kw("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:kw("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:kw("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},lineBreak=/\r\n?|\n|\u2028|\u2029/,lineBreakG=new RegExp(lineBreak.source,"g");function isNewLine(g){return 10===g||13===g||8232===g||8233===g}function nextLineBreak(g,O,L){void 0===L&&(L=g.length);for(var M=O;M<L;M++){var J=g.charCodeAt(M);if(isNewLine(J))return M<L-1&&13===J&&10===g.charCodeAt(M+1)?M+2:M+1}return-1}var nonASCIIwhitespace=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,skipWhiteSpace=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ref=Object.prototype,hasOwnProperty=ref.hasOwnProperty,toString=ref.toString,hasOwn=Object.hasOwn||function(g,O){return hasOwnProperty.call(g,O)},isArray=Array.isArray||function(g){return"[object Array]"===toString.call(g)},regexpCache=Object.create(null);function wordsRegexp(g){return regexpCache[g]||(regexpCache[g]=new RegExp("^(?:"+g.replace(/ /g,"|")+")$"))}function codePointToString(g){return g<=65535?String.fromCharCode(g):(g-=65536,String.fromCharCode(55296+(g>>10),56320+(1023&g)))}var loneSurrogate=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Position=function Position(g,O){this.line=g,this.column=O};Position.prototype.offset=function offset(g){return new Position(this.line,this.column+g)};var SourceLocation=function SourceLocation(g,O,L){this.start=O,this.end=L,null!==g.sourceFile&&(this.source=g.sourceFile)};function getLineInfo(g,O){for(var L=1,M=0;;){var J=nextLineBreak(g,M,O);if(J<0)return new Position(L,O-M);++L,M=J}}var defaultOptions={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},warnedAboutEcmaVersion=!1;function getOptions(g){var O={};for(var L in defaultOptions)O[L]=g&&hasOwn(g,L)?g[L]:defaultOptions[L];if("latest"===O.ecmaVersion?O.ecmaVersion=1e8:null==O.ecmaVersion?(!warnedAboutEcmaVersion&&"object"==typeof console&&console.warn&&(warnedAboutEcmaVersion=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),O.ecmaVersion=11):O.ecmaVersion>=2015&&(O.ecmaVersion-=2009),null==O.allowReserved&&(O.allowReserved=O.ecmaVersion<5),g&&null!=g.allowHashBang||(O.allowHashBang=O.ecmaVersion>=14),isArray(O.onToken)){var M=O.onToken;O.onToken=function(g){return M.push(g)}}return isArray(O.onComment)&&(O.onComment=pushComment(O,O.onComment)),O}function pushComment(g,O){return function(L,M,J,ae,ie,ne){var oe={type:L?"Block":"Line",value:M,start:J,end:ae};g.locations&&(oe.loc=new SourceLocation(this,ie,ne)),g.ranges&&(oe.range=[J,ae]),O.push(oe)}}var SCOPE_TOP=1,SCOPE_FUNCTION=2,SCOPE_ASYNC=4,SCOPE_GENERATOR=8,SCOPE_ARROW=16,SCOPE_SIMPLE_CATCH=32,SCOPE_SUPER=64,SCOPE_DIRECT_SUPER=128,SCOPE_CLASS_STATIC_BLOCK=256,SCOPE_VAR=SCOPE_TOP|SCOPE_FUNCTION|SCOPE_CLASS_STATIC_BLOCK;function functionFlags(g,O){return SCOPE_FUNCTION|(g?SCOPE_ASYNC:0)|(O?SCOPE_GENERATOR:0)}var BIND_NONE=0,BIND_VAR=1,BIND_LEXICAL=2,BIND_FUNCTION=3,BIND_SIMPLE_CATCH=4,BIND_OUTSIDE=5,Parser=function Parser(g,O,L){this.options=g=getOptions(g),this.sourceFile=g.sourceFile,this.keywords=wordsRegexp(keywords$1[g.ecmaVersion>=6?6:"module"===g.sourceType?"5module":5]);var M="";!0!==g.allowReserved&&(M=reservedWords[g.ecmaVersion>=6?6:5===g.ecmaVersion?5:3],"module"===g.sourceType&&(M+=" await")),this.reservedWords=wordsRegexp(M);var J=(M?M+" ":"")+reservedWords.strict;this.reservedWordsStrict=wordsRegexp(J),this.reservedWordsStrictBind=wordsRegexp(J+" "+reservedWords.strictBind),this.input=String(O),this.containsEsc=!1,L?(this.pos=L,this.lineStart=this.input.lastIndexOf("\n",L-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(lineBreak).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=types$1.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===g.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&g.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(SCOPE_TOP),this.regexpState=null,this.privateNameStack=[]},prototypeAccessors={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Parser.prototype.parse=function parse(){var g=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(g)},prototypeAccessors.inFunction.get=function(){return(this.currentVarScope().flags&SCOPE_FUNCTION)>0},prototypeAccessors.inGenerator.get=function(){return(this.currentVarScope().flags&SCOPE_GENERATOR)>0&&!this.currentVarScope().inClassFieldInit},prototypeAccessors.inAsync.get=function(){return(this.currentVarScope().flags&SCOPE_ASYNC)>0&&!this.currentVarScope().inClassFieldInit},prototypeAccessors.canAwait.get=function(){for(var g=this.scopeStack.length-1;g>=0;g--){var O=this.scopeStack[g];if(O.inClassFieldInit||O.flags&SCOPE_CLASS_STATIC_BLOCK)return!1;if(O.flags&SCOPE_FUNCTION)return(O.flags&SCOPE_ASYNC)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},prototypeAccessors.allowSuper.get=function(){var g=this.currentThisScope(),O=g.flags,L=g.inClassFieldInit;return(O&SCOPE_SUPER)>0||L||this.options.allowSuperOutsideMethod},prototypeAccessors.allowDirectSuper.get=function(){return(this.currentThisScope().flags&SCOPE_DIRECT_SUPER)>0},prototypeAccessors.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},prototypeAccessors.allowNewDotTarget.get=function(){var g=this.currentThisScope(),O=g.flags,L=g.inClassFieldInit;return(O&(SCOPE_FUNCTION|SCOPE_CLASS_STATIC_BLOCK))>0||L},prototypeAccessors.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&SCOPE_CLASS_STATIC_BLOCK)>0},Parser.extend=function extend(){for(var g=[],O=arguments.length;O--;)g[O]=arguments[O];for(var L=this,M=0;M<g.length;M++)L=g[M](L);return L},Parser.parse=function parse(g,O){return new this(O,g).parse()},Parser.parseExpressionAt=function parseExpressionAt(g,O,L){var M=new this(L,g,O);return M.nextToken(),M.parseExpression()},Parser.tokenizer=function tokenizer(g,O){return new this(O,g)},Object.defineProperties(Parser.prototype,prototypeAccessors);var pp$9=Parser.prototype,literal=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;pp$9.strictDirective=function(g){if(this.options.ecmaVersion<5)return!1;for(;;){skipWhiteSpace.lastIndex=g,g+=skipWhiteSpace.exec(this.input)[0].length;var O=literal.exec(this.input.slice(g));if(!O)return!1;if("use strict"===(O[1]||O[2])){skipWhiteSpace.lastIndex=g+O[0].length;var L=skipWhiteSpace.exec(this.input),M=L.index+L[0].length,J=this.input.charAt(M);return";"===J||"}"===J||lineBreak.test(L[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(J)||"!"===J&&"="===this.input.charAt(M+1))}g+=O[0].length,skipWhiteSpace.lastIndex=g,g+=skipWhiteSpace.exec(this.input)[0].length,";"===this.input[g]&&g++}},pp$9.eat=function(g){return this.type===g&&(this.next(),!0)},pp$9.isContextual=function(g){return this.type===types$1.name&&this.value===g&&!this.containsEsc},pp$9.eatContextual=function(g){return!!this.isContextual(g)&&(this.next(),!0)},pp$9.expectContextual=function(g){this.eatContextual(g)||this.unexpected()},pp$9.canInsertSemicolon=function(){return this.type===types$1.eof||this.type===types$1.braceR||lineBreak.test(this.input.slice(this.lastTokEnd,this.start))},pp$9.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},pp$9.semicolon=function(){this.eat(types$1.semi)||this.insertSemicolon()||this.unexpected()},pp$9.afterTrailingComma=function(g,O){if(this.type===g)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),O||this.next(),!0},pp$9.expect=function(g){this.eat(g)||this.unexpected()},pp$9.unexpected=function(g){this.raise(null!=g?g:this.start,"Unexpected token")};var DestructuringErrors=function DestructuringErrors(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};pp$9.checkPatternErrors=function(g,O){if(g){g.trailingComma>-1&&this.raiseRecoverable(g.trailingComma,"Comma is not permitted after the rest element");var L=O?g.parenthesizedAssign:g.parenthesizedBind;L>-1&&this.raiseRecoverable(L,O?"Assigning to rvalue":"Parenthesized pattern")}},pp$9.checkExpressionErrors=function(g,O){if(!g)return!1;var L=g.shorthandAssign,M=g.doubleProto;if(!O)return L>=0||M>=0;L>=0&&this.raise(L,"Shorthand property assignments are valid only in destructuring patterns"),M>=0&&this.raiseRecoverable(M,"Redefinition of __proto__ property")},pp$9.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},pp$9.isSimpleAssignTarget=function(g){return"ParenthesizedExpression"===g.type?this.isSimpleAssignTarget(g.expression):"Identifier"===g.type||"MemberExpression"===g.type};var pp$8=Parser.prototype;pp$8.parseTopLevel=function(g){var O=Object.create(null);for(g.body||(g.body=[]);this.type!==types$1.eof;){var L=this.parseStatement(null,!0,O);g.body.push(L)}if(this.inModule)for(var M=0,J=Object.keys(this.undefinedExports);M<J.length;M+=1){var ae=J[M];this.raiseRecoverable(this.undefinedExports[ae].start,"Export '"+ae+"' is not defined")}return this.adaptDirectivePrologue(g.body),this.next(),g.sourceType=this.options.sourceType,this.finishNode(g,"Program")};var loopLabel={kind:"loop"},switchLabel={kind:"switch"};pp$8.isLet=function(g){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;skipWhiteSpace.lastIndex=this.pos;var O=skipWhiteSpace.exec(this.input),L=this.pos+O[0].length,M=this.input.charCodeAt(L);if(91===M||92===M)return!0;if(g)return!1;if(123===M||M>55295&&M<56320)return!0;if(isIdentifierStart(M,!0)){for(var J=L+1;isIdentifierChar(M=this.input.charCodeAt(J),!0);)++J;if(92===M||M>55295&&M<56320)return!0;var ae=this.input.slice(L,J);if(!keywordRelationalOperator.test(ae))return!0}return!1},pp$8.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;skipWhiteSpace.lastIndex=this.pos;var g,O=skipWhiteSpace.exec(this.input),L=this.pos+O[0].length;return!(lineBreak.test(this.input.slice(this.pos,L))||"function"!==this.input.slice(L,L+8)||L+8!==this.input.length&&(isIdentifierChar(g=this.input.charCodeAt(L+8))||g>55295&&g<56320))},pp$8.parseStatement=function(g,O,L){var M,J=this.type,ae=this.startNode();switch(this.isLet(g)&&(J=types$1._var,M="let"),J){case types$1._break:case types$1._continue:return this.parseBreakContinueStatement(ae,J.keyword);case types$1._debugger:return this.parseDebuggerStatement(ae);case types$1._do:return this.parseDoStatement(ae);case types$1._for:return this.parseForStatement(ae);case types$1._function:return g&&(this.strict||"if"!==g&&"label"!==g)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(ae,!1,!g);case types$1._class:return g&&this.unexpected(),this.parseClass(ae,!0);case types$1._if:return this.parseIfStatement(ae);case types$1._return:return this.parseReturnStatement(ae);case types$1._switch:return this.parseSwitchStatement(ae);case types$1._throw:return this.parseThrowStatement(ae);case types$1._try:return this.parseTryStatement(ae);case types$1._const:case types$1._var:return M=M||this.value,g&&"var"!==M&&this.unexpected(),this.parseVarStatement(ae,M);case types$1._while:return this.parseWhileStatement(ae);case types$1._with:return this.parseWithStatement(ae);case types$1.braceL:return this.parseBlock(!0,ae);case types$1.semi:return this.parseEmptyStatement(ae);case types$1._export:case types$1._import:if(this.options.ecmaVersion>10&&J===types$1._import){skipWhiteSpace.lastIndex=this.pos;var ie=skipWhiteSpace.exec(this.input),ne=this.pos+ie[0].length,oe=this.input.charCodeAt(ne);if(40===oe||46===oe)return this.parseExpressionStatement(ae,this.parseExpression())}return this.options.allowImportExportEverywhere||(O||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),J===types$1._import?this.parseImport(ae):this.parseExport(ae,L);default:if(this.isAsyncFunction())return g&&this.unexpected(),this.next(),this.parseFunctionStatement(ae,!0,!g);var pe=this.value,le=this.parseExpression();return J===types$1.name&&"Identifier"===le.type&&this.eat(types$1.colon)?this.parseLabeledStatement(ae,pe,le,g):this.parseExpressionStatement(ae,le)}},pp$8.parseBreakContinueStatement=function(g,O){var L="break"===O;this.next(),this.eat(types$1.semi)||this.insertSemicolon()?g.label=null:this.type!==types$1.name?this.unexpected():(g.label=this.parseIdent(),this.semicolon());for(var M=0;M<this.labels.length;++M){var J=this.labels[M];if(null==g.label||J.name===g.label.name){if(null!=J.kind&&(L||"loop"===J.kind))break;if(g.label&&L)break}}return M===this.labels.length&&this.raise(g.start,"Unsyntactic "+O),this.finishNode(g,L?"BreakStatement":"ContinueStatement")},pp$8.parseDebuggerStatement=function(g){return this.next(),this.semicolon(),this.finishNode(g,"DebuggerStatement")},pp$8.parseDoStatement=function(g){return this.next(),this.labels.push(loopLabel),g.body=this.parseStatement("do"),this.labels.pop(),this.expect(types$1._while),g.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(types$1.semi):this.semicolon(),this.finishNode(g,"DoWhileStatement")},pp$8.parseForStatement=function(g){this.next();var O=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(loopLabel),this.enterScope(0),this.expect(types$1.parenL),this.type===types$1.semi)return O>-1&&this.unexpected(O),this.parseFor(g,null);var L=this.isLet();if(this.type===types$1._var||this.type===types$1._const||L){var M=this.startNode(),J=L?"let":this.value;return this.next(),this.parseVar(M,!0,J),this.finishNode(M,"VariableDeclaration"),(this.type===types$1._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===M.declarations.length?(this.options.ecmaVersion>=9&&(this.type===types$1._in?O>-1&&this.unexpected(O):g.await=O>-1),this.parseForIn(g,M)):(O>-1&&this.unexpected(O),this.parseFor(g,M))}var ae=this.isContextual("let"),ie=!1,ne=this.containsEsc,oe=new DestructuringErrors,pe=this.start,le=O>-1?this.parseExprSubscripts(oe,"await"):this.parseExpression(!0,oe);return this.type===types$1._in||(ie=this.options.ecmaVersion>=6&&this.isContextual("of"))?(O>-1?(this.type===types$1._in&&this.unexpected(O),g.await=!0):ie&&this.options.ecmaVersion>=8&&(le.start!==pe||ne||"Identifier"!==le.type||"async"!==le.name?this.options.ecmaVersion>=9&&(g.await=!1):this.unexpected()),ae&&ie&&this.raise(le.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(le,!1,oe),this.checkLValPattern(le),this.parseForIn(g,le)):(this.checkExpressionErrors(oe,!0),O>-1&&this.unexpected(O),this.parseFor(g,le))},pp$8.parseFunctionStatement=function(g,O,L){return this.next(),this.parseFunction(g,FUNC_STATEMENT|(L?0:FUNC_HANGING_STATEMENT),!1,O)},pp$8.parseIfStatement=function(g){return this.next(),g.test=this.parseParenExpression(),g.consequent=this.parseStatement("if"),g.alternate=this.eat(types$1._else)?this.parseStatement("if"):null,this.finishNode(g,"IfStatement")},pp$8.parseReturnStatement=function(g){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(types$1.semi)||this.insertSemicolon()?g.argument=null:(g.argument=this.parseExpression(),this.semicolon()),this.finishNode(g,"ReturnStatement")},pp$8.parseSwitchStatement=function(g){var O;this.next(),g.discriminant=this.parseParenExpression(),g.cases=[],this.expect(types$1.braceL),this.labels.push(switchLabel),this.enterScope(0);for(var L=!1;this.type!==types$1.braceR;)if(this.type===types$1._case||this.type===types$1._default){var M=this.type===types$1._case;O&&this.finishNode(O,"SwitchCase"),g.cases.push(O=this.startNode()),O.consequent=[],this.next(),M?O.test=this.parseExpression():(L&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),L=!0,O.test=null),this.expect(types$1.colon)}else O||this.unexpected(),O.consequent.push(this.parseStatement(null));return this.exitScope(),O&&this.finishNode(O,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(g,"SwitchStatement")},pp$8.parseThrowStatement=function(g){return this.next(),lineBreak.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),g.argument=this.parseExpression(),this.semicolon(),this.finishNode(g,"ThrowStatement")};var empty$1=[];pp$8.parseCatchClauseParam=function(){var g=this.parseBindingAtom(),O="Identifier"===g.type;return this.enterScope(O?SCOPE_SIMPLE_CATCH:0),this.checkLValPattern(g,O?BIND_SIMPLE_CATCH:BIND_LEXICAL),this.expect(types$1.parenR),g},pp$8.parseTryStatement=function(g){if(this.next(),g.block=this.parseBlock(),g.handler=null,this.type===types$1._catch){var O=this.startNode();this.next(),this.eat(types$1.parenL)?O.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),O.param=null,this.enterScope(0)),O.body=this.parseBlock(!1),this.exitScope(),g.handler=this.finishNode(O,"CatchClause")}return g.finalizer=this.eat(types$1._finally)?this.parseBlock():null,g.handler||g.finalizer||this.raise(g.start,"Missing catch or finally clause"),this.finishNode(g,"TryStatement")},pp$8.parseVarStatement=function(g,O,L){return this.next(),this.parseVar(g,!1,O,L),this.semicolon(),this.finishNode(g,"VariableDeclaration")},pp$8.parseWhileStatement=function(g){return this.next(),g.test=this.parseParenExpression(),this.labels.push(loopLabel),g.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(g,"WhileStatement")},pp$8.parseWithStatement=function(g){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),g.object=this.parseParenExpression(),g.body=this.parseStatement("with"),this.finishNode(g,"WithStatement")},pp$8.parseEmptyStatement=function(g){return this.next(),this.finishNode(g,"EmptyStatement")},pp$8.parseLabeledStatement=function(g,O,L,M){for(var J=0,ae=this.labels;J<ae.length;J+=1){ae[J].name===O&&this.raise(L.start,"Label '"+O+"' is already declared")}for(var ie=this.type.isLoop?"loop":this.type===types$1._switch?"switch":null,ne=this.labels.length-1;ne>=0;ne--){var oe=this.labels[ne];if(oe.statementStart!==g.start)break;oe.statementStart=this.start,oe.kind=ie}return this.labels.push({name:O,kind:ie,statementStart:this.start}),g.body=this.parseStatement(M?-1===M.indexOf("label")?M+"label":M:"label"),this.labels.pop(),g.label=L,this.finishNode(g,"LabeledStatement")},pp$8.parseExpressionStatement=function(g,O){return g.expression=O,this.semicolon(),this.finishNode(g,"ExpressionStatement")},pp$8.parseBlock=function(g,O,L){for(void 0===g&&(g=!0),void 0===O&&(O=this.startNode()),O.body=[],this.expect(types$1.braceL),g&&this.enterScope(0);this.type!==types$1.braceR;){var M=this.parseStatement(null);O.body.push(M)}return L&&(this.strict=!1),this.next(),g&&this.exitScope(),this.finishNode(O,"BlockStatement")},pp$8.parseFor=function(g,O){return g.init=O,this.expect(types$1.semi),g.test=this.type===types$1.semi?null:this.parseExpression(),this.expect(types$1.semi),g.update=this.type===types$1.parenR?null:this.parseExpression(),this.expect(types$1.parenR),g.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(g,"ForStatement")},pp$8.parseForIn=function(g,O){var L=this.type===types$1._in;return this.next(),"VariableDeclaration"===O.type&&null!=O.declarations[0].init&&(!L||this.options.ecmaVersion<8||this.strict||"var"!==O.kind||"Identifier"!==O.declarations[0].id.type)&&this.raise(O.start,(L?"for-in":"for-of")+" loop variable declaration may not have an initializer"),g.left=O,g.right=L?this.parseExpression():this.parseMaybeAssign(),this.expect(types$1.parenR),g.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(g,L?"ForInStatement":"ForOfStatement")},pp$8.parseVar=function(g,O,L,M){for(g.declarations=[],g.kind=L;;){var J=this.startNode();if(this.parseVarId(J,L),this.eat(types$1.eq)?J.init=this.parseMaybeAssign(O):M||"const"!==L||this.type===types$1._in||this.options.ecmaVersion>=6&&this.isContextual("of")?M||"Identifier"===J.id.type||O&&(this.type===types$1._in||this.isContextual("of"))?J.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),g.declarations.push(this.finishNode(J,"VariableDeclarator")),!this.eat(types$1.comma))break}return g},pp$8.parseVarId=function(g,O){g.id=this.parseBindingAtom(),this.checkLValPattern(g.id,"var"===O?BIND_VAR:BIND_LEXICAL,!1)};var FUNC_STATEMENT=1,FUNC_HANGING_STATEMENT=2,FUNC_NULLABLE_ID=4;function isPrivateNameConflicted(g,O){var L=O.key.name,M=g[L],J="true";return"MethodDefinition"!==O.type||"get"!==O.kind&&"set"!==O.kind||(J=(O.static?"s":"i")+O.kind),"iget"===M&&"iset"===J||"iset"===M&&"iget"===J||"sget"===M&&"sset"===J||"sset"===M&&"sget"===J?(g[L]="true",!1):!!M||(g[L]=J,!1)}function checkKeyName(g,O){var L=g.computed,M=g.key;return!L&&("Identifier"===M.type&&M.name===O||"Literal"===M.type&&M.value===O)}pp$8.parseFunction=function(g,O,L,M,J){this.initFunction(g),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!M)&&(this.type===types$1.star&&O&FUNC_HANGING_STATEMENT&&this.unexpected(),g.generator=this.eat(types$1.star)),this.options.ecmaVersion>=8&&(g.async=!!M),O&FUNC_STATEMENT&&(g.id=O&FUNC_NULLABLE_ID&&this.type!==types$1.name?null:this.parseIdent(),!g.id||O&FUNC_HANGING_STATEMENT||this.checkLValSimple(g.id,this.strict||g.generator||g.async?this.treatFunctionsAsVar?BIND_VAR:BIND_LEXICAL:BIND_FUNCTION));var ae=this.yieldPos,ie=this.awaitPos,ne=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(g.async,g.generator)),O&FUNC_STATEMENT||(g.id=this.type===types$1.name?this.parseIdent():null),this.parseFunctionParams(g),this.parseFunctionBody(g,L,!1,J),this.yieldPos=ae,this.awaitPos=ie,this.awaitIdentPos=ne,this.finishNode(g,O&FUNC_STATEMENT?"FunctionDeclaration":"FunctionExpression")},pp$8.parseFunctionParams=function(g){this.expect(types$1.parenL),g.params=this.parseBindingList(types$1.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},pp$8.parseClass=function(g,O){this.next();var L=this.strict;this.strict=!0,this.parseClassId(g,O),this.parseClassSuper(g);var M=this.enterClassBody(),J=this.startNode(),ae=!1;for(J.body=[],this.expect(types$1.braceL);this.type!==types$1.braceR;){var ie=this.parseClassElement(null!==g.superClass);ie&&(J.body.push(ie),"MethodDefinition"===ie.type&&"constructor"===ie.kind?(ae&&this.raiseRecoverable(ie.start,"Duplicate constructor in the same class"),ae=!0):ie.key&&"PrivateIdentifier"===ie.key.type&&isPrivateNameConflicted(M,ie)&&this.raiseRecoverable(ie.key.start,"Identifier '#"+ie.key.name+"' has already been declared"))}return this.strict=L,this.next(),g.body=this.finishNode(J,"ClassBody"),this.exitClassBody(),this.finishNode(g,O?"ClassDeclaration":"ClassExpression")},pp$8.parseClassElement=function(g){if(this.eat(types$1.semi))return null;var O=this.options.ecmaVersion,L=this.startNode(),M="",J=!1,ae=!1,ie="method",ne=!1;if(this.eatContextual("static")){if(O>=13&&this.eat(types$1.braceL))return this.parseClassStaticBlock(L),L;this.isClassElementNameStart()||this.type===types$1.star?ne=!0:M="static"}if(L.static=ne,!M&&O>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==types$1.star||this.canInsertSemicolon()?M="async":ae=!0),!M&&(O>=9||!ae)&&this.eat(types$1.star)&&(J=!0),!M&&!ae&&!J){var oe=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?ie=oe:M=oe)}if(M?(L.computed=!1,L.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),L.key.name=M,this.finishNode(L.key,"Identifier")):this.parseClassElementName(L),O<13||this.type===types$1.parenL||"method"!==ie||J||ae){var pe=!L.static&&checkKeyName(L,"constructor"),le=pe&&g;pe&&"method"!==ie&&this.raise(L.key.start,"Constructor can't have get/set modifier"),L.kind=pe?"constructor":ie,this.parseClassMethod(L,J,ae,le)}else this.parseClassField(L);return L},pp$8.isClassElementNameStart=function(){return this.type===types$1.name||this.type===types$1.privateId||this.type===types$1.num||this.type===types$1.string||this.type===types$1.bracketL||this.type.keyword},pp$8.parseClassElementName=function(g){this.type===types$1.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),g.computed=!1,g.key=this.parsePrivateIdent()):this.parsePropertyName(g)},pp$8.parseClassMethod=function(g,O,L,M){var J=g.key;"constructor"===g.kind?(O&&this.raise(J.start,"Constructor can't be a generator"),L&&this.raise(J.start,"Constructor can't be an async method")):g.static&&checkKeyName(g,"prototype")&&this.raise(J.start,"Classes may not have a static property named prototype");var ae=g.value=this.parseMethod(O,L,M);return"get"===g.kind&&0!==ae.params.length&&this.raiseRecoverable(ae.start,"getter should have no params"),"set"===g.kind&&1!==ae.params.length&&this.raiseRecoverable(ae.start,"setter should have exactly one param"),"set"===g.kind&&"RestElement"===ae.params[0].type&&this.raiseRecoverable(ae.params[0].start,"Setter cannot use rest params"),this.finishNode(g,"MethodDefinition")},pp$8.parseClassField=function(g){if(checkKeyName(g,"constructor")?this.raise(g.key.start,"Classes can't have a field named 'constructor'"):g.static&&checkKeyName(g,"prototype")&&this.raise(g.key.start,"Classes can't have a static field named 'prototype'"),this.eat(types$1.eq)){var O=this.currentThisScope(),L=O.inClassFieldInit;O.inClassFieldInit=!0,g.value=this.parseMaybeAssign(),O.inClassFieldInit=L}else g.value=null;return this.semicolon(),this.finishNode(g,"PropertyDefinition")},pp$8.parseClassStaticBlock=function(g){g.body=[];var O=this.labels;for(this.labels=[],this.enterScope(SCOPE_CLASS_STATIC_BLOCK|SCOPE_SUPER);this.type!==types$1.braceR;){var L=this.parseStatement(null);g.body.push(L)}return this.next(),this.exitScope(),this.labels=O,this.finishNode(g,"StaticBlock")},pp$8.parseClassId=function(g,O){this.type===types$1.name?(g.id=this.parseIdent(),O&&this.checkLValSimple(g.id,BIND_LEXICAL,!1)):(!0===O&&this.unexpected(),g.id=null)},pp$8.parseClassSuper=function(g){g.superClass=this.eat(types$1._extends)?this.parseExprSubscripts(null,!1):null},pp$8.enterClassBody=function(){var g={declared:Object.create(null),used:[]};return this.privateNameStack.push(g),g.declared},pp$8.exitClassBody=function(){var g=this.privateNameStack.pop(),O=g.declared,L=g.used;if(this.options.checkPrivateFields)for(var M=this.privateNameStack.length,J=0===M?null:this.privateNameStack[M-1],ae=0;ae<L.length;++ae){var ie=L[ae];hasOwn(O,ie.name)||(J?J.used.push(ie):this.raiseRecoverable(ie.start,"Private field '#"+ie.name+"' must be declared in an enclosing class"))}},pp$8.parseExportAllDeclaration=function(g,O){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(g.exported=this.parseModuleExportName(),this.checkExport(O,g.exported,this.lastTokStart)):g.exported=null),this.expectContextual("from"),this.type!==types$1.string&&this.unexpected(),g.source=this.parseExprAtom(),this.semicolon(),this.finishNode(g,"ExportAllDeclaration")},pp$8.parseExport=function(g,O){if(this.next(),this.eat(types$1.star))return this.parseExportAllDeclaration(g,O);if(this.eat(types$1._default))return this.checkExport(O,"default",this.lastTokStart),g.declaration=this.parseExportDefaultDeclaration(),this.finishNode(g,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())g.declaration=this.parseExportDeclaration(g),"VariableDeclaration"===g.declaration.type?this.checkVariableExport(O,g.declaration.declarations):this.checkExport(O,g.declaration.id,g.declaration.id.start),g.specifiers=[],g.source=null;else{if(g.declaration=null,g.specifiers=this.parseExportSpecifiers(O),this.eatContextual("from"))this.type!==types$1.string&&this.unexpected(),g.source=this.parseExprAtom();else{for(var L=0,M=g.specifiers;L<M.length;L+=1){var J=M[L];this.checkUnreserved(J.local),this.checkLocalExport(J.local),"Literal"===J.local.type&&this.raise(J.local.start,"A string literal cannot be used as an exported binding without `from`.")}g.source=null}this.semicolon()}return this.finishNode(g,"ExportNamedDeclaration")},pp$8.parseExportDeclaration=function(g){return this.parseStatement(null)},pp$8.parseExportDefaultDeclaration=function(){var g;if(this.type===types$1._function||(g=this.isAsyncFunction())){var O=this.startNode();return this.next(),g&&this.next(),this.parseFunction(O,FUNC_STATEMENT|FUNC_NULLABLE_ID,!1,g)}if(this.type===types$1._class){var L=this.startNode();return this.parseClass(L,"nullableID")}var M=this.parseMaybeAssign();return this.semicolon(),M},pp$8.checkExport=function(g,O,L){g&&("string"!=typeof O&&(O="Identifier"===O.type?O.name:O.value),hasOwn(g,O)&&this.raiseRecoverable(L,"Duplicate export '"+O+"'"),g[O]=!0)},pp$8.checkPatternExport=function(g,O){var L=O.type;if("Identifier"===L)this.checkExport(g,O,O.start);else if("ObjectPattern"===L)for(var M=0,J=O.properties;M<J.length;M+=1){var ae=J[M];this.checkPatternExport(g,ae)}else if("ArrayPattern"===L)for(var ie=0,ne=O.elements;ie<ne.length;ie+=1){var oe=ne[ie];oe&&this.checkPatternExport(g,oe)}else"Property"===L?this.checkPatternExport(g,O.value):"AssignmentPattern"===L?this.checkPatternExport(g,O.left):"RestElement"===L&&this.checkPatternExport(g,O.argument)},pp$8.checkVariableExport=function(g,O){if(g)for(var L=0,M=O;L<M.length;L+=1){var J=M[L];this.checkPatternExport(g,J.id)}},pp$8.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},pp$8.parseExportSpecifier=function(g){var O=this.startNode();return O.local=this.parseModuleExportName(),O.exported=this.eatContextual("as")?this.parseModuleExportName():O.local,this.checkExport(g,O.exported,O.exported.start),this.finishNode(O,"ExportSpecifier")},pp$8.parseExportSpecifiers=function(g){var O=[],L=!0;for(this.expect(types$1.braceL);!this.eat(types$1.braceR);){if(L)L=!1;else if(this.expect(types$1.comma),this.afterTrailingComma(types$1.braceR))break;O.push(this.parseExportSpecifier(g))}return O},pp$8.parseImport=function(g){return this.next(),this.type===types$1.string?(g.specifiers=empty$1,g.source=this.parseExprAtom()):(g.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),g.source=this.type===types$1.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(g,"ImportDeclaration")},pp$8.parseImportSpecifier=function(){var g=this.startNode();return g.imported=this.parseModuleExportName(),this.eatContextual("as")?g.local=this.parseIdent():(this.checkUnreserved(g.imported),g.local=g.imported),this.checkLValSimple(g.local,BIND_LEXICAL),this.finishNode(g,"ImportSpecifier")},pp$8.parseImportDefaultSpecifier=function(){var g=this.startNode();return g.local=this.parseIdent(),this.checkLValSimple(g.local,BIND_LEXICAL),this.finishNode(g,"ImportDefaultSpecifier")},pp$8.parseImportNamespaceSpecifier=function(){var g=this.startNode();return this.next(),this.expectContextual("as"),g.local=this.parseIdent(),this.checkLValSimple(g.local,BIND_LEXICAL),this.finishNode(g,"ImportNamespaceSpecifier")},pp$8.parseImportSpecifiers=function(){var g=[],O=!0;if(this.type===types$1.name&&(g.push(this.parseImportDefaultSpecifier()),!this.eat(types$1.comma)))return g;if(this.type===types$1.star)return g.push(this.parseImportNamespaceSpecifier()),g;for(this.expect(types$1.braceL);!this.eat(types$1.braceR);){if(O)O=!1;else if(this.expect(types$1.comma),this.afterTrailingComma(types$1.braceR))break;g.push(this.parseImportSpecifier())}return g},pp$8.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===types$1.string){var g=this.parseLiteral(this.value);return loneSurrogate.test(g.value)&&this.raise(g.start,"An export name cannot include a lone surrogate."),g}return this.parseIdent(!0)},pp$8.adaptDirectivePrologue=function(g){for(var O=0;O<g.length&&this.isDirectiveCandidate(g[O]);++O)g[O].directive=g[O].expression.raw.slice(1,-1)},pp$8.isDirectiveCandidate=function(g){return this.options.ecmaVersion>=5&&"ExpressionStatement"===g.type&&"Literal"===g.expression.type&&"string"==typeof g.expression.value&&('"'===this.input[g.start]||"'"===this.input[g.start])};var pp$7=Parser.prototype;pp$7.toAssignable=function(g,O,L){if(this.options.ecmaVersion>=6&&g)switch(g.type){case"Identifier":this.inAsync&&"await"===g.name&&this.raise(g.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":g.type="ObjectPattern",L&&this.checkPatternErrors(L,!0);for(var M=0,J=g.properties;M<J.length;M+=1){var ae=J[M];this.toAssignable(ae,O),"RestElement"!==ae.type||"ArrayPattern"!==ae.argument.type&&"ObjectPattern"!==ae.argument.type||this.raise(ae.argument.start,"Unexpected token")}break;case"Property":"init"!==g.kind&&this.raise(g.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(g.value,O);break;case"ArrayExpression":g.type="ArrayPattern",L&&this.checkPatternErrors(L,!0),this.toAssignableList(g.elements,O);break;case"SpreadElement":g.type="RestElement",this.toAssignable(g.argument,O),"AssignmentPattern"===g.argument.type&&this.raise(g.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==g.operator&&this.raise(g.left.end,"Only '=' operator can be used for specifying default value."),g.type="AssignmentPattern",delete g.operator,this.toAssignable(g.left,O);break;case"ParenthesizedExpression":this.toAssignable(g.expression,O,L);break;case"ChainExpression":this.raiseRecoverable(g.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!O)break;default:this.raise(g.start,"Assigning to rvalue")}else L&&this.checkPatternErrors(L,!0);return g},pp$7.toAssignableList=function(g,O){for(var L=g.length,M=0;M<L;M++){var J=g[M];J&&this.toAssignable(J,O)}if(L){var ae=g[L-1];6===this.options.ecmaVersion&&O&&ae&&"RestElement"===ae.type&&"Identifier"!==ae.argument.type&&this.unexpected(ae.argument.start)}return g},pp$7.parseSpread=function(g){var O=this.startNode();return this.next(),O.argument=this.parseMaybeAssign(!1,g),this.finishNode(O,"SpreadElement")},pp$7.parseRestBinding=function(){var g=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==types$1.name&&this.unexpected(),g.argument=this.parseBindingAtom(),this.finishNode(g,"RestElement")},pp$7.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case types$1.bracketL:var g=this.startNode();return this.next(),g.elements=this.parseBindingList(types$1.bracketR,!0,!0),this.finishNode(g,"ArrayPattern");case types$1.braceL:return this.parseObj(!0)}return this.parseIdent()},pp$7.parseBindingList=function(g,O,L,M){for(var J=[],ae=!0;!this.eat(g);)if(ae?ae=!1:this.expect(types$1.comma),O&&this.type===types$1.comma)J.push(null);else{if(L&&this.afterTrailingComma(g))break;if(this.type===types$1.ellipsis){var ie=this.parseRestBinding();this.parseBindingListItem(ie),J.push(ie),this.type===types$1.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(g);break}J.push(this.parseAssignableListItem(M))}return J},pp$7.parseAssignableListItem=function(g){var O=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(O),O},pp$7.parseBindingListItem=function(g){return g},pp$7.parseMaybeDefault=function(g,O,L){if(L=L||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(types$1.eq))return L;var M=this.startNodeAt(g,O);return M.left=L,M.right=this.parseMaybeAssign(),this.finishNode(M,"AssignmentPattern")},pp$7.checkLValSimple=function(g,O,L){void 0===O&&(O=BIND_NONE);var M=O!==BIND_NONE;switch(g.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(g.name)&&this.raiseRecoverable(g.start,(M?"Binding ":"Assigning to ")+g.name+" in strict mode"),M&&(O===BIND_LEXICAL&&"let"===g.name&&this.raiseRecoverable(g.start,"let is disallowed as a lexically bound name"),L&&(hasOwn(L,g.name)&&this.raiseRecoverable(g.start,"Argument name clash"),L[g.name]=!0),O!==BIND_OUTSIDE&&this.declareName(g.name,O,g.start));break;case"ChainExpression":this.raiseRecoverable(g.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":M&&this.raiseRecoverable(g.start,"Binding member expression");break;case"ParenthesizedExpression":return M&&this.raiseRecoverable(g.start,"Binding parenthesized expression"),this.checkLValSimple(g.expression,O,L);default:this.raise(g.start,(M?"Binding":"Assigning to")+" rvalue")}},pp$7.checkLValPattern=function(g,O,L){switch(void 0===O&&(O=BIND_NONE),g.type){case"ObjectPattern":for(var M=0,J=g.properties;M<J.length;M+=1){var ae=J[M];this.checkLValInnerPattern(ae,O,L)}break;case"ArrayPattern":for(var ie=0,ne=g.elements;ie<ne.length;ie+=1){var oe=ne[ie];oe&&this.checkLValInnerPattern(oe,O,L)}break;default:this.checkLValSimple(g,O,L)}},pp$7.checkLValInnerPattern=function(g,O,L){switch(void 0===O&&(O=BIND_NONE),g.type){case"Property":this.checkLValInnerPattern(g.value,O,L);break;case"AssignmentPattern":this.checkLValPattern(g.left,O,L);break;case"RestElement":this.checkLValPattern(g.argument,O,L);break;default:this.checkLValPattern(g,O,L)}};var TokContext=function TokContext(g,O,L,M,J){this.token=g,this.isExpr=!!O,this.preserveSpace=!!L,this.override=M,this.generator=!!J},types={b_stat:new TokContext("{",!1),b_expr:new TokContext("{",!0),b_tmpl:new TokContext("${",!1),p_stat:new TokContext("(",!1),p_expr:new TokContext("(",!0),q_tmpl:new TokContext("`",!0,!0,(function(g){return g.tryReadTemplateToken()})),f_stat:new TokContext("function",!1),f_expr:new TokContext("function",!0),f_expr_gen:new TokContext("function",!0,!1,null,!0),f_gen:new TokContext("function",!1,!1,null,!0)},pp$6=Parser.prototype;pp$6.initialContext=function(){return[types.b_stat]},pp$6.curContext=function(){return this.context[this.context.length-1]},pp$6.braceIsBlock=function(g){var O=this.curContext();return O===types.f_expr||O===types.f_stat||(g!==types$1.colon||O!==types.b_stat&&O!==types.b_expr?g===types$1._return||g===types$1.name&&this.exprAllowed?lineBreak.test(this.input.slice(this.lastTokEnd,this.start)):g===types$1._else||g===types$1.semi||g===types$1.eof||g===types$1.parenR||g===types$1.arrow||(g===types$1.braceL?O===types.b_stat:g!==types$1._var&&g!==types$1._const&&g!==types$1.name&&!this.exprAllowed):!O.isExpr)},pp$6.inGeneratorContext=function(){for(var g=this.context.length-1;g>=1;g--){var O=this.context[g];if("function"===O.token)return O.generator}return!1},pp$6.updateContext=function(g){var O,L=this.type;L.keyword&&g===types$1.dot?this.exprAllowed=!1:(O=L.updateContext)?O.call(this,g):this.exprAllowed=L.beforeExpr},pp$6.overrideContext=function(g){this.curContext()!==g&&(this.context[this.context.length-1]=g)},types$1.parenR.updateContext=types$1.braceR.updateContext=function(){if(1!==this.context.length){var g=this.context.pop();g===types.b_stat&&"function"===this.curContext().token&&(g=this.context.pop()),this.exprAllowed=!g.isExpr}else this.exprAllowed=!0},types$1.braceL.updateContext=function(g){this.context.push(this.braceIsBlock(g)?types.b_stat:types.b_expr),this.exprAllowed=!0},types$1.dollarBraceL.updateContext=function(){this.context.push(types.b_tmpl),this.exprAllowed=!0},types$1.parenL.updateContext=function(g){var O=g===types$1._if||g===types$1._for||g===types$1._with||g===types$1._while;this.context.push(O?types.p_stat:types.p_expr),this.exprAllowed=!0},types$1.incDec.updateContext=function(){},types$1._function.updateContext=types$1._class.updateContext=function(g){!g.beforeExpr||g===types$1._else||g===types$1.semi&&this.curContext()!==types.p_stat||g===types$1._return&&lineBreak.test(this.input.slice(this.lastTokEnd,this.start))||(g===types$1.colon||g===types$1.braceL)&&this.curContext()===types.b_stat?this.context.push(types.f_stat):this.context.push(types.f_expr),this.exprAllowed=!1},types$1.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},types$1.backQuote.updateContext=function(){this.curContext()===types.q_tmpl?this.context.pop():this.context.push(types.q_tmpl),this.exprAllowed=!1},types$1.star.updateContext=function(g){if(g===types$1._function){var O=this.context.length-1;this.context[O]===types.f_expr?this.context[O]=types.f_expr_gen:this.context[O]=types.f_gen}this.exprAllowed=!0},types$1.name.updateContext=function(g){var O=!1;this.options.ecmaVersion>=6&&g!==types$1.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(O=!0),this.exprAllowed=O};var pp$5=Parser.prototype;function isLocalVariableAccess(g){return"Identifier"===g.type||"ParenthesizedExpression"===g.type&&isLocalVariableAccess(g.expression)}function isPrivateFieldAccess(g){return"MemberExpression"===g.type&&"PrivateIdentifier"===g.property.type||"ChainExpression"===g.type&&isPrivateFieldAccess(g.expression)||"ParenthesizedExpression"===g.type&&isPrivateFieldAccess(g.expression)}pp$5.checkPropClash=function(g,O,L){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===g.type||this.options.ecmaVersion>=6&&(g.computed||g.method||g.shorthand))){var M,J=g.key;switch(J.type){case"Identifier":M=J.name;break;case"Literal":M=String(J.value);break;default:return}var ae=g.kind;if(this.options.ecmaVersion>=6)"__proto__"===M&&"init"===ae&&(O.proto&&(L?L.doubleProto<0&&(L.doubleProto=J.start):this.raiseRecoverable(J.start,"Redefinition of __proto__ property")),O.proto=!0);else{var ie=O[M="$"+M];if(ie)("init"===ae?this.strict&&ie.init||ie.get||ie.set:ie.init||ie[ae])&&this.raiseRecoverable(J.start,"Redefinition of property");else ie=O[M]={init:!1,get:!1,set:!1};ie[ae]=!0}}},pp$5.parseExpression=function(g,O){var L=this.start,M=this.startLoc,J=this.parseMaybeAssign(g,O);if(this.type===types$1.comma){var ae=this.startNodeAt(L,M);for(ae.expressions=[J];this.eat(types$1.comma);)ae.expressions.push(this.parseMaybeAssign(g,O));return this.finishNode(ae,"SequenceExpression")}return J},pp$5.parseMaybeAssign=function(g,O,L){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(g);this.exprAllowed=!1}var M=!1,J=-1,ae=-1,ie=-1;O?(J=O.parenthesizedAssign,ae=O.trailingComma,ie=O.doubleProto,O.parenthesizedAssign=O.trailingComma=-1):(O=new DestructuringErrors,M=!0);var ne=this.start,oe=this.startLoc;this.type!==types$1.parenL&&this.type!==types$1.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===g);var pe=this.parseMaybeConditional(g,O);if(L&&(pe=L.call(this,pe,ne,oe)),this.type.isAssign){var le=this.startNodeAt(ne,oe);return le.operator=this.value,this.type===types$1.eq&&(pe=this.toAssignable(pe,!1,O)),M||(O.parenthesizedAssign=O.trailingComma=O.doubleProto=-1),O.shorthandAssign>=pe.start&&(O.shorthandAssign=-1),this.type===types$1.eq?this.checkLValPattern(pe):this.checkLValSimple(pe),le.left=pe,this.next(),le.right=this.parseMaybeAssign(g),ie>-1&&(O.doubleProto=ie),this.finishNode(le,"AssignmentExpression")}return M&&this.checkExpressionErrors(O,!0),J>-1&&(O.parenthesizedAssign=J),ae>-1&&(O.trailingComma=ae),pe},pp$5.parseMaybeConditional=function(g,O){var L=this.start,M=this.startLoc,J=this.parseExprOps(g,O);if(this.checkExpressionErrors(O))return J;if(this.eat(types$1.question)){var ae=this.startNodeAt(L,M);return ae.test=J,ae.consequent=this.parseMaybeAssign(),this.expect(types$1.colon),ae.alternate=this.parseMaybeAssign(g),this.finishNode(ae,"ConditionalExpression")}return J},pp$5.parseExprOps=function(g,O){var L=this.start,M=this.startLoc,J=this.parseMaybeUnary(O,!1,!1,g);return this.checkExpressionErrors(O)||J.start===L&&"ArrowFunctionExpression"===J.type?J:this.parseExprOp(J,L,M,-1,g)},pp$5.parseExprOp=function(g,O,L,M,J){var ae=this.type.binop;if(null!=ae&&(!J||this.type!==types$1._in)&&ae>M){var ie=this.type===types$1.logicalOR||this.type===types$1.logicalAND,ne=this.type===types$1.coalesce;ne&&(ae=types$1.logicalAND.binop);var oe=this.value;this.next();var pe=this.start,le=this.startLoc,ue=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,J),pe,le,ae,J),de=this.buildBinary(O,L,g,ue,oe,ie||ne);return(ie&&this.type===types$1.coalesce||ne&&(this.type===types$1.logicalOR||this.type===types$1.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(de,O,L,M,J)}return g},pp$5.buildBinary=function(g,O,L,M,J,ae){"PrivateIdentifier"===M.type&&this.raise(M.start,"Private identifier can only be left side of binary expression");var ie=this.startNodeAt(g,O);return ie.left=L,ie.operator=J,ie.right=M,this.finishNode(ie,ae?"LogicalExpression":"BinaryExpression")},pp$5.parseMaybeUnary=function(g,O,L,M){var J,ae=this.start,ie=this.startLoc;if(this.isContextual("await")&&this.canAwait)J=this.parseAwait(M),O=!0;else if(this.type.prefix){var ne=this.startNode(),oe=this.type===types$1.incDec;ne.operator=this.value,ne.prefix=!0,this.next(),ne.argument=this.parseMaybeUnary(null,!0,oe,M),this.checkExpressionErrors(g,!0),oe?this.checkLValSimple(ne.argument):this.strict&&"delete"===ne.operator&&isLocalVariableAccess(ne.argument)?this.raiseRecoverable(ne.start,"Deleting local variable in strict mode"):"delete"===ne.operator&&isPrivateFieldAccess(ne.argument)?this.raiseRecoverable(ne.start,"Private fields can not be deleted"):O=!0,J=this.finishNode(ne,oe?"UpdateExpression":"UnaryExpression")}else if(O||this.type!==types$1.privateId){if(J=this.parseExprSubscripts(g,M),this.checkExpressionErrors(g))return J;for(;this.type.postfix&&!this.canInsertSemicolon();){var pe=this.startNodeAt(ae,ie);pe.operator=this.value,pe.prefix=!1,pe.argument=J,this.checkLValSimple(J),this.next(),J=this.finishNode(pe,"UpdateExpression")}}else(M||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),J=this.parsePrivateIdent(),this.type!==types$1._in&&this.unexpected();return L||!this.eat(types$1.starstar)?J:O?void this.unexpected(this.lastTokStart):this.buildBinary(ae,ie,J,this.parseMaybeUnary(null,!1,!1,M),"**",!1)},pp$5.parseExprSubscripts=function(g,O){var L=this.start,M=this.startLoc,J=this.parseExprAtom(g,O);if("ArrowFunctionExpression"===J.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return J;var ae=this.parseSubscripts(J,L,M,!1,O);return g&&"MemberExpression"===ae.type&&(g.parenthesizedAssign>=ae.start&&(g.parenthesizedAssign=-1),g.parenthesizedBind>=ae.start&&(g.parenthesizedBind=-1),g.trailingComma>=ae.start&&(g.trailingComma=-1)),ae},pp$5.parseSubscripts=function(g,O,L,M,J){for(var ae=this.options.ecmaVersion>=8&&"Identifier"===g.type&&"async"===g.name&&this.lastTokEnd===g.end&&!this.canInsertSemicolon()&&g.end-g.start==5&&this.potentialArrowAt===g.start,ie=!1;;){var ne=this.parseSubscript(g,O,L,M,ae,ie,J);if(ne.optional&&(ie=!0),ne===g||"ArrowFunctionExpression"===ne.type){if(ie){var oe=this.startNodeAt(O,L);oe.expression=ne,ne=this.finishNode(oe,"ChainExpression")}return ne}g=ne}},pp$5.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(types$1.arrow)},pp$5.parseSubscriptAsyncArrow=function(g,O,L,M){return this.parseArrowExpression(this.startNodeAt(g,O),L,!0,M)},pp$5.parseSubscript=function(g,O,L,M,J,ae,ie){var ne=this.options.ecmaVersion>=11,oe=ne&&this.eat(types$1.questionDot);M&&oe&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var pe=this.eat(types$1.bracketL);if(pe||oe&&this.type!==types$1.parenL&&this.type!==types$1.backQuote||this.eat(types$1.dot)){var le=this.startNodeAt(O,L);le.object=g,pe?(le.property=this.parseExpression(),this.expect(types$1.bracketR)):this.type===types$1.privateId&&"Super"!==g.type?le.property=this.parsePrivateIdent():le.property=this.parseIdent("never"!==this.options.allowReserved),le.computed=!!pe,ne&&(le.optional=oe),g=this.finishNode(le,"MemberExpression")}else if(!M&&this.eat(types$1.parenL)){var ue=new DestructuringErrors,de=this.yieldPos,he=this.awaitPos,ye=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var me=this.parseExprList(types$1.parenR,this.options.ecmaVersion>=8,!1,ue);if(J&&!oe&&this.shouldParseAsyncArrow())return this.checkPatternErrors(ue,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=de,this.awaitPos=he,this.awaitIdentPos=ye,this.parseSubscriptAsyncArrow(O,L,me,ie);this.checkExpressionErrors(ue,!0),this.yieldPos=de||this.yieldPos,this.awaitPos=he||this.awaitPos,this.awaitIdentPos=ye||this.awaitIdentPos;var fe=this.startNodeAt(O,L);fe.callee=g,fe.arguments=me,ne&&(fe.optional=oe),g=this.finishNode(fe,"CallExpression")}else if(this.type===types$1.backQuote){(oe||ae)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var ge=this.startNodeAt(O,L);ge.tag=g,ge.quasi=this.parseTemplate({isTagged:!0}),g=this.finishNode(ge,"TaggedTemplateExpression")}return g},pp$5.parseExprAtom=function(g,O,L){this.type===types$1.slash&&this.readRegexp();var M,J=this.potentialArrowAt===this.start;switch(this.type){case types$1._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),M=this.startNode(),this.next(),this.type!==types$1.parenL||this.allowDirectSuper||this.raise(M.start,"super() call outside constructor of a subclass"),this.type!==types$1.dot&&this.type!==types$1.bracketL&&this.type!==types$1.parenL&&this.unexpected(),this.finishNode(M,"Super");case types$1._this:return M=this.startNode(),this.next(),this.finishNode(M,"ThisExpression");case types$1.name:var ae=this.start,ie=this.startLoc,ne=this.containsEsc,oe=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!ne&&"async"===oe.name&&!this.canInsertSemicolon()&&this.eat(types$1._function))return this.overrideContext(types.f_expr),this.parseFunction(this.startNodeAt(ae,ie),0,!1,!0,O);if(J&&!this.canInsertSemicolon()){if(this.eat(types$1.arrow))return this.parseArrowExpression(this.startNodeAt(ae,ie),[oe],!1,O);if(this.options.ecmaVersion>=8&&"async"===oe.name&&this.type===types$1.name&&!ne&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return oe=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(types$1.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(ae,ie),[oe],!0,O)}return oe;case types$1.regexp:var pe=this.value;return(M=this.parseLiteral(pe.value)).regex={pattern:pe.pattern,flags:pe.flags},M;case types$1.num:case types$1.string:return this.parseLiteral(this.value);case types$1._null:case types$1._true:case types$1._false:return(M=this.startNode()).value=this.type===types$1._null?null:this.type===types$1._true,M.raw=this.type.keyword,this.next(),this.finishNode(M,"Literal");case types$1.parenL:var le=this.start,ue=this.parseParenAndDistinguishExpression(J,O);return g&&(g.parenthesizedAssign<0&&!this.isSimpleAssignTarget(ue)&&(g.parenthesizedAssign=le),g.parenthesizedBind<0&&(g.parenthesizedBind=le)),ue;case types$1.bracketL:return M=this.startNode(),this.next(),M.elements=this.parseExprList(types$1.bracketR,!0,!0,g),this.finishNode(M,"ArrayExpression");case types$1.braceL:return this.overrideContext(types.b_expr),this.parseObj(!1,g);case types$1._function:return M=this.startNode(),this.next(),this.parseFunction(M,0);case types$1._class:return this.parseClass(this.startNode(),!1);case types$1._new:return this.parseNew();case types$1.backQuote:return this.parseTemplate();case types$1._import:return this.options.ecmaVersion>=11?this.parseExprImport(L):this.unexpected();default:return this.parseExprAtomDefault()}},pp$5.parseExprAtomDefault=function(){this.unexpected()},pp$5.parseExprImport=function(g){var O=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===types$1.parenL&&!g)return this.parseDynamicImport(O);if(this.type===types$1.dot){var L=this.startNodeAt(O.start,O.loc&&O.loc.start);return L.name="import",O.meta=this.finishNode(L,"Identifier"),this.parseImportMeta(O)}this.unexpected()},pp$5.parseDynamicImport=function(g){if(this.next(),g.source=this.parseMaybeAssign(),!this.eat(types$1.parenR)){var O=this.start;this.eat(types$1.comma)&&this.eat(types$1.parenR)?this.raiseRecoverable(O,"Trailing comma is not allowed in import()"):this.unexpected(O)}return this.finishNode(g,"ImportExpression")},pp$5.parseImportMeta=function(g){this.next();var O=this.containsEsc;return g.property=this.parseIdent(!0),"meta"!==g.property.name&&this.raiseRecoverable(g.property.start,"The only valid meta property for import is 'import.meta'"),O&&this.raiseRecoverable(g.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(g.start,"Cannot use 'import.meta' outside a module"),this.finishNode(g,"MetaProperty")},pp$5.parseLiteral=function(g){var O=this.startNode();return O.value=g,O.raw=this.input.slice(this.start,this.end),110===O.raw.charCodeAt(O.raw.length-1)&&(O.bigint=O.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(O,"Literal")},pp$5.parseParenExpression=function(){this.expect(types$1.parenL);var g=this.parseExpression();return this.expect(types$1.parenR),g},pp$5.shouldParseArrow=function(g){return!this.canInsertSemicolon()},pp$5.parseParenAndDistinguishExpression=function(g,O){var L,M=this.start,J=this.startLoc,ae=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var ie,ne=this.start,oe=this.startLoc,pe=[],le=!0,ue=!1,de=new DestructuringErrors,he=this.yieldPos,ye=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==types$1.parenR;){if(le?le=!1:this.expect(types$1.comma),ae&&this.afterTrailingComma(types$1.parenR,!0)){ue=!0;break}if(this.type===types$1.ellipsis){ie=this.start,pe.push(this.parseParenItem(this.parseRestBinding())),this.type===types$1.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}pe.push(this.parseMaybeAssign(!1,de,this.parseParenItem))}var me=this.lastTokEnd,fe=this.lastTokEndLoc;if(this.expect(types$1.parenR),g&&this.shouldParseArrow(pe)&&this.eat(types$1.arrow))return this.checkPatternErrors(de,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=he,this.awaitPos=ye,this.parseParenArrowList(M,J,pe,O);pe.length&&!ue||this.unexpected(this.lastTokStart),ie&&this.unexpected(ie),this.checkExpressionErrors(de,!0),this.yieldPos=he||this.yieldPos,this.awaitPos=ye||this.awaitPos,pe.length>1?((L=this.startNodeAt(ne,oe)).expressions=pe,this.finishNodeAt(L,"SequenceExpression",me,fe)):L=pe[0]}else L=this.parseParenExpression();if(this.options.preserveParens){var ge=this.startNodeAt(M,J);return ge.expression=L,this.finishNode(ge,"ParenthesizedExpression")}return L},pp$5.parseParenItem=function(g){return g},pp$5.parseParenArrowList=function(g,O,L,M){return this.parseArrowExpression(this.startNodeAt(g,O),L,!1,M)};var empty=[];pp$5.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var g=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===types$1.dot){var O=this.startNodeAt(g.start,g.loc&&g.loc.start);O.name="new",g.meta=this.finishNode(O,"Identifier"),this.next();var L=this.containsEsc;return g.property=this.parseIdent(!0),"target"!==g.property.name&&this.raiseRecoverable(g.property.start,"The only valid meta property for new is 'new.target'"),L&&this.raiseRecoverable(g.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(g.start,"'new.target' can only be used in functions and class static block"),this.finishNode(g,"MetaProperty")}var M=this.start,J=this.startLoc;return g.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),M,J,!0,!1),this.eat(types$1.parenL)?g.arguments=this.parseExprList(types$1.parenR,this.options.ecmaVersion>=8,!1):g.arguments=empty,this.finishNode(g,"NewExpression")},pp$5.parseTemplateElement=function(g){var O=g.isTagged,L=this.startNode();return this.type===types$1.invalidTemplate?(O||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),L.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):L.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),L.tail=this.type===types$1.backQuote,this.finishNode(L,"TemplateElement")},pp$5.parseTemplate=function(g){void 0===g&&(g={});var O=g.isTagged;void 0===O&&(O=!1);var L=this.startNode();this.next(),L.expressions=[];var M=this.parseTemplateElement({isTagged:O});for(L.quasis=[M];!M.tail;)this.type===types$1.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(types$1.dollarBraceL),L.expressions.push(this.parseExpression()),this.expect(types$1.braceR),L.quasis.push(M=this.parseTemplateElement({isTagged:O}));return this.next(),this.finishNode(L,"TemplateLiteral")},pp$5.isAsyncProp=function(g){return!g.computed&&"Identifier"===g.key.type&&"async"===g.key.name&&(this.type===types$1.name||this.type===types$1.num||this.type===types$1.string||this.type===types$1.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===types$1.star)&&!lineBreak.test(this.input.slice(this.lastTokEnd,this.start))},pp$5.parseObj=function(g,O){var L=this.startNode(),M=!0,J={};for(L.properties=[],this.next();!this.eat(types$1.braceR);){if(M)M=!1;else if(this.expect(types$1.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(types$1.braceR))break;var ae=this.parseProperty(g,O);g||this.checkPropClash(ae,J,O),L.properties.push(ae)}return this.finishNode(L,g?"ObjectPattern":"ObjectExpression")},pp$5.parseProperty=function(g,O){var L,M,J,ae,ie=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(types$1.ellipsis))return g?(ie.argument=this.parseIdent(!1),this.type===types$1.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(ie,"RestElement")):(ie.argument=this.parseMaybeAssign(!1,O),this.type===types$1.comma&&O&&O.trailingComma<0&&(O.trailingComma=this.start),this.finishNode(ie,"SpreadElement"));this.options.ecmaVersion>=6&&(ie.method=!1,ie.shorthand=!1,(g||O)&&(J=this.start,ae=this.startLoc),g||(L=this.eat(types$1.star)));var ne=this.containsEsc;return this.parsePropertyName(ie),!g&&!ne&&this.options.ecmaVersion>=8&&!L&&this.isAsyncProp(ie)?(M=!0,L=this.options.ecmaVersion>=9&&this.eat(types$1.star),this.parsePropertyName(ie)):M=!1,this.parsePropertyValue(ie,g,L,M,J,ae,O,ne),this.finishNode(ie,"Property")},pp$5.parseGetterSetter=function(g){g.kind=g.key.name,this.parsePropertyName(g),g.value=this.parseMethod(!1);var O="get"===g.kind?0:1;if(g.value.params.length!==O){var L=g.value.start;"get"===g.kind?this.raiseRecoverable(L,"getter should have no params"):this.raiseRecoverable(L,"setter should have exactly one param")}else"set"===g.kind&&"RestElement"===g.value.params[0].type&&this.raiseRecoverable(g.value.params[0].start,"Setter cannot use rest params")},pp$5.parsePropertyValue=function(g,O,L,M,J,ae,ie,ne){(L||M)&&this.type===types$1.colon&&this.unexpected(),this.eat(types$1.colon)?(g.value=O?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,ie),g.kind="init"):this.options.ecmaVersion>=6&&this.type===types$1.parenL?(O&&this.unexpected(),g.kind="init",g.method=!0,g.value=this.parseMethod(L,M)):O||ne||!(this.options.ecmaVersion>=5)||g.computed||"Identifier"!==g.key.type||"get"!==g.key.name&&"set"!==g.key.name||this.type===types$1.comma||this.type===types$1.braceR||this.type===types$1.eq?this.options.ecmaVersion>=6&&!g.computed&&"Identifier"===g.key.type?((L||M)&&this.unexpected(),this.checkUnreserved(g.key),"await"!==g.key.name||this.awaitIdentPos||(this.awaitIdentPos=J),g.kind="init",O?g.value=this.parseMaybeDefault(J,ae,this.copyNode(g.key)):this.type===types$1.eq&&ie?(ie.shorthandAssign<0&&(ie.shorthandAssign=this.start),g.value=this.parseMaybeDefault(J,ae,this.copyNode(g.key))):g.value=this.copyNode(g.key),g.shorthand=!0):this.unexpected():((L||M)&&this.unexpected(),this.parseGetterSetter(g))},pp$5.parsePropertyName=function(g){if(this.options.ecmaVersion>=6){if(this.eat(types$1.bracketL))return g.computed=!0,g.key=this.parseMaybeAssign(),this.expect(types$1.bracketR),g.key;g.computed=!1}return g.key=this.type===types$1.num||this.type===types$1.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},pp$5.initFunction=function(g){g.id=null,this.options.ecmaVersion>=6&&(g.generator=g.expression=!1),this.options.ecmaVersion>=8&&(g.async=!1)},pp$5.parseMethod=function(g,O,L){var M=this.startNode(),J=this.yieldPos,ae=this.awaitPos,ie=this.awaitIdentPos;return this.initFunction(M),this.options.ecmaVersion>=6&&(M.generator=g),this.options.ecmaVersion>=8&&(M.async=!!O),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(O,M.generator)|SCOPE_SUPER|(L?SCOPE_DIRECT_SUPER:0)),this.expect(types$1.parenL),M.params=this.parseBindingList(types$1.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(M,!1,!0,!1),this.yieldPos=J,this.awaitPos=ae,this.awaitIdentPos=ie,this.finishNode(M,"FunctionExpression")},pp$5.parseArrowExpression=function(g,O,L,M){var J=this.yieldPos,ae=this.awaitPos,ie=this.awaitIdentPos;return this.enterScope(functionFlags(L,!1)|SCOPE_ARROW),this.initFunction(g),this.options.ecmaVersion>=8&&(g.async=!!L),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,g.params=this.toAssignableList(O,!0),this.parseFunctionBody(g,!0,!1,M),this.yieldPos=J,this.awaitPos=ae,this.awaitIdentPos=ie,this.finishNode(g,"ArrowFunctionExpression")},pp$5.parseFunctionBody=function(g,O,L,M){var J=O&&this.type!==types$1.braceL,ae=this.strict,ie=!1;if(J)g.body=this.parseMaybeAssign(M),g.expression=!0,this.checkParams(g,!1);else{var ne=this.options.ecmaVersion>=7&&!this.isSimpleParamList(g.params);ae&&!ne||(ie=this.strictDirective(this.end))&&ne&&this.raiseRecoverable(g.start,"Illegal 'use strict' directive in function with non-simple parameter list");var oe=this.labels;this.labels=[],ie&&(this.strict=!0),this.checkParams(g,!ae&&!ie&&!O&&!L&&this.isSimpleParamList(g.params)),this.strict&&g.id&&this.checkLValSimple(g.id,BIND_OUTSIDE),g.body=this.parseBlock(!1,void 0,ie&&!ae),g.expression=!1,this.adaptDirectivePrologue(g.body.body),this.labels=oe}this.exitScope()},pp$5.isSimpleParamList=function(g){for(var O=0,L=g;O<L.length;O+=1){if("Identifier"!==L[O].type)return!1}return!0},pp$5.checkParams=function(g,O){for(var L=Object.create(null),M=0,J=g.params;M<J.length;M+=1){var ae=J[M];this.checkLValInnerPattern(ae,BIND_VAR,O?null:L)}},pp$5.parseExprList=function(g,O,L,M){for(var J=[],ae=!0;!this.eat(g);){if(ae)ae=!1;else if(this.expect(types$1.comma),O&&this.afterTrailingComma(g))break;var ie=void 0;L&&this.type===types$1.comma?ie=null:this.type===types$1.ellipsis?(ie=this.parseSpread(M),M&&this.type===types$1.comma&&M.trailingComma<0&&(M.trailingComma=this.start)):ie=this.parseMaybeAssign(!1,M),J.push(ie)}return J},pp$5.checkUnreserved=function(g){var O=g.start,L=g.end,M=g.name;(this.inGenerator&&"yield"===M&&this.raiseRecoverable(O,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===M&&this.raiseRecoverable(O,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&"arguments"===M&&this.raiseRecoverable(O,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==M&&"await"!==M||this.raise(O,"Cannot use "+M+" in class static initialization block"),this.keywords.test(M)&&this.raise(O,"Unexpected keyword '"+M+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(O,L).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(M)&&(this.inAsync||"await"!==M||this.raiseRecoverable(O,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(O,"The keyword '"+M+"' is reserved"))},pp$5.parseIdent=function(g){var O=this.parseIdentNode();return this.next(!!g),this.finishNode(O,"Identifier"),g||(this.checkUnreserved(O),"await"!==O.name||this.awaitIdentPos||(this.awaitIdentPos=O.start)),O},pp$5.parseIdentNode=function(){var g=this.startNode();return this.type===types$1.name?g.name=this.value:this.type.keyword?(g.name=this.type.keyword,"class"!==g.name&&"function"!==g.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop(),this.type=types$1.name):this.unexpected(),g},pp$5.parsePrivateIdent=function(){var g=this.startNode();return this.type===types$1.privateId?g.name=this.value:this.unexpected(),this.next(),this.finishNode(g,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(g.start,"Private field '#"+g.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(g)),g},pp$5.parseYield=function(g){this.yieldPos||(this.yieldPos=this.start);var O=this.startNode();return this.next(),this.type===types$1.semi||this.canInsertSemicolon()||this.type!==types$1.star&&!this.type.startsExpr?(O.delegate=!1,O.argument=null):(O.delegate=this.eat(types$1.star),O.argument=this.parseMaybeAssign(g)),this.finishNode(O,"YieldExpression")},pp$5.parseAwait=function(g){this.awaitPos||(this.awaitPos=this.start);var O=this.startNode();return this.next(),O.argument=this.parseMaybeUnary(null,!0,!1,g),this.finishNode(O,"AwaitExpression")};var pp$4=Parser.prototype;pp$4.raise=function(g,O){var L=getLineInfo(this.input,g);O+=" ("+L.line+":"+L.column+")";var M=new SyntaxError(O);throw M.pos=g,M.loc=L,M.raisedAt=this.pos,M},pp$4.raiseRecoverable=pp$4.raise,pp$4.curPosition=function(){if(this.options.locations)return new Position(this.curLine,this.pos-this.lineStart)};var pp$3=Parser.prototype,Scope=function Scope(g){this.flags=g,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};pp$3.enterScope=function(g){this.scopeStack.push(new Scope(g))},pp$3.exitScope=function(){this.scopeStack.pop()},pp$3.treatFunctionsAsVarInScope=function(g){return g.flags&SCOPE_FUNCTION||!this.inModule&&g.flags&SCOPE_TOP},pp$3.declareName=function(g,O,L){var M=!1;if(O===BIND_LEXICAL){var J=this.currentScope();M=J.lexical.indexOf(g)>-1||J.functions.indexOf(g)>-1||J.var.indexOf(g)>-1,J.lexical.push(g),this.inModule&&J.flags&SCOPE_TOP&&delete this.undefinedExports[g]}else if(O===BIND_SIMPLE_CATCH){this.currentScope().lexical.push(g)}else if(O===BIND_FUNCTION){var ae=this.currentScope();M=this.treatFunctionsAsVar?ae.lexical.indexOf(g)>-1:ae.lexical.indexOf(g)>-1||ae.var.indexOf(g)>-1,ae.functions.push(g)}else for(var ie=this.scopeStack.length-1;ie>=0;--ie){var ne=this.scopeStack[ie];if(ne.lexical.indexOf(g)>-1&&!(ne.flags&SCOPE_SIMPLE_CATCH&&ne.lexical[0]===g)||!this.treatFunctionsAsVarInScope(ne)&&ne.functions.indexOf(g)>-1){M=!0;break}if(ne.var.push(g),this.inModule&&ne.flags&SCOPE_TOP&&delete this.undefinedExports[g],ne.flags&SCOPE_VAR)break}M&&this.raiseRecoverable(L,"Identifier '"+g+"' has already been declared")},pp$3.checkLocalExport=function(g){-1===this.scopeStack[0].lexical.indexOf(g.name)&&-1===this.scopeStack[0].var.indexOf(g.name)&&(this.undefinedExports[g.name]=g)},pp$3.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},pp$3.currentVarScope=function(){for(var g=this.scopeStack.length-1;;g--){var O=this.scopeStack[g];if(O.flags&SCOPE_VAR)return O}},pp$3.currentThisScope=function(){for(var g=this.scopeStack.length-1;;g--){var O=this.scopeStack[g];if(O.flags&SCOPE_VAR&&!(O.flags&SCOPE_ARROW))return O}};var Node$1=function Node(g,O,L){this.type="",this.start=O,this.end=0,g.options.locations&&(this.loc=new SourceLocation(g,L)),g.options.directSourceFile&&(this.sourceFile=g.options.directSourceFile),g.options.ranges&&(this.range=[O,0])},pp$2=Parser.prototype;function finishNodeAt(g,O,L,M){return g.type=O,g.end=L,this.options.locations&&(g.loc.end=M),this.options.ranges&&(g.range[1]=L),g}pp$2.startNode=function(){return new Node$1(this,this.start,this.startLoc)},pp$2.startNodeAt=function(g,O){return new Node$1(this,g,O)},pp$2.finishNode=function(g,O){return finishNodeAt.call(this,g,O,this.lastTokEnd,this.lastTokEndLoc)},pp$2.finishNodeAt=function(g,O,L,M){return finishNodeAt.call(this,g,O,L,M)},pp$2.copyNode=function(g){var O=new Node$1(this,g.start,this.startLoc);for(var L in g)O[L]=g[L];return O};var ecma9BinaryProperties="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",ecma10BinaryProperties=ecma9BinaryProperties+" Extended_Pictographic",ecma11BinaryProperties=ecma10BinaryProperties,ecma12BinaryProperties=ecma11BinaryProperties+" EBase EComp EMod EPres ExtPict",ecma13BinaryProperties=ecma12BinaryProperties,ecma14BinaryProperties=ecma13BinaryProperties,unicodeBinaryProperties={9:ecma9BinaryProperties,10:ecma10BinaryProperties,11:ecma11BinaryProperties,12:ecma12BinaryProperties,13:ecma13BinaryProperties,14:ecma14BinaryProperties},ecma14BinaryPropertiesOfStrings="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",unicodeBinaryPropertiesOfStrings={9:"",10:"",11:"",12:"",13:"",14:ecma14BinaryPropertiesOfStrings},unicodeGeneralCategoryValues="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",ecma9ScriptValues="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ecma10ScriptValues=ecma9ScriptValues+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",ecma11ScriptValues=ecma10ScriptValues+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",ecma12ScriptValues=ecma11ScriptValues+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ecma13ScriptValues=ecma12ScriptValues+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",ecma14ScriptValues=ecma13ScriptValues+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",unicodeScriptValues={9:ecma9ScriptValues,10:ecma10ScriptValues,11:ecma11ScriptValues,12:ecma12ScriptValues,13:ecma13ScriptValues,14:ecma14ScriptValues},data={};function buildUnicodeData(g){var O=data[g]={binary:wordsRegexp(unicodeBinaryProperties[g]+" "+unicodeGeneralCategoryValues),binaryOfStrings:wordsRegexp(unicodeBinaryPropertiesOfStrings[g]),nonBinary:{General_Category:wordsRegexp(unicodeGeneralCategoryValues),Script:wordsRegexp(unicodeScriptValues[g])}};O.nonBinary.Script_Extensions=O.nonBinary.Script,O.nonBinary.gc=O.nonBinary.General_Category,O.nonBinary.sc=O.nonBinary.Script,O.nonBinary.scx=O.nonBinary.Script_Extensions}for(var i=0,list=[9,10,11,12,13,14];i<list.length;i+=1){var ecmaVersion=list[i];buildUnicodeData(ecmaVersion)}var pp$1=Parser.prototype,BranchID=function BranchID(g,O){this.parent=g,this.base=O||this};BranchID.prototype.separatedFrom=function separatedFrom(g){for(var O=this;O;O=O.parent)for(var L=g;L;L=L.parent)if(O.base===L.base&&O!==L)return!0;return!1},BranchID.prototype.sibling=function sibling(){return new BranchID(this.parent,this.base)};var RegExpValidationState=function RegExpValidationState(g){this.parser=g,this.validFlags="gim"+(g.options.ecmaVersion>=6?"uy":"")+(g.options.ecmaVersion>=9?"s":"")+(g.options.ecmaVersion>=13?"d":"")+(g.options.ecmaVersion>=15?"v":""),this.unicodeProperties=data[g.options.ecmaVersion>=14?14:g.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function hasProp(g){for(var O in g)return!0;return!1}function isSyntaxCharacter(g){return 36===g||g>=40&&g<=43||46===g||63===g||g>=91&&g<=94||g>=123&&g<=125}function isRegExpIdentifierStart(g){return isIdentifierStart(g,!0)||36===g||95===g}function isRegExpIdentifierPart(g){return isIdentifierChar(g,!0)||36===g||95===g||8204===g||8205===g}function isControlLetter(g){return g>=65&&g<=90||g>=97&&g<=122}function isValidUnicode(g){return g>=0&&g<=1114111}RegExpValidationState.prototype.reset=function reset(g,O,L){var M=-1!==L.indexOf("v"),J=-1!==L.indexOf("u");this.start=0|g,this.source=O+"",this.flags=L,M&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=J&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=J&&this.parser.options.ecmaVersion>=9)},RegExpValidationState.prototype.raise=function raise(g){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+g)},RegExpValidationState.prototype.at=function at(g,O){void 0===O&&(O=!1);var L=this.source,M=L.length;if(g>=M)return-1;var J=L.charCodeAt(g);if(!O&&!this.switchU||J<=55295||J>=57344||g+1>=M)return J;var ae=L.charCodeAt(g+1);return ae>=56320&&ae<=57343?(J<<10)+ae-56613888:J},RegExpValidationState.prototype.nextIndex=function nextIndex(g,O){void 0===O&&(O=!1);var L=this.source,M=L.length;if(g>=M)return M;var J,ae=L.charCodeAt(g);return!O&&!this.switchU||ae<=55295||ae>=57344||g+1>=M||(J=L.charCodeAt(g+1))<56320||J>57343?g+1:g+2},RegExpValidationState.prototype.current=function current(g){return void 0===g&&(g=!1),this.at(this.pos,g)},RegExpValidationState.prototype.lookahead=function lookahead(g){return void 0===g&&(g=!1),this.at(this.nextIndex(this.pos,g),g)},RegExpValidationState.prototype.advance=function advance(g){void 0===g&&(g=!1),this.pos=this.nextIndex(this.pos,g)},RegExpValidationState.prototype.eat=function eat(g,O){return void 0===O&&(O=!1),this.current(O)===g&&(this.advance(O),!0)},RegExpValidationState.prototype.eatChars=function eatChars(g,O){void 0===O&&(O=!1);for(var L=this.pos,M=0,J=g;M<J.length;M+=1){var ae=J[M],ie=this.at(L,O);if(-1===ie||ie!==ae)return!1;L=this.nextIndex(L,O)}return this.pos=L,!0},pp$1.validateRegExpFlags=function(g){for(var O=g.validFlags,L=g.flags,M=!1,J=!1,ae=0;ae<L.length;ae++){var ie=L.charAt(ae);-1===O.indexOf(ie)&&this.raise(g.start,"Invalid regular expression flag"),L.indexOf(ie,ae+1)>-1&&this.raise(g.start,"Duplicate regular expression flag"),"u"===ie&&(M=!0),"v"===ie&&(J=!0)}this.options.ecmaVersion>=15&&M&&J&&this.raise(g.start,"Invalid regular expression flag")},pp$1.validateRegExpPattern=function(g){this.regexp_pattern(g),!g.switchN&&this.options.ecmaVersion>=9&&hasProp(g.groupNames)&&(g.switchN=!0,this.regexp_pattern(g))},pp$1.regexp_pattern=function(g){g.pos=0,g.lastIntValue=0,g.lastStringValue="",g.lastAssertionIsQuantifiable=!1,g.numCapturingParens=0,g.maxBackReference=0,g.groupNames=Object.create(null),g.backReferenceNames.length=0,g.branchID=null,this.regexp_disjunction(g),g.pos!==g.source.length&&(g.eat(41)&&g.raise("Unmatched ')'"),(g.eat(93)||g.eat(125))&&g.raise("Lone quantifier brackets")),g.maxBackReference>g.numCapturingParens&&g.raise("Invalid escape");for(var O=0,L=g.backReferenceNames;O<L.length;O+=1){var M=L[O];g.groupNames[M]||g.raise("Invalid named capture referenced")}},pp$1.regexp_disjunction=function(g){var O=this.options.ecmaVersion>=16;for(O&&(g.branchID=new BranchID(g.branchID,null)),this.regexp_alternative(g);g.eat(124);)O&&(g.branchID=g.branchID.sibling()),this.regexp_alternative(g);O&&(g.branchID=g.branchID.parent),this.regexp_eatQuantifier(g,!0)&&g.raise("Nothing to repeat"),g.eat(123)&&g.raise("Lone quantifier brackets")},pp$1.regexp_alternative=function(g){for(;g.pos<g.source.length&&this.regexp_eatTerm(g););},pp$1.regexp_eatTerm=function(g){return this.regexp_eatAssertion(g)?(g.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(g)&&g.switchU&&g.raise("Invalid quantifier"),!0):!!(g.switchU?this.regexp_eatAtom(g):this.regexp_eatExtendedAtom(g))&&(this.regexp_eatQuantifier(g),!0)},pp$1.regexp_eatAssertion=function(g){var O=g.pos;if(g.lastAssertionIsQuantifiable=!1,g.eat(94)||g.eat(36))return!0;if(g.eat(92)){if(g.eat(66)||g.eat(98))return!0;g.pos=O}if(g.eat(40)&&g.eat(63)){var L=!1;if(this.options.ecmaVersion>=9&&(L=g.eat(60)),g.eat(61)||g.eat(33))return this.regexp_disjunction(g),g.eat(41)||g.raise("Unterminated group"),g.lastAssertionIsQuantifiable=!L,!0}return g.pos=O,!1},pp$1.regexp_eatQuantifier=function(g,O){return void 0===O&&(O=!1),!!this.regexp_eatQuantifierPrefix(g,O)&&(g.eat(63),!0)},pp$1.regexp_eatQuantifierPrefix=function(g,O){return g.eat(42)||g.eat(43)||g.eat(63)||this.regexp_eatBracedQuantifier(g,O)},pp$1.regexp_eatBracedQuantifier=function(g,O){var L=g.pos;if(g.eat(123)){var M=0,J=-1;if(this.regexp_eatDecimalDigits(g)&&(M=g.lastIntValue,g.eat(44)&&this.regexp_eatDecimalDigits(g)&&(J=g.lastIntValue),g.eat(125)))return-1!==J&&J<M&&!O&&g.raise("numbers out of order in {} quantifier"),!0;g.switchU&&!O&&g.raise("Incomplete quantifier"),g.pos=L}return!1},pp$1.regexp_eatAtom=function(g){return this.regexp_eatPatternCharacters(g)||g.eat(46)||this.regexp_eatReverseSolidusAtomEscape(g)||this.regexp_eatCharacterClass(g)||this.regexp_eatUncapturingGroup(g)||this.regexp_eatCapturingGroup(g)},pp$1.regexp_eatReverseSolidusAtomEscape=function(g){var O=g.pos;if(g.eat(92)){if(this.regexp_eatAtomEscape(g))return!0;g.pos=O}return!1},pp$1.regexp_eatUncapturingGroup=function(g){var O=g.pos;if(g.eat(40)){if(g.eat(63)&&g.eat(58)){if(this.regexp_disjunction(g),g.eat(41))return!0;g.raise("Unterminated group")}g.pos=O}return!1},pp$1.regexp_eatCapturingGroup=function(g){if(g.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(g):63===g.current()&&g.raise("Invalid group"),this.regexp_disjunction(g),g.eat(41))return g.numCapturingParens+=1,!0;g.raise("Unterminated group")}return!1},pp$1.regexp_eatExtendedAtom=function(g){return g.eat(46)||this.regexp_eatReverseSolidusAtomEscape(g)||this.regexp_eatCharacterClass(g)||this.regexp_eatUncapturingGroup(g)||this.regexp_eatCapturingGroup(g)||this.regexp_eatInvalidBracedQuantifier(g)||this.regexp_eatExtendedPatternCharacter(g)},pp$1.regexp_eatInvalidBracedQuantifier=function(g){return this.regexp_eatBracedQuantifier(g,!0)&&g.raise("Nothing to repeat"),!1},pp$1.regexp_eatSyntaxCharacter=function(g){var O=g.current();return!!isSyntaxCharacter(O)&&(g.lastIntValue=O,g.advance(),!0)},pp$1.regexp_eatPatternCharacters=function(g){for(var O=g.pos,L=0;-1!==(L=g.current())&&!isSyntaxCharacter(L);)g.advance();return g.pos!==O},pp$1.regexp_eatExtendedPatternCharacter=function(g){var O=g.current();return!(-1===O||36===O||O>=40&&O<=43||46===O||63===O||91===O||94===O||124===O)&&(g.advance(),!0)},pp$1.regexp_groupSpecifier=function(g){if(g.eat(63)){this.regexp_eatGroupName(g)||g.raise("Invalid group");var O=this.options.ecmaVersion>=16,L=g.groupNames[g.lastStringValue];if(L)if(O)for(var M=0,J=L;M<J.length;M+=1){J[M].separatedFrom(g.branchID)||g.raise("Duplicate capture group name")}else g.raise("Duplicate capture group name");O?(L||(g.groupNames[g.lastStringValue]=[])).push(g.branchID):g.groupNames[g.lastStringValue]=!0}},pp$1.regexp_eatGroupName=function(g){if(g.lastStringValue="",g.eat(60)){if(this.regexp_eatRegExpIdentifierName(g)&&g.eat(62))return!0;g.raise("Invalid capture group name")}return!1},pp$1.regexp_eatRegExpIdentifierName=function(g){if(g.lastStringValue="",this.regexp_eatRegExpIdentifierStart(g)){for(g.lastStringValue+=codePointToString(g.lastIntValue);this.regexp_eatRegExpIdentifierPart(g);)g.lastStringValue+=codePointToString(g.lastIntValue);return!0}return!1},pp$1.regexp_eatRegExpIdentifierStart=function(g){var O=g.pos,L=this.options.ecmaVersion>=11,M=g.current(L);return g.advance(L),92===M&&this.regexp_eatRegExpUnicodeEscapeSequence(g,L)&&(M=g.lastIntValue),isRegExpIdentifierStart(M)?(g.lastIntValue=M,!0):(g.pos=O,!1)},pp$1.regexp_eatRegExpIdentifierPart=function(g){var O=g.pos,L=this.options.ecmaVersion>=11,M=g.current(L);return g.advance(L),92===M&&this.regexp_eatRegExpUnicodeEscapeSequence(g,L)&&(M=g.lastIntValue),isRegExpIdentifierPart(M)?(g.lastIntValue=M,!0):(g.pos=O,!1)},pp$1.regexp_eatAtomEscape=function(g){return!!(this.regexp_eatBackReference(g)||this.regexp_eatCharacterClassEscape(g)||this.regexp_eatCharacterEscape(g)||g.switchN&&this.regexp_eatKGroupName(g))||(g.switchU&&(99===g.current()&&g.raise("Invalid unicode escape"),g.raise("Invalid escape")),!1)},pp$1.regexp_eatBackReference=function(g){var O=g.pos;if(this.regexp_eatDecimalEscape(g)){var L=g.lastIntValue;if(g.switchU)return L>g.maxBackReference&&(g.maxBackReference=L),!0;if(L<=g.numCapturingParens)return!0;g.pos=O}return!1},pp$1.regexp_eatKGroupName=function(g){if(g.eat(107)){if(this.regexp_eatGroupName(g))return g.backReferenceNames.push(g.lastStringValue),!0;g.raise("Invalid named reference")}return!1},pp$1.regexp_eatCharacterEscape=function(g){return this.regexp_eatControlEscape(g)||this.regexp_eatCControlLetter(g)||this.regexp_eatZero(g)||this.regexp_eatHexEscapeSequence(g)||this.regexp_eatRegExpUnicodeEscapeSequence(g,!1)||!g.switchU&&this.regexp_eatLegacyOctalEscapeSequence(g)||this.regexp_eatIdentityEscape(g)},pp$1.regexp_eatCControlLetter=function(g){var O=g.pos;if(g.eat(99)){if(this.regexp_eatControlLetter(g))return!0;g.pos=O}return!1},pp$1.regexp_eatZero=function(g){return 48===g.current()&&!isDecimalDigit(g.lookahead())&&(g.lastIntValue=0,g.advance(),!0)},pp$1.regexp_eatControlEscape=function(g){var O=g.current();return 116===O?(g.lastIntValue=9,g.advance(),!0):110===O?(g.lastIntValue=10,g.advance(),!0):118===O?(g.lastIntValue=11,g.advance(),!0):102===O?(g.lastIntValue=12,g.advance(),!0):114===O&&(g.lastIntValue=13,g.advance(),!0)},pp$1.regexp_eatControlLetter=function(g){var O=g.current();return!!isControlLetter(O)&&(g.lastIntValue=O%32,g.advance(),!0)},pp$1.regexp_eatRegExpUnicodeEscapeSequence=function(g,O){void 0===O&&(O=!1);var L=g.pos,M=O||g.switchU;if(g.eat(117)){if(this.regexp_eatFixedHexDigits(g,4)){var J=g.lastIntValue;if(M&&J>=55296&&J<=56319){var ae=g.pos;if(g.eat(92)&&g.eat(117)&&this.regexp_eatFixedHexDigits(g,4)){var ie=g.lastIntValue;if(ie>=56320&&ie<=57343)return g.lastIntValue=1024*(J-55296)+(ie-56320)+65536,!0}g.pos=ae,g.lastIntValue=J}return!0}if(M&&g.eat(123)&&this.regexp_eatHexDigits(g)&&g.eat(125)&&isValidUnicode(g.lastIntValue))return!0;M&&g.raise("Invalid unicode escape"),g.pos=L}return!1},pp$1.regexp_eatIdentityEscape=function(g){if(g.switchU)return!!this.regexp_eatSyntaxCharacter(g)||!!g.eat(47)&&(g.lastIntValue=47,!0);var O=g.current();return!(99===O||g.switchN&&107===O)&&(g.lastIntValue=O,g.advance(),!0)},pp$1.regexp_eatDecimalEscape=function(g){g.lastIntValue=0;var O=g.current();if(O>=49&&O<=57){do{g.lastIntValue=10*g.lastIntValue+(O-48),g.advance()}while((O=g.current())>=48&&O<=57);return!0}return!1};var CharSetNone=0,CharSetOk=1,CharSetString=2;function isCharacterClassEscape(g){return 100===g||68===g||115===g||83===g||119===g||87===g}function isUnicodePropertyNameCharacter(g){return isControlLetter(g)||95===g}function isUnicodePropertyValueCharacter(g){return isUnicodePropertyNameCharacter(g)||isDecimalDigit(g)}function isClassSetReservedDoublePunctuatorCharacter(g){return 33===g||g>=35&&g<=38||g>=42&&g<=44||46===g||g>=58&&g<=64||94===g||96===g||126===g}function isClassSetSyntaxCharacter(g){return 40===g||41===g||45===g||47===g||g>=91&&g<=93||g>=123&&g<=125}function isClassSetReservedPunctuator(g){return 33===g||35===g||37===g||38===g||44===g||45===g||g>=58&&g<=62||64===g||96===g||126===g}function isDecimalDigit(g){return g>=48&&g<=57}function isHexDigit(g){return g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102}function hexToInt(g){return g>=65&&g<=70?g-65+10:g>=97&&g<=102?g-97+10:g-48}function isOctalDigit(g){return g>=48&&g<=55}pp$1.regexp_eatCharacterClassEscape=function(g){var O=g.current();if(isCharacterClassEscape(O))return g.lastIntValue=-1,g.advance(),CharSetOk;var L=!1;if(g.switchU&&this.options.ecmaVersion>=9&&((L=80===O)||112===O)){var M;if(g.lastIntValue=-1,g.advance(),g.eat(123)&&(M=this.regexp_eatUnicodePropertyValueExpression(g))&&g.eat(125))return L&&M===CharSetString&&g.raise("Invalid property name"),M;g.raise("Invalid property name")}return CharSetNone},pp$1.regexp_eatUnicodePropertyValueExpression=function(g){var O=g.pos;if(this.regexp_eatUnicodePropertyName(g)&&g.eat(61)){var L=g.lastStringValue;if(this.regexp_eatUnicodePropertyValue(g)){var M=g.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(g,L,M),CharSetOk}}if(g.pos=O,this.regexp_eatLoneUnicodePropertyNameOrValue(g)){var J=g.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(g,J)}return CharSetNone},pp$1.regexp_validateUnicodePropertyNameAndValue=function(g,O,L){hasOwn(g.unicodeProperties.nonBinary,O)||g.raise("Invalid property name"),g.unicodeProperties.nonBinary[O].test(L)||g.raise("Invalid property value")},pp$1.regexp_validateUnicodePropertyNameOrValue=function(g,O){return g.unicodeProperties.binary.test(O)?CharSetOk:g.switchV&&g.unicodeProperties.binaryOfStrings.test(O)?CharSetString:void g.raise("Invalid property name")},pp$1.regexp_eatUnicodePropertyName=function(g){var O=0;for(g.lastStringValue="";isUnicodePropertyNameCharacter(O=g.current());)g.lastStringValue+=codePointToString(O),g.advance();return""!==g.lastStringValue},pp$1.regexp_eatUnicodePropertyValue=function(g){var O=0;for(g.lastStringValue="";isUnicodePropertyValueCharacter(O=g.current());)g.lastStringValue+=codePointToString(O),g.advance();return""!==g.lastStringValue},pp$1.regexp_eatLoneUnicodePropertyNameOrValue=function(g){return this.regexp_eatUnicodePropertyValue(g)},pp$1.regexp_eatCharacterClass=function(g){if(g.eat(91)){var O=g.eat(94),L=this.regexp_classContents(g);return g.eat(93)||g.raise("Unterminated character class"),O&&L===CharSetString&&g.raise("Negated character class may contain strings"),!0}return!1},pp$1.regexp_classContents=function(g){return 93===g.current()?CharSetOk:g.switchV?this.regexp_classSetExpression(g):(this.regexp_nonEmptyClassRanges(g),CharSetOk)},pp$1.regexp_nonEmptyClassRanges=function(g){for(;this.regexp_eatClassAtom(g);){var O=g.lastIntValue;if(g.eat(45)&&this.regexp_eatClassAtom(g)){var L=g.lastIntValue;!g.switchU||-1!==O&&-1!==L||g.raise("Invalid character class"),-1!==O&&-1!==L&&O>L&&g.raise("Range out of order in character class")}}},pp$1.regexp_eatClassAtom=function(g){var O=g.pos;if(g.eat(92)){if(this.regexp_eatClassEscape(g))return!0;if(g.switchU){var L=g.current();(99===L||isOctalDigit(L))&&g.raise("Invalid class escape"),g.raise("Invalid escape")}g.pos=O}var M=g.current();return 93!==M&&(g.lastIntValue=M,g.advance(),!0)},pp$1.regexp_eatClassEscape=function(g){var O=g.pos;if(g.eat(98))return g.lastIntValue=8,!0;if(g.switchU&&g.eat(45))return g.lastIntValue=45,!0;if(!g.switchU&&g.eat(99)){if(this.regexp_eatClassControlLetter(g))return!0;g.pos=O}return this.regexp_eatCharacterClassEscape(g)||this.regexp_eatCharacterEscape(g)},pp$1.regexp_classSetExpression=function(g){var O,L=CharSetOk;if(this.regexp_eatClassSetRange(g));else if(O=this.regexp_eatClassSetOperand(g)){O===CharSetString&&(L=CharSetString);for(var M=g.pos;g.eatChars([38,38]);)38!==g.current()&&(O=this.regexp_eatClassSetOperand(g))?O!==CharSetString&&(L=CharSetOk):g.raise("Invalid character in character class");if(M!==g.pos)return L;for(;g.eatChars([45,45]);)this.regexp_eatClassSetOperand(g)||g.raise("Invalid character in character class");if(M!==g.pos)return L}else g.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(g)){if(!(O=this.regexp_eatClassSetOperand(g)))return L;O===CharSetString&&(L=CharSetString)}},pp$1.regexp_eatClassSetRange=function(g){var O=g.pos;if(this.regexp_eatClassSetCharacter(g)){var L=g.lastIntValue;if(g.eat(45)&&this.regexp_eatClassSetCharacter(g)){var M=g.lastIntValue;return-1!==L&&-1!==M&&L>M&&g.raise("Range out of order in character class"),!0}g.pos=O}return!1},pp$1.regexp_eatClassSetOperand=function(g){return this.regexp_eatClassSetCharacter(g)?CharSetOk:this.regexp_eatClassStringDisjunction(g)||this.regexp_eatNestedClass(g)},pp$1.regexp_eatNestedClass=function(g){var O=g.pos;if(g.eat(91)){var L=g.eat(94),M=this.regexp_classContents(g);if(g.eat(93))return L&&M===CharSetString&&g.raise("Negated character class may contain strings"),M;g.pos=O}if(g.eat(92)){var J=this.regexp_eatCharacterClassEscape(g);if(J)return J;g.pos=O}return null},pp$1.regexp_eatClassStringDisjunction=function(g){var O=g.pos;if(g.eatChars([92,113])){if(g.eat(123)){var L=this.regexp_classStringDisjunctionContents(g);if(g.eat(125))return L}else g.raise("Invalid escape");g.pos=O}return null},pp$1.regexp_classStringDisjunctionContents=function(g){for(var O=this.regexp_classString(g);g.eat(124);)this.regexp_classString(g)===CharSetString&&(O=CharSetString);return O},pp$1.regexp_classString=function(g){for(var O=0;this.regexp_eatClassSetCharacter(g);)O++;return 1===O?CharSetOk:CharSetString},pp$1.regexp_eatClassSetCharacter=function(g){var O=g.pos;if(g.eat(92))return!(!this.regexp_eatCharacterEscape(g)&&!this.regexp_eatClassSetReservedPunctuator(g))||(g.eat(98)?(g.lastIntValue=8,!0):(g.pos=O,!1));var L=g.current();return!(L<0||L===g.lookahead()&&isClassSetReservedDoublePunctuatorCharacter(L))&&(!isClassSetSyntaxCharacter(L)&&(g.advance(),g.lastIntValue=L,!0))},pp$1.regexp_eatClassSetReservedPunctuator=function(g){var O=g.current();return!!isClassSetReservedPunctuator(O)&&(g.lastIntValue=O,g.advance(),!0)},pp$1.regexp_eatClassControlLetter=function(g){var O=g.current();return!(!isDecimalDigit(O)&&95!==O)&&(g.lastIntValue=O%32,g.advance(),!0)},pp$1.regexp_eatHexEscapeSequence=function(g){var O=g.pos;if(g.eat(120)){if(this.regexp_eatFixedHexDigits(g,2))return!0;g.switchU&&g.raise("Invalid escape"),g.pos=O}return!1},pp$1.regexp_eatDecimalDigits=function(g){var O=g.pos,L=0;for(g.lastIntValue=0;isDecimalDigit(L=g.current());)g.lastIntValue=10*g.lastIntValue+(L-48),g.advance();return g.pos!==O},pp$1.regexp_eatHexDigits=function(g){var O=g.pos,L=0;for(g.lastIntValue=0;isHexDigit(L=g.current());)g.lastIntValue=16*g.lastIntValue+hexToInt(L),g.advance();return g.pos!==O},pp$1.regexp_eatLegacyOctalEscapeSequence=function(g){if(this.regexp_eatOctalDigit(g)){var O=g.lastIntValue;if(this.regexp_eatOctalDigit(g)){var L=g.lastIntValue;O<=3&&this.regexp_eatOctalDigit(g)?g.lastIntValue=64*O+8*L+g.lastIntValue:g.lastIntValue=8*O+L}else g.lastIntValue=O;return!0}return!1},pp$1.regexp_eatOctalDigit=function(g){var O=g.current();return isOctalDigit(O)?(g.lastIntValue=O-48,g.advance(),!0):(g.lastIntValue=0,!1)},pp$1.regexp_eatFixedHexDigits=function(g,O){var L=g.pos;g.lastIntValue=0;for(var M=0;M<O;++M){var J=g.current();if(!isHexDigit(J))return g.pos=L,!1;g.lastIntValue=16*g.lastIntValue+hexToInt(J),g.advance()}return!0};var Token=function Token(g){this.type=g.type,this.value=g.value,this.start=g.start,this.end=g.end,g.options.locations&&(this.loc=new SourceLocation(g,g.startLoc,g.endLoc)),g.options.ranges&&(this.range=[g.start,g.end])},pp=Parser.prototype;function stringToNumber(g,O){return O?parseInt(g,8):parseFloat(g.replace(/_/g,""))}function stringToBigInt(g){return"function"!=typeof BigInt?null:BigInt(g.replace(/_/g,""))}pp.next=function(g){!g&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Token(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},pp.getToken=function(){return this.next(),new Token(this)},"undefined"!=typeof Symbol&&(pp[Symbol.iterator]=function(){var g=this;return{next:function(){var O=g.getToken();return{done:O.type===types$1.eof,value:O}}}}),pp.nextToken=function(){var g=this.curContext();return g&&g.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(types$1.eof):g.override?g.override(this):void this.readToken(this.fullCharCodeAtPos())},pp.readToken=function(g){return isIdentifierStart(g,this.options.ecmaVersion>=6)||92===g?this.readWord():this.getTokenFromCode(g)},pp.fullCharCodeAtPos=function(){var g=this.input.charCodeAt(this.pos);if(g<=55295||g>=56320)return g;var O=this.input.charCodeAt(this.pos+1);return O<=56319||O>=57344?g:(g<<10)+O-56613888},pp.skipBlockComment=function(){var g=this.options.onComment&&this.curPosition(),O=this.pos,L=this.input.indexOf("*/",this.pos+=2);if(-1===L&&this.raise(this.pos-2,"Unterminated comment"),this.pos=L+2,this.options.locations)for(var M=void 0,J=O;(M=nextLineBreak(this.input,J,this.pos))>-1;)++this.curLine,J=this.lineStart=M;this.options.onComment&&this.options.onComment(!0,this.input.slice(O+2,L),O,this.pos,g,this.curPosition())},pp.skipLineComment=function(g){for(var O=this.pos,L=this.options.onComment&&this.curPosition(),M=this.input.charCodeAt(this.pos+=g);this.pos<this.input.length&&!isNewLine(M);)M=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(O+g,this.pos),O,this.pos,L,this.curPosition())},pp.skipSpace=function(){e:for(;this.pos<this.input.length;){var g=this.input.charCodeAt(this.pos);switch(g){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(g>8&&g<14||g>=5760&&nonASCIIwhitespace.test(String.fromCharCode(g))))break e;++this.pos}}},pp.finishToken=function(g,O){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var L=this.type;this.type=g,this.value=O,this.updateContext(L)},pp.readToken_dot=function(){var g=this.input.charCodeAt(this.pos+1);if(g>=48&&g<=57)return this.readNumber(!0);var O=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===g&&46===O?(this.pos+=3,this.finishToken(types$1.ellipsis)):(++this.pos,this.finishToken(types$1.dot))},pp.readToken_slash=function(){var g=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===g?this.finishOp(types$1.assign,2):this.finishOp(types$1.slash,1)},pp.readToken_mult_modulo_exp=function(g){var O=this.input.charCodeAt(this.pos+1),L=1,M=42===g?types$1.star:types$1.modulo;return this.options.ecmaVersion>=7&&42===g&&42===O&&(++L,M=types$1.starstar,O=this.input.charCodeAt(this.pos+2)),61===O?this.finishOp(types$1.assign,L+1):this.finishOp(M,L)},pp.readToken_pipe_amp=function(g){var O=this.input.charCodeAt(this.pos+1);if(O===g){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(types$1.assign,3);return this.finishOp(124===g?types$1.logicalOR:types$1.logicalAND,2)}return 61===O?this.finishOp(types$1.assign,2):this.finishOp(124===g?types$1.bitwiseOR:types$1.bitwiseAND,1)},pp.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(types$1.assign,2):this.finishOp(types$1.bitwiseXOR,1)},pp.readToken_plus_min=function(g){var O=this.input.charCodeAt(this.pos+1);return O===g?45!==O||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!lineBreak.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(types$1.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===O?this.finishOp(types$1.assign,2):this.finishOp(types$1.plusMin,1)},pp.readToken_lt_gt=function(g){var O=this.input.charCodeAt(this.pos+1),L=1;return O===g?(L=62===g&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+L)?this.finishOp(types$1.assign,L+1):this.finishOp(types$1.bitShift,L)):33!==O||60!==g||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===O&&(L=2),this.finishOp(types$1.relational,L)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},pp.readToken_eq_excl=function(g){var O=this.input.charCodeAt(this.pos+1);return 61===O?this.finishOp(types$1.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===g&&62===O&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(types$1.arrow)):this.finishOp(61===g?types$1.eq:types$1.prefix,1)},pp.readToken_question=function(){var g=this.options.ecmaVersion;if(g>=11){var O=this.input.charCodeAt(this.pos+1);if(46===O){var L=this.input.charCodeAt(this.pos+2);if(L<48||L>57)return this.finishOp(types$1.questionDot,2)}if(63===O){if(g>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(types$1.assign,3);return this.finishOp(types$1.coalesce,2)}}return this.finishOp(types$1.question,1)},pp.readToken_numberSign=function(){var g=35;if(this.options.ecmaVersion>=13&&(++this.pos,isIdentifierStart(g=this.fullCharCodeAtPos(),!0)||92===g))return this.finishToken(types$1.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+codePointToString(g)+"'")},pp.getTokenFromCode=function(g){switch(g){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(types$1.parenL);case 41:return++this.pos,this.finishToken(types$1.parenR);case 59:return++this.pos,this.finishToken(types$1.semi);case 44:return++this.pos,this.finishToken(types$1.comma);case 91:return++this.pos,this.finishToken(types$1.bracketL);case 93:return++this.pos,this.finishToken(types$1.bracketR);case 123:return++this.pos,this.finishToken(types$1.braceL);case 125:return++this.pos,this.finishToken(types$1.braceR);case 58:return++this.pos,this.finishToken(types$1.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(types$1.backQuote);case 48:var O=this.input.charCodeAt(this.pos+1);if(120===O||88===O)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===O||79===O)return this.readRadixNumber(8);if(98===O||66===O)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(g);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(g);case 124:case 38:return this.readToken_pipe_amp(g);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(g);case 60:case 62:return this.readToken_lt_gt(g);case 61:case 33:return this.readToken_eq_excl(g);case 63:return this.readToken_question();case 126:return this.finishOp(types$1.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+codePointToString(g)+"'")},pp.finishOp=function(g,O){var L=this.input.slice(this.pos,this.pos+O);return this.pos+=O,this.finishToken(g,L)},pp.readRegexp=function(){for(var g,O,L=this.pos;;){this.pos>=this.input.length&&this.raise(L,"Unterminated regular expression");var M=this.input.charAt(this.pos);if(lineBreak.test(M)&&this.raise(L,"Unterminated regular expression"),g)g=!1;else{if("["===M)O=!0;else if("]"===M&&O)O=!1;else if("/"===M&&!O)break;g="\\"===M}++this.pos}var J=this.input.slice(L,this.pos);++this.pos;var ae=this.pos,ie=this.readWord1();this.containsEsc&&this.unexpected(ae);var ne=this.regexpState||(this.regexpState=new RegExpValidationState(this));ne.reset(L,J,ie),this.validateRegExpFlags(ne),this.validateRegExpPattern(ne);var oe=null;try{oe=new RegExp(J,ie)}catch(g){}return this.finishToken(types$1.regexp,{pattern:J,flags:ie,value:oe})},pp.readInt=function(g,O,L){for(var M=this.options.ecmaVersion>=12&&void 0===O,J=L&&48===this.input.charCodeAt(this.pos),ae=this.pos,ie=0,ne=0,oe=0,pe=null==O?1/0:O;oe<pe;++oe,++this.pos){var le=this.input.charCodeAt(this.pos),ue=void 0;if(M&&95===le)J&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===ne&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===oe&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),ne=le;else{if((ue=le>=97?le-97+10:le>=65?le-65+10:le>=48&&le<=57?le-48:1/0)>=g)break;ne=le,ie=ie*g+ue}}return M&&95===ne&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===ae||null!=O&&this.pos-ae!==O?null:ie},pp.readRadixNumber=function(g){var O=this.pos;this.pos+=2;var L=this.readInt(g);return null==L&&this.raise(this.start+2,"Expected number in radix "+g),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(L=stringToBigInt(this.input.slice(O,this.pos)),++this.pos):isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(types$1.num,L)},pp.readNumber=function(g){var O=this.pos;g||null!==this.readInt(10,void 0,!0)||this.raise(O,"Invalid number");var L=this.pos-O>=2&&48===this.input.charCodeAt(O);L&&this.strict&&this.raise(O,"Invalid number");var M=this.input.charCodeAt(this.pos);if(!L&&!g&&this.options.ecmaVersion>=11&&110===M){var J=stringToBigInt(this.input.slice(O,this.pos));return++this.pos,isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(types$1.num,J)}L&&/[89]/.test(this.input.slice(O,this.pos))&&(L=!1),46!==M||L||(++this.pos,this.readInt(10),M=this.input.charCodeAt(this.pos)),69!==M&&101!==M||L||(43!==(M=this.input.charCodeAt(++this.pos))&&45!==M||++this.pos,null===this.readInt(10)&&this.raise(O,"Invalid number")),isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var ae=stringToNumber(this.input.slice(O,this.pos),L);return this.finishToken(types$1.num,ae)},pp.readCodePoint=function(){var g;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var O=++this.pos;g=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,g>1114111&&this.invalidStringToken(O,"Code point out of bounds")}else g=this.readHexChar(4);return g},pp.readString=function(g){for(var O="",L=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var M=this.input.charCodeAt(this.pos);if(M===g)break;92===M?(O+=this.input.slice(L,this.pos),O+=this.readEscapedChar(!1),L=this.pos):8232===M||8233===M?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(isNewLine(M)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return O+=this.input.slice(L,this.pos++),this.finishToken(types$1.string,O)};var INVALID_TEMPLATE_ESCAPE_ERROR={};pp.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(g){if(g!==INVALID_TEMPLATE_ESCAPE_ERROR)throw g;this.readInvalidTemplateToken()}this.inTemplateElement=!1},pp.invalidStringToken=function(g,O){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw INVALID_TEMPLATE_ESCAPE_ERROR;this.raise(g,O)},pp.readTmplToken=function(){for(var g="",O=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var L=this.input.charCodeAt(this.pos);if(96===L||36===L&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==types$1.template&&this.type!==types$1.invalidTemplate?(g+=this.input.slice(O,this.pos),this.finishToken(types$1.template,g)):36===L?(this.pos+=2,this.finishToken(types$1.dollarBraceL)):(++this.pos,this.finishToken(types$1.backQuote));if(92===L)g+=this.input.slice(O,this.pos),g+=this.readEscapedChar(!0),O=this.pos;else if(isNewLine(L)){switch(g+=this.input.slice(O,this.pos),++this.pos,L){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:g+="\n";break;default:g+=String.fromCharCode(L)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),O=this.pos}else++this.pos}},pp.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(types$1.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},pp.readEscapedChar=function(g){var O=this.input.charCodeAt(++this.pos);switch(++this.pos,O){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),g){var L=this.pos-1;this.invalidStringToken(L,"Invalid escape sequence in template string")}default:if(O>=48&&O<=55){var M=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],J=parseInt(M,8);return J>255&&(M=M.slice(0,-1),J=parseInt(M,8)),this.pos+=M.length-1,O=this.input.charCodeAt(this.pos),"0"===M&&56!==O&&57!==O||!this.strict&&!g||this.invalidStringToken(this.pos-1-M.length,g?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(J)}return isNewLine(O)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(O)}},pp.readHexChar=function(g){var O=this.pos,L=this.readInt(16,g);return null===L&&this.invalidStringToken(O,"Bad character escape sequence"),L},pp.readWord1=function(){this.containsEsc=!1;for(var g="",O=!0,L=this.pos,M=this.options.ecmaVersion>=6;this.pos<this.input.length;){var J=this.fullCharCodeAtPos();if(isIdentifierChar(J,M))this.pos+=J<=65535?1:2;else{if(92!==J)break;this.containsEsc=!0,g+=this.input.slice(L,this.pos);var ae=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var ie=this.readCodePoint();(O?isIdentifierStart:isIdentifierChar)(ie,M)||this.invalidStringToken(ae,"Invalid Unicode escape"),g+=codePointToString(ie),L=this.pos}O=!1}return g+this.input.slice(L,this.pos)},pp.readWord=function(){var g=this.readWord1(),O=types$1.name;return this.keywords.test(g)&&(O=keywords[g]),this.finishToken(O,g)};var version="8.12.1";function parse(g,O){return Parser.parse(g,O)}Parser.acorn={Parser:Parser,version:version,defaultOptions:defaultOptions,Position:Position,SourceLocation:SourceLocation,getLineInfo:getLineInfo,Node:Node$1,TokenType:TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext:TokContext,tokContexts:types,isIdentifierChar:isIdentifierChar,isIdentifierStart:isIdentifierStart,Token:Token,isNewLine:isNewLine,lineBreak:lineBreak,lineBreakG:lineBreakG,nonASCIIwhitespace:nonASCIIwhitespace};const nbsp=" ",upArrow="↑",downArrow="↓",U={nbsp:nbsp,upArrow:upArrow,downArrow:downArrow},$=g=>document.querySelector(g),$e=(g,O)=>{const L="string"==typeof g?$(g):g;return L?L.querySelector(O):null},$$e=(g,O)=>{const L="string"==typeof g?$(g):g;return L?[...L.querySelectorAll(O)]:[]},removeChildren=g=>{const O="string"==typeof g?$(g):g;if(!O)throw new Error("Node not found!");for(;O.hasChildNodes();)O.lastChild?.remove()},removeIfExists=g=>{const O="string"==typeof g?$(g):g;O&&O.remove()},filterChildElements=(g,O)=>{const L="string"==typeof g?$(g):g;if(!L)throw new Error("Element not found!");let M=[L];return(O=Array.isArray(O)?O:[O]).forEach((g=>{M=M.reduce(((O,L)=>L?(O.push(...((g,O)=>{const L=[...g.children].filter((g=>g.matches(O)));return L})(L,g)),O):O),[])})),M},initialCaps=g=>g.charAt(0).toUpperCase()+g.slice(1),DOM={removeChildren:removeChildren,removeIfExists:removeIfExists,filterChildElements:filterChildElements,initialCaps:initialCaps},localeStrings={submit:"Submit",cancel:"Cancel",ok:"Ok"},dialogs={localeStrings:{},setLocale(g={}){this.localeStrings={...localeStrings,...g}},makeDialog({atts:g={},children:O=[],close:L,remove:M=!0}={}){L&&(g.$on||(g.$on={}),"close"in g.$on||(g.$on.close=L));const J=jml("dialog",g,O,body);return J.showModal(),M&&J.addEventListener("close",(()=>{J.remove()})),J},makeCancelDialog({cancel:g,cancelClass:O="cancel",submitClass:L="submit",...M}){const J=this.makeDialog(M);return jml("div",{class:L},[["br"],["br"],["button",{class:O,$on:{click(O){O.preventDefault(),g&&!1===g.call(this,{e:O,dialog:J})||J.close()}}},[this.localeStrings.cancel]]],J),J},makeSubmitDialog({submit:g,submitText:O,submitClass:L="submit",...M}){const J=this.makeCancelDialog(M);return $e(J,`button.${M.cancelClass||"cancel"}`)?.before(jml("button",{class:L,$on:{click(O){g.call(this,{e:O,dialog:J})}}},[O??this.localeStrings.submit]),nbsp$1.repeat(2)),J},alert(g){g="string"==typeof g?{message:g}:g;const{submitClass:O="submit"}=g,{message:L}=g;return new Promise((g=>{const M=jml("dialog",[L,["br"],["br"],["div",{class:O},[["button",{$on:{click(){M.close(),g()}}},[this.localeStrings.ok]]]]],body);M.showModal()}))},confirm({atts:g={},message:O,submitClass:L="submit"}){return({message:O}="string"==typeof O?{message:O}:O),new Promise(((M,J)=>{const ae=jml("dialog",g,[O,["br"],["br"],["div",{class:L},[["button",{$on:{click(){ae.close(),M()}}},[this.localeStrings.ok]],nbsp$1.repeat(2),["button",{$on:{click(){ae.close(),J(new Error("cancelled"))}}},[this.localeStrings.cancel]]]]],body);ae.showModal()}))}};dialogs.setLocale();const buildTypeChoices=({autoTrigger:g=!0,format:O,typeNamespace:L,value:M,setValue:J=!1,state:ae,keySelectClass:ie,requireObject:ne,objectHasValue:oe,topRoot:pe,formats:le=new Formats,types:ue=new Types,schema:de,schemaIdx:he,schemaOriginal:ye,schemaContent:me})=>{const fe=ne&&!me?{typeOptions:[ue.getOptionForType("object")],schemaObjects:void 0}:ue.getTypeOptionsForFormatAndState(O,ae,me,ye),{typeOptions:ge}=fe,ve=fe.schemaObjects;let be;const $getValue=(g,M)=>{const J=$e(Se,"div[data-type]");return ue.getValueForRoot(J,{typeNamespace:L,formats:le,format:O,types:ue,...g},M)},xe=jml("select",{hidden:ne||1===ge.length,class:`typeChoices-${L}${ie?" "+ie:""}`,$custom:{$getValue:$getValue,$setType({type:g,baseValue:O,bringIntoFocus:L,avoidReport:M,specificSchema:J}){if(ve&&J){const O=ve.map((g=>JSON.stringify(g))).indexOf(JSON.stringify(J));-1===O?this.value=g:this.selectedIndex=O+1}else this.value=g;this.$setStyles(),this.$addAndValidateEditUI({baseValue:O,bringIntoFocus:L,avoidReport:M})},$setTypeNoEditUI({type:g,specificSchema:O}){if(ve&&O){const g=ve.map((g=>JSON.stringify(g))).indexOf(JSON.stringify(O));this.selectedIndex=g+1}else this.value=g;this.$setStyles()},$setStyles(){const{value:g}=this;this.dataset.type=g;let O=this.parentElement;"fieldset"!==O.nodeName.toLowerCase()&&(O=this.parentElement.parentElement),"fieldset"===O.nodeName.toLowerCase()&&(O.dataset.type=g,DOM.filterChildElements(O,"legend").forEach((O=>{O.dataset.type=g})))},$getTypeRoot(){const g=this.$getContainer();return!!g&&$e(g,"div[data-type]")},$addAndValidateEditUI({baseValue:g,bringIntoFocus:M,schemaObject:J,avoidReport:ae}={}){const{value:ie}=this;if(!ie)return;let ne=this.$getTopRoot();be=ue.getUIForModeAndType({readonly:!1,typeNamespace:L,type:ie,bringIntoFocus:M,hasValue:"arrayNonindexKeys"===ie&&g,value:g,buildTypeChoices:buildTypeChoices,format:O,topRoot:ne,schemaContent:ye??("union"===me?.type&&void 0!==he?me.options[he]:me),specificSchemaObject:J??ve?.[xe.selectedIndex-1]??("union"===me?.type&&void 0!==he?me.options[he]:me),schemaFallingBack:Boolean(!J&&me)}),this.$addEditUI({editUI:be}),this.$validate({avoidReport:ae}),ne=this.$getTopRoot(),ue.validateAllReferences({topRoot:ne})},$addTypeAndEditUI({type:g,editUI:O,specificSchema:L}){this.$setTypeNoEditUI({type:g,specificSchema:L}),this.$addEditUI({editUI:O})},$addEditUI({editUI:g}){const O=this.$getContainer();DOM.removeChildren(O),jml(g,O)},$getContainer(){return this.nextElementSibling},$getTopRoot(){return pe||this.$getTypeRoot()},$validate({avoidReport:g}={}){const{value:O}=this,L=this.$getContainer();if(!L.firstElementChild)return!1;const M=L.firstElementChild;return ue.validate({type:O,root:M,topRoot:this.$getTopRoot(),avoidReport:g})}},$on:{change(g){g?.stopPropagation(),this.$addAndValidateEditUI({schemaObject:ve?ve[Number(g.target.selectedOptions[0].dataset.idx)]:void 0}),this.$setStyles()}}},[["option",{value:""},["(Choose a type)"]],...ge.map((([g,O],L)=>["option",{...O,dataset:ve?{idx:L}:{}},[g]]))]);g&&1===ge.length&&!J?setTimeout((()=>{xe.selectedIndex=1,xe.dispatchEvent(new Event("change"))})):(J||ne&&!oe)&&setTimeout((async()=>{J||(M={});try{const{rootUI:g,specificSchemas:J}=await le.getControlsForFormatAndValue(ue,O,M,{readonly:!1,typeNamespace:L,schema:de,schemaContent:me,formats:le,types:ue}),ae=Types.getTypeForRoot(g);xe.$addTypeAndEditUI({type:ae,editUI:g,specificSchema:J?.[0]})}catch(g){dialogs.alert({message:"The object to be added had types not supported by the current format."}),console.log("err",g)}}));const Se=jml("div",{class:"typeContainer"});return{domArray:[xe,Se],getValue:$getValue,getType(){const g=$e(Se,"div[data-type]");return Types.getTypeForRoot(g)},validValuesSet(){const g=$e(Se,"div[data-type]").closest("form");return Types.validValuesSet({form:g,typeNamespace:L})},async setValue(g,L){const M=(await le.getControlsForFormatAndValue(ue,O,g,L)).rootUI,J=Types.getTypeForRoot(M);xe.$addTypeAndEditUI({type:J,editUI:M})}}},unescapeJSONPointerPart=g=>g.replaceAll(/~([01])/gu,((g,O)=>"0"===O?"~":"/")),getJSONPointerParts=g=>g.split("/").slice(1).map((g=>unescapeJSONPointerPart(g))),reduceJSONPointerParts=(g,O)=>{if(!(O in g))throw new TypeError("Path part not found in object");return g=g[O]},resolveJSONPointer=({path:g,obj:O})=>getJSONPointerParts(g).reduce(((g,O)=>reduceJSONPointerParts(g,O)),O),typesonPathToJSONPointer=g=>g?"/"+g.split(".").map((g=>g.replaceAll("~1",".").replaceAll("/","~1"))).join("/"):g,typesonToJson=new Map([["arrayNonindexKeys","array"]]),json={types:()=>["null","true","false","number","string","array","object"],iterate(g,O){const L=g;return O.format="json",structuredCloning.iterate(L,O)},convertFromTypeson:g=>({type:typesonToJson.get(g)}),testInvalid(g,O){if("array"===g)return Object.keys(O).length!==O.length},getTypesAndSchemasForState(g,O){if(!O||["array","object"].includes(O))return{types:this.types(),schemaObjects:[]}}};G.resurrectable.test=g=>g&&"object"==typeof g&&!Array.isArray(g)&&"Object"!==toStringTag(g);const encapsulateObserver=g=>{const{typeNamespace:O,readonly:L,format:M,schemaContent:J,formats:ae,types:ie}=g,ne=M,oe={},pe={},le=[];return M=>{const{type:ue,cyclic:de,keypath:he,value:ye,replaced:me,cyclicKeypath:fe,endIterateIn:ge,endIterateOwn:ve,endIterateUnsetNumeric:be,clone:xe}=M;if("replaced"in M)return;if("readonly"===de&&!Array.isArray(M.value))return;if("readonly"===de&&("set"===ue||"filelist"===ue))return;if(ge||ve)return;if(be||void 0===xe&&void 0===fe&&Array.isArray(ye))return;if(M.replacing&&"negativeZero"===ue)return;if("sparseUndefined"===ue)return;let Se,Te=ye;const Ie="structuredCloning"===ne?"arrayNonindexKeys":"array",we=he.lastIndexOf("."),_e=unescapeKeyPathComponent(he.slice(we+1)),Ee=-1===we?"":he.slice(0,we);let Ce,ke,Ne;if("string"==typeof fe)Te=typesonPathToJSONPointer(fe),Se="array"===ue?"arrayReference":"objectReference",({newType:Se,schema:Ce,schemaIdx:ke,mustBeOptional:Ne}=canonicalTypeToAvailableTypeAndSchema(ie,ae,ne,Ie,Se,ye,_e,pe[Ee],g));else try{({newType:Se,schema:Ce,schemaIdx:ke,mustBeOptional:Ne}=canonicalTypeToAvailableTypeAndSchema(ie,ae,ne,Ie,ue,ye,_e,pe[Ee],g))}catch(O){return console.log("err",ue,O),void(g.error=O)}const Ae=["array","object","set","map","tuple","record","filelist","arrayNonindexKeys"].includes(Se),Oe="map"===ue&&"[object Map]"===Object.prototype.toString.call(ye);if(Oe&&le.push(he),Ce&&(g.specificSchema=Ce,g.specificSchemas||(g.specificSchemas=[]),g.specificSchemas.push(Ce)),!g.rootUI)return g.rootUI=ie?.getUIForModeAndType({readonly:L,typeNamespace:O,type:Se,bringIntoFocus:!1,buildTypeChoices:buildTypeChoices,format:ne,specificSchemaObject:Ce,schemaContent:J,value:Te,hasValue:!0,replaced:me}),oe[""]=g.rootUI,Ce&&(pe[""]=[Ce,ke]),void(Oe&&[...ye].forEach(((O,L)=>{oe[L]=g.rootUI})));Ce&&(pe[he]=[Ce,ke]),setTimeout((()=>{const O=oe[Ee];if(!O||!("$addAndSetArrayElement"in O))return;if(!Oe&&le.some((g=>{if(g===he||""===g&&/^\d+$/u.test(he))return!0;const O=he.match(/\.\d+$/u);return O&&""!==g&&he.slice(0,-O[0].length)===g})))return;const M=O.$addAndSetArrayElement({mustBeOptional:Ne,propName:_e,type:Se,value:Te,bringIntoFocus:!1,schemaIdx:ke,schemaContent:Ce??J});M&&(L||(ie?.setValue({type:Se,root:M,value:Te}),ie?.validate({type:Se,root:M,topRoot:g.rootUI,avoidReport:!0})),Ae&&(oe[he]=M,Oe&&[...ye].forEach(((g,O)=>{oe[`${he}.${O}`]=M}))))}))}},replaceTypes=(g,O)=>{O.forEach((([O,L])=>{g.splice(g.indexOf(O),1,L)}))},canonicalTypeToAvailableTypeAndSchema=(g,O,L,M,J,ae,ie,ne,oe)=>{const pe=O.getAvailableFormat(L),{getTypesAndSchemasForState:le,convertFromTypeson:ue,testInvalid:de}=pe,he=le.call(pe,g,M,oe.schemaContent)?.types;if(!he)throw new Error("Unexpected undefined type for state");let ye;const isInvalid=g=>{const O=new Error("Invalid");throw O.newValType=g,O};let me;if(ue){let O,L,M;if(({type:O,schema:me,schemaIdx:M,mustBeOptional:L}=ue(J,g,ae,ie,ne,oe)),"string"==typeof O){if(de&&de(O,ae))return isInvalid(O);if(J=O,me)return{newType:J,schema:me,schemaIdx:M,mustBeOptional:L}}}return he.some((O=>{const L=g.getTypeObject(O),{valueMatch:M,superType:ie,childTypes:ne}=L;return!!(ie&&M&&ie===J&&M(ae)||ne&&ne.includes(J))&&(ye=O,!0)})),void 0===ye&&(he.some((g=>g===J&&(ye=g,!0))),void 0===ye)?(console.log("AALLLowableTypes",M,he,"::",J),isInvalid(J)):{newType:ye,schema:me}},structuredCloning={async iterate(records,stateObj){stateObj.format||(stateObj.format="structuredCloning");const structuredCloningFixed=se.filter((g=>!["imagedata","imagebitmap","cryptokey","domquad"].some((O=>Object.hasOwn(g,O)))));structuredCloningFixed.splice(1,0,G);const typeson=new c({encapsulateObserver:encapsulateObserver(stateObj)}).register("arbitraryJS"===stateObj.format||"schema"===stateObj.format?[...structuredCloningFixed,z$1,q,{function:{test:g=>"function"==typeof g,replace:g=>"("+g.toString()+")",revive(o){return eval(o)}}}]:structuredCloningFixed);if(await typeson.encapsulateAsync(records,null,{throwOnBadSyncType:!1}),stateObj.error)throw stateObj.error;return stateObj},getTypesAndSchemasForState(g,O){if(O&&g.getContextInfo("structuredCloning",O)){const L=this.getTypesAndSchemasForState(g)?.types||[];return g.getContextInfo("structuredCloning",O).forEach((({type:g,after:O})=>{const M=L.indexOf(O);L.splice(M+1,0,g)})),{types:L,schemaObjects:[]}}return"errorsArray"===O?{types:["error","errors"],schemaObjects:[]}:"filelistArray"===O?{types:["file"],schemaObjects:[]}:{types:this.types(),schemaObjects:[]}},types(){const g=json.types();return replaceTypes(g,[["array","arrayNonindexKeys"]]),[...g,"undef","bigint","bigintObject","SpecialNumber","date","regexp","BooleanObject","NumberObject","StringObject","error","errors","blob","blobHTML","file","set","map","filelist","domexception","domrect","dompoint","dommatrix","buffersource","resurrectable"]}},indexedDBKey={types:()=>["number","SpecialRealNumber","string","ValidDate","array","buffersource"],testInvalid(g,O){switch(g){case"SpecialRealNumber":return Number.isNaN(O);case"ValidDate":return Number.isNaN(O.getTime());case"array":return Object.keys(O).length!==O.length;default:return!1}},convertFromTypeson:g=>({type:typesonToIndexedDBKey.get(g)}),iterate:(g,O)=>(O.format="indexedDBKey",structuredCloning.iterate(g,O)),getTypesAndSchemasForState(g,O){if(!O||["array"].includes(O))return{types:this.types(),schemaObjects:[]}}},typesonToIndexedDBKey=new Map([["SpecialNumber","SpecialRealNumber"],["date","ValidDate"],["arrayNonindexKeys","array"]]),arbitraryJS={types:()=>[...structuredCloning.types(),"symbol","promise","function"],iterate(g,O){const L=g;return O.format="arbitraryJS",structuredCloning.iterate(L,O)},getTypesAndSchemasForState(g,O){return structuredCloning.getTypesAndSchemasForState.call(this,g,O)}};var util,objectUtil;!function(g){g.assertEqual=g=>g,g.assertIs=function assertIs(g){},g.assertNever=function assertNever(g){throw new Error},g.arrayToEnum=g=>{const O={};for(const L of g)O[L]=L;return O},g.getValidEnumValues=O=>{const L=g.objectKeys(O).filter((g=>"number"!=typeof O[O[g]])),M={};for(const g of L)M[g]=O[g];return g.objectValues(M)},g.objectValues=O=>g.objectKeys(O).map((function(g){return O[g]})),g.objectKeys="function"==typeof Object.keys?g=>Object.keys(g):g=>{const O=[];for(const L in g)Object.prototype.hasOwnProperty.call(g,L)&&O.push(L);return O},g.find=(g,O)=>{for(const L of g)if(O(L))return L},g.isInteger="function"==typeof Number.isInteger?g=>Number.isInteger(g):g=>"number"==typeof g&&isFinite(g)&&Math.floor(g)===g,g.joinValues=function joinValues(g,O=" | "){return g.map((g=>"string"==typeof g?`'${g}'`:g)).join(O)},g.jsonStringifyReplacer=(g,O)=>"bigint"==typeof O?O.toString():O}(util||(util={})),function(g){g.mergeShapes=(g,O)=>({...g,...O})}(objectUtil||(objectUtil={}));const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=g=>{switch(typeof g){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(g)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(g)?ZodParsedType.array:null===g?ZodParsedType.null:g.then&&"function"==typeof g.then&&g.catch&&"function"==typeof g.catch?ZodParsedType.promise:"undefined"!=typeof Map&&g instanceof Map?ZodParsedType.map:"undefined"!=typeof Set&&g instanceof Set?ZodParsedType.set:"undefined"!=typeof Date&&g instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=g=>JSON.stringify(g,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(g){super(),this.issues=[],this.addIssue=g=>{this.issues=[...this.issues,g]},this.addIssues=(g=[])=>{this.issues=[...this.issues,...g]};const O=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,O):this.__proto__=O,this.name="ZodError",this.issues=g}get errors(){return this.issues}format(g){const O=g||function(g){return g.message},L={_errors:[]},processError=g=>{for(const M of g.issues)if("invalid_union"===M.code)M.unionErrors.map(processError);else if("invalid_return_type"===M.code)processError(M.returnTypeError);else if("invalid_arguments"===M.code)processError(M.argumentsError);else if(0===M.path.length)L._errors.push(O(M));else{let g=L,J=0;for(;J<M.path.length;){const L=M.path[J];J===M.path.length-1?(g[L]=g[L]||{_errors:[]},g[L]._errors.push(O(M))):g[L]=g[L]||{_errors:[]},g=g[L],J++}}};return processError(this),L}static assert(g){if(!(g instanceof ZodError))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(g=g=>g.message){const O={},L=[];for(const M of this.issues)M.path.length>0?(O[M.path[0]]=O[M.path[0]]||[],O[M.path[0]].push(g(M))):L.push(g(M));return{formErrors:L,fieldErrors:O}}get formErrors(){return this.flatten()}}ZodError.create=g=>new ZodError(g);const errorMap=(g,O)=>{let L;switch(g.code){case ZodIssueCode.invalid_type:L=g.received===ZodParsedType.undefined?"Required":`Expected ${g.expected}, received ${g.received}`;break;case ZodIssueCode.invalid_literal:L=`Invalid literal value, expected ${JSON.stringify(g.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:L=`Unrecognized key(s) in object: ${util.joinValues(g.keys,", ")}`;break;case ZodIssueCode.invalid_union:L="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:L=`Invalid discriminator value. Expected ${util.joinValues(g.options)}`;break;case ZodIssueCode.invalid_enum_value:L=`Invalid enum value. Expected ${util.joinValues(g.options)}, received '${g.received}'`;break;case ZodIssueCode.invalid_arguments:L="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:L="Invalid function return type";break;case ZodIssueCode.invalid_date:L="Invalid date";break;case ZodIssueCode.invalid_string:"object"==typeof g.validation?"includes"in g.validation?(L=`Invalid input: must include "${g.validation.includes}"`,"number"==typeof g.validation.position&&(L=`${L} at one or more positions greater than or equal to ${g.validation.position}`)):"startsWith"in g.validation?L=`Invalid input: must start with "${g.validation.startsWith}"`:"endsWith"in g.validation?L=`Invalid input: must end with "${g.validation.endsWith}"`:util.assertNever(g.validation):L="regex"!==g.validation?`Invalid ${g.validation}`:"Invalid";break;case ZodIssueCode.too_small:L="array"===g.type?`Array must contain ${g.exact?"exactly":g.inclusive?"at least":"more than"} ${g.minimum} element(s)`:"string"===g.type?`String must contain ${g.exact?"exactly":g.inclusive?"at least":"over"} ${g.minimum} character(s)`:"number"===g.type?`Number must be ${g.exact?"exactly equal to ":g.inclusive?"greater than or equal to ":"greater than "}${g.minimum}`:"date"===g.type?`Date must be ${g.exact?"exactly equal to ":g.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(g.minimum))}`:"Invalid input";break;case ZodIssueCode.too_big:L="array"===g.type?`Array must contain ${g.exact?"exactly":g.inclusive?"at most":"less than"} ${g.maximum} element(s)`:"string"===g.type?`String must contain ${g.exact?"exactly":g.inclusive?"at most":"under"} ${g.maximum} character(s)`:"number"===g.type?`Number must be ${g.exact?"exactly":g.inclusive?"less than or equal to":"less than"} ${g.maximum}`:"bigint"===g.type?`BigInt must be ${g.exact?"exactly":g.inclusive?"less than or equal to":"less than"} ${g.maximum}`:"date"===g.type?`Date must be ${g.exact?"exactly":g.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(g.maximum))}`:"Invalid input";break;case ZodIssueCode.custom:L="Invalid input";break;case ZodIssueCode.invalid_intersection_types:L="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:L=`Number must be a multiple of ${g.multipleOf}`;break;case ZodIssueCode.not_finite:L="Number must be finite";break;default:L=O.defaultError,util.assertNever(g)}return{message:L}};let overrideErrorMap=errorMap;function setErrorMap(g){overrideErrorMap=g}function getErrorMap(){return overrideErrorMap}const makeIssue=g=>{const{data:O,path:L,errorMaps:M,issueData:J}=g,ae=[...L,...J.path||[]],ie={...J,path:ae};if(void 0!==J.message)return{...J,path:ae,message:J.message};let ne="";const oe=M.filter((g=>!!g)).slice().reverse();for(const g of oe)ne=g(ie,{data:O,defaultError:ne}).message;return{...J,path:ae,message:ne}},EMPTY_PATH=[];function addIssueToContext(g,O){const L=getErrorMap(),M=makeIssue({issueData:O,data:g.data,path:g.path,errorMaps:[g.common.contextualErrorMap,g.schemaErrorMap,L,L===errorMap?void 0:errorMap].filter((g=>!!g))});g.common.issues.push(M)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(g,O){const L=[];for(const M of O){if("aborted"===M.status)return INVALID;"dirty"===M.status&&g.dirty(),L.push(M.value)}return{status:g.value,value:L}}static async mergeObjectAsync(g,O){const L=[];for(const g of O){const O=await g.key,M=await g.value;L.push({key:O,value:M})}return ParseStatus.mergeObjectSync(g,L)}static mergeObjectSync(g,O){const L={};for(const M of O){const{key:O,value:J}=M;if("aborted"===O.status)return INVALID;if("aborted"===J.status)return INVALID;"dirty"===O.status&&g.dirty(),"dirty"===J.status&&g.dirty(),"__proto__"===O.value||void 0===J.value&&!M.alwaysSet||(L[O.value]=J.value)}return{status:g.value,value:L}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=g=>({status:"dirty",value:g}),OK=g=>({status:"valid",value:g}),isAborted=g=>"aborted"===g.status,isDirty=g=>"dirty"===g.status,isValid=g=>"valid"===g.status,isAsync=g=>"undefined"!=typeof Promise&&g instanceof Promise;function __classPrivateFieldGet(g,O,L,M){if("function"==typeof O?g!==O||!M:!O.has(g))throw new TypeError("Cannot read private member from an object whose class did not declare it");return O.get(g)}function __classPrivateFieldSet(g,O,L,M,J){if("function"==typeof O?g!==O||!J:!O.has(g))throw new TypeError("Cannot write private member to an object whose class did not declare it");return O.set(g,L),L}var errorUtil,_ZodEnum_cache,_ZodNativeEnum_cache;"function"==typeof SuppressedError&&SuppressedError,function(g){g.errToObj=g=>"string"==typeof g?{message:g}:g||{},g.toString=g=>"string"==typeof g?g:null==g?void 0:g.message}(errorUtil||(errorUtil={}));class ParseInputLazyPath{constructor(g,O,L,M){this._cachedPath=[],this.parent=g,this.data=O,this._path=L,this._key=M}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(g,O)=>{if(isValid(O))return{success:!0,data:O.value};if(!g.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const O=new ZodError(g.common.issues);return this._error=O,this._error}}};function processCreateParams(g){if(!g)return{};const{errorMap:O,invalid_type_error:L,required_error:M,description:J}=g;if(O&&(L||M))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(O)return{errorMap:O,description:J};return{errorMap:(O,J)=>{var ae,ie;const{message:ne}=g;return"invalid_enum_value"===O.code?{message:null!=ne?ne:J.defaultError}:void 0===J.data?{message:null!==(ae=null!=ne?ne:M)&&void 0!==ae?ae:J.defaultError}:"invalid_type"!==O.code?{message:J.defaultError}:{message:null!==(ie=null!=ne?ne:L)&&void 0!==ie?ie:J.defaultError}},description:J}}class ZodType{constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(g){return getParsedType(g.data)}_getOrReturnCtx(g,O){return O||{common:g.parent.common,data:g.data,parsedType:getParsedType(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new ParseStatus,ctx:{common:g.parent.common,data:g.data,parsedType:getParsedType(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const O=this._parse(g);if(isAsync(O))throw new Error("Synchronous parse encountered promise.");return O}_parseAsync(g){const O=this._parse(g);return Promise.resolve(O)}parse(g,O){const L=this.safeParse(g,O);if(L.success)return L.data;throw L.error}safeParse(g,O){var L;const M={common:{issues:[],async:null!==(L=null==O?void 0:O.async)&&void 0!==L&&L,contextualErrorMap:null==O?void 0:O.errorMap},path:(null==O?void 0:O.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:getParsedType(g)},J=this._parseSync({data:g,path:M.path,parent:M});return handleResult(M,J)}async parseAsync(g,O){const L=await this.safeParseAsync(g,O);if(L.success)return L.data;throw L.error}async safeParseAsync(g,O){const L={common:{issues:[],contextualErrorMap:null==O?void 0:O.errorMap,async:!0},path:(null==O?void 0:O.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:getParsedType(g)},M=this._parse({data:g,path:L.path,parent:L}),J=await(isAsync(M)?M:Promise.resolve(M));return handleResult(L,J)}refine(g,O){const getIssueProperties=g=>"string"==typeof O||void 0===O?{message:O}:"function"==typeof O?O(g):O;return this._refinement(((O,L)=>{const M=g(O),setError=()=>L.addIssue({code:ZodIssueCode.custom,...getIssueProperties(O)});return"undefined"!=typeof Promise&&M instanceof Promise?M.then((g=>!!g||(setError(),!1))):!!M||(setError(),!1)}))}refinement(g,O){return this._refinement(((L,M)=>!!g(L)||(M.addIssue("function"==typeof O?O(L,M):O),!1)))}_refinement(g){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(g){return ZodUnion.create([this,g],this._def)}and(g){return ZodIntersection.create(this,g,this._def)}transform(g){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const O="function"==typeof g?g:()=>g;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:O,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(g){const O="function"==typeof g?g:()=>g;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:O,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(g){return new(0,this.constructor)({...this._def,description:g})}pipe(g){return ZodPipeline.create(this,g)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex$1=/^c[^\s-]{8,}$/i,cuid2Regex$1=/^[0-9a-z]+$/,ulidRegex$1=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex$1=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex$1=/^[a-z0-9_-]{21}$/i,durationRegex$1=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex$1;const ipv4Regex$1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex$1=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex$1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource$1(g){let O="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return g.precision?O=`${O}\\.\\d{${g.precision}}`:null==g.precision&&(O=`${O}(\\.\\d+)?`),O}function timeRegex$1(g){return new RegExp(`^${timeRegexSource$1(g)}$`)}function datetimeRegex(g){let O=`${dateRegexSource}T${timeRegexSource$1(g)}`;const L=[];return L.push(g.local?"Z?":"Z"),g.offset&&L.push("([+-]\\d{2}:?\\d{2})"),O=`${O}(${L.join("|")})`,new RegExp(`^${O}$`)}function isValidIP(g,O){return!("v4"!==O&&O||!ipv4Regex$1.test(g))||!("v6"!==O&&O||!ipv6Regex$1.test(g))}class ZodString extends ZodType{_parse(g){this._def.coerce&&(g.data=String(g.data));if(this._getType(g)!==ZodParsedType.string){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:O.parsedType}),INVALID}const O=new ParseStatus;let L;for(const M of this._def.checks)if("min"===M.kind)g.data.length<M.value&&(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.too_small,minimum:M.value,type:"string",inclusive:!0,exact:!1,message:M.message}),O.dirty());else if("max"===M.kind)g.data.length>M.value&&(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.too_big,maximum:M.value,type:"string",inclusive:!0,exact:!1,message:M.message}),O.dirty());else if("length"===M.kind){const J=g.data.length>M.value,ae=g.data.length<M.value;(J||ae)&&(L=this._getOrReturnCtx(g,L),J?addIssueToContext(L,{code:ZodIssueCode.too_big,maximum:M.value,type:"string",inclusive:!0,exact:!0,message:M.message}):ae&&addIssueToContext(L,{code:ZodIssueCode.too_small,minimum:M.value,type:"string",inclusive:!0,exact:!0,message:M.message}),O.dirty())}else if("email"===M.kind)emailRegex.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"email",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("emoji"===M.kind)emojiRegex$1||(emojiRegex$1=new RegExp(_emojiRegex,"u")),emojiRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"emoji",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("uuid"===M.kind)uuidRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"uuid",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("nanoid"===M.kind)nanoidRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("cuid"===M.kind)cuidRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"cuid",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("cuid2"===M.kind)cuid2Regex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("ulid"===M.kind)ulidRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"ulid",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("url"===M.kind)try{new URL(g.data)}catch(J){L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"url",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty()}else if("regex"===M.kind){M.regex.lastIndex=0;M.regex.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"regex",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty())}else if("trim"===M.kind)g.data=g.data.trim();else if("includes"===M.kind)g.data.includes(M.value,M.position)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:{includes:M.value,position:M.position},message:M.message}),O.dirty());else if("toLowerCase"===M.kind)g.data=g.data.toLowerCase();else if("toUpperCase"===M.kind)g.data=g.data.toUpperCase();else if("startsWith"===M.kind)g.data.startsWith(M.value)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:{startsWith:M.value},message:M.message}),O.dirty());else if("endsWith"===M.kind)g.data.endsWith(M.value)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:{endsWith:M.value},message:M.message}),O.dirty());else if("datetime"===M.kind){datetimeRegex(M).test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:"datetime",message:M.message}),O.dirty())}else if("date"===M.kind){dateRegex.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:"date",message:M.message}),O.dirty())}else if("time"===M.kind){timeRegex$1(M).test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:"time",message:M.message}),O.dirty())}else"duration"===M.kind?durationRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"duration",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty()):"ip"===M.kind?isValidIP(g.data,M.version)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"ip",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty()):"base64"===M.kind?base64Regex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"base64",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty()):util.assertNever(M);return{status:O.value,value:g.data}}_regex(g,O,L){return this.refinement((O=>g.test(O)),{validation:O,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(L)})}_addCheck(g){return new ZodString({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...errorUtil.errToObj(g)})}url(g){return this._addCheck({kind:"url",...errorUtil.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...errorUtil.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...errorUtil.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...errorUtil.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...errorUtil.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...errorUtil.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...errorUtil.errToObj(g)})}datetime(g){var O,L;return"string"==typeof g?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:void 0===(null==g?void 0:g.precision)?null:null==g?void 0:g.precision,offset:null!==(O=null==g?void 0:g.offset)&&void 0!==O&&O,local:null!==(L=null==g?void 0:g.local)&&void 0!==L&&L,...errorUtil.errToObj(null==g?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return"string"==typeof g?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:void 0===(null==g?void 0:g.precision)?null:null==g?void 0:g.precision,...errorUtil.errToObj(null==g?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...errorUtil.errToObj(g)})}regex(g,O){return this._addCheck({kind:"regex",regex:g,...errorUtil.errToObj(O)})}includes(g,O){return this._addCheck({kind:"includes",value:g,position:null==O?void 0:O.position,...errorUtil.errToObj(null==O?void 0:O.message)})}startsWith(g,O){return this._addCheck({kind:"startsWith",value:g,...errorUtil.errToObj(O)})}endsWith(g,O){return this._addCheck({kind:"endsWith",value:g,...errorUtil.errToObj(O)})}min(g,O){return this._addCheck({kind:"min",value:g,...errorUtil.errToObj(O)})}max(g,O){return this._addCheck({kind:"max",value:g,...errorUtil.errToObj(O)})}length(g,O){return this._addCheck({kind:"length",value:g,...errorUtil.errToObj(O)})}nonempty(g){return this.min(1,errorUtil.errToObj(g))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((g=>"datetime"===g.kind))}get isDate(){return!!this._def.checks.find((g=>"date"===g.kind))}get isTime(){return!!this._def.checks.find((g=>"time"===g.kind))}get isDuration(){return!!this._def.checks.find((g=>"duration"===g.kind))}get isEmail(){return!!this._def.checks.find((g=>"email"===g.kind))}get isURL(){return!!this._def.checks.find((g=>"url"===g.kind))}get isEmoji(){return!!this._def.checks.find((g=>"emoji"===g.kind))}get isUUID(){return!!this._def.checks.find((g=>"uuid"===g.kind))}get isNANOID(){return!!this._def.checks.find((g=>"nanoid"===g.kind))}get isCUID(){return!!this._def.checks.find((g=>"cuid"===g.kind))}get isCUID2(){return!!this._def.checks.find((g=>"cuid2"===g.kind))}get isULID(){return!!this._def.checks.find((g=>"ulid"===g.kind))}get isIP(){return!!this._def.checks.find((g=>"ip"===g.kind))}get isBase64(){return!!this._def.checks.find((g=>"base64"===g.kind))}get minLength(){let g=null;for(const O of this._def.checks)"min"===O.kind&&(null===g||O.value>g)&&(g=O.value);return g}get maxLength(){let g=null;for(const O of this._def.checks)"max"===O.kind&&(null===g||O.value<g)&&(g=O.value);return g}}function floatSafeRemainder(g,O){const L=(g.toString().split(".")[1]||"").length,M=(O.toString().split(".")[1]||"").length,J=L>M?L:M;return parseInt(g.toFixed(J).replace(".",""))%parseInt(O.toFixed(J).replace(".",""))/Math.pow(10,J)}ZodString.create=g=>{var O;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:null!==(O=null==g?void 0:g.coerce)&&void 0!==O&&O,...processCreateParams(g)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){this._def.coerce&&(g.data=Number(g.data));if(this._getType(g)!==ZodParsedType.number){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:O.parsedType}),INVALID}let O;const L=new ParseStatus;for(const M of this._def.checks)if("int"===M.kind)util.isInteger(g.data)||(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:M.message}),L.dirty());else if("min"===M.kind){(M.inclusive?g.data<M.value:g.data<=M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.too_small,minimum:M.value,type:"number",inclusive:M.inclusive,exact:!1,message:M.message}),L.dirty())}else if("max"===M.kind){(M.inclusive?g.data>M.value:g.data>=M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.too_big,maximum:M.value,type:"number",inclusive:M.inclusive,exact:!1,message:M.message}),L.dirty())}else"multipleOf"===M.kind?0!==floatSafeRemainder(g.data,M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.not_multiple_of,multipleOf:M.value,message:M.message}),L.dirty()):"finite"===M.kind?Number.isFinite(g.data)||(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.not_finite,message:M.message}),L.dirty()):util.assertNever(M);return{status:L.value,value:g.data}}gte(g,O){return this.setLimit("min",g,!0,errorUtil.toString(O))}gt(g,O){return this.setLimit("min",g,!1,errorUtil.toString(O))}lte(g,O){return this.setLimit("max",g,!0,errorUtil.toString(O))}lt(g,O){return this.setLimit("max",g,!1,errorUtil.toString(O))}setLimit(g,O,L,M){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:g,value:O,inclusive:L,message:errorUtil.toString(M)}]})}_addCheck(g){return new ZodNumber({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:errorUtil.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(g)})}multipleOf(g,O){return this._addCheck({kind:"multipleOf",value:g,message:errorUtil.toString(O)})}finite(g){return this._addCheck({kind:"finite",message:errorUtil.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(g)})}get minValue(){let g=null;for(const O of this._def.checks)"min"===O.kind&&(null===g||O.value>g)&&(g=O.value);return g}get maxValue(){let g=null;for(const O of this._def.checks)"max"===O.kind&&(null===g||O.value<g)&&(g=O.value);return g}get isInt(){return!!this._def.checks.find((g=>"int"===g.kind||"multipleOf"===g.kind&&util.isInteger(g.value)))}get isFinite(){let g=null,O=null;for(const L of this._def.checks){if("finite"===L.kind||"int"===L.kind||"multipleOf"===L.kind)return!0;"min"===L.kind?(null===O||L.value>O)&&(O=L.value):"max"===L.kind&&(null===g||L.value<g)&&(g=L.value)}return Number.isFinite(O)&&Number.isFinite(g)}}ZodNumber.create=g=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(null==g?void 0:g.coerce)||!1,...processCreateParams(g)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){this._def.coerce&&(g.data=BigInt(g.data));if(this._getType(g)!==ZodParsedType.bigint){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:O.parsedType}),INVALID}let O;const L=new ParseStatus;for(const M of this._def.checks)if("min"===M.kind){(M.inclusive?g.data<M.value:g.data<=M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.too_small,type:"bigint",minimum:M.value,inclusive:M.inclusive,message:M.message}),L.dirty())}else if("max"===M.kind){(M.inclusive?g.data>M.value:g.data>=M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.too_big,type:"bigint",maximum:M.value,inclusive:M.inclusive,message:M.message}),L.dirty())}else"multipleOf"===M.kind?g.data%M.value!==BigInt(0)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.not_multiple_of,multipleOf:M.value,message:M.message}),L.dirty()):util.assertNever(M);return{status:L.value,value:g.data}}gte(g,O){return this.setLimit("min",g,!0,errorUtil.toString(O))}gt(g,O){return this.setLimit("min",g,!1,errorUtil.toString(O))}lte(g,O){return this.setLimit("max",g,!0,errorUtil.toString(O))}lt(g,O){return this.setLimit("max",g,!1,errorUtil.toString(O))}setLimit(g,O,L,M){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:g,value:O,inclusive:L,message:errorUtil.toString(M)}]})}_addCheck(g){return new ZodBigInt({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(g)})}multipleOf(g,O){return this._addCheck({kind:"multipleOf",value:g,message:errorUtil.toString(O)})}get minValue(){let g=null;for(const O of this._def.checks)"min"===O.kind&&(null===g||O.value>g)&&(g=O.value);return g}get maxValue(){let g=null;for(const O of this._def.checks)"max"===O.kind&&(null===g||O.value<g)&&(g=O.value);return g}}ZodBigInt.create=g=>{var O;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:null!==(O=null==g?void 0:g.coerce)&&void 0!==O&&O,...processCreateParams(g)})};class ZodBoolean extends ZodType{_parse(g){this._def.coerce&&(g.data=Boolean(g.data));if(this._getType(g)!==ZodParsedType.boolean){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:O.parsedType}),INVALID}return OK(g.data)}}ZodBoolean.create=g=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(null==g?void 0:g.coerce)||!1,...processCreateParams(g)});class ZodDate extends ZodType{_parse(g){this._def.coerce&&(g.data=new Date(g.data));if(this._getType(g)!==ZodParsedType.date){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:O.parsedType}),INVALID}if(isNaN(g.data.getTime())){return addIssueToContext(this._getOrReturnCtx(g),{code:ZodIssueCode.invalid_date}),INVALID}const O=new ParseStatus;let L;for(const M of this._def.checks)"min"===M.kind?g.data.getTime()<M.value&&(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.too_small,message:M.message,inclusive:!0,exact:!1,minimum:M.value,type:"date"}),O.dirty()):"max"===M.kind?g.data.getTime()>M.value&&(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.too_big,message:M.message,inclusive:!0,exact:!1,maximum:M.value,type:"date"}),O.dirty()):util.assertNever(M);return{status:O.value,value:new Date(g.data.getTime())}}_addCheck(g){return new ZodDate({...this._def,checks:[...this._def.checks,g]})}min(g,O){return this._addCheck({kind:"min",value:g.getTime(),message:errorUtil.toString(O)})}max(g,O){return this._addCheck({kind:"max",value:g.getTime(),message:errorUtil.toString(O)})}get minDate(){let g=null;for(const O of this._def.checks)"min"===O.kind&&(null===g||O.value>g)&&(g=O.value);return null!=g?new Date(g):null}get maxDate(){let g=null;for(const O of this._def.checks)"max"===O.kind&&(null===g||O.value<g)&&(g=O.value);return null!=g?new Date(g):null}}ZodDate.create=g=>new ZodDate({checks:[],coerce:(null==g?void 0:g.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(g)});class ZodSymbol extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.symbol){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:O.parsedType}),INVALID}return OK(g.data)}}ZodSymbol.create=g=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(g)});class ZodUndefined extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.undefined){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:O.parsedType}),INVALID}return OK(g.data)}}ZodUndefined.create=g=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(g)});class ZodNull extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.null){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:O.parsedType}),INVALID}return OK(g.data)}}ZodNull.create=g=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(g)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(g){return OK(g.data)}}ZodAny.create=g=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(g)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(g){return OK(g.data)}}ZodUnknown.create=g=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(g)});class ZodNever extends ZodType{_parse(g){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:O.parsedType}),INVALID}}ZodNever.create=g=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(g)});class ZodVoid extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.undefined){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:O.parsedType}),INVALID}return OK(g.data)}}ZodVoid.create=g=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(g)});class ZodArray extends ZodType{_parse(g){const{ctx:O,status:L}=this._processInputParams(g),M=this._def;if(O.parsedType!==ZodParsedType.array)return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:O.parsedType}),INVALID;if(null!==M.exactLength){const g=O.data.length>M.exactLength.value,J=O.data.length<M.exactLength.value;(g||J)&&(addIssueToContext(O,{code:g?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:J?M.exactLength.value:void 0,maximum:g?M.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:M.exactLength.message}),L.dirty())}if(null!==M.minLength&&O.data.length<M.minLength.value&&(addIssueToContext(O,{code:ZodIssueCode.too_small,minimum:M.minLength.value,type:"array",inclusive:!0,exact:!1,message:M.minLength.message}),L.dirty()),null!==M.maxLength&&O.data.length>M.maxLength.value&&(addIssueToContext(O,{code:ZodIssueCode.too_big,maximum:M.maxLength.value,type:"array",inclusive:!0,exact:!1,message:M.maxLength.message}),L.dirty()),O.common.async)return Promise.all([...O.data].map(((g,L)=>M.type._parseAsync(new ParseInputLazyPath(O,g,O.path,L))))).then((g=>ParseStatus.mergeArray(L,g)));const J=[...O.data].map(((g,L)=>M.type._parseSync(new ParseInputLazyPath(O,g,O.path,L))));return ParseStatus.mergeArray(L,J)}get element(){return this._def.type}min(g,O){return new ZodArray({...this._def,minLength:{value:g,message:errorUtil.toString(O)}})}max(g,O){return new ZodArray({...this._def,maxLength:{value:g,message:errorUtil.toString(O)}})}length(g,O){return new ZodArray({...this._def,exactLength:{value:g,message:errorUtil.toString(O)}})}nonempty(g){return this.min(1,g)}}function deepPartialify(g){if(g instanceof ZodObject){const O={};for(const L in g.shape){const M=g.shape[L];O[L]=ZodOptional.create(deepPartialify(M))}return new ZodObject({...g._def,shape:()=>O})}return g instanceof ZodArray?new ZodArray({...g._def,type:deepPartialify(g.element)}):g instanceof ZodOptional?ZodOptional.create(deepPartialify(g.unwrap())):g instanceof ZodNullable?ZodNullable.create(deepPartialify(g.unwrap())):g instanceof ZodTuple?ZodTuple.create(g.items.map((g=>deepPartialify(g)))):g}ZodArray.create=(g,O)=>new ZodArray({type:g,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(O)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const g=this._def.shape(),O=util.objectKeys(g);return this._cached={shape:g,keys:O}}_parse(g){if(this._getType(g)!==ZodParsedType.object){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:O.parsedType}),INVALID}const{status:O,ctx:L}=this._processInputParams(g),{shape:M,keys:J}=this._getCached(),ae=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const g in L.data)J.includes(g)||ae.push(g);const ie=[];for(const g of J){const O=M[g],J=L.data[g];ie.push({key:{status:"valid",value:g},value:O._parse(new ParseInputLazyPath(L,J,L.path,g)),alwaysSet:g in L.data})}if(this._def.catchall instanceof ZodNever){const g=this._def.unknownKeys;if("passthrough"===g)for(const g of ae)ie.push({key:{status:"valid",value:g},value:{status:"valid",value:L.data[g]}});else if("strict"===g)ae.length>0&&(addIssueToContext(L,{code:ZodIssueCode.unrecognized_keys,keys:ae}),O.dirty());else if("strip"!==g)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const O of ae){const M=L.data[O];ie.push({key:{status:"valid",value:O},value:g._parse(new ParseInputLazyPath(L,M,L.path,O)),alwaysSet:O in L.data})}}return L.common.async?Promise.resolve().then((async()=>{const g=[];for(const O of ie){const L=await O.key,M=await O.value;g.push({key:L,value:M,alwaysSet:O.alwaysSet})}return g})).then((g=>ParseStatus.mergeObjectSync(O,g))):ParseStatus.mergeObjectSync(O,ie)}get shape(){return this._def.shape()}strict(g){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==g?{errorMap:(O,L)=>{var M,J,ae,ie;const ne=null!==(ae=null===(J=(M=this._def).errorMap)||void 0===J?void 0:J.call(M,O,L).message)&&void 0!==ae?ae:L.defaultError;return"unrecognized_keys"===O.code?{message:null!==(ie=errorUtil.errToObj(g).message)&&void 0!==ie?ie:ne}:{message:ne}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(g){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new ZodObject({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(g,O){return this.augment({[g]:O})}catchall(g){return new ZodObject({...this._def,catchall:g})}pick(g){const O={};return util.objectKeys(g).forEach((L=>{g[L]&&this.shape[L]&&(O[L]=this.shape[L])})),new ZodObject({...this._def,shape:()=>O})}omit(g){const O={};return util.objectKeys(this.shape).forEach((L=>{g[L]||(O[L]=this.shape[L])})),new ZodObject({...this._def,shape:()=>O})}deepPartial(){return deepPartialify(this)}partial(g){const O={};return util.objectKeys(this.shape).forEach((L=>{const M=this.shape[L];g&&!g[L]?O[L]=M:O[L]=M.optional()})),new ZodObject({...this._def,shape:()=>O})}required(g){const O={};return util.objectKeys(this.shape).forEach((L=>{if(g&&!g[L])O[L]=this.shape[L];else{let g=this.shape[L];for(;g instanceof ZodOptional;)g=g._def.innerType;O[L]=g}})),new ZodObject({...this._def,shape:()=>O})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(g,O)=>new ZodObject({shape:()=>g,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(O)}),ZodObject.strictCreate=(g,O)=>new ZodObject({shape:()=>g,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(O)}),ZodObject.lazycreate=(g,O)=>new ZodObject({shape:g,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(O)});class ZodUnion extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g),L=this._def.options;if(O.common.async)return Promise.all(L.map((async g=>{const L={...O,common:{...O.common,issues:[]},parent:null};return{result:await g._parseAsync({data:O.data,path:O.path,parent:L}),ctx:L}}))).then((function handleResults(g){for(const O of g)if("valid"===O.result.status)return O.result;for(const L of g)if("dirty"===L.result.status)return O.common.issues.push(...L.ctx.common.issues),L.result;const L=g.map((g=>new ZodError(g.ctx.common.issues)));return addIssueToContext(O,{code:ZodIssueCode.invalid_union,unionErrors:L}),INVALID}));{let g;const M=[];for(const J of L){const L={...O,common:{...O.common,issues:[]},parent:null},ae=J._parseSync({data:O.data,path:O.path,parent:L});if("valid"===ae.status)return ae;"dirty"!==ae.status||g||(g={result:ae,ctx:L}),L.common.issues.length&&M.push(L.common.issues)}if(g)return O.common.issues.push(...g.ctx.common.issues),g.result;const J=M.map((g=>new ZodError(g)));return addIssueToContext(O,{code:ZodIssueCode.invalid_union,unionErrors:J}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(g,O)=>new ZodUnion({options:g,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(O)});const getDiscriminator=g=>g instanceof ZodLazy?getDiscriminator(g.schema):g instanceof ZodEffects?getDiscriminator(g.innerType()):g instanceof ZodLiteral?[g.value]:g instanceof ZodEnum?g.options:g instanceof ZodNativeEnum?util.objectValues(g.enum):g instanceof ZodDefault?getDiscriminator(g._def.innerType):g instanceof ZodUndefined?[void 0]:g instanceof ZodNull?[null]:g instanceof ZodOptional?[void 0,...getDiscriminator(g.unwrap())]:g instanceof ZodNullable?[null,...getDiscriminator(g.unwrap())]:g instanceof ZodBranded||g instanceof ZodReadonly?getDiscriminator(g.unwrap()):g instanceof ZodCatch?getDiscriminator(g._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g);if(O.parsedType!==ZodParsedType.object)return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:O.parsedType}),INVALID;const L=this.discriminator,M=O.data[L],J=this.optionsMap.get(M);return J?O.common.async?J._parseAsync({data:O.data,path:O.path,parent:O}):J._parseSync({data:O.data,path:O.path,parent:O}):(addIssueToContext(O,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[L]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,O,L){const M=new Map;for(const L of O){const O=getDiscriminator(L.shape[g]);if(!O.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const J of O){if(M.has(J))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(J)}`);M.set(J,L)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:g,options:O,optionsMap:M,...processCreateParams(L)})}}function mergeValues(g,O){const L=getParsedType(g),M=getParsedType(O);if(g===O)return{valid:!0,data:g};if(L===ZodParsedType.object&&M===ZodParsedType.object){const L=util.objectKeys(O),M=util.objectKeys(g).filter((g=>-1!==L.indexOf(g))),J={...g,...O};for(const L of M){const M=mergeValues(g[L],O[L]);if(!M.valid)return{valid:!1};J[L]=M.data}return{valid:!0,data:J}}if(L===ZodParsedType.array&&M===ZodParsedType.array){if(g.length!==O.length)return{valid:!1};const L=[];for(let M=0;M<g.length;M++){const J=mergeValues(g[M],O[M]);if(!J.valid)return{valid:!1};L.push(J.data)}return{valid:!0,data:L}}return L===ZodParsedType.date&&M===ZodParsedType.date&&+g==+O?{valid:!0,data:g}:{valid:!1}}class ZodIntersection extends ZodType{_parse(g){const{status:O,ctx:L}=this._processInputParams(g),handleParsed=(g,M)=>{if(isAborted(g)||isAborted(M))return INVALID;const J=mergeValues(g.value,M.value);return J.valid?((isDirty(g)||isDirty(M))&&O.dirty(),{status:O.value,value:J.data}):(addIssueToContext(L,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return L.common.async?Promise.all([this._def.left._parseAsync({data:L.data,path:L.path,parent:L}),this._def.right._parseAsync({data:L.data,path:L.path,parent:L})]).then((([g,O])=>handleParsed(g,O))):handleParsed(this._def.left._parseSync({data:L.data,path:L.path,parent:L}),this._def.right._parseSync({data:L.data,path:L.path,parent:L}))}}ZodIntersection.create=(g,O,L)=>new ZodIntersection({left:g,right:O,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(L)});class ZodTuple extends ZodType{_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.parsedType!==ZodParsedType.array)return addIssueToContext(L,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:L.parsedType}),INVALID;if(L.data.length<this._def.items.length)return addIssueToContext(L,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&L.data.length>this._def.items.length&&(addIssueToContext(L,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O.dirty());const M=[...L.data].map(((g,O)=>{const M=this._def.items[O]||this._def.rest;return M?M._parse(new ParseInputLazyPath(L,g,L.path,O)):null})).filter((g=>!!g));return L.common.async?Promise.all(M).then((g=>ParseStatus.mergeArray(O,g))):ParseStatus.mergeArray(O,M)}get items(){return this._def.items}rest(g){return new ZodTuple({...this._def,rest:g})}}ZodTuple.create=(g,O)=>{if(!Array.isArray(g))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:g,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(O)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.parsedType!==ZodParsedType.object)return addIssueToContext(L,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:L.parsedType}),INVALID;const M=[],J=this._def.keyType,ae=this._def.valueType;for(const g in L.data)M.push({key:J._parse(new ParseInputLazyPath(L,g,L.path,g)),value:ae._parse(new ParseInputLazyPath(L,L.data[g],L.path,g)),alwaysSet:g in L.data});return L.common.async?ParseStatus.mergeObjectAsync(O,M):ParseStatus.mergeObjectSync(O,M)}get element(){return this._def.valueType}static create(g,O,L){return new ZodRecord(O instanceof ZodType?{keyType:g,valueType:O,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(L)}:{keyType:ZodString.create(),valueType:g,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(O)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.parsedType!==ZodParsedType.map)return addIssueToContext(L,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:L.parsedType}),INVALID;const M=this._def.keyType,J=this._def.valueType,ae=[...L.data.entries()].map((([g,O],ae)=>({key:M._parse(new ParseInputLazyPath(L,g,L.path,[ae,"key"])),value:J._parse(new ParseInputLazyPath(L,O,L.path,[ae,"value"]))})));if(L.common.async){const g=new Map;return Promise.resolve().then((async()=>{for(const L of ae){const M=await L.key,J=await L.value;if("aborted"===M.status||"aborted"===J.status)return INVALID;"dirty"!==M.status&&"dirty"!==J.status||O.dirty(),g.set(M.value,J.value)}return{status:O.value,value:g}}))}{const g=new Map;for(const L of ae){const M=L.key,J=L.value;if("aborted"===M.status||"aborted"===J.status)return INVALID;"dirty"!==M.status&&"dirty"!==J.status||O.dirty(),g.set(M.value,J.value)}return{status:O.value,value:g}}}}ZodMap.create=(g,O,L)=>new ZodMap({valueType:O,keyType:g,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(L)});class ZodSet extends ZodType{_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.parsedType!==ZodParsedType.set)return addIssueToContext(L,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:L.parsedType}),INVALID;const M=this._def;null!==M.minSize&&L.data.size<M.minSize.value&&(addIssueToContext(L,{code:ZodIssueCode.too_small,minimum:M.minSize.value,type:"set",inclusive:!0,exact:!1,message:M.minSize.message}),O.dirty()),null!==M.maxSize&&L.data.size>M.maxSize.value&&(addIssueToContext(L,{code:ZodIssueCode.too_big,maximum:M.maxSize.value,type:"set",inclusive:!0,exact:!1,message:M.maxSize.message}),O.dirty());const J=this._def.valueType;function finalizeSet(g){const L=new Set;for(const M of g){if("aborted"===M.status)return INVALID;"dirty"===M.status&&O.dirty(),L.add(M.value)}return{status:O.value,value:L}}const ae=[...L.data.values()].map(((g,O)=>J._parse(new ParseInputLazyPath(L,g,L.path,O))));return L.common.async?Promise.all(ae).then((g=>finalizeSet(g))):finalizeSet(ae)}min(g,O){return new ZodSet({...this._def,minSize:{value:g,message:errorUtil.toString(O)}})}max(g,O){return new ZodSet({...this._def,maxSize:{value:g,message:errorUtil.toString(O)}})}size(g,O){return this.min(g,O).max(g,O)}nonempty(g){return this.min(1,g)}}ZodSet.create=(g,O)=>new ZodSet({valueType:g,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(O)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:O}=this._processInputParams(g);if(O.parsedType!==ZodParsedType.function)return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:O.parsedType}),INVALID;function makeArgsIssue(g,L){return makeIssue({data:g,path:O.path,errorMaps:[O.common.contextualErrorMap,O.schemaErrorMap,getErrorMap(),errorMap].filter((g=>!!g)),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:L}})}function makeReturnsIssue(g,L){return makeIssue({data:g,path:O.path,errorMaps:[O.common.contextualErrorMap,O.schemaErrorMap,getErrorMap(),errorMap].filter((g=>!!g)),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:L}})}const L={errorMap:O.common.contextualErrorMap},M=O.data;if(this._def.returns instanceof ZodPromise){const g=this;return OK((async function(...O){const J=new ZodError([]),ae=await g._def.args.parseAsync(O,L).catch((g=>{throw J.addIssue(makeArgsIssue(O,g)),J})),ie=await Reflect.apply(M,this,ae),ne=await g._def.returns._def.type.parseAsync(ie,L).catch((g=>{throw J.addIssue(makeReturnsIssue(ie,g)),J}));return ne}))}{const g=this;return OK((function(...O){const J=g._def.args.safeParse(O,L);if(!J.success)throw new ZodError([makeArgsIssue(O,J.error)]);const ae=Reflect.apply(M,this,J.data),ie=g._def.returns.safeParse(ae,L);if(!ie.success)throw new ZodError([makeReturnsIssue(ae,ie.error)]);return ie.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new ZodFunction({...this._def,args:ZodTuple.create(g).rest(ZodUnknown.create())})}returns(g){return new ZodFunction({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,O,L){return new ZodFunction({args:g||ZodTuple.create([]).rest(ZodUnknown.create()),returns:O||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(L)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(g){const{ctx:O}=this._processInputParams(g);return this._def.getter()._parse({data:O.data,path:O.path,parent:O})}}ZodLazy.create=(g,O)=>new ZodLazy({getter:g,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(O)});class ZodLiteral extends ZodType{_parse(g){if(g.data!==this._def.value){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{received:O.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:g.data}}get value(){return this._def.value}}function createZodEnum(g,O){return new ZodEnum({values:g,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(O)})}ZodLiteral.create=(g,O)=>new ZodLiteral({value:g,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(O)});class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(g){if("string"!=typeof g.data){const O=this._getOrReturnCtx(g),L=this._def.values;return addIssueToContext(O,{expected:util.joinValues(L),received:O.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodEnum_cache)||__classPrivateFieldSet(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet(this,_ZodEnum_cache).has(g.data)){const O=this._getOrReturnCtx(g),L=this._def.values;return addIssueToContext(O,{received:O.data,code:ZodIssueCode.invalid_enum_value,options:L}),INVALID}return OK(g.data)}get options(){return this._def.values}get enum(){const g={};for(const O of this._def.values)g[O]=O;return g}get Values(){const g={};for(const O of this._def.values)g[O]=O;return g}get Enum(){const g={};for(const O of this._def.values)g[O]=O;return g}extract(g,O=this._def){return ZodEnum.create(g,{...this._def,...O})}exclude(g,O=this._def){return ZodEnum.create(this.options.filter((O=>!g.includes(O))),{...this._def,...O})}}_ZodEnum_cache=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(g){const O=util.getValidEnumValues(this._def.values),L=this._getOrReturnCtx(g);if(L.parsedType!==ZodParsedType.string&&L.parsedType!==ZodParsedType.number){const g=util.objectValues(O);return addIssueToContext(L,{expected:util.joinValues(g),received:L.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache)||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,_ZodNativeEnum_cache).has(g.data)){const g=util.objectValues(O);return addIssueToContext(L,{received:L.data,code:ZodIssueCode.invalid_enum_value,options:g}),INVALID}return OK(g.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap,ZodNativeEnum.create=(g,O)=>new ZodNativeEnum({values:g,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(O)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(g){const{ctx:O}=this._processInputParams(g);if(O.parsedType!==ZodParsedType.promise&&!1===O.common.async)return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:O.parsedType}),INVALID;const L=O.parsedType===ZodParsedType.promise?O.data:Promise.resolve(O.data);return OK(L.then((g=>this._def.type.parseAsync(g,{path:O.path,errorMap:O.common.contextualErrorMap}))))}}ZodPromise.create=(g,O)=>new ZodPromise({type:g,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(O)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:O,ctx:L}=this._processInputParams(g),M=this._def.effect||null,J={addIssue:g=>{addIssueToContext(L,g),g.fatal?O.abort():O.dirty()},get path(){return L.path}};if(J.addIssue=J.addIssue.bind(J),"preprocess"===M.type){const g=M.transform(L.data,J);if(L.common.async)return Promise.resolve(g).then((async g=>{if("aborted"===O.value)return INVALID;const M=await this._def.schema._parseAsync({data:g,path:L.path,parent:L});return"aborted"===M.status?INVALID:"dirty"===M.status||"dirty"===O.value?DIRTY(M.value):M}));{if("aborted"===O.value)return INVALID;const M=this._def.schema._parseSync({data:g,path:L.path,parent:L});return"aborted"===M.status?INVALID:"dirty"===M.status||"dirty"===O.value?DIRTY(M.value):M}}if("refinement"===M.type){const executeRefinement=g=>{const O=M.refinement(g,J);if(L.common.async)return Promise.resolve(O);if(O instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return g};if(!1===L.common.async){const g=this._def.schema._parseSync({data:L.data,path:L.path,parent:L});return"aborted"===g.status?INVALID:("dirty"===g.status&&O.dirty(),executeRefinement(g.value),{status:O.value,value:g.value})}return this._def.schema._parseAsync({data:L.data,path:L.path,parent:L}).then((g=>"aborted"===g.status?INVALID:("dirty"===g.status&&O.dirty(),executeRefinement(g.value).then((()=>({status:O.value,value:g.value}))))))}if("transform"===M.type){if(!1===L.common.async){const g=this._def.schema._parseSync({data:L.data,path:L.path,parent:L});if(!isValid(g))return g;const ae=M.transform(g.value,J);if(ae instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:O.value,value:ae}}return this._def.schema._parseAsync({data:L.data,path:L.path,parent:L}).then((g=>isValid(g)?Promise.resolve(M.transform(g.value,J)).then((g=>({status:O.value,value:g}))):g))}util.assertNever(M)}}ZodEffects.create=(g,O,L)=>new ZodEffects({schema:g,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:O,...processCreateParams(L)}),ZodEffects.createWithPreprocess=(g,O,L)=>new ZodEffects({schema:O,effect:{type:"preprocess",transform:g},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(L)});class ZodOptional extends ZodType{_parse(g){return this._getType(g)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}ZodOptional.create=(g,O)=>new ZodOptional({innerType:g,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(O)});class ZodNullable extends ZodType{_parse(g){return this._getType(g)===ZodParsedType.null?OK(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}ZodNullable.create=(g,O)=>new ZodNullable({innerType:g,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(O)});class ZodDefault extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g);let L=O.data;return O.parsedType===ZodParsedType.undefined&&(L=this._def.defaultValue()),this._def.innerType._parse({data:L,path:O.path,parent:O})}removeDefault(){return this._def.innerType}}ZodDefault.create=(g,O)=>new ZodDefault({innerType:g,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:"function"==typeof O.default?O.default:()=>O.default,...processCreateParams(O)});class ZodCatch extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g),L={...O,common:{...O.common,issues:[]}},M=this._def.innerType._parse({data:L.data,path:L.path,parent:{...L}});return isAsync(M)?M.then((g=>({status:"valid",value:"valid"===g.status?g.value:this._def.catchValue({get error(){return new ZodError(L.common.issues)},input:L.data})}))):{status:"valid",value:"valid"===M.status?M.value:this._def.catchValue({get error(){return new ZodError(L.common.issues)},input:L.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(g,O)=>new ZodCatch({innerType:g,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:"function"==typeof O.catch?O.catch:()=>O.catch,...processCreateParams(O)});class ZodNaN extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.nan){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:O.parsedType}),INVALID}return{status:"valid",value:g.data}}}ZodNaN.create=g=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(g)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g),L=O.data;return this._def.type._parse({data:L,path:O.path,parent:O})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.common.async){return(async()=>{const g=await this._def.in._parseAsync({data:L.data,path:L.path,parent:L});return"aborted"===g.status?INVALID:"dirty"===g.status?(O.dirty(),DIRTY(g.value)):this._def.out._parseAsync({data:g.value,path:L.path,parent:L})})()}{const g=this._def.in._parseSync({data:L.data,path:L.path,parent:L});return"aborted"===g.status?INVALID:"dirty"===g.status?(O.dirty(),{status:"dirty",value:g.value}):this._def.out._parseSync({data:g.value,path:L.path,parent:L})}}static create(g,O){return new ZodPipeline({in:g,out:O,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(g){const O=this._def.innerType._parse(g),freeze=g=>(isValid(g)&&(g.value=Object.freeze(g.value)),g);return isAsync(O)?O.then((g=>freeze(g))):freeze(O)}unwrap(){return this._def.innerType}}function custom(g,O={},L){return g?ZodAny.create().superRefine(((M,J)=>{var ae,ie;if(!g(M)){const g="function"==typeof O?O(M):"string"==typeof O?{message:O}:O,ne=null===(ie=null!==(ae=g.fatal)&&void 0!==ae?ae:L)||void 0===ie||ie,oe="string"==typeof g?{message:g}:g;J.addIssue({code:"custom",...oe,fatal:ne})}})):ZodAny.create()}ZodReadonly.create=(g,O)=>new ZodReadonly({innerType:g,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(O)});const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;!function(g){g.ZodString="ZodString",g.ZodNumber="ZodNumber",g.ZodNaN="ZodNaN",g.ZodBigInt="ZodBigInt",g.ZodBoolean="ZodBoolean",g.ZodDate="ZodDate",g.ZodSymbol="ZodSymbol",g.ZodUndefined="ZodUndefined",g.ZodNull="ZodNull",g.ZodAny="ZodAny",g.ZodUnknown="ZodUnknown",g.ZodNever="ZodNever",g.ZodVoid="ZodVoid",g.ZodArray="ZodArray",g.ZodObject="ZodObject",g.ZodUnion="ZodUnion",g.ZodDiscriminatedUnion="ZodDiscriminatedUnion",g.ZodIntersection="ZodIntersection",g.ZodTuple="ZodTuple",g.ZodRecord="ZodRecord",g.ZodMap="ZodMap",g.ZodSet="ZodSet",g.ZodFunction="ZodFunction",g.ZodLazy="ZodLazy",g.ZodLiteral="ZodLiteral",g.ZodEnum="ZodEnum",g.ZodEffects="ZodEffects",g.ZodNativeEnum="ZodNativeEnum",g.ZodOptional="ZodOptional",g.ZodNullable="ZodNullable",g.ZodDefault="ZodDefault",g.ZodCatch="ZodCatch",g.ZodPromise="ZodPromise",g.ZodBranded="ZodBranded",g.ZodPipeline="ZodPipeline",g.ZodReadonly="ZodReadonly"}(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(g,O={message:`Input not instance of ${g.name}`})=>custom((O=>O instanceof g),O),stringType$1=ZodString.create,numberType$1=ZodNumber.create,nanType$1=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType$1=ZodBoolean.create,dateType$1=ZodDate.create,symbolType$1=ZodSymbol.create,undefinedType$1=ZodUndefined.create,nullType$1=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType$1=ZodNever.create,voidType$1=ZodVoid.create,arrayType$1=ZodArray.create,objectType$1=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType$1=ZodTuple.create,recordType$1=ZodRecord.create,mapType$1=ZodMap.create,setType$1=ZodSet.create,functionType$1=ZodFunction.create,lazyType=ZodLazy.create,literalType$1=ZodLiteral.create,enumType$1=ZodEnum.create,nativeEnumType$1=ZodNativeEnum.create,promiseType$1=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType$1().optional(),onumber=()=>numberType$1().optional(),oboolean=()=>booleanType$1().optional(),coerce={string:g=>ZodString.create({...g,coerce:!0}),number:g=>ZodNumber.create({...g,coerce:!0}),boolean:g=>ZodBoolean.create({...g,coerce:!0}),bigint:g=>ZodBigInt.create({...g,coerce:!0}),date:g=>ZodDate.create({...g,coerce:!0})},NEVER=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:setErrorMap,getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:EMPTY_PATH,addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:INVALID,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType:ZodParsedType,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:BRAND,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce,any:anyType,array:arrayType$1,bigint:bigIntType,boolean:booleanType$1,date:dateType$1,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType$1,function:functionType$1,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType$1,map:mapType$1,nan:nanType$1,nativeEnum:nativeEnumType$1,never:neverType$1,null:nullType$1,nullable:nullableType,number:numberType$1,object:objectType$1,oboolean:oboolean,onumber:onumber,optional:optionalType,ostring:ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType$1,record:recordType$1,set:setType$1,strictObject:strictObjectType,string:stringType$1,symbol:symbolType$1,transformer:effectsType,tuple:tupleType$1,undefined:undefinedType$1,union:unionType,unknown:unknownType,void:voidType$1,NEVER:NEVER,ZodIssueCode:ZodIssueCode,quotelessJson:quotelessJson,ZodError:ZodError});function checkRef(g,O){if("$ref"in g){const L=z.lazy((()=>z.null()));return O.$refs.push([L,g.$ref]),L}return!1}const d=dezerializeRefs,dezerializers={number:g=>{let O=g.coerce?z.coerce.number():z.number();return void 0!==g.min&&(O=g.minInclusive?O.min(g.min):O.gt(g.min)),void 0!==g.max&&(O=g.maxInclusive?O.max(g.max):O.lt(g.max)),void 0!==g.multipleOf&&(O=O.multipleOf(g.multipleOf)),g.int&&(O=O.int()),g.finite&&(O=O.finite()),O},string:g=>{let O=g.coerce?z.coerce.string():z.string();return void 0!==g.min&&(O=O.min(g.min)),void 0!==g.max&&(O=O.max(g.max)),void 0!==g.length&&(O=O.length(g.length)),void 0!==g.startsWith&&(O=O.startsWith(g.startsWith)),void 0!==g.endsWith&&(O=O.endsWith(g.endsWith)),void 0!==g.toLowerCase&&(O=O.toLowerCase()),void 0!==g.toUpperCase&&(O=O.toUpperCase()),void 0!==g.trim&&(O=O.trim()),"includes"in g&&(O=O.includes(g.includes,{position:g.position})),"regex"in g&&(O=O.regex(new RegExp(g.regex,g.flags))),"kind"in g&&(O="ip"==g.kind?O.ip({version:g.version}):"datetime"==g.kind?O.datetime({offset:g.offset,precision:g.precision,local:g.local}):"time"==g.kind?O.time({precision:g.precision}):O[g.kind]()),O},boolean:g=>g.coerce?z.coerce.boolean():z.boolean(),nan:()=>z.nan(),bigInt:g=>{let O=g.coerce?z.coerce.bigint():z.bigint();if(void 0!==g.min){const L=BigInt(g.min);O=g.minInclusive?O.min(L):O.gt(L)}if(void 0!==g.max){const L=BigInt(g.max);O=g.maxInclusive?O.max(L):O.lt(L)}if(void 0!==g.multipleOf){const L=BigInt(g.multipleOf);O=O.multipleOf(L)}return O},date:g=>{let O=g.coerce?z.coerce.date():z.date();return void 0!==g.min&&(O=O.min(new Date(g.min))),void 0!==g.max&&(O=O.max(new Date(g.max))),O},undefined:()=>z.undefined(),null:()=>z.null(),any:()=>z.any(),unknown:()=>z.unknown(),never:()=>z.never(),void:()=>z.void(),literal:g=>z.literal(g.value),symbol:()=>z.symbol(),tuple:(g,O)=>{let L=z.tuple(g.items.map(((g,L)=>checkRef(g,O)||d(g,{...O,path:O.path+"/items/"+L}))));if(g.rest){const M=checkRef(g.rest,O)||d(g.rest,{...O,path:O.path+"/rest"});L=L.rest(M)}return O.pathToSchema.set(O.path,L),L},set:(g,O)=>{let L=z.set(checkRef(g.value,O)||d(g.value,{...O,path:O.path+"/value"}));return void 0!==g.minSize&&(L=L.min(g.minSize)),void 0!==g.maxSize&&(L=L.max(g.maxSize)),O.pathToSchema.set(O.path,L),L},array:(g,O)=>{let L=z.array(checkRef(g.element,O)||d(g.element,{...O,path:O.path+"/element"}));return void 0!==g.minLength&&(L=L.min(g.minLength)),void 0!==g.maxLength&&(L=L.max(g.maxLength)),O.pathToSchema.set(O.path,L),L},object:(g,O)=>{let L=z.object(Object.fromEntries(Object.entries(g.properties).map((([g,L])=>[g,checkRef(L,O)||d(L,{...O,path:O.path+"/properties/"+g})]))));return g.catchall?L=L.catchall(d(g.catchall,O)):"strict"===g.unknownKeys?L=L.strict():"passthrough"===g.unknownKeys&&(L=L.passthrough()),O.pathToSchema.set(O.path,L),L},record:(g,O)=>{const L=z.record(checkRef(g.key,O)||d(g.key,{...O,path:O.path+"/key"}),checkRef(g.value,O)||d(g.value,{...O,path:O.path+"/value"}));return O.pathToSchema.set(O.path,L),L},map:(g,O)=>{const L=z.map(checkRef(g.key,O)||d(g.key,{...O,path:O.path+"/key"}),checkRef(g.value,O)||d(g.value,{...O,path:O.path+"/value"}));return O.pathToSchema.set(O.path,L),L},nativeEnum:g=>z.nativeEnum(g.values),enum:g=>z.enum(g.values),union:(g,O)=>{const L=z.union(g.options.map(((g,L)=>checkRef(g,O)||d(g,{...O,path:O.path+"/options/"+L}))));return O.pathToSchema.set(O.path,L),L},discriminatedUnion:(g,O)=>{const L=z.discriminatedUnion(g.discriminator,g.options.map(((g,L)=>checkRef(g,O)||d(g,{...O,path:O.path+"/options/"+L}))));return O.pathToSchema.set(O.path,L),L},intersection:(g,O)=>{const L=z.intersection(checkRef(g.left,O)||d(g.left,{...O,path:O.path+"/left"}),checkRef(g.right,O)||d(g.right,{...O,path:O.path+"/right"}));return O.pathToSchema.set(O.path,L),L},function:(g,O)=>{const L=z.function(checkRef(g.args,O)||d(g.args,{...O,path:O.path+"/args"}),checkRef(g.returns,O)||d(g.returns,{...O,path:O.path+"/returns"}));return O.pathToSchema.set(O.path,L),L},promise:(g,O)=>{const L=z.promise(checkRef(g.value,O)||d(g.value,{...O,path:O.path+"/value"}));return O.pathToSchema.set(O.path,L),L},catch:(g,O)=>{let L=checkRef(g.innerType,O)||d(g.innerType,{...O,path:O.path+"/innerType"});return L=L.catch(g.value),O.pathToSchema.set(O.path,L),L},effect:(g,O)=>{let L=checkRef(g.inner,O)||d(g.inner,{...O,path:O.path+"/inner"});if(!("superRefinements"in O||"transforms"in O||"preprocesses"in O))return O.pathToSchema.set(O.path,L),L;for(const{name:M,type:J}of g.effects)"refinement"===J&&O.superRefinements?.[M]?L=L.superRefine(O.superRefinements[M]):"transform"===J&&O.transforms?.[M]?L=L.transform(O.transforms[M]):"preprocess"===J&&O.preprocesses?.[M]&&(L=z.preprocess(O.preprocesses[M],L));return O.pathToSchema.set(O.path,L),L}};function dezerializeRefs(g,O){if("isOptional"in g){const{isOptional:L,...M}=g,J=d(M,O),ae=L?J.optional():J;return O.pathToSchema.set(O.path,ae),ae}if("isNullable"in g){const{isNullable:L,...M}=g,J=d(M,O),ae=L?J.nullable():J;return O.pathToSchema.set(O.path,ae),ae}if("defaultValue"in g){const{defaultValue:L,...M}=g,J=d(M,O).default("bigInt"===g.type?BigInt(L):"date"===g.type?new Date(L):L);return O.pathToSchema.set(O.path,J),J}if("readonly"in g){const{readonly:L,...M}=g,J=d(M,O),ae=L?J.readonly():J;return O.pathToSchema.set(O.path,ae),ae}if("description"in g&&"string"==typeof g.description){const{description:L,...M}=g,J=d(M,O).describe(L);return O.pathToSchema.set(O.path,J),J}return dezerializers[g.type](g,O)}function resolvePointer(g,O){return O.split("/").slice(1).reduce(((g,O)=>void 0===g?g:g[O.replace(/~1/g,"/").replace(/~0/g,"~")]),g)}function dezerialize(g,O={}){"path"in O||(O.path="#"),"pathToSchema"in O||(O.pathToSchema=new Map),"$refs"in O||(O.$refs=[]),"originalShape"in O||(O.originalShape=g);const L=O,M=dezerializeRefs(g,L);for(const[g,O]of L.$refs)g._def.getter=()=>{const g=L.pathToSchema.get(O);if(g)return g;const M=dezerialize(resolvePointer(L.originalShape,O),L);return L.pathToSchema.set(O,M),M};return M}function copyObject(g){const O=Array.isArray(g)?[]:{};for(const[L,M]of Object.entries(g))O[L]=M&&"object"==typeof M?copyObject(M):M;return O}const zodexToStructuredCloningTypeMap=new Map([["boolean","boolean"],["number","number"],["nan","nan"],["bigInt","bigint"],["string","string"],["date","date"],["undefined","undef"],["void","void"],["null","null"],["array","arrayNonindexKeys"],["object","object"],["enum","enum"],["literal","literal"],["tuple","tuple"],["record","record"],["map","map"],["set","set"],["never","never"],["symbol","symbol"],["promise","promise"],["function","function"],["catch","catch"],["nativeEnum","nativeEnum"]]);function mergeSchema(g,O){if("object"!==g.type)throw console.log("leftItem",g),new Error("Unexpected leftItem of type "+g.type);if("object"!==O.type)throw console.log("rightItem",O),new Error("Unexpected rightItem of type "+O.type);const L=copyObject(g);for(const[g,M]of Object.entries(O))if("type"!==g&&"properties"!==g)if("description"===g)"Modifiers"!==M&&(L[g]=L[g]?L[g]+" and "+M:M);else{if(g in L)throw new Error("Duplicate property "+g+" of value "+JSON.stringify(M)+" and "+JSON.stringify(L[g]));L[g]=M&&"object"==typeof M?copyObject(M):M}for(const[g,M]of Object.entries(O.properties)){if("string"!=typeof L.properties&&g in L.properties)throw new Error("Duplicate property "+g+" of value "+JSON.stringify(M)+" and "+JSON.stringify(L.properties[g]));L.properties[g]=M&&"object"==typeof M?copyObject(M):M}return L}function flattenIntersection(g,O){const L=[...g],M=[...O],J=[];for(const g of L)for(const O of M)J.push(mergeSchema(g,O));return J}let unionGroupID=0;function addModifiers(g,O){if("defaultValue"in g){unionGroupID++;for(const L of O)L.$unionGroupID=unionGroupID,L.$defaultValue=g.defaultValue}if(g.isNullable&&O.push({type:"null"}),g.isOptional)for(const L of O)"isOptional"in L||(L.isOptional=g.isOptional);if(g.readonly)for(const L of O)"readonly"in L||(L.$readonlyParent=g.readonly);if(g.description)for(const L of O)L.description=L.description?L.description+" and "+g.description:g.description}function getTypesForSchema(g,O){switch(g.type){case"never":return new Set;case"object":{const O=new Set;return O.add(g),O}case"discriminatedUnion":case"union":{let L=[];for(const M of g.options)L=[...L,...getTypesForSchema(M,O)];if("discriminatedUnion"===g.type)for(const O of L)O.$discriminator=g.discriminator;return addModifiers(g,L),new Set(L)}case"intersection":{const L=flattenIntersection(getTypesForSchema(g.left,O),getTypesForSchema(g.right,O));return addModifiers(g,L),new Set(L)}case"any":case"unknown":return new Set([{type:"boolean"},{type:"number"},{type:"nan"},{type:"bigInt"},{type:"string"},{description:"Email",type:"string",kind:"email"},{description:"URL",type:"string",kind:"url"},{description:"Date",type:"string",kind:"date"},{type:"date"},{type:"undefined"},{type:"null"},{type:"object",properties:{},unknownKeys:"passthrough"},{type:"nativeEnum",values:{type:"union",options:[{description:"Numeric",type:"record",key:{type:"number"},value:{type:"string"}},{description:"String",type:"record",key:{type:"string"},value:{type:"union",options:[{type:"string"},{type:"number"}]}}]}},{type:"array",element:{type:"any"}},{type:"set",value:{type:"any"}},{type:"map",key:{type:"any"},value:{type:"any"}},{type:"never"},{type:"effect",effects:[{name:"regexp",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"blob",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"BooleanObject",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"NumberObject",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"StringObject",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"SpecialRealNumber",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"domexception",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"error",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"filelist",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"file",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"resurrectable",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"blobHTML",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"buffersource",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"dommatrix",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"dompoint",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"domrect",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"errors",type:"refinement"}],inner:{type:"any"}},{description:"JSON Reference",type:"object",properties:{$ref:{type:"string"}}}]);default:if("$ref"in g){return getTypesForSchema(resolveJSONPointer({obj:O,path:g.$ref}),O)}return new Set([g])}}const schema={iterate:(g,O)=>(O.format="schema",structuredCloning.iterate(g,O)),convertFromTypeson(g,O,L,M,J,ae){let[ie,ne]=J??[];if(!ae)throw new Error("State object expected for schema");let oe=ae.schemaContent,pe=!1;switch("number"==typeof ne&&"union"===ie?.type&&(ie=ie.options[ne]),ie?.type){case"object":oe=ie.properties[M],oe||(oe=ie.catchall,pe=!0);break;case"array":oe=ie.element;break;case"set":case"promise":oe=ie.value;break;case"effect":oe=ie.inner;break;case"tuple":oe=ie.items[Number(M)]??ie.rest}if(!oe)return{type:g};const le=[...getTypesForSchema(oe,ae.schemaContent)];for(const[g,M]of le.entries()){let J;"object"===M.type&&(({unknownKeys:J}=M),M.unknownKeys="strict");const ie=dezerialize(M,{originalShape:ae.schemaContent}).safeParse(L);if("object"===M.type&&(M.unknownKeys=J),ie.success){let J=zodexToStructuredCloningTypeMap.get(M.type);J||"effect"!==M.type||(J=M.effects[0].name);const ie=O.getTypeObject(J);if(ie.valueMatch&&ie.valueMatch(L))return{type:J,schemaIdx:g,schema:!ae.rootUI||ae.readonly||1===le.length?M:{type:"union",options:le},mustBeOptional:pe}}}return{type:g}},types:()=>structuredCloning.types(),getTypesAndSchemasForState(g,O,L,M){if(!L)throw new Error("Missing schema object");if("array"===O)return structuredCloning.getTypesAndSchemasForState(g,O,L,M);const J=[...getTypesForSchema(L,M??L)],ae=J.map((({type:g})=>g));return{schemaObjects:J,types:ae.map(((g,O)=>"effect"===g?J[O].effects[0].name:zodexToStructuredCloningTypeMap.get(g)))}}};class Formats{constructor(){this.availableFormats={indexedDBKey:indexedDBKey,json:json,structuredCloning:structuredCloning,arbitraryJS:arbitraryJS,schema:schema}}async getControlsForFormatAndValue(g,O,L,M){return await this.availableFormats[O].iterate(L,{...M,types:g,formats:this,format:O})}getTypesAndSchemasForFormatAndState(g,O,L,M,J){return this.availableFormats[O].getTypesAndSchemasForState(g,L,M,J)}getAvailableFormat(g){return this.availableFormats[g]}}const nullType={option:["Null"],stringRegex:/^null$/u,valueMatch:g=>null===g,toValue:()=>({value:null}),getValue:()=>null,getInput:({root:g})=>$e(g,"input"),viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"null"},title:g?.description??"(a `null`)"},["null"]],editUI:({typeNamespace:g,specificSchemaObject:O})=>["div",{dataset:{type:"null"},title:O?.description??"Null"},[["label",["Null",["input",{type:"checkbox",name:`${g}-null`,checked:!0,disabled:!0}]]]]]},trueType={option:["Boolean (true)",{value:"true"}],stringRegex:/^true$/u,toValue:()=>({value:!0}),valueMatch:g=>!0===g,superType:"boolean",getValue:()=>!0,viewUI:()=>["i",{dataset:{type:"true"}},["true"]],ct:0,getInput:({root:g})=>$e(g,"input"),editUI({typeNamespace:g}){return this.ct++,["div",{dataset:{type:"true"}},[["label",["True",["input",{type:"radio",name:`${g}-true${this.ct}`,value:"true",checked:!0}]]],["label",["False",["input",{type:"radio",name:`${g}-true${this.ct}`,value:"false",disabled:!0}]]]]]}},falseType={option:["Boolean (false)",{value:"false"}],stringRegex:/^false$/u,toValue:()=>({value:!1}),valueMatch:g=>!1===g,superType:"boolean",getValue:()=>!1,viewUI:()=>["i",{dataset:{type:"false"}},["false"]],ct:0,getInput:({root:g})=>$e(g,"input[value=false]"),editUI({typeNamespace:g}){return this.ct++,["div",{dataset:{type:"false"}},[["label",["True",["input",{type:"radio",name:`${g}-false${this.ct}`,value:"true",disabled:!0}]]],["label",["False",["input",{type:"radio",name:`${g}-false${this.ct}`,value:"false",checked:!0}]]]]]}},nanType={option:["NaN"],stringRegex:/^NaN$/u,valueMatch:g=>Number.isNaN(g),toValue:()=>({value:Number.NaN}),getValue:()=>Number.NaN,getInput:({root:g})=>$e(g,"input"),viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"nan"},title:g?.description??"(a `NaN`)"},["NaN"]],editUI:({typeNamespace:g,specificSchemaObject:O})=>["div",{dataset:{type:"nan"},title:O?.description??"NaN"},[["label",["NaN",["input",{type:"checkbox",name:`${g}-nan`,checked:!0}]]]]]},isNullish=g=>null==g,blobHTMLType={option:["Blob (text/html)"],stringRegex:/^data:text\/html(?:;base64)?,.*$/u,valueMatch:g=>g&&"text/html"===g.type,superType:"blob",toValue:g=>({value:function dataURIToBlob(g){const O=g.indexOf(","),L=g.slice(0,O),M=g.slice(O+1),[J,ae]=L.split(":")[1].split(";");let ie;if("base64"===ae){const g=atob(M);ie=new ArrayBuffer(g.length);const O=new Uint8Array(ie);for(let L=0;L<g.length;L++)O[L]=g.charCodeAt(L)}else ie=M;return new Blob([ie],{type:J})}(g)}),getInput:({root:g})=>$e(g,"textarea[name$=-blobHTML]"),getValue({root:g}){return this.toValue("data:text/html,"+this.getInput({root:g}).sceditorInstance.val()).value},loadBlob:async g=>await g.text(),async setValue({root:g,value:O}){const L=await this.loadBlob(O);this.getInput({root:g}).sceditorInstance.val(L)},viewUI({value:g,specificSchemaObject:O}){let L;const M=jml("div",{dataset:{type:"blobHTML"},title:O?.description?"HTML":void 0},[O?.description??"HTML",": ",["button",{$on:{click(){dialogs.alert({message:["div",["Source: ",["textarea",{class:"view-source"},[L]]]]})}}},["View source"]]]);return this.loadBlob(g).then((g=>{L=g,jml("iframe",{sandbox:"",srcdoc:L},M)})).catch((g=>{console.error("Err",g)})),[M]},editUI({typeNamespace:g,specificSchemaObject:O,value:L}){const M=jml("textarea",{name:`${g}-blobHTML`});M.sceditorInstance={val(){throw new Error("Not yet instantiated")}};const J=jml("div",{dataset:{type:"blobHTML"},title:O?.description??"Blob (HTML)"},[M]);return setTimeout((()=>{sceditor.create(M,{width:"1000px",height:"225px",autoUpdate:!0,resizeMaxHeight:-1,resizeMaxWidth:-1,plugins:"xhtml,plaintext,undo",emoticonsRoot:"node_modules/sceditor/",style:"node_modules/sceditor/minified/themes/content/default.min.css"}),M.sceditorInstance=sceditor.instance(M),isNullish(L)||this.setValue({root:J,value:L})})),[J]}},booleanType={option:["Boolean",{value:"boolean"}],stringRegex:/^(?:true|false)$/u,valueMatch:g=>"boolean"==typeof g,toValue:g=>({value:"true"===g}),getValue({root:g}){return this.getInput({root:g}).checked},getInput:({root:g})=>$e(g,"input[value=true]"),setValue({root:g,value:O}){$e(g,O?"input[value=true]":"input[value=false]").checked=!0},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"boolean"},title:O?.description??"(a boolean)"},[g?"true":"false"]],ct:0,editUI({typeNamespace:g,specificSchemaObject:O,value:L}){this.ct++;const M="literal"===O?.type,J=M?O?.value:L??O?.defaultValue;return["div",{dataset:{type:"boolean"},title:O?.description??"Boolean"},[["label",["True",["input",{disabled:M,type:"radio",name:`${g}-boolean${this.ct}`,value:"true",checked:"boolean"!=typeof J||J}]]],["label",["False",["input",{disabled:M,type:"radio",name:`${g}-boolean${this.ct}`,value:"false",checked:"boolean"==typeof J&&!J}]]]]]}},numberType={option:["Number"],stringRegex:new RegExp("^[-+]?"+String.raw`(?:\d{0,30}\.)?`+String.raw`\d{1,30}`+String.raw`(?:[Ee][-+]?[1-2]?\d)?`+"$","u"),valueMatch:g=>"number"==typeof g&&!Number.isNaN(g)&&g!==Number.POSITIVE_INFINITY&&g!==Number.NEGATIVE_INFINITY&&!Object.is(g,-0),toValue:g=>({value:Number(g)}),getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=String(O)},validate({root:g}){const O=this.getInput({root:g}).value;return{message:"Not a valid (finite) number",valid:Boolean(O&&/^-?(\d+|\d*\.\d+)$/u.test(O))}},getValue({root:g}){return Number.parseFloat(this.getInput({root:g}).value)},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"number"},title:O?.description??"(a number)"},[String(g)]],editUI({typeNamespace:g,specificSchemaObject:O,value:L}){const M="literal"===O?.type,J=O,ae=150*Number.EPSILON,ie=300*Number.EPSILON;return["div",{dataset:{type:"number"},title:O?.description??"Number"},[["input",{disabled:M,name:`${g}-number`,type:"number",min:J?.min?J?.minInclusive?J?.min:J?.min+(J?.int?1:ae):void 0,max:J?.max?J?.maxInclusive?J?.max:J?.max-(J?.int?1:ie):void 0,step:J?.multipleOf??(J?.int?"1":"any"),value:M?O?.value:L??O?.defaultValue??""}]]]}},bigintType={option:["BigInt"],stringRegex:new RegExp("^-?"+String.raw`\d+`+"n$","u"),valueMatch:g=>"bigint"==typeof g,toValue:g=>({value:BigInt(g.slice(0,-1))}),getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=String(O)},validate({root:g}){const O=this.getInput({root:g}).value;return{message:"Not a valid BigInt",valid:Boolean(O&&/^-?(\d+)$/u.test(O))}},getValue({root:g}){return BigInt(this.getInput({root:g}).value)},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"bigint"},title:O?.description??"(a BigInt)"},[`${String(g)}n`]],editUI({typeNamespace:g,specificSchemaObject:O,value:L}){const M=O;return["div",{dataset:{type:"bigint"},title:O?.description??"BigInt"},[["input",{name:`${g}-bigint`,type:"number",value:L??O?.defaultValue??"",min:M?.min?M?.minInclusive?M?.min:String(BigInt(M?.min)+1n):void 0,max:M?.max?M?.maxInclusive?M?.max:String(BigInt(M?.max)-1n):void 0,step:M?.multipleOf??"1"}]]]}},bigintObjectType={option:["BigInt Object"],stringRegex:new RegExp("^BigIntObject-?"+String.raw`\d+`+"n$","u"),valueMatch:g=>"object"==typeof g&&hasConstructorOf(g,BigInt),toValue:g=>({value:new Object(BigInt(g.slice(12,-1)))}),getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=String(O)},validate({root:g}){const O=this.getInput({root:g}).value;return{message:"Not a valid BigInt",valid:Boolean(O&&/^-?(\d+)$/u.test(O))}},getValue({root:g}){return new Object(BigInt(this.getInput({root:g}).value))},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"bigintObject"},title:O?.description??"(a BigInt Object)"},[`${String(g)}n`]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L=""})=>["div",{dataset:{type:"bigintObject"},title:O?.description??"BigInt object"},[["input",{name:`${g}-bigintObject`,type:"number",step:"1",value:L}]]]},ipv4Regex=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)$/u,ipv6Regex=/^(([a-f\d]{1,4}:){7}|::([a-f\d]{1,4}:){0,6}|([a-f\d]{1,4}:):([a-f\d]{1,4}:){0,5}|([a-f\d]{1,4}:){2}:([a-f\d]{1,4}:){0,4}|([a-f\d]{1,4}:){3}:([a-f\d]{1,4}:){0,3}|([a-f\d]{1,4}:){4}:([a-f\d]{1,4}:){0,2}|([a-f\d]{1,4}:){5}:([a-f\d]{1,4}:)?)([a-f\d]{1,4}|(((25[0-5])|(2[0-4]\d)|(1\d{2})|(\d{1,2}))\.){3}((25[0-5])|(2[0-4]\d)|(1\d{2})|(\d{1,2})))$/u,base64Regex=/^([\da-zA-Z+/]{4})*(([\da-zA-Z+/]{2}==)|([\da-zA-Z+/]{3}=))?$/u,emojiRegexStr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",emojiRegex=new RegExp(emojiRegexStr,"u"),cuidRegex=/^c[^\s-]{8,}$/iu,cuid2Regex=/^[\da-z]+$/u,ulidRegex=/^[\dA-HJKMNP-TV-Z]{26}$/iu,uuidRegex=/^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu,nanoidRegex=/^[a-z\d_-]{21}$/iu,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/u;function timeRegexSource(g){let O="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return g.precision?O=`${O}\\.\\d{${g.precision}}`:null!==g.precision&&void 0!==g.precision||(O=`${O}(\\.\\d+)?`),O}function timeRegex(g){return new RegExp(`^${timeRegexSource(g)}$`,"u")}const stringType={option:["String"],stringRegex:/^"(?:[^\\"]|\\\\|\\")*"$/u,valueMatch:g=>"string"==typeof g,toValue:g=>({value:g.slice(1,-1)}),getInput:({root:g})=>$e(g,'[data-type="string"] > textarea,input'),setValue({root:g,value:O}){this.getInput({root:g}).value=O},getValue({root:g}){return this.getInput({root:g}).value},viewUI({value:g,specificSchemaObject:O}){const L=O?.kind;return["span",{dataset:{type:"string"},title:O?.description??("email"===L?`(an ${L} string)`:L?`(a ${L} string)`:"(a string)")},[g]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L}){const M=O,J=M?.kind,ae="literal"===O?.type,ie=M?.min??M?.length,ne=M?.max??M?.length,oe=M?.startsWith,pe=M?.endsWith,le=M?.toLowerCase,ue=M?.toUpperCase,de=M?.trim,he=M?.includes,ye=M?.position,me=M?.regex,fe=M?.flags,checkValue=g=>{if(oe&&!g.startsWith(oe))return`Value doesn't start with expected: ${oe}`;if(pe&&!g.endsWith(pe))return`Value doesn't end with expected: ${pe}`;if(he&&!g.includes(he,ye??0))return`Value doesn't include the expected: ${he}${ye?` after position: ${ye}`:""}`;if(me&&!new RegExp(me,fe??"").test(g))return`Value doesn't match regular expression: ${me}${fe?` with flags: ${fe}`:""}`;if(J)switch(J){case"ip":if("v4"===M?.version){if(!ipv4Regex.test(g))return"Value doesn't match IP v4 pattern."}else if(!ipv6Regex.test(g))return"Value doesn't match IP v6 pattern.";break;case"time":if(!timeRegex(M).test(g))return"Value does not match time/precision.";break;case"datetime":if(!datetimeRegex(M).test(g))return"Value does not match datetime/precision/offset/local";break;case"emoji":if(!emojiRegex.test(g))return"Value does not match emoji pattern";break;case"uuid":if(!uuidRegex.test(g))return"Value does not match uuid pattern";break;case"nanoid":if(!nanoidRegex.test(g))return"Value does not match nanoid pattern";break;case"cuid":if(!cuidRegex.test(g))return"Value does not match cuid pattern";break;case"cuid2":if(!cuid2Regex.test(g))return"Value does not match cuid2 pattern";break;case"ulid":if(!ulidRegex.test(g))return"Value does not match ulid pattern";break;case"duration":if(!durationRegex.test(g))return"Value does not match duration pattern";break;case"base64":if(!base64Regex.test(g))return"Value does not match base64 pattern"}return null},transform=g=>(le&&(g=g.toLowerCase()),ue&&(g=g.toUpperCase()),de&&(g=g.trim()),g);return["div",{dataset:{type:"string"},title:O?.description??"String"},[["email","url","date"].includes(J)?["input",{$on:{change(){const g=this;g.value=transform(g.value);const O=checkValue(g.value);g.setCustomValidity(O??""),g.reportValidity()}},name:`${g}-string`,type:J,value:L??O?.defaultValue??"",minlength:"date"===J?void 0:ie,maxlength:"date"===J?void 0:ne}]:["textarea",{$on:{change(){const g=this;g.value=transform(g.value);const O=checkValue(g.value);g.setCustomValidity(O??""),g.reportValidity()}},name:`${g}-string`,disabled:ae,minlength:ie,maxlength:ne},[ae?O?.value:L??O?.defaultValue??""]]]]}},arrayReferenceType={option:["Array reference"],type:"array",stringRegex:/^arrayRef\((?:\/[^)]*|)\)$/u,toValue(g,O){const{rootHolder:L,parent:M,parentPath:J}=O,ae=g.slice(`${this.type}Ref(`.length,-1);return L.push([this.type,M,J,ae]),{assign:!1}},resolveReference(g,O){let L=O;return""!==g&&getJSONPointerParts(g).forEach((g=>{if(L=L[g],!L)throw new Error("Bad path")})),L},stateDependent:{structuredCloning:{after:"arrayNonindexKeys",contexts:["arrayNonindexKeys","object","set"]}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=O},getValue({root:g,stateObj:O,currentPath:L}){const M=this.getInput({root:g}).value;O&&(O.paths||(O.paths={}),O.paths[L]={referentPath:M,expectArrayReferent:"array"===this.type},O.handlingReference=!0),console.log(M)},validate({root:g,topRoot:O}){const{type:L}=this,M=this.getInput({root:g}),J=M.value,invalidMessage=g=>({valid:!1,message:g});if(M.validity.patternMismatch)return invalidMessage('You must use a path beginning with "/" (or the empty string)');if(/~([^01]|$)/u.test(J))return invalidMessage("You must use a valid JSON Pointer (with tildes followed by 0 or 1)");let ae=O||g;let ie;if(""!==J&&getJSONPointerParts(J).some(((O,L)=>{const M=DOM.filterChildElements($e(ae,".arrayItems"),["fieldset","legend"]),J=M.map((g=>getPropertyValueFromLegend(g))).indexOf(O);return-1===J?(ie="Specified path doesn't exist",!0):(ae=$e(M[J].parentElement,"div[data-type]"),ae===g?(ie="Can't reference self",!0):!["array","object","arrayNonindexKeys"].includes(Types.getTypeForRoot(ae))&&(ie=`Referent portion (at segment ${L}) is not an object or array`,!0))})))return invalidMessage(ie);const ne=Types.getTypeForRoot(ae);return(["array","arrayNonindexKeys"].includes(ne)?"array":"object"===ne?"object":null)!==L?invalidMessage("Reference must match expected reference type (array or object)"):{valid:!0}},validateAll({types:g,topRoot:O}){const L=`${this.type}Reference`;$$e(O,`div[data-type="${L}"]`).forEach((M=>{g.validate({type:L,root:M,topRoot:O})}))},viewUI({value:g}){return["i",{dataset:{type:`${this.type}Reference`}},[`${this.type}Ref(${g})`]]},editUI({typeNamespace:g,value:O=""}){const{type:L}=this;return["div",{dataset:{type:`${L}Reference`}},[["label",[`JSON Pointer path to ${L} (leave blank for path to root) `,["input",{name:`${g}-${L}Reference`,type:"text",pattern:"^(|/.*)$",value:O}]]]]]}},objectReferenceType={option:["Object reference"],type:"object",stringRegex:/^objectRef\((?:\/[^)]*|)\)$/u,toValue(...g){return arrayReferenceType.toValue.apply(this,g)},resolveReference(...g){return arrayReferenceType.resolveReference?.apply(this,g)},stateDependent:{structuredCloning:{after:"object",contexts:["arrayNonindexKeys","object","set"]}},getInput(...g){return arrayReferenceType.getInput.apply(this,g)},setValue(...g){return arrayReferenceType.setValue?.apply(this,g)},getValue(...g){return arrayReferenceType.getValue.apply(this,g)},validate(...g){return arrayReferenceType.validate?.apply(this,g)},validateAll(...g){return arrayReferenceType.validateAll?.apply(this,g)},viewUI(...g){return arrayReferenceType.viewUI.apply(this,g)},editUI(...g){return arrayReferenceType.editUI.apply(this,g)}};class FileList{constructor(){this._files=arguments[0],this.length=this._files.length}item(g){return this._files[g]}get[Symbol.toStringTag](){return"FileList"}}let optionalPropertyId=0;function sameValueZero(g,O){return"number"==typeof g&&"number"==typeof O?g===O||g!=g&&O!=O:g===O}const arrayType={option:["Array"],array:!0,regexEndings:[",","]"],stringRegexBegin:/^\[/u,stringRegexEnd:/^\]/u,valueMatch:g=>Array.isArray(g),toValue(g,O){const{endMatchTypeObjs:L=[],remnant:M,rootHolder:J,schemaObject:ae}=O,ie=O.format,ne=O.types,{sparse:oe}=this,pe=oe?"arrayNonindexKeys":this.array&&!this.record?"array":"object",le=this.array&&!this.record?[]:{};let ue=void 0!==M?M:g;const checkEnd=g=>{if(g&&L.length){const g=ue.match(L.at(-1).stringRegexEnd);if(g)return L.pop(),ue=ue.slice(g[0].length),!0}return!1};if(this.array&&!this.record){let g=0;const parse=()=>{if(!ue)return;const O=ue.match(oe?/^[,\s]+/u:/^\s*,?\s*/u);if(O){const L=O[0].match(/\s/gu);if(g+=O[0].length-(L?L.length:0),ue=ue.slice(O[0].length),!ue)return}let M,de,he;try{[M,ue,de,he]=ne.getValueForString(ue,{firstRun:!1,format:ie,state:pe,schemaObject:ae,endMatchTypeObjs:L,rootHolder:J,parent:le,parentPath:g})}catch(g){return void console.log("e",g)}he&&(le[g]=M),checkEnd(de)||parse()};return parse(),oe&&g&&g>le.length-1&&(le.length=g+1),{value:this.set&&Array.isArray(le)?new Set(le):this.map?new Map(le):this.filelist?new FileList(le):le,remnant:ue}}const parse=g=>{if(!ue)return;g&&","===ue[0]&&(ue=ue.slice(1));const O=ue.match(/^\s*(?:([^:"}]+)|"((?:[^\\"]|\\\\|\\")*)")(\s*:\s*)/u);if(!O)return;const[,M,oe]=O,de=void 0!==M?M:oe;let he,ye,me;ue=ue.slice(O[0].length);try{[he,ue,ye,me]=ne.getValueForString(ue,{firstRun:!1,format:ie,state:pe,schemaObject:ae,endMatchTypeObjs:L,rootHolder:J,parent:le,parentPath:de})}catch{return}me&&(le[de]=he),checkEnd(ye)||parse(!0)};return parse(),{value:le,remnant:ue}},getValue({root:g,stateObj:O,currentPath:L=""}){if(!O)throw new Error("TS guard");const M=O.types,J=""===L,ae=$e(g,".arrayItems"),ie=[...ae.children],ne="object"===g.dataset.type?{}:this.sparse?Array.from({length:Number.parseInt(DOM.filterChildElements(g,["div","div","label","input"])[0].value)}):[];return ie.forEach((g=>{const J=g.firstElementChild,ae=getPropertyValueFromLegend(J),ie=DOM.filterChildElements(g,[".typeContainer","div[data-type]"])[0]||DOM.filterChildElements(g,["[class^=optionalProperties-placeholder]",".typeContainer","div[data-type]"])[0];if(!ie)return;const oe=DOM.filterChildElements(J,["input"]),[pe,le]=((g,J)=>{const ae=M.getValueForRoot(g,O,L+"/"+J);return"handlingReference"in O&&O.handlingReference?(O.handlingReference=!1,[!1]):[!0,ae]})(ie,ae);pe&&(oe.length?ne[ae]=le:ne.push(le))})),J&&Object.entries(O.paths||[]).forEach((([g,{referentPath:O}])=>{const L=""===O?ne:resolveJSONPointer({path:O,obj:ne}),M=getJSONPointerParts(g),J=M.pop();M.reduce(((g,O)=>reduceJSONPointerParts(g,O)),ne)[J]=L})),this.filelist?new FileList(ne):this.set&&Array.isArray(ne)?new Set(ne):this.map?new Map(ae.$getMapKeySelects().map(((g,O)=>[g.$getValue(),ne[O]]))):this.record?ae.$getMapKeySelects().reduce(((g,O,L)=>{const M=O.$getValue(),J=ne[L];return g[M]=J,g}),{}):ne},viewUI({typeNamespace:g,type:O,types:L,value:M,topRoot:J,resultType:ae,format:ie,specificSchemaObject:ne}){let oe=-1;const pe=O,buildLegend=({itemIndex:g,typeNamespace:L,propName:M})=>{const J=ne?.items?.[g],ae=ne?.rest;return["legend",[this.array&&"record"!==O?ne?.element?.description??("set"===O&&ne?.value?.description?ne?.value?.description:J?.description??ae?.description)??"Item":ne?"":"Property",ne?"":":",nbsp$1.repeat(2),["span",{class:`propertyName-${L}`,title:"record"===O&&ne?.key?.description?ne?.key?.description:ne?M:void 0},[void 0!==M?ne?.properties?.[M]?.description??M:g]]]]},le=jml("div",{class:"arrayHolder",dataset:{type:O},$custom:{$addAndSetArrayElement({propName:O,type:M,value:oe,bringIntoFocus:le,schemaContent:ue}){if("map"===pe){const pe=L.getUIForModeAndType({resultType:ae,readonly:!0,typeNamespace:g,type:M,topRoot:J,bringIntoFocus:le,format:ie,schemaContent:ue,value:oe,hasValue:!0});if("0"===O){const g=this.$addMapElement();this._lastFieldset=g;const O=jml("fieldset",[["legend",{title:ne?.key?.description?"(map key)":void 0},[ne?.key?.description??"Key"]]],g);jml(pe,O)}else{const g=jml("fieldset",[["legend",{title:ne?.value?.description?"(map value)":void 0},[ne?.value?.description??"Value"]]],this._lastFieldset);this._lastFieldset=null,jml(pe,g)}return pe}const de=this.$addArrayElement({propName:O}),he=L.getUIForModeAndType({resultType:ae,readonly:!0,typeNamespace:g,type:M,topRoot:J,bringIntoFocus:le,format:ie,schemaContent:ue,specificSchemaObject:ue,value:oe,hasValue:!0});return jml(he,de),he},$addMapElement(){oe++;const O=this.$getArrayItems();return jml("fieldset",[buildLegend({itemIndex:oe,typeNamespace:g,propName:void 0})],O)},$addArrayElement({propName:O}){oe++;const L=this.$getArrayItems();return jml("fieldset",[buildLegend({itemIndex:oe,typeNamespace:g,propName:O})],L)},$getArrayItems(){return this.lastElementChild.lastElementChild}}},[["span",{title:ne?.description},[ne?"—":DOM.initialCaps(O).replace(/s$/u,"")]],nbsp$1.repeat(2),["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(O.closest(".arrayHolder"),".arrayContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"arrayContents"},[this.array&&"record"!==O?["div",{title:ne?"filelist"===O?"(a FileList)":"set"===O?"(a Set)":"map"===O?"(a Map)":"tuple"===O?"(a tuple)":"(an Array)":void 0},["filelist"===O?(ne?.description??"FileList")+" length: ":"set"===O?(ne?.description??"Set")+" size: ":"map"===O?(ne?.description??"Map")+" size: ":(ne?.description??"Array")+" length: ",["span",[(!M||"set"!==O&&"map"!==O?M.length:M.size)||0]]]]:"record"===O?ne?.description??"Record":"",["div",{class:"arrayItems"}]]]]);return[le]},getInput:({root:g})=>$e(g,"button"),editUI({typeNamespace:g,buildTypeChoices:O,format:L,formats:M,types:J,specificSchemaObject:ae,schemaFallingBack:ie,schemaContent:ne,type:oe,forcedState:pe,topRoot:le,value:ue,bringIntoFocus:de=!0}){const{sparse:he}=this,ye=this,me="object"===oe?1:0;let fe=me-1;const ge="array"!==oe&&"set"!==oe&&"map"!==oe&&"filelist"!==oe&&"tuple"!==oe&&"record"!==oe,ve="map"===oe||"record"===oe,be=ae?.element?.description??("set"===oe?ae?.value?.description:void 0),bringFocus=(g,O)=>{(de||O)&&(g.scrollIntoView(),g.focus())},$validateLegend=function(){const g=this.$arrayItems.$getPropertyInputs(),O=g.some((g=>this!==g&&g.value===this.value))?"Duplicate property name":"";O&&(this.setCustomValidity(O),this.reportValidity()),g.some(((g,O,L)=>{const M=L.some((O=>g!==O&&g.value===O.value))?"Duplicate property name":"";return(g.validity.valid||"Invalid length"!==g.validationMessage)&&(g.setCustomValidity(M),M&&g.reportValidity()),M}))},buildLegend=({className:g,splice:M,itemIndex:ie,typeNamespace:pe,arrayItems:ue,propName:de,required:me,schema:fe})=>{const $validateLength=async function(g){if(!he)return;const O=ue.$inputsExceedingLength(),L=O.length;if(g||!L||!/^\d+$/u.test(this.value))return;await dialogs.confirm({message:'You are attempting to add an (integer-based) array item beyond the length. Click "Ok" to allow to permit and extend the array length or "Cancel" otherwise.'});const M=$e(ue.previousElementSibling,"input"),J=O.map((g=>Number.parseInt(g.value))).sort().at(-1);M.value=String(J+1),M.$oldvalue=String(J+1),this.$validateLength(!0)};if(ve){const M=O({value:void 0!==de&&"record"===oe?de:void 0,setValue:void 0!==de&&"record"===oe,autoTrigger:void 0===de||"record"===oe,format:L,schemaOriginal:ne,schemaContent:ae?.key,typeNamespace:"key-type-choices-only"});return["legend",[["span",{class:"mapKey",title:"map"===oe&&ae?.key?.description?"(map key)":"record"===oe&&ae?.key?.description?"(record key)":void 0},["map"===oe?ae?.key?.description??"Map key":ae?.key?.description??"Record key"," "]],["span",{dataset:{prop:"true"},className:g},[String(ie)]],":",nbsp$1.repeat(2),["span",{class:"mapKeyHolder",$on:{change:[function(){this.$validateMapKey(),J.validateAllReferences({topRoot:le})},!0]},$custom:{$validateMapKey(){const g=ue.$getMapKeySelects();setTimeout((()=>{const O=g.map((g=>g.$getValue())),L=O.findLastIndex(((g,L)=>O.some(((O,M)=>L!==M&&sameValueZero(g,O)))));if(-1===L)return;const M=g[L];if(!M)return;const J=M.hidden?$e(M.nextElementSibling,"input,textarea"):M;J.setCustomValidity(`Duplicate ${"map"===oe?"Map":"Record"} key value`),J.reportValidity()}))}}},M.domArray]]]}if(ge){const O=ae?.properties?.[de]?.description,L=Object.entries(ae?.properties??{}).map((([g,O])=>O.isOptional?g:null)).filter(Boolean);optionalPropertyId++;const ne=he?"append"===M?"":void 0!==de?de:ie:de||"";return["legend",[he?be??"Item":{"#":me?[["b",{className:g,title:be??O?de:void 0},[be??O??de]]]:[["span",{className:`${g}_propertyHolder${optionalPropertyId}`},[...ae&&de?[["b",[ae?.properties?.[de]?ae?.properties?.[de]?.description??de:ae?.catchall?.description??de]]]:["Property ",["span",{className:g},[String(ie)]],":"]]]]},nbsp$1.repeat(2),ae&&!me?["datalist",{id:`optionalProperties_${optionalPropertyId}`},L.map((g=>["option",{value:g}]))]:"",["input",{list:ae&&!me?`optionalProperties_${optionalPropertyId}`:void 0,style:{display:me&&"arrayNonindexKeys"!==oe?"none":"block"},disabled:me&&"arrayNonindexKeys"===oe,value:ne,dataset:{prop:!0,object:!0,optionalPropertyId:optionalPropertyId},$custom:{async $validate(){try{try{await this.$validateLength()}catch{}this.$validateLegend(),J.validateAllReferences({topRoot:le})}catch{}},$parseInt(){return!!/^\d+$/u.test(this.value)&&Number.parseInt(this.value)},$validateLegend:$validateLegend,$arrayItems:ue,$validateLength:$validateLength,$resort({alwaysFocus:g}){const O=this.$arrayItems.$getPropertyInputs();if(1===O.length)return;const getFieldset=g=>g.closest("fieldset"),L=getFieldset(this),M=this.$parseInt();if(!1===M)return void O.reverse().some((O=>{if(O===this)return!0;return"number"==typeof O.$parseInt()&&(getFieldset(O).after(L),bringFocus(this,g),ue.$redrawMoveArrows(),!0)}));const getNearest=J=>{let ae;if(O.some((g=>{if(g===this)return!1;const O=g.$parseInt();if("number"!=typeof O)return ae||(ae=g),!1;const cmp=(g,O)=>J?g>O:g<O;return!(!cmp(M,O)||ae&&!cmp(O,Number.parseInt(ae.value)))&&(ae=g,M+(J?-1:1)===O)})),!ae)return!1;const ie=J?"after":"before";return setTimeout((()=>{ae&&(getFieldset(ae)[ie](L),bringFocus(this,g),ue.$redrawMoveArrows())})),!0};getNearest()||getNearest(!0)}},$on:{input(){if(!ae&&!fe)return;const O=$e(ue,`.${g}_propertyHolder${this.dataset.optionalPropertyId}`);DOM.removeChildren(O),jml("b",[ae?.properties?.[this.value]?ae?.properties?.[this.value]?.description??this.value:ae?.catchall?.description??this.value],O)},change(g){let O=!1;if("never"===ae?.properties?.[this.value]?.type)this.setCustomValidity("Never value"),this.reportValidity(),this.style.backgroundColor="pink",O=!0;else if(this.list&&!ye.array){if([...this.list.options].map((({value:g})=>g)).includes(this.value)||"strict"!==ae.unknownKeys){this.style.backgroundColor="revert-layer",this.setCustomValidity(""),this.reportValidity();const{optionalPropertyId:g}=this.dataset;let O=$e(ue,`.optionalProperties-placeholder${g}`);O||(O=$e(this.parentElement?.parentElement,".property-placeholder")?.previousElementSibling,O.previousElementSibling?.remove()),O.replaceWith(jml("div",{className:`optionalProperties-placeholder${g}`},[...buildTypeChoicesForProperty({propName:this.value,schema:ae?.properties?.[this.value]??ae?.catchall??{type:"any"}})]))}else this.setCustomValidity("Bad value"),this.reportValidity(),this.style.backgroundColor="pink",O=!0}if(O){const g=$e(ue,`.optionalProperties-placeholder${optionalPropertyId}`);DOM.removeChildren(g)}else this.$validate();g.stopPropagation(),this.$resort({alwaysFocus:!0})}},class:`propertyName-${pe}`}]]]}const xe=ae?.inner?.description;return["legend",[be?"":xe?`${xe} `:fe?.description?`${fe?.description} `:"tuple"===oe&&ae?.rest?.description?`${ae?.rest?.description} `:"Item ",["span",{dataset:{prop:!0,array:!0},className:g},[be?`${be} ${ie+1}`:void 0!==de?de:String(ie)]]]]},decrementItemIndex=g=>{he?fe=g.$getPropertyInputs().reduce(((g,O)=>{const L=O.$parseInt();return!1!==L&&L>g?L:g}),-1):fe--},buildTypeChoicesForProperty=({propName:M,schema:J,schemaIdx:ie,autoTrigger:ue})=>O({autoTrigger:ue,topRoot:le,format:L,schemaOriginal:ne,schemaIdx:ie,schemaContent:J||"tuple"===oe?J??ae.rest:ve||"set"===oe?ae?.value:"filelist"===oe?ae?.inner:"array"===oe||"arrayNonindexKeys"===oe?ae?.element:ae?.properties?.[M],state:ye.filelist?"filelistArray":pe??oe,typeNamespace:g}).domArray;function preventAdding(g=0){switch(oe){case"tuple":if("never"===ae?.rest?.type)return dialogs.alert('Tuple has rest type "never", so one cannot add to it.'),!0;if("never"===ae?.items?.[0]?.type)return dialogs.alert('Tuple has items type "never", so one cannot add to it.'),!0;break;case"set":{if("never"===ae?.value?.type)return dialogs.alert('Set has type "never", so one cannot add to it.'),!0;const{maxSize:O}=ae??{};if(void 0!==O&&[...Te.children].length+g>O)return dialogs.alert("You cannot add beyond the `maxSize` of the Set"),!0;break}case"array":case"arrayNonindexKeys":{if("never"===ae?.element?.type)return dialogs.alert('Array has type "never", so one cannot add to it.'),!0;const{maxLength:O}=ae??{};if(void 0!==O&&Te.$getArrayLength()+g>O)return dialogs.alert("You cannot add beyond the `maxLength` of the array"),!0;break}}return!1}const xe=["button",{class:"addArrayElement",$custom:{$addArrayElement:function({propName:O,splice:L,alwaysFocus:ie,required:ne,schema:pe,schemaIdx:ue,autoTrigger:de}){const ve=this.$getArrayItems();if(he)if(O){const g=O.match(/^\d+$/u)&&Number.parseInt(O);"number"==typeof g&&(fe=g)}else"number"==typeof L?fe=L+1:"string"!=typeof L&&(fe=ve.$getPropertyInputs().reduce(((g,O)=>{const L=O.$parseInt();return!1!==L&&L>g?L:g}),-1)+1);else fe++;const xe=this,Se=`${oe}Item`,Te=jml("fieldset",{dataset:ne?{required:"required"}:{},$on:{change:[()=>{"set"===oe&&setTimeout((()=>{const g=Ee,O=ye.getValue.call({...ye,set:!1},{root:g,stateObj:{types:J,formats:M}}),L=O.findLastIndex(((g,L)=>O.some(((O,M)=>L!==M&&g===O))));if(-1===L)return;const ae=[...ve.children].map((g=>{const O=$e(g,"div[data-type]");return O?J.getFormControlForRoot(O):null})),ie=ae[L];ie&&(ie.setCustomValidity("Duplicate Set value"),ie.reportValidity())}))},!0]},$custom:{$getPropertyInput(){return DOM.filterChildElements(this,["legend",`input.propertyName-${g}`]).pop()}}},[buildLegend({className:Se,splice:L,itemIndex:fe,typeNamespace:g,arrayItems:ve,propName:O,required:ne,schema:pe})],ve);if(jml({"#":[["span",{class:"mapValue",title:"map"===oe&&ae?.value?.description?"(map value)":"record"===oe&&ae?.value?.description?"(record value)":void 0},["map"===oe?ae?.value?.description??"Map value":"record"===oe?ae?.value?.description??"Record value":""," "]],...!ae||O||ye.array?buildTypeChoicesForProperty({propName:O,schema:pe,schemaIdx:ue,autoTrigger:de}):[jml("span",{className:`optionalProperties-placeholder${optionalPropertyId}`})],["span",{className:"property-placeholder"}],nbsp$1.repeat(2),["button",{disabled:"tuple"===oe&&ne&&ae?.items?.length-1>fe,$on:{click(g){if(g.preventDefault(),preventAdding(1))return;let O;if(he){const g=Te.$getPropertyInput().$parseInt();O=!1===g?"append":g}xe.$addArrayElement({splice:O,alwaysFocus:!0,schema:pe});const L=ve.lastElementChild;if(Te.after(L),he||(ae||pe)&&!ye.array){const g=L.$getPropertyInput();bringFocus(g,!0)}else DOM.filterChildElements(ve,["fieldset","legend","."+Se]).forEach(((g,O)=>{g.textContent=be?`${be} ${O+me+1}`:String(O+me)}));J.validateAllReferences({topRoot:le}),ve.$redrawMoveArrows()}}},["+"]],["button",{disabled:ne,$on:{click(g){g.preventDefault(),Te.remove(),decrementItemIndex(ve),he||ae&&!ye.array||DOM.filterChildElements(ve,["fieldset","legend","."+Se]).forEach(((g,O)=>{g.textContent=be?`${be} ${O+me+1}`:String(O+me)})),J.validateAllReferences({topRoot:le}),ve.$redrawMoveArrows()}}},["x"]],["span",{class:`${oe}Item-arrowHolder-${g}`},[]]]},Te),ge){const g=ve.$getPropertyInputs();if(g.length){const O=g.pop();O.$validate(),O.$resort({alwaysFocus:ie}),bringFocus(O,ie)}}ve.$redrawMoveArrows()},$getArrayItems(){return this.previousElementSibling}},$on:{click(){preventAdding(1)||(this.$addArrayElement({alwaysFocus:!0}),J.validateAllReferences({topRoot:le}))}}},["+ Item"]],Se=he?["div",[["label",["Array length: ",["input",{type:"number",value:ue&&ue.length||0,step:1,size:4,class:"arrayLength",pattern:String.raw`\d`,$on:{async change(){if(preventAdding())return void(this.value=this.$oldvalue??this.defaultValue);const g=$e(this.closest(".arrayContents"),".arrayItems").$inputsExceedingLength();try{if(g.length)await dialogs.confirm({message:"Your new length will truncate the array causing items to be removed. Continue?"}),g.forEach((g=>{const O=g.closest("fieldset");if(O.matches("[data-required]")){const g=$e(Ee,".arrayLength");g.value=String(Number.parseInt(g.value)+1)}else O.remove()})),J.validateAllReferences({topRoot:le});else{const g=ae?.element;if(!["void","undefined"].includes(g?.type)&&("union"!==g?.type||g?.options?.every((g=>!["void","undefined"].includes(g.type))))){const g=Number.parseInt(this.value)-Number.parseInt(this.$oldvalue??this.defaultValue);for(let O=0;O<g;O++)setTimeout((()=>{Ee.$addArrayElement({})}))}}this.$oldvalue=this.value}catch{this.value=this.$oldvalue}}}}]]]]]:"",Te=jml("div",{class:"arrayItems",$custom:{$swapGroup:function(g,O){const L=g.parentElement,M=L["up"===O?"previousElementSibling":"nextElementSibling"];if(M&&"fieldset"===M.nodeName.toLowerCase()){if(he||ae&&!ye.array){const g=L.$getPropertyInput(),O=M.$getPropertyInput();if("number"==typeof g.$parseInt()||"number"==typeof O.$parseInt()){const L=g.value,M=O.value;g.value=M,O.value=L}}else{const g=DOM.filterChildElements(M,["legend",`.${oe}Item`])[0],O=DOM.filterChildElements(L,["legend",`.${oe}Item`])[0],J=g.textContent,ae=O.textContent;g.textContent=ae,O.textContent=J}"up"===O?M.before(L):L.before(M),J.validateAllReferences({topRoot:le}),this.$redrawMoveArrows()}},$redrawMoveArrows:function(){"tuple"!==oe&&DOM.filterChildElements(this,["fieldset",`.${oe}Item-arrowHolder-${g}`]).forEach(((g,O,L)=>{DOM.removeChildren(g);let M=!0,J=!0;1!==L.length&&(0===O?M=!1:O===L.length-1&&(J=!1),M&&jml("button",{$on:{click:()=>{this.$swapGroup(g,"up")}}},[U.upArrow],g),J&&jml("button",{$on:{click:()=>{this.$swapGroup(g,"down")}}},[U.downArrow],g))}))},$getArrayLength:function(){return Number($e(this.previousElementSibling,"input").value)},$inputsExceedingLength:function(){const g=this.$getArrayLength()-1;return this.$getPropertyInputs().filter((g=>g.value.match(/^\d+$/u))).filter((O=>{const L=Number.parseInt(O.value)>g;return O.setCustomValidity(L?"Invalid length":""),O.reportValidity(),L}))},$getMapKeySelects(){return DOM.filterChildElements(this,["fieldset","legend:first-child","span.mapKeyHolder","select.typeChoices-key-type-choices-only"])},$getPropertyInputs(){return DOM.filterChildElements(this,["fieldset","legend",`input.propertyName-${g}`])}}}),Ie=["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(Ee,".arrayContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],we=["div",{class:"arrayContents"},[Se,Te,xe,["button",{$on:{click(){const g=this.closest(".arrayContents"),O=$e(g,".arrayItems"),L=O.lastElementChild;L&&!L.matches("[data-required]")&&(L.remove(),decrementItemIndex(O),$e(g,".arrayItems").$redrawMoveArrows()),J.validateAllReferences({topRoot:le})}}},["- Last item"]],["button",{$on:{click(){const g=this.closest(".arrayContents"),O=$e(g,".arrayItems"),L=$$e(g,".arrayItems > fieldset:not([data-required])");for(const g of L)g.remove();he?decrementItemIndex(O):fe=-1,J.validateAllReferences({topRoot:le})}}},["x All"]]]],_e=oe,Ee=jml("div",{dataset:{type:oe},$custom:{$addAndSetArrayElement({propName:g,type:O,value:L,bringIntoFocus:M,setAValue:ae,schemaContent:ie,schemaIdx:ne,mustBeOptional:oe}){if("map"===_e){if("0"===g){this.$addArrayElement({propName:g,autoTrigger:!1});const J=this.$getArrayItems(),ae=DOM.filterChildElements(J,["fieldset:last-of-type","legend",".mapKeyHolder","select"])[0];return ae.$setType({type:O,baseValue:L,bringIntoFocus:M,avoidReport:!0}),ae.$getTypeRoot()}}else"record"===_e?this.$addArrayElement({propName:g,autoTrigger:!1,required:!1}):this.$addArrayElement({propName:g,schema:ie,autoTrigger:!1,schemaIdx:ne,required:!oe&&ie&&!ie.isOptional&&"never"!==ie.type});const pe=this.$getTypeChoices();pe.$setType({type:O,baseValue:L,bringIntoFocus:M,specificSchema:"union"===ie?.type&&void 0!==ne?ie.options[ne]:ie,avoidReport:!0});const ue=pe.$getTypeRoot();if(ae){const g=J.getTypeObject(O);g.setValue&&g.setValue({root:ue,value:L})}return J.validate({type:O,root:ue,topRoot:le,avoidReport:!0}),ue},$getAddArrayElement(){const g=this.lastElementChild.firstElementChild.nextElementSibling;return he?g.nextElementSibling:g},$addArrayElement({propName:g,splice:O,alwaysFocus:L,required:M,schema:J,schemaIdx:ae,autoTrigger:ie}){this.$getAddArrayElement().$addArrayElement({propName:g,splice:O,alwaysFocus:L,required:M,schema:J,schemaIdx:ae,autoTrigger:ie})},$getArrayItems(){return this.$getAddArrayElement().previousElementSibling},$getTypeChoices(){const O=this.$getArrayItems();return $e(O.lastElementChild,`fieldset > .typeChoices-${g}`)}},$on:{click(g){const O=g,L=O.target;["checkbox","radio","file","datetime-local",void 0].includes(L.type)||O.preventDefault()}}},[[ae?"span":"b",{title:ae?.description??DOM.initialCaps(oe).replace(/s$/u,"")},[ae?"—":DOM.initialCaps(oe).replace(/s$/u,"")]],nbsp$1.repeat(2),"filelist"===oe?["input",{name:g+"-filelist",multiple:!0,type:"file",$on:{change(){if(this.files)for(let g=0;g<this.files.length;g++){const O=this.files.item(g);Ee.$addAndSetArrayElement({propName:String(g),type:"file",value:O,bringIntoFocus:!1,setAValue:!0})}}}}]:"",Ie,we]);if(le=le||Ee,!ue&&ae)switch(oe){case"object":if(!ie)for(const[g,O]of Object.entries(ae.properties??{}))O.isOptional||"never"===O.type||Ee.$addArrayElement({propName:g,required:!0});break;case"tuple":if(!ie){const g=ae;if("never"!==ae?.items?.[0]?.type)for(const O of g.items)Ee.$addArrayElement({schema:O,required:!0})}break;case"arrayNonindexKeys":{const{minLength:g=0}=ae,O=$e(Ee,".arrayLength");O.value=String(g),O.$oldvalue=String(g);for(let O=0;O<g;O++)Ee.$addArrayElement({required:!0});break}case"set":if(!ie){const{minSize:g=0}=ae;for(let O=0;O<g;O++)Ee.$addArrayElement({required:!0})}}return[Ee]}},tupleType={option:["Tuple"],array:!0,regexEndings:[",","]"],stringRegexBegin:/^Tuple\[/u,stringRegexEnd:/^\]/u,tuple:!0,valueMatch:g=>Array.isArray(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"tuple"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"tuple"})}},objectType={option:["Object"],regexEndings:[",","}"],stringRegexBegin:/^\{/u,stringRegexEnd:/^\}/u,valueMatch:g=>g&&"object"==typeof g&&"Object"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"object"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"object"})}},recordType={option:["Record"],regexEndings:[",","}"],stringRegexBegin:/^Record\{/u,stringRegexEnd:/^\}/u,array:!0,record:!0,valueMatch:g=>g&&"object"==typeof g&&"Object"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"record"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"record"})}},dateType={option:["Date"],dateRegex:/^(?:\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d)$/u,stringRegex(){const g=this.dateRegex;if(!this.valid){const{source:O}=g;return new RegExp("^(?:InvalidDate)|"+O.slice(1),"u")}return new RegExp(g,"u")},valueMatch:g=>"Date"===toStringTag(g),toValue:g=>({value:new Date(g)}),getInput:({root:g})=>$e(g,'input[type="datetime-local"]'),setValue({root:g,value:O}){if(O&&Number.isNaN(O.getTime()))return void $e(g,".invalidDate").$setValidity(!0);const L=new Date(Date.parse(O)).toISOString();this.getInput({root:g}).value=24===L.length?L.slice(0,-8):L.slice(3,13)},validate({root:g}){if(this.isInvalid({root:g}))return{valid:!0};const O=this.getInput({root:g}).value;return O?{valid:new RegExp(this.dateRegex,"u").test(O),message:"Must match a valid date"}:{valid:!1,message:"Must not be empty`"}},isInvalid({root:g}){return!this.valid&&$e(g,".invalidDate").checked},getValue({root:g}){return this.isInvalid({root:g})?this.toValue("NaN").value:this.toValue(this.getInput({root:g}).value).value},isValueInvalid:g=>g&&Number.isNaN(g.getTime()),viewUI({value:g,specificSchemaObject:O}){return!this.valid&&this.isValueInvalid(g)?["i",{dataset:{type:"date"},class:"InvalidDate",title:O?.description??"(an InvalidDate)"},["InvalidDate"]]:["i",{dataset:{type:"date"},class:"ValidDate",title:O?.description??"(a `Date`)"},[g.toISOString().slice(0,-8)]]},editUI({typeNamespace:g,specificSchemaObject:O,types:L,value:M}){const J=O,ae=M??(O?.defaultValue?new Date(O?.defaultValue):""),ie=this.isValueInvalid(ae),ne=this.valid?"":jml("div",[["label",["Invalid date",["input",{type:"checkbox",class:"invalidDate",checked:ie,name:`${g}-invalidDate`,$custom:{$setValidity(g){!0===g&&(this.checked=!0);const O=ne.previousElementSibling;O.hidden=Boolean(g);const M=O.parentElement;L.validate({type:"date",root:M})}},$on:{click(){this.$setValidity(this.checked)}}}]]]]);return["div",{dataset:{type:this.valid?"ValidDate":"date"},title:O?.description??"Date"},[["label",{hidden:ie},["Date: ",["input",{name:`${g}-date`,type:"datetime-local",value:!ae||ie?"":ae.toISOString().slice(0,-8),min:J?.min?new Date(J.min).toISOString().slice(0,-8):void 0,max:J?.max?new Date(J.max).toISOString().slice(0,-8):void 0}]]],ne]]}},enumType={option:["Enum"],stringRegex:/^Enum\((.*)\)$/u,valueMatch:g=>"string"==typeof g,toValue:g=>({value:g.slice(1,-1)}),getInput:({root:g})=>$e(g,"select"),setValue({root:g,value:O}){this.getInput({root:g}).value=O},getValue({root:g}){return this.getInput({root:g}).value},viewUI:({value:g,specificSchemaObject:O})=>["span",{dataset:{type:"enum"},title:O?.description??"(an enum)"},[g]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L=""})=>["div",{dataset:{type:"enum"},title:O?.description??"Enum"},[["select",{name:`${g}-enum`},O?.values.map((g=>["option",{selected:L?L===g:O?.defaultValue===g},[g]]))]]]},setType={option:["Set"],array:!0,set:!0,regexEndings:[",",")"],stringRegexBegin:/^Set\(/u,stringRegexEnd:/^\)/u,valueMatch:g=>"Set"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"set"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"set"})}},mapType={option:["Map"],array:!0,map:!0,regexEndings:[",",")"],stringRegexBegin:/^Map\(/u,stringRegexEnd:/^\)/u,valueMatch:g=>"Map"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"map"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"map"})}},literalType={option:["Literal"],stringRegex:/^Literal\((.*)\)$/u,valueMatch:g=>"boolean"==typeof g||"number"==typeof g||"string"==typeof g,toValue:g=>({value:"true"===g||"false"!==g&&('"'===g.charAt(0)?g.slice(1,-1):Number(g))}),getInput:({root:g})=>$e(g,"input,textarea"),setValue({root:g,value:O}){this.getInput({root:g}).value=O},getValue({root:g,stateObj:O}){const L=$e(g,"[data-type]"),M=O?.types?.getTypeObject?.(L?.dataset.type);return M?.getValue({root:g,stateObj:O})},viewUI:({value:g,specificSchemaObject:O})=>["span",{dataset:{type:"literal"},title:O?.description??`(a literal ${typeof g})`},[`${g}`]],editUI(g){const{specificSchemaObject:O}=g,{value:L}=O;let M;switch(typeof L){case"boolean":M=booleanType.editUI(g);break;case"number":M=numberType.editUI(g);break;default:M=stringType.editUI(g)}return["div",{dataset:{type:"literal"}},[M]]}},undefinedType={stringRegex:/^undefined$/u,option:["Explicit undefined"],valueMatch:g=>void 0===g,toValue:()=>({value:void 0}),getValue(){return this.toValue("").value},viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"undef"},title:g?.description??"(an `undefined`)"},["undefined"]],getInput:({root:g})=>$e(g,"input"),editUI:({typeNamespace:g,specificSchemaObject:O})=>["div",{dataset:{type:"undef"},title:O?.description??"Undefined"},[["label",["Undefined",["input",{type:"checkbox",name:`${g}-undef`,disabled:!0,checked:!0}]]]]]},voidType={stringRegex:/^void$/u,option:["Void"],valueMatch:g=>void 0===g,toValue:()=>({value:void 0}),getValue(){return this.toValue("").value},getInput:({root:g})=>$e(g,"input"),viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"void"},title:g?.description??"(a `void`)"},["void"]],editUI:({typeNamespace:g,specificSchemaObject:O})=>["div",{dataset:{type:"void"},title:O?.description??"Void"},[["label",["Void",["input",{type:"checkbox",name:`${g}-void`,checked:!0,disabled:!0}]]]]]},regexpType={option:["RegExp"],stringRegex(g){const O=g?"(?:":"(";return new RegExp(`^/${O}.*)/${O}[${this.allowedFlags.join("")}]{0,${this.allowedFlags.length}})$`,"u")},valueMatch:g=>"RegExp"===toStringTag(g),toValue(g){if("function"!=typeof this.stringRegex)throw new TypeError("Guard for TS");const[,O,L]=g.match(this.stringRegex());return{value:new RegExp(O,L)}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=O.source,this.getSelect({root:g}).$set([...O.flags])},getSelect:({root:g})=>$e(g,"select"),validate({root:g}){try{return this.getValue({root:g}),{valid:!0}}catch(g){return{valid:!1,message:g.message}}},getValue({root:g}){return new RegExp(this.getInput({root:g}).value,[...this.getSelect({root:g}).selectedOptions].reduce(((g,O)=>g+O.value),""))},allowedFlags:["g","i","m","u","y","s","v"],viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"regexp"},title:O?.description??"(a `RegExp`)"},[String(g)]],editUI({typeNamespace:g,specificSchemaObject:O,types:L,value:M={source:"",flags:""}}){const J=jml("select",{multiple:!0,size:5,$custom:{$set(g){[...this.options].forEach((O=>{O.selected=g.includes(O.value)}))}}},this.allowedFlags.map((g=>["option",{selected:M.flags.includes(g)},[g]]))),ae=jml("div",{dataset:{type:"regexp"},title:O?.description??"RegExp"},[["label",["Source ",["input",{name:`${g}-regexp`,type:"text",value:M.source}]]],["br"],["label",["Flags ",J]]]);return J.addEventListener("change",(()=>{L.validate({type:"regexp",root:ae})})),[ae]}},BooleanObjectType={option:["BooleanObject"],stringRegex:/^Boolean\((.*)\)$/u,valueMatch:g=>"Boolean"===toStringTag(g)&&"object"==typeof g,toValue:g=>({value:new Boolean("true"===g)}),getInput:({root:g})=>$e(g,"input"),getValue({root:g}){return this.toValue(String(this.getInput({root:g}).checked)).value},setValue({root:g,value:O}){$$e(g,"input")[O.valueOf()?0:1].checked=!0},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"BooleanObject"},title:O?.description??"(a Boolean Object)"},[O?`${g}`:`Boolean(${g})`]],ct:0,editUI({typeNamespace:g,specificSchemaObject:O,value:L=new Boolean(!0)}){return this.ct++,["div",{dataset:{type:"BooleanObject"},title:O?.description??"Boolean object"},[["label",["True",["input",{type:"radio",name:`${g}-BooleanObject${this.ct}`,value:"true",checked:L.valueOf()}]]],["label",["False",["input",{type:"radio",name:`${g}-BooleanObject${this.ct}`,value:"false",checked:!L.valueOf()}]]]]]}},NumberObjectType={option:["NumberObject"],stringRegex:/^Number\((.*)\)$/u,valueMatch:g=>"Number"===toStringTag(g)&&"object"==typeof g,toValue:g=>({value:new Number(g)}),validate:({root:g})=>numberType.validate({root:g}),getInput:({root:g})=>$e(g,"input"),getValue({root:g}){return this.toValue(this.getInput({root:g}).value).value},setValue({root:g,value:O}){this.getInput({root:g}).value=String(O)},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"NumberObject"},title:O?.description??"(a Number Object)"},[O?`${g}`:`Number(${g})`]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L})=>["div",{dataset:{type:"NumberObject"},title:O?.description??"Number object"},[["input",{name:`${g}-NumberObject`,type:"number",value:L,step:"any"}]]]},StringObjectType={stringRegex:/^String\(([^)]*)\)$/u,valueMatch:g=>"String"===toStringTag(g)&&"object"==typeof g,toValue:g=>({value:new String(g)}),option:["StringObject"],getInput:({root:g})=>$e(g,"textarea"),getValue({root:g}){return this.toValue(this.getInput({root:g}).value).value},setValue({root:g,value:O}){this.getInput({root:g}).value=O},viewUI:({value:g,specificSchemaObject:O})=>["span",{dataset:{type:"StringObject"},title:O?.description??"(a String Object)"},[O?"":["i",["String("]],["span",[g.valueOf()]],O?"":["i",[")"]]]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L=""})=>["div",{dataset:{type:"StringObject"},title:O?.description??"String object"},[["textarea",{name:`${g}-StringObject`},[L]]]]},SpecialRealNumberSuperType={option:["Special Real Number",{title:"`Infinity`, `-Infinity`, `-0`"}],childTypes:["infinity","negativeInfinity","negativeZero"],stringRegex:/^(?:-?Infinity|-0)$/u,valueMatch:g=>Object.is(g,-0)||g===Number.POSITIVE_INFINITY||g===Number.NEGATIVE_INFINITY,toValue:g=>({value:"-0"===g?-0:"Infinity"===g?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY}),getSelect:({root:g})=>$e(g,"select"),getValue({root:g}){return this.toValue(this.getSelect({root:g}).value).value},setValue({root:g,value:O}){this.getSelect({root:g}).value=Object.is(O,-0)?"-0":String(O)},viewUI({value:g,specificSchemaObject:O}){const L=Object.is(g,-0);return["i",{dataset:{type:"SpecialRealNumber"},title:O?.description??(L?"(negative zero)":`(${String(g)})`)},[L?"-0":String(g)]]},getInput:({root:g})=>$e(g,"select"),editUI:({typeNamespace:g,specificSchemaObject:O,value:L=Number.POSITIVE_INFINITY})=>["div",{dataset:{type:"SpecialRealNumber"},title:O?.description??"Special Real Number"},[["label",[["select",{name:`${g}-SpecialRealNumber`},[["option",{value:"Infinity",selected:L===Number.POSITIVE_INFINITY},["Infinity"]],["option",{value:"-Infinity",selected:L===Number.NEGATIVE_INFINITY},["-Infinity"]],["option",{value:"-0",selected:Object.is(L,-0)},["-0"]]]]]]]]},SpecialNumberSuperType={option:["Special Number",{title:"`NaN`, `Infinity`, `-Infinity`, `-0`"}],childTypes:["infinity","negativeInfinity","nan","negativeZero"],stringRegex:/^(?:NaN|-?Infinity|-0)$/u,toValue:g=>({value:"-0"===g?-0:"NaN"===g?Number.NaN:"Infinity"===g?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY}),getSelect:({root:g})=>$e(g,"select"),getInput:({root:g})=>$e(g,"select"),getValue({root:g}){return this.toValue(this.getSelect({root:g}).value).value},setValue({root:g,value:O}){this.getSelect({root:g}).value=Object.is(O,-0)?"-0":String(O)},viewUI:({value:g})=>["i",{dataset:{type:"SpecialNumber"}},[Object.is(g,-0)?"-0":String(g)]],editUI:({typeNamespace:g,value:O=Number.NaN})=>["div",{dataset:{type:"SpecialNumber"}},[["label",["Special number: ",["select",{name:`${g}-SpecialNumber`},[["option",{value:"NaN",selected:Number.isNaN(O)},["NaN"]],["option",{value:"Infinity",selected:O===Number.POSITIVE_INFINITY},["Infinity"]],["option",{value:"-Infinity",selected:O===Number.NEGATIVE_INFINITY},["-Infinity"]],["option",{value:"-0",selected:Object.is(O,-0)},["-0"]]]]]]]]},errorType={option:["Error"],stringRegex:/^Error\((.*)\)$/u,valueMatch:g=>"Error"===toStringTag(g)&&hasConstructorOf(g,Error),toValue(g){const O=JSON.parse(g);return{value:P.error.revive(O,{})}},getInput:({root:g})=>$e(g,"input:not([type])"),setValue({root:g,value:O}){"string"==typeof O.message?$e(g,"input.message:not([type])").value=O.message:$e(g,"input.message[type=checkbox]").click(),"string"==typeof O.name?$e(g,"input.name:not([type])").value=O.name:$e(g,"input.name[type=checkbox]").click(),"string"==typeof O.fileName?$e(g,"input.fileName:not([type])").value=O.fileName:$e(g,"input.fileName[type=checkbox]").click(),"number"==typeof O.lineNumber?$e(g,"input.lineNumber[type=number]").value=O.lineNumber:$e(g,"input.lineNumber[type=number]").value="","number"==typeof O.columnNumber?$e(g,"input.columnNumber[type=number]").value=O.columnNumber:$e(g,"input.columnNumber[type=number]").value="","string"==typeof O.stack?$e(g,"textarea.stack:not([type])").value=O.stack:$e(g,"input.stack[type=checkbox]").click(),setTimeout((()=>{"object"==typeof O.cause&&($e(g,".cause").click(),this.setValue({root:$e(g,".causeContents"),value:O.cause}))}))},getValue({root:g}){let O;if($e(g,"input.message[type=checkbox]").checked){const L=$e(g,"input.message:not([type])").value;O=new Error(L)}else O=new Error,O.message=void 0;if($e(g,"input.name[type=checkbox]").checked){const L=$e(g,"input.name:not([type])").value;O.name=L}else O.name=void 0;if($e(g,"input.fileName[type=checkbox]").checked){const L=$e(g,"input.fileName:not([type])").value;O.fileName=L}else O.fileName=void 0;if($e(g,"input.stack[type=checkbox]").checked){const L=$e(g,"textarea.stack:not([type])").value;O.stack=L}else O.stack=void 0;const L=$e(g,"input.lineNumber[type=number]").value;O.lineNumber=""===L?void 0:Number(L);const M=$e(g,"input.columnNumber[type=number]").value;O.columnNumber=""===M?void 0:Number(M);const J=$e(g,".causeContents");return J.children.length&&(O.cause=this.getValue({root:J})),O},viewUI({value:g,specificSchemaObject:O,types:L,format:M}){return["div",{dataset:{type:"error"}},[["b",{class:"emphasis",title:O?.description?"(an Error)":void 0},[O?.description??"Error"]],"string"==typeof g.message?["div",[["b",["Message: "]],["span",[g.message]]]]:[],"string"==typeof g.name?["div",[["b",["Name: "]],["span",[g.name]]]]:[],"string"==typeof g.fileName?["div",[["b",["File name: "]],["span",[g.fileName]]]]:[],"number"==typeof g.lineNumber?["div",[["b",["Line number: "]],["span",[g.lineNumber]]]]:[],"number"==typeof g.columnNumber?["div",[["b",["Column number: "]],["span",[g.columnNumber]]]]:[],"string"==typeof g.stack?["div",[["b",["Stack: "]],["span",[g.stack]]]]:[],["b",["Cause: "]],["div",{class:"causeHolder"},[["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=O.nextElementSibling;L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"causeContents"},[g.cause?this.viewUI({format:M,value:g.cause,types:L}):""]]]]]]},editUI({typeNamespace:g,types:O,specificSchemaObject:L,value:M={message:"",name:"",fileName:"",lineNumber:"",columnNumber:"",stack:"",cause:void 0}}){const click=function(g){this.parentNode.nextElementSibling.hidden=!g.target.checked},J=this;"object"==typeof M.cause&&setTimeout((()=>{$e(ae,".cause").click()}));const ae=jml("div",{dataset:{type:"error"},title:L?.description??"Error"},[["div",[["label",["Message? ",["input",{class:"message",type:"checkbox",checked:"string"==typeof M.message,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof M.message},["Message ",["input",{class:"message",name:`${g}-error-message`,value:M.message}]]]]],["div",[["label",["Name? ",["input",{class:"name",type:"checkbox",checked:"string"==typeof M.name,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof M.name},["Name ",["input",{class:"name",name:`${g}-error-name`,value:M.name}]]]]],["br"],["div",[["label",["File name? ",["input",{class:"fileName",type:"checkbox",checked:"string"==typeof M.fileName,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof M.fileName},["File name ",["input",{class:"fileName",name:`${g}-error-fileName`,value:M.fileName}]]]]],["label",["Line number ",["input",{class:"lineNumber",name:`${g}-error-lineNumber`,type:"number",step:"any",value:M.lineNumber}]]],["br"],["label",["Column number ",["input",{class:"columnNumber",name:`${g}-error-columnNumber`,type:"number",step:"any",value:M.columnNumber}]]],["div",[["label",["Stack? ",["input",{class:"stack",type:"checkbox",checked:"string"==typeof M.stack,$on:{click:click}}]]],["label",{hidden:"string"!=typeof M.stack},["Stack ",["textarea",{class:"stack",name:`${g}-error-stack`},[M.stack]]]]]],["label",["Cause? ",["input",{class:"cause",type:"checkbox",$on:{click(L){click.call(this,L);const ae=this.parentElement.nextElementSibling,ie=$e(ae,".causeContents");if(!ie?.children.length){const L=J.editUI({typeNamespace:g,types:O,value:M.cause});jml(...L,ie)}}}}]]],["div",{class:"causeHolder",hidden:!0},[["label",["Cause "]],["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(O.closest(".causeHolder"),".causeContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"causeContents"}]]]]);return[ae]}};function getConstructor(g){const O=Function.prototype.toString.call(g);return O.slice(9,O.indexOf("("))}const specialErrorsMap=new Map([["TypeError",TypeError],["RangeError",RangeError],["SyntaxError",SyntaxError],["ReferenceError",ReferenceError],["EvalError",EvalError],["URIError",URIError]]);"undefined"!=typeof AggregateError&&specialErrorsMap.set("AggregateError",AggregateError),"undefined"!=typeof InternalError&&specialErrorsMap.set("InternalError",InternalError);const specialErrors=[...specialErrorsMap.keys()],errorsSpecialType={option:["Special errors"],valueMatch:g=>[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError,AggregateError].some((O=>hasConstructorOf(g,O))),childTypes:specialErrors.map((g=>g.toLowerCase())),stringRegex:new RegExp("^(?<errorClass>"+specialErrors.join("|")+String.raw`)\((?<innerContent>.*)\)$`,"u"),toValue(g,O){const{groups:{errorClass:L}={}}=O.match,M=JSON.parse(g);return{value:x[L.toLowerCase()].revive(M,{})}},getInput:({root:g})=>$e(g,"input:not([type])"),setValue({root:g,value:O}){const L=$e(g,".errorType");L.value=getConstructor(O.constructor),L.$hideAggregateErrorsLabel(),"string"==typeof O.message?$e(g,"input.message:not([type])").value=O.message:$e(g,"input.message[type=checkbox]").click(),"string"==typeof O.name?$e(g,"input.name:not([type])").value=O.name:$e(g,"input.name[type=checkbox]").click(),"string"==typeof O.fileName?$e(g,"input.fileName:not([type])").value=O.fileName:$e(g,"input.fileName[type=checkbox]").click(),"number"==typeof O.lineNumber?$e(g,"input.lineNumber[type=number]").value=O.lineNumber:$e(g,"input.lineNumber[type=number]").value="","number"==typeof O.columnNumber?$e(g,"input.columnNumber[type=number]").value=O.columnNumber:$e(g,"input.columnNumber[type=number]").value="","string"==typeof O.stack?$e(g,"textarea.stack:not([type])").value=O.stack:$e(g,"input.stack[type=checkbox]").click(),setTimeout((()=>{if("object"==typeof O.cause&&($e(g,".cause").click(),this.setValue({root:$e(g,".causeContents"),value:O.cause})),Array.isArray(O.errors)){const L=$e(g,"input.aggregateErrors");L.click(),L.$emptyAggregateErrorsContents(),L.$populateContents(O.errors)}}))},getValue({root:g,stateObj:O}){const L=specialErrorsMap.get($e(g,".errorType").value);if(!L)throw new Error("Bad error type");let M;if($e(g,"input.message[type=checkbox]").checked){const J=$e(g,"input.message:not([type])").value;if("AggregateError"===getConstructor(L)){const ae=L,ie=$e(g,".aggregateErrorsContents").firstElementChild;M=new ae(arrayType.getValue({stateObj:O,root:ie}),J)}else{M=new L(J)}}else{if("AggregateError"===getConstructor(L)){const J=L,ae=$e(g,".aggregateErrorsContents").firstElementChild;M=new J(arrayType.getValue({stateObj:O,root:ae}))}else{M=new L}M.message=void 0}if($e(g,"input.name[type=checkbox]").checked){const O=$e(g,"input.name:not([type])").value;M.name=O}else M.name=void 0;if($e(g,"input.fileName[type=checkbox]").checked){const O=$e(g,"input.fileName:not([type])").value;M.fileName=O}else M.fileName=void 0;if($e(g,"input.stack[type=checkbox]").checked){const O=$e(g,"textarea.stack:not([type])").value;M.stack=O}else M.stack=void 0;const J=$e(g,"input.lineNumber[type=number]").value;M.lineNumber=""===J?void 0:Number(J);const ae=$e(g,"input.columnNumber[type=number]").value;M.columnNumber=""===ae?void 0:Number(ae);const ie=$e(g,".causeContents");return ie.children.length&&(M.cause=this.getValue({stateObj:O,root:ie})),M},viewUI({value:g,types:O,format:L,specificSchemaObject:M,typeNamespace:J,resultType:ae}){const ie=getConstructor(g.constructor);return["div",{dataset:{type:"errors"},title:M?.description?`(an Error ${ie})`:void 0},[M?.description??["div",[["b",["Error type: "]],["span",[ie]]]],"string"==typeof g.message?["div",[["b",["Message: "]],["span",[g.message]]]]:[],"string"==typeof g.name?["div",[["b",["Name: "]],["span",[g.name]]]]:[],"string"==typeof g.fileName?["div",[["b",["File name: "]],["span",[g.fileName]]]]:[],"number"==typeof g.lineNumber?["div",[["b",["Line number: "]],["span",[g.lineNumber]]]]:[],"number"==typeof g.columnNumber?["div",[["b",["Column number: "]],["span",[g.columnNumber]]]]:[],"string"==typeof g.stack?["div",[["b",["Stack: "]],["span",[g.stack]]]]:[],["b",["Cause: "]],["div",{class:"causeHolder"},[["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=O.nextElementSibling;L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"causeContents"},[g.cause?this.viewUI({format:L,value:g.cause,types:O}):""]]]],"AggregateError"===ie?["div",[["b",["Errors "]],["div",{class:"aggregateErrorsHolder"},[["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=O.nextElementSibling;L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"aggregateErrorsContents"},[g.errors?(()=>{const[M]=arrayType.viewUI({typeNamespace:J,resultType:ae,format:L,type:"arrayNonindexKeys",value:[],types:O});return g.errors.forEach(((g,O)=>{M.$addAndSetArrayElement({propName:String(O),type:"Error"===getConstructor(g.constructor)?"error":"errors",value:g,bringIntoFocus:!1})})),M})():""]]]]]]:""]]},editUI({typeNamespace:g,specificSchemaObject:O,types:L,buildTypeChoices:M,format:J,topRoot:ae,bringIntoFocus:ie,value:ne={message:"",name:"",fileName:"",lineNumber:"",columnNumber:"",stack:"",cause:void 0,errors:void 0}}){const click=function(g){this.parentNode.nextElementSibling.hidden=!g.target.checked},oe=this;"object"==typeof ne.cause&&setTimeout((()=>{$e(pe,".cause").click()})),Array.isArray(ne.errors)&&setTimeout((()=>{$e(pe,"input.aggregateErrors").click()}));const pe=jml("div",{dataset:{type:"errors"},title:O?.description??"Special error"},[["div",[["label",["Special error type ",["select",{class:"errorType",$custom:{$hideAggregateErrorsLabel(){$e(this.parentElement?.closest("div[data-type=errors]"),"label.aggregateErrors").hidden="AggregateError"!==this.value}},$on:{change(){this.$hideAggregateErrorsLabel()}}},[["option",{value:""},["Select an error type"]],...specialErrors.map((g=>["option",{selected:g===getConstructor(ne.constructor)?"selected":void 0},[g]]))]]]],["br"],["label",["Message? ",["input",{class:"message",type:"checkbox",checked:"string"==typeof ne.message,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof ne.message},["Message ",["input",{class:"message",name:`${g}-errors-message`,value:ne.message}]]]]],["div",[["label",["Name? ",["input",{class:"name",type:"checkbox",checked:"string"==typeof ne.name,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof ne.name},["Name ",["input",{class:"name",name:`${g}-errors-name`,value:ne.name}]]]]],["br"],["div",[["label",["File name? ",["input",{class:"fileName",type:"checkbox",checked:"string"==typeof ne.fileName,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof ne.fileName},["File name ",["input",{class:"fileName",name:`${g}-errors-fileName`,value:ne.fileName}]]]]],["label",["Line number ",["input",{class:"lineNumber",name:`${g}-errors-lineNumber`,type:"number",step:"any",value:ne.lineNumber}]]],["br"],["label",["Column number ",["input",{class:"columnNumber",name:`${g}-errors-columnNumber`,type:"number",step:"any",value:ne.columnNumber}]]],["div",[["label",["Stack? ",["input",{class:"stack",type:"checkbox",checked:"string"==typeof ne.stack,$on:{click:click}}]]],["label",{hidden:"string"!=typeof ne.stack},["Stack ",["textarea",{class:"stack",name:`${g}-errors-stack`},[ne.stack??""]]]]]],["label",["Cause? ",["input",{class:"cause",type:"checkbox",$on:{click(O){click.call(this,O);const J=this.parentElement.nextElementSibling,ae=$e(J,".causeContents");if(!ae?.children.length){const O=oe.editUI({buildTypeChoices:M,typeNamespace:g,types:L,value:ne.cause});jml(...O,ae)}}}}]]],["div",{class:"causeHolder",hidden:!0},[["label",["Cause "]],["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(O.closest(".causeHolder"),".causeContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"causeContents"}]]],["br"],["label",{class:"aggregateErrors"},{hidden:!ne.errors},["Aggregate errors? ",["input",{class:"aggregateErrors",type:"checkbox",$custom:{$emptyAggregateErrorsContents(){const g=this.parentElement.nextElementSibling,O=$e(g,".aggregateErrorsContents");for(;O?.firstChild;)O?.firstChild.remove()},$populateContents(O){const ne=this.parentElement.nextElementSibling,oe=$e(ne,".aggregateErrorsContents");if(!oe?.children.length){const[ne]=arrayType.editUI({typeNamespace:g,types:L,buildTypeChoices:M,format:J,type:"array",topRoot:ae,bringIntoFocus:ie,forcedState:"errorsArray",value:[]});O.forEach(((g,O)=>{ne.$addAndSetArrayElement({propName:String(O),type:"Error"===getConstructor(g.constructor)?"error":"errors",value:g,bringIntoFocus:!1,setAValue:!0})})),jml(ne,oe)}}},$on:{click(g){click.call(this,g);const O=this;ne.errors?O.$populateContents(ne.errors):O.$populateContents([{message:"",name:"",stack:""}])}}}]]],["div",{class:"aggregateErrorsHolder",hidden:!0},[["label",["Aggregate errors "]],["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(O.closest(".aggregateErrorsHolder"),".aggregateErrorsContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"aggregateErrorsContents"}]]]]);return[pe]}};let audioCtx;function visualize(g,O){audioCtx||(audioCtx=new AudioContext);const L=O.getContext("2d"),M=audioCtx.createMediaStreamSource(g),J=audioCtx.createAnalyser();J.fftSize=2048;const ae=J.frequencyBinCount,ie=new Uint8Array(ae);M.connect(J),function draw(){const g=O.width,M=O.height;requestAnimationFrame(draw),J.getByteTimeDomainData(ie),L.fillStyle="rgb(200, 200, 200)",L.fillRect(0,0,g,M),L.lineWidth=2,L.strokeStyle="rgb(0, 0, 0)",L.beginPath();const ne=1*g/ae;let oe=0;for(let g=0;g<ae;g++){const O=ie[g]/128*M/2;0===g?L.moveTo(oe,O):L.lineTo(oe,O),oe+=ne}L.lineTo(O.width,O.height/2),L.stroke()}()}async function getUserMedia(g){let O=null;try{O=await navigator.mediaDevices.getUserMedia(g)}catch(g){return console.error("err",g),null}return O}async function startScreenCapture(g){let O=null;try{O=await navigator.mediaDevices.getDisplayMedia(g)}catch(g){console.error(`Error: ${g}`)}return O}function getDateString(g){const O=new Date(g);return new Date(O.getTime()-6e4*O.getTimezoneOffset()).toISOString().slice(0,-1)}function newFileForBinary(g,O){const L=g.$value,M=new File([void 0===O.stringContents?L&&"File"===Object.prototype.toString.call(L).slice(8,-1)?L:"":O.stringContents],void 0===O.name?L?.name??"":O.name,{type:void 0===O.type?L?.type??"":O.type,lastModified:void 0===O.lastModified?L?.lastModified??0:O.lastModified});g.$value=M}function binaryButton$1(g,O){return["button",{class:"viewBinary",$custom:{$value:g},$on:{click(g){const O=this;g.preventDefault(),this.$value&&"File"===Object.prototype.toString.call(this.$value).slice(8,-1)||newFileForBinary(O,{});const L=new FileReader;L.addEventListener("load",(async function(){const g=await dialogs.makeSubmitDialog({submitText:"Save",submit(){const L=$e(g,".view-binary");newFileForBinary(O,{stringContents:L.value}),g.close()},children:[["div",["Binary source",["br"],["textarea",{class:"view-binary"},[L.result??""]]]]]})})),L.addEventListener("error",(async function(){console.error(L.error),await dialogs.alert(L.error.message)})),L.readAsBinaryString(this.$value)}}},[O?"Edit binary data":"View binary data"]]}const fileType={option:["File"],stringRegex:/^File\((.*)\)$/u,valueMatch:g=>"File"===toStringTag(g),toValue(g){const O=JSON.parse(g);return{value:new File([O.stringContents],O.name,{type:O.type,lastModified:O.lastModified})}},getInput:({root:g})=>$e(g,"button.viewBinary"),setValue({root:g,value:O}){$e(g,"fieldset.fileMetaData").$setValue(O)},getValue({root:g}){return this.getInput({root:g}).$value},viewUI:({value:g,specificSchemaObject:O})=>["div",{dataset:{type:"file"}},[["b",{class:"emphasis",title:O?.description?"(a File)":void 0},[O?.description??"File"]],["br"],["br"],["b",["Name "]],g.name,["br"],["b",["Size (in bytes) "]],String(g.size),["br"],["b",["Content type "]],g.type,["br"],["b",["Last modified date "]],getDateString(g.lastModified),["br"],g.type.startsWith("text/")||"application/json"===g.type?(()=>{const O=jml("div"),L=new FileReader;return L.addEventListener("load",(function(){O.append(jml("div",["Text source",["br"],["textarea",{class:"view-text"},[L.result??""]]]))})),L.addEventListener("error",(function(){console.error(L.error),O.append(L.error.message)})),L.readAsBinaryString(g),O})():binaryButton$1(g),g.type.startsWith("video/")?(()=>{const O=URL.createObjectURL(g),L=jml("video",{src:O,class:"video",$on:{loadeddata(){URL.revokeObjectURL(O)}}});return["div",[L,["button",{class:"play",$on:{click(g){g.preventDefault(),L.play()}}},["Play"]],["button",{class:"pause",$on:{click(g){g.preventDefault(),L.pause()}}},["Pause"]],["button",{class:"replay",$on:{click(g){g.preventDefault(),L.pause(),L.currentTime=0,L.play()}}},["Replay"]]]]})():"",g.type.startsWith("audio/")?(()=>{const O=URL.createObjectURL(g),L=jml("audio",{src:O,class:"audio",$on:{loadeddata(){URL.revokeObjectURL(O)}}});return["div",[L,["button",{class:"play",$on:{click(g){g.preventDefault(),L.play()}}},["Play"]],["button",{class:"pause",$on:{click(g){g.preventDefault(),L.pause()}}},["Pause"]],["button",{class:"replay",$on:{click(g){g.preventDefault(),L.pause(),L.currentTime=0,L.play()}}},["Replay"]]]]})():"","application/pdf"===g.type?(()=>{const O=URL.createObjectURL(g);return jml("iframe",{class:"PDF",src:O,$on:{load(){URL.revokeObjectURL(O)}}})})():"",g.type.startsWith("image/")?["img",{class:"imageView",src:URL.createObjectURL(g),$on:{load(){URL.revokeObjectURL(this.src)}}}]:""]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L={}})=>["div",{dataset:{type:"file"},title:O?.description??"File"},[["fieldset",{class:"fileMetaData",$custom:{$setValue(g){const O=this;$e(O,".fileName").value=g.name,$e(O,".size").value=String(g.size),$e(O,".contentType").value=g.type,$e(O,".lastModified").value="number"==typeof g.lastModified?getDateString(g.lastModified):"",$e(O,"button.viewBinary").$value="number"==typeof g.lastModified?g:void 0}}},[["legend",["Current file data"]],["label",["Name ",["input",{size:50,class:"fileName",value:L.name??"",$on:{change(){newFileForBinary($e(this.parentElement?.parentElement,"button.viewBinary"),{name:this.value})}}}]]],["br"],["label",["Size (in bytes) ",["input",{type:"number",step:"1",disabled:!0,class:"size",value:String(L.size)}]]],["br"],["label",["Content type ",["input",{class:"contentType",value:L.type??"",$on:{change(){newFileForBinary($e(this.parentElement?.parentElement,"button.viewBinary"),{type:this.value})}}}]]],["br"],["label",["Last modified date ",["input",{type:"datetime-local",class:"lastModified",step:.001,value:L.lastModified?getDateString(L.lastModified):void 0,$on:{change(){const g=$e(this.parentElement?.parentElement,"button.viewBinary"),O=this.value;newFileForBinary(g,{lastModified:new Date(O).getTime()})}}}]]],["br"],binaryButton$1(L,!0),["button",{class:"clearData",$on:{click(g){g.preventDefault(),this.parentElement.$setValue({name:"",size:"",type:"",lastModified:""})}}},["Clear data"]]]],["fieldset",[["legend",["Supply file through upload"]],["label",["File ",["input",{$on:{change(){if(!this.files)return;const g=this.files[0],O=(this.parentElement?.parentElement)?.previousElementSibling;O.$setValue(g)}},name:`${g}-file`,type:"file"}]]]]],["fieldset",[["legend",["Supply file through recording"]],(()=>{const g=jml("select",{class:"device",$on:{async change(){const O=this.nextElementSibling?.nextElementSibling;$e(O,"img.photo").hidden=!0;const L=$e(O,"video.previewMedia"),M=jml("video",{class:"previewMedia"});if(L.$stream){L.$stream.getTracks().forEach((g=>{g.stop()})),L.srcObject=null}L.replaceWith(M);const J=$e(g.nextElementSibling,".takeSnapshot"),ae=$e(g.nextElementSibling,".recordMedia");$e(g.nextElementSibling?.nextElementSibling,"div.recordedMedia").hidden=!0;const ie=$e(O,"canvas.visualizer");let ne,oe;switch(M.$screenShare=!1,g.value){case"audio-and-video":ne={video:!0,audio:!0},M.hidden=!1,J.hidden=!1,ae.textContent="Record video/audio";break;case"video":ne={video:!0},M.hidden=!1,J.hidden=!1,ae.textContent="Record video";break;case"audio":ne={audio:!0},M.hidden=!0,J.hidden=!0,ae.textContent="Record audio";break;case"screenShare":oe={video:!0};case"screenShareAndVideo":oe||(oe={video:!0,audio:!0}),M.$screenShare=!0,M.hidden=!0,J.hidden=!0,ie.hidden=!0;break;default:return}if(ne){const g=await getUserMedia(ne);if(!g)return void await dialogs.alert("Error getting user media");if(O.hidden=!1,M.srcObject=g,M.$stream=g,ne.video){const g=$e(O,"canvas.recordedImage");M.addEventListener("canplay",(()=>{g.setAttribute("width",String(M.videoWidth)),g.setAttribute("height",String(M.videoHeight))}))}M.addEventListener("loadedmetadata",(()=>{M.play(),ne?.audio?(ie.hidden=!1,visualize(g,ie)):ie.hidden=!0}))}else if(oe){const g=await startScreenCapture(oe);if(!g)return void await dialogs.alert("Error getting user media");O.hidden=!1,M.srcObject=g,M.$stream=g}}}},[["option",{value:""},["Please choose a device"]]]);return(async()=>{const O=await navigator.mediaDevices.enumerateDevices();let L=!1,M=!1;O.forEach((g=>{switch(g.kind){case"audioinput":L=!0;break;case"videoinput":M=!0}})),L&&jml("option",{value:"audio"},["Microphone only"],g),M&&jml("option",{value:"video"},["Video camera only"],g),L&&M&&jml("option",{value:"audio-and-video"},["Video camera and microphone"],g),jml("option",{value:"screenShare"},["Screen share"],g),jml("option",{value:"screenShareAndVideo"},["Screen share and microphone"],g)})(),g})()," ",["div",[["button",{class:"recordMedia",$on:{click(g){g.preventDefault();const O=$e(this.parentElement?.nextElementSibling,"video.previewMedia");if(!O.srcObject)return void dialogs.alert("No stream found to record");const L=this.parentElement?.nextElementSibling;$e(L,"img.photo").hidden=!0;const M="video/webm",J=new MediaRecorder(O.$stream,{mimeType:M});let ae=[];J.addEventListener("dataavailable",(g=>{ae.push(g.data)}));try{J.start()}catch{return void dialogs.alert("Error starting media recorder")}J.addEventListener("stop",(()=>{const g=new Blob(ae,{type:M}),O=URL.createObjectURL(g),L=$e(this.parentElement?.nextElementSibling,"video.recordedMedia");L.parentElement.hidden=!1,L.src=O,L.addEventListener("loadeddata",(()=>{URL.revokeObjectURL(O)}));const J=new File([g],"placeholder.webm",{type:M});console.log("file",J);const ie=this.closest('[data-type="file"]');$e(ie,"fieldset.fileMetaData").$setValue(J),ae=[]})),this.$mediaRecorder=J}}},["Record media"]],["button",{class:"stopRecording",$on:{click(g){g.preventDefault(),this.previousElementSibling.$mediaRecorder.stop()}}},["Stop recording"]],["button",{class:"takeSnapshot",hidden:!0},{$on:{click(g){g.preventDefault();const O=this.parentElement?.nextElementSibling;$e(O,".recordedMedia").hidden=!0;const L=$e(O,"canvas.recordedImage"),M=L.getContext("2d"),J=$e(O,"video.previewMedia");M.drawImage(J,0,0,L.width,L.height);const ae=$e(O,"img.photo");L.toBlob((g=>{if(!g)return void dialogs.alert("Error converting canvas to Blob");const O=jml("img",{class:"photo"}),L=URL.createObjectURL(g);O.addEventListener("load",(()=>{URL.revokeObjectURL(L)}));const M=new File([g],"placeholder.png",{type:g.type});console.log("file",M);const J=this.closest('[data-type="file"]');$e(J,"fieldset.fileMetaData").$setValue(M),O.src=L,ae.replaceWith(O)}))}}},["Take and use snapshot as file"]]]],["div",{class:"videoContainer",hidden:!0},[["canvas",{class:"visualizer",hidden:!0}],["br"],["video",{class:"previewMedia"}],["div",[["canvas",{hidden:!0,class:"recordedImage"}],["img",{class:"photo"}]]],["div",{class:"recordedMedia"},[...(()=>{const g=jml("video",{class:"recordedMedia"});return[g,["br"],jml("button",{class:"play",$on:{click(O){O.preventDefault(),g.play()}}},["Play"]),jml("button",{class:"pause",$on:{click(O){O.preventDefault(),g.pause()}}},["Pause"]),jml("button",{class:"replay",$on:{click(O){O.preventDefault(),g.pause(),g.currentTime=0,g.play()}}},["Replay"])]})()]]]]]]]]},filelistType={option:["FileList"],array:!0,filelist:!0,regexEndings:[",",")"],stringRegexBegin:/^FileList\(/u,stringRegexEnd:/^\)/u,valueMatch:g=>"FileList"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"filelist"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"filelist"})}};function newBlobForBinary(g,O){const L=g.$value,M=new Blob([void 0===O.stringContents?L&&"Blob"===Object.prototype.toString.call(L).slice(8,-1)?L:"":O.stringContents],{type:void 0===O.type?L?.type??"":O.type});return g.$value=M,M}function binaryButton(g,O){return["button",{class:"viewBinary",$custom:{$value:g},$on:{click(g){const O=this;g.preventDefault(),this.$value&&"Blob"===Object.prototype.toString.call(this.$value).slice(8,-1)||newBlobForBinary(O,{});const L=new FileReader;L.addEventListener("load",(async function(){const g=await dialogs.makeSubmitDialog({submitText:"Save",submit(){const L=$e(g,".view-binary"),M=newBlobForBinary(O,{stringContents:L.value});O.parentElement.$setValue(M),g.close()},children:[["div",["Binary source",["br"],["textarea",{class:"view-binary"},[L.result??""]]]]]})})),L.addEventListener("error",(async function(){console.error(L.error),await dialogs.alert(L.error.message)})),L.readAsBinaryString(this.$value)}}},[O?"Edit binary data":"View binary data"]]}const blobType={option:["Blob"],stringRegex:/^Blob\((.*)\)$/u,valueMatch:g=>"Blob"===toStringTag(g),toValue(g){const O=JSON.parse(g);return{value:new Blob([O.stringContents],{type:O.type})}},getInput:({root:g})=>$e(g,"button.viewBinary"),setValue({root:g,value:O}){$e(g,"fieldset.blobMetaData").$setValue(O)},getValue({root:g}){return this.getInput({root:g}).$value},viewUI:({value:g,specificSchemaObject:O})=>["div",{dataset:{type:"blob"}},[["b",{class:"emphasis",title:O?.description?"(a Blob)":void 0},[O?.description??"Blob"]],["br"],["br"],["b",["Size (in bytes) "]],String(g.size),["br"],["b",["Content type "]],g.type,["br"],g.type.startsWith("text/")||"application/json"===g.type?(()=>{const O=jml("div"),L=new FileReader;return L.addEventListener("load",(function(){O.append(jml("div",["Text source",["br"],["textarea",{class:"view-text"},[L.result??""]]]))})),L.addEventListener("error",(function(){console.error(L.error),O.append(L.error.message)})),L.readAsBinaryString(g),O})():binaryButton(g),g.type.startsWith("video/")?(()=>{const O=URL.createObjectURL(g),L=jml("video",{src:O,class:"video",$on:{loadeddata(){URL.revokeObjectURL(O)}}});return["div",[L,["button",{class:"play",$on:{click(g){g.preventDefault(),L.play()}}},["Play"]],["button",{class:"pause",$on:{click(g){g.preventDefault(),L.pause()}}},["Pause"]],["button",{class:"replay",$on:{click(g){g.preventDefault(),L.pause(),L.currentTime=0,L.play()}}},["Replay"]]]]})():"",g.type.startsWith("audio/")?(()=>{const O=URL.createObjectURL(g),L=jml("audio",{src:O,class:"audio",$on:{loadeddata(){URL.revokeObjectURL(O)}}});return["div",[L,["button",{class:"play",$on:{click(g){g.preventDefault(),L.play()}}},["Play"]],["button",{class:"pause",$on:{click(g){g.preventDefault(),L.pause()}}},["Pause"]],["button",{class:"replay",$on:{click(g){g.preventDefault(),L.pause(),L.currentTime=0,L.play()}}},["Replay"]]]]})():"","application/pdf"===g.type?(()=>{const O=URL.createObjectURL(g);return jml("iframe",{class:"PDF",src:O,$on:{load(){URL.revokeObjectURL(O)}}})})():"",g.type.startsWith("image/")?["img",{class:"imageView",src:URL.createObjectURL(g),$on:{load(){URL.revokeObjectURL(this.src)}}}]:""]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L={}})=>["div",{dataset:{type:"blob"},title:O?.description??"Blob"},[["fieldset",{class:"blobMetaData",$custom:{$setValue(g){const O=this;$e(O,".size").value=String(g.size),$e(O,".contentType").value=g.type,$e(O,"button.viewBinary").$value="Blob"===Object.prototype.toString.call(g).slice(8,-1)?g:void 0}}},[["legend",["Current blob data"]],["label",["Size (in bytes) ",["input",{type:"number",step:"1",disabled:!0,class:"size",value:String(L.size)}]]],["br"],["label",["Content type ",["input",{class:"contentType",value:L.type??"",$on:{change(){newBlobForBinary($e(this.parentElement?.parentElement,"button.viewBinary"),{type:this.value})}}}]]],["br"],binaryButton(L,!0),["button",{class:"clearData",$on:{click(g){g.preventDefault(),this.parentElement.$setValue({size:"",type:""})}}},["Clear data"]]]],["fieldset",[["legend",["Supply blob through upload"]],["label",["Blob ",["input",{$on:{change(){if(!this.files)return;const g=this.files[0],O=new Blob([g],{type:g.type}),L=(this.parentElement?.parentElement)?.previousElementSibling;L.$setValue(O)}},name:`${g}-blob`,type:"file"}]]]]],["fieldset",[["legend",["Supply blob through recording"]],(()=>{const g=jml("select",{class:"device",$on:{async change(){const O=this.nextElementSibling?.nextElementSibling;$e(O,"img.photo").hidden=!0;const L=$e(O,"video.previewMedia"),M=jml("video",{class:"previewMedia"});if(L.$stream){L.$stream.getTracks().forEach((g=>{g.stop()})),L.srcObject=null}L.replaceWith(M);const J=$e(g.nextElementSibling,".takeSnapshot"),ae=$e(g.nextElementSibling,".recordMedia");$e(g.nextElementSibling?.nextElementSibling,"div.recordedMedia").hidden=!0;const ie=$e(O,"canvas.visualizer");let ne,oe;switch(M.$screenShare=!1,g.value){case"audio-and-video":ne={video:!0,audio:!0},M.hidden=!1,J.hidden=!1,ae.textContent="Record video/audio";break;case"video":ne={video:!0},M.hidden=!1,J.hidden=!1,ae.textContent="Record video";break;case"audio":ne={audio:!0},M.hidden=!0,J.hidden=!0,ae.textContent="Record audio";break;case"screenShare":oe={video:!0};case"screenShareAndVideo":oe||(oe={video:!0,audio:!0}),M.$screenShare=!0,M.hidden=!0,J.hidden=!0,ie.hidden=!0;break;default:return}if(ne){const g=await getUserMedia(ne);if(!g)return void await dialogs.alert("Error getting user media");if(O.hidden=!1,M.srcObject=g,M.$stream=g,ne.video){const g=$e(O,"canvas.recordedImage");M.addEventListener("canplay",(()=>{g.setAttribute("width",String(M.videoWidth)),g.setAttribute("height",String(M.videoHeight))}))}M.addEventListener("loadedmetadata",(()=>{M.play(),ne?.audio?(ie.hidden=!1,visualize(g,ie)):ie.hidden=!0}))}else if(oe){const g=await startScreenCapture(oe);if(!g)return void await dialogs.alert("Error getting user media");O.hidden=!1,M.srcObject=g,M.$stream=g}}}},[["option",{value:""},["Please choose a device"]]]);return(async()=>{const O=await navigator.mediaDevices.enumerateDevices();let L=!1,M=!1;O.forEach((g=>{switch(g.kind){case"audioinput":L=!0;break;case"videoinput":M=!0}})),L&&jml("option",{value:"audio"},["Microphone only"],g),M&&jml("option",{value:"video"},["Video camera only"],g),L&&M&&jml("option",{value:"audio-and-video"},["Video camera and microphone"],g),jml("option",{value:"screenShare"},["Screen share"],g),jml("option",{value:"screenShareAndVideo"},["Screen share and microphone"],g)})(),g})()," ",["div",[["button",{class:"recordMedia",$on:{click(g){g.preventDefault();const O=$e(this.parentElement?.nextElementSibling,"video.previewMedia");if(!O.srcObject)return void dialogs.alert("No stream found to record");const L=this.parentElement?.nextElementSibling;$e(L,"img.photo").hidden=!0;const M="video/webm",J=new MediaRecorder(O.$stream,{mimeType:M});let ae=[];J.addEventListener("dataavailable",(g=>{ae.push(g.data)}));try{J.start()}catch{return void dialogs.alert("Error starting media recorder")}J.addEventListener("stop",(()=>{const g=new Blob(ae,{type:M}),O=URL.createObjectURL(g),L=$e(this.parentElement?.nextElementSibling,"video.recordedMedia");L.parentElement.hidden=!1,L.src=O,L.addEventListener("loadeddata",(()=>{URL.revokeObjectURL(O)}));const J=this.closest('[data-type="blob"]');$e(J,"fieldset.blobMetaData").$setValue(g),ae=[]})),this.$mediaRecorder=J}}},["Record media"]],["button",{class:"stopRecording",$on:{click(g){g.preventDefault(),this.previousElementSibling.$mediaRecorder.stop()}}},["Stop recording"]],["button",{class:"takeSnapshot",hidden:!0},{$on:{click(g){g.preventDefault();const O=this.parentElement?.nextElementSibling;$e(O,".recordedMedia").hidden=!0;const L=$e(O,"canvas.recordedImage"),M=L.getContext("2d"),J=$e(O,"video.previewMedia");M.drawImage(J,0,0,L.width,L.height);const ae=$e(O,"img.photo");L.toBlob((g=>{if(!g)return void dialogs.alert("Error converting canvas to Blob");const O=jml("img",{class:"photo"}),L=URL.createObjectURL(g);O.addEventListener("load",(()=>{URL.revokeObjectURL(L)}));const M=this.closest('[data-type="blob"]');$e(M,"fieldset.blobMetaData").$setValue(g),O.src=L,ae.replaceWith(O)}))}}},["Take and use snapshot as blob"]]]],["div",{class:"videoContainer",hidden:!0},[["canvas",{class:"visualizer",hidden:!0}],["br"],["video",{class:"previewMedia"}],["div",[["canvas",{hidden:!0,class:"recordedImage"}],["img",{class:"photo"}]]],["div",{class:"recordedMedia"},[...(()=>{const g=jml("video",{class:"recordedMedia"});return[g,["br"],jml("button",{class:"play",$on:{click(O){O.preventDefault(),g.play()}}},["Play"]),jml("button",{class:"pause",$on:{click(O){O.preventDefault(),g.pause()}}},["Pause"]),jml("button",{class:"replay",$on:{click(O){O.preventDefault(),g.pause(),g.currentTime=0,g.play()}}},["Replay"])]})()]]]]]]]]};let domExceptionNameId=0;const domexceptionType={option:["DOMException"],stringRegex:/^DOMException\((.*)\)$/u,valueMatch:g=>"DOMException"===toStringTag(g),toValue(g){const{message:O,name:L}=JSON.parse(g);return{value:new DOMException(O,L)}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){$e(g,".message").value=O.message,$e(g,".name").value=O.name},getValue({root:g}){const O=$e(g,".message").value,L=$e(g,".name").value;return new DOMException(O,L)},viewUI:({value:g,specificSchemaObject:O})=>["div",{dataset:{type:"domexception"},title:O?.description??"(a `DOMException`)"},[["b",["Message "]],g.message,["br"],["b",["Name "]],g.name,["br"],["b",["Code "]],g.code]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L=""})=>(domExceptionNameId++,["div",{dataset:{type:"domexception"},title:O?.description??"DOMException"},[["label",["Name: ",["input",{class:"name",list:`domExceptionNames-${domExceptionNameId}`,name:`${g}-domexception-name`,value:L?.name??"",size:30,placeholder:"(Optional predefined name)"}]]],["datalist",{id:`domExceptionNames-${domExceptionNameId}`,class:"predefinedNames"},["IndexSizeError","HierarchyRequestError","WrongDocumentError","InvalidCharacterError","NoModificationAllowedError","NotFoundError","NotSupportedError","InvalidStateError","InUseAttributeError","SyntaxError","InvalidModificationError","NamespaceError","InvalidAccessError","TypeMismatchError","SecurityError","NetworkError","AbortError","URLMismatchError","QuotaExceededError","TimeoutError","InvalidNodeTypeError","DataCloneError","EncodingError","NotReadableError","UnknownError","ConstraintError","DataError","TransactionInactiveError","ReadOnlyErrorVersionError","OperationError","NotAllowedError"].map((g=>["option",[g]]))],["br"],["label",["Message: ",["input",{class:"message",name:`${g}-domexception-message`,value:L?.message??""}]]]]])};let idx$3=0;const domrectType={option:["DOMRect"],childTypes:["domrectreadonly"],stringRegex:/^(?<domRectClass>DOMRect|DOMRectReadOnly)\((?<innerContent>.*)\)$/u,valueMatch:g=>["DOMRect","DOMRectReadOnly"].includes(toStringTag(g)),toValue(g,O){const{groups:{domRectClass:L}={}}=O.match,{x:M,y:J,width:ae,height:ie}=JSON.parse(g);return{value:new("DOMRect"===L?DOMRect:DOMRectReadOnly)(M,J,ae,ie)}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){$e(g,".x").value=String(O.x),$e(g,".y").value=String(O.y),$e(g,".width").value=String(O.width),$e(g,".height").value=String(O.height),"DOMRect"===toStringTag(O)?$e(g,".domrect-readonly-readwrite").checked=!0:$e(g,".domrect-readonly-readonly").checked=!0},getValue({root:g}){const O=Number($e(g,".x").value),L=Number($e(g,".y").value),M=Number($e(g,".width").value),J=Number($e(g,".height").value);return new($e(g,".domrect-readonly-readwrite").checked?DOMRect:DOMRectReadOnly)(O,L,M,J)},viewUI({value:g,specificSchemaObject:O}){const L="DOMRect"===toStringTag(g);return["div",{dataset:{type:"domrect"},title:O?.description?`(a \`${L?"DOMRect":"DOMRectReadOnly"}\`)`:void 0},[["b",{class:"emphasis"},[O?.description??(L?"DOMRect":"DOMRectReadOnly")]],["br"],["b",["x "]],g.x,["br"],["b",["y "]],g.y,["br"],["b",["width "]],g.width,["br"],["b",["height "]],g.height]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L={x:"",y:"",width:"",height:""}}){idx$3++;const M="any";return["div",{dataset:{type:"domrect"},title:O?.description??"DOMRect"},[["div",[["label",[["input",{type:"radio",class:"domrect-readonly-readwrite",name:`${g}-domrect-readonly-${idx$3}`,value:"readwrite",checked:"DOMRectReadOnly"!==toStringTag(L)}],"Readwrite"]]," ",["label",[["input",{type:"radio",class:"domrect-readonly-readonly",name:`${g}-domrect-readonly-${idx$3}`,value:"readonly",checked:"DOMRectReadOnly"===toStringTag(L)}],"Read-only"]]]],["label",["x: ",["input",{type:"number",step:M,class:"x",name:`${g}-domrect-x`,value:L.x}]]],["br"],["label",["y: ",["input",{type:"number",step:M,class:"y",name:`${g}-domrect-y`,value:L.y}]]],["br"],["label",["width: ",["input",{type:"number",step:M,class:"width",name:`${g}-domrect-width`,value:L.width}]]],["br"],["label",["height: ",["input",{type:"number",step:M,class:"height",name:`${g}-domrect-height`,value:L.height}]]]]]}};let idx$2=0;const dompointType={option:["DOMPoint"],childTypes:["dompointreadonly"],stringRegex:/^(?<domPointClass>DOMPoint|DOMPointReadOnly)\((?<innerContent>.*)\)$/u,valueMatch:g=>["DOMPoint","DOMPointReadOnly"].includes(toStringTag(g)),toValue(g,O){const{groups:{domPointClass:L}={}}=O.match,{x:M,y:J,z:ae,w:ie}=JSON.parse(g);return{value:new("DOMPoint"===L?DOMPoint:DOMPointReadOnly)(M,J,ae,ie)}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){$e(g,".x").value=String(O.x),$e(g,".y").value=String(O.y),$e(g,".z").value=String(O.z),$e(g,".w").value=String(O.w),"DOMPoint"===toStringTag(O)?$e(g,".dompoint-readonly-readwrite").checked=!0:$e(g,".dompoint-readonly-readonly").checked=!0},getValue({root:g}){const O=Number($e(g,".x").value),L=Number($e(g,".y").value),M=Number($e(g,".z").value),J=Number($e(g,".w").value);return new($e(g,".dompoint-readonly-readwrite").checked?DOMPoint:DOMPointReadOnly)(O,L,M,J)},viewUI({value:g,specificSchemaObject:O}){const L="DOMPoint"===toStringTag(g);return["div",{dataset:{type:"dompoint"},title:O?.description?`(a \`${L?"DOMPoint":"DOMPointReadOnly"}\`)`:void 0},[["b",{class:"emphasis"},[O?.description??(L?"DOMPoint":"DOMPointReadOnly")]],["br"],["b",["x "]],g.x,["br"],["b",["y "]],g.y,["br"],["b",["z "]],g.z,["br"],["b",["w "]],g.w]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L={x:"",y:"",z:"",w:""}}){idx$2++;const M="any";return["div",{dataset:{type:"dompoint"},title:O?.description??"DOMPoint"},[["div",[["label",[["input",{type:"radio",class:"dompoint-readonly-readwrite",name:`${g}-dompoint-readonly-${idx$2}`,value:"readwrite",checked:"DOMPointReadOnly"!==toStringTag(L)}],"Readwrite"]]," ",["label",[["input",{type:"radio",class:"dompoint-readonly-readonly",name:`${g}-dompoint-readonly-${idx$2}`,value:"readonly",checked:"DOMPointReadOnly"===toStringTag(L)}],"Read-only"]]]],["label",["x: ",["input",{type:"number",step:M,class:"x",name:`${g}-dompoint-x`,value:L.x}]]],["br"],["label",["y: ",["input",{type:"number",step:M,class:"y",name:`${g}-dompoint-y`,value:L.y}]]],["br"],["label",["z: ",["input",{type:"number",step:M,class:"z",name:`${g}-dompoint-z`,value:L.z}]]],["br"],["label",["w: ",["input",{type:"number",step:M,class:"w",name:`${g}-dompoint-w`,value:L.w}]]]]]}};let idx$1=0;const dommatrixType={option:["DOMMatrix"],childTypes:["dommatrixreadonly"],stringRegex:/^(?<domMatrixClass>DOMMatrix|DOMMatrixReadOnly)\((?<innerContent>.*)\)$/u,valueMatch:g=>["DOMMatrix","DOMMatrixReadOnly"].includes(toStringTag(g)),toValue(g,O){const{groups:{domMatrixClass:L}={}}=O.match,M=JSON.parse(g),J="DOMMatrix"===L?DOMMatrix:DOMMatrixReadOnly;return{value:Object.hasOwn(M,"a")?new J([M.a,M.b,M.c,M.d,M.e,M.f]):new J([M.m11,M.m12,M.m13,M.m14,M.m21,M.m22,M.m23,M.m24,M.m31,M.m32,M.m33,M.m34,M.m41,M.m42,M.m43,M.m44])}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){const{is2D:L}=O;$e(g,".d2").checked=L,$e(g,".d3").checked=!L,$e(g,".holder2d").hidden=!L,$e(g,".holder3d").hidden=L,L?($e(g,".a").value=O.a,$e(g,".b").value=O.b,$e(g,".c").value=O.c,$e(g,".d").value=O.d,$e(g,".e").value=O.e,$e(g,".f").value=O.f):($e(g,".m11").value=O.m11,$e(g,".m12").value=O.m12,$e(g,".m13").value=O.m13,$e(g,".m14").value=O.m14,$e(g,".m21").value=O.m21,$e(g,".m22").value=O.m22,$e(g,".m23").value=O.m23,$e(g,".m24").value=O.m24,$e(g,".m31").value=O.m31,$e(g,".m32").value=O.m32,$e(g,".m33").value=O.m33,$e(g,".m34").value=O.m34,$e(g,".m41").value=O.m41,$e(g,".m42").value=O.m42,$e(g,".m43").value=O.m43,$e(g,".m44").value=O.m44),"DOMMatrix"===toStringTag(O)?$e(g,".dommatrix-readonly-readwrite").checked=!0:$e(g,".dommatrix-readonly-readonly").checked=!0},getValue({root:g}){const O=$e(g,".dommatrix-readonly-readwrite").checked?DOMMatrix:DOMMatrixReadOnly,L=$e(g,".a").value;if(L){return new O([Number(L),Number($e(g,".b").value),Number($e(g,".c").value),Number($e(g,".d").value),Number($e(g,".e").value),Number($e(g,".f").value)])}return new O([Number($e(g,".m11").value),Number($e(g,".m12").value),Number($e(g,".m13").value),Number($e(g,".m14").value),Number($e(g,".m21").value),Number($e(g,".m22").value),Number($e(g,".m23").value),Number($e(g,".m24").value),Number($e(g,".m31").value),Number($e(g,".m32").value),Number($e(g,".m33").value),Number($e(g,".m34").value),Number($e(g,".m41").value),Number($e(g,".m42").value),Number($e(g,".m43").value),Number($e(g,".m44").value)])},viewUI({value:g,specificSchemaObject:O}){const L="DOMMatrix"===toStringTag(g);return["div",{dataset:{type:"dommatrix"}},[["b",{class:"emphasis",title:O?.description?`(a \`${L?"DOMMatrix":"DOMMatrixReadOnly"}\`)`:void 0},[O?.description??(L?"DOMMatrix":"DOMMatrixReadOnly")]],g.is2D?["div",[["b",["a "]],g.a,["br"],["b",["b "]],g.b,["br"],["b",["c "]],g.c,["br"],["b",["d "]],g.d,["br"],["b",["e "]],g.e,["br"],["b",["f "]],g.f]]:["div",[["b",["m11 "]],g.m11,["br"],["b",["m12 "]],g.m12,["br"],["b",["m13 "]],g.m13,["br"],["b",["m14 "]],g.m14,["br"],["b",["m21 "]],g.m21,["br"],["b",["m22 "]],g.m22,["br"],["b",["m23 "]],g.m23,["br"],["b",["m24 "]],g.m24,["br"],["b",["m31 "]],g.m31,["br"],["b",["m32 "]],g.m32,["br"],["b",["m33 "]],g.m33,["br"],["b",["m34 "]],g.m34,["br"],["b",["m41 "]],g.m41,["br"],["b",["m42 "]],g.m42,["br"],["b",["m43 "]],g.m43,["br"],["b",["m44 "]],g.m44]]]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L={}}){idx$1++;const{is2D:M}=L;return["div",{dataset:{type:"dommatrix"},title:O?.description??"DOMMatrix"},[["div",[["label",[["input",{type:"radio",class:"dommatrix-readonly-readwrite",name:`${g}-dommatrix-readonly-${idx$1}`,value:"readwrite",checked:"DOMMatrixReadOnly"!==toStringTag(L)}],"Readwrite"]]," ",["label",[["input",{type:"radio",class:"dommatrix-readonly-readonly",name:`${g}-dommatrix-readonly-${idx$1}`,value:"readonly",checked:"DOMMatrixReadOnly"===toStringTag(L)}],"Read-only"]]]],["div",{$on:{click(g){const{target:O}=g;if("radio"!==O.type)return;const L=this.parentElement;$e(L,".holder2d").hidden="3d"===O.value,$e(L,".holder3d").hidden="2d"===O.value}}},[["label",["2d",["input",{class:"d2",type:"radio",name:`${g}-dommatrix-dimension-${idx$1}`,value:"2d",checked:Boolean(M)}]]]," ",["label",["3d",["input",{class:"d3",type:"radio",name:`${g}-dommatrix-dimension-${idx$1}`,value:"3d",checked:!M}]]]]],["div",{class:"holder2d",hidden:!M},["a","b","c","d","e","f"].flatMap((O=>[["br"],["label",[O+": ",["input",{type:"number",step:"any",class:O,name:`${g}-dommatrix-${O}`,value:L[O]??""}]]]])).slice(1)],["div",{class:"holder3d",hidden:Boolean(M)},["m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44"].flatMap((O=>[["br"],["label",[O+": ",["input",{type:"number",step:"any",class:O,name:`${g}-dommatrix-${O}`,value:L[O]??""}]]]])).slice(1)]]]}},dataViewMethods=["setInt8","setUint8","setInt16","setUint16","setInt32","setUint32","setFloat32","setFloat64","setBigInt64","setBigUint64"],typedArrays=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],getMinMaxForTypedArray=g=>{switch(g){case"Int8Array":return{min:-128,max:127};case"Uint8Array":case"Uint8ClampedArray":return{min:0,max:255};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":return{min:-34e37,max:34e37};case"Float64Array":return{min:-Infinity,max:Infinity};case"BigInt64Array":return{min:-(2**63),max:2**63-1};case"BigUint64Array":return{min:0,max:2**64-1};default:throw new Error("Unexpected typed array type")}},getTypedArray=g=>{switch(g){case"Int8Array":return Int8Array;case"Uint8Array":return Uint8Array;case"Uint8ClampedArray":return Uint8ClampedArray;case"Int16Array":return Int16Array;case"Uint16Array":return Uint16Array;case"Int32Array":return Int32Array;case"Uint32Array":return Uint32Array;case"Float32Array":return Float32Array;case"Float64Array":return Float64Array;case"BigInt64Array":return BigInt64Array;case"BigUint64Array":return BigUint64Array;default:throw new Error("Unexpected type")}},bufferSourceClasses=new Set(["ArrayBuffer","DataView","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]);let idx=0;const buffersourceType={option:["Buffer source (ArrayBuffer, DataView, TypedArrays)"],childTypes:["arraybuffer","dataview","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","bigint64array","biguint64array"],stringRegex:/^(?<bufferSourceClass>ArrayBuffer|DataView|(?:Int8|Uint8|Uint8Clamped|Int16|Uint16|Int32|Uint32|Float32|Float64|BigInt64|BigUint64)Array)\((?<innerContent>.*)\)$/u,valueMatch:g=>bufferSourceClasses.has(toStringTag(g)),toValue(g,O){const{groups:{bufferSourceClass:L}={}}=O.match,M=JSON.parse(g),{byteLength:J,maxByteLength:ae,byteOffset:ie,dataViewByteOffset:ne,dataViewByteLength:oe,length:pe}=M,le=new ArrayBuffer(J,{maxByteLength:ae});let ue,de,he;return(L.endsWith("Array")||"typedArray"in M)&&(de=getTypedArray(M.typedArray??L),ue=new de(le,ie,pe),"set"in M&&(M.set[0].forEach(((g,O)=>{"string"==typeof g&&(M.set[0][O]=BigInt(g))})),ue.set(...M.set))),("DataView"===L||dataViewMethods.some((g=>g in M)))&&(he=new DataView(le,ne,oe),dataViewMethods.forEach((g=>{M[g]?.forEach((O=>{"string"==typeof O[1]&&(O[1]=BigInt(O[1])),he[g](...O)}))}))),{value:"ArrayBuffer"===L?le:"DataView"===L?he:ue}},getInput:({root:g})=>$e(g,".byteLength"),setValue({root:g,value:O}){const L=toStringTag(O);if("ArrayBuffer"===L||"DataView"===L)$e(g,`[value=${L}].buffersource-returnType`)?.click();else{$e(g,"[value=TypedArray].buffersource-returnType")?.click();const O=$e(g,".buffersource-typedArrays");O.value=L,O.dispatchEvent(new Event("change"))}const M=$e(g,".byteLength");M.$value=O;const J="ArrayBuffer"===L?O:O.buffer;M.value=J.byteLength,M.dispatchEvent(new Event("change"));const ae=$e(g,".maxByteLength");if(ae.value=J.maxByteLength,ae.dispatchEvent(new Event("change")),"DataView"===L){const L=$e(g,".dataViewByteLength");L.value=O.byteLength,L.dispatchEvent(new Event("change"));const M=$e(g,".dataViewByteOffset");M.value=O.byteOffset,M.dispatchEvent(new Event("change"))}else if("ArrayBuffer"!==L){const L=$e(g,".typedArrayByteOffset");L.value=O.byteOffset,L.dispatchEvent(new Event("change"));const M=$e(g,".typedArrayLength");M.value=O.length,M.dispatchEvent(new Event("change"))}},getValue({root:g}){return this.getInput({root:g}).$value},viewUI({value:g,specificSchemaObject:O}){const L=toStringTag(g),M="ArrayBuffer"===L?g:g.buffer;return["div",{dataset:{type:"buffersource"}},[["b",{class:"emphasis",title:O?.description?/^[aeiou]/iu.test(L)?`(an ${L})`:`(a ${L})`:void 0},[O?.description??L]],["br"],["b",["Buffer byte length: "]],M.byteLength,["br"],["b",["Buffer max byte length: "]],M.maxByteLength,..."DataView"===L?[["br"],["b",["Data View byte length: "]],g.byteLength,["br"],["b",["Data View byte offset: "]],g.byteOffset]:[""],..."DataView"!==L&&"ArrayBuffer"!==L?[["br"],["b",["Typed Array byte offset: "]],g.byteOffset,["br"],["b",["Typed Array length: "]],g.length]:[""],["br"],["button",{class:"buffersource-viewData",$on:{async click(g){g.preventDefault();const O=await dialogs.makeCancelDialog({children:[["select",{class:"buffersource-typedArrays-view","aria-label":"Typed Arrays",$on:{change(){const g=this.value,O=new(getTypedArray(g))(M),L=$e(this.parentElement,".typedArrayArea");L.textContent="",L.append(...Array.from({length:O.length},((g,L)=>jml("span",[["b",[L]]," ",["span",[O[L]?String(O[L]):"0"]]," "]))))}}},typedArrays.map((g=>["option",{selected:L===g||void 0},[g]]))],["div",{class:"typedArrayArea"}]]});$e(O,".buffersource-typedArrays-view").dispatchEvent(new Event("change"))}}},["View data"]]]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L}){idx++;const M=jml("div",{dataset:{type:"buffersource"},title:O?.description??"BufferSource"},[["fieldset",{class:"returnType",$on:{change(){this.$buildInstances()}},$custom:{$buildInstances(){const O=this.parentElement,{value:L}=$e(this,`[name=${g}-buffersource-returnType-${idx}]:checked`),M=$e(O,".byteLength"),J=Number.parseInt(M.value),ae=Number.parseInt($e(O,".maxByteLength").value),ie=new ArrayBuffer(J,ae?{maxByteLength:ae}:void 0),ne=$e(O,".dataViewByteOffset").value,oe=ne?Number.parseInt(ne):0,pe=$e(O,".dataViewByteLength").value,le=pe?Number.parseInt(pe):void 0,ue=new DataView(ie,oe,le),{value:de}=$e(O,".buffersource-typedArrays-init"),he=getTypedArray(de),ye=$e(O,".typedArrayByteOffset").value,me=ye?Number.parseInt(ye):0,fe=$e(O,".typedArrayLength").value,ge=fe?Number.parseInt(fe):J,ve=new he(ie,me,ge);M.$dataView=ue,M.$typedArray=ve;const be=$$e(O,".typedArrayArea .typedArrayValue").map((g=>he.name.startsWith("Big")?BigInt(g.value):Number(g.value)));switch(M.$typedArray.set(be,0),L){case"ArrayBuffer":M.$value=ie;break;case"DataView":M.$value=ue;break;default:M.$value=ve}}}},[["legend",["Return type"]],["label",{$on:{click(){$e(this.parentElement,".buffersource-typedArrays").hidden=!0,$e(this?.parentElement?.parentElement,".buffersource-typedArrays-init").hidden=!1}}},[["input",{type:"radio",class:"buffersource-returnType buffersource-returnType-arraybuffer",name:`${g}-buffersource-returnType-${idx}`,checked:!0,value:"ArrayBuffer"}],"ArrayBuffer"]]," ",["label",{$on:{click(){$e(this.parentElement,".buffersource-typedArrays").hidden=!0,$e(this?.parentElement?.parentElement,".buffersource-typedArrays-init").hidden=!1}}},[["input",{type:"radio",class:"buffersource-returnType buffersource-returnType-dataview",name:`${g}-buffersource-returnType-${idx}`,value:"DataView"}],"DataView"]]," ",["label",{$on:{click(){$e(this.parentElement,".buffersource-typedArrays").hidden=!1,$e(this?.parentElement?.parentElement,".buffersource-typedArrays-init").hidden=!0}}},[["input",{type:"radio",class:"buffersource-returnType buffersource-returnType-typedarray",name:`${g}-buffersource-returnType-${idx}`,value:"TypedArray"}],"Typed Array"]]," ",["select",{hidden:!0,class:"buffersource-typedArrays","aria-label":"Typed Arrays",$on:{change(g){const O=this.parentElement?.parentElement,L=$e(O,".buffersource-typedArrays-init");L.value=this.value;if(!$e(O,".typedArrayLength").$checkBufferBounds(g))return;L.$setMinsAndMaxes(this.value),L.$checkTypedArrayByteLength(g);$e(this?.parentElement?.parentElement,".typedArrayByteOffset").$checkByteOffsetMultiple(g)}}},typedArrays.map((g=>["option",[g]]))]]],["fieldset",{$on:{change(){this.previousElementSibling.$buildInstances()}}},[["legend",["Construction options"]],["fieldset",[["legend",["ArrayBuffer"]],["label",["Byte length ",["input",{class:"byteLength",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$custom:{$value:L??new ArrayBuffer(0)},$on:{change(g){const O=this,L=O.parentElement?.parentElement?.parentElement?.parentElement;if(!$e(L,".typedArrayLength").$checkBufferBounds(g))return;const M=$e(O.parentElement?.parentElement,".maxByteLength"),J=O.value;if(Number.parseInt(J)>Number.MAX_SAFE_INTEGER)return O.setCustomValidity("The ArrayBuffer length exceeds the maximum allowable size"),g.stopPropagation(),void O.reportValidity();O.setCustomValidity(""),O.reportValidity(),Number.parseInt(J)>Number.parseInt(M.value)&&(M.value=J);const ae=O.parentElement?.parentElement?.parentElement;$e(ae,".dataViewByteLength").$checkDataViewByteLength(g),$e(ae.parentElement,".buffersource-typedArrays-init").$checkTypedArrayByteLength(g)}}}]]]," ",["label",["Max byte length ",["input",{class:"maxByteLength",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$on:{change(g){const O=this,L=$e(O.parentElement?.parentElement,".byteLength"),M=O.value;Number.parseInt(M)<Number.parseInt(L.value)?(O.setCustomValidity("The max value cannot be less than the byte length"),g.stopPropagation()):O.setCustomValidity(""),O.reportValidity()}}}]]]]],["fieldset",[["legend",["DataView"]],["label",["Byte length ",["input",{class:"dataViewByteLength",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$custom:{$checkDataViewByteLength(g){const O=this,L=O.parentElement?.parentElement?.parentElement,M=Number.parseInt($e(L,".dataViewByteOffset").value)||0,J=$e(L,".byteLength").value,ae=J?Number.parseInt(J):0;M+(O.value?Number.parseInt(O.value):ae)>ae?(O.setCustomValidity("The DataView byte length and offset exceed the buffer's byte length"),g.stopPropagation()):O.setCustomValidity(""),O.reportValidity()}},$on:{change(g){this.$checkDataViewByteLength(g)}}}]]]," ",["label",["Byte offset ",["input",{class:"dataViewByteOffset",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$on:{change(g){const O=this.parentElement?.parentElement?.parentElement;$e(O,".dataViewByteLength").$checkDataViewByteLength(g)}}}]]]]],["fieldset",[["legend",["Typed array"]],["label",["Byte offset ",["input",{class:"typedArrayByteOffset",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,max:2**53-1,$custom:{$checkByteOffsetMultiple(g){const O=this,L=O.parentElement?.parentElement?.parentElement?.parentElement,{value:M}=$e(L,".buffersource-typedArrays-init"),J=getTypedArray(M);Number.parseInt(O.value)%J.BYTES_PER_ELEMENT?(O.setCustomValidity(`Byte offset must be a multiple of the typed array's bytes-per-element size (${J.BYTES_PER_ELEMENT})`),g.stopPropagation()):O.setCustomValidity(""),O.reportValidity()}},$on:{change(g){const O=this.parentElement?.parentElement?.parentElement?.parentElement;$e(O,".typedArrayLength").$checkBufferBounds(g)&&this.$checkByteOffsetMultiple(g)}}}]]]]]]],["fieldset",[["legend",["Typed Array initialization (optional)"]],["select",{class:"buffersource-typedArrays-init","aria-label":"Typed Arrays",$custom:{$setMinsAndMaxes(g){const{min:O,max:L}=getMinMaxForTypedArray(g);$$e(this.parentElement,".typedArrayValue").forEach((M=>{M.className="typedArrayValue typedArray-"+g,M.min=String(O),M.max=String(L)}))},$checkTypedArrayByteLength(g){const O=getTypedArray(this.value),L=$e(this.parentElement?.parentElement,".byteLength");(L.value?Number.parseInt(L.value):0)%O.BYTES_PER_ELEMENT?(L.setCustomValidity(`Array buffer must be a multiple of the typed array's bytes-per-element size (${O.BYTES_PER_ELEMENT})`),g.stopPropagation()):L.setCustomValidity(""),L.reportValidity()}},$on:{change(g){const O=this,L=O.parentElement?.parentElement?.parentElement;$e(this.parentElement?.parentElement,".buffersource-typedArrays").value=O.value;if(!$e(L,".typedArrayLength").$checkBufferBounds(g))return;O.$checkTypedArrayByteLength(g),O.$setMinsAndMaxes(O.value);$e(O?.parentElement?.parentElement,".typedArrayByteOffset").$checkByteOffsetMultiple(g),$e(this.parentElement?.parentElement,".returnType").$buildInstances()}}},typedArrays.map((g=>["option",[g]]))]," ",["label",["Array length: ",["input",{class:"typedArrayLength",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$custom:{$checkBufferBounds(g){const O=this,L=O.parentElement?.parentElement?.parentElement,M=$e(L,".byteLength").value,J=M?Number.parseInt(M):0,ae=O.value?Number.parseInt(O.value):J,{value:ie}=$e(L,".buffersource-typedArrays-init"),ne=getTypedArray(ie),oe=$e(L,".typedArrayByteOffset").value;return(oe?Number.parseInt(oe):0)+ae*ne.BYTES_PER_ELEMENT>J?(O.setCustomValidity("The byte offset and the length times bytes per element is greater than the buffer length"),g.stopPropagation(),O.reportValidity(),!1):(O.setCustomValidity(""),O.reportValidity(),!0)},$buildTypedArray(){const g=this,O=Number.parseInt(g.value),L=g.parentElement?.parentElement,M=g.parentElement?.parentElement?.parentElement,J=$e(M,".byteLength"),ae=$e(L,".typedArrayArea");ae.addEventListener("change",(g=>{const O=g.target;J.$typedArray.set(["true"===O.dataset.bigint?BigInt(O.value):Number(O.value)],Number.parseInt(O.dataset.key))}));const{value:ie}=$e(L,".buffersource-typedArrays-init"),{min:ne,max:oe}=getMinMaxForTypedArray(ie);ae.textContent="",ae.append(...Array.from({length:O},((g,O)=>jml("label",[O," ",["input",{class:"typedArrayValue typedArray-"+ie,dataset:{key:O,bigint:String(ie.startsWith("BigInt"))},type:"number",step:"1",pattern:ie.startsWith("Float")?String.raw`\d+(?:\.\d+)?`:String.raw`\d+`,value:J.$typedArray[O]?String(J.$typedArray[O]):"0",min:ne,max:oe}]," "]))))}},$on:{change(g){const O=this,L=this.parentElement?.parentElement;if(!O.$checkBufferBounds(g))return;const{value:M}=$e(L,".buffersource-typedArrays-init"),J=Number.parseInt(O.value);try{new(getTypedArray(M))(J)}catch{return O.setCustomValidity("Typed Array length is too long"),g.stopPropagation(),void O.reportValidity()}O.setCustomValidity(""),O.reportValidity(),$e(this.parentElement?.parentElement?.parentElement,".returnType").$buildInstances(),O.$buildTypedArray()}}}],["div",{class:"typedArrayArea"}]]]]],["fieldset",[["legend",["DataView initialization (optional)"]],["select",{class:"dataViewMethod","aria-label":"Data View methods",$on:{change(){const g=$e(this.parentElement,".dataViewArea"),O=this.value,L=O.slice(3)+"Array";g.textContent="",g.append(jml("label",["Byte offset ",["input",{type:"number",class:"dataViewSetByteOffset",step:"1",size:"4",pattern:String.raw`\d+`}]])," ",jml("label",["Value ",["input",{type:"number",step:"1",size:"4",pattern:String.raw`\d+`,class:"typedArrayValue typedArray-"+L,...getMinMaxForTypedArray(L)}]]),"setInt8"===O||"setUint8"===O?"":jml("label",[["input",{class:"littleEndian",type:"checkbox"}],"Little endian"])," ",jml("button",{$on:{click(g){g.preventDefault();const O=this.parentElement,L=O.previousElementSibling?.value,M=Number.parseInt($e(O,".dataViewSetByteOffset").value),J=$e(O,".typedArrayValue").value,ae=$e(O,".littleEndian")?.checked,ie=$e(O?.parentElement?.parentElement,".byteLength");"setBigInt64"===L||"setBigUint64"===L?ie.$dataView[L](M,BigInt(J),ae):ie.$dataView[L](M,Number(J),ae);$e(O.parentElement?.parentElement,".typedArrayLength").$buildTypedArray()}}},["Set"]))}}},[["option",{value:""},["(Select a data view method)"]],...dataViewMethods.map((g=>["option",[g]]))]]," ",["div",{class:"dataViewArea"}]]]]);if(this.setValue&&L)this.setValue({root:M,value:L});else{$e(M,".byteLength").$value=new ArrayBuffer(0)}return[M]}},noneditableType={option:["Non-editable"],valueMatch:()=>!0,getInput:({root:g})=>$e(g,"button"),setValue({root:g,value:O}){this.getInput({root:g}).$value=O,$e(g,".stringTag").textContent=void 0===O?"(None)":toStringTag(O)},getValue({root:g}){return this.getInput({root:g}).$value},validate({root:g}){return{message:"The non-editable type is only for passing on pre-existing content that is unknown or currently unsupported",valid:void 0!==this.getInput({root:g}).$value}},viewUI({value:g,specificSchemaObject:O}){const L=toStringTag(g);return["div",{dataset:{type:"resurrectable"}},[["b",{class:"emphasis",title:O?.description?`(a non-editable ${L})`:void 0},[O?.description??"Non-editable"]],["span",{title:"There is no current support for editing this element's type, but its contents will be passed on transparently."},["?"]],["b",["String tag: "]],L]]},editUI:({typeNamespace:g,specificSchemaObject:O,value:L})=>["div",{dataset:{type:"resurrectable"},title:O?.description??"Non-editable"},[["a",{href:"javascript:void(0)",$on:{click(g){g.preventDefault()}},title:"There is no current support for editing this element's type, but its contents will be passed on transparently."},["?"]]," ",["button",{$on:{click(g){g.preventDefault(),console.log(this.$value)}},name:`${g}-resurrectable`,$custom:{$value:L}},["Non-editable"]],["br"],["b",["String tag: "]],["span",{class:"stringTag"},[L?toStringTag(L):"(None)"]]]]},neverType={stringRegex:/^never$/u,option:["Never"],valueMatch:()=>!1,toValue(){throw new Error("Cannot convert to value")},getValue(){return this.toValue("")},viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"never"},title:g?.description??"(a `never`)"},["never"]],getInput:({root:g})=>$e(g,"input"),editUI:({typeNamespace:g})=>["div",{dataset:{type:"never"}},[["label",["Never (no value present here)",["input",{type:"checkbox",name:`${g}-never`,hidden:!0}]]]]]},catchType={option:["Catch"],stringRegex:/^catch\((.*)\)$/u,valueMatch:g=>["number","string"].includes(typeof g),toValue:g=>({value:'"'===g.charAt(0)?g.slice(1,-1):Number(g)}),getInput:({root:g})=>$e(g,"input,textarea"),setValue({root:g,value:O}){setTimeout((()=>{this.getInput({root:g}).value=O}))},getValue({root:g}){return this.getInput({root:g}).value},viewUI:({specificSchemaObject:g,types:O,resultType:L,typeNamespace:M,topRoot:J,format:ae,bringIntoFocus:ie,buildTypeChoices:ne,replaced:oe,value:pe})=>["span",{dataset:{type:"catch"},title:g?.description??"(a catch)"},[["b",["Catch"]],["br"],"Default value",["br"],["div",{class:"defaultValue"},[O.getUIForModeAndType({readonly:!0,specificSchemaObject:g?.innerType,hasValue:!0,value:pe,resultType:L,typeNamespace:M,type:g?.innerType?.type,topRoot:J,bringIntoFocus:ie,buildTypeChoices:ne,format:ae,replaced:oe})]],"Catch value",["br"],["div",{class:"catchValue"},[O.getUIForModeAndType({readonly:!0,specificSchemaObject:{...g?.innerType,description:"(catch value)"},hasValue:!0,value:g.value,resultType:L,typeNamespace:M,type:g?.innerType?.type,topRoot:J,bringIntoFocus:ie,buildTypeChoices:ne,format:ae,replaced:oe})]]]],editUI({format:g,type:O,buildTypeChoices:L,specificSchemaObject:M,topRoot:J,schemaContent:ae,typeNamespace:ie,value:ne}){const oe=M?.value;return["div",{dataset:{type:"catch"},title:M?.description??"(a `catch`)"},[["label",[["b",{title:String(oe)},["Value"]]," ",...L({topRoot:J,format:g,setValue:!0,value:ne??oe,schemaOriginal:ae,schemaContent:M?.innerType,state:O,typeNamespace:ie}).domArray]]]]}},nativeEnumType={option:["Native enum"],stringRegex:/^nativeEnum\((.*)\)$/u,valueMatch:g=>["number","string"].includes(typeof g),toValue(g,O){const L='"'===g.charAt(0)?g.slice(1,-1):Number(g);let M=O?.schemaObject;if("union"===O?.schemaObject?.type){M=O.schemaObject.options.filter((g=>"nativeEnum"===g.type)).find((g=>L in g.values))}const J=M?.values[L];return{value:J}},getInput:({root:g})=>$e(g,"input.nativeEnumKey"),setValue({root:g,value:O}){const L=this.getInput({root:g});L.value=Object.entries(L.$schemaNativeEnumValues).find((([,g])=>g===O))?.[0]??"",L.value&&($e(g,".enumeratedValue").textContent=O)},getValue({root:g}){const{value:O,$schemaNativeEnumValues:L}=this.getInput({root:g});return L[O]},viewUI:({value:g,specificSchemaObject:O})=>["div",["Native enum: ",["span",{dataset:{type:"nativeEnum"},title:O?.description??"(a native enum)"},[g]]]],editUI(g){const{specificSchemaObject:O,value:L}=g,M=O?.values,J=Object.keys(M);let ae;M&&"value"in g&&(ae=Object.entries(M).find((([,g])=>g===L))?.[0]);const ie=J.map((g=>/^\d$/u.test(g)&&Object.values(M).includes(Number.parseInt(g))?null:escapeRegex(g))).filter(Boolean).join("|"),ne=jml("input",{class:"nativeEnumKey",placeholder:ie,title:ie,pattern:ie,value:ae??"",$on:{input(){const g=this.parentElement?.parentElement?.querySelector(".enumeratedValue");g.textContent=String(M[this.value]??"")}}});return ne.$schemaNativeEnumValues=M,["div",{dataset:{type:"nativeEnum"},title:O?.description??"Native Enum"},[["label",["Enumerated key ",ne]],["br"],"Enumerated value: ",["span",{class:"enumeratedValue"},[L??""]]]]}},symbolType={option:["Symbol"],stringRegex:/^(?<symbolClassType>Symbol|Symbol.for)\((?<innerContent>[^)]*)\)$/u,ct:0,valueMatch:g=>"symbol"==typeof g,toValue(g,O){const{groups:{symbolClassType:L}={}}=O.match;return{value:("Symbol"===L?Symbol:Symbol.for.bind(Symbol))(g)}},getInput:({root:g})=>$e(g,"input.symbolInput"),setValue({root:g,value:O}){Symbol.keyFor(O)?$e(g,'input[value="Symbol.for"]').checked=!0:$e(g,'input[value="Symbol"]').checked=!0,this.getInput({root:g}).value=String(O).slice(7,-1)},getValue({root:g}){return($e(g,'input[value="Symbol"]').checked?Symbol:Symbol.for.bind(Symbol))(this.getInput({root:g}).value)},viewUI:({value:g,specificSchemaObject:O})=>["span",{dataset:{type:"symbol"},title:O?.description??"(a Symbol)"},[void 0===Symbol.keyFor(g)?"":["b",["Global: "]],String(g).slice(7,-1)]],editUI({typeNamespace:g,specificSchemaObject:O,value:L=""}){return this.ct++,["div",{dataset:{type:"symbol"},title:O?.description??"(a Symbol)"},[["label",["Symbol()",["input",{type:"radio",name:`${g}-symbol${this.ct}`,value:"Symbol",checked:!L||!Symbol.keyFor(L)}]]],["label",["Symbol.for()",["input",{type:"radio",name:`${g}-symbol${this.ct}`,value:"Symbol.for",checked:L&&void 0!==Symbol.keyFor(L)}]]],["br"],["input",{className:"symbolInput",name:`${g}-symbol`,value:String(L).slice(7,-1)}]]]}},getTypeson=()=>{const structuredCloningFixed=se.filter((g=>!["imagedata","imagebitmap","cryptokey","domquad"].some((O=>Object.hasOwn(g,O)))));return structuredCloningFixed.splice(1,0,G),(new c).register([...structuredCloningFixed,z$1,q,{function:{test:g=>"function"==typeof g,replace:g=>"("+g.toString()+")",revive(o){return eval(o)}}}])},promiseType={option:["Promise"],regexEndings:[",",")"],stringRegexBegin:/^Promise\(/u,stringRegexEnd:/^\)/u,array:!0,valueMatch:g=>"Promise"===toStringTag(g),toValue(...g){const O=arrayType.toValue.apply(this,g);return{value:Promise.resolve(O.value[0]),remnant:O.remnant}},getInput({root:g}){const O=$e(g,"div[data-type]");return this.types?.getFormControlForRoot(O)},setValue({root:g,value:O}){setTimeout((async()=>{const L=await O,M=getTypeson(),J=await M.rootTypeName(L),ae=$e(g,"select");ae.value=J,ae.dispatchEvent(new Event("change"));const ie=$e(g,"div[data-type]");this.types?.setValue({type:J,root:ie,value:L});const ne=this.types?.getFormControlForRoot(ie);ne?.dispatchEvent(new Event("input")),ne?.blur()}))},getValue({root:g}){const O=$e(g,"div[data-type]");return Promise.resolve(this.types?.getValueForRoot(O))},viewUI({specificSchemaObject:g,types:O,value:L,...M}){const J=getTypeson(),ae=jml("span"),ie=jml("div");return(async()=>{const ne=await L,oe=await J.rootTypeName(ne);ae.textContent=oe;const pe=O.getTypeObject(oe);ie.append(jml(...pe.viewUI({specificSchemaObject:g,types:O,value:ne,...M})))})(),["span",{dataset:{type:"promise"},title:g?.description},["A Promise ",ae,ie]]},editUI({format:g,types:O,type:L,buildTypeChoices:M,specificSchemaObject:J,topRoot:ae,schemaContent:ie,typeNamespace:ne,value:oe}){this.types=O;const pe=jml("div",{dataset:{type:"promise"},title:J?.description??"(a Promise)"},["Promise ",...M({topRoot:ae,format:g,schemaOriginal:ie,schemaContent:J?.value??{type:"any"},state:L,typeNamespace:ne}).domArray]);return oe&&this.setValue&&this.setValue({root:pe,value:oe}),[pe]}},observerMap=new WeakMap,idRegex=String.raw`^(?:[$_\p{ID_Start}])(?:[$_\u200C\u200D\p{ID_Continue}])*$`,setTooltips=({root:g,specificSchemaObject:O,textareas:L,textareaBody:M})=>{M.title=`Return type:\n\n${JSON.stringify(O.returns,null,2)}`;const J=O.args;if(L.forEach(((g,O)=>{g.title=JSON.stringify(J.items[O]??J.rest,null,2)})),observerMap.has(g))return;const addTitles=O=>{if(O.nodeType!==Node.ELEMENT_NODE)return;if(O.querySelector("textarea")){$$e(g,"textarea").slice(0,-1).forEach(((g,O)=>{g.title=JSON.stringify(J.items[O]??J.rest,null,2)}))}},ae=new MutationObserver((g=>{for(const O of g)if("childList"===O.type){for(const g of O.removedNodes)addTitles(g);for(const g of O.addedNodes)addTitles(g)}}));ae.observe(g,{attributes:!1,childList:!0,subtree:!0}),observerMap.set(g,ae)},getArgsAndBodyOfFunction=g=>{const O=String(g),L=String(`(${O.trimStart().startsWith("function")?O:`function ${O}`})`),M=L.slice(L.indexOf("{")+1,L.lastIndexOf("}")).trim();return{args:parse(L,{ecmaVersion:"latest",sourceType:"module"}).body[0].expression.params.map((({name:g})=>g.trim())),body:M}},setValueAndTooltips=({root:g,value:O,specificSchemaObject:L})=>{const{args:M,body:J}=getArgsAndBodyOfFunction(O);setTimeout((()=>{let ae=$$e(g,'textarea[name$="-string"]');const ie=ae.pop();M.forEach(((O,L)=>{ae[L]||$e(g,".addArrayElement")?.click()})),setTimeout((()=>{ae=$$e(g,'textarea[name$="-string"]').slice(0,-1),O&&(M.forEach(((g,O)=>{ae[O].value=g})),ie.value=J),L&&setTooltips({root:g,specificSchemaObject:L,textareas:ae,textareaBody:ie})}))}))},functionType={option:["function"],regexEndings:["}"],stringRegexBegin:/^function\((?<args>[^)]*?)\) \{(?<returns>.*)\}$/u,stringRegexEnd:/^\}/u,array:!0,valueMatch:g=>"function"==typeof g,toValue(g,O){const{groups:{args:L,returns:M}={}}=O.match;return{value:new Function(...L.split(/\s*,\s*/u),M)}},getInput:({root:g})=>$e(g,"textarea"),setValue({root:g,value:O}){setValueAndTooltips({root:g,value:O})},getValue({root:g}){const O=$$e(g,"textarea"),L=O.pop();return new Function(...O.map((({value:g})=>g.trim())),L.value.trim())},viewUI({value:g,specificSchemaObject:O}){const{args:L,body:M}=getArgsAndBodyOfFunction(g);return["span",{dataset:{type:"function"},title:O?.description??"(a function)"},[["b",["Args"]]," ",`(${L.join(", ")})`,["br"],["b",["Body"]]," ",M]]},editUI({type:g,buildTypeChoices:O,specificSchemaObject:L,topRoot:M,typeNamespace:J,value:ae}){const ie=L?copyObject(L):void 0,ne=ie?.args??{type:"tuple",items:[],rest:{type:"any"}};ne.description="",ne.rest&&(ne.rest.description="Argument");const oe=ne.items.length,pe={type:"set",minSize:oe,maxSize:ne.rest?void 0:oe,value:{type:"string",regex:idRegex,flags:"v"}},le=jml("div",{dataset:{type:"function"}},[["b",["Arguments"]],["br"],...O({topRoot:M,format:"schema",schemaContent:pe,state:g,typeNamespace:J}).domArray,["b",["Function body"]],["br"],...O({topRoot:M,format:"schema",schemaContent:{type:"string"},state:g,typeNamespace:J}).domArray]);return ae?setTimeout((()=>{setValueAndTooltips({root:le,value:ae,specificSchemaObject:L})})):L&&setTimeout((()=>{setTimeout((()=>{const g=$$e(le,"textarea"),O=g.pop();setTooltips({root:le,specificSchemaObject:L,textareas:g,textareaBody:O})}))})),[le]}},getPropertyValueFromLegend=g=>{const O=$e(g,'*[data-prop="true"]');if(!O)throw new Error("No property on the supplied legend element");if("input"===O.nodeName.toLowerCase())return O.value;if(!O.textContent)throw new Error("No property with text present on the supplied legend element");return String(Number.parseInt(O.textContent)-1)};class Types{constructor(){this.formats=new Formats,this.customValidateAllReferences=void 0,this.availableTypes={null:nullType,true:trueType,false:falseType,nan:nanType,boolean:booleanType,number:numberType,bigint:bigintType,bigintObject:bigintObjectType,string:stringType,arrayReference:arrayReferenceType,objectReference:objectReferenceType,array:arrayType,tuple:tupleType,object:objectType,record:recordType,date:dateType,enum:enumType,userObject:["User objects"],undef:undefinedType,void:voidType,SpecialRealNumber:SpecialRealNumberSuperType,SpecialNumber:SpecialNumberSuperType,error:errorType,errors:errorsSpecialType,regexp:regexpType,BooleanObject:BooleanObjectType,NumberObject:NumberObjectType,StringObject:StringObjectType,literal:literalType,map:mapType,set:setType,file:fileType,filelist:filelistType,blob:blobType,blobHTML:blobHTMLType,domexception:domexceptionType,domrect:domrectType,dompoint:dompointType,dommatrix:dommatrixType,resurrectable:noneditableType,never:neverType,symbol:symbolType,promise:promiseType,function:functionType,catch:catchType,nativeEnum:nativeEnumType,buffersource:buffersourceType,dataview:{option:["DataView"]},imagedata:{option:["ImageData"]},imagebitmap:{option:["ImageBitmap"]},int8array:{option:["Int8Array"]},uint8array:{option:["Uint8Array"]},uint8clampedarray:{option:["Uint8ClampedArray"]},int16array:{option:["Int16Array"]},uint16array:{option:["Uint16Array"]},int32array:{option:["Int32Array"]},uint32array:{option:["Uint32Array"]},float32array:{option:["Float32Array"]},float64array:{option:["Float64Array"]},ValidDate:{valid:!0},arrayNonindexKeys:{sparse:!0}};(g=>{g.forEach((([g,O])=>{Object.assign(this.availableTypes[O],this.availableTypes[g])}))})([["date","ValidDate"],["array","arrayNonindexKeys"]]),this.contexts={},Object.entries(this.availableTypes).forEach((([g,O])=>{const L=g,{stateDependent:M}=O;M&&Object.entries(M).forEach((([g,O])=>{this.contexts[g]||(this.contexts[g]={});const{contexts:M,after:J}=O;M.forEach((O=>{this.contexts[g][O]||(this.contexts[g][O]=[]),this.contexts[g][O].push({type:L,after:J})}))}))}))}async getControlsForFormatAndValue(g,O,L){return(await this.formats.getControlsForFormatAndValue(this,g,O,L)).rootUI}getContextInfo(g,O){return this.contexts[g][O]}getValueForRoot(g,O,L){return this.availableTypes[Types.getTypeForRoot(g)].getValue({root:g,stateObj:O??{types:this},currentPath:L})}getFormControlForRoot(g){const O=this.availableTypes[Types.getTypeForRoot(g)];return O.getInput?O.getInput({root:g}):null}getValueFromRootAncestor(g,O){return this.getValueForRoot($e(g,"div[data-type]"),{...O,types:this,formats:this.formats})}getFormControlFromRootAncestor(g){const O=$e(g,"div[data-type]");return O?this.getFormControlForRoot(O):null}getOptionForType(g,O=void 0){const L=[...this.availableTypes[g].option];return O&&O.description&&(L[0]=`${L[0]} (${O.description})`),L[1]={value:g,...L[1]},L}getTypeOptionsForFormatAndState(g,O,L,M){const J=this.formats.getTypesAndSchemasForFormatAndState(this,g,O,L,M);if(!J)throw new Error("Unexpected type for format and state");return{typeOptions:J.types.map(((g,O)=>this.getOptionForType(g,J.schemaObjects[O]))),schemaObjects:J.schemaObjects}}getUIForModeAndType({readonly:g,resultType:O,typeNamespace:L,type:M,topRoot:J,bringIntoFocus:ae,buildTypeChoices:ie,format:ne,schemaContent:oe,value:pe,hasValue:le,replaced:ue,specificSchemaObject:de,schemaFallingBack:he}){const ye=this.availableTypes[M],me=le?{typeNamespace:L,type:M,buildTypeChoices:ie,format:ne,schemaContent:oe,resultType:O,topRoot:J,bringIntoFocus:ae,value:pe,replaced:ue,specificSchemaObject:de,schemaFallingBack:he,types:this}:{typeNamespace:L,type:M,buildTypeChoices:ie,format:ne,schemaContent:oe,resultType:O,topRoot:J,bringIntoFocus:ae,replaced:ue,specificSchemaObject:de,schemaFallingBack:he,types:this},fe=jml(...g?ye.viewUI(me):ye.editUI(me));if(!g&&ye.validate){ye.getInput({root:fe}).addEventListener("input",(()=>{this.validate({type:M,root:fe,topRoot:J})}))}return fe}validateAllReferences({topRoot:g}){g?(Object.values(this.availableTypes).forEach((O=>{const L=O;L.validateAll&&L.validateAll({topRoot:g,types:this})})),this.customValidateAllReferences&&this.customValidateAllReferences({topRoot:g})):console.log("No references present")}validate({type:g,root:O,topRoot:L,avoidReport:M}){const J=this.availableTypes[g];if(J.validate){const{valid:g,message:ae}=J.validate({root:O,topRoot:L}),ie=J.getInput({root:O});return ie.setCustomValidity(g?"":ae||"Invalid"),M||ie.reportValidity(),g}return!0}setValue({type:g,root:O,value:L}){const M=this.availableTypes[g];M.setValue&&M.setValue({root:O,value:L})}getValueForString(g,{format:O,state:L,endMatchTypeObjs:M=[],firstRun:J=!0,rootHolder:ae=[],parent:ie,parentPath:ne,schemaObject:oe,schemaOriginal:pe}){const le=this.formats.getTypesAndSchemasForFormatAndState(this,O,L,oe,pe)?.types;if(!le)throw new Error("Could not get types for format and state");const ue=Object.entries(this.availableTypes).filter((([g])=>le.includes(g))),de="|"+ue.map((([,g])=>g)).reduce(((g,O)=>{const L=O;let M=g;return L.regexEndings&&(M.push(...L.regexEndings),M=[...new Set(M)]),M}),[]).map((g=>escapeRegex(g))).join("|");let he=null,ye=ue.find((([,O])=>{const L=O;let{stringRegex:M}=L;return"function"==typeof L.stringRegex&&(M=L.stringRegex(!0)),M=M?new RegExp(M.source.slice(0,-1)+"(?=$"+de+")","u"):M,he=Boolean(M&&g)&&g.match(M),he})),me=!1;void 0===ye&&(ye=ue.find((([,O])=>{const L=O,{stringRegexBegin:J}=L;return he=Boolean(J&&g)&&g.match(J),he&&(me=!0,M.push(L)),he})));let fe=!0;if(void 0!==ye){const L=he,[pe,le]=L;let ue,de=g.slice(pe.length);g=g.slice(0,pe.length);try{const J=ye[1];if(!J.toValue)throw new Error("Type has no `toValue` method");ue=J.toValue(L.groups?.innerContent||le||g,{types:this,format:O,match:he,endMatchTypeObjs:M,remnant:de,rootHolder:ae,parent:ie,parentPath:ne,schemaObject:oe})}catch(g){throw console.log("eee",g),g}!1===ue.assign&&(fe=!1);const{value:ge}=ue;if(void 0!==ue.remnant&&({remnant:de}=ue),me&&M.length){const g=de.match(M.at(-1).stringRegexEnd);g&&(M.pop(),de=de.slice(g[0].length))}if(J){const g=(new c).register(se);try{const O=g.revive(ge);return ae.forEach((([g,L,M,J])=>{const ae=this.availableTypes[g+"Reference"].resolveReference(J,O),ie=getJSONType(ae);["array","object"].includes(g)&&ie===g&&(L[M]=ae)})),[O,de,me,fe]}catch(g){console.log("failed Typeson revival",g)}}return[ge,de,me,fe]}throw new Error("Bad parsing data")}getTypeObject(g){return this.availableTypes[g]}}function escapeRegex(g){return String(g).replaceAll(/[.\\+*?^[\]$(){}=!<>|:-]/gu,String.raw`\$&`)}Types.getTypeForRoot=g=>String(g?g.dataset.type:g),Types.validValuesSet=({form:g,typeNamespace:O,keySelectClass:L})=>{if(!g.offsetParent||!g.checkValidity())return!1;return $$e(g,L?`.${L}`:`.typeChoices-${O}`).every((g=>!g.offsetParent||""!==g.value&&g.$validate()))};const getFormatAndSchemaChoices=({schemas:g,selectedSchema:O,hasKeyPath:L,preselectSchema:M,arbitraryJS:J=!1}={})=>{const ae=g&&g.length;return[["JSON only",{value:"json"}],...L?[]:[["IndexedDB key",{value:"indexedDBKey"}]],["Structured Clone (via Typeson JSON)",{value:"structuredCloning",selected:!(M&&ae||J)}],...J?[["Arbitrary JavaScript Object",{value:"arbitraryJS",selected:!M||!ae}]]:[],...ae?g.map(((g,L)=>[`Schema: ${g}`,{value:"schema",dataset:{schema:g},selected:M?O?g===O:0===L:void 0}])):[]].map((([g,O])=>jml("option",O,[g]))).reduce(((g,O)=>(g.append(O),g)),document.createDocumentFragment())};async function formatAndTypeChoices({schemas:g,getSchemaContent:O,hasValue:L,singleValue:M,hasKeyPath:J,arbitraryJS:ae=!1,preselectSchema:ie=!0,typeNamespace:ne,selectedSchema:oe,formats:pe=new Formats,types:le=new Types}){const ue=ie&&g&&g.length?"schema":ae?"arbitraryJS":"structuredCloning",de=jml("select",{class:"formatChoices",hidden:M,$custom:{async $setFormat({valueFormat:g,autoTrigger:O,schema:L}){if(L){const g=[...this.options].findIndex((g=>g.dataset.schema===L));this.selectedIndex=-1===g?0:g}else g&&(this.value=g);await this.$buildTypeChoices(O)},async $buildTypeChoices(g){DOM.removeChildren(he);const{schema:M}=this.selectedOptions[0].dataset;jml({"#":buildTypeChoices({autoTrigger:g,topRoot:$e(he,"div[data-type]"),format:this.value,formats:pe,types:le,typeNamespace:ne,requireObject:J,objectHasValue:L,schema:M,schemaContent:M?await(O?.(M)):void 0}).domArray},he)}},$on:{async change(){await this.$buildTypeChoices()}}},[getFormatAndSchemaChoices({schemas:g,hasKeyPath:J,selectedSchema:oe,arbitraryJS:ae,preselectSchema:ie})]),he=jml("div",{class:"typesHolder",$custom:{$getTypeRoot(){return $e(this,"div[data-type]")},$getTypeSelect(){return $e(this,`.typeChoices-${ne}`)}}}),ye="schema"===ue?de.selectedOptions[0].dataset.schema:void 0;return jml({"#":buildTypeChoices({topRoot:$e(he,"div[data-type]"),format:ue,formats:pe,types:le,typeNamespace:ne,requireObject:J,objectHasValue:L,schema:ye,schemaContent:void 0===ye?void 0:await(O?.(ye))}).domArray},he),{formats:pe,types:le,formatChoices:de,typesHolder:he,domArray:[de,he],getValue(g,O){const L=he.$getTypeRoot();return le.getValueForRoot(L,{typeNamespace:ne,format:de.value,formats:pe,types:le,...g},O)},getType(){const g=he.$getTypeRoot();return Types.getTypeForRoot(g)},validValuesSet(){const g=he.$getTypeRoot().closest("form");return Types.validValuesSet({form:g,typeNamespace:ne})},async setValue(g,O){const L=(await pe.getControlsForFormatAndValue(le,de.value,g,O)).rootUI,M=Types.getTypeForRoot(L);he.$getTypeSelect().$addTypeAndEditUI({type:M,editUI:L})}}}export{Formats,Types,formatAndTypeChoices,getFormatAndSchemaChoices,getTypesForSchema,buildTypeChoices as typeChoices};
|
|
1
|
+
import"react";let win;"undefined"!=typeof window&&window&&(win=window);let doc="undefined"!=typeof document&&document||win?.document;const possibleOptions=["$plugins","$map"],NS_HTML="http://www.w3.org/1999/xhtml",hyphenForCamelCase=/-([a-z])/gu,ATTR_MAP=new Map([["maxlength","maxLength"],["minlength","minLength"],["readonly","readOnly"]]),BOOL_ATTS=["checked","defaultChecked","defaultSelected","disabled","indeterminate","open","readOnly","selected"],ATTR_DOM=[...BOOL_ATTS,"accessKey","async","autocapitalize","autofocus","contentEditable","defaultValue","defer","draggable","formnovalidate","hidden","innerText","inputMode","ismap","multiple","novalidate","pattern","required","spellcheck","translate","value","willvalidate"],NULLABLES=["autocomplete","dir","integrity","lang","max","min","minLength","maxLength","title"],$$2=g=>{if(!doc)throw new Error("No document object");return doc.querySelector(g)};function _getHTMLNodeName(g){return g.nodeName&&g.nodeName.toLowerCase()}function _appendNode(g,O){"template"!==_getHTMLNodeName(g)?g.append(O):g.content.append(O)}function _addEvent(g,O,L,M){g.addEventListener(O,L,Boolean(M))}function _createSafeReference(g,O,L){if(!doc)throw new Error("No document defined");if(!/^\w+$/u.test(L))throw new TypeError(`Bad ${g} reference; with prefix "${O}" and arg "${L}"`);const M=doc.createElement("div");return M.innerHTML="&"+O+L+";",doc.createTextNode(M.innerHTML)}function _upperCase(g,O){return O.toUpperCase()}function _isNullish(g){return null==g}function _getType(g){const O=typeof g;if("string"==typeof g||void 0===g)return"string";if("object"===O){if(null===g)return"null";if(Array.isArray(g))return"array";if("nodeType"in g)switch(g.nodeType){case 1:return"element";case 9:return"document";case 11:return"fragment";default:return"non-container node"}}return O}function _fragReducer(g,O){return g.append(O),g}function _replaceDefiner(g){return function(...O){const L=O[0];let M=g[""]?' xmlns="'+g[""]+'"':L;for(const[O,L]of Object.entries(g))""!==O&&(M+=" xmlns:"+O+'="'+L+'"');return M}}function _childrenToJML(g){return function(O,L){const M=g.childNodes[L],J=Array.isArray(O)?jml(...O):jml(O);M.replaceWith(J)}}function _appendJML(g){return function(O){if("string"==typeof O||"number"==typeof O)throw new TypeError("Unexpected text string/number in the head");Array.isArray(O)?g.append(jml(...O)):"object"==typeof O&&"nodeType"in O?g.append(O):g.append(jml(O))}}function _appendJMLOrText(g){return function(O){"string"==typeof O||"number"==typeof O?g.append(String(O)):Array.isArray(O)?g.append(jml(...O)):"object"==typeof O&&"nodeType"in O?g.append(O):g.append(jml(O))}}function checkPluginValue(g,O,L,M,J){if(M.$state=J??"attributeValue",L&&"object"==typeof L){const J=getMatchingPlugin(M,Object.keys(L)[0]);if(J)return J.set({opts:M,element:g,attribute:{name:O,value:L}})}return L}function getMatchingPlugin(g,O){return g.$plugins&&g.$plugins.find((g=>g.name===O))}const jml=function jml(...g){if(!win)throw new Error("No window object");if(!doc)throw new Error("No document object");let O=doc.createDocumentFragment();function _checkAtts(ae){if(!doc)throw new Error("No document object");for(let[ie,ne]of Object.entries(ae))if(ie=ATTR_MAP.get(ie)??ie,NULLABLES.includes(ie))ne=checkPluginValue(O,ie,ne,J),_isNullish(ne)||(O[ie]=ne);else if(ATTR_DOM.includes(ie))ne=checkPluginValue(O,ie,ne,J),O[ie]=ne;else switch(ie){case"#":J.$state="fragmentChildren",L[L.length]=jml(J,ne);break;case"$shadow":{const{open:g,closed:L}=ne;let{content:M,template:J}=ne;const ae=O.attachShadow({mode:L||!1===g?"closed":"open"});J?(Array.isArray(J)?J="object"===_getType(J[0])?jml("template",...J,doc.body):jml("template",J,doc.body):"string"==typeof J&&(J=$$2(J)),jml(J.content.cloneNode(!0),ae)):(M||!0!==g&&(M=g||"boolean"==typeof L?M:L),M&&"boolean"!=typeof M&&(Array.isArray(M)?jml({"#":M},ae):jml(M,ae)));break}case"$state":case"is":case"xmlns":break;case"$custom":Object.assign(O,ne);break;case"$define":{if(!("localName"in O))throw new Error("Element expected for `$define`");const L=O.localName.toLowerCase(),M=!L.includes("-");let ie;if(M&&(ie=O.getAttribute("is"),!ie)){if(!Object.hasOwn(ae,"is"))throw new TypeError(`Expected \`is\` with \`$define\` on built-in; args: ${JSON.stringify(g)}`);ae.is=checkPluginValue(O,"is",ae.is,J),O.setAttribute("is",ae.is),({is:ie}=ae)}const oe=M?ie:L;if(window.customElements.get(oe))break;const getConstructor=g=>{if(!doc)throw new Error("No document object");const O="object"==typeof le&&"string"==typeof le.extends?doc.createElement(le.extends).constructor:M?doc.createElement(L).constructor:window.HTMLElement;return g?class extends O{constructor(){super(),g.call(this)}}:class extends O{}};let pe,le,ue;const de=ne;Array.isArray(de)?de.length<=2?([pe,le]=de,"string"==typeof le?le={extends:le}:le&&!Object.hasOwn(le,"extends")&&(ue=le),"object"==typeof pe&&(ue=pe,pe=getConstructor())):([pe,ue,le]=de,"string"==typeof le&&(le={extends:le})):"function"==typeof de?pe=de:(ue=de,pe=getConstructor()),pe.toString().startsWith("class")||(pe=getConstructor(pe)),!le&&M&&(le={extends:L}),ue&&Object.entries(ue).forEach((([g,O])=>{pe.prototype[g]=O})),window.customElements.define(oe,pe,"object"==typeof le?le:void 0);break}case"$symbol":{const[g,L]=ne;if("function"==typeof L){const M=L.bind(O);"string"==typeof g?O[Symbol.for(g)]=M:O[g]=M}else{const M=L;M.elem=O,"string"==typeof g?O[Symbol.for(g)]=M:O[g]=M}break}case"$data":setMap(ne);break;case"$attribute":{const g=ne,O=3===g.length?doc.createAttributeNS(g[0],g[1]):doc.createAttribute(g[0]);O.value=g[g.length-1],L[L.length]=O;break}case"$text":{const g=doc.createTextNode(ne);L[L.length]=g;break}case"$document":{const g=doc.implementation.createHTMLDocument();if(!ne)throw new Error("Bad attribute value");const O=ne;if(O.childNodes){const L=O.childNodes.length;for(;g.childNodes[L];){g.childNodes[L].remove()}O.childNodes.forEach(_childrenToJML(g))}else{if(O.$DOCTYPE){const L={$DOCTYPE:O.$DOCTYPE},M=jml(L);g.firstChild?.replaceWith(M)}const L=g.querySelector("html"),M=L?.querySelector("head"),J=L?.querySelector("body");if(O.title||O.head){const L=doc.createElement("meta");L.setAttribute("charset","utf-8"),M?.append(L),O.title&&(g.title=O.title),O.head&&M&&O.head.forEach(_appendJML(M))}O.body&&J&&O.body.forEach(_appendJMLOrText(J))}L[L.length]=g;break}case"$DOCTYPE":{const g=ne,O=doc.implementation.createDocumentType(g.name,g.publicId||"",g.systemId||"");L[L.length]=O;break}case"$on":for(let[L,M]of Object.entries(ne||{})){if("function"==typeof M&&(M=[M,!1]),"function"!=typeof M[0])throw new TypeError(`Expect a function for \`$on\`; args: ${JSON.stringify(g)}`);_addEvent(O,L,M[0],M[1])}break;case"className":case"class":ne=checkPluginValue(O,ie,ne,J),_isNullish(ne)||(O.className=ne);break;case"dataset":{const recurse=(g,L)=>{let M="";const J=""!==L;Object.keys(g).forEach((ae=>{const ie=g[ae];if(M=J?L+ae.replace(hyphenForCamelCase,_upperCase).replace(/^([a-z])/u,_upperCase):L+ae.replace(hyphenForCamelCase,_upperCase),null===ie||"object"!=typeof ie)return _isNullish(ie)||(O.dataset[M]=ie),void(M=L);recurse(ie,M)}))};recurse(ne,"");break}case"innerHTML":_isNullish(ne)||(O.innerHTML=ne);break;case"htmlFor":case"for":if("label"===M){ne=checkPluginValue(O,ie,ne,J),_isNullish(ne)||(O.htmlFor=ne);break}ne=checkPluginValue(O,ie,ne,J),O.setAttribute(ie,ne);break;default:{if(ie.startsWith("on")){ne=checkPluginValue(O,ie,ne,J),O[ie]=ne;break}if("style"===ie){if(ne=checkPluginValue(O,ie,ne,J),_isNullish(ne))break;if("object"==typeof ne){for(const[g,L]of Object.entries(ne))_isNullish(L)||("float"===g?(O.style.cssFloat=L,O.style.styleFloat=L):O.style[g.replace(hyphenForCamelCase,_upperCase)]=L);break}O.setAttribute(ie,ne);break}const g=ie,M=getMatchingPlugin(J,g);if(M){M.set({opts:J,element:L[0],attribute:{name:g,value:ne}});break}ne=checkPluginValue(O,ie,ne,J),O.setAttribute(ie,ne);break}}}const L=[];let M,J,ae=!1,ie=0;if("object"===_getType(g[0])&&Object.keys(g[0]).some((g=>possibleOptions.includes(g)))){if(J=g[0],void 0===J.$state&&(ae=!0,J.$state="root"),Array.isArray(J.$map)&&(J.$map={root:J.$map}),"$plugins"in J){if(!Array.isArray(J.$plugins))throw new TypeError(`\`$plugins\` must be an array; args: ${JSON.stringify(g)}`);J.$plugins.forEach((O=>{if(!O||"object"!=typeof O)throw new TypeError(`Plugin must be an object; args: ${JSON.stringify(g)}`);if(!O.name||!O.name.startsWith("$_"))throw new TypeError(`Plugin object name must be present and begin with \`$_\`; args: ${JSON.stringify(g)}`);if("function"!=typeof O.set)throw new TypeError(`Plugin object must have a \`set\` method; args: ${JSON.stringify(g)}`)}))}ie=1}else J={$state:void 0};const ne=g.length,oe=J.$map&&J.$map.root,setMap=g=>{let L,M;const ae=oe;if(!0===g)[L,M]=ae;else if(Array.isArray(g)){if("string"==typeof g[0])return void g.forEach((g=>{setMap(J.$map[g])}));L=g[0]||ae[0],M=g[1]||ae[1]}else/^\[object (?:Weak)?Map\]$/u.test([].toString.call(g))?(L=g,M=ae[1]):(L=ae[0],M=g);L.set(O,M)};for(let ae=ie;ae<ne;ae++){let ie=g[ae];const oe=_getType(ie);switch(oe){case"null":if(ae===ne-1)return L.length<=1?L[0]:L.reduce(_fragReducer,doc.createDocumentFragment());throw new TypeError(`\`null\` values not allowed except as final Jamilih argument; index ${ae} on args: ${JSON.stringify(g)}`);case"string":switch(ie){case"!":L[L.length]=doc.createComment(g[++ae]);break;case"?":{ie=g[++ae];let O=g[++ae];const M=O;if(M&&"object"==typeof M){const g=[];for(const[O,L]of Object.entries(M))g.push(O+'="'+L.replace(/"/gu,""")+'"');O=g.join(" ")}try{L[L.length]=doc.createProcessingInstruction(ie,O)}catch(g){L[L.length]=doc.createComment("?"+ie+" "+O+"?")}break}case"&":L[L.length]=_createSafeReference("entity","",g[++ae]);break;case"#":L[L.length]=_createSafeReference("decimal",ie,String(g[++ae]));break;case"#x":L[L.length]=_createSafeReference("hexadecimal",ie,g[++ae]);break;case"![":try{L[L.length]=doc.createCDATASection(g[++ae])}catch(O){L[L.length]=doc.createTextNode(g[ae])}break;case"":L[L.length]=O=doc.createDocumentFragment(),J.$state="fragment";break;default:{M=ie;const ne=g[ae+1];if(ne&&"object"===_getType(ne)&&ne.is){const{is:g}=ne;O=doc.createElementNS?doc.createElementNS(NS_HTML,M,{is:g}):doc.createElement(M,{is:g})}else O=doc.createElementNS?doc.createElementNS(NS_HTML,M):doc.createElement(M);J.$state="element",L[L.length]=O;break}}break;case"object":{if(!ie||"object"!=typeof ie)throw new Error("Null should not reach here");const g=ie;if("xmlns"in g){const M=g,ae=M.xmlns&&"object"==typeof M.xmlns?_replaceDefiner(M.xmlns):' xmlns="'+M.xmlns+'"';O=L[L.length-1]=(new win.DOMParser).parseFromString((new win.XMLSerializer).serializeToString(O).replace(' xmlns="'+NS_HTML+'"',ae),"application/xml").documentElement,J.$state="element"}_checkAtts(g);break}case"document":case"fragment":case"element":if(0===ae&&(O=ie,J.$state="element"),ae===ne-1||ae===ne-2&&null===g[ae+1]){const g=L.length;for(let O=0;O<g;O++)_appendNode(ie,L[O])}else L[L.length]=ie;break;case"array":{const L=ie,M=L.length;for(let ae=0;ae<M;ae++){const M=L[ae],ie=typeof M;if(null===M||_isNullish(M))throw new TypeError(`Bad children (parent array: ${JSON.stringify(g)}; index ${ae} of child: ${JSON.stringify(L)})`);switch(ie){case"string":case"number":case"boolean":_appendNode(O,doc.createTextNode(String(M)));break;default:if("object"!=typeof M)throw new TypeError(`Bad children (parent array: ${JSON.stringify(g)}; index ${ae} of child: ${JSON.stringify(L)})`);if(Array.isArray(M))J.$state="children",_appendNode(O,jml(J,...M));else if("#"in M)J.$state="fragmentChildren",_appendNode(O,jml(J,M["#"]));else{let g;"nodeType"in M||(g=checkPluginValue(O,null,M,J,"children")),_appendNode(O,g||M)}}}break}default:throw new TypeError(`Unexpected type: ${oe}; arg: ${ie}; index ${ae} on args: ${JSON.stringify(g)}`)}}const pe=L[0]||O;return ae&&J.$map&&J.$map.root&&setMap(!0),pe};let DOMException$1=class DOMException extends Error{constructor(g,O){super(g),this.code=0,this.name=O}},body;jml.toJML=function(g,{stringOutput:O=!1,reportInvalidState:L=!0,stripWhitespace:M=!1}={}){if(!win)throw new Error("No window object set");"string"==typeof g&&(g=(new win.DOMParser).parseFromString(g,"text/html"));const J=[];let ae=J,ie=0;function invalidStateError(g){if(L){const O=new DOMException$1(g,"INVALID_STATE_ERR");throw O.code=11,O}}function set(g){ae[ie]=g,ie++}function setChildren(){set([]),ae=ae[ie-1],ie=0}function setObj(g,O){ae=ae[ie-1][g],ie=0,O&&(ae=ae[O])}return function parseDOM(g,O){const L="nodeType"in g?g.nodeType:null;if(!L)throw new TypeError("Not an XML type");if(5===L)return void set(["&",g.nodeName]);let J,ne;function setTemp(){J=ae,ne=ie}function resetTemp(){ae=J,ie=ne,ie++}switch(O={...O},[2,3,4,7,8].includes(L)&&g.nodeValue&&!/^([\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD]|[\uD800-\uDBFF][\uDC00-\uDFFF])*$/u.test(g.nodeValue)&&invalidStateError("Node has bad XML character value"),L){case 1:{const L=g;setTemp();const M=L.nodeName.toLowerCase();setChildren(),set(M);const J={};let ae=!1;O[L.prefix||""]!==L.namespaceURI&&(O[L.prefix||""]=L.namespaceURI,L.prefix?J["xmlns:"+L.prefix]=L.namespaceURI:L.namespaceURI?J.xmlns=L.namespaceURI:J.xmlns=null,ae=!0),L.attributes.length?set([...L.attributes].reduce((function(g,O){return g[O.name]=O.value,g}),J)):ae&&set(J);const{childNodes:ie}=L;ie.length&&(setChildren(),[...ie].forEach((function(g){parseDOM(g,O)}))),resetTemp();break}case 2:{const O=g;set({$attribute:[O.namespaceURI,O.name,O.value]});break}case 3:{const O=g;if(!O.nodeValue)throw new Error("Unexpected null comment value");if(M&&/^\s+$/u.test(O.nodeValue))return void set("");set(O.nodeValue);break}case 4:{const O=g;O.nodeValue?.includes("]]>")&&invalidStateError("CDATA cannot end with closing ]]>"),set(["![",O.nodeValue]);break}case 7:{const O=g;/^xml$/iu.test(O.target)&&invalidStateError('Processing instructions cannot be "xml".'),O.target.includes("?>")&&invalidStateError("Processing instruction targets cannot include ?>"),O.target.includes(":")&&invalidStateError('The processing instruction target cannot include ":"'),O.data.includes("?>")&&invalidStateError("Processing instruction data cannot include ?>"),set(["?",O.target,O.data]);break}case 8:{const O=g;if(!O.nodeValue)throw new Error("Unexpected null comment value");(O.nodeValue.includes("--")||O.nodeValue.length&&O.nodeValue.lastIndexOf("-")===O.nodeValue.length-1)&&invalidStateError("Comments cannot include --"),set(["!",O.nodeValue]);break}case 9:{const L=g;setTemp();set({$document:{childNodes:[]}}),setObj("$document","childNodes");const{childNodes:M}=L;M.length||invalidStateError("Documents must have a child node"),[...M].forEach((function(g){parseDOM(g,O)})),resetTemp();break}case 10:{const O=g;setTemp();const L={$DOCTYPE:{name:O.name}};/^(\u0020|\u000D|\u000A|[a-zA-Z0-9]|[-'()+,./:=?;!*#@$_%])*$/u.test(O.publicId)||invalidStateError("A publicId must have valid characters."),function addExternalID(g,O){O.systemId.includes('"')&&O.systemId.includes("'")&&invalidStateError("systemId cannot have both single and double quotes.");const{publicId:L,systemId:M}=O;M&&(g.systemId=M),L&&(g.publicId=L)}(L.$DOCTYPE,O),set(L),resetTemp();break}case 11:{const L=g;setTemp(),set({"#":[]}),setObj("#");const{childNodes:M}=L;[...M].forEach((function(g){parseDOM(g,O)})),resetTemp();break}default:throw new TypeError("Not an XML type")}}(g,{}),O?JSON.stringify(J[0]):J[0]},jml.toJMLString=function(g,O){return jml.toJML(g,Object.assign(O||{},{stringOutput:!0}))},jml.toDOM=function(...g){return jml(...g)},jml.toHTML=function(...g){const O=jml(...g);switch(O.nodeType){case 1:return O.outerHTML;case 2:return`${O.name}="${O.value.replace(/"/gu,""")}"`;case 3:if(!O.nodeValue)throw new TypeError("Unexpected null Text node");return O.nodeValue;case 9:case 11:return[...O.childNodes].map((g=>jml.toHTML(g))).join("");case 10:{const g=O;return`<!DOCTYPE ${g.name}${g.publicId?` PUBLIC "${g.publicId}" "${g.systemId}"`:g.systemId?` SYSTEM "${g.systemId}"`:""}>`}default:throw new Error("Unexpected node type")}},jml.toDOMString=function(...g){return jml.toHTML(...g)},jml.toXML=function(...g){if(!win)throw new Error("No window object set");const O=jml(...g);return(new win.XMLSerializer).serializeToString(O)},jml.toXMLDOMString=function(...g){return jml.toXML(...g)};class JamilihMap extends Map{get(g){const O="string"==typeof g?$$2(g):g;return super.get.call(this,O)}set(g,O){const L="string"==typeof g?$$2(g):g;return super.set.call(this,L,O)}invoke(g,O,...L){const M="string"==typeof g?$$2(g):g;return this.get(M)[O](M,...L)}}class JamilihWeakMap extends WeakMap{get(g){const O="string"==typeof g?$$2(g):g;if(!O)throw new Error("Can't find the element");return super.get.call(this,O)}set(g,O){const L="string"==typeof g?$$2(g):g;if(!L)throw new Error("Can't find the element");return super.set.call(this,L,O)}invoke(g,O,...L){const M="string"==typeof g?$$2(g):g;if(!M)throw new Error("Can't find the element");return this.get(M)[O](M,...L)}}jml.Map=JamilihMap,jml.WeakMap=JamilihWeakMap,jml.weak=function(g,...O){const L=new JamilihWeakMap;return[L,jml({$map:[L,g]},...O)]},jml.strong=function(g,...O){const L=new JamilihMap;return[L,jml({$map:[L,g]},...O)]},jml.symbol=jml.sym=jml.for=function(g,O){return("string"==typeof g?$$2(g):g)["symbol"==typeof O?O:Symbol.for(O)]},jml.command=function(g,O,L,...M){if(!(g="string"==typeof g?$$2(g):g))throw new Error("No element found");let J;if(["symbol","string"].includes(typeof O))return J=jml.sym(g,O),"function"==typeof J?J(L,...M):J[L](...M);if(J=O.get(g),!J)throw new Error("No map found");return"function"==typeof J?J.call(g,L,...M):J[L](g,...M)},jml.setWindow=g=>{win=g,doc=win?.document,doc&&doc.body&&(body=doc.body)},jml.getWindow=()=>{if(!win)throw new Error("No window object set");return win},doc&&doc.body&&(body=doc.body);const nbsp$1=" ";function ownKeys(g,O){var L=Object.keys(g);if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(g);O&&(M=M.filter((function(O){return Object.getOwnPropertyDescriptor(g,O).enumerable}))),L.push.apply(L,M)}return L}function _objectSpread2(g){for(var O=1;O<arguments.length;O++){var L=null!=arguments[O]?arguments[O]:{};O%2?ownKeys(Object(L),!0).forEach((function(O){_defineProperty(g,O,L[O])})):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(L)):ownKeys(Object(L)).forEach((function(O){Object.defineProperty(g,O,Object.getOwnPropertyDescriptor(L,O))}))}return g}function _typeof(g){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"==typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},_typeof(g)}function _classCallCheck(g,O){if(!(g instanceof O))throw new TypeError("Cannot call a class as a function")}function _createClass(g,O,L){return O&&function _defineProperties(g,O){for(var L=0;L<O.length;L++){var M=O[L];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(g,_toPropertyKey(M.key),M)}}(g.prototype,O),Object.defineProperty(g,"prototype",{writable:!1}),g}function _defineProperty(g,O,L){return(O=_toPropertyKey(O))in g?Object.defineProperty(g,O,{value:L,enumerable:!0,configurable:!0,writable:!0}):g[O]=L,g}function _slicedToArray(g,O){return function _arrayWithHoles(g){if(Array.isArray(g))return g}(g)||function _iterableToArrayLimit(g,O){var L=null==g?null:"undefined"!=typeof Symbol&&g[Symbol.iterator]||g["@@iterator"];if(null!=L){var M,J,ae,ie,ne=[],oe=!0,pe=!1;try{if(ae=(L=L.call(g)).next,0===O){if(Object(L)!==L)return;oe=!1}else for(;!(oe=(M=ae.call(L)).done)&&(ne.push(M.value),ne.length!==O);oe=!0);}catch(g){pe=!0,J=g}finally{try{if(!oe&&null!=L.return&&(ie=L.return(),Object(ie)!==ie))return}finally{if(pe)throw J}}return ne}}(g,O)||_unsupportedIterableToArray(g,O)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(g,O){if(g){if("string"==typeof g)return _arrayLikeToArray(g,O);var L=Object.prototype.toString.call(g).slice(8,-1);return"Object"===L&&g.constructor&&(L=g.constructor.name),"Map"===L||"Set"===L?Array.from(g):"Arguments"===L||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L)?_arrayLikeToArray(g,O):void 0}}function _arrayLikeToArray(g,O){(null==O||O>g.length)&&(O=g.length);for(var L=0,M=new Array(O);L<O;L++)M[L]=g[L];return M}function _toPropertyKey(g){var O=function _toPrimitive(g,O){if("object"!=typeof g||null===g)return g;var L=g[Symbol.toPrimitive];if(void 0!==L){var M=L.call(g,O);if("object"!=typeof M)return M;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(g)}(g,"string");return"symbol"==typeof O?O:String(O)}var e=_createClass((function TypesonPromise(g){_classCallCheck(this,TypesonPromise),this.p=new Promise(g)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(g,O){var L=this;return new e((function(M,J){L.p.then((function(O){M(g?g(O):O)})).catch((function(g){return O?O(g):Promise.reject(g)})).then(M,J)}))},e.prototype.catch=function(g){return this.then((function(){}),g)},e.resolve=function(g){return new e((function(O){O(g)}))},e.reject=function(g){return new e((function(O,L){L(g)}))},e.all=function(g){return new e((function(O,L){Promise.all(g.map((function(g){return null!=g&&g.constructor&&"__typeson__type__"in g.constructor&&"TypesonPromise"===g.constructor.__typeson__type__?g.p:g}))).then(O,L)}))},e.race=function(g){return new e((function(O,L){Promise.race(g.map((function(g){return null!=g&&g.constructor&&"__typeson__type__"in g.constructor&&"TypesonPromise"===g.constructor.__typeson__type__?g.p:g}))).then(O,L)}))},e.allSettled=function(g){return new e((function(O,L){Promise.allSettled(g.map((function(g){return null!=g&&g.constructor&&"__typeson__type__"in g.constructor&&"TypesonPromise"===g.constructor.__typeson__type__?g.p:g}))).then(O,L)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(g,O){return isObject(g)&&"function"==typeof g.then&&!O}function toStringTag(g){return Object.prototype.toString.call(g).slice(8,-1)}function hasConstructorOf(g,O){if(!g||"object"!==_typeof(g))return!1;var L=r(g);if(!L)return null===O;var M=t(L,"constructor")&&L.constructor;return"function"!=typeof M?null===O:O===M||null!==O&&Function.prototype.toString.call(M)===Function.prototype.toString.call(O)||"function"==typeof O&&"string"==typeof M.__typeson__type__&&M.__typeson__type__===O.__typeson__type__}function isPlainObject(g){return!(!g||"Object"!==toStringTag(g))&&(!r(g)||hasConstructorOf(g,Object))}function isUserObject(g){if(!g||"Object"!==toStringTag(g))return!1;var O=r(g);return!O||hasConstructorOf(g,Object)||isUserObject(O)}function isObject(g){return null!==g&&"object"===_typeof(g)}function escapeKeyPathComponent(g){return g.replaceAll("''","''''").replace(/^$/,"''").replaceAll("~","~0").replaceAll(".","~1")}function unescapeKeyPathComponent(g){return g.replaceAll("~1",".").replaceAll("~0","~").replace(/^''$/,"").replaceAll("''''","''")}function getByKeyPath(g,O){if(""===O)return g;if(null===g||"object"!==_typeof(g))throw new TypeError("Unexpected non-object type");var L=O.indexOf(".");if(L>-1){var M=g[unescapeKeyPathComponent(O.slice(0,L))];return void 0===M?void 0:getByKeyPath(M,O.slice(L+1))}return g[unescapeKeyPathComponent(O)]}function setAtKeyPath(g,O,L){if(""===O)return L;if(!g||"object"!==_typeof(g))throw new TypeError("Unexpected non-object type");var M=O.indexOf(".");return M>-1?setAtKeyPath(g[unescapeKeyPathComponent(O.slice(0,M))],O.slice(M+1),L):(g[unescapeKeyPathComponent(O)]=L,g)}function getJSONType(g){return null===g?"null":Array.isArray(g)?"array":_typeof(g)}function _await(g,O,L){return g&&g.then||(g=Promise.resolve(g)),O?g.then(O):g}var n=Object.keys,a=Object.hasOwn,o=Array.isArray,i$1=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(g){return function(){for(var O=[],L=0;L<arguments.length;L++)O[L]=arguments[L];try{return Promise.resolve(g.apply(this,O))}catch(g){return Promise.reject(g)}}}function nestedPathsFirst(g,O){var L,M;if(""===g.keypath)return-1;var J=null!==(L=g.keypath.match(/\./g))&&void 0!==L?L:0,ae=null!==(M=O.keypath.match(/\./g))&&void 0!==M?M:0;return J&&(J=J.length),ae&&(ae=ae.length),J>ae?-1:J<ae?1:g.keypath<O.keypath?-1:g.keypath>O.keypath?1:0}var c=function(){function Typeson(g){_classCallCheck(this,Typeson),this.options=g,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return _createClass(Typeson,[{key:"stringify",value:function stringify(g,O,L,M){M=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),M),{},{stringification:!0});var J=this.encapsulate(g,null,M);return o(J)?JSON.stringify(J[0],O,L):J.then((function(g){return JSON.stringify(g,O,L)}))}},{key:"stringifySync",value:function stringifySync(g,O,L,M){return this.stringify(g,O,L,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},M),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(g,O,L,M){return this.stringify(g,O,L,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},M),{},{sync:!1}))}},{key:"parse",value:function parse(g,O,L){return L=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),L),{},{parse:!0}),this.revive(JSON.parse(g,O),L)}},{key:"parseSync",value:function parseSync(g,O,L){return this.parse(g,O,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},L),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(g,O,L){return this.parse(g,O,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},L),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(g,O){var L=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return L.returnTypeNames=!0,this.encapsulate(g,O,L)}},{key:"rootTypeName",value:function rootTypeName(g,O){var L=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return L.iterateNone=!0,this.encapsulate(g,O,L)}},{key:"encapsulate",value:function encapsulate(g,O,L){var M=this,J=_objectSpread2(_objectSpread2({sync:!0},this.options),L),ae=J.sync,ie={},ne=[],oe=[],pe=[],le=!("cyclic"in J)||J.cyclic,ue=J.encapsulateObserver,de=function finish(g){var O=Object.values(ie);if(J.iterateNone)return O.length?O[0]:getJSONType(g);if(O.length){if(J.returnTypeNames)return function _toConsumableArray(g){return function _arrayWithoutHoles(g){if(Array.isArray(g))return _arrayLikeToArray(g)}(g)||function _iterableToArray(g){if("undefined"!=typeof Symbol&&null!=g[Symbol.iterator]||null!=g["@@iterator"])return Array.from(g)}(g)||_unsupportedIterableToArray(g)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(O));g&&isPlainObject(g)&&!a(g,"$types")?g.$types=ie:g={$:g,$types:{$:ie}}}else isObject(g)&&a(g,"$types")&&(g={$:g,$types:!0});return!J.returnTypeNames&&g},he=_async((function(g,O){return _await(Promise.all(O.map((function(g){return g[1].p}))),(function(L){return _await(Promise.all(L.map(_async((function(L){var M=!1,J=[],ae=_slicedToArray(O.splice(0,1),1),ie=_slicedToArray(ae[0],7),ne=ie[0],oe=ie[2],pe=ie[3],le=ie[4],ue=ie[5],de=ie[6],ye=me(ne,L,oe,pe,J,!0,de),fe=hasConstructorOf(ye,e);return function _invoke(g,O){var L=g();return L&&L.then?L.then(O):O(L)}((function(){if(ne&&fe)return _await(ye.p,(function(O){le[ue]=O;var L=he(g,J);return M=!0,L}))}),(function(O){return M?O:(ne?le[ue]=ye:g=fe?ye.p:ye,he(g,J))}))})))),(function(){return g}))}))})),ye=function _adaptBuiltinStateObjectProperties(g,O,L){Object.assign(g,O);var M=i$1.map((function(O){var L=g[O];return delete g[O],L}));L(),i$1.forEach((function(O,L){g[O]=M[L]}))},me=function _encapsulate(g,O,L,ae,pe,le,de){var he,me={},ge=_typeof(O),ve=ue?function(M){var J,ie=null!==(J=null!=de?de:ae.type)&&void 0!==J?J:getJSONType(O);ue(Object.assign(null!=M?M:me,{keypath:g,value:O,cyclic:L,stateObj:ae,promisesData:pe,resolvingTypesonPromise:le,awaitingTypesonPromise:hasConstructorOf(O,e)},{type:ie}))}:null;if(["string","boolean","number","undefined"].includes(ge))return void 0===O||Number.isNaN(O)||O===Number.NEGATIVE_INFINITY||O===Number.POSITIVE_INFINITY||0===O?(he=ae.replaced?O:fe(g,O,ae,pe,!1,le,ve))!==O&&(me={replaced:he}):he=O,ve&&ve(),he;if(null===O)return ve&&ve(),O;if(L&&!ae.iterateIn&&!ae.iterateUnsetNumeric&&O&&"object"===_typeof(O)){var be=ne.indexOf(O);if(!(be<0))return ie[g]="#",ve&&ve({cyclicKeypath:oe[be]}),"#"+oe[be];!0===L&&(ne.push(O),oe.push(g))}var xe,Se,Te=isPlainObject(O),Ie=o(O),we=(Te||Ie)&&(!M.plainObjectReplacers.length||ae.replaced)||ae.iterateIn?O:fe(g,O,ae,pe,Te||Ie,null,ve);if(we!==O?(he=we,me={replaced:we}):""===g&&hasConstructorOf(O,e)?(pe.push([g,O,L,ae,void 0,void 0,ae.type]),he=O):Ie&&"object"!==ae.iterateIn||"array"===ae.iterateIn?(xe=new Array(O.length),me={clone:xe}):(["function","symbol"].includes(_typeof(O))||"toJSON"in O||hasConstructorOf(O,e)||hasConstructorOf(O,Promise)||hasConstructorOf(O,ArrayBuffer))&&!Te&&"object"!==ae.iterateIn?he=O:(xe={},ae.addLength&&(xe.length=O.length),me={clone:xe}),ve&&ve(),J.iterateNone)return null!==(Se=xe)&&void 0!==Se?Se:he;if(!xe)return he;if(ae.iterateIn){var _e=function _loop(M){var J={ownKeys:a(O,M)};ye(ae,J,(function(){var J=g+(g?".":"")+escapeKeyPathComponent(M),ie=_encapsulate(J,O[M],Boolean(L),ae,pe,le);hasConstructorOf(ie,e)?pe.push([J,ie,Boolean(L),ae,xe,M,ae.type]):void 0!==ie&&(xe[M]=ie)}))};for(var Ee in O)_e(Ee);ve&&ve({endIterateIn:!0,end:!0})}else n(O).forEach((function(M){var J=g+(g?".":"")+escapeKeyPathComponent(M);ye(ae,{ownKeys:!0},(function(){var g=_encapsulate(J,O[M],Boolean(L),ae,pe,le);hasConstructorOf(g,e)?pe.push([J,g,Boolean(L),ae,xe,M,ae.type]):void 0!==g&&(xe[M]=g)}))})),ve&&ve({endIterateOwn:!0,end:!0});if(ae.iterateUnsetNumeric){for(var Ce=O.length,ke=function _loop2(M){if(!(M in O)){var J="".concat(g).concat(g?".":"").concat(M);ye(ae,{ownKeys:!1},(function(){var g=_encapsulate(J,void 0,Boolean(L),ae,pe,le);hasConstructorOf(g,e)?pe.push([J,g,Boolean(L),ae,xe,M,ae.type]):void 0!==g&&(xe[M]=g)}))}},Ne=0;Ne<Ce;Ne++)ke(Ne);ve&&ve({endIterateUnsetNumeric:!0,end:!0})}return xe},fe=function replace(g,O,L,J,ne,oe,pe){for(var ue=ne?M.plainObjectReplacers:M.nonplainObjectReplacers,de=ue.length;de--;){var he=ue[de];if(he.test(O,L)){var ye=he.type;if(M.revivers[ye]){var fe=ie[g];ie[g]=fe?[ye].concat(fe):ye}if(Object.assign(L,{type:ye,replaced:!0}),(ae||!he.replaceAsync)&&!he.replace)return pe&&pe({typeDetected:!0}),me(g,O,le&&"readonly",L,J,oe,ye);pe&&pe({replacing:!0});var ge=void 0;if(ae||!he.replaceAsync){if(void 0===he.replace)throw new TypeError("Missing replacer");ge=he.replace(O,L)}else ge=he.replaceAsync(O,L);return me(g,ge,le&&"readonly",L,J,oe,ye)}}return O},ge=me("",g,le,null!=O?O:{},pe);if(pe.length)return ae&&J.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(he(ge,pe)).then(de);if(!ae&&J.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return J.stringification&&ae?[de(ge)]:ae?de(ge):Promise.resolve(de(ge))}},{key:"encapsulateSync",value:function encapsulateSync(g,O,L){return this.encapsulate(g,O,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},L),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(g,O,L){return this.encapsulate(g,O,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},L),{},{sync:!1}))}},{key:"revive",value:function revive(g,O){var L=this,M=_objectSpread2(_objectSpread2({sync:!0},this.options),O),J=M.sync;function finishRevival(g){if(J)return g;if(M.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(g)}if(!g||"object"!==_typeof(g)||Array.isArray(g))return finishRevival(g);var ae=g.$types;if(!0===ae)return finishRevival(g.$);if(!ae||"object"!==_typeof(ae)||Array.isArray(ae))return finishRevival(g);var ie=[],ne={},oe=!0;ae.$&&isPlainObject(ae.$)&&(g=g.$,ae=ae.$,oe=!1);var pe=function executeReviver(g,O){var M,ae=_slicedToArray(null!==(M=L.revivers[g])&&void 0!==M?M:[],1)[0];if(!ae)throw new Error("Unregistered type: "+g);if(J&&!("revive"in ae))return O;if(!J&&ae.reviveAsync)return ae.reviveAsync(O,ne);if(ae.revive)return ae.revive(O,ne);throw new Error("Missing reviver")},le=[];function checkUndefined(g){return hasConstructorOf(g,s)?void 0:g}var ue,de=function revivePlainObjects(){var O=[];if(!ae)throw new Error("Found bad `types`");if(Object.entries(ae).forEach((function(g){var M=_slicedToArray(g,2),J=M[0],ie=M[1];"#"!==ie&&[].concat(ie).forEach((function(g){var M;_slicedToArray(null!==(M=L.revivers[g])&&void 0!==M?M:[null,{}],2)[1].plain&&(O.push({keypath:J,type:g}),delete ae[J])}))})),O.length)return O.sort(nestedPathsFirst).reduce((function reducer(O,L){var M=L.keypath,J=L.type;if(isThenable(O))return O.then((function(g){return reducer(g,{keypath:M,type:J})}));var ae=getByKeyPath(g,M);if(hasConstructorOf(ae=pe(J,ae),e))return ae.then((function(O){var L=setAtKeyPath(g,M,O);L===O&&(g=L)}));var ie=setAtKeyPath(g,M,ae);ie===ae&&(g=ie)}),void 0)}();return hasConstructorOf(de,e)?ue=de.then((function(){return g})):(ue=function _revive(g,O,L,M,J){if(!oe||"$types"!==g){var ne=ae[g],ue=o(O);if(ue||isPlainObject(O)){var de=ue?new Array(O.length):{};for(n(O).forEach((function(M){var J=_revive(g+(g?".":"")+escapeKeyPathComponent(M),O[M],null!=L?L:de,de,M),ae=function set(g){return hasConstructorOf(g,s)?de[M]=void 0:void 0!==g&&(de[M]=g),g};hasConstructorOf(J,e)?le.push(J.then((function(g){return ae(g)}))):ae(J)})),O=de;ie.length;){var he=_slicedToArray(ie[0],4),ye=he[0],me=he[1],fe=he[2],ge=he[3],ve=getByKeyPath(ye,me);if(void 0===ve)break;fe[ge]=ve,ie.splice(0,1)}}if(!ne)return O;if("#"===ne){var be=getByKeyPath(L,O.slice(1));return void 0===be&&ie.push([L,O.slice(1),M,J]),be}return[].concat(ne).reduce((function reducer(g,O){if(hasConstructorOf(g,e))return g.then((function(g){return reducer(g,O)}));if("string"!=typeof O)throw new TypeError("Bad type JSON");return pe(O,g)}),O)}}("",g,null),le.length&&(ue=e.resolve(ue).then((function(g){return e.all([g].concat(le))})).then((function(g){return _slicedToArray(g,1)[0]})))),isThenable(ue)?J&&M.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(ue,e)?ue.p.then(checkUndefined):ue:!J&&M.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():J?checkUndefined(ue):Promise.resolve(checkUndefined(ue))}},{key:"reviveSync",value:function reviveSync(g,O){return this.revive(g,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},O),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(g,O){return this.revive(g,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},O),{},{sync:!1}))}},{key:"register",value:function register(g,O){var L=this,M=null!=O?O:{},J=function R(g){o(g)?g.forEach((function(g){return R(g)})):n(g).forEach((function(O){var J;if("#"===O)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(O))throw new TypeError("Plain JSON object types are reserved as type names");var ae=g[O],ie=ae&&"function"!=typeof ae&&!Array.isArray(ae)&&ae.testPlainObjects?L.plainObjectReplacers:L.nonplainObjectReplacers,ne=ie.filter((function(g){return g.type===O}));if(ne.length&&(ie.splice(ie.indexOf(ne[0]),1),delete L.revivers[O],delete L.types[O]),"function"==typeof ae){var oe=ae;ae={test:function test(g){return g&&g.constructor===oe},replace:function replace(g){return _objectSpread2({},g)},revive:function revive(g){return Object.assign(Object.create(oe.prototype),g)}}}else if(o(ae)){var pe=_slicedToArray(ae,3);ae={test:pe[0],replace:pe[1],revive:pe[2]}}if(null!==(J=ae)&&void 0!==J&&J.test){var le={type:O,test:ae.test.bind(ae)};ae.replace&&(le.replace=ae.replace.bind(ae)),ae.replaceAsync&&(le.replaceAsync=ae.replaceAsync.bind(ae));var ue="number"==typeof M.fallback?M.fallback:M.fallback?0:Number.POSITIVE_INFINITY;if(ae.testPlainObjects?L.plainObjectReplacers.splice(ue,0,le):L.nonplainObjectReplacers.splice(ue,0,le),ae.revive||ae.reviveAsync){var de={};ae.revive&&(de.revive=ae.revive.bind(ae)),ae.reviveAsync&&(de.reviveAsync=ae.reviveAsync.bind(ae)),L.revivers[O]=[de,{plain:ae.testPlainObjects}]}L.types[O]=ae}}))};return[].concat(g).forEach((function(g){return J(g)})),this}}]),Typeson}(),s=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));s.__typeson__type__="TypesonUndefined";for(var u=["null","boolean","number","string","array","object"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=new Uint8Array(256),y=0;y<64;y++)f[l.codePointAt(y)]=y;var p=function encode(g,O,L){null==L&&(L=g.byteLength);for(var M=new Uint8Array(g,0,L),J=M.length,ae="",ie=0;ie<J;ie+=3)ae+=l[M[ie]>>2],ae+=l[(3&M[ie])<<4|M[ie+1]>>4],ae+=l[(15&M[ie+1])<<2|M[ie+2]>>6],ae+=l[63&M[ie+2]];return J%3==2?ae=ae.slice(0,-1)+"=":J%3==1&&(ae=ae.slice(0,-2)+"=="),ae},d$1=function decode(g,O){var L=g.length;if(L%4)throw new Error("Bad base64 length: not divisible by four");var M,J,ae,ie,ne=.75*g.length,oe=0;"="===g[g.length-1]&&(ne--,"="===g[g.length-2]&&ne--);for(var pe=new ArrayBuffer(ne,O),le=new Uint8Array(pe),ue=0;ue<L;ue+=4)M=f[g.codePointAt(ue)],J=f[g.codePointAt(ue+1)],ae=f[g.codePointAt(ue+2)],ie=f[g.codePointAt(ue+3)],le[oe++]=M<<2|J>>4,le[oe++]=(15&J)<<4|ae>>2,le[oe++]=(3&ae)<<6|63&ie;return pe};const v={arraybuffer:{test:g=>"ArrayBuffer"===toStringTag(g),replace(g,O){O.buffers||(O.buffers=[]);const L=O.buffers.indexOf(g);return L>-1?{index:L}:(O.buffers.push(g),{s:p(g),maxByteLength:g.maxByteLength})},revive(g,O){if(O.buffers||(O.buffers=[]),Object.hasOwn(g,"index"))return O.buffers[g.index];const L=d$1(g.s,{maxByteLength:g.maxByteLength});return O.buffers.push(L),L}}},m={bigintObject:{test:g=>"object"==typeof g&&hasConstructorOf(g,BigInt),replace:String,revive:g=>new Object(BigInt(g))}},b={bigint:{test:g=>"bigint"==typeof g,replace:String,revive:g=>BigInt(g)}};function arraybuffer2string(g){return new Uint8Array(g).reduce(((g,O)=>g+String.fromCodePoint(O)),"")}function string2arraybuffer(g){const O=new Uint8Array(g.length);for(let L=0;L<g.length;L++)O[L]=g.charCodeAt(L);return O.buffer}const h={blob:{test:g=>"Blob"===toStringTag(g),replace(g){const O=new XMLHttpRequest;if(O.overrideMimeType("text/plain; charset=x-user-defined"),O.open("GET",URL.createObjectURL(g),!1),O.send(),200!==O.status&&0!==O.status)throw new Error("Bad Blob access: "+O.status);return{type:g.type,stringContents:O.responseText}},revive(g){const{type:O,stringContents:L}=g;return new Blob([string2arraybuffer(L)],{type:O})},replaceAsync:g=>new e(((O,L)=>{const M=new FileReader;M.addEventListener("load",(()=>{O({type:g.type,stringContents:arraybuffer2string(M.result)})})),M.addEventListener("error",(()=>{L(M.error)})),M.readAsArrayBuffer(g)}))}};function generateUUID(){let g=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/gu,(function(O){const L=Math.trunc((g+16*Math.random())%16);return g=Math.floor(g/16),("x"===O?L:3&L|8).toString(16)}))}const w={cryptokey:{test:g=>"CryptoKey"===toStringTag(g)&&g.extractable,replaceAsync:g=>new e((async(O,L)=>{let M;try{M=await crypto.subtle.exportKey("jwk",g)}catch(O){return void L(O)}O({jwk:M,algorithm:g.algorithm,usages:g.usages})})),revive(g){const{jwk:O,algorithm:L,usages:M}=g;return crypto.subtle.importKey("jwk",O,L,!0,M)}}},_={dataview:{test:g=>"DataView"===toStringTag(g),replace({buffer:g,byteOffset:O,byteLength:L},M){M.buffers||(M.buffers=[]);const J=M.buffers.indexOf(g);return J>-1?{index:J,byteOffset:O,byteLength:L}:(M.buffers.push(g),{encoded:p(g),maxByteLength:g.maxByteLength,byteOffset:O,byteLength:L})},revive(g,O){O.buffers||(O.buffers=[]);const{byteOffset:L,byteLength:M,encoded:J,index:ae,maxByteLength:ie}=g;let ne;return"index"in g?ne=O.buffers[ae]:(ne=d$1(J,void 0===ie?ie:{maxByteLength:ie}),O.buffers.push(ne)),new DataView(ne,L,M)}}},A={date:{test:g=>"Date"===toStringTag(g),replace(g){const O=g.getTime();return Number.isNaN(O)?"NaN":O},revive:g=>"NaN"===g?new Date(Number.NaN):new Date(g)}},S={domexception:{test:g=>"DOMException"===toStringTag(g),replace:g=>({name:g.name,message:g.message}),revive:({message:g,name:O})=>new DOMException(g,O)}},j={};function create$5(g){j[g.name.toLowerCase()]={test:O=>toStringTag(O)===g.name,replace:g=>g.is2D?{a:g.a,b:g.b,c:g.c,d:g.d,e:g.e,f:g.f}:{m11:g.m11,m12:g.m12,m13:g.m13,m14:g.m14,m21:g.m21,m22:g.m22,m23:g.m23,m24:g.m24,m31:g.m31,m32:g.m32,m33:g.m33,m34:g.m34,m41:g.m41,m42:g.m42,m43:g.m43,m44:g.m44},revive:O=>Object.hasOwn(O,"a")?new g([O.a,O.b,O.c,O.d,O.e,O.f]):new g([O.m11,O.m12,O.m13,O.m14,O.m21,O.m22,O.m23,O.m24,O.m31,O.m32,O.m33,O.m34,O.m41,O.m42,O.m43,O.m44])}}"undefined"!=typeof DOMMatrix&&create$5(DOMMatrix),"undefined"!=typeof DOMMatrixReadOnly&&create$5(DOMMatrixReadOnly);const T={};function create$4(g){T[g.name.toLowerCase()]={test:O=>toStringTag(O)===g.name,replace:g=>({x:g.x,y:g.y,z:g.z,w:g.w}),revive:({x:O,y:L,z:M,w:J})=>new g(O,L,M,J)}}"undefined"!=typeof DOMPoint&&create$4(DOMPoint),"undefined"!=typeof DOMPointReadOnly&&create$4(DOMPointReadOnly);const I={domquad:{test:g=>"DOMQuad"===toStringTag(g),replace:g=>({p1:g.p1,p2:g.p2,p3:g.p3,p4:g.p4}),revive:({p1:g,p2:O,p3:L,p4:M})=>new DOMQuad(g,O,L,M)}},N={};function create$3(g){N[g.name.toLowerCase()]={test:O=>toStringTag(O)===g.name,replace:g=>({x:g.x,y:g.y,width:g.width,height:g.height}),revive:({x:O,y:L,width:M,height:J})=>new g(O,L,M,J)}}"undefined"!=typeof DOMRect&&create$3(DOMRect),"undefined"!=typeof DOMRectReadOnly&&create$3(DOMRectReadOnly);const P={error:{test:g=>"Error"===toStringTag(g),replace:({name:g,message:O,cause:L,stack:M,fileName:J,lineNumber:ae,columnNumber:ie})=>({name:g,message:O,cause:L,stack:M,fileName:J,lineNumber:ae,columnNumber:ie}),revive(g){const O=new Error(g.message);return O.name=g.name,O.cause=g.cause,O.stack=g.stack,O.fileName=g.fileName,O.lineNumber=g.lineNumber,O.columnNumber=g.columnNumber,O}}},x={};function create$2(g){x[g.name.toLowerCase()]={test:O=>hasConstructorOf(O,g),replace:({name:g,message:O,cause:L,stack:M,fileName:J,lineNumber:ae,columnNumber:ie,errors:ne})=>({name:g,message:O,cause:L,stack:M,fileName:J,lineNumber:ae,columnNumber:ie,errors:ne}),revive(O){const L="undefined"!=typeof AggregateError&&g===AggregateError?new g(O.errors,O.message):new g(O.message);return L.name=O.name,L.cause=O.cause,L.stack=O.stack,L.fileName=O.fileName,L.lineNumber=O.lineNumber,L.columnNumber=O.columnNumber,L}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((g=>create$2(g))),"undefined"!=typeof AggregateError&&create$2(AggregateError),"function"==typeof InternalError&&create$2(InternalError);const E={file:{test:g=>"File"===toStringTag(g),replace(g){const O=new XMLHttpRequest;if(O.overrideMimeType("text/plain; charset=x-user-defined"),O.open("GET",URL.createObjectURL(g),!1),O.send(),200!==O.status&&0!==O.status)throw new Error("Bad File access: "+O.status);return{type:g.type,stringContents:O.responseText,name:g.name,lastModified:g.lastModified}},revive:({name:g,type:O,stringContents:L,lastModified:M})=>new File([string2arraybuffer(L)],g,{type:O,lastModified:M}),replaceAsync:g=>new e((function(O,L){const M=new FileReader;M.addEventListener("load",(function(){O({type:g.type,stringContents:arraybuffer2string(M.result),name:g.name,lastModified:g.lastModified})})),M.addEventListener("error",(function(){L(M.error)})),M.readAsArrayBuffer(g)}))}},C={file:E.file,filelist:{test:g=>"FileList"===toStringTag(g),replace(g){const O=[];for(let L=0;L<g.length;L++)O[L]=g.item(L);return O},revive(g){class FileList{constructor(){this._files=arguments[0],this.length=this._files.length}item(g){return this._files[g]}get[Symbol.toStringTag](){return"FileList"}}return new FileList(g)}}},B={imagebitmap:{test:g=>"ImageBitmap"===toStringTag(g)||g&&g.dataset&&"ImageBitmap"===g.dataset.toStringTag,replace(g){const O=document.createElement("canvas");return O.getContext("2d").drawImage(g,0,0),{width:g.width,height:g.height,dataURL:O.toDataURL()}},revive(g){const O="undefined"==typeof OffscreenCanvas?document.createElement("canvas"):new OffscreenCanvas(g.width,g.height),L=O.getContext("2d"),M=document.createElement("img");return M.addEventListener("load",(function(){L.drawImage(M,0,0)})),M.src=g.dataURL,"undefined"==typeof OffscreenCanvas?O:O.transferToImageBitmap()},reviveAsync(g){const O=document.createElement("canvas"),L=O.getContext("2d"),M=document.createElement("img");return M.addEventListener("load",(function(){L.drawImage(M,0,0)})),M.src=g.dataURL,new e((async(g,L)=>{try{g(await createImageBitmap(O))}catch(g){L(g)}}))}}},k={imagedata:{test:g=>"ImageData"===toStringTag(g),replace:g=>({array:[...g.data],width:g.width,height:g.height}),revive:g=>new ImageData(new Uint8ClampedArray(g.array),g.width,g.height)}},U$1={infinity:{test:g=>g===Number.POSITIVE_INFINITY,replace:()=>"Infinity",revive:()=>Number.POSITIVE_INFINITY}},D={map:{test:g=>"Map"===toStringTag(g),replace:g=>[...g.entries()],revive:g=>new Map(g)}},K={nan:{test:g=>Number.isNaN(g),replace:()=>"NaN",revive:()=>Number.NaN}},F={negativeInfinity:{test:g=>g===Number.NEGATIVE_INFINITY,replace:()=>"-Infinity",revive:()=>Number.NEGATIVE_INFINITY}},$$1={negativeZero:{test:g=>Object.is(g,-0),replace:()=>0,revive:()=>-0}},V={StringObject:{test:g=>"String"===toStringTag(g)&&"object"==typeof g,replace:String,revive:g=>new String(g)},BooleanObject:{test:g=>"Boolean"===toStringTag(g)&&"object"==typeof g,replace:g=>g.valueOf(),revive:g=>new Boolean(g)},NumberObject:{test:g=>"Number"===toStringTag(g)&&"object"==typeof g,replace:Number,revive:g=>new Number(g)}},q={promise:{test:g=>"Promise"===toStringTag(g),replaceAsync:g=>new e((async O=>{try{O({value:await g})}catch(g){O({error:g})}})),revive:g=>g.error?Promise.reject(g.error):Promise.resolve(g.value)}},Y={regexp:{test:g=>"RegExp"===toStringTag(g),replace:g=>({source:g.source,flags:(g.global?"g":"")+(g.ignoreCase?"i":"")+(g.multiline?"m":"")+(g.sticky?"y":"")+(g.unicode?"u":"")}),revive:({source:g,flags:O})=>new RegExp(g,O)}},W={},G={resurrectable:{test:g=>g&&!Array.isArray(g)&&["object","function","symbol"].includes(typeof g),replace(g){const O=generateUUID();return W[O]=g,O},revive:g=>W[g]}},H={set:{test:g=>"Set"===toStringTag(g),replace:g=>[...g.values()],revive:g=>new Set(g)}},z$1={symbol:{test:g=>"symbol"==typeof g,replace:g=>({global:void 0!==Symbol.keyFor(g),sym:String(g).slice(7,-1)}),revive:g=>g.global?Symbol.for(g.sym):Symbol(g.sym)}},Q={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,..."function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[]].forEach((g=>function create$1(g){const O=g.name;Q[O.toLowerCase()]={test:g=>toStringTag(g)===O,replace:g=>(0===g.byteOffset&&g.byteLength===g.buffer.byteLength?g:g.slice(0)).buffer,revive:O=>"ArrayBuffer"===toStringTag(O)?new g(O):O}}(g)));const X={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,..."function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[]].forEach((g=>function create(g){const O=g.name;X[O.toLowerCase()]={test:g=>toStringTag(g)===O,replace({buffer:g,byteOffset:O,length:L},M){M.buffers||(M.buffers=[]);const J=M.buffers.indexOf(g);return J>-1?{index:J,byteOffset:O,length:L}:(M.buffers.push(g),{maxByteLength:g.maxByteLength,encoded:p(g),byteOffset:O,length:L})},revive(O,L){L.buffers||(L.buffers=[]);const{byteOffset:M,length:J,encoded:ae,index:ie,maxByteLength:ne}=O;let oe;return"index"in O?oe=L.buffers[ie]:(oe=d$1(ae,void 0===ne?void 0:{maxByteLength:ne}),L.buffers.push(oe)),new g(oe,M,J)}}}(g)));const Z={undef:{test:(g,O)=>void 0===g&&(O.ownKeys||!("ownKeys"in O)),replace:()=>0,revive:()=>new s}},ee={userObject:{test:g=>isUserObject(g),replace:g=>({...g}),revive:g=>g}},te=[{arrayNonindexKeys:{testPlainObjects:!0,test:(g,O)=>!!Array.isArray(g)&&(Object.keys(g).some((g=>String(Number.parseInt(g))!==g))&&(O.iterateIn="object",O.addLength=!0),!0),replace:(g,O)=>(O.iterateUnsetNumeric=!0,g),revive(g){if(Array.isArray(g))return g;const O=[];return Object.entries(g).forEach((([g,L])=>{O[g]=L})),O}}},{sparseUndefined:{test:(g,O)=>void 0===g&&!1===O.ownKeys,replace:()=>0,revive(){}}}],re=[K,U$1,F,$$1],ce=[ee,Z,te,V,re,A,Y,k,B,E,C,h,P,x].concat("function"==typeof Map?D:[],"function"==typeof Set?H:[],"function"==typeof ArrayBuffer?v:[],"function"==typeof Uint8Array?X:[],"function"==typeof DataView?_:[],"undefined"!=typeof crypto?w:[],"undefined"!=typeof BigInt?[b,m]:[],"undefined"!=typeof DOMException?S:[],"undefined"!=typeof DOMRect?N:[],"undefined"!=typeof DOMPoint?T:[],"undefined"!=typeof DOMQuad?I:[],"undefined"!=typeof DOMMatrix?j:[]),se=ce.concat({checkDataCloneException:{test(g){const O={}.toString.call(g).slice(8,-1);if(["symbol","function"].includes(typeof g)||["Arguments","Module","Promise","WeakMap","WeakSet","Event","MessageChannel"].includes(O)||g&&"object"==typeof g&&"number"==typeof g.nodeType&&"function"==typeof g.insertBefore)throw new DOMException("The object cannot be cloned.","DataCloneError");return!1}}});var astralIdentifierCodes=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],astralIdentifierStartCodes=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],nonASCIIidentifierChars="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",nonASCIIidentifierStartChars="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",reservedWords={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},ecma5AndLessKeywords="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",keywords$1={5:ecma5AndLessKeywords,"5module":ecma5AndLessKeywords+" export import",6:ecma5AndLessKeywords+" const class extends export import super"},keywordRelationalOperator=/^in(stanceof)?$/,nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]"),nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");function isInAstralSet(g,O){for(var L=65536,M=0;M<O.length;M+=2){if((L+=O[M])>g)return!1;if((L+=O[M+1])>=g)return!0}return!1}function isIdentifierStart(g,O){return g<65?36===g:g<91||(g<97?95===g:g<123||(g<=65535?g>=170&&nonASCIIidentifierStart.test(String.fromCharCode(g)):!1!==O&&isInAstralSet(g,astralIdentifierStartCodes)))}function isIdentifierChar(g,O){return g<48?36===g:g<58||!(g<65)&&(g<91||(g<97?95===g:g<123||(g<=65535?g>=170&&nonASCIIidentifier.test(String.fromCharCode(g)):!1!==O&&(isInAstralSet(g,astralIdentifierStartCodes)||isInAstralSet(g,astralIdentifierCodes)))))}var TokenType=function TokenType(g,O){void 0===O&&(O={}),this.label=g,this.keyword=O.keyword,this.beforeExpr=!!O.beforeExpr,this.startsExpr=!!O.startsExpr,this.isLoop=!!O.isLoop,this.isAssign=!!O.isAssign,this.prefix=!!O.prefix,this.postfix=!!O.postfix,this.binop=O.binop||null,this.updateContext=null};function binop(g,O){return new TokenType(g,{beforeExpr:!0,binop:O})}var beforeExpr={beforeExpr:!0},startsExpr={startsExpr:!0},keywords={};function kw(g,O){return void 0===O&&(O={}),O.keyword=g,keywords[g]=new TokenType(g,O)}var types$1={num:new TokenType("num",startsExpr),regexp:new TokenType("regexp",startsExpr),string:new TokenType("string",startsExpr),name:new TokenType("name",startsExpr),privateId:new TokenType("privateId",startsExpr),eof:new TokenType("eof"),bracketL:new TokenType("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new TokenType("]"),braceL:new TokenType("{",{beforeExpr:!0,startsExpr:!0}),braceR:new TokenType("}"),parenL:new TokenType("(",{beforeExpr:!0,startsExpr:!0}),parenR:new TokenType(")"),comma:new TokenType(",",beforeExpr),semi:new TokenType(";",beforeExpr),colon:new TokenType(":",beforeExpr),dot:new TokenType("."),question:new TokenType("?",beforeExpr),questionDot:new TokenType("?."),arrow:new TokenType("=>",beforeExpr),template:new TokenType("template"),invalidTemplate:new TokenType("invalidTemplate"),ellipsis:new TokenType("...",beforeExpr),backQuote:new TokenType("`",startsExpr),dollarBraceL:new TokenType("${",{beforeExpr:!0,startsExpr:!0}),eq:new TokenType("=",{beforeExpr:!0,isAssign:!0}),assign:new TokenType("_=",{beforeExpr:!0,isAssign:!0}),incDec:new TokenType("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new TokenType("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:binop("||",1),logicalAND:binop("&&",2),bitwiseOR:binop("|",3),bitwiseXOR:binop("^",4),bitwiseAND:binop("&",5),equality:binop("==/!=/===/!==",6),relational:binop("</>/<=/>=",7),bitShift:binop("<</>>/>>>",8),plusMin:new TokenType("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:binop("%",10),star:binop("*",10),slash:binop("/",10),starstar:new TokenType("**",{beforeExpr:!0}),coalesce:binop("??",1),_break:kw("break"),_case:kw("case",beforeExpr),_catch:kw("catch"),_continue:kw("continue"),_debugger:kw("debugger"),_default:kw("default",beforeExpr),_do:kw("do",{isLoop:!0,beforeExpr:!0}),_else:kw("else",beforeExpr),_finally:kw("finally"),_for:kw("for",{isLoop:!0}),_function:kw("function",startsExpr),_if:kw("if"),_return:kw("return",beforeExpr),_switch:kw("switch"),_throw:kw("throw",beforeExpr),_try:kw("try"),_var:kw("var"),_const:kw("const"),_while:kw("while",{isLoop:!0}),_with:kw("with"),_new:kw("new",{beforeExpr:!0,startsExpr:!0}),_this:kw("this",startsExpr),_super:kw("super",startsExpr),_class:kw("class",startsExpr),_extends:kw("extends",beforeExpr),_export:kw("export"),_import:kw("import",startsExpr),_null:kw("null",startsExpr),_true:kw("true",startsExpr),_false:kw("false",startsExpr),_in:kw("in",{beforeExpr:!0,binop:7}),_instanceof:kw("instanceof",{beforeExpr:!0,binop:7}),_typeof:kw("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:kw("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:kw("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},lineBreak=/\r\n?|\n|\u2028|\u2029/,lineBreakG=new RegExp(lineBreak.source,"g");function isNewLine(g){return 10===g||13===g||8232===g||8233===g}function nextLineBreak(g,O,L){void 0===L&&(L=g.length);for(var M=O;M<L;M++){var J=g.charCodeAt(M);if(isNewLine(J))return M<L-1&&13===J&&10===g.charCodeAt(M+1)?M+2:M+1}return-1}var nonASCIIwhitespace=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,skipWhiteSpace=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ref=Object.prototype,hasOwnProperty=ref.hasOwnProperty,toString=ref.toString,hasOwn=Object.hasOwn||function(g,O){return hasOwnProperty.call(g,O)},isArray=Array.isArray||function(g){return"[object Array]"===toString.call(g)},regexpCache=Object.create(null);function wordsRegexp(g){return regexpCache[g]||(regexpCache[g]=new RegExp("^(?:"+g.replace(/ /g,"|")+")$"))}function codePointToString(g){return g<=65535?String.fromCharCode(g):(g-=65536,String.fromCharCode(55296+(g>>10),56320+(1023&g)))}var loneSurrogate=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Position=function Position(g,O){this.line=g,this.column=O};Position.prototype.offset=function offset(g){return new Position(this.line,this.column+g)};var SourceLocation=function SourceLocation(g,O,L){this.start=O,this.end=L,null!==g.sourceFile&&(this.source=g.sourceFile)};function getLineInfo(g,O){for(var L=1,M=0;;){var J=nextLineBreak(g,M,O);if(J<0)return new Position(L,O-M);++L,M=J}}var defaultOptions={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},warnedAboutEcmaVersion=!1;function getOptions(g){var O={};for(var L in defaultOptions)O[L]=g&&hasOwn(g,L)?g[L]:defaultOptions[L];if("latest"===O.ecmaVersion?O.ecmaVersion=1e8:null==O.ecmaVersion?(!warnedAboutEcmaVersion&&"object"==typeof console&&console.warn&&(warnedAboutEcmaVersion=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),O.ecmaVersion=11):O.ecmaVersion>=2015&&(O.ecmaVersion-=2009),null==O.allowReserved&&(O.allowReserved=O.ecmaVersion<5),g&&null!=g.allowHashBang||(O.allowHashBang=O.ecmaVersion>=14),isArray(O.onToken)){var M=O.onToken;O.onToken=function(g){return M.push(g)}}return isArray(O.onComment)&&(O.onComment=pushComment(O,O.onComment)),O}function pushComment(g,O){return function(L,M,J,ae,ie,ne){var oe={type:L?"Block":"Line",value:M,start:J,end:ae};g.locations&&(oe.loc=new SourceLocation(this,ie,ne)),g.ranges&&(oe.range=[J,ae]),O.push(oe)}}var SCOPE_TOP=1,SCOPE_FUNCTION=2,SCOPE_ASYNC=4,SCOPE_GENERATOR=8,SCOPE_ARROW=16,SCOPE_SIMPLE_CATCH=32,SCOPE_SUPER=64,SCOPE_DIRECT_SUPER=128,SCOPE_CLASS_STATIC_BLOCK=256,SCOPE_VAR=SCOPE_TOP|SCOPE_FUNCTION|SCOPE_CLASS_STATIC_BLOCK;function functionFlags(g,O){return SCOPE_FUNCTION|(g?SCOPE_ASYNC:0)|(O?SCOPE_GENERATOR:0)}var BIND_NONE=0,BIND_VAR=1,BIND_LEXICAL=2,BIND_FUNCTION=3,BIND_SIMPLE_CATCH=4,BIND_OUTSIDE=5,Parser=function Parser(g,O,L){this.options=g=getOptions(g),this.sourceFile=g.sourceFile,this.keywords=wordsRegexp(keywords$1[g.ecmaVersion>=6?6:"module"===g.sourceType?"5module":5]);var M="";!0!==g.allowReserved&&(M=reservedWords[g.ecmaVersion>=6?6:5===g.ecmaVersion?5:3],"module"===g.sourceType&&(M+=" await")),this.reservedWords=wordsRegexp(M);var J=(M?M+" ":"")+reservedWords.strict;this.reservedWordsStrict=wordsRegexp(J),this.reservedWordsStrictBind=wordsRegexp(J+" "+reservedWords.strictBind),this.input=String(O),this.containsEsc=!1,L?(this.pos=L,this.lineStart=this.input.lastIndexOf("\n",L-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(lineBreak).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=types$1.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===g.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&g.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(SCOPE_TOP),this.regexpState=null,this.privateNameStack=[]},prototypeAccessors={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Parser.prototype.parse=function parse(){var g=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(g)},prototypeAccessors.inFunction.get=function(){return(this.currentVarScope().flags&SCOPE_FUNCTION)>0},prototypeAccessors.inGenerator.get=function(){return(this.currentVarScope().flags&SCOPE_GENERATOR)>0&&!this.currentVarScope().inClassFieldInit},prototypeAccessors.inAsync.get=function(){return(this.currentVarScope().flags&SCOPE_ASYNC)>0&&!this.currentVarScope().inClassFieldInit},prototypeAccessors.canAwait.get=function(){for(var g=this.scopeStack.length-1;g>=0;g--){var O=this.scopeStack[g];if(O.inClassFieldInit||O.flags&SCOPE_CLASS_STATIC_BLOCK)return!1;if(O.flags&SCOPE_FUNCTION)return(O.flags&SCOPE_ASYNC)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},prototypeAccessors.allowSuper.get=function(){var g=this.currentThisScope(),O=g.flags,L=g.inClassFieldInit;return(O&SCOPE_SUPER)>0||L||this.options.allowSuperOutsideMethod},prototypeAccessors.allowDirectSuper.get=function(){return(this.currentThisScope().flags&SCOPE_DIRECT_SUPER)>0},prototypeAccessors.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},prototypeAccessors.allowNewDotTarget.get=function(){var g=this.currentThisScope(),O=g.flags,L=g.inClassFieldInit;return(O&(SCOPE_FUNCTION|SCOPE_CLASS_STATIC_BLOCK))>0||L},prototypeAccessors.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&SCOPE_CLASS_STATIC_BLOCK)>0},Parser.extend=function extend(){for(var g=[],O=arguments.length;O--;)g[O]=arguments[O];for(var L=this,M=0;M<g.length;M++)L=g[M](L);return L},Parser.parse=function parse(g,O){return new this(O,g).parse()},Parser.parseExpressionAt=function parseExpressionAt(g,O,L){var M=new this(L,g,O);return M.nextToken(),M.parseExpression()},Parser.tokenizer=function tokenizer(g,O){return new this(O,g)},Object.defineProperties(Parser.prototype,prototypeAccessors);var pp$9=Parser.prototype,literal=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;pp$9.strictDirective=function(g){if(this.options.ecmaVersion<5)return!1;for(;;){skipWhiteSpace.lastIndex=g,g+=skipWhiteSpace.exec(this.input)[0].length;var O=literal.exec(this.input.slice(g));if(!O)return!1;if("use strict"===(O[1]||O[2])){skipWhiteSpace.lastIndex=g+O[0].length;var L=skipWhiteSpace.exec(this.input),M=L.index+L[0].length,J=this.input.charAt(M);return";"===J||"}"===J||lineBreak.test(L[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(J)||"!"===J&&"="===this.input.charAt(M+1))}g+=O[0].length,skipWhiteSpace.lastIndex=g,g+=skipWhiteSpace.exec(this.input)[0].length,";"===this.input[g]&&g++}},pp$9.eat=function(g){return this.type===g&&(this.next(),!0)},pp$9.isContextual=function(g){return this.type===types$1.name&&this.value===g&&!this.containsEsc},pp$9.eatContextual=function(g){return!!this.isContextual(g)&&(this.next(),!0)},pp$9.expectContextual=function(g){this.eatContextual(g)||this.unexpected()},pp$9.canInsertSemicolon=function(){return this.type===types$1.eof||this.type===types$1.braceR||lineBreak.test(this.input.slice(this.lastTokEnd,this.start))},pp$9.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},pp$9.semicolon=function(){this.eat(types$1.semi)||this.insertSemicolon()||this.unexpected()},pp$9.afterTrailingComma=function(g,O){if(this.type===g)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),O||this.next(),!0},pp$9.expect=function(g){this.eat(g)||this.unexpected()},pp$9.unexpected=function(g){this.raise(null!=g?g:this.start,"Unexpected token")};var DestructuringErrors=function DestructuringErrors(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};pp$9.checkPatternErrors=function(g,O){if(g){g.trailingComma>-1&&this.raiseRecoverable(g.trailingComma,"Comma is not permitted after the rest element");var L=O?g.parenthesizedAssign:g.parenthesizedBind;L>-1&&this.raiseRecoverable(L,O?"Assigning to rvalue":"Parenthesized pattern")}},pp$9.checkExpressionErrors=function(g,O){if(!g)return!1;var L=g.shorthandAssign,M=g.doubleProto;if(!O)return L>=0||M>=0;L>=0&&this.raise(L,"Shorthand property assignments are valid only in destructuring patterns"),M>=0&&this.raiseRecoverable(M,"Redefinition of __proto__ property")},pp$9.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},pp$9.isSimpleAssignTarget=function(g){return"ParenthesizedExpression"===g.type?this.isSimpleAssignTarget(g.expression):"Identifier"===g.type||"MemberExpression"===g.type};var pp$8=Parser.prototype;pp$8.parseTopLevel=function(g){var O=Object.create(null);for(g.body||(g.body=[]);this.type!==types$1.eof;){var L=this.parseStatement(null,!0,O);g.body.push(L)}if(this.inModule)for(var M=0,J=Object.keys(this.undefinedExports);M<J.length;M+=1){var ae=J[M];this.raiseRecoverable(this.undefinedExports[ae].start,"Export '"+ae+"' is not defined")}return this.adaptDirectivePrologue(g.body),this.next(),g.sourceType=this.options.sourceType,this.finishNode(g,"Program")};var loopLabel={kind:"loop"},switchLabel={kind:"switch"};pp$8.isLet=function(g){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;skipWhiteSpace.lastIndex=this.pos;var O=skipWhiteSpace.exec(this.input),L=this.pos+O[0].length,M=this.input.charCodeAt(L);if(91===M||92===M)return!0;if(g)return!1;if(123===M||M>55295&&M<56320)return!0;if(isIdentifierStart(M,!0)){for(var J=L+1;isIdentifierChar(M=this.input.charCodeAt(J),!0);)++J;if(92===M||M>55295&&M<56320)return!0;var ae=this.input.slice(L,J);if(!keywordRelationalOperator.test(ae))return!0}return!1},pp$8.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;skipWhiteSpace.lastIndex=this.pos;var g,O=skipWhiteSpace.exec(this.input),L=this.pos+O[0].length;return!(lineBreak.test(this.input.slice(this.pos,L))||"function"!==this.input.slice(L,L+8)||L+8!==this.input.length&&(isIdentifierChar(g=this.input.charCodeAt(L+8))||g>55295&&g<56320))},pp$8.parseStatement=function(g,O,L){var M,J=this.type,ae=this.startNode();switch(this.isLet(g)&&(J=types$1._var,M="let"),J){case types$1._break:case types$1._continue:return this.parseBreakContinueStatement(ae,J.keyword);case types$1._debugger:return this.parseDebuggerStatement(ae);case types$1._do:return this.parseDoStatement(ae);case types$1._for:return this.parseForStatement(ae);case types$1._function:return g&&(this.strict||"if"!==g&&"label"!==g)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(ae,!1,!g);case types$1._class:return g&&this.unexpected(),this.parseClass(ae,!0);case types$1._if:return this.parseIfStatement(ae);case types$1._return:return this.parseReturnStatement(ae);case types$1._switch:return this.parseSwitchStatement(ae);case types$1._throw:return this.parseThrowStatement(ae);case types$1._try:return this.parseTryStatement(ae);case types$1._const:case types$1._var:return M=M||this.value,g&&"var"!==M&&this.unexpected(),this.parseVarStatement(ae,M);case types$1._while:return this.parseWhileStatement(ae);case types$1._with:return this.parseWithStatement(ae);case types$1.braceL:return this.parseBlock(!0,ae);case types$1.semi:return this.parseEmptyStatement(ae);case types$1._export:case types$1._import:if(this.options.ecmaVersion>10&&J===types$1._import){skipWhiteSpace.lastIndex=this.pos;var ie=skipWhiteSpace.exec(this.input),ne=this.pos+ie[0].length,oe=this.input.charCodeAt(ne);if(40===oe||46===oe)return this.parseExpressionStatement(ae,this.parseExpression())}return this.options.allowImportExportEverywhere||(O||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),J===types$1._import?this.parseImport(ae):this.parseExport(ae,L);default:if(this.isAsyncFunction())return g&&this.unexpected(),this.next(),this.parseFunctionStatement(ae,!0,!g);var pe=this.value,le=this.parseExpression();return J===types$1.name&&"Identifier"===le.type&&this.eat(types$1.colon)?this.parseLabeledStatement(ae,pe,le,g):this.parseExpressionStatement(ae,le)}},pp$8.parseBreakContinueStatement=function(g,O){var L="break"===O;this.next(),this.eat(types$1.semi)||this.insertSemicolon()?g.label=null:this.type!==types$1.name?this.unexpected():(g.label=this.parseIdent(),this.semicolon());for(var M=0;M<this.labels.length;++M){var J=this.labels[M];if(null==g.label||J.name===g.label.name){if(null!=J.kind&&(L||"loop"===J.kind))break;if(g.label&&L)break}}return M===this.labels.length&&this.raise(g.start,"Unsyntactic "+O),this.finishNode(g,L?"BreakStatement":"ContinueStatement")},pp$8.parseDebuggerStatement=function(g){return this.next(),this.semicolon(),this.finishNode(g,"DebuggerStatement")},pp$8.parseDoStatement=function(g){return this.next(),this.labels.push(loopLabel),g.body=this.parseStatement("do"),this.labels.pop(),this.expect(types$1._while),g.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(types$1.semi):this.semicolon(),this.finishNode(g,"DoWhileStatement")},pp$8.parseForStatement=function(g){this.next();var O=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(loopLabel),this.enterScope(0),this.expect(types$1.parenL),this.type===types$1.semi)return O>-1&&this.unexpected(O),this.parseFor(g,null);var L=this.isLet();if(this.type===types$1._var||this.type===types$1._const||L){var M=this.startNode(),J=L?"let":this.value;return this.next(),this.parseVar(M,!0,J),this.finishNode(M,"VariableDeclaration"),(this.type===types$1._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===M.declarations.length?(this.options.ecmaVersion>=9&&(this.type===types$1._in?O>-1&&this.unexpected(O):g.await=O>-1),this.parseForIn(g,M)):(O>-1&&this.unexpected(O),this.parseFor(g,M))}var ae=this.isContextual("let"),ie=!1,ne=this.containsEsc,oe=new DestructuringErrors,pe=this.start,le=O>-1?this.parseExprSubscripts(oe,"await"):this.parseExpression(!0,oe);return this.type===types$1._in||(ie=this.options.ecmaVersion>=6&&this.isContextual("of"))?(O>-1?(this.type===types$1._in&&this.unexpected(O),g.await=!0):ie&&this.options.ecmaVersion>=8&&(le.start!==pe||ne||"Identifier"!==le.type||"async"!==le.name?this.options.ecmaVersion>=9&&(g.await=!1):this.unexpected()),ae&&ie&&this.raise(le.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(le,!1,oe),this.checkLValPattern(le),this.parseForIn(g,le)):(this.checkExpressionErrors(oe,!0),O>-1&&this.unexpected(O),this.parseFor(g,le))},pp$8.parseFunctionStatement=function(g,O,L){return this.next(),this.parseFunction(g,FUNC_STATEMENT|(L?0:FUNC_HANGING_STATEMENT),!1,O)},pp$8.parseIfStatement=function(g){return this.next(),g.test=this.parseParenExpression(),g.consequent=this.parseStatement("if"),g.alternate=this.eat(types$1._else)?this.parseStatement("if"):null,this.finishNode(g,"IfStatement")},pp$8.parseReturnStatement=function(g){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(types$1.semi)||this.insertSemicolon()?g.argument=null:(g.argument=this.parseExpression(),this.semicolon()),this.finishNode(g,"ReturnStatement")},pp$8.parseSwitchStatement=function(g){var O;this.next(),g.discriminant=this.parseParenExpression(),g.cases=[],this.expect(types$1.braceL),this.labels.push(switchLabel),this.enterScope(0);for(var L=!1;this.type!==types$1.braceR;)if(this.type===types$1._case||this.type===types$1._default){var M=this.type===types$1._case;O&&this.finishNode(O,"SwitchCase"),g.cases.push(O=this.startNode()),O.consequent=[],this.next(),M?O.test=this.parseExpression():(L&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),L=!0,O.test=null),this.expect(types$1.colon)}else O||this.unexpected(),O.consequent.push(this.parseStatement(null));return this.exitScope(),O&&this.finishNode(O,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(g,"SwitchStatement")},pp$8.parseThrowStatement=function(g){return this.next(),lineBreak.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),g.argument=this.parseExpression(),this.semicolon(),this.finishNode(g,"ThrowStatement")};var empty$1=[];pp$8.parseCatchClauseParam=function(){var g=this.parseBindingAtom(),O="Identifier"===g.type;return this.enterScope(O?SCOPE_SIMPLE_CATCH:0),this.checkLValPattern(g,O?BIND_SIMPLE_CATCH:BIND_LEXICAL),this.expect(types$1.parenR),g},pp$8.parseTryStatement=function(g){if(this.next(),g.block=this.parseBlock(),g.handler=null,this.type===types$1._catch){var O=this.startNode();this.next(),this.eat(types$1.parenL)?O.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),O.param=null,this.enterScope(0)),O.body=this.parseBlock(!1),this.exitScope(),g.handler=this.finishNode(O,"CatchClause")}return g.finalizer=this.eat(types$1._finally)?this.parseBlock():null,g.handler||g.finalizer||this.raise(g.start,"Missing catch or finally clause"),this.finishNode(g,"TryStatement")},pp$8.parseVarStatement=function(g,O,L){return this.next(),this.parseVar(g,!1,O,L),this.semicolon(),this.finishNode(g,"VariableDeclaration")},pp$8.parseWhileStatement=function(g){return this.next(),g.test=this.parseParenExpression(),this.labels.push(loopLabel),g.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(g,"WhileStatement")},pp$8.parseWithStatement=function(g){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),g.object=this.parseParenExpression(),g.body=this.parseStatement("with"),this.finishNode(g,"WithStatement")},pp$8.parseEmptyStatement=function(g){return this.next(),this.finishNode(g,"EmptyStatement")},pp$8.parseLabeledStatement=function(g,O,L,M){for(var J=0,ae=this.labels;J<ae.length;J+=1){ae[J].name===O&&this.raise(L.start,"Label '"+O+"' is already declared")}for(var ie=this.type.isLoop?"loop":this.type===types$1._switch?"switch":null,ne=this.labels.length-1;ne>=0;ne--){var oe=this.labels[ne];if(oe.statementStart!==g.start)break;oe.statementStart=this.start,oe.kind=ie}return this.labels.push({name:O,kind:ie,statementStart:this.start}),g.body=this.parseStatement(M?-1===M.indexOf("label")?M+"label":M:"label"),this.labels.pop(),g.label=L,this.finishNode(g,"LabeledStatement")},pp$8.parseExpressionStatement=function(g,O){return g.expression=O,this.semicolon(),this.finishNode(g,"ExpressionStatement")},pp$8.parseBlock=function(g,O,L){for(void 0===g&&(g=!0),void 0===O&&(O=this.startNode()),O.body=[],this.expect(types$1.braceL),g&&this.enterScope(0);this.type!==types$1.braceR;){var M=this.parseStatement(null);O.body.push(M)}return L&&(this.strict=!1),this.next(),g&&this.exitScope(),this.finishNode(O,"BlockStatement")},pp$8.parseFor=function(g,O){return g.init=O,this.expect(types$1.semi),g.test=this.type===types$1.semi?null:this.parseExpression(),this.expect(types$1.semi),g.update=this.type===types$1.parenR?null:this.parseExpression(),this.expect(types$1.parenR),g.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(g,"ForStatement")},pp$8.parseForIn=function(g,O){var L=this.type===types$1._in;return this.next(),"VariableDeclaration"===O.type&&null!=O.declarations[0].init&&(!L||this.options.ecmaVersion<8||this.strict||"var"!==O.kind||"Identifier"!==O.declarations[0].id.type)&&this.raise(O.start,(L?"for-in":"for-of")+" loop variable declaration may not have an initializer"),g.left=O,g.right=L?this.parseExpression():this.parseMaybeAssign(),this.expect(types$1.parenR),g.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(g,L?"ForInStatement":"ForOfStatement")},pp$8.parseVar=function(g,O,L,M){for(g.declarations=[],g.kind=L;;){var J=this.startNode();if(this.parseVarId(J,L),this.eat(types$1.eq)?J.init=this.parseMaybeAssign(O):M||"const"!==L||this.type===types$1._in||this.options.ecmaVersion>=6&&this.isContextual("of")?M||"Identifier"===J.id.type||O&&(this.type===types$1._in||this.isContextual("of"))?J.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),g.declarations.push(this.finishNode(J,"VariableDeclarator")),!this.eat(types$1.comma))break}return g},pp$8.parseVarId=function(g,O){g.id=this.parseBindingAtom(),this.checkLValPattern(g.id,"var"===O?BIND_VAR:BIND_LEXICAL,!1)};var FUNC_STATEMENT=1,FUNC_HANGING_STATEMENT=2,FUNC_NULLABLE_ID=4;function isPrivateNameConflicted(g,O){var L=O.key.name,M=g[L],J="true";return"MethodDefinition"!==O.type||"get"!==O.kind&&"set"!==O.kind||(J=(O.static?"s":"i")+O.kind),"iget"===M&&"iset"===J||"iset"===M&&"iget"===J||"sget"===M&&"sset"===J||"sset"===M&&"sget"===J?(g[L]="true",!1):!!M||(g[L]=J,!1)}function checkKeyName(g,O){var L=g.computed,M=g.key;return!L&&("Identifier"===M.type&&M.name===O||"Literal"===M.type&&M.value===O)}pp$8.parseFunction=function(g,O,L,M,J){this.initFunction(g),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!M)&&(this.type===types$1.star&&O&FUNC_HANGING_STATEMENT&&this.unexpected(),g.generator=this.eat(types$1.star)),this.options.ecmaVersion>=8&&(g.async=!!M),O&FUNC_STATEMENT&&(g.id=O&FUNC_NULLABLE_ID&&this.type!==types$1.name?null:this.parseIdent(),!g.id||O&FUNC_HANGING_STATEMENT||this.checkLValSimple(g.id,this.strict||g.generator||g.async?this.treatFunctionsAsVar?BIND_VAR:BIND_LEXICAL:BIND_FUNCTION));var ae=this.yieldPos,ie=this.awaitPos,ne=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(g.async,g.generator)),O&FUNC_STATEMENT||(g.id=this.type===types$1.name?this.parseIdent():null),this.parseFunctionParams(g),this.parseFunctionBody(g,L,!1,J),this.yieldPos=ae,this.awaitPos=ie,this.awaitIdentPos=ne,this.finishNode(g,O&FUNC_STATEMENT?"FunctionDeclaration":"FunctionExpression")},pp$8.parseFunctionParams=function(g){this.expect(types$1.parenL),g.params=this.parseBindingList(types$1.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},pp$8.parseClass=function(g,O){this.next();var L=this.strict;this.strict=!0,this.parseClassId(g,O),this.parseClassSuper(g);var M=this.enterClassBody(),J=this.startNode(),ae=!1;for(J.body=[],this.expect(types$1.braceL);this.type!==types$1.braceR;){var ie=this.parseClassElement(null!==g.superClass);ie&&(J.body.push(ie),"MethodDefinition"===ie.type&&"constructor"===ie.kind?(ae&&this.raiseRecoverable(ie.start,"Duplicate constructor in the same class"),ae=!0):ie.key&&"PrivateIdentifier"===ie.key.type&&isPrivateNameConflicted(M,ie)&&this.raiseRecoverable(ie.key.start,"Identifier '#"+ie.key.name+"' has already been declared"))}return this.strict=L,this.next(),g.body=this.finishNode(J,"ClassBody"),this.exitClassBody(),this.finishNode(g,O?"ClassDeclaration":"ClassExpression")},pp$8.parseClassElement=function(g){if(this.eat(types$1.semi))return null;var O=this.options.ecmaVersion,L=this.startNode(),M="",J=!1,ae=!1,ie="method",ne=!1;if(this.eatContextual("static")){if(O>=13&&this.eat(types$1.braceL))return this.parseClassStaticBlock(L),L;this.isClassElementNameStart()||this.type===types$1.star?ne=!0:M="static"}if(L.static=ne,!M&&O>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==types$1.star||this.canInsertSemicolon()?M="async":ae=!0),!M&&(O>=9||!ae)&&this.eat(types$1.star)&&(J=!0),!M&&!ae&&!J){var oe=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?ie=oe:M=oe)}if(M?(L.computed=!1,L.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),L.key.name=M,this.finishNode(L.key,"Identifier")):this.parseClassElementName(L),O<13||this.type===types$1.parenL||"method"!==ie||J||ae){var pe=!L.static&&checkKeyName(L,"constructor"),le=pe&&g;pe&&"method"!==ie&&this.raise(L.key.start,"Constructor can't have get/set modifier"),L.kind=pe?"constructor":ie,this.parseClassMethod(L,J,ae,le)}else this.parseClassField(L);return L},pp$8.isClassElementNameStart=function(){return this.type===types$1.name||this.type===types$1.privateId||this.type===types$1.num||this.type===types$1.string||this.type===types$1.bracketL||this.type.keyword},pp$8.parseClassElementName=function(g){this.type===types$1.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),g.computed=!1,g.key=this.parsePrivateIdent()):this.parsePropertyName(g)},pp$8.parseClassMethod=function(g,O,L,M){var J=g.key;"constructor"===g.kind?(O&&this.raise(J.start,"Constructor can't be a generator"),L&&this.raise(J.start,"Constructor can't be an async method")):g.static&&checkKeyName(g,"prototype")&&this.raise(J.start,"Classes may not have a static property named prototype");var ae=g.value=this.parseMethod(O,L,M);return"get"===g.kind&&0!==ae.params.length&&this.raiseRecoverable(ae.start,"getter should have no params"),"set"===g.kind&&1!==ae.params.length&&this.raiseRecoverable(ae.start,"setter should have exactly one param"),"set"===g.kind&&"RestElement"===ae.params[0].type&&this.raiseRecoverable(ae.params[0].start,"Setter cannot use rest params"),this.finishNode(g,"MethodDefinition")},pp$8.parseClassField=function(g){if(checkKeyName(g,"constructor")?this.raise(g.key.start,"Classes can't have a field named 'constructor'"):g.static&&checkKeyName(g,"prototype")&&this.raise(g.key.start,"Classes can't have a static field named 'prototype'"),this.eat(types$1.eq)){var O=this.currentThisScope(),L=O.inClassFieldInit;O.inClassFieldInit=!0,g.value=this.parseMaybeAssign(),O.inClassFieldInit=L}else g.value=null;return this.semicolon(),this.finishNode(g,"PropertyDefinition")},pp$8.parseClassStaticBlock=function(g){g.body=[];var O=this.labels;for(this.labels=[],this.enterScope(SCOPE_CLASS_STATIC_BLOCK|SCOPE_SUPER);this.type!==types$1.braceR;){var L=this.parseStatement(null);g.body.push(L)}return this.next(),this.exitScope(),this.labels=O,this.finishNode(g,"StaticBlock")},pp$8.parseClassId=function(g,O){this.type===types$1.name?(g.id=this.parseIdent(),O&&this.checkLValSimple(g.id,BIND_LEXICAL,!1)):(!0===O&&this.unexpected(),g.id=null)},pp$8.parseClassSuper=function(g){g.superClass=this.eat(types$1._extends)?this.parseExprSubscripts(null,!1):null},pp$8.enterClassBody=function(){var g={declared:Object.create(null),used:[]};return this.privateNameStack.push(g),g.declared},pp$8.exitClassBody=function(){var g=this.privateNameStack.pop(),O=g.declared,L=g.used;if(this.options.checkPrivateFields)for(var M=this.privateNameStack.length,J=0===M?null:this.privateNameStack[M-1],ae=0;ae<L.length;++ae){var ie=L[ae];hasOwn(O,ie.name)||(J?J.used.push(ie):this.raiseRecoverable(ie.start,"Private field '#"+ie.name+"' must be declared in an enclosing class"))}},pp$8.parseExportAllDeclaration=function(g,O){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(g.exported=this.parseModuleExportName(),this.checkExport(O,g.exported,this.lastTokStart)):g.exported=null),this.expectContextual("from"),this.type!==types$1.string&&this.unexpected(),g.source=this.parseExprAtom(),this.semicolon(),this.finishNode(g,"ExportAllDeclaration")},pp$8.parseExport=function(g,O){if(this.next(),this.eat(types$1.star))return this.parseExportAllDeclaration(g,O);if(this.eat(types$1._default))return this.checkExport(O,"default",this.lastTokStart),g.declaration=this.parseExportDefaultDeclaration(),this.finishNode(g,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())g.declaration=this.parseExportDeclaration(g),"VariableDeclaration"===g.declaration.type?this.checkVariableExport(O,g.declaration.declarations):this.checkExport(O,g.declaration.id,g.declaration.id.start),g.specifiers=[],g.source=null;else{if(g.declaration=null,g.specifiers=this.parseExportSpecifiers(O),this.eatContextual("from"))this.type!==types$1.string&&this.unexpected(),g.source=this.parseExprAtom();else{for(var L=0,M=g.specifiers;L<M.length;L+=1){var J=M[L];this.checkUnreserved(J.local),this.checkLocalExport(J.local),"Literal"===J.local.type&&this.raise(J.local.start,"A string literal cannot be used as an exported binding without `from`.")}g.source=null}this.semicolon()}return this.finishNode(g,"ExportNamedDeclaration")},pp$8.parseExportDeclaration=function(g){return this.parseStatement(null)},pp$8.parseExportDefaultDeclaration=function(){var g;if(this.type===types$1._function||(g=this.isAsyncFunction())){var O=this.startNode();return this.next(),g&&this.next(),this.parseFunction(O,FUNC_STATEMENT|FUNC_NULLABLE_ID,!1,g)}if(this.type===types$1._class){var L=this.startNode();return this.parseClass(L,"nullableID")}var M=this.parseMaybeAssign();return this.semicolon(),M},pp$8.checkExport=function(g,O,L){g&&("string"!=typeof O&&(O="Identifier"===O.type?O.name:O.value),hasOwn(g,O)&&this.raiseRecoverable(L,"Duplicate export '"+O+"'"),g[O]=!0)},pp$8.checkPatternExport=function(g,O){var L=O.type;if("Identifier"===L)this.checkExport(g,O,O.start);else if("ObjectPattern"===L)for(var M=0,J=O.properties;M<J.length;M+=1){var ae=J[M];this.checkPatternExport(g,ae)}else if("ArrayPattern"===L)for(var ie=0,ne=O.elements;ie<ne.length;ie+=1){var oe=ne[ie];oe&&this.checkPatternExport(g,oe)}else"Property"===L?this.checkPatternExport(g,O.value):"AssignmentPattern"===L?this.checkPatternExport(g,O.left):"RestElement"===L&&this.checkPatternExport(g,O.argument)},pp$8.checkVariableExport=function(g,O){if(g)for(var L=0,M=O;L<M.length;L+=1){var J=M[L];this.checkPatternExport(g,J.id)}},pp$8.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},pp$8.parseExportSpecifier=function(g){var O=this.startNode();return O.local=this.parseModuleExportName(),O.exported=this.eatContextual("as")?this.parseModuleExportName():O.local,this.checkExport(g,O.exported,O.exported.start),this.finishNode(O,"ExportSpecifier")},pp$8.parseExportSpecifiers=function(g){var O=[],L=!0;for(this.expect(types$1.braceL);!this.eat(types$1.braceR);){if(L)L=!1;else if(this.expect(types$1.comma),this.afterTrailingComma(types$1.braceR))break;O.push(this.parseExportSpecifier(g))}return O},pp$8.parseImport=function(g){return this.next(),this.type===types$1.string?(g.specifiers=empty$1,g.source=this.parseExprAtom()):(g.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),g.source=this.type===types$1.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(g,"ImportDeclaration")},pp$8.parseImportSpecifier=function(){var g=this.startNode();return g.imported=this.parseModuleExportName(),this.eatContextual("as")?g.local=this.parseIdent():(this.checkUnreserved(g.imported),g.local=g.imported),this.checkLValSimple(g.local,BIND_LEXICAL),this.finishNode(g,"ImportSpecifier")},pp$8.parseImportDefaultSpecifier=function(){var g=this.startNode();return g.local=this.parseIdent(),this.checkLValSimple(g.local,BIND_LEXICAL),this.finishNode(g,"ImportDefaultSpecifier")},pp$8.parseImportNamespaceSpecifier=function(){var g=this.startNode();return this.next(),this.expectContextual("as"),g.local=this.parseIdent(),this.checkLValSimple(g.local,BIND_LEXICAL),this.finishNode(g,"ImportNamespaceSpecifier")},pp$8.parseImportSpecifiers=function(){var g=[],O=!0;if(this.type===types$1.name&&(g.push(this.parseImportDefaultSpecifier()),!this.eat(types$1.comma)))return g;if(this.type===types$1.star)return g.push(this.parseImportNamespaceSpecifier()),g;for(this.expect(types$1.braceL);!this.eat(types$1.braceR);){if(O)O=!1;else if(this.expect(types$1.comma),this.afterTrailingComma(types$1.braceR))break;g.push(this.parseImportSpecifier())}return g},pp$8.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===types$1.string){var g=this.parseLiteral(this.value);return loneSurrogate.test(g.value)&&this.raise(g.start,"An export name cannot include a lone surrogate."),g}return this.parseIdent(!0)},pp$8.adaptDirectivePrologue=function(g){for(var O=0;O<g.length&&this.isDirectiveCandidate(g[O]);++O)g[O].directive=g[O].expression.raw.slice(1,-1)},pp$8.isDirectiveCandidate=function(g){return this.options.ecmaVersion>=5&&"ExpressionStatement"===g.type&&"Literal"===g.expression.type&&"string"==typeof g.expression.value&&('"'===this.input[g.start]||"'"===this.input[g.start])};var pp$7=Parser.prototype;pp$7.toAssignable=function(g,O,L){if(this.options.ecmaVersion>=6&&g)switch(g.type){case"Identifier":this.inAsync&&"await"===g.name&&this.raise(g.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":g.type="ObjectPattern",L&&this.checkPatternErrors(L,!0);for(var M=0,J=g.properties;M<J.length;M+=1){var ae=J[M];this.toAssignable(ae,O),"RestElement"!==ae.type||"ArrayPattern"!==ae.argument.type&&"ObjectPattern"!==ae.argument.type||this.raise(ae.argument.start,"Unexpected token")}break;case"Property":"init"!==g.kind&&this.raise(g.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(g.value,O);break;case"ArrayExpression":g.type="ArrayPattern",L&&this.checkPatternErrors(L,!0),this.toAssignableList(g.elements,O);break;case"SpreadElement":g.type="RestElement",this.toAssignable(g.argument,O),"AssignmentPattern"===g.argument.type&&this.raise(g.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==g.operator&&this.raise(g.left.end,"Only '=' operator can be used for specifying default value."),g.type="AssignmentPattern",delete g.operator,this.toAssignable(g.left,O);break;case"ParenthesizedExpression":this.toAssignable(g.expression,O,L);break;case"ChainExpression":this.raiseRecoverable(g.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!O)break;default:this.raise(g.start,"Assigning to rvalue")}else L&&this.checkPatternErrors(L,!0);return g},pp$7.toAssignableList=function(g,O){for(var L=g.length,M=0;M<L;M++){var J=g[M];J&&this.toAssignable(J,O)}if(L){var ae=g[L-1];6===this.options.ecmaVersion&&O&&ae&&"RestElement"===ae.type&&"Identifier"!==ae.argument.type&&this.unexpected(ae.argument.start)}return g},pp$7.parseSpread=function(g){var O=this.startNode();return this.next(),O.argument=this.parseMaybeAssign(!1,g),this.finishNode(O,"SpreadElement")},pp$7.parseRestBinding=function(){var g=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==types$1.name&&this.unexpected(),g.argument=this.parseBindingAtom(),this.finishNode(g,"RestElement")},pp$7.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case types$1.bracketL:var g=this.startNode();return this.next(),g.elements=this.parseBindingList(types$1.bracketR,!0,!0),this.finishNode(g,"ArrayPattern");case types$1.braceL:return this.parseObj(!0)}return this.parseIdent()},pp$7.parseBindingList=function(g,O,L,M){for(var J=[],ae=!0;!this.eat(g);)if(ae?ae=!1:this.expect(types$1.comma),O&&this.type===types$1.comma)J.push(null);else{if(L&&this.afterTrailingComma(g))break;if(this.type===types$1.ellipsis){var ie=this.parseRestBinding();this.parseBindingListItem(ie),J.push(ie),this.type===types$1.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(g);break}J.push(this.parseAssignableListItem(M))}return J},pp$7.parseAssignableListItem=function(g){var O=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(O),O},pp$7.parseBindingListItem=function(g){return g},pp$7.parseMaybeDefault=function(g,O,L){if(L=L||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(types$1.eq))return L;var M=this.startNodeAt(g,O);return M.left=L,M.right=this.parseMaybeAssign(),this.finishNode(M,"AssignmentPattern")},pp$7.checkLValSimple=function(g,O,L){void 0===O&&(O=BIND_NONE);var M=O!==BIND_NONE;switch(g.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(g.name)&&this.raiseRecoverable(g.start,(M?"Binding ":"Assigning to ")+g.name+" in strict mode"),M&&(O===BIND_LEXICAL&&"let"===g.name&&this.raiseRecoverable(g.start,"let is disallowed as a lexically bound name"),L&&(hasOwn(L,g.name)&&this.raiseRecoverable(g.start,"Argument name clash"),L[g.name]=!0),O!==BIND_OUTSIDE&&this.declareName(g.name,O,g.start));break;case"ChainExpression":this.raiseRecoverable(g.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":M&&this.raiseRecoverable(g.start,"Binding member expression");break;case"ParenthesizedExpression":return M&&this.raiseRecoverable(g.start,"Binding parenthesized expression"),this.checkLValSimple(g.expression,O,L);default:this.raise(g.start,(M?"Binding":"Assigning to")+" rvalue")}},pp$7.checkLValPattern=function(g,O,L){switch(void 0===O&&(O=BIND_NONE),g.type){case"ObjectPattern":for(var M=0,J=g.properties;M<J.length;M+=1){var ae=J[M];this.checkLValInnerPattern(ae,O,L)}break;case"ArrayPattern":for(var ie=0,ne=g.elements;ie<ne.length;ie+=1){var oe=ne[ie];oe&&this.checkLValInnerPattern(oe,O,L)}break;default:this.checkLValSimple(g,O,L)}},pp$7.checkLValInnerPattern=function(g,O,L){switch(void 0===O&&(O=BIND_NONE),g.type){case"Property":this.checkLValInnerPattern(g.value,O,L);break;case"AssignmentPattern":this.checkLValPattern(g.left,O,L);break;case"RestElement":this.checkLValPattern(g.argument,O,L);break;default:this.checkLValPattern(g,O,L)}};var TokContext=function TokContext(g,O,L,M,J){this.token=g,this.isExpr=!!O,this.preserveSpace=!!L,this.override=M,this.generator=!!J},types={b_stat:new TokContext("{",!1),b_expr:new TokContext("{",!0),b_tmpl:new TokContext("${",!1),p_stat:new TokContext("(",!1),p_expr:new TokContext("(",!0),q_tmpl:new TokContext("`",!0,!0,(function(g){return g.tryReadTemplateToken()})),f_stat:new TokContext("function",!1),f_expr:new TokContext("function",!0),f_expr_gen:new TokContext("function",!0,!1,null,!0),f_gen:new TokContext("function",!1,!1,null,!0)},pp$6=Parser.prototype;pp$6.initialContext=function(){return[types.b_stat]},pp$6.curContext=function(){return this.context[this.context.length-1]},pp$6.braceIsBlock=function(g){var O=this.curContext();return O===types.f_expr||O===types.f_stat||(g!==types$1.colon||O!==types.b_stat&&O!==types.b_expr?g===types$1._return||g===types$1.name&&this.exprAllowed?lineBreak.test(this.input.slice(this.lastTokEnd,this.start)):g===types$1._else||g===types$1.semi||g===types$1.eof||g===types$1.parenR||g===types$1.arrow||(g===types$1.braceL?O===types.b_stat:g!==types$1._var&&g!==types$1._const&&g!==types$1.name&&!this.exprAllowed):!O.isExpr)},pp$6.inGeneratorContext=function(){for(var g=this.context.length-1;g>=1;g--){var O=this.context[g];if("function"===O.token)return O.generator}return!1},pp$6.updateContext=function(g){var O,L=this.type;L.keyword&&g===types$1.dot?this.exprAllowed=!1:(O=L.updateContext)?O.call(this,g):this.exprAllowed=L.beforeExpr},pp$6.overrideContext=function(g){this.curContext()!==g&&(this.context[this.context.length-1]=g)},types$1.parenR.updateContext=types$1.braceR.updateContext=function(){if(1!==this.context.length){var g=this.context.pop();g===types.b_stat&&"function"===this.curContext().token&&(g=this.context.pop()),this.exprAllowed=!g.isExpr}else this.exprAllowed=!0},types$1.braceL.updateContext=function(g){this.context.push(this.braceIsBlock(g)?types.b_stat:types.b_expr),this.exprAllowed=!0},types$1.dollarBraceL.updateContext=function(){this.context.push(types.b_tmpl),this.exprAllowed=!0},types$1.parenL.updateContext=function(g){var O=g===types$1._if||g===types$1._for||g===types$1._with||g===types$1._while;this.context.push(O?types.p_stat:types.p_expr),this.exprAllowed=!0},types$1.incDec.updateContext=function(){},types$1._function.updateContext=types$1._class.updateContext=function(g){!g.beforeExpr||g===types$1._else||g===types$1.semi&&this.curContext()!==types.p_stat||g===types$1._return&&lineBreak.test(this.input.slice(this.lastTokEnd,this.start))||(g===types$1.colon||g===types$1.braceL)&&this.curContext()===types.b_stat?this.context.push(types.f_stat):this.context.push(types.f_expr),this.exprAllowed=!1},types$1.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},types$1.backQuote.updateContext=function(){this.curContext()===types.q_tmpl?this.context.pop():this.context.push(types.q_tmpl),this.exprAllowed=!1},types$1.star.updateContext=function(g){if(g===types$1._function){var O=this.context.length-1;this.context[O]===types.f_expr?this.context[O]=types.f_expr_gen:this.context[O]=types.f_gen}this.exprAllowed=!0},types$1.name.updateContext=function(g){var O=!1;this.options.ecmaVersion>=6&&g!==types$1.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(O=!0),this.exprAllowed=O};var pp$5=Parser.prototype;function isLocalVariableAccess(g){return"Identifier"===g.type||"ParenthesizedExpression"===g.type&&isLocalVariableAccess(g.expression)}function isPrivateFieldAccess(g){return"MemberExpression"===g.type&&"PrivateIdentifier"===g.property.type||"ChainExpression"===g.type&&isPrivateFieldAccess(g.expression)||"ParenthesizedExpression"===g.type&&isPrivateFieldAccess(g.expression)}pp$5.checkPropClash=function(g,O,L){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===g.type||this.options.ecmaVersion>=6&&(g.computed||g.method||g.shorthand))){var M,J=g.key;switch(J.type){case"Identifier":M=J.name;break;case"Literal":M=String(J.value);break;default:return}var ae=g.kind;if(this.options.ecmaVersion>=6)"__proto__"===M&&"init"===ae&&(O.proto&&(L?L.doubleProto<0&&(L.doubleProto=J.start):this.raiseRecoverable(J.start,"Redefinition of __proto__ property")),O.proto=!0);else{var ie=O[M="$"+M];if(ie)("init"===ae?this.strict&&ie.init||ie.get||ie.set:ie.init||ie[ae])&&this.raiseRecoverable(J.start,"Redefinition of property");else ie=O[M]={init:!1,get:!1,set:!1};ie[ae]=!0}}},pp$5.parseExpression=function(g,O){var L=this.start,M=this.startLoc,J=this.parseMaybeAssign(g,O);if(this.type===types$1.comma){var ae=this.startNodeAt(L,M);for(ae.expressions=[J];this.eat(types$1.comma);)ae.expressions.push(this.parseMaybeAssign(g,O));return this.finishNode(ae,"SequenceExpression")}return J},pp$5.parseMaybeAssign=function(g,O,L){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(g);this.exprAllowed=!1}var M=!1,J=-1,ae=-1,ie=-1;O?(J=O.parenthesizedAssign,ae=O.trailingComma,ie=O.doubleProto,O.parenthesizedAssign=O.trailingComma=-1):(O=new DestructuringErrors,M=!0);var ne=this.start,oe=this.startLoc;this.type!==types$1.parenL&&this.type!==types$1.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===g);var pe=this.parseMaybeConditional(g,O);if(L&&(pe=L.call(this,pe,ne,oe)),this.type.isAssign){var le=this.startNodeAt(ne,oe);return le.operator=this.value,this.type===types$1.eq&&(pe=this.toAssignable(pe,!1,O)),M||(O.parenthesizedAssign=O.trailingComma=O.doubleProto=-1),O.shorthandAssign>=pe.start&&(O.shorthandAssign=-1),this.type===types$1.eq?this.checkLValPattern(pe):this.checkLValSimple(pe),le.left=pe,this.next(),le.right=this.parseMaybeAssign(g),ie>-1&&(O.doubleProto=ie),this.finishNode(le,"AssignmentExpression")}return M&&this.checkExpressionErrors(O,!0),J>-1&&(O.parenthesizedAssign=J),ae>-1&&(O.trailingComma=ae),pe},pp$5.parseMaybeConditional=function(g,O){var L=this.start,M=this.startLoc,J=this.parseExprOps(g,O);if(this.checkExpressionErrors(O))return J;if(this.eat(types$1.question)){var ae=this.startNodeAt(L,M);return ae.test=J,ae.consequent=this.parseMaybeAssign(),this.expect(types$1.colon),ae.alternate=this.parseMaybeAssign(g),this.finishNode(ae,"ConditionalExpression")}return J},pp$5.parseExprOps=function(g,O){var L=this.start,M=this.startLoc,J=this.parseMaybeUnary(O,!1,!1,g);return this.checkExpressionErrors(O)||J.start===L&&"ArrowFunctionExpression"===J.type?J:this.parseExprOp(J,L,M,-1,g)},pp$5.parseExprOp=function(g,O,L,M,J){var ae=this.type.binop;if(null!=ae&&(!J||this.type!==types$1._in)&&ae>M){var ie=this.type===types$1.logicalOR||this.type===types$1.logicalAND,ne=this.type===types$1.coalesce;ne&&(ae=types$1.logicalAND.binop);var oe=this.value;this.next();var pe=this.start,le=this.startLoc,ue=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,J),pe,le,ae,J),de=this.buildBinary(O,L,g,ue,oe,ie||ne);return(ie&&this.type===types$1.coalesce||ne&&(this.type===types$1.logicalOR||this.type===types$1.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(de,O,L,M,J)}return g},pp$5.buildBinary=function(g,O,L,M,J,ae){"PrivateIdentifier"===M.type&&this.raise(M.start,"Private identifier can only be left side of binary expression");var ie=this.startNodeAt(g,O);return ie.left=L,ie.operator=J,ie.right=M,this.finishNode(ie,ae?"LogicalExpression":"BinaryExpression")},pp$5.parseMaybeUnary=function(g,O,L,M){var J,ae=this.start,ie=this.startLoc;if(this.isContextual("await")&&this.canAwait)J=this.parseAwait(M),O=!0;else if(this.type.prefix){var ne=this.startNode(),oe=this.type===types$1.incDec;ne.operator=this.value,ne.prefix=!0,this.next(),ne.argument=this.parseMaybeUnary(null,!0,oe,M),this.checkExpressionErrors(g,!0),oe?this.checkLValSimple(ne.argument):this.strict&&"delete"===ne.operator&&isLocalVariableAccess(ne.argument)?this.raiseRecoverable(ne.start,"Deleting local variable in strict mode"):"delete"===ne.operator&&isPrivateFieldAccess(ne.argument)?this.raiseRecoverable(ne.start,"Private fields can not be deleted"):O=!0,J=this.finishNode(ne,oe?"UpdateExpression":"UnaryExpression")}else if(O||this.type!==types$1.privateId){if(J=this.parseExprSubscripts(g,M),this.checkExpressionErrors(g))return J;for(;this.type.postfix&&!this.canInsertSemicolon();){var pe=this.startNodeAt(ae,ie);pe.operator=this.value,pe.prefix=!1,pe.argument=J,this.checkLValSimple(J),this.next(),J=this.finishNode(pe,"UpdateExpression")}}else(M||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),J=this.parsePrivateIdent(),this.type!==types$1._in&&this.unexpected();return L||!this.eat(types$1.starstar)?J:O?void this.unexpected(this.lastTokStart):this.buildBinary(ae,ie,J,this.parseMaybeUnary(null,!1,!1,M),"**",!1)},pp$5.parseExprSubscripts=function(g,O){var L=this.start,M=this.startLoc,J=this.parseExprAtom(g,O);if("ArrowFunctionExpression"===J.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return J;var ae=this.parseSubscripts(J,L,M,!1,O);return g&&"MemberExpression"===ae.type&&(g.parenthesizedAssign>=ae.start&&(g.parenthesizedAssign=-1),g.parenthesizedBind>=ae.start&&(g.parenthesizedBind=-1),g.trailingComma>=ae.start&&(g.trailingComma=-1)),ae},pp$5.parseSubscripts=function(g,O,L,M,J){for(var ae=this.options.ecmaVersion>=8&&"Identifier"===g.type&&"async"===g.name&&this.lastTokEnd===g.end&&!this.canInsertSemicolon()&&g.end-g.start==5&&this.potentialArrowAt===g.start,ie=!1;;){var ne=this.parseSubscript(g,O,L,M,ae,ie,J);if(ne.optional&&(ie=!0),ne===g||"ArrowFunctionExpression"===ne.type){if(ie){var oe=this.startNodeAt(O,L);oe.expression=ne,ne=this.finishNode(oe,"ChainExpression")}return ne}g=ne}},pp$5.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(types$1.arrow)},pp$5.parseSubscriptAsyncArrow=function(g,O,L,M){return this.parseArrowExpression(this.startNodeAt(g,O),L,!0,M)},pp$5.parseSubscript=function(g,O,L,M,J,ae,ie){var ne=this.options.ecmaVersion>=11,oe=ne&&this.eat(types$1.questionDot);M&&oe&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var pe=this.eat(types$1.bracketL);if(pe||oe&&this.type!==types$1.parenL&&this.type!==types$1.backQuote||this.eat(types$1.dot)){var le=this.startNodeAt(O,L);le.object=g,pe?(le.property=this.parseExpression(),this.expect(types$1.bracketR)):this.type===types$1.privateId&&"Super"!==g.type?le.property=this.parsePrivateIdent():le.property=this.parseIdent("never"!==this.options.allowReserved),le.computed=!!pe,ne&&(le.optional=oe),g=this.finishNode(le,"MemberExpression")}else if(!M&&this.eat(types$1.parenL)){var ue=new DestructuringErrors,de=this.yieldPos,he=this.awaitPos,ye=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var me=this.parseExprList(types$1.parenR,this.options.ecmaVersion>=8,!1,ue);if(J&&!oe&&this.shouldParseAsyncArrow())return this.checkPatternErrors(ue,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=de,this.awaitPos=he,this.awaitIdentPos=ye,this.parseSubscriptAsyncArrow(O,L,me,ie);this.checkExpressionErrors(ue,!0),this.yieldPos=de||this.yieldPos,this.awaitPos=he||this.awaitPos,this.awaitIdentPos=ye||this.awaitIdentPos;var fe=this.startNodeAt(O,L);fe.callee=g,fe.arguments=me,ne&&(fe.optional=oe),g=this.finishNode(fe,"CallExpression")}else if(this.type===types$1.backQuote){(oe||ae)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var ge=this.startNodeAt(O,L);ge.tag=g,ge.quasi=this.parseTemplate({isTagged:!0}),g=this.finishNode(ge,"TaggedTemplateExpression")}return g},pp$5.parseExprAtom=function(g,O,L){this.type===types$1.slash&&this.readRegexp();var M,J=this.potentialArrowAt===this.start;switch(this.type){case types$1._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),M=this.startNode(),this.next(),this.type!==types$1.parenL||this.allowDirectSuper||this.raise(M.start,"super() call outside constructor of a subclass"),this.type!==types$1.dot&&this.type!==types$1.bracketL&&this.type!==types$1.parenL&&this.unexpected(),this.finishNode(M,"Super");case types$1._this:return M=this.startNode(),this.next(),this.finishNode(M,"ThisExpression");case types$1.name:var ae=this.start,ie=this.startLoc,ne=this.containsEsc,oe=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!ne&&"async"===oe.name&&!this.canInsertSemicolon()&&this.eat(types$1._function))return this.overrideContext(types.f_expr),this.parseFunction(this.startNodeAt(ae,ie),0,!1,!0,O);if(J&&!this.canInsertSemicolon()){if(this.eat(types$1.arrow))return this.parseArrowExpression(this.startNodeAt(ae,ie),[oe],!1,O);if(this.options.ecmaVersion>=8&&"async"===oe.name&&this.type===types$1.name&&!ne&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return oe=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(types$1.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(ae,ie),[oe],!0,O)}return oe;case types$1.regexp:var pe=this.value;return(M=this.parseLiteral(pe.value)).regex={pattern:pe.pattern,flags:pe.flags},M;case types$1.num:case types$1.string:return this.parseLiteral(this.value);case types$1._null:case types$1._true:case types$1._false:return(M=this.startNode()).value=this.type===types$1._null?null:this.type===types$1._true,M.raw=this.type.keyword,this.next(),this.finishNode(M,"Literal");case types$1.parenL:var le=this.start,ue=this.parseParenAndDistinguishExpression(J,O);return g&&(g.parenthesizedAssign<0&&!this.isSimpleAssignTarget(ue)&&(g.parenthesizedAssign=le),g.parenthesizedBind<0&&(g.parenthesizedBind=le)),ue;case types$1.bracketL:return M=this.startNode(),this.next(),M.elements=this.parseExprList(types$1.bracketR,!0,!0,g),this.finishNode(M,"ArrayExpression");case types$1.braceL:return this.overrideContext(types.b_expr),this.parseObj(!1,g);case types$1._function:return M=this.startNode(),this.next(),this.parseFunction(M,0);case types$1._class:return this.parseClass(this.startNode(),!1);case types$1._new:return this.parseNew();case types$1.backQuote:return this.parseTemplate();case types$1._import:return this.options.ecmaVersion>=11?this.parseExprImport(L):this.unexpected();default:return this.parseExprAtomDefault()}},pp$5.parseExprAtomDefault=function(){this.unexpected()},pp$5.parseExprImport=function(g){var O=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===types$1.parenL&&!g)return this.parseDynamicImport(O);if(this.type===types$1.dot){var L=this.startNodeAt(O.start,O.loc&&O.loc.start);return L.name="import",O.meta=this.finishNode(L,"Identifier"),this.parseImportMeta(O)}this.unexpected()},pp$5.parseDynamicImport=function(g){if(this.next(),g.source=this.parseMaybeAssign(),!this.eat(types$1.parenR)){var O=this.start;this.eat(types$1.comma)&&this.eat(types$1.parenR)?this.raiseRecoverable(O,"Trailing comma is not allowed in import()"):this.unexpected(O)}return this.finishNode(g,"ImportExpression")},pp$5.parseImportMeta=function(g){this.next();var O=this.containsEsc;return g.property=this.parseIdent(!0),"meta"!==g.property.name&&this.raiseRecoverable(g.property.start,"The only valid meta property for import is 'import.meta'"),O&&this.raiseRecoverable(g.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(g.start,"Cannot use 'import.meta' outside a module"),this.finishNode(g,"MetaProperty")},pp$5.parseLiteral=function(g){var O=this.startNode();return O.value=g,O.raw=this.input.slice(this.start,this.end),110===O.raw.charCodeAt(O.raw.length-1)&&(O.bigint=O.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(O,"Literal")},pp$5.parseParenExpression=function(){this.expect(types$1.parenL);var g=this.parseExpression();return this.expect(types$1.parenR),g},pp$5.shouldParseArrow=function(g){return!this.canInsertSemicolon()},pp$5.parseParenAndDistinguishExpression=function(g,O){var L,M=this.start,J=this.startLoc,ae=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var ie,ne=this.start,oe=this.startLoc,pe=[],le=!0,ue=!1,de=new DestructuringErrors,he=this.yieldPos,ye=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==types$1.parenR;){if(le?le=!1:this.expect(types$1.comma),ae&&this.afterTrailingComma(types$1.parenR,!0)){ue=!0;break}if(this.type===types$1.ellipsis){ie=this.start,pe.push(this.parseParenItem(this.parseRestBinding())),this.type===types$1.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}pe.push(this.parseMaybeAssign(!1,de,this.parseParenItem))}var me=this.lastTokEnd,fe=this.lastTokEndLoc;if(this.expect(types$1.parenR),g&&this.shouldParseArrow(pe)&&this.eat(types$1.arrow))return this.checkPatternErrors(de,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=he,this.awaitPos=ye,this.parseParenArrowList(M,J,pe,O);pe.length&&!ue||this.unexpected(this.lastTokStart),ie&&this.unexpected(ie),this.checkExpressionErrors(de,!0),this.yieldPos=he||this.yieldPos,this.awaitPos=ye||this.awaitPos,pe.length>1?((L=this.startNodeAt(ne,oe)).expressions=pe,this.finishNodeAt(L,"SequenceExpression",me,fe)):L=pe[0]}else L=this.parseParenExpression();if(this.options.preserveParens){var ge=this.startNodeAt(M,J);return ge.expression=L,this.finishNode(ge,"ParenthesizedExpression")}return L},pp$5.parseParenItem=function(g){return g},pp$5.parseParenArrowList=function(g,O,L,M){return this.parseArrowExpression(this.startNodeAt(g,O),L,!1,M)};var empty=[];pp$5.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var g=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===types$1.dot){var O=this.startNodeAt(g.start,g.loc&&g.loc.start);O.name="new",g.meta=this.finishNode(O,"Identifier"),this.next();var L=this.containsEsc;return g.property=this.parseIdent(!0),"target"!==g.property.name&&this.raiseRecoverable(g.property.start,"The only valid meta property for new is 'new.target'"),L&&this.raiseRecoverable(g.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(g.start,"'new.target' can only be used in functions and class static block"),this.finishNode(g,"MetaProperty")}var M=this.start,J=this.startLoc;return g.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),M,J,!0,!1),this.eat(types$1.parenL)?g.arguments=this.parseExprList(types$1.parenR,this.options.ecmaVersion>=8,!1):g.arguments=empty,this.finishNode(g,"NewExpression")},pp$5.parseTemplateElement=function(g){var O=g.isTagged,L=this.startNode();return this.type===types$1.invalidTemplate?(O||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),L.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):L.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),L.tail=this.type===types$1.backQuote,this.finishNode(L,"TemplateElement")},pp$5.parseTemplate=function(g){void 0===g&&(g={});var O=g.isTagged;void 0===O&&(O=!1);var L=this.startNode();this.next(),L.expressions=[];var M=this.parseTemplateElement({isTagged:O});for(L.quasis=[M];!M.tail;)this.type===types$1.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(types$1.dollarBraceL),L.expressions.push(this.parseExpression()),this.expect(types$1.braceR),L.quasis.push(M=this.parseTemplateElement({isTagged:O}));return this.next(),this.finishNode(L,"TemplateLiteral")},pp$5.isAsyncProp=function(g){return!g.computed&&"Identifier"===g.key.type&&"async"===g.key.name&&(this.type===types$1.name||this.type===types$1.num||this.type===types$1.string||this.type===types$1.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===types$1.star)&&!lineBreak.test(this.input.slice(this.lastTokEnd,this.start))},pp$5.parseObj=function(g,O){var L=this.startNode(),M=!0,J={};for(L.properties=[],this.next();!this.eat(types$1.braceR);){if(M)M=!1;else if(this.expect(types$1.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(types$1.braceR))break;var ae=this.parseProperty(g,O);g||this.checkPropClash(ae,J,O),L.properties.push(ae)}return this.finishNode(L,g?"ObjectPattern":"ObjectExpression")},pp$5.parseProperty=function(g,O){var L,M,J,ae,ie=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(types$1.ellipsis))return g?(ie.argument=this.parseIdent(!1),this.type===types$1.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(ie,"RestElement")):(ie.argument=this.parseMaybeAssign(!1,O),this.type===types$1.comma&&O&&O.trailingComma<0&&(O.trailingComma=this.start),this.finishNode(ie,"SpreadElement"));this.options.ecmaVersion>=6&&(ie.method=!1,ie.shorthand=!1,(g||O)&&(J=this.start,ae=this.startLoc),g||(L=this.eat(types$1.star)));var ne=this.containsEsc;return this.parsePropertyName(ie),!g&&!ne&&this.options.ecmaVersion>=8&&!L&&this.isAsyncProp(ie)?(M=!0,L=this.options.ecmaVersion>=9&&this.eat(types$1.star),this.parsePropertyName(ie)):M=!1,this.parsePropertyValue(ie,g,L,M,J,ae,O,ne),this.finishNode(ie,"Property")},pp$5.parseGetterSetter=function(g){g.kind=g.key.name,this.parsePropertyName(g),g.value=this.parseMethod(!1);var O="get"===g.kind?0:1;if(g.value.params.length!==O){var L=g.value.start;"get"===g.kind?this.raiseRecoverable(L,"getter should have no params"):this.raiseRecoverable(L,"setter should have exactly one param")}else"set"===g.kind&&"RestElement"===g.value.params[0].type&&this.raiseRecoverable(g.value.params[0].start,"Setter cannot use rest params")},pp$5.parsePropertyValue=function(g,O,L,M,J,ae,ie,ne){(L||M)&&this.type===types$1.colon&&this.unexpected(),this.eat(types$1.colon)?(g.value=O?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,ie),g.kind="init"):this.options.ecmaVersion>=6&&this.type===types$1.parenL?(O&&this.unexpected(),g.kind="init",g.method=!0,g.value=this.parseMethod(L,M)):O||ne||!(this.options.ecmaVersion>=5)||g.computed||"Identifier"!==g.key.type||"get"!==g.key.name&&"set"!==g.key.name||this.type===types$1.comma||this.type===types$1.braceR||this.type===types$1.eq?this.options.ecmaVersion>=6&&!g.computed&&"Identifier"===g.key.type?((L||M)&&this.unexpected(),this.checkUnreserved(g.key),"await"!==g.key.name||this.awaitIdentPos||(this.awaitIdentPos=J),g.kind="init",O?g.value=this.parseMaybeDefault(J,ae,this.copyNode(g.key)):this.type===types$1.eq&&ie?(ie.shorthandAssign<0&&(ie.shorthandAssign=this.start),g.value=this.parseMaybeDefault(J,ae,this.copyNode(g.key))):g.value=this.copyNode(g.key),g.shorthand=!0):this.unexpected():((L||M)&&this.unexpected(),this.parseGetterSetter(g))},pp$5.parsePropertyName=function(g){if(this.options.ecmaVersion>=6){if(this.eat(types$1.bracketL))return g.computed=!0,g.key=this.parseMaybeAssign(),this.expect(types$1.bracketR),g.key;g.computed=!1}return g.key=this.type===types$1.num||this.type===types$1.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},pp$5.initFunction=function(g){g.id=null,this.options.ecmaVersion>=6&&(g.generator=g.expression=!1),this.options.ecmaVersion>=8&&(g.async=!1)},pp$5.parseMethod=function(g,O,L){var M=this.startNode(),J=this.yieldPos,ae=this.awaitPos,ie=this.awaitIdentPos;return this.initFunction(M),this.options.ecmaVersion>=6&&(M.generator=g),this.options.ecmaVersion>=8&&(M.async=!!O),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(O,M.generator)|SCOPE_SUPER|(L?SCOPE_DIRECT_SUPER:0)),this.expect(types$1.parenL),M.params=this.parseBindingList(types$1.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(M,!1,!0,!1),this.yieldPos=J,this.awaitPos=ae,this.awaitIdentPos=ie,this.finishNode(M,"FunctionExpression")},pp$5.parseArrowExpression=function(g,O,L,M){var J=this.yieldPos,ae=this.awaitPos,ie=this.awaitIdentPos;return this.enterScope(functionFlags(L,!1)|SCOPE_ARROW),this.initFunction(g),this.options.ecmaVersion>=8&&(g.async=!!L),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,g.params=this.toAssignableList(O,!0),this.parseFunctionBody(g,!0,!1,M),this.yieldPos=J,this.awaitPos=ae,this.awaitIdentPos=ie,this.finishNode(g,"ArrowFunctionExpression")},pp$5.parseFunctionBody=function(g,O,L,M){var J=O&&this.type!==types$1.braceL,ae=this.strict,ie=!1;if(J)g.body=this.parseMaybeAssign(M),g.expression=!0,this.checkParams(g,!1);else{var ne=this.options.ecmaVersion>=7&&!this.isSimpleParamList(g.params);ae&&!ne||(ie=this.strictDirective(this.end))&&ne&&this.raiseRecoverable(g.start,"Illegal 'use strict' directive in function with non-simple parameter list");var oe=this.labels;this.labels=[],ie&&(this.strict=!0),this.checkParams(g,!ae&&!ie&&!O&&!L&&this.isSimpleParamList(g.params)),this.strict&&g.id&&this.checkLValSimple(g.id,BIND_OUTSIDE),g.body=this.parseBlock(!1,void 0,ie&&!ae),g.expression=!1,this.adaptDirectivePrologue(g.body.body),this.labels=oe}this.exitScope()},pp$5.isSimpleParamList=function(g){for(var O=0,L=g;O<L.length;O+=1){if("Identifier"!==L[O].type)return!1}return!0},pp$5.checkParams=function(g,O){for(var L=Object.create(null),M=0,J=g.params;M<J.length;M+=1){var ae=J[M];this.checkLValInnerPattern(ae,BIND_VAR,O?null:L)}},pp$5.parseExprList=function(g,O,L,M){for(var J=[],ae=!0;!this.eat(g);){if(ae)ae=!1;else if(this.expect(types$1.comma),O&&this.afterTrailingComma(g))break;var ie=void 0;L&&this.type===types$1.comma?ie=null:this.type===types$1.ellipsis?(ie=this.parseSpread(M),M&&this.type===types$1.comma&&M.trailingComma<0&&(M.trailingComma=this.start)):ie=this.parseMaybeAssign(!1,M),J.push(ie)}return J},pp$5.checkUnreserved=function(g){var O=g.start,L=g.end,M=g.name;(this.inGenerator&&"yield"===M&&this.raiseRecoverable(O,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===M&&this.raiseRecoverable(O,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&"arguments"===M&&this.raiseRecoverable(O,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==M&&"await"!==M||this.raise(O,"Cannot use "+M+" in class static initialization block"),this.keywords.test(M)&&this.raise(O,"Unexpected keyword '"+M+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(O,L).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(M)&&(this.inAsync||"await"!==M||this.raiseRecoverable(O,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(O,"The keyword '"+M+"' is reserved"))},pp$5.parseIdent=function(g){var O=this.parseIdentNode();return this.next(!!g),this.finishNode(O,"Identifier"),g||(this.checkUnreserved(O),"await"!==O.name||this.awaitIdentPos||(this.awaitIdentPos=O.start)),O},pp$5.parseIdentNode=function(){var g=this.startNode();return this.type===types$1.name?g.name=this.value:this.type.keyword?(g.name=this.type.keyword,"class"!==g.name&&"function"!==g.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop(),this.type=types$1.name):this.unexpected(),g},pp$5.parsePrivateIdent=function(){var g=this.startNode();return this.type===types$1.privateId?g.name=this.value:this.unexpected(),this.next(),this.finishNode(g,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(g.start,"Private field '#"+g.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(g)),g},pp$5.parseYield=function(g){this.yieldPos||(this.yieldPos=this.start);var O=this.startNode();return this.next(),this.type===types$1.semi||this.canInsertSemicolon()||this.type!==types$1.star&&!this.type.startsExpr?(O.delegate=!1,O.argument=null):(O.delegate=this.eat(types$1.star),O.argument=this.parseMaybeAssign(g)),this.finishNode(O,"YieldExpression")},pp$5.parseAwait=function(g){this.awaitPos||(this.awaitPos=this.start);var O=this.startNode();return this.next(),O.argument=this.parseMaybeUnary(null,!0,!1,g),this.finishNode(O,"AwaitExpression")};var pp$4=Parser.prototype;pp$4.raise=function(g,O){var L=getLineInfo(this.input,g);O+=" ("+L.line+":"+L.column+")";var M=new SyntaxError(O);throw M.pos=g,M.loc=L,M.raisedAt=this.pos,M},pp$4.raiseRecoverable=pp$4.raise,pp$4.curPosition=function(){if(this.options.locations)return new Position(this.curLine,this.pos-this.lineStart)};var pp$3=Parser.prototype,Scope=function Scope(g){this.flags=g,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};pp$3.enterScope=function(g){this.scopeStack.push(new Scope(g))},pp$3.exitScope=function(){this.scopeStack.pop()},pp$3.treatFunctionsAsVarInScope=function(g){return g.flags&SCOPE_FUNCTION||!this.inModule&&g.flags&SCOPE_TOP},pp$3.declareName=function(g,O,L){var M=!1;if(O===BIND_LEXICAL){var J=this.currentScope();M=J.lexical.indexOf(g)>-1||J.functions.indexOf(g)>-1||J.var.indexOf(g)>-1,J.lexical.push(g),this.inModule&&J.flags&SCOPE_TOP&&delete this.undefinedExports[g]}else if(O===BIND_SIMPLE_CATCH){this.currentScope().lexical.push(g)}else if(O===BIND_FUNCTION){var ae=this.currentScope();M=this.treatFunctionsAsVar?ae.lexical.indexOf(g)>-1:ae.lexical.indexOf(g)>-1||ae.var.indexOf(g)>-1,ae.functions.push(g)}else for(var ie=this.scopeStack.length-1;ie>=0;--ie){var ne=this.scopeStack[ie];if(ne.lexical.indexOf(g)>-1&&!(ne.flags&SCOPE_SIMPLE_CATCH&&ne.lexical[0]===g)||!this.treatFunctionsAsVarInScope(ne)&&ne.functions.indexOf(g)>-1){M=!0;break}if(ne.var.push(g),this.inModule&&ne.flags&SCOPE_TOP&&delete this.undefinedExports[g],ne.flags&SCOPE_VAR)break}M&&this.raiseRecoverable(L,"Identifier '"+g+"' has already been declared")},pp$3.checkLocalExport=function(g){-1===this.scopeStack[0].lexical.indexOf(g.name)&&-1===this.scopeStack[0].var.indexOf(g.name)&&(this.undefinedExports[g.name]=g)},pp$3.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},pp$3.currentVarScope=function(){for(var g=this.scopeStack.length-1;;g--){var O=this.scopeStack[g];if(O.flags&SCOPE_VAR)return O}},pp$3.currentThisScope=function(){for(var g=this.scopeStack.length-1;;g--){var O=this.scopeStack[g];if(O.flags&SCOPE_VAR&&!(O.flags&SCOPE_ARROW))return O}};var Node$1=function Node(g,O,L){this.type="",this.start=O,this.end=0,g.options.locations&&(this.loc=new SourceLocation(g,L)),g.options.directSourceFile&&(this.sourceFile=g.options.directSourceFile),g.options.ranges&&(this.range=[O,0])},pp$2=Parser.prototype;function finishNodeAt(g,O,L,M){return g.type=O,g.end=L,this.options.locations&&(g.loc.end=M),this.options.ranges&&(g.range[1]=L),g}pp$2.startNode=function(){return new Node$1(this,this.start,this.startLoc)},pp$2.startNodeAt=function(g,O){return new Node$1(this,g,O)},pp$2.finishNode=function(g,O){return finishNodeAt.call(this,g,O,this.lastTokEnd,this.lastTokEndLoc)},pp$2.finishNodeAt=function(g,O,L,M){return finishNodeAt.call(this,g,O,L,M)},pp$2.copyNode=function(g){var O=new Node$1(this,g.start,this.startLoc);for(var L in g)O[L]=g[L];return O};var ecma9BinaryProperties="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",ecma10BinaryProperties=ecma9BinaryProperties+" Extended_Pictographic",ecma11BinaryProperties=ecma10BinaryProperties,ecma12BinaryProperties=ecma11BinaryProperties+" EBase EComp EMod EPres ExtPict",ecma13BinaryProperties=ecma12BinaryProperties,ecma14BinaryProperties=ecma13BinaryProperties,unicodeBinaryProperties={9:ecma9BinaryProperties,10:ecma10BinaryProperties,11:ecma11BinaryProperties,12:ecma12BinaryProperties,13:ecma13BinaryProperties,14:ecma14BinaryProperties},ecma14BinaryPropertiesOfStrings="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",unicodeBinaryPropertiesOfStrings={9:"",10:"",11:"",12:"",13:"",14:ecma14BinaryPropertiesOfStrings},unicodeGeneralCategoryValues="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",ecma9ScriptValues="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ecma10ScriptValues=ecma9ScriptValues+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",ecma11ScriptValues=ecma10ScriptValues+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",ecma12ScriptValues=ecma11ScriptValues+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ecma13ScriptValues=ecma12ScriptValues+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",ecma14ScriptValues=ecma13ScriptValues+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",unicodeScriptValues={9:ecma9ScriptValues,10:ecma10ScriptValues,11:ecma11ScriptValues,12:ecma12ScriptValues,13:ecma13ScriptValues,14:ecma14ScriptValues},data={};function buildUnicodeData(g){var O=data[g]={binary:wordsRegexp(unicodeBinaryProperties[g]+" "+unicodeGeneralCategoryValues),binaryOfStrings:wordsRegexp(unicodeBinaryPropertiesOfStrings[g]),nonBinary:{General_Category:wordsRegexp(unicodeGeneralCategoryValues),Script:wordsRegexp(unicodeScriptValues[g])}};O.nonBinary.Script_Extensions=O.nonBinary.Script,O.nonBinary.gc=O.nonBinary.General_Category,O.nonBinary.sc=O.nonBinary.Script,O.nonBinary.scx=O.nonBinary.Script_Extensions}for(var i=0,list=[9,10,11,12,13,14];i<list.length;i+=1){var ecmaVersion=list[i];buildUnicodeData(ecmaVersion)}var pp$1=Parser.prototype,BranchID=function BranchID(g,O){this.parent=g,this.base=O||this};BranchID.prototype.separatedFrom=function separatedFrom(g){for(var O=this;O;O=O.parent)for(var L=g;L;L=L.parent)if(O.base===L.base&&O!==L)return!0;return!1},BranchID.prototype.sibling=function sibling(){return new BranchID(this.parent,this.base)};var RegExpValidationState=function RegExpValidationState(g){this.parser=g,this.validFlags="gim"+(g.options.ecmaVersion>=6?"uy":"")+(g.options.ecmaVersion>=9?"s":"")+(g.options.ecmaVersion>=13?"d":"")+(g.options.ecmaVersion>=15?"v":""),this.unicodeProperties=data[g.options.ecmaVersion>=14?14:g.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function hasProp(g){for(var O in g)return!0;return!1}function isSyntaxCharacter(g){return 36===g||g>=40&&g<=43||46===g||63===g||g>=91&&g<=94||g>=123&&g<=125}function isRegExpIdentifierStart(g){return isIdentifierStart(g,!0)||36===g||95===g}function isRegExpIdentifierPart(g){return isIdentifierChar(g,!0)||36===g||95===g||8204===g||8205===g}function isControlLetter(g){return g>=65&&g<=90||g>=97&&g<=122}function isValidUnicode(g){return g>=0&&g<=1114111}RegExpValidationState.prototype.reset=function reset(g,O,L){var M=-1!==L.indexOf("v"),J=-1!==L.indexOf("u");this.start=0|g,this.source=O+"",this.flags=L,M&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=J&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=J&&this.parser.options.ecmaVersion>=9)},RegExpValidationState.prototype.raise=function raise(g){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+g)},RegExpValidationState.prototype.at=function at(g,O){void 0===O&&(O=!1);var L=this.source,M=L.length;if(g>=M)return-1;var J=L.charCodeAt(g);if(!O&&!this.switchU||J<=55295||J>=57344||g+1>=M)return J;var ae=L.charCodeAt(g+1);return ae>=56320&&ae<=57343?(J<<10)+ae-56613888:J},RegExpValidationState.prototype.nextIndex=function nextIndex(g,O){void 0===O&&(O=!1);var L=this.source,M=L.length;if(g>=M)return M;var J,ae=L.charCodeAt(g);return!O&&!this.switchU||ae<=55295||ae>=57344||g+1>=M||(J=L.charCodeAt(g+1))<56320||J>57343?g+1:g+2},RegExpValidationState.prototype.current=function current(g){return void 0===g&&(g=!1),this.at(this.pos,g)},RegExpValidationState.prototype.lookahead=function lookahead(g){return void 0===g&&(g=!1),this.at(this.nextIndex(this.pos,g),g)},RegExpValidationState.prototype.advance=function advance(g){void 0===g&&(g=!1),this.pos=this.nextIndex(this.pos,g)},RegExpValidationState.prototype.eat=function eat(g,O){return void 0===O&&(O=!1),this.current(O)===g&&(this.advance(O),!0)},RegExpValidationState.prototype.eatChars=function eatChars(g,O){void 0===O&&(O=!1);for(var L=this.pos,M=0,J=g;M<J.length;M+=1){var ae=J[M],ie=this.at(L,O);if(-1===ie||ie!==ae)return!1;L=this.nextIndex(L,O)}return this.pos=L,!0},pp$1.validateRegExpFlags=function(g){for(var O=g.validFlags,L=g.flags,M=!1,J=!1,ae=0;ae<L.length;ae++){var ie=L.charAt(ae);-1===O.indexOf(ie)&&this.raise(g.start,"Invalid regular expression flag"),L.indexOf(ie,ae+1)>-1&&this.raise(g.start,"Duplicate regular expression flag"),"u"===ie&&(M=!0),"v"===ie&&(J=!0)}this.options.ecmaVersion>=15&&M&&J&&this.raise(g.start,"Invalid regular expression flag")},pp$1.validateRegExpPattern=function(g){this.regexp_pattern(g),!g.switchN&&this.options.ecmaVersion>=9&&hasProp(g.groupNames)&&(g.switchN=!0,this.regexp_pattern(g))},pp$1.regexp_pattern=function(g){g.pos=0,g.lastIntValue=0,g.lastStringValue="",g.lastAssertionIsQuantifiable=!1,g.numCapturingParens=0,g.maxBackReference=0,g.groupNames=Object.create(null),g.backReferenceNames.length=0,g.branchID=null,this.regexp_disjunction(g),g.pos!==g.source.length&&(g.eat(41)&&g.raise("Unmatched ')'"),(g.eat(93)||g.eat(125))&&g.raise("Lone quantifier brackets")),g.maxBackReference>g.numCapturingParens&&g.raise("Invalid escape");for(var O=0,L=g.backReferenceNames;O<L.length;O+=1){var M=L[O];g.groupNames[M]||g.raise("Invalid named capture referenced")}},pp$1.regexp_disjunction=function(g){var O=this.options.ecmaVersion>=16;for(O&&(g.branchID=new BranchID(g.branchID,null)),this.regexp_alternative(g);g.eat(124);)O&&(g.branchID=g.branchID.sibling()),this.regexp_alternative(g);O&&(g.branchID=g.branchID.parent),this.regexp_eatQuantifier(g,!0)&&g.raise("Nothing to repeat"),g.eat(123)&&g.raise("Lone quantifier brackets")},pp$1.regexp_alternative=function(g){for(;g.pos<g.source.length&&this.regexp_eatTerm(g););},pp$1.regexp_eatTerm=function(g){return this.regexp_eatAssertion(g)?(g.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(g)&&g.switchU&&g.raise("Invalid quantifier"),!0):!!(g.switchU?this.regexp_eatAtom(g):this.regexp_eatExtendedAtom(g))&&(this.regexp_eatQuantifier(g),!0)},pp$1.regexp_eatAssertion=function(g){var O=g.pos;if(g.lastAssertionIsQuantifiable=!1,g.eat(94)||g.eat(36))return!0;if(g.eat(92)){if(g.eat(66)||g.eat(98))return!0;g.pos=O}if(g.eat(40)&&g.eat(63)){var L=!1;if(this.options.ecmaVersion>=9&&(L=g.eat(60)),g.eat(61)||g.eat(33))return this.regexp_disjunction(g),g.eat(41)||g.raise("Unterminated group"),g.lastAssertionIsQuantifiable=!L,!0}return g.pos=O,!1},pp$1.regexp_eatQuantifier=function(g,O){return void 0===O&&(O=!1),!!this.regexp_eatQuantifierPrefix(g,O)&&(g.eat(63),!0)},pp$1.regexp_eatQuantifierPrefix=function(g,O){return g.eat(42)||g.eat(43)||g.eat(63)||this.regexp_eatBracedQuantifier(g,O)},pp$1.regexp_eatBracedQuantifier=function(g,O){var L=g.pos;if(g.eat(123)){var M=0,J=-1;if(this.regexp_eatDecimalDigits(g)&&(M=g.lastIntValue,g.eat(44)&&this.regexp_eatDecimalDigits(g)&&(J=g.lastIntValue),g.eat(125)))return-1!==J&&J<M&&!O&&g.raise("numbers out of order in {} quantifier"),!0;g.switchU&&!O&&g.raise("Incomplete quantifier"),g.pos=L}return!1},pp$1.regexp_eatAtom=function(g){return this.regexp_eatPatternCharacters(g)||g.eat(46)||this.regexp_eatReverseSolidusAtomEscape(g)||this.regexp_eatCharacterClass(g)||this.regexp_eatUncapturingGroup(g)||this.regexp_eatCapturingGroup(g)},pp$1.regexp_eatReverseSolidusAtomEscape=function(g){var O=g.pos;if(g.eat(92)){if(this.regexp_eatAtomEscape(g))return!0;g.pos=O}return!1},pp$1.regexp_eatUncapturingGroup=function(g){var O=g.pos;if(g.eat(40)){if(g.eat(63)&&g.eat(58)){if(this.regexp_disjunction(g),g.eat(41))return!0;g.raise("Unterminated group")}g.pos=O}return!1},pp$1.regexp_eatCapturingGroup=function(g){if(g.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(g):63===g.current()&&g.raise("Invalid group"),this.regexp_disjunction(g),g.eat(41))return g.numCapturingParens+=1,!0;g.raise("Unterminated group")}return!1},pp$1.regexp_eatExtendedAtom=function(g){return g.eat(46)||this.regexp_eatReverseSolidusAtomEscape(g)||this.regexp_eatCharacterClass(g)||this.regexp_eatUncapturingGroup(g)||this.regexp_eatCapturingGroup(g)||this.regexp_eatInvalidBracedQuantifier(g)||this.regexp_eatExtendedPatternCharacter(g)},pp$1.regexp_eatInvalidBracedQuantifier=function(g){return this.regexp_eatBracedQuantifier(g,!0)&&g.raise("Nothing to repeat"),!1},pp$1.regexp_eatSyntaxCharacter=function(g){var O=g.current();return!!isSyntaxCharacter(O)&&(g.lastIntValue=O,g.advance(),!0)},pp$1.regexp_eatPatternCharacters=function(g){for(var O=g.pos,L=0;-1!==(L=g.current())&&!isSyntaxCharacter(L);)g.advance();return g.pos!==O},pp$1.regexp_eatExtendedPatternCharacter=function(g){var O=g.current();return!(-1===O||36===O||O>=40&&O<=43||46===O||63===O||91===O||94===O||124===O)&&(g.advance(),!0)},pp$1.regexp_groupSpecifier=function(g){if(g.eat(63)){this.regexp_eatGroupName(g)||g.raise("Invalid group");var O=this.options.ecmaVersion>=16,L=g.groupNames[g.lastStringValue];if(L)if(O)for(var M=0,J=L;M<J.length;M+=1){J[M].separatedFrom(g.branchID)||g.raise("Duplicate capture group name")}else g.raise("Duplicate capture group name");O?(L||(g.groupNames[g.lastStringValue]=[])).push(g.branchID):g.groupNames[g.lastStringValue]=!0}},pp$1.regexp_eatGroupName=function(g){if(g.lastStringValue="",g.eat(60)){if(this.regexp_eatRegExpIdentifierName(g)&&g.eat(62))return!0;g.raise("Invalid capture group name")}return!1},pp$1.regexp_eatRegExpIdentifierName=function(g){if(g.lastStringValue="",this.regexp_eatRegExpIdentifierStart(g)){for(g.lastStringValue+=codePointToString(g.lastIntValue);this.regexp_eatRegExpIdentifierPart(g);)g.lastStringValue+=codePointToString(g.lastIntValue);return!0}return!1},pp$1.regexp_eatRegExpIdentifierStart=function(g){var O=g.pos,L=this.options.ecmaVersion>=11,M=g.current(L);return g.advance(L),92===M&&this.regexp_eatRegExpUnicodeEscapeSequence(g,L)&&(M=g.lastIntValue),isRegExpIdentifierStart(M)?(g.lastIntValue=M,!0):(g.pos=O,!1)},pp$1.regexp_eatRegExpIdentifierPart=function(g){var O=g.pos,L=this.options.ecmaVersion>=11,M=g.current(L);return g.advance(L),92===M&&this.regexp_eatRegExpUnicodeEscapeSequence(g,L)&&(M=g.lastIntValue),isRegExpIdentifierPart(M)?(g.lastIntValue=M,!0):(g.pos=O,!1)},pp$1.regexp_eatAtomEscape=function(g){return!!(this.regexp_eatBackReference(g)||this.regexp_eatCharacterClassEscape(g)||this.regexp_eatCharacterEscape(g)||g.switchN&&this.regexp_eatKGroupName(g))||(g.switchU&&(99===g.current()&&g.raise("Invalid unicode escape"),g.raise("Invalid escape")),!1)},pp$1.regexp_eatBackReference=function(g){var O=g.pos;if(this.regexp_eatDecimalEscape(g)){var L=g.lastIntValue;if(g.switchU)return L>g.maxBackReference&&(g.maxBackReference=L),!0;if(L<=g.numCapturingParens)return!0;g.pos=O}return!1},pp$1.regexp_eatKGroupName=function(g){if(g.eat(107)){if(this.regexp_eatGroupName(g))return g.backReferenceNames.push(g.lastStringValue),!0;g.raise("Invalid named reference")}return!1},pp$1.regexp_eatCharacterEscape=function(g){return this.regexp_eatControlEscape(g)||this.regexp_eatCControlLetter(g)||this.regexp_eatZero(g)||this.regexp_eatHexEscapeSequence(g)||this.regexp_eatRegExpUnicodeEscapeSequence(g,!1)||!g.switchU&&this.regexp_eatLegacyOctalEscapeSequence(g)||this.regexp_eatIdentityEscape(g)},pp$1.regexp_eatCControlLetter=function(g){var O=g.pos;if(g.eat(99)){if(this.regexp_eatControlLetter(g))return!0;g.pos=O}return!1},pp$1.regexp_eatZero=function(g){return 48===g.current()&&!isDecimalDigit(g.lookahead())&&(g.lastIntValue=0,g.advance(),!0)},pp$1.regexp_eatControlEscape=function(g){var O=g.current();return 116===O?(g.lastIntValue=9,g.advance(),!0):110===O?(g.lastIntValue=10,g.advance(),!0):118===O?(g.lastIntValue=11,g.advance(),!0):102===O?(g.lastIntValue=12,g.advance(),!0):114===O&&(g.lastIntValue=13,g.advance(),!0)},pp$1.regexp_eatControlLetter=function(g){var O=g.current();return!!isControlLetter(O)&&(g.lastIntValue=O%32,g.advance(),!0)},pp$1.regexp_eatRegExpUnicodeEscapeSequence=function(g,O){void 0===O&&(O=!1);var L=g.pos,M=O||g.switchU;if(g.eat(117)){if(this.regexp_eatFixedHexDigits(g,4)){var J=g.lastIntValue;if(M&&J>=55296&&J<=56319){var ae=g.pos;if(g.eat(92)&&g.eat(117)&&this.regexp_eatFixedHexDigits(g,4)){var ie=g.lastIntValue;if(ie>=56320&&ie<=57343)return g.lastIntValue=1024*(J-55296)+(ie-56320)+65536,!0}g.pos=ae,g.lastIntValue=J}return!0}if(M&&g.eat(123)&&this.regexp_eatHexDigits(g)&&g.eat(125)&&isValidUnicode(g.lastIntValue))return!0;M&&g.raise("Invalid unicode escape"),g.pos=L}return!1},pp$1.regexp_eatIdentityEscape=function(g){if(g.switchU)return!!this.regexp_eatSyntaxCharacter(g)||!!g.eat(47)&&(g.lastIntValue=47,!0);var O=g.current();return!(99===O||g.switchN&&107===O)&&(g.lastIntValue=O,g.advance(),!0)},pp$1.regexp_eatDecimalEscape=function(g){g.lastIntValue=0;var O=g.current();if(O>=49&&O<=57){do{g.lastIntValue=10*g.lastIntValue+(O-48),g.advance()}while((O=g.current())>=48&&O<=57);return!0}return!1};var CharSetNone=0,CharSetOk=1,CharSetString=2;function isCharacterClassEscape(g){return 100===g||68===g||115===g||83===g||119===g||87===g}function isUnicodePropertyNameCharacter(g){return isControlLetter(g)||95===g}function isUnicodePropertyValueCharacter(g){return isUnicodePropertyNameCharacter(g)||isDecimalDigit(g)}function isClassSetReservedDoublePunctuatorCharacter(g){return 33===g||g>=35&&g<=38||g>=42&&g<=44||46===g||g>=58&&g<=64||94===g||96===g||126===g}function isClassSetSyntaxCharacter(g){return 40===g||41===g||45===g||47===g||g>=91&&g<=93||g>=123&&g<=125}function isClassSetReservedPunctuator(g){return 33===g||35===g||37===g||38===g||44===g||45===g||g>=58&&g<=62||64===g||96===g||126===g}function isDecimalDigit(g){return g>=48&&g<=57}function isHexDigit(g){return g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102}function hexToInt(g){return g>=65&&g<=70?g-65+10:g>=97&&g<=102?g-97+10:g-48}function isOctalDigit(g){return g>=48&&g<=55}pp$1.regexp_eatCharacterClassEscape=function(g){var O=g.current();if(isCharacterClassEscape(O))return g.lastIntValue=-1,g.advance(),CharSetOk;var L=!1;if(g.switchU&&this.options.ecmaVersion>=9&&((L=80===O)||112===O)){var M;if(g.lastIntValue=-1,g.advance(),g.eat(123)&&(M=this.regexp_eatUnicodePropertyValueExpression(g))&&g.eat(125))return L&&M===CharSetString&&g.raise("Invalid property name"),M;g.raise("Invalid property name")}return CharSetNone},pp$1.regexp_eatUnicodePropertyValueExpression=function(g){var O=g.pos;if(this.regexp_eatUnicodePropertyName(g)&&g.eat(61)){var L=g.lastStringValue;if(this.regexp_eatUnicodePropertyValue(g)){var M=g.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(g,L,M),CharSetOk}}if(g.pos=O,this.regexp_eatLoneUnicodePropertyNameOrValue(g)){var J=g.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(g,J)}return CharSetNone},pp$1.regexp_validateUnicodePropertyNameAndValue=function(g,O,L){hasOwn(g.unicodeProperties.nonBinary,O)||g.raise("Invalid property name"),g.unicodeProperties.nonBinary[O].test(L)||g.raise("Invalid property value")},pp$1.regexp_validateUnicodePropertyNameOrValue=function(g,O){return g.unicodeProperties.binary.test(O)?CharSetOk:g.switchV&&g.unicodeProperties.binaryOfStrings.test(O)?CharSetString:void g.raise("Invalid property name")},pp$1.regexp_eatUnicodePropertyName=function(g){var O=0;for(g.lastStringValue="";isUnicodePropertyNameCharacter(O=g.current());)g.lastStringValue+=codePointToString(O),g.advance();return""!==g.lastStringValue},pp$1.regexp_eatUnicodePropertyValue=function(g){var O=0;for(g.lastStringValue="";isUnicodePropertyValueCharacter(O=g.current());)g.lastStringValue+=codePointToString(O),g.advance();return""!==g.lastStringValue},pp$1.regexp_eatLoneUnicodePropertyNameOrValue=function(g){return this.regexp_eatUnicodePropertyValue(g)},pp$1.regexp_eatCharacterClass=function(g){if(g.eat(91)){var O=g.eat(94),L=this.regexp_classContents(g);return g.eat(93)||g.raise("Unterminated character class"),O&&L===CharSetString&&g.raise("Negated character class may contain strings"),!0}return!1},pp$1.regexp_classContents=function(g){return 93===g.current()?CharSetOk:g.switchV?this.regexp_classSetExpression(g):(this.regexp_nonEmptyClassRanges(g),CharSetOk)},pp$1.regexp_nonEmptyClassRanges=function(g){for(;this.regexp_eatClassAtom(g);){var O=g.lastIntValue;if(g.eat(45)&&this.regexp_eatClassAtom(g)){var L=g.lastIntValue;!g.switchU||-1!==O&&-1!==L||g.raise("Invalid character class"),-1!==O&&-1!==L&&O>L&&g.raise("Range out of order in character class")}}},pp$1.regexp_eatClassAtom=function(g){var O=g.pos;if(g.eat(92)){if(this.regexp_eatClassEscape(g))return!0;if(g.switchU){var L=g.current();(99===L||isOctalDigit(L))&&g.raise("Invalid class escape"),g.raise("Invalid escape")}g.pos=O}var M=g.current();return 93!==M&&(g.lastIntValue=M,g.advance(),!0)},pp$1.regexp_eatClassEscape=function(g){var O=g.pos;if(g.eat(98))return g.lastIntValue=8,!0;if(g.switchU&&g.eat(45))return g.lastIntValue=45,!0;if(!g.switchU&&g.eat(99)){if(this.regexp_eatClassControlLetter(g))return!0;g.pos=O}return this.regexp_eatCharacterClassEscape(g)||this.regexp_eatCharacterEscape(g)},pp$1.regexp_classSetExpression=function(g){var O,L=CharSetOk;if(this.regexp_eatClassSetRange(g));else if(O=this.regexp_eatClassSetOperand(g)){O===CharSetString&&(L=CharSetString);for(var M=g.pos;g.eatChars([38,38]);)38!==g.current()&&(O=this.regexp_eatClassSetOperand(g))?O!==CharSetString&&(L=CharSetOk):g.raise("Invalid character in character class");if(M!==g.pos)return L;for(;g.eatChars([45,45]);)this.regexp_eatClassSetOperand(g)||g.raise("Invalid character in character class");if(M!==g.pos)return L}else g.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(g)){if(!(O=this.regexp_eatClassSetOperand(g)))return L;O===CharSetString&&(L=CharSetString)}},pp$1.regexp_eatClassSetRange=function(g){var O=g.pos;if(this.regexp_eatClassSetCharacter(g)){var L=g.lastIntValue;if(g.eat(45)&&this.regexp_eatClassSetCharacter(g)){var M=g.lastIntValue;return-1!==L&&-1!==M&&L>M&&g.raise("Range out of order in character class"),!0}g.pos=O}return!1},pp$1.regexp_eatClassSetOperand=function(g){return this.regexp_eatClassSetCharacter(g)?CharSetOk:this.regexp_eatClassStringDisjunction(g)||this.regexp_eatNestedClass(g)},pp$1.regexp_eatNestedClass=function(g){var O=g.pos;if(g.eat(91)){var L=g.eat(94),M=this.regexp_classContents(g);if(g.eat(93))return L&&M===CharSetString&&g.raise("Negated character class may contain strings"),M;g.pos=O}if(g.eat(92)){var J=this.regexp_eatCharacterClassEscape(g);if(J)return J;g.pos=O}return null},pp$1.regexp_eatClassStringDisjunction=function(g){var O=g.pos;if(g.eatChars([92,113])){if(g.eat(123)){var L=this.regexp_classStringDisjunctionContents(g);if(g.eat(125))return L}else g.raise("Invalid escape");g.pos=O}return null},pp$1.regexp_classStringDisjunctionContents=function(g){for(var O=this.regexp_classString(g);g.eat(124);)this.regexp_classString(g)===CharSetString&&(O=CharSetString);return O},pp$1.regexp_classString=function(g){for(var O=0;this.regexp_eatClassSetCharacter(g);)O++;return 1===O?CharSetOk:CharSetString},pp$1.regexp_eatClassSetCharacter=function(g){var O=g.pos;if(g.eat(92))return!(!this.regexp_eatCharacterEscape(g)&&!this.regexp_eatClassSetReservedPunctuator(g))||(g.eat(98)?(g.lastIntValue=8,!0):(g.pos=O,!1));var L=g.current();return!(L<0||L===g.lookahead()&&isClassSetReservedDoublePunctuatorCharacter(L))&&(!isClassSetSyntaxCharacter(L)&&(g.advance(),g.lastIntValue=L,!0))},pp$1.regexp_eatClassSetReservedPunctuator=function(g){var O=g.current();return!!isClassSetReservedPunctuator(O)&&(g.lastIntValue=O,g.advance(),!0)},pp$1.regexp_eatClassControlLetter=function(g){var O=g.current();return!(!isDecimalDigit(O)&&95!==O)&&(g.lastIntValue=O%32,g.advance(),!0)},pp$1.regexp_eatHexEscapeSequence=function(g){var O=g.pos;if(g.eat(120)){if(this.regexp_eatFixedHexDigits(g,2))return!0;g.switchU&&g.raise("Invalid escape"),g.pos=O}return!1},pp$1.regexp_eatDecimalDigits=function(g){var O=g.pos,L=0;for(g.lastIntValue=0;isDecimalDigit(L=g.current());)g.lastIntValue=10*g.lastIntValue+(L-48),g.advance();return g.pos!==O},pp$1.regexp_eatHexDigits=function(g){var O=g.pos,L=0;for(g.lastIntValue=0;isHexDigit(L=g.current());)g.lastIntValue=16*g.lastIntValue+hexToInt(L),g.advance();return g.pos!==O},pp$1.regexp_eatLegacyOctalEscapeSequence=function(g){if(this.regexp_eatOctalDigit(g)){var O=g.lastIntValue;if(this.regexp_eatOctalDigit(g)){var L=g.lastIntValue;O<=3&&this.regexp_eatOctalDigit(g)?g.lastIntValue=64*O+8*L+g.lastIntValue:g.lastIntValue=8*O+L}else g.lastIntValue=O;return!0}return!1},pp$1.regexp_eatOctalDigit=function(g){var O=g.current();return isOctalDigit(O)?(g.lastIntValue=O-48,g.advance(),!0):(g.lastIntValue=0,!1)},pp$1.regexp_eatFixedHexDigits=function(g,O){var L=g.pos;g.lastIntValue=0;for(var M=0;M<O;++M){var J=g.current();if(!isHexDigit(J))return g.pos=L,!1;g.lastIntValue=16*g.lastIntValue+hexToInt(J),g.advance()}return!0};var Token=function Token(g){this.type=g.type,this.value=g.value,this.start=g.start,this.end=g.end,g.options.locations&&(this.loc=new SourceLocation(g,g.startLoc,g.endLoc)),g.options.ranges&&(this.range=[g.start,g.end])},pp=Parser.prototype;function stringToNumber(g,O){return O?parseInt(g,8):parseFloat(g.replace(/_/g,""))}function stringToBigInt(g){return"function"!=typeof BigInt?null:BigInt(g.replace(/_/g,""))}pp.next=function(g){!g&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Token(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},pp.getToken=function(){return this.next(),new Token(this)},"undefined"!=typeof Symbol&&(pp[Symbol.iterator]=function(){var g=this;return{next:function(){var O=g.getToken();return{done:O.type===types$1.eof,value:O}}}}),pp.nextToken=function(){var g=this.curContext();return g&&g.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(types$1.eof):g.override?g.override(this):void this.readToken(this.fullCharCodeAtPos())},pp.readToken=function(g){return isIdentifierStart(g,this.options.ecmaVersion>=6)||92===g?this.readWord():this.getTokenFromCode(g)},pp.fullCharCodeAtPos=function(){var g=this.input.charCodeAt(this.pos);if(g<=55295||g>=56320)return g;var O=this.input.charCodeAt(this.pos+1);return O<=56319||O>=57344?g:(g<<10)+O-56613888},pp.skipBlockComment=function(){var g=this.options.onComment&&this.curPosition(),O=this.pos,L=this.input.indexOf("*/",this.pos+=2);if(-1===L&&this.raise(this.pos-2,"Unterminated comment"),this.pos=L+2,this.options.locations)for(var M=void 0,J=O;(M=nextLineBreak(this.input,J,this.pos))>-1;)++this.curLine,J=this.lineStart=M;this.options.onComment&&this.options.onComment(!0,this.input.slice(O+2,L),O,this.pos,g,this.curPosition())},pp.skipLineComment=function(g){for(var O=this.pos,L=this.options.onComment&&this.curPosition(),M=this.input.charCodeAt(this.pos+=g);this.pos<this.input.length&&!isNewLine(M);)M=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(O+g,this.pos),O,this.pos,L,this.curPosition())},pp.skipSpace=function(){e:for(;this.pos<this.input.length;){var g=this.input.charCodeAt(this.pos);switch(g){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(g>8&&g<14||g>=5760&&nonASCIIwhitespace.test(String.fromCharCode(g))))break e;++this.pos}}},pp.finishToken=function(g,O){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var L=this.type;this.type=g,this.value=O,this.updateContext(L)},pp.readToken_dot=function(){var g=this.input.charCodeAt(this.pos+1);if(g>=48&&g<=57)return this.readNumber(!0);var O=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===g&&46===O?(this.pos+=3,this.finishToken(types$1.ellipsis)):(++this.pos,this.finishToken(types$1.dot))},pp.readToken_slash=function(){var g=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===g?this.finishOp(types$1.assign,2):this.finishOp(types$1.slash,1)},pp.readToken_mult_modulo_exp=function(g){var O=this.input.charCodeAt(this.pos+1),L=1,M=42===g?types$1.star:types$1.modulo;return this.options.ecmaVersion>=7&&42===g&&42===O&&(++L,M=types$1.starstar,O=this.input.charCodeAt(this.pos+2)),61===O?this.finishOp(types$1.assign,L+1):this.finishOp(M,L)},pp.readToken_pipe_amp=function(g){var O=this.input.charCodeAt(this.pos+1);if(O===g){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(types$1.assign,3);return this.finishOp(124===g?types$1.logicalOR:types$1.logicalAND,2)}return 61===O?this.finishOp(types$1.assign,2):this.finishOp(124===g?types$1.bitwiseOR:types$1.bitwiseAND,1)},pp.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(types$1.assign,2):this.finishOp(types$1.bitwiseXOR,1)},pp.readToken_plus_min=function(g){var O=this.input.charCodeAt(this.pos+1);return O===g?45!==O||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!lineBreak.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(types$1.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===O?this.finishOp(types$1.assign,2):this.finishOp(types$1.plusMin,1)},pp.readToken_lt_gt=function(g){var O=this.input.charCodeAt(this.pos+1),L=1;return O===g?(L=62===g&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+L)?this.finishOp(types$1.assign,L+1):this.finishOp(types$1.bitShift,L)):33!==O||60!==g||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===O&&(L=2),this.finishOp(types$1.relational,L)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},pp.readToken_eq_excl=function(g){var O=this.input.charCodeAt(this.pos+1);return 61===O?this.finishOp(types$1.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===g&&62===O&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(types$1.arrow)):this.finishOp(61===g?types$1.eq:types$1.prefix,1)},pp.readToken_question=function(){var g=this.options.ecmaVersion;if(g>=11){var O=this.input.charCodeAt(this.pos+1);if(46===O){var L=this.input.charCodeAt(this.pos+2);if(L<48||L>57)return this.finishOp(types$1.questionDot,2)}if(63===O){if(g>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(types$1.assign,3);return this.finishOp(types$1.coalesce,2)}}return this.finishOp(types$1.question,1)},pp.readToken_numberSign=function(){var g=35;if(this.options.ecmaVersion>=13&&(++this.pos,isIdentifierStart(g=this.fullCharCodeAtPos(),!0)||92===g))return this.finishToken(types$1.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+codePointToString(g)+"'")},pp.getTokenFromCode=function(g){switch(g){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(types$1.parenL);case 41:return++this.pos,this.finishToken(types$1.parenR);case 59:return++this.pos,this.finishToken(types$1.semi);case 44:return++this.pos,this.finishToken(types$1.comma);case 91:return++this.pos,this.finishToken(types$1.bracketL);case 93:return++this.pos,this.finishToken(types$1.bracketR);case 123:return++this.pos,this.finishToken(types$1.braceL);case 125:return++this.pos,this.finishToken(types$1.braceR);case 58:return++this.pos,this.finishToken(types$1.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(types$1.backQuote);case 48:var O=this.input.charCodeAt(this.pos+1);if(120===O||88===O)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===O||79===O)return this.readRadixNumber(8);if(98===O||66===O)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(g);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(g);case 124:case 38:return this.readToken_pipe_amp(g);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(g);case 60:case 62:return this.readToken_lt_gt(g);case 61:case 33:return this.readToken_eq_excl(g);case 63:return this.readToken_question();case 126:return this.finishOp(types$1.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+codePointToString(g)+"'")},pp.finishOp=function(g,O){var L=this.input.slice(this.pos,this.pos+O);return this.pos+=O,this.finishToken(g,L)},pp.readRegexp=function(){for(var g,O,L=this.pos;;){this.pos>=this.input.length&&this.raise(L,"Unterminated regular expression");var M=this.input.charAt(this.pos);if(lineBreak.test(M)&&this.raise(L,"Unterminated regular expression"),g)g=!1;else{if("["===M)O=!0;else if("]"===M&&O)O=!1;else if("/"===M&&!O)break;g="\\"===M}++this.pos}var J=this.input.slice(L,this.pos);++this.pos;var ae=this.pos,ie=this.readWord1();this.containsEsc&&this.unexpected(ae);var ne=this.regexpState||(this.regexpState=new RegExpValidationState(this));ne.reset(L,J,ie),this.validateRegExpFlags(ne),this.validateRegExpPattern(ne);var oe=null;try{oe=new RegExp(J,ie)}catch(g){}return this.finishToken(types$1.regexp,{pattern:J,flags:ie,value:oe})},pp.readInt=function(g,O,L){for(var M=this.options.ecmaVersion>=12&&void 0===O,J=L&&48===this.input.charCodeAt(this.pos),ae=this.pos,ie=0,ne=0,oe=0,pe=null==O?1/0:O;oe<pe;++oe,++this.pos){var le=this.input.charCodeAt(this.pos),ue=void 0;if(M&&95===le)J&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===ne&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===oe&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),ne=le;else{if((ue=le>=97?le-97+10:le>=65?le-65+10:le>=48&&le<=57?le-48:1/0)>=g)break;ne=le,ie=ie*g+ue}}return M&&95===ne&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===ae||null!=O&&this.pos-ae!==O?null:ie},pp.readRadixNumber=function(g){var O=this.pos;this.pos+=2;var L=this.readInt(g);return null==L&&this.raise(this.start+2,"Expected number in radix "+g),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(L=stringToBigInt(this.input.slice(O,this.pos)),++this.pos):isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(types$1.num,L)},pp.readNumber=function(g){var O=this.pos;g||null!==this.readInt(10,void 0,!0)||this.raise(O,"Invalid number");var L=this.pos-O>=2&&48===this.input.charCodeAt(O);L&&this.strict&&this.raise(O,"Invalid number");var M=this.input.charCodeAt(this.pos);if(!L&&!g&&this.options.ecmaVersion>=11&&110===M){var J=stringToBigInt(this.input.slice(O,this.pos));return++this.pos,isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(types$1.num,J)}L&&/[89]/.test(this.input.slice(O,this.pos))&&(L=!1),46!==M||L||(++this.pos,this.readInt(10),M=this.input.charCodeAt(this.pos)),69!==M&&101!==M||L||(43!==(M=this.input.charCodeAt(++this.pos))&&45!==M||++this.pos,null===this.readInt(10)&&this.raise(O,"Invalid number")),isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var ae=stringToNumber(this.input.slice(O,this.pos),L);return this.finishToken(types$1.num,ae)},pp.readCodePoint=function(){var g;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var O=++this.pos;g=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,g>1114111&&this.invalidStringToken(O,"Code point out of bounds")}else g=this.readHexChar(4);return g},pp.readString=function(g){for(var O="",L=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var M=this.input.charCodeAt(this.pos);if(M===g)break;92===M?(O+=this.input.slice(L,this.pos),O+=this.readEscapedChar(!1),L=this.pos):8232===M||8233===M?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(isNewLine(M)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return O+=this.input.slice(L,this.pos++),this.finishToken(types$1.string,O)};var INVALID_TEMPLATE_ESCAPE_ERROR={};pp.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(g){if(g!==INVALID_TEMPLATE_ESCAPE_ERROR)throw g;this.readInvalidTemplateToken()}this.inTemplateElement=!1},pp.invalidStringToken=function(g,O){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw INVALID_TEMPLATE_ESCAPE_ERROR;this.raise(g,O)},pp.readTmplToken=function(){for(var g="",O=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var L=this.input.charCodeAt(this.pos);if(96===L||36===L&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==types$1.template&&this.type!==types$1.invalidTemplate?(g+=this.input.slice(O,this.pos),this.finishToken(types$1.template,g)):36===L?(this.pos+=2,this.finishToken(types$1.dollarBraceL)):(++this.pos,this.finishToken(types$1.backQuote));if(92===L)g+=this.input.slice(O,this.pos),g+=this.readEscapedChar(!0),O=this.pos;else if(isNewLine(L)){switch(g+=this.input.slice(O,this.pos),++this.pos,L){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:g+="\n";break;default:g+=String.fromCharCode(L)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),O=this.pos}else++this.pos}},pp.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(types$1.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},pp.readEscapedChar=function(g){var O=this.input.charCodeAt(++this.pos);switch(++this.pos,O){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),g){var L=this.pos-1;this.invalidStringToken(L,"Invalid escape sequence in template string")}default:if(O>=48&&O<=55){var M=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],J=parseInt(M,8);return J>255&&(M=M.slice(0,-1),J=parseInt(M,8)),this.pos+=M.length-1,O=this.input.charCodeAt(this.pos),"0"===M&&56!==O&&57!==O||!this.strict&&!g||this.invalidStringToken(this.pos-1-M.length,g?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(J)}return isNewLine(O)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(O)}},pp.readHexChar=function(g){var O=this.pos,L=this.readInt(16,g);return null===L&&this.invalidStringToken(O,"Bad character escape sequence"),L},pp.readWord1=function(){this.containsEsc=!1;for(var g="",O=!0,L=this.pos,M=this.options.ecmaVersion>=6;this.pos<this.input.length;){var J=this.fullCharCodeAtPos();if(isIdentifierChar(J,M))this.pos+=J<=65535?1:2;else{if(92!==J)break;this.containsEsc=!0,g+=this.input.slice(L,this.pos);var ae=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var ie=this.readCodePoint();(O?isIdentifierStart:isIdentifierChar)(ie,M)||this.invalidStringToken(ae,"Invalid Unicode escape"),g+=codePointToString(ie),L=this.pos}O=!1}return g+this.input.slice(L,this.pos)},pp.readWord=function(){var g=this.readWord1(),O=types$1.name;return this.keywords.test(g)&&(O=keywords[g]),this.finishToken(O,g)};var version="8.12.1";function parse(g,O){return Parser.parse(g,O)}Parser.acorn={Parser:Parser,version:version,defaultOptions:defaultOptions,Position:Position,SourceLocation:SourceLocation,getLineInfo:getLineInfo,Node:Node$1,TokenType:TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext:TokContext,tokContexts:types,isIdentifierChar:isIdentifierChar,isIdentifierStart:isIdentifierStart,Token:Token,isNewLine:isNewLine,lineBreak:lineBreak,lineBreakG:lineBreakG,nonASCIIwhitespace:nonASCIIwhitespace};const nbsp=" ",upArrow="↑",downArrow="↓",U={nbsp:nbsp,upArrow:upArrow,downArrow:downArrow},$=g=>document.querySelector(g),$e=(g,O)=>{const L="string"==typeof g?$(g):g;return L?L.querySelector(O):null},$$e=(g,O)=>{const L="string"==typeof g?$(g):g;return L?[...L.querySelectorAll(O)]:[]},removeChildren=g=>{const O="string"==typeof g?$(g):g;if(!O)throw new Error("Node not found!");for(;O.hasChildNodes();)O.lastChild?.remove()},removeIfExists=g=>{const O="string"==typeof g?$(g):g;O&&O.remove()},filterChildElements=(g,O)=>{const L="string"==typeof g?$(g):g;if(!L)throw new Error("Element not found!");let M=[L];return(O=Array.isArray(O)?O:[O]).forEach((g=>{M=M.reduce(((O,L)=>L?(O.push(...((g,O)=>{const L=[...g.children].filter((g=>g.matches(O)));return L})(L,g)),O):O),[])})),M},initialCaps=g=>g.charAt(0).toUpperCase()+g.slice(1),DOM={removeChildren:removeChildren,removeIfExists:removeIfExists,filterChildElements:filterChildElements,initialCaps:initialCaps},localeStrings={submit:"Submit",cancel:"Cancel",ok:"Ok"},dialogs={localeStrings:{},setLocale(g={}){this.localeStrings={...localeStrings,...g}},makeDialog({atts:g={},children:O=[],close:L,remove:M=!0}={}){L&&(g.$on||(g.$on={}),"close"in g.$on||(g.$on.close=L));const J=jml("dialog",g,O,body);return J.showModal(),M&&J.addEventListener("close",(()=>{J.remove()})),J},makeCancelDialog({cancel:g,cancelClass:O="cancel",submitClass:L="submit",...M}){const J=this.makeDialog(M);return jml("div",{class:L},[["br"],["br"],["button",{class:O,$on:{click(O){O.preventDefault(),g&&!1===g.call(this,{e:O,dialog:J})||J.close()}}},[this.localeStrings.cancel]]],J),J},makeSubmitDialog({submit:g,submitText:O,submitClass:L="submit",...M}){const J=this.makeCancelDialog(M);return $e(J,`button.${M.cancelClass||"cancel"}`)?.before(jml("button",{class:L,$on:{click(O){g.call(this,{e:O,dialog:J})}}},[O??this.localeStrings.submit]),nbsp$1.repeat(2)),J},alert(g){g="string"==typeof g?{message:g}:g;const{submitClass:O="submit"}=g,{message:L}=g;return new Promise((g=>{const M=jml("dialog",[L,["br"],["br"],["div",{class:O},[["button",{$on:{click(){M.close(),g()}}},[this.localeStrings.ok]]]]],body);M.showModal()}))},confirm({atts:g={},message:O,submitClass:L="submit"}){return({message:O}="string"==typeof O?{message:O}:O),new Promise(((M,J)=>{const ae=jml("dialog",g,[O,["br"],["br"],["div",{class:L},[["button",{$on:{click(){ae.close(),M()}}},[this.localeStrings.ok]],nbsp$1.repeat(2),["button",{$on:{click(){ae.close(),J(new Error("cancelled"))}}},[this.localeStrings.cancel]]]]],body);ae.showModal()}))}};dialogs.setLocale();const buildTypeChoices=({autoTrigger:g=!0,format:O,typeNamespace:L,value:M,setValue:J=!1,state:ae,keySelectClass:ie,requireObject:ne,objectHasValue:oe,topRoot:pe,formats:le=new Formats,types:ue=new Types,schema:de,schemaIdx:he,schemaOriginal:ye,schemaContent:me})=>{const fe=ne&&!me?{typeOptions:[ue.getOptionForType("object")],schemaObjects:void 0}:ue.getTypeOptionsForFormatAndState(O,ae,me,ye),{typeOptions:ge}=fe,ve=fe.schemaObjects;let be;const $getValue=(g,M)=>{const J=$e(Se,"div[data-type]");return ue.getValueForRoot(J,{typeNamespace:L,formats:le,format:O,types:ue,...g},M)},xe=jml("select",{hidden:ne||1===ge.length,class:`typeChoices-${L}${ie?" "+ie:""}`,$custom:{$getValue:$getValue,$setType({type:g,baseValue:O,bringIntoFocus:L,avoidReport:M,specificSchema:J}){if(ve&&J){const O=ve.map((g=>JSON.stringify(g))).indexOf(JSON.stringify(J));-1===O?this.value=g:this.selectedIndex=O+1}else this.value=g;this.$setStyles(),this.$addAndValidateEditUI({baseValue:O,bringIntoFocus:L,avoidReport:M})},$setTypeNoEditUI({type:g,specificSchema:O}){if(ve&&O){const g=ve.map((g=>JSON.stringify(g))).indexOf(JSON.stringify(O));this.selectedIndex=g+1}else this.value=g;this.$setStyles()},$setStyles(){const{value:g}=this;this.dataset.type=g;let O=this.parentElement;"fieldset"!==O.nodeName.toLowerCase()&&(O=this.parentElement.parentElement),"fieldset"===O.nodeName.toLowerCase()&&(O.dataset.type=g,DOM.filterChildElements(O,"legend").forEach((O=>{O.dataset.type=g})))},$getTypeRoot(){const g=this.$getContainer();return!!g&&$e(g,"div[data-type]")},$addAndValidateEditUI({baseValue:g,bringIntoFocus:M,schemaObject:J,avoidReport:ae}={}){const{value:ie}=this;if(!ie)return;let ne=this.$getTopRoot();be=ue.getUIForModeAndType({readonly:!1,typeNamespace:L,type:ie,bringIntoFocus:M,hasValue:"arrayNonindexKeys"===ie&&g,value:g,buildTypeChoices:buildTypeChoices,format:O,topRoot:ne,schemaContent:ye??("union"===me?.type&&void 0!==he?me.options[he]:me),specificSchemaObject:J??ve?.[xe.selectedIndex-1]??("union"===me?.type&&void 0!==he?me.options[he]:me),schemaFallingBack:Boolean(!J&&me)}),this.$addEditUI({editUI:be}),this.$validate({avoidReport:ae}),ne=this.$getTopRoot(),ue.validateAllReferences({topRoot:ne})},$addTypeAndEditUI({type:g,editUI:O,specificSchema:L}){this.$setTypeNoEditUI({type:g,specificSchema:L}),this.$addEditUI({editUI:O})},$addEditUI({editUI:g}){const O=this.$getContainer();DOM.removeChildren(O),jml(g,O)},$getContainer(){return this.nextElementSibling},$getTopRoot(){return pe||this.$getTypeRoot()},$validate({avoidReport:g}={}){const{value:O}=this,L=this.$getContainer();if(!L.firstElementChild)return!1;const M=L.firstElementChild;return ue.validate({type:O,root:M,topRoot:this.$getTopRoot(),avoidReport:g})}},$on:{change(g){g?.stopPropagation(),this.$addAndValidateEditUI({schemaObject:ve?ve[Number(g.target.selectedOptions[0].dataset.idx)]:void 0}),this.$setStyles()}}},[["option",{value:""},["(Choose a type)"]],...ge.map((([g,O],L)=>["option",{...O,dataset:ve?{idx:L}:{}},[g]]))]);g&&1===ge.length&&!J?setTimeout((()=>{xe.selectedIndex=1,xe.dispatchEvent(new Event("change"))})):(J||ne&&!oe)&&setTimeout((async()=>{J||(M={});try{const{rootUI:g,specificSchemas:J}=await le.getControlsForFormatAndValue(ue,O,M,{readonly:!1,typeNamespace:L,schema:de,schemaContent:me,formats:le,types:ue}),ae=Types.getTypeForRoot(g);xe.$addTypeAndEditUI({type:ae,editUI:g,specificSchema:J?.[0]})}catch(g){dialogs.alert({message:"The object to be added had types not supported by the current format."}),console.log("err",g)}}));const Se=jml("div",{class:"typeContainer"});return{domArray:[xe,Se],getValue:$getValue,getType(){const g=$e(Se,"div[data-type]");return Types.getTypeForRoot(g)},validValuesSet(){const g=$e(Se,"div[data-type]").closest("form");return Types.validValuesSet({form:g,typeNamespace:L})},async setValue(g,L){const M=(await le.getControlsForFormatAndValue(ue,O,g,L)).rootUI,J=Types.getTypeForRoot(M);xe.$addTypeAndEditUI({type:J,editUI:M})}}},unescapeJSONPointerPart=g=>g.replaceAll(/~([01])/gu,((g,O)=>"0"===O?"~":"/")),getJSONPointerParts=g=>g.split("/").slice(1).map((g=>unescapeJSONPointerPart(g))),reduceJSONPointerParts=(g,O)=>{if(!(O in g))throw new TypeError("Path part not found in object");return g=g[O]},resolveJSONPointer=({path:g,obj:O})=>getJSONPointerParts(g).reduce(((g,O)=>reduceJSONPointerParts(g,O)),O),typesonPathToJSONPointer=g=>g?"/"+g.split(".").map((g=>g.replaceAll("~1",".").replaceAll("/","~1"))).join("/"):g,typesonToJson=new Map([["arrayNonindexKeys","array"]]),json={types:()=>["null","true","false","number","string","array","object"],iterate(g,O){const L=g;return O.format="json",structuredCloning.iterate(L,O)},convertFromTypeson:g=>({type:typesonToJson.get(g)}),testInvalid(g,O){if("array"===g)return Object.keys(O).length!==O.length},getTypesAndSchemasForState(g,O){if(!O||["array","object"].includes(O))return{types:this.types(),schemaObjects:[]}}};G.resurrectable.test=g=>g&&"object"==typeof g&&!Array.isArray(g)&&"Object"!==toStringTag(g);const encapsulateObserver=g=>{const{typeNamespace:O,readonly:L,format:M,schemaContent:J,formats:ae,types:ie}=g,ne=M,oe={},pe={},le=[];return M=>{const{type:ue,cyclic:de,keypath:he,value:ye,replaced:me,cyclicKeypath:fe,endIterateIn:ge,endIterateOwn:ve,endIterateUnsetNumeric:be,clone:xe}=M;if("replaced"in M)return;if("readonly"===de&&!Array.isArray(M.value))return;if("readonly"===de&&("set"===ue||"filelist"===ue))return;if(ge||ve)return;if(be||void 0===xe&&void 0===fe&&Array.isArray(ye))return;if(M.replacing&&"negativeZero"===ue)return;if("sparseUndefined"===ue)return;let Se,Te=ye;const Ie="structuredCloning"===ne?"arrayNonindexKeys":"array",we=he.lastIndexOf("."),_e=unescapeKeyPathComponent(he.slice(we+1)),Ee=-1===we?"":he.slice(0,we);let Ce,ke,Ne;if("string"==typeof fe)Te=typesonPathToJSONPointer(fe),Se="array"===ue?"arrayReference":"objectReference",({newType:Se,schema:Ce,schemaIdx:ke,mustBeOptional:Ne}=canonicalTypeToAvailableTypeAndSchema(ie,ae,ne,Ie,Se,ye,_e,pe[Ee],g));else try{({newType:Se,schema:Ce,schemaIdx:ke,mustBeOptional:Ne}=canonicalTypeToAvailableTypeAndSchema(ie,ae,ne,Ie,ue,ye,_e,pe[Ee],g))}catch(O){return console.log("err",ue,O),void(g.error=O)}const Ae=["array","object","set","map","tuple","record","filelist","arrayNonindexKeys"].includes(Se),Oe="map"===ue&&"[object Map]"===Object.prototype.toString.call(ye);if(Oe&&le.push(he),Ce&&(g.specificSchema=Ce,g.specificSchemas||(g.specificSchemas=[]),g.specificSchemas.push(Ce)),!g.rootUI)return g.rootUI=ie?.getUIForModeAndType({readonly:L,typeNamespace:O,type:Se,bringIntoFocus:!1,buildTypeChoices:buildTypeChoices,format:ne,specificSchemaObject:Ce,schemaContent:J,value:Te,hasValue:!0,replaced:me}),oe[""]=g.rootUI,Ce&&(pe[""]=[Ce,ke]),void(Oe&&[...ye].forEach(((O,L)=>{oe[L]=g.rootUI})));Ce&&(pe[he]=[Ce,ke]),setTimeout((()=>{const O=oe[Ee];if(!O||!("$addAndSetArrayElement"in O))return;if(!Oe&&le.some((g=>{if(g===he||""===g&&/^\d+$/u.test(he))return!0;const O=he.match(/\.\d+$/u);return O&&""!==g&&he.slice(0,-O[0].length)===g})))return;const M=O.$addAndSetArrayElement({mustBeOptional:Ne,propName:_e,type:Se,value:Te,bringIntoFocus:!1,schemaIdx:ke,schemaContent:Ce??J});M&&(L||(ie?.setValue({type:Se,root:M,value:Te}),ie?.validate({type:Se,root:M,topRoot:g.rootUI,avoidReport:!0})),Ae&&(oe[he]=M,Oe&&[...ye].forEach(((g,O)=>{oe[`${he}.${O}`]=M}))))}))}},replaceTypes=(g,O)=>{O.forEach((([O,L])=>{g.splice(g.indexOf(O),1,L)}))},canonicalTypeToAvailableTypeAndSchema=(g,O,L,M,J,ae,ie,ne,oe)=>{const pe=O.getAvailableFormat(L),{getTypesAndSchemasForState:le,convertFromTypeson:ue,testInvalid:de}=pe,he=le.call(pe,g,M,oe.schemaContent)?.types;if(!he)throw new Error("Unexpected undefined type for state");let ye;const isInvalid=g=>{const O=new Error("Invalid");throw O.newValType=g,O};let me;if(ue){let O,L,M;if(({type:O,schema:me,schemaIdx:M,mustBeOptional:L}=ue(J,g,ae,ie,ne,oe)),"string"==typeof O){if(de&&de(O,ae))return isInvalid(O);if(J=O,me)return{newType:J,schema:me,schemaIdx:M,mustBeOptional:L}}}return he.some((O=>{const L=g.getTypeObject(O),{valueMatch:M,superType:ie,childTypes:ne}=L;return!!(ie&&M&&ie===J&&M(ae)||ne&&ne.includes(J))&&(ye=O,!0)})),void 0===ye&&(he.some((g=>g===J&&(ye=g,!0))),void 0===ye)?(console.log("AALLLowableTypes",M,he,"::",J),isInvalid(J)):{newType:ye,schema:me}},structuredCloning={async iterate(records,stateObj){stateObj.format||(stateObj.format="structuredCloning");const structuredCloningFixed=se.filter((g=>!["imagedata","imagebitmap","cryptokey","domquad"].some((O=>Object.hasOwn(g,O)))));structuredCloningFixed.splice(1,0,G);const typeson=new c({encapsulateObserver:encapsulateObserver(stateObj)}).register("arbitraryJS"===stateObj.format||"schema"===stateObj.format?[...structuredCloningFixed,z$1,q,{function:{test:g=>"function"==typeof g,replace:g=>"("+g.toString()+")",revive(o){return eval(o)}}}]:structuredCloningFixed);if(await typeson.encapsulateAsync(records,null,{throwOnBadSyncType:!1}),stateObj.error)throw stateObj.error;return stateObj},getTypesAndSchemasForState(g,O){if(O&&g.getContextInfo("structuredCloning",O)){const L=this.getTypesAndSchemasForState(g)?.types||[];return g.getContextInfo("structuredCloning",O).forEach((({type:g,after:O})=>{const M=L.indexOf(O);L.splice(M+1,0,g)})),{types:L,schemaObjects:[]}}return"errorsArray"===O?{types:["error","errors"],schemaObjects:[]}:"filelistArray"===O?{types:["file"],schemaObjects:[]}:{types:this.types(),schemaObjects:[]}},types(){const g=json.types();return replaceTypes(g,[["array","arrayNonindexKeys"]]),[...g,"undef","bigint","bigintObject","SpecialNumber","date","regexp","BooleanObject","NumberObject","StringObject","error","errors","blob","blobHTML","file","set","map","filelist","domexception","domrect","dompoint","dommatrix","buffersource","resurrectable"]}},indexedDBKey={types:()=>["number","SpecialRealNumber","string","ValidDate","array","buffersource"],testInvalid(g,O){switch(g){case"SpecialRealNumber":return Number.isNaN(O);case"ValidDate":return Number.isNaN(O.getTime());case"array":return Object.keys(O).length!==O.length;default:return!1}},convertFromTypeson:g=>({type:typesonToIndexedDBKey.get(g)}),iterate:(g,O)=>(O.format="indexedDBKey",structuredCloning.iterate(g,O)),getTypesAndSchemasForState(g,O){if(!O||["array"].includes(O))return{types:this.types(),schemaObjects:[]}}},typesonToIndexedDBKey=new Map([["SpecialNumber","SpecialRealNumber"],["date","ValidDate"],["arrayNonindexKeys","array"]]),arbitraryJS={types:()=>[...structuredCloning.types(),"symbol","promise","function"],iterate(g,O){const L=g;return O.format="arbitraryJS",structuredCloning.iterate(L,O)},getTypesAndSchemasForState(g,O){return structuredCloning.getTypesAndSchemasForState.call(this,g,O)}};var util,objectUtil;!function(g){g.assertEqual=g=>g,g.assertIs=function assertIs(g){},g.assertNever=function assertNever(g){throw new Error},g.arrayToEnum=g=>{const O={};for(const L of g)O[L]=L;return O},g.getValidEnumValues=O=>{const L=g.objectKeys(O).filter((g=>"number"!=typeof O[O[g]])),M={};for(const g of L)M[g]=O[g];return g.objectValues(M)},g.objectValues=O=>g.objectKeys(O).map((function(g){return O[g]})),g.objectKeys="function"==typeof Object.keys?g=>Object.keys(g):g=>{const O=[];for(const L in g)Object.prototype.hasOwnProperty.call(g,L)&&O.push(L);return O},g.find=(g,O)=>{for(const L of g)if(O(L))return L},g.isInteger="function"==typeof Number.isInteger?g=>Number.isInteger(g):g=>"number"==typeof g&&isFinite(g)&&Math.floor(g)===g,g.joinValues=function joinValues(g,O=" | "){return g.map((g=>"string"==typeof g?`'${g}'`:g)).join(O)},g.jsonStringifyReplacer=(g,O)=>"bigint"==typeof O?O.toString():O}(util||(util={})),function(g){g.mergeShapes=(g,O)=>({...g,...O})}(objectUtil||(objectUtil={}));const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=g=>{switch(typeof g){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(g)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(g)?ZodParsedType.array:null===g?ZodParsedType.null:g.then&&"function"==typeof g.then&&g.catch&&"function"==typeof g.catch?ZodParsedType.promise:"undefined"!=typeof Map&&g instanceof Map?ZodParsedType.map:"undefined"!=typeof Set&&g instanceof Set?ZodParsedType.set:"undefined"!=typeof Date&&g instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=g=>JSON.stringify(g,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(g){super(),this.issues=[],this.addIssue=g=>{this.issues=[...this.issues,g]},this.addIssues=(g=[])=>{this.issues=[...this.issues,...g]};const O=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,O):this.__proto__=O,this.name="ZodError",this.issues=g}get errors(){return this.issues}format(g){const O=g||function(g){return g.message},L={_errors:[]},processError=g=>{for(const M of g.issues)if("invalid_union"===M.code)M.unionErrors.map(processError);else if("invalid_return_type"===M.code)processError(M.returnTypeError);else if("invalid_arguments"===M.code)processError(M.argumentsError);else if(0===M.path.length)L._errors.push(O(M));else{let g=L,J=0;for(;J<M.path.length;){const L=M.path[J];J===M.path.length-1?(g[L]=g[L]||{_errors:[]},g[L]._errors.push(O(M))):g[L]=g[L]||{_errors:[]},g=g[L],J++}}};return processError(this),L}static assert(g){if(!(g instanceof ZodError))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(g=g=>g.message){const O={},L=[];for(const M of this.issues)M.path.length>0?(O[M.path[0]]=O[M.path[0]]||[],O[M.path[0]].push(g(M))):L.push(g(M));return{formErrors:L,fieldErrors:O}}get formErrors(){return this.flatten()}}ZodError.create=g=>new ZodError(g);const errorMap=(g,O)=>{let L;switch(g.code){case ZodIssueCode.invalid_type:L=g.received===ZodParsedType.undefined?"Required":`Expected ${g.expected}, received ${g.received}`;break;case ZodIssueCode.invalid_literal:L=`Invalid literal value, expected ${JSON.stringify(g.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:L=`Unrecognized key(s) in object: ${util.joinValues(g.keys,", ")}`;break;case ZodIssueCode.invalid_union:L="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:L=`Invalid discriminator value. Expected ${util.joinValues(g.options)}`;break;case ZodIssueCode.invalid_enum_value:L=`Invalid enum value. Expected ${util.joinValues(g.options)}, received '${g.received}'`;break;case ZodIssueCode.invalid_arguments:L="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:L="Invalid function return type";break;case ZodIssueCode.invalid_date:L="Invalid date";break;case ZodIssueCode.invalid_string:"object"==typeof g.validation?"includes"in g.validation?(L=`Invalid input: must include "${g.validation.includes}"`,"number"==typeof g.validation.position&&(L=`${L} at one or more positions greater than or equal to ${g.validation.position}`)):"startsWith"in g.validation?L=`Invalid input: must start with "${g.validation.startsWith}"`:"endsWith"in g.validation?L=`Invalid input: must end with "${g.validation.endsWith}"`:util.assertNever(g.validation):L="regex"!==g.validation?`Invalid ${g.validation}`:"Invalid";break;case ZodIssueCode.too_small:L="array"===g.type?`Array must contain ${g.exact?"exactly":g.inclusive?"at least":"more than"} ${g.minimum} element(s)`:"string"===g.type?`String must contain ${g.exact?"exactly":g.inclusive?"at least":"over"} ${g.minimum} character(s)`:"number"===g.type?`Number must be ${g.exact?"exactly equal to ":g.inclusive?"greater than or equal to ":"greater than "}${g.minimum}`:"date"===g.type?`Date must be ${g.exact?"exactly equal to ":g.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(g.minimum))}`:"Invalid input";break;case ZodIssueCode.too_big:L="array"===g.type?`Array must contain ${g.exact?"exactly":g.inclusive?"at most":"less than"} ${g.maximum} element(s)`:"string"===g.type?`String must contain ${g.exact?"exactly":g.inclusive?"at most":"under"} ${g.maximum} character(s)`:"number"===g.type?`Number must be ${g.exact?"exactly":g.inclusive?"less than or equal to":"less than"} ${g.maximum}`:"bigint"===g.type?`BigInt must be ${g.exact?"exactly":g.inclusive?"less than or equal to":"less than"} ${g.maximum}`:"date"===g.type?`Date must be ${g.exact?"exactly":g.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(g.maximum))}`:"Invalid input";break;case ZodIssueCode.custom:L="Invalid input";break;case ZodIssueCode.invalid_intersection_types:L="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:L=`Number must be a multiple of ${g.multipleOf}`;break;case ZodIssueCode.not_finite:L="Number must be finite";break;default:L=O.defaultError,util.assertNever(g)}return{message:L}};let overrideErrorMap=errorMap;function setErrorMap(g){overrideErrorMap=g}function getErrorMap(){return overrideErrorMap}const makeIssue=g=>{const{data:O,path:L,errorMaps:M,issueData:J}=g,ae=[...L,...J.path||[]],ie={...J,path:ae};if(void 0!==J.message)return{...J,path:ae,message:J.message};let ne="";const oe=M.filter((g=>!!g)).slice().reverse();for(const g of oe)ne=g(ie,{data:O,defaultError:ne}).message;return{...J,path:ae,message:ne}},EMPTY_PATH=[];function addIssueToContext(g,O){const L=getErrorMap(),M=makeIssue({issueData:O,data:g.data,path:g.path,errorMaps:[g.common.contextualErrorMap,g.schemaErrorMap,L,L===errorMap?void 0:errorMap].filter((g=>!!g))});g.common.issues.push(M)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(g,O){const L=[];for(const M of O){if("aborted"===M.status)return INVALID;"dirty"===M.status&&g.dirty(),L.push(M.value)}return{status:g.value,value:L}}static async mergeObjectAsync(g,O){const L=[];for(const g of O){const O=await g.key,M=await g.value;L.push({key:O,value:M})}return ParseStatus.mergeObjectSync(g,L)}static mergeObjectSync(g,O){const L={};for(const M of O){const{key:O,value:J}=M;if("aborted"===O.status)return INVALID;if("aborted"===J.status)return INVALID;"dirty"===O.status&&g.dirty(),"dirty"===J.status&&g.dirty(),"__proto__"===O.value||void 0===J.value&&!M.alwaysSet||(L[O.value]=J.value)}return{status:g.value,value:L}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=g=>({status:"dirty",value:g}),OK=g=>({status:"valid",value:g}),isAborted=g=>"aborted"===g.status,isDirty=g=>"dirty"===g.status,isValid=g=>"valid"===g.status,isAsync=g=>"undefined"!=typeof Promise&&g instanceof Promise;function __classPrivateFieldGet(g,O,L,M){if("function"==typeof O?g!==O||!M:!O.has(g))throw new TypeError("Cannot read private member from an object whose class did not declare it");return O.get(g)}function __classPrivateFieldSet(g,O,L,M,J){if("function"==typeof O?g!==O||!J:!O.has(g))throw new TypeError("Cannot write private member to an object whose class did not declare it");return O.set(g,L),L}var errorUtil,_ZodEnum_cache,_ZodNativeEnum_cache;"function"==typeof SuppressedError&&SuppressedError,function(g){g.errToObj=g=>"string"==typeof g?{message:g}:g||{},g.toString=g=>"string"==typeof g?g:null==g?void 0:g.message}(errorUtil||(errorUtil={}));class ParseInputLazyPath{constructor(g,O,L,M){this._cachedPath=[],this.parent=g,this.data=O,this._path=L,this._key=M}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(g,O)=>{if(isValid(O))return{success:!0,data:O.value};if(!g.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const O=new ZodError(g.common.issues);return this._error=O,this._error}}};function processCreateParams(g){if(!g)return{};const{errorMap:O,invalid_type_error:L,required_error:M,description:J}=g;if(O&&(L||M))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(O)return{errorMap:O,description:J};return{errorMap:(O,J)=>{var ae,ie;const{message:ne}=g;return"invalid_enum_value"===O.code?{message:null!=ne?ne:J.defaultError}:void 0===J.data?{message:null!==(ae=null!=ne?ne:M)&&void 0!==ae?ae:J.defaultError}:"invalid_type"!==O.code?{message:J.defaultError}:{message:null!==(ie=null!=ne?ne:L)&&void 0!==ie?ie:J.defaultError}},description:J}}class ZodType{constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(g){return getParsedType(g.data)}_getOrReturnCtx(g,O){return O||{common:g.parent.common,data:g.data,parsedType:getParsedType(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new ParseStatus,ctx:{common:g.parent.common,data:g.data,parsedType:getParsedType(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const O=this._parse(g);if(isAsync(O))throw new Error("Synchronous parse encountered promise.");return O}_parseAsync(g){const O=this._parse(g);return Promise.resolve(O)}parse(g,O){const L=this.safeParse(g,O);if(L.success)return L.data;throw L.error}safeParse(g,O){var L;const M={common:{issues:[],async:null!==(L=null==O?void 0:O.async)&&void 0!==L&&L,contextualErrorMap:null==O?void 0:O.errorMap},path:(null==O?void 0:O.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:getParsedType(g)},J=this._parseSync({data:g,path:M.path,parent:M});return handleResult(M,J)}async parseAsync(g,O){const L=await this.safeParseAsync(g,O);if(L.success)return L.data;throw L.error}async safeParseAsync(g,O){const L={common:{issues:[],contextualErrorMap:null==O?void 0:O.errorMap,async:!0},path:(null==O?void 0:O.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:getParsedType(g)},M=this._parse({data:g,path:L.path,parent:L}),J=await(isAsync(M)?M:Promise.resolve(M));return handleResult(L,J)}refine(g,O){const getIssueProperties=g=>"string"==typeof O||void 0===O?{message:O}:"function"==typeof O?O(g):O;return this._refinement(((O,L)=>{const M=g(O),setError=()=>L.addIssue({code:ZodIssueCode.custom,...getIssueProperties(O)});return"undefined"!=typeof Promise&&M instanceof Promise?M.then((g=>!!g||(setError(),!1))):!!M||(setError(),!1)}))}refinement(g,O){return this._refinement(((L,M)=>!!g(L)||(M.addIssue("function"==typeof O?O(L,M):O),!1)))}_refinement(g){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(g){return ZodUnion.create([this,g],this._def)}and(g){return ZodIntersection.create(this,g,this._def)}transform(g){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const O="function"==typeof g?g:()=>g;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:O,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(g){const O="function"==typeof g?g:()=>g;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:O,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(g){return new(0,this.constructor)({...this._def,description:g})}pipe(g){return ZodPipeline.create(this,g)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex$1=/^c[^\s-]{8,}$/i,cuid2Regex$1=/^[0-9a-z]+$/,ulidRegex$1=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex$1=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex$1=/^[a-z0-9_-]{21}$/i,durationRegex$1=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex$1;const ipv4Regex$1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex$1=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex$1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource$1(g){let O="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return g.precision?O=`${O}\\.\\d{${g.precision}}`:null==g.precision&&(O=`${O}(\\.\\d+)?`),O}function timeRegex$1(g){return new RegExp(`^${timeRegexSource$1(g)}$`)}function datetimeRegex(g){let O=`${dateRegexSource}T${timeRegexSource$1(g)}`;const L=[];return L.push(g.local?"Z?":"Z"),g.offset&&L.push("([+-]\\d{2}:?\\d{2})"),O=`${O}(${L.join("|")})`,new RegExp(`^${O}$`)}function isValidIP(g,O){return!("v4"!==O&&O||!ipv4Regex$1.test(g))||!("v6"!==O&&O||!ipv6Regex$1.test(g))}class ZodString extends ZodType{_parse(g){this._def.coerce&&(g.data=String(g.data));if(this._getType(g)!==ZodParsedType.string){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:O.parsedType}),INVALID}const O=new ParseStatus;let L;for(const M of this._def.checks)if("min"===M.kind)g.data.length<M.value&&(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.too_small,minimum:M.value,type:"string",inclusive:!0,exact:!1,message:M.message}),O.dirty());else if("max"===M.kind)g.data.length>M.value&&(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.too_big,maximum:M.value,type:"string",inclusive:!0,exact:!1,message:M.message}),O.dirty());else if("length"===M.kind){const J=g.data.length>M.value,ae=g.data.length<M.value;(J||ae)&&(L=this._getOrReturnCtx(g,L),J?addIssueToContext(L,{code:ZodIssueCode.too_big,maximum:M.value,type:"string",inclusive:!0,exact:!0,message:M.message}):ae&&addIssueToContext(L,{code:ZodIssueCode.too_small,minimum:M.value,type:"string",inclusive:!0,exact:!0,message:M.message}),O.dirty())}else if("email"===M.kind)emailRegex.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"email",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("emoji"===M.kind)emojiRegex$1||(emojiRegex$1=new RegExp(_emojiRegex,"u")),emojiRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"emoji",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("uuid"===M.kind)uuidRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"uuid",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("nanoid"===M.kind)nanoidRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("cuid"===M.kind)cuidRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"cuid",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("cuid2"===M.kind)cuid2Regex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("ulid"===M.kind)ulidRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"ulid",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty());else if("url"===M.kind)try{new URL(g.data)}catch(J){L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"url",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty()}else if("regex"===M.kind){M.regex.lastIndex=0;M.regex.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"regex",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty())}else if("trim"===M.kind)g.data=g.data.trim();else if("includes"===M.kind)g.data.includes(M.value,M.position)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:{includes:M.value,position:M.position},message:M.message}),O.dirty());else if("toLowerCase"===M.kind)g.data=g.data.toLowerCase();else if("toUpperCase"===M.kind)g.data=g.data.toUpperCase();else if("startsWith"===M.kind)g.data.startsWith(M.value)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:{startsWith:M.value},message:M.message}),O.dirty());else if("endsWith"===M.kind)g.data.endsWith(M.value)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:{endsWith:M.value},message:M.message}),O.dirty());else if("datetime"===M.kind){datetimeRegex(M).test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:"datetime",message:M.message}),O.dirty())}else if("date"===M.kind){dateRegex.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:"date",message:M.message}),O.dirty())}else if("time"===M.kind){timeRegex$1(M).test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.invalid_string,validation:"time",message:M.message}),O.dirty())}else"duration"===M.kind?durationRegex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"duration",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty()):"ip"===M.kind?isValidIP(g.data,M.version)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"ip",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty()):"base64"===M.kind?base64Regex$1.test(g.data)||(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{validation:"base64",code:ZodIssueCode.invalid_string,message:M.message}),O.dirty()):util.assertNever(M);return{status:O.value,value:g.data}}_regex(g,O,L){return this.refinement((O=>g.test(O)),{validation:O,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(L)})}_addCheck(g){return new ZodString({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...errorUtil.errToObj(g)})}url(g){return this._addCheck({kind:"url",...errorUtil.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...errorUtil.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...errorUtil.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...errorUtil.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...errorUtil.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...errorUtil.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...errorUtil.errToObj(g)})}datetime(g){var O,L;return"string"==typeof g?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:void 0===(null==g?void 0:g.precision)?null:null==g?void 0:g.precision,offset:null!==(O=null==g?void 0:g.offset)&&void 0!==O&&O,local:null!==(L=null==g?void 0:g.local)&&void 0!==L&&L,...errorUtil.errToObj(null==g?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return"string"==typeof g?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:void 0===(null==g?void 0:g.precision)?null:null==g?void 0:g.precision,...errorUtil.errToObj(null==g?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...errorUtil.errToObj(g)})}regex(g,O){return this._addCheck({kind:"regex",regex:g,...errorUtil.errToObj(O)})}includes(g,O){return this._addCheck({kind:"includes",value:g,position:null==O?void 0:O.position,...errorUtil.errToObj(null==O?void 0:O.message)})}startsWith(g,O){return this._addCheck({kind:"startsWith",value:g,...errorUtil.errToObj(O)})}endsWith(g,O){return this._addCheck({kind:"endsWith",value:g,...errorUtil.errToObj(O)})}min(g,O){return this._addCheck({kind:"min",value:g,...errorUtil.errToObj(O)})}max(g,O){return this._addCheck({kind:"max",value:g,...errorUtil.errToObj(O)})}length(g,O){return this._addCheck({kind:"length",value:g,...errorUtil.errToObj(O)})}nonempty(g){return this.min(1,errorUtil.errToObj(g))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((g=>"datetime"===g.kind))}get isDate(){return!!this._def.checks.find((g=>"date"===g.kind))}get isTime(){return!!this._def.checks.find((g=>"time"===g.kind))}get isDuration(){return!!this._def.checks.find((g=>"duration"===g.kind))}get isEmail(){return!!this._def.checks.find((g=>"email"===g.kind))}get isURL(){return!!this._def.checks.find((g=>"url"===g.kind))}get isEmoji(){return!!this._def.checks.find((g=>"emoji"===g.kind))}get isUUID(){return!!this._def.checks.find((g=>"uuid"===g.kind))}get isNANOID(){return!!this._def.checks.find((g=>"nanoid"===g.kind))}get isCUID(){return!!this._def.checks.find((g=>"cuid"===g.kind))}get isCUID2(){return!!this._def.checks.find((g=>"cuid2"===g.kind))}get isULID(){return!!this._def.checks.find((g=>"ulid"===g.kind))}get isIP(){return!!this._def.checks.find((g=>"ip"===g.kind))}get isBase64(){return!!this._def.checks.find((g=>"base64"===g.kind))}get minLength(){let g=null;for(const O of this._def.checks)"min"===O.kind&&(null===g||O.value>g)&&(g=O.value);return g}get maxLength(){let g=null;for(const O of this._def.checks)"max"===O.kind&&(null===g||O.value<g)&&(g=O.value);return g}}function floatSafeRemainder(g,O){const L=(g.toString().split(".")[1]||"").length,M=(O.toString().split(".")[1]||"").length,J=L>M?L:M;return parseInt(g.toFixed(J).replace(".",""))%parseInt(O.toFixed(J).replace(".",""))/Math.pow(10,J)}ZodString.create=g=>{var O;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:null!==(O=null==g?void 0:g.coerce)&&void 0!==O&&O,...processCreateParams(g)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){this._def.coerce&&(g.data=Number(g.data));if(this._getType(g)!==ZodParsedType.number){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:O.parsedType}),INVALID}let O;const L=new ParseStatus;for(const M of this._def.checks)if("int"===M.kind)util.isInteger(g.data)||(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:M.message}),L.dirty());else if("min"===M.kind){(M.inclusive?g.data<M.value:g.data<=M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.too_small,minimum:M.value,type:"number",inclusive:M.inclusive,exact:!1,message:M.message}),L.dirty())}else if("max"===M.kind){(M.inclusive?g.data>M.value:g.data>=M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.too_big,maximum:M.value,type:"number",inclusive:M.inclusive,exact:!1,message:M.message}),L.dirty())}else"multipleOf"===M.kind?0!==floatSafeRemainder(g.data,M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.not_multiple_of,multipleOf:M.value,message:M.message}),L.dirty()):"finite"===M.kind?Number.isFinite(g.data)||(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.not_finite,message:M.message}),L.dirty()):util.assertNever(M);return{status:L.value,value:g.data}}gte(g,O){return this.setLimit("min",g,!0,errorUtil.toString(O))}gt(g,O){return this.setLimit("min",g,!1,errorUtil.toString(O))}lte(g,O){return this.setLimit("max",g,!0,errorUtil.toString(O))}lt(g,O){return this.setLimit("max",g,!1,errorUtil.toString(O))}setLimit(g,O,L,M){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:g,value:O,inclusive:L,message:errorUtil.toString(M)}]})}_addCheck(g){return new ZodNumber({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:errorUtil.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(g)})}multipleOf(g,O){return this._addCheck({kind:"multipleOf",value:g,message:errorUtil.toString(O)})}finite(g){return this._addCheck({kind:"finite",message:errorUtil.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(g)})}get minValue(){let g=null;for(const O of this._def.checks)"min"===O.kind&&(null===g||O.value>g)&&(g=O.value);return g}get maxValue(){let g=null;for(const O of this._def.checks)"max"===O.kind&&(null===g||O.value<g)&&(g=O.value);return g}get isInt(){return!!this._def.checks.find((g=>"int"===g.kind||"multipleOf"===g.kind&&util.isInteger(g.value)))}get isFinite(){let g=null,O=null;for(const L of this._def.checks){if("finite"===L.kind||"int"===L.kind||"multipleOf"===L.kind)return!0;"min"===L.kind?(null===O||L.value>O)&&(O=L.value):"max"===L.kind&&(null===g||L.value<g)&&(g=L.value)}return Number.isFinite(O)&&Number.isFinite(g)}}ZodNumber.create=g=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(null==g?void 0:g.coerce)||!1,...processCreateParams(g)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){this._def.coerce&&(g.data=BigInt(g.data));if(this._getType(g)!==ZodParsedType.bigint){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:O.parsedType}),INVALID}let O;const L=new ParseStatus;for(const M of this._def.checks)if("min"===M.kind){(M.inclusive?g.data<M.value:g.data<=M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.too_small,type:"bigint",minimum:M.value,inclusive:M.inclusive,message:M.message}),L.dirty())}else if("max"===M.kind){(M.inclusive?g.data>M.value:g.data>=M.value)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.too_big,type:"bigint",maximum:M.value,inclusive:M.inclusive,message:M.message}),L.dirty())}else"multipleOf"===M.kind?g.data%M.value!==BigInt(0)&&(O=this._getOrReturnCtx(g,O),addIssueToContext(O,{code:ZodIssueCode.not_multiple_of,multipleOf:M.value,message:M.message}),L.dirty()):util.assertNever(M);return{status:L.value,value:g.data}}gte(g,O){return this.setLimit("min",g,!0,errorUtil.toString(O))}gt(g,O){return this.setLimit("min",g,!1,errorUtil.toString(O))}lte(g,O){return this.setLimit("max",g,!0,errorUtil.toString(O))}lt(g,O){return this.setLimit("max",g,!1,errorUtil.toString(O))}setLimit(g,O,L,M){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:g,value:O,inclusive:L,message:errorUtil.toString(M)}]})}_addCheck(g){return new ZodBigInt({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(g)})}multipleOf(g,O){return this._addCheck({kind:"multipleOf",value:g,message:errorUtil.toString(O)})}get minValue(){let g=null;for(const O of this._def.checks)"min"===O.kind&&(null===g||O.value>g)&&(g=O.value);return g}get maxValue(){let g=null;for(const O of this._def.checks)"max"===O.kind&&(null===g||O.value<g)&&(g=O.value);return g}}ZodBigInt.create=g=>{var O;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:null!==(O=null==g?void 0:g.coerce)&&void 0!==O&&O,...processCreateParams(g)})};class ZodBoolean extends ZodType{_parse(g){this._def.coerce&&(g.data=Boolean(g.data));if(this._getType(g)!==ZodParsedType.boolean){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:O.parsedType}),INVALID}return OK(g.data)}}ZodBoolean.create=g=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(null==g?void 0:g.coerce)||!1,...processCreateParams(g)});class ZodDate extends ZodType{_parse(g){this._def.coerce&&(g.data=new Date(g.data));if(this._getType(g)!==ZodParsedType.date){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:O.parsedType}),INVALID}if(isNaN(g.data.getTime())){return addIssueToContext(this._getOrReturnCtx(g),{code:ZodIssueCode.invalid_date}),INVALID}const O=new ParseStatus;let L;for(const M of this._def.checks)"min"===M.kind?g.data.getTime()<M.value&&(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.too_small,message:M.message,inclusive:!0,exact:!1,minimum:M.value,type:"date"}),O.dirty()):"max"===M.kind?g.data.getTime()>M.value&&(L=this._getOrReturnCtx(g,L),addIssueToContext(L,{code:ZodIssueCode.too_big,message:M.message,inclusive:!0,exact:!1,maximum:M.value,type:"date"}),O.dirty()):util.assertNever(M);return{status:O.value,value:new Date(g.data.getTime())}}_addCheck(g){return new ZodDate({...this._def,checks:[...this._def.checks,g]})}min(g,O){return this._addCheck({kind:"min",value:g.getTime(),message:errorUtil.toString(O)})}max(g,O){return this._addCheck({kind:"max",value:g.getTime(),message:errorUtil.toString(O)})}get minDate(){let g=null;for(const O of this._def.checks)"min"===O.kind&&(null===g||O.value>g)&&(g=O.value);return null!=g?new Date(g):null}get maxDate(){let g=null;for(const O of this._def.checks)"max"===O.kind&&(null===g||O.value<g)&&(g=O.value);return null!=g?new Date(g):null}}ZodDate.create=g=>new ZodDate({checks:[],coerce:(null==g?void 0:g.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(g)});class ZodSymbol extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.symbol){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:O.parsedType}),INVALID}return OK(g.data)}}ZodSymbol.create=g=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(g)});class ZodUndefined extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.undefined){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:O.parsedType}),INVALID}return OK(g.data)}}ZodUndefined.create=g=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(g)});class ZodNull extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.null){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:O.parsedType}),INVALID}return OK(g.data)}}ZodNull.create=g=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(g)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(g){return OK(g.data)}}ZodAny.create=g=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(g)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(g){return OK(g.data)}}ZodUnknown.create=g=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(g)});class ZodNever extends ZodType{_parse(g){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:O.parsedType}),INVALID}}ZodNever.create=g=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(g)});class ZodVoid extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.undefined){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:O.parsedType}),INVALID}return OK(g.data)}}ZodVoid.create=g=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(g)});class ZodArray extends ZodType{_parse(g){const{ctx:O,status:L}=this._processInputParams(g),M=this._def;if(O.parsedType!==ZodParsedType.array)return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:O.parsedType}),INVALID;if(null!==M.exactLength){const g=O.data.length>M.exactLength.value,J=O.data.length<M.exactLength.value;(g||J)&&(addIssueToContext(O,{code:g?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:J?M.exactLength.value:void 0,maximum:g?M.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:M.exactLength.message}),L.dirty())}if(null!==M.minLength&&O.data.length<M.minLength.value&&(addIssueToContext(O,{code:ZodIssueCode.too_small,minimum:M.minLength.value,type:"array",inclusive:!0,exact:!1,message:M.minLength.message}),L.dirty()),null!==M.maxLength&&O.data.length>M.maxLength.value&&(addIssueToContext(O,{code:ZodIssueCode.too_big,maximum:M.maxLength.value,type:"array",inclusive:!0,exact:!1,message:M.maxLength.message}),L.dirty()),O.common.async)return Promise.all([...O.data].map(((g,L)=>M.type._parseAsync(new ParseInputLazyPath(O,g,O.path,L))))).then((g=>ParseStatus.mergeArray(L,g)));const J=[...O.data].map(((g,L)=>M.type._parseSync(new ParseInputLazyPath(O,g,O.path,L))));return ParseStatus.mergeArray(L,J)}get element(){return this._def.type}min(g,O){return new ZodArray({...this._def,minLength:{value:g,message:errorUtil.toString(O)}})}max(g,O){return new ZodArray({...this._def,maxLength:{value:g,message:errorUtil.toString(O)}})}length(g,O){return new ZodArray({...this._def,exactLength:{value:g,message:errorUtil.toString(O)}})}nonempty(g){return this.min(1,g)}}function deepPartialify(g){if(g instanceof ZodObject){const O={};for(const L in g.shape){const M=g.shape[L];O[L]=ZodOptional.create(deepPartialify(M))}return new ZodObject({...g._def,shape:()=>O})}return g instanceof ZodArray?new ZodArray({...g._def,type:deepPartialify(g.element)}):g instanceof ZodOptional?ZodOptional.create(deepPartialify(g.unwrap())):g instanceof ZodNullable?ZodNullable.create(deepPartialify(g.unwrap())):g instanceof ZodTuple?ZodTuple.create(g.items.map((g=>deepPartialify(g)))):g}ZodArray.create=(g,O)=>new ZodArray({type:g,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(O)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const g=this._def.shape(),O=util.objectKeys(g);return this._cached={shape:g,keys:O}}_parse(g){if(this._getType(g)!==ZodParsedType.object){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:O.parsedType}),INVALID}const{status:O,ctx:L}=this._processInputParams(g),{shape:M,keys:J}=this._getCached(),ae=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const g in L.data)J.includes(g)||ae.push(g);const ie=[];for(const g of J){const O=M[g],J=L.data[g];ie.push({key:{status:"valid",value:g},value:O._parse(new ParseInputLazyPath(L,J,L.path,g)),alwaysSet:g in L.data})}if(this._def.catchall instanceof ZodNever){const g=this._def.unknownKeys;if("passthrough"===g)for(const g of ae)ie.push({key:{status:"valid",value:g},value:{status:"valid",value:L.data[g]}});else if("strict"===g)ae.length>0&&(addIssueToContext(L,{code:ZodIssueCode.unrecognized_keys,keys:ae}),O.dirty());else if("strip"!==g)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const O of ae){const M=L.data[O];ie.push({key:{status:"valid",value:O},value:g._parse(new ParseInputLazyPath(L,M,L.path,O)),alwaysSet:O in L.data})}}return L.common.async?Promise.resolve().then((async()=>{const g=[];for(const O of ie){const L=await O.key,M=await O.value;g.push({key:L,value:M,alwaysSet:O.alwaysSet})}return g})).then((g=>ParseStatus.mergeObjectSync(O,g))):ParseStatus.mergeObjectSync(O,ie)}get shape(){return this._def.shape()}strict(g){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==g?{errorMap:(O,L)=>{var M,J,ae,ie;const ne=null!==(ae=null===(J=(M=this._def).errorMap)||void 0===J?void 0:J.call(M,O,L).message)&&void 0!==ae?ae:L.defaultError;return"unrecognized_keys"===O.code?{message:null!==(ie=errorUtil.errToObj(g).message)&&void 0!==ie?ie:ne}:{message:ne}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(g){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new ZodObject({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(g,O){return this.augment({[g]:O})}catchall(g){return new ZodObject({...this._def,catchall:g})}pick(g){const O={};return util.objectKeys(g).forEach((L=>{g[L]&&this.shape[L]&&(O[L]=this.shape[L])})),new ZodObject({...this._def,shape:()=>O})}omit(g){const O={};return util.objectKeys(this.shape).forEach((L=>{g[L]||(O[L]=this.shape[L])})),new ZodObject({...this._def,shape:()=>O})}deepPartial(){return deepPartialify(this)}partial(g){const O={};return util.objectKeys(this.shape).forEach((L=>{const M=this.shape[L];g&&!g[L]?O[L]=M:O[L]=M.optional()})),new ZodObject({...this._def,shape:()=>O})}required(g){const O={};return util.objectKeys(this.shape).forEach((L=>{if(g&&!g[L])O[L]=this.shape[L];else{let g=this.shape[L];for(;g instanceof ZodOptional;)g=g._def.innerType;O[L]=g}})),new ZodObject({...this._def,shape:()=>O})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(g,O)=>new ZodObject({shape:()=>g,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(O)}),ZodObject.strictCreate=(g,O)=>new ZodObject({shape:()=>g,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(O)}),ZodObject.lazycreate=(g,O)=>new ZodObject({shape:g,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(O)});class ZodUnion extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g),L=this._def.options;if(O.common.async)return Promise.all(L.map((async g=>{const L={...O,common:{...O.common,issues:[]},parent:null};return{result:await g._parseAsync({data:O.data,path:O.path,parent:L}),ctx:L}}))).then((function handleResults(g){for(const O of g)if("valid"===O.result.status)return O.result;for(const L of g)if("dirty"===L.result.status)return O.common.issues.push(...L.ctx.common.issues),L.result;const L=g.map((g=>new ZodError(g.ctx.common.issues)));return addIssueToContext(O,{code:ZodIssueCode.invalid_union,unionErrors:L}),INVALID}));{let g;const M=[];for(const J of L){const L={...O,common:{...O.common,issues:[]},parent:null},ae=J._parseSync({data:O.data,path:O.path,parent:L});if("valid"===ae.status)return ae;"dirty"!==ae.status||g||(g={result:ae,ctx:L}),L.common.issues.length&&M.push(L.common.issues)}if(g)return O.common.issues.push(...g.ctx.common.issues),g.result;const J=M.map((g=>new ZodError(g)));return addIssueToContext(O,{code:ZodIssueCode.invalid_union,unionErrors:J}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(g,O)=>new ZodUnion({options:g,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(O)});const getDiscriminator=g=>g instanceof ZodLazy?getDiscriminator(g.schema):g instanceof ZodEffects?getDiscriminator(g.innerType()):g instanceof ZodLiteral?[g.value]:g instanceof ZodEnum?g.options:g instanceof ZodNativeEnum?util.objectValues(g.enum):g instanceof ZodDefault?getDiscriminator(g._def.innerType):g instanceof ZodUndefined?[void 0]:g instanceof ZodNull?[null]:g instanceof ZodOptional?[void 0,...getDiscriminator(g.unwrap())]:g instanceof ZodNullable?[null,...getDiscriminator(g.unwrap())]:g instanceof ZodBranded||g instanceof ZodReadonly?getDiscriminator(g.unwrap()):g instanceof ZodCatch?getDiscriminator(g._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g);if(O.parsedType!==ZodParsedType.object)return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:O.parsedType}),INVALID;const L=this.discriminator,M=O.data[L],J=this.optionsMap.get(M);return J?O.common.async?J._parseAsync({data:O.data,path:O.path,parent:O}):J._parseSync({data:O.data,path:O.path,parent:O}):(addIssueToContext(O,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[L]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,O,L){const M=new Map;for(const L of O){const O=getDiscriminator(L.shape[g]);if(!O.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const J of O){if(M.has(J))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(J)}`);M.set(J,L)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:g,options:O,optionsMap:M,...processCreateParams(L)})}}function mergeValues(g,O){const L=getParsedType(g),M=getParsedType(O);if(g===O)return{valid:!0,data:g};if(L===ZodParsedType.object&&M===ZodParsedType.object){const L=util.objectKeys(O),M=util.objectKeys(g).filter((g=>-1!==L.indexOf(g))),J={...g,...O};for(const L of M){const M=mergeValues(g[L],O[L]);if(!M.valid)return{valid:!1};J[L]=M.data}return{valid:!0,data:J}}if(L===ZodParsedType.array&&M===ZodParsedType.array){if(g.length!==O.length)return{valid:!1};const L=[];for(let M=0;M<g.length;M++){const J=mergeValues(g[M],O[M]);if(!J.valid)return{valid:!1};L.push(J.data)}return{valid:!0,data:L}}return L===ZodParsedType.date&&M===ZodParsedType.date&&+g==+O?{valid:!0,data:g}:{valid:!1}}class ZodIntersection extends ZodType{_parse(g){const{status:O,ctx:L}=this._processInputParams(g),handleParsed=(g,M)=>{if(isAborted(g)||isAborted(M))return INVALID;const J=mergeValues(g.value,M.value);return J.valid?((isDirty(g)||isDirty(M))&&O.dirty(),{status:O.value,value:J.data}):(addIssueToContext(L,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return L.common.async?Promise.all([this._def.left._parseAsync({data:L.data,path:L.path,parent:L}),this._def.right._parseAsync({data:L.data,path:L.path,parent:L})]).then((([g,O])=>handleParsed(g,O))):handleParsed(this._def.left._parseSync({data:L.data,path:L.path,parent:L}),this._def.right._parseSync({data:L.data,path:L.path,parent:L}))}}ZodIntersection.create=(g,O,L)=>new ZodIntersection({left:g,right:O,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(L)});class ZodTuple extends ZodType{_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.parsedType!==ZodParsedType.array)return addIssueToContext(L,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:L.parsedType}),INVALID;if(L.data.length<this._def.items.length)return addIssueToContext(L,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&L.data.length>this._def.items.length&&(addIssueToContext(L,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O.dirty());const M=[...L.data].map(((g,O)=>{const M=this._def.items[O]||this._def.rest;return M?M._parse(new ParseInputLazyPath(L,g,L.path,O)):null})).filter((g=>!!g));return L.common.async?Promise.all(M).then((g=>ParseStatus.mergeArray(O,g))):ParseStatus.mergeArray(O,M)}get items(){return this._def.items}rest(g){return new ZodTuple({...this._def,rest:g})}}ZodTuple.create=(g,O)=>{if(!Array.isArray(g))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:g,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(O)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.parsedType!==ZodParsedType.object)return addIssueToContext(L,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:L.parsedType}),INVALID;const M=[],J=this._def.keyType,ae=this._def.valueType;for(const g in L.data)M.push({key:J._parse(new ParseInputLazyPath(L,g,L.path,g)),value:ae._parse(new ParseInputLazyPath(L,L.data[g],L.path,g)),alwaysSet:g in L.data});return L.common.async?ParseStatus.mergeObjectAsync(O,M):ParseStatus.mergeObjectSync(O,M)}get element(){return this._def.valueType}static create(g,O,L){return new ZodRecord(O instanceof ZodType?{keyType:g,valueType:O,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(L)}:{keyType:ZodString.create(),valueType:g,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(O)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.parsedType!==ZodParsedType.map)return addIssueToContext(L,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:L.parsedType}),INVALID;const M=this._def.keyType,J=this._def.valueType,ae=[...L.data.entries()].map((([g,O],ae)=>({key:M._parse(new ParseInputLazyPath(L,g,L.path,[ae,"key"])),value:J._parse(new ParseInputLazyPath(L,O,L.path,[ae,"value"]))})));if(L.common.async){const g=new Map;return Promise.resolve().then((async()=>{for(const L of ae){const M=await L.key,J=await L.value;if("aborted"===M.status||"aborted"===J.status)return INVALID;"dirty"!==M.status&&"dirty"!==J.status||O.dirty(),g.set(M.value,J.value)}return{status:O.value,value:g}}))}{const g=new Map;for(const L of ae){const M=L.key,J=L.value;if("aborted"===M.status||"aborted"===J.status)return INVALID;"dirty"!==M.status&&"dirty"!==J.status||O.dirty(),g.set(M.value,J.value)}return{status:O.value,value:g}}}}ZodMap.create=(g,O,L)=>new ZodMap({valueType:O,keyType:g,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(L)});class ZodSet extends ZodType{_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.parsedType!==ZodParsedType.set)return addIssueToContext(L,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:L.parsedType}),INVALID;const M=this._def;null!==M.minSize&&L.data.size<M.minSize.value&&(addIssueToContext(L,{code:ZodIssueCode.too_small,minimum:M.minSize.value,type:"set",inclusive:!0,exact:!1,message:M.minSize.message}),O.dirty()),null!==M.maxSize&&L.data.size>M.maxSize.value&&(addIssueToContext(L,{code:ZodIssueCode.too_big,maximum:M.maxSize.value,type:"set",inclusive:!0,exact:!1,message:M.maxSize.message}),O.dirty());const J=this._def.valueType;function finalizeSet(g){const L=new Set;for(const M of g){if("aborted"===M.status)return INVALID;"dirty"===M.status&&O.dirty(),L.add(M.value)}return{status:O.value,value:L}}const ae=[...L.data.values()].map(((g,O)=>J._parse(new ParseInputLazyPath(L,g,L.path,O))));return L.common.async?Promise.all(ae).then((g=>finalizeSet(g))):finalizeSet(ae)}min(g,O){return new ZodSet({...this._def,minSize:{value:g,message:errorUtil.toString(O)}})}max(g,O){return new ZodSet({...this._def,maxSize:{value:g,message:errorUtil.toString(O)}})}size(g,O){return this.min(g,O).max(g,O)}nonempty(g){return this.min(1,g)}}ZodSet.create=(g,O)=>new ZodSet({valueType:g,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(O)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:O}=this._processInputParams(g);if(O.parsedType!==ZodParsedType.function)return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:O.parsedType}),INVALID;function makeArgsIssue(g,L){return makeIssue({data:g,path:O.path,errorMaps:[O.common.contextualErrorMap,O.schemaErrorMap,getErrorMap(),errorMap].filter((g=>!!g)),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:L}})}function makeReturnsIssue(g,L){return makeIssue({data:g,path:O.path,errorMaps:[O.common.contextualErrorMap,O.schemaErrorMap,getErrorMap(),errorMap].filter((g=>!!g)),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:L}})}const L={errorMap:O.common.contextualErrorMap},M=O.data;if(this._def.returns instanceof ZodPromise){const g=this;return OK((async function(...O){const J=new ZodError([]),ae=await g._def.args.parseAsync(O,L).catch((g=>{throw J.addIssue(makeArgsIssue(O,g)),J})),ie=await Reflect.apply(M,this,ae),ne=await g._def.returns._def.type.parseAsync(ie,L).catch((g=>{throw J.addIssue(makeReturnsIssue(ie,g)),J}));return ne}))}{const g=this;return OK((function(...O){const J=g._def.args.safeParse(O,L);if(!J.success)throw new ZodError([makeArgsIssue(O,J.error)]);const ae=Reflect.apply(M,this,J.data),ie=g._def.returns.safeParse(ae,L);if(!ie.success)throw new ZodError([makeReturnsIssue(ae,ie.error)]);return ie.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new ZodFunction({...this._def,args:ZodTuple.create(g).rest(ZodUnknown.create())})}returns(g){return new ZodFunction({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,O,L){return new ZodFunction({args:g||ZodTuple.create([]).rest(ZodUnknown.create()),returns:O||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(L)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(g){const{ctx:O}=this._processInputParams(g);return this._def.getter()._parse({data:O.data,path:O.path,parent:O})}}ZodLazy.create=(g,O)=>new ZodLazy({getter:g,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(O)});class ZodLiteral extends ZodType{_parse(g){if(g.data!==this._def.value){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{received:O.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:g.data}}get value(){return this._def.value}}function createZodEnum(g,O){return new ZodEnum({values:g,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(O)})}ZodLiteral.create=(g,O)=>new ZodLiteral({value:g,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(O)});class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(g){if("string"!=typeof g.data){const O=this._getOrReturnCtx(g),L=this._def.values;return addIssueToContext(O,{expected:util.joinValues(L),received:O.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodEnum_cache)||__classPrivateFieldSet(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet(this,_ZodEnum_cache).has(g.data)){const O=this._getOrReturnCtx(g),L=this._def.values;return addIssueToContext(O,{received:O.data,code:ZodIssueCode.invalid_enum_value,options:L}),INVALID}return OK(g.data)}get options(){return this._def.values}get enum(){const g={};for(const O of this._def.values)g[O]=O;return g}get Values(){const g={};for(const O of this._def.values)g[O]=O;return g}get Enum(){const g={};for(const O of this._def.values)g[O]=O;return g}extract(g,O=this._def){return ZodEnum.create(g,{...this._def,...O})}exclude(g,O=this._def){return ZodEnum.create(this.options.filter((O=>!g.includes(O))),{...this._def,...O})}}_ZodEnum_cache=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(g){const O=util.getValidEnumValues(this._def.values),L=this._getOrReturnCtx(g);if(L.parsedType!==ZodParsedType.string&&L.parsedType!==ZodParsedType.number){const g=util.objectValues(O);return addIssueToContext(L,{expected:util.joinValues(g),received:L.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache)||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,_ZodNativeEnum_cache).has(g.data)){const g=util.objectValues(O);return addIssueToContext(L,{received:L.data,code:ZodIssueCode.invalid_enum_value,options:g}),INVALID}return OK(g.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap,ZodNativeEnum.create=(g,O)=>new ZodNativeEnum({values:g,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(O)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(g){const{ctx:O}=this._processInputParams(g);if(O.parsedType!==ZodParsedType.promise&&!1===O.common.async)return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:O.parsedType}),INVALID;const L=O.parsedType===ZodParsedType.promise?O.data:Promise.resolve(O.data);return OK(L.then((g=>this._def.type.parseAsync(g,{path:O.path,errorMap:O.common.contextualErrorMap}))))}}ZodPromise.create=(g,O)=>new ZodPromise({type:g,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(O)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:O,ctx:L}=this._processInputParams(g),M=this._def.effect||null,J={addIssue:g=>{addIssueToContext(L,g),g.fatal?O.abort():O.dirty()},get path(){return L.path}};if(J.addIssue=J.addIssue.bind(J),"preprocess"===M.type){const g=M.transform(L.data,J);if(L.common.async)return Promise.resolve(g).then((async g=>{if("aborted"===O.value)return INVALID;const M=await this._def.schema._parseAsync({data:g,path:L.path,parent:L});return"aborted"===M.status?INVALID:"dirty"===M.status||"dirty"===O.value?DIRTY(M.value):M}));{if("aborted"===O.value)return INVALID;const M=this._def.schema._parseSync({data:g,path:L.path,parent:L});return"aborted"===M.status?INVALID:"dirty"===M.status||"dirty"===O.value?DIRTY(M.value):M}}if("refinement"===M.type){const executeRefinement=g=>{const O=M.refinement(g,J);if(L.common.async)return Promise.resolve(O);if(O instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return g};if(!1===L.common.async){const g=this._def.schema._parseSync({data:L.data,path:L.path,parent:L});return"aborted"===g.status?INVALID:("dirty"===g.status&&O.dirty(),executeRefinement(g.value),{status:O.value,value:g.value})}return this._def.schema._parseAsync({data:L.data,path:L.path,parent:L}).then((g=>"aborted"===g.status?INVALID:("dirty"===g.status&&O.dirty(),executeRefinement(g.value).then((()=>({status:O.value,value:g.value}))))))}if("transform"===M.type){if(!1===L.common.async){const g=this._def.schema._parseSync({data:L.data,path:L.path,parent:L});if(!isValid(g))return g;const ae=M.transform(g.value,J);if(ae instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:O.value,value:ae}}return this._def.schema._parseAsync({data:L.data,path:L.path,parent:L}).then((g=>isValid(g)?Promise.resolve(M.transform(g.value,J)).then((g=>({status:O.value,value:g}))):g))}util.assertNever(M)}}ZodEffects.create=(g,O,L)=>new ZodEffects({schema:g,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:O,...processCreateParams(L)}),ZodEffects.createWithPreprocess=(g,O,L)=>new ZodEffects({schema:O,effect:{type:"preprocess",transform:g},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(L)});class ZodOptional extends ZodType{_parse(g){return this._getType(g)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}ZodOptional.create=(g,O)=>new ZodOptional({innerType:g,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(O)});class ZodNullable extends ZodType{_parse(g){return this._getType(g)===ZodParsedType.null?OK(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}ZodNullable.create=(g,O)=>new ZodNullable({innerType:g,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(O)});class ZodDefault extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g);let L=O.data;return O.parsedType===ZodParsedType.undefined&&(L=this._def.defaultValue()),this._def.innerType._parse({data:L,path:O.path,parent:O})}removeDefault(){return this._def.innerType}}ZodDefault.create=(g,O)=>new ZodDefault({innerType:g,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:"function"==typeof O.default?O.default:()=>O.default,...processCreateParams(O)});class ZodCatch extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g),L={...O,common:{...O.common,issues:[]}},M=this._def.innerType._parse({data:L.data,path:L.path,parent:{...L}});return isAsync(M)?M.then((g=>({status:"valid",value:"valid"===g.status?g.value:this._def.catchValue({get error(){return new ZodError(L.common.issues)},input:L.data})}))):{status:"valid",value:"valid"===M.status?M.value:this._def.catchValue({get error(){return new ZodError(L.common.issues)},input:L.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(g,O)=>new ZodCatch({innerType:g,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:"function"==typeof O.catch?O.catch:()=>O.catch,...processCreateParams(O)});class ZodNaN extends ZodType{_parse(g){if(this._getType(g)!==ZodParsedType.nan){const O=this._getOrReturnCtx(g);return addIssueToContext(O,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:O.parsedType}),INVALID}return{status:"valid",value:g.data}}}ZodNaN.create=g=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(g)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(g){const{ctx:O}=this._processInputParams(g),L=O.data;return this._def.type._parse({data:L,path:O.path,parent:O})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(g){const{status:O,ctx:L}=this._processInputParams(g);if(L.common.async){return(async()=>{const g=await this._def.in._parseAsync({data:L.data,path:L.path,parent:L});return"aborted"===g.status?INVALID:"dirty"===g.status?(O.dirty(),DIRTY(g.value)):this._def.out._parseAsync({data:g.value,path:L.path,parent:L})})()}{const g=this._def.in._parseSync({data:L.data,path:L.path,parent:L});return"aborted"===g.status?INVALID:"dirty"===g.status?(O.dirty(),{status:"dirty",value:g.value}):this._def.out._parseSync({data:g.value,path:L.path,parent:L})}}static create(g,O){return new ZodPipeline({in:g,out:O,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(g){const O=this._def.innerType._parse(g),freeze=g=>(isValid(g)&&(g.value=Object.freeze(g.value)),g);return isAsync(O)?O.then((g=>freeze(g))):freeze(O)}unwrap(){return this._def.innerType}}function custom(g,O={},L){return g?ZodAny.create().superRefine(((M,J)=>{var ae,ie;if(!g(M)){const g="function"==typeof O?O(M):"string"==typeof O?{message:O}:O,ne=null===(ie=null!==(ae=g.fatal)&&void 0!==ae?ae:L)||void 0===ie||ie,oe="string"==typeof g?{message:g}:g;J.addIssue({code:"custom",...oe,fatal:ne})}})):ZodAny.create()}ZodReadonly.create=(g,O)=>new ZodReadonly({innerType:g,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(O)});const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;!function(g){g.ZodString="ZodString",g.ZodNumber="ZodNumber",g.ZodNaN="ZodNaN",g.ZodBigInt="ZodBigInt",g.ZodBoolean="ZodBoolean",g.ZodDate="ZodDate",g.ZodSymbol="ZodSymbol",g.ZodUndefined="ZodUndefined",g.ZodNull="ZodNull",g.ZodAny="ZodAny",g.ZodUnknown="ZodUnknown",g.ZodNever="ZodNever",g.ZodVoid="ZodVoid",g.ZodArray="ZodArray",g.ZodObject="ZodObject",g.ZodUnion="ZodUnion",g.ZodDiscriminatedUnion="ZodDiscriminatedUnion",g.ZodIntersection="ZodIntersection",g.ZodTuple="ZodTuple",g.ZodRecord="ZodRecord",g.ZodMap="ZodMap",g.ZodSet="ZodSet",g.ZodFunction="ZodFunction",g.ZodLazy="ZodLazy",g.ZodLiteral="ZodLiteral",g.ZodEnum="ZodEnum",g.ZodEffects="ZodEffects",g.ZodNativeEnum="ZodNativeEnum",g.ZodOptional="ZodOptional",g.ZodNullable="ZodNullable",g.ZodDefault="ZodDefault",g.ZodCatch="ZodCatch",g.ZodPromise="ZodPromise",g.ZodBranded="ZodBranded",g.ZodPipeline="ZodPipeline",g.ZodReadonly="ZodReadonly"}(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(g,O={message:`Input not instance of ${g.name}`})=>custom((O=>O instanceof g),O),stringType$1=ZodString.create,numberType$1=ZodNumber.create,nanType$1=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType$1=ZodBoolean.create,dateType$1=ZodDate.create,symbolType$1=ZodSymbol.create,undefinedType$1=ZodUndefined.create,nullType$1=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType$1=ZodNever.create,voidType$1=ZodVoid.create,arrayType$1=ZodArray.create,objectType$1=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType$1=ZodTuple.create,recordType$1=ZodRecord.create,mapType$1=ZodMap.create,setType$1=ZodSet.create,functionType$1=ZodFunction.create,lazyType=ZodLazy.create,literalType$1=ZodLiteral.create,enumType$1=ZodEnum.create,nativeEnumType$1=ZodNativeEnum.create,promiseType$1=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType$1().optional(),onumber=()=>numberType$1().optional(),oboolean=()=>booleanType$1().optional(),coerce={string:g=>ZodString.create({...g,coerce:!0}),number:g=>ZodNumber.create({...g,coerce:!0}),boolean:g=>ZodBoolean.create({...g,coerce:!0}),bigint:g=>ZodBigInt.create({...g,coerce:!0}),date:g=>ZodDate.create({...g,coerce:!0})},NEVER=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:setErrorMap,getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:EMPTY_PATH,addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:INVALID,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType:ZodParsedType,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:BRAND,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce,any:anyType,array:arrayType$1,bigint:bigIntType,boolean:booleanType$1,date:dateType$1,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType$1,function:functionType$1,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType$1,map:mapType$1,nan:nanType$1,nativeEnum:nativeEnumType$1,never:neverType$1,null:nullType$1,nullable:nullableType,number:numberType$1,object:objectType$1,oboolean:oboolean,onumber:onumber,optional:optionalType,ostring:ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType$1,record:recordType$1,set:setType$1,strictObject:strictObjectType,string:stringType$1,symbol:symbolType$1,transformer:effectsType,tuple:tupleType$1,undefined:undefinedType$1,union:unionType,unknown:unknownType,void:voidType$1,NEVER:NEVER,ZodIssueCode:ZodIssueCode,quotelessJson:quotelessJson,ZodError:ZodError});function checkRef(g,O){if("$ref"in g){const L=z.lazy((()=>z.null()));return O.$refs.push([L,g.$ref]),L}return!1}const d=dezerializeRefs,dezerializers={number:g=>{let O=g.coerce?z.coerce.number():z.number();return void 0!==g.min&&(O=g.minInclusive?O.min(g.min):O.gt(g.min)),void 0!==g.max&&(O=g.maxInclusive?O.max(g.max):O.lt(g.max)),void 0!==g.multipleOf&&(O=O.multipleOf(g.multipleOf)),g.int&&(O=O.int()),g.finite&&(O=O.finite()),O},string:g=>{let O=g.coerce?z.coerce.string():z.string();return void 0!==g.min&&(O=O.min(g.min)),void 0!==g.max&&(O=O.max(g.max)),void 0!==g.length&&(O=O.length(g.length)),void 0!==g.startsWith&&(O=O.startsWith(g.startsWith)),void 0!==g.endsWith&&(O=O.endsWith(g.endsWith)),void 0!==g.toLowerCase&&(O=O.toLowerCase()),void 0!==g.toUpperCase&&(O=O.toUpperCase()),void 0!==g.trim&&(O=O.trim()),"includes"in g&&(O=O.includes(g.includes,{position:g.position})),"regex"in g&&(O=O.regex(new RegExp(g.regex,g.flags))),"kind"in g&&(O="ip"==g.kind?O.ip({version:g.version}):"datetime"==g.kind?O.datetime({offset:g.offset,precision:g.precision,local:g.local}):"time"==g.kind?O.time({precision:g.precision}):O[g.kind]()),O},boolean:g=>g.coerce?z.coerce.boolean():z.boolean(),nan:()=>z.nan(),bigInt:g=>{let O=g.coerce?z.coerce.bigint():z.bigint();if(void 0!==g.min){const L=BigInt(g.min);O=g.minInclusive?O.min(L):O.gt(L)}if(void 0!==g.max){const L=BigInt(g.max);O=g.maxInclusive?O.max(L):O.lt(L)}if(void 0!==g.multipleOf){const L=BigInt(g.multipleOf);O=O.multipleOf(L)}return O},date:g=>{let O=g.coerce?z.coerce.date():z.date();return void 0!==g.min&&(O=O.min(new Date(g.min))),void 0!==g.max&&(O=O.max(new Date(g.max))),O},undefined:()=>z.undefined(),null:()=>z.null(),any:()=>z.any(),unknown:()=>z.unknown(),never:()=>z.never(),void:()=>z.void(),literal:g=>z.literal(g.value),symbol:()=>z.symbol(),tuple:(g,O)=>{let L=z.tuple(g.items.map(((g,L)=>checkRef(g,O)||d(g,{...O,path:O.path+"/items/"+L}))));if(g.rest){const M=checkRef(g.rest,O)||d(g.rest,{...O,path:O.path+"/rest"});L=L.rest(M)}return O.pathToSchema.set(O.path,L),L},set:(g,O)=>{let L=z.set(checkRef(g.value,O)||d(g.value,{...O,path:O.path+"/value"}));return void 0!==g.minSize&&(L=L.min(g.minSize)),void 0!==g.maxSize&&(L=L.max(g.maxSize)),O.pathToSchema.set(O.path,L),L},array:(g,O)=>{let L=z.array(checkRef(g.element,O)||d(g.element,{...O,path:O.path+"/element"}));return void 0!==g.minLength&&(L=L.min(g.minLength)),void 0!==g.maxLength&&(L=L.max(g.maxLength)),O.pathToSchema.set(O.path,L),L},object:(g,O)=>{let L=z.object(Object.fromEntries(Object.entries(g.properties).map((([g,L])=>[g,checkRef(L,O)||d(L,{...O,path:O.path+"/properties/"+g})]))));return g.catchall?L=L.catchall(d(g.catchall,O)):"strict"===g.unknownKeys?L=L.strict():"passthrough"===g.unknownKeys&&(L=L.passthrough()),O.pathToSchema.set(O.path,L),L},record:(g,O)=>{const L=z.record(checkRef(g.key,O)||d(g.key,{...O,path:O.path+"/key"}),checkRef(g.value,O)||d(g.value,{...O,path:O.path+"/value"}));return O.pathToSchema.set(O.path,L),L},map:(g,O)=>{const L=z.map(checkRef(g.key,O)||d(g.key,{...O,path:O.path+"/key"}),checkRef(g.value,O)||d(g.value,{...O,path:O.path+"/value"}));return O.pathToSchema.set(O.path,L),L},nativeEnum:g=>z.nativeEnum(g.values),enum:g=>z.enum(g.values),union:(g,O)=>{const L=z.union(g.options.map(((g,L)=>checkRef(g,O)||d(g,{...O,path:O.path+"/options/"+L}))));return O.pathToSchema.set(O.path,L),L},discriminatedUnion:(g,O)=>{const L=z.discriminatedUnion(g.discriminator,g.options.map(((g,L)=>checkRef(g,O)||d(g,{...O,path:O.path+"/options/"+L}))));return O.pathToSchema.set(O.path,L),L},intersection:(g,O)=>{const L=z.intersection(checkRef(g.left,O)||d(g.left,{...O,path:O.path+"/left"}),checkRef(g.right,O)||d(g.right,{...O,path:O.path+"/right"}));return O.pathToSchema.set(O.path,L),L},function:(g,O)=>{const L=z.function(checkRef(g.args,O)||d(g.args,{...O,path:O.path+"/args"}),checkRef(g.returns,O)||d(g.returns,{...O,path:O.path+"/returns"}));return O.pathToSchema.set(O.path,L),L},promise:(g,O)=>{const L=z.promise(checkRef(g.value,O)||d(g.value,{...O,path:O.path+"/value"}));return O.pathToSchema.set(O.path,L),L},catch:(g,O)=>{let L=checkRef(g.innerType,O)||d(g.innerType,{...O,path:O.path+"/innerType"});return L=L.catch(g.value),O.pathToSchema.set(O.path,L),L},effect:(g,O)=>{let L=checkRef(g.inner,O)||d(g.inner,{...O,path:O.path+"/inner"});if(!("superRefinements"in O||"transforms"in O||"preprocesses"in O))return O.pathToSchema.set(O.path,L),L;for(const{name:M,type:J}of g.effects)"refinement"===J&&O.superRefinements?.[M]?L=L.superRefine(O.superRefinements[M]):"transform"===J&&O.transforms?.[M]?L=L.transform(O.transforms[M]):"preprocess"===J&&O.preprocesses?.[M]&&(L=z.preprocess(O.preprocesses[M],L));return O.pathToSchema.set(O.path,L),L}};function dezerializeRefs(g,O){if("isOptional"in g){const{isOptional:L,...M}=g,J=d(M,O),ae=L?J.optional():J;return O.pathToSchema.set(O.path,ae),ae}if("isNullable"in g){const{isNullable:L,...M}=g,J=d(M,O),ae=L?J.nullable():J;return O.pathToSchema.set(O.path,ae),ae}if("defaultValue"in g){const{defaultValue:L,...M}=g,J=d(M,O).default("bigInt"===g.type?BigInt(L):"date"===g.type?new Date(L):L);return O.pathToSchema.set(O.path,J),J}if("readonly"in g){const{readonly:L,...M}=g,J=d(M,O),ae=L?J.readonly():J;return O.pathToSchema.set(O.path,ae),ae}if("description"in g&&"string"==typeof g.description){const{description:L,...M}=g,J=d(M,O).describe(L);return O.pathToSchema.set(O.path,J),J}return dezerializers[g.type](g,O)}function resolvePointer(g,O){return O.split("/").slice(1).reduce(((g,O)=>void 0===g?g:g[O.replace(/~1/g,"/").replace(/~0/g,"~")]),g)}function dezerialize(g,O={}){"path"in O||(O.path="#"),"pathToSchema"in O||(O.pathToSchema=new Map),"$refs"in O||(O.$refs=[]),"originalShape"in O||(O.originalShape=g);const L=O,M=dezerializeRefs(g,L);for(const[g,O]of L.$refs)g._def.getter=()=>{const g=L.pathToSchema.get(O);if(g)return g;const M=dezerialize(resolvePointer(L.originalShape,O),L);return L.pathToSchema.set(O,M),M};return M}function copyObject(g){const O=Array.isArray(g)?[]:{};for(const[L,M]of Object.entries(g))O[L]=M&&"object"==typeof M?copyObject(M):M;return O}const zodexToStructuredCloningTypeMap=new Map([["boolean","boolean"],["number","number"],["nan","nan"],["bigInt","bigint"],["string","string"],["date","date"],["undefined","undef"],["void","void"],["null","null"],["array","arrayNonindexKeys"],["object","object"],["enum","enum"],["literal","literal"],["tuple","tuple"],["record","record"],["map","map"],["set","set"],["never","never"],["symbol","symbol"],["promise","promise"],["function","function"],["catch","catch"],["nativeEnum","nativeEnum"]]);function mergeSchema(g,O){if("object"!==g.type)throw console.log("leftItem",g),new Error("Unexpected leftItem of type "+g.type);if("object"!==O.type)throw console.log("rightItem",O),new Error("Unexpected rightItem of type "+O.type);const L=copyObject(g);for(const[g,M]of Object.entries(O))if("type"!==g&&"properties"!==g)if("description"===g)"Modifiers"!==M&&(L[g]=L[g]?L[g]+" and "+M:M);else{if(g in L)throw new Error("Duplicate property "+g+" of value "+JSON.stringify(M)+" and "+JSON.stringify(L[g]));L[g]=M&&"object"==typeof M?copyObject(M):M}for(const[g,M]of Object.entries(O.properties)){if("string"!=typeof L.properties&&g in L.properties)throw new Error("Duplicate property "+g+" of value "+JSON.stringify(M)+" and "+JSON.stringify(L.properties[g]));L.properties[g]=M&&"object"==typeof M?copyObject(M):M}return L}function flattenIntersection(g,O){const L=[...g],M=[...O],J=[];for(const g of L)for(const O of M)J.push(mergeSchema(g,O));return J}let unionGroupID=0;function addModifiers(g,O){if("defaultValue"in g){unionGroupID++;for(const L of O)L.$unionGroupID=unionGroupID,L.$defaultValue=g.defaultValue}if(g.isNullable&&O.push({type:"null"}),g.isOptional)for(const L of O)"isOptional"in L||(L.isOptional=g.isOptional);if(g.readonly)for(const L of O)"readonly"in L||(L.$readonlyParent=g.readonly);if(g.description)for(const L of O)L.description=L.description?L.description+" and "+g.description:g.description}function getTypesForSchema(g,O){switch(g.type){case"never":return new Set;case"object":{const O=new Set;return O.add(g),O}case"discriminatedUnion":case"union":{let L=[];for(const M of g.options)L=[...L,...getTypesForSchema(M,O)];if("discriminatedUnion"===g.type)for(const O of L)O.$discriminator=g.discriminator;return addModifiers(g,L),new Set(L)}case"intersection":{const L=flattenIntersection(getTypesForSchema(g.left,O),getTypesForSchema(g.right,O));return addModifiers(g,L),new Set(L)}case"any":case"unknown":return new Set([{type:"boolean"},{type:"number"},{type:"nan"},{type:"bigInt"},{type:"string"},{description:"Email",type:"string",kind:"email"},{description:"URL",type:"string",kind:"url"},{description:"Date",type:"string",kind:"date"},{type:"date"},{type:"undefined"},{type:"null"},{type:"object",properties:{},unknownKeys:"passthrough"},{type:"nativeEnum",values:{type:"union",options:[{description:"Numeric",type:"record",key:{type:"number"},value:{type:"string"}},{description:"String",type:"record",key:{type:"string"},value:{type:"union",options:[{type:"string"},{type:"number"}]}}]}},{type:"array",element:{type:"any"}},{type:"set",value:{type:"any"}},{type:"map",key:{type:"any"},value:{type:"any"}},{type:"never"},{type:"effect",effects:[{name:"regexp",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"blob",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"BooleanObject",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"NumberObject",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"StringObject",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"SpecialRealNumber",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"domexception",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"error",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"filelist",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"file",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"resurrectable",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"blobHTML",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"buffersource",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"dommatrix",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"dompoint",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"domrect",type:"refinement"}],inner:{type:"any"}},{type:"effect",effects:[{name:"errors",type:"refinement"}],inner:{type:"any"}},{description:"JSON Reference",type:"object",properties:{$ref:{type:"string"}}}]);default:if("$ref"in g){return getTypesForSchema(resolveJSONPointer({obj:O,path:g.$ref}),O)}return new Set([g])}}const schema={iterate:(g,O)=>(O.format="schema",structuredCloning.iterate(g,O)),convertFromTypeson(g,O,L,M,J,ae){let[ie,ne]=J??[];if(!ae)throw new Error("State object expected for schema");let oe=ae.schemaContent,pe=!1;switch("number"==typeof ne&&"union"===ie?.type&&(ie=ie.options[ne]),ie?.type){case"object":oe=ie.properties[M],oe||(oe=ie.catchall,pe=!0);break;case"array":oe=ie.element;break;case"set":case"promise":oe=ie.value;break;case"effect":oe=ie.inner;break;case"tuple":oe=ie.items[Number(M)]??ie.rest}if(!oe)return{type:g};const le=[...getTypesForSchema(oe,ae.schemaContent)];for(const[g,M]of le.entries()){let J;"object"===M.type&&(({unknownKeys:J}=M),M.unknownKeys="strict");const ie=dezerialize(M,{originalShape:ae.schemaContent}).safeParse(L);if("object"===M.type&&(M.unknownKeys=J),ie.success){let J=zodexToStructuredCloningTypeMap.get(M.type);J||"effect"!==M.type||(J=M.effects[0].name);const ie=O.getTypeObject(J);if(ie.valueMatch&&ie.valueMatch(L))return{type:J,schemaIdx:g,schema:!ae.rootUI||ae.readonly||1===le.length?M:{type:"union",options:le},mustBeOptional:pe}}}return{type:g}},types:()=>structuredCloning.types(),getTypesAndSchemasForState(g,O,L,M){if(!L)throw new Error("Missing schema object");if("array"===O)return structuredCloning.getTypesAndSchemasForState(g,O,L,M);const J=[...getTypesForSchema(L,M??L)],ae=J.map((({type:g})=>g));return{schemaObjects:J,types:ae.map(((g,O)=>"effect"===g?J[O].effects[0].name:zodexToStructuredCloningTypeMap.get(g)))}}};class Formats{constructor(){this.availableFormats={indexedDBKey:indexedDBKey,json:json,structuredCloning:structuredCloning,arbitraryJS:arbitraryJS,schema:schema}}async getControlsForFormatAndValue(g,O,L,M){return await this.availableFormats[O].iterate(L,{...M,types:g,formats:this,format:O})}getTypesAndSchemasForFormatAndState(g,O,L,M,J){return this.availableFormats[O].getTypesAndSchemasForState(g,L,M,J)}getAvailableFormat(g){return this.availableFormats[g]}}const nullType={option:["Null"],stringRegex:/^null$/u,valueMatch:g=>null===g,toValue:()=>({value:null}),getValue:()=>null,getInput:({root:g})=>$e(g,"input"),viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"null"},title:g?.description??"(a `null`)"},["null"]],editUI:({typeNamespace:g,specificSchemaObject:O})=>["div",{dataset:{type:"null"},title:O?.description??"Null"},[["label",["Null",["input",{type:"checkbox",name:`${g}-null`,checked:!0,disabled:!0}]]]]]},trueType={option:["Boolean (true)",{value:"true"}],stringRegex:/^true$/u,toValue:()=>({value:!0}),valueMatch:g=>!0===g,superType:"boolean",getValue:()=>!0,viewUI:()=>["i",{dataset:{type:"true"}},["true"]],ct:0,getInput:({root:g})=>$e(g,"input"),editUI({typeNamespace:g}){return this.ct++,["div",{dataset:{type:"true"}},[["label",["True",["input",{type:"radio",name:`${g}-true${this.ct}`,value:"true",checked:!0}]]],["label",["False",["input",{type:"radio",name:`${g}-true${this.ct}`,value:"false",disabled:!0}]]]]]}},falseType={option:["Boolean (false)",{value:"false"}],stringRegex:/^false$/u,toValue:()=>({value:!1}),valueMatch:g=>!1===g,superType:"boolean",getValue:()=>!1,viewUI:()=>["i",{dataset:{type:"false"}},["false"]],ct:0,getInput:({root:g})=>$e(g,"input[value=false]"),editUI({typeNamespace:g}){return this.ct++,["div",{dataset:{type:"false"}},[["label",["True",["input",{type:"radio",name:`${g}-false${this.ct}`,value:"true",disabled:!0}]]],["label",["False",["input",{type:"radio",name:`${g}-false${this.ct}`,value:"false",checked:!0}]]]]]}},nanType={option:["NaN"],stringRegex:/^NaN$/u,valueMatch:g=>Number.isNaN(g),toValue:()=>({value:Number.NaN}),getValue:()=>Number.NaN,getInput:({root:g})=>$e(g,"input"),viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"nan"},title:g?.description??"(a `NaN`)"},["NaN"]],editUI:({typeNamespace:g,specificSchemaObject:O})=>["div",{dataset:{type:"nan"},title:O?.description??"NaN"},[["label",["NaN",["input",{type:"checkbox",name:`${g}-nan`,checked:!0}]]]]]},isNullish=g=>null==g,blobHTMLType={option:["Blob (text/html)"],stringRegex:/^data:text\/html(?:;base64)?,.*$/u,valueMatch:g=>g&&"text/html"===g.type,superType:"blob",toValue:g=>({value:function dataURIToBlob(g){const O=g.indexOf(","),L=g.slice(0,O),M=g.slice(O+1),[J,ae]=L.split(":")[1].split(";");let ie;if("base64"===ae){const g=atob(M);ie=new ArrayBuffer(g.length);const O=new Uint8Array(ie);for(let L=0;L<g.length;L++)O[L]=g.charCodeAt(L)}else ie=M;return new Blob([ie],{type:J})}(g)}),getInput:({root:g})=>$e(g,"textarea[name$=-blobHTML]"),getValue({root:g}){return this.toValue("data:text/html,"+this.getInput({root:g}).sceditorInstance.val()).value},loadBlob:async g=>await g.text(),async setValue({root:g,value:O}){const L=await this.loadBlob(O);this.getInput({root:g}).sceditorInstance.val(L)},viewUI({value:g,specificSchemaObject:O}){let L;const M=jml("div",{dataset:{type:"blobHTML"},title:O?.description?"HTML":void 0},[O?.description??"HTML",": ",["button",{$on:{click(){dialogs.alert({message:["div",["Source: ",["textarea",{class:"view-source"},[L]]]]})}}},["View source"]]]);return this.loadBlob(g).then((g=>{L=g,jml("iframe",{sandbox:"",srcdoc:L},M)})).catch((g=>{console.error("Err",g)})),[M]},editUI({typeNamespace:g,specificSchemaObject:O,value:L}){const M=jml("textarea",{name:`${g}-blobHTML`});M.sceditorInstance={val(){throw new Error("Not yet instantiated")}};const J=jml("div",{dataset:{type:"blobHTML"},title:O?.description??"Blob (HTML)"},[M]);return setTimeout((()=>{sceditor.create(M,{width:"1000px",height:"225px",autoUpdate:!0,resizeMaxHeight:-1,resizeMaxWidth:-1,plugins:"xhtml,plaintext,undo",emoticonsRoot:"node_modules/sceditor/",style:"/node_modules/sceditor/minified/themes/content/default.min.css"}),M.sceditorInstance=sceditor.instance(M),isNullish(L)||this.setValue({root:J,value:L})})),[J]}},booleanType={option:["Boolean",{value:"boolean"}],stringRegex:/^(?:true|false)$/u,valueMatch:g=>"boolean"==typeof g,toValue:g=>({value:"true"===g}),getValue({root:g}){return this.getInput({root:g}).checked},getInput:({root:g})=>$e(g,"input[value=true]"),setValue({root:g,value:O}){$e(g,O?"input[value=true]":"input[value=false]").checked=!0},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"boolean"},title:O?.description??"(a boolean)"},[g?"true":"false"]],ct:0,editUI({typeNamespace:g,specificSchemaObject:O,value:L}){this.ct++;const M="literal"===O?.type,J=M?O?.value:L??O?.defaultValue;return["div",{dataset:{type:"boolean"},title:O?.description??"Boolean"},[["label",["True",["input",{disabled:M,type:"radio",name:`${g}-boolean${this.ct}`,value:"true",checked:"boolean"!=typeof J||J}]]],["label",["False",["input",{disabled:M,type:"radio",name:`${g}-boolean${this.ct}`,value:"false",checked:"boolean"==typeof J&&!J}]]]]]}},numberType={option:["Number"],stringRegex:new RegExp("^[-+]?"+String.raw`(?:\d{0,30}\.)?`+String.raw`\d{1,30}`+String.raw`(?:[Ee][-+]?[1-2]?\d)?`+"$","u"),valueMatch:g=>"number"==typeof g&&!Number.isNaN(g)&&g!==Number.POSITIVE_INFINITY&&g!==Number.NEGATIVE_INFINITY&&!Object.is(g,-0),toValue:g=>({value:Number(g)}),getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=String(O)},validate({root:g}){const O=this.getInput({root:g}).value;return{message:"Not a valid (finite) number",valid:Boolean(O&&/^-?(\d+|\d*\.\d+)$/u.test(O))}},getValue({root:g}){return Number.parseFloat(this.getInput({root:g}).value)},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"number"},title:O?.description??"(a number)"},[String(g)]],editUI({typeNamespace:g,specificSchemaObject:O,value:L}){const M="literal"===O?.type,J=O,ae=150*Number.EPSILON,ie=300*Number.EPSILON;return["div",{dataset:{type:"number"},title:O?.description??"Number"},[["input",{disabled:M,name:`${g}-number`,type:"number",min:J?.min?J?.minInclusive?J?.min:J?.min+(J?.int?1:ae):void 0,max:J?.max?J?.maxInclusive?J?.max:J?.max-(J?.int?1:ie):void 0,step:J?.multipleOf??(J?.int?"1":"any"),value:M?O?.value:L??O?.defaultValue??""}]]]}},bigintType={option:["BigInt"],stringRegex:new RegExp("^-?"+String.raw`\d+`+"n$","u"),valueMatch:g=>"bigint"==typeof g,toValue:g=>({value:BigInt(g.slice(0,-1))}),getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=String(O)},validate({root:g}){const O=this.getInput({root:g}).value;return{message:"Not a valid BigInt",valid:Boolean(O&&/^-?(\d+)$/u.test(O))}},getValue({root:g}){return BigInt(this.getInput({root:g}).value)},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"bigint"},title:O?.description??"(a BigInt)"},[`${String(g)}n`]],editUI({typeNamespace:g,specificSchemaObject:O,value:L}){const M=O;return["div",{dataset:{type:"bigint"},title:O?.description??"BigInt"},[["input",{name:`${g}-bigint`,type:"number",value:L??O?.defaultValue??"",min:M?.min?M?.minInclusive?M?.min:String(BigInt(M?.min)+1n):void 0,max:M?.max?M?.maxInclusive?M?.max:String(BigInt(M?.max)-1n):void 0,step:M?.multipleOf??"1"}]]]}},bigintObjectType={option:["BigInt Object"],stringRegex:new RegExp("^BigIntObject-?"+String.raw`\d+`+"n$","u"),valueMatch:g=>"object"==typeof g&&hasConstructorOf(g,BigInt),toValue:g=>({value:new Object(BigInt(g.slice(12,-1)))}),getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=String(O)},validate({root:g}){const O=this.getInput({root:g}).value;return{message:"Not a valid BigInt",valid:Boolean(O&&/^-?(\d+)$/u.test(O))}},getValue({root:g}){return new Object(BigInt(this.getInput({root:g}).value))},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"bigintObject"},title:O?.description??"(a BigInt Object)"},[`${String(g)}n`]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L=""})=>["div",{dataset:{type:"bigintObject"},title:O?.description??"BigInt object"},[["input",{name:`${g}-bigintObject`,type:"number",step:"1",value:L}]]]},ipv4Regex=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)$/u,ipv6Regex=/^(([a-f\d]{1,4}:){7}|::([a-f\d]{1,4}:){0,6}|([a-f\d]{1,4}:):([a-f\d]{1,4}:){0,5}|([a-f\d]{1,4}:){2}:([a-f\d]{1,4}:){0,4}|([a-f\d]{1,4}:){3}:([a-f\d]{1,4}:){0,3}|([a-f\d]{1,4}:){4}:([a-f\d]{1,4}:){0,2}|([a-f\d]{1,4}:){5}:([a-f\d]{1,4}:)?)([a-f\d]{1,4}|(((25[0-5])|(2[0-4]\d)|(1\d{2})|(\d{1,2}))\.){3}((25[0-5])|(2[0-4]\d)|(1\d{2})|(\d{1,2})))$/u,base64Regex=/^([\da-zA-Z+/]{4})*(([\da-zA-Z+/]{2}==)|([\da-zA-Z+/]{3}=))?$/u,emojiRegexStr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",emojiRegex=new RegExp(emojiRegexStr,"u"),cuidRegex=/^c[^\s-]{8,}$/iu,cuid2Regex=/^[\da-z]+$/u,ulidRegex=/^[\dA-HJKMNP-TV-Z]{26}$/iu,uuidRegex=/^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu,nanoidRegex=/^[a-z\d_-]{21}$/iu,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/u;function timeRegexSource(g){let O="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return g.precision?O=`${O}\\.\\d{${g.precision}}`:null!==g.precision&&void 0!==g.precision||(O=`${O}(\\.\\d+)?`),O}function timeRegex(g){return new RegExp(`^${timeRegexSource(g)}$`,"u")}const stringType={option:["String"],stringRegex:/^"(?:[^\\"]|\\\\|\\")*"$/u,valueMatch:g=>"string"==typeof g,toValue:g=>({value:g.slice(1,-1)}),getInput:({root:g})=>$e(g,'[data-type="string"] > textarea,input'),setValue({root:g,value:O}){this.getInput({root:g}).value=O},getValue({root:g}){return this.getInput({root:g}).value},viewUI({value:g,specificSchemaObject:O}){const L=O?.kind;return["span",{dataset:{type:"string"},title:O?.description??("email"===L?`(an ${L} string)`:L?`(a ${L} string)`:"(a string)")},[g]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L}){const M=O,J=M?.kind,ae="literal"===O?.type,ie=M?.min??M?.length,ne=M?.max??M?.length,oe=M?.startsWith,pe=M?.endsWith,le=M?.toLowerCase,ue=M?.toUpperCase,de=M?.trim,he=M?.includes,ye=M?.position,me=M?.regex,fe=M?.flags,checkValue=g=>{if(oe&&!g.startsWith(oe))return`Value doesn't start with expected: ${oe}`;if(pe&&!g.endsWith(pe))return`Value doesn't end with expected: ${pe}`;if(he&&!g.includes(he,ye??0))return`Value doesn't include the expected: ${he}${ye?` after position: ${ye}`:""}`;if(me&&!new RegExp(me,fe??"").test(g))return`Value doesn't match regular expression: ${me}${fe?` with flags: ${fe}`:""}`;if(J)switch(J){case"ip":if("v4"===M?.version){if(!ipv4Regex.test(g))return"Value doesn't match IP v4 pattern."}else if(!ipv6Regex.test(g))return"Value doesn't match IP v6 pattern.";break;case"time":if(!timeRegex(M).test(g))return"Value does not match time/precision.";break;case"datetime":if(!datetimeRegex(M).test(g))return"Value does not match datetime/precision/offset/local";break;case"emoji":if(!emojiRegex.test(g))return"Value does not match emoji pattern";break;case"uuid":if(!uuidRegex.test(g))return"Value does not match uuid pattern";break;case"nanoid":if(!nanoidRegex.test(g))return"Value does not match nanoid pattern";break;case"cuid":if(!cuidRegex.test(g))return"Value does not match cuid pattern";break;case"cuid2":if(!cuid2Regex.test(g))return"Value does not match cuid2 pattern";break;case"ulid":if(!ulidRegex.test(g))return"Value does not match ulid pattern";break;case"duration":if(!durationRegex.test(g))return"Value does not match duration pattern";break;case"base64":if(!base64Regex.test(g))return"Value does not match base64 pattern"}return null},transform=g=>(le&&(g=g.toLowerCase()),ue&&(g=g.toUpperCase()),de&&(g=g.trim()),g);return["div",{dataset:{type:"string"},title:O?.description??"String"},[["email","url","date"].includes(J)?["input",{$on:{change(){const g=this;g.value=transform(g.value);const O=checkValue(g.value);g.setCustomValidity(O??""),g.reportValidity()}},name:`${g}-string`,type:J,value:L??O?.defaultValue??"",minlength:"date"===J?void 0:ie,maxlength:"date"===J?void 0:ne}]:["textarea",{$on:{change(){const g=this;g.value=transform(g.value);const O=checkValue(g.value);g.setCustomValidity(O??""),g.reportValidity()}},name:`${g}-string`,disabled:ae,minlength:ie,maxlength:ne},[ae?O?.value:L??O?.defaultValue??""]]]]}},arrayReferenceType={option:["Array reference"],type:"array",stringRegex:/^arrayRef\((?:\/[^)]*|)\)$/u,toValue(g,O){const{rootHolder:L,parent:M,parentPath:J}=O,ae=g.slice(`${this.type}Ref(`.length,-1);return L.push([this.type,M,J,ae]),{assign:!1}},resolveReference(g,O){let L=O;return""!==g&&getJSONPointerParts(g).forEach((g=>{if(L=L[g],!L)throw new Error("Bad path")})),L},stateDependent:{structuredCloning:{after:"arrayNonindexKeys",contexts:["arrayNonindexKeys","object","set"]}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=O},getValue({root:g,stateObj:O,currentPath:L}){const M=this.getInput({root:g}).value;O&&(O.paths||(O.paths={}),O.paths[L]={referentPath:M,expectArrayReferent:"array"===this.type},O.handlingReference=!0),console.log(M)},validate({root:g,topRoot:O}){const{type:L}=this,M=this.getInput({root:g}),J=M.value,invalidMessage=g=>({valid:!1,message:g});if(M.validity.patternMismatch)return invalidMessage('You must use a path beginning with "/" (or the empty string)');if(/~([^01]|$)/u.test(J))return invalidMessage("You must use a valid JSON Pointer (with tildes followed by 0 or 1)");let ae=O||g;let ie;if(""!==J&&getJSONPointerParts(J).some(((O,L)=>{const M=DOM.filterChildElements($e(ae,".arrayItems"),["fieldset","legend"]),J=M.map((g=>getPropertyValueFromLegend(g))).indexOf(O);return-1===J?(ie="Specified path doesn't exist",!0):(ae=$e(M[J].parentElement,"div[data-type]"),ae===g?(ie="Can't reference self",!0):!["array","object","arrayNonindexKeys"].includes(Types.getTypeForRoot(ae))&&(ie=`Referent portion (at segment ${L}) is not an object or array`,!0))})))return invalidMessage(ie);const ne=Types.getTypeForRoot(ae);return(["array","arrayNonindexKeys"].includes(ne)?"array":"object"===ne?"object":null)!==L?invalidMessage("Reference must match expected reference type (array or object)"):{valid:!0}},validateAll({types:g,topRoot:O}){const L=`${this.type}Reference`;$$e(O,`div[data-type="${L}"]`).forEach((M=>{g.validate({type:L,root:M,topRoot:O})}))},viewUI({value:g}){return["i",{dataset:{type:`${this.type}Reference`}},[`${this.type}Ref(${g})`]]},editUI({typeNamespace:g,value:O=""}){const{type:L}=this;return["div",{dataset:{type:`${L}Reference`}},[["label",[`JSON Pointer path to ${L} (leave blank for path to root) `,["input",{name:`${g}-${L}Reference`,type:"text",pattern:"^(|/.*)$",value:O}]]]]]}},objectReferenceType={option:["Object reference"],type:"object",stringRegex:/^objectRef\((?:\/[^)]*|)\)$/u,toValue(...g){return arrayReferenceType.toValue.apply(this,g)},resolveReference(...g){return arrayReferenceType.resolveReference?.apply(this,g)},stateDependent:{structuredCloning:{after:"object",contexts:["arrayNonindexKeys","object","set"]}},getInput(...g){return arrayReferenceType.getInput.apply(this,g)},setValue(...g){return arrayReferenceType.setValue?.apply(this,g)},getValue(...g){return arrayReferenceType.getValue.apply(this,g)},validate(...g){return arrayReferenceType.validate?.apply(this,g)},validateAll(...g){return arrayReferenceType.validateAll?.apply(this,g)},viewUI(...g){return arrayReferenceType.viewUI.apply(this,g)},editUI(...g){return arrayReferenceType.editUI.apply(this,g)}};class FileList{constructor(){this._files=arguments[0],this.length=this._files.length}item(g){return this._files[g]}get[Symbol.toStringTag](){return"FileList"}}let optionalPropertyId=0;function sameValueZero(g,O){return"number"==typeof g&&"number"==typeof O?g===O||g!=g&&O!=O:g===O}const arrayType={option:["Array"],array:!0,regexEndings:[",","]"],stringRegexBegin:/^\[/u,stringRegexEnd:/^\]/u,valueMatch:g=>Array.isArray(g),toValue(g,O){const{endMatchTypeObjs:L=[],remnant:M,rootHolder:J,schemaObject:ae}=O,ie=O.format,ne=O.types,{sparse:oe}=this,pe=oe?"arrayNonindexKeys":this.array&&!this.record?"array":"object",le=this.array&&!this.record?[]:{};let ue=void 0!==M?M:g;const checkEnd=g=>{if(g&&L.length){const g=ue.match(L.at(-1).stringRegexEnd);if(g)return L.pop(),ue=ue.slice(g[0].length),!0}return!1};if(this.array&&!this.record){let g=0;const parse=()=>{if(!ue)return;const O=ue.match(oe?/^[,\s]+/u:/^\s*,?\s*/u);if(O){const L=O[0].match(/\s/gu);if(g+=O[0].length-(L?L.length:0),ue=ue.slice(O[0].length),!ue)return}let M,de,he;try{[M,ue,de,he]=ne.getValueForString(ue,{firstRun:!1,format:ie,state:pe,schemaObject:ae,endMatchTypeObjs:L,rootHolder:J,parent:le,parentPath:g})}catch(g){return void console.log("e",g)}he&&(le[g]=M),checkEnd(de)||parse()};return parse(),oe&&g&&g>le.length-1&&(le.length=g+1),{value:this.set&&Array.isArray(le)?new Set(le):this.map?new Map(le):this.filelist?new FileList(le):le,remnant:ue}}const parse=g=>{if(!ue)return;g&&","===ue[0]&&(ue=ue.slice(1));const O=ue.match(/^\s*(?:([^:"}]+)|"((?:[^\\"]|\\\\|\\")*)")(\s*:\s*)/u);if(!O)return;const[,M,oe]=O,de=void 0!==M?M:oe;let he,ye,me;ue=ue.slice(O[0].length);try{[he,ue,ye,me]=ne.getValueForString(ue,{firstRun:!1,format:ie,state:pe,schemaObject:ae,endMatchTypeObjs:L,rootHolder:J,parent:le,parentPath:de})}catch{return}me&&(le[de]=he),checkEnd(ye)||parse(!0)};return parse(),{value:le,remnant:ue}},getValue({root:g,stateObj:O,currentPath:L=""}){if(!O)throw new Error("TS guard");const M=O.types,J=""===L,ae=$e(g,".arrayItems"),ie=[...ae.children],ne="object"===g.dataset.type?{}:this.sparse?Array.from({length:Number.parseInt(DOM.filterChildElements(g,["div","div","label","input"])[0].value)}):[];return ie.forEach((g=>{const J=g.firstElementChild,ae=getPropertyValueFromLegend(J),ie=DOM.filterChildElements(g,[".typeContainer","div[data-type]"])[0]||DOM.filterChildElements(g,["[class^=optionalProperties-placeholder]",".typeContainer","div[data-type]"])[0];if(!ie)return;const oe=DOM.filterChildElements(J,["input"]),[pe,le]=((g,J)=>{const ae=M.getValueForRoot(g,O,L+"/"+J);return"handlingReference"in O&&O.handlingReference?(O.handlingReference=!1,[!1]):[!0,ae]})(ie,ae);pe&&(oe.length?ne[ae]=le:ne.push(le))})),J&&Object.entries(O.paths||[]).forEach((([g,{referentPath:O}])=>{const L=""===O?ne:resolveJSONPointer({path:O,obj:ne}),M=getJSONPointerParts(g),J=M.pop();M.reduce(((g,O)=>reduceJSONPointerParts(g,O)),ne)[J]=L})),this.filelist?new FileList(ne):this.set&&Array.isArray(ne)?new Set(ne):this.map?new Map(ae.$getMapKeySelects().map(((g,O)=>[g.$getValue(),ne[O]]))):this.record?ae.$getMapKeySelects().reduce(((g,O,L)=>{const M=O.$getValue(),J=ne[L];return g[M]=J,g}),{}):ne},viewUI({typeNamespace:g,type:O,types:L,value:M,topRoot:J,resultType:ae,format:ie,specificSchemaObject:ne}){let oe=-1;const pe=O,buildLegend=({itemIndex:g,typeNamespace:L,propName:M})=>{const J=ne?.items?.[g],ae=ne?.rest;return["legend",[this.array&&"record"!==O?ne?.element?.description??("set"===O&&ne?.value?.description?ne?.value?.description:J?.description??ae?.description)??"Item":ne?"":"Property",ne?"":":",nbsp$1.repeat(2),["span",{class:`propertyName-${L}`,title:"record"===O&&ne?.key?.description?ne?.key?.description:ne?M:void 0},[void 0!==M?ne?.properties?.[M]?.description??M:g]]]]},le=jml("div",{class:"arrayHolder",dataset:{type:O},$custom:{$addAndSetArrayElement({propName:O,type:M,value:oe,bringIntoFocus:le,schemaContent:ue}){if("map"===pe){const pe=L.getUIForModeAndType({resultType:ae,readonly:!0,typeNamespace:g,type:M,topRoot:J,bringIntoFocus:le,format:ie,schemaContent:ue,value:oe,hasValue:!0});if("0"===O){const g=this.$addMapElement();this._lastFieldset=g;const O=jml("fieldset",[["legend",{title:ne?.key?.description?"(map key)":void 0},[ne?.key?.description??"Key"]]],g);jml(pe,O)}else{const g=jml("fieldset",[["legend",{title:ne?.value?.description?"(map value)":void 0},[ne?.value?.description??"Value"]]],this._lastFieldset);this._lastFieldset=null,jml(pe,g)}return pe}const de=this.$addArrayElement({propName:O}),he=L.getUIForModeAndType({resultType:ae,readonly:!0,typeNamespace:g,type:M,topRoot:J,bringIntoFocus:le,format:ie,schemaContent:ue,specificSchemaObject:ue,value:oe,hasValue:!0});return jml(he,de),he},$addMapElement(){oe++;const O=this.$getArrayItems();return jml("fieldset",[buildLegend({itemIndex:oe,typeNamespace:g,propName:void 0})],O)},$addArrayElement({propName:O}){oe++;const L=this.$getArrayItems();return jml("fieldset",[buildLegend({itemIndex:oe,typeNamespace:g,propName:O})],L)},$getArrayItems(){return this.lastElementChild.lastElementChild}}},[["span",{title:ne?.description},[ne?"—":DOM.initialCaps(O).replace(/s$/u,"")]],nbsp$1.repeat(2),["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(O.closest(".arrayHolder"),".arrayContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"arrayContents"},[this.array&&"record"!==O?["div",{title:ne?"filelist"===O?"(a FileList)":"set"===O?"(a Set)":"map"===O?"(a Map)":"tuple"===O?"(a tuple)":"(an Array)":void 0},["filelist"===O?(ne?.description??"FileList")+" length: ":"set"===O?(ne?.description??"Set")+" size: ":"map"===O?(ne?.description??"Map")+" size: ":(ne?.description??"Array")+" length: ",["span",[(!M||"set"!==O&&"map"!==O?M.length:M.size)||0]]]]:"record"===O?ne?.description??"Record":"",["div",{class:"arrayItems"}]]]]);return[le]},getInput:({root:g})=>$e(g,"button"),editUI({typeNamespace:g,buildTypeChoices:O,format:L,formats:M,types:J,specificSchemaObject:ae,schemaFallingBack:ie,schemaContent:ne,type:oe,forcedState:pe,topRoot:le,value:ue,bringIntoFocus:de=!0}){const{sparse:he}=this,ye=this,me="object"===oe?1:0;let fe=me-1;const ge="array"!==oe&&"set"!==oe&&"map"!==oe&&"filelist"!==oe&&"tuple"!==oe&&"record"!==oe,ve="map"===oe||"record"===oe,be=ae?.element?.description??("set"===oe?ae?.value?.description:void 0),bringFocus=(g,O)=>{(de||O)&&(g.scrollIntoView(),g.focus())},$validateLegend=function(){const g=this.$arrayItems.$getPropertyInputs(),O=g.some((g=>this!==g&&g.value===this.value))?"Duplicate property name":"";O&&(this.setCustomValidity(O),this.reportValidity()),g.some(((g,O,L)=>{const M=L.some((O=>g!==O&&g.value===O.value))?"Duplicate property name":"";return(g.validity.valid||"Invalid length"!==g.validationMessage)&&(g.setCustomValidity(M),M&&g.reportValidity()),M}))},buildLegend=({className:g,splice:M,itemIndex:ie,typeNamespace:pe,arrayItems:ue,propName:de,required:me,schema:fe})=>{const $validateLength=async function(g){if(!he)return;const O=ue.$inputsExceedingLength(),L=O.length;if(g||!L||!/^\d+$/u.test(this.value))return;await dialogs.confirm({message:'You are attempting to add an (integer-based) array item beyond the length. Click "Ok" to allow to permit and extend the array length or "Cancel" otherwise.'});const M=$e(ue.previousElementSibling,"input"),J=O.map((g=>Number.parseInt(g.value))).sort().at(-1);M.value=String(J+1),M.$oldvalue=String(J+1),this.$validateLength(!0)};if(ve){const M=O({value:void 0!==de&&"record"===oe?de:void 0,setValue:void 0!==de&&"record"===oe,autoTrigger:void 0===de||"record"===oe,format:L,schemaOriginal:ne,schemaContent:ae?.key,typeNamespace:"key-type-choices-only"});return["legend",[["span",{class:"mapKey",title:"map"===oe&&ae?.key?.description?"(map key)":"record"===oe&&ae?.key?.description?"(record key)":void 0},["map"===oe?ae?.key?.description??"Map key":ae?.key?.description??"Record key"," "]],["span",{dataset:{prop:"true"},className:g},[String(ie)]],":",nbsp$1.repeat(2),["span",{class:"mapKeyHolder",$on:{change:[function(){this.$validateMapKey(),J.validateAllReferences({topRoot:le})},!0]},$custom:{$validateMapKey(){const g=ue.$getMapKeySelects();setTimeout((()=>{const O=g.map((g=>g.$getValue())),L=O.findLastIndex(((g,L)=>O.some(((O,M)=>L!==M&&sameValueZero(g,O)))));if(-1===L)return;const M=g[L];if(!M)return;const J=M.hidden?$e(M.nextElementSibling,"input,textarea"):M;J.setCustomValidity(`Duplicate ${"map"===oe?"Map":"Record"} key value`),J.reportValidity()}))}}},M.domArray]]]}if(ge){const O=ae?.properties?.[de]?.description,L=Object.entries(ae?.properties??{}).map((([g,O])=>O.isOptional?g:null)).filter(Boolean);optionalPropertyId++;const ne=he?"append"===M?"":void 0!==de?de:ie:de||"";return["legend",[he?be??"Item":{"#":me?[["b",{className:g,title:be??O?de:void 0},[be??O??de]]]:[["span",{className:`${g}_propertyHolder${optionalPropertyId}`},[...ae&&de?[["b",[ae?.properties?.[de]?ae?.properties?.[de]?.description??de:ae?.catchall?.description??de]]]:["Property ",["span",{className:g},[String(ie)]],":"]]]]},nbsp$1.repeat(2),ae&&!me?["datalist",{id:`optionalProperties_${optionalPropertyId}`},L.map((g=>["option",{value:g}]))]:"",["input",{list:ae&&!me?`optionalProperties_${optionalPropertyId}`:void 0,style:{display:me&&"arrayNonindexKeys"!==oe?"none":"block"},disabled:me&&"arrayNonindexKeys"===oe,value:ne,dataset:{prop:!0,object:!0,optionalPropertyId:optionalPropertyId},$custom:{async $validate(){try{try{await this.$validateLength()}catch{}this.$validateLegend(),J.validateAllReferences({topRoot:le})}catch{}},$parseInt(){return!!/^\d+$/u.test(this.value)&&Number.parseInt(this.value)},$validateLegend:$validateLegend,$arrayItems:ue,$validateLength:$validateLength,$resort({alwaysFocus:g}){const O=this.$arrayItems.$getPropertyInputs();if(1===O.length)return;const getFieldset=g=>g.closest("fieldset"),L=getFieldset(this),M=this.$parseInt();if(!1===M)return void O.reverse().some((O=>{if(O===this)return!0;return"number"==typeof O.$parseInt()&&(getFieldset(O).after(L),bringFocus(this,g),ue.$redrawMoveArrows(),!0)}));const getNearest=J=>{let ae;if(O.some((g=>{if(g===this)return!1;const O=g.$parseInt();if("number"!=typeof O)return ae||(ae=g),!1;const cmp=(g,O)=>J?g>O:g<O;return!(!cmp(M,O)||ae&&!cmp(O,Number.parseInt(ae.value)))&&(ae=g,M+(J?-1:1)===O)})),!ae)return!1;const ie=J?"after":"before";return setTimeout((()=>{ae&&(getFieldset(ae)[ie](L),bringFocus(this,g),ue.$redrawMoveArrows())})),!0};getNearest()||getNearest(!0)}},$on:{input(){if(!ae&&!fe)return;const O=$e(ue,`.${g}_propertyHolder${this.dataset.optionalPropertyId}`);DOM.removeChildren(O),jml("b",[ae?.properties?.[this.value]?ae?.properties?.[this.value]?.description??this.value:ae?.catchall?.description??this.value],O)},change(g){let O=!1;if("never"===ae?.properties?.[this.value]?.type)this.setCustomValidity("Never value"),this.reportValidity(),this.style.backgroundColor="pink",O=!0;else if(this.list&&!ye.array){if([...this.list.options].map((({value:g})=>g)).includes(this.value)||"strict"!==ae.unknownKeys){this.style.backgroundColor="revert-layer",this.setCustomValidity(""),this.reportValidity();const{optionalPropertyId:g}=this.dataset;let O=$e(ue,`.optionalProperties-placeholder${g}`);O||(O=$e(this.parentElement?.parentElement,".property-placeholder")?.previousElementSibling,O.previousElementSibling?.remove()),O.replaceWith(jml("div",{className:`optionalProperties-placeholder${g}`},[...buildTypeChoicesForProperty({propName:this.value,schema:ae?.properties?.[this.value]??ae?.catchall??{type:"any"}})]))}else this.setCustomValidity("Bad value"),this.reportValidity(),this.style.backgroundColor="pink",O=!0}if(O){const g=$e(ue,`.optionalProperties-placeholder${optionalPropertyId}`);DOM.removeChildren(g)}else this.$validate();g.stopPropagation(),this.$resort({alwaysFocus:!0})}},class:`propertyName-${pe}`}]]]}const xe=ae?.inner?.description;return["legend",[be?"":xe?`${xe} `:fe?.description?`${fe?.description} `:"tuple"===oe&&ae?.rest?.description?`${ae?.rest?.description} `:"Item ",["span",{dataset:{prop:!0,array:!0},className:g},[be?`${be} ${ie+1}`:void 0!==de?de:String(ie)]]]]},decrementItemIndex=g=>{he?fe=g.$getPropertyInputs().reduce(((g,O)=>{const L=O.$parseInt();return!1!==L&&L>g?L:g}),-1):fe--},buildTypeChoicesForProperty=({propName:M,schema:J,schemaIdx:ie,autoTrigger:ue})=>O({autoTrigger:ue,topRoot:le,format:L,schemaOriginal:ne,schemaIdx:ie,schemaContent:J||"tuple"===oe?J??ae.rest:ve||"set"===oe?ae?.value:"filelist"===oe?ae?.inner:"array"===oe||"arrayNonindexKeys"===oe?ae?.element:ae?.properties?.[M],state:ye.filelist?"filelistArray":pe??oe,typeNamespace:g}).domArray;function preventAdding(g=0){switch(oe){case"tuple":if("never"===ae?.rest?.type)return dialogs.alert('Tuple has rest type "never", so one cannot add to it.'),!0;if("never"===ae?.items?.[0]?.type)return dialogs.alert('Tuple has items type "never", so one cannot add to it.'),!0;break;case"set":{if("never"===ae?.value?.type)return dialogs.alert('Set has type "never", so one cannot add to it.'),!0;const{maxSize:O}=ae??{};if(void 0!==O&&[...Te.children].length+g>O)return dialogs.alert("You cannot add beyond the `maxSize` of the Set"),!0;break}case"array":case"arrayNonindexKeys":{if("never"===ae?.element?.type)return dialogs.alert('Array has type "never", so one cannot add to it.'),!0;const{maxLength:O}=ae??{};if(void 0!==O&&Te.$getArrayLength()+g>O)return dialogs.alert("You cannot add beyond the `maxLength` of the array"),!0;break}}return!1}const xe=["button",{class:"addArrayElement",$custom:{$addArrayElement:function({propName:O,splice:L,alwaysFocus:ie,required:ne,schema:pe,schemaIdx:ue,autoTrigger:de}){const ve=this.$getArrayItems();if(he)if(O){const g=O.match(/^\d+$/u)&&Number.parseInt(O);"number"==typeof g&&(fe=g)}else"number"==typeof L?fe=L+1:"string"!=typeof L&&(fe=ve.$getPropertyInputs().reduce(((g,O)=>{const L=O.$parseInt();return!1!==L&&L>g?L:g}),-1)+1);else fe++;const xe=this,Se=`${oe}Item`,Te=jml("fieldset",{dataset:ne?{required:"required"}:{},$on:{change:[()=>{"set"===oe&&setTimeout((()=>{const g=Ee,O=ye.getValue.call({...ye,set:!1},{root:g,stateObj:{types:J,formats:M}}),L=O.findLastIndex(((g,L)=>O.some(((O,M)=>L!==M&&g===O))));if(-1===L)return;const ae=[...ve.children].map((g=>{const O=$e(g,"div[data-type]");return O?J.getFormControlForRoot(O):null})),ie=ae[L];ie&&(ie.setCustomValidity("Duplicate Set value"),ie.reportValidity())}))},!0]},$custom:{$getPropertyInput(){return DOM.filterChildElements(this,["legend",`input.propertyName-${g}`]).pop()}}},[buildLegend({className:Se,splice:L,itemIndex:fe,typeNamespace:g,arrayItems:ve,propName:O,required:ne,schema:pe})],ve);if(jml({"#":[["span",{class:"mapValue",title:"map"===oe&&ae?.value?.description?"(map value)":"record"===oe&&ae?.value?.description?"(record value)":void 0},["map"===oe?ae?.value?.description??"Map value":"record"===oe?ae?.value?.description??"Record value":""," "]],...!ae||O||ye.array?buildTypeChoicesForProperty({propName:O,schema:pe,schemaIdx:ue,autoTrigger:de}):[jml("span",{className:`optionalProperties-placeholder${optionalPropertyId}`})],["span",{className:"property-placeholder"}],nbsp$1.repeat(2),["button",{disabled:"tuple"===oe&&ne&&ae?.items?.length-1>fe,$on:{click(g){if(g.preventDefault(),preventAdding(1))return;let O;if(he){const g=Te.$getPropertyInput().$parseInt();O=!1===g?"append":g}xe.$addArrayElement({splice:O,alwaysFocus:!0,schema:pe});const L=ve.lastElementChild;if(Te.after(L),he||(ae||pe)&&!ye.array){const g=L.$getPropertyInput();bringFocus(g,!0)}else DOM.filterChildElements(ve,["fieldset","legend","."+Se]).forEach(((g,O)=>{g.textContent=be?`${be} ${O+me+1}`:String(O+me)}));J.validateAllReferences({topRoot:le}),ve.$redrawMoveArrows()}}},["+"]],["button",{disabled:ne,$on:{click(g){g.preventDefault(),Te.remove(),decrementItemIndex(ve),he||ae&&!ye.array||DOM.filterChildElements(ve,["fieldset","legend","."+Se]).forEach(((g,O)=>{g.textContent=be?`${be} ${O+me+1}`:String(O+me)})),J.validateAllReferences({topRoot:le}),ve.$redrawMoveArrows()}}},["x"]],["span",{class:`${oe}Item-arrowHolder-${g}`},[]]]},Te),ge){const g=ve.$getPropertyInputs();if(g.length){const O=g.pop();O.$validate(),O.$resort({alwaysFocus:ie}),bringFocus(O,ie)}}ve.$redrawMoveArrows()},$getArrayItems(){return this.previousElementSibling}},$on:{click(){preventAdding(1)||(this.$addArrayElement({alwaysFocus:!0}),J.validateAllReferences({topRoot:le}))}}},["+ Item"]],Se=he?["div",[["label",["Array length: ",["input",{type:"number",value:ue&&ue.length||0,step:1,size:4,class:"arrayLength",pattern:String.raw`\d`,$on:{async change(){if(preventAdding())return void(this.value=this.$oldvalue??this.defaultValue);const g=$e(this.closest(".arrayContents"),".arrayItems").$inputsExceedingLength();try{if(g.length)await dialogs.confirm({message:"Your new length will truncate the array causing items to be removed. Continue?"}),g.forEach((g=>{const O=g.closest("fieldset");if(O.matches("[data-required]")){const g=$e(Ee,".arrayLength");g.value=String(Number.parseInt(g.value)+1)}else O.remove()})),J.validateAllReferences({topRoot:le});else{const g=ae?.element;if(!["void","undefined"].includes(g?.type)&&("union"!==g?.type||g?.options?.every((g=>!["void","undefined"].includes(g.type))))){const g=Number.parseInt(this.value)-Number.parseInt(this.$oldvalue??this.defaultValue);for(let O=0;O<g;O++)setTimeout((()=>{Ee.$addArrayElement({})}))}}this.$oldvalue=this.value}catch{this.value=this.$oldvalue}}}}]]]]]:"",Te=jml("div",{class:"arrayItems",$custom:{$swapGroup:function(g,O){const L=g.parentElement,M=L["up"===O?"previousElementSibling":"nextElementSibling"];if(M&&"fieldset"===M.nodeName.toLowerCase()){if(he||ae&&!ye.array){const g=L.$getPropertyInput(),O=M.$getPropertyInput();if("number"==typeof g.$parseInt()||"number"==typeof O.$parseInt()){const L=g.value,M=O.value;g.value=M,O.value=L}}else{const g=DOM.filterChildElements(M,["legend","span",`.${oe}Item`])[0],O=DOM.filterChildElements(L,["legend","span",`.${oe}Item`])[0],J=g.textContent,ae=O.textContent;g.textContent=ae,O.textContent=J}"up"===O?M.before(L):L.before(M),J.validateAllReferences({topRoot:le}),this.$redrawMoveArrows()}},$redrawMoveArrows:function(){"tuple"!==oe&&DOM.filterChildElements(this,["fieldset",`.${oe}Item-arrowHolder-${g}`]).forEach(((g,O,L)=>{DOM.removeChildren(g);let M=!0,J=!0;1!==L.length&&(0===O?M=!1:O===L.length-1&&(J=!1),M&&jml("button",{$on:{click:()=>{this.$swapGroup(g,"up")}}},[U.upArrow],g),J&&jml("button",{$on:{click:()=>{this.$swapGroup(g,"down")}}},[U.downArrow],g))}))},$getArrayLength:function(){return Number($e(this.previousElementSibling,"input").value)},$inputsExceedingLength:function(){const g=this.$getArrayLength()-1;return this.$getPropertyInputs().filter((g=>g.value.match(/^\d+$/u))).filter((O=>{const L=Number.parseInt(O.value)>g;return O.setCustomValidity(L?"Invalid length":""),O.reportValidity(),L}))},$getMapKeySelects(){return DOM.filterChildElements(this,["fieldset","legend:first-child","span.mapKeyHolder","select.typeChoices-key-type-choices-only"])},$getPropertyInputs(){return DOM.filterChildElements(this,["fieldset","legend",`input.propertyName-${g}`])}}}),Ie=["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(Ee,".arrayContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],we=["div",{class:"arrayContents"},[Se,Te,xe,["button",{$on:{click(){const g=this.closest(".arrayContents"),O=$e(g,".arrayItems"),L=O.lastElementChild;L&&!L.matches("[data-required]")&&(L.remove(),decrementItemIndex(O),$e(g,".arrayItems").$redrawMoveArrows()),J.validateAllReferences({topRoot:le})}}},["- Last item"]],["button",{$on:{click(){const g=this.closest(".arrayContents"),O=$e(g,".arrayItems"),L=$$e(g,".arrayItems > fieldset:not([data-required])");for(const g of L)g.remove();he?decrementItemIndex(O):fe=-1,J.validateAllReferences({topRoot:le})}}},["x All"]]]],_e=oe,Ee=jml("div",{dataset:{type:oe},$custom:{$addAndSetArrayElement({propName:g,type:O,value:L,bringIntoFocus:M,setAValue:ae,schemaContent:ie,schemaIdx:ne,mustBeOptional:oe}){if("map"===_e){if("0"===g){this.$addArrayElement({propName:g,autoTrigger:!1});const J=this.$getArrayItems(),ae=DOM.filterChildElements(J,["fieldset:last-of-type","legend",".mapKeyHolder","select"])[0];return ae.$setType({type:O,baseValue:L,bringIntoFocus:M,avoidReport:!0}),ae.$getTypeRoot()}}else"record"===_e?this.$addArrayElement({propName:g,autoTrigger:!1,required:!1}):this.$addArrayElement({propName:g,schema:ie,autoTrigger:!1,schemaIdx:ne,required:!oe&&ie&&!ie.isOptional&&"never"!==ie.type});const pe=this.$getTypeChoices();pe.$setType({type:O,baseValue:L,bringIntoFocus:M,specificSchema:"union"===ie?.type&&void 0!==ne?ie.options[ne]:ie,avoidReport:!0});const ue=pe.$getTypeRoot();if(ae){const g=J.getTypeObject(O);g.setValue&&g.setValue({root:ue,value:L})}return J.validate({type:O,root:ue,topRoot:le,avoidReport:!0}),ue},$getAddArrayElement(){const g=this.lastElementChild.firstElementChild.nextElementSibling;return he?g.nextElementSibling:g},$addArrayElement({propName:g,splice:O,alwaysFocus:L,required:M,schema:J,schemaIdx:ae,autoTrigger:ie}){this.$getAddArrayElement().$addArrayElement({propName:g,splice:O,alwaysFocus:L,required:M,schema:J,schemaIdx:ae,autoTrigger:ie})},$getArrayItems(){return this.$getAddArrayElement().previousElementSibling},$getTypeChoices(){const O=this.$getArrayItems();return $e(O.lastElementChild,`fieldset > .typeChoices-${g}`)}},$on:{click(g){const O=g,L=O.target;["checkbox","radio","file","datetime-local",void 0].includes(L.type)||O.preventDefault()}}},[[ae?"span":"b",{title:ae?.description??DOM.initialCaps(oe).replace(/s$/u,"")},[ae?"—":DOM.initialCaps(oe).replace(/s$/u,"")]],nbsp$1.repeat(2),"filelist"===oe?["input",{name:g+"-filelist",multiple:!0,type:"file",$on:{change(){if(this.files)for(let g=0;g<this.files.length;g++){const O=this.files.item(g);Ee.$addAndSetArrayElement({propName:String(g),type:"file",value:O,bringIntoFocus:!1,setAValue:!0})}}}}]:"",Ie,we]);if(le=le||Ee,!ue&&ae)switch(oe){case"object":if(!ie)for(const[g,O]of Object.entries(ae.properties??{}))O.isOptional||"never"===O.type||Ee.$addArrayElement({propName:g,required:!0});break;case"tuple":if(!ie){const g=ae;if("never"!==ae?.items?.[0]?.type)for(const O of g.items)Ee.$addArrayElement({schema:O,required:!0})}break;case"arrayNonindexKeys":{const{minLength:g=0}=ae,O=$e(Ee,".arrayLength");O.value=String(g),O.$oldvalue=String(g);for(let O=0;O<g;O++)Ee.$addArrayElement({required:!0});break}case"set":if(!ie){const{minSize:g=0}=ae;for(let O=0;O<g;O++)Ee.$addArrayElement({required:!0})}}return[Ee]}},tupleType={option:["Tuple"],array:!0,regexEndings:[",","]"],stringRegexBegin:/^Tuple\[/u,stringRegexEnd:/^\]/u,tuple:!0,valueMatch:g=>Array.isArray(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"tuple"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"tuple"})}},objectType={option:["Object"],regexEndings:[",","}"],stringRegexBegin:/^\{/u,stringRegexEnd:/^\}/u,valueMatch:g=>g&&"object"==typeof g&&"Object"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"object"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"object"})}},recordType={option:["Record"],regexEndings:[",","}"],stringRegexBegin:/^Record\{/u,stringRegexEnd:/^\}/u,array:!0,record:!0,valueMatch:g=>g&&"object"==typeof g&&"Object"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"record"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"record"})}},dateType={option:["Date"],dateRegex:/^(?:\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d)$/u,stringRegex(){const g=this.dateRegex;if(!this.valid){const{source:O}=g;return new RegExp("^(?:InvalidDate)|"+O.slice(1),"u")}return new RegExp(g,"u")},valueMatch:g=>"Date"===toStringTag(g),toValue:g=>({value:new Date(g)}),getInput:({root:g})=>$e(g,'input[type="datetime-local"]'),setValue({root:g,value:O}){if(O&&Number.isNaN(O.getTime()))return void $e(g,".invalidDate").$setValidity(!0);const L=new Date(Date.parse(O)).toISOString();this.getInput({root:g}).value=24===L.length?L.slice(0,-8):L.slice(3,13)},validate({root:g}){if(this.isInvalid({root:g}))return{valid:!0};const O=this.getInput({root:g}).value;return O?{valid:new RegExp(this.dateRegex,"u").test(O),message:"Must match a valid date"}:{valid:!1,message:"Must not be empty`"}},isInvalid({root:g}){return!this.valid&&$e(g,".invalidDate").checked},getValue({root:g}){return this.isInvalid({root:g})?this.toValue("NaN").value:this.toValue(this.getInput({root:g}).value).value},isValueInvalid:g=>g&&Number.isNaN(g.getTime()),viewUI({value:g,specificSchemaObject:O}){return!this.valid&&this.isValueInvalid(g)?["i",{dataset:{type:"date"},class:"InvalidDate",title:O?.description??"(an InvalidDate)"},["InvalidDate"]]:["i",{dataset:{type:"date"},class:"ValidDate",title:O?.description??"(a `Date`)"},[g.toISOString().slice(0,-8)]]},editUI({typeNamespace:g,specificSchemaObject:O,types:L,value:M}){const J=O,ae=M??(O?.defaultValue?new Date(O?.defaultValue):""),ie=this.isValueInvalid(ae),ne=this.valid?"":jml("div",[["label",["Invalid date",["input",{type:"checkbox",class:"invalidDate",checked:ie,name:`${g}-invalidDate`,$custom:{$setValidity(g){!0===g&&(this.checked=!0);const O=ne.previousElementSibling;O.hidden=Boolean(g);const M=O.parentElement;L.validate({type:"date",root:M})}},$on:{click(){this.$setValidity(this.checked)}}}]]]]);return["div",{dataset:{type:this.valid?"ValidDate":"date"},title:O?.description??"Date"},[["label",{hidden:ie},["Date: ",["input",{name:`${g}-date`,type:"datetime-local",value:!ae||ie?"":ae.toISOString().slice(0,-8),min:J?.min?new Date(J.min).toISOString().slice(0,-8):void 0,max:J?.max?new Date(J.max).toISOString().slice(0,-8):void 0}]]],ne]]}},enumType={option:["Enum"],stringRegex:/^Enum\((.*)\)$/u,valueMatch:g=>"string"==typeof g,toValue:g=>({value:g.slice(1,-1)}),getInput:({root:g})=>$e(g,"select"),setValue({root:g,value:O}){this.getInput({root:g}).value=O},getValue({root:g}){return this.getInput({root:g}).value},viewUI:({value:g,specificSchemaObject:O})=>["span",{dataset:{type:"enum"},title:O?.description??"(an enum)"},[g]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L=""})=>["div",{dataset:{type:"enum"},title:O?.description??"Enum"},[["select",{name:`${g}-enum`},O?.values.map((g=>["option",{selected:L?L===g:O?.defaultValue===g},[g]]))]]]},setType={option:["Set"],array:!0,set:!0,regexEndings:[",",")"],stringRegexBegin:/^Set\(/u,stringRegexEnd:/^\)/u,valueMatch:g=>"Set"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"set"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"set"})}},mapType={option:["Map"],array:!0,map:!0,regexEndings:[",",")"],stringRegexBegin:/^Map\(/u,stringRegexEnd:/^\)/u,valueMatch:g=>"Map"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"map"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"map"})}},literalType={option:["Literal"],stringRegex:/^Literal\((.*)\)$/u,valueMatch:g=>"boolean"==typeof g||"number"==typeof g||"string"==typeof g,toValue:g=>({value:"true"===g||"false"!==g&&('"'===g.charAt(0)?g.slice(1,-1):Number(g))}),getInput:({root:g})=>$e(g,"input,textarea"),setValue({root:g,value:O}){this.getInput({root:g}).value=O},getValue({root:g,stateObj:O}){const L=$e(g,"[data-type]"),M=O?.types?.getTypeObject?.(L?.dataset.type);return M?.getValue({root:g,stateObj:O})},viewUI:({value:g,specificSchemaObject:O})=>["span",{dataset:{type:"literal"},title:O?.description??`(a literal ${typeof g})`},[`${g}`]],editUI(g){const{specificSchemaObject:O}=g,{value:L}=O;let M;switch(typeof L){case"boolean":M=booleanType.editUI(g);break;case"number":M=numberType.editUI(g);break;default:M=stringType.editUI(g)}return["div",{dataset:{type:"literal"}},[M]]}},undefinedType={stringRegex:/^undefined$/u,option:["Explicit undefined"],valueMatch:g=>void 0===g,toValue:()=>({value:void 0}),getValue(){return this.toValue("").value},viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"undef"},title:g?.description??"(an `undefined`)"},["undefined"]],getInput:({root:g})=>$e(g,"input"),editUI:({typeNamespace:g,specificSchemaObject:O})=>["div",{dataset:{type:"undef"},title:O?.description??"Undefined"},[["label",["Undefined",["input",{type:"checkbox",name:`${g}-undef`,disabled:!0,checked:!0}]]]]]},voidType={stringRegex:/^void$/u,option:["Void"],valueMatch:g=>void 0===g,toValue:()=>({value:void 0}),getValue(){return this.toValue("").value},getInput:({root:g})=>$e(g,"input"),viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"void"},title:g?.description??"(a `void`)"},["void"]],editUI:({typeNamespace:g,specificSchemaObject:O})=>["div",{dataset:{type:"void"},title:O?.description??"Void"},[["label",["Void",["input",{type:"checkbox",name:`${g}-void`,checked:!0,disabled:!0}]]]]]},regexpType={option:["RegExp"],stringRegex(g){const O=g?"(?:":"(";return new RegExp(`^/${O}.*)/${O}[${this.allowedFlags.join("")}]{0,${this.allowedFlags.length}})$`,"u")},valueMatch:g=>"RegExp"===toStringTag(g),toValue(g){if("function"!=typeof this.stringRegex)throw new TypeError("Guard for TS");const[,O,L]=g.match(this.stringRegex());return{value:new RegExp(O,L)}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){this.getInput({root:g}).value=O.source,this.getSelect({root:g}).$set([...O.flags])},getSelect:({root:g})=>$e(g,"select"),validate({root:g}){try{return this.getValue({root:g}),{valid:!0}}catch(g){return{valid:!1,message:g.message}}},getValue({root:g}){return new RegExp(this.getInput({root:g}).value,[...this.getSelect({root:g}).selectedOptions].reduce(((g,O)=>g+O.value),""))},allowedFlags:["g","i","m","u","y","s","v"],viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"regexp"},title:O?.description??"(a `RegExp`)"},[String(g)]],editUI({typeNamespace:g,specificSchemaObject:O,types:L,value:M={source:"",flags:""}}){const J=jml("select",{multiple:!0,size:5,$custom:{$set(g){[...this.options].forEach((O=>{O.selected=g.includes(O.value)}))}}},this.allowedFlags.map((g=>["option",{selected:M.flags.includes(g)},[g]]))),ae=jml("div",{dataset:{type:"regexp"},title:O?.description??"RegExp"},[["label",["Source ",["input",{name:`${g}-regexp`,type:"text",value:M.source}]]],["br"],["label",["Flags ",J]]]);return J.addEventListener("change",(()=>{L.validate({type:"regexp",root:ae})})),[ae]}},BooleanObjectType={option:["BooleanObject"],stringRegex:/^Boolean\((.*)\)$/u,valueMatch:g=>"Boolean"===toStringTag(g)&&"object"==typeof g,toValue:g=>({value:new Boolean("true"===g)}),getInput:({root:g})=>$e(g,"input"),getValue({root:g}){return this.toValue(String(this.getInput({root:g}).checked)).value},setValue({root:g,value:O}){$$e(g,"input")[O.valueOf()?0:1].checked=!0},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"BooleanObject"},title:O?.description??"(a Boolean Object)"},[O?`${g}`:`Boolean(${g})`]],ct:0,editUI({typeNamespace:g,specificSchemaObject:O,value:L=new Boolean(!0)}){return this.ct++,["div",{dataset:{type:"BooleanObject"},title:O?.description??"Boolean object"},[["label",["True",["input",{type:"radio",name:`${g}-BooleanObject${this.ct}`,value:"true",checked:L.valueOf()}]]],["label",["False",["input",{type:"radio",name:`${g}-BooleanObject${this.ct}`,value:"false",checked:!L.valueOf()}]]]]]}},NumberObjectType={option:["NumberObject"],stringRegex:/^Number\((.*)\)$/u,valueMatch:g=>"Number"===toStringTag(g)&&"object"==typeof g,toValue:g=>({value:new Number(g)}),validate:({root:g})=>numberType.validate({root:g}),getInput:({root:g})=>$e(g,"input"),getValue({root:g}){return this.toValue(this.getInput({root:g}).value).value},setValue({root:g,value:O}){this.getInput({root:g}).value=String(O)},viewUI:({value:g,specificSchemaObject:O})=>["i",{dataset:{type:"NumberObject"},title:O?.description??"(a Number Object)"},[O?`${g}`:`Number(${g})`]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L})=>["div",{dataset:{type:"NumberObject"},title:O?.description??"Number object"},[["input",{name:`${g}-NumberObject`,type:"number",value:L,step:"any"}]]]},StringObjectType={stringRegex:/^String\(([^)]*)\)$/u,valueMatch:g=>"String"===toStringTag(g)&&"object"==typeof g,toValue:g=>({value:new String(g)}),option:["StringObject"],getInput:({root:g})=>$e(g,"textarea"),getValue({root:g}){return this.toValue(this.getInput({root:g}).value).value},setValue({root:g,value:O}){this.getInput({root:g}).value=O},viewUI:({value:g,specificSchemaObject:O})=>["span",{dataset:{type:"StringObject"},title:O?.description??"(a String Object)"},[O?"":["i",["String("]],["span",[g.valueOf()]],O?"":["i",[")"]]]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L=""})=>["div",{dataset:{type:"StringObject"},title:O?.description??"String object"},[["textarea",{name:`${g}-StringObject`},[L]]]]},SpecialRealNumberSuperType={option:["Special Real Number",{title:"`Infinity`, `-Infinity`, `-0`"}],childTypes:["infinity","negativeInfinity","negativeZero"],stringRegex:/^(?:-?Infinity|-0)$/u,valueMatch:g=>Object.is(g,-0)||g===Number.POSITIVE_INFINITY||g===Number.NEGATIVE_INFINITY,toValue:g=>({value:"-0"===g?-0:"Infinity"===g?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY}),getSelect:({root:g})=>$e(g,"select"),getValue({root:g}){return this.toValue(this.getSelect({root:g}).value).value},setValue({root:g,value:O}){this.getSelect({root:g}).value=Object.is(O,-0)?"-0":String(O)},viewUI({value:g,specificSchemaObject:O}){const L=Object.is(g,-0);return["i",{dataset:{type:"SpecialRealNumber"},title:O?.description??(L?"(negative zero)":`(${String(g)})`)},[L?"-0":String(g)]]},getInput:({root:g})=>$e(g,"select"),editUI:({typeNamespace:g,specificSchemaObject:O,value:L=Number.POSITIVE_INFINITY})=>["div",{dataset:{type:"SpecialRealNumber"},title:O?.description??"Special Real Number"},[["label",[["select",{name:`${g}-SpecialRealNumber`},[["option",{value:"Infinity",selected:L===Number.POSITIVE_INFINITY},["Infinity"]],["option",{value:"-Infinity",selected:L===Number.NEGATIVE_INFINITY},["-Infinity"]],["option",{value:"-0",selected:Object.is(L,-0)},["-0"]]]]]]]]},SpecialNumberSuperType={option:["Special Number",{title:"`NaN`, `Infinity`, `-Infinity`, `-0`"}],childTypes:["infinity","negativeInfinity","nan","negativeZero"],stringRegex:/^(?:NaN|-?Infinity|-0)$/u,toValue:g=>({value:"-0"===g?-0:"NaN"===g?Number.NaN:"Infinity"===g?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY}),getSelect:({root:g})=>$e(g,"select"),getInput:({root:g})=>$e(g,"select"),getValue({root:g}){return this.toValue(this.getSelect({root:g}).value).value},setValue({root:g,value:O}){this.getSelect({root:g}).value=Object.is(O,-0)?"-0":String(O)},viewUI:({value:g})=>["i",{dataset:{type:"SpecialNumber"}},[Object.is(g,-0)?"-0":String(g)]],editUI:({typeNamespace:g,value:O=Number.NaN})=>["div",{dataset:{type:"SpecialNumber"}},[["label",["Special number: ",["select",{name:`${g}-SpecialNumber`},[["option",{value:"NaN",selected:Number.isNaN(O)},["NaN"]],["option",{value:"Infinity",selected:O===Number.POSITIVE_INFINITY},["Infinity"]],["option",{value:"-Infinity",selected:O===Number.NEGATIVE_INFINITY},["-Infinity"]],["option",{value:"-0",selected:Object.is(O,-0)},["-0"]]]]]]]]},errorType={option:["Error"],stringRegex:/^Error\((.*)\)$/u,valueMatch:g=>"Error"===toStringTag(g)&&hasConstructorOf(g,Error),toValue(g){const O=JSON.parse(g);return{value:P.error.revive(O,{})}},getInput:({root:g})=>$e(g,"input:not([type])"),setValue({root:g,value:O}){"string"==typeof O.message?$e(g,"input.message:not([type])").value=O.message:$e(g,"input.message[type=checkbox]").click(),"string"==typeof O.name?$e(g,"input.name:not([type])").value=O.name:$e(g,"input.name[type=checkbox]").click(),"string"==typeof O.fileName?$e(g,"input.fileName:not([type])").value=O.fileName:$e(g,"input.fileName[type=checkbox]").click(),"number"==typeof O.lineNumber?$e(g,"input.lineNumber[type=number]").value=O.lineNumber:$e(g,"input.lineNumber[type=number]").value="","number"==typeof O.columnNumber?$e(g,"input.columnNumber[type=number]").value=O.columnNumber:$e(g,"input.columnNumber[type=number]").value="","string"==typeof O.stack?$e(g,"textarea.stack:not([type])").value=O.stack:$e(g,"input.stack[type=checkbox]").click(),setTimeout((()=>{"object"==typeof O.cause&&($e(g,".cause").click(),this.setValue({root:$e(g,".causeContents"),value:O.cause}))}))},getValue({root:g}){let O;if($e(g,"input.message[type=checkbox]").checked){const L=$e(g,"input.message:not([type])").value;O=new Error(L)}else O=new Error,O.message=void 0;if($e(g,"input.name[type=checkbox]").checked){const L=$e(g,"input.name:not([type])").value;O.name=L}else O.name=void 0;if($e(g,"input.fileName[type=checkbox]").checked){const L=$e(g,"input.fileName:not([type])").value;O.fileName=L}else O.fileName=void 0;if($e(g,"input.stack[type=checkbox]").checked){const L=$e(g,"textarea.stack:not([type])").value;O.stack=L}else O.stack=void 0;const L=$e(g,"input.lineNumber[type=number]").value;O.lineNumber=""===L?void 0:Number(L);const M=$e(g,"input.columnNumber[type=number]").value;O.columnNumber=""===M?void 0:Number(M);const J=$e(g,".causeContents");return J.children.length&&(O.cause=this.getValue({root:J})),O},viewUI({value:g,specificSchemaObject:O,types:L,format:M}){return["div",{dataset:{type:"error"}},[["b",{class:"emphasis",title:O?.description?"(an Error)":void 0},[O?.description??"Error"]],"string"==typeof g.message?["div",[["b",["Message: "]],["span",[g.message]]]]:[],"string"==typeof g.name?["div",[["b",["Name: "]],["span",[g.name]]]]:[],"string"==typeof g.fileName?["div",[["b",["File name: "]],["span",[g.fileName]]]]:[],"number"==typeof g.lineNumber?["div",[["b",["Line number: "]],["span",[g.lineNumber]]]]:[],"number"==typeof g.columnNumber?["div",[["b",["Column number: "]],["span",[g.columnNumber]]]]:[],"string"==typeof g.stack?["div",[["b",["Stack: "]],["span",[g.stack]]]]:[],["b",["Cause: "]],["div",{class:"causeHolder"},[["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=O.nextElementSibling;L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"causeContents"},[g.cause?this.viewUI({format:M,value:g.cause,types:L}):""]]]]]]},editUI({typeNamespace:g,types:O,specificSchemaObject:L,value:M={message:"",name:"",fileName:"",lineNumber:"",columnNumber:"",stack:"",cause:void 0}}){const click=function(g){this.parentNode.nextElementSibling.hidden=!g.target.checked},J=this;"object"==typeof M.cause&&setTimeout((()=>{$e(ae,".cause").click()}));const ae=jml("div",{dataset:{type:"error"},title:L?.description??"Error"},[["div",[["label",["Message? ",["input",{class:"message",type:"checkbox",checked:"string"==typeof M.message,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof M.message},["Message ",["input",{class:"message",name:`${g}-error-message`,value:M.message}]]]]],["div",[["label",["Name? ",["input",{class:"name",type:"checkbox",checked:"string"==typeof M.name,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof M.name},["Name ",["input",{class:"name",name:`${g}-error-name`,value:M.name}]]]]],["br"],["div",[["label",["File name? ",["input",{class:"fileName",type:"checkbox",checked:"string"==typeof M.fileName,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof M.fileName},["File name ",["input",{class:"fileName",name:`${g}-error-fileName`,value:M.fileName}]]]]],["label",["Line number ",["input",{class:"lineNumber",name:`${g}-error-lineNumber`,type:"number",step:"any",value:M.lineNumber}]]],["br"],["label",["Column number ",["input",{class:"columnNumber",name:`${g}-error-columnNumber`,type:"number",step:"any",value:M.columnNumber}]]],["div",[["label",["Stack? ",["input",{class:"stack",type:"checkbox",checked:"string"==typeof M.stack,$on:{click:click}}]]],["label",{hidden:"string"!=typeof M.stack},["Stack ",["textarea",{class:"stack",name:`${g}-error-stack`},[M.stack]]]]]],["label",["Cause? ",["input",{class:"cause",type:"checkbox",$on:{click(L){click.call(this,L);const ae=this.parentElement.nextElementSibling,ie=$e(ae,".causeContents");if(!ie?.children.length){const L=J.editUI({typeNamespace:g,types:O,value:M.cause});jml(...L,ie)}}}}]]],["div",{class:"causeHolder",hidden:!0},[["label",["Cause "]],["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(O.closest(".causeHolder"),".causeContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"causeContents"}]]]]);return[ae]}};function getConstructor(g){const O=Function.prototype.toString.call(g);return O.slice(9,O.indexOf("("))}const specialErrorsMap=new Map([["TypeError",TypeError],["RangeError",RangeError],["SyntaxError",SyntaxError],["ReferenceError",ReferenceError],["EvalError",EvalError],["URIError",URIError]]);"undefined"!=typeof AggregateError&&specialErrorsMap.set("AggregateError",AggregateError),"undefined"!=typeof InternalError&&specialErrorsMap.set("InternalError",InternalError);const specialErrors=[...specialErrorsMap.keys()],errorsSpecialType={option:["Special errors"],valueMatch:g=>[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError,AggregateError].some((O=>hasConstructorOf(g,O))),childTypes:specialErrors.map((g=>g.toLowerCase())),stringRegex:new RegExp("^(?<errorClass>"+specialErrors.join("|")+String.raw`)\((?<innerContent>.*)\)$`,"u"),toValue(g,O){const{groups:{errorClass:L}={}}=O.match,M=JSON.parse(g);return{value:x[L.toLowerCase()].revive(M,{})}},getInput:({root:g})=>$e(g,"input:not([type])"),setValue({root:g,value:O}){const L=$e(g,".errorType");L.value=getConstructor(O.constructor),L.$hideAggregateErrorsLabel(),"string"==typeof O.message?$e(g,"input.message:not([type])").value=O.message:$e(g,"input.message[type=checkbox]").click(),"string"==typeof O.name?$e(g,"input.name:not([type])").value=O.name:$e(g,"input.name[type=checkbox]").click(),"string"==typeof O.fileName?$e(g,"input.fileName:not([type])").value=O.fileName:$e(g,"input.fileName[type=checkbox]").click(),"number"==typeof O.lineNumber?$e(g,"input.lineNumber[type=number]").value=O.lineNumber:$e(g,"input.lineNumber[type=number]").value="","number"==typeof O.columnNumber?$e(g,"input.columnNumber[type=number]").value=O.columnNumber:$e(g,"input.columnNumber[type=number]").value="","string"==typeof O.stack?$e(g,"textarea.stack:not([type])").value=O.stack:$e(g,"input.stack[type=checkbox]").click(),setTimeout((()=>{if("object"==typeof O.cause&&($e(g,".cause").click(),this.setValue({root:$e(g,".causeContents"),value:O.cause})),Array.isArray(O.errors)){const L=$e(g,"input.aggregateErrors");L.click(),L.$emptyAggregateErrorsContents(),L.$populateContents(O.errors)}}))},getValue({root:g,stateObj:O}){const L=specialErrorsMap.get($e(g,".errorType").value);if(!L)throw new Error("Bad error type");let M;if($e(g,"input.message[type=checkbox]").checked){const J=$e(g,"input.message:not([type])").value;if("AggregateError"===getConstructor(L)){const ae=L,ie=$e(g,".aggregateErrorsContents").firstElementChild;M=new ae(arrayType.getValue({stateObj:O,root:ie}),J)}else{M=new L(J)}}else{if("AggregateError"===getConstructor(L)){const J=L,ae=$e(g,".aggregateErrorsContents").firstElementChild;M=new J(arrayType.getValue({stateObj:O,root:ae}))}else{M=new L}M.message=void 0}if($e(g,"input.name[type=checkbox]").checked){const O=$e(g,"input.name:not([type])").value;M.name=O}else M.name=void 0;if($e(g,"input.fileName[type=checkbox]").checked){const O=$e(g,"input.fileName:not([type])").value;M.fileName=O}else M.fileName=void 0;if($e(g,"input.stack[type=checkbox]").checked){const O=$e(g,"textarea.stack:not([type])").value;M.stack=O}else M.stack=void 0;const J=$e(g,"input.lineNumber[type=number]").value;M.lineNumber=""===J?void 0:Number(J);const ae=$e(g,"input.columnNumber[type=number]").value;M.columnNumber=""===ae?void 0:Number(ae);const ie=$e(g,".causeContents");return ie.children.length&&(M.cause=this.getValue({stateObj:O,root:ie})),M},viewUI({value:g,types:O,format:L,specificSchemaObject:M,typeNamespace:J,resultType:ae}){const ie=getConstructor(g.constructor);return["div",{dataset:{type:"errors"},title:M?.description?`(an Error ${ie})`:void 0},[M?.description??["div",[["b",["Error type: "]],["span",[ie]]]],"string"==typeof g.message?["div",[["b",["Message: "]],["span",[g.message]]]]:[],"string"==typeof g.name?["div",[["b",["Name: "]],["span",[g.name]]]]:[],"string"==typeof g.fileName?["div",[["b",["File name: "]],["span",[g.fileName]]]]:[],"number"==typeof g.lineNumber?["div",[["b",["Line number: "]],["span",[g.lineNumber]]]]:[],"number"==typeof g.columnNumber?["div",[["b",["Column number: "]],["span",[g.columnNumber]]]]:[],"string"==typeof g.stack?["div",[["b",["Stack: "]],["span",[g.stack]]]]:[],["b",["Cause: "]],["div",{class:"causeHolder"},[["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=O.nextElementSibling;L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"causeContents"},[g.cause?this.viewUI({format:L,value:g.cause,types:O}):""]]]],"AggregateError"===ie?["div",[["b",["Errors "]],["div",{class:"aggregateErrorsHolder"},[["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=O.nextElementSibling;L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"aggregateErrorsContents"},[g.errors?(()=>{const[M]=arrayType.viewUI({typeNamespace:J,resultType:ae,format:L,type:"arrayNonindexKeys",value:[],types:O});return g.errors.forEach(((g,O)=>{M.$addAndSetArrayElement({propName:String(O),type:"Error"===getConstructor(g.constructor)?"error":"errors",value:g,bringIntoFocus:!1})})),M})():""]]]]]]:""]]},editUI({typeNamespace:g,specificSchemaObject:O,types:L,buildTypeChoices:M,format:J,topRoot:ae,bringIntoFocus:ie,value:ne={message:"",name:"",fileName:"",lineNumber:"",columnNumber:"",stack:"",cause:void 0,errors:void 0}}){const click=function(g){this.parentNode.nextElementSibling.hidden=!g.target.checked},oe=this;"object"==typeof ne.cause&&setTimeout((()=>{$e(pe,".cause").click()})),Array.isArray(ne.errors)&&setTimeout((()=>{$e(pe,"input.aggregateErrors").click()}));const pe=jml("div",{dataset:{type:"errors"},title:O?.description??"Special error"},[["div",[["label",["Special error type ",["select",{class:"errorType",$custom:{$hideAggregateErrorsLabel(){$e(this.parentElement?.closest("div[data-type=errors]"),"label.aggregateErrors").hidden="AggregateError"!==this.value}},$on:{change(){this.$hideAggregateErrorsLabel()}}},[["option",{value:""},["Select an error type"]],...specialErrors.map((g=>["option",{selected:g===getConstructor(ne.constructor)?"selected":void 0},[g]]))]]]],["br"],["label",["Message? ",["input",{class:"message",type:"checkbox",checked:"string"==typeof ne.message,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof ne.message},["Message ",["input",{class:"message",name:`${g}-errors-message`,value:ne.message}]]]]],["div",[["label",["Name? ",["input",{class:"name",type:"checkbox",checked:"string"==typeof ne.name,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof ne.name},["Name ",["input",{class:"name",name:`${g}-errors-name`,value:ne.name}]]]]],["br"],["div",[["label",["File name? ",["input",{class:"fileName",type:"checkbox",checked:"string"==typeof ne.fileName,$on:{click:click}}]]]," ",["label",{hidden:"string"!=typeof ne.fileName},["File name ",["input",{class:"fileName",name:`${g}-errors-fileName`,value:ne.fileName}]]]]],["label",["Line number ",["input",{class:"lineNumber",name:`${g}-errors-lineNumber`,type:"number",step:"any",value:ne.lineNumber}]]],["br"],["label",["Column number ",["input",{class:"columnNumber",name:`${g}-errors-columnNumber`,type:"number",step:"any",value:ne.columnNumber}]]],["div",[["label",["Stack? ",["input",{class:"stack",type:"checkbox",checked:"string"==typeof ne.stack,$on:{click:click}}]]],["label",{hidden:"string"!=typeof ne.stack},["Stack ",["textarea",{class:"stack",name:`${g}-errors-stack`},[ne.stack??""]]]]]],["label",["Cause? ",["input",{class:"cause",type:"checkbox",$on:{click(O){click.call(this,O);const J=this.parentElement.nextElementSibling,ae=$e(J,".causeContents");if(!ae?.children.length){const O=oe.editUI({buildTypeChoices:M,typeNamespace:g,types:L,value:ne.cause});jml(...O,ae)}}}}]]],["div",{class:"causeHolder",hidden:!0},[["label",["Cause "]],["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(O.closest(".causeHolder"),".causeContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"causeContents"}]]],["br"],["label",{class:"aggregateErrors"},{hidden:!ne.errors},["Aggregate errors? ",["input",{class:"aggregateErrors",type:"checkbox",$custom:{$emptyAggregateErrorsContents(){const g=this.parentElement.nextElementSibling,O=$e(g,".aggregateErrorsContents");for(;O?.firstChild;)O?.firstChild.remove()},$populateContents(O){const ne=this.parentElement.nextElementSibling,oe=$e(ne,".aggregateErrorsContents");if(!oe?.children.length){const[ne]=arrayType.editUI({typeNamespace:g,types:L,buildTypeChoices:M,format:J,type:"array",topRoot:ae,bringIntoFocus:ie,forcedState:"errorsArray",value:[]});O.forEach(((g,O)=>{ne.$addAndSetArrayElement({propName:String(O),type:"Error"===getConstructor(g.constructor)?"error":"errors",value:g,bringIntoFocus:!1,setAValue:!0})})),jml(ne,oe)}}},$on:{click(g){click.call(this,g);const O=this;ne.errors?O.$populateContents(ne.errors):O.$populateContents([{message:"",name:"",stack:""}])}}}]]],["div",{class:"aggregateErrorsHolder",hidden:!0},[["label",["Aggregate errors "]],["button",{$on:{click(g){g.preventDefault();const{target:O}=g,L=$e(O.closest(".aggregateErrorsHolder"),".aggregateErrorsContents");L.hidden=!L.hidden,O.textContent=L.hidden?"+":"-"}}},["-"]],["div",{class:"aggregateErrorsContents"}]]]]);return[pe]}};let audioCtx;function visualize(g,O){audioCtx||(audioCtx=new AudioContext);const L=O.getContext("2d"),M=audioCtx.createMediaStreamSource(g),J=audioCtx.createAnalyser();J.fftSize=2048;const ae=J.frequencyBinCount,ie=new Uint8Array(ae);M.connect(J),function draw(){const g=O.width,M=O.height;requestAnimationFrame(draw),J.getByteTimeDomainData(ie),L.fillStyle="rgb(200, 200, 200)",L.fillRect(0,0,g,M),L.lineWidth=2,L.strokeStyle="rgb(0, 0, 0)",L.beginPath();const ne=1*g/ae;let oe=0;for(let g=0;g<ae;g++){const O=ie[g]/128*M/2;0===g?L.moveTo(oe,O):L.lineTo(oe,O),oe+=ne}L.lineTo(O.width,O.height/2),L.stroke()}()}async function getUserMedia(g){let O=null;try{O=await navigator.mediaDevices.getUserMedia(g)}catch(g){return console.error("err",g),null}return O}async function startScreenCapture(g){let O=null;try{O=await navigator.mediaDevices.getDisplayMedia(g)}catch(g){console.error(`Error: ${g}`)}return O}function getDateString(g){const O=new Date(g);return new Date(O.getTime()-6e4*O.getTimezoneOffset()).toISOString().slice(0,-1)}function newFileForBinary(g,O){const L=g.$value,M=new File([void 0===O.stringContents?L&&"File"===Object.prototype.toString.call(L).slice(8,-1)?L:"":O.stringContents],void 0===O.name?L?.name??"":O.name,{type:void 0===O.type?L?.type??"":O.type,lastModified:void 0===O.lastModified?L?.lastModified??0:O.lastModified});g.$value=M}function binaryButton$1(g,O){return["button",{class:"viewBinary",$custom:{$value:g},$on:{click(g){const O=this;g.preventDefault(),this.$value&&"File"===Object.prototype.toString.call(this.$value).slice(8,-1)||newFileForBinary(O,{});const L=new FileReader;L.addEventListener("load",(async function(){const g=await dialogs.makeSubmitDialog({submitText:"Save",submit(){const L=$e(g,".view-binary");newFileForBinary(O,{stringContents:L.value}),g.close()},children:[["div",["Binary source",["br"],["textarea",{class:"view-binary"},[L.result??""]]]]]})})),L.addEventListener("error",(async function(){console.error(L.error),await dialogs.alert(L.error.message)})),L.readAsBinaryString(this.$value)}}},[O?"Edit binary data":"View binary data"]]}const fileType={option:["File"],stringRegex:/^File\((.*)\)$/u,valueMatch:g=>"File"===toStringTag(g),toValue(g){const O=JSON.parse(g);return{value:new File([O.stringContents],O.name,{type:O.type,lastModified:O.lastModified})}},getInput:({root:g})=>$e(g,"button.viewBinary"),setValue({root:g,value:O}){$e(g,"fieldset.fileMetaData").$setValue(O)},getValue({root:g}){return this.getInput({root:g}).$value},viewUI:({value:g,specificSchemaObject:O})=>["div",{dataset:{type:"file"}},[["b",{class:"emphasis",title:O?.description?"(a File)":void 0},[O?.description??"File"]],["br"],["br"],["b",["Name "]],g.name,["br"],["b",["Size (in bytes) "]],String(g.size),["br"],["b",["Content type "]],g.type,["br"],["b",["Last modified date "]],getDateString(g.lastModified),["br"],g.type.startsWith("text/")||"application/json"===g.type?(()=>{const O=jml("div"),L=new FileReader;return L.addEventListener("load",(function(){O.append(jml("div",["Text source",["br"],["textarea",{class:"view-text"},[L.result??""]]]))})),L.addEventListener("error",(function(){console.error(L.error),O.append(L.error.message)})),L.readAsBinaryString(g),O})():binaryButton$1(g),g.type.startsWith("video/")?(()=>{const O=URL.createObjectURL(g),L=jml("video",{src:O,class:"video",$on:{loadeddata(){/iPad|iPhone|iPod|Safari/u.test(navigator.userAgent)||URL.revokeObjectURL(O)}}});return["div",[L,["button",{class:"play",$on:{click(g){g.preventDefault(),L.play()}}},["Play"]],["button",{class:"pause",$on:{click(g){g.preventDefault(),L.pause()}}},["Pause"]],["button",{class:"replay",$on:{click(g){g.preventDefault(),L.pause(),L.currentTime=0,L.play()}}},["Replay"]]]]})():"",g.type.startsWith("audio/")?(()=>{const O=URL.createObjectURL(g),L=jml("audio",{src:O,class:"audio",$on:{loadeddata(){URL.revokeObjectURL(O)}}});return["div",[L,["button",{class:"play",$on:{click(g){g.preventDefault(),L.play()}}},["Play"]],["button",{class:"pause",$on:{click(g){g.preventDefault(),L.pause()}}},["Pause"]],["button",{class:"replay",$on:{click(g){g.preventDefault(),L.pause(),L.currentTime=0,L.play()}}},["Replay"]]]]})():"","application/pdf"===g.type?(()=>{const O=URL.createObjectURL(g);return jml("iframe",{class:"PDF",src:O,$on:{load(){URL.revokeObjectURL(O)}}})})():"",g.type.startsWith("image/")?["img",{class:"imageView",src:URL.createObjectURL(g),$on:{load(){URL.revokeObjectURL(this.src)}}}]:""]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L={}})=>["div",{dataset:{type:"file"},title:O?.description??"File"},[["fieldset",{class:"fileMetaData",$custom:{$setValue(g){const O=this;$e(O,".fileName").value=g.name,$e(O,".size").value=String(g.size),$e(O,".contentType").value=g.type,$e(O,".lastModified").value="number"==typeof g.lastModified?getDateString(g.lastModified):"",$e(O,"button.viewBinary").$value="number"==typeof g.lastModified?g:void 0}}},[["legend",["Current file data"]],["label",["Name ",["input",{size:50,class:"fileName",value:L.name??"",$on:{change(){newFileForBinary($e(this.parentElement?.parentElement,"button.viewBinary"),{name:this.value})}}}]]],["br"],["label",["Size (in bytes) ",["input",{type:"number",step:"1",disabled:!0,class:"size",value:String(L.size)}]]],["br"],["label",["Content type ",["input",{class:"contentType",value:L.type??"",$on:{change(){newFileForBinary($e(this.parentElement?.parentElement,"button.viewBinary"),{type:this.value})}}}]]],["br"],["label",["Last modified date ",["input",{type:"datetime-local",class:"lastModified",step:.001,value:L.lastModified?getDateString(L.lastModified):void 0,$on:{change(){const g=$e(this.parentElement?.parentElement,"button.viewBinary"),O=this.value;newFileForBinary(g,{lastModified:new Date(O).getTime()})}}}]]],["br"],binaryButton$1(L,!0),["button",{class:"clearData",$on:{click(g){g.preventDefault(),this.parentElement.$setValue({name:"",size:"",type:"",lastModified:""})}}},["Clear data"]]]],["fieldset",[["legend",["Supply file through upload"]],["label",["File ",["input",{$on:{change(){if(!this.files)return;const g=this.files[0],O=(this.parentElement?.parentElement)?.previousElementSibling;O.$setValue(g)}},name:`${g}-file`,type:"file"}]]]]],["fieldset",[["legend",["Supply file through recording"]],(()=>{const g=jml("select",{class:"device",$on:{async change(){const O=this.nextElementSibling?.nextElementSibling;$e(O,"img.photo").hidden=!0;const L=$e(O,"video.previewMedia"),M=jml("video",{class:"previewMedia"});if(L.$stream){L.$stream.getTracks().forEach((g=>{g.stop()})),L.srcObject=null}L.replaceWith(M);const J=$e(g.nextElementSibling,".takeSnapshot"),ae=$e(g.nextElementSibling,".recordMedia");$e(g.nextElementSibling?.nextElementSibling,"div.recordedMedia").hidden=!0;const ie=$e(O,"canvas.visualizer");let ne,oe;switch(M.$screenShare=!1,g.value){case"audio-and-video":ne={video:!0,audio:!0},M.hidden=!1,J.hidden=!1,ae.textContent="Record video/audio";break;case"video":ne={video:!0},M.hidden=!1,J.hidden=!1,ae.textContent="Record video";break;case"audio":ne={audio:!0},M.hidden=!0,J.hidden=!0,ae.textContent="Record audio";break;case"screenShare":oe={video:!0};case"screenShareAndVideo":oe||(oe={video:!0,audio:!0}),M.$screenShare=!0,M.hidden=!0,J.hidden=!0,ie.hidden=!0;break;default:return}if(ne){const g=await getUserMedia(ne);if(!g)return void await dialogs.alert("Error getting user media");if(O.hidden=!1,M.srcObject=g,M.$stream=g,ne.video){const g=$e(O,"canvas.recordedImage");M.addEventListener("canplay",(()=>{g.setAttribute("width",String(M.videoWidth)),g.setAttribute("height",String(M.videoHeight))}))}M.addEventListener("loadedmetadata",(()=>{M.play(),ne?.audio?(ie.hidden=!1,visualize(g,ie)):ie.hidden=!0}))}else if(oe){const g=await startScreenCapture(oe);if(!g)return void await dialogs.alert("Error getting user media");O.hidden=!1,M.srcObject=g,M.$stream=g}}}},[["option",{value:""},["Please choose a device"]]]);return(async()=>{const O=await navigator.mediaDevices.enumerateDevices();let L=!1,M=!1;O.forEach((g=>{switch(g.kind){case"audioinput":L=!0;break;case"videoinput":M=!0}})),L&&jml("option",{value:"audio"},["Microphone only"],g),M&&jml("option",{value:"video"},["Video camera only"],g),L&&M&&jml("option",{value:"audio-and-video"},["Video camera and microphone"],g),jml("option",{value:"screenShare"},["Screen share"],g),jml("option",{value:"screenShareAndVideo"},["Screen share and microphone"],g)})(),g})()," ",["div",[["button",{class:"recordMedia",$on:{click(g){g.preventDefault();const O=$e(this.parentElement?.nextElementSibling,"video.previewMedia");if(!O.srcObject)return void dialogs.alert("No stream found to record");const L=this.parentElement?.nextElementSibling;$e(L,"img.photo").hidden=!0;const M="video/mp4",J=new MediaRecorder(O.$stream,{mimeType:M});let ae=[];J.addEventListener("dataavailable",(g=>{ae.push(g.data)}));try{J.start()}catch{return void dialogs.alert("Error starting media recorder")}J.addEventListener("stop",(()=>{const g=new Blob(ae,{type:M}),O=URL.createObjectURL(g),L=$e(this.parentElement?.nextElementSibling,"video.recordedMedia");L.parentElement.hidden=!1,L.src=O,L.addEventListener("loadeddata",(()=>{/iPad|iPhone|iPod|Safari/u.test(navigator.userAgent)||URL.revokeObjectURL(O)}));const J=new File([g],"placeholder.mp4",{type:M});console.log("file",J);const ie=this.closest('[data-type="file"]');$e(ie,"fieldset.fileMetaData").$setValue(J),ae=[]})),this.$mediaRecorder=J}}},["Record media"]],["button",{class:"stopRecording",$on:{click(g){g.preventDefault(),this.previousElementSibling.$mediaRecorder.stop()}}},["Stop recording"]],["button",{class:"takeSnapshot",hidden:!0},{$on:{click(g){g.preventDefault();const O=this.parentElement?.nextElementSibling;$e(O,".recordedMedia").hidden=!0;const L=$e(O,"canvas.recordedImage"),M=L.getContext("2d"),J=$e(O,"video.previewMedia");M.drawImage(J,0,0,L.width,L.height);const ae=$e(O,"img.photo");L.toBlob((g=>{if(!g)return void dialogs.alert("Error converting canvas to Blob");const O=jml("img",{class:"photo"}),L=URL.createObjectURL(g);O.addEventListener("load",(()=>{URL.revokeObjectURL(L)}));const M=new File([g],"placeholder.png",{type:g.type});console.log("file",M);const J=this.closest('[data-type="file"]');$e(J,"fieldset.fileMetaData").$setValue(M),O.src=L,ae.replaceWith(O)}))}}},["Take and use snapshot as file"]]]],["div",{class:"videoContainer",hidden:!0},[["canvas",{class:"visualizer",hidden:!0}],["br"],["video",{class:"previewMedia"}],["div",[["canvas",{hidden:!0,class:"recordedImage"}],["img",{class:"photo"}]]],["div",{class:"recordedMedia"},[...(()=>{const g=jml("video",{class:"recordedMedia"});return[g,["br"],jml("button",{class:"play",$on:{click(O){O.preventDefault(),g.play()}}},["Play"]),jml("button",{class:"pause",$on:{click(O){O.preventDefault(),g.pause()}}},["Pause"]),jml("button",{class:"replay",$on:{click(O){O.preventDefault(),g.pause(),g.currentTime=0,g.play()}}},["Replay"])]})()]]]]]]]]},filelistType={option:["FileList"],array:!0,filelist:!0,regexEndings:[",",")"],stringRegexBegin:/^FileList\(/u,stringRegexEnd:/^\)/u,valueMatch:g=>"FileList"===toStringTag(g),toValue(...g){return arrayType.toValue.apply(this,g)},getValue(...g){return arrayType.getValue.apply(this,g)},getInput(...g){return arrayType.getInput.apply(this,g)},viewUI({...g}){return arrayType.viewUI.call(this,{...g,type:"filelist"})},editUI({...g}){return arrayType.editUI.call(this,{...g,type:"filelist"})}};function newBlobForBinary(g,O){const L=g.$value,M=new Blob([void 0===O.stringContents?L&&"Blob"===Object.prototype.toString.call(L).slice(8,-1)?L:"":O.stringContents],{type:void 0===O.type?L?.type??"":O.type});return g.$value=M,M}function binaryButton(g,O){return["button",{class:"viewBinary",$custom:{$value:g},$on:{click(g){const O=this;g.preventDefault(),this.$value&&"Blob"===Object.prototype.toString.call(this.$value).slice(8,-1)||newBlobForBinary(O,{});const L=new FileReader;L.addEventListener("load",(async function(){const g=await dialogs.makeSubmitDialog({submitText:"Save",submit(){const L=$e(g,".view-binary"),M=newBlobForBinary(O,{stringContents:L.value});O.parentElement.$setValue(M),g.close()},children:[["div",["Binary source",["br"],["textarea",{class:"view-binary"},[L.result??""]]]]]})})),L.addEventListener("error",(async function(){console.error(L.error),await dialogs.alert(L.error.message)})),L.readAsBinaryString(this.$value)}}},[O?"Edit binary data":"View binary data"]]}const blobType={option:["Blob"],stringRegex:/^Blob\((.*)\)$/u,valueMatch:g=>"Blob"===toStringTag(g),toValue(g){const O=JSON.parse(g);return{value:new Blob([O.stringContents],{type:O.type})}},getInput:({root:g})=>$e(g,"button.viewBinary"),setValue({root:g,value:O}){$e(g,"fieldset.blobMetaData").$setValue(O)},getValue({root:g}){return this.getInput({root:g}).$value},viewUI:({value:g,specificSchemaObject:O})=>["div",{dataset:{type:"blob"}},[["b",{class:"emphasis",title:O?.description?"(a Blob)":void 0},[O?.description??"Blob"]],["br"],["br"],["b",["Size (in bytes) "]],String(g.size),["br"],["b",["Content type "]],g.type,["br"],g.type.startsWith("text/")||"application/json"===g.type?(()=>{const O=jml("div"),L=new FileReader;return L.addEventListener("load",(function(){O.append(jml("div",["Text source",["br"],["textarea",{class:"view-text"},[L.result??""]]]))})),L.addEventListener("error",(function(){console.error(L.error),O.append(L.error.message)})),L.readAsBinaryString(g),O})():binaryButton(g),g.type.startsWith("video/")?(()=>{const O=URL.createObjectURL(g),L=jml("video",{src:O,class:"video",$on:{loadeddata(){/iPad|iPhone|iPod|Safari/u.test(navigator.userAgent)||URL.revokeObjectURL(O)}}});return["div",[L,["button",{class:"play",$on:{click(g){g.preventDefault(),L.play()}}},["Play"]],["button",{class:"pause",$on:{click(g){g.preventDefault(),L.pause()}}},["Pause"]],["button",{class:"replay",$on:{click(g){g.preventDefault(),L.pause(),L.currentTime=0,L.play()}}},["Replay"]]]]})():"",g.type.startsWith("audio/")?(()=>{const O=URL.createObjectURL(g),L=jml("audio",{src:O,class:"audio",$on:{loadeddata(){URL.revokeObjectURL(O)}}});return["div",[L,["button",{class:"play",$on:{click(g){g.preventDefault(),L.play()}}},["Play"]],["button",{class:"pause",$on:{click(g){g.preventDefault(),L.pause()}}},["Pause"]],["button",{class:"replay",$on:{click(g){g.preventDefault(),L.pause(),L.currentTime=0,L.play()}}},["Replay"]]]]})():"","application/pdf"===g.type?(()=>{const O=URL.createObjectURL(g);return jml("iframe",{class:"PDF",src:O,$on:{load(){URL.revokeObjectURL(O)}}})})():"",g.type.startsWith("image/")?["img",{class:"imageView",src:URL.createObjectURL(g),$on:{load(){URL.revokeObjectURL(this.src)}}}]:""]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L={}})=>["div",{dataset:{type:"blob"},title:O?.description??"Blob"},[["fieldset",{class:"blobMetaData",$custom:{$setValue(g){const O=this;$e(O,".size").value=String(g.size),$e(O,".contentType").value=g.type,$e(O,"button.viewBinary").$value="Blob"===Object.prototype.toString.call(g).slice(8,-1)?g:void 0}}},[["legend",["Current blob data"]],["label",["Size (in bytes) ",["input",{type:"number",step:"1",disabled:!0,class:"size",value:String(L.size)}]]],["br"],["label",["Content type ",["input",{class:"contentType",value:L.type??"",$on:{change(){newBlobForBinary($e(this.parentElement?.parentElement,"button.viewBinary"),{type:this.value})}}}]]],["br"],binaryButton(L,!0),["button",{class:"clearData",$on:{click(g){g.preventDefault(),this.parentElement.$setValue({size:"",type:""})}}},["Clear data"]]]],["fieldset",[["legend",["Supply blob through upload"]],["label",["Blob ",["input",{$on:{change(){if(!this.files)return;const g=this.files[0],O=new Blob([g],{type:g.type}),L=(this.parentElement?.parentElement)?.previousElementSibling;L.$setValue(O)}},name:`${g}-blob`,type:"file"}]]]]],["fieldset",[["legend",["Supply blob through recording"]],(()=>{const g=jml("select",{class:"device",$on:{async change(){const O=this.nextElementSibling?.nextElementSibling;$e(O,"img.photo").hidden=!0;const L=$e(O,"video.previewMedia"),M=jml("video",{class:"previewMedia"});if(L.$stream){L.$stream.getTracks().forEach((g=>{g.stop()})),L.srcObject=null}L.replaceWith(M);const J=$e(g.nextElementSibling,".takeSnapshot"),ae=$e(g.nextElementSibling,".recordMedia");$e(g.nextElementSibling?.nextElementSibling,"div.recordedMedia").hidden=!0;const ie=$e(O,"canvas.visualizer");let ne,oe;switch(M.$screenShare=!1,g.value){case"audio-and-video":ne={video:!0,audio:!0},M.hidden=!1,J.hidden=!1,ae.textContent="Record video/audio";break;case"video":ne={video:!0},M.hidden=!1,J.hidden=!1,ae.textContent="Record video";break;case"audio":ne={audio:!0},M.hidden=!0,J.hidden=!0,ae.textContent="Record audio";break;case"screenShare":oe={video:!0};case"screenShareAndVideo":oe||(oe={video:!0,audio:!0}),M.$screenShare=!0,M.hidden=!0,J.hidden=!0,ie.hidden=!0;break;default:return}if(ne){const g=await getUserMedia(ne);if(!g)return void await dialogs.alert("Error getting user media");if(O.hidden=!1,M.srcObject=g,M.$stream=g,ne.video){const g=$e(O,"canvas.recordedImage");M.addEventListener("canplay",(()=>{g.setAttribute("width",String(M.videoWidth)),g.setAttribute("height",String(M.videoHeight))}))}M.addEventListener("loadedmetadata",(()=>{M.play(),ne?.audio?(ie.hidden=!1,visualize(g,ie)):ie.hidden=!0}))}else if(oe){const g=await startScreenCapture(oe);if(!g)return void await dialogs.alert("Error getting user media");O.hidden=!1,M.srcObject=g,M.$stream=g}}}},[["option",{value:""},["Please choose a device"]]]);return(async()=>{const O=await navigator.mediaDevices.enumerateDevices();let L=!1,M=!1;O.forEach((g=>{switch(g.kind){case"audioinput":L=!0;break;case"videoinput":M=!0}})),L&&jml("option",{value:"audio"},["Microphone only"],g),M&&jml("option",{value:"video"},["Video camera only"],g),L&&M&&jml("option",{value:"audio-and-video"},["Video camera and microphone"],g),jml("option",{value:"screenShare"},["Screen share"],g),jml("option",{value:"screenShareAndVideo"},["Screen share and microphone"],g)})(),g})()," ",["div",[["button",{class:"recordMedia",$on:{click(g){g.preventDefault();const O=$e(this.parentElement?.nextElementSibling,"video.previewMedia");if(!O.srcObject)return void dialogs.alert("No stream found to record");const L=this.parentElement?.nextElementSibling;$e(L,"img.photo").hidden=!0;const M="video/mp4",J=new MediaRecorder(O.$stream,{mimeType:M});let ae=[];J.addEventListener("dataavailable",(g=>{ae.push(g.data)}));try{J.start()}catch{return void dialogs.alert("Error starting media recorder")}J.addEventListener("stop",(()=>{const g=new Blob(ae,{type:M}),O=URL.createObjectURL(g),L=$e(this.parentElement?.nextElementSibling,"video.recordedMedia");L.parentElement.hidden=!1,L.src=O,L.addEventListener("loadeddata",(()=>{/iPad|iPhone|iPod|Safari/u.test(navigator.userAgent)||URL.revokeObjectURL(O)}));const J=this.closest('[data-type="blob"]');$e(J,"fieldset.blobMetaData").$setValue(g),ae=[]})),this.$mediaRecorder=J}}},["Record media"]],["button",{class:"stopRecording",$on:{click(g){g.preventDefault(),this.previousElementSibling.$mediaRecorder.stop()}}},["Stop recording"]],["button",{class:"takeSnapshot",hidden:!0},{$on:{click(g){g.preventDefault();const O=this.parentElement?.nextElementSibling;$e(O,".recordedMedia").hidden=!0;const L=$e(O,"canvas.recordedImage"),M=L.getContext("2d"),J=$e(O,"video.previewMedia");M.drawImage(J,0,0,L.width,L.height);const ae=$e(O,"img.photo");L.toBlob((g=>{if(!g)return void dialogs.alert("Error converting canvas to Blob");const O=jml("img",{class:"photo"}),L=URL.createObjectURL(g);O.addEventListener("load",(()=>{URL.revokeObjectURL(L)}));const M=this.closest('[data-type="blob"]');$e(M,"fieldset.blobMetaData").$setValue(g),O.src=L,ae.replaceWith(O)}))}}},["Take and use snapshot as blob"]]]],["div",{class:"videoContainer",hidden:!0},[["canvas",{class:"visualizer",hidden:!0}],["br"],["video",{class:"previewMedia"}],["div",[["canvas",{hidden:!0,class:"recordedImage"}],["img",{class:"photo"}]]],["div",{class:"recordedMedia"},[...(()=>{const g=jml("video",{class:"recordedMedia"});return[g,["br"],jml("button",{class:"play",$on:{click(O){O.preventDefault(),g.play()}}},["Play"]),jml("button",{class:"pause",$on:{click(O){O.preventDefault(),g.pause()}}},["Pause"]),jml("button",{class:"replay",$on:{click(O){O.preventDefault(),g.pause(),g.currentTime=0,g.play()}}},["Replay"])]})()]]]]]]]]};let domExceptionNameId=0;const domexceptionType={option:["DOMException"],stringRegex:/^DOMException\((.*)\)$/u,valueMatch:g=>"DOMException"===toStringTag(g),toValue(g){const{message:O,name:L}=JSON.parse(g);return{value:new DOMException(O,L)}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){$e(g,".message").value=O.message,$e(g,".name").value=O.name},getValue({root:g}){const O=$e(g,".message").value,L=$e(g,".name").value;return new DOMException(O,L)},viewUI:({value:g,specificSchemaObject:O})=>["div",{dataset:{type:"domexception"},title:O?.description??"(a `DOMException`)"},[["b",["Message "]],g.message,["br"],["b",["Name "]],g.name,["br"],["b",["Code "]],g.code]],editUI:({typeNamespace:g,specificSchemaObject:O,value:L=""})=>(domExceptionNameId++,["div",{dataset:{type:"domexception"},title:O?.description??"DOMException"},[["label",["Name: ",["input",{class:"name",list:`domExceptionNames-${domExceptionNameId}`,name:`${g}-domexception-name`,value:L?.name??"",size:30,placeholder:"(Optional predefined name)"}]]],["datalist",{id:`domExceptionNames-${domExceptionNameId}`,class:"predefinedNames"},["IndexSizeError","HierarchyRequestError","WrongDocumentError","InvalidCharacterError","NoModificationAllowedError","NotFoundError","NotSupportedError","InvalidStateError","InUseAttributeError","SyntaxError","InvalidModificationError","NamespaceError","InvalidAccessError","TypeMismatchError","SecurityError","NetworkError","AbortError","URLMismatchError","QuotaExceededError","TimeoutError","InvalidNodeTypeError","DataCloneError","EncodingError","NotReadableError","UnknownError","ConstraintError","DataError","TransactionInactiveError","ReadOnlyErrorVersionError","OperationError","NotAllowedError"].map((g=>["option",[g]]))],["br"],["label",["Message: ",["input",{class:"message",name:`${g}-domexception-message`,value:L?.message??""}]]]]])};let idx$3=0;const domrectType={option:["DOMRect"],childTypes:["domrectreadonly"],stringRegex:/^(?<domRectClass>DOMRect|DOMRectReadOnly)\((?<innerContent>.*)\)$/u,valueMatch:g=>["DOMRect","DOMRectReadOnly"].includes(toStringTag(g)),toValue(g,O){const{groups:{domRectClass:L}={}}=O.match,{x:M,y:J,width:ae,height:ie}=JSON.parse(g);return{value:new("DOMRect"===L?DOMRect:DOMRectReadOnly)(M,J,ae,ie)}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){$e(g,".x").value=String(O.x),$e(g,".y").value=String(O.y),$e(g,".width").value=String(O.width),$e(g,".height").value=String(O.height),"DOMRect"===toStringTag(O)?$e(g,".domrect-readonly-readwrite").checked=!0:$e(g,".domrect-readonly-readonly").checked=!0},getValue({root:g}){const O=Number($e(g,".x").value),L=Number($e(g,".y").value),M=Number($e(g,".width").value),J=Number($e(g,".height").value);return new($e(g,".domrect-readonly-readwrite").checked?DOMRect:DOMRectReadOnly)(O,L,M,J)},viewUI({value:g,specificSchemaObject:O}){const L="DOMRect"===toStringTag(g);return["div",{dataset:{type:"domrect"},title:O?.description?`(a \`${L?"DOMRect":"DOMRectReadOnly"}\`)`:void 0},[["b",{class:"emphasis"},[O?.description??(L?"DOMRect":"DOMRectReadOnly")]],["br"],["b",["x "]],g.x,["br"],["b",["y "]],g.y,["br"],["b",["width "]],g.width,["br"],["b",["height "]],g.height]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L={x:"",y:"",width:"",height:""}}){idx$3++;const M="any";return["div",{dataset:{type:"domrect"},title:O?.description??"DOMRect"},[["div",[["label",[["input",{type:"radio",class:"domrect-readonly-readwrite",name:`${g}-domrect-readonly-${idx$3}`,value:"readwrite",checked:"DOMRectReadOnly"!==toStringTag(L)}],"Readwrite"]]," ",["label",[["input",{type:"radio",class:"domrect-readonly-readonly",name:`${g}-domrect-readonly-${idx$3}`,value:"readonly",checked:"DOMRectReadOnly"===toStringTag(L)}],"Read-only"]]]],["label",["x: ",["input",{type:"number",step:M,class:"x",name:`${g}-domrect-x`,value:L.x}]]],["br"],["label",["y: ",["input",{type:"number",step:M,class:"y",name:`${g}-domrect-y`,value:L.y}]]],["br"],["label",["width: ",["input",{type:"number",step:M,class:"width",name:`${g}-domrect-width`,value:L.width}]]],["br"],["label",["height: ",["input",{type:"number",step:M,class:"height",name:`${g}-domrect-height`,value:L.height}]]]]]}};let idx$2=0;const dompointType={option:["DOMPoint"],childTypes:["dompointreadonly"],stringRegex:/^(?<domPointClass>DOMPoint|DOMPointReadOnly)\((?<innerContent>.*)\)$/u,valueMatch:g=>["DOMPoint","DOMPointReadOnly"].includes(toStringTag(g)),toValue(g,O){const{groups:{domPointClass:L}={}}=O.match,{x:M,y:J,z:ae,w:ie}=JSON.parse(g);return{value:new("DOMPoint"===L?DOMPoint:DOMPointReadOnly)(M,J,ae,ie)}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){$e(g,".x").value=String(O.x),$e(g,".y").value=String(O.y),$e(g,".z").value=String(O.z),$e(g,".w").value=String(O.w),"DOMPoint"===toStringTag(O)?$e(g,".dompoint-readonly-readwrite").checked=!0:$e(g,".dompoint-readonly-readonly").checked=!0},getValue({root:g}){const O=Number($e(g,".x").value),L=Number($e(g,".y").value),M=Number($e(g,".z").value),J=Number($e(g,".w").value);return new($e(g,".dompoint-readonly-readwrite").checked?DOMPoint:DOMPointReadOnly)(O,L,M,J)},viewUI({value:g,specificSchemaObject:O}){const L="DOMPoint"===toStringTag(g);return["div",{dataset:{type:"dompoint"},title:O?.description?`(a \`${L?"DOMPoint":"DOMPointReadOnly"}\`)`:void 0},[["b",{class:"emphasis"},[O?.description??(L?"DOMPoint":"DOMPointReadOnly")]],["br"],["b",["x "]],g.x,["br"],["b",["y "]],g.y,["br"],["b",["z "]],g.z,["br"],["b",["w "]],g.w]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L={x:"",y:"",z:"",w:""}}){idx$2++;const M="any";return["div",{dataset:{type:"dompoint"},title:O?.description??"DOMPoint"},[["div",[["label",[["input",{type:"radio",class:"dompoint-readonly-readwrite",name:`${g}-dompoint-readonly-${idx$2}`,value:"readwrite",checked:"DOMPointReadOnly"!==toStringTag(L)}],"Readwrite"]]," ",["label",[["input",{type:"radio",class:"dompoint-readonly-readonly",name:`${g}-dompoint-readonly-${idx$2}`,value:"readonly",checked:"DOMPointReadOnly"===toStringTag(L)}],"Read-only"]]]],["label",["x: ",["input",{type:"number",step:M,class:"x",name:`${g}-dompoint-x`,value:L.x}]]],["br"],["label",["y: ",["input",{type:"number",step:M,class:"y",name:`${g}-dompoint-y`,value:L.y}]]],["br"],["label",["z: ",["input",{type:"number",step:M,class:"z",name:`${g}-dompoint-z`,value:L.z}]]],["br"],["label",["w: ",["input",{type:"number",step:M,class:"w",name:`${g}-dompoint-w`,value:L.w}]]]]]}};let idx$1=0;const dommatrixType={option:["DOMMatrix"],childTypes:["dommatrixreadonly"],stringRegex:/^(?<domMatrixClass>DOMMatrix|DOMMatrixReadOnly)\((?<innerContent>.*)\)$/u,valueMatch:g=>["DOMMatrix","DOMMatrixReadOnly"].includes(toStringTag(g)),toValue(g,O){const{groups:{domMatrixClass:L}={}}=O.match,M=JSON.parse(g),J="DOMMatrix"===L?DOMMatrix:DOMMatrixReadOnly;return{value:Object.hasOwn(M,"a")?new J([M.a,M.b,M.c,M.d,M.e,M.f]):new J([M.m11,M.m12,M.m13,M.m14,M.m21,M.m22,M.m23,M.m24,M.m31,M.m32,M.m33,M.m34,M.m41,M.m42,M.m43,M.m44])}},getInput:({root:g})=>$e(g,"input"),setValue({root:g,value:O}){const{is2D:L}=O;$e(g,".d2").checked=L,$e(g,".d3").checked=!L,$e(g,".holder2d").hidden=!L,$e(g,".holder3d").hidden=L,L?($e(g,".a").value=O.a,$e(g,".b").value=O.b,$e(g,".c").value=O.c,$e(g,".d").value=O.d,$e(g,".e").value=O.e,$e(g,".f").value=O.f):($e(g,".m11").value=O.m11,$e(g,".m12").value=O.m12,$e(g,".m13").value=O.m13,$e(g,".m14").value=O.m14,$e(g,".m21").value=O.m21,$e(g,".m22").value=O.m22,$e(g,".m23").value=O.m23,$e(g,".m24").value=O.m24,$e(g,".m31").value=O.m31,$e(g,".m32").value=O.m32,$e(g,".m33").value=O.m33,$e(g,".m34").value=O.m34,$e(g,".m41").value=O.m41,$e(g,".m42").value=O.m42,$e(g,".m43").value=O.m43,$e(g,".m44").value=O.m44),"DOMMatrix"===toStringTag(O)?$e(g,".dommatrix-readonly-readwrite").checked=!0:$e(g,".dommatrix-readonly-readonly").checked=!0},getValue({root:g}){const O=$e(g,".dommatrix-readonly-readwrite").checked?DOMMatrix:DOMMatrixReadOnly,L=$e(g,".a").value;if(L){return new O([Number(L),Number($e(g,".b").value),Number($e(g,".c").value),Number($e(g,".d").value),Number($e(g,".e").value),Number($e(g,".f").value)])}return new O([Number($e(g,".m11").value),Number($e(g,".m12").value),Number($e(g,".m13").value),Number($e(g,".m14").value),Number($e(g,".m21").value),Number($e(g,".m22").value),Number($e(g,".m23").value),Number($e(g,".m24").value),Number($e(g,".m31").value),Number($e(g,".m32").value),Number($e(g,".m33").value),Number($e(g,".m34").value),Number($e(g,".m41").value),Number($e(g,".m42").value),Number($e(g,".m43").value),Number($e(g,".m44").value)])},viewUI({value:g,specificSchemaObject:O}){const L="DOMMatrix"===toStringTag(g);return["div",{dataset:{type:"dommatrix"}},[["b",{class:"emphasis",title:O?.description?`(a \`${L?"DOMMatrix":"DOMMatrixReadOnly"}\`)`:void 0},[O?.description??(L?"DOMMatrix":"DOMMatrixReadOnly")]],g.is2D?["div",[["b",["a "]],g.a,["br"],["b",["b "]],g.b,["br"],["b",["c "]],g.c,["br"],["b",["d "]],g.d,["br"],["b",["e "]],g.e,["br"],["b",["f "]],g.f]]:["div",[["b",["m11 "]],g.m11,["br"],["b",["m12 "]],g.m12,["br"],["b",["m13 "]],g.m13,["br"],["b",["m14 "]],g.m14,["br"],["b",["m21 "]],g.m21,["br"],["b",["m22 "]],g.m22,["br"],["b",["m23 "]],g.m23,["br"],["b",["m24 "]],g.m24,["br"],["b",["m31 "]],g.m31,["br"],["b",["m32 "]],g.m32,["br"],["b",["m33 "]],g.m33,["br"],["b",["m34 "]],g.m34,["br"],["b",["m41 "]],g.m41,["br"],["b",["m42 "]],g.m42,["br"],["b",["m43 "]],g.m43,["br"],["b",["m44 "]],g.m44]]]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L={}}){idx$1++;const{is2D:M}=L;return["div",{dataset:{type:"dommatrix"},title:O?.description??"DOMMatrix"},[["div",[["label",[["input",{type:"radio",class:"dommatrix-readonly-readwrite",name:`${g}-dommatrix-readonly-${idx$1}`,value:"readwrite",checked:"DOMMatrixReadOnly"!==toStringTag(L)}],"Readwrite"]]," ",["label",[["input",{type:"radio",class:"dommatrix-readonly-readonly",name:`${g}-dommatrix-readonly-${idx$1}`,value:"readonly",checked:"DOMMatrixReadOnly"===toStringTag(L)}],"Read-only"]]]],["div",{$on:{click(g){const{target:O}=g;if("radio"!==O.type)return;const L=this.parentElement;$e(L,".holder2d").hidden="3d"===O.value,$e(L,".holder3d").hidden="2d"===O.value}}},[["label",["2d",["input",{class:"d2",type:"radio",name:`${g}-dommatrix-dimension-${idx$1}`,value:"2d",checked:Boolean(M)}]]]," ",["label",["3d",["input",{class:"d3",type:"radio",name:`${g}-dommatrix-dimension-${idx$1}`,value:"3d",checked:!M}]]]]],["div",{class:"holder2d",hidden:!M},["a","b","c","d","e","f"].flatMap((O=>[["br"],["label",[O+": ",["input",{type:"number",step:"any",class:O,name:`${g}-dommatrix-${O}`,value:L[O]??""}]]]])).slice(1)],["div",{class:"holder3d",hidden:Boolean(M)},["m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44"].flatMap((O=>[["br"],["label",[O+": ",["input",{type:"number",step:"any",class:O,name:`${g}-dommatrix-${O}`,value:L[O]??""}]]]])).slice(1)]]]}},dataViewMethods=["setInt8","setUint8","setInt16","setUint16","setInt32","setUint32","setFloat32","setFloat64","setBigInt64","setBigUint64"],typedArrays=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],getMinMaxForTypedArray=g=>{switch(g){case"Int8Array":return{min:-128,max:127};case"Uint8Array":case"Uint8ClampedArray":return{min:0,max:255};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":return{min:-34e37,max:34e37};case"Float64Array":return{min:-Infinity,max:Infinity};case"BigInt64Array":return{min:-(2**63),max:2**63-1};case"BigUint64Array":return{min:0,max:2**64-1};default:throw new Error("Unexpected typed array type")}},getTypedArray=g=>{switch(g){case"Int8Array":return Int8Array;case"Uint8Array":return Uint8Array;case"Uint8ClampedArray":return Uint8ClampedArray;case"Int16Array":return Int16Array;case"Uint16Array":return Uint16Array;case"Int32Array":return Int32Array;case"Uint32Array":return Uint32Array;case"Float32Array":return Float32Array;case"Float64Array":return Float64Array;case"BigInt64Array":return BigInt64Array;case"BigUint64Array":return BigUint64Array;default:throw new Error("Unexpected type")}},bufferSourceClasses=new Set(["ArrayBuffer","DataView","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]);let idx=0;const buffersourceType={option:["Buffer source (ArrayBuffer, DataView, TypedArrays)"],childTypes:["arraybuffer","dataview","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","bigint64array","biguint64array"],stringRegex:/^(?<bufferSourceClass>ArrayBuffer|DataView|(?:Int8|Uint8|Uint8Clamped|Int16|Uint16|Int32|Uint32|Float32|Float64|BigInt64|BigUint64)Array)\((?<innerContent>.*)\)$/u,valueMatch:g=>bufferSourceClasses.has(toStringTag(g)),toValue(g,O){const{groups:{bufferSourceClass:L}={}}=O.match,M=JSON.parse(g),{byteLength:J,maxByteLength:ae,byteOffset:ie,dataViewByteOffset:ne,dataViewByteLength:oe,length:pe}=M,le=new ArrayBuffer(J,{maxByteLength:ae});let ue,de,he;return(L.endsWith("Array")||"typedArray"in M)&&(de=getTypedArray(M.typedArray??L),ue=new de(le,ie,pe),"set"in M&&(M.set[0].forEach(((g,O)=>{"string"==typeof g&&(M.set[0][O]=BigInt(g))})),ue.set(...M.set))),("DataView"===L||dataViewMethods.some((g=>g in M)))&&(he=new DataView(le,ne,oe),dataViewMethods.forEach((g=>{M[g]?.forEach((O=>{"string"==typeof O[1]&&(O[1]=BigInt(O[1])),he[g](...O)}))}))),{value:"ArrayBuffer"===L?le:"DataView"===L?he:ue}},getInput:({root:g})=>$e(g,".byteLength"),setValue({root:g,value:O}){const L=toStringTag(O);if("ArrayBuffer"===L||"DataView"===L)$e(g,`[value=${L}].buffersource-returnType`)?.click();else{$e(g,"[value=TypedArray].buffersource-returnType")?.click();const O=$e(g,".buffersource-typedArrays");O.value=L,O.dispatchEvent(new Event("change"))}const M=$e(g,".byteLength");M.$value=O;const J="ArrayBuffer"===L?O:O.buffer;M.value=J.byteLength,M.dispatchEvent(new Event("change"));const ae=$e(g,".maxByteLength");if(ae.value=J.maxByteLength,ae.dispatchEvent(new Event("change")),"DataView"===L){const L=$e(g,".dataViewByteLength");L.value=O.byteLength,L.dispatchEvent(new Event("change"));const M=$e(g,".dataViewByteOffset");M.value=O.byteOffset,M.dispatchEvent(new Event("change"))}else if("ArrayBuffer"!==L){const L=$e(g,".typedArrayByteOffset");L.value=O.byteOffset,L.dispatchEvent(new Event("change"));const M=$e(g,".typedArrayLength");M.value=O.length,M.dispatchEvent(new Event("change"))}},getValue({root:g}){return this.getInput({root:g}).$value},viewUI({value:g,specificSchemaObject:O}){const L=toStringTag(g),M="ArrayBuffer"===L?g:g.buffer;return["div",{dataset:{type:"buffersource"}},[["b",{class:"emphasis",title:O?.description?/^[aeiou]/iu.test(L)?`(an ${L})`:`(a ${L})`:void 0},[O?.description??L]],["br"],["b",["Buffer byte length: "]],M.byteLength,["br"],["b",["Buffer max byte length: "]],M.maxByteLength,..."DataView"===L?[["br"],["b",["Data View byte length: "]],g.byteLength,["br"],["b",["Data View byte offset: "]],g.byteOffset]:[""],..."DataView"!==L&&"ArrayBuffer"!==L?[["br"],["b",["Typed Array byte offset: "]],g.byteOffset,["br"],["b",["Typed Array length: "]],g.length]:[""],["br"],["button",{class:"buffersource-viewData",$on:{async click(g){g.preventDefault();const O=await dialogs.makeCancelDialog({children:[["select",{class:"buffersource-typedArrays-view","aria-label":"Typed Arrays",$on:{change(){const g=this.value,O=new(getTypedArray(g))(M),L=$e(this.parentElement,".typedArrayArea");L.textContent="",L.append(...Array.from({length:O.length},((g,L)=>jml("span",[["b",[L]]," ",["span",[O[L]?String(O[L]):"0"]]," "]))))}}},typedArrays.map((g=>["option",{selected:L===g||void 0},[g]]))],["div",{class:"typedArrayArea"}]]});$e(O,".buffersource-typedArrays-view").dispatchEvent(new Event("change"))}}},["View data"]]]]},editUI({typeNamespace:g,specificSchemaObject:O,value:L}){idx++;const M=jml("div",{dataset:{type:"buffersource"},title:O?.description??"BufferSource"},[["fieldset",{class:"returnType",$on:{change(){this.$buildInstances()}},$custom:{$buildInstances(){const O=this.parentElement,{value:L}=$e(this,`[name=${g}-buffersource-returnType-${idx}]:checked`),M=$e(O,".byteLength"),J=Number.parseInt(M.value),ae=Number.parseInt($e(O,".maxByteLength").value),ie=new ArrayBuffer(J,ae?{maxByteLength:ae}:void 0),ne=$e(O,".dataViewByteOffset").value,oe=ne?Number.parseInt(ne):0,pe=$e(O,".dataViewByteLength").value,le=pe?Number.parseInt(pe):void 0,ue=new DataView(ie,oe,le),{value:de}=$e(O,".buffersource-typedArrays-init"),he=getTypedArray(de),ye=$e(O,".typedArrayByteOffset").value,me=ye?Number.parseInt(ye):0,fe=$e(O,".typedArrayLength").value,ge=fe?Number.parseInt(fe):J,ve=new he(ie,me,ge);M.$dataView=ue,M.$typedArray=ve;const be=$$e(O,".typedArrayArea .typedArrayValue").map((g=>he.name.startsWith("Big")?BigInt(g.value):Number(g.value)));switch(M.$typedArray.set(be,0),L){case"ArrayBuffer":M.$value=ie;break;case"DataView":M.$value=ue;break;default:M.$value=ve}}}},[["legend",["Return type"]],["label",{$on:{click(){$e(this.parentElement,".buffersource-typedArrays").hidden=!0,$e(this?.parentElement?.parentElement,".buffersource-typedArrays-init").hidden=!1}}},[["input",{type:"radio",class:"buffersource-returnType buffersource-returnType-arraybuffer",name:`${g}-buffersource-returnType-${idx}`,checked:!0,value:"ArrayBuffer"}],"ArrayBuffer"]]," ",["label",{$on:{click(){$e(this.parentElement,".buffersource-typedArrays").hidden=!0,$e(this?.parentElement?.parentElement,".buffersource-typedArrays-init").hidden=!1}}},[["input",{type:"radio",class:"buffersource-returnType buffersource-returnType-dataview",name:`${g}-buffersource-returnType-${idx}`,value:"DataView"}],"DataView"]]," ",["label",{$on:{click(){$e(this.parentElement,".buffersource-typedArrays").hidden=!1,$e(this?.parentElement?.parentElement,".buffersource-typedArrays-init").hidden=!0}}},[["input",{type:"radio",class:"buffersource-returnType buffersource-returnType-typedarray",name:`${g}-buffersource-returnType-${idx}`,value:"TypedArray"}],"Typed Array"]]," ",["select",{hidden:!0,class:"buffersource-typedArrays","aria-label":"Typed Arrays",$on:{change(g){const O=this.parentElement?.parentElement,L=$e(O,".buffersource-typedArrays-init");L.value=this.value;if(!$e(O,".typedArrayLength").$checkBufferBounds(g))return;L.$setMinsAndMaxes(this.value),L.$checkTypedArrayByteLength(g);$e(this?.parentElement?.parentElement,".typedArrayByteOffset").$checkByteOffsetMultiple(g)}}},typedArrays.map((g=>["option",[g]]))]]],["fieldset",{$on:{change(){this.previousElementSibling.$buildInstances()}}},[["legend",["Construction options"]],["fieldset",[["legend",["ArrayBuffer"]],["label",["Byte length ",["input",{class:"byteLength",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$custom:{$value:L??new ArrayBuffer(0)},$on:{change(g){const O=this,L=O.parentElement?.parentElement?.parentElement?.parentElement;if(!$e(L,".typedArrayLength").$checkBufferBounds(g))return;const M=$e(O.parentElement?.parentElement,".maxByteLength"),J=O.value;if(Number.parseInt(J)>Number.MAX_SAFE_INTEGER)return O.setCustomValidity("The ArrayBuffer length exceeds the maximum allowable size"),g.stopPropagation(),void O.reportValidity();O.setCustomValidity(""),O.reportValidity(),Number.parseInt(J)>Number.parseInt(M.value)&&(M.value=J);const ae=O.parentElement?.parentElement?.parentElement;$e(ae,".dataViewByteLength").$checkDataViewByteLength(g),$e(ae.parentElement,".buffersource-typedArrays-init").$checkTypedArrayByteLength(g)}}}]]]," ",["label",["Max byte length ",["input",{class:"maxByteLength",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$on:{change(g){const O=this,L=$e(O.parentElement?.parentElement,".byteLength"),M=O.value;Number.parseInt(M)<Number.parseInt(L.value)?(O.setCustomValidity("The max value cannot be less than the byte length"),g.stopPropagation()):O.setCustomValidity(""),O.reportValidity()}}}]]]]],["fieldset",[["legend",["DataView"]],["label",["Byte length ",["input",{class:"dataViewByteLength",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$custom:{$checkDataViewByteLength(g){const O=this,L=O.parentElement?.parentElement?.parentElement,M=Number.parseInt($e(L,".dataViewByteOffset").value)||0,J=$e(L,".byteLength").value,ae=J?Number.parseInt(J):0;M+(O.value?Number.parseInt(O.value):ae)>ae?(O.setCustomValidity("The DataView byte length and offset exceed the buffer's byte length"),g.stopPropagation()):O.setCustomValidity(""),O.reportValidity()}},$on:{change(g){this.$checkDataViewByteLength(g)}}}]]]," ",["label",["Byte offset ",["input",{class:"dataViewByteOffset",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$on:{change(g){const O=this.parentElement?.parentElement?.parentElement;$e(O,".dataViewByteLength").$checkDataViewByteLength(g)}}}]]]]],["fieldset",[["legend",["Typed array"]],["label",["Byte offset ",["input",{class:"typedArrayByteOffset",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,max:2**53-1,$custom:{$checkByteOffsetMultiple(g){const O=this,L=O.parentElement?.parentElement?.parentElement?.parentElement,{value:M}=$e(L,".buffersource-typedArrays-init"),J=getTypedArray(M);Number.parseInt(O.value)%J.BYTES_PER_ELEMENT?(O.setCustomValidity(`Byte offset must be a multiple of the typed array's bytes-per-element size (${J.BYTES_PER_ELEMENT})`),g.stopPropagation()):O.setCustomValidity(""),O.reportValidity()}},$on:{change(g){const O=this.parentElement?.parentElement?.parentElement?.parentElement;$e(O,".typedArrayLength").$checkBufferBounds(g)&&this.$checkByteOffsetMultiple(g)}}}]]]]]]],["fieldset",[["legend",["Typed Array initialization (optional)"]],["select",{class:"buffersource-typedArrays-init","aria-label":"Typed Arrays",$custom:{$setMinsAndMaxes(g){const{min:O,max:L}=getMinMaxForTypedArray(g);$$e(this.parentElement,".typedArrayValue").forEach((M=>{M.className="typedArrayValue typedArray-"+g,M.min=String(O),M.max=String(L)}))},$checkTypedArrayByteLength(g){const O=getTypedArray(this.value),L=$e(this.parentElement?.parentElement,".byteLength");(L.value?Number.parseInt(L.value):0)%O.BYTES_PER_ELEMENT?(L.setCustomValidity(`Array buffer must be a multiple of the typed array's bytes-per-element size (${O.BYTES_PER_ELEMENT})`),g.stopPropagation()):L.setCustomValidity(""),L.reportValidity()}},$on:{change(g){const O=this,L=O.parentElement?.parentElement?.parentElement;$e(this.parentElement?.parentElement,".buffersource-typedArrays").value=O.value;if(!$e(L,".typedArrayLength").$checkBufferBounds(g))return;O.$checkTypedArrayByteLength(g),O.$setMinsAndMaxes(O.value);$e(O?.parentElement?.parentElement,".typedArrayByteOffset").$checkByteOffsetMultiple(g),$e(this.parentElement?.parentElement,".returnType").$buildInstances()}}},typedArrays.map((g=>["option",[g]]))]," ",["label",["Array length: ",["input",{class:"typedArrayLength",type:"number",step:"1",size:"4",pattern:String.raw`\d+`,min:0,$custom:{$checkBufferBounds(g){const O=this,L=O.parentElement?.parentElement?.parentElement,M=$e(L,".byteLength").value,J=M?Number.parseInt(M):0,ae=O.value?Number.parseInt(O.value):J,{value:ie}=$e(L,".buffersource-typedArrays-init"),ne=getTypedArray(ie),oe=$e(L,".typedArrayByteOffset").value;return(oe?Number.parseInt(oe):0)+ae*ne.BYTES_PER_ELEMENT>J?(O.setCustomValidity("The byte offset and the length times bytes per element is greater than the buffer length"),g.stopPropagation(),O.reportValidity(),!1):(O.setCustomValidity(""),O.reportValidity(),!0)},$buildTypedArray(){const g=this,O=Number.parseInt(g.value),L=g.parentElement?.parentElement,M=g.parentElement?.parentElement?.parentElement,J=$e(M,".byteLength"),ae=$e(L,".typedArrayArea");ae.addEventListener("change",(g=>{const O=g.target;J.$typedArray.set(["true"===O.dataset.bigint?BigInt(O.value):Number(O.value)],Number.parseInt(O.dataset.key))}));const{value:ie}=$e(L,".buffersource-typedArrays-init"),{min:ne,max:oe}=getMinMaxForTypedArray(ie);ae.textContent="",ae.append(...Array.from({length:O},((g,O)=>jml("label",[O," ",["input",{class:"typedArrayValue typedArray-"+ie,dataset:{key:O,bigint:String(ie.startsWith("BigInt"))},type:"number",step:"1",pattern:ie.startsWith("Float")?String.raw`\d+(?:\.\d+)?`:String.raw`\d+`,value:J.$typedArray[O]?String(J.$typedArray[O]):"0",min:ne,max:oe}]," "]))))}},$on:{change(g){const O=this,L=this.parentElement?.parentElement;if(!O.$checkBufferBounds(g))return;const{value:M}=$e(L,".buffersource-typedArrays-init"),J=Number.parseInt(O.value);try{new(getTypedArray(M))(J)}catch{return O.setCustomValidity("Typed Array length is too long"),g.stopPropagation(),void O.reportValidity()}O.setCustomValidity(""),O.reportValidity(),$e(this.parentElement?.parentElement?.parentElement,".returnType").$buildInstances(),O.$buildTypedArray()}}}],["div",{class:"typedArrayArea"}]]]]],["fieldset",[["legend",["DataView initialization (optional)"]],["select",{class:"dataViewMethod","aria-label":"Data View methods",$on:{change(){const g=$e(this.parentElement,".dataViewArea"),O=this.value,L=O.slice(3)+"Array";g.textContent="",g.append(jml("label",["Byte offset ",["input",{type:"number",class:"dataViewSetByteOffset",step:"1",size:"4",pattern:String.raw`\d+`}]])," ",jml("label",["Value ",["input",{type:"number",step:"1",size:"4",pattern:String.raw`\d+`,class:"typedArrayValue typedArray-"+L,...getMinMaxForTypedArray(L)}]]),"setInt8"===O||"setUint8"===O?"":jml("label",[["input",{class:"littleEndian",type:"checkbox"}],"Little endian"])," ",jml("button",{$on:{click(g){g.preventDefault();const O=this.parentElement,L=O.previousElementSibling?.value,M=Number.parseInt($e(O,".dataViewSetByteOffset").value),J=$e(O,".typedArrayValue").value,ae=$e(O,".littleEndian")?.checked,ie=$e(O?.parentElement?.parentElement,".byteLength");"setBigInt64"===L||"setBigUint64"===L?ie.$dataView[L](M,BigInt(J),ae):ie.$dataView[L](M,Number(J),ae);$e(O.parentElement?.parentElement,".typedArrayLength").$buildTypedArray()}}},["Set"]))}}},[["option",{value:""},["(Select a data view method)"]],...dataViewMethods.map((g=>["option",[g]]))]]," ",["div",{class:"dataViewArea"}]]]]);if(this.setValue&&L)this.setValue({root:M,value:L});else{$e(M,".byteLength").$value=new ArrayBuffer(0)}return[M]}},noneditableType={option:["Non-editable"],valueMatch:()=>!0,getInput:({root:g})=>$e(g,"button"),setValue({root:g,value:O}){this.getInput({root:g}).$value=O,$e(g,".stringTag").textContent=void 0===O?"(None)":toStringTag(O)},getValue({root:g}){return this.getInput({root:g}).$value},validate({root:g}){return{message:"The non-editable type is only for passing on pre-existing content that is unknown or currently unsupported",valid:void 0!==this.getInput({root:g}).$value}},viewUI({value:g,specificSchemaObject:O}){const L=toStringTag(g);return["div",{dataset:{type:"resurrectable"}},[["b",{class:"emphasis",title:O?.description?`(a non-editable ${L})`:void 0},[O?.description??"Non-editable"]],["span",{title:"There is no current support for editing this element's type, but its contents will be passed on transparently."},["?"]],["b",["String tag: "]],L]]},editUI:({typeNamespace:g,specificSchemaObject:O,value:L})=>["div",{dataset:{type:"resurrectable"},title:O?.description??"Non-editable"},[["a",{href:"javascript:void(0)",$on:{click(g){g.preventDefault()}},title:"There is no current support for editing this element's type, but its contents will be passed on transparently."},["?"]]," ",["button",{$on:{click(g){g.preventDefault(),console.log(this.$value)}},name:`${g}-resurrectable`,$custom:{$value:L}},["Non-editable"]],["br"],["b",["String tag: "]],["span",{class:"stringTag"},[L?toStringTag(L):"(None)"]]]]},neverType={stringRegex:/^never$/u,option:["Never"],valueMatch:()=>!1,toValue(){throw new Error("Cannot convert to value")},getValue(){return this.toValue("")},viewUI:({specificSchemaObject:g})=>["i",{dataset:{type:"never"},title:g?.description??"(a `never`)"},["never"]],getInput:({root:g})=>$e(g,"input"),editUI:({typeNamespace:g})=>["div",{dataset:{type:"never"}},[["label",["Never (no value present here)",["input",{type:"checkbox",name:`${g}-never`,hidden:!0}]]]]]},catchType={option:["Catch"],stringRegex:/^catch\((.*)\)$/u,valueMatch:g=>["number","string"].includes(typeof g),toValue:g=>({value:'"'===g.charAt(0)?g.slice(1,-1):Number(g)}),getInput:({root:g})=>$e(g,"input,textarea"),setValue({root:g,value:O}){setTimeout((()=>{this.getInput({root:g}).value=O}))},getValue({root:g}){return this.getInput({root:g}).value},viewUI:({specificSchemaObject:g,types:O,resultType:L,typeNamespace:M,topRoot:J,format:ae,bringIntoFocus:ie,buildTypeChoices:ne,replaced:oe,value:pe})=>["span",{dataset:{type:"catch"},title:g?.description??"(a catch)"},[["b",["Catch"]],["br"],"Default value",["br"],["div",{class:"defaultValue"},[O.getUIForModeAndType({readonly:!0,specificSchemaObject:g?.innerType,hasValue:!0,value:pe,resultType:L,typeNamespace:M,type:g?.innerType?.type,topRoot:J,bringIntoFocus:ie,buildTypeChoices:ne,format:ae,replaced:oe})]],"Catch value",["br"],["div",{class:"catchValue"},[O.getUIForModeAndType({readonly:!0,specificSchemaObject:{...g?.innerType,description:"(catch value)"},hasValue:!0,value:g.value,resultType:L,typeNamespace:M,type:g?.innerType?.type,topRoot:J,bringIntoFocus:ie,buildTypeChoices:ne,format:ae,replaced:oe})]]]],editUI({format:g,type:O,buildTypeChoices:L,specificSchemaObject:M,topRoot:J,schemaContent:ae,typeNamespace:ie,value:ne}){const oe=M?.value;return["div",{dataset:{type:"catch"},title:M?.description??"(a `catch`)"},[["label",[["b",{title:String(oe)},["Value"]]," ",...L({topRoot:J,format:g,setValue:!0,value:ne??oe,schemaOriginal:ae,schemaContent:M?.innerType,state:O,typeNamespace:ie}).domArray]]]]}},nativeEnumType={option:["Native enum"],stringRegex:/^nativeEnum\((.*)\)$/u,valueMatch:g=>["number","string"].includes(typeof g),toValue(g,O){const L='"'===g.charAt(0)?g.slice(1,-1):Number(g);let M=O?.schemaObject;if("union"===O?.schemaObject?.type){M=O.schemaObject.options.filter((g=>"nativeEnum"===g.type)).find((g=>L in g.values))}const J=M?.values[L];return{value:J}},getInput:({root:g})=>$e(g,"input.nativeEnumKey"),setValue({root:g,value:O}){const L=this.getInput({root:g});L.value=Object.entries(L.$schemaNativeEnumValues).find((([,g])=>g===O))?.[0]??"",L.value&&($e(g,".enumeratedValue").textContent=O)},getValue({root:g}){const{value:O,$schemaNativeEnumValues:L}=this.getInput({root:g});return L[O]},viewUI:({value:g,specificSchemaObject:O})=>["div",["Native enum: ",["span",{dataset:{type:"nativeEnum"},title:O?.description??"(a native enum)"},[g]]]],editUI(g){const{specificSchemaObject:O,value:L}=g,M=O?.values,J=Object.keys(M);let ae;M&&"value"in g&&(ae=Object.entries(M).find((([,g])=>g===L))?.[0]);const ie=J.map((g=>/^\d$/u.test(g)&&Object.values(M).includes(Number.parseInt(g))?null:escapeRegex(g))).filter(Boolean).join("|"),ne=jml("input",{class:"nativeEnumKey",placeholder:ie,title:ie,pattern:ie,value:ae??"",$on:{input(){const g=this.parentElement?.parentElement?.querySelector(".enumeratedValue");g.textContent=String(M[this.value]??"")}}});return ne.$schemaNativeEnumValues=M,["div",{dataset:{type:"nativeEnum"},title:O?.description??"Native Enum"},[["label",["Enumerated key ",ne]],["br"],"Enumerated value: ",["span",{class:"enumeratedValue"},[L??""]]]]}},symbolType={option:["Symbol"],stringRegex:/^(?<symbolClassType>Symbol|Symbol.for)\((?<innerContent>[^)]*)\)$/u,ct:0,valueMatch:g=>"symbol"==typeof g,toValue(g,O){const{groups:{symbolClassType:L}={}}=O.match;return{value:("Symbol"===L?Symbol:Symbol.for.bind(Symbol))(g)}},getInput:({root:g})=>$e(g,"input.symbolInput"),setValue({root:g,value:O}){Symbol.keyFor(O)?$e(g,'input[value="Symbol.for"]').checked=!0:$e(g,'input[value="Symbol"]').checked=!0,this.getInput({root:g}).value=String(O).slice(7,-1)},getValue({root:g}){return($e(g,'input[value="Symbol"]').checked?Symbol:Symbol.for.bind(Symbol))(this.getInput({root:g}).value)},viewUI:({value:g,specificSchemaObject:O})=>["span",{dataset:{type:"symbol"},title:O?.description??"(a Symbol)"},[void 0===Symbol.keyFor(g)?"":["b",["Global: "]],String(g).slice(7,-1)]],editUI({typeNamespace:g,specificSchemaObject:O,value:L=""}){return this.ct++,["div",{dataset:{type:"symbol"},title:O?.description??"(a Symbol)"},[["label",["Symbol()",["input",{type:"radio",name:`${g}-symbol${this.ct}`,value:"Symbol",checked:!L||!Symbol.keyFor(L)}]]],["label",["Symbol.for()",["input",{type:"radio",name:`${g}-symbol${this.ct}`,value:"Symbol.for",checked:L&&void 0!==Symbol.keyFor(L)}]]],["br"],["input",{className:"symbolInput",name:`${g}-symbol`,value:String(L).slice(7,-1)}]]]}},getTypeson=()=>{const structuredCloningFixed=se.filter((g=>!["imagedata","imagebitmap","cryptokey","domquad"].some((O=>Object.hasOwn(g,O)))));return structuredCloningFixed.splice(1,0,G),(new c).register([...structuredCloningFixed,z$1,q,{function:{test:g=>"function"==typeof g,replace:g=>"("+g.toString()+")",revive(o){return eval(o)}}}])},promiseType={option:["Promise"],regexEndings:[",",")"],stringRegexBegin:/^Promise\(/u,stringRegexEnd:/^\)/u,array:!0,valueMatch:g=>"Promise"===toStringTag(g),toValue(...g){const O=arrayType.toValue.apply(this,g);return{value:Promise.resolve(O.value[0]),remnant:O.remnant}},getInput({root:g}){const O=$e(g,"div[data-type]");return this.types?.getFormControlForRoot(O)},setValue({root:g,value:O}){setTimeout((async()=>{const L=await O,M=getTypeson(),J=await M.rootTypeName(L),ae=$e(g,"select");ae.value=J,ae.dispatchEvent(new Event("change"));const ie=$e(g,"div[data-type]");this.types?.setValue({type:J,root:ie,value:L});const ne=this.types?.getFormControlForRoot(ie);ne?.dispatchEvent(new Event("input")),ne?.blur()}))},getValue({root:g}){const O=$e(g,"div[data-type]");return Promise.resolve(this.types?.getValueForRoot(O))},viewUI({specificSchemaObject:g,types:O,value:L,...M}){const J=getTypeson(),ae=jml("span"),ie=jml("div");return(async()=>{const ne=await L,oe=await J.rootTypeName(ne);ae.textContent=oe;const pe=O.getTypeObject(oe);ie.append(jml(...pe.viewUI({specificSchemaObject:g,types:O,value:ne,...M})))})(),["span",{dataset:{type:"promise"},title:g?.description},["A Promise ",ae,ie]]},editUI({format:g,types:O,type:L,buildTypeChoices:M,specificSchemaObject:J,topRoot:ae,schemaContent:ie,typeNamespace:ne,value:oe}){this.types=O;const pe=jml("div",{dataset:{type:"promise"},title:J?.description??"(a Promise)"},["Promise ",...M({topRoot:ae,format:g,schemaOriginal:ie,schemaContent:J?.value??{type:"any"},state:L,typeNamespace:ne}).domArray]);return oe&&this.setValue&&this.setValue({root:pe,value:oe}),[pe]}},observerMap=new WeakMap,idRegex=String.raw`^(?:[$_\p{ID_Start}])(?:[$_\u200C\u200D\p{ID_Continue}])*$`,setTooltips=({root:g,specificSchemaObject:O,textareas:L,textareaBody:M})=>{M.title=`Return type:\n\n${JSON.stringify(O.returns,null,2)}`;const J=O.args;if(L.forEach(((g,O)=>{g.title=JSON.stringify(J.items[O]??J.rest,null,2)})),observerMap.has(g))return;const addTitles=O=>{if(O.nodeType!==Node.ELEMENT_NODE)return;if(O.querySelector("textarea")){$$e(g,"textarea").slice(0,-1).forEach(((g,O)=>{g.title=JSON.stringify(J.items[O]??J.rest,null,2)}))}},ae=new MutationObserver((g=>{for(const O of g)if("childList"===O.type){for(const g of O.removedNodes)addTitles(g);for(const g of O.addedNodes)addTitles(g)}}));ae.observe(g,{attributes:!1,childList:!0,subtree:!0}),observerMap.set(g,ae)},getArgsAndBodyOfFunction=g=>{const O=String(g),L=String(`(${O.trimStart().startsWith("function")?O:`function ${O}`})`),M=L.slice(L.indexOf("{")+1,L.lastIndexOf("}")).trim();return{args:parse(L,{ecmaVersion:"latest",sourceType:"module"}).body[0].expression.params.map((({name:g})=>g.trim())),body:M}},setValueAndTooltips=({root:g,value:O,specificSchemaObject:L})=>{const{args:M,body:J}=getArgsAndBodyOfFunction(O);setTimeout((()=>{let ae=$$e(g,'textarea[name$="-string"]');const ie=ae.pop();M.forEach(((O,L)=>{ae[L]||$e(g,".addArrayElement")?.click()})),setTimeout((()=>{ae=$$e(g,'textarea[name$="-string"]').slice(0,-1),O&&(M.forEach(((g,O)=>{ae[O].value=g})),ie.value=J),L&&setTooltips({root:g,specificSchemaObject:L,textareas:ae,textareaBody:ie})}))}))},functionType={option:["function"],regexEndings:["}"],stringRegexBegin:/^function\((?<args>[^)]*?)\) \{(?<returns>.*)\}$/u,stringRegexEnd:/^\}/u,array:!0,valueMatch:g=>"function"==typeof g,toValue(g,O){const{groups:{args:L,returns:M}={}}=O.match;return{value:new Function(...L.split(/\s*,\s*/u),M)}},getInput:({root:g})=>$e(g,"textarea"),setValue({root:g,value:O}){setValueAndTooltips({root:g,value:O})},getValue({root:g}){const O=$$e(g,"textarea"),L=O.pop();return new Function(...O.map((({value:g})=>g.trim())),L.value.trim())},viewUI({value:g,specificSchemaObject:O}){const{args:L,body:M}=getArgsAndBodyOfFunction(g);return["span",{dataset:{type:"function"},title:O?.description??"(a function)"},[["b",["Args"]]," ",`(${L.join(", ")})`,["br"],["b",["Body"]]," ",M]]},editUI({type:g,buildTypeChoices:O,specificSchemaObject:L,topRoot:M,typeNamespace:J,value:ae}){const ie=L?copyObject(L):void 0,ne=ie?.args??{type:"tuple",items:[],rest:{type:"any"}};ne.description="",ne.rest&&(ne.rest.description="Argument");const oe=ne.items.length,pe={type:"set",minSize:oe,maxSize:ne.rest?void 0:oe,value:{type:"string",regex:idRegex,flags:"v"}},le=jml("div",{dataset:{type:"function"}},[["b",["Arguments"]],["br"],...O({topRoot:M,format:"schema",schemaContent:pe,state:g,typeNamespace:J}).domArray,["b",["Function body"]],["br"],...O({topRoot:M,format:"schema",schemaContent:{type:"string"},state:g,typeNamespace:J}).domArray]);return ae?setTimeout((()=>{setValueAndTooltips({root:le,value:ae,specificSchemaObject:L})})):L&&setTimeout((()=>{setTimeout((()=>{const g=$$e(le,"textarea"),O=g.pop();setTooltips({root:le,specificSchemaObject:L,textareas:g,textareaBody:O})}))})),[le]}},getPropertyValueFromLegend=g=>{const O=$e(g,'*[data-prop="true"]');if(!O)throw new Error("No property on the supplied legend element");if("input"===O.nodeName.toLowerCase())return O.value;if(!O.textContent)throw new Error("No property with text present on the supplied legend element");return String(Number.parseInt(O.textContent)-1)};class Types{constructor(){this.formats=new Formats,this.customValidateAllReferences=void 0,this.availableTypes={null:nullType,true:trueType,false:falseType,nan:nanType,boolean:booleanType,number:numberType,bigint:bigintType,bigintObject:bigintObjectType,string:stringType,arrayReference:arrayReferenceType,objectReference:objectReferenceType,array:arrayType,tuple:tupleType,object:objectType,record:recordType,date:dateType,enum:enumType,userObject:["User objects"],undef:undefinedType,void:voidType,SpecialRealNumber:SpecialRealNumberSuperType,SpecialNumber:SpecialNumberSuperType,error:errorType,errors:errorsSpecialType,regexp:regexpType,BooleanObject:BooleanObjectType,NumberObject:NumberObjectType,StringObject:StringObjectType,literal:literalType,map:mapType,set:setType,file:fileType,filelist:filelistType,blob:blobType,blobHTML:blobHTMLType,domexception:domexceptionType,domrect:domrectType,dompoint:dompointType,dommatrix:dommatrixType,resurrectable:noneditableType,never:neverType,symbol:symbolType,promise:promiseType,function:functionType,catch:catchType,nativeEnum:nativeEnumType,buffersource:buffersourceType,dataview:{option:["DataView"]},imagedata:{option:["ImageData"]},imagebitmap:{option:["ImageBitmap"]},int8array:{option:["Int8Array"]},uint8array:{option:["Uint8Array"]},uint8clampedarray:{option:["Uint8ClampedArray"]},int16array:{option:["Int16Array"]},uint16array:{option:["Uint16Array"]},int32array:{option:["Int32Array"]},uint32array:{option:["Uint32Array"]},float32array:{option:["Float32Array"]},float64array:{option:["Float64Array"]},ValidDate:{valid:!0},arrayNonindexKeys:{sparse:!0}};(g=>{g.forEach((([g,O])=>{Object.assign(this.availableTypes[O],this.availableTypes[g])}))})([["date","ValidDate"],["array","arrayNonindexKeys"]]),this.contexts={},Object.entries(this.availableTypes).forEach((([g,O])=>{const L=g,{stateDependent:M}=O;M&&Object.entries(M).forEach((([g,O])=>{this.contexts[g]||(this.contexts[g]={});const{contexts:M,after:J}=O;M.forEach((O=>{this.contexts[g][O]||(this.contexts[g][O]=[]),this.contexts[g][O].push({type:L,after:J})}))}))}))}async getControlsForFormatAndValue(g,O,L){return(await this.formats.getControlsForFormatAndValue(this,g,O,L)).rootUI}getContextInfo(g,O){return this.contexts[g][O]}getValueForRoot(g,O,L){return this.availableTypes[Types.getTypeForRoot(g)].getValue({root:g,stateObj:O??{types:this},currentPath:L})}getFormControlForRoot(g){const O=this.availableTypes[Types.getTypeForRoot(g)];return O.getInput?O.getInput({root:g}):null}getValueFromRootAncestor(g,O){return this.getValueForRoot($e(g,"div[data-type]"),{...O,types:this,formats:this.formats})}getFormControlFromRootAncestor(g){const O=$e(g,"div[data-type]");return O?this.getFormControlForRoot(O):null}getOptionForType(g,O=void 0){const L=[...this.availableTypes[g].option];return O&&O.description&&(L[0]=`${L[0]} (${O.description})`),L[1]={value:g,...L[1]},L}getTypeOptionsForFormatAndState(g,O,L,M){const J=this.formats.getTypesAndSchemasForFormatAndState(this,g,O,L,M);if(!J)throw new Error("Unexpected type for format and state");return{typeOptions:J.types.map(((g,O)=>this.getOptionForType(g,J.schemaObjects[O]))),schemaObjects:J.schemaObjects}}getUIForModeAndType({readonly:g,resultType:O,typeNamespace:L,type:M,topRoot:J,bringIntoFocus:ae,buildTypeChoices:ie,format:ne,schemaContent:oe,value:pe,hasValue:le,replaced:ue,specificSchemaObject:de,schemaFallingBack:he}){const ye=this.availableTypes[M],me=le?{typeNamespace:L,type:M,buildTypeChoices:ie,format:ne,schemaContent:oe,resultType:O,topRoot:J,bringIntoFocus:ae,value:pe,replaced:ue,specificSchemaObject:de,schemaFallingBack:he,types:this}:{typeNamespace:L,type:M,buildTypeChoices:ie,format:ne,schemaContent:oe,resultType:O,topRoot:J,bringIntoFocus:ae,replaced:ue,specificSchemaObject:de,schemaFallingBack:he,types:this},fe=jml(...g?ye.viewUI(me):ye.editUI(me));if(!g&&ye.validate){ye.getInput({root:fe}).addEventListener("input",(()=>{this.validate({type:M,root:fe,topRoot:J})}))}return fe}validateAllReferences({topRoot:g}){g?(Object.values(this.availableTypes).forEach((O=>{const L=O;L.validateAll&&L.validateAll({topRoot:g,types:this})})),this.customValidateAllReferences&&this.customValidateAllReferences({topRoot:g})):console.log("No references present")}validate({type:g,root:O,topRoot:L,avoidReport:M}){const J=this.availableTypes[g];if(J.validate){const{valid:g,message:ae}=J.validate({root:O,topRoot:L}),ie=J.getInput({root:O});return ie.setCustomValidity(g?"":ae||"Invalid"),M||ie.reportValidity(),g}return!0}setValue({type:g,root:O,value:L}){const M=this.availableTypes[g];M.setValue&&M.setValue({root:O,value:L})}getValueForString(g,{format:O,state:L,endMatchTypeObjs:M=[],firstRun:J=!0,rootHolder:ae=[],parent:ie,parentPath:ne,schemaObject:oe,schemaOriginal:pe}){const le=this.formats.getTypesAndSchemasForFormatAndState(this,O,L,oe,pe)?.types;if(!le)throw new Error("Could not get types for format and state");const ue=Object.entries(this.availableTypes).filter((([g])=>le.includes(g))),de="|"+ue.map((([,g])=>g)).reduce(((g,O)=>{const L=O;let M=g;return L.regexEndings&&(M.push(...L.regexEndings),M=[...new Set(M)]),M}),[]).map((g=>escapeRegex(g))).join("|");let he=null,ye=ue.find((([,O])=>{const L=O;let{stringRegex:M}=L;return"function"==typeof L.stringRegex&&(M=L.stringRegex(!0)),M=M?new RegExp(M.source.slice(0,-1)+"(?=$"+de+")","u"):M,he=Boolean(M&&g)&&g.match(M),he})),me=!1;void 0===ye&&(ye=ue.find((([,O])=>{const L=O,{stringRegexBegin:J}=L;return he=Boolean(J&&g)&&g.match(J),he&&(me=!0,M.push(L)),he})));let fe=!0;if(void 0!==ye){const L=he,[pe,le]=L;let ue,de=g.slice(pe.length);g=g.slice(0,pe.length);try{const J=ye[1];if(!J.toValue)throw new Error("Type has no `toValue` method");ue=J.toValue(L.groups?.innerContent||le||g,{types:this,format:O,match:he,endMatchTypeObjs:M,remnant:de,rootHolder:ae,parent:ie,parentPath:ne,schemaObject:oe})}catch(g){throw console.log("eee",g),g}!1===ue.assign&&(fe=!1);const{value:ge}=ue;if(void 0!==ue.remnant&&({remnant:de}=ue),me&&M.length){const g=de.match(M.at(-1).stringRegexEnd);g&&(M.pop(),de=de.slice(g[0].length))}if(J){const g=(new c).register(se);try{const O=g.revive(ge);return ae.forEach((([g,L,M,J])=>{const ae=this.availableTypes[g+"Reference"].resolveReference(J,O),ie=getJSONType(ae);["array","object"].includes(g)&&ie===g&&(L[M]=ae)})),[O,de,me,fe]}catch(g){console.log("failed Typeson revival",g)}}return[ge,de,me,fe]}throw new Error("Bad parsing data")}getTypeObject(g){return this.availableTypes[g]}}function escapeRegex(g){return String(g).replaceAll(/[.\\+*?^[\]$(){}=!<>|:-]/gu,String.raw`\$&`)}Types.getTypeForRoot=g=>String(g?g.dataset.type:g),Types.validValuesSet=({form:g,typeNamespace:O,keySelectClass:L})=>{if(!g.offsetParent||!g.checkValidity())return!1;return $$e(g,L?`.${L}`:`.typeChoices-${O}`).every((g=>!g.offsetParent||""!==g.value&&g.$validate()))};const getFormatAndSchemaChoices=({schemas:g,selectedSchema:O,hasKeyPath:L,preselectSchema:M,arbitraryJS:J=!1}={})=>{const ae=g&&g.length;return[["JSON only",{value:"json"}],...L?[]:[["IndexedDB key",{value:"indexedDBKey"}]],["Structured Clone (via Typeson JSON)",{value:"structuredCloning",selected:!(M&&ae||J)}],...J?[["Arbitrary JavaScript Object",{value:"arbitraryJS",selected:!M||!ae}]]:[],...ae?g.map(((g,L)=>[`Schema: ${g}`,{value:"schema",dataset:{schema:g},selected:M?O?g===O:0===L:void 0}])):[]].map((([g,O])=>jml("option",O,[g]))).reduce(((g,O)=>(g.append(O),g)),document.createDocumentFragment())};async function formatAndTypeChoices({schemas:g,getSchemaContent:O,hasValue:L,singleValue:M,hasKeyPath:J,arbitraryJS:ae=!1,preselectSchema:ie=!0,typeNamespace:ne,selectedSchema:oe,formats:pe=new Formats,types:le=new Types}){const ue=ie&&g&&g.length?"schema":ae?"arbitraryJS":"structuredCloning",de=jml("select",{class:"formatChoices",hidden:M,$custom:{async $setFormat({valueFormat:g,autoTrigger:O,schema:L}){if(L){const g=[...this.options].findIndex((g=>g.dataset.schema===L));this.selectedIndex=-1===g?0:g}else g&&(this.value=g);await this.$buildTypeChoices(O)},async $buildTypeChoices(g){DOM.removeChildren(he);const{schema:M}=this.selectedOptions[0].dataset;jml({"#":buildTypeChoices({autoTrigger:g,topRoot:$e(he,"div[data-type]"),format:this.value,formats:pe,types:le,typeNamespace:ne,requireObject:J,objectHasValue:L,schema:M,schemaContent:M?await(O?.(M)):void 0}).domArray},he)}},$on:{async change(){await this.$buildTypeChoices()}}},[getFormatAndSchemaChoices({schemas:g,hasKeyPath:J,selectedSchema:oe,arbitraryJS:ae,preselectSchema:ie})]),he=jml("div",{class:"typesHolder",$custom:{$getTypeRoot(){return $e(this,"div[data-type]")},$getTypeSelect(){return $e(this,`.typeChoices-${ne}`)}}}),ye="schema"===ue?de.selectedOptions[0].dataset.schema:void 0;return jml({"#":buildTypeChoices({topRoot:$e(he,"div[data-type]"),format:ue,formats:pe,types:le,typeNamespace:ne,requireObject:J,objectHasValue:L,schema:ye,schemaContent:void 0===ye?void 0:await(O?.(ye))}).domArray},he),{formats:pe,types:le,formatChoices:de,typesHolder:he,domArray:[de,he],getValue(g,O){const L=he.$getTypeRoot();return le.getValueForRoot(L,{typeNamespace:ne,format:de.value,formats:pe,types:le,...g},O)},getType(){const g=he.$getTypeRoot();return Types.getTypeForRoot(g)},validValuesSet(){const g=he.$getTypeRoot().closest("form");return Types.validValuesSet({form:g,typeNamespace:ne})},async setValue(g,O){const L=(await pe.getControlsForFormatAndValue(le,de.value,g,O)).rootUI,M=Types.getTypeForRoot(L);he.$getTypeSelect().$addTypeAndEditUI({type:M,editUI:L})}}}export{Formats,Types,formatAndTypeChoices,getFormatAndSchemaChoices,getTypesForSchema,buildTypeChoices as typeChoices};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|