Sign In

fast-xml-builder

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-xml-builder - npm Package Compare versions

Comparing version
1.3.0
to
1.3.1
+3
-0
CHANGELOG.md
**1.3.1** (2026-08-14)
- fix: preserve negative sign for zero (By [rajanpanth](https://github.com/rajanpanth))
**1.3.0** (2026-07-11)

@@ -3,0 +6,0 @@ - upgrade:

+1
-1

@@ -1,1 +0,1 @@

(()=>{"use strict";var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>O});class s{constructor(t,e={},s){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this.data=s,this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let s=0,i="";for(;s<t.length;)t[s]===this.separator?s+1<t.length&&t[s+1]===this.separator?(i.trim()&&(e.push(this._parseSegment(i.trim())),i=""),e.push({type:"deep-wildcard"}),s+=2):(i.trim()&&e.push(this._parseSegment(i.trim())),i="",s++):(i+=t[s],s++);return i.trim()&&e.push(this._parseSegment(i.trim())),e}_parseSegment(t){const e={type:"tag"};let s=null,i=t;const n=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(n&&(i=n[1]+n[3],n[2])){const t=n[2].slice(1,-1);t&&(s=t)}let r,o,a=i;if(i.includes("::")){const e=i.indexOf("::");if(r=i.substring(0,e).trim(),a=i.substring(e+2).trim(),!r)throw new Error(`Invalid namespace in pattern: ${t}`)}let h=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),s=a.substring(t+1).trim();["first","last","odd","even"].includes(s)||/^nth\(\d+\)$/.test(s)?(o=e,h=s):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,r&&(e.namespace=r),s)if(s.includes("=")){const t=s.indexOf("=");e.attrName=s.substring(0,t).trim(),e.attrValue=s.substring(t+1).trim()}else e.attrName=s.trim();if(h){const t=h.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=h}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class i{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){const t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){const t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){const e=this._matcher.path;if(0!==e.length)return e[e.length-1].values?.[t]}hasAttr(t){const e=this._matcher.path;if(0===e.length)return!1;const s=e[e.length-1];return void 0!==s.values&&t in s.values}getAnyParentAttr(t){return this._matcher.getAnyParentAttr(t)}hasAnyParentAttr(t){return this._matcher.hasAnyParentAttr(t)}getPosition(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].position??0}getCounter(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,e=!0){return this._matcher.toString(t,e)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}}class n{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new i(this),this._keptAttrs=[]}push(t,e=null,s=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const n=this.path.length;let r=this.siblingStacks[n];r||(r={counts:new Map,total:0},this.siblingStacks[n]=r);const o=s?`${s}:${t}`:t,a=r.counts.get(o)||0,h=r.total;r.counts.set(o,a+1),r.total++;const p={tag:t,position:h,counter:a};null!=s&&(p.namespace=s),null!=e&&(p.values=e),this.path.push(p);const u=this.path.length,l=null!==i?i.keep:null;if(null!=l&&l.length>0&&e)for(let t=0;t<l.length;t++){const s=l[t];void 0!==e[s]&&this._keptAttrs.push({depth:u,name:s,value:e[s]})}}pop(){if(0===this.path.length)return;this._pathStringCache=null;const t=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const e=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=e;)this._keptAttrs.pop();return t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0!==this.path.length)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getAnyParentAttr(t){const e=this._keptAttrs;for(let s=e.length-1;s>=0;s--)if(e[s].name===t)return e[s].value}hasAnyParentAttr(t){const e=this._keptAttrs;for(let s=e.length-1;s>=0;s--)if(e[s].name===t)return!0;return!1}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const s=t||this.separator;if(s===this.separator&&!0===e){if(null!==this._pathStringCache)return this._pathStringCache;const t=this.path.map(t=>t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(s);return this._pathStringCache=t,t}return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(s)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++)if(!this._matchSegment(t[e],this.path[e],e===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,s=t.length-1;for(;s>=0&&e>=0;){const i=t[s];if("deep-wildcard"===i.type){if(s--,s<0)return!0;const i=t[s];let n=!1;for(let t=e;t>=0;t--)if(this._matchSegment(i,this.path[t],t===this.path.length-1)){e=t-1,s--,n=!0;break}if(!n)return!1}else{if(!this._matchSegment(i,this.path[e],e===this.path.length-1))return!1;e--,s--}}return s<0}_matchSegment(t,e,s){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!s)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue&&String(e.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!s)return!1;const i=e.counter??0;if("first"===t.position&&0!==i)return!1;if("odd"===t.position&&i%2!=1)return!1;if("even"===t.position&&i%2!=0)return!1;if("nth"===t.position&&i!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),keptAttrs:this._keptAttrs.map(t=>({...t}))}}restore(t){this._pathStringCache=null,this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),this._keptAttrs=(t.keptAttrs||[]).map(t=>({...t}))}readOnly(){return this._view}}function r(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function o(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function a(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const h=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",p=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",u=p+"\\-\\.\\d·̀-ͯ҇‿-⁀",l=(t,e,s="")=>{const i=`[${t.replace(":","")}][${e.replace(":","")}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,s),ncName:new RegExp(`^${i}$`,s),qName:new RegExp(`^${i}(?::${i})?$`,s),nmToken:new RegExp(`^[${e}]+$`,s),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,s)}},c=l(h,h+"\\-\\.\\d·̀-ͯ‿-⁀"),g=l(p,u,"u"),d=":A-Za-z_",f=l(d,d+"\\-\\.\\d"),m=["name","ncName","qName","nmToken","nmTokens"],N=(t,{xmlVersion:e="1.0",asciiOnly:s=!1,maxCacheSize:i=2048}={})=>{if(!m.includes(t))throw new TypeError(`Unknown production "${t}". Must be one of: ${m.join(", ")}`);const n=((t="1.0",e=!1)=>e?f:"1.1"===t?g:c)(e,s)[t];let r=new Map;const o=t=>{const e=r.get(t);if(void 0!==e)return e;const s=n.test(t);return r.size<i&&r.set(t,s),s};return o.reset=()=>{r=new Map},o};function b(t,e,s,i,n){return s.sanitizeName?n(t)?t:s.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function y(t,e){let i="";e.format&&(i="\n");const r=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const i=e.stopNodes[t];"string"==typeof i?r.push(new s(i)):i instanceof s&&r.push(i)}const o=function(t,e){if(!Array.isArray(t)||0===t.length)return"1.0";const s=t[0];if("?xml"===S(s)){const t=s[":@"];if(t){const s=e.attributeNamePrefix+"version";if(t[s])return t[s]}}return"1.0"}(t,e),a=N("qName",{xmlVersion:o});return x(t,e,i,new n,r,a)}function x(t,e,s,i,n,a){let h="",p=!1;if(e.maxNestedTags&&i.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let s=t.toString();return s=w(s,e),s}return""}for(let u=0;u<t.length;u++){const l=t[u],c=S(l);if(void 0===c)continue;const g=c===e.textNodeName||c===e.cdataPropName||c===e.commentPropName||"?"===c[0]?c:b(c,!1,e,i,a),d=A(l[":@"],e);i.push(g,d);const f=v(i,n);if(g===e.textNodeName){let t=l[c];f||(t=e.tagValueProcessor(g,t),t=w(t,e)),p&&(h+=s),h+=t,p=!1,i.pop();continue}if(g===e.cdataPropName){p&&(h+=s),h+=`<![CDATA[${o(l[c][0][e.textNodeName])}]]>`,p=!1,i.pop();continue}if(g===e.commentPropName){h+=s+`\x3c!--${r(l[c][0][e.textNodeName])}--\x3e`,p=!0,i.pop();continue}if("?"===g[0]){h+=("?xml"===g?"":s)+`<${g}${_(l[":@"],e,f,i,a)}?>`,p=!0,i.pop();continue}let m=s;""!==m&&(m+=e.indentBy);const N=s+`<${g}${_(l[":@"],e,f,i,a)}`;let y;y=f?P(l[c],e):x(l[c],e,m,i,n,a),-1!==e.unpairedTags.indexOf(g)?e.suppressUnpairedNode?h+=N+">":h+=N+"/>":y&&0!==y.length||!e.suppressEmptyNode?y&&y.endsWith(">")?h+=N+`>${y}${s}</${g}>`:(h+=N+">",y&&""!==s&&(y.includes("/>")||y.includes("</"))?h+=s+e.indentBy+y+s:h+=y,h+=`</${g}>`):h+=N+"/>",p=!0,i.pop()}return h}function A(t,e){if(!t||e.ignoreAttributes)return null;const s={};let i=!1;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n.startsWith(e.attributeNamePrefix)?n.substr(e.attributeNamePrefix.length):n]=a(t[n]),i=!0);return i?s:null}function P(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";let s="";for(let i=0;i<t.length;i++){const n=t[i],r=S(n);if(r===e.textNodeName)s+=n[r];else if(r===e.cdataPropName)s+=n[r][0][e.textNodeName];else if(r===e.commentPropName)s+=n[r][0][e.textNodeName];else{if(r&&"?"===r[0])continue;if(r){const t=$(n[":@"],e),i=P(n[r],e);i&&0!==i.length?s+=`<${r}${t}>${i}</${r}>`:s+=`<${r}${t}/>`}}}return s}function $(t,e){let s="";if(t&&!e.ignoreAttributes)for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let n=t[i];!0===n&&e.suppressBooleanAttributes?s+=` ${i.substr(e.attributeNamePrefix.length)}`:s+=` ${i.substr(e.attributeNamePrefix.length)}="${a(n)}"`}return s}function S(t){const e=Object.keys(t);for(let s=0;s<e.length;s++){const i=e[s];if(Object.prototype.hasOwnProperty.call(t,i)&&":@"!==i)return i}}function _(t,e,s,i,n){let r="";if(t&&!e.ignoreAttributes)for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const h=o.substr(e.attributeNamePrefix.length),p=s?h:b(h,!0,e,i,n);let u;s?u=t[o]:(u=e.attributeValueProcessor(o,t[o]),u=w(u,e)),!0===u&&e.suppressBooleanAttributes?r+=` ${p}`:r+=` ${p}="${a(u)}"`}return r}function v(t,e){if(!e||0===e.length)return!1;for(let s=0;s<e.length;s++)if(t.matches(e[s]))return!0;return!1}function w(t,e){if(t&&t.length>0&&e.processEntities)for(let s=0;s<e.entities.length;s++){const i=e.entities[s];t=t.replace(i.regex,i.val)}return t}const E={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function O(t){if(this.options=Object.assign({},E,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new s(e)):e instanceof s&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const s of e){if("string"==typeof s&&t===s)return!0;if(s instanceof RegExp&&s.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=T),this.processTextOrObjNode=j,this.options.format?(this.indentate=k,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function C(t,e,s,i,n){return s.sanitizeName?n(t)?t:s.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function j(t,e,s,i,n){const r=this.extractAttributes(t);if(i.push(e,r),this.checkStopNode(i)){const n=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);return i.pop(),this.buildObjectNode(n,e,r,s)}const o=this.j2x(t,s+1,i,n);return i.pop(),"?"===e[0]?this.buildTextValNode("",e,o.attrStr,s,i):void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,o.attrStr,s,i):this.buildObjectNode(o.val,e,o.attrStr,s)}function k(t){return this.options.indentBy.repeat(t)}function T(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}O.prototype.build=function(t){if(this.options.preserveOrder)return y(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new n,s=function(t,e){const s=t["?xml"];if(s&&"object"==typeof s){if(e.attributesGroupName&&s[e.attributesGroupName]){const t=s[e.attributesGroupName][e.attributeNamePrefix+"version"];if(t)return t}const t=s[e.attributeNamePrefix+"version"];if(t)return t}return"1.0"}(t,this.options),i=N("qName",{xmlVersion:s});return this.j2x(t,0,e,i).val}},O.prototype.j2x=function(t,e,s,i){let n="",r="";if(this.options.maxNestedTags&&s.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?s.toString():s,a=this.checkStopNode(s);for(let h in t){if(!Object.prototype.hasOwnProperty.call(t,h))continue;const p=h===this.options.textNodeName||h===this.options.cdataPropName||h===this.options.commentPropName||this.options.attributesGroupName&&h===this.options.attributesGroupName||this.isAttribute(h)||"?"===h[0]?h:C(h,!1,this.options,s,i);if(void 0===t[h])this.isAttribute(h)&&(r+="");else if(null===t[h])this.isAttribute(h)||p===this.options.cdataPropName||p===this.options.commentPropName?r+="":"?"===p[0]?r+=this.indentate(e)+"<"+p+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+p+"/"+this.tagEndChar;else if(t[h]instanceof Date)r+=this.buildTextValNode(t[h],p,"",e,s);else if("object"!=typeof t[h]){const u=this.isAttribute(h);if(u&&!this.ignoreAttributesFn(u,o)){const e=C(u,!0,this.options,s,i);n+=this.buildAttrPairStr(e,""+t[h],a)}else if(!u)if(h===this.options.textNodeName){let e=this.options.tagValueProcessor(h,""+t[h]);r+=this.replaceEntitiesValue(e)}else{s.push(p);const i=this.checkStopNode(s);if(s.pop(),i){const s=""+t[h];r+=""===s?this.indentate(e)+"<"+p+this.closeTag(p)+this.tagEndChar:this.indentate(e)+"<"+p+">"+s+"</"+p+this.tagEndChar}else r+=this.buildTextValNode(t[h],p,"",e,s)}}else if(Array.isArray(t[h])){const n=t[h].length;let o="",a="";for(let u=0;u<n;u++){const n=t[h][u];if(void 0===n);else if(null===n)"?"===p[0]?r+=this.indentate(e)+"<"+p+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+p+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){s.push(p);const t=this.j2x(n,e+1,s,i);s.pop(),o+=t.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(a+=t.attrStr)}else o+=this.processTextOrObjNode(n,p,e,s,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(p,n);t=this.replaceEntitiesValue(t),o+=t}else{s.push(p);const t=this.checkStopNode(s);if(s.pop(),t){const t=""+n;o+=""===t?this.indentate(e)+"<"+p+this.closeTag(p)+this.tagEndChar:this.indentate(e)+"<"+p+">"+t+"</"+p+this.tagEndChar}else o+=this.buildTextValNode(n,p,"",e,s)}}this.options.oneListGroup&&(o=this.buildObjectNode(o,p,a,e)),r+=o}else if(this.options.attributesGroupName&&h===this.options.attributesGroupName){const e=Object.keys(t[h]),r=e.length;for(let o=0;o<r;o++){const r=C(e[o],!0,this.options,s,i);n+=this.buildAttrPairStr(r,""+t[h][e[o]],a)}}else r+=this.processTextOrObjNode(t[h],p,e,s,i)}return{attrStr:n,val:r}},O.prototype.buildAttrPairStr=function(t,e,s){return s||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+a(e)+'"'},O.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let s=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=a(i[t]),s=!0)}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const n=this.isAttribute(i);n&&(e[n]=a(t[i]),s=!0)}return s?e:null},O.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;if(this.isAttribute(s))continue;if(this.options.attributesGroupName&&s===this.options.attributesGroupName)continue;const i=t[s];if(s===this.options.textNodeName)e+=i;else if(Array.isArray(i)){for(let t of i)if("string"==typeof t||"number"==typeof t)e+=`<${s}>${t}</${s}>`;else if("object"==typeof t&&null!==t){const i=this.buildRawContent(t),n=this.buildAttributesForStopNode(t);e+=""===i?`<${s}${n}/>`:`<${s}${n}>${i}</${s}>`}}else if("object"==typeof i&&null!==i){const t=this.buildRawContent(i),n=this.buildAttributesForStopNode(i);e+=""===t?`<${s}${n}/>`:`<${s}${n}>${t}</${s}>`}else e+=`<${s}>${i}</${s}>`}return e},O.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const s=t[this.options.attributesGroupName];for(let t in s){if(!Object.prototype.hasOwnProperty.call(s,t))continue;const i=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,n=s[t];!0===n&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+a(n)+'"'}}else for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const i=this.isAttribute(s);if(i){const n=t[s];!0===n&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+a(n)+'"'}}return e},O.prototype.buildObjectNode=function(t,e,s,i){if(""===t)return"?"===e[0]?this.indentate(i)+"<"+e+s+"?"+this.tagEndChar:this.indentate(i)+"<"+e+s+this.closeTag(e)+this.tagEndChar;if("?"===e[0])return this.indentate(i)+"<"+e+s+"?"+this.tagEndChar;{let n="</"+e+this.tagEndChar,o="";return"?"===e[0]&&(o="?",n=""),!s&&""!==s||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===o.length?this.indentate(i)+`\x3c!--${r(t)}--\x3e`+this.newLine:this.indentate(i)+"<"+e+s+o+this.tagEndChar+t+this.indentate(i)+n:this.indentate(i)+"<"+e+s+o+">"+t+n}},O.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},O.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},O.prototype.buildTextValNode=function(t,e,s,i,n){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName){const e=o(t);return this.indentate(i)+`<![CDATA[${e}]]>`+this.newLine}if(!1!==this.options.commentPropName&&e===this.options.commentPropName){const e=r(t);return this.indentate(i)+`\x3c!--${e}--\x3e`+this.newLine}if("?"===e[0])return this.indentate(i)+"<"+e+s+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),""===n?this.indentate(i)+"<"+e+s+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+s+">"+n+"</"+e+this.tagEndChar}},O.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const s=this.options.entities[e];t=t.replace(s.regex,s.val)}return t},module.exports=e})();
(()=>{"use strict";var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>C});class s{constructor(t,e={},s){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this.data=s,this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let s=0,i="";for(;s<t.length;)t[s]===this.separator?s+1<t.length&&t[s+1]===this.separator?(i.trim()&&(e.push(this._parseSegment(i.trim())),i=""),e.push({type:"deep-wildcard"}),s+=2):(i.trim()&&e.push(this._parseSegment(i.trim())),i="",s++):(i+=t[s],s++);return i.trim()&&e.push(this._parseSegment(i.trim())),e}_parseSegment(t){const e={type:"tag"};let s=null,i=t;const n=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(n&&(i=n[1]+n[3],n[2])){const t=n[2].slice(1,-1);t&&(s=t)}let r,o,a=i;if(i.includes("::")){const e=i.indexOf("::");if(r=i.substring(0,e).trim(),a=i.substring(e+2).trim(),!r)throw new Error(`Invalid namespace in pattern: ${t}`)}let h=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),s=a.substring(t+1).trim();["first","last","odd","even"].includes(s)||/^nth\(\d+\)$/.test(s)?(o=e,h=s):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,r&&(e.namespace=r),s)if(s.includes("=")){const t=s.indexOf("=");e.attrName=s.substring(0,t).trim(),e.attrValue=s.substring(t+1).trim()}else e.attrName=s.trim();if(h){const t=h.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=h}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class i{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){const t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){const t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){const e=this._matcher.path;if(0!==e.length)return e[e.length-1].values?.[t]}hasAttr(t){const e=this._matcher.path;if(0===e.length)return!1;const s=e[e.length-1];return void 0!==s.values&&t in s.values}getAnyParentAttr(t){return this._matcher.getAnyParentAttr(t)}hasAnyParentAttr(t){return this._matcher.hasAnyParentAttr(t)}getPosition(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].position??0}getCounter(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,e=!0){return this._matcher.toString(t,e)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}}class n{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new i(this),this._keptAttrs=[]}push(t,e=null,s=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const n=this.path.length;let r=this.siblingStacks[n];r||(r={counts:new Map,total:0},this.siblingStacks[n]=r);const o=s?`${s}:${t}`:t,a=r.counts.get(o)||0,h=r.total;r.counts.set(o,a+1),r.total++;const p={tag:t,position:h,counter:a};null!=s&&(p.namespace=s),null!=e&&(p.values=e),this.path.push(p);const u=this.path.length,l=null!==i?i.keep:null;if(null!=l&&l.length>0&&e)for(let t=0;t<l.length;t++){const s=l[t];void 0!==e[s]&&this._keptAttrs.push({depth:u,name:s,value:e[s]})}}pop(){if(0===this.path.length)return;this._pathStringCache=null;const t=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const e=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=e;)this._keptAttrs.pop();return t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0!==this.path.length)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getAnyParentAttr(t){const e=this._keptAttrs;for(let s=e.length-1;s>=0;s--)if(e[s].name===t)return e[s].value}hasAnyParentAttr(t){const e=this._keptAttrs;for(let s=e.length-1;s>=0;s--)if(e[s].name===t)return!0;return!1}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const s=t||this.separator;if(s===this.separator&&!0===e){if(null!==this._pathStringCache)return this._pathStringCache;const t=this.path.map(t=>t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(s);return this._pathStringCache=t,t}return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(s)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++)if(!this._matchSegment(t[e],this.path[e],e===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,s=t.length-1;for(;s>=0&&e>=0;){const i=t[s];if("deep-wildcard"===i.type){if(s--,s<0)return!0;const i=t[s];let n=!1;for(let t=e;t>=0;t--)if(this._matchSegment(i,this.path[t],t===this.path.length-1)){e=t-1,s--,n=!0;break}if(!n)return!1}else{if(!this._matchSegment(i,this.path[e],e===this.path.length-1))return!1;e--,s--}}return s<0}_matchSegment(t,e,s){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!s)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue&&String(e.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!s)return!1;const i=e.counter??0;if("first"===t.position&&0!==i)return!1;if("odd"===t.position&&i%2!=1)return!1;if("even"===t.position&&i%2!=0)return!1;if("nth"===t.position&&i!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),keptAttrs:this._keptAttrs.map(t=>({...t}))}}restore(t){this._pathStringCache=null,this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),this._keptAttrs=(t.keptAttrs||[]).map(t=>({...t}))}readOnly(){return this._view}}function r(t){return"number"==typeof t&&Object.is(t,-0)?"-0":String(t)}function o(t){return r(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function a(t){return r(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function h(t){return r(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const p=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",u=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",l=u+"\\-\\.\\d·̀-ͯ҇‿-⁀",c=(t,e,s="")=>{const i=`[${t.replace(":","")}][${e.replace(":","")}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,s),ncName:new RegExp(`^${i}$`,s),qName:new RegExp(`^${i}(?::${i})?$`,s),nmToken:new RegExp(`^[${e}]+$`,s),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,s)}},g=c(p,p+"\\-\\.\\d·̀-ͯ‿-⁀"),d=c(u,l,"u"),f=":A-Za-z_",m=c(f,f+"\\-\\.\\d"),N=["name","ncName","qName","nmToken","nmTokens"],b=(t,{xmlVersion:e="1.0",asciiOnly:s=!1,maxCacheSize:i=2048}={})=>{if(!N.includes(t))throw new TypeError(`Unknown production "${t}". Must be one of: ${N.join(", ")}`);const n=((t="1.0",e=!1)=>e?m:"1.1"===t?d:g)(e,s)[t];let r=new Map;const o=t=>{const e=r.get(t);if(void 0!==e)return e;const s=n.test(t);return r.size<i&&r.set(t,s),s};return o.reset=()=>{r=new Map},o};function y(t,e,s,i,n){return s.sanitizeName?n(t)?t:s.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function x(t,e){let i="";e.format&&(i="\n");const r=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const i=e.stopNodes[t];"string"==typeof i?r.push(new s(i)):i instanceof s&&r.push(i)}const o=function(t,e){if(!Array.isArray(t)||0===t.length)return"1.0";const s=t[0];if("?xml"===_(s)){const t=s[":@"];if(t){const s=e.attributeNamePrefix+"version";if(t[s])return t[s]}}return"1.0"}(t,e),a=b("qName",{xmlVersion:o});return A(t,e,i,new n,r,a)}function A(t,e,s,i,n,h){let p="",u=!1;if(e.maxNestedTags&&i.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let s=r(t);return s=O(s,e),s}return""}for(let l=0;l<t.length;l++){const c=t[l],g=_(c);if(void 0===g)continue;const d=g===e.textNodeName||g===e.cdataPropName||g===e.commentPropName||"?"===g[0]?g:y(g,!1,e,i,h),f=P(c[":@"],e);i.push(d,f);const m=w(i,n);if(d===e.textNodeName){let t=c[g];m||(t=e.tagValueProcessor(d,t),t=O(t,e)),t=r(t),u&&(p+=s),p+=t,u=!1,i.pop();continue}if(d===e.cdataPropName){u&&(p+=s),p+=`<![CDATA[${a(c[g][0][e.textNodeName])}]]>`,u=!1,i.pop();continue}if(d===e.commentPropName){p+=s+`\x3c!--${o(c[g][0][e.textNodeName])}--\x3e`,u=!0,i.pop();continue}if("?"===d[0]){p+=("?xml"===d?"":s)+`<${d}${v(c[":@"],e,m,i,h)}?>`,u=!0,i.pop();continue}let N=s;""!==N&&(N+=e.indentBy);const b=s+`<${d}${v(c[":@"],e,m,i,h)}`;let x;x=m?$(c[g],e):A(c[g],e,N,i,n,h),-1!==e.unpairedTags.indexOf(d)?e.suppressUnpairedNode?p+=b+">":p+=b+"/>":x&&0!==x.length||!e.suppressEmptyNode?x&&x.endsWith(">")?p+=b+`>${x}${s}</${d}>`:(p+=b+">",x&&""!==s&&(x.includes("/>")||x.includes("</"))?p+=s+e.indentBy+x+s:p+=x,p+=`</${d}>`):p+=b+"/>",u=!0,i.pop()}return p}function P(t,e){if(!t||e.ignoreAttributes)return null;const s={};let i=!1;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n.startsWith(e.attributeNamePrefix)?n.substr(e.attributeNamePrefix.length):n]=h(t[n]),i=!0);return i?s:null}function $(t,e){if(!Array.isArray(t))return null!=t?r(t):"";let s="";for(let i=0;i<t.length;i++){const n=t[i],o=_(n);if(o===e.textNodeName)s+=r(n[o]);else if(o===e.cdataPropName)s+=n[o][0][e.textNodeName];else if(o===e.commentPropName)s+=n[o][0][e.textNodeName];else{if(o&&"?"===o[0])continue;if(o){const t=S(n[":@"],e),i=$(n[o],e);i&&0!==i.length?s+=`<${o}${t}>${i}</${o}>`:s+=`<${o}${t}/>`}}}return s}function S(t,e){let s="";if(t&&!e.ignoreAttributes)for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let n=t[i];!0===n&&e.suppressBooleanAttributes?s+=` ${i.substr(e.attributeNamePrefix.length)}`:s+=` ${i.substr(e.attributeNamePrefix.length)}="${h(n)}"`}return s}function _(t){const e=Object.keys(t);for(let s=0;s<e.length;s++){const i=e[s];if(Object.prototype.hasOwnProperty.call(t,i)&&":@"!==i)return i}}function v(t,e,s,i,n){let r="";if(t&&!e.ignoreAttributes)for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const a=o.substr(e.attributeNamePrefix.length),p=s?a:y(a,!0,e,i,n);let u;s?u=t[o]:(u=e.attributeValueProcessor(o,t[o]),u=O(u,e)),!0===u&&e.suppressBooleanAttributes?r+=` ${p}`:r+=` ${p}="${h(u)}"`}return r}function w(t,e){if(!e||0===e.length)return!1;for(let s=0;s<e.length;s++)if(t.matches(e[s]))return!0;return!1}function O(t,e){if(t&&t.length>0&&e.processEntities)for(let s=0;s<e.entities.length;s++){const i=e.entities[s];t=t.replace(i.regex,i.val)}return t}const E={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function C(t){if(this.options=Object.assign({},E,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new s(e)):e instanceof s&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const s of e){if("string"==typeof s&&t===s)return!0;if(s instanceof RegExp&&s.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=V),this.processTextOrObjNode=k,this.options.format?(this.indentate=T,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function j(t,e,s,i,n){return s.sanitizeName?n(t)?t:s.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function k(t,e,s,i,n){const r=this.extractAttributes(t);if(i.push(e,r),this.checkStopNode(i)){const n=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);return i.pop(),this.buildObjectNode(n,e,r,s)}const o=this.j2x(t,s+1,i,n);return i.pop(),"?"===e[0]?this.buildTextValNode("",e,o.attrStr,s,i):void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,o.attrStr,s,i):this.buildObjectNode(o.val,e,o.attrStr,s)}function T(t){return this.options.indentBy.repeat(t)}function V(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}C.prototype.build=function(t){if(this.options.preserveOrder)return x(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new n,s=function(t,e){const s=t["?xml"];if(s&&"object"==typeof s){if(e.attributesGroupName&&s[e.attributesGroupName]){const t=s[e.attributesGroupName][e.attributeNamePrefix+"version"];if(t)return t}const t=s[e.attributeNamePrefix+"version"];if(t)return t}return"1.0"}(t,this.options),i=b("qName",{xmlVersion:s});return this.j2x(t,0,e,i).val}},C.prototype.j2x=function(t,e,s,i){let n="",o="";if(this.options.maxNestedTags&&s.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const a=this.options.jPath?s.toString():s,h=this.checkStopNode(s);for(let p in t){if(!Object.prototype.hasOwnProperty.call(t,p))continue;const u=p===this.options.textNodeName||p===this.options.cdataPropName||p===this.options.commentPropName||this.options.attributesGroupName&&p===this.options.attributesGroupName||this.isAttribute(p)||"?"===p[0]?p:j(p,!1,this.options,s,i);if(void 0===t[p])this.isAttribute(p)&&(o+="");else if(null===t[p])this.isAttribute(p)||u===this.options.cdataPropName||u===this.options.commentPropName?o+="":"?"===u[0]?o+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(t[p]instanceof Date)o+=this.buildTextValNode(t[p],u,"",e,s);else if("object"!=typeof t[p]){const l=this.isAttribute(p);if(l&&!this.ignoreAttributesFn(l,a)){const e=j(l,!0,this.options,s,i);n+=this.buildAttrPairStr(e,r(t[p]),h)}else if(!l)if(p===this.options.textNodeName){let e=this.options.tagValueProcessor(p,r(t[p]));o+=this.replaceEntitiesValue(e)}else{s.push(u);const i=this.checkStopNode(s);if(s.pop(),i){const s=r(t[p]);o+=""===s?this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:this.indentate(e)+"<"+u+">"+s+"</"+u+this.tagEndChar}else o+=this.buildTextValNode(t[p],u,"",e,s)}}else if(Array.isArray(t[p])){const n=t[p].length;let a="",h="";for(let l=0;l<n;l++){const n=t[p][l];if(void 0===n);else if(null===n)"?"===u[0]?o+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){s.push(u);const t=this.j2x(n,e+1,s,i);s.pop(),a+=t.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(h+=t.attrStr)}else a+=this.processTextOrObjNode(n,u,e,s,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(u,n);t=this.replaceEntitiesValue(t),t=r(t),a+=t}else{s.push(u);const t=this.checkStopNode(s);if(s.pop(),t){const t=r(n);a+=""===t?this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:this.indentate(e)+"<"+u+">"+t+"</"+u+this.tagEndChar}else a+=this.buildTextValNode(n,u,"",e,s)}}this.options.oneListGroup&&(a=this.buildObjectNode(a,u,h,e)),o+=a}else if(this.options.attributesGroupName&&p===this.options.attributesGroupName){const e=Object.keys(t[p]),o=e.length;for(let a=0;a<o;a++){const o=j(e[a],!0,this.options,s,i);n+=this.buildAttrPairStr(o,r(t[p][e[a]]),h)}}else o+=this.processTextOrObjNode(t[p],u,e,s,i)}return{attrStr:n,val:o}},C.prototype.buildAttrPairStr=function(t,e,s){return s||(e=this.options.attributeValueProcessor(t,r(e)),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+h(e)+'"'},C.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let s=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=h(i[t]),s=!0)}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const n=this.isAttribute(i);n&&(e[n]=h(t[i]),s=!0)}return s?e:null},C.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;if(this.isAttribute(s))continue;if(this.options.attributesGroupName&&s===this.options.attributesGroupName)continue;const i=t[s];if(s===this.options.textNodeName)e+=i;else if(Array.isArray(i)){for(let t of i)if("string"==typeof t||"number"==typeof t)e+=`<${s}>${t}</${s}>`;else if("object"==typeof t&&null!==t){const i=this.buildRawContent(t),n=this.buildAttributesForStopNode(t);e+=""===i?`<${s}${n}/>`:`<${s}${n}>${i}</${s}>`}}else if("object"==typeof i&&null!==i){const t=this.buildRawContent(i),n=this.buildAttributesForStopNode(i);e+=""===t?`<${s}${n}/>`:`<${s}${n}>${t}</${s}>`}else e+=`<${s}>${i}</${s}>`}return e},C.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const s=t[this.options.attributesGroupName];for(let t in s){if(!Object.prototype.hasOwnProperty.call(s,t))continue;const i=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,n=s[t];!0===n&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+h(n)+'"'}}else for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const i=this.isAttribute(s);if(i){const n=t[s];!0===n&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+h(n)+'"'}}return e},C.prototype.buildObjectNode=function(t,e,s,i){if(""===t)return"?"===e[0]?this.indentate(i)+"<"+e+s+"?"+this.tagEndChar:this.indentate(i)+"<"+e+s+this.closeTag(e)+this.tagEndChar;if("?"===e[0])return this.indentate(i)+"<"+e+s+"?"+this.tagEndChar;{let n="</"+e+this.tagEndChar,r="";return"?"===e[0]&&(r="?",n=""),!s&&""!==s||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===r.length?this.indentate(i)+`\x3c!--${o(t)}--\x3e`+this.newLine:this.indentate(i)+"<"+e+s+r+this.tagEndChar+t+this.indentate(i)+n:this.indentate(i)+"<"+e+s+r+">"+t+n}},C.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},C.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},C.prototype.buildTextValNode=function(t,e,s,i,n){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName){const e=a(t);return this.indentate(i)+`<![CDATA[${e}]]>`+this.newLine}if(!1!==this.options.commentPropName&&e===this.options.commentPropName){const e=o(t);return this.indentate(i)+`\x3c!--${e}--\x3e`+this.newLine}if("?"===e[0])return this.indentate(i)+"<"+e+s+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),n=r(n),""===n?this.indentate(i)+"<"+e+s+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+s+">"+n+"</"+e+this.tagEndChar}},C.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const s=this.options.entities[e];t=t.replace(s.regex,s.val)}return t},module.exports=e})();

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fxb=e():t.fxb=e()}(this,()=>(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>T});class r{constructor(t,e={},r){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this.data=r,this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let r=0,i="";for(;r<t.length;)t[r]===this.separator?r+1<t.length&&t[r+1]===this.separator?(i.trim()&&(e.push(this._parseSegment(i.trim())),i=""),e.push({type:"deep-wildcard"}),r+=2):(i.trim()&&e.push(this._parseSegment(i.trim())),i="",r++):(i+=t[r],r++);return i.trim()&&e.push(this._parseSegment(i.trim())),e}_parseSegment(t){const e={type:"tag"};let r=null,i=t;const s=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(i=s[1]+s[3],s[2])){const t=s[2].slice(1,-1);t&&(r=t)}let n,a,o=i;if(i.includes("::")){const e=i.indexOf("::");if(n=i.substring(0,e).trim(),o=i.substring(e+2).trim(),!n)throw new Error(`Invalid namespace in pattern: ${t}`)}let h=null;if(o.includes(":")){const t=o.lastIndexOf(":"),e=o.substring(0,t).trim(),r=o.substring(t+1).trim();["first","last","odd","even"].includes(r)||/^nth\(\d+\)$/.test(r)?(a=e,h=r):a=o}else a=o;if(!a)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=a,n&&(e.namespace=n),r)if(r.includes("=")){const t=r.indexOf("=");e.attrName=r.substring(0,t).trim(),e.attrValue=r.substring(t+1).trim()}else e.attrName=r.trim();if(h){const t=h.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=h}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class i{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){const t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){const t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){const e=this._matcher.path;if(0!==e.length)return e[e.length-1].values?.[t]}hasAttr(t){const e=this._matcher.path;if(0===e.length)return!1;const r=e[e.length-1];return void 0!==r.values&&t in r.values}getAnyParentAttr(t){return this._matcher.getAnyParentAttr(t)}hasAnyParentAttr(t){return this._matcher.hasAnyParentAttr(t)}getPosition(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].position??0}getCounter(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,e=!0){return this._matcher.toString(t,e)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}}class s{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new i(this),this._keptAttrs=[]}push(t,e=null,r=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const s=this.path.length;let n=this.siblingStacks[s];n||(n={counts:new Map,total:0},this.siblingStacks[s]=n);const a=r?`${r}:${t}`:t,o=n.counts.get(a)||0,h=n.total;n.counts.set(a,o+1),n.total++;const p={tag:t,position:h,counter:o};null!=r&&(p.namespace=r),null!=e&&(p.values=e),this.path.push(p);const u=this.path.length,l=null!==i?i.keep:null;if(null!=l&&l.length>0&&e)for(let t=0;t<l.length;t++){const r=l[t];void 0!==e[r]&&this._keptAttrs.push({depth:u,name:r,value:e[r]})}}pop(){if(0===this.path.length)return;this._pathStringCache=null;const t=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const e=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=e;)this._keptAttrs.pop();return t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0!==this.path.length)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getAnyParentAttr(t){const e=this._keptAttrs;for(let r=e.length-1;r>=0;r--)if(e[r].name===t)return e[r].value}hasAnyParentAttr(t){const e=this._keptAttrs;for(let r=e.length-1;r>=0;r--)if(e[r].name===t)return!0;return!1}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const r=t||this.separator;if(r===this.separator&&!0===e){if(null!==this._pathStringCache)return this._pathStringCache;const t=this.path.map(t=>t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(r);return this._pathStringCache=t,t}return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(r)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++)if(!this._matchSegment(t[e],this.path[e],e===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,r=t.length-1;for(;r>=0&&e>=0;){const i=t[r];if("deep-wildcard"===i.type){if(r--,r<0)return!0;const i=t[r];let s=!1;for(let t=e;t>=0;t--)if(this._matchSegment(i,this.path[t],t===this.path.length-1)){e=t-1,r--,s=!0;break}if(!s)return!1}else{if(!this._matchSegment(i,this.path[e],e===this.path.length-1))return!1;e--,r--}}return r<0}_matchSegment(t,e,r){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!r)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue&&String(e.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!r)return!1;const i=e.counter??0;if("first"===t.position&&0!==i)return!1;if("odd"===t.position&&i%2!=1)return!1;if("even"===t.position&&i%2!=0)return!1;if("nth"===t.position&&i!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),keptAttrs:this._keptAttrs.map(t=>({...t}))}}restore(t){this._pathStringCache=null,this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),this._keptAttrs=(t.keptAttrs||[]).map(t=>({...t}))}readOnly(){return this._view}}function n(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function a(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function o(t){return String(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const h=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",p=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",u=p+"\\-\\.\\d·̀-ͯ҇‿-⁀",l=(t,e,r="")=>{const i=`[${t.replace(":","")}][${e.replace(":","")}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,r),ncName:new RegExp(`^${i}$`,r),qName:new RegExp(`^${i}(?::${i})?$`,r),nmToken:new RegExp(`^[${e}]+$`,r),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,r)}},c=l(h,h+"\\-\\.\\d·̀-ͯ‿-⁀"),f=l(p,u,"u"),g=":A-Za-z_",d=l(g,g+"\\-\\.\\d"),m=["name","ncName","qName","nmToken","nmTokens"],b=(t,{xmlVersion:e="1.0",asciiOnly:r=!1,maxCacheSize:i=2048}={})=>{if(!m.includes(t))throw new TypeError(`Unknown production "${t}". Must be one of: ${m.join(", ")}`);const s=((t="1.0",e=!1)=>e?d:"1.1"===t?f:c)(e,r)[t];let n=new Map;const a=t=>{const e=n.get(t);if(void 0!==e)return e;const r=s.test(t);return n.size<i&&n.set(t,r),r};return a.reset=()=>{n=new Map},a};function v(t,e,r,i,s){return r.sanitizeName?s(t)?t:r.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function N(t,e){var i="";e.format&&(i="\n");var n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(var a=0;a<e.stopNodes.length;a++){var o=e.stopNodes[a];"string"==typeof o?n.push(new r(o)):o instanceof r&&n.push(o)}var h=function(t,e){if(!Array.isArray(t)||0===t.length)return"1.0";var r=t[0];if("?xml"===P(r)){var i=r[":@"];if(i){var s=e.attributeNamePrefix+"version";if(i[s])return i[s]}}return"1.0"}(t,e),p=b("qName",{xmlVersion:h});return y(t,e,i,new s,n,p)}function y(t,e,r,i,s,o){var h="",p=!1;if(e.maxNestedTags&&i.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){var u=t.toString();return E(u,e)}return""}for(var l=0;l<t.length;l++){var c=t[l],f=P(c);if(void 0!==f){var g=f===e.textNodeName||f===e.cdataPropName||f===e.commentPropName||"?"===f[0]?f:v(f,!1,e,i,o),d=A(c[":@"],e);i.push(g,d);var m=w(i,s);if(g!==e.textNodeName)if(g!==e.cdataPropName)if(g!==e.commentPropName)if("?"!==g[0]){var b=r;""!==b&&(b+=e.indentBy);var N=r+"<"+g+_(c[":@"],e,m,i,o),S=void 0;S=m?x(c[f],e):y(c[f],e,b,i,s,o),-1!==e.unpairedTags.indexOf(g)?e.suppressUnpairedNode?h+=N+">":h+=N+"/>":S&&0!==S.length||!e.suppressEmptyNode?S&&S.endsWith(">")?h+=N+">"+S+r+"</"+g+">":(h+=N+">",S&&""!==r&&(S.includes("/>")||S.includes("</"))?h+=r+e.indentBy+S+r:h+=S,h+="</"+g+">"):h+=N+"/>",p=!0,i.pop()}else h+=("?xml"===g?"":r)+"<"+g+_(c[":@"],e,m,i,o)+"?>",p=!0,i.pop();else h+=r+"\x3c!--"+n(c[f][0][e.textNodeName])+"--\x3e",p=!0,i.pop();else p&&(h+=r),h+="<![CDATA["+a(c[f][0][e.textNodeName])+"]]>",p=!1,i.pop();else{var O=c[f];m||(O=E(O=e.tagValueProcessor(g,O),e)),p&&(h+=r),h+=O,p=!1,i.pop()}}}return h}function A(t,e){if(!t||e.ignoreAttributes)return null;var r={},i=!1;for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s.startsWith(e.attributeNamePrefix)?s.substr(e.attributeNamePrefix.length):s]=o(t[s]),i=!0);return i?r:null}function x(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";for(var r="",i=0;i<t.length;i++){var s=t[i],n=P(s);if(n===e.textNodeName)r+=s[n];else if(n===e.cdataPropName)r+=s[n][0][e.textNodeName];else if(n===e.commentPropName)r+=s[n][0][e.textNodeName];else{if(n&&"?"===n[0])continue;if(n){var a=S(s[":@"],e),o=x(s[n],e);o&&0!==o.length?r+="<"+n+a+">"+o+"</"+n+">":r+="<"+n+a+"/>"}}}return r}function S(t,e){var r="";if(t&&!e.ignoreAttributes)for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];!0===s&&e.suppressBooleanAttributes?r+=" "+i.substr(e.attributeNamePrefix.length):r+=" "+i.substr(e.attributeNamePrefix.length)+'="'+o(s)+'"'}return r}function P(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var i=e[r];if(Object.prototype.hasOwnProperty.call(t,i)&&":@"!==i)return i}}function _(t,e,r,i,s){var n="";if(t&&!e.ignoreAttributes)for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){var h=a.substr(e.attributeNamePrefix.length),p=r?h:v(h,!0,e,i,s),u=void 0;!0===(u=r?t[a]:E(u=e.attributeValueProcessor(a,t[a]),e))&&e.suppressBooleanAttributes?n+=" "+p:n+=" "+p+'="'+o(u)+'"'}return n}function w(t,e){if(!e||0===e.length)return!1;for(var r=0;r<e.length;r++)if(t.matches(e[r]))return!0;return!1}function E(t,e){if(t&&t.length>0&&e.processEntities)for(var r=0;r<e.entities.length;r++){var i=e.entities[r];t=t.replace(i.regex,i.val)}return t}function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function j(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return C(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}var k={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function T(t){if(this.options=Object.assign({},k,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(function(t){return"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t})),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(var e=0;e<this.options.stopNodes.length;e++){var i=this.options.stopNodes[e];"string"==typeof i?this.stopNodeExpressions.push(new r(i)):i instanceof r&&this.stopNodeExpressions.push(i)}var s;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(s=this.options.ignoreAttributes)?s:Array.isArray(s)?function(t){for(var e,r=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return O(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(s);!(e=r()).done;){var i=e.value;if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:function(){return!1},this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=R),this.processTextOrObjNode=V,this.options.format?(this.indentate=G,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function $(t,e,r,i,s){return r.sanitizeName?s(t)?t:r.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function V(t,e,r,i,s){var n=this.extractAttributes(t);if(i.push(e,n),this.checkStopNode(i)){var a=this.buildRawContent(t),o=this.buildAttributesForStopNode(t);return i.pop(),this.buildObjectNode(a,e,o,r)}var h=this.j2x(t,r+1,i,s);return i.pop(),"?"===e[0]?this.buildTextValNode("",e,h.attrStr,r,i):void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,h.attrStr,r,i):this.buildObjectNode(h.val,e,h.attrStr,r)}function G(t){return this.options.indentBy.repeat(t)}function R(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}return T.prototype.build=function(t){if(this.options.preserveOrder)return N(t,this.options);var e;Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&((e={})[this.options.arrayNodeName]=t,t=e);var r=new s,i=function(t,e){var r=t["?xml"];if(r&&"object"==typeof r){if(e.attributesGroupName&&r[e.attributesGroupName]){var i=r[e.attributesGroupName][e.attributeNamePrefix+"version"];if(i)return i}var s=r[e.attributeNamePrefix+"version"];if(s)return s}return"1.0"}(t,this.options),n=b("qName",{xmlVersion:i});return this.j2x(t,0,r,n).val},T.prototype.j2x=function(t,e,r,i){var s="",n="";if(this.options.maxNestedTags&&r.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");var a=this.options.jPath?r.toString():r,o=this.checkStopNode(r);for(var h in t)if(Object.prototype.hasOwnProperty.call(t,h)){var p=h===this.options.textNodeName||h===this.options.cdataPropName||h===this.options.commentPropName||this.options.attributesGroupName&&h===this.options.attributesGroupName||this.isAttribute(h)||"?"===h[0]?h:$(h,!1,this.options,r,i);if(void 0===t[h])this.isAttribute(h)&&(n+="");else if(null===t[h])this.isAttribute(h)||p===this.options.cdataPropName||p===this.options.commentPropName?n+="":"?"===p[0]?n+=this.indentate(e)+"<"+p+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+p+"/"+this.tagEndChar;else if(t[h]instanceof Date)n+=this.buildTextValNode(t[h],p,"",e,r);else if("object"!=typeof t[h]){var u=this.isAttribute(h);if(u&&!this.ignoreAttributesFn(u,a)){var l=$(u,!0,this.options,r,i);s+=this.buildAttrPairStr(l,""+t[h],o)}else if(!u)if(h===this.options.textNodeName){var c=this.options.tagValueProcessor(h,""+t[h]);n+=this.replaceEntitiesValue(c)}else{r.push(p);var f=this.checkStopNode(r);if(r.pop(),f){var g=""+t[h];n+=""===g?this.indentate(e)+"<"+p+this.closeTag(p)+this.tagEndChar:this.indentate(e)+"<"+p+">"+g+"</"+p+this.tagEndChar}else n+=this.buildTextValNode(t[h],p,"",e,r)}}else if(Array.isArray(t[h])){for(var d=t[h].length,m="",b="",v=0;v<d;v++){var N=t[h][v];if(void 0===N);else if(null===N)"?"===p[0]?n+=this.indentate(e)+"<"+p+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+p+"/"+this.tagEndChar;else if("object"==typeof N)if(this.options.oneListGroup){r.push(p);var y=this.j2x(N,e+1,r,i);r.pop(),m+=y.val,this.options.attributesGroupName&&N.hasOwnProperty(this.options.attributesGroupName)&&(b+=y.attrStr)}else m+=this.processTextOrObjNode(N,p,e,r,i);else if(this.options.oneListGroup){var A=this.options.tagValueProcessor(p,N);m+=A=this.replaceEntitiesValue(A)}else{r.push(p);var x=this.checkStopNode(r);if(r.pop(),x){var S=""+N;m+=""===S?this.indentate(e)+"<"+p+this.closeTag(p)+this.tagEndChar:this.indentate(e)+"<"+p+">"+S+"</"+p+this.tagEndChar}else m+=this.buildTextValNode(N,p,"",e,r)}}this.options.oneListGroup&&(m=this.buildObjectNode(m,p,b,e)),n+=m}else if(this.options.attributesGroupName&&h===this.options.attributesGroupName)for(var P=Object.keys(t[h]),_=P.length,w=0;w<_;w++){var E=$(P[w],!0,this.options,r,i);s+=this.buildAttrPairStr(E,""+t[h][P[w]],o)}else n+=this.processTextOrObjNode(t[h],p,e,r,i)}return{attrStr:s,val:n}},T.prototype.buildAttrPairStr=function(t,e,r){return r||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+o(e)+'"'},T.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;var e={},r=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){var i=t[this.options.attributesGroupName];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s.startsWith(this.options.attributeNamePrefix)?s.substring(this.options.attributeNamePrefix.length):s]=o(i[s]),r=!0)}else for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var a=this.isAttribute(n);a&&(e[a]=o(t[n]),r=!0)}return r?e:null},T.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];var e="";for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&!(this.isAttribute(r)||this.options.attributesGroupName&&r===this.options.attributesGroupName)){var i=t[r];if(r===this.options.textNodeName)e+=i;else if(Array.isArray(i))for(var s,n=j(i);!(s=n()).done;){var a=s.value;if("string"==typeof a||"number"==typeof a)e+="<"+r+">"+a+"</"+r+">";else if("object"==typeof a&&null!==a){var o=this.buildRawContent(a),h=this.buildAttributesForStopNode(a);e+=""===o?"<"+r+h+"/>":"<"+r+h+">"+o+"</"+r+">"}}else if("object"==typeof i&&null!==i){var p=this.buildRawContent(i),u=this.buildAttributesForStopNode(i);e+=""===p?"<"+r+u+"/>":"<"+r+u+">"+p+"</"+r+">"}else e+="<"+r+">"+i+"</"+r+">"}return e},T.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";var e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){var r=t[this.options.attributesGroupName];for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)){var s=i.startsWith(this.options.attributeNamePrefix)?i.substring(this.options.attributeNamePrefix.length):i,n=r[i];!0===n&&this.options.suppressBooleanAttributes?e+=" "+s:e+=" "+s+'="'+o(n)+'"'}}else for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){var h=this.isAttribute(a);if(h){var p=t[a];!0===p&&this.options.suppressBooleanAttributes?e+=" "+h:e+=" "+h+'="'+o(p)+'"'}}return e},T.prototype.buildObjectNode=function(t,e,r,i){if(""===t)return"?"===e[0]?this.indentate(i)+"<"+e+r+"?"+this.tagEndChar:this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar;if("?"===e[0])return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;var s="</"+e+this.tagEndChar,a="";return"?"===e[0]&&(a="?",s=""),!r&&""!==r||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===a.length?this.indentate(i)+"\x3c!--"+n(t)+"--\x3e"+this.newLine:this.indentate(i)+"<"+e+r+a+this.tagEndChar+t+this.indentate(i)+s:this.indentate(i)+"<"+e+r+a+">"+t+s},T.prototype.closeTag=function(t){var e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":"></"+t,e},T.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(var e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},T.prototype.buildTextValNode=function(t,e,r,i,s){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName){var o=a(t);return this.indentate(i)+"<![CDATA["+o+"]]>"+this.newLine}if(!1!==this.options.commentPropName&&e===this.options.commentPropName){var h=n(t);return this.indentate(i)+"\x3c!--"+h+"--\x3e"+this.newLine}if("?"===e[0])return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;var p=this.options.tagValueProcessor(e,t);return""===(p=this.replaceEntitiesValue(p))?this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+r+">"+p+"</"+e+this.tagEndChar},T.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(var e=0;e<this.options.entities.length;e++){var r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t},e})());
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fxb=e():t.fxb=e()}(this,()=>(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>$});class r{constructor(t,e={},r){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this.data=r,this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let r=0,i="";for(;r<t.length;)t[r]===this.separator?r+1<t.length&&t[r+1]===this.separator?(i.trim()&&(e.push(this._parseSegment(i.trim())),i=""),e.push({type:"deep-wildcard"}),r+=2):(i.trim()&&e.push(this._parseSegment(i.trim())),i="",r++):(i+=t[r],r++);return i.trim()&&e.push(this._parseSegment(i.trim())),e}_parseSegment(t){const e={type:"tag"};let r=null,i=t;const s=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(i=s[1]+s[3],s[2])){const t=s[2].slice(1,-1);t&&(r=t)}let n,a,o=i;if(i.includes("::")){const e=i.indexOf("::");if(n=i.substring(0,e).trim(),o=i.substring(e+2).trim(),!n)throw new Error(`Invalid namespace in pattern: ${t}`)}let h=null;if(o.includes(":")){const t=o.lastIndexOf(":"),e=o.substring(0,t).trim(),r=o.substring(t+1).trim();["first","last","odd","even"].includes(r)||/^nth\(\d+\)$/.test(r)?(a=e,h=r):a=o}else a=o;if(!a)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=a,n&&(e.namespace=n),r)if(r.includes("=")){const t=r.indexOf("=");e.attrName=r.substring(0,t).trim(),e.attrValue=r.substring(t+1).trim()}else e.attrName=r.trim();if(h){const t=h.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=h}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class i{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){const t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){const t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){const e=this._matcher.path;if(0!==e.length)return e[e.length-1].values?.[t]}hasAttr(t){const e=this._matcher.path;if(0===e.length)return!1;const r=e[e.length-1];return void 0!==r.values&&t in r.values}getAnyParentAttr(t){return this._matcher.getAnyParentAttr(t)}hasAnyParentAttr(t){return this._matcher.hasAnyParentAttr(t)}getPosition(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].position??0}getCounter(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,e=!0){return this._matcher.toString(t,e)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}}class s{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new i(this),this._keptAttrs=[]}push(t,e=null,r=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const s=this.path.length;let n=this.siblingStacks[s];n||(n={counts:new Map,total:0},this.siblingStacks[s]=n);const a=r?`${r}:${t}`:t,o=n.counts.get(a)||0,h=n.total;n.counts.set(a,o+1),n.total++;const p={tag:t,position:h,counter:o};null!=r&&(p.namespace=r),null!=e&&(p.values=e),this.path.push(p);const u=this.path.length,l=null!==i?i.keep:null;if(null!=l&&l.length>0&&e)for(let t=0;t<l.length;t++){const r=l[t];void 0!==e[r]&&this._keptAttrs.push({depth:u,name:r,value:e[r]})}}pop(){if(0===this.path.length)return;this._pathStringCache=null;const t=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const e=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=e;)this._keptAttrs.pop();return t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0!==this.path.length)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getAnyParentAttr(t){const e=this._keptAttrs;for(let r=e.length-1;r>=0;r--)if(e[r].name===t)return e[r].value}hasAnyParentAttr(t){const e=this._keptAttrs;for(let r=e.length-1;r>=0;r--)if(e[r].name===t)return!0;return!1}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const r=t||this.separator;if(r===this.separator&&!0===e){if(null!==this._pathStringCache)return this._pathStringCache;const t=this.path.map(t=>t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(r);return this._pathStringCache=t,t}return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(r)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++)if(!this._matchSegment(t[e],this.path[e],e===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,r=t.length-1;for(;r>=0&&e>=0;){const i=t[r];if("deep-wildcard"===i.type){if(r--,r<0)return!0;const i=t[r];let s=!1;for(let t=e;t>=0;t--)if(this._matchSegment(i,this.path[t],t===this.path.length-1)){e=t-1,r--,s=!0;break}if(!s)return!1}else{if(!this._matchSegment(i,this.path[e],e===this.path.length-1))return!1;e--,r--}}return r<0}_matchSegment(t,e,r){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!r)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue&&String(e.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!r)return!1;const i=e.counter??0;if("first"===t.position&&0!==i)return!1;if("odd"===t.position&&i%2!=1)return!1;if("even"===t.position&&i%2!=0)return!1;if("nth"===t.position&&i!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),keptAttrs:this._keptAttrs.map(t=>({...t}))}}restore(t){this._pathStringCache=null,this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),this._keptAttrs=(t.keptAttrs||[]).map(t=>({...t}))}readOnly(){return this._view}}function n(t){return"number"==typeof t&&Object.is(t,-0)?"-0":String(t)}function a(t){return n(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function o(t){return n(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function h(t){return n(t).replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const p=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",u=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",l=u+"\\-\\.\\d·̀-ͯ҇‿-⁀",c=(t,e,r="")=>{const i=`[${t.replace(":","")}][${e.replace(":","")}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,r),ncName:new RegExp(`^${i}$`,r),qName:new RegExp(`^${i}(?::${i})?$`,r),nmToken:new RegExp(`^[${e}]+$`,r),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,r)}},f=c(p,p+"\\-\\.\\d·̀-ͯ‿-⁀"),d=c(u,l,"u"),g=":A-Za-z_",m=c(g,g+"\\-\\.\\d"),b=["name","ncName","qName","nmToken","nmTokens"],v=(t,{xmlVersion:e="1.0",asciiOnly:r=!1,maxCacheSize:i=2048}={})=>{if(!b.includes(t))throw new TypeError(`Unknown production "${t}". Must be one of: ${b.join(", ")}`);const s=((t="1.0",e=!1)=>e?m:"1.1"===t?d:f)(e,r)[t];let n=new Map;const a=t=>{const e=n.get(t);if(void 0!==e)return e;const r=s.test(t);return n.size<i&&n.set(t,r),r};return a.reset=()=>{n=new Map},a};function N(t,e,r,i,s){return r.sanitizeName?s(t)?t:r.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function y(t,e){var i="";e.format&&(i="\n");var n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(var a=0;a<e.stopNodes.length;a++){var o=e.stopNodes[a];"string"==typeof o?n.push(new r(o)):o instanceof r&&n.push(o)}var h=function(t,e){if(!Array.isArray(t)||0===t.length)return"1.0";var r=t[0];if("?xml"===_(r)){var i=r[":@"];if(i){var s=e.attributeNamePrefix+"version";if(i[s])return i[s]}}return"1.0"}(t,e),p=v("qName",{xmlVersion:h});return A(t,e,i,new s,n,p)}function A(t,e,r,i,s,h){var p="",u=!1;if(e.maxNestedTags&&i.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){var l=n(t);return E(l,e)}return""}for(var c=0;c<t.length;c++){var f=t[c],d=_(f);if(void 0!==d){var g=d===e.textNodeName||d===e.cdataPropName||d===e.commentPropName||"?"===d[0]?d:N(d,!1,e,i,h),m=x(f[":@"],e);i.push(g,m);var b=O(i,s);if(g!==e.textNodeName)if(g!==e.cdataPropName)if(g!==e.commentPropName)if("?"!==g[0]){var v=r;""!==v&&(v+=e.indentBy);var y=r+"<"+g+w(f[":@"],e,b,i,h),S=void 0;S=b?P(f[d],e):A(f[d],e,v,i,s,h),-1!==e.unpairedTags.indexOf(g)?e.suppressUnpairedNode?p+=y+">":p+=y+"/>":S&&0!==S.length||!e.suppressEmptyNode?S&&S.endsWith(">")?p+=y+">"+S+r+"</"+g+">":(p+=y+">",S&&""!==r&&(S.includes("/>")||S.includes("</"))?p+=r+e.indentBy+S+r:p+=S,p+="</"+g+">"):p+=y+"/>",u=!0,i.pop()}else p+=("?xml"===g?"":r)+"<"+g+w(f[":@"],e,b,i,h)+"?>",u=!0,i.pop();else p+=r+"\x3c!--"+a(f[d][0][e.textNodeName])+"--\x3e",u=!0,i.pop();else u&&(p+=r),p+="<![CDATA["+o(f[d][0][e.textNodeName])+"]]>",u=!1,i.pop();else{var j=f[d];b||(j=E(j=e.tagValueProcessor(g,j),e)),u&&(p+=r),p+=j=n(j),u=!1,i.pop()}}}return p}function x(t,e){if(!t||e.ignoreAttributes)return null;var r={},i=!1;for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s.startsWith(e.attributeNamePrefix)?s.substr(e.attributeNamePrefix.length):s]=h(t[s]),i=!0);return i?r:null}function P(t,e){if(!Array.isArray(t))return null!=t?n(t):"";for(var r="",i=0;i<t.length;i++){var s=t[i],a=_(s);if(a===e.textNodeName)r+=n(s[a]);else if(a===e.cdataPropName)r+=s[a][0][e.textNodeName];else if(a===e.commentPropName)r+=s[a][0][e.textNodeName];else{if(a&&"?"===a[0])continue;if(a){var o=S(s[":@"],e),h=P(s[a],e);h&&0!==h.length?r+="<"+a+o+">"+h+"</"+a+">":r+="<"+a+o+"/>"}}}return r}function S(t,e){var r="";if(t&&!e.ignoreAttributes)for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];!0===s&&e.suppressBooleanAttributes?r+=" "+i.substr(e.attributeNamePrefix.length):r+=" "+i.substr(e.attributeNamePrefix.length)+'="'+h(s)+'"'}return r}function _(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var i=e[r];if(Object.prototype.hasOwnProperty.call(t,i)&&":@"!==i)return i}}function w(t,e,r,i,s){var n="";if(t&&!e.ignoreAttributes)for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){var o=a.substr(e.attributeNamePrefix.length),p=r?o:N(o,!0,e,i,s),u=void 0;!0===(u=r?t[a]:E(u=e.attributeValueProcessor(a,t[a]),e))&&e.suppressBooleanAttributes?n+=" "+p:n+=" "+p+'="'+h(u)+'"'}return n}function O(t,e){if(!e||0===e.length)return!1;for(var r=0;r<e.length;r++)if(t.matches(e[r]))return!0;return!1}function E(t,e){if(t&&t.length>0&&e.processEntities)for(var r=0;r<e.entities.length;r++){var i=e.entities[r];t=t.replace(i.regex,i.val)}return t}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function C(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return k(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}var T={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function $(t){if(this.options=Object.assign({},T,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(function(t){return"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t})),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(var e=0;e<this.options.stopNodes.length;e++){var i=this.options.stopNodes[e];"string"==typeof i?this.stopNodeExpressions.push(new r(i)):i instanceof r&&this.stopNodeExpressions.push(i)}var s;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(s=this.options.ignoreAttributes)?s:Array.isArray(s)?function(t){for(var e,r=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return j(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(s);!(e=r()).done;){var i=e.value;if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:function(){return!1},this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=D),this.processTextOrObjNode=G,this.options.format?(this.indentate=R,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function V(t,e,r,i,s){return r.sanitizeName?s(t)?t:r.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function G(t,e,r,i,s){var n=this.extractAttributes(t);if(i.push(e,n),this.checkStopNode(i)){var a=this.buildRawContent(t),o=this.buildAttributesForStopNode(t);return i.pop(),this.buildObjectNode(a,e,o,r)}var h=this.j2x(t,r+1,i,s);return i.pop(),"?"===e[0]?this.buildTextValNode("",e,h.attrStr,r,i):void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,h.attrStr,r,i):this.buildObjectNode(h.val,e,h.attrStr,r)}function R(t){return this.options.indentBy.repeat(t)}function D(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}return $.prototype.build=function(t){if(this.options.preserveOrder)return y(t,this.options);var e;Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&((e={})[this.options.arrayNodeName]=t,t=e);var r=new s,i=function(t,e){var r=t["?xml"];if(r&&"object"==typeof r){if(e.attributesGroupName&&r[e.attributesGroupName]){var i=r[e.attributesGroupName][e.attributeNamePrefix+"version"];if(i)return i}var s=r[e.attributeNamePrefix+"version"];if(s)return s}return"1.0"}(t,this.options),n=v("qName",{xmlVersion:i});return this.j2x(t,0,r,n).val},$.prototype.j2x=function(t,e,r,i){var s="",a="";if(this.options.maxNestedTags&&r.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");var o=this.options.jPath?r.toString():r,h=this.checkStopNode(r);for(var p in t)if(Object.prototype.hasOwnProperty.call(t,p)){var u=p===this.options.textNodeName||p===this.options.cdataPropName||p===this.options.commentPropName||this.options.attributesGroupName&&p===this.options.attributesGroupName||this.isAttribute(p)||"?"===p[0]?p:V(p,!1,this.options,r,i);if(void 0===t[p])this.isAttribute(p)&&(a+="");else if(null===t[p])this.isAttribute(p)||u===this.options.cdataPropName||u===this.options.commentPropName?a+="":"?"===u[0]?a+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:a+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(t[p]instanceof Date)a+=this.buildTextValNode(t[p],u,"",e,r);else if("object"!=typeof t[p]){var l=this.isAttribute(p);if(l&&!this.ignoreAttributesFn(l,o)){var c=V(l,!0,this.options,r,i);s+=this.buildAttrPairStr(c,n(t[p]),h)}else if(!l)if(p===this.options.textNodeName){var f=this.options.tagValueProcessor(p,n(t[p]));a+=this.replaceEntitiesValue(f)}else{r.push(u);var d=this.checkStopNode(r);if(r.pop(),d){var g=n(t[p]);a+=""===g?this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:this.indentate(e)+"<"+u+">"+g+"</"+u+this.tagEndChar}else a+=this.buildTextValNode(t[p],u,"",e,r)}}else if(Array.isArray(t[p])){for(var m=t[p].length,b="",v="",N=0;N<m;N++){var y=t[p][N];if(void 0===y);else if(null===y)"?"===u[0]?a+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:a+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if("object"==typeof y)if(this.options.oneListGroup){r.push(u);var A=this.j2x(y,e+1,r,i);r.pop(),b+=A.val,this.options.attributesGroupName&&y.hasOwnProperty(this.options.attributesGroupName)&&(v+=A.attrStr)}else b+=this.processTextOrObjNode(y,u,e,r,i);else if(this.options.oneListGroup){var x=this.options.tagValueProcessor(u,y);b+=x=n(x=this.replaceEntitiesValue(x))}else{r.push(u);var P=this.checkStopNode(r);if(r.pop(),P){var S=n(y);b+=""===S?this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:this.indentate(e)+"<"+u+">"+S+"</"+u+this.tagEndChar}else b+=this.buildTextValNode(y,u,"",e,r)}}this.options.oneListGroup&&(b=this.buildObjectNode(b,u,v,e)),a+=b}else if(this.options.attributesGroupName&&p===this.options.attributesGroupName)for(var _=Object.keys(t[p]),w=_.length,O=0;O<w;O++){var E=V(_[O],!0,this.options,r,i);s+=this.buildAttrPairStr(E,n(t[p][_[O]]),h)}else a+=this.processTextOrObjNode(t[p],u,e,r,i)}return{attrStr:s,val:a}},$.prototype.buildAttrPairStr=function(t,e,r){return r||(e=this.options.attributeValueProcessor(t,n(e)),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+h(e)+'"'},$.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;var e={},r=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){var i=t[this.options.attributesGroupName];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s.startsWith(this.options.attributeNamePrefix)?s.substring(this.options.attributeNamePrefix.length):s]=h(i[s]),r=!0)}else for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var a=this.isAttribute(n);a&&(e[a]=h(t[n]),r=!0)}return r?e:null},$.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];var e="";for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&!(this.isAttribute(r)||this.options.attributesGroupName&&r===this.options.attributesGroupName)){var i=t[r];if(r===this.options.textNodeName)e+=i;else if(Array.isArray(i))for(var s,n=C(i);!(s=n()).done;){var a=s.value;if("string"==typeof a||"number"==typeof a)e+="<"+r+">"+a+"</"+r+">";else if("object"==typeof a&&null!==a){var o=this.buildRawContent(a),h=this.buildAttributesForStopNode(a);e+=""===o?"<"+r+h+"/>":"<"+r+h+">"+o+"</"+r+">"}}else if("object"==typeof i&&null!==i){var p=this.buildRawContent(i),u=this.buildAttributesForStopNode(i);e+=""===p?"<"+r+u+"/>":"<"+r+u+">"+p+"</"+r+">"}else e+="<"+r+">"+i+"</"+r+">"}return e},$.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";var e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){var r=t[this.options.attributesGroupName];for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)){var s=i.startsWith(this.options.attributeNamePrefix)?i.substring(this.options.attributeNamePrefix.length):i,n=r[i];!0===n&&this.options.suppressBooleanAttributes?e+=" "+s:e+=" "+s+'="'+h(n)+'"'}}else for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){var o=this.isAttribute(a);if(o){var p=t[a];!0===p&&this.options.suppressBooleanAttributes?e+=" "+o:e+=" "+o+'="'+h(p)+'"'}}return e},$.prototype.buildObjectNode=function(t,e,r,i){if(""===t)return"?"===e[0]?this.indentate(i)+"<"+e+r+"?"+this.tagEndChar:this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar;if("?"===e[0])return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;var s="</"+e+this.tagEndChar,n="";return"?"===e[0]&&(n="?",s=""),!r&&""!==r||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===n.length?this.indentate(i)+"\x3c!--"+a(t)+"--\x3e"+this.newLine:this.indentate(i)+"<"+e+r+n+this.tagEndChar+t+this.indentate(i)+s:this.indentate(i)+"<"+e+r+n+">"+t+s},$.prototype.closeTag=function(t){var e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":"></"+t,e},$.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(var e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},$.prototype.buildTextValNode=function(t,e,r,i,s){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName){var h=o(t);return this.indentate(i)+"<![CDATA["+h+"]]>"+this.newLine}if(!1!==this.options.commentPropName&&e===this.options.commentPropName){var p=a(t);return this.indentate(i)+"\x3c!--"+p+"--\x3e"+this.newLine}if("?"===e[0])return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;var u=this.options.tagValueProcessor(e,t);return""===(u=n(u=this.replaceEntitiesValue(u)))?this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+r+">"+u+"</"+e+this.tagEndChar},$.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(var e=0;e<this.options.entities.length;e++){var r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t},e})());
//# sourceMappingURL=fxb.min.js.map
{
"name": "fast-xml-builder",
"version": "1.3.0",
"version": "1.3.1",
"description": "Build XML from JSON without C/C++ based libraries",

@@ -28,6 +28,3 @@ "main": "./lib/fxb.cjs",

"bundle": "webpack --config webpack.cjs.config.js",
"prettier": "prettier --write src/**/*.js",
"checkReadiness": "publish-please --dry-run",
"publish-please": "publish-please",
"prepublishOnly": "publish-please guard"
"prettier": "prettier --write src/**/*.js"
},

