lone-format 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lone-format.css +1 -1
- package/dist/lone-format.js +1654 -1588
- package/dist/lone-format.umd.cjs +11 -11
- package/package.json +1 -1
package/dist/lone-format.umd.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=l}else e+=l}return o||this.throwError('Unclosed quote after "'+e+'"'),{type:f.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(f.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,f.isIdentifierPart(e));)this.index++;return{type:f.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let s=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let l=this.code;if(l===e){s=!0,this.index++,e===f.CPAREN_CODE&&o&&o>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(l===f.COMMA_CODE){if(this.index++,o++,o!==t.length){if(e===f.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===f.CBRACK_CODE)for(let a=t.length;a<o;a++)t.push(null)}}else if(t.length!==o&&o!==0)this.throwError("Expected comma");else{const a=this.gobbleExpression();(!a||a.type===f.COMPOUND)&&this.throwError("Expected comma"),t.push(a)}}return s||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(f.CPAREN_CODE);if(this.code===f.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:f.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:f.ARRAY_EXP,elements:this.gobbleArguments(f.CBRACK_CODE)}}}const Ye=new We;Object.assign(f,{hooks:Ye,plugins:new Qe(f),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),f.max_unop_len=f.getMaxKeyLen(f.unary_ops),f.max_binop_len=f.getMaxKeyLen(f.binary_ops);const re=n=>new f(n).parse(),De=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(f).filter(n=>!De.includes(n)&&re[n]===void 0).forEach(n=>{re[n]=f[n]}),re.Jsep=f;const Ge="ConditionalExpression";var Ze={name:"ternary",init(n){n.hooks.add("after-expression",function(t){if(t.node&&this.code===n.QUMARK_CODE){this.index++;const s=t.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===n.COLON_CODE){this.index++;const l=this.gobbleExpression();if(l||this.throwError("Expected expression"),t.node={type:Ge,test:s,consequent:o,alternate:l},s.operator&&n.binary_ops[s.operator]<=.9){let a=s;for(;a.right.operator&&n.binary_ops[a.right.operator]<=.9;)a=a.right;t.node.test=a.right,a.right=t.node,t.node=s}}else this.throwError("Expected :")}})}};re.plugins.register(Ze);const Te=47,Je=92;var et={name:"regex",init(n){n.hooks.add("gobble-token",function(t){if(this.code===Te){const s=++this.index;let o=!1;for(;this.index<this.expr.length;){if(this.code===Te&&!o){const l=this.expr.slice(s,this.index);let a="";for(;++this.index<this.expr.length;){const i=this.code;if(i>=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57)a+=this.char;else break}let d;try{d=new RegExp(l,a)}catch(i){this.throwError(i.message)}return t.node={type:n.LITERAL,value:d,raw:this.expr.slice(s-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===n.OBRACK_CODE?o=!0:o&&this.code===n.CBRACK_CODE&&(o=!1),this.index+=this.code===Je?2:1}this.throwError("Unclosed Regex")}})}};const ke=43,fe={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[ke,45],assignmentPrecedence:.9,init(n){const e=[n.IDENTIFIER,n.MEMBER_EXP];fe.assignmentOperators.forEach(s=>n.addBinaryOp(s,fe.assignmentPrecedence,!0)),n.hooks.add("gobble-token",function(o){const l=this.code;fe.updateOperators.some(a=>a===l&&a===this.expr.charCodeAt(this.index+1))&&(this.index+=2,o.node={type:"UpdateExpression",operator:l===ke?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!o.node.argument||!e.includes(o.node.argument.type))&&this.throwError(`Unexpected ${o.node.operator}`))}),n.hooks.add("after-token",function(o){if(o.node){const l=this.code;fe.updateOperators.some(a=>a===l&&a===this.expr.charCodeAt(this.index+1))&&(e.includes(o.node.type)||this.throwError(`Unexpected ${o.node.operator}`),this.index+=2,o.node={type:"UpdateExpression",operator:l===ke?"++":"--",argument:o.node,prefix:!1})}}),n.hooks.add("after-expression",function(o){o.node&&t(o.node)});function t(s){fe.assignmentOperators.has(s.operator)?(s.type="AssignmentExpression",t(s.left),t(s.right)):s.operator||Object.values(s).forEach(o=>{o&&typeof o=="object"&&t(o)})}}};re.plugins.register(et,fe),re.addUnaryOp("typeof"),re.addLiteral("null",null),re.addLiteral("undefined",void 0);const tt=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),j={evalAst(n,e){switch(n.type){case"BinaryExpression":case"LogicalExpression":return j.evalBinaryExpression(n,e);case"Compound":return j.evalCompound(n,e);case"ConditionalExpression":return j.evalConditionalExpression(n,e);case"Identifier":return j.evalIdentifier(n,e);case"Literal":return j.evalLiteral(n,e);case"MemberExpression":return j.evalMemberExpression(n,e);case"UnaryExpression":return j.evalUnaryExpression(n,e);case"ArrayExpression":return j.evalArrayExpression(n,e);case"CallExpression":return j.evalCallExpression(n,e);case"AssignmentExpression":return j.evalAssignmentExpression(n,e);default:throw SyntaxError("Unexpected expression",n)}},evalBinaryExpression(n,e){return{"||":(s,o)=>s||o(),"&&":(s,o)=>s&&o(),"|":(s,o)=>s|o(),"^":(s,o)=>s^o(),"&":(s,o)=>s&o(),"==":(s,o)=>s==o(),"!=":(s,o)=>s!=o(),"===":(s,o)=>s===o(),"!==":(s,o)=>s!==o(),"<":(s,o)=>s<o(),">":(s,o)=>s>o(),"<=":(s,o)=>s<=o(),">=":(s,o)=>s>=o(),"<<":(s,o)=>s<<o(),">>":(s,o)=>s>>o(),">>>":(s,o)=>s>>>o(),"+":(s,o)=>s+o(),"-":(s,o)=>s-o(),"*":(s,o)=>s*o(),"/":(s,o)=>s/o(),"%":(s,o)=>s%o()}[n.operator](j.evalAst(n.left,e),()=>j.evalAst(n.right,e))},evalCompound(n,e){let t;for(let s=0;s<n.body.length;s++){n.body[s].type==="Identifier"&&["var","let","const"].includes(n.body[s].name)&&n.body[s+1]&&n.body[s+1].type==="AssignmentExpression"&&(s+=1);const o=n.body[s];t=j.evalAst(o,e)}return t},evalConditionalExpression(n,e){return j.evalAst(n.test,e)?j.evalAst(n.consequent,e):j.evalAst(n.alternate,e)},evalIdentifier(n,e){if(Object.hasOwn(e,n.name))return e[n.name];throw ReferenceError(`${n.name} is not defined`)},evalLiteral(n){return n.value},evalMemberExpression(n,e){const t=String(n.computed?j.evalAst(n.property):n.property.name),s=j.evalAst(n.object,e);if(s==null)throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);if(!Object.hasOwn(s,t)&&tt.has(t))throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);const o=s[t];return typeof o=="function"?o.bind(s):o},evalUnaryExpression(n,e){return{"-":s=>-j.evalAst(s,e),"!":s=>!j.evalAst(s,e),"~":s=>~j.evalAst(s,e),"+":s=>+j.evalAst(s,e),typeof:s=>typeof j.evalAst(s,e)}[n.operator](n.argument)},evalArrayExpression(n,e){return n.elements.map(t=>j.evalAst(t,e))},evalCallExpression(n,e){const t=n.arguments.map(o=>j.evalAst(o,e));return j.evalAst(n.callee,e)(...t)},evalAssignmentExpression(n,e){if(n.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const t=n.left.name,s=j.evalAst(n.right,e);return e[t]=s,e[t]}};class nt{constructor(e){this.code=e,this.ast=re(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return j.evalAst(this.ast,t)}}function le(n,e){return n=n.slice(),n.push(e),n}function Ne(n,e){return e=e.slice(),e.unshift(n),e}class rt extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}}function K(n,e,t,s,o){if(!(this instanceof K))try{return new K(n,e,t,s,o)}catch(a){if(!a.avoidNew)throw a;return a.value}typeof n=="string"&&(o=s,s=t,t=e,e=n,n=null);const l=n&&typeof n=="object";if(n=n||{},this.json=n.json||t,this.path=n.path||e,this.resultType=n.resultType||"value",this.flatten=n.flatten||!1,this.wrap=Object.hasOwn(n,"wrap")?n.wrap:!0,this.sandbox=n.sandbox||{},this.eval=n.eval===void 0?"safe":n.eval,this.ignoreEvalErrors=typeof n.ignoreEvalErrors>"u"?!1:n.ignoreEvalErrors,this.parent=n.parent||null,this.parentProperty=n.parentProperty||null,this.callback=n.callback||s||null,this.otherTypeCallback=n.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},n.autostart!==!1){const a={path:l?n.path:e};l?"json"in n&&(a.json=n.json):a.json=t;const d=this.evaluate(a);if(!d||typeof d!="object")throw new rt(d);return d}}K.prototype.evaluate=function(n,e,t,s){let o=this.parent,l=this.parentProperty,{flatten:a,wrap:d}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,t=t||this.callback,this.currOtherTypeCallback=s||this.otherTypeCallback,e=e||this.json,n=n||this.path,n&&typeof n=="object"&&!Array.isArray(n)){if(!n.path&&n.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(n,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=n),a=Object.hasOwn(n,"flatten")?n.flatten:a,this.currResultType=Object.hasOwn(n,"resultType")?n.resultType:this.currResultType,this.currSandbox=Object.hasOwn(n,"sandbox")?n.sandbox:this.currSandbox,d=Object.hasOwn(n,"wrap")?n.wrap:d,this.currEval=Object.hasOwn(n,"eval")?n.eval:this.currEval,t=Object.hasOwn(n,"callback")?n.callback:t,this.currOtherTypeCallback=Object.hasOwn(n,"otherTypeCallback")?n.otherTypeCallback:this.currOtherTypeCallback,o=Object.hasOwn(n,"parent")?n.parent:o,l=Object.hasOwn(n,"parentProperty")?n.parentProperty:l,n=n.path}if(o=o||null,l=l||null,Array.isArray(n)&&(n=K.toPathString(n)),!n&&n!==""||!e)return;const i=K.toPathArray(n);i[0]==="$"&&i.length>1&&i.shift(),this._hasParentSelector=null;const c=this._trace(i,e,["$"],o,l,t).filter(function(b){return b&&!b.isParentSelector});return c.length?!d&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce((b,p)=>{const k=this._getPreferredOutput(p);return a&&Array.isArray(k)?b=b.concat(k):b.push(k),b},[]):d?[]:void 0},K.prototype._getPreferredOutput=function(n){const e=this.currResultType;switch(e){case"all":{const t=Array.isArray(n.path)?n.path:K.toPathArray(n.path);return n.pointer=K.toPointer(t),n.path=typeof n.path=="string"?n.path:K.toPathString(n.path),n}case"value":case"parent":case"parentProperty":return n[e];case"path":return K.toPathString(n[e]);case"pointer":return K.toPointer(n.path);default:throw new TypeError("Unknown result type")}},K.prototype._handleCallback=function(n,e,t){if(e){const s=this._getPreferredOutput(n);n.path=typeof n.path=="string"?n.path:K.toPathString(n.path),e(s,t,n)}},K.prototype._trace=function(n,e,t,s,o,l,a,d){let i;if(!n.length)return i={path:t,value:e,parent:s,parentProperty:o,hasArrExpr:a},this._handleCallback(i,l,"value"),i;const c=n[0],b=n.slice(1),p=[];function k(E){Array.isArray(E)?E.forEach(O=>{p.push(O)}):p.push(E)}if((typeof c!="string"||d)&&e&&Object.hasOwn(e,c))k(this._trace(b,e[c],le(t,c),e,c,l,a));else if(c==="*")this._walk(e,E=>{k(this._trace(b,e[E],le(t,E),e,E,l,!0,!0))});else if(c==="..")k(this._trace(b,e,t,s,o,l,a)),this._walk(e,E=>{typeof e[E]=="object"&&k(this._trace(n.slice(),e[E],le(t,E),e,E,l,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:t.slice(0,-1),expr:b,isParentSelector:!0};if(c==="~")return i={path:le(t,c),value:o,parent:s,parentProperty:null},this._handleCallback(i,l,"property"),i;if(c==="$")k(this._trace(b,e,t,null,null,l,a));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c))k(this._slice(c,b,e,t,s,o,l));else if(c.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const E=c.replace(/^\?\((.*?)\)$/u,"$1"),O=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(E);O?this._walk(e,$=>{const w=[O[2]],L=O[1]?e[$][O[1]]:e[$];this._trace(w,L,t,s,o,l,!0).length>0&&k(this._trace(b,e[$],le(t,$),e,$,l,!0))}):this._walk(e,$=>{this._eval(E,e[$],$,t,s,o)&&k(this._trace(b,e[$],le(t,$),e,$,l,!0))})}else if(c[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");k(this._trace(Ne(this._eval(c,e,t.at(-1),t.slice(0,-1),s,o),b),e,t,s,o,l,a))}else if(c[0]==="@"){let E=!1;const O=c.slice(1,-2);switch(O){case"scalar":(!e||!["object","function"].includes(typeof e))&&(E=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===O&&(E=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(E=!0);break;case"number":Number.isFinite(e)&&(E=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(E=!0);break;case"object":e&&typeof e===O&&(E=!0);break;case"array":Array.isArray(e)&&(E=!0);break;case"other":E=this.currOtherTypeCallback(e,t,s,o);break;case"null":e===null&&(E=!0);break;default:throw new TypeError("Unknown value type "+O)}if(E)return i={path:t,value:e,parent:s,parentProperty:o},this._handleCallback(i,l,"value"),i}else if(c[0]==="`"&&e&&Object.hasOwn(e,c.slice(1))){const E=c.slice(1);k(this._trace(b,e[E],le(t,E),e,E,l,a,!0))}else if(c.includes(",")){const E=c.split(",");for(const O of E)k(this._trace(Ne(O,b),e,t,s,o,l,!0))}else!d&&e&&Object.hasOwn(e,c)&&k(this._trace(b,e[c],le(t,c),e,c,l,a,!0))}if(this._hasParentSelector)for(let E=0;E<p.length;E++){const O=p[E];if(O&&O.isParentSelector){const $=this._trace(O.expr,e,O.path,s,o,l,a);if(Array.isArray($)){p[E]=$[0];const w=$.length;for(let L=1;L<w;L++)E++,p.splice(E,0,$[L])}else p[E]=$}}return p},K.prototype._walk=function(n,e){if(Array.isArray(n)){const t=n.length;for(let s=0;s<t;s++)e(s)}else n&&typeof n=="object"&&Object.keys(n).forEach(t=>{e(t)})},K.prototype._slice=function(n,e,t,s,o,l,a){if(!Array.isArray(t))return;const d=t.length,i=n.split(":"),c=i[2]&&Number.parseInt(i[2])||1;let b=i[0]&&Number.parseInt(i[0])||0,p=i[1]&&Number.parseInt(i[1])||d;b=b<0?Math.max(0,b+d):Math.min(d,b),p=p<0?Math.max(0,p+d):Math.min(d,p);const k=[];for(let E=b;E<p;E+=c)this._trace(Ne(E,e),t,s,o,l,a,!0).forEach($=>{k.push($)});return k},K.prototype._eval=function(n,e,t,s,o,l){this.currSandbox._$_parentProperty=l,this.currSandbox._$_parent=o,this.currSandbox._$_property=t,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const a=n.includes("@path");a&&(this.currSandbox._$_path=K.toPathString(s.concat([t])));const d=this.currEval+"Script:"+n;if(!K.cache[d]){let i=n.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(a&&(i=i.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)K.cache[d]=new this.safeVm.Script(i);else if(this.currEval==="native")K.cache[d]=new this.vm.Script(i);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const c=this.currEval;K.cache[d]=new c(i)}else if(typeof this.currEval=="function")K.cache[d]={runInNewContext:c=>this.currEval(i,c)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return K.cache[d].runInNewContext(this.currSandbox)}catch(i){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+i.message+": "+n)}},K.cache={},K.toPathString=function(n){const e=n,t=e.length;let s="$";for(let o=1;o<t;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(s+=/^[0-9*]+$/u.test(e[o])?"["+e[o]+"]":"['"+e[o]+"']");return s},K.toPointer=function(n){const e=n,t=e.length;let s="";for(let o=1;o<t;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(s+="/"+e[o].toString().replaceAll("~","~0").replaceAll("/","~1"));return s},K.toPathArray=function(n){const{cache:e}=K;if(e[n])return e[n].concat();const t=[],o=n.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(l,a){return"[#"+(t.push(a)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(l,a){return"['"+a.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(l,a){return";"+a.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(l){const a=l.match(/#(\d+)/u);return!a||!a[1]?l:t[a[1]]});return e[n]=o,e[n].concat()},K.prototype.safeVm={Script:nt};const ot=function(n,e,t){const s=n.length;for(let o=0;o<s;o++){const l=n[o];t(l)&&e.push(n.splice(o--,1)[0])}};class st{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const s=Object.keys(e),o=[];ot(s,o,c=>typeof e[c]=="function");const l=s.map(c=>e[c]);t=o.reduce((c,b)=>{let p=e[b].toString();return/function/u.test(p)||(p="function "+p),"var "+b+"="+p+";"+c},"")+t,!/(['"])use strict\1/u.test(t)&&!s.includes("arguments")&&(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const d=t.lastIndexOf(";"),i=d!==-1?t.slice(0,d+1)+" return "+t.slice(d+1):" return "+t;return new Function(...s,i)(...l)}}K.prototype.vm={Script:st};const lt={class:"json-node"},at={key:0,class:"json-node__container"},it={class:"json-node__line"},ct=["contenteditable","onKeydown"],dt={key:1,class:"json-node__colon"},ut=["title"],ft=["title"],ht={key:4,class:"json-node__comma"},pt={key:0,class:"json-node__children"},mt={class:"json-node__children-content"},gt={class:"json-node__line json-node__closing-bracket"},yt={class:"json-node__bracket"},bt={key:0,class:"json-node__comma"},Et={key:1,class:"json-node__primitive"},_t=["contenteditable","onKeydown"],xt={key:1,class:"json-node__colon"},kt=["title"],Nt=["contenteditable","onKeydown"],wt={key:0,class:"json-node__comma"},At=r.defineComponent({name:"JsonNode",__name:"JsonNode",props:{value:{},keyName:{},level:{},path:{default:""},expanded:{},isLast:{type:Boolean,default:!1},theme:{}},emits:["update:value","toggle-expand","copy","update:key"],setup(n,{emit:e}){r.useCssVars(u=>({"2a18b018":u.level,"58a14b93":u.theme.colors.syntaxKey,"46fe1b3e":u.theme.colors.hoverBackground,fbe2c048:u.theme.colors.syntaxBracket,"4bd524bb":u.theme.colors.collapsedText,"3308d23c":u.theme.colors.collapsedBackground,"36380c60":u.theme.colors.collapsedBackgroundHover,"0892365d":u.theme.colors.syntaxString,"0015b195":u.theme.colors.syntaxNumber,"7db95f5c":u.theme.colors.syntaxBoolean,"88ec825a":u.theme.colors.syntaxNull,"537157f7":u.theme.colors.background,"3cee3331":u.theme.colors.selectionBackground,"81323cee":u.theme.colors.indentLine}));const t=n,s=e,o=r.ref(!1),l=r.ref(!1),a=r.ref(""),d=r.ref(""),i=r.ref("string"),c=r.ref(null),b=r.ref(null),p=u=>u!==null&&typeof u=="object"&&!Array.isArray(u)&&"__protected_number__"in u&&Object.keys(u).length===1,k=u=>p(u)?u.__protected_number__:"",E=r.computed(()=>p(t.value)?!1:t.value!==null&&typeof t.value=="object"),O=r.computed(()=>Array.isArray(t.value)),$=r.computed(()=>t.path?t.path:t.keyName?t.keyName:"root"),w=r.computed(()=>t.expanded.has($.value)),L=r.computed(()=>t.keyName),F=r.computed(()=>O.value?"[":"{"),M=r.computed(()=>O.value?"]":"}"),z=r.computed(()=>{if(!t.value)return"";const y=Object.keys(t.value).length;return O.value?y>0?` ${y} items `:" ":y>0?` ${y} keys `:" "}),ee=r.computed(()=>{const u=typeof t.value;return t.value===null?"json-node__value--null":u==="boolean"?"json-node__value--boolean":u==="number"||p(t.value)?"json-node__value--number":u==="string"?"json-node__value--string":""}),G=r.computed(()=>t.value===null?"null":typeof t.value=="boolean"||typeof t.value=="number"?String(t.value):p(t.value)?k(t.value):typeof t.value=="string"?`"${t.value}"`:String(t.value)),Z=r.computed(()=>"Double-click to edit"),J=u=>t.level===0?u:$.value?`${$.value}.${u}`:u,te=u=>{const y=Object.keys(t.value);return y.indexOf(u)===y.length-1},_=()=>{s("toggle-expand",$.value)},C=()=>{t.level!==0&&(o.value=!0,a.value=t.keyName,r.nextTick(()=>{if(c.value){c.value.focus();const u=document.createRange();u.selectNodeContents(c.value);const y=window.getSelection();y?.removeAllRanges(),y?.addRange(u)}}))},V=()=>{E.value||(l.value=!0,t.value===null?i.value="null":p(t.value)?i.value="protected-number":typeof t.value=="string"?i.value="string":typeof t.value=="number"?i.value="number":typeof t.value=="boolean"&&(i.value="boolean"),p(t.value)?d.value=k(t.value):typeof t.value=="string"?d.value=t.value:d.value=String(t.value),r.nextTick(()=>{if(b.value){b.value.focus();const u=document.createRange();u.selectNodeContents(b.value);const y=window.getSelection();y?.removeAllRanges(),y?.addRange(u)}}))},A=()=>{if(t.level===0||!o.value)return;const u=c.value?.innerText.trim()||"";if(!u){g();return}if(u===t.keyName){o.value=!1;return}o.value=!1,s("update:key",$.value,u)},T=()=>{if(l.value)try{let u;const y=b.value?.innerText.trim()||"";if(i.value==="string")y==="null"?u=null:y==="true"||y==="false"?u=y==="true":u=y;else if(i.value==="protected-number")u={__protected_number__:y};else if(y==="null")u=null;else if(y==="true"||y==="false")u=y==="true";else if(!isNaN(Number(y))&&y!==""){const B=Number(y);!Number.isSafeInteger(B)||y.length>15?u={__protected_number__:y}:u=B}else u=y;s("update:value",$.value,u),l.value=!1}catch(u){console.error("Failed to parse value:",u),l.value=!1}},g=()=>{o.value=!1,a.value=t.keyName},m=()=>{l.value=!1,p(t.value)?d.value=k(t.value):typeof t.value=="string"?d.value=t.value:d.value=String(t.value)};return(u,y)=>{const B=r.resolveComponent("JsonNode",!0);return r.openBlock(),r.createElementBlock("div",lt,[E.value?(r.openBlock(),r.createElementBlock("div",at,[r.createElementVNode("div",it,[u.keyName?(r.openBlock(),r.createElementBlock("span",{key:0,class:"json-node__key",contenteditable:o.value,onDblclick:C,onKeydown:[r.withKeys(r.withModifiers(A,["prevent"]),["enter"]),r.withKeys(g,["escape"])],onBlur:A,ref_key:"keyRef",ref:c,title:"Double-click to edit key"},r.toDisplayString(o.value?a.value:`"${L.value}"`),41,ct)):r.createCommentVNode("",!0),u.keyName?(r.openBlock(),r.createElementBlock("span",dt,": ")):r.createCommentVNode("",!0),r.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:_,title:w.value?"Click to collapse":"Click to expand"},r.toDisplayString(F.value),9,ut),w.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",{key:2,class:"json-node__collapsed-info",onClick:_,title:`Click to expand ${z.value.trim()}`},r.toDisplayString(z.value),9,ft)),w.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",{key:3,class:"json-node__bracket json-node__bracket--clickable",onClick:_,title:"Click to expand"},r.toDisplayString(M.value),1)),!w.value&&!u.isLast?(r.openBlock(),r.createElementBlock("span",ht,",")):r.createCommentVNode("",!0)]),w.value?(r.openBlock(),r.createElementBlock("div",pt,[r.createElementVNode("div",mt,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u.value,(x,v)=>(r.openBlock(),r.createElementBlock("div",{key:v,class:"json-node__child"},[r.createVNode(B,{value:x,"key-name":O.value?"":String(v),level:u.level+1,path:J(String(v)),expanded:u.expanded,theme:u.theme,"onUpdate:value":y[0]||(y[0]=(S,I)=>u.$emit("update:value",S,I)),onToggleExpand:y[1]||(y[1]=S=>u.$emit("toggle-expand",S)),onCopy:y[2]||(y[2]=S=>u.$emit("copy",S)),"onUpdate:key":y[3]||(y[3]=(S,I)=>u.$emit("update:key",S,I)),"is-last":te(String(v))},null,8,["value","key-name","level","path","expanded","theme","is-last"])]))),128))]),r.createElementVNode("div",gt,[r.createElementVNode("span",yt,r.toDisplayString(M.value),1),u.isLast?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",bt,","))])])):r.createCommentVNode("",!0)])):(r.openBlock(),r.createElementBlock("div",Et,[u.keyName?(r.openBlock(),r.createElementBlock("span",{key:0,class:"json-node__key",contenteditable:o.value,onDblclick:C,onKeydown:[r.withKeys(r.withModifiers(A,["prevent"]),["enter"]),r.withKeys(g,["escape"])],onBlur:A,ref_key:"keyRef",ref:c,title:"Double-click to edit key"},r.toDisplayString(o.value?a.value:`"${L.value}"`),41,_t)):r.createCommentVNode("",!0),u.keyName?(r.openBlock(),r.createElementBlock("span",xt,": ")):r.createCommentVNode("",!0),r.createElementVNode("span",{class:r.normalizeClass(["json-node__value-wrapper",ee.value]),onDblclick:V,title:Z.value},[r.createElementVNode("span",{class:"json-node__value",contenteditable:l.value,onKeydown:[r.withKeys(r.withModifiers(T,["prevent"]),["enter"]),r.withKeys(m,["escape"])],onBlur:T,ref_key:"valueRef",ref:b},r.toDisplayString(l.value?d.value:G.value),41,Nt),u.isLast?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",wt,","))],42,kt)]))])}}}),ge=(n,e)=>{const t=n.__vccOpts||n;for(const[s,o]of e)t[s]=o;return t},Ct=ge(At,[["__scopeId","data-v-1472a8af"]]),ve={name:"github-light",colors:{background:"#ffffff",surfaceBackground:"#f6f8fa",border:"#d0d7de",text:"#24292f",textSecondary:"#656d76",buttonBackground:"#f6f8fa",buttonBackgroundHover:"#f3f4f6",buttonBorder:"#d0d7de",buttonText:"#24292f",buttonPrimary:"#2da44e",buttonPrimaryHover:"#2c974b",success:"#1a7f37",successBackground:"#dafbe1",error:"#cf222e",errorBackground:"#ffebe9",syntaxString:"#0a3069",syntaxNumber:"#0969da",syntaxBoolean:"#8250df",syntaxNull:"#656d76",syntaxKey:"#0969da",syntaxBracket:"#24292f",hoverBackground:"#f6f8fa",selectionBackground:"rgba(9, 105, 218, 0.2)",collapsedBackground:"#ddf4ff",collapsedBackgroundHover:"#b6e3ff",collapsedText:"#0969da",indentLine:"#d0d7de"}},Bt={"github-light":ve,"github-dark":{name:"github-dark",colors:{background:"#0d1117",surfaceBackground:"#161b22",border:"#30363d",text:"#e6edf3",textSecondary:"#7d8590",buttonBackground:"#21262d",buttonBackgroundHover:"#30363d",buttonBorder:"#30363d",buttonText:"#e6edf3",buttonPrimary:"#238636",buttonPrimaryHover:"#2ea043",success:"#3fb950",successBackground:"#0f2419",error:"#f85149",errorBackground:"#381921",syntaxString:"#a5d6ff",syntaxNumber:"#79c0ff",syntaxBoolean:"#d2a8ff",syntaxNull:"#7d8590",syntaxKey:"#79c0ff",syntaxBracket:"#e6edf3",hoverBackground:"#161b22",selectionBackground:"rgba(121, 192, 255, 0.2)",collapsedBackground:"#1c2128",collapsedBackgroundHover:"#2d333b",collapsedText:"#79c0ff",indentLine:"#30363d"}},"min-light":{name:"min-light",colors:{background:"#ffffff",surfaceBackground:"#fafafa",border:"#e5e5e5",text:"#333333",textSecondary:"#888888",buttonBackground:"#f8f8f8",buttonBackgroundHover:"#eeeeee",buttonBorder:"#e0e0e0",buttonText:"#333333",buttonPrimary:"#007acc",buttonPrimaryHover:"#005a9e",success:"#22c55e",successBackground:"#f0fdf4",error:"#ef4444",errorBackground:"#fef2f2",syntaxString:"#22c55e",syntaxNumber:"#3b82f6",syntaxBoolean:"#8b5cf6",syntaxNull:"#6b7280",syntaxKey:"#1f2937",syntaxBracket:"#374151",hoverBackground:"#f9f9f9",selectionBackground:"rgba(59, 130, 246, 0.2)",collapsedBackground:"#e0f2fe",collapsedBackgroundHover:"#bae6fd",collapsedText:"#0284c7",indentLine:"#e5e7eb"}},"slack-ochin":{name:"slack-ochin",colors:{background:"#fefbf6",surfaceBackground:"#faf6f0",border:"#e8d5b7",text:"#4a3b2a",textSecondary:"#8b7355",buttonBackground:"#f4ede4",buttonBackgroundHover:"#efe5d8",buttonBorder:"#e8d5b7",buttonText:"#4a3b2a",buttonPrimary:"#ff6b35",buttonPrimaryHover:"#e55a2b",success:"#ff9500",successBackground:"#fff8f0",error:"#d73502",errorBackground:"#ffeee8",syntaxString:"#d73502",syntaxNumber:"#ff6b35",syntaxBoolean:"#b7472a",syntaxNull:"#8b7355",syntaxKey:"#4a3b2a",syntaxBracket:"#6b5444",hoverBackground:"#f8f2eb",selectionBackground:"rgba(255, 107, 53, 0.2)",collapsedBackground:"#ffe8d6",collapsedBackgroundHover:"#ffd4b0",collapsedText:"#d73502",indentLine:"#e8d5b7"}}};function Tt(n="github-light"){return Bt[n]||ve}const vt={key:0,class:"json-format__toolbar"},St={class:"json-format__actions"},Ot=["disabled"],$t=["disabled"],Pt=["disabled"],Vt=["disabled"],It={class:"json-format__info"},Rt={key:0,class:"json-format__status json-format__status--success"},Lt={key:1,class:"json-format__status json-format__status--error"},Mt={class:"json-format__content"},Kt={key:0,class:"json-format__error"},jt={key:1,class:"json-format__error"},Ut={key:2,class:"json-format__viewer"},Se=ge(r.defineComponent({name:"JsonFormat",__name:"index",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},maxDepth:{default:10},showToolbar:{type:Boolean,default:!0},theme:{default:"github-light"}},emits:["update:modelValue","copy-success","copy-error","expand-all","collapse-all","compress"],setup(n,{expose:e,emit:t}){r.useCssVars(g=>({"325d5f6b":p.value.colors.border,"407388ed":p.value.colors.background,"1276f42c":p.value.colors.text,"34805dc8":p.value.colors.surfaceBackground,"212f19fd":p.value.colors.buttonBorder,b83cab02:p.value.colors.buttonBackground,b58ba984:p.value.colors.buttonText,d50a3406:p.value.colors.buttonBackgroundHover,"2421bb5e":p.value.colors.buttonPrimary,"0299816b":p.value.colors.buttonPrimaryHover,"55f370f2":p.value.colors.successBackground,b3fc86b8:p.value.colors.success,"781064f7":p.value.colors.errorBackground,"3b9a02e9":p.value.colors.error}));const s=n,o=t,l=r.ref(null),a=r.ref(""),d=r.ref(new Set),i=r.ref(null),c=r.ref(""),b=r.computed(()=>a.value===""),p=r.computed(()=>Tt(s.theme)),k=r.computed(()=>c.value?null:i.value!==null?i.value:l.value),E=g=>{if(!g.trim()){l.value=null,a.value="",i.value=null,c.value="";return}try{let m=g;const u=/(:\s*|,\s*|\[\s*)-?\d{16,}/.test(m),y=/(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(m);if(!u&&!y)try{l.value=JSON.parse(m),a.value="",i.value=null,c.value="",r.nextTick(()=>{k.value!==null&&z()});return}catch{}m=(x=>{let v="",S=!1,I=!1,U=0;for(;U<x.length;){const Y=x[U];if(S)I?I=!1:Y==="\\"?I=!0:Y==='"'&&(S=!1),v+=Y,U++;else if(Y==='"')S=!0,v+=Y,U++;else{const ue=x.slice(U);let q=ue.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);if(q){v+=q[1]+'{"__protected_number__":"'+q[2]+'"}'+q[3],U+=q[0].length;continue}if(q=ue.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/),q){v+=q[1]+'{"__protected_number__":"'+q[2]+'"}'+q[3],U+=q[0].length;continue}v+=Y,U++}}return v})(m),l.value=JSON.parse(m),a.value="",i.value=null,c.value="",r.nextTick(()=>{k.value!==null&&z()})}catch(m){a.value=m instanceof Error?m.message:"Unknown parsing error",l.value=null,i.value=null,c.value=""}},O=g=>{if(!g||!g.expression.trim()){$();return}if(!l.value){c.value="No valid JSON data to filter";return}try{let m;if(g.type==="jsonpath")m=K({path:g.expression,json:l.value}),m.length===1&&g.expression.includes("$[")===!1&&!g.expression.endsWith("[*]")?i.value=m[0]:i.value=m;else if(g.type==="js")m=new Function("data",`
|
|
1
|
+
(function(le,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(le=typeof globalThis<"u"?globalThis:le||self,r(le.LoneFormat={},le.Vue))})(this,function(le,r){"use strict";class qe{add(e,t,s){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(o){this[o]=this[o]||[],t&&this[o][s?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(s){s.call(t&&t.context?t.context:t,t)})}}class Qe{constructor(e){this.jsep=e,this.registered={}}register(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];t.forEach(o=>{if(typeof o!="object"||!o.name||!o.init)throw new Error("Invalid JSEP plugin format");this.registered[o.name]||(o.init(this.jsep),this.registered[o.name]=o)})}}class f{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+f.version}static addUnaryOp(e){return f.max_unop_len=Math.max(e.length,f.max_unop_len),f.unary_ops[e]=1,f}static addBinaryOp(e,t,s){return f.max_binop_len=Math.max(e.length,f.max_binop_len),f.binary_ops[e]=t,s?f.right_associative.add(e):f.right_associative.delete(e),f}static addIdentifierChar(e){return f.additional_identifier_chars.add(e),f}static addLiteral(e,t){return f.literals[e]=t,f}static removeUnaryOp(e){return delete f.unary_ops[e],e.length===f.max_unop_len&&(f.max_unop_len=f.getMaxKeyLen(f.unary_ops)),f}static removeAllUnaryOps(){return f.unary_ops={},f.max_unop_len=0,f}static removeIdentifierChar(e){return f.additional_identifier_chars.delete(e),f}static removeBinaryOp(e){return delete f.binary_ops[e],e.length===f.max_binop_len&&(f.max_binop_len=f.getMaxKeyLen(f.binary_ops)),f.right_associative.delete(e),f}static removeAllBinaryOps(){return f.binary_ops={},f.max_binop_len=0,f}static removeLiteral(e){return delete f.literals[e],f}static removeAllLiterals(){return f.literals={},f}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new f(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(t=>t.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return f.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!f.binary_ops[String.fromCharCode(e)]||f.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return f.isIdentifierStart(e)||f.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(f.hooks[e]){const s={context:this,node:t};return f.hooks.run(e,s),s.node}return t}searchHook(e){if(f.hooks[e]){const t={context:this};return f.hooks[e].find(function(s){return s.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===f.SPACE_CODE||e===f.TAB_CODE||e===f.LF_CODE||e===f.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=e.length===1?e[0]:{type:f.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],s,o;for(;this.index<this.expr.length;)if(s=this.code,s===f.SEMCOL_CODE||s===f.COMMA_CODE)this.index++;else if(o=this.gobbleExpression())t.push(o);else if(this.index<this.expr.length){if(s===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,f.max_binop_len),t=e.length;for(;t>0;){if(f.binary_ops.hasOwnProperty(e)&&(!f.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!f.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,s,o,l,a,d,i,c;if(a=this.gobbleToken(),!a||(t=this.gobbleBinaryOp(),!t))return a;for(l={value:t,prec:f.binaryPrecedence(t),right_a:f.right_associative.has(t)},d=this.gobbleToken(),d||this.throwError("Expected expression after "+t),o=[a,l,d];t=this.gobbleBinaryOp();){if(s=f.binaryPrecedence(t),s===0){this.index-=t.length;break}l={value:t,prec:s,right_a:f.right_associative.has(t)},c=t;const g=p=>l.right_a&&p.right_a?s>p.prec:s<=p.prec;for(;o.length>2&&g(o[o.length-2]);)d=o.pop(),t=o.pop().value,a=o.pop(),e={type:f.BINARY_EXP,operator:t,left:a,right:d},o.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+c),o.push(l,e)}for(i=o.length-1,e=o[i];i>1;)e={type:f.BINARY_EXP,operator:o[i-1].value,left:o[i-2],right:e},i-=2;return e}gobbleToken(){let e,t,s,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(e=this.code,f.isDecimalDigit(e)||e===f.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===f.SQUOTE_CODE||e===f.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(e===f.OBRACK_CODE)o=this.gobbleArray();else{for(t=this.expr.substr(this.index,f.max_unop_len),s=t.length;s>0;){if(f.unary_ops.hasOwnProperty(t)&&(!f.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!f.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=s;const l=this.gobbleToken();return l||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:f.UNARY_EXP,operator:t,argument:l,prefix:!0})}t=t.substr(0,--s)}f.isIdentifierStart(e)?(o=this.gobbleIdentifier(),f.literals.hasOwnProperty(o.name)?o={type:f.LITERAL,value:f.literals[o.name],raw:o.name}:o.name===f.this_str&&(o={type:f.THIS_EXP})):e===f.OPAREN_CODE&&(o=this.gobbleGroup())}return o?(o=this.gobbleTokenProperty(o),this.runHook("after-token",o)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===f.PERIOD_CODE||t===f.OBRACK_CODE||t===f.OPAREN_CODE||t===f.QUMARK_CODE;){let s;if(t===f.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==f.PERIOD_CODE)break;s=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===f.OBRACK_CODE?(e={type:f.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},e.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==f.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===f.OPAREN_CODE?e={type:f.CALL_EXP,arguments:this.gobbleArguments(f.CPAREN_CODE),callee:e}:(t===f.PERIOD_CODE||s)&&(s&&this.index--,this.gobbleSpaces(),e={type:f.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),s&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,s;for(;f.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===f.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);f.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(t=this.char,t==="e"||t==="E"){for(e+=this.expr.charAt(this.index++),t=this.char,(t==="+"||t==="-")&&(e+=this.expr.charAt(this.index++));f.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);f.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return s=this.code,f.isIdentifierStart(s)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(s===f.PERIOD_CODE||e.length===1&&e.charCodeAt(0)===f.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:f.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="";const t=this.index,s=this.expr.charAt(this.index++);let o=!1;for(;this.index<this.expr.length;){let l=this.expr.charAt(this.index++);if(l===s){o=!0;break}else if(l==="\\")switch(l=this.expr.charAt(this.index++),l){case"n":e+=`
|
|
2
|
+
`;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=l}else e+=l}return o||this.throwError('Unclosed quote after "'+e+'"'),{type:f.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(f.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,f.isIdentifierPart(e));)this.index++;return{type:f.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let s=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let l=this.code;if(l===e){s=!0,this.index++,e===f.CPAREN_CODE&&o&&o>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(l===f.COMMA_CODE){if(this.index++,o++,o!==t.length){if(e===f.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===f.CBRACK_CODE)for(let a=t.length;a<o;a++)t.push(null)}}else if(t.length!==o&&o!==0)this.throwError("Expected comma");else{const a=this.gobbleExpression();(!a||a.type===f.COMPOUND)&&this.throwError("Expected comma"),t.push(a)}}return s||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(f.CPAREN_CODE);if(this.code===f.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:f.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:f.ARRAY_EXP,elements:this.gobbleArguments(f.CBRACK_CODE)}}}const Ye=new qe;Object.assign(f,{hooks:Ye,plugins:new Qe(f),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),f.max_unop_len=f.getMaxKeyLen(f.unary_ops),f.max_binop_len=f.getMaxKeyLen(f.binary_ops);const ae=n=>new f(n).parse(),De=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(f).filter(n=>!De.includes(n)&&ae[n]===void 0).forEach(n=>{ae[n]=f[n]}),ae.Jsep=f;const Ge="ConditionalExpression";var Ze={name:"ternary",init(n){n.hooks.add("after-expression",function(t){if(t.node&&this.code===n.QUMARK_CODE){this.index++;const s=t.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===n.COLON_CODE){this.index++;const l=this.gobbleExpression();if(l||this.throwError("Expected expression"),t.node={type:Ge,test:s,consequent:o,alternate:l},s.operator&&n.binary_ops[s.operator]<=.9){let a=s;for(;a.right.operator&&n.binary_ops[a.right.operator]<=.9;)a=a.right;t.node.test=a.right,a.right=t.node,t.node=s}}else this.throwError("Expected :")}})}};ae.plugins.register(Ze);const ve=47,Je=92;var et={name:"regex",init(n){n.hooks.add("gobble-token",function(t){if(this.code===ve){const s=++this.index;let o=!1;for(;this.index<this.expr.length;){if(this.code===ve&&!o){const l=this.expr.slice(s,this.index);let a="";for(;++this.index<this.expr.length;){const i=this.code;if(i>=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57)a+=this.char;else break}let d;try{d=new RegExp(l,a)}catch(i){this.throwError(i.message)}return t.node={type:n.LITERAL,value:d,raw:this.expr.slice(s-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===n.OBRACK_CODE?o=!0:o&&this.code===n.CBRACK_CODE&&(o=!1),this.index+=this.code===Je?2:1}this.throwError("Unclosed Regex")}})}};const Ne=43,me={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[Ne,45],assignmentPrecedence:.9,init(n){const e=[n.IDENTIFIER,n.MEMBER_EXP];me.assignmentOperators.forEach(s=>n.addBinaryOp(s,me.assignmentPrecedence,!0)),n.hooks.add("gobble-token",function(o){const l=this.code;me.updateOperators.some(a=>a===l&&a===this.expr.charCodeAt(this.index+1))&&(this.index+=2,o.node={type:"UpdateExpression",operator:l===Ne?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!o.node.argument||!e.includes(o.node.argument.type))&&this.throwError(`Unexpected ${o.node.operator}`))}),n.hooks.add("after-token",function(o){if(o.node){const l=this.code;me.updateOperators.some(a=>a===l&&a===this.expr.charCodeAt(this.index+1))&&(e.includes(o.node.type)||this.throwError(`Unexpected ${o.node.operator}`),this.index+=2,o.node={type:"UpdateExpression",operator:l===Ne?"++":"--",argument:o.node,prefix:!1})}}),n.hooks.add("after-expression",function(o){o.node&&t(o.node)});function t(s){me.assignmentOperators.has(s.operator)?(s.type="AssignmentExpression",t(s.left),t(s.right)):s.operator||Object.values(s).forEach(o=>{o&&typeof o=="object"&&t(o)})}}};ae.plugins.register(et,me),ae.addUnaryOp("typeof"),ae.addLiteral("null",null),ae.addLiteral("undefined",void 0);const tt=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),z={evalAst(n,e){switch(n.type){case"BinaryExpression":case"LogicalExpression":return z.evalBinaryExpression(n,e);case"Compound":return z.evalCompound(n,e);case"ConditionalExpression":return z.evalConditionalExpression(n,e);case"Identifier":return z.evalIdentifier(n,e);case"Literal":return z.evalLiteral(n,e);case"MemberExpression":return z.evalMemberExpression(n,e);case"UnaryExpression":return z.evalUnaryExpression(n,e);case"ArrayExpression":return z.evalArrayExpression(n,e);case"CallExpression":return z.evalCallExpression(n,e);case"AssignmentExpression":return z.evalAssignmentExpression(n,e);default:throw SyntaxError("Unexpected expression",n)}},evalBinaryExpression(n,e){return{"||":(s,o)=>s||o(),"&&":(s,o)=>s&&o(),"|":(s,o)=>s|o(),"^":(s,o)=>s^o(),"&":(s,o)=>s&o(),"==":(s,o)=>s==o(),"!=":(s,o)=>s!=o(),"===":(s,o)=>s===o(),"!==":(s,o)=>s!==o(),"<":(s,o)=>s<o(),">":(s,o)=>s>o(),"<=":(s,o)=>s<=o(),">=":(s,o)=>s>=o(),"<<":(s,o)=>s<<o(),">>":(s,o)=>s>>o(),">>>":(s,o)=>s>>>o(),"+":(s,o)=>s+o(),"-":(s,o)=>s-o(),"*":(s,o)=>s*o(),"/":(s,o)=>s/o(),"%":(s,o)=>s%o()}[n.operator](z.evalAst(n.left,e),()=>z.evalAst(n.right,e))},evalCompound(n,e){let t;for(let s=0;s<n.body.length;s++){n.body[s].type==="Identifier"&&["var","let","const"].includes(n.body[s].name)&&n.body[s+1]&&n.body[s+1].type==="AssignmentExpression"&&(s+=1);const o=n.body[s];t=z.evalAst(o,e)}return t},evalConditionalExpression(n,e){return z.evalAst(n.test,e)?z.evalAst(n.consequent,e):z.evalAst(n.alternate,e)},evalIdentifier(n,e){if(Object.hasOwn(e,n.name))return e[n.name];throw ReferenceError(`${n.name} is not defined`)},evalLiteral(n){return n.value},evalMemberExpression(n,e){const t=String(n.computed?z.evalAst(n.property):n.property.name),s=z.evalAst(n.object,e);if(s==null)throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);if(!Object.hasOwn(s,t)&&tt.has(t))throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);const o=s[t];return typeof o=="function"?o.bind(s):o},evalUnaryExpression(n,e){return{"-":s=>-z.evalAst(s,e),"!":s=>!z.evalAst(s,e),"~":s=>~z.evalAst(s,e),"+":s=>+z.evalAst(s,e),typeof:s=>typeof z.evalAst(s,e)}[n.operator](n.argument)},evalArrayExpression(n,e){return n.elements.map(t=>z.evalAst(t,e))},evalCallExpression(n,e){const t=n.arguments.map(o=>z.evalAst(o,e));return z.evalAst(n.callee,e)(...t)},evalAssignmentExpression(n,e){if(n.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const t=n.left.name,s=z.evalAst(n.right,e);return e[t]=s,e[t]}};class nt{constructor(e){this.code=e,this.ast=ae(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return z.evalAst(this.ast,t)}}function de(n,e){return n=n.slice(),n.push(e),n}function we(n,e){return e=e.slice(),e.unshift(n),e}class rt extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}}function K(n,e,t,s,o){if(!(this instanceof K))try{return new K(n,e,t,s,o)}catch(a){if(!a.avoidNew)throw a;return a.value}typeof n=="string"&&(o=s,s=t,t=e,e=n,n=null);const l=n&&typeof n=="object";if(n=n||{},this.json=n.json||t,this.path=n.path||e,this.resultType=n.resultType||"value",this.flatten=n.flatten||!1,this.wrap=Object.hasOwn(n,"wrap")?n.wrap:!0,this.sandbox=n.sandbox||{},this.eval=n.eval===void 0?"safe":n.eval,this.ignoreEvalErrors=typeof n.ignoreEvalErrors>"u"?!1:n.ignoreEvalErrors,this.parent=n.parent||null,this.parentProperty=n.parentProperty||null,this.callback=n.callback||s||null,this.otherTypeCallback=n.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},n.autostart!==!1){const a={path:l?n.path:e};l?"json"in n&&(a.json=n.json):a.json=t;const d=this.evaluate(a);if(!d||typeof d!="object")throw new rt(d);return d}}K.prototype.evaluate=function(n,e,t,s){let o=this.parent,l=this.parentProperty,{flatten:a,wrap:d}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,t=t||this.callback,this.currOtherTypeCallback=s||this.otherTypeCallback,e=e||this.json,n=n||this.path,n&&typeof n=="object"&&!Array.isArray(n)){if(!n.path&&n.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(n,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=n),a=Object.hasOwn(n,"flatten")?n.flatten:a,this.currResultType=Object.hasOwn(n,"resultType")?n.resultType:this.currResultType,this.currSandbox=Object.hasOwn(n,"sandbox")?n.sandbox:this.currSandbox,d=Object.hasOwn(n,"wrap")?n.wrap:d,this.currEval=Object.hasOwn(n,"eval")?n.eval:this.currEval,t=Object.hasOwn(n,"callback")?n.callback:t,this.currOtherTypeCallback=Object.hasOwn(n,"otherTypeCallback")?n.otherTypeCallback:this.currOtherTypeCallback,o=Object.hasOwn(n,"parent")?n.parent:o,l=Object.hasOwn(n,"parentProperty")?n.parentProperty:l,n=n.path}if(o=o||null,l=l||null,Array.isArray(n)&&(n=K.toPathString(n)),!n&&n!==""||!e)return;const i=K.toPathArray(n);i[0]==="$"&&i.length>1&&i.shift(),this._hasParentSelector=null;const c=this._trace(i,e,["$"],o,l,t).filter(function(g){return g&&!g.isParentSelector});return c.length?!d&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce((g,p)=>{const w=this._getPreferredOutput(p);return a&&Array.isArray(w)?g=g.concat(w):g.push(w),g},[]):d?[]:void 0},K.prototype._getPreferredOutput=function(n){const e=this.currResultType;switch(e){case"all":{const t=Array.isArray(n.path)?n.path:K.toPathArray(n.path);return n.pointer=K.toPointer(t),n.path=typeof n.path=="string"?n.path:K.toPathString(n.path),n}case"value":case"parent":case"parentProperty":return n[e];case"path":return K.toPathString(n[e]);case"pointer":return K.toPointer(n.path);default:throw new TypeError("Unknown result type")}},K.prototype._handleCallback=function(n,e,t){if(e){const s=this._getPreferredOutput(n);n.path=typeof n.path=="string"?n.path:K.toPathString(n.path),e(s,t,n)}},K.prototype._trace=function(n,e,t,s,o,l,a,d){let i;if(!n.length)return i={path:t,value:e,parent:s,parentProperty:o,hasArrExpr:a},this._handleCallback(i,l,"value"),i;const c=n[0],g=n.slice(1),p=[];function w(k){Array.isArray(k)?k.forEach(S=>{p.push(S)}):p.push(k)}if((typeof c!="string"||d)&&e&&Object.hasOwn(e,c))w(this._trace(g,e[c],de(t,c),e,c,l,a));else if(c==="*")this._walk(e,k=>{w(this._trace(g,e[k],de(t,k),e,k,l,!0,!0))});else if(c==="..")w(this._trace(g,e,t,s,o,l,a)),this._walk(e,k=>{typeof e[k]=="object"&&w(this._trace(n.slice(),e[k],de(t,k),e,k,l,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:t.slice(0,-1),expr:g,isParentSelector:!0};if(c==="~")return i={path:de(t,c),value:o,parent:s,parentProperty:null},this._handleCallback(i,l,"property"),i;if(c==="$")w(this._trace(g,e,t,null,null,l,a));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c))w(this._slice(c,g,e,t,s,o,l));else if(c.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const k=c.replace(/^\?\((.*?)\)$/u,"$1"),S=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(k);S?this._walk(e,$=>{const B=[S[2]],M=S[1]?e[$][S[1]]:e[$];this._trace(B,M,t,s,o,l,!0).length>0&&w(this._trace(g,e[$],de(t,$),e,$,l,!0))}):this._walk(e,$=>{this._eval(k,e[$],$,t,s,o)&&w(this._trace(g,e[$],de(t,$),e,$,l,!0))})}else if(c[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");w(this._trace(we(this._eval(c,e,t.at(-1),t.slice(0,-1),s,o),g),e,t,s,o,l,a))}else if(c[0]==="@"){let k=!1;const S=c.slice(1,-2);switch(S){case"scalar":(!e||!["object","function"].includes(typeof e))&&(k=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===S&&(k=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(k=!0);break;case"number":Number.isFinite(e)&&(k=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(k=!0);break;case"object":e&&typeof e===S&&(k=!0);break;case"array":Array.isArray(e)&&(k=!0);break;case"other":k=this.currOtherTypeCallback(e,t,s,o);break;case"null":e===null&&(k=!0);break;default:throw new TypeError("Unknown value type "+S)}if(k)return i={path:t,value:e,parent:s,parentProperty:o},this._handleCallback(i,l,"value"),i}else if(c[0]==="`"&&e&&Object.hasOwn(e,c.slice(1))){const k=c.slice(1);w(this._trace(g,e[k],de(t,k),e,k,l,a,!0))}else if(c.includes(",")){const k=c.split(",");for(const S of k)w(this._trace(we(S,g),e,t,s,o,l,!0))}else!d&&e&&Object.hasOwn(e,c)&&w(this._trace(g,e[c],de(t,c),e,c,l,a,!0))}if(this._hasParentSelector)for(let k=0;k<p.length;k++){const S=p[k];if(S&&S.isParentSelector){const $=this._trace(S.expr,e,S.path,s,o,l,a);if(Array.isArray($)){p[k]=$[0];const B=$.length;for(let M=1;M<B;M++)k++,p.splice(k,0,$[M])}else p[k]=$}}return p},K.prototype._walk=function(n,e){if(Array.isArray(n)){const t=n.length;for(let s=0;s<t;s++)e(s)}else n&&typeof n=="object"&&Object.keys(n).forEach(t=>{e(t)})},K.prototype._slice=function(n,e,t,s,o,l,a){if(!Array.isArray(t))return;const d=t.length,i=n.split(":"),c=i[2]&&Number.parseInt(i[2])||1;let g=i[0]&&Number.parseInt(i[0])||0,p=i[1]&&Number.parseInt(i[1])||d;g=g<0?Math.max(0,g+d):Math.min(d,g),p=p<0?Math.max(0,p+d):Math.min(d,p);const w=[];for(let k=g;k<p;k+=c)this._trace(we(k,e),t,s,o,l,a,!0).forEach($=>{w.push($)});return w},K.prototype._eval=function(n,e,t,s,o,l){this.currSandbox._$_parentProperty=l,this.currSandbox._$_parent=o,this.currSandbox._$_property=t,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const a=n.includes("@path");a&&(this.currSandbox._$_path=K.toPathString(s.concat([t])));const d=this.currEval+"Script:"+n;if(!K.cache[d]){let i=n.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(a&&(i=i.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)K.cache[d]=new this.safeVm.Script(i);else if(this.currEval==="native")K.cache[d]=new this.vm.Script(i);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const c=this.currEval;K.cache[d]=new c(i)}else if(typeof this.currEval=="function")K.cache[d]={runInNewContext:c=>this.currEval(i,c)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return K.cache[d].runInNewContext(this.currSandbox)}catch(i){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+i.message+": "+n)}},K.cache={},K.toPathString=function(n){const e=n,t=e.length;let s="$";for(let o=1;o<t;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(s+=/^[0-9*]+$/u.test(e[o])?"["+e[o]+"]":"['"+e[o]+"']");return s},K.toPointer=function(n){const e=n,t=e.length;let s="";for(let o=1;o<t;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(s+="/"+e[o].toString().replaceAll("~","~0").replaceAll("/","~1"));return s},K.toPathArray=function(n){const{cache:e}=K;if(e[n])return e[n].concat();const t=[],o=n.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(l,a){return"[#"+(t.push(a)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(l,a){return"['"+a.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(l,a){return";"+a.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(l){const a=l.match(/#(\d+)/u);return!a||!a[1]?l:t[a[1]]});return e[n]=o,e[n].concat()},K.prototype.safeVm={Script:nt};const ot=function(n,e,t){const s=n.length;for(let o=0;o<s;o++){const l=n[o];t(l)&&e.push(n.splice(o--,1)[0])}};class st{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const s=Object.keys(e),o=[];ot(s,o,c=>typeof e[c]=="function");const l=s.map(c=>e[c]);t=o.reduce((c,g)=>{let p=e[g].toString();return/function/u.test(p)||(p="function "+p),"var "+g+"="+p+";"+c},"")+t,!/(['"])use strict\1/u.test(t)&&!s.includes("arguments")&&(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const d=t.lastIndexOf(";"),i=d!==-1?t.slice(0,d+1)+" return "+t.slice(d+1):" return "+t;return new Function(...s,i)(...l)}}K.prototype.vm={Script:st};const lt={class:"json-node"},at={key:0,class:"json-node__container"},it={class:"json-node__line"},ct=["contenteditable","onKeydown"],dt={key:1,class:"json-node__colon"},ut=["title"],ft=["title"],ht={key:4,class:"json-node__comma"},pt={key:0,class:"json-node__children"},mt={class:"json-node__children-content"},gt={class:"json-node__line json-node__closing-bracket"},yt={class:"json-node__bracket"},bt={key:0,class:"json-node__comma"},Et={key:1,class:"json-node__primitive"},_t=["contenteditable","onKeydown"],xt={key:1,class:"json-node__colon"},kt=["title"],Nt=["contenteditable","onKeydown"],wt={key:0,class:"json-node__comma"},At=r.defineComponent({name:"JsonNode",__name:"JsonNode",props:{value:{},keyName:{},level:{},path:{default:""},expanded:{},isLast:{type:Boolean,default:!1},theme:{}},emits:["update:value","toggle-expand","copy","update:key"],setup(n,{emit:e}){r.useCssVars(y=>({"2a18b018":y.level,"58a14b93":y.theme.colors.syntaxKey,"46fe1b3e":y.theme.colors.hoverBackground,fbe2c048:y.theme.colors.syntaxBracket,"4bd524bb":y.theme.colors.collapsedText,"3308d23c":y.theme.colors.collapsedBackground,"36380c60":y.theme.colors.collapsedBackgroundHover,"0892365d":y.theme.colors.syntaxString,"0015b195":y.theme.colors.syntaxNumber,"7db95f5c":y.theme.colors.syntaxBoolean,"88ec825a":y.theme.colors.syntaxNull,"537157f7":y.theme.colors.background,"3cee3331":y.theme.colors.selectionBackground,"81323cee":y.theme.colors.indentLine}));const t=n,s=e,o=r.ref(!1),l=r.ref(!1),a=r.ref(""),d=r.ref(""),i=r.ref("string"),c=r.ref(null),g=r.ref(null),p=y=>y!==null&&typeof y=="object"&&!Array.isArray(y)&&"__protected_number__"in y&&Object.keys(y).length===1,w=y=>p(y)?y.__protected_number__:"",k=r.computed(()=>p(t.value)?!1:t.value!==null&&typeof t.value=="object"),S=r.computed(()=>Array.isArray(t.value)),$=r.computed(()=>t.path?t.path:t.keyName?t.keyName:"root"),B=r.computed(()=>t.expanded.has($.value)),M=r.computed(()=>t.keyName),X=r.computed(()=>S.value?"[":"{"),j=r.computed(()=>S.value?"]":"}"),q=r.computed(()=>{if(!t.value)return"";const u=Object.keys(t.value).length;return S.value?u>0?` ${u} items `:" ":u>0?` ${u} keys `:" "}),re=r.computed(()=>{const y=typeof t.value;return t.value===null?"json-node__value--null":y==="boolean"?"json-node__value--boolean":y==="number"||p(t.value)?"json-node__value--number":y==="string"?"json-node__value--string":""}),J=r.computed(()=>t.value===null?"null":typeof t.value=="boolean"||typeof t.value=="number"?String(t.value):p(t.value)?w(t.value):typeof t.value=="string"?`"${t.value}"`:String(t.value)),D=r.computed(()=>"Double-click to edit"),ne=y=>t.level===0?y:$.value?`${$.value}.${y}`:y,oe=y=>{const u=Object.keys(t.value);return u.indexOf(y)===u.length-1},N=()=>{s("toggle-expand",$.value)},v=()=>{t.level!==0&&(o.value=!0,a.value=t.keyName,r.nextTick(()=>{if(c.value){c.value.focus();const y=document.createRange();y.selectNodeContents(c.value);const u=window.getSelection();u?.removeAllRanges(),u?.addRange(y)}}))},R=()=>{k.value||(l.value=!0,t.value===null?i.value="null":p(t.value)?i.value="protected-number":typeof t.value=="string"?i.value="string":typeof t.value=="number"?i.value="number":typeof t.value=="boolean"&&(i.value="boolean"),p(t.value)?d.value=w(t.value):typeof t.value=="string"?d.value=t.value:d.value=String(t.value),r.nextTick(()=>{if(g.value){g.value.focus();const y=document.createRange();y.selectNodeContents(g.value);const u=window.getSelection();u?.removeAllRanges(),u?.addRange(y)}}))},C=()=>{if(t.level===0||!o.value)return;const y=c.value?.innerText.trim()||"";if(!y){U();return}if(y===t.keyName){o.value=!1;return}o.value=!1,s("update:key",$.value,y)},O=()=>{if(l.value)try{let y;const u=g.value?.innerText.trim()||"";if(i.value==="string")u==="null"?y=null:u==="true"||u==="false"?y=u==="true":y=u;else if(i.value==="protected-number")y={__protected_number__:u};else if(u==="null")y=null;else if(u==="true"||u==="false")y=u==="true";else if(!isNaN(Number(u))&&u!==""){const m=Number(u);!Number.isSafeInteger(m)||u.length>15?y={__protected_number__:u}:y=m}else y=u;s("update:value",$.value,y),l.value=!1}catch(y){console.error("Failed to parse value:",y),l.value=!1}},U=()=>{o.value=!1,a.value=t.keyName},V=()=>{l.value=!1,p(t.value)?d.value=w(t.value):typeof t.value=="string"?d.value=t.value:d.value=String(t.value)};return(y,u)=>{const m=r.resolveComponent("JsonNode",!0);return r.openBlock(),r.createElementBlock("div",lt,[k.value?(r.openBlock(),r.createElementBlock("div",at,[r.createElementVNode("div",it,[y.keyName?(r.openBlock(),r.createElementBlock("span",{key:0,class:"json-node__key",contenteditable:o.value,onDblclick:v,onKeydown:[r.withKeys(r.withModifiers(C,["prevent"]),["enter"]),r.withKeys(U,["escape"])],onBlur:C,ref_key:"keyRef",ref:c,title:"Double-click to edit key"},r.toDisplayString(o.value?a.value:`"${M.value}"`),41,ct)):r.createCommentVNode("",!0),y.keyName?(r.openBlock(),r.createElementBlock("span",dt,": ")):r.createCommentVNode("",!0),r.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:N,title:B.value?"Click to collapse":"Click to expand"},r.toDisplayString(X.value),9,ut),B.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",{key:2,class:"json-node__collapsed-info",onClick:N,title:`Click to expand ${q.value.trim()}`},r.toDisplayString(q.value),9,ft)),B.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",{key:3,class:"json-node__bracket json-node__bracket--clickable",onClick:N,title:"Click to expand"},r.toDisplayString(j.value),1)),!B.value&&!y.isLast?(r.openBlock(),r.createElementBlock("span",ht,",")):r.createCommentVNode("",!0)]),B.value?(r.openBlock(),r.createElementBlock("div",pt,[r.createElementVNode("div",mt,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(y.value,(E,_)=>(r.openBlock(),r.createElementBlock("div",{key:_,class:"json-node__child"},[r.createVNode(m,{value:E,"key-name":S.value?"":String(_),level:y.level+1,path:ne(String(_)),expanded:y.expanded,theme:y.theme,"onUpdate:value":u[0]||(u[0]=(x,b)=>y.$emit("update:value",x,b)),onToggleExpand:u[1]||(u[1]=x=>y.$emit("toggle-expand",x)),onCopy:u[2]||(u[2]=x=>y.$emit("copy",x)),"onUpdate:key":u[3]||(u[3]=(x,b)=>y.$emit("update:key",x,b)),"is-last":oe(String(_))},null,8,["value","key-name","level","path","expanded","theme","is-last"])]))),128))]),r.createElementVNode("div",gt,[r.createElementVNode("span",yt,r.toDisplayString(j.value),1),y.isLast?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",bt,","))])])):r.createCommentVNode("",!0)])):(r.openBlock(),r.createElementBlock("div",Et,[y.keyName?(r.openBlock(),r.createElementBlock("span",{key:0,class:"json-node__key",contenteditable:o.value,onDblclick:v,onKeydown:[r.withKeys(r.withModifiers(C,["prevent"]),["enter"]),r.withKeys(U,["escape"])],onBlur:C,ref_key:"keyRef",ref:c,title:"Double-click to edit key"},r.toDisplayString(o.value?a.value:`"${M.value}"`),41,_t)):r.createCommentVNode("",!0),y.keyName?(r.openBlock(),r.createElementBlock("span",xt,": ")):r.createCommentVNode("",!0),r.createElementVNode("span",{class:r.normalizeClass(["json-node__value-wrapper",re.value]),onDblclick:R,title:D.value},[r.createElementVNode("span",{class:"json-node__value",contenteditable:l.value,onKeydown:[r.withKeys(r.withModifiers(O,["prevent"]),["enter"]),r.withKeys(V,["escape"])],onBlur:O,ref_key:"valueRef",ref:g},r.toDisplayString(l.value?d.value:J.value),41,Nt),y.isLast?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",wt,","))],42,kt)]))])}}}),Ee=(n,e)=>{const t=n.__vccOpts||n;for(const[s,o]of e)t[s]=o;return t},Ct=Ee(At,[["__scopeId","data-v-1472a8af"]]),Oe={name:"github-light",colors:{background:"#ffffff",surfaceBackground:"#f6f8fa",border:"#d0d7de",text:"#24292f",textSecondary:"#656d76",buttonBackground:"#f6f8fa",buttonBackgroundHover:"#f3f4f6",buttonBorder:"#d0d7de",buttonText:"#24292f",buttonPrimary:"#2da44e",buttonPrimaryHover:"#2c974b",success:"#1a7f37",successBackground:"#dafbe1",error:"#cf222e",errorBackground:"#ffebe9",syntaxString:"#0a3069",syntaxNumber:"#0969da",syntaxBoolean:"#8250df",syntaxNull:"#656d76",syntaxKey:"#0969da",syntaxBracket:"#24292f",hoverBackground:"#f6f8fa",selectionBackground:"rgba(9, 105, 218, 0.2)",collapsedBackground:"#ddf4ff",collapsedBackgroundHover:"#b6e3ff",collapsedText:"#0969da",indentLine:"#d0d7de"}},Bt={"github-light":Oe,"github-dark":{name:"github-dark",colors:{background:"#0d1117",surfaceBackground:"#161b22",border:"#30363d",text:"#e6edf3",textSecondary:"#7d8590",buttonBackground:"#21262d",buttonBackgroundHover:"#30363d",buttonBorder:"#30363d",buttonText:"#e6edf3",buttonPrimary:"#238636",buttonPrimaryHover:"#2ea043",success:"#3fb950",successBackground:"#0f2419",error:"#f85149",errorBackground:"#381921",syntaxString:"#a5d6ff",syntaxNumber:"#79c0ff",syntaxBoolean:"#d2a8ff",syntaxNull:"#7d8590",syntaxKey:"#79c0ff",syntaxBracket:"#e6edf3",hoverBackground:"#161b22",selectionBackground:"rgba(121, 192, 255, 0.2)",collapsedBackground:"#1c2128",collapsedBackgroundHover:"#2d333b",collapsedText:"#79c0ff",indentLine:"#30363d"}},"min-light":{name:"min-light",colors:{background:"#ffffff",surfaceBackground:"#fafafa",border:"#e5e5e5",text:"#333333",textSecondary:"#888888",buttonBackground:"#f8f8f8",buttonBackgroundHover:"#eeeeee",buttonBorder:"#e0e0e0",buttonText:"#333333",buttonPrimary:"#007acc",buttonPrimaryHover:"#005a9e",success:"#22c55e",successBackground:"#f0fdf4",error:"#ef4444",errorBackground:"#fef2f2",syntaxString:"#22c55e",syntaxNumber:"#3b82f6",syntaxBoolean:"#8b5cf6",syntaxNull:"#6b7280",syntaxKey:"#1f2937",syntaxBracket:"#374151",hoverBackground:"#f9f9f9",selectionBackground:"rgba(59, 130, 246, 0.2)",collapsedBackground:"#e0f2fe",collapsedBackgroundHover:"#bae6fd",collapsedText:"#0284c7",indentLine:"#e5e7eb"}},"slack-ochin":{name:"slack-ochin",colors:{background:"#fefbf6",surfaceBackground:"#faf6f0",border:"#e8d5b7",text:"#4a3b2a",textSecondary:"#8b7355",buttonBackground:"#f4ede4",buttonBackgroundHover:"#efe5d8",buttonBorder:"#e8d5b7",buttonText:"#4a3b2a",buttonPrimary:"#ff6b35",buttonPrimaryHover:"#e55a2b",success:"#ff9500",successBackground:"#fff8f0",error:"#d73502",errorBackground:"#ffeee8",syntaxString:"#d73502",syntaxNumber:"#ff6b35",syntaxBoolean:"#b7472a",syntaxNull:"#8b7355",syntaxKey:"#4a3b2a",syntaxBracket:"#6b5444",hoverBackground:"#f8f2eb",selectionBackground:"rgba(255, 107, 53, 0.2)",collapsedBackground:"#ffe8d6",collapsedBackgroundHover:"#ffd4b0",collapsedText:"#d73502",indentLine:"#e8d5b7"}}};function Tt(n="github-light"){return Bt[n]||Oe}const vt={key:0,class:"json-format__toolbar"},Ot={class:"json-format__actions"},St=["disabled"],$t=["disabled"],Pt=["disabled"],Vt=["disabled"],It={class:"json-format__info"},Rt={key:0,class:"json-format__status json-format__status--success"},Lt={key:1,class:"json-format__status json-format__status--error"},Mt={class:"json-format__content"},jt={key:0,class:"json-format__error"},Kt={key:1,class:"json-format__error"},Ut={key:2,class:"json-format__viewer"},Se=Ee(r.defineComponent({name:"JsonFormat",__name:"index",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},maxDepth:{default:10},showToolbar:{type:Boolean,default:!0},theme:{default:"github-light"}},emits:["update:modelValue","copy-success","copy-error","expand-all","collapse-all","compress"],setup(n,{expose:e,emit:t}){r.useCssVars(u=>({"820119d0":p.value.colors.border,"7d4c03cc":p.value.colors.background,ec17e1ce:p.value.colors.text,"3b9ec162":p.value.colors.surfaceBackground,"024cf7ea":p.value.colors.buttonBorder,"34566c28":p.value.colors.buttonBackground,"2620a06b":p.value.colors.buttonText,"33a362b0":p.value.colors.buttonBackgroundHover,"308d0204":p.value.colors.buttonPrimary,d77b0cd0:p.value.colors.buttonPrimaryHover,"52643f25":p.value.colors.successBackground,a4bbc2d2:p.value.colors.success,ea95b82c:p.value.colors.errorBackground,"987f74c8":p.value.colors.error}));const s=n,o=t,l=r.ref(null),a=r.ref(""),d=r.ref(new Set),i=r.ref(null),c=r.ref(""),g=r.computed(()=>a.value===""),p=r.computed(()=>Tt(s.theme)),w=r.computed(()=>c.value?null:i.value!==null?i.value:l.value),k=u=>{if(!u.trim()){l.value=null,a.value="",i.value=null,c.value="";return}try{let m=u;const E=/(:\s*|,\s*|\[\s*)-?\d{16,}/.test(m),_=/(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(m);if(!E&&!_)try{l.value=JSON.parse(m),a.value="",i.value=null,c.value="",r.nextTick(()=>{w.value!==null&&D()});return}catch{}m=(b=>{let T="",I=!1,F=!1,W=0;for(;W<b.length;){const ee=b[W];if(I)F?F=!1:ee==="\\"?F=!0:ee==='"'&&(I=!1),T+=ee,W++;else if(ee==='"')I=!0,T+=ee,W++;else{const se=b.slice(W);let te=se.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);if(te){T+=te[1]+'{"__protected_number__":"'+te[2]+'"}'+te[3],W+=te[0].length;continue}if(te=se.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/),te){T+=te[1]+'{"__protected_number__":"'+te[2]+'"}'+te[3],W+=te[0].length;continue}T+=ee,W++}}return T})(m),l.value=JSON.parse(m),a.value="",i.value=null,c.value="",r.nextTick(()=>{w.value!==null&&D()})}catch(m){a.value=m instanceof Error?m.message:"Unknown parsing error",l.value=null,i.value=null,c.value=""}},S=u=>{if(!u||!u.expression.trim()){X();return}if(!l.value){c.value="No valid JSON data to filter";return}try{let m;if(u.type==="jsonpath")m=K({path:u.expression,json:l.value}),m.length===1&&u.expression.includes("$[")===!1&&!u.expression.endsWith("[*]")?i.value=m[0]:i.value=m;else if(u.type==="js"){const{proxyData:E,indexMap:_}=$(l.value),b=new Function("$",`
|
|
3
3
|
try {
|
|
4
|
-
return ${
|
|
4
|
+
return ${u.expression};
|
|
5
5
|
} catch (error) {
|
|
6
6
|
throw new Error('JavaScript expression error: ' + error.message);
|
|
7
7
|
}
|
|
8
|
-
`)(l.value),i.value=m;else throw new Error(`Unsupported filter type: ${g.type}`);c.value="",r.nextTick(()=>{z()})}catch(m){c.value=m instanceof Error?m.message:"Filter execution error",i.value=null}},$=()=>{i.value=null,c.value=""};r.watch(()=>s.modelValue,g=>{E(g)},{immediate:!0});const w=(g,m,u)=>{const y=v=>{if(v===null||typeof v!="object")return v;if(!Array.isArray(v)&&"__protected_number__"in v&&Object.keys(v).length===1)return`__PROTECTED_NUMBER_${v.__protected_number__}_PROTECTED_NUMBER__`;if(Array.isArray(v))return v.map(I=>y(I));const S={};for(const[I,U]of Object.entries(v))S[I]=y(U);return S},B=y(g);return JSON.stringify(B,m,u).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g,"$1")},L=(g,m)=>{if(!s.readonly)try{const u=F(l.value,g,m),y=w(u,null,2);o("update:modelValue",y)}catch(u){console.error("Failed to update JSON:",u)}},F=(g,m,u)=>{if(!m||m==="root")return u;const y=m.split("."),B=C(g,y.slice(0,-1));let x=B;for(let S=0;S<y.length-1;S++){const I=y[S];I!=="root"&&(Array.isArray(x)?x=x[parseInt(I)]:x=x[I])}const v=y[y.length-1];return v==="root"?u:(Array.isArray(x)?x[parseInt(v)]=u:x[v]=u,B)},M=g=>{d.value.has(g)?d.value.delete(g):d.value.add(g)},z=()=>{const g=new Set,m=(u,y="")=>{u!==null&&typeof u=="object"&&(g.add(y||"root"),Array.isArray(u)?u.forEach((B,x)=>{const v=y?`${y}.${x}`:`${x}`;m(B,v)}):Object.keys(u).forEach(B=>{const x=y?`${y}.${B}`:B;m(u[B],x)}))};m(k.value),d.value=g,o("expand-all")},ee=()=>{d.value=new Set(["root"]),o("collapse-all")},G=async()=>{if(b.value)try{const g=k.value,m=w(g,null,2);await navigator.clipboard.writeText(m),o("copy-success",m)}catch(g){console.error("Failed to copy JSON:",g),o("copy-error",g instanceof Error?g:new Error("Failed to copy JSON"))}},Z=()=>{if(b.value)try{const g=k.value,m=w(g);o("update:modelValue",m),o("compress",m)}catch(g){console.error("Failed to compress JSON:",g)}},J=async g=>{try{let m;typeof g=="object"&&g!==null&&!Array.isArray(g)&&"__protected_number__"in g&&Object.keys(g).length===1?m=g.__protected_number__:typeof g=="string"?m=`"${g}"`:m=JSON.stringify(g),await navigator.clipboard.writeText(m)}catch(m){console.error("Failed to copy value:",m)}},te=(g,m)=>{if(!s.readonly)try{const u=_(l.value,g,m),y=w(u,null,2);o("update:modelValue",y),T(g,m)}catch(u){console.error("Failed to rename key:",u)}},_=(g,m,u)=>{if(!m||m==="root")return g;const y=m.split("."),B=C(g,y.slice(0,-1));if(y.length===1){const S=y[0];return B&&typeof B=="object"&&!Array.isArray(B)?V(B,S,u):B}let x=B;for(let S=0;S<y.length-1;S++){const I=y[S];Array.isArray(x)?x=x[parseInt(I)]:x=x[I]}const v=y[y.length-1];if(!Array.isArray(x)&&x&&typeof x=="object"){const S=V(x,v,u),I=y.slice(0,-1);I.length>0&&A(B,I,S)}return B},C=(g,m)=>{if(m.length===0)return g;if(Array.isArray(g)){const u=[...g],y=m[0],B=parseInt(y);return m.length===1||(u[B]=C(g[B],m.slice(1))),u}else if(g&&typeof g=="object"){const u={...g},y=m[0];return m.length===1||(u[y]=C(g[y],m.slice(1))),u}return g},V=(g,m,u)=>{if(!g||typeof g!="object"||Array.isArray(g))return g;const y=Object.keys(g),B={};for(const x of y)x===m?B[u]=g[x]:B[x]=g[x];return B},A=(g,m,u)=>{let y=g;for(let x=0;x<m.length-1;x++){const v=m[x];Array.isArray(y)?y=y[parseInt(v)]:y=y[v]}const B=m[m.length-1];Array.isArray(y)?y[parseInt(B)]=u:y[B]=u},T=(g,m)=>{const u=new Set;d.value.forEach(y=>{if(y===g){const B=g.split(".");B[B.length-1]=m,u.add(B.join("."))}else if(y.startsWith(g+".")){const B=g.split(".");B[B.length-1]=m;const x=B.join("."),v=y.substring(g.length);u.add(x+v)}else u.add(y)}),d.value=u};return e({copyJson:G,compressSource:Z,expandAll:z,collapseAll:ee,toggleExpand:M,updateValue:L,updateKey:te,filter:O,clearFilter:$,isValidJson:()=>b.value,getParsedJson:()=>l.value,getFilteredJson:()=>i.value,getExpandedNodes:()=>d.value,getParseError:()=>a.value,getFilterError:()=>c.value,parseJson:g=>E(g),copyValue:g=>J(g)}),(g,m)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["json-format",`json-format--${p.value.name}`])},[g.showToolbar?(r.openBlock(),r.createElementBlock("div",vt,[r.createElementVNode("div",St,[r.createElementVNode("button",{class:"json-format__btn json-format__btn--primary",onClick:G,disabled:!b.value,title:"Copy JSON"}," 📋 Copy ",8,Ot),r.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:z,disabled:!b.value,title:"Expand All"}," ⬇️ Expand All ",8,$t),r.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:ee,disabled:!b.value,title:"Collapse All"}," ➡️ Collapse All ",8,Pt),r.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:Z,disabled:!b.value,title:"Compress JSON"}," 📦 Compress ",8,Vt)]),r.createElementVNode("div",It,[b.value?(r.openBlock(),r.createElementBlock("span",Rt," ✅ Valid JSON ")):(r.openBlock(),r.createElementBlock("span",Lt," ❌ Invalid JSON "))])])):r.createCommentVNode("",!0),r.createElementVNode("div",Mt,[b.value?c.value?(r.openBlock(),r.createElementBlock("div",jt,[m[1]||(m[1]=r.createElementVNode("h4",null,"Filter Error:",-1)),r.createElementVNode("pre",null,r.toDisplayString(c.value),1)])):(r.openBlock(),r.createElementBlock("div",Ut,[r.createVNode(Ct,{value:k.value,"key-name":"",level:0,expanded:d.value,"is-last":!0,theme:p.value,"onUpdate:value":L,onToggleExpand:M,onCopy:J,"onUpdate:key":te},null,8,["value","expanded","theme"])])):(r.openBlock(),r.createElementBlock("div",Kt,[m[0]||(m[0]=r.createElementVNode("h4",null,"JSON Parse Error:",-1)),r.createElementVNode("pre",null,r.toDisplayString(a.value),1)]))])],2))}}),[["__scopeId","data-v-b956002c"]]),Ft={key:0,class:"xml-node__comment"},zt={key:1,class:"xml-node__cdata"},Xt={key:2,class:"xml-node__element"},Ht={key:0,class:"xml-node__line"},qt=["contenteditable","onKeydown"],Wt=["contenteditable","onDblclick","onKeydown"],Qt=["contenteditable","onDblclick","onKeydown"],Yt=["contenteditable","onKeydown"],Dt={key:1,class:"xml-node__line"},Gt=["contenteditable","onKeydown"],Zt=["contenteditable","onDblclick","onKeydown"],Jt=["contenteditable","onDblclick","onKeydown"],en=["contenteditable","onKeydown"],tn={key:2},nn={key:0,class:"xml-node__line"},rn=["contenteditable","onKeydown"],on=["contenteditable","onDblclick","onKeydown"],sn=["contenteditable","onDblclick","onKeydown"],ln=["title"],an={class:"xml-node__line"},cn=["title"],dn=["contenteditable","onKeydown"],un={key:1},fn=["contenteditable","onKeydown"],hn=["contenteditable","onDblclick","onKeydown"],pn=["contenteditable","onDblclick","onKeydown"],mn=["title"],gn={key:0,class:"xml-node__children"},yn={key:0,class:"xml-node__text"},bn=["contenteditable","onKeydown"],En={key:1,class:"xml-node__line"},_n=ge(r.defineComponent({__name:"XmlNode",props:{node:{},index:{},level:{default:0},parentPath:{default:""},expanded:{},theme:{}},emits:["toggle-expand","copy","update:tagName","update:attributeName","update:attributeValue","update:textContent","update:cdataContent"],setup(n,{emit:e}){r.useCssVars(h=>({"623698b5":h.theme.colors.indentLine}));const t=n,s=e,o=r.ref(!1),l=r.ref(null),a=r.ref(null),d=r.ref(!1),i=r.ref(!1),c=r.ref(""),b=r.ref(""),p=r.ref(""),k=r.ref(""),E=r.ref(""),O=r.ref(null),$=r.ref(null),w=r.ref(null),L=r.ref(null),F=r.ref(null),M=r.computed(()=>Object.keys(t.node).find(N=>!N.startsWith(":")&&!N.startsWith("#"))||""),z=r.computed(()=>M.value?t.parentPath?`${t.parentPath}.${M.value}[${t.index}]`:`${M.value}[${t.index}]`:""),ee=r.computed(()=>t.expanded.has(z.value)),G=r.computed(()=>t.node["#comment"]?"comment":t.node.__cdata?"cdata":M.value?"element":"unknown"),Z=r.computed(()=>{const h=t.node[":@"]||{},N={};return Object.keys(h).forEach(H=>{H.startsWith("@_")&&(N[H.substring(2)]=h[H])}),N}),J=r.computed(()=>{if(G.value!=="element"||!M.value)return[];const h=t.node[M.value];return Array.isArray(h)?h:[]}),te=r.computed(()=>J.value.some(h=>h.__cdata)),_=r.computed(()=>{if(!te.value)return"";const h=J.value.find(N=>N.__cdata);if(h&&Array.isArray(h.__cdata)){const N=h.__cdata;if(N.length>0&&N[0]["#text"])return N[0]["#text"]}return""}),C=r.computed(()=>{if(G.value!=="element"||!M.value||te.value)return"";const h=t.node[M.value];if(!Array.isArray(h))return"";const N=h.find(H=>H["#text"]);return N?N["#text"]:""}),V=r.computed(()=>{if(G.value!=="comment")return"";const h=t.node["#comment"];return Array.isArray(h)&&h.length>0&&h[0]["#text"]||""}),A=r.computed(()=>J.value.some(h=>Object.keys(h).some(H=>!H.startsWith("#")&&!H.startsWith(":")))),T=r.computed(()=>A.value?J.value.filter(h=>Object.keys(h).some(H=>!H.startsWith("#")&&!H.startsWith(":"))).length:0),g=r.computed(()=>G.value==="element"&&!A.value&&C.value.trim()!==""),m=()=>{A.value&&s("toggle-expand",z.value)},u=(h,N)=>`${z.value}-child-${N}`,y=()=>`${z.value}.${M.value}`,B=()=>{o.value=!0,c.value=M.value,r.nextTick(()=>{if(O.value){O.value.focus();const h=document.createRange();h.selectNodeContents(O.value);const N=window.getSelection();N?.removeAllRanges(),N?.addRange(h)}})},x=h=>{l.value=h,b.value=h,r.nextTick(()=>{if($.value){$.value.focus();const N=document.createRange();N.selectNodeContents($.value);const H=window.getSelection();H?.removeAllRanges(),H?.addRange(N)}})},v=h=>{a.value=h,p.value=Z.value[h]||"",r.nextTick(()=>{if(w.value){w.value.focus();const N=document.createRange();N.selectNodeContents(w.value);const H=window.getSelection();H?.removeAllRanges(),H?.addRange(N)}})},S=()=>{d.value=!0,k.value=C.value,r.nextTick(()=>{if(L.value){L.value.focus();const h=document.createRange();h.selectNodeContents(L.value);const N=window.getSelection();N?.removeAllRanges(),N?.addRange(h)}})},I=()=>{if(!o.value)return;const h=O.value?.innerText.trim()||"";if(!h||h===M.value){o.value=!1;return}o.value=!1,s("update:tagName",z.value,M.value,h)},U=()=>{if(!l.value)return;const h=l.value,N=$.value?.innerText.trim()||"";if(!N||N===h){l.value=null;return}l.value=null,s("update:attributeName",z.value,h,N)},Y=()=>{if(!a.value)return;const h=a.value,N=w.value?.innerText.trim()||"";a.value=null,s("update:attributeValue",z.value,h,N)},ue=()=>{if(!d.value)return;const h=L.value?.innerText||"";if(h===C.value){d.value=!1;return}d.value=!1,s("update:textContent",z.value,h)},q=()=>{o.value=!1,c.value=M.value},Ee=()=>{l.value&&(b.value=l.value,l.value=null)},_e=()=>{a.value&&(p.value=Z.value[a.value]||"",a.value=null)},He=()=>{d.value=!1,k.value=C.value},jr=()=>{i.value=!0,E.value=_.value,r.nextTick(()=>{if(F.value){F.value.focus();const h=document.createRange();h.selectNodeContents(F.value);const N=window.getSelection();N?.removeAllRanges(),N?.addRange(h)}})},qe=()=>{if(!i.value)return;const h=F.value?.innerText||"";if(h===_.value){i.value=!1;return}i.value=!1,s("update:cdataContent",z.value,h)},Ur=()=>{i.value=!1,E.value=_.value},xe=h=>{A.value&&(h.preventDefault(),B())};return(h,N)=>{const H=r.resolveComponent("XmlNode",!0);return r.openBlock(),r.createElementBlock("div",{class:"xml-node",style:r.normalizeStyle({paddingLeft:h.level>0?"16px":"0"})},[G.value==="comment"?(r.openBlock(),r.createElementBlock("div",Ft,[r.createElementVNode("span",{style:r.normalizeStyle({color:h.theme.colors.xmlComment})}," <!-- "+r.toDisplayString(V.value)+" --> ",5)])):G.value==="cdata"?(r.openBlock(),r.createElementBlock("div",zt,[r.createElementVNode("span",{style:r.normalizeStyle({color:h.theme.colors.xmlCdata})}," <![CDATA["+r.toDisplayString(h.node.__cdata)+"]]> ",5)])):G.value==="element"?(r.openBlock(),r.createElementBlock("div",Xt,[te.value?(r.openBlock(),r.createElementBlock("div",Ht,[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:B,onContextmenu:xe,onKeydown:[r.withKeys(r.withModifiers(I,["prevent"]),["enter"]),r.withKeys(q,["escape"])],onBlur:I,ref_key:"tagNameRef",ref:O,title:"Double-click to edit tag name"},r.toDisplayString(o.value?c.value:M.value),45,qt),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Z.value,(W,P)=>(r.openBlock(),r.createElementBlock("span",{key:P,class:"xml-node__attribute"},[r.createElementVNode("span",{class:"xml-node__attr-name xml-node__attr-name--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttribute}),contenteditable:l.value===P,onDblclick:R=>x(P),onKeydown:[r.withKeys(r.withModifiers(U,["prevent"]),["enter"]),r.withKeys(Ee,["escape"])],onBlur:U,ref_for:!0,ref:R=>{l.value===P&&($.value=R)},title:"Double-click to edit attribute name"},r.toDisplayString(l.value===P?b.value:P),45,Wt),r.createElementVNode("span",{class:"xml-node__equals",style:r.normalizeStyle({color:h.theme.colors.xmlEquals})},"=",4),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4),r.createElementVNode("span",{class:"xml-node__attr-value xml-node__attr-value--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttributeValue}),contenteditable:a.value===P,onDblclick:R=>v(P),onKeydown:[r.withKeys(r.withModifiers(Y,["prevent"]),["enter"]),r.withKeys(_e,["escape"])],onBlur:Y,ref_for:!0,ref:R=>{a.value===P&&(w.value=R)},title:"Double-click to edit attribute value"},r.toDisplayString(a.value===P?p.value:W),45,Qt),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4)]))),128)),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4),r.createElementVNode("span",{class:"xml-node__cdata",style:r.normalizeStyle({color:h.theme.colors.xmlCdata})},"<![CDATA[",4),r.createElementVNode("span",{class:"xml-node__cdata-content xml-node__cdata-content--editable",style:r.normalizeStyle({color:h.theme.colors.xmlCdata}),contenteditable:i.value,onDblclick:jr,onKeydown:[r.withKeys(r.withModifiers(qe,["prevent"]),["enter"]),r.withKeys(Ur,["escape"])],onBlur:qe,ref_key:"cdataContentRef",ref:F,title:"Double-click to edit CDATA content"},r.toDisplayString(i.value?E.value:_.value),45,Yt),r.createElementVNode("span",{class:"xml-node__cdata",style:r.normalizeStyle({color:h.theme.colors.xmlCdata})},"]]>",4),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"</",4),r.createElementVNode("span",{class:"xml-node__tag",style:r.normalizeStyle({color:h.theme.colors.xmlTag})},r.toDisplayString(o.value?c.value:M.value),5),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)])):g.value?(r.openBlock(),r.createElementBlock("div",Dt,[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:B,onContextmenu:xe,onKeydown:[r.withKeys(r.withModifiers(I,["prevent"]),["enter"]),r.withKeys(q,["escape"])],onBlur:I,ref_key:"tagNameRef",ref:O,title:"Double-click to edit tag name"},r.toDisplayString(o.value?c.value:M.value),45,Gt),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Z.value,(W,P)=>(r.openBlock(),r.createElementBlock("span",{key:P,class:"xml-node__attribute"},[r.createElementVNode("span",{class:"xml-node__attr-name xml-node__attr-name--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttribute}),contenteditable:l.value===P,onDblclick:R=>x(P),onKeydown:[r.withKeys(r.withModifiers(U,["prevent"]),["enter"]),r.withKeys(Ee,["escape"])],onBlur:U,ref_for:!0,ref:R=>{l.value===P&&($.value=R)},title:"Double-click to edit attribute name"},r.toDisplayString(l.value===P?b.value:P),45,Zt),r.createElementVNode("span",{class:"xml-node__equals",style:r.normalizeStyle({color:h.theme.colors.xmlEquals})},"=",4),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4),r.createElementVNode("span",{class:"xml-node__attr-value xml-node__attr-value--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttributeValue}),contenteditable:a.value===P,onDblclick:R=>v(P),onKeydown:[r.withKeys(r.withModifiers(Y,["prevent"]),["enter"]),r.withKeys(_e,["escape"])],onBlur:Y,ref_for:!0,ref:R=>{a.value===P&&(w.value=R)},title:"Double-click to edit attribute value"},r.toDisplayString(a.value===P?p.value:W),45,Jt),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4)]))),128)),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4),r.createElementVNode("span",{class:"xml-node__text-content xml-node__text-content--editable",style:r.normalizeStyle({color:h.theme.colors.xmlText}),contenteditable:d.value,onDblclick:S,onKeydown:[r.withKeys(r.withModifiers(ue,["prevent"]),["enter"]),r.withKeys(He,["escape"])],onBlur:ue,ref_key:"textContentRef",ref:L,title:"Double-click to edit text content"},r.toDisplayString(d.value?k.value:C.value),45,en),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"</",4),r.createElementVNode("span",{class:"xml-node__tag",style:r.normalizeStyle({color:h.theme.colors.xmlTag})},r.toDisplayString(o.value?c.value:M.value),5),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)])):(r.openBlock(),r.createElementBlock("div",tn,[!ee.value&&A.value?(r.openBlock(),r.createElementBlock("div",nn,[r.createElementVNode("span",{class:"xml-node__clickable-part",onClick:N[0]||(N[0]=W=>m()),title:"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:r.withModifiers(B,["stop"]),onContextmenu:xe,onKeydown:[r.withKeys(r.withModifiers(I,["prevent"]),["enter"]),r.withKeys(q,["escape"])],onBlur:I,ref_key:"tagNameRef",ref:O,title:"Double-click or right-click to edit tag name"},r.toDisplayString(o.value?c.value:M.value),45,rn)]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Z.value,(W,P)=>(r.openBlock(),r.createElementBlock("span",{key:P,class:"xml-node__attribute"},[r.createElementVNode("span",{class:"xml-node__attr-name xml-node__attr-name--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttribute}),contenteditable:l.value===P,onDblclick:R=>x(P),onKeydown:[r.withKeys(r.withModifiers(U,["prevent"]),["enter"]),r.withKeys(Ee,["escape"])],onBlur:U,ref_for:!0,ref:R=>{l.value===P&&($.value=R)},title:"Double-click to edit attribute name"},r.toDisplayString(l.value===P?b.value:P),45,on),r.createElementVNode("span",{class:"xml-node__equals",style:r.normalizeStyle({color:h.theme.colors.xmlEquals})},"=",4),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4),r.createElementVNode("span",{class:"xml-node__attr-value xml-node__attr-value--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttributeValue}),contenteditable:a.value===P,onDblclick:R=>v(P),onKeydown:[r.withKeys(r.withModifiers(Y,["prevent"]),["enter"]),r.withKeys(_e,["escape"])],onBlur:Y,ref_for:!0,ref:R=>{a.value===P&&(w.value=R)},title:"Double-click to edit attribute value"},r.toDisplayString(a.value===P?p.value:W),45,sn),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4)]))),128)),r.createElementVNode("span",{class:"xml-node__clickable-part",onClick:N[1]||(N[1]=W=>m()),title:"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)]),r.createElementVNode("span",{class:"xml-node__collapsed-badge",style:r.normalizeStyle({backgroundColor:h.theme.colors.collapsedBackground,color:h.theme.colors.collapsedText}),onClick:N[2]||(N[2]=W=>m()),title:`Click to expand ${T.value} child element${T.value>1?"s":""}`},r.toDisplayString(T.value)+" child"+r.toDisplayString(T.value>1?"ren":""),13,ln),r.createElementVNode("span",{class:"xml-node__clickable-part",onClick:N[3]||(N[3]=W=>m()),title:"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"</",4),r.createElementVNode("span",{class:"xml-node__tag",style:r.normalizeStyle({color:h.theme.colors.xmlTag})},r.toDisplayString(o.value?c.value:M.value),5),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)])])):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",an,[A.value?(r.openBlock(),r.createElementBlock("span",{key:0,class:"xml-node__clickable-part",onClick:N[4]||(N[4]=W=>m()),title:ee.value?"Click to collapse":"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:r.withModifiers(B,["stop"]),onContextmenu:xe,onKeydown:[r.withKeys(r.withModifiers(I,["prevent"]),["enter"]),r.withKeys(q,["escape"])],onBlur:I,ref_key:"tagNameRef",ref:O,title:"Double-click or right-click to edit tag name"},r.toDisplayString(o.value?c.value:M.value),45,dn)],8,cn)):(r.openBlock(),r.createElementBlock("span",un,[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:B,onKeydown:[r.withKeys(r.withModifiers(I,["prevent"]),["enter"]),r.withKeys(q,["escape"])],onBlur:I,ref_key:"tagNameRef",ref:O,title:"Double-click to edit tag name"},r.toDisplayString(o.value?c.value:M.value),45,fn)])),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Z.value,(W,P)=>(r.openBlock(),r.createElementBlock("span",{key:P,class:"xml-node__attribute"},[r.createElementVNode("span",{class:"xml-node__attr-name xml-node__attr-name--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttribute}),contenteditable:l.value===P,onDblclick:R=>x(P),onKeydown:[r.withKeys(r.withModifiers(U,["prevent"]),["enter"]),r.withKeys(Ee,["escape"])],onBlur:U,ref_for:!0,ref:R=>{l.value===P&&($.value=R)},title:"Double-click to edit attribute name"},r.toDisplayString(l.value===P?b.value:P),45,hn),r.createElementVNode("span",{class:"xml-node__equals",style:r.normalizeStyle({color:h.theme.colors.xmlEquals})},"=",4),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4),r.createElementVNode("span",{class:"xml-node__attr-value xml-node__attr-value--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttributeValue}),contenteditable:a.value===P,onDblclick:R=>v(P),onKeydown:[r.withKeys(r.withModifiers(Y,["prevent"]),["enter"]),r.withKeys(_e,["escape"])],onBlur:Y,ref_for:!0,ref:R=>{a.value===P&&(w.value=R)},title:"Double-click to edit attribute value"},r.toDisplayString(a.value===P?p.value:W),45,pn),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4)]))),128)),A.value?(r.openBlock(),r.createElementBlock("span",{key:2,class:"xml-node__clickable-part",onClick:N[5]||(N[5]=W=>m()),title:ee.value?"Click to collapse":"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)],8,mn)):(r.openBlock(),r.createElementBlock("span",{key:3,class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},r.toDisplayString(A.value?">":"/>"),5))]),ee.value&&A.value?(r.openBlock(),r.createElementBlock("div",gn,[J.value.length===0&&C.value.trim()?(r.openBlock(),r.createElementBlock("div",yn,[r.createElementVNode("span",{class:"xml-node__text-content xml-node__text-content--editable",style:r.normalizeStyle({color:h.theme.colors.xmlText}),contenteditable:d.value,onDblclick:S,onKeydown:[r.withKeys(r.withModifiers(ue,["prevent"]),["enter"]),r.withKeys(He,["escape"])],onBlur:ue,ref_key:"textContentRef",ref:L,title:"Double-click to edit text content"},r.toDisplayString(d.value?k.value:C.value),45,bn)])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(J.value,(W,P)=>(r.openBlock(),r.createBlock(H,{key:u(W,P),node:W,index:P,level:h.level+1,"parent-path":y(),expanded:h.expanded,theme:h.theme,onToggleExpand:N[6]||(N[6]=R=>h.$emit("toggle-expand",R)),onCopy:N[7]||(N[7]=R=>h.$emit("copy",R)),"onUpdate:tagName":N[8]||(N[8]=(R,se,me)=>h.$emit("update:tagName",R,se,me)),"onUpdate:attributeName":N[9]||(N[9]=(R,se,me)=>h.$emit("update:attributeName",R,se,me)),"onUpdate:attributeValue":N[10]||(N[10]=(R,se,me)=>h.$emit("update:attributeValue",R,se,me)),"onUpdate:textContent":N[11]||(N[11]=(R,se)=>h.$emit("update:textContent",R,se)),"onUpdate:cdataContent":N[12]||(N[12]=(R,se)=>h.$emit("update:cdataContent",R,se))},null,8,["node","index","level","parent-path","expanded","theme"]))),128))])):r.createCommentVNode("",!0),ee.value&&A.value?(r.openBlock(),r.createElementBlock("div",En,[r.createElementVNode("span",{class:"xml-node__clickable-part",onClick:N[13]||(N[13]=W=>m()),title:"Click to collapse"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"</",4),r.createElementVNode("span",{class:"xml-node__tag",style:r.normalizeStyle({color:h.theme.colors.xmlTag})},r.toDisplayString(o.value?c.value:M.value),5),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)])])):r.createCommentVNode("",!0)],64))]))])):r.createCommentVNode("",!0)],4)}}}),[["__scopeId","data-v-44ac0d91"]]),Oe={"github-light":{name:"github-light",colors:{background:"#ffffff",surfaceBackground:"#f6f8fa",border:"#d0d7de",text:"#24292f",textSecondary:"#57606a",buttonBackground:"#f6f8fa",buttonBackgroundHover:"#f3f4f6",buttonBorder:"#d0d7de",buttonText:"#24292f",buttonPrimary:"#1f883d",buttonPrimaryHover:"#1a7f37",success:"#1f883d",successBackground:"#dafbe1",error:"#cf222e",errorBackground:"#ffebe9",xmlTag:"#116329",xmlAttribute:"#0550ae",xmlAttributeValue:"#0a3069",xmlText:"#24292f",xmlComment:"#6e7781",xmlCdata:"#8250df",xmlDeclaration:"#953800",xmlBracket:"#6e7781",xmlEquals:"#6e7781",xmlQuote:"#0550ae",collapsedBackground:"#ddf4ff",collapsedText:"#0969da",indentLine:"#d0d7de"}},"github-dark":{name:"github-dark",colors:{background:"#0d1117",surfaceBackground:"#161b22",border:"#30363d",text:"#c9d1d9",textSecondary:"#8b949e",buttonBackground:"#21262d",buttonBackgroundHover:"#30363d",buttonBorder:"#30363d",buttonText:"#c9d1d9",buttonPrimary:"#238636",buttonPrimaryHover:"#2ea043",success:"#3fb950",successBackground:"#0f2e1c",error:"#f85149",errorBackground:"#3d1319",xmlTag:"#7ee787",xmlAttribute:"#79c0ff",xmlAttributeValue:"#a5d6ff",xmlText:"#c9d1d9",xmlComment:"#8b949e",xmlCdata:"#d2a8ff",xmlDeclaration:"#ffa657",xmlBracket:"#8b949e",xmlEquals:"#8b949e",xmlQuote:"#79c0ff",collapsedBackground:"#1c2d41",collapsedText:"#58a6ff",indentLine:"#30363d"}},"min-light":{name:"min-light",colors:{background:"#ffffff",surfaceBackground:"#fafafa",border:"#e5e5e5",text:"#171717",textSecondary:"#737373",buttonBackground:"#fafafa",buttonBackgroundHover:"#f5f5f5",buttonBorder:"#e5e5e5",buttonText:"#171717",buttonPrimary:"#22c55e",buttonPrimaryHover:"#16a34a",success:"#22c55e",successBackground:"#dcfce7",error:"#ef4444",errorBackground:"#fee2e2",xmlTag:"#16a34a",xmlAttribute:"#2563eb",xmlAttributeValue:"#1e40af",xmlText:"#171717",xmlComment:"#737373",xmlCdata:"#9333ea",xmlDeclaration:"#ea580c",xmlBracket:"#737373",xmlEquals:"#737373",xmlQuote:"#2563eb",collapsedBackground:"#dbeafe",collapsedText:"#1d4ed8",indentLine:"#e5e7eb"}},"slack-ochin":{name:"slack-ochin",colors:{background:"#fef5ed",surfaceBackground:"#fef9f3",border:"#e9dcc9",text:"#3d3c40",textSecondary:"#616061",buttonBackground:"#fef9f3",buttonBackgroundHover:"#f9f0e5",buttonBorder:"#e9dcc9",buttonText:"#3d3c40",buttonPrimary:"#007a5a",buttonPrimaryHover:"#006644",success:"#007a5a",successBackground:"#d1f4e0",error:"#e01e5a",errorBackground:"#ffdbea",xmlTag:"#007a5a",xmlAttribute:"#1264a3",xmlAttributeValue:"#0b4c8c",xmlText:"#3d3c40",xmlComment:"#616061",xmlCdata:"#8b2eff",xmlDeclaration:"#e8912d",xmlBracket:"#616061",xmlEquals:"#616061",xmlQuote:"#1264a3",collapsedBackground:"#d8eaf5",collapsedText:"#0b4c8c",indentLine:"#e8d5b7"}}},xn=n=>Oe[n]||Oe["github-light"],$e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",kn=$e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Nn="["+$e+"]["+kn+"]*",wn=new RegExp("^"+Nn+"$");function Pe(n,e){const t=[];let s=e.exec(n);for(;s;){const o=[];o.startIndex=e.lastIndex-s[0].length;const l=s.length;for(let a=0;a<l;a++)o.push(s[a]);t.push(o),s=e.exec(n)}return t}const ye=function(n){const e=wn.exec(n);return!(e===null||typeof e>"u")};function An(n){return typeof n<"u"}const Cn={allowBooleanAttributes:!1,unpairedTags:[]};function Ve(n,e){e=Object.assign({},Cn,e);const t=[];let s=!1,o=!1;n[0]==="\uFEFF"&&(n=n.substr(1));for(let l=0;l<n.length;l++)if(n[l]==="<"&&n[l+1]==="?"){if(l+=2,l=Re(n,l),l.err)return l}else if(n[l]==="<"){let a=l;if(l++,n[l]==="!"){l=Le(n,l);continue}else{let d=!1;n[l]==="/"&&(d=!0,l++);let i="";for(;l<n.length&&n[l]!==">"&&n[l]!==" "&&n[l]!==" "&&n[l]!==`
|
|
9
|
-
`&&n[l]!=="\r";l++)i+=n[l];if(i=i.trim(),i[i.length-1]==="/"&&(i=i.substring(0,i.length-1),l--),!Vn(i)){let p;return i.trim().length===0?p="Invalid space after '<'.":p="Tag '"+i+"' is an invalid name.",
|
|
10
|
-
`||n==="\r"}function Re(n,e){const t=e;for(;e<n.length;e++)if(n[e]=="?"||n[e]==" "){const s=n.substr(t,e-t);if(e>5&&s==="xml")return X("InvalidXml","XML declaration allowed only at the start of the document.",Q(n,e));if(n[e]=="?"&&n[e+1]==">"){e++;break}else continue}return e}function Le(n,e){if(n.length>e+5&&n[e+1]==="-"&&n[e+2]==="-"){for(e+=3;e<n.length;e++)if(n[e]==="-"&&n[e+1]==="-"&&n[e+2]===">"){e+=2;break}}else if(n.length>e+8&&n[e+1]==="D"&&n[e+2]==="O"&&n[e+3]==="C"&&n[e+4]==="T"&&n[e+5]==="Y"&&n[e+6]==="P"&&n[e+7]==="E"){let t=1;for(e+=8;e<n.length;e++)if(n[e]==="<")t++;else if(n[e]===">"&&(t--,t===0))break}else if(n.length>e+9&&n[e+1]==="["&&n[e+2]==="C"&&n[e+3]==="D"&&n[e+4]==="A"&&n[e+5]==="T"&&n[e+6]==="A"&&n[e+7]==="["){for(e+=8;e<n.length;e++)if(n[e]==="]"&&n[e+1]==="]"&&n[e+2]===">"){e+=2;break}}return e}const Bn='"',Tn="'";function vn(n,e){let t="",s="",o=!1;for(;e<n.length;e++){if(n[e]===Bn||n[e]===Tn)s===""?s=n[e]:s!==n[e]||(s="");else if(n[e]===">"&&s===""){o=!0;break}t+=n[e]}return s!==""?!1:{value:t,index:e,tagClosed:o}}const Sn=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Me(n,e){const t=Pe(n,Sn),s={};for(let o=0;o<t.length;o++){if(t[o][1].length===0)return X("InvalidAttr","Attribute '"+t[o][2]+"' has no space in starting.",he(t[o]));if(t[o][3]!==void 0&&t[o][4]===void 0)return X("InvalidAttr","Attribute '"+t[o][2]+"' is without value.",he(t[o]));if(t[o][3]===void 0&&!e.allowBooleanAttributes)return X("InvalidAttr","boolean attribute '"+t[o][2]+"' is not allowed.",he(t[o]));const l=t[o][2];if(!Pn(l))return X("InvalidAttr","Attribute '"+l+"' is an invalid name.",he(t[o]));if(!s.hasOwnProperty(l))s[l]=1;else return X("InvalidAttr","Attribute '"+l+"' is repeated.",he(t[o]))}return!0}function On(n,e){let t=/\d/;for(n[e]==="x"&&(e++,t=/[\da-fA-F]/);e<n.length;e++){if(n[e]===";")return e;if(!n[e].match(t))break}return-1}function $n(n,e){if(e++,n[e]===";")return-1;if(n[e]==="#")return e++,On(n,e);let t=0;for(;e<n.length;e++,t++)if(!(n[e].match(/\w/)&&t<20)){if(n[e]===";")break;return-1}return e}function X(n,e,t){return{err:{code:n,msg:e,line:t.line||t,col:t.col}}}function Pn(n){return ye(n)}function Vn(n){return ye(n)}function Q(n,e){const t=n.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function he(n){return n.startIndex+n[1].length}const In={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,e,t){return n},captureMetaData:!1},Rn=function(n){return Object.assign({},In,n)};let be;typeof Symbol!="function"?be="@@xmlMetadata":be=Symbol("XML Node Metadata");class ie{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][be]={startIndex:t})}static getMetaDataSymbol(){return be}}class Ln{constructor(e){this.suppressValidationErr=!e}readDocType(e,t){const s={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let o=1,l=!1,a=!1,d="";for(;t<e.length;t++)if(e[t]==="<"&&!a){if(l&&ce(e,"!ENTITY",t)){t+=7;let i,c;[i,c,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),c.indexOf("&")===-1&&(s[i]={regx:RegExp(`&${i};`,"g"),val:c})}else if(l&&ce(e,"!ELEMENT",t)){t+=8;const{index:i}=this.readElementExp(e,t+1);t=i}else if(l&&ce(e,"!ATTLIST",t))t+=8;else if(l&&ce(e,"!NOTATION",t)){t+=9;const{index:i}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=i}else if(ce(e,"!--",t))a=!0;else throw new Error("Invalid DOCTYPE");o++,d=""}else if(e[t]===">"){if(a?e[t-1]==="-"&&e[t-2]==="-"&&(a=!1,o--):o--,o===0)break}else e[t]==="["?l=!0:d+=e[t];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:s,i:t}}readEntityExp(e,t){t=D(e,t);let s="";for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)s+=e[t],t++;if(pe(s),t=D(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[t]==="%")throw new Error("Parameter entities are not supported")}let o="";return[t,o]=this.readIdentifierVal(e,t,"entity"),t--,[s,o,t]}readNotationExp(e,t){t=D(e,t);let s="";for(;t<e.length&&!/\s/.test(e[t]);)s+=e[t],t++;!this.suppressValidationErr&&pe(s),t=D(e,t);const o=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);t+=o.length,t=D(e,t);let l=null,a=null;if(o==="PUBLIC")[t,l]=this.readIdentifierVal(e,t,"publicIdentifier"),t=D(e,t),(e[t]==='"'||e[t]==="'")&&([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"));else if(o==="SYSTEM"&&([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:s,publicIdentifier:l,systemIdentifier:a,index:--t}}readIdentifierVal(e,t,s){let o="";const l=e[t];if(l!=='"'&&l!=="'")throw new Error(`Expected quoted string, found "${l}"`);for(t++;t<e.length&&e[t]!==l;)o+=e[t],t++;if(e[t]!==l)throw new Error(`Unterminated ${s} value`);return t++,[t,o]}readElementExp(e,t){t=D(e,t);let s="";for(;t<e.length&&!/\s/.test(e[t]);)s+=e[t],t++;if(!this.suppressValidationErr&&!ye(s))throw new Error(`Invalid element name: "${s}"`);t=D(e,t);let o="";if(e[t]==="E"&&ce(e,"MPTY",t))t+=4;else if(e[t]==="A"&&ce(e,"NY",t))t+=2;else if(e[t]==="("){for(t++;t<e.length&&e[t]!==")";)o+=e[t],t++;if(e[t]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:s,contentModel:o.trim(),index:t}}readAttlistExp(e,t){t=D(e,t);let s="";for(;t<e.length&&!/\s/.test(e[t]);)s+=e[t],t++;pe(s),t=D(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t]);)o+=e[t],t++;if(!pe(o))throw new Error(`Invalid attribute name: "${o}"`);t=D(e,t);let l="";if(e.substring(t,t+8).toUpperCase()==="NOTATION"){if(l="NOTATION",t+=8,t=D(e,t),e[t]!=="(")throw new Error(`Expected '(', found "${e[t]}"`);t++;let d=[];for(;t<e.length&&e[t]!==")";){let i="";for(;t<e.length&&e[t]!=="|"&&e[t]!==")";)i+=e[t],t++;if(i=i.trim(),!pe(i))throw new Error(`Invalid notation name: "${i}"`);d.push(i),e[t]==="|"&&(t++,t=D(e,t))}if(e[t]!==")")throw new Error("Unterminated list of notations");t++,l+=" ("+d.join("|")+")"}else{for(;t<e.length&&!/\s/.test(e[t]);)l+=e[t],t++;const d=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!d.includes(l.toUpperCase()))throw new Error(`Invalid attribute type: "${l}"`)}t=D(e,t);let a="";return e.substring(t,t+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",t+=8):e.substring(t,t+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",t+=7):[t,a]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:s,attributeName:o,attributeType:l,defaultValue:a,index:t}}}const D=(n,e)=>{for(;e<n.length&&/\s/.test(n[e]);)e++;return e};function ce(n,e,t){for(let s=0;s<e.length;s++)if(e[s]!==n[t+s+1])return!1;return!0}function pe(n){if(ye(n))return n;throw new Error(`Invalid entity name ${n}`)}const Mn=/^[-+]?0x[a-fA-F0-9]+$/,Kn=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,jn={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Un(n,e={}){if(e=Object.assign({},jn,e),!n||typeof n!="string")return n;let t=n.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return n;if(n==="0")return 0;if(e.hex&&Mn.test(t))return Hn(t,16);if(t.search(/.+[eE].+/)!==-1)return zn(n,t,e);{const s=Kn.exec(t);if(s){const o=s[1]||"",l=s[2];let a=Xn(s[3]);const d=o?n[l.length+1]===".":n[l.length]===".";if(!e.leadingZeros&&(l.length>1||l.length===1&&!d))return n;{const i=Number(t),c=String(i);if(i===0)return i;if(c.search(/[eE]/)!==-1)return e.eNotation?i:n;if(t.indexOf(".")!==-1)return c==="0"||c===a||c===`${o}${a}`?i:n;let b=l?a:t;return l?b===c||o+b===c?i:n:b===c||b===o+c?i:n}}else return n}}const Fn=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function zn(n,e,t){if(!t.eNotation)return n;const s=e.match(Fn);if(s){let o=s[1]||"";const l=s[3].indexOf("e")===-1?"E":"e",a=s[2],d=o?n[a.length+1]===l:n[a.length]===l;return a.length>1&&d?n:a.length===1&&(s[3].startsWith(`.${l}`)||s[3][0]===l)?Number(e):t.leadingZeros&&!d?(e=(s[1]||"")+s[3],Number(e)):n}else return n}function Xn(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substring(0,n.length-1))),n}function Hn(n,e){if(parseInt)return parseInt(n,e);if(Number.parseInt)return Number.parseInt(n,e);if(window&&window.parseInt)return window.parseInt(n,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Ke(n){return typeof n=="function"?n:Array.isArray(n)?e=>{for(const t of n)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}class qn{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,s)=>String.fromCodePoint(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,s)=>String.fromCodePoint(Number.parseInt(s,16))}},this.addExternalEntities=Wn,this.parseXml=Zn,this.parseTextData=Qn,this.resolveNameSpace=Yn,this.buildAttributesMap=Gn,this.isItStopNode=nr,this.replaceEntitiesValue=er,this.readStopNodeData=or,this.saveTextToParentTag=tr,this.addChild=Jn,this.ignoreAttributesFn=Ke(this.options.ignoreAttributes)}}function Wn(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const s=e[t];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:n[s]}}}function Qn(n,e,t,s,o,l,a){if(n!==void 0&&(this.options.trimValues&&!s&&(n=n.trim()),n.length>0)){a||(n=this.replaceEntitiesValue(n));const d=this.options.tagValueProcessor(e,n,t,o,l);return d==null?n:typeof d!=typeof n||d!==n?d:this.options.trimValues?Ae(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?Ae(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function Yn(n){if(this.options.removeNSPrefix){const e=n.split(":"),t=n.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(n=t+e[1])}return n}const Dn=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Gn(n,e,t){if(this.options.ignoreAttributes!==!0&&typeof n=="string"){const s=Pe(n,Dn),o=s.length,l={};for(let a=0;a<o;a++){const d=this.resolveNameSpace(s[a][1]);if(this.ignoreAttributesFn(d,e))continue;let i=s[a][4],c=this.options.attributeNamePrefix+d;if(d.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),i!==void 0){this.options.trimValues&&(i=i.trim()),i=this.replaceEntitiesValue(i);const b=this.options.attributeValueProcessor(d,i,e);b==null?l[c]=i:typeof b!=typeof i||b!==i?l[c]=b:l[c]=Ae(i,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(l[c]=!0)}if(!Object.keys(l).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=l,a}return l}}const Zn=function(n){n=n.replace(/\r\n?/g,`
|
|
11
|
-
`);const e=new
|
|
12
|
-
`;function ur(n,e){let t="";return e.format&&e.indentBy.length>0&&(t=dr),
|
|
8
|
+
`)(E);m=B(l.value,b,_),i.value=m}else throw new Error(`Unsupported filter type: ${u.type}`);c.value="",r.nextTick(()=>{D()})}catch(m){c.value=m instanceof Error?m.message:"Filter execution error",i.value=null}},$=(u,m="root")=>{const E=new Map,_=(b,T)=>{if(b==null)return b;if(typeof b=="object"&&b.__protected_number__!==void 0){const I=parseFloat(b.__protected_number__);return E.set(I,T),I}if(Array.isArray(b)){const I=b.map((F,W)=>{const ee=`${T}[${W}]`,se=_(F,ee);return E.set(se,ee),se});return E.set(I,T),I}if(typeof b=="object"){const I={};for(const F in b)if(Object.prototype.hasOwnProperty.call(b,F)){const W=T==="root"?F:`${T}.${F}`;I[F]=_(b[F],W)}return E.set(I,T),I}return b};return{proxyData:_(u,m),indexMap:E}},B=(u,m,E)=>{if(m===null||typeof m!="object")return m;if(Array.isArray(m))return m.map(b=>{const T=E.get(b);if(T){const I=M(u,T);if(I!==void 0)return I}return B(u,b,E)});const _=E.get(m);if(_){const b=M(u,_);if(b!==void 0)return b}const x={};for(const b in m)Object.prototype.hasOwnProperty.call(m,b)&&(x[b]=B(u,m[b],E));return x},M=(u,m)=>{if(m==="root")return u;const E=[];let _=m.replace(/^root\.?/,"");const x=/([^\[\].]+)|\[(\d+)\]/g;let b;for(;(b=x.exec(_))!==null;)b[1]?E.push(b[1]):b[2]!==void 0&&E.push(parseInt(b[2]));let T=u;for(const I of E){if(T==null)return;T=T[I]}return T},X=()=>{i.value=null,c.value=""};r.watch(()=>s.modelValue,u=>{k(u)},{immediate:!0});const j=(u,m,E)=>{const _=T=>{if(T===null||typeof T!="object")return T;if(!Array.isArray(T)&&"__protected_number__"in T&&Object.keys(T).length===1)return`__PROTECTED_NUMBER_${T.__protected_number__}_PROTECTED_NUMBER__`;if(Array.isArray(T))return T.map(F=>_(F));const I={};for(const[F,W]of Object.entries(T))I[F]=_(W);return I},x=_(u);return JSON.stringify(x,m,E).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g,"$1")},q=(u,m)=>{if(!s.readonly)try{const E=re(l.value,u,m),_=j(E,null,2);o("update:modelValue",_)}catch(E){console.error("Failed to update JSON:",E)}},re=(u,m,E)=>{if(!m||m==="root")return E;const _=m.split("."),x=O(u,_.slice(0,-1));let b=x;for(let I=0;I<_.length-1;I++){const F=_[I];F!=="root"&&(Array.isArray(b)?b=b[parseInt(F)]:b=b[F])}const T=_[_.length-1];return T==="root"?E:(Array.isArray(b)?b[parseInt(T)]=E:b[T]=E,x)},J=u=>{d.value.has(u)?d.value.delete(u):d.value.add(u)},D=()=>{const u=new Set,m=(E,_="")=>{E!==null&&typeof E=="object"&&(u.add(_||"root"),Array.isArray(E)?E.forEach((x,b)=>{const T=_?`${_}.${b}`:`${b}`;m(x,T)}):Object.keys(E).forEach(x=>{const b=_?`${_}.${x}`:x;m(E[x],b)}))};m(w.value),d.value=u,o("expand-all")},ne=()=>{d.value=new Set(["root"]),o("collapse-all")},oe=async()=>{if(g.value)try{const u=w.value,m=j(u,null,2);await navigator.clipboard.writeText(m),o("copy-success",m)}catch(u){console.error("Failed to copy JSON:",u),o("copy-error",u instanceof Error?u:new Error("Failed to copy JSON"))}},N=()=>{if(g.value)try{const u=w.value,m=j(u);o("update:modelValue",m),o("compress",m)}catch(u){console.error("Failed to compress JSON:",u)}},v=async u=>{try{let m;typeof u=="object"&&u!==null&&!Array.isArray(u)&&"__protected_number__"in u&&Object.keys(u).length===1?m=u.__protected_number__:typeof u=="string"?m=`"${u}"`:m=JSON.stringify(u),await navigator.clipboard.writeText(m)}catch(m){console.error("Failed to copy value:",m)}},R=(u,m)=>{if(!s.readonly)try{const E=C(l.value,u,m),_=j(E,null,2);o("update:modelValue",_),y(u,m)}catch(E){console.error("Failed to rename key:",E)}},C=(u,m,E)=>{if(!m||m==="root")return u;const _=m.split("."),x=O(u,_.slice(0,-1));if(_.length===1){const I=_[0];return x&&typeof x=="object"&&!Array.isArray(x)?U(x,I,E):x}let b=x;for(let I=0;I<_.length-1;I++){const F=_[I];Array.isArray(b)?b=b[parseInt(F)]:b=b[F]}const T=_[_.length-1];if(!Array.isArray(b)&&b&&typeof b=="object"){const I=U(b,T,E),F=_.slice(0,-1);F.length>0&&V(x,F,I)}return x},O=(u,m)=>{if(m.length===0)return u;if(Array.isArray(u)){const E=[...u],_=m[0],x=parseInt(_);return m.length===1||(E[x]=O(u[x],m.slice(1))),E}else if(u&&typeof u=="object"){const E={...u},_=m[0];return m.length===1||(E[_]=O(u[_],m.slice(1))),E}return u},U=(u,m,E)=>{if(!u||typeof u!="object"||Array.isArray(u))return u;const _=Object.keys(u),x={};for(const b of _)b===m?x[E]=u[b]:x[b]=u[b];return x},V=(u,m,E)=>{let _=u;for(let b=0;b<m.length-1;b++){const T=m[b];Array.isArray(_)?_=_[parseInt(T)]:_=_[T]}const x=m[m.length-1];Array.isArray(_)?_[parseInt(x)]=E:_[x]=E},y=(u,m)=>{const E=new Set;d.value.forEach(_=>{if(_===u){const x=u.split(".");x[x.length-1]=m,E.add(x.join("."))}else if(_.startsWith(u+".")){const x=u.split(".");x[x.length-1]=m;const b=x.join("."),T=_.substring(u.length);E.add(b+T)}else E.add(_)}),d.value=E};return e({copyJson:oe,compressSource:N,expandAll:D,collapseAll:ne,toggleExpand:J,updateValue:q,updateKey:R,filter:S,clearFilter:X,isValidJson:()=>g.value,getParsedJson:()=>l.value,getFilteredJson:()=>i.value,getExpandedNodes:()=>d.value,getParseError:()=>a.value,getFilterError:()=>c.value,parseJson:u=>k(u),copyValue:u=>v(u)}),(u,m)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["json-format",`json-format--${p.value.name}`])},[u.showToolbar?(r.openBlock(),r.createElementBlock("div",vt,[r.createElementVNode("div",Ot,[r.createElementVNode("button",{class:"json-format__btn json-format__btn--primary",onClick:oe,disabled:!g.value,title:"Copy JSON"}," 📋 Copy ",8,St),r.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:D,disabled:!g.value,title:"Expand All"}," ⬇️ Expand All ",8,$t),r.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:ne,disabled:!g.value,title:"Collapse All"}," ➡️ Collapse All ",8,Pt),r.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:N,disabled:!g.value,title:"Compress JSON"}," 📦 Compress ",8,Vt)]),r.createElementVNode("div",It,[g.value?(r.openBlock(),r.createElementBlock("span",Rt," ✅ Valid JSON ")):(r.openBlock(),r.createElementBlock("span",Lt," ❌ Invalid JSON "))])])):r.createCommentVNode("",!0),r.createElementVNode("div",Mt,[g.value?c.value?(r.openBlock(),r.createElementBlock("div",Kt,[m[1]||(m[1]=r.createElementVNode("h4",null,"Filter Error:",-1)),r.createElementVNode("pre",null,r.toDisplayString(c.value),1)])):(r.openBlock(),r.createElementBlock("div",Ut,[r.createVNode(Ct,{value:w.value,"key-name":"",level:0,expanded:d.value,"is-last":!0,theme:p.value,"onUpdate:value":q,onToggleExpand:J,onCopy:v,"onUpdate:key":R},null,8,["value","expanded","theme"])])):(r.openBlock(),r.createElementBlock("div",jt,[m[0]||(m[0]=r.createElementVNode("h4",null,"JSON Parse Error:",-1)),r.createElementVNode("pre",null,r.toDisplayString(a.value),1)]))])],2))}}),[["__scopeId","data-v-d3aaf91e"]]),Ft={key:0,class:"xml-node__comment"},zt={key:1,class:"xml-node__cdata"},Xt={key:2,class:"xml-node__element"},Ht={key:0,class:"xml-node__line"},Wt=["contenteditable","onKeydown"],qt=["contenteditable","onDblclick","onKeydown"],Qt=["contenteditable","onDblclick","onKeydown"],Yt=["contenteditable","onKeydown"],Dt={key:1,class:"xml-node__line"},Gt=["contenteditable","onKeydown"],Zt=["contenteditable","onDblclick","onKeydown"],Jt=["contenteditable","onDblclick","onKeydown"],en=["contenteditable","onKeydown"],tn={key:2},nn={key:0,class:"xml-node__line"},rn=["contenteditable","onKeydown"],on=["contenteditable","onDblclick","onKeydown"],sn=["contenteditable","onDblclick","onKeydown"],ln=["title"],an={class:"xml-node__line"},cn=["title"],dn=["contenteditable","onKeydown"],un={key:1},fn=["contenteditable","onKeydown"],hn=["contenteditable","onDblclick","onKeydown"],pn=["contenteditable","onDblclick","onKeydown"],mn=["title"],gn={key:0,class:"xml-node__children"},yn={key:0,class:"xml-node__text"},bn=["contenteditable","onKeydown"],En={key:1,class:"xml-node__line"},_n=Ee(r.defineComponent({__name:"XmlNode",props:{node:{},index:{},level:{default:0},parentPath:{default:""},expanded:{},theme:{}},emits:["toggle-expand","copy","update:tagName","update:attributeName","update:attributeValue","update:textContent","update:cdataContent"],setup(n,{emit:e}){r.useCssVars(h=>({"623698b5":h.theme.colors.indentLine}));const t=n,s=e,o=r.ref(!1),l=r.ref(null),a=r.ref(null),d=r.ref(!1),i=r.ref(!1),c=r.ref(""),g=r.ref(""),p=r.ref(""),w=r.ref(""),k=r.ref(""),S=r.ref(null),$=r.ref(null),B=r.ref(null),M=r.ref(null),X=r.ref(null),j=r.computed(()=>Object.keys(t.node).find(A=>!A.startsWith(":")&&!A.startsWith("#"))||""),q=r.computed(()=>j.value?t.parentPath?`${t.parentPath}.${j.value}[${t.index}]`:`${j.value}[${t.index}]`:""),re=r.computed(()=>t.expanded.has(q.value)),J=r.computed(()=>t.node["#comment"]?"comment":t.node.__cdata?"cdata":j.value?"element":"unknown"),D=r.computed(()=>{const h=t.node[":@"]||{},A={};return Object.keys(h).forEach(Q=>{Q.startsWith("@_")&&(A[Q.substring(2)]=h[Q])}),A}),ne=r.computed(()=>{if(J.value!=="element"||!j.value)return[];const h=t.node[j.value];return Array.isArray(h)?h:[]}),oe=r.computed(()=>ne.value.some(h=>h.__cdata)),N=r.computed(()=>{if(!oe.value)return"";const h=ne.value.find(A=>A.__cdata);if(h&&Array.isArray(h.__cdata)){const A=h.__cdata;if(A.length>0&&A[0]["#text"])return A[0]["#text"]}return""}),v=r.computed(()=>{if(J.value!=="element"||!j.value||oe.value)return"";const h=t.node[j.value];if(!Array.isArray(h))return"";const A=h.find(Q=>Q["#text"]);return A?A["#text"]:""}),R=r.computed(()=>{if(J.value!=="comment")return"";const h=t.node["#comment"];return Array.isArray(h)&&h.length>0&&h[0]["#text"]||""}),C=r.computed(()=>ne.value.some(h=>Object.keys(h).some(Q=>!Q.startsWith("#")&&!Q.startsWith(":")))),O=r.computed(()=>C.value?ne.value.filter(h=>Object.keys(h).some(Q=>!Q.startsWith("#")&&!Q.startsWith(":"))).length:0),U=r.computed(()=>J.value==="element"&&!C.value&&v.value.trim()!==""),V=()=>{C.value&&s("toggle-expand",q.value)},y=(h,A)=>`${q.value}-child-${A}`,u=()=>`${q.value}.${j.value}`,m=()=>{o.value=!0,c.value=j.value,r.nextTick(()=>{if(S.value){S.value.focus();const h=document.createRange();h.selectNodeContents(S.value);const A=window.getSelection();A?.removeAllRanges(),A?.addRange(h)}})},E=h=>{l.value=h,g.value=h,r.nextTick(()=>{if($.value){$.value.focus();const A=document.createRange();A.selectNodeContents($.value);const Q=window.getSelection();Q?.removeAllRanges(),Q?.addRange(A)}})},_=h=>{a.value=h,p.value=D.value[h]||"",r.nextTick(()=>{if(B.value){B.value.focus();const A=document.createRange();A.selectNodeContents(B.value);const Q=window.getSelection();Q?.removeAllRanges(),Q?.addRange(A)}})},x=()=>{d.value=!0,w.value=v.value,r.nextTick(()=>{if(M.value){M.value.focus();const h=document.createRange();h.selectNodeContents(M.value);const A=window.getSelection();A?.removeAllRanges(),A?.addRange(h)}})},b=()=>{if(!o.value)return;const h=S.value?.innerText.trim()||"";if(!h||h===j.value){o.value=!1;return}o.value=!1,s("update:tagName",q.value,j.value,h)},T=()=>{if(!l.value)return;const h=l.value,A=$.value?.innerText.trim()||"";if(!A||A===h){l.value=null;return}l.value=null,s("update:attributeName",q.value,h,A)},I=()=>{if(!a.value)return;const h=a.value,A=B.value?.innerText.trim()||"";a.value=null,s("update:attributeValue",q.value,h,A)},F=()=>{if(!d.value)return;const h=M.value?.innerText||"";if(h===v.value){d.value=!1;return}d.value=!1,s("update:textContent",q.value,h)},W=()=>{o.value=!1,c.value=j.value},ee=()=>{l.value&&(g.value=l.value,l.value=null)},se=()=>{a.value&&(p.value=D.value[a.value]||"",a.value=null)},te=()=>{d.value=!1,w.value=v.value},Kr=()=>{i.value=!0,k.value=N.value,r.nextTick(()=>{if(X.value){X.value.focus();const h=document.createRange();h.selectNodeContents(X.value);const A=window.getSelection();A?.removeAllRanges(),A?.addRange(h)}})},We=()=>{if(!i.value)return;const h=X.value?.innerText||"";if(h===N.value){i.value=!1;return}i.value=!1,s("update:cdataContent",q.value,h)},Ur=()=>{i.value=!1,k.value=N.value},ke=h=>{C.value&&(h.preventDefault(),m())};return(h,A)=>{const Q=r.resolveComponent("XmlNode",!0);return r.openBlock(),r.createElementBlock("div",{class:"xml-node",style:r.normalizeStyle({paddingLeft:h.level>0?"16px":"0"})},[J.value==="comment"?(r.openBlock(),r.createElementBlock("div",Ft,[r.createElementVNode("span",{style:r.normalizeStyle({color:h.theme.colors.xmlComment})}," <!-- "+r.toDisplayString(R.value)+" --> ",5)])):J.value==="cdata"?(r.openBlock(),r.createElementBlock("div",zt,[r.createElementVNode("span",{style:r.normalizeStyle({color:h.theme.colors.xmlCdata})}," <![CDATA["+r.toDisplayString(h.node.__cdata)+"]]> ",5)])):J.value==="element"?(r.openBlock(),r.createElementBlock("div",Xt,[oe.value?(r.openBlock(),r.createElementBlock("div",Ht,[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:m,onContextmenu:ke,onKeydown:[r.withKeys(r.withModifiers(b,["prevent"]),["enter"]),r.withKeys(W,["escape"])],onBlur:b,ref_key:"tagNameRef",ref:S,title:"Double-click to edit tag name"},r.toDisplayString(o.value?c.value:j.value),45,Wt),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(D.value,(Y,P)=>(r.openBlock(),r.createElementBlock("span",{key:P,class:"xml-node__attribute"},[r.createElementVNode("span",{class:"xml-node__attr-name xml-node__attr-name--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttribute}),contenteditable:l.value===P,onDblclick:L=>E(P),onKeydown:[r.withKeys(r.withModifiers(T,["prevent"]),["enter"]),r.withKeys(ee,["escape"])],onBlur:T,ref_for:!0,ref:L=>{l.value===P&&($.value=L)},title:"Double-click to edit attribute name"},r.toDisplayString(l.value===P?g.value:P),45,qt),r.createElementVNode("span",{class:"xml-node__equals",style:r.normalizeStyle({color:h.theme.colors.xmlEquals})},"=",4),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4),r.createElementVNode("span",{class:"xml-node__attr-value xml-node__attr-value--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttributeValue}),contenteditable:a.value===P,onDblclick:L=>_(P),onKeydown:[r.withKeys(r.withModifiers(I,["prevent"]),["enter"]),r.withKeys(se,["escape"])],onBlur:I,ref_for:!0,ref:L=>{a.value===P&&(B.value=L)},title:"Double-click to edit attribute value"},r.toDisplayString(a.value===P?p.value:Y),45,Qt),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4)]))),128)),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4),r.createElementVNode("span",{class:"xml-node__cdata",style:r.normalizeStyle({color:h.theme.colors.xmlCdata})},"<![CDATA[",4),r.createElementVNode("span",{class:"xml-node__cdata-content xml-node__cdata-content--editable",style:r.normalizeStyle({color:h.theme.colors.xmlCdata}),contenteditable:i.value,onDblclick:Kr,onKeydown:[r.withKeys(r.withModifiers(We,["prevent"]),["enter"]),r.withKeys(Ur,["escape"])],onBlur:We,ref_key:"cdataContentRef",ref:X,title:"Double-click to edit CDATA content"},r.toDisplayString(i.value?k.value:N.value),45,Yt),r.createElementVNode("span",{class:"xml-node__cdata",style:r.normalizeStyle({color:h.theme.colors.xmlCdata})},"]]>",4),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"</",4),r.createElementVNode("span",{class:"xml-node__tag",style:r.normalizeStyle({color:h.theme.colors.xmlTag})},r.toDisplayString(o.value?c.value:j.value),5),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)])):U.value?(r.openBlock(),r.createElementBlock("div",Dt,[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:m,onContextmenu:ke,onKeydown:[r.withKeys(r.withModifiers(b,["prevent"]),["enter"]),r.withKeys(W,["escape"])],onBlur:b,ref_key:"tagNameRef",ref:S,title:"Double-click to edit tag name"},r.toDisplayString(o.value?c.value:j.value),45,Gt),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(D.value,(Y,P)=>(r.openBlock(),r.createElementBlock("span",{key:P,class:"xml-node__attribute"},[r.createElementVNode("span",{class:"xml-node__attr-name xml-node__attr-name--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttribute}),contenteditable:l.value===P,onDblclick:L=>E(P),onKeydown:[r.withKeys(r.withModifiers(T,["prevent"]),["enter"]),r.withKeys(ee,["escape"])],onBlur:T,ref_for:!0,ref:L=>{l.value===P&&($.value=L)},title:"Double-click to edit attribute name"},r.toDisplayString(l.value===P?g.value:P),45,Zt),r.createElementVNode("span",{class:"xml-node__equals",style:r.normalizeStyle({color:h.theme.colors.xmlEquals})},"=",4),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4),r.createElementVNode("span",{class:"xml-node__attr-value xml-node__attr-value--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttributeValue}),contenteditable:a.value===P,onDblclick:L=>_(P),onKeydown:[r.withKeys(r.withModifiers(I,["prevent"]),["enter"]),r.withKeys(se,["escape"])],onBlur:I,ref_for:!0,ref:L=>{a.value===P&&(B.value=L)},title:"Double-click to edit attribute value"},r.toDisplayString(a.value===P?p.value:Y),45,Jt),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4)]))),128)),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4),r.createElementVNode("span",{class:"xml-node__text-content xml-node__text-content--editable",style:r.normalizeStyle({color:h.theme.colors.xmlText}),contenteditable:d.value,onDblclick:x,onKeydown:[r.withKeys(r.withModifiers(F,["prevent"]),["enter"]),r.withKeys(te,["escape"])],onBlur:F,ref_key:"textContentRef",ref:M,title:"Double-click to edit text content"},r.toDisplayString(d.value?w.value:v.value),45,en),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"</",4),r.createElementVNode("span",{class:"xml-node__tag",style:r.normalizeStyle({color:h.theme.colors.xmlTag})},r.toDisplayString(o.value?c.value:j.value),5),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)])):(r.openBlock(),r.createElementBlock("div",tn,[!re.value&&C.value?(r.openBlock(),r.createElementBlock("div",nn,[r.createElementVNode("span",{class:"xml-node__clickable-part",onClick:A[0]||(A[0]=Y=>V()),title:"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:r.withModifiers(m,["stop"]),onContextmenu:ke,onKeydown:[r.withKeys(r.withModifiers(b,["prevent"]),["enter"]),r.withKeys(W,["escape"])],onBlur:b,ref_key:"tagNameRef",ref:S,title:"Double-click or right-click to edit tag name"},r.toDisplayString(o.value?c.value:j.value),45,rn)]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(D.value,(Y,P)=>(r.openBlock(),r.createElementBlock("span",{key:P,class:"xml-node__attribute"},[r.createElementVNode("span",{class:"xml-node__attr-name xml-node__attr-name--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttribute}),contenteditable:l.value===P,onDblclick:L=>E(P),onKeydown:[r.withKeys(r.withModifiers(T,["prevent"]),["enter"]),r.withKeys(ee,["escape"])],onBlur:T,ref_for:!0,ref:L=>{l.value===P&&($.value=L)},title:"Double-click to edit attribute name"},r.toDisplayString(l.value===P?g.value:P),45,on),r.createElementVNode("span",{class:"xml-node__equals",style:r.normalizeStyle({color:h.theme.colors.xmlEquals})},"=",4),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4),r.createElementVNode("span",{class:"xml-node__attr-value xml-node__attr-value--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttributeValue}),contenteditable:a.value===P,onDblclick:L=>_(P),onKeydown:[r.withKeys(r.withModifiers(I,["prevent"]),["enter"]),r.withKeys(se,["escape"])],onBlur:I,ref_for:!0,ref:L=>{a.value===P&&(B.value=L)},title:"Double-click to edit attribute value"},r.toDisplayString(a.value===P?p.value:Y),45,sn),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4)]))),128)),r.createElementVNode("span",{class:"xml-node__clickable-part",onClick:A[1]||(A[1]=Y=>V()),title:"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)]),r.createElementVNode("span",{class:"xml-node__collapsed-badge",style:r.normalizeStyle({backgroundColor:h.theme.colors.collapsedBackground,color:h.theme.colors.collapsedText}),onClick:A[2]||(A[2]=Y=>V()),title:`Click to expand ${O.value} child element${O.value>1?"s":""}`},r.toDisplayString(O.value)+" child"+r.toDisplayString(O.value>1?"ren":""),13,ln),r.createElementVNode("span",{class:"xml-node__clickable-part",onClick:A[3]||(A[3]=Y=>V()),title:"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"</",4),r.createElementVNode("span",{class:"xml-node__tag",style:r.normalizeStyle({color:h.theme.colors.xmlTag})},r.toDisplayString(o.value?c.value:j.value),5),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)])])):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",an,[C.value?(r.openBlock(),r.createElementBlock("span",{key:0,class:"xml-node__clickable-part",onClick:A[4]||(A[4]=Y=>V()),title:re.value?"Click to collapse":"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:r.withModifiers(m,["stop"]),onContextmenu:ke,onKeydown:[r.withKeys(r.withModifiers(b,["prevent"]),["enter"]),r.withKeys(W,["escape"])],onBlur:b,ref_key:"tagNameRef",ref:S,title:"Double-click or right-click to edit tag name"},r.toDisplayString(o.value?c.value:j.value),45,dn)],8,cn)):(r.openBlock(),r.createElementBlock("span",un,[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"<",4),r.createElementVNode("span",{class:"xml-node__tag xml-node__tag--editable",style:r.normalizeStyle({color:h.theme.colors.xmlTag}),contenteditable:o.value,onDblclick:m,onKeydown:[r.withKeys(r.withModifiers(b,["prevent"]),["enter"]),r.withKeys(W,["escape"])],onBlur:b,ref_key:"tagNameRef",ref:S,title:"Double-click to edit tag name"},r.toDisplayString(o.value?c.value:j.value),45,fn)])),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(D.value,(Y,P)=>(r.openBlock(),r.createElementBlock("span",{key:P,class:"xml-node__attribute"},[r.createElementVNode("span",{class:"xml-node__attr-name xml-node__attr-name--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttribute}),contenteditable:l.value===P,onDblclick:L=>E(P),onKeydown:[r.withKeys(r.withModifiers(T,["prevent"]),["enter"]),r.withKeys(ee,["escape"])],onBlur:T,ref_for:!0,ref:L=>{l.value===P&&($.value=L)},title:"Double-click to edit attribute name"},r.toDisplayString(l.value===P?g.value:P),45,hn),r.createElementVNode("span",{class:"xml-node__equals",style:r.normalizeStyle({color:h.theme.colors.xmlEquals})},"=",4),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4),r.createElementVNode("span",{class:"xml-node__attr-value xml-node__attr-value--editable",style:r.normalizeStyle({color:h.theme.colors.xmlAttributeValue}),contenteditable:a.value===P,onDblclick:L=>_(P),onKeydown:[r.withKeys(r.withModifiers(I,["prevent"]),["enter"]),r.withKeys(se,["escape"])],onBlur:I,ref_for:!0,ref:L=>{a.value===P&&(B.value=L)},title:"Double-click to edit attribute value"},r.toDisplayString(a.value===P?p.value:Y),45,pn),r.createElementVNode("span",{class:"xml-node__quote",style:r.normalizeStyle({color:h.theme.colors.xmlQuote})},'"',4)]))),128)),C.value?(r.openBlock(),r.createElementBlock("span",{key:2,class:"xml-node__clickable-part",onClick:A[5]||(A[5]=Y=>V()),title:re.value?"Click to collapse":"Click to expand"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)],8,mn)):(r.openBlock(),r.createElementBlock("span",{key:3,class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},r.toDisplayString(C.value?">":"/>"),5))]),re.value&&C.value?(r.openBlock(),r.createElementBlock("div",gn,[ne.value.length===0&&v.value.trim()?(r.openBlock(),r.createElementBlock("div",yn,[r.createElementVNode("span",{class:"xml-node__text-content xml-node__text-content--editable",style:r.normalizeStyle({color:h.theme.colors.xmlText}),contenteditable:d.value,onDblclick:x,onKeydown:[r.withKeys(r.withModifiers(F,["prevent"]),["enter"]),r.withKeys(te,["escape"])],onBlur:F,ref_key:"textContentRef",ref:M,title:"Double-click to edit text content"},r.toDisplayString(d.value?w.value:v.value),45,bn)])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(ne.value,(Y,P)=>(r.openBlock(),r.createBlock(Q,{key:y(Y,P),node:Y,index:P,level:h.level+1,"parent-path":u(),expanded:h.expanded,theme:h.theme,onToggleExpand:A[6]||(A[6]=L=>h.$emit("toggle-expand",L)),onCopy:A[7]||(A[7]=L=>h.$emit("copy",L)),"onUpdate:tagName":A[8]||(A[8]=(L,ce,be)=>h.$emit("update:tagName",L,ce,be)),"onUpdate:attributeName":A[9]||(A[9]=(L,ce,be)=>h.$emit("update:attributeName",L,ce,be)),"onUpdate:attributeValue":A[10]||(A[10]=(L,ce,be)=>h.$emit("update:attributeValue",L,ce,be)),"onUpdate:textContent":A[11]||(A[11]=(L,ce)=>h.$emit("update:textContent",L,ce)),"onUpdate:cdataContent":A[12]||(A[12]=(L,ce)=>h.$emit("update:cdataContent",L,ce))},null,8,["node","index","level","parent-path","expanded","theme"]))),128))])):r.createCommentVNode("",!0),re.value&&C.value?(r.openBlock(),r.createElementBlock("div",En,[r.createElementVNode("span",{class:"xml-node__clickable-part",onClick:A[13]||(A[13]=Y=>V()),title:"Click to collapse"},[r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},"</",4),r.createElementVNode("span",{class:"xml-node__tag",style:r.normalizeStyle({color:h.theme.colors.xmlTag})},r.toDisplayString(o.value?c.value:j.value),5),r.createElementVNode("span",{class:"xml-node__bracket",style:r.normalizeStyle({color:h.theme.colors.xmlBracket})},">",4)])])):r.createCommentVNode("",!0)],64))]))])):r.createCommentVNode("",!0)],4)}}}),[["__scopeId","data-v-44ac0d91"]]),$e={"github-light":{name:"github-light",colors:{background:"#ffffff",surfaceBackground:"#f6f8fa",border:"#d0d7de",text:"#24292f",textSecondary:"#57606a",buttonBackground:"#f6f8fa",buttonBackgroundHover:"#f3f4f6",buttonBorder:"#d0d7de",buttonText:"#24292f",buttonPrimary:"#1f883d",buttonPrimaryHover:"#1a7f37",success:"#1f883d",successBackground:"#dafbe1",error:"#cf222e",errorBackground:"#ffebe9",xmlTag:"#116329",xmlAttribute:"#0550ae",xmlAttributeValue:"#0a3069",xmlText:"#24292f",xmlComment:"#6e7781",xmlCdata:"#8250df",xmlDeclaration:"#953800",xmlBracket:"#6e7781",xmlEquals:"#6e7781",xmlQuote:"#0550ae",collapsedBackground:"#ddf4ff",collapsedText:"#0969da",indentLine:"#d0d7de"}},"github-dark":{name:"github-dark",colors:{background:"#0d1117",surfaceBackground:"#161b22",border:"#30363d",text:"#c9d1d9",textSecondary:"#8b949e",buttonBackground:"#21262d",buttonBackgroundHover:"#30363d",buttonBorder:"#30363d",buttonText:"#c9d1d9",buttonPrimary:"#238636",buttonPrimaryHover:"#2ea043",success:"#3fb950",successBackground:"#0f2e1c",error:"#f85149",errorBackground:"#3d1319",xmlTag:"#7ee787",xmlAttribute:"#79c0ff",xmlAttributeValue:"#a5d6ff",xmlText:"#c9d1d9",xmlComment:"#8b949e",xmlCdata:"#d2a8ff",xmlDeclaration:"#ffa657",xmlBracket:"#8b949e",xmlEquals:"#8b949e",xmlQuote:"#79c0ff",collapsedBackground:"#1c2d41",collapsedText:"#58a6ff",indentLine:"#30363d"}},"min-light":{name:"min-light",colors:{background:"#ffffff",surfaceBackground:"#fafafa",border:"#e5e5e5",text:"#171717",textSecondary:"#737373",buttonBackground:"#fafafa",buttonBackgroundHover:"#f5f5f5",buttonBorder:"#e5e5e5",buttonText:"#171717",buttonPrimary:"#22c55e",buttonPrimaryHover:"#16a34a",success:"#22c55e",successBackground:"#dcfce7",error:"#ef4444",errorBackground:"#fee2e2",xmlTag:"#16a34a",xmlAttribute:"#2563eb",xmlAttributeValue:"#1e40af",xmlText:"#171717",xmlComment:"#737373",xmlCdata:"#9333ea",xmlDeclaration:"#ea580c",xmlBracket:"#737373",xmlEquals:"#737373",xmlQuote:"#2563eb",collapsedBackground:"#dbeafe",collapsedText:"#1d4ed8",indentLine:"#e5e7eb"}},"slack-ochin":{name:"slack-ochin",colors:{background:"#fef5ed",surfaceBackground:"#fef9f3",border:"#e9dcc9",text:"#3d3c40",textSecondary:"#616061",buttonBackground:"#fef9f3",buttonBackgroundHover:"#f9f0e5",buttonBorder:"#e9dcc9",buttonText:"#3d3c40",buttonPrimary:"#007a5a",buttonPrimaryHover:"#006644",success:"#007a5a",successBackground:"#d1f4e0",error:"#e01e5a",errorBackground:"#ffdbea",xmlTag:"#007a5a",xmlAttribute:"#1264a3",xmlAttributeValue:"#0b4c8c",xmlText:"#3d3c40",xmlComment:"#616061",xmlCdata:"#8b2eff",xmlDeclaration:"#e8912d",xmlBracket:"#616061",xmlEquals:"#616061",xmlQuote:"#1264a3",collapsedBackground:"#d8eaf5",collapsedText:"#0b4c8c",indentLine:"#e8d5b7"}}},xn=n=>$e[n]||$e["github-light"],Pe=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",kn=Pe+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Nn="["+Pe+"]["+kn+"]*",wn=new RegExp("^"+Nn+"$");function Ve(n,e){const t=[];let s=e.exec(n);for(;s;){const o=[];o.startIndex=e.lastIndex-s[0].length;const l=s.length;for(let a=0;a<l;a++)o.push(s[a]);t.push(o),s=e.exec(n)}return t}const _e=function(n){const e=wn.exec(n);return!(e===null||typeof e>"u")};function An(n){return typeof n<"u"}const Cn={allowBooleanAttributes:!1,unpairedTags:[]};function Ie(n,e){e=Object.assign({},Cn,e);const t=[];let s=!1,o=!1;n[0]==="\uFEFF"&&(n=n.substr(1));for(let l=0;l<n.length;l++)if(n[l]==="<"&&n[l+1]==="?"){if(l+=2,l=Le(n,l),l.err)return l}else if(n[l]==="<"){let a=l;if(l++,n[l]==="!"){l=Me(n,l);continue}else{let d=!1;n[l]==="/"&&(d=!0,l++);let i="";for(;l<n.length&&n[l]!==">"&&n[l]!==" "&&n[l]!==" "&&n[l]!==`
|
|
9
|
+
`&&n[l]!=="\r";l++)i+=n[l];if(i=i.trim(),i[i.length-1]==="/"&&(i=i.substring(0,i.length-1),l--),!Vn(i)){let p;return i.trim().length===0?p="Invalid space after '<'.":p="Tag '"+i+"' is an invalid name.",H("InvalidTag",p,G(n,l))}const c=vn(n,l);if(c===!1)return H("InvalidAttr","Attributes for '"+i+"' have open quote.",G(n,l));let g=c.value;if(l=c.index,g[g.length-1]==="/"){const p=l-g.length;g=g.substring(0,g.length-1);const w=je(g,e);if(w===!0)s=!0;else return H(w.err.code,w.err.msg,G(n,p+w.err.line))}else if(d)if(c.tagClosed){if(g.trim().length>0)return H("InvalidTag","Closing tag '"+i+"' can't have attributes or invalid starting.",G(n,a));if(t.length===0)return H("InvalidTag","Closing tag '"+i+"' has not been opened.",G(n,a));{const p=t.pop();if(i!==p.tagName){let w=G(n,p.tagStartPos);return H("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+w.line+", col "+w.col+") instead of closing tag '"+i+"'.",G(n,a))}t.length==0&&(o=!0)}}else return H("InvalidTag","Closing tag '"+i+"' doesn't have proper closing.",G(n,l));else{const p=je(g,e);if(p!==!0)return H(p.err.code,p.err.msg,G(n,l-g.length+p.err.line));if(o===!0)return H("InvalidXml","Multiple possible root nodes found.",G(n,l));e.unpairedTags.indexOf(i)!==-1||t.push({tagName:i,tagStartPos:a}),s=!0}for(l++;l<n.length;l++)if(n[l]==="<")if(n[l+1]==="!"){l++,l=Me(n,l);continue}else if(n[l+1]==="?"){if(l=Le(n,++l),l.err)return l}else break;else if(n[l]==="&"){const p=$n(n,l);if(p==-1)return H("InvalidChar","char '&' is not expected.",G(n,l));l=p}else if(o===!0&&!Re(n[l]))return H("InvalidXml","Extra text at the end",G(n,l));n[l]==="<"&&l--}}else{if(Re(n[l]))continue;return H("InvalidChar","char '"+n[l]+"' is not expected.",G(n,l))}if(s){if(t.length==1)return H("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",G(n,t[0].tagStartPos));if(t.length>0)return H("InvalidXml","Invalid '"+JSON.stringify(t.map(l=>l.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return H("InvalidXml","Start tag expected.",1);return!0}function Re(n){return n===" "||n===" "||n===`
|
|
10
|
+
`||n==="\r"}function Le(n,e){const t=e;for(;e<n.length;e++)if(n[e]=="?"||n[e]==" "){const s=n.substr(t,e-t);if(e>5&&s==="xml")return H("InvalidXml","XML declaration allowed only at the start of the document.",G(n,e));if(n[e]=="?"&&n[e+1]==">"){e++;break}else continue}return e}function Me(n,e){if(n.length>e+5&&n[e+1]==="-"&&n[e+2]==="-"){for(e+=3;e<n.length;e++)if(n[e]==="-"&&n[e+1]==="-"&&n[e+2]===">"){e+=2;break}}else if(n.length>e+8&&n[e+1]==="D"&&n[e+2]==="O"&&n[e+3]==="C"&&n[e+4]==="T"&&n[e+5]==="Y"&&n[e+6]==="P"&&n[e+7]==="E"){let t=1;for(e+=8;e<n.length;e++)if(n[e]==="<")t++;else if(n[e]===">"&&(t--,t===0))break}else if(n.length>e+9&&n[e+1]==="["&&n[e+2]==="C"&&n[e+3]==="D"&&n[e+4]==="A"&&n[e+5]==="T"&&n[e+6]==="A"&&n[e+7]==="["){for(e+=8;e<n.length;e++)if(n[e]==="]"&&n[e+1]==="]"&&n[e+2]===">"){e+=2;break}}return e}const Bn='"',Tn="'";function vn(n,e){let t="",s="",o=!1;for(;e<n.length;e++){if(n[e]===Bn||n[e]===Tn)s===""?s=n[e]:s!==n[e]||(s="");else if(n[e]===">"&&s===""){o=!0;break}t+=n[e]}return s!==""?!1:{value:t,index:e,tagClosed:o}}const On=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function je(n,e){const t=Ve(n,On),s={};for(let o=0;o<t.length;o++){if(t[o][1].length===0)return H("InvalidAttr","Attribute '"+t[o][2]+"' has no space in starting.",ge(t[o]));if(t[o][3]!==void 0&&t[o][4]===void 0)return H("InvalidAttr","Attribute '"+t[o][2]+"' is without value.",ge(t[o]));if(t[o][3]===void 0&&!e.allowBooleanAttributes)return H("InvalidAttr","boolean attribute '"+t[o][2]+"' is not allowed.",ge(t[o]));const l=t[o][2];if(!Pn(l))return H("InvalidAttr","Attribute '"+l+"' is an invalid name.",ge(t[o]));if(!s.hasOwnProperty(l))s[l]=1;else return H("InvalidAttr","Attribute '"+l+"' is repeated.",ge(t[o]))}return!0}function Sn(n,e){let t=/\d/;for(n[e]==="x"&&(e++,t=/[\da-fA-F]/);e<n.length;e++){if(n[e]===";")return e;if(!n[e].match(t))break}return-1}function $n(n,e){if(e++,n[e]===";")return-1;if(n[e]==="#")return e++,Sn(n,e);let t=0;for(;e<n.length;e++,t++)if(!(n[e].match(/\w/)&&t<20)){if(n[e]===";")break;return-1}return e}function H(n,e,t){return{err:{code:n,msg:e,line:t.line||t,col:t.col}}}function Pn(n){return _e(n)}function Vn(n){return _e(n)}function G(n,e){const t=n.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function ge(n){return n.startIndex+n[1].length}const In={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,e,t){return n},captureMetaData:!1},Rn=function(n){return Object.assign({},In,n)};let xe;typeof Symbol!="function"?xe="@@xmlMetadata":xe=Symbol("XML Node Metadata");class fe{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][xe]={startIndex:t})}static getMetaDataSymbol(){return xe}}class Ln{constructor(e){this.suppressValidationErr=!e}readDocType(e,t){const s={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let o=1,l=!1,a=!1,d="";for(;t<e.length;t++)if(e[t]==="<"&&!a){if(l&&he(e,"!ENTITY",t)){t+=7;let i,c;[i,c,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),c.indexOf("&")===-1&&(s[i]={regx:RegExp(`&${i};`,"g"),val:c})}else if(l&&he(e,"!ELEMENT",t)){t+=8;const{index:i}=this.readElementExp(e,t+1);t=i}else if(l&&he(e,"!ATTLIST",t))t+=8;else if(l&&he(e,"!NOTATION",t)){t+=9;const{index:i}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=i}else if(he(e,"!--",t))a=!0;else throw new Error("Invalid DOCTYPE");o++,d=""}else if(e[t]===">"){if(a?e[t-1]==="-"&&e[t-2]==="-"&&(a=!1,o--):o--,o===0)break}else e[t]==="["?l=!0:d+=e[t];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:s,i:t}}readEntityExp(e,t){t=Z(e,t);let s="";for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)s+=e[t],t++;if(ye(s),t=Z(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[t]==="%")throw new Error("Parameter entities are not supported")}let o="";return[t,o]=this.readIdentifierVal(e,t,"entity"),t--,[s,o,t]}readNotationExp(e,t){t=Z(e,t);let s="";for(;t<e.length&&!/\s/.test(e[t]);)s+=e[t],t++;!this.suppressValidationErr&&ye(s),t=Z(e,t);const o=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);t+=o.length,t=Z(e,t);let l=null,a=null;if(o==="PUBLIC")[t,l]=this.readIdentifierVal(e,t,"publicIdentifier"),t=Z(e,t),(e[t]==='"'||e[t]==="'")&&([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"));else if(o==="SYSTEM"&&([t,a]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:s,publicIdentifier:l,systemIdentifier:a,index:--t}}readIdentifierVal(e,t,s){let o="";const l=e[t];if(l!=='"'&&l!=="'")throw new Error(`Expected quoted string, found "${l}"`);for(t++;t<e.length&&e[t]!==l;)o+=e[t],t++;if(e[t]!==l)throw new Error(`Unterminated ${s} value`);return t++,[t,o]}readElementExp(e,t){t=Z(e,t);let s="";for(;t<e.length&&!/\s/.test(e[t]);)s+=e[t],t++;if(!this.suppressValidationErr&&!_e(s))throw new Error(`Invalid element name: "${s}"`);t=Z(e,t);let o="";if(e[t]==="E"&&he(e,"MPTY",t))t+=4;else if(e[t]==="A"&&he(e,"NY",t))t+=2;else if(e[t]==="("){for(t++;t<e.length&&e[t]!==")";)o+=e[t],t++;if(e[t]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:s,contentModel:o.trim(),index:t}}readAttlistExp(e,t){t=Z(e,t);let s="";for(;t<e.length&&!/\s/.test(e[t]);)s+=e[t],t++;ye(s),t=Z(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t]);)o+=e[t],t++;if(!ye(o))throw new Error(`Invalid attribute name: "${o}"`);t=Z(e,t);let l="";if(e.substring(t,t+8).toUpperCase()==="NOTATION"){if(l="NOTATION",t+=8,t=Z(e,t),e[t]!=="(")throw new Error(`Expected '(', found "${e[t]}"`);t++;let d=[];for(;t<e.length&&e[t]!==")";){let i="";for(;t<e.length&&e[t]!=="|"&&e[t]!==")";)i+=e[t],t++;if(i=i.trim(),!ye(i))throw new Error(`Invalid notation name: "${i}"`);d.push(i),e[t]==="|"&&(t++,t=Z(e,t))}if(e[t]!==")")throw new Error("Unterminated list of notations");t++,l+=" ("+d.join("|")+")"}else{for(;t<e.length&&!/\s/.test(e[t]);)l+=e[t],t++;const d=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!d.includes(l.toUpperCase()))throw new Error(`Invalid attribute type: "${l}"`)}t=Z(e,t);let a="";return e.substring(t,t+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",t+=8):e.substring(t,t+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",t+=7):[t,a]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:s,attributeName:o,attributeType:l,defaultValue:a,index:t}}}const Z=(n,e)=>{for(;e<n.length&&/\s/.test(n[e]);)e++;return e};function he(n,e,t){for(let s=0;s<e.length;s++)if(e[s]!==n[t+s+1])return!1;return!0}function ye(n){if(_e(n))return n;throw new Error(`Invalid entity name ${n}`)}const Mn=/^[-+]?0x[a-fA-F0-9]+$/,jn=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Kn={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Un(n,e={}){if(e=Object.assign({},Kn,e),!n||typeof n!="string")return n;let t=n.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return n;if(n==="0")return 0;if(e.hex&&Mn.test(t))return Hn(t,16);if(t.search(/.+[eE].+/)!==-1)return zn(n,t,e);{const s=jn.exec(t);if(s){const o=s[1]||"",l=s[2];let a=Xn(s[3]);const d=o?n[l.length+1]===".":n[l.length]===".";if(!e.leadingZeros&&(l.length>1||l.length===1&&!d))return n;{const i=Number(t),c=String(i);if(i===0)return i;if(c.search(/[eE]/)!==-1)return e.eNotation?i:n;if(t.indexOf(".")!==-1)return c==="0"||c===a||c===`${o}${a}`?i:n;let g=l?a:t;return l?g===c||o+g===c?i:n:g===c||g===o+c?i:n}}else return n}}const Fn=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function zn(n,e,t){if(!t.eNotation)return n;const s=e.match(Fn);if(s){let o=s[1]||"";const l=s[3].indexOf("e")===-1?"E":"e",a=s[2],d=o?n[a.length+1]===l:n[a.length]===l;return a.length>1&&d?n:a.length===1&&(s[3].startsWith(`.${l}`)||s[3][0]===l)?Number(e):t.leadingZeros&&!d?(e=(s[1]||"")+s[3],Number(e)):n}else return n}function Xn(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substring(0,n.length-1))),n}function Hn(n,e){if(parseInt)return parseInt(n,e);if(Number.parseInt)return Number.parseInt(n,e);if(window&&window.parseInt)return window.parseInt(n,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Ke(n){return typeof n=="function"?n:Array.isArray(n)?e=>{for(const t of n)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}class Wn{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,s)=>String.fromCodePoint(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,s)=>String.fromCodePoint(Number.parseInt(s,16))}},this.addExternalEntities=qn,this.parseXml=Zn,this.parseTextData=Qn,this.resolveNameSpace=Yn,this.buildAttributesMap=Gn,this.isItStopNode=nr,this.replaceEntitiesValue=er,this.readStopNodeData=or,this.saveTextToParentTag=tr,this.addChild=Jn,this.ignoreAttributesFn=Ke(this.options.ignoreAttributes)}}function qn(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const s=e[t];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:n[s]}}}function Qn(n,e,t,s,o,l,a){if(n!==void 0&&(this.options.trimValues&&!s&&(n=n.trim()),n.length>0)){a||(n=this.replaceEntitiesValue(n));const d=this.options.tagValueProcessor(e,n,t,o,l);return d==null?n:typeof d!=typeof n||d!==n?d:this.options.trimValues?Ce(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?Ce(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function Yn(n){if(this.options.removeNSPrefix){const e=n.split(":"),t=n.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(n=t+e[1])}return n}const Dn=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Gn(n,e,t){if(this.options.ignoreAttributes!==!0&&typeof n=="string"){const s=Ve(n,Dn),o=s.length,l={};for(let a=0;a<o;a++){const d=this.resolveNameSpace(s[a][1]);if(this.ignoreAttributesFn(d,e))continue;let i=s[a][4],c=this.options.attributeNamePrefix+d;if(d.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),i!==void 0){this.options.trimValues&&(i=i.trim()),i=this.replaceEntitiesValue(i);const g=this.options.attributeValueProcessor(d,i,e);g==null?l[c]=i:typeof g!=typeof i||g!==i?l[c]=g:l[c]=Ce(i,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(l[c]=!0)}if(!Object.keys(l).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=l,a}return l}}const Zn=function(n){n=n.replace(/\r\n?/g,`
|
|
11
|
+
`);const e=new fe("!xml");let t=e,s="",o="";const l=new Ln(this.options.processEntities);for(let a=0;a<n.length;a++)if(n[a]==="<")if(n[a+1]==="/"){const i=pe(n,">",a,"Closing Tag is not closed.");let c=n.substring(a+2,i).trim();if(this.options.removeNSPrefix){const w=c.indexOf(":");w!==-1&&(c=c.substr(w+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),t&&(s=this.saveTextToParentTag(s,t,o));const g=o.substring(o.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let p=0;g&&this.options.unpairedTags.indexOf(g)!==-1?(p=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=o.lastIndexOf("."),o=o.substring(0,p),t=this.tagsNodeStack.pop(),s="",a=i}else if(n[a+1]==="?"){let i=Ae(n,a,!1,"?>");if(!i)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,t,o),!(this.options.ignoreDeclaration&&i.tagName==="?xml"||this.options.ignorePiTags)){const c=new fe(i.tagName);c.add(this.options.textNodeName,""),i.tagName!==i.tagExp&&i.attrExpPresent&&(c[":@"]=this.buildAttributesMap(i.tagExp,o,i.tagName)),this.addChild(t,c,o,a)}a=i.closeIndex+1}else if(n.substr(a+1,3)==="!--"){const i=pe(n,"-->",a+4,"Comment is not closed.");if(this.options.commentPropName){const c=n.substring(a+4,i-2);s=this.saveTextToParentTag(s,t,o),t.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}a=i}else if(n.substr(a+1,2)==="!D"){const i=l.readDocType(n,a);this.docTypeEntities=i.entities,a=i.i}else if(n.substr(a+1,2)==="!["){const i=pe(n,"]]>",a,"CDATA is not closed.")-2,c=n.substring(a+9,i);s=this.saveTextToParentTag(s,t,o);let g=this.parseTextData(c,t.tagname,o,!0,!1,!0,!0);g==null&&(g=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):t.add(this.options.textNodeName,g),a=i+2}else{let i=Ae(n,a,this.options.removeNSPrefix),c=i.tagName;const g=i.rawTagName;let p=i.tagExp,w=i.attrExpPresent,k=i.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),t&&s&&t.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,t,o,!1));const S=t;S&&this.options.unpairedTags.indexOf(S.tagname)!==-1&&(t=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),c!==e.tagname&&(o+=o?"."+c:c);const $=a;if(this.isItStopNode(this.options.stopNodes,o,c)){let B="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),p=c):p=p.substr(0,p.length-1),a=i.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)a=i.closeIndex;else{const X=this.readStopNodeData(n,g,k+1);if(!X)throw new Error(`Unexpected end of ${g}`);a=X.i,B=X.tagContent}const M=new fe(c);c!==p&&w&&(M[":@"]=this.buildAttributesMap(p,o,c)),B&&(B=this.parseTextData(B,c,o,!0,w,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),M.add(this.options.textNodeName,B),this.addChild(t,M,o,$)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),p=c):p=p.substr(0,p.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const B=new fe(c);c!==p&&w&&(B[":@"]=this.buildAttributesMap(p,o,c)),this.addChild(t,B,o,$),o=o.substr(0,o.lastIndexOf("."))}else{const B=new fe(c);this.tagsNodeStack.push(t),c!==p&&w&&(B[":@"]=this.buildAttributesMap(p,o,c)),this.addChild(t,B,o,$),t=B}s="",a=k}}else s+=n[a];return e.child};function Jn(n,e,t,s){this.options.captureMetaData||(s=void 0);const o=this.options.updateTag(e.tagname,t,e[":@"]);o===!1||(typeof o=="string"&&(e.tagname=o),n.addChild(e,s))}const er=function(n){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];n=n.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];n=n.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];n=n.replace(t.regex,t.val)}n=n.replace(this.ampEntity.regex,this.ampEntity.val)}return n};function tr(n,e,t,s){return n&&(s===void 0&&(s=e.child.length===0),n=this.parseTextData(n,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,s),n!==void 0&&n!==""&&e.add(this.options.textNodeName,n),n=""),n}function nr(n,e,t){const s="*."+t;for(const o in n){const l=n[o];if(s===l||e===l)return!0}return!1}function rr(n,e,t=">"){let s,o="";for(let l=e;l<n.length;l++){let a=n[l];if(s)a===s&&(s="");else if(a==='"'||a==="'")s=a;else if(a===t[0])if(t[1]){if(n[l+1]===t[1])return{data:o,index:l}}else return{data:o,index:l};else a===" "&&(a=" ");o+=a}}function pe(n,e,t,s){const o=n.indexOf(e,t);if(o===-1)throw new Error(s);return o+e.length-1}function Ae(n,e,t,s=">"){const o=rr(n,e+1,s);if(!o)return;let l=o.data;const a=o.index,d=l.search(/\s/);let i=l,c=!0;d!==-1&&(i=l.substring(0,d),l=l.substring(d+1).trimStart());const g=i;if(t){const p=i.indexOf(":");p!==-1&&(i=i.substr(p+1),c=i!==o.data.substr(p+1))}return{tagName:i,tagExp:l,closeIndex:a,attrExpPresent:c,rawTagName:g}}function or(n,e,t){const s=t;let o=1;for(;t<n.length;t++)if(n[t]==="<")if(n[t+1]==="/"){const l=pe(n,">",t,`${e} is not closed`);if(n.substring(t+2,l).trim()===e&&(o--,o===0))return{tagContent:n.substring(s,t),i:l};t=l}else if(n[t+1]==="?")t=pe(n,"?>",t+1,"StopNode is not closed.");else if(n.substr(t+1,3)==="!--")t=pe(n,"-->",t+3,"StopNode is not closed.");else if(n.substr(t+1,2)==="![")t=pe(n,"]]>",t,"StopNode is not closed.")-2;else{const l=Ae(n,t,">");l&&((l&&l.tagName)===e&&l.tagExp[l.tagExp.length-1]!=="/"&&o++,t=l.closeIndex)}}function Ce(n,e,t){if(e&&typeof n=="string"){const s=n.trim();return s==="true"?!0:s==="false"?!1:Un(n,t)}else return An(n)?n:""}const Be=fe.getMetaDataSymbol();function sr(n,e){return Ue(n,e)}function Ue(n,e,t){let s;const o={};for(let l=0;l<n.length;l++){const a=n[l],d=lr(a);let i="";if(t===void 0?i=d:i=t+"."+d,d===e.textNodeName)s===void 0?s=a[d]:s+=""+a[d];else{if(d===void 0)continue;if(a[d]){let c=Ue(a[d],e,i);const g=ir(c,e);a[Be]!==void 0&&(c[Be]=a[Be]),a[":@"]?ar(c,a[":@"],i,e):Object.keys(c).length===1&&c[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?c=c[e.textNodeName]:Object.keys(c).length===0&&(e.alwaysCreateTextNode?c[e.textNodeName]="":c=""),o[d]!==void 0&&o.hasOwnProperty(d)?(Array.isArray(o[d])||(o[d]=[o[d]]),o[d].push(c)):e.isArray(d,i,g)?o[d]=[c]:o[d]=c}}}return typeof s=="string"?s.length>0&&(o[e.textNodeName]=s):s!==void 0&&(o[e.textNodeName]=s),o}function lr(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const s=e[t];if(s!==":@")return s}}function ar(n,e,t,s){if(e){const o=Object.keys(e),l=o.length;for(let a=0;a<l;a++){const d=o[a];s.isArray(d,t+"."+d,!0,!0)?n[d]=[e[d]]:n[d]=e[d]}}}function ir(n,e){const{textNodeName:t}=e,s=Object.keys(n).length;return!!(s===0||s===1&&(n[t]||typeof n[t]=="boolean"||n[t]===0))}class cr{constructor(e){this.externalEntities={},this.options=Rn(e)}parse(e,t){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const l=Ie(e,t);if(l!==!0)throw Error(`${l.err.msg}:${l.err.line}:${l.err.col}`)}const s=new Wn(this.options);s.addExternalEntities(this.externalEntities);const o=s.parseXml(e);return this.options.preserveOrder||o===void 0?o:sr(o,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}static getMetaDataSymbol(){return fe.getMetaDataSymbol()}}const dr=`
|
|
12
|
+
`;function ur(n,e){let t="";return e.format&&e.indentBy.length>0&&(t=dr),Fe(n,e,"",t)}function Fe(n,e,t,s){let o="",l=!1;for(let a=0;a<n.length;a++){const d=n[a],i=fr(d);if(i===void 0)continue;let c="";if(t.length===0?c=i:c=`${t}.${i}`,i===e.textNodeName){let S=d[i];hr(c,e)||(S=e.tagValueProcessor(i,S),S=Xe(S,e)),l&&(o+=s),o+=S,l=!1;continue}else if(i===e.cdataPropName){l&&(o+=s),o+=`<![CDATA[${d[i][0][e.textNodeName]}]]>`,l=!1;continue}else if(i===e.commentPropName){o+=s+`<!--${d[i][0][e.textNodeName]}-->`,l=!0;continue}else if(i[0]==="?"){const S=ze(d[":@"],e),$=i==="?xml"?"":s;let B=d[i][0][e.textNodeName];B=B.length!==0?" "+B:"",o+=$+`<${i}${B}${S}?>`,l=!0;continue}let g=s;g!==""&&(g+=e.indentBy);const p=ze(d[":@"],e),w=s+`<${i}${p}`,k=Fe(d[i],e,c,g);e.unpairedTags.indexOf(i)!==-1?e.suppressUnpairedNode?o+=w+">":o+=w+"/>":(!k||k.length===0)&&e.suppressEmptyNode?o+=w+"/>":k&&k.endsWith(">")?o+=w+`>${k}${s}</${i}>`:(o+=w+">",k&&s!==""&&(k.includes("/>")||k.includes("</"))?o+=s+e.indentBy+k+s:o+=k,o+=`</${i}>`),l=!0}return o}function fr(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const s=e[t];if(n.hasOwnProperty(s)&&s!==":@")return s}}function ze(n,e){let t="";if(n&&!e.ignoreAttributes)for(let s in n){if(!n.hasOwnProperty(s))continue;let o=e.attributeValueProcessor(s,n[s]);o=Xe(o,e),o===!0&&e.suppressBooleanAttributes?t+=` ${s.substr(e.attributeNamePrefix.length)}`:t+=` ${s.substr(e.attributeNamePrefix.length)}="${o}"`}return t}function hr(n,e){n=n.substr(0,n.length-e.textNodeName.length-1);let t=n.substr(n.lastIndexOf(".")+1);for(let s in e.stopNodes)if(e.stopNodes[s]===n||e.stopNodes[s]==="*."+t)return!0;return!1}function Xe(n,e){if(n&&n.length>0&&e.processEntities)for(let t=0;t<e.entities.length;t++){const s=e.entities[t];n=n.replace(s.regex,s.val)}return n}const pr={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function ue(n){this.options=Object.assign({},pr,n),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Ke(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=yr),this.processTextOrObjNode=mr,this.options.format?(this.indentate=gr,this.tagEndChar=`>
|
|
13
13
|
`,this.newLine=`
|
|
14
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}
|
|
15
|
-
`+s),s}catch(t){throw new Error(`XML 构建失败: ${t instanceof Error?t.message:"Unknown error"}`)}},kr=n=>Array.isArray(n)?
|
|
16
|
-
`:"";let d="";for(const i of n){if(i["?xml"]){const w=i[":@"]||{},L=Object.entries(w).map(([F,M])=>`${F.startsWith("@_")?F.substring(2):F}="${M}"`).join(" ");d+=`<?xml ${L}?>${a}`;continue}if(i["#comment"]){const w=i["#comment"];if(Array.isArray(w)&&w.length>0){const L=w[0]["#text"]||w[0];d+=`${l}<!--${L}-->${a}`}continue}const c=Object.keys(i).find(w=>!w.startsWith(":")&&!w.startsWith("#")&&!w.startsWith("__"));if(!c)continue;const b=i[c],p=i[":@"]||{},k=Object.entries(p).map(([w,L])=>`${w.startsWith("@_")?w.substring(2):w}="${L}"`).join(" "),E=k?" "+k:"";if(!Array.isArray(b)||b.length===0){d+=`${l}<${c}${E}/>${a}`;continue}const O=b.length===1&&b[0]["#text"]!==void 0;if(b.some(w=>w.__cdata)){const w=b.find(L=>L.__cdata);if(w){const L=w.__cdata[0]["#text"]||"";d+=`${l}<${c}${E}><![CDATA[${L}]]></${c}>${a}`}}else if(O){const w=b[0]["#text"];d+=`${l}<${c}${E}>${w}</${c}>${a}`}else d+=`${l}<${c}${E}>${a}`,d+=oe(b,{indent:t,level:s+1,format:o}),d+=`${l}</${c}>${a}`}return d},wr={key:0,class:"xml-format__toolbar"},Ar={class:"xml-format__actions"},Cr=["disabled"],Br=["disabled"],Tr=["disabled"],vr=["disabled"],Sr=["disabled"],Or={class:"xml-format__info"},$r={key:0,class:"xml-format__status xml-format__status--success"},Pr={key:1,class:"xml-format__status xml-format__status--error"},Vr={class:"xml-format__content"},Ir={key:0,class:"xml-format__error"},Rr={key:1,class:"xml-format__viewer"},Lr=ge(r.defineComponent({__name:"index",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},maxDepth:{default:10},showToolbar:{type:Boolean,default:!0},theme:{default:"github-light"},showComments:{type:Boolean,default:!0},showCdata:{type:Boolean,default:!0},preserveWhitespace:{type:Boolean,default:!1}},emits:["update:modelValue","copy-success","copy-error","expand-all","collapse-all","compress","format"],setup(n,{expose:e,emit:t}){r.useCssVars(_=>({dafdfa5a:c.value.colors.border,"54718f56":c.value.colors.background,"5e7c5194":c.value.colors.text,"5e337cb4":c.value.colors.surfaceBackground,"9f56e136":c.value.colors.buttonBorder,e203a832:c.value.colors.buttonBackground,"3a8ddaa6":c.value.colors.buttonText,"0e7f0595":c.value.colors.buttonBackgroundHover,"437859e9":c.value.colors.buttonPrimary,cec96e5a:c.value.colors.buttonPrimaryHover,"4a52863c":c.value.colors.success,"6331c6ec":c.value.colors.successBackground,70405281:c.value.colors.error,dfabd2e2:c.value.colors.errorBackground}));const s=n,o=t,l=r.ref(null),a=r.ref(""),d=r.ref(new Set),i=r.computed(()=>a.value===""),c=r.computed(()=>xn(s.theme)),b=r.computed(()=>!l.value||!Array.isArray(l.value)?[]:l.value.map((_,C)=>({node:_,originalIndex:C})).filter(_=>!_.node["?xml"])),p=r.computed(()=>{if(!l.value||!Array.isArray(l.value))return null;const _=l.value.find(A=>A["?xml"]);if(!_||!_[":@"])return null;const C=_[":@"],V=[];return C["@_version"]&&V.push(`version="${C["@_version"]}"`),C["@_encoding"]&&V.push(`encoding="${C["@_encoding"]}"`),C["@_standalone"]&&V.push(`standalone="${C["@_standalone"]}"`),V.length>0?`<?xml ${V.join(" ")}?>`:null}),k=r.computed(()=>b.value),E=_=>{if(!_||!_.trim()){a.value="",l.value=null;return}try{const C=xr(_);if(!C.valid){a.value=C.error||"Invalid XML",l.value=null;return}l.value=Xe(_),a.value="",r.nextTick(()=>{$()})}catch(C){a.value=C instanceof Error?C.message:"Unknown parse error",l.value=null}},O=_=>{d.value.has(_)?d.value.delete(_):d.value.add(_)},$=()=>{const _=new Set,C=(V,A="")=>{Array.isArray(V)&&V.forEach((T,g)=>{const m=Object.keys(T).find(B=>!B.startsWith(":")&&!B.startsWith("#"));if(!m)return;const u=A?`${A}.${m}[${g}]`:`${m}[${g}]`;_.add(u);const y=T[m];Array.isArray(y)&&C(y,u+"."+m)})};b.value.forEach(({node:V,originalIndex:A})=>{const T=Object.keys(V).find(g=>!g.startsWith(":")&&!g.startsWith("#"));if(T){const g=`${T}[${A}]`;_.add(g);const m=V[T];Array.isArray(m)&&C(m,g+"."+T)}}),d.value=_,o("expand-all")},w=()=>{d.value.clear(),o("collapse-all")},L=async()=>{if(!(!i.value||!l.value))try{const _=Array.isArray(l.value)?oe(l.value,{indent:" "}):Be(l.value,{format:!0,indentBy:" "});await navigator.clipboard.writeText(_),o("copy-success",_)}catch(_){const C=_ instanceof Error?_:new Error("Copy failed");o("copy-error",C),console.error("Failed to copy XML:",_)}},F=()=>{if(!(!i.value||!l.value))try{const _=kr(l.value);o("update:modelValue",_),o("compress",_)}catch(_){console.error("Failed to compress XML:",_)}},M=()=>{if(i.value)try{const _=Nr(s.modelValue,{format:!0,indentBy:" "});o("update:modelValue",_),o("format",_)}catch(_){console.error("Failed to format XML:",_)}},z=async _=>{try{const C=typeof _=="string"?_:JSON.stringify(_,null,2);await navigator.clipboard.writeText(C),o("copy-success",C)}catch(C){const V=C instanceof Error?C:new Error("Copy failed");o("copy-error",V),console.error("Failed to copy value:",C)}},ee=(_,C,V)=>{if(!(!l.value||!Array.isArray(l.value)))try{const A=_.split(/\./).filter(Boolean);let T=l.value;for(let m=0;m<A.length;m++){const u=A[m],y=u.match(/^(.+?)\[(\d+)\]$/);if(y){const B=y[1],x=parseInt(y[2]);if(m===A.length-1){if(Array.isArray(T)&&T[x]){const v=T[x];if(v[C]){const S=v[C];delete v[C],v[V]=S}}}else Array.isArray(T)&&T[x]&&(T=T[x])}else T[u]&&(T=T[u])}const g=oe(l.value,{indent:" "});o("update:modelValue",g)}catch(A){console.error("Failed to update tag name:",A)}},G=(_,C,V)=>{if(!(!l.value||!Array.isArray(l.value)))try{const A=_.split(/\./).filter(Boolean);let T=l.value;for(let m=0;m<A.length;m++){const u=A[m],y=u.match(/^(.+?)\[(\d+)\]$/);if(y){const B=y[1],x=parseInt(y[2]);if(m===A.length-1){if(Array.isArray(T)&&T[x]){const S=T[x][":@"];if(S&&S[`@_${C}`]!==void 0){const I=S[`@_${C}`];delete S[`@_${C}`],S[`@_${V}`]=I}}}else Array.isArray(T)&&T[x]&&(T=T[x])}else T[u]&&(T=T[u])}const g=oe(l.value,{indent:" "});o("update:modelValue",g)}catch(A){console.error("Failed to update attribute name:",A)}},Z=(_,C,V)=>{if(!(!l.value||!Array.isArray(l.value)))try{const A=_.split(/\./).filter(Boolean);let T=l.value;for(let m=0;m<A.length;m++){const u=A[m],y=u.match(/^(.+?)\[(\d+)\]$/);if(y){const B=y[1],x=parseInt(y[2]);if(m===A.length-1){if(Array.isArray(T)&&T[x]){const S=T[x][":@"];S&&S[`@_${C}`]!==void 0&&(S[`@_${C}`]=V)}}else Array.isArray(T)&&T[x]&&(T=T[x])}else T[u]&&(T=T[u])}const g=oe(l.value,{indent:" "});o("update:modelValue",g)}catch(A){console.error("Failed to update attribute value:",A)}},J=(_,C)=>{if(!(!l.value||!Array.isArray(l.value)))try{const V=_.split(/\./).filter(Boolean);let A=l.value,T="";for(let m=0;m<V.length;m++){const u=V[m],y=u.match(/^(.+?)\[(\d+)\]$/);if(y){const B=y[1],x=parseInt(y[2]);if(m===V.length-1){if(Array.isArray(A)&&A[x]){const v=A[x];if(T=Object.keys(v).find(S=>!S.startsWith(":")&&!S.startsWith("#"))||"",T&&Array.isArray(v[T])){const S=v[T],I=S.findIndex(U=>U["#text"]!==void 0);I!==-1?S[I]["#text"]=C:S.push({"#text":C})}}}else Array.isArray(A)&&A[x]&&(A=A[x])}else A[u]&&(A=A[u])}const g=oe(l.value,{indent:" "});o("update:modelValue",g)}catch(V){console.error("Failed to update text content:",V)}},te=(_,C)=>{if(!(!l.value||!Array.isArray(l.value)))try{const V=_.split(/\./).filter(Boolean);let A=l.value;for(let g=0;g<V.length;g++){const m=V[g],u=m.match(/^(.+?)\[(\d+)\]$/);if(u){const y=u[1],B=parseInt(u[2]);if(g===V.length-1){if(Array.isArray(A)&&A[B]){const x=A[B],v=Object.keys(x).find(S=>!S.startsWith(":")&&!S.startsWith("#"));if(v&&Array.isArray(x[v])){const S=x[v],I=S.findIndex(U=>U.__cdata!==void 0);if(I!==-1){const U=S[I];Array.isArray(U.__cdata)&&U.__cdata[0]&&(U.__cdata[0]["#text"]=C)}else S.push({__cdata:[{"#text":C}]})}}}else Array.isArray(A)&&A[B]&&(A=A[B])}else A[m]&&(A=A[m])}const T=oe(l.value,{indent:" "});o("update:modelValue",T)}catch(V){console.error("Failed to update CDATA content:",V)}};return r.watch(()=>s.modelValue,_=>{E(_)},{immediate:!0}),e({copyXml:L,compressSource:F,formatSource:M,expandAll:$,collapseAll:w,toggleExpand:O,isValidXml:()=>i.value,getParsedXml:()=>l.value,getExpandedNodes:()=>d.value,getParseError:()=>a.value,parseXmlString:_=>E(_),copyValue:_=>z(_)}),(_,C)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["xml-format",`xml-format--${c.value.name}`])},[_.showToolbar?(r.openBlock(),r.createElementBlock("div",wr,[r.createElementVNode("div",Ar,[r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--primary",onClick:L,disabled:!i.value,title:"Copy XML"}," 📋 Copy ",8,Cr),r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:$,disabled:!i.value,title:"Expand All"}," ⬇️ Expand All ",8,Br),r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:w,disabled:!i.value,title:"Collapse All"}," ➡️ Collapse All ",8,Tr),r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:F,disabled:!i.value,title:"Compress XML"}," 📦 Compress ",8,vr),r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:M,disabled:!i.value,title:"Format XML"}," ✨ Format ",8,Sr)]),r.createElementVNode("div",Or,[i.value?(r.openBlock(),r.createElementBlock("span",$r," ✅ Valid XML ")):(r.openBlock(),r.createElementBlock("span",Pr," ❌ Invalid XML "))])])):r.createCommentVNode("",!0),r.createElementVNode("div",Vr,[i.value?(r.openBlock(),r.createElementBlock("div",Rr,[p.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"xml-declaration",style:r.normalizeStyle({color:c.value.colors.xmlDeclaration})},r.toDisplayString(p.value),5)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(k.value,(V,A)=>(r.openBlock(),r.createBlock(_n,{key:A,node:V.node,index:V.originalIndex,level:0,expanded:d.value,theme:c.value,onToggleExpand:O,onCopy:z,"onUpdate:tagName":ee,"onUpdate:attributeName":G,"onUpdate:attributeValue":Z,"onUpdate:textContent":J,"onUpdate:cdataContent":te},null,8,["node","index","expanded","theme"]))),128))])):(r.openBlock(),r.createElementBlock("div",Ir,[C[0]||(C[0]=r.createElementVNode("h4",null,"XML Parse Error:",-1)),r.createElementVNode("pre",null,r.toDisplayString(a.value),1)]))])],2))}}),[["__scopeId","data-v-078198c5"]]),Mr=[Se],Kr={install:n=>{Mr.forEach(e=>{const t=e.name||e.__name||"UnknownComponent";n.component(t,e)})}};ne.JsonFormat=Se,ne.XmlFormat=Lr,ne.default=Kr,Object.defineProperties(ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
14
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}ue.prototype.build=function(n){return this.options.preserveOrder?ur(n,this.options):(Array.isArray(n)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(n={[this.options.arrayNodeName]:n}),this.j2x(n,0,[]).val)},ue.prototype.j2x=function(n,e,t){let s="",o="";const l=t.join(".");for(let a in n)if(Object.prototype.hasOwnProperty.call(n,a))if(typeof n[a]>"u")this.isAttribute(a)&&(o+="");else if(n[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?o+="":a[0]==="?"?o+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(n[a]instanceof Date)o+=this.buildTextValNode(n[a],a,"",e);else if(typeof n[a]!="object"){const d=this.isAttribute(a);if(d&&!this.ignoreAttributesFn(d,l))s+=this.buildAttrPairStr(d,""+n[a]);else if(!d)if(a===this.options.textNodeName){let i=this.options.tagValueProcessor(a,""+n[a]);o+=this.replaceEntitiesValue(i)}else o+=this.buildTextValNode(n[a],a,"",e)}else if(Array.isArray(n[a])){const d=n[a].length;let i="",c="";for(let g=0;g<d;g++){const p=n[a][g];if(!(typeof p>"u"))if(p===null)a[0]==="?"?o+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){const w=this.j2x(p,e+1,t.concat(a));i+=w.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(c+=w.attrStr)}else i+=this.processTextOrObjNode(p,a,e,t);else if(this.options.oneListGroup){let w=this.options.tagValueProcessor(a,p);w=this.replaceEntitiesValue(w),i+=w}else i+=this.buildTextValNode(p,a,"",e)}this.options.oneListGroup&&(i=this.buildObjectNode(i,a,c,e)),o+=i}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const d=Object.keys(n[a]),i=d.length;for(let c=0;c<i;c++)s+=this.buildAttrPairStr(d[c],""+n[a][d[c]])}else o+=this.processTextOrObjNode(n[a],a,e,t);return{attrStr:s,val:o}},ue.prototype.buildAttrPairStr=function(n,e){return e=this.options.attributeValueProcessor(n,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+n:" "+n+'="'+e+'"'};function mr(n,e,t,s){const o=this.j2x(n,t+1,s.concat(e));return n[this.options.textNodeName]!==void 0&&Object.keys(n).length===1?this.buildTextValNode(n[this.options.textNodeName],e,o.attrStr,t):this.buildObjectNode(o.val,e,o.attrStr,t)}ue.prototype.buildObjectNode=function(n,e,t,s){if(n==="")return e[0]==="?"?this.indentate(s)+"<"+e+t+"?"+this.tagEndChar:this.indentate(s)+"<"+e+t+this.closeTag(e)+this.tagEndChar;{let o="</"+e+this.tagEndChar,l="";return e[0]==="?"&&(l="?",o=""),(t||t==="")&&n.indexOf("<")===-1?this.indentate(s)+"<"+e+t+l+">"+n+o:this.options.commentPropName!==!1&&e===this.options.commentPropName&&l.length===0?this.indentate(s)+`<!--${n}-->`+this.newLine:this.indentate(s)+"<"+e+t+l+this.tagEndChar+n+this.indentate(s)+o}},ue.prototype.closeTag=function(n){let e="";return this.options.unpairedTags.indexOf(n)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${n}`,e},ue.prototype.buildTextValNode=function(n,e,t,s){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${n}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(s)+`<!--${n}-->`+this.newLine;if(e[0]==="?")return this.indentate(s)+"<"+e+t+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(e,n);return o=this.replaceEntitiesValue(o),o===""?this.indentate(s)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(s)+"<"+e+t+">"+o+"</"+e+this.tagEndChar}},ue.prototype.replaceEntitiesValue=function(n){if(n&&n.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const t=this.options.entities[e];n=n.replace(t.regex,t.val)}return n};function gr(n){return this.options.indentBy.repeat(n)}function yr(n){return n.startsWith(this.options.attributeNamePrefix)&&n!==this.options.textNodeName?n.substr(this.attrPrefixLen):!1}const br={validate:Ie},Er={ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",ignoreDeclaration:!1,commentPropName:"#comment",cdataPropName:"__cdata",preserveOrder:!0,parseAttributeValue:!1,trimValues:!0,parseTagValue:!1,processEntities:!0,htmlEntities:!1,ignoreNameSpace:!1,allowBooleanAttributes:!0,unpairedTags:[],stopNodes:[],alwaysCreateTextNode:!1},_r={ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",format:!0,indentBy:" ",suppressEmptyNode:!1,suppressBooleanAttributes:!1,suppressUnpairedNode:!1},xr=n=>{try{const e=br.validate(n,{allowBooleanAttributes:!0});return e===!0?{valid:!0}:{valid:!1,error:`Line ${e.err.line}: ${e.err.msg}`}}catch(e){return{valid:!1,error:e instanceof Error?e.message:"Unknown validation error"}}},He=(n,e)=>{try{return new cr({...Er,...e}).parse(n)}catch(t){throw new Error(`XML 解析失败: ${t instanceof Error?t.message:"Unknown error"}`)}},Te=(n,e)=>{try{let s=new ue({..._r,format:e?.format??!0,indentBy:e?.indentBy??" "}).build(n);return e?.showDeclaration!==!1&&!s.startsWith("<?xml")&&(s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
15
|
+
`+s),s}catch(t){throw new Error(`XML 构建失败: ${t instanceof Error?t.message:"Unknown error"}`)}},kr=n=>Array.isArray(n)?ie(n,{format:!1}):Te(n,{format:!1,showDeclaration:!1}),Nr=(n,e)=>{const t=He(n);return Array.isArray(t)?ie(t,{indent:e?.indentBy}):Te(t,e)},ie=(n,e={})=>{const t=e.indent!==void 0?e.indent:" ",s=e.level||0,o=e.format!==!1,l=o?t.repeat(s):"",a=o?`
|
|
16
|
+
`:"";let d="";for(const i of n){if(i["?xml"]){const B=i[":@"]||{},M=Object.entries(B).map(([X,j])=>`${X.startsWith("@_")?X.substring(2):X}="${j}"`).join(" ");d+=`<?xml ${M}?>${a}`;continue}if(i["#comment"]){const B=i["#comment"];if(Array.isArray(B)&&B.length>0){const M=B[0]["#text"]||B[0];d+=`${l}<!--${M}-->${a}`}continue}const c=Object.keys(i).find(B=>!B.startsWith(":")&&!B.startsWith("#")&&!B.startsWith("__"));if(!c)continue;const g=i[c],p=i[":@"]||{},w=Object.entries(p).map(([B,M])=>`${B.startsWith("@_")?B.substring(2):B}="${M}"`).join(" "),k=w?" "+w:"";if(!Array.isArray(g)||g.length===0){d+=`${l}<${c}${k}/>${a}`;continue}const S=g.length===1&&g[0]["#text"]!==void 0;if(g.some(B=>B.__cdata)){const B=g.find(M=>M.__cdata);if(B){const M=B.__cdata[0]["#text"]||"";d+=`${l}<${c}${k}><![CDATA[${M}]]></${c}>${a}`}}else if(S){const B=g[0]["#text"];d+=`${l}<${c}${k}>${B}</${c}>${a}`}else d+=`${l}<${c}${k}>${a}`,d+=ie(g,{indent:t,level:s+1,format:o}),d+=`${l}</${c}>${a}`}return d},wr={key:0,class:"xml-format__toolbar"},Ar={class:"xml-format__actions"},Cr=["disabled"],Br=["disabled"],Tr=["disabled"],vr=["disabled"],Or=["disabled"],Sr={class:"xml-format__info"},$r={key:0,class:"xml-format__status xml-format__status--success"},Pr={key:1,class:"xml-format__status xml-format__status--error"},Vr={class:"xml-format__content"},Ir={key:0,class:"xml-format__error"},Rr={key:1,class:"xml-format__viewer"},Lr=Ee(r.defineComponent({__name:"index",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},maxDepth:{default:10},showToolbar:{type:Boolean,default:!0},theme:{default:"github-light"},showComments:{type:Boolean,default:!0},showCdata:{type:Boolean,default:!0},preserveWhitespace:{type:Boolean,default:!1}},emits:["update:modelValue","copy-success","copy-error","expand-all","collapse-all","compress","format"],setup(n,{expose:e,emit:t}){r.useCssVars(N=>({dafdfa5a:c.value.colors.border,"54718f56":c.value.colors.background,"5e7c5194":c.value.colors.text,"5e337cb4":c.value.colors.surfaceBackground,"9f56e136":c.value.colors.buttonBorder,e203a832:c.value.colors.buttonBackground,"3a8ddaa6":c.value.colors.buttonText,"0e7f0595":c.value.colors.buttonBackgroundHover,"437859e9":c.value.colors.buttonPrimary,cec96e5a:c.value.colors.buttonPrimaryHover,"4a52863c":c.value.colors.success,"6331c6ec":c.value.colors.successBackground,70405281:c.value.colors.error,dfabd2e2:c.value.colors.errorBackground}));const s=n,o=t,l=r.ref(null),a=r.ref(""),d=r.ref(new Set),i=r.computed(()=>a.value===""),c=r.computed(()=>xn(s.theme)),g=r.computed(()=>!l.value||!Array.isArray(l.value)?[]:l.value.map((N,v)=>({node:N,originalIndex:v})).filter(N=>!N.node["?xml"])),p=r.computed(()=>{if(!l.value||!Array.isArray(l.value))return null;const N=l.value.find(C=>C["?xml"]);if(!N||!N[":@"])return null;const v=N[":@"],R=[];return v["@_version"]&&R.push(`version="${v["@_version"]}"`),v["@_encoding"]&&R.push(`encoding="${v["@_encoding"]}"`),v["@_standalone"]&&R.push(`standalone="${v["@_standalone"]}"`),R.length>0?`<?xml ${R.join(" ")}?>`:null}),w=r.computed(()=>g.value),k=N=>{if(!N||!N.trim()){a.value="",l.value=null;return}try{const v=xr(N);if(!v.valid){a.value=v.error||"Invalid XML",l.value=null;return}l.value=He(N),a.value="",r.nextTick(()=>{$()})}catch(v){a.value=v instanceof Error?v.message:"Unknown parse error",l.value=null}},S=N=>{d.value.has(N)?d.value.delete(N):d.value.add(N)},$=()=>{const N=new Set,v=(R,C="")=>{Array.isArray(R)&&R.forEach((O,U)=>{const V=Object.keys(O).find(m=>!m.startsWith(":")&&!m.startsWith("#"));if(!V)return;const y=C?`${C}.${V}[${U}]`:`${V}[${U}]`;N.add(y);const u=O[V];Array.isArray(u)&&v(u,y+"."+V)})};g.value.forEach(({node:R,originalIndex:C})=>{const O=Object.keys(R).find(U=>!U.startsWith(":")&&!U.startsWith("#"));if(O){const U=`${O}[${C}]`;N.add(U);const V=R[O];Array.isArray(V)&&v(V,U+"."+O)}}),d.value=N,o("expand-all")},B=()=>{d.value.clear(),o("collapse-all")},M=async()=>{if(!(!i.value||!l.value))try{const N=Array.isArray(l.value)?ie(l.value,{indent:" "}):Te(l.value,{format:!0,indentBy:" "});await navigator.clipboard.writeText(N),o("copy-success",N)}catch(N){const v=N instanceof Error?N:new Error("Copy failed");o("copy-error",v),console.error("Failed to copy XML:",N)}},X=()=>{if(!(!i.value||!l.value))try{const N=kr(l.value);o("update:modelValue",N),o("compress",N)}catch(N){console.error("Failed to compress XML:",N)}},j=()=>{if(i.value)try{const N=Nr(s.modelValue,{format:!0,indentBy:" "});o("update:modelValue",N),o("format",N)}catch(N){console.error("Failed to format XML:",N)}},q=async N=>{try{const v=typeof N=="string"?N:JSON.stringify(N,null,2);await navigator.clipboard.writeText(v),o("copy-success",v)}catch(v){const R=v instanceof Error?v:new Error("Copy failed");o("copy-error",R),console.error("Failed to copy value:",v)}},re=(N,v,R)=>{if(!(!l.value||!Array.isArray(l.value)))try{const C=N.split(/\./).filter(Boolean);let O=l.value;for(let V=0;V<C.length;V++){const y=C[V],u=y.match(/^(.+?)\[(\d+)\]$/);if(u){const m=u[1],E=parseInt(u[2]);if(V===C.length-1){if(Array.isArray(O)&&O[E]){const _=O[E];if(_[v]){const x=_[v];delete _[v],_[R]=x}}}else Array.isArray(O)&&O[E]&&(O=O[E])}else O[y]&&(O=O[y])}const U=ie(l.value,{indent:" "});o("update:modelValue",U)}catch(C){console.error("Failed to update tag name:",C)}},J=(N,v,R)=>{if(!(!l.value||!Array.isArray(l.value)))try{const C=N.split(/\./).filter(Boolean);let O=l.value;for(let V=0;V<C.length;V++){const y=C[V],u=y.match(/^(.+?)\[(\d+)\]$/);if(u){const m=u[1],E=parseInt(u[2]);if(V===C.length-1){if(Array.isArray(O)&&O[E]){const x=O[E][":@"];if(x&&x[`@_${v}`]!==void 0){const b=x[`@_${v}`];delete x[`@_${v}`],x[`@_${R}`]=b}}}else Array.isArray(O)&&O[E]&&(O=O[E])}else O[y]&&(O=O[y])}const U=ie(l.value,{indent:" "});o("update:modelValue",U)}catch(C){console.error("Failed to update attribute name:",C)}},D=(N,v,R)=>{if(!(!l.value||!Array.isArray(l.value)))try{const C=N.split(/\./).filter(Boolean);let O=l.value;for(let V=0;V<C.length;V++){const y=C[V],u=y.match(/^(.+?)\[(\d+)\]$/);if(u){const m=u[1],E=parseInt(u[2]);if(V===C.length-1){if(Array.isArray(O)&&O[E]){const x=O[E][":@"];x&&x[`@_${v}`]!==void 0&&(x[`@_${v}`]=R)}}else Array.isArray(O)&&O[E]&&(O=O[E])}else O[y]&&(O=O[y])}const U=ie(l.value,{indent:" "});o("update:modelValue",U)}catch(C){console.error("Failed to update attribute value:",C)}},ne=(N,v)=>{if(!(!l.value||!Array.isArray(l.value)))try{const R=N.split(/\./).filter(Boolean);let C=l.value,O="";for(let V=0;V<R.length;V++){const y=R[V],u=y.match(/^(.+?)\[(\d+)\]$/);if(u){const m=u[1],E=parseInt(u[2]);if(V===R.length-1){if(Array.isArray(C)&&C[E]){const _=C[E];if(O=Object.keys(_).find(x=>!x.startsWith(":")&&!x.startsWith("#"))||"",O&&Array.isArray(_[O])){const x=_[O],b=x.findIndex(T=>T["#text"]!==void 0);b!==-1?x[b]["#text"]=v:x.push({"#text":v})}}}else Array.isArray(C)&&C[E]&&(C=C[E])}else C[y]&&(C=C[y])}const U=ie(l.value,{indent:" "});o("update:modelValue",U)}catch(R){console.error("Failed to update text content:",R)}},oe=(N,v)=>{if(!(!l.value||!Array.isArray(l.value)))try{const R=N.split(/\./).filter(Boolean);let C=l.value;for(let U=0;U<R.length;U++){const V=R[U],y=V.match(/^(.+?)\[(\d+)\]$/);if(y){const u=y[1],m=parseInt(y[2]);if(U===R.length-1){if(Array.isArray(C)&&C[m]){const E=C[m],_=Object.keys(E).find(x=>!x.startsWith(":")&&!x.startsWith("#"));if(_&&Array.isArray(E[_])){const x=E[_],b=x.findIndex(T=>T.__cdata!==void 0);if(b!==-1){const T=x[b];Array.isArray(T.__cdata)&&T.__cdata[0]&&(T.__cdata[0]["#text"]=v)}else x.push({__cdata:[{"#text":v}]})}}}else Array.isArray(C)&&C[m]&&(C=C[m])}else C[V]&&(C=C[V])}const O=ie(l.value,{indent:" "});o("update:modelValue",O)}catch(R){console.error("Failed to update CDATA content:",R)}};return r.watch(()=>s.modelValue,N=>{k(N)},{immediate:!0}),e({copyXml:M,compressSource:X,formatSource:j,expandAll:$,collapseAll:B,toggleExpand:S,isValidXml:()=>i.value,getParsedXml:()=>l.value,getExpandedNodes:()=>d.value,getParseError:()=>a.value,parseXmlString:N=>k(N),copyValue:N=>q(N)}),(N,v)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["xml-format",`xml-format--${c.value.name}`])},[N.showToolbar?(r.openBlock(),r.createElementBlock("div",wr,[r.createElementVNode("div",Ar,[r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--primary",onClick:M,disabled:!i.value,title:"Copy XML"}," 📋 Copy ",8,Cr),r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:$,disabled:!i.value,title:"Expand All"}," ⬇️ Expand All ",8,Br),r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:B,disabled:!i.value,title:"Collapse All"}," ➡️ Collapse All ",8,Tr),r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:X,disabled:!i.value,title:"Compress XML"}," 📦 Compress ",8,vr),r.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:j,disabled:!i.value,title:"Format XML"}," ✨ Format ",8,Or)]),r.createElementVNode("div",Sr,[i.value?(r.openBlock(),r.createElementBlock("span",$r," ✅ Valid XML ")):(r.openBlock(),r.createElementBlock("span",Pr," ❌ Invalid XML "))])])):r.createCommentVNode("",!0),r.createElementVNode("div",Vr,[i.value?(r.openBlock(),r.createElementBlock("div",Rr,[p.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"xml-declaration",style:r.normalizeStyle({color:c.value.colors.xmlDeclaration})},r.toDisplayString(p.value),5)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(w.value,(R,C)=>(r.openBlock(),r.createBlock(_n,{key:C,node:R.node,index:R.originalIndex,level:0,expanded:d.value,theme:c.value,onToggleExpand:S,onCopy:q,"onUpdate:tagName":re,"onUpdate:attributeName":J,"onUpdate:attributeValue":D,"onUpdate:textContent":ne,"onUpdate:cdataContent":oe},null,8,["node","index","expanded","theme"]))),128))])):(r.openBlock(),r.createElementBlock("div",Ir,[v[0]||(v[0]=r.createElementVNode("h4",null,"XML Parse Error:",-1)),r.createElementVNode("pre",null,r.toDisplayString(a.value),1)]))])],2))}}),[["__scopeId","data-v-078198c5"]]),Mr=[Se],jr={install:n=>{Mr.forEach(e=>{const t=e.name||e.__name||"UnknownComponent";n.component(t,e)})}};le.JsonFormat=Se,le.XmlFormat=Lr,le.default=jr,Object.defineProperties(le,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|