lone-format 0.4.0 → 0.5.0
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 +118 -137
- package/dist/lone-format.umd.cjs +7 -7
- package/package.json +1 -1
package/dist/lone-format.umd.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
(function(Y,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(Y=typeof globalThis<"u"?globalThis:Y||self,s(Y.LoneFormat={},Y.Vue))})(this,function(Y,s){"use strict";class Ie{add(e,t,o){if(typeof arguments[0]!="string")for(let n in arguments[0])this.add(n,arguments[0][n],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(n){this[n]=this[n]||[],t&&this[n][o?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(o){o.call(t&&t.context?t.context:t,t)})}}class ve{constructor(e){this.jsep=e,this.registered={}}register(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];t.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}}class u{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+u.version}static addUnaryOp(e){return u.max_unop_len=Math.max(e.length,u.max_unop_len),u.unary_ops[e]=1,u}static addBinaryOp(e,t,o){return u.max_binop_len=Math.max(e.length,u.max_binop_len),u.binary_ops[e]=t,o?u.right_associative.add(e):u.right_associative.delete(e),u}static addIdentifierChar(e){return u.additional_identifier_chars.add(e),u}static addLiteral(e,t){return u.literals[e]=t,u}static removeUnaryOp(e){return delete u.unary_ops[e],e.length===u.max_unop_len&&(u.max_unop_len=u.getMaxKeyLen(u.unary_ops)),u}static removeAllUnaryOps(){return u.unary_ops={},u.max_unop_len=0,u}static removeIdentifierChar(e){return u.additional_identifier_chars.delete(e),u}static removeBinaryOp(e){return delete u.binary_ops[e],e.length===u.max_binop_len&&(u.max_binop_len=u.getMaxKeyLen(u.binary_ops)),u.right_associative.delete(e),u}static removeAllBinaryOps(){return u.binary_ops={},u.max_binop_len=0,u}static removeLiteral(e){return delete u.literals[e],u}static removeAllLiterals(){return u.literals={},u}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 u(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 u.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!u.binary_ops[String.fromCharCode(e)]||u.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return u.isIdentifierStart(e)||u.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(u.hooks[e]){const o={context:this,node:t};return u.hooks.run(e,o),o.node}return t}searchHook(e){if(u.hooks[e]){const t={context:this};return u.hooks[e].find(function(o){return o.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===u.SPACE_CODE||e===u.TAB_CODE||e===u.LF_CODE||e===u.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:u.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],o,n;for(;this.index<this.expr.length;)if(o=this.code,o===u.SEMCOL_CODE||o===u.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(o===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,u.max_binop_len),t=e.length;for(;t>0;){if(u.binary_ops.hasOwnProperty(e)&&(!u.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!u.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,o,n,i,l,d,a,c;if(l=this.gobbleToken(),!l||(t=this.gobbleBinaryOp(),!t))return l;for(i={value:t,prec:u.binaryPrecedence(t),right_a:u.right_associative.has(t)},d=this.gobbleToken(),d||this.throwError("Expected expression after "+t),n=[l,i,d];t=this.gobbleBinaryOp();){if(o=u.binaryPrecedence(t),o===0){this.index-=t.length;break}i={value:t,prec:o,right_a:u.right_associative.has(t)},c=t;const p=h=>i.right_a&&h.right_a?o>h.prec:o<=h.prec;for(;n.length>2&&p(n[n.length-2]);)d=n.pop(),t=n.pop().value,l=n.pop(),e={type:u.BINARY_EXP,operator:t,left:l,right:d},n.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+c),n.push(i,e)}for(a=n.length-1,e=n[a];a>1;)e={type:u.BINARY_EXP,operator:n[a-1].value,left:n[a-2],right:e},a-=2;return e}gobbleToken(){let e,t,o,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"),n)return this.runHook("after-token",n);if(e=this.code,u.isDecimalDigit(e)||e===u.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===u.SQUOTE_CODE||e===u.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===u.OBRACK_CODE)n=this.gobbleArray();else{for(t=this.expr.substr(this.index,u.max_unop_len),o=t.length;o>0;){if(u.unary_ops.hasOwnProperty(t)&&(!u.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!u.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=o;const i=this.gobbleToken();return i||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:u.UNARY_EXP,operator:t,argument:i,prefix:!0})}t=t.substr(0,--o)}u.isIdentifierStart(e)?(n=this.gobbleIdentifier(),u.literals.hasOwnProperty(n.name)?n={type:u.LITERAL,value:u.literals[n.name],raw:n.name}:n.name===u.this_str&&(n={type:u.THIS_EXP})):e===u.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===u.PERIOD_CODE||t===u.OBRACK_CODE||t===u.OPAREN_CODE||t===u.QUMARK_CODE;){let o;if(t===u.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==u.PERIOD_CODE)break;o=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===u.OBRACK_CODE?(e={type:u.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},e.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==u.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===u.OPAREN_CODE?e={type:u.CALL_EXP,arguments:this.gobbleArguments(u.CPAREN_CODE),callee:e}:(t===u.PERIOD_CODE||o)&&(o&&this.index--,this.gobbleSpaces(),e={type:u.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),o&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,o;for(;u.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===u.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);u.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++));u.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);u.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return o=this.code,u.isIdentifierStart(o)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(o===u.PERIOD_CODE||e.length===1&&e.charCodeAt(0)===u.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:u.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="";const t=this.index,o=this.expr.charAt(this.index++);let n=!1;for(;this.index<this.expr.length;){let i=this.expr.charAt(this.index++);if(i===o){n=!0;break}else if(i==="\\")switch(i=this.expr.charAt(this.index++),i){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+=i}else e+=i}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:u.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(u.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,u.isIdentifierPart(e));)this.index++;return{type:u.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let o=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let i=this.code;if(i===e){o=!0,this.index++,e===u.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(i===u.COMMA_CODE){if(this.index++,n++,n!==t.length){if(e===u.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===u.CBRACK_CODE)for(let l=t.length;l<n;l++)t.push(null)}}else if(t.length!==n&&n!==0)this.throwError("Expected comma");else{const l=this.gobbleExpression();(!l||l.type===u.COMPOUND)&&this.throwError("Expected comma"),t.push(l)}}return o||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(u.CPAREN_CODE);if(this.code===u.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:u.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:u.ARRAY_EXP,elements:this.gobbleArguments(u.CBRACK_CODE)}}}const Le=new Ie;Object.assign(u,{hooks:Le,plugins:new ve(u),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"}),u.max_unop_len=u.getMaxKeyLen(u.unary_ops),u.max_binop_len=u.getMaxKeyLen(u.binary_ops);const Q=r=>new u(r).parse(),je=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(u).filter(r=>!je.includes(r)&&Q[r]===void 0).forEach(r=>{Q[r]=u[r]}),Q.Jsep=u;const Re="ConditionalExpression";var Me={name:"ternary",init(r){r.hooks.add("after-expression",function(t){if(t.node&&this.code===r.QUMARK_CODE){this.index++;const o=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===r.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),t.node={type:Re,test:o,consequent:n,alternate:i},o.operator&&r.binary_ops[o.operator]<=.9){let l=o;for(;l.right.operator&&r.binary_ops[l.right.operator]<=.9;)l=l.right;t.node.test=l.right,l.right=t.node,t.node=o}}else this.throwError("Expected :")}})}};Q.plugins.register(Me);const ge=47,Ue=92;var Fe={name:"regex",init(r){r.hooks.add("gobble-token",function(t){if(this.code===ge){const o=++this.index;let n=!1;for(;this.index<this.expr.length;){if(this.code===ge&&!n){const i=this.expr.slice(o,this.index);let l="";for(;++this.index<this.expr.length;){const a=this.code;if(a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57)l+=this.char;else break}let d;try{d=new RegExp(i,l)}catch(a){this.throwError(a.message)}return t.node={type:r.LITERAL,value:d,raw:this.expr.slice(o-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===r.OBRACK_CODE?n=!0:n&&this.code===r.CBRACK_CODE&&(n=!1),this.index+=this.code===Ue?2:1}this.throwError("Unclosed Regex")}})}};const de=43,te={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[de,45],assignmentPrecedence:.9,init(r){const e=[r.IDENTIFIER,r.MEMBER_EXP];te.assignmentOperators.forEach(o=>r.addBinaryOp(o,te.assignmentPrecedence,!0)),r.hooks.add("gobble-token",function(n){const i=this.code;te.updateOperators.some(l=>l===i&&l===this.expr.charCodeAt(this.index+1))&&(this.index+=2,n.node={type:"UpdateExpression",operator:i===de?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!n.node.argument||!e.includes(n.node.argument.type))&&this.throwError(`Unexpected ${n.node.operator}`))}),r.hooks.add("after-token",function(n){if(n.node){const i=this.code;te.updateOperators.some(l=>l===i&&l===this.expr.charCodeAt(this.index+1))&&(e.includes(n.node.type)||this.throwError(`Unexpected ${n.node.operator}`),this.index+=2,n.node={type:"UpdateExpression",operator:i===de?"++":"--",argument:n.node,prefix:!1})}}),r.hooks.add("after-expression",function(n){n.node&&t(n.node)});function t(o){te.assignmentOperators.has(o.operator)?(o.type="AssignmentExpression",t(o.left),t(o.right)):o.operator||Object.values(o).forEach(n=>{n&&typeof n=="object"&&t(n)})}}};Q.plugins.register(Fe,te),Q.addUnaryOp("typeof"),Q.addLiteral("null",null),Q.addLiteral("undefined",void 0);const Xe=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),I={evalAst(r,e){switch(r.type){case"BinaryExpression":case"LogicalExpression":return I.evalBinaryExpression(r,e);case"Compound":return I.evalCompound(r,e);case"ConditionalExpression":return I.evalConditionalExpression(r,e);case"Identifier":return I.evalIdentifier(r,e);case"Literal":return I.evalLiteral(r,e);case"MemberExpression":return I.evalMemberExpression(r,e);case"UnaryExpression":return I.evalUnaryExpression(r,e);case"ArrayExpression":return I.evalArrayExpression(r,e);case"CallExpression":return I.evalCallExpression(r,e);case"AssignmentExpression":return I.evalAssignmentExpression(r,e);default:throw SyntaxError("Unexpected expression",r)}},evalBinaryExpression(r,e){return{"||":(o,n)=>o||n(),"&&":(o,n)=>o&&n(),"|":(o,n)=>o|n(),"^":(o,n)=>o^n(),"&":(o,n)=>o&n(),"==":(o,n)=>o==n(),"!=":(o,n)=>o!=n(),"===":(o,n)=>o===n(),"!==":(o,n)=>o!==n(),"<":(o,n)=>o<n(),">":(o,n)=>o>n(),"<=":(o,n)=>o<=n(),">=":(o,n)=>o>=n(),"<<":(o,n)=>o<<n(),">>":(o,n)=>o>>n(),">>>":(o,n)=>o>>>n(),"+":(o,n)=>o+n(),"-":(o,n)=>o-n(),"*":(o,n)=>o*n(),"/":(o,n)=>o/n(),"%":(o,n)=>o%n()}[r.operator](I.evalAst(r.left,e),()=>I.evalAst(r.right,e))},evalCompound(r,e){let t;for(let o=0;o<r.body.length;o++){r.body[o].type==="Identifier"&&["var","let","const"].includes(r.body[o].name)&&r.body[o+1]&&r.body[o+1].type==="AssignmentExpression"&&(o+=1);const n=r.body[o];t=I.evalAst(n,e)}return t},evalConditionalExpression(r,e){return I.evalAst(r.test,e)?I.evalAst(r.consequent,e):I.evalAst(r.alternate,e)},evalIdentifier(r,e){if(Object.hasOwn(e,r.name))return e[r.name];throw ReferenceError(`${r.name} is not defined`)},evalLiteral(r){return r.value},evalMemberExpression(r,e){const t=String(r.computed?I.evalAst(r.property):r.property.name),o=I.evalAst(r.object,e);if(o==null)throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);if(!Object.hasOwn(o,t)&&Xe.has(t))throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);const n=o[t];return typeof n=="function"?n.bind(o):n},evalUnaryExpression(r,e){return{"-":o=>-I.evalAst(o,e),"!":o=>!I.evalAst(o,e),"~":o=>~I.evalAst(o,e),"+":o=>+I.evalAst(o,e),typeof:o=>typeof I.evalAst(o,e)}[r.operator](r.argument)},evalArrayExpression(r,e){return r.elements.map(t=>I.evalAst(t,e))},evalCallExpression(r,e){const t=r.arguments.map(n=>I.evalAst(n,e));return I.evalAst(r.callee,e)(...t)},evalAssignmentExpression(r,e){if(r.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const t=r.left.name,o=I.evalAst(r.right,e);return e[t]=o,e[t]}};class ze{constructor(e){this.code=e,this.ast=Q(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return I.evalAst(this.ast,t)}}function G(r,e){return r=r.slice(),r.push(e),r}function ue(r,e){return e=e.slice(),e.unshift(r),e}class He 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 P(r,e,t,o,n){if(!(this instanceof P))try{return new P(r,e,t,o,n)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof r=="string"&&(n=o,o=t,t=e,e=r,r=null);const i=r&&typeof r=="object";if(r=r||{},this.json=r.json||t,this.path=r.path||e,this.resultType=r.resultType||"value",this.flatten=r.flatten||!1,this.wrap=Object.hasOwn(r,"wrap")?r.wrap:!0,this.sandbox=r.sandbox||{},this.eval=r.eval===void 0?"safe":r.eval,this.ignoreEvalErrors=typeof r.ignoreEvalErrors>"u"?!1:r.ignoreEvalErrors,this.parent=r.parent||null,this.parentProperty=r.parentProperty||null,this.callback=r.callback||o||null,this.otherTypeCallback=r.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},r.autostart!==!1){const l={path:i?r.path:e};i?"json"in r&&(l.json=r.json):l.json=t;const d=this.evaluate(l);if(!d||typeof d!="object")throw new He(d);return d}}P.prototype.evaluate=function(r,e,t,o){let n=this.parent,i=this.parentProperty,{flatten:l,wrap:d}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,t=t||this.callback,this.currOtherTypeCallback=o||this.otherTypeCallback,e=e||this.json,r=r||this.path,r&&typeof r=="object"&&!Array.isArray(r)){if(!r.path&&r.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(r,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=r),l=Object.hasOwn(r,"flatten")?r.flatten:l,this.currResultType=Object.hasOwn(r,"resultType")?r.resultType:this.currResultType,this.currSandbox=Object.hasOwn(r,"sandbox")?r.sandbox:this.currSandbox,d=Object.hasOwn(r,"wrap")?r.wrap:d,this.currEval=Object.hasOwn(r,"eval")?r.eval:this.currEval,t=Object.hasOwn(r,"callback")?r.callback:t,this.currOtherTypeCallback=Object.hasOwn(r,"otherTypeCallback")?r.otherTypeCallback:this.currOtherTypeCallback,n=Object.hasOwn(r,"parent")?r.parent:n,i=Object.hasOwn(r,"parentProperty")?r.parentProperty:i,r=r.path}if(n=n||null,i=i||null,Array.isArray(r)&&(r=P.toPathString(r)),!r&&r!==""||!e)return;const a=P.toPathArray(r);a[0]==="$"&&a.length>1&&a.shift(),this._hasParentSelector=null;const c=this._trace(a,e,["$"],n,i,t).filter(function(p){return p&&!p.isParentSelector});return c.length?!d&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce((p,h)=>{const E=this._getPreferredOutput(h);return l&&Array.isArray(E)?p=p.concat(E):p.push(E),p},[]):d?[]:void 0},P.prototype._getPreferredOutput=function(r){const e=this.currResultType;switch(e){case"all":{const t=Array.isArray(r.path)?r.path:P.toPathArray(r.path);return r.pointer=P.toPointer(t),r.path=typeof r.path=="string"?r.path:P.toPathString(r.path),r}case"value":case"parent":case"parentProperty":return r[e];case"path":return P.toPathString(r[e]);case"pointer":return P.toPointer(r.path);default:throw new TypeError("Unknown result type")}},P.prototype._handleCallback=function(r,e,t){if(e){const o=this._getPreferredOutput(r);r.path=typeof r.path=="string"?r.path:P.toPathString(r.path),e(o,t,r)}},P.prototype._trace=function(r,e,t,o,n,i,l,d){let a;if(!r.length)return a={path:t,value:e,parent:o,parentProperty:n,hasArrExpr:l},this._handleCallback(a,i,"value"),a;const c=r[0],p=r.slice(1),h=[];function E(y){Array.isArray(y)?y.forEach(A=>{h.push(A)}):h.push(y)}if((typeof c!="string"||d)&&e&&Object.hasOwn(e,c))E(this._trace(p,e[c],G(t,c),e,c,i,l));else if(c==="*")this._walk(e,y=>{E(this._trace(p,e[y],G(t,y),e,y,i,!0,!0))});else if(c==="..")E(this._trace(p,e,t,o,n,i,l)),this._walk(e,y=>{typeof e[y]=="object"&&E(this._trace(r.slice(),e[y],G(t,y),e,y,i,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:t.slice(0,-1),expr:p,isParentSelector:!0};if(c==="~")return a={path:G(t,c),value:n,parent:o,parentProperty:null},this._handleCallback(a,i,"property"),a;if(c==="$")E(this._trace(p,e,t,null,null,i,l));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c))E(this._slice(c,p,e,t,o,n,i));else if(c.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const y=c.replace(/^\?\((.*?)\)$/u,"$1"),A=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(y);A?this._walk(e,B=>{const x=[A[2]],V=A[1]?e[B][A[1]]:e[B];this._trace(x,V,t,o,n,i,!0).length>0&&E(this._trace(p,e[B],G(t,B),e,B,i,!0))}):this._walk(e,B=>{this._eval(y,e[B],B,t,o,n)&&E(this._trace(p,e[B],G(t,B),e,B,i,!0))})}else if(c[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");E(this._trace(ue(this._eval(c,e,t.at(-1),t.slice(0,-1),o,n),p),e,t,o,n,i,l))}else if(c[0]==="@"){let y=!1;const A=c.slice(1,-2);switch(A){case"scalar":(!e||!["object","function"].includes(typeof e))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===A&&(y=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(y=!0);break;case"number":Number.isFinite(e)&&(y=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(y=!0);break;case"object":e&&typeof e===A&&(y=!0);break;case"array":Array.isArray(e)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(e,t,o,n);break;case"null":e===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+A)}if(y)return a={path:t,value:e,parent:o,parentProperty:n},this._handleCallback(a,i,"value"),a}else if(c[0]==="`"&&e&&Object.hasOwn(e,c.slice(1))){const y=c.slice(1);E(this._trace(p,e[y],G(t,y),e,y,i,l,!0))}else if(c.includes(",")){const y=c.split(",");for(const A of y)E(this._trace(ue(A,p),e,t,o,n,i,!0))}else!d&&e&&Object.hasOwn(e,c)&&E(this._trace(p,e[c],G(t,c),e,c,i,l,!0))}if(this._hasParentSelector)for(let y=0;y<h.length;y++){const A=h[y];if(A&&A.isParentSelector){const B=this._trace(A.expr,e,A.path,o,n,i,l);if(Array.isArray(B)){h[y]=B[0];const x=B.length;for(let V=1;V<x;V++)y++,h.splice(y,0,B[V])}else h[y]=B}}return h},P.prototype._walk=function(r,e){if(Array.isArray(r)){const t=r.length;for(let o=0;o<t;o++)e(o)}else r&&typeof r=="object"&&Object.keys(r).forEach(t=>{e(t)})},P.prototype._slice=function(r,e,t,o,n,i,l){if(!Array.isArray(t))return;const d=t.length,a=r.split(":"),c=a[2]&&Number.parseInt(a[2])||1;let p=a[0]&&Number.parseInt(a[0])||0,h=a[1]&&Number.parseInt(a[1])||d;p=p<0?Math.max(0,p+d):Math.min(d,p),h=h<0?Math.max(0,h+d):Math.min(d,h);const E=[];for(let y=p;y<h;y+=c)this._trace(ue(y,e),t,o,n,i,l,!0).forEach(B=>{E.push(B)});return E},P.prototype._eval=function(r,e,t,o,n,i){this.currSandbox._$_parentProperty=i,this.currSandbox._$_parent=n,this.currSandbox._$_property=t,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const l=r.includes("@path");l&&(this.currSandbox._$_path=P.toPathString(o.concat([t])));const d=this.currEval+"Script:"+r;if(!P.cache[d]){let a=r.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(l&&(a=a.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)P.cache[d]=new this.safeVm.Script(a);else if(this.currEval==="native")P.cache[d]=new this.vm.Script(a);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const c=this.currEval;P.cache[d]=new c(a)}else if(typeof this.currEval=="function")P.cache[d]={runInNewContext:c=>this.currEval(a,c)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return P.cache[d].runInNewContext(this.currSandbox)}catch(a){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+a.message+": "+r)}},P.cache={},P.toPathString=function(r){const e=r,t=e.length;let o="$";for(let n=1;n<t;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(o+=/^[0-9*]+$/u.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return o},P.toPointer=function(r){const e=r,t=e.length;let o="";for(let n=1;n<t;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(o+="/"+e[n].toString().replaceAll("~","~0").replaceAll("/","~1"));return o},P.toPathArray=function(r){const{cache:e}=P;if(e[r])return e[r].concat();const t=[],n=r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(i,l){return"[#"+(t.push(l)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(i,l){return"['"+l.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(i,l){return";"+l.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(i){const l=i.match(/#(\d+)/u);return!l||!l[1]?i:t[l[1]]});return e[r]=n,e[r].concat()},P.prototype.safeVm={Script:ze};const Ke=function(r,e,t){const o=r.length;for(let n=0;n<o;n++){const i=r[n];t(i)&&e.push(r.splice(n--,1)[0])}};class qe{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const o=Object.keys(e),n=[];Ke(o,n,c=>typeof e[c]=="function");const i=o.map(c=>e[c]);t=n.reduce((c,p)=>{let h=e[p].toString();return/function/u.test(h)||(h="function "+h),"var "+p+"="+h+";"+c},"")+t,!/(['"])use strict\1/u.test(t)&&!o.includes("arguments")&&(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const d=t.lastIndexOf(";"),a=d!==-1?t.slice(0,d+1)+" return "+t.slice(d+1):" return "+t;return new Function(...o,a)(...i)}}P.prototype.vm={Script:qe};const Ye={class:"json-node"},Qe={key:0,class:"json-node__container"},We={class:"json-node__line"},Ge={key:2,class:"json-node__colon"},Ze=["title"],De={key:3,class:"json-node__collapsed"},Je={key:4,class:"json-node__comma"},et={key:0,class:"json-node__children"},tt={class:"json-node__children-content"},rt={class:"json-node__line json-node__closing-bracket"},nt={class:"json-node__bracket"},ot={key:0,class:"json-node__comma"},st={key:1,class:"json-node__primitive"},it={key:2,class:"json-node__colon"},lt=["title"],at={key:0,class:"json-node__comma"},ct=s.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(r,{emit:e}){s.useCssVars(b=>({"7b112182":b.level,"1501a3a8":b.theme.colors.syntaxKey,"4c2226b6":b.theme.colors.hoverBackground,"30aa351e":b.theme.colors.syntaxBracket,"090e30f3":b.theme.colors.textSecondary,cf872bb0:b.theme.colors.syntaxString,e0803540:b.theme.colors.syntaxNumber,"3954b61e":b.theme.colors.syntaxBoolean,e9972d44:b.theme.colors.syntaxNull,"231c0282":b.theme.colors.background,e1dce7d8:b.theme.colors.indentLine}));const t=r,o=e,n=s.ref(!1),i=s.ref(!1),l=s.ref(""),d=s.ref(""),a=b=>b!==null&&typeof b=="object"&&!Array.isArray(b)&&"__protected_number__"in b&&Object.keys(b).length===1,c=b=>a(b)?b.__protected_number__:"",p=s.computed(()=>a(t.value)?!1:t.value!==null&&typeof t.value=="object"),h=s.computed(()=>Array.isArray(t.value)),E=s.computed(()=>t.path?t.path:t.keyName?t.keyName:"root"),y=s.computed(()=>t.expanded.has(E.value)),A=s.computed(()=>t.keyName),B=s.computed(()=>h.value?"[":"{"),x=s.computed(()=>h.value?"]":"}"),V=s.computed(()=>{if(!t.value)return"";const f=Object.keys(t.value).length;return h.value?f>0?` ${f} items `:" ":f>0?` ${f} keys `:" "}),j=s.computed(()=>{const b=typeof t.value;return t.value===null?"json-node__value--null":b==="boolean"?"json-node__value--boolean":b==="number"||a(t.value)?"json-node__value--number":b==="string"?"json-node__value--string":""}),m=s.computed(()=>i.value?d.value:t.value===null?"null":typeof t.value=="boolean"||typeof t.value=="number"?String(t.value):a(t.value)?c(t.value):typeof t.value=="string"?`"${t.value}"`:String(t.value)),O=s.computed(()=>"Click to edit, double-click to copy"),_=b=>t.level===0?b:E.value?`${E.value}.${b}`:b,w=b=>{const f=Object.keys(t.value);return f.indexOf(b)===f.length-1},S=()=>{o("toggle-expand",E.value)},L=()=>{t.level!==0&&(n.value=!0,l.value=t.keyName,s.nextTick(()=>{const b=document.querySelectorAll(".json-node__key-input"),f=b[b.length-1];f&&(f.focus(),f.select())}))},H=()=>{p.value||(i.value=!0,a(t.value)?d.value=c(t.value):typeof t.value=="string"?d.value=t.value:d.value=String(t.value),s.nextTick(()=>{const b=document.querySelectorAll(".json-node__value-input"),f=b[b.length-1];f&&(f.focus(),f.select())}))},F=()=>{if(t.level===0||!n.value)return;const b=l.value.trim();if(!b){W();return}if(b===t.keyName){n.value=!1;return}n.value=!1,o("update:key",E.value,b)},X=()=>{try{let b;const f=d.value.trim();if(f==="null")b=null;else if(f==="true"||f==="false")b=f==="true";else if(!isNaN(Number(f))&&f!==""){const g=Number(f);!Number.isSafeInteger(g)||f.length>15?b={__protected_number__:f}:b=g}else b=d.value;o("update:value",E.value,b),i.value=!1}catch(b){console.error("Failed to parse value:",b),i.value=!1}},W=()=>{n.value=!1,l.value=t.keyName},re=()=>{i.value=!1,a(t.value)?d.value=c(t.value):typeof t.value=="string"?d.value=t.value:d.value=String(t.value)};return(b,f)=>{const g=s.resolveComponent("JsonNode",!0);return s.openBlock(),s.createElementBlock("div",Ye,[p.value?(s.openBlock(),s.createElementBlock("div",Qe,[s.createElementVNode("div",We,[b.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:L,title:"Click to edit key"},' "'+s.toDisplayString(A.value)+'" ',1)):s.createCommentVNode("",!0),b.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":f[0]||(f[0]=N=>l.value=N),onKeyup:[s.withKeys(F,["enter"]),s.withKeys(W,["escape"])],onBlur:F,class:"json-node__key-input"},null,544)),[[s.vModelText,l.value]]):s.createCommentVNode("",!0),b.keyName?(s.openBlock(),s.createElementBlock("span",Ge,": ")):s.createCommentVNode("",!0),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:S,title:y.value?"Click to collapse":"Click to expand"},s.toDisplayString(B.value),9,Ze),y.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",De,[s.createTextVNode(s.toDisplayString(V.value)+" ",1),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:S},s.toDisplayString(x.value),1)])),!y.value&&!b.isLast?(s.openBlock(),s.createElementBlock("span",Je,",")):s.createCommentVNode("",!0)]),y.value?(s.openBlock(),s.createElementBlock("div",et,[s.createElementVNode("div",tt,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.value,(N,k)=>(s.openBlock(),s.createElementBlock("div",{key:k,class:"json-node__child"},[s.createVNode(g,{value:N,"key-name":h.value?"":String(k),level:b.level+1,path:_(String(k)),expanded:b.expanded,theme:b.theme,"onUpdate:value":f[1]||(f[1]=(C,T)=>b.$emit("update:value",C,T)),onToggleExpand:f[2]||(f[2]=C=>b.$emit("toggle-expand",C)),onCopy:f[3]||(f[3]=C=>b.$emit("copy",C)),"onUpdate:key":f[4]||(f[4]=(C,T)=>b.$emit("update:key",C,T)),"is-last":w(String(k))},null,8,["value","key-name","level","path","expanded","theme","is-last"])]))),128))]),s.createElementVNode("div",rt,[s.createElementVNode("span",nt,s.toDisplayString(x.value),1),b.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",ot,","))])])):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",st,[b.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:L,title:"Click to edit key"},' "'+s.toDisplayString(A.value)+'" ',1)):s.createCommentVNode("",!0),b.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":f[5]||(f[5]=N=>l.value=N),onKeyup:[s.withKeys(F,["enter"]),s.withKeys(W,["escape"])],onBlur:F,class:"json-node__key-input"},null,544)),[[s.vModelText,l.value]]):s.createCommentVNode("",!0),b.keyName?(s.openBlock(),s.createElementBlock("span",it,": ")):s.createCommentVNode("",!0),i.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",{key:3,class:s.normalizeClass(["json-node__value",j.value]),onClick:H,onDblclick:f[6]||(f[6]=N=>b.$emit("copy",b.value)),title:O.value},[s.createTextVNode(s.toDisplayString(m.value),1),b.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",at,","))],42,lt)),i.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:4,"onUpdate:modelValue":f[7]||(f[7]=N=>d.value=N),onKeyup:[s.withKeys(X,["enter"]),s.withKeys(re,["escape"])],onBlur:X,class:"json-node__value-input"},null,544)),[[s.vModelText,d.value]]):s.createCommentVNode("",!0)]))])}}}),ie=(r,e)=>{const t=r.__vccOpts||r;for(const[o,n]of e)t[o]=n;return t},dt=ie(ct,[["__scopeId","data-v-860beb35"]]),ye={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",scrollbarTrack:"#f6f8fa",scrollbarThumb:"#d0d7de",scrollbarThumbHover:"#afb8c1",hoverBackground:"#f6f8fa",indentLine:"#d0d7de"}},ut={"github-light":ye,"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",scrollbarTrack:"#161b22",scrollbarThumb:"#30363d",scrollbarThumbHover:"#6e7681",hoverBackground:"#161b22",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",scrollbarTrack:"#f5f5f5",scrollbarThumb:"#d1d5db",scrollbarThumbHover:"#9ca3af",hoverBackground:"#f9f9f9",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",scrollbarTrack:"#f4ede4",scrollbarThumb:"#e8d5b7",scrollbarThumbHover:"#d4c4a8",hoverBackground:"#f8f2eb",indentLine:"#e8d5b7"}}};function ft(r="github-light"){return ut[r]||ye}const ht={key:0,class:"json-format__toolbar"},pt={class:"json-format__actions"},mt=["disabled"],gt=["disabled"],yt=["disabled"],bt=["disabled"],Et={class:"json-format__info"},_t={key:0,class:"json-format__status json-format__status--success"},xt={key:1,class:"json-format__status json-format__status--error"},kt={class:"json-format__content"},Nt={key:0,class:"json-format__error"},At={key:1,class:"json-format__error"},Ct={key:2,class:"json-format__viewer"},be=ie(s.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(r,{expose:e,emit:t}){s.useCssVars(f=>({"50e4672c":h.value.colors.border,"64d14328":h.value.colors.background,"668c94eb":h.value.colors.text,"8370c286":h.value.colors.surfaceBackground,"1698e888":h.value.colors.buttonBorder,"584924be":h.value.colors.buttonBackground,"325e00bd":h.value.colors.buttonText,"2430fb1e":h.value.colors.buttonBackgroundHover,ea0e2f1c:h.value.colors.buttonPrimary,"3b0b67ea":h.value.colors.buttonPrimaryHover,"2e7b3e93":h.value.colors.successBackground,b24220f6:h.value.colors.success,"0c7db250":h.value.colors.errorBackground,"6a387a0a":h.value.colors.error,"2c13c5fa":h.value.colors.scrollbarTrack,"2c1c44e4":h.value.colors.scrollbarThumb,"8ba97764":h.value.colors.scrollbarThumbHover}));const o=r,n=t,i=s.ref(null),l=s.ref(""),d=s.ref(new Set),a=s.ref(null),c=s.ref(""),p=s.computed(()=>l.value===""),h=s.computed(()=>ft(o.theme)),E=s.computed(()=>c.value?null:a.value!==null?a.value:i.value),y=f=>{if(!f.trim()){i.value=null,l.value="",a.value=null,c.value="";return}try{let g=f;const N=/(:\s*|,\s*|\[\s*)-?\d{16,}/.test(g),k=/(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(g);if(!N&&!k)try{i.value=JSON.parse(g),l.value="",a.value=null,c.value="",s.nextTick(()=>{E.value!==null&&O()});return}catch{}g=(T=>{let $="",R=!1,M=!1,q=0;for(;q<T.length;){const ne=T[q];if(R)M?M=!1:ne==="\\"?M=!0:ne==='"'&&(R=!1),$+=ne,q++;else if(ne==='"')R=!0,$+=ne,q++;else{const Ve=T.slice(q);let K=Ve.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);if(K){$+=K[1]+'{"__protected_number__":"'+K[2]+'"}'+K[3],q+=K[0].length;continue}if(K=Ve.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/),K){$+=K[1]+'{"__protected_number__":"'+K[2]+'"}'+K[3],q+=K[0].length;continue}$+=ne,q++}}return $})(g),i.value=JSON.parse(g),l.value="",a.value=null,c.value="",s.nextTick(()=>{E.value!==null&&O()})}catch(g){l.value=g instanceof Error?g.message:"Unknown parsing error",i.value=null,a.value=null,c.value=""}},A=f=>{if(!f||!f.expression.trim()){B();return}if(!i.value){c.value="No valid JSON data to filter";return}try{let g;if(f.type==="jsonpath")g=P({path:f.expression,json:i.value}),g.length===1&&f.expression.includes("$[")===!1&&!f.expression.endsWith("[*]")?a.value=g[0]:a.value=g;else if(f.type==="js")g=new Function("data",`
|
|
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+=i}else e+=i}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:u.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(u.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,u.isIdentifierPart(e));)this.index++;return{type:u.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let o=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let i=this.code;if(i===e){o=!0,this.index++,e===u.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(i===u.COMMA_CODE){if(this.index++,n++,n!==t.length){if(e===u.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===u.CBRACK_CODE)for(let l=t.length;l<n;l++)t.push(null)}}else if(t.length!==n&&n!==0)this.throwError("Expected comma");else{const l=this.gobbleExpression();(!l||l.type===u.COMPOUND)&&this.throwError("Expected comma"),t.push(l)}}return o||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(u.CPAREN_CODE);if(this.code===u.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:u.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:u.ARRAY_EXP,elements:this.gobbleArguments(u.CBRACK_CODE)}}}const Le=new Ie;Object.assign(u,{hooks:Le,plugins:new ve(u),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"}),u.max_unop_len=u.getMaxKeyLen(u.unary_ops),u.max_binop_len=u.getMaxKeyLen(u.binary_ops);const Q=r=>new u(r).parse(),je=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(u).filter(r=>!je.includes(r)&&Q[r]===void 0).forEach(r=>{Q[r]=u[r]}),Q.Jsep=u;const Re="ConditionalExpression";var Me={name:"ternary",init(r){r.hooks.add("after-expression",function(t){if(t.node&&this.code===r.QUMARK_CODE){this.index++;const o=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===r.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),t.node={type:Re,test:o,consequent:n,alternate:i},o.operator&&r.binary_ops[o.operator]<=.9){let l=o;for(;l.right.operator&&r.binary_ops[l.right.operator]<=.9;)l=l.right;t.node.test=l.right,l.right=t.node,t.node=o}}else this.throwError("Expected :")}})}};Q.plugins.register(Me);const ge=47,Ue=92;var Fe={name:"regex",init(r){r.hooks.add("gobble-token",function(t){if(this.code===ge){const o=++this.index;let n=!1;for(;this.index<this.expr.length;){if(this.code===ge&&!n){const i=this.expr.slice(o,this.index);let l="";for(;++this.index<this.expr.length;){const a=this.code;if(a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57)l+=this.char;else break}let d;try{d=new RegExp(i,l)}catch(a){this.throwError(a.message)}return t.node={type:r.LITERAL,value:d,raw:this.expr.slice(o-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===r.OBRACK_CODE?n=!0:n&&this.code===r.CBRACK_CODE&&(n=!1),this.index+=this.code===Ue?2:1}this.throwError("Unclosed Regex")}})}};const de=43,te={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[de,45],assignmentPrecedence:.9,init(r){const e=[r.IDENTIFIER,r.MEMBER_EXP];te.assignmentOperators.forEach(o=>r.addBinaryOp(o,te.assignmentPrecedence,!0)),r.hooks.add("gobble-token",function(n){const i=this.code;te.updateOperators.some(l=>l===i&&l===this.expr.charCodeAt(this.index+1))&&(this.index+=2,n.node={type:"UpdateExpression",operator:i===de?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!n.node.argument||!e.includes(n.node.argument.type))&&this.throwError(`Unexpected ${n.node.operator}`))}),r.hooks.add("after-token",function(n){if(n.node){const i=this.code;te.updateOperators.some(l=>l===i&&l===this.expr.charCodeAt(this.index+1))&&(e.includes(n.node.type)||this.throwError(`Unexpected ${n.node.operator}`),this.index+=2,n.node={type:"UpdateExpression",operator:i===de?"++":"--",argument:n.node,prefix:!1})}}),r.hooks.add("after-expression",function(n){n.node&&t(n.node)});function t(o){te.assignmentOperators.has(o.operator)?(o.type="AssignmentExpression",t(o.left),t(o.right)):o.operator||Object.values(o).forEach(n=>{n&&typeof n=="object"&&t(n)})}}};Q.plugins.register(Fe,te),Q.addUnaryOp("typeof"),Q.addLiteral("null",null),Q.addLiteral("undefined",void 0);const Xe=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),I={evalAst(r,e){switch(r.type){case"BinaryExpression":case"LogicalExpression":return I.evalBinaryExpression(r,e);case"Compound":return I.evalCompound(r,e);case"ConditionalExpression":return I.evalConditionalExpression(r,e);case"Identifier":return I.evalIdentifier(r,e);case"Literal":return I.evalLiteral(r,e);case"MemberExpression":return I.evalMemberExpression(r,e);case"UnaryExpression":return I.evalUnaryExpression(r,e);case"ArrayExpression":return I.evalArrayExpression(r,e);case"CallExpression":return I.evalCallExpression(r,e);case"AssignmentExpression":return I.evalAssignmentExpression(r,e);default:throw SyntaxError("Unexpected expression",r)}},evalBinaryExpression(r,e){return{"||":(o,n)=>o||n(),"&&":(o,n)=>o&&n(),"|":(o,n)=>o|n(),"^":(o,n)=>o^n(),"&":(o,n)=>o&n(),"==":(o,n)=>o==n(),"!=":(o,n)=>o!=n(),"===":(o,n)=>o===n(),"!==":(o,n)=>o!==n(),"<":(o,n)=>o<n(),">":(o,n)=>o>n(),"<=":(o,n)=>o<=n(),">=":(o,n)=>o>=n(),"<<":(o,n)=>o<<n(),">>":(o,n)=>o>>n(),">>>":(o,n)=>o>>>n(),"+":(o,n)=>o+n(),"-":(o,n)=>o-n(),"*":(o,n)=>o*n(),"/":(o,n)=>o/n(),"%":(o,n)=>o%n()}[r.operator](I.evalAst(r.left,e),()=>I.evalAst(r.right,e))},evalCompound(r,e){let t;for(let o=0;o<r.body.length;o++){r.body[o].type==="Identifier"&&["var","let","const"].includes(r.body[o].name)&&r.body[o+1]&&r.body[o+1].type==="AssignmentExpression"&&(o+=1);const n=r.body[o];t=I.evalAst(n,e)}return t},evalConditionalExpression(r,e){return I.evalAst(r.test,e)?I.evalAst(r.consequent,e):I.evalAst(r.alternate,e)},evalIdentifier(r,e){if(Object.hasOwn(e,r.name))return e[r.name];throw ReferenceError(`${r.name} is not defined`)},evalLiteral(r){return r.value},evalMemberExpression(r,e){const t=String(r.computed?I.evalAst(r.property):r.property.name),o=I.evalAst(r.object,e);if(o==null)throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);if(!Object.hasOwn(o,t)&&Xe.has(t))throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);const n=o[t];return typeof n=="function"?n.bind(o):n},evalUnaryExpression(r,e){return{"-":o=>-I.evalAst(o,e),"!":o=>!I.evalAst(o,e),"~":o=>~I.evalAst(o,e),"+":o=>+I.evalAst(o,e),typeof:o=>typeof I.evalAst(o,e)}[r.operator](r.argument)},evalArrayExpression(r,e){return r.elements.map(t=>I.evalAst(t,e))},evalCallExpression(r,e){const t=r.arguments.map(n=>I.evalAst(n,e));return I.evalAst(r.callee,e)(...t)},evalAssignmentExpression(r,e){if(r.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const t=r.left.name,o=I.evalAst(r.right,e);return e[t]=o,e[t]}};class ze{constructor(e){this.code=e,this.ast=Q(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return I.evalAst(this.ast,t)}}function G(r,e){return r=r.slice(),r.push(e),r}function ue(r,e){return e=e.slice(),e.unshift(r),e}class Ke 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 P(r,e,t,o,n){if(!(this instanceof P))try{return new P(r,e,t,o,n)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof r=="string"&&(n=o,o=t,t=e,e=r,r=null);const i=r&&typeof r=="object";if(r=r||{},this.json=r.json||t,this.path=r.path||e,this.resultType=r.resultType||"value",this.flatten=r.flatten||!1,this.wrap=Object.hasOwn(r,"wrap")?r.wrap:!0,this.sandbox=r.sandbox||{},this.eval=r.eval===void 0?"safe":r.eval,this.ignoreEvalErrors=typeof r.ignoreEvalErrors>"u"?!1:r.ignoreEvalErrors,this.parent=r.parent||null,this.parentProperty=r.parentProperty||null,this.callback=r.callback||o||null,this.otherTypeCallback=r.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},r.autostart!==!1){const l={path:i?r.path:e};i?"json"in r&&(l.json=r.json):l.json=t;const d=this.evaluate(l);if(!d||typeof d!="object")throw new Ke(d);return d}}P.prototype.evaluate=function(r,e,t,o){let n=this.parent,i=this.parentProperty,{flatten:l,wrap:d}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,t=t||this.callback,this.currOtherTypeCallback=o||this.otherTypeCallback,e=e||this.json,r=r||this.path,r&&typeof r=="object"&&!Array.isArray(r)){if(!r.path&&r.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(r,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=r),l=Object.hasOwn(r,"flatten")?r.flatten:l,this.currResultType=Object.hasOwn(r,"resultType")?r.resultType:this.currResultType,this.currSandbox=Object.hasOwn(r,"sandbox")?r.sandbox:this.currSandbox,d=Object.hasOwn(r,"wrap")?r.wrap:d,this.currEval=Object.hasOwn(r,"eval")?r.eval:this.currEval,t=Object.hasOwn(r,"callback")?r.callback:t,this.currOtherTypeCallback=Object.hasOwn(r,"otherTypeCallback")?r.otherTypeCallback:this.currOtherTypeCallback,n=Object.hasOwn(r,"parent")?r.parent:n,i=Object.hasOwn(r,"parentProperty")?r.parentProperty:i,r=r.path}if(n=n||null,i=i||null,Array.isArray(r)&&(r=P.toPathString(r)),!r&&r!==""||!e)return;const a=P.toPathArray(r);a[0]==="$"&&a.length>1&&a.shift(),this._hasParentSelector=null;const c=this._trace(a,e,["$"],n,i,t).filter(function(p){return p&&!p.isParentSelector});return c.length?!d&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce((p,h)=>{const E=this._getPreferredOutput(h);return l&&Array.isArray(E)?p=p.concat(E):p.push(E),p},[]):d?[]:void 0},P.prototype._getPreferredOutput=function(r){const e=this.currResultType;switch(e){case"all":{const t=Array.isArray(r.path)?r.path:P.toPathArray(r.path);return r.pointer=P.toPointer(t),r.path=typeof r.path=="string"?r.path:P.toPathString(r.path),r}case"value":case"parent":case"parentProperty":return r[e];case"path":return P.toPathString(r[e]);case"pointer":return P.toPointer(r.path);default:throw new TypeError("Unknown result type")}},P.prototype._handleCallback=function(r,e,t){if(e){const o=this._getPreferredOutput(r);r.path=typeof r.path=="string"?r.path:P.toPathString(r.path),e(o,t,r)}},P.prototype._trace=function(r,e,t,o,n,i,l,d){let a;if(!r.length)return a={path:t,value:e,parent:o,parentProperty:n,hasArrExpr:l},this._handleCallback(a,i,"value"),a;const c=r[0],p=r.slice(1),h=[];function E(y){Array.isArray(y)?y.forEach(A=>{h.push(A)}):h.push(y)}if((typeof c!="string"||d)&&e&&Object.hasOwn(e,c))E(this._trace(p,e[c],G(t,c),e,c,i,l));else if(c==="*")this._walk(e,y=>{E(this._trace(p,e[y],G(t,y),e,y,i,!0,!0))});else if(c==="..")E(this._trace(p,e,t,o,n,i,l)),this._walk(e,y=>{typeof e[y]=="object"&&E(this._trace(r.slice(),e[y],G(t,y),e,y,i,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:t.slice(0,-1),expr:p,isParentSelector:!0};if(c==="~")return a={path:G(t,c),value:n,parent:o,parentProperty:null},this._handleCallback(a,i,"property"),a;if(c==="$")E(this._trace(p,e,t,null,null,i,l));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c))E(this._slice(c,p,e,t,o,n,i));else if(c.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const y=c.replace(/^\?\((.*?)\)$/u,"$1"),A=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(y);A?this._walk(e,B=>{const x=[A[2]],V=A[1]?e[B][A[1]]:e[B];this._trace(x,V,t,o,n,i,!0).length>0&&E(this._trace(p,e[B],G(t,B),e,B,i,!0))}):this._walk(e,B=>{this._eval(y,e[B],B,t,o,n)&&E(this._trace(p,e[B],G(t,B),e,B,i,!0))})}else if(c[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");E(this._trace(ue(this._eval(c,e,t.at(-1),t.slice(0,-1),o,n),p),e,t,o,n,i,l))}else if(c[0]==="@"){let y=!1;const A=c.slice(1,-2);switch(A){case"scalar":(!e||!["object","function"].includes(typeof e))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===A&&(y=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(y=!0);break;case"number":Number.isFinite(e)&&(y=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(y=!0);break;case"object":e&&typeof e===A&&(y=!0);break;case"array":Array.isArray(e)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(e,t,o,n);break;case"null":e===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+A)}if(y)return a={path:t,value:e,parent:o,parentProperty:n},this._handleCallback(a,i,"value"),a}else if(c[0]==="`"&&e&&Object.hasOwn(e,c.slice(1))){const y=c.slice(1);E(this._trace(p,e[y],G(t,y),e,y,i,l,!0))}else if(c.includes(",")){const y=c.split(",");for(const A of y)E(this._trace(ue(A,p),e,t,o,n,i,!0))}else!d&&e&&Object.hasOwn(e,c)&&E(this._trace(p,e[c],G(t,c),e,c,i,l,!0))}if(this._hasParentSelector)for(let y=0;y<h.length;y++){const A=h[y];if(A&&A.isParentSelector){const B=this._trace(A.expr,e,A.path,o,n,i,l);if(Array.isArray(B)){h[y]=B[0];const x=B.length;for(let V=1;V<x;V++)y++,h.splice(y,0,B[V])}else h[y]=B}}return h},P.prototype._walk=function(r,e){if(Array.isArray(r)){const t=r.length;for(let o=0;o<t;o++)e(o)}else r&&typeof r=="object"&&Object.keys(r).forEach(t=>{e(t)})},P.prototype._slice=function(r,e,t,o,n,i,l){if(!Array.isArray(t))return;const d=t.length,a=r.split(":"),c=a[2]&&Number.parseInt(a[2])||1;let p=a[0]&&Number.parseInt(a[0])||0,h=a[1]&&Number.parseInt(a[1])||d;p=p<0?Math.max(0,p+d):Math.min(d,p),h=h<0?Math.max(0,h+d):Math.min(d,h);const E=[];for(let y=p;y<h;y+=c)this._trace(ue(y,e),t,o,n,i,l,!0).forEach(B=>{E.push(B)});return E},P.prototype._eval=function(r,e,t,o,n,i){this.currSandbox._$_parentProperty=i,this.currSandbox._$_parent=n,this.currSandbox._$_property=t,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const l=r.includes("@path");l&&(this.currSandbox._$_path=P.toPathString(o.concat([t])));const d=this.currEval+"Script:"+r;if(!P.cache[d]){let a=r.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(l&&(a=a.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)P.cache[d]=new this.safeVm.Script(a);else if(this.currEval==="native")P.cache[d]=new this.vm.Script(a);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const c=this.currEval;P.cache[d]=new c(a)}else if(typeof this.currEval=="function")P.cache[d]={runInNewContext:c=>this.currEval(a,c)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return P.cache[d].runInNewContext(this.currSandbox)}catch(a){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+a.message+": "+r)}},P.cache={},P.toPathString=function(r){const e=r,t=e.length;let o="$";for(let n=1;n<t;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(o+=/^[0-9*]+$/u.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return o},P.toPointer=function(r){const e=r,t=e.length;let o="";for(let n=1;n<t;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(o+="/"+e[n].toString().replaceAll("~","~0").replaceAll("/","~1"));return o},P.toPathArray=function(r){const{cache:e}=P;if(e[r])return e[r].concat();const t=[],n=r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(i,l){return"[#"+(t.push(l)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(i,l){return"['"+l.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(i,l){return";"+l.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(i){const l=i.match(/#(\d+)/u);return!l||!l[1]?i:t[l[1]]});return e[r]=n,e[r].concat()},P.prototype.safeVm={Script:ze};const He=function(r,e,t){const o=r.length;for(let n=0;n<o;n++){const i=r[n];t(i)&&e.push(r.splice(n--,1)[0])}};class qe{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const o=Object.keys(e),n=[];He(o,n,c=>typeof e[c]=="function");const i=o.map(c=>e[c]);t=n.reduce((c,p)=>{let h=e[p].toString();return/function/u.test(h)||(h="function "+h),"var "+p+"="+h+";"+c},"")+t,!/(['"])use strict\1/u.test(t)&&!o.includes("arguments")&&(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const d=t.lastIndexOf(";"),a=d!==-1?t.slice(0,d+1)+" return "+t.slice(d+1):" return "+t;return new Function(...o,a)(...i)}}P.prototype.vm={Script:qe};const Ye={class:"json-node"},Qe={key:0,class:"json-node__container"},We={class:"json-node__line"},Ge={key:2,class:"json-node__colon"},Ze=["title"],De={key:3,class:"json-node__collapsed"},Je={key:4,class:"json-node__comma"},et={key:0,class:"json-node__children"},tt={class:"json-node__children-content"},rt={class:"json-node__line json-node__closing-bracket"},nt={class:"json-node__bracket"},ot={key:0,class:"json-node__comma"},st={key:1,class:"json-node__primitive"},it={key:2,class:"json-node__colon"},lt=["title"],at={key:0,class:"json-node__comma"},ct=s.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(r,{emit:e}){s.useCssVars(b=>({"7b112182":b.level,"1501a3a8":b.theme.colors.syntaxKey,"4c2226b6":b.theme.colors.hoverBackground,"30aa351e":b.theme.colors.syntaxBracket,"090e30f3":b.theme.colors.textSecondary,cf872bb0:b.theme.colors.syntaxString,e0803540:b.theme.colors.syntaxNumber,"3954b61e":b.theme.colors.syntaxBoolean,e9972d44:b.theme.colors.syntaxNull,"231c0282":b.theme.colors.background,e1dce7d8:b.theme.colors.indentLine}));const t=r,o=e,n=s.ref(!1),i=s.ref(!1),l=s.ref(""),d=s.ref(""),a=b=>b!==null&&typeof b=="object"&&!Array.isArray(b)&&"__protected_number__"in b&&Object.keys(b).length===1,c=b=>a(b)?b.__protected_number__:"",p=s.computed(()=>a(t.value)?!1:t.value!==null&&typeof t.value=="object"),h=s.computed(()=>Array.isArray(t.value)),E=s.computed(()=>t.path?t.path:t.keyName?t.keyName:"root"),y=s.computed(()=>t.expanded.has(E.value)),A=s.computed(()=>t.keyName),B=s.computed(()=>h.value?"[":"{"),x=s.computed(()=>h.value?"]":"}"),V=s.computed(()=>{if(!t.value)return"";const f=Object.keys(t.value).length;return h.value?f>0?` ${f} items `:" ":f>0?` ${f} keys `:" "}),j=s.computed(()=>{const b=typeof t.value;return t.value===null?"json-node__value--null":b==="boolean"?"json-node__value--boolean":b==="number"||a(t.value)?"json-node__value--number":b==="string"?"json-node__value--string":""}),m=s.computed(()=>i.value?d.value:t.value===null?"null":typeof t.value=="boolean"||typeof t.value=="number"?String(t.value):a(t.value)?c(t.value):typeof t.value=="string"?`"${t.value}"`:String(t.value)),T=s.computed(()=>"Click to edit, double-click to copy"),_=b=>t.level===0?b:E.value?`${E.value}.${b}`:b,w=b=>{const f=Object.keys(t.value);return f.indexOf(b)===f.length-1},S=()=>{o("toggle-expand",E.value)},L=()=>{t.level!==0&&(n.value=!0,l.value=t.keyName,s.nextTick(()=>{const b=document.querySelectorAll(".json-node__key-input"),f=b[b.length-1];f&&(f.focus(),f.select())}))},K=()=>{p.value||(i.value=!0,a(t.value)?d.value=c(t.value):typeof t.value=="string"?d.value=t.value:d.value=String(t.value),s.nextTick(()=>{const b=document.querySelectorAll(".json-node__value-input"),f=b[b.length-1];f&&(f.focus(),f.select())}))},F=()=>{if(t.level===0||!n.value)return;const b=l.value.trim();if(!b){W();return}if(b===t.keyName){n.value=!1;return}n.value=!1,o("update:key",E.value,b)},X=()=>{try{let b;const f=d.value.trim();if(f==="null")b=null;else if(f==="true"||f==="false")b=f==="true";else if(!isNaN(Number(f))&&f!==""){const g=Number(f);!Number.isSafeInteger(g)||f.length>15?b={__protected_number__:f}:b=g}else b=d.value;o("update:value",E.value,b),i.value=!1}catch(b){console.error("Failed to parse value:",b),i.value=!1}},W=()=>{n.value=!1,l.value=t.keyName},re=()=>{i.value=!1,a(t.value)?d.value=c(t.value):typeof t.value=="string"?d.value=t.value:d.value=String(t.value)};return(b,f)=>{const g=s.resolveComponent("JsonNode",!0);return s.openBlock(),s.createElementBlock("div",Ye,[p.value?(s.openBlock(),s.createElementBlock("div",Qe,[s.createElementVNode("div",We,[b.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:L,title:"Click to edit key"},' "'+s.toDisplayString(A.value)+'" ',1)):s.createCommentVNode("",!0),b.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":f[0]||(f[0]=N=>l.value=N),onKeyup:[s.withKeys(F,["enter"]),s.withKeys(W,["escape"])],onBlur:F,class:"json-node__key-input"},null,544)),[[s.vModelText,l.value]]):s.createCommentVNode("",!0),b.keyName?(s.openBlock(),s.createElementBlock("span",Ge,": ")):s.createCommentVNode("",!0),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:S,title:y.value?"Click to collapse":"Click to expand"},s.toDisplayString(B.value),9,Ze),y.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",De,[s.createTextVNode(s.toDisplayString(V.value)+" ",1),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:S},s.toDisplayString(x.value),1)])),!y.value&&!b.isLast?(s.openBlock(),s.createElementBlock("span",Je,",")):s.createCommentVNode("",!0)]),y.value?(s.openBlock(),s.createElementBlock("div",et,[s.createElementVNode("div",tt,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.value,(N,k)=>(s.openBlock(),s.createElementBlock("div",{key:k,class:"json-node__child"},[s.createVNode(g,{value:N,"key-name":h.value?"":String(k),level:b.level+1,path:_(String(k)),expanded:b.expanded,theme:b.theme,"onUpdate:value":f[1]||(f[1]=(C,O)=>b.$emit("update:value",C,O)),onToggleExpand:f[2]||(f[2]=C=>b.$emit("toggle-expand",C)),onCopy:f[3]||(f[3]=C=>b.$emit("copy",C)),"onUpdate:key":f[4]||(f[4]=(C,O)=>b.$emit("update:key",C,O)),"is-last":w(String(k))},null,8,["value","key-name","level","path","expanded","theme","is-last"])]))),128))]),s.createElementVNode("div",rt,[s.createElementVNode("span",nt,s.toDisplayString(x.value),1),b.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",ot,","))])])):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",st,[b.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:L,title:"Click to edit key"},' "'+s.toDisplayString(A.value)+'" ',1)):s.createCommentVNode("",!0),b.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":f[5]||(f[5]=N=>l.value=N),onKeyup:[s.withKeys(F,["enter"]),s.withKeys(W,["escape"])],onBlur:F,class:"json-node__key-input"},null,544)),[[s.vModelText,l.value]]):s.createCommentVNode("",!0),b.keyName?(s.openBlock(),s.createElementBlock("span",it,": ")):s.createCommentVNode("",!0),i.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",{key:3,class:s.normalizeClass(["json-node__value",j.value]),onClick:K,onDblclick:f[6]||(f[6]=N=>b.$emit("copy",b.value)),title:T.value},[s.createTextVNode(s.toDisplayString(m.value),1),b.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",at,","))],42,lt)),i.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:4,"onUpdate:modelValue":f[7]||(f[7]=N=>d.value=N),onKeyup:[s.withKeys(X,["enter"]),s.withKeys(re,["escape"])],onBlur:X,class:"json-node__value-input"},null,544)),[[s.vModelText,d.value]]):s.createCommentVNode("",!0)]))])}}}),ie=(r,e)=>{const t=r.__vccOpts||r;for(const[o,n]of e)t[o]=n;return t},dt=ie(ct,[["__scopeId","data-v-860beb35"]]),ye={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",indentLine:"#d0d7de"}},ut={"github-light":ye,"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",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",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",indentLine:"#e8d5b7"}}};function ft(r="github-light"){return ut[r]||ye}const ht={key:0,class:"json-format__toolbar"},pt={class:"json-format__actions"},mt=["disabled"],gt=["disabled"],yt=["disabled"],bt=["disabled"],Et={class:"json-format__info"},_t={key:0,class:"json-format__status json-format__status--success"},xt={key:1,class:"json-format__status json-format__status--error"},kt={class:"json-format__content"},Nt={key:0,class:"json-format__error"},At={key:1,class:"json-format__error"},Ct={key:2,class:"json-format__viewer"},be=ie(s.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(r,{expose:e,emit:t}){s.useCssVars(f=>({"325d5f6b":h.value.colors.border,"407388ed":h.value.colors.background,"1276f42c":h.value.colors.text,"34805dc8":h.value.colors.surfaceBackground,"212f19fd":h.value.colors.buttonBorder,b83cab02:h.value.colors.buttonBackground,b58ba984:h.value.colors.buttonText,d50a3406:h.value.colors.buttonBackgroundHover,"2421bb5e":h.value.colors.buttonPrimary,"0299816b":h.value.colors.buttonPrimaryHover,"55f370f2":h.value.colors.successBackground,b3fc86b8:h.value.colors.success,"781064f7":h.value.colors.errorBackground,"3b9a02e9":h.value.colors.error}));const o=r,n=t,i=s.ref(null),l=s.ref(""),d=s.ref(new Set),a=s.ref(null),c=s.ref(""),p=s.computed(()=>l.value===""),h=s.computed(()=>ft(o.theme)),E=s.computed(()=>c.value?null:a.value!==null?a.value:i.value),y=f=>{if(!f.trim()){i.value=null,l.value="",a.value=null,c.value="";return}try{let g=f;const N=/(:\s*|,\s*|\[\s*)-?\d{16,}/.test(g),k=/(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(g);if(!N&&!k)try{i.value=JSON.parse(g),l.value="",a.value=null,c.value="",s.nextTick(()=>{E.value!==null&&T()});return}catch{}g=(O=>{let $="",R=!1,M=!1,q=0;for(;q<O.length;){const ne=O[q];if(R)M?M=!1:ne==="\\"?M=!0:ne==='"'&&(R=!1),$+=ne,q++;else if(ne==='"')R=!0,$+=ne,q++;else{const Ve=O.slice(q);let H=Ve.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);if(H){$+=H[1]+'{"__protected_number__":"'+H[2]+'"}'+H[3],q+=H[0].length;continue}if(H=Ve.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/),H){$+=H[1]+'{"__protected_number__":"'+H[2]+'"}'+H[3],q+=H[0].length;continue}$+=ne,q++}}return $})(g),i.value=JSON.parse(g),l.value="",a.value=null,c.value="",s.nextTick(()=>{E.value!==null&&T()})}catch(g){l.value=g instanceof Error?g.message:"Unknown parsing error",i.value=null,a.value=null,c.value=""}},A=f=>{if(!f||!f.expression.trim()){B();return}if(!i.value){c.value="No valid JSON data to filter";return}try{let g;if(f.type==="jsonpath")g=P({path:f.expression,json:i.value}),g.length===1&&f.expression.includes("$[")===!1&&!f.expression.endsWith("[*]")?a.value=g[0]:a.value=g;else if(f.type==="js")g=new Function("data",`
|
|
3
3
|
try {
|
|
4
4
|
return ${f.expression};
|
|
5
5
|
} catch (error) {
|
|
6
6
|
throw new Error('JavaScript expression error: ' + error.message);
|
|
7
7
|
}
|
|
8
|
-
`)(i.value),a.value=g;else throw new Error(`Unsupported filter type: ${f.type}`);c.value="",s.nextTick(()=>{O()})}catch(g){c.value=g instanceof Error?g.message:"Filter execution error",a.value=null}},B=()=>{a.value=null,c.value=""};s.watch(()=>o.modelValue,f=>{y(f)},{immediate:!0});const x=(f,g,N)=>{const k=$=>{if($===null||typeof $!="object")return $;if(!Array.isArray($)&&"__protected_number__"in $&&Object.keys($).length===1)return`__PROTECTED_NUMBER_${$.__protected_number__}_PROTECTED_NUMBER__`;if(Array.isArray($))return $.map(M=>k(M));const R={};for(const[M,q]of Object.entries($))R[M]=k(q);return R},C=k(f);return JSON.stringify(C,g,N).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g,"$1")},V=(f,g)=>{if(!o.readonly)try{const N=j(i.value,f,g),k=x(N,null,2);n("update:modelValue",k)}catch(N){console.error("Failed to update JSON:",N)}},j=(f,g,N)=>{if(!g||g==="root")return N;const k=g.split("."),C=X(f,k.slice(0,-1));let T=C;for(let R=0;R<k.length-1;R++){const M=k[R];M!=="root"&&(Array.isArray(T)?T=T[parseInt(M)]:T=T[M])}const $=k[k.length-1];return $==="root"?N:(Array.isArray(T)?T[parseInt($)]=N:T[$]=N,C)},m=f=>{d.value.has(f)?d.value.delete(f):d.value.add(f)},O=()=>{const f=new Set,g=(N,k="")=>{N!==null&&typeof N=="object"&&(f.add(k||"root"),Array.isArray(N)?N.forEach((C,T)=>{const $=k?`${k}.${T}`:`${T}`;g(C,$)}):Object.keys(N).forEach(C=>{const T=k?`${k}.${C}`:C;g(N[C],T)}))};g(E.value),d.value=f,n("expand-all")},_=()=>{d.value=new Set(["root"]),n("collapse-all")},w=async()=>{if(p.value)try{const f=E.value,g=x(f,null,2);await navigator.clipboard.writeText(g),n("copy-success",g)}catch(f){console.error("Failed to copy JSON:",f),n("copy-error",f instanceof Error?f:new Error("Failed to copy JSON"))}},S=()=>{if(p.value)try{const f=E.value,g=x(f);n("update:modelValue",g),n("compress",g)}catch(f){console.error("Failed to compress JSON:",f)}},L=async f=>{try{let g;typeof f=="object"&&f!==null&&!Array.isArray(f)&&"__protected_number__"in f&&Object.keys(f).length===1?g=f.__protected_number__:typeof f=="string"?g=`"${f}"`:g=JSON.stringify(f),await navigator.clipboard.writeText(g)}catch(g){console.error("Failed to copy value:",g)}},H=(f,g)=>{if(!o.readonly)try{const N=F(i.value,f,g),k=x(N,null,2);n("update:modelValue",k),b(f,g)}catch(N){console.error("Failed to rename key:",N)}},F=(f,g,N)=>{if(!g||g==="root")return f;const k=g.split("."),C=X(f,k.slice(0,-1));if(k.length===1){const R=k[0];return C&&typeof C=="object"&&!Array.isArray(C)?W(C,R,N):C}let T=C;for(let R=0;R<k.length-1;R++){const M=k[R];Array.isArray(T)?T=T[parseInt(M)]:T=T[M]}const $=k[k.length-1];if(!Array.isArray(T)&&T&&typeof T=="object"){const R=W(T,$,N),M=k.slice(0,-1);M.length>0&&re(C,M,R)}return C},X=(f,g)=>{if(g.length===0)return f;if(Array.isArray(f)){const N=[...f],k=g[0],C=parseInt(k);return g.length===1||(N[C]=X(f[C],g.slice(1))),N}else if(f&&typeof f=="object"){const N={...f},k=g[0];return g.length===1||(N[k]=X(f[k],g.slice(1))),N}return f},W=(f,g,N)=>{if(!f||typeof f!="object"||Array.isArray(f))return f;const k=Object.keys(f),C={};for(const T of k)T===g?C[N]=f[T]:C[T]=f[T];return C},re=(f,g,N)=>{let k=f;for(let T=0;T<g.length-1;T++){const $=g[T];Array.isArray(k)?k=k[parseInt($)]:k=k[$]}const C=g[g.length-1];Array.isArray(k)?k[parseInt(C)]=N:k[C]=N},b=(f,g)=>{const N=new Set;d.value.forEach(k=>{if(k===f){const C=f.split(".");C[C.length-1]=g,N.add(C.join("."))}else if(k.startsWith(f+".")){const C=f.split(".");C[C.length-1]=g;const T=C.join("."),$=k.substring(f.length);N.add(T+$)}else N.add(k)}),d.value=N};return e({copyJson:w,compressSource:S,expandAll:O,collapseAll:_,toggleExpand:m,updateValue:V,updateKey:H,filter:A,clearFilter:B,isValidJson:()=>p.value,getParsedJson:()=>i.value,getFilteredJson:()=>a.value,getExpandedNodes:()=>d.value,getParseError:()=>l.value,getFilterError:()=>c.value,parseJson:f=>y(f),copyValue:f=>L(f)}),(f,g)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["json-format",`json-format--${h.value.name}`])},[f.showToolbar?(s.openBlock(),s.createElementBlock("div",ht,[s.createElementVNode("div",pt,[s.createElementVNode("button",{class:"json-format__btn json-format__btn--primary",onClick:w,disabled:!p.value,title:"Copy JSON"}," 📋 Copy ",8,mt),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:O,disabled:!p.value,title:"Expand All"}," ⬇️ Expand All ",8,gt),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:_,disabled:!p.value,title:"Collapse All"}," ➡️ Collapse All ",8,yt),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:S,disabled:!p.value,title:"Compress JSON"}," 📦 Compress ",8,bt)]),s.createElementVNode("div",Et,[p.value?(s.openBlock(),s.createElementBlock("span",_t," ✅ Valid JSON ")):(s.openBlock(),s.createElementBlock("span",xt," ❌ Invalid JSON "))])])):s.createCommentVNode("",!0),s.createElementVNode("div",kt,[p.value?c.value?(s.openBlock(),s.createElementBlock("div",At,[g[1]||(g[1]=s.createElementVNode("h4",null,"Filter Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(c.value),1)])):(s.openBlock(),s.createElementBlock("div",Ct,[s.createVNode(dt,{value:E.value,"key-name":"",level:0,expanded:d.value,"is-last":!0,theme:h.value,"onUpdate:value":V,onToggleExpand:m,onCopy:L,"onUpdate:key":H},null,8,["value","expanded","theme"])])):(s.openBlock(),s.createElementBlock("div",Nt,[g[0]||(g[0]=s.createElementVNode("h4",null,"JSON Parse Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(l.value),1)]))])],2))}}),[["__scopeId","data-v-7a477244"]]),wt={key:0,class:"xml-node__comment"},Tt={key:1,class:"xml-node__cdata"},Ot={key:2,class:"xml-node__element"},Bt={key:0,class:"xml-node__line"},St={key:1,class:"xml-node__line"},Pt={key:2},$t={class:"xml-node__line"},Vt=["title"],It={key:1},vt=["title"],Lt={key:0,class:"xml-node__children"},jt={key:0,class:"xml-node__text"},Rt={key:1,class:"xml-node__line"},Mt=ie(s.defineComponent({__name:"XmlNode",props:{node:{},index:{},level:{default:0},parentPath:{default:""},expanded:{},theme:{}},emits:["toggle-expand","copy"],setup(r,{emit:e}){const t=r,o=e,n=s.computed(()=>Object.keys(t.node).find(O=>!O.startsWith(":")&&!O.startsWith("#"))||""),i=s.computed(()=>n.value?t.parentPath?`${t.parentPath}[${t.index}]`:`${n.value}[${t.index}]`:""),l=s.computed(()=>t.expanded.has(i.value)),d=s.computed(()=>t.node["#comment"]?"comment":t.node.__cdata?"cdata":n.value?"element":"unknown"),a=s.computed(()=>{const m=t.node[":@"]||{},O={};return Object.keys(m).forEach(_=>{_.startsWith("@_")&&(O[_.substring(2)]=m[_])}),O}),c=s.computed(()=>{if(d.value!=="element"||!n.value)return[];const m=t.node[n.value];return Array.isArray(m)?m:[]}),p=s.computed(()=>c.value.some(m=>m.__cdata)),h=s.computed(()=>{if(!p.value)return"";const m=c.value.find(O=>O.__cdata);if(m&&Array.isArray(m.__cdata)){const O=m.__cdata;if(O.length>0&&O[0]["#text"])return O[0]["#text"]}return""}),E=s.computed(()=>{if(d.value!=="element"||!n.value||p.value)return"";const m=t.node[n.value];if(!Array.isArray(m))return"";const O=m.find(_=>_["#text"]);return O?O["#text"]:""}),y=s.computed(()=>{if(d.value!=="comment")return"";const m=t.node["#comment"];return Array.isArray(m)&&m.length>0&&m[0]["#text"]||""}),A=s.computed(()=>c.value.some(m=>Object.keys(m).some(_=>!_.startsWith("#")&&!_.startsWith(":")))),B=s.computed(()=>d.value==="element"&&!A.value&&E.value.trim()!==""),x=()=>{A.value&&o("toggle-expand",i.value)},V=(m,O)=>`${i.value}-child-${O}`,j=()=>`${i.value}.${n.value}`;return(m,O)=>{const _=s.resolveComponent("XmlNode",!0);return s.openBlock(),s.createElementBlock("div",{class:"xml-node",style:s.normalizeStyle({paddingLeft:m.level>0?"16px":"0"})},[d.value==="comment"?(s.openBlock(),s.createElementBlock("div",wt,[s.createElementVNode("span",{style:s.normalizeStyle({color:m.theme.colors.xmlComment})}," <!-- "+s.toDisplayString(y.value)+" --> ",5)])):d.value==="cdata"?(s.openBlock(),s.createElementBlock("div",Tt,[s.createElementVNode("span",{style:s.normalizeStyle({color:m.theme.colors.xmlCdata})}," <![CDATA["+s.toDisplayString(m.node.__cdata)+"]]> ",5)])):d.value==="element"?(s.openBlock(),s.createElementBlock("div",Ot,[p.value?(s.openBlock(),s.createElementBlock("div",Bt,[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"<",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,(w,S)=>(s.openBlock(),s.createElementBlock("span",{key:S,class:"xml-node__attribute"},[s.createElementVNode("span",{class:"xml-node__attr-name",style:s.normalizeStyle({color:m.theme.colors.xmlAttribute})},s.toDisplayString(S),5),s.createElementVNode("span",{class:"xml-node__equals",style:s.normalizeStyle({color:m.theme.colors.xmlEquals})},"=",4),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4),s.createElementVNode("span",{class:"xml-node__attr-value",style:s.normalizeStyle({color:m.theme.colors.xmlAttributeValue})},s.toDisplayString(w),5),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4)]))),128)),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4),s.createElementVNode("span",{class:"xml-node__cdata",style:s.normalizeStyle({color:m.theme.colors.xmlCdata})},"<![CDATA["+s.toDisplayString(h.value)+"]]>",5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"</",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4)])):B.value?(s.openBlock(),s.createElementBlock("div",St,[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"<",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,(w,S)=>(s.openBlock(),s.createElementBlock("span",{key:S,class:"xml-node__attribute"},[s.createElementVNode("span",{class:"xml-node__attr-name",style:s.normalizeStyle({color:m.theme.colors.xmlAttribute})},s.toDisplayString(S),5),s.createElementVNode("span",{class:"xml-node__equals",style:s.normalizeStyle({color:m.theme.colors.xmlEquals})},"=",4),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4),s.createElementVNode("span",{class:"xml-node__attr-value",style:s.normalizeStyle({color:m.theme.colors.xmlAttributeValue})},s.toDisplayString(w),5),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4)]))),128)),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4),s.createElementVNode("span",{class:"xml-node__text-content",style:s.normalizeStyle({color:m.theme.colors.xmlText})},s.toDisplayString(E.value),5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"</",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4)])):(s.openBlock(),s.createElementBlock("div",Pt,[s.createElementVNode("div",$t,[A.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"xml-node__clickable-part",onClick:O[0]||(O[0]=w=>x()),title:l.value?"Click to collapse":"Click to expand"},[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"<",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5)],8,Vt)):(s.openBlock(),s.createElementBlock("span",It,[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"<",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5)])),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,(w,S)=>(s.openBlock(),s.createElementBlock("span",{key:S,class:"xml-node__attribute"},[s.createElementVNode("span",{class:"xml-node__attr-name",style:s.normalizeStyle({color:m.theme.colors.xmlAttribute})},s.toDisplayString(S),5),s.createElementVNode("span",{class:"xml-node__equals",style:s.normalizeStyle({color:m.theme.colors.xmlEquals})},"=",4),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4),s.createElementVNode("span",{class:"xml-node__attr-value",style:s.normalizeStyle({color:m.theme.colors.xmlAttributeValue})},s.toDisplayString(w),5),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4)]))),128)),A.value?(s.openBlock(),s.createElementBlock("span",{key:2,class:"xml-node__clickable-part",onClick:O[1]||(O[1]=w=>x()),title:l.value?"Click to collapse":"Click to expand"},[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4)],8,vt)):(s.openBlock(),s.createElementBlock("span",{key:3,class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},s.toDisplayString(A.value?">":"/>"),5)),!l.value&&A.value?(s.openBlock(),s.createElementBlock("span",{key:4,class:"xml-node__collapsed xml-node__collapsed--clickable",style:s.normalizeStyle({color:m.theme.colors.textSecondary}),onClick:O[2]||(O[2]=w=>x()),title:"Click to expand"},"...",4)):s.createCommentVNode("",!0)]),l.value&&A.value?(s.openBlock(),s.createElementBlock("div",Lt,[c.value.length===0&&E.value.trim()?(s.openBlock(),s.createElementBlock("div",jt,[s.createElementVNode("span",{class:"xml-node__text-content",style:s.normalizeStyle({color:m.theme.colors.xmlText})},s.toDisplayString(E.value),5)])):s.createCommentVNode("",!0),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(c.value,(w,S)=>(s.openBlock(),s.createBlock(_,{key:V(w,S),node:w,index:S,level:m.level+1,"parent-path":j(),expanded:m.expanded,theme:m.theme,onToggleExpand:O[3]||(O[3]=L=>m.$emit("toggle-expand",L)),onCopy:O[4]||(O[4]=L=>m.$emit("copy",L))},null,8,["node","index","level","parent-path","expanded","theme"]))),128))])):s.createCommentVNode("",!0),l.value&&A.value?(s.openBlock(),s.createElementBlock("div",Rt,[s.createElementVNode("span",{class:"xml-node__clickable-part",onClick:O[5]||(O[5]=w=>x()),title:"Click to collapse"},[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"</",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4)])])):s.createCommentVNode("",!0)]))])):s.createCommentVNode("",!0)],4)}}}),[["__scopeId","data-v-9c0c90fa"]]),Ee={"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"}},"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"}},"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"}},"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"}}},Ut=r=>Ee[r]||Ee["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",Ft=_e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Xt="["+_e+"]["+Ft+"]*",zt=new RegExp("^"+Xt+"$");function xe(r,e){const t=[];let o=e.exec(r);for(;o;){const n=[];n.startIndex=e.lastIndex-o[0].length;const i=o.length;for(let l=0;l<i;l++)n.push(o[l]);t.push(n),o=e.exec(r)}return t}const le=function(r){const e=zt.exec(r);return!(e===null||typeof e>"u")};function Ht(r){return typeof r<"u"}const Kt={allowBooleanAttributes:!1,unpairedTags:[]};function ke(r,e){e=Object.assign({},Kt,e);const t=[];let o=!1,n=!1;r[0]==="\uFEFF"&&(r=r.substr(1));for(let i=0;i<r.length;i++)if(r[i]==="<"&&r[i+1]==="?"){if(i+=2,i=Ae(r,i),i.err)return i}else if(r[i]==="<"){let l=i;if(i++,r[i]==="!"){i=Ce(r,i);continue}else{let d=!1;r[i]==="/"&&(d=!0,i++);let a="";for(;i<r.length&&r[i]!==">"&&r[i]!==" "&&r[i]!==" "&&r[i]!==`
|
|
8
|
+
`)(i.value),a.value=g;else throw new Error(`Unsupported filter type: ${f.type}`);c.value="",s.nextTick(()=>{T()})}catch(g){c.value=g instanceof Error?g.message:"Filter execution error",a.value=null}},B=()=>{a.value=null,c.value=""};s.watch(()=>o.modelValue,f=>{y(f)},{immediate:!0});const x=(f,g,N)=>{const k=$=>{if($===null||typeof $!="object")return $;if(!Array.isArray($)&&"__protected_number__"in $&&Object.keys($).length===1)return`__PROTECTED_NUMBER_${$.__protected_number__}_PROTECTED_NUMBER__`;if(Array.isArray($))return $.map(M=>k(M));const R={};for(const[M,q]of Object.entries($))R[M]=k(q);return R},C=k(f);return JSON.stringify(C,g,N).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g,"$1")},V=(f,g)=>{if(!o.readonly)try{const N=j(i.value,f,g),k=x(N,null,2);n("update:modelValue",k)}catch(N){console.error("Failed to update JSON:",N)}},j=(f,g,N)=>{if(!g||g==="root")return N;const k=g.split("."),C=X(f,k.slice(0,-1));let O=C;for(let R=0;R<k.length-1;R++){const M=k[R];M!=="root"&&(Array.isArray(O)?O=O[parseInt(M)]:O=O[M])}const $=k[k.length-1];return $==="root"?N:(Array.isArray(O)?O[parseInt($)]=N:O[$]=N,C)},m=f=>{d.value.has(f)?d.value.delete(f):d.value.add(f)},T=()=>{const f=new Set,g=(N,k="")=>{N!==null&&typeof N=="object"&&(f.add(k||"root"),Array.isArray(N)?N.forEach((C,O)=>{const $=k?`${k}.${O}`:`${O}`;g(C,$)}):Object.keys(N).forEach(C=>{const O=k?`${k}.${C}`:C;g(N[C],O)}))};g(E.value),d.value=f,n("expand-all")},_=()=>{d.value=new Set(["root"]),n("collapse-all")},w=async()=>{if(p.value)try{const f=E.value,g=x(f,null,2);await navigator.clipboard.writeText(g),n("copy-success",g)}catch(f){console.error("Failed to copy JSON:",f),n("copy-error",f instanceof Error?f:new Error("Failed to copy JSON"))}},S=()=>{if(p.value)try{const f=E.value,g=x(f);n("update:modelValue",g),n("compress",g)}catch(f){console.error("Failed to compress JSON:",f)}},L=async f=>{try{let g;typeof f=="object"&&f!==null&&!Array.isArray(f)&&"__protected_number__"in f&&Object.keys(f).length===1?g=f.__protected_number__:typeof f=="string"?g=`"${f}"`:g=JSON.stringify(f),await navigator.clipboard.writeText(g)}catch(g){console.error("Failed to copy value:",g)}},K=(f,g)=>{if(!o.readonly)try{const N=F(i.value,f,g),k=x(N,null,2);n("update:modelValue",k),b(f,g)}catch(N){console.error("Failed to rename key:",N)}},F=(f,g,N)=>{if(!g||g==="root")return f;const k=g.split("."),C=X(f,k.slice(0,-1));if(k.length===1){const R=k[0];return C&&typeof C=="object"&&!Array.isArray(C)?W(C,R,N):C}let O=C;for(let R=0;R<k.length-1;R++){const M=k[R];Array.isArray(O)?O=O[parseInt(M)]:O=O[M]}const $=k[k.length-1];if(!Array.isArray(O)&&O&&typeof O=="object"){const R=W(O,$,N),M=k.slice(0,-1);M.length>0&&re(C,M,R)}return C},X=(f,g)=>{if(g.length===0)return f;if(Array.isArray(f)){const N=[...f],k=g[0],C=parseInt(k);return g.length===1||(N[C]=X(f[C],g.slice(1))),N}else if(f&&typeof f=="object"){const N={...f},k=g[0];return g.length===1||(N[k]=X(f[k],g.slice(1))),N}return f},W=(f,g,N)=>{if(!f||typeof f!="object"||Array.isArray(f))return f;const k=Object.keys(f),C={};for(const O of k)O===g?C[N]=f[O]:C[O]=f[O];return C},re=(f,g,N)=>{let k=f;for(let O=0;O<g.length-1;O++){const $=g[O];Array.isArray(k)?k=k[parseInt($)]:k=k[$]}const C=g[g.length-1];Array.isArray(k)?k[parseInt(C)]=N:k[C]=N},b=(f,g)=>{const N=new Set;d.value.forEach(k=>{if(k===f){const C=f.split(".");C[C.length-1]=g,N.add(C.join("."))}else if(k.startsWith(f+".")){const C=f.split(".");C[C.length-1]=g;const O=C.join("."),$=k.substring(f.length);N.add(O+$)}else N.add(k)}),d.value=N};return e({copyJson:w,compressSource:S,expandAll:T,collapseAll:_,toggleExpand:m,updateValue:V,updateKey:K,filter:A,clearFilter:B,isValidJson:()=>p.value,getParsedJson:()=>i.value,getFilteredJson:()=>a.value,getExpandedNodes:()=>d.value,getParseError:()=>l.value,getFilterError:()=>c.value,parseJson:f=>y(f),copyValue:f=>L(f)}),(f,g)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["json-format",`json-format--${h.value.name}`])},[f.showToolbar?(s.openBlock(),s.createElementBlock("div",ht,[s.createElementVNode("div",pt,[s.createElementVNode("button",{class:"json-format__btn json-format__btn--primary",onClick:w,disabled:!p.value,title:"Copy JSON"}," 📋 Copy ",8,mt),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:T,disabled:!p.value,title:"Expand All"}," ⬇️ Expand All ",8,gt),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:_,disabled:!p.value,title:"Collapse All"}," ➡️ Collapse All ",8,yt),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:S,disabled:!p.value,title:"Compress JSON"}," 📦 Compress ",8,bt)]),s.createElementVNode("div",Et,[p.value?(s.openBlock(),s.createElementBlock("span",_t," ✅ Valid JSON ")):(s.openBlock(),s.createElementBlock("span",xt," ❌ Invalid JSON "))])])):s.createCommentVNode("",!0),s.createElementVNode("div",kt,[p.value?c.value?(s.openBlock(),s.createElementBlock("div",At,[g[1]||(g[1]=s.createElementVNode("h4",null,"Filter Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(c.value),1)])):(s.openBlock(),s.createElementBlock("div",Ct,[s.createVNode(dt,{value:E.value,"key-name":"",level:0,expanded:d.value,"is-last":!0,theme:h.value,"onUpdate:value":V,onToggleExpand:m,onCopy:L,"onUpdate:key":K},null,8,["value","expanded","theme"])])):(s.openBlock(),s.createElementBlock("div",Nt,[g[0]||(g[0]=s.createElementVNode("h4",null,"JSON Parse Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(l.value),1)]))])],2))}}),[["__scopeId","data-v-b956002c"]]),wt={key:0,class:"xml-node__comment"},Ot={key:1,class:"xml-node__cdata"},Tt={key:2,class:"xml-node__element"},Bt={key:0,class:"xml-node__line"},St={key:1,class:"xml-node__line"},Pt={key:2},$t={class:"xml-node__line"},Vt=["title"],It={key:1},vt=["title"],Lt={key:0,class:"xml-node__children"},jt={key:0,class:"xml-node__text"},Rt={key:1,class:"xml-node__line"},Mt=ie(s.defineComponent({__name:"XmlNode",props:{node:{},index:{},level:{default:0},parentPath:{default:""},expanded:{},theme:{}},emits:["toggle-expand","copy"],setup(r,{emit:e}){const t=r,o=e,n=s.computed(()=>Object.keys(t.node).find(T=>!T.startsWith(":")&&!T.startsWith("#"))||""),i=s.computed(()=>n.value?t.parentPath?`${t.parentPath}[${t.index}]`:`${n.value}[${t.index}]`:""),l=s.computed(()=>t.expanded.has(i.value)),d=s.computed(()=>t.node["#comment"]?"comment":t.node.__cdata?"cdata":n.value?"element":"unknown"),a=s.computed(()=>{const m=t.node[":@"]||{},T={};return Object.keys(m).forEach(_=>{_.startsWith("@_")&&(T[_.substring(2)]=m[_])}),T}),c=s.computed(()=>{if(d.value!=="element"||!n.value)return[];const m=t.node[n.value];return Array.isArray(m)?m:[]}),p=s.computed(()=>c.value.some(m=>m.__cdata)),h=s.computed(()=>{if(!p.value)return"";const m=c.value.find(T=>T.__cdata);if(m&&Array.isArray(m.__cdata)){const T=m.__cdata;if(T.length>0&&T[0]["#text"])return T[0]["#text"]}return""}),E=s.computed(()=>{if(d.value!=="element"||!n.value||p.value)return"";const m=t.node[n.value];if(!Array.isArray(m))return"";const T=m.find(_=>_["#text"]);return T?T["#text"]:""}),y=s.computed(()=>{if(d.value!=="comment")return"";const m=t.node["#comment"];return Array.isArray(m)&&m.length>0&&m[0]["#text"]||""}),A=s.computed(()=>c.value.some(m=>Object.keys(m).some(_=>!_.startsWith("#")&&!_.startsWith(":")))),B=s.computed(()=>d.value==="element"&&!A.value&&E.value.trim()!==""),x=()=>{A.value&&o("toggle-expand",i.value)},V=(m,T)=>`${i.value}-child-${T}`,j=()=>`${i.value}.${n.value}`;return(m,T)=>{const _=s.resolveComponent("XmlNode",!0);return s.openBlock(),s.createElementBlock("div",{class:"xml-node",style:s.normalizeStyle({paddingLeft:m.level>0?"16px":"0"})},[d.value==="comment"?(s.openBlock(),s.createElementBlock("div",wt,[s.createElementVNode("span",{style:s.normalizeStyle({color:m.theme.colors.xmlComment})}," <!-- "+s.toDisplayString(y.value)+" --> ",5)])):d.value==="cdata"?(s.openBlock(),s.createElementBlock("div",Ot,[s.createElementVNode("span",{style:s.normalizeStyle({color:m.theme.colors.xmlCdata})}," <![CDATA["+s.toDisplayString(m.node.__cdata)+"]]> ",5)])):d.value==="element"?(s.openBlock(),s.createElementBlock("div",Tt,[p.value?(s.openBlock(),s.createElementBlock("div",Bt,[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"<",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,(w,S)=>(s.openBlock(),s.createElementBlock("span",{key:S,class:"xml-node__attribute"},[s.createElementVNode("span",{class:"xml-node__attr-name",style:s.normalizeStyle({color:m.theme.colors.xmlAttribute})},s.toDisplayString(S),5),s.createElementVNode("span",{class:"xml-node__equals",style:s.normalizeStyle({color:m.theme.colors.xmlEquals})},"=",4),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4),s.createElementVNode("span",{class:"xml-node__attr-value",style:s.normalizeStyle({color:m.theme.colors.xmlAttributeValue})},s.toDisplayString(w),5),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4)]))),128)),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4),s.createElementVNode("span",{class:"xml-node__cdata",style:s.normalizeStyle({color:m.theme.colors.xmlCdata})},"<![CDATA["+s.toDisplayString(h.value)+"]]>",5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"</",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4)])):B.value?(s.openBlock(),s.createElementBlock("div",St,[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"<",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,(w,S)=>(s.openBlock(),s.createElementBlock("span",{key:S,class:"xml-node__attribute"},[s.createElementVNode("span",{class:"xml-node__attr-name",style:s.normalizeStyle({color:m.theme.colors.xmlAttribute})},s.toDisplayString(S),5),s.createElementVNode("span",{class:"xml-node__equals",style:s.normalizeStyle({color:m.theme.colors.xmlEquals})},"=",4),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4),s.createElementVNode("span",{class:"xml-node__attr-value",style:s.normalizeStyle({color:m.theme.colors.xmlAttributeValue})},s.toDisplayString(w),5),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4)]))),128)),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4),s.createElementVNode("span",{class:"xml-node__text-content",style:s.normalizeStyle({color:m.theme.colors.xmlText})},s.toDisplayString(E.value),5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"</",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4)])):(s.openBlock(),s.createElementBlock("div",Pt,[s.createElementVNode("div",$t,[A.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"xml-node__clickable-part",onClick:T[0]||(T[0]=w=>x()),title:l.value?"Click to collapse":"Click to expand"},[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"<",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5)],8,Vt)):(s.openBlock(),s.createElementBlock("span",It,[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"<",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5)])),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,(w,S)=>(s.openBlock(),s.createElementBlock("span",{key:S,class:"xml-node__attribute"},[s.createElementVNode("span",{class:"xml-node__attr-name",style:s.normalizeStyle({color:m.theme.colors.xmlAttribute})},s.toDisplayString(S),5),s.createElementVNode("span",{class:"xml-node__equals",style:s.normalizeStyle({color:m.theme.colors.xmlEquals})},"=",4),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4),s.createElementVNode("span",{class:"xml-node__attr-value",style:s.normalizeStyle({color:m.theme.colors.xmlAttributeValue})},s.toDisplayString(w),5),s.createElementVNode("span",{class:"xml-node__quote",style:s.normalizeStyle({color:m.theme.colors.xmlQuote})},'"',4)]))),128)),A.value?(s.openBlock(),s.createElementBlock("span",{key:2,class:"xml-node__clickable-part",onClick:T[1]||(T[1]=w=>x()),title:l.value?"Click to collapse":"Click to expand"},[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4)],8,vt)):(s.openBlock(),s.createElementBlock("span",{key:3,class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},s.toDisplayString(A.value?">":"/>"),5)),!l.value&&A.value?(s.openBlock(),s.createElementBlock("span",{key:4,class:"xml-node__collapsed xml-node__collapsed--clickable",style:s.normalizeStyle({color:m.theme.colors.textSecondary}),onClick:T[2]||(T[2]=w=>x()),title:"Click to expand"},"...",4)):s.createCommentVNode("",!0)]),l.value&&A.value?(s.openBlock(),s.createElementBlock("div",Lt,[c.value.length===0&&E.value.trim()?(s.openBlock(),s.createElementBlock("div",jt,[s.createElementVNode("span",{class:"xml-node__text-content",style:s.normalizeStyle({color:m.theme.colors.xmlText})},s.toDisplayString(E.value),5)])):s.createCommentVNode("",!0),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(c.value,(w,S)=>(s.openBlock(),s.createBlock(_,{key:V(w,S),node:w,index:S,level:m.level+1,"parent-path":j(),expanded:m.expanded,theme:m.theme,onToggleExpand:T[3]||(T[3]=L=>m.$emit("toggle-expand",L)),onCopy:T[4]||(T[4]=L=>m.$emit("copy",L))},null,8,["node","index","level","parent-path","expanded","theme"]))),128))])):s.createCommentVNode("",!0),l.value&&A.value?(s.openBlock(),s.createElementBlock("div",Rt,[s.createElementVNode("span",{class:"xml-node__clickable-part",onClick:T[5]||(T[5]=w=>x()),title:"Click to collapse"},[s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},"</",4),s.createElementVNode("span",{class:"xml-node__tag",style:s.normalizeStyle({color:m.theme.colors.xmlTag})},s.toDisplayString(n.value),5),s.createElementVNode("span",{class:"xml-node__bracket",style:s.normalizeStyle({color:m.theme.colors.xmlBracket})},">",4)])])):s.createCommentVNode("",!0)]))])):s.createCommentVNode("",!0)],4)}}}),[["__scopeId","data-v-9c0c90fa"]]),Ee={"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"}},"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"}},"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"}},"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"}}},Ut=r=>Ee[r]||Ee["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",Ft=_e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Xt="["+_e+"]["+Ft+"]*",zt=new RegExp("^"+Xt+"$");function xe(r,e){const t=[];let o=e.exec(r);for(;o;){const n=[];n.startIndex=e.lastIndex-o[0].length;const i=o.length;for(let l=0;l<i;l++)n.push(o[l]);t.push(n),o=e.exec(r)}return t}const le=function(r){const e=zt.exec(r);return!(e===null||typeof e>"u")};function Kt(r){return typeof r<"u"}const Ht={allowBooleanAttributes:!1,unpairedTags:[]};function ke(r,e){e=Object.assign({},Ht,e);const t=[];let o=!1,n=!1;r[0]==="\uFEFF"&&(r=r.substr(1));for(let i=0;i<r.length;i++)if(r[i]==="<"&&r[i+1]==="?"){if(i+=2,i=Ae(r,i),i.err)return i}else if(r[i]==="<"){let l=i;if(i++,r[i]==="!"){i=Ce(r,i);continue}else{let d=!1;r[i]==="/"&&(d=!0,i++);let a="";for(;i<r.length&&r[i]!==">"&&r[i]!==" "&&r[i]!==" "&&r[i]!==`
|
|
9
9
|
`&&r[i]!=="\r";i++)a+=r[i];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),i--),!Jt(a)){let h;return a.trim().length===0?h="Invalid space after '<'.":h="Tag '"+a+"' is an invalid name.",v("InvalidTag",h,U(r,i))}const c=Qt(r,i);if(c===!1)return v("InvalidAttr","Attributes for '"+a+"' have open quote.",U(r,i));let p=c.value;if(i=c.index,p[p.length-1]==="/"){const h=i-p.length;p=p.substring(0,p.length-1);const E=we(p,e);if(E===!0)o=!0;else return v(E.err.code,E.err.msg,U(r,h+E.err.line))}else if(d)if(c.tagClosed){if(p.trim().length>0)return v("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",U(r,l));if(t.length===0)return v("InvalidTag","Closing tag '"+a+"' has not been opened.",U(r,l));{const h=t.pop();if(a!==h.tagName){let E=U(r,h.tagStartPos);return v("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+E.line+", col "+E.col+") instead of closing tag '"+a+"'.",U(r,l))}t.length==0&&(n=!0)}}else return v("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",U(r,i));else{const h=we(p,e);if(h!==!0)return v(h.err.code,h.err.msg,U(r,i-p.length+h.err.line));if(n===!0)return v("InvalidXml","Multiple possible root nodes found.",U(r,i));e.unpairedTags.indexOf(a)!==-1||t.push({tagName:a,tagStartPos:l}),o=!0}for(i++;i<r.length;i++)if(r[i]==="<")if(r[i+1]==="!"){i++,i=Ce(r,i);continue}else if(r[i+1]==="?"){if(i=Ae(r,++i),i.err)return i}else break;else if(r[i]==="&"){const h=Zt(r,i);if(h==-1)return v("InvalidChar","char '&' is not expected.",U(r,i));i=h}else if(n===!0&&!Ne(r[i]))return v("InvalidXml","Extra text at the end",U(r,i));r[i]==="<"&&i--}}else{if(Ne(r[i]))continue;return v("InvalidChar","char '"+r[i]+"' is not expected.",U(r,i))}if(o){if(t.length==1)return v("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",U(r,t[0].tagStartPos));if(t.length>0)return v("InvalidXml","Invalid '"+JSON.stringify(t.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return v("InvalidXml","Start tag expected.",1);return!0}function Ne(r){return r===" "||r===" "||r===`
|
|
10
|
-
`||r==="\r"}function Ae(r,e){const t=e;for(;e<r.length;e++)if(r[e]=="?"||r[e]==" "){const o=r.substr(t,e-t);if(e>5&&o==="xml")return v("InvalidXml","XML declaration allowed only at the start of the document.",U(r,e));if(r[e]=="?"&&r[e+1]==">"){e++;break}else continue}return e}function Ce(r,e){if(r.length>e+5&&r[e+1]==="-"&&r[e+2]==="-"){for(e+=3;e<r.length;e++)if(r[e]==="-"&&r[e+1]==="-"&&r[e+2]===">"){e+=2;break}}else if(r.length>e+8&&r[e+1]==="D"&&r[e+2]==="O"&&r[e+3]==="C"&&r[e+4]==="T"&&r[e+5]==="Y"&&r[e+6]==="P"&&r[e+7]==="E"){let t=1;for(e+=8;e<r.length;e++)if(r[e]==="<")t++;else if(r[e]===">"&&(t--,t===0))break}else if(r.length>e+9&&r[e+1]==="["&&r[e+2]==="C"&&r[e+3]==="D"&&r[e+4]==="A"&&r[e+5]==="T"&&r[e+6]==="A"&&r[e+7]==="["){for(e+=8;e<r.length;e++)if(r[e]==="]"&&r[e+1]==="]"&&r[e+2]===">"){e+=2;break}}return e}const qt='"',Yt="'";function Qt(r,e){let t="",o="",n=!1;for(;e<r.length;e++){if(r[e]===qt||r[e]===Yt)o===""?o=r[e]:o!==r[e]||(o="");else if(r[e]===">"&&o===""){n=!0;break}t+=r[e]}return o!==""?!1:{value:t,index:e,tagClosed:n}}const Wt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function we(r,e){const t=xe(r,Wt),o={};for(let n=0;n<t.length;n++){if(t[n][1].length===0)return v("InvalidAttr","Attribute '"+t[n][2]+"' has no space in starting.",oe(t[n]));if(t[n][3]!==void 0&&t[n][4]===void 0)return v("InvalidAttr","Attribute '"+t[n][2]+"' is without value.",oe(t[n]));if(t[n][3]===void 0&&!e.allowBooleanAttributes)return v("InvalidAttr","boolean attribute '"+t[n][2]+"' is not allowed.",oe(t[n]));const i=t[n][2];if(!Dt(i))return v("InvalidAttr","Attribute '"+i+"' is an invalid name.",oe(t[n]));if(!o.hasOwnProperty(i))o[i]=1;else return v("InvalidAttr","Attribute '"+i+"' is repeated.",oe(t[n]))}return!0}function Gt(r,e){let t=/\d/;for(r[e]==="x"&&(e++,t=/[\da-fA-F]/);e<r.length;e++){if(r[e]===";")return e;if(!r[e].match(t))break}return-1}function Zt(r,e){if(e++,r[e]===";")return-1;if(r[e]==="#")return e++,Gt(r,e);let t=0;for(;e<r.length;e++,t++)if(!(r[e].match(/\w/)&&t<20)){if(r[e]===";")break;return-1}return e}function v(r,e,t){return{err:{code:r,msg:e,line:t.line||t,col:t.col}}}function Dt(r){return le(r)}function Jt(r){return le(r)}function U(r,e){const t=r.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function oe(r){return r.startIndex+r[1].length}const er={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(r,e){return e},attributeValueProcessor:function(r,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(r,e,t){return r},captureMetaData:!1},tr=function(r){return Object.assign({},er,r)};let ae;typeof Symbol!="function"?ae="@@xmlMetadata":ae=Symbol("XML Node Metadata");class D{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][ae]={startIndex:t})}static getMetaDataSymbol(){return ae}}class rr{constructor(e){this.suppressValidationErr=!e}readDocType(e,t){const o={};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 n=1,i=!1,l=!1,d="";for(;t<e.length;t++)if(e[t]==="<"&&!l){if(i&&J(e,"!ENTITY",t)){t+=7;let a,c;[a,c,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),c.indexOf("&")===-1&&(o[a]={regx:RegExp(`&${a};`,"g"),val:c})}else if(i&&J(e,"!ELEMENT",t)){t+=8;const{index:a}=this.readElementExp(e,t+1);t=a}else if(i&&J(e,"!ATTLIST",t))t+=8;else if(i&&J(e,"!NOTATION",t)){t+=9;const{index:a}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=a}else if(J(e,"!--",t))l=!0;else throw new Error("Invalid DOCTYPE");n++,d=""}else if(e[t]===">"){if(l?e[t-1]==="-"&&e[t-2]==="-"&&(l=!1,n--):n--,n===0)break}else e[t]==="["?i=!0:d+=e[t];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:o,i:t}}readEntityExp(e,t){t=z(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)o+=e[t],t++;if(se(o),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 n="";return[t,n]=this.readIdentifierVal(e,t,"entity"),t--,[o,n,t]}readNotationExp(e,t){t=z(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t]);)o+=e[t],t++;!this.suppressValidationErr&&se(o),t=z(e,t);const n=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&n!=="SYSTEM"&&n!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);t+=n.length,t=z(e,t);let i=null,l=null;if(n==="PUBLIC")[t,i]=this.readIdentifierVal(e,t,"publicIdentifier"),t=z(e,t),(e[t]==='"'||e[t]==="'")&&([t,l]=this.readIdentifierVal(e,t,"systemIdentifier"));else if(n==="SYSTEM"&&([t,l]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!l))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:o,publicIdentifier:i,systemIdentifier:l,index:--t}}readIdentifierVal(e,t,o){let n="";const i=e[t];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);for(t++;t<e.length&&e[t]!==i;)n+=e[t],t++;if(e[t]!==i)throw new Error(`Unterminated ${o} value`);return t++,[t,n]}readElementExp(e,t){t=z(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t]);)o+=e[t],t++;if(!this.suppressValidationErr&&!le(o))throw new Error(`Invalid element name: "${o}"`);t=z(e,t);let n="";if(e[t]==="E"&&J(e,"MPTY",t))t+=4;else if(e[t]==="A"&&J(e,"NY",t))t+=2;else if(e[t]==="("){for(t++;t<e.length&&e[t]!==")";)n+=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:o,contentModel:n.trim(),index:t}}readAttlistExp(e,t){t=z(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t]);)o+=e[t],t++;se(o),t=z(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;if(!se(n))throw new Error(`Invalid attribute name: "${n}"`);t=z(e,t);let i="";if(e.substring(t,t+8).toUpperCase()==="NOTATION"){if(i="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 a="";for(;t<e.length&&e[t]!=="|"&&e[t]!==")";)a+=e[t],t++;if(a=a.trim(),!se(a))throw new Error(`Invalid notation name: "${a}"`);d.push(a),e[t]==="|"&&(t++,t=z(e,t))}if(e[t]!==")")throw new Error("Unterminated list of notations");t++,i+=" ("+d.join("|")+")"}else{for(;t<e.length&&!/\s/.test(e[t]);)i+=e[t],t++;const d=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!d.includes(i.toUpperCase()))throw new Error(`Invalid attribute type: "${i}"`)}t=z(e,t);let l="";return e.substring(t,t+8).toUpperCase()==="#REQUIRED"?(l="#REQUIRED",t+=8):e.substring(t,t+7).toUpperCase()==="#IMPLIED"?(l="#IMPLIED",t+=7):[t,l]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:o,attributeName:n,attributeType:i,defaultValue:l,index:t}}}const z=(r,e)=>{for(;e<r.length&&/\s/.test(r[e]);)e++;return e};function J(r,e,t){for(let o=0;o<e.length;o++)if(e[o]!==r[t+o+1])return!1;return!0}function se(r){if(le(r))return r;throw new Error(`Invalid entity name ${r}`)}const nr=/^[-+]?0x[a-fA-F0-9]+$/,or=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,sr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function ir(r,e={}){if(e=Object.assign({},sr,e),!r||typeof r!="string")return r;let t=r.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return r;if(r==="0")return 0;if(e.hex&&nr.test(t))return dr(t,16);if(t.search(/.+[eE].+/)!==-1)return ar(r,t,e);{const o=or.exec(t);if(o){const n=o[1]||"",i=o[2];let l=cr(o[3]);const d=n?r[i.length+1]===".":r[i.length]===".";if(!e.leadingZeros&&(i.length>1||i.length===1&&!d))return r;{const a=Number(t),c=String(a);if(a===0)return a;if(c.search(/[eE]/)!==-1)return e.eNotation?a:r;if(t.indexOf(".")!==-1)return c==="0"||c===l||c===`${n}${l}`?a:r;let p=i?l:t;return i?p===c||n+p===c?a:r:p===c||p===n+c?a:r}}else return r}}const lr=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function ar(r,e,t){if(!t.eNotation)return r;const o=e.match(lr);if(o){let n=o[1]||"";const i=o[3].indexOf("e")===-1?"E":"e",l=o[2],d=n?r[l.length+1]===i:r[l.length]===i;return l.length>1&&d?r:l.length===1&&(o[3].startsWith(`.${i}`)||o[3][0]===i)?Number(e):t.leadingZeros&&!d?(e=(o[1]||"")+o[3],Number(e)):r}else return r}function cr(r){return r&&r.indexOf(".")!==-1&&(r=r.replace(/0+$/,""),r==="."?r="0":r[0]==="."?r="0"+r:r[r.length-1]==="."&&(r=r.substring(0,r.length-1))),r}function dr(r,e){if(parseInt)return parseInt(r,e);if(Number.parseInt)return Number.parseInt(r,e);if(window&&window.parseInt)return window.parseInt(r,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Te(r){return typeof r=="function"?r:Array.isArray(r)?e=>{for(const t of r)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}class ur{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,o)=>String.fromCodePoint(Number.parseInt(o,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,o)=>String.fromCodePoint(Number.parseInt(o,16))}},this.addExternalEntities=fr,this.parseXml=yr,this.parseTextData=hr,this.resolveNameSpace=pr,this.buildAttributesMap=gr,this.isItStopNode=xr,this.replaceEntitiesValue=Er,this.readStopNodeData=Nr,this.saveTextToParentTag=_r,this.addChild=br,this.ignoreAttributesFn=Te(this.options.ignoreAttributes)}}function fr(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const o=e[t];this.lastEntities[o]={regex:new RegExp("&"+o+";","g"),val:r[o]}}}function hr(r,e,t,o,n,i,l){if(r!==void 0&&(this.options.trimValues&&!o&&(r=r.trim()),r.length>0)){l||(r=this.replaceEntitiesValue(r));const d=this.options.tagValueProcessor(e,r,t,n,i);return d==null?r:typeof d!=typeof r||d!==r?d:this.options.trimValues?he(r,this.options.parseTagValue,this.options.numberParseOptions):r.trim()===r?he(r,this.options.parseTagValue,this.options.numberParseOptions):r}}function pr(r){if(this.options.removeNSPrefix){const e=r.split(":"),t=r.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(r=t+e[1])}return r}const mr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function gr(r,e,t){if(this.options.ignoreAttributes!==!0&&typeof r=="string"){const o=xe(r,mr),n=o.length,i={};for(let l=0;l<n;l++){const d=this.resolveNameSpace(o[l][1]);if(this.ignoreAttributesFn(d,e))continue;let a=o[l][4],c=this.options.attributeNamePrefix+d;if(d.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a);const p=this.options.attributeValueProcessor(d,a,e);p==null?i[c]=a:typeof p!=typeof a||p!==a?i[c]=p:i[c]=he(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[c]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const l={};return l[this.options.attributesGroupName]=i,l}return i}}const yr=function(r){r=r.replace(/\r\n?/g,`
|
|
11
|
-
`);const e=new D("!xml");let t=e,o="",n="";const i=new rr(this.options.processEntities);for(let l=0;l<r.length;l++)if(r[l]==="<")if(r[l+1]==="/"){const a=ee(r,">",l,"Closing Tag is not closed.");let c=r.substring(l+2,a).trim();if(this.options.removeNSPrefix){const E=c.indexOf(":");E!==-1&&(c=c.substr(E+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),t&&(o=this.saveTextToParentTag(o,t,n));const p=n.substring(n.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let h=0;p&&this.options.unpairedTags.indexOf(p)!==-1?(h=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=n.lastIndexOf("."),n=n.substring(0,h),t=this.tagsNodeStack.pop(),o="",l=a}else if(r[l+1]==="?"){let a=fe(r,l,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(o=this.saveTextToParentTag(o,t,n),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const c=new D(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,n,a.tagName)),this.addChild(t,c,n,l)}l=a.closeIndex+1}else if(r.substr(l+1,3)==="!--"){const a=ee(r,"-->",l+4,"Comment is not closed.");if(this.options.commentPropName){const c=r.substring(l+4,a-2);o=this.saveTextToParentTag(o,t,n),t.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}l=a}else if(r.substr(l+1,2)==="!D"){const a=i.readDocType(r,l);this.docTypeEntities=a.entities,l=a.i}else if(r.substr(l+1,2)==="!["){const a=ee(r,"]]>",l,"CDATA is not closed.")-2,c=r.substring(l+9,a);o=this.saveTextToParentTag(o,t,n);let p=this.parseTextData(c,t.tagname,n,!0,!1,!0,!0);p==null&&(p=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):t.add(this.options.textNodeName,p),l=a+2}else{let a=fe(r,l,this.options.removeNSPrefix),c=a.tagName;const p=a.rawTagName;let h=a.tagExp,E=a.attrExpPresent,y=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),t&&o&&t.tagname!=="!xml"&&(o=this.saveTextToParentTag(o,t,n,!1));const A=t;A&&this.options.unpairedTags.indexOf(A.tagname)!==-1&&(t=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),c!==e.tagname&&(n+=n?"."+c:c);const B=l;if(this.isItStopNode(this.options.stopNodes,n,c)){let x="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),n=n.substr(0,n.length-1),h=c):h=h.substr(0,h.length-1),l=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)l=a.closeIndex;else{const j=this.readStopNodeData(r,p,y+1);if(!j)throw new Error(`Unexpected end of ${p}`);l=j.i,x=j.tagContent}const V=new D(c);c!==h&&E&&(V[":@"]=this.buildAttributesMap(h,n,c)),x&&(x=this.parseTextData(x,c,n,!0,E,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),V.add(this.options.textNodeName,x),this.addChild(t,V,n,B)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),n=n.substr(0,n.length-1),h=c):h=h.substr(0,h.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const x=new D(c);c!==h&&E&&(x[":@"]=this.buildAttributesMap(h,n,c)),this.addChild(t,x,n,B),n=n.substr(0,n.lastIndexOf("."))}else{const x=new D(c);this.tagsNodeStack.push(t),c!==h&&E&&(x[":@"]=this.buildAttributesMap(h,n,c)),this.addChild(t,x,n,B),t=x}o="",l=y}}else o+=r[l];return e.child};function br(r,e,t,o){this.options.captureMetaData||(o=void 0);const n=this.options.updateTag(e.tagname,t,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),r.addChild(e,o))}const Er=function(r){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];r=r.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];r=r.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];r=r.replace(t.regex,t.val)}r=r.replace(this.ampEntity.regex,this.ampEntity.val)}return r};function _r(r,e,t,o){return r&&(o===void 0&&(o=e.child.length===0),r=this.parseTextData(r,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,o),r!==void 0&&r!==""&&e.add(this.options.textNodeName,r),r=""),r}function xr(r,e,t){const o="*."+t;for(const n in r){const i=r[n];if(o===i||e===i)return!0}return!1}function kr(r,e,t=">"){let o,n="";for(let i=e;i<r.length;i++){let l=r[i];if(o)l===o&&(o="");else if(l==='"'||l==="'")o=l;else if(l===t[0])if(t[1]){if(r[i+1]===t[1])return{data:n,index:i}}else return{data:n,index:i};else l===" "&&(l=" ");n+=l}}function ee(r,e,t,o){const n=r.indexOf(e,t);if(n===-1)throw new Error(o);return n+e.length-1}function fe(r,e,t,o=">"){const n=kr(r,e+1,o);if(!n)return;let i=n.data;const l=n.index,d=i.search(/\s/);let a=i,c=!0;d!==-1&&(a=i.substring(0,d),i=i.substring(d+1).trimStart());const p=a;if(t){const h=a.indexOf(":");h!==-1&&(a=a.substr(h+1),c=a!==n.data.substr(h+1))}return{tagName:a,tagExp:i,closeIndex:l,attrExpPresent:c,rawTagName:p}}function Nr(r,e,t){const o=t;let n=1;for(;t<r.length;t++)if(r[t]==="<")if(r[t+1]==="/"){const i=ee(r,">",t,`${e} is not closed`);if(r.substring(t+2,i).trim()===e&&(n--,n===0))return{tagContent:r.substring(o,t),i};t=i}else if(r[t+1]==="?")t=ee(r,"?>",t+1,"StopNode is not closed.");else if(r.substr(t+1,3)==="!--")t=ee(r,"-->",t+3,"StopNode is not closed.");else if(r.substr(t+1,2)==="![")t=ee(r,"]]>",t,"StopNode is not closed.")-2;else{const i=fe(r,t,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&n++,t=i.closeIndex)}}function he(r,e,t){if(e&&typeof r=="string"){const o=r.trim();return o==="true"?!0:o==="false"?!1:ir(r,t)}else return
|
|
12
|
-
`;function Sr(r,e){let t="";return e.format&&e.indentBy.length>0&&(t=Br),Be(r,e,"",t)}function Be(r,e,t,o){let n="",i=!1;for(let l=0;l<r.length;l++){const d=r[l],a=Pr(d);if(a===void 0)continue;let c="";if(t.length===0?c=a:c=`${t}.${a}`,a===e.textNodeName){let A=d[a];$r(c,e)||(A=e.tagValueProcessor(a,A),A=Pe(A,e)),i&&(n+=o),n+=A,i=!1;continue}else if(a===e.cdataPropName){i&&(n+=o),n+=`<![CDATA[${d[a][0][e.textNodeName]}]]>`,i=!1;continue}else if(a===e.commentPropName){n+=o+`<!--${d[a][0][e.textNodeName]}-->`,i=!0;continue}else if(a[0]==="?"){const A=Se(d[":@"],e),B=a==="?xml"?"":o;let x=d[a][0][e.textNodeName];x=x.length!==0?" "+x:"",n+=B+`<${a}${x}${A}?>`,i=!0;continue}let p=o;p!==""&&(p+=e.indentBy);const h=Se(d[":@"],e),E=o+`<${a}${h}`,y=Be(d[a],e,c,p);e.unpairedTags.indexOf(a)!==-1?e.suppressUnpairedNode?n+=E+">":n+=E+"/>":(!y||y.length===0)&&e.suppressEmptyNode?n+=E+"/>":y&&y.endsWith(">")?n+=E+`>${y}${o}</${a}>`:(n+=E+">",y&&o!==""&&(y.includes("/>")||y.includes("</"))?n+=o+e.indentBy+y+o:n+=y,n+=`</${a}>`),i=!0}return n}function Pr(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const o=e[t];if(r.hasOwnProperty(o)&&o!==":@")return o}}function Se(r,e){let t="";if(r&&!e.ignoreAttributes)for(let o in r){if(!r.hasOwnProperty(o))continue;let n=e.attributeValueProcessor(o,r[o]);n=Pe(n,e),n===!0&&e.suppressBooleanAttributes?t+=` ${o.substr(e.attributeNamePrefix.length)}`:t+=` ${o.substr(e.attributeNamePrefix.length)}="${n}"`}return t}function $r(r,e){r=r.substr(0,r.length-e.textNodeName.length-1);let t=r.substr(r.lastIndexOf(".")+1);for(let o in e.stopNodes)if(e.stopNodes[o]===r||e.stopNodes[o]==="*."+t)return!0;return!1}function Pe(r,e){if(r&&r.length>0&&e.processEntities)for(let t=0;t<e.entities.length;t++){const o=e.entities[t];r=r.replace(o.regex,o.val)}return r}const Vr={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(r,e){return e},attributeValueProcessor:function(r,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 Z(r){this.options=Object.assign({},Vr,r),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=
|
|
10
|
+
`||r==="\r"}function Ae(r,e){const t=e;for(;e<r.length;e++)if(r[e]=="?"||r[e]==" "){const o=r.substr(t,e-t);if(e>5&&o==="xml")return v("InvalidXml","XML declaration allowed only at the start of the document.",U(r,e));if(r[e]=="?"&&r[e+1]==">"){e++;break}else continue}return e}function Ce(r,e){if(r.length>e+5&&r[e+1]==="-"&&r[e+2]==="-"){for(e+=3;e<r.length;e++)if(r[e]==="-"&&r[e+1]==="-"&&r[e+2]===">"){e+=2;break}}else if(r.length>e+8&&r[e+1]==="D"&&r[e+2]==="O"&&r[e+3]==="C"&&r[e+4]==="T"&&r[e+5]==="Y"&&r[e+6]==="P"&&r[e+7]==="E"){let t=1;for(e+=8;e<r.length;e++)if(r[e]==="<")t++;else if(r[e]===">"&&(t--,t===0))break}else if(r.length>e+9&&r[e+1]==="["&&r[e+2]==="C"&&r[e+3]==="D"&&r[e+4]==="A"&&r[e+5]==="T"&&r[e+6]==="A"&&r[e+7]==="["){for(e+=8;e<r.length;e++)if(r[e]==="]"&&r[e+1]==="]"&&r[e+2]===">"){e+=2;break}}return e}const qt='"',Yt="'";function Qt(r,e){let t="",o="",n=!1;for(;e<r.length;e++){if(r[e]===qt||r[e]===Yt)o===""?o=r[e]:o!==r[e]||(o="");else if(r[e]===">"&&o===""){n=!0;break}t+=r[e]}return o!==""?!1:{value:t,index:e,tagClosed:n}}const Wt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function we(r,e){const t=xe(r,Wt),o={};for(let n=0;n<t.length;n++){if(t[n][1].length===0)return v("InvalidAttr","Attribute '"+t[n][2]+"' has no space in starting.",oe(t[n]));if(t[n][3]!==void 0&&t[n][4]===void 0)return v("InvalidAttr","Attribute '"+t[n][2]+"' is without value.",oe(t[n]));if(t[n][3]===void 0&&!e.allowBooleanAttributes)return v("InvalidAttr","boolean attribute '"+t[n][2]+"' is not allowed.",oe(t[n]));const i=t[n][2];if(!Dt(i))return v("InvalidAttr","Attribute '"+i+"' is an invalid name.",oe(t[n]));if(!o.hasOwnProperty(i))o[i]=1;else return v("InvalidAttr","Attribute '"+i+"' is repeated.",oe(t[n]))}return!0}function Gt(r,e){let t=/\d/;for(r[e]==="x"&&(e++,t=/[\da-fA-F]/);e<r.length;e++){if(r[e]===";")return e;if(!r[e].match(t))break}return-1}function Zt(r,e){if(e++,r[e]===";")return-1;if(r[e]==="#")return e++,Gt(r,e);let t=0;for(;e<r.length;e++,t++)if(!(r[e].match(/\w/)&&t<20)){if(r[e]===";")break;return-1}return e}function v(r,e,t){return{err:{code:r,msg:e,line:t.line||t,col:t.col}}}function Dt(r){return le(r)}function Jt(r){return le(r)}function U(r,e){const t=r.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function oe(r){return r.startIndex+r[1].length}const er={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(r,e){return e},attributeValueProcessor:function(r,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(r,e,t){return r},captureMetaData:!1},tr=function(r){return Object.assign({},er,r)};let ae;typeof Symbol!="function"?ae="@@xmlMetadata":ae=Symbol("XML Node Metadata");class D{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][ae]={startIndex:t})}static getMetaDataSymbol(){return ae}}class rr{constructor(e){this.suppressValidationErr=!e}readDocType(e,t){const o={};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 n=1,i=!1,l=!1,d="";for(;t<e.length;t++)if(e[t]==="<"&&!l){if(i&&J(e,"!ENTITY",t)){t+=7;let a,c;[a,c,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),c.indexOf("&")===-1&&(o[a]={regx:RegExp(`&${a};`,"g"),val:c})}else if(i&&J(e,"!ELEMENT",t)){t+=8;const{index:a}=this.readElementExp(e,t+1);t=a}else if(i&&J(e,"!ATTLIST",t))t+=8;else if(i&&J(e,"!NOTATION",t)){t+=9;const{index:a}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=a}else if(J(e,"!--",t))l=!0;else throw new Error("Invalid DOCTYPE");n++,d=""}else if(e[t]===">"){if(l?e[t-1]==="-"&&e[t-2]==="-"&&(l=!1,n--):n--,n===0)break}else e[t]==="["?i=!0:d+=e[t];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:o,i:t}}readEntityExp(e,t){t=z(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)o+=e[t],t++;if(se(o),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 n="";return[t,n]=this.readIdentifierVal(e,t,"entity"),t--,[o,n,t]}readNotationExp(e,t){t=z(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t]);)o+=e[t],t++;!this.suppressValidationErr&&se(o),t=z(e,t);const n=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&n!=="SYSTEM"&&n!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);t+=n.length,t=z(e,t);let i=null,l=null;if(n==="PUBLIC")[t,i]=this.readIdentifierVal(e,t,"publicIdentifier"),t=z(e,t),(e[t]==='"'||e[t]==="'")&&([t,l]=this.readIdentifierVal(e,t,"systemIdentifier"));else if(n==="SYSTEM"&&([t,l]=this.readIdentifierVal(e,t,"systemIdentifier"),!this.suppressValidationErr&&!l))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:o,publicIdentifier:i,systemIdentifier:l,index:--t}}readIdentifierVal(e,t,o){let n="";const i=e[t];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);for(t++;t<e.length&&e[t]!==i;)n+=e[t],t++;if(e[t]!==i)throw new Error(`Unterminated ${o} value`);return t++,[t,n]}readElementExp(e,t){t=z(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t]);)o+=e[t],t++;if(!this.suppressValidationErr&&!le(o))throw new Error(`Invalid element name: "${o}"`);t=z(e,t);let n="";if(e[t]==="E"&&J(e,"MPTY",t))t+=4;else if(e[t]==="A"&&J(e,"NY",t))t+=2;else if(e[t]==="("){for(t++;t<e.length&&e[t]!==")";)n+=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:o,contentModel:n.trim(),index:t}}readAttlistExp(e,t){t=z(e,t);let o="";for(;t<e.length&&!/\s/.test(e[t]);)o+=e[t],t++;se(o),t=z(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;if(!se(n))throw new Error(`Invalid attribute name: "${n}"`);t=z(e,t);let i="";if(e.substring(t,t+8).toUpperCase()==="NOTATION"){if(i="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 a="";for(;t<e.length&&e[t]!=="|"&&e[t]!==")";)a+=e[t],t++;if(a=a.trim(),!se(a))throw new Error(`Invalid notation name: "${a}"`);d.push(a),e[t]==="|"&&(t++,t=z(e,t))}if(e[t]!==")")throw new Error("Unterminated list of notations");t++,i+=" ("+d.join("|")+")"}else{for(;t<e.length&&!/\s/.test(e[t]);)i+=e[t],t++;const d=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!d.includes(i.toUpperCase()))throw new Error(`Invalid attribute type: "${i}"`)}t=z(e,t);let l="";return e.substring(t,t+8).toUpperCase()==="#REQUIRED"?(l="#REQUIRED",t+=8):e.substring(t,t+7).toUpperCase()==="#IMPLIED"?(l="#IMPLIED",t+=7):[t,l]=this.readIdentifierVal(e,t,"ATTLIST"),{elementName:o,attributeName:n,attributeType:i,defaultValue:l,index:t}}}const z=(r,e)=>{for(;e<r.length&&/\s/.test(r[e]);)e++;return e};function J(r,e,t){for(let o=0;o<e.length;o++)if(e[o]!==r[t+o+1])return!1;return!0}function se(r){if(le(r))return r;throw new Error(`Invalid entity name ${r}`)}const nr=/^[-+]?0x[a-fA-F0-9]+$/,or=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,sr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function ir(r,e={}){if(e=Object.assign({},sr,e),!r||typeof r!="string")return r;let t=r.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return r;if(r==="0")return 0;if(e.hex&&nr.test(t))return dr(t,16);if(t.search(/.+[eE].+/)!==-1)return ar(r,t,e);{const o=or.exec(t);if(o){const n=o[1]||"",i=o[2];let l=cr(o[3]);const d=n?r[i.length+1]===".":r[i.length]===".";if(!e.leadingZeros&&(i.length>1||i.length===1&&!d))return r;{const a=Number(t),c=String(a);if(a===0)return a;if(c.search(/[eE]/)!==-1)return e.eNotation?a:r;if(t.indexOf(".")!==-1)return c==="0"||c===l||c===`${n}${l}`?a:r;let p=i?l:t;return i?p===c||n+p===c?a:r:p===c||p===n+c?a:r}}else return r}}const lr=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function ar(r,e,t){if(!t.eNotation)return r;const o=e.match(lr);if(o){let n=o[1]||"";const i=o[3].indexOf("e")===-1?"E":"e",l=o[2],d=n?r[l.length+1]===i:r[l.length]===i;return l.length>1&&d?r:l.length===1&&(o[3].startsWith(`.${i}`)||o[3][0]===i)?Number(e):t.leadingZeros&&!d?(e=(o[1]||"")+o[3],Number(e)):r}else return r}function cr(r){return r&&r.indexOf(".")!==-1&&(r=r.replace(/0+$/,""),r==="."?r="0":r[0]==="."?r="0"+r:r[r.length-1]==="."&&(r=r.substring(0,r.length-1))),r}function dr(r,e){if(parseInt)return parseInt(r,e);if(Number.parseInt)return Number.parseInt(r,e);if(window&&window.parseInt)return window.parseInt(r,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Oe(r){return typeof r=="function"?r:Array.isArray(r)?e=>{for(const t of r)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}class ur{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,o)=>String.fromCodePoint(Number.parseInt(o,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,o)=>String.fromCodePoint(Number.parseInt(o,16))}},this.addExternalEntities=fr,this.parseXml=yr,this.parseTextData=hr,this.resolveNameSpace=pr,this.buildAttributesMap=gr,this.isItStopNode=xr,this.replaceEntitiesValue=Er,this.readStopNodeData=Nr,this.saveTextToParentTag=_r,this.addChild=br,this.ignoreAttributesFn=Oe(this.options.ignoreAttributes)}}function fr(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const o=e[t];this.lastEntities[o]={regex:new RegExp("&"+o+";","g"),val:r[o]}}}function hr(r,e,t,o,n,i,l){if(r!==void 0&&(this.options.trimValues&&!o&&(r=r.trim()),r.length>0)){l||(r=this.replaceEntitiesValue(r));const d=this.options.tagValueProcessor(e,r,t,n,i);return d==null?r:typeof d!=typeof r||d!==r?d:this.options.trimValues?he(r,this.options.parseTagValue,this.options.numberParseOptions):r.trim()===r?he(r,this.options.parseTagValue,this.options.numberParseOptions):r}}function pr(r){if(this.options.removeNSPrefix){const e=r.split(":"),t=r.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(r=t+e[1])}return r}const mr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function gr(r,e,t){if(this.options.ignoreAttributes!==!0&&typeof r=="string"){const o=xe(r,mr),n=o.length,i={};for(let l=0;l<n;l++){const d=this.resolveNameSpace(o[l][1]);if(this.ignoreAttributesFn(d,e))continue;let a=o[l][4],c=this.options.attributeNamePrefix+d;if(d.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a);const p=this.options.attributeValueProcessor(d,a,e);p==null?i[c]=a:typeof p!=typeof a||p!==a?i[c]=p:i[c]=he(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[c]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const l={};return l[this.options.attributesGroupName]=i,l}return i}}const yr=function(r){r=r.replace(/\r\n?/g,`
|
|
11
|
+
`);const e=new D("!xml");let t=e,o="",n="";const i=new rr(this.options.processEntities);for(let l=0;l<r.length;l++)if(r[l]==="<")if(r[l+1]==="/"){const a=ee(r,">",l,"Closing Tag is not closed.");let c=r.substring(l+2,a).trim();if(this.options.removeNSPrefix){const E=c.indexOf(":");E!==-1&&(c=c.substr(E+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),t&&(o=this.saveTextToParentTag(o,t,n));const p=n.substring(n.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let h=0;p&&this.options.unpairedTags.indexOf(p)!==-1?(h=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=n.lastIndexOf("."),n=n.substring(0,h),t=this.tagsNodeStack.pop(),o="",l=a}else if(r[l+1]==="?"){let a=fe(r,l,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(o=this.saveTextToParentTag(o,t,n),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const c=new D(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,n,a.tagName)),this.addChild(t,c,n,l)}l=a.closeIndex+1}else if(r.substr(l+1,3)==="!--"){const a=ee(r,"-->",l+4,"Comment is not closed.");if(this.options.commentPropName){const c=r.substring(l+4,a-2);o=this.saveTextToParentTag(o,t,n),t.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}l=a}else if(r.substr(l+1,2)==="!D"){const a=i.readDocType(r,l);this.docTypeEntities=a.entities,l=a.i}else if(r.substr(l+1,2)==="!["){const a=ee(r,"]]>",l,"CDATA is not closed.")-2,c=r.substring(l+9,a);o=this.saveTextToParentTag(o,t,n);let p=this.parseTextData(c,t.tagname,n,!0,!1,!0,!0);p==null&&(p=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):t.add(this.options.textNodeName,p),l=a+2}else{let a=fe(r,l,this.options.removeNSPrefix),c=a.tagName;const p=a.rawTagName;let h=a.tagExp,E=a.attrExpPresent,y=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),t&&o&&t.tagname!=="!xml"&&(o=this.saveTextToParentTag(o,t,n,!1));const A=t;A&&this.options.unpairedTags.indexOf(A.tagname)!==-1&&(t=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),c!==e.tagname&&(n+=n?"."+c:c);const B=l;if(this.isItStopNode(this.options.stopNodes,n,c)){let x="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),n=n.substr(0,n.length-1),h=c):h=h.substr(0,h.length-1),l=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)l=a.closeIndex;else{const j=this.readStopNodeData(r,p,y+1);if(!j)throw new Error(`Unexpected end of ${p}`);l=j.i,x=j.tagContent}const V=new D(c);c!==h&&E&&(V[":@"]=this.buildAttributesMap(h,n,c)),x&&(x=this.parseTextData(x,c,n,!0,E,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),V.add(this.options.textNodeName,x),this.addChild(t,V,n,B)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),n=n.substr(0,n.length-1),h=c):h=h.substr(0,h.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const x=new D(c);c!==h&&E&&(x[":@"]=this.buildAttributesMap(h,n,c)),this.addChild(t,x,n,B),n=n.substr(0,n.lastIndexOf("."))}else{const x=new D(c);this.tagsNodeStack.push(t),c!==h&&E&&(x[":@"]=this.buildAttributesMap(h,n,c)),this.addChild(t,x,n,B),t=x}o="",l=y}}else o+=r[l];return e.child};function br(r,e,t,o){this.options.captureMetaData||(o=void 0);const n=this.options.updateTag(e.tagname,t,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),r.addChild(e,o))}const Er=function(r){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];r=r.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];r=r.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];r=r.replace(t.regex,t.val)}r=r.replace(this.ampEntity.regex,this.ampEntity.val)}return r};function _r(r,e,t,o){return r&&(o===void 0&&(o=e.child.length===0),r=this.parseTextData(r,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,o),r!==void 0&&r!==""&&e.add(this.options.textNodeName,r),r=""),r}function xr(r,e,t){const o="*."+t;for(const n in r){const i=r[n];if(o===i||e===i)return!0}return!1}function kr(r,e,t=">"){let o,n="";for(let i=e;i<r.length;i++){let l=r[i];if(o)l===o&&(o="");else if(l==='"'||l==="'")o=l;else if(l===t[0])if(t[1]){if(r[i+1]===t[1])return{data:n,index:i}}else return{data:n,index:i};else l===" "&&(l=" ");n+=l}}function ee(r,e,t,o){const n=r.indexOf(e,t);if(n===-1)throw new Error(o);return n+e.length-1}function fe(r,e,t,o=">"){const n=kr(r,e+1,o);if(!n)return;let i=n.data;const l=n.index,d=i.search(/\s/);let a=i,c=!0;d!==-1&&(a=i.substring(0,d),i=i.substring(d+1).trimStart());const p=a;if(t){const h=a.indexOf(":");h!==-1&&(a=a.substr(h+1),c=a!==n.data.substr(h+1))}return{tagName:a,tagExp:i,closeIndex:l,attrExpPresent:c,rawTagName:p}}function Nr(r,e,t){const o=t;let n=1;for(;t<r.length;t++)if(r[t]==="<")if(r[t+1]==="/"){const i=ee(r,">",t,`${e} is not closed`);if(r.substring(t+2,i).trim()===e&&(n--,n===0))return{tagContent:r.substring(o,t),i};t=i}else if(r[t+1]==="?")t=ee(r,"?>",t+1,"StopNode is not closed.");else if(r.substr(t+1,3)==="!--")t=ee(r,"-->",t+3,"StopNode is not closed.");else if(r.substr(t+1,2)==="![")t=ee(r,"]]>",t,"StopNode is not closed.")-2;else{const i=fe(r,t,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&n++,t=i.closeIndex)}}function he(r,e,t){if(e&&typeof r=="string"){const o=r.trim();return o==="true"?!0:o==="false"?!1:ir(r,t)}else return Kt(r)?r:""}const pe=D.getMetaDataSymbol();function Ar(r,e){return Te(r,e)}function Te(r,e,t){let o;const n={};for(let i=0;i<r.length;i++){const l=r[i],d=Cr(l);let a="";if(t===void 0?a=d:a=t+"."+d,d===e.textNodeName)o===void 0?o=l[d]:o+=""+l[d];else{if(d===void 0)continue;if(l[d]){let c=Te(l[d],e,a);const p=Or(c,e);l[pe]!==void 0&&(c[pe]=l[pe]),l[":@"]?wr(c,l[":@"],a,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=""),n[d]!==void 0&&n.hasOwnProperty(d)?(Array.isArray(n[d])||(n[d]=[n[d]]),n[d].push(c)):e.isArray(d,a,p)?n[d]=[c]:n[d]=c}}}return typeof o=="string"?o.length>0&&(n[e.textNodeName]=o):o!==void 0&&(n[e.textNodeName]=o),n}function Cr(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const o=e[t];if(o!==":@")return o}}function wr(r,e,t,o){if(e){const n=Object.keys(e),i=n.length;for(let l=0;l<i;l++){const d=n[l];o.isArray(d,t+"."+d,!0,!0)?r[d]=[e[d]]:r[d]=e[d]}}}function Or(r,e){const{textNodeName:t}=e,o=Object.keys(r).length;return!!(o===0||o===1&&(r[t]||typeof r[t]=="boolean"||r[t]===0))}class Tr{constructor(e){this.externalEntities={},this.options=tr(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 i=ke(e,t);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const o=new ur(this.options);o.addExternalEntities(this.externalEntities);const n=o.parseXml(e);return this.options.preserveOrder||n===void 0?n:Ar(n,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 D.getMetaDataSymbol()}}const Br=`
|
|
12
|
+
`;function Sr(r,e){let t="";return e.format&&e.indentBy.length>0&&(t=Br),Be(r,e,"",t)}function Be(r,e,t,o){let n="",i=!1;for(let l=0;l<r.length;l++){const d=r[l],a=Pr(d);if(a===void 0)continue;let c="";if(t.length===0?c=a:c=`${t}.${a}`,a===e.textNodeName){let A=d[a];$r(c,e)||(A=e.tagValueProcessor(a,A),A=Pe(A,e)),i&&(n+=o),n+=A,i=!1;continue}else if(a===e.cdataPropName){i&&(n+=o),n+=`<![CDATA[${d[a][0][e.textNodeName]}]]>`,i=!1;continue}else if(a===e.commentPropName){n+=o+`<!--${d[a][0][e.textNodeName]}-->`,i=!0;continue}else if(a[0]==="?"){const A=Se(d[":@"],e),B=a==="?xml"?"":o;let x=d[a][0][e.textNodeName];x=x.length!==0?" "+x:"",n+=B+`<${a}${x}${A}?>`,i=!0;continue}let p=o;p!==""&&(p+=e.indentBy);const h=Se(d[":@"],e),E=o+`<${a}${h}`,y=Be(d[a],e,c,p);e.unpairedTags.indexOf(a)!==-1?e.suppressUnpairedNode?n+=E+">":n+=E+"/>":(!y||y.length===0)&&e.suppressEmptyNode?n+=E+"/>":y&&y.endsWith(">")?n+=E+`>${y}${o}</${a}>`:(n+=E+">",y&&o!==""&&(y.includes("/>")||y.includes("</"))?n+=o+e.indentBy+y+o:n+=y,n+=`</${a}>`),i=!0}return n}function Pr(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const o=e[t];if(r.hasOwnProperty(o)&&o!==":@")return o}}function Se(r,e){let t="";if(r&&!e.ignoreAttributes)for(let o in r){if(!r.hasOwnProperty(o))continue;let n=e.attributeValueProcessor(o,r[o]);n=Pe(n,e),n===!0&&e.suppressBooleanAttributes?t+=` ${o.substr(e.attributeNamePrefix.length)}`:t+=` ${o.substr(e.attributeNamePrefix.length)}="${n}"`}return t}function $r(r,e){r=r.substr(0,r.length-e.textNodeName.length-1);let t=r.substr(r.lastIndexOf(".")+1);for(let o in e.stopNodes)if(e.stopNodes[o]===r||e.stopNodes[o]==="*."+t)return!0;return!1}function Pe(r,e){if(r&&r.length>0&&e.processEntities)for(let t=0;t<e.entities.length;t++){const o=e.entities[t];r=r.replace(o.regex,o.val)}return r}const Vr={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(r,e){return e},attributeValueProcessor:function(r,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 Z(r){this.options=Object.assign({},Vr,r),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Oe(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Lr),this.processTextOrObjNode=Ir,this.options.format?(this.indentate=vr,this.tagEndChar=`>
|
|
13
13
|
`,this.newLine=`
|
|
14
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Z.prototype.build=function(r){return this.options.preserveOrder?Sr(r,this.options):(Array.isArray(r)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(r={[this.options.arrayNodeName]:r}),this.j2x(r,0,[]).val)},Z.prototype.j2x=function(r,e,t){let o="",n="";const i=t.join(".");for(let l in r)if(Object.prototype.hasOwnProperty.call(r,l))if(typeof r[l]>"u")this.isAttribute(l)&&(n+="");else if(r[l]===null)this.isAttribute(l)||l===this.options.cdataPropName?n+="":l[0]==="?"?n+=this.indentate(e)+"<"+l+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+l+"/"+this.tagEndChar;else if(r[l]instanceof Date)n+=this.buildTextValNode(r[l],l,"",e);else if(typeof r[l]!="object"){const d=this.isAttribute(l);if(d&&!this.ignoreAttributesFn(d,i))o+=this.buildAttrPairStr(d,""+r[l]);else if(!d)if(l===this.options.textNodeName){let a=this.options.tagValueProcessor(l,""+r[l]);n+=this.replaceEntitiesValue(a)}else n+=this.buildTextValNode(r[l],l,"",e)}else if(Array.isArray(r[l])){const d=r[l].length;let a="",c="";for(let p=0;p<d;p++){const h=r[l][p];if(!(typeof h>"u"))if(h===null)l[0]==="?"?n+=this.indentate(e)+"<"+l+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+l+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){const E=this.j2x(h,e+1,t.concat(l));a+=E.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(c+=E.attrStr)}else a+=this.processTextOrObjNode(h,l,e,t);else if(this.options.oneListGroup){let E=this.options.tagValueProcessor(l,h);E=this.replaceEntitiesValue(E),a+=E}else a+=this.buildTextValNode(h,l,"",e)}this.options.oneListGroup&&(a=this.buildObjectNode(a,l,c,e)),n+=a}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const d=Object.keys(r[l]),a=d.length;for(let c=0;c<a;c++)o+=this.buildAttrPairStr(d[c],""+r[l][d[c]])}else n+=this.processTextOrObjNode(r[l],l,e,t);return{attrStr:o,val:n}},Z.prototype.buildAttrPairStr=function(r,e){return e=this.options.attributeValueProcessor(r,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+r:" "+r+'="'+e+'"'};function Ir(r,e,t,o){const n=this.j2x(r,t+1,o.concat(e));return r[this.options.textNodeName]!==void 0&&Object.keys(r).length===1?this.buildTextValNode(r[this.options.textNodeName],e,n.attrStr,t):this.buildObjectNode(n.val,e,n.attrStr,t)}Z.prototype.buildObjectNode=function(r,e,t,o){if(r==="")return e[0]==="?"?this.indentate(o)+"<"+e+t+"?"+this.tagEndChar:this.indentate(o)+"<"+e+t+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,i="";return e[0]==="?"&&(i="?",n=""),(t||t==="")&&r.indexOf("<")===-1?this.indentate(o)+"<"+e+t+i+">"+r+n:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(o)+`<!--${r}-->`+this.newLine:this.indentate(o)+"<"+e+t+i+this.tagEndChar+r+this.indentate(o)+n}},Z.prototype.closeTag=function(r){let e="";return this.options.unpairedTags.indexOf(r)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${r}`,e},Z.prototype.buildTextValNode=function(r,e,t,o){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(o)+`<![CDATA[${r}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(o)+`<!--${r}-->`+this.newLine;if(e[0]==="?")return this.indentate(o)+"<"+e+t+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,r);return n=this.replaceEntitiesValue(n),n===""?this.indentate(o)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(o)+"<"+e+t+">"+n+"</"+e+this.tagEndChar}},Z.prototype.replaceEntitiesValue=function(r){if(r&&r.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const t=this.options.entities[e];r=r.replace(t.regex,t.val)}return r};function vr(r){return this.options.indentBy.repeat(r)}function Lr(r){return r.startsWith(this.options.attributeNamePrefix)&&r!==this.options.textNodeName?r.substr(this.attrPrefixLen):!1}const jr={validate:ke},Rr={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},Mr={ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",format:!0,indentBy:" ",suppressEmptyNode:!1,suppressBooleanAttributes:!1,suppressUnpairedNode:!1},Ur=r=>{try{const e=jr.validate(r,{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"}}},$e=(r,e)=>{try{return new
|
|
14
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Z.prototype.build=function(r){return this.options.preserveOrder?Sr(r,this.options):(Array.isArray(r)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(r={[this.options.arrayNodeName]:r}),this.j2x(r,0,[]).val)},Z.prototype.j2x=function(r,e,t){let o="",n="";const i=t.join(".");for(let l in r)if(Object.prototype.hasOwnProperty.call(r,l))if(typeof r[l]>"u")this.isAttribute(l)&&(n+="");else if(r[l]===null)this.isAttribute(l)||l===this.options.cdataPropName?n+="":l[0]==="?"?n+=this.indentate(e)+"<"+l+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+l+"/"+this.tagEndChar;else if(r[l]instanceof Date)n+=this.buildTextValNode(r[l],l,"",e);else if(typeof r[l]!="object"){const d=this.isAttribute(l);if(d&&!this.ignoreAttributesFn(d,i))o+=this.buildAttrPairStr(d,""+r[l]);else if(!d)if(l===this.options.textNodeName){let a=this.options.tagValueProcessor(l,""+r[l]);n+=this.replaceEntitiesValue(a)}else n+=this.buildTextValNode(r[l],l,"",e)}else if(Array.isArray(r[l])){const d=r[l].length;let a="",c="";for(let p=0;p<d;p++){const h=r[l][p];if(!(typeof h>"u"))if(h===null)l[0]==="?"?n+=this.indentate(e)+"<"+l+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+l+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){const E=this.j2x(h,e+1,t.concat(l));a+=E.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(c+=E.attrStr)}else a+=this.processTextOrObjNode(h,l,e,t);else if(this.options.oneListGroup){let E=this.options.tagValueProcessor(l,h);E=this.replaceEntitiesValue(E),a+=E}else a+=this.buildTextValNode(h,l,"",e)}this.options.oneListGroup&&(a=this.buildObjectNode(a,l,c,e)),n+=a}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const d=Object.keys(r[l]),a=d.length;for(let c=0;c<a;c++)o+=this.buildAttrPairStr(d[c],""+r[l][d[c]])}else n+=this.processTextOrObjNode(r[l],l,e,t);return{attrStr:o,val:n}},Z.prototype.buildAttrPairStr=function(r,e){return e=this.options.attributeValueProcessor(r,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+r:" "+r+'="'+e+'"'};function Ir(r,e,t,o){const n=this.j2x(r,t+1,o.concat(e));return r[this.options.textNodeName]!==void 0&&Object.keys(r).length===1?this.buildTextValNode(r[this.options.textNodeName],e,n.attrStr,t):this.buildObjectNode(n.val,e,n.attrStr,t)}Z.prototype.buildObjectNode=function(r,e,t,o){if(r==="")return e[0]==="?"?this.indentate(o)+"<"+e+t+"?"+this.tagEndChar:this.indentate(o)+"<"+e+t+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,i="";return e[0]==="?"&&(i="?",n=""),(t||t==="")&&r.indexOf("<")===-1?this.indentate(o)+"<"+e+t+i+">"+r+n:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(o)+`<!--${r}-->`+this.newLine:this.indentate(o)+"<"+e+t+i+this.tagEndChar+r+this.indentate(o)+n}},Z.prototype.closeTag=function(r){let e="";return this.options.unpairedTags.indexOf(r)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${r}`,e},Z.prototype.buildTextValNode=function(r,e,t,o){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(o)+`<![CDATA[${r}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(o)+`<!--${r}-->`+this.newLine;if(e[0]==="?")return this.indentate(o)+"<"+e+t+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,r);return n=this.replaceEntitiesValue(n),n===""?this.indentate(o)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(o)+"<"+e+t+">"+n+"</"+e+this.tagEndChar}},Z.prototype.replaceEntitiesValue=function(r){if(r&&r.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const t=this.options.entities[e];r=r.replace(t.regex,t.val)}return r};function vr(r){return this.options.indentBy.repeat(r)}function Lr(r){return r.startsWith(this.options.attributeNamePrefix)&&r!==this.options.textNodeName?r.substr(this.attrPrefixLen):!1}const jr={validate:ke},Rr={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},Mr={ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",format:!0,indentBy:" ",suppressEmptyNode:!1,suppressBooleanAttributes:!1,suppressUnpairedNode:!1},Ur=r=>{try{const e=jr.validate(r,{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"}}},$e=(r,e)=>{try{return new Tr({...Rr,...e}).parse(r)}catch(t){throw new Error(`XML 解析失败: ${t instanceof Error?t.message:"Unknown error"}`)}},me=(r,e)=>{try{let o=new Z({...Mr,format:e?.format??!0,indentBy:e?.indentBy??" "}).build(r);return e?.showDeclaration!==!1&&!o.startsWith("<?xml")&&(o=`<?xml version="1.0" encoding="UTF-8"?>
|
|
15
15
|
`+o),o}catch(t){throw new Error(`XML 构建失败: ${t instanceof Error?t.message:"Unknown error"}`)}},Fr=r=>Array.isArray(r)?ce(r,{format:!1}):me(r,{format:!1,showDeclaration:!1}),Xr=(r,e)=>{const t=$e(r);return Array.isArray(t)?ce(t,{indent:e?.indentBy}):me(t,e)},ce=(r,e={})=>{const t=e.indent!==void 0?e.indent:" ",o=e.level||0,n=e.format!==!1,i=n?t.repeat(o):"",l=n?`
|
|
16
|
-
`:"";let d="";for(const a of r){if(a["?xml"]){const x=a[":@"]||{},V=Object.entries(x).map(([j,m])=>`${j.startsWith("@_")?j.substring(2):j}="${m}"`).join(" ");d+=`<?xml ${V}?>${l}`;continue}if(a["#comment"]){const x=a["#comment"];if(Array.isArray(x)&&x.length>0){const V=x[0]["#text"]||x[0];d+=`${i}<!--${V}-->${l}`}continue}const c=Object.keys(a).find(x=>!x.startsWith(":")&&!x.startsWith("#")&&!x.startsWith("__"));if(!c)continue;const p=a[c],h=a[":@"]||{},E=Object.entries(h).map(([x,V])=>`${x.startsWith("@_")?x.substring(2):x}="${V}"`).join(" "),y=E?" "+E:"";if(!Array.isArray(p)||p.length===0){d+=`${i}<${c}${y}/>${l}`;continue}const A=p.length===1&&p[0]["#text"]!==void 0;if(p.some(x=>x.__cdata)){const x=p.find(V=>V.__cdata);if(x){const V=x.__cdata[0]["#text"]||"";d+=`${i}<${c}${y}><![CDATA[${V}]]></${c}>${l}`}}else if(A){const x=p[0]["#text"];d+=`${i}<${c}${y}>${x}</${c}>${l}`}else d+=`${i}<${c}${y}>${l}`,d+=ce(p,{indent:t,level:o+1,format:n}),d+=`${i}</${c}>${l}`}return d},zr={key:0,class:"xml-format__toolbar"},
|
|
16
|
+
`:"";let d="";for(const a of r){if(a["?xml"]){const x=a[":@"]||{},V=Object.entries(x).map(([j,m])=>`${j.startsWith("@_")?j.substring(2):j}="${m}"`).join(" ");d+=`<?xml ${V}?>${l}`;continue}if(a["#comment"]){const x=a["#comment"];if(Array.isArray(x)&&x.length>0){const V=x[0]["#text"]||x[0];d+=`${i}<!--${V}-->${l}`}continue}const c=Object.keys(a).find(x=>!x.startsWith(":")&&!x.startsWith("#")&&!x.startsWith("__"));if(!c)continue;const p=a[c],h=a[":@"]||{},E=Object.entries(h).map(([x,V])=>`${x.startsWith("@_")?x.substring(2):x}="${V}"`).join(" "),y=E?" "+E:"";if(!Array.isArray(p)||p.length===0){d+=`${i}<${c}${y}/>${l}`;continue}const A=p.length===1&&p[0]["#text"]!==void 0;if(p.some(x=>x.__cdata)){const x=p.find(V=>V.__cdata);if(x){const V=x.__cdata[0]["#text"]||"";d+=`${i}<${c}${y}><![CDATA[${V}]]></${c}>${l}`}}else if(A){const x=p[0]["#text"];d+=`${i}<${c}${y}>${x}</${c}>${l}`}else d+=`${i}<${c}${y}>${l}`,d+=ce(p,{indent:t,level:o+1,format:n}),d+=`${i}</${c}>${l}`}return d},zr={key:0,class:"xml-format__toolbar"},Kr={class:"xml-format__actions"},Hr=["disabled"],qr=["disabled"],Yr=["disabled"],Qr=["disabled"],Wr=["disabled"],Gr={class:"xml-format__info"},Zr={key:0,class:"xml-format__status xml-format__status--success"},Dr={key:1,class:"xml-format__status xml-format__status--error"},Jr={class:"xml-format__content"},en={key:0,class:"xml-format__error"},tn={key:1,class:"xml-format__viewer"},rn=ie(s.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(r,{expose:e,emit:t}){s.useCssVars(_=>({"0db40539":c.value.colors.border,bd72d08a:c.value.colors.background,"1738b57a":c.value.colors.text,"69331e8e":c.value.colors.surfaceBackground,cd0ca56a:c.value.colors.buttonBorder,"02f5e6cd":c.value.colors.buttonBackground,"060d3a0c":c.value.colors.buttonText,"6ac62a6f":c.value.colors.buttonBackgroundHover,"7ef6f8c3":c.value.colors.buttonPrimary,"24e03b8e":c.value.colors.buttonPrimaryHover,"357fd096":c.value.colors.success,"4d328338":c.value.colors.successBackground,"61df294a":c.value.colors.error,"3307322e":c.value.colors.errorBackground}));const o=r,n=t,i=s.ref(null),l=s.ref(""),d=s.ref(new Set),a=s.computed(()=>l.value===""),c=s.computed(()=>Ut(o.theme)),p=s.computed(()=>!i.value||!Array.isArray(i.value)?[]:i.value.filter(_=>!_["?xml"])),h=s.computed(()=>{if(!i.value||!Array.isArray(i.value))return null;const _=i.value.find(L=>L["?xml"]);if(!_||!_[":@"])return null;const w=_[":@"],S=[];return w["@_version"]&&S.push(`version="${w["@_version"]}"`),w["@_encoding"]&&S.push(`encoding="${w["@_encoding"]}"`),w["@_standalone"]&&S.push(`standalone="${w["@_standalone"]}"`),S.length>0?`<?xml ${S.join(" ")}?>`:null}),E=s.computed(()=>p.value),y=_=>{if(!_||!_.trim()){l.value="",i.value=null;return}try{const w=Ur(_);if(!w.valid){l.value=w.error||"Invalid XML",i.value=null;return}i.value=$e(_),l.value="",s.nextTick(()=>{B()})}catch(w){l.value=w instanceof Error?w.message:"Unknown parse error",i.value=null}},A=_=>{d.value.has(_)?d.value.delete(_):d.value.add(_)},B=()=>{const _=new Set,w=(S,L="")=>{Array.isArray(S)&&S.forEach((K,F)=>{const X=Object.keys(K).find(b=>!b.startsWith(":")&&!b.startsWith("#"));if(!X)return;const W=L?`${L}[${F}]`:`${X}[${F}]`;_.add(W);const re=K[X];Array.isArray(re)&&w(re,W+"."+X)})};p.value.forEach((S,L)=>{const K=Object.keys(S).find(F=>!F.startsWith(":")&&!F.startsWith("#"));if(K){const F=`${K}[${L}]`;_.add(F);const X=S[K];Array.isArray(X)&&w(X,F+"."+K)}}),d.value=_,n("expand-all")},x=()=>{d.value.clear(),n("collapse-all")},V=async()=>{if(!(!a.value||!i.value))try{const _=Array.isArray(i.value)?ce(i.value,{indent:" "}):me(i.value,{format:!0,indentBy:" "});await navigator.clipboard.writeText(_),n("copy-success",_)}catch(_){const w=_ instanceof Error?_:new Error("Copy failed");n("copy-error",w),console.error("Failed to copy XML:",_)}},j=()=>{if(!(!a.value||!i.value))try{const _=Fr(i.value);n("update:modelValue",_),n("compress",_)}catch(_){console.error("Failed to compress XML:",_)}},m=()=>{if(a.value)try{const _=Xr(o.modelValue,{format:!0,indentBy:" "});n("update:modelValue",_),n("format",_)}catch(_){console.error("Failed to format XML:",_)}},T=async _=>{try{const w=typeof _=="string"?_:JSON.stringify(_,null,2);await navigator.clipboard.writeText(w),n("copy-success",w)}catch(w){const S=w instanceof Error?w:new Error("Copy failed");n("copy-error",S),console.error("Failed to copy value:",w)}};return s.watch(()=>o.modelValue,_=>{y(_)},{immediate:!0}),e({copyXml:V,compressSource:j,formatSource:m,expandAll:B,collapseAll:x,toggleExpand:A,isValidXml:()=>a.value,getParsedXml:()=>i.value,getExpandedNodes:()=>d.value,getParseError:()=>l.value,parseXmlString:_=>y(_),copyValue:_=>T(_)}),(_,w)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["xml-format",`xml-format--${c.value.name}`])},[_.showToolbar?(s.openBlock(),s.createElementBlock("div",zr,[s.createElementVNode("div",Kr,[s.createElementVNode("button",{class:"xml-format__btn xml-format__btn--primary",onClick:V,disabled:!a.value,title:"Copy XML"}," 📋 Copy ",8,Hr),s.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:B,disabled:!a.value,title:"Expand All"}," ⬇️ Expand All ",8,qr),s.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:x,disabled:!a.value,title:"Collapse All"}," ➡️ Collapse All ",8,Yr),s.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:j,disabled:!a.value,title:"Compress XML"}," 📦 Compress ",8,Qr),s.createElementVNode("button",{class:"xml-format__btn xml-format__btn--secondary",onClick:m,disabled:!a.value,title:"Format XML"}," ✨ Format ",8,Wr)]),s.createElementVNode("div",Gr,[a.value?(s.openBlock(),s.createElementBlock("span",Zr," ✅ Valid XML ")):(s.openBlock(),s.createElementBlock("span",Dr," ❌ Invalid XML "))])])):s.createCommentVNode("",!0),s.createElementVNode("div",Jr,[a.value?(s.openBlock(),s.createElementBlock("div",tn,[h.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"xml-declaration",style:s.normalizeStyle({color:c.value.colors.xmlDeclaration})},s.toDisplayString(h.value),5)):s.createCommentVNode("",!0),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.value,(S,L)=>(s.openBlock(),s.createBlock(Mt,{key:L,node:S,index:L,level:0,expanded:d.value,theme:c.value,onToggleExpand:A,onCopy:T},null,8,["node","index","expanded","theme"]))),128))])):(s.openBlock(),s.createElementBlock("div",en,[w[0]||(w[0]=s.createElementVNode("h4",null,"XML Parse Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(l.value),1)]))])],2))}}),[["__scopeId","data-v-f9125514"]]),nn=[be],on={install:r=>{nn.forEach(e=>{const t=e.name||e.__name||"UnknownComponent";r.component(t,e)})}};Y.JsonFormat=be,Y.XmlFormat=rn,Y.default=on,Object.defineProperties(Y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|