@@ -67,3 +64,2 @@ "files": [

"prettier": "^3.5.1",
"publish-please": "^5.5.2",
"typescript": "5",

@@ -70,0 +66,0 @@ "webpack": "^5.64.4",

@@ -6,3 +6,3 @@ 'use strict';

import { Expression, Matcher } from 'path-expression-matcher';
import { safeComment, safeCdata, escapeAttribute } from './util.js';
import { safeComment, safeCdata, escapeAttribute, valToStr } from './util.js';
import { createValidator } from 'xml-naming';

@@ -213,7 +213,7 @@

const resolvedAttr = resolveTagName(attr, true, this.options, matcher, qNameValidator);
attrStr += this.buildAttrPairStr(resolvedAttr, '' + jObj[key], isCurrentStopNode);
attrStr += this.buildAttrPairStr(resolvedAttr, valToStr(jObj[key]), isCurrentStopNode);
} else if (!attr) {
//tag value
if (key === this.options.textNodeName) {
let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
let newval = this.options.tagValueProcessor(key, valToStr(jObj[key]));
val += this.replaceEntitiesValue(newval);

@@ -228,3 +228,3 @@ } else {

// Build as raw content without encoding
const textValue = '' + jObj[key];
const textValue = valToStr(jObj[key]);
if (textValue === '') {

@@ -271,2 +271,3 @@ val += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;

textValue = this.replaceEntitiesValue(textValue);
textValue = valToStr(textValue);
listTagVal += textValue;

@@ -281,3 +282,3 @@ } else {

// Build as raw content without encoding
const textValue = '' + item;
const textValue = valToStr(item);
if (textValue === '') {

@@ -306,3 +307,3 @@ listTagVal += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;

const resolvedAttr = resolveTagName(Ks[j], true, this.options, matcher, qNameValidator);
attrStr += this.buildAttrPairStr(resolvedAttr, '' + jObj[key][Ks[j]], isCurrentStopNode);
attrStr += this.buildAttrPairStr(resolvedAttr, valToStr(jObj[key][Ks[j]]), isCurrentStopNode);
}

@@ -319,3 +320,3 @@ } else {

if (!isStopNode) {
val = this.options.attributeValueProcessor(attrName, '' + val);
val = this.options.attributeValueProcessor(attrName, valToStr(val));
val = this.replaceEntitiesValue(val);

@@ -580,2 +581,6 @@ }

textValue = this.replaceEntitiesValue(textValue);
// tagValueProcessor may return the raw value unchanged (default is identity), and
// replaceEntitiesValue no-ops on non-strings, so a plain number can still reach here;
// stringify it now, sign-preserving, before it's implicitly ToString'd below.
textValue = valToStr(textValue);

@@ -582,0 +587,0 @@ if (textValue === '') {

import { Expression, Matcher } from 'path-expression-matcher';
import { safeComment, safeCdata, escapeAttribute } from "./util.js";
import { safeComment, safeCdata, escapeAttribute, valToStr } from "./util.js";
import { createValidator } from 'xml-naming';

@@ -91,3 +91,3 @@

if (arr !== undefined && arr !== null) {
let text = arr.toString();
let text = valToStr(arr);
text = replaceEntitiesValue(text, options);

@@ -131,2 +131,3 @@ return text;

}
tagText = valToStr(tagText);
if (isPreviousElementTag) {

@@ -240,3 +241,3 @@ xmlStr += indentation;

if (arr !== undefined && arr !== null) {
return arr.toString();
return valToStr(arr);
}

@@ -253,3 +254,3 @@ return "";

// Raw text content - NO processing, NO entity replacement
content += item[tagName];
content += valToStr(item[tagName]);
} else if (tagName === options.cdataPropName) {

@@ -256,0 +257,0 @@ // CDATA content

// String(val)/val.toString() drop the sign of -0 (e.g. String(-0) === '0'), silently
// corrupting a round-tripped negative-zero value. XML has no separate int/float syntax,
// so this is the single place every raw value gets turned into text.
export function valToStr(val) {
return typeof val === 'number' && Object.is(val, -0) ? '-0' : String(val)
}
export function safeComment(val) {
return String(val)
return valToStr(val)
.replace(/--/g, '- -') // -- is illegal anywhere in comment content

@@ -11,7 +18,7 @@ .replace(/--/g, '- -') // handle the scenario when 2 consiucative dashes appears

export function safeCdata(val) {
return String(val).replace(/\]\]>/g, ']]]]><![CDATA[>')
return valToStr(val).replace(/\]\]>/g, ']]]]><![CDATA[>')
}
export function escapeAttribute(val) {
return String(val).replace(/"/g, '&quot;').replace(/'/g, '&apos;')
return valToStr(val).replace(/"/g, '&quot;').replace(/'/g, '&apos;')
}

Sorry, the diff of this file is too big to display