lone-format 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- (function(D,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(D=typeof globalThis<"u"?globalThis:D||self,s(D.LoneFormat={},D.Vue))})(this,function(D,s){"use strict";class te{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 re{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 i{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+i.version}static addUnaryOp(e){return i.max_unop_len=Math.max(e.length,i.max_unop_len),i.unary_ops[e]=1,i}static addBinaryOp(e,t,o){return i.max_binop_len=Math.max(e.length,i.max_binop_len),i.binary_ops[e]=t,o?i.right_associative.add(e):i.right_associative.delete(e),i}static addIdentifierChar(e){return i.additional_identifier_chars.add(e),i}static addLiteral(e,t){return i.literals[e]=t,i}static removeUnaryOp(e){return delete i.unary_ops[e],e.length===i.max_unop_len&&(i.max_unop_len=i.getMaxKeyLen(i.unary_ops)),i}static removeAllUnaryOps(){return i.unary_ops={},i.max_unop_len=0,i}static removeIdentifierChar(e){return i.additional_identifier_chars.delete(e),i}static removeBinaryOp(e){return delete i.binary_ops[e],e.length===i.max_binop_len&&(i.max_binop_len=i.getMaxKeyLen(i.binary_ops)),i.right_associative.delete(e),i}static removeAllBinaryOps(){return i.binary_ops={},i.max_binop_len=0,i}static removeLiteral(e){return delete i.literals[e],i}static removeAllLiterals(){return i.literals={},i}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 i(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 i.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!i.binary_ops[String.fromCharCode(e)]||i.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return i.isIdentifierStart(e)||i.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(i.hooks[e]){const o={context:this,node:t};return i.hooks.run(e,o),o.node}return t}searchHook(e){if(i.hooks[e]){const t={context:this};return i.hooks[e].find(function(o){return o.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===i.SPACE_CODE||e===i.TAB_CODE||e===i.LF_CODE||e===i.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:i.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===i.SEMCOL_CODE||o===i.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,i.max_binop_len),t=e.length;for(;t>0;){if(i.binary_ops.hasOwnProperty(e)&&(!i.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!i.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,l,c,p,h,f;if(c=this.gobbleToken(),!c||(t=this.gobbleBinaryOp(),!t))return c;for(l={value:t,prec:i.binaryPrecedence(t),right_a:i.right_associative.has(t)},p=this.gobbleToken(),p||this.throwError("Expected expression after "+t),n=[c,l,p];t=this.gobbleBinaryOp();){if(o=i.binaryPrecedence(t),o===0){this.index-=t.length;break}l={value:t,prec:o,right_a:i.right_associative.has(t)},f=t;const k=y=>l.right_a&&y.right_a?o>y.prec:o<=y.prec;for(;n.length>2&&k(n[n.length-2]);)p=n.pop(),t=n.pop().value,c=n.pop(),e={type:i.BINARY_EXP,operator:t,left:c,right:p},n.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+f),n.push(l,e)}for(h=n.length-1,e=n[h];h>1;)e={type:i.BINARY_EXP,operator:n[h-1].value,left:n[h-2],right:e},h-=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,i.isDecimalDigit(e)||e===i.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===i.SQUOTE_CODE||e===i.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===i.OBRACK_CODE)n=this.gobbleArray();else{for(t=this.expr.substr(this.index,i.max_unop_len),o=t.length;o>0;){if(i.unary_ops.hasOwnProperty(t)&&(!i.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!i.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=o;const l=this.gobbleToken();return l||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:i.UNARY_EXP,operator:t,argument:l,prefix:!0})}t=t.substr(0,--o)}i.isIdentifierStart(e)?(n=this.gobbleIdentifier(),i.literals.hasOwnProperty(n.name)?n={type:i.LITERAL,value:i.literals[n.name],raw:n.name}:n.name===i.this_str&&(n={type:i.THIS_EXP})):e===i.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===i.PERIOD_CODE||t===i.OBRACK_CODE||t===i.OPAREN_CODE||t===i.QUMARK_CODE;){let o;if(t===i.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==i.PERIOD_CODE)break;o=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===i.OBRACK_CODE?(e={type:i.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},e.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==i.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===i.OPAREN_CODE?e={type:i.CALL_EXP,arguments:this.gobbleArguments(i.CPAREN_CODE),callee:e}:(t===i.PERIOD_CODE||o)&&(o&&this.index--,this.gobbleSpaces(),e={type:i.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(;i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===i.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);i.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++));i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);i.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return o=this.code,i.isIdentifierStart(o)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(o===i.PERIOD_CODE||e.length===1&&e.charCodeAt(0)===i.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:i.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 l=this.expr.charAt(this.index++);if(l===o){n=!0;break}else if(l==="\\")switch(l=this.expr.charAt(this.index++),l){case"n":e+=`
2
- `;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=l}else e+=l}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:i.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(i.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,i.isIdentifierPart(e));)this.index++;return{type:i.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 l=this.code;if(l===e){o=!0,this.index++,e===i.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(l===i.COMMA_CODE){if(this.index++,n++,n!==t.length){if(e===i.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===i.CBRACK_CODE)for(let c=t.length;c<n;c++)t.push(null)}}else if(t.length!==n&&n!==0)this.throwError("Expected comma");else{const c=this.gobbleExpression();(!c||c.type===i.COMPOUND)&&this.throwError("Expected comma"),t.push(c)}}return o||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(i.CPAREN_CODE);if(this.code===i.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:i.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:i.ARRAY_EXP,elements:this.gobbleArguments(i.CBRACK_CODE)}}}const ne=new te;Object.assign(i,{hooks:ne,plugins:new re(i),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"}),i.max_unop_len=i.getMaxKeyLen(i.unary_ops),i.max_binop_len=i.getMaxKeyLen(i.binary_ops);const P=r=>new i(r).parse(),oe=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(i).filter(r=>!oe.includes(r)&&P[r]===void 0).forEach(r=>{P[r]=i[r]}),P.Jsep=i;const se="ConditionalExpression";var ie={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 l=this.gobbleExpression();if(l||this.throwError("Expected expression"),t.node={type:se,test:o,consequent:n,alternate:l},o.operator&&r.binary_ops[o.operator]<=.9){let c=o;for(;c.right.operator&&r.binary_ops[c.right.operator]<=.9;)c=c.right;t.node.test=c.right,c.right=t.node,t.node=o}}else this.throwError("Expected :")}})}};P.plugins.register(ie);const W=47,ae=92;var le={name:"regex",init(r){r.hooks.add("gobble-token",function(t){if(this.code===W){const o=++this.index;let n=!1;for(;this.index<this.expr.length;){if(this.code===W&&!n){const l=this.expr.slice(o,this.index);let c="";for(;++this.index<this.expr.length;){const h=this.code;if(h>=97&&h<=122||h>=65&&h<=90||h>=48&&h<=57)c+=this.char;else break}let p;try{p=new RegExp(l,c)}catch(h){this.throwError(h.message)}return t.node={type:r.LITERAL,value:p,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===ae?2:1}this.throwError("Unclosed Regex")}})}};const Y=43,R={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[Y,45],assignmentPrecedence:.9,init(r){const e=[r.IDENTIFIER,r.MEMBER_EXP];R.assignmentOperators.forEach(o=>r.addBinaryOp(o,R.assignmentPrecedence,!0)),r.hooks.add("gobble-token",function(n){const l=this.code;R.updateOperators.some(c=>c===l&&c===this.expr.charCodeAt(this.index+1))&&(this.index+=2,n.node={type:"UpdateExpression",operator:l===Y?"++":"--",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 l=this.code;R.updateOperators.some(c=>c===l&&c===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:l===Y?"++":"--",argument:n.node,prefix:!1})}}),r.hooks.add("after-expression",function(n){n.node&&t(n.node)});function t(o){R.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)})}}};P.plugins.register(le,R),P.addUnaryOp("typeof"),P.addLiteral("null",null),P.addLiteral("undefined",void 0);const ce=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),w={evalAst(r,e){switch(r.type){case"BinaryExpression":case"LogicalExpression":return w.evalBinaryExpression(r,e);case"Compound":return w.evalCompound(r,e);case"ConditionalExpression":return w.evalConditionalExpression(r,e);case"Identifier":return w.evalIdentifier(r,e);case"Literal":return w.evalLiteral(r,e);case"MemberExpression":return w.evalMemberExpression(r,e);case"UnaryExpression":return w.evalUnaryExpression(r,e);case"ArrayExpression":return w.evalArrayExpression(r,e);case"CallExpression":return w.evalCallExpression(r,e);case"AssignmentExpression":return w.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](w.evalAst(r.left,e),()=>w.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=w.evalAst(n,e)}return t},evalConditionalExpression(r,e){return w.evalAst(r.test,e)?w.evalAst(r.consequent,e):w.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?w.evalAst(r.property):r.property.name),o=w.evalAst(r.object,e);if(o==null)throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);if(!Object.hasOwn(o,t)&&ce.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=>-w.evalAst(o,e),"!":o=>!w.evalAst(o,e),"~":o=>~w.evalAst(o,e),"+":o=>+w.evalAst(o,e),typeof:o=>typeof w.evalAst(o,e)}[r.operator](r.argument)},evalArrayExpression(r,e){return r.elements.map(t=>w.evalAst(t,e))},evalCallExpression(r,e){const t=r.arguments.map(n=>w.evalAst(n,e));return w.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=w.evalAst(r.right,e);return e[t]=o,e[t]}};class ue{constructor(e){this.code=e,this.ast=P(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return w.evalAst(this.ast,t)}}function j(r,e){return r=r.slice(),r.push(e),r}function q(r,e){return e=e.slice(),e.unshift(r),e}class de 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 O(r,e,t,o,n){if(!(this instanceof O))try{return new O(r,e,t,o,n)}catch(c){if(!c.avoidNew)throw c;return c.value}typeof r=="string"&&(n=o,o=t,t=e,e=r,r=null);const l=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 c={path:l?r.path:e};l?"json"in r&&(c.json=r.json):c.json=t;const p=this.evaluate(c);if(!p||typeof p!="object")throw new de(p);return p}}O.prototype.evaluate=function(r,e,t,o){let n=this.parent,l=this.parentProperty,{flatten:c,wrap:p}=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),c=Object.hasOwn(r,"flatten")?r.flatten:c,this.currResultType=Object.hasOwn(r,"resultType")?r.resultType:this.currResultType,this.currSandbox=Object.hasOwn(r,"sandbox")?r.sandbox:this.currSandbox,p=Object.hasOwn(r,"wrap")?r.wrap:p,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,l=Object.hasOwn(r,"parentProperty")?r.parentProperty:l,r=r.path}if(n=n||null,l=l||null,Array.isArray(r)&&(r=O.toPathString(r)),!r&&r!==""||!e)return;const h=O.toPathArray(r);h[0]==="$"&&h.length>1&&h.shift(),this._hasParentSelector=null;const f=this._trace(h,e,["$"],n,l,t).filter(function(k){return k&&!k.isParentSelector});return f.length?!p&&f.length===1&&!f[0].hasArrExpr?this._getPreferredOutput(f[0]):f.reduce((k,y)=>{const C=this._getPreferredOutput(y);return c&&Array.isArray(C)?k=k.concat(C):k.push(C),k},[]):p?[]:void 0},O.prototype._getPreferredOutput=function(r){const e=this.currResultType;switch(e){case"all":{const t=Array.isArray(r.path)?r.path:O.toPathArray(r.path);return r.pointer=O.toPointer(t),r.path=typeof r.path=="string"?r.path:O.toPathString(r.path),r}case"value":case"parent":case"parentProperty":return r[e];case"path":return O.toPathString(r[e]);case"pointer":return O.toPointer(r.path);default:throw new TypeError("Unknown result type")}},O.prototype._handleCallback=function(r,e,t){if(e){const o=this._getPreferredOutput(r);r.path=typeof r.path=="string"?r.path:O.toPathString(r.path),e(o,t,r)}},O.prototype._trace=function(r,e,t,o,n,l,c,p){let h;if(!r.length)return h={path:t,value:e,parent:o,parentProperty:n,hasArrExpr:c},this._handleCallback(h,l,"value"),h;const f=r[0],k=r.slice(1),y=[];function C(m){Array.isArray(m)?m.forEach(v=>{y.push(v)}):y.push(m)}if((typeof f!="string"||p)&&e&&Object.hasOwn(e,f))C(this._trace(k,e[f],j(t,f),e,f,l,c));else if(f==="*")this._walk(e,m=>{C(this._trace(k,e[m],j(t,m),e,m,l,!0,!0))});else if(f==="..")C(this._trace(k,e,t,o,n,l,c)),this._walk(e,m=>{typeof e[m]=="object"&&C(this._trace(r.slice(),e[m],j(t,m),e,m,l,!0))});else{if(f==="^")return this._hasParentSelector=!0,{path:t.slice(0,-1),expr:k,isParentSelector:!0};if(f==="~")return h={path:j(t,f),value:n,parent:o,parentProperty:null},this._handleCallback(h,l,"property"),h;if(f==="$")C(this._trace(k,e,t,null,null,l,c));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(f))C(this._slice(f,k,e,t,o,n,l));else if(f.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const m=f.replace(/^\?\((.*?)\)$/u,"$1"),v=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(m);v?this._walk(e,A=>{const I=[v[2]],N=v[1]?e[A][v[1]]:e[A];this._trace(I,N,t,o,n,l,!0).length>0&&C(this._trace(k,e[A],j(t,A),e,A,l,!0))}):this._walk(e,A=>{this._eval(m,e[A],A,t,o,n)&&C(this._trace(k,e[A],j(t,A),e,A,l,!0))})}else if(f[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");C(this._trace(q(this._eval(f,e,t.at(-1),t.slice(0,-1),o,n),k),e,t,o,n,l,c))}else if(f[0]==="@"){let m=!1;const v=f.slice(1,-2);switch(v){case"scalar":(!e||!["object","function"].includes(typeof e))&&(m=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===v&&(m=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(m=!0);break;case"number":Number.isFinite(e)&&(m=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(m=!0);break;case"object":e&&typeof e===v&&(m=!0);break;case"array":Array.isArray(e)&&(m=!0);break;case"other":m=this.currOtherTypeCallback(e,t,o,n);break;case"null":e===null&&(m=!0);break;default:throw new TypeError("Unknown value type "+v)}if(m)return h={path:t,value:e,parent:o,parentProperty:n},this._handleCallback(h,l,"value"),h}else if(f[0]==="`"&&e&&Object.hasOwn(e,f.slice(1))){const m=f.slice(1);C(this._trace(k,e[m],j(t,m),e,m,l,c,!0))}else if(f.includes(",")){const m=f.split(",");for(const v of m)C(this._trace(q(v,k),e,t,o,n,l,!0))}else!p&&e&&Object.hasOwn(e,f)&&C(this._trace(k,e[f],j(t,f),e,f,l,c,!0))}if(this._hasParentSelector)for(let m=0;m<y.length;m++){const v=y[m];if(v&&v.isParentSelector){const A=this._trace(v.expr,e,v.path,o,n,l,c);if(Array.isArray(A)){y[m]=A[0];const I=A.length;for(let N=1;N<I;N++)m++,y.splice(m,0,A[N])}else y[m]=A}}return y},O.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)})},O.prototype._slice=function(r,e,t,o,n,l,c){if(!Array.isArray(t))return;const p=t.length,h=r.split(":"),f=h[2]&&Number.parseInt(h[2])||1;let k=h[0]&&Number.parseInt(h[0])||0,y=h[1]&&Number.parseInt(h[1])||p;k=k<0?Math.max(0,k+p):Math.min(p,k),y=y<0?Math.max(0,y+p):Math.min(p,y);const C=[];for(let m=k;m<y;m+=f)this._trace(q(m,e),t,o,n,l,c,!0).forEach(A=>{C.push(A)});return C},O.prototype._eval=function(r,e,t,o,n,l){this.currSandbox._$_parentProperty=l,this.currSandbox._$_parent=n,this.currSandbox._$_property=t,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const c=r.includes("@path");c&&(this.currSandbox._$_path=O.toPathString(o.concat([t])));const p=this.currEval+"Script:"+r;if(!O.cache[p]){let h=r.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(c&&(h=h.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)O.cache[p]=new this.safeVm.Script(h);else if(this.currEval==="native")O.cache[p]=new this.vm.Script(h);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const f=this.currEval;O.cache[p]=new f(h)}else if(typeof this.currEval=="function")O.cache[p]={runInNewContext:f=>this.currEval(h,f)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return O.cache[p].runInNewContext(this.currSandbox)}catch(h){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+h.message+": "+r)}},O.cache={},O.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},O.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},O.toPathArray=function(r){const{cache:e}=O;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(l,c){return"[#"+(t.push(c)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(l,c){return"['"+c.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(l,c){return";"+c.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(l){const c=l.match(/#(\d+)/u);return!c||!c[1]?l:t[c[1]]});return e[r]=n,e[r].concat()},O.prototype.safeVm={Script:ue};const he=function(r,e,t){const o=r.length;for(let n=0;n<o;n++){const l=r[n];t(l)&&e.push(r.splice(n--,1)[0])}};class fe{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const o=Object.keys(e),n=[];he(o,n,f=>typeof e[f]=="function");const l=o.map(f=>e[f]);t=n.reduce((f,k)=>{let y=e[k].toString();return/function/u.test(y)||(y="function "+y),"var "+k+"="+y+";"+f},"")+t,!/(['"])use strict\1/u.test(t)&&!o.includes("arguments")&&(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const p=t.lastIndexOf(";"),h=p!==-1?t.slice(0,p+1)+" return "+t.slice(p+1):" return "+t;return new Function(...o,h)(...l)}}O.prototype.vm={Script:fe};const pe={class:"json-node"},ye={key:0,class:"json-node__container"},ge={class:"json-node__line"},be={key:2,class:"json-node__colon"},me=["title"],Ee={key:3,class:"json-node__collapsed"},ke={key:4,class:"json-node__comma"},_e={key:0,class:"json-node__children"},xe={class:"json-node__children-content"},Oe={class:"json-node__line json-node__closing-bracket"},Ce={class:"json-node__bracket"},we={key:0,class:"json-node__comma"},Ae={key:1,class:"json-node__primitive"},ve={key:2,class:"json-node__colon"},Se=["title"],Ne={key:0,class:"json-node__comma"},Be=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(d=>({"41b58a02":d.level,"63accfe8":d.theme.colors.syntaxKey,"7a4b22f6":d.theme.colors.hoverBackground,"5865f1b1":d.theme.colors.syntaxBracket,"79c93d33":d.theme.colors.textSecondary,"59ced5e8":d.theme.colors.syntaxString,51525120:d.theme.colors.syntaxNumber,"5410b131":d.theme.colors.syntaxBoolean,"11eec51e":d.theme.colors.syntaxNull,ac53437c:d.theme.colors.background,"15cbe7d4":d.theme.colors.indentLine}));const t=r,o=e,n=s.ref(!1),l=s.ref(!1),c=s.ref(""),p=s.ref(""),h=d=>{if(!/^-?\d+(\.\d+)?$/.test(d))return!1;const _=Number(d);return!Number.isSafeInteger(_)||d.length>15},f=s.computed(()=>t.value!==null&&typeof t.value=="object"),k=s.computed(()=>Array.isArray(t.value)),y=s.computed(()=>t.path?t.path:t.keyName?t.keyName:"root"),C=s.computed(()=>t.expanded.has(y.value)),m=s.computed(()=>t.keyName),v=s.computed(()=>k.value?"[":"{"),A=s.computed(()=>k.value?"]":"}"),I=s.computed(()=>{if(!t.value)return"";const _=Object.keys(t.value).length;return k.value?_>0?` ${_} items `:" ":_>0?` ${_} keys `:" "}),N=s.computed(()=>{const d=typeof t.value;return t.value===null?"json-node__value--null":d==="boolean"?"json-node__value--boolean":d==="number"?"json-node__value--number":d==="string"?h(t.value)?"json-node__value--number":"json-node__value--string":""}),M=s.computed(()=>l.value?p.value:t.value===null?"null":typeof t.value=="boolean"||typeof t.value=="number"?String(t.value):typeof t.value=="string"?h(t.value)?t.value:`"${t.value}"`:String(t.value)),z=s.computed(()=>"Click to edit, double-click to copy"),G=d=>t.level===0?d:y.value?`${y.value}.${d}`:d,V=d=>{const _=Object.keys(t.value);return _.indexOf(d)===_.length-1},F=()=>{o("toggle-expand",y.value)},K=()=>{t.level!==0&&(n.value=!0,c.value=t.keyName,s.nextTick(()=>{const d=document.querySelectorAll(".json-node__key-input"),_=d[d.length-1];_&&(_.focus(),_.select())}))},Q=()=>{f.value||(l.value=!0,typeof t.value=="string"&&h(t.value)||typeof t.value=="string"?p.value=t.value:p.value=String(t.value),s.nextTick(()=>{const d=document.querySelectorAll(".json-node__value-input"),_=d[d.length-1];_&&(_.focus(),_.select())}))},$=()=>{if(t.level===0||!n.value)return;const d=c.value.trim();if(!d){X();return}if(d===t.keyName){n.value=!1;return}n.value=!1,o("update:key",y.value,d)},H=()=>{try{let d;const _=p.value.trim();if(_==="null")d=null;else if(_==="true"||_==="false")d=_==="true";else if(!isNaN(Number(_))&&_!==""){const U=Number(_);!Number.isSafeInteger(U)||_.length>15?d=_:d=U}else d=p.value;o("update:value",y.value,d),l.value=!1}catch(d){console.error("Failed to parse value:",d),l.value=!1}},X=()=>{n.value=!1,c.value=t.keyName},L=()=>{l.value=!1,typeof t.value=="string"&&h(t.value)||typeof t.value=="string"?p.value=t.value:p.value=String(t.value)};return(d,_)=>{const U=s.resolveComponent("JsonNode",!0);return s.openBlock(),s.createElementBlock("div",pe,[f.value?(s.openBlock(),s.createElementBlock("div",ye,[s.createElementVNode("div",ge,[d.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:K,title:"Click to edit key"},' "'+s.toDisplayString(m.value)+'" ',1)):s.createCommentVNode("",!0),d.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":_[0]||(_[0]=a=>c.value=a),onKeyup:[s.withKeys($,["enter"]),s.withKeys(X,["escape"])],onBlur:$,class:"json-node__key-input"},null,544)),[[s.vModelText,c.value]]):s.createCommentVNode("",!0),d.keyName?(s.openBlock(),s.createElementBlock("span",be,": ")):s.createCommentVNode("",!0),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:F,title:C.value?"Click to collapse":"Click to expand"},s.toDisplayString(v.value),9,me),C.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",Ee,[s.createTextVNode(s.toDisplayString(I.value)+" ",1),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:F},s.toDisplayString(A.value),1)])),!C.value&&!d.isLast?(s.openBlock(),s.createElementBlock("span",ke,",")):s.createCommentVNode("",!0)]),C.value?(s.openBlock(),s.createElementBlock("div",_e,[s.createElementVNode("div",xe,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(d.value,(a,u)=>(s.openBlock(),s.createElementBlock("div",{key:u,class:"json-node__child"},[s.createVNode(U,{value:a,"key-name":k.value?"":String(u),level:d.level+1,path:G(String(u)),expanded:d.expanded,theme:d.theme,"onUpdate:value":_[1]||(_[1]=(g,b)=>d.$emit("update:value",g,b)),onToggleExpand:_[2]||(_[2]=g=>d.$emit("toggle-expand",g)),onCopy:_[3]||(_[3]=g=>d.$emit("copy",g)),"onUpdate:key":_[4]||(_[4]=(g,b)=>d.$emit("update:key",g,b)),"is-last":V(String(u))},null,8,["value","key-name","level","path","expanded","theme","is-last"])]))),128))]),s.createElementVNode("div",Oe,[s.createElementVNode("span",Ce,s.toDisplayString(A.value),1),d.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",we,","))])])):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",Ae,[d.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:K,title:"Click to edit key"},' "'+s.toDisplayString(m.value)+'" ',1)):s.createCommentVNode("",!0),d.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":_[5]||(_[5]=a=>c.value=a),onKeyup:[s.withKeys($,["enter"]),s.withKeys(X,["escape"])],onBlur:$,class:"json-node__key-input"},null,544)),[[s.vModelText,c.value]]):s.createCommentVNode("",!0),d.keyName?(s.openBlock(),s.createElementBlock("span",ve,": ")):s.createCommentVNode("",!0),l.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",{key:3,class:s.normalizeClass(["json-node__value",N.value]),onClick:Q,onDblclick:_[6]||(_[6]=a=>d.$emit("copy",d.value)),title:z.value},[s.createTextVNode(s.toDisplayString(M.value),1),d.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",Ne,","))],42,Se)),l.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:4,"onUpdate:modelValue":_[7]||(_[7]=a=>p.value=a),onKeyup:[s.withKeys(H,["enter"]),s.withKeys(L,["escape"])],onBlur:H,class:"json-node__value-input"},null,544)),[[s.vModelText,p.value]]):s.createCommentVNode("",!0)]))])}}}),Z=(r,e)=>{const t=r.__vccOpts||r;for(const[o,n]of e)t[o]=n;return t},Pe=Z(Be,[["__scopeId","data-v-f3f3cbc9"]]),J={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"}},Te={"github-light":J,"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 De(r="github-light"){return Te[r]||J}const je={key:0,class:"json-format__toolbar"},Ie={class:"json-format__actions"},$e=["disabled"],Re=["disabled"],Ve=["disabled"],Le=["disabled"],Ue={class:"json-format__info"},Me={key:0,class:"json-format__status json-format__status--success"},Fe={key:1,class:"json-format__status json-format__status--error"},Ke={class:"json-format__content"},He={key:0,class:"json-format__error"},Xe={key:1,class:"json-format__error"},Ge={key:2,class:"json-format__viewer"},ee=Z(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(a=>({"8d5bfdae":y.value.colors.border,"14a51bab":y.value.colors.background,"0504ed6a":y.value.colors.text,a5b566c4:y.value.colors.surfaceBackground,a172158a:y.value.colors.buttonBorder,"5ffdb6bd":y.value.colors.buttonBackground,"796bbdfc":y.value.colors.buttonText,"225a5f02":y.value.colors.buttonBackgroundHover,"22d2aed3":y.value.colors.buttonPrimary,"27e37629":y.value.colors.buttonPrimaryHover,"1d58ec74":y.value.colors.successBackground,"04bd5ab4":y.value.colors.success,"0242d8f9":y.value.colors.errorBackground,ca699d2a:y.value.colors.error,"4d5522c2":y.value.colors.scrollbarTrack,"4d50e34d":y.value.colors.scrollbarThumb,"6854fdef":y.value.colors.scrollbarThumbHover}));const o=r,n=t,l=s.ref(null),c=s.ref(""),p=s.ref(new Set),h=s.ref(null),f=s.ref(""),k=s.computed(()=>c.value===""),y=s.computed(()=>De(o.theme)),C=s.computed(()=>f.value?null:h.value!==null?h.value:l.value),m=a=>{if(!a.trim()){l.value=null,c.value="",h.value=null,f.value="";return}try{let u=a;u=u.replace(/:\s*(\d{16,})\s*([,}])/g,': "$1"$2'),u=u.replace(/:\s*(\d+\.\d*?0+)\s*([,}])/g,': "$1"$2'),l.value=JSON.parse(u),c.value="",h.value=null,f.value="",s.nextTick(()=>{C.value!==null&&V()})}catch(u){c.value=u instanceof Error?u.message:"Unknown parsing error",l.value=null,h.value=null,f.value=""}},v=a=>{if(!a||!a.expression.trim()){A();return}if(!l.value){f.value="No valid JSON data to filter";return}try{let u;if(a.type==="jsonpath")u=O({path:a.expression,json:l.value}),u.length===1&&a.expression.includes("$[")===!1&&!a.expression.endsWith("[*]")?h.value=u[0]:h.value=u;else if(a.type==="js")u=new Function("data",`
1
+ (function(D,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(D=typeof globalThis<"u"?globalThis:D||self,s(D.LoneFormat={},D.Vue))})(this,function(D,s){"use strict";class te{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 re{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 i{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+i.version}static addUnaryOp(e){return i.max_unop_len=Math.max(e.length,i.max_unop_len),i.unary_ops[e]=1,i}static addBinaryOp(e,t,o){return i.max_binop_len=Math.max(e.length,i.max_binop_len),i.binary_ops[e]=t,o?i.right_associative.add(e):i.right_associative.delete(e),i}static addIdentifierChar(e){return i.additional_identifier_chars.add(e),i}static addLiteral(e,t){return i.literals[e]=t,i}static removeUnaryOp(e){return delete i.unary_ops[e],e.length===i.max_unop_len&&(i.max_unop_len=i.getMaxKeyLen(i.unary_ops)),i}static removeAllUnaryOps(){return i.unary_ops={},i.max_unop_len=0,i}static removeIdentifierChar(e){return i.additional_identifier_chars.delete(e),i}static removeBinaryOp(e){return delete i.binary_ops[e],e.length===i.max_binop_len&&(i.max_binop_len=i.getMaxKeyLen(i.binary_ops)),i.right_associative.delete(e),i}static removeAllBinaryOps(){return i.binary_ops={},i.max_binop_len=0,i}static removeLiteral(e){return delete i.literals[e],i}static removeAllLiterals(){return i.literals={},i}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 i(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 i.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!i.binary_ops[String.fromCharCode(e)]||i.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return i.isIdentifierStart(e)||i.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(i.hooks[e]){const o={context:this,node:t};return i.hooks.run(e,o),o.node}return t}searchHook(e){if(i.hooks[e]){const t={context:this};return i.hooks[e].find(function(o){return o.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===i.SPACE_CODE||e===i.TAB_CODE||e===i.LF_CODE||e===i.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:i.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===i.SEMCOL_CODE||o===i.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,i.max_binop_len),t=e.length;for(;t>0;){if(i.binary_ops.hasOwnProperty(e)&&(!i.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!i.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,l,u,p,h,f;if(u=this.gobbleToken(),!u||(t=this.gobbleBinaryOp(),!t))return u;for(l={value:t,prec:i.binaryPrecedence(t),right_a:i.right_associative.has(t)},p=this.gobbleToken(),p||this.throwError("Expected expression after "+t),n=[u,l,p];t=this.gobbleBinaryOp();){if(o=i.binaryPrecedence(t),o===0){this.index-=t.length;break}l={value:t,prec:o,right_a:i.right_associative.has(t)},f=t;const _=m=>l.right_a&&m.right_a?o>m.prec:o<=m.prec;for(;n.length>2&&_(n[n.length-2]);)p=n.pop(),t=n.pop().value,u=n.pop(),e={type:i.BINARY_EXP,operator:t,left:u,right:p},n.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+f),n.push(l,e)}for(h=n.length-1,e=n[h];h>1;)e={type:i.BINARY_EXP,operator:n[h-1].value,left:n[h-2],right:e},h-=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,i.isDecimalDigit(e)||e===i.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===i.SQUOTE_CODE||e===i.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===i.OBRACK_CODE)n=this.gobbleArray();else{for(t=this.expr.substr(this.index,i.max_unop_len),o=t.length;o>0;){if(i.unary_ops.hasOwnProperty(t)&&(!i.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!i.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=o;const l=this.gobbleToken();return l||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:i.UNARY_EXP,operator:t,argument:l,prefix:!0})}t=t.substr(0,--o)}i.isIdentifierStart(e)?(n=this.gobbleIdentifier(),i.literals.hasOwnProperty(n.name)?n={type:i.LITERAL,value:i.literals[n.name],raw:n.name}:n.name===i.this_str&&(n={type:i.THIS_EXP})):e===i.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===i.PERIOD_CODE||t===i.OBRACK_CODE||t===i.OPAREN_CODE||t===i.QUMARK_CODE;){let o;if(t===i.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==i.PERIOD_CODE)break;o=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===i.OBRACK_CODE?(e={type:i.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},e.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==i.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===i.OPAREN_CODE?e={type:i.CALL_EXP,arguments:this.gobbleArguments(i.CPAREN_CODE),callee:e}:(t===i.PERIOD_CODE||o)&&(o&&this.index--,this.gobbleSpaces(),e={type:i.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(;i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===i.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);i.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++));i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);i.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return o=this.code,i.isIdentifierStart(o)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(o===i.PERIOD_CODE||e.length===1&&e.charCodeAt(0)===i.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:i.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 l=this.expr.charAt(this.index++);if(l===o){n=!0;break}else if(l==="\\")switch(l=this.expr.charAt(this.index++),l){case"n":e+=`
2
+ `;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=l}else e+=l}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:i.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(i.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,i.isIdentifierPart(e));)this.index++;return{type:i.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 l=this.code;if(l===e){o=!0,this.index++,e===i.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(l===i.COMMA_CODE){if(this.index++,n++,n!==t.length){if(e===i.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===i.CBRACK_CODE)for(let u=t.length;u<n;u++)t.push(null)}}else if(t.length!==n&&n!==0)this.throwError("Expected comma");else{const u=this.gobbleExpression();(!u||u.type===i.COMPOUND)&&this.throwError("Expected comma"),t.push(u)}}return o||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(i.CPAREN_CODE);if(this.code===i.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:i.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:i.ARRAY_EXP,elements:this.gobbleArguments(i.CBRACK_CODE)}}}const ne=new te;Object.assign(i,{hooks:ne,plugins:new re(i),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"}),i.max_unop_len=i.getMaxKeyLen(i.unary_ops),i.max_binop_len=i.getMaxKeyLen(i.binary_ops);const P=r=>new i(r).parse(),oe=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(i).filter(r=>!oe.includes(r)&&P[r]===void 0).forEach(r=>{P[r]=i[r]}),P.Jsep=i;const se="ConditionalExpression";var ie={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 l=this.gobbleExpression();if(l||this.throwError("Expected expression"),t.node={type:se,test:o,consequent:n,alternate:l},o.operator&&r.binary_ops[o.operator]<=.9){let u=o;for(;u.right.operator&&r.binary_ops[u.right.operator]<=.9;)u=u.right;t.node.test=u.right,u.right=t.node,t.node=o}}else this.throwError("Expected :")}})}};P.plugins.register(ie);const W=47,ae=92;var le={name:"regex",init(r){r.hooks.add("gobble-token",function(t){if(this.code===W){const o=++this.index;let n=!1;for(;this.index<this.expr.length;){if(this.code===W&&!n){const l=this.expr.slice(o,this.index);let u="";for(;++this.index<this.expr.length;){const h=this.code;if(h>=97&&h<=122||h>=65&&h<=90||h>=48&&h<=57)u+=this.char;else break}let p;try{p=new RegExp(l,u)}catch(h){this.throwError(h.message)}return t.node={type:r.LITERAL,value:p,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===ae?2:1}this.throwError("Unclosed Regex")}})}};const Y=43,V={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[Y,45],assignmentPrecedence:.9,init(r){const e=[r.IDENTIFIER,r.MEMBER_EXP];V.assignmentOperators.forEach(o=>r.addBinaryOp(o,V.assignmentPrecedence,!0)),r.hooks.add("gobble-token",function(n){const l=this.code;V.updateOperators.some(u=>u===l&&u===this.expr.charCodeAt(this.index+1))&&(this.index+=2,n.node={type:"UpdateExpression",operator:l===Y?"++":"--",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 l=this.code;V.updateOperators.some(u=>u===l&&u===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:l===Y?"++":"--",argument:n.node,prefix:!1})}}),r.hooks.add("after-expression",function(n){n.node&&t(n.node)});function t(o){V.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)})}}};P.plugins.register(le,V),P.addUnaryOp("typeof"),P.addLiteral("null",null),P.addLiteral("undefined",void 0);const ce=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),w={evalAst(r,e){switch(r.type){case"BinaryExpression":case"LogicalExpression":return w.evalBinaryExpression(r,e);case"Compound":return w.evalCompound(r,e);case"ConditionalExpression":return w.evalConditionalExpression(r,e);case"Identifier":return w.evalIdentifier(r,e);case"Literal":return w.evalLiteral(r,e);case"MemberExpression":return w.evalMemberExpression(r,e);case"UnaryExpression":return w.evalUnaryExpression(r,e);case"ArrayExpression":return w.evalArrayExpression(r,e);case"CallExpression":return w.evalCallExpression(r,e);case"AssignmentExpression":return w.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](w.evalAst(r.left,e),()=>w.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=w.evalAst(n,e)}return t},evalConditionalExpression(r,e){return w.evalAst(r.test,e)?w.evalAst(r.consequent,e):w.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?w.evalAst(r.property):r.property.name),o=w.evalAst(r.object,e);if(o==null)throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);if(!Object.hasOwn(o,t)&&ce.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=>-w.evalAst(o,e),"!":o=>!w.evalAst(o,e),"~":o=>~w.evalAst(o,e),"+":o=>+w.evalAst(o,e),typeof:o=>typeof w.evalAst(o,e)}[r.operator](r.argument)},evalArrayExpression(r,e){return r.elements.map(t=>w.evalAst(t,e))},evalCallExpression(r,e){const t=r.arguments.map(n=>w.evalAst(n,e));return w.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=w.evalAst(r.right,e);return e[t]=o,e[t]}};class ue{constructor(e){this.code=e,this.ast=P(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return w.evalAst(this.ast,t)}}function j(r,e){return r=r.slice(),r.push(e),r}function q(r,e){return e=e.slice(),e.unshift(r),e}class de 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 O(r,e,t,o,n){if(!(this instanceof O))try{return new O(r,e,t,o,n)}catch(u){if(!u.avoidNew)throw u;return u.value}typeof r=="string"&&(n=o,o=t,t=e,e=r,r=null);const l=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 u={path:l?r.path:e};l?"json"in r&&(u.json=r.json):u.json=t;const p=this.evaluate(u);if(!p||typeof p!="object")throw new de(p);return p}}O.prototype.evaluate=function(r,e,t,o){let n=this.parent,l=this.parentProperty,{flatten:u,wrap:p}=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),u=Object.hasOwn(r,"flatten")?r.flatten:u,this.currResultType=Object.hasOwn(r,"resultType")?r.resultType:this.currResultType,this.currSandbox=Object.hasOwn(r,"sandbox")?r.sandbox:this.currSandbox,p=Object.hasOwn(r,"wrap")?r.wrap:p,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,l=Object.hasOwn(r,"parentProperty")?r.parentProperty:l,r=r.path}if(n=n||null,l=l||null,Array.isArray(r)&&(r=O.toPathString(r)),!r&&r!==""||!e)return;const h=O.toPathArray(r);h[0]==="$"&&h.length>1&&h.shift(),this._hasParentSelector=null;const f=this._trace(h,e,["$"],n,l,t).filter(function(_){return _&&!_.isParentSelector});return f.length?!p&&f.length===1&&!f[0].hasArrExpr?this._getPreferredOutput(f[0]):f.reduce((_,m)=>{const C=this._getPreferredOutput(m);return u&&Array.isArray(C)?_=_.concat(C):_.push(C),_},[]):p?[]:void 0},O.prototype._getPreferredOutput=function(r){const e=this.currResultType;switch(e){case"all":{const t=Array.isArray(r.path)?r.path:O.toPathArray(r.path);return r.pointer=O.toPointer(t),r.path=typeof r.path=="string"?r.path:O.toPathString(r.path),r}case"value":case"parent":case"parentProperty":return r[e];case"path":return O.toPathString(r[e]);case"pointer":return O.toPointer(r.path);default:throw new TypeError("Unknown result type")}},O.prototype._handleCallback=function(r,e,t){if(e){const o=this._getPreferredOutput(r);r.path=typeof r.path=="string"?r.path:O.toPathString(r.path),e(o,t,r)}},O.prototype._trace=function(r,e,t,o,n,l,u,p){let h;if(!r.length)return h={path:t,value:e,parent:o,parentProperty:n,hasArrExpr:u},this._handleCallback(h,l,"value"),h;const f=r[0],_=r.slice(1),m=[];function C(k){Array.isArray(k)?k.forEach(v=>{m.push(v)}):m.push(k)}if((typeof f!="string"||p)&&e&&Object.hasOwn(e,f))C(this._trace(_,e[f],j(t,f),e,f,l,u));else if(f==="*")this._walk(e,k=>{C(this._trace(_,e[k],j(t,k),e,k,l,!0,!0))});else if(f==="..")C(this._trace(_,e,t,o,n,l,u)),this._walk(e,k=>{typeof e[k]=="object"&&C(this._trace(r.slice(),e[k],j(t,k),e,k,l,!0))});else{if(f==="^")return this._hasParentSelector=!0,{path:t.slice(0,-1),expr:_,isParentSelector:!0};if(f==="~")return h={path:j(t,f),value:n,parent:o,parentProperty:null},this._handleCallback(h,l,"property"),h;if(f==="$")C(this._trace(_,e,t,null,null,l,u));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(f))C(this._slice(f,_,e,t,o,n,l));else if(f.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const k=f.replace(/^\?\((.*?)\)$/u,"$1"),v=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(k);v?this._walk(e,A=>{const I=[v[2]],N=v[1]?e[A][v[1]]:e[A];this._trace(I,N,t,o,n,l,!0).length>0&&C(this._trace(_,e[A],j(t,A),e,A,l,!0))}):this._walk(e,A=>{this._eval(k,e[A],A,t,o,n)&&C(this._trace(_,e[A],j(t,A),e,A,l,!0))})}else if(f[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");C(this._trace(q(this._eval(f,e,t.at(-1),t.slice(0,-1),o,n),_),e,t,o,n,l,u))}else if(f[0]==="@"){let k=!1;const v=f.slice(1,-2);switch(v){case"scalar":(!e||!["object","function"].includes(typeof e))&&(k=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===v&&(k=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(k=!0);break;case"number":Number.isFinite(e)&&(k=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(k=!0);break;case"object":e&&typeof e===v&&(k=!0);break;case"array":Array.isArray(e)&&(k=!0);break;case"other":k=this.currOtherTypeCallback(e,t,o,n);break;case"null":e===null&&(k=!0);break;default:throw new TypeError("Unknown value type "+v)}if(k)return h={path:t,value:e,parent:o,parentProperty:n},this._handleCallback(h,l,"value"),h}else if(f[0]==="`"&&e&&Object.hasOwn(e,f.slice(1))){const k=f.slice(1);C(this._trace(_,e[k],j(t,k),e,k,l,u,!0))}else if(f.includes(",")){const k=f.split(",");for(const v of k)C(this._trace(q(v,_),e,t,o,n,l,!0))}else!p&&e&&Object.hasOwn(e,f)&&C(this._trace(_,e[f],j(t,f),e,f,l,u,!0))}if(this._hasParentSelector)for(let k=0;k<m.length;k++){const v=m[k];if(v&&v.isParentSelector){const A=this._trace(v.expr,e,v.path,o,n,l,u);if(Array.isArray(A)){m[k]=A[0];const I=A.length;for(let N=1;N<I;N++)k++,m.splice(k,0,A[N])}else m[k]=A}}return m},O.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)})},O.prototype._slice=function(r,e,t,o,n,l,u){if(!Array.isArray(t))return;const p=t.length,h=r.split(":"),f=h[2]&&Number.parseInt(h[2])||1;let _=h[0]&&Number.parseInt(h[0])||0,m=h[1]&&Number.parseInt(h[1])||p;_=_<0?Math.max(0,_+p):Math.min(p,_),m=m<0?Math.max(0,m+p):Math.min(p,m);const C=[];for(let k=_;k<m;k+=f)this._trace(q(k,e),t,o,n,l,u,!0).forEach(A=>{C.push(A)});return C},O.prototype._eval=function(r,e,t,o,n,l){this.currSandbox._$_parentProperty=l,this.currSandbox._$_parent=n,this.currSandbox._$_property=t,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const u=r.includes("@path");u&&(this.currSandbox._$_path=O.toPathString(o.concat([t])));const p=this.currEval+"Script:"+r;if(!O.cache[p]){let h=r.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(u&&(h=h.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)O.cache[p]=new this.safeVm.Script(h);else if(this.currEval==="native")O.cache[p]=new this.vm.Script(h);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const f=this.currEval;O.cache[p]=new f(h)}else if(typeof this.currEval=="function")O.cache[p]={runInNewContext:f=>this.currEval(h,f)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return O.cache[p].runInNewContext(this.currSandbox)}catch(h){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+h.message+": "+r)}},O.cache={},O.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},O.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},O.toPathArray=function(r){const{cache:e}=O;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(l,u){return"[#"+(t.push(u)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(l,u){return"['"+u.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(l,u){return";"+u.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(l){const u=l.match(/#(\d+)/u);return!u||!u[1]?l:t[u[1]]});return e[r]=n,e[r].concat()},O.prototype.safeVm={Script:ue};const he=function(r,e,t){const o=r.length;for(let n=0;n<o;n++){const l=r[n];t(l)&&e.push(r.splice(n--,1)[0])}};class fe{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const o=Object.keys(e),n=[];he(o,n,f=>typeof e[f]=="function");const l=o.map(f=>e[f]);t=n.reduce((f,_)=>{let m=e[_].toString();return/function/u.test(m)||(m="function "+m),"var "+_+"="+m+";"+f},"")+t,!/(['"])use strict\1/u.test(t)&&!o.includes("arguments")&&(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const p=t.lastIndexOf(";"),h=p!==-1?t.slice(0,p+1)+" return "+t.slice(p+1):" return "+t;return new Function(...o,h)(...l)}}O.prototype.vm={Script:fe};const pe={class:"json-node"},ye={key:0,class:"json-node__container"},ge={class:"json-node__line"},be={key:2,class:"json-node__colon"},me=["title"],Ee={key:3,class:"json-node__collapsed"},ke={key:4,class:"json-node__comma"},_e={key:0,class:"json-node__children"},xe={class:"json-node__children-content"},Oe={class:"json-node__line json-node__closing-bracket"},Ce={class:"json-node__bracket"},we={key:0,class:"json-node__comma"},Ae={key:1,class:"json-node__primitive"},ve={key:2,class:"json-node__colon"},Se=["title"],Ne={key:0,class:"json-node__comma"},Be=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(d=>({"41b58a02":d.level,"63accfe8":d.theme.colors.syntaxKey,"7a4b22f6":d.theme.colors.hoverBackground,"5865f1b1":d.theme.colors.syntaxBracket,"79c93d33":d.theme.colors.textSecondary,"59ced5e8":d.theme.colors.syntaxString,51525120:d.theme.colors.syntaxNumber,"5410b131":d.theme.colors.syntaxBoolean,"11eec51e":d.theme.colors.syntaxNull,ac53437c:d.theme.colors.background,"15cbe7d4":d.theme.colors.indentLine}));const t=r,o=e,n=s.ref(!1),l=s.ref(!1),u=s.ref(""),p=s.ref(""),h=d=>{if(!/^-?\d+(\.\d+)?$/.test(d))return!1;const x=Number(d);return!Number.isSafeInteger(x)||d.length>15},f=s.computed(()=>t.value!==null&&typeof t.value=="object"),_=s.computed(()=>Array.isArray(t.value)),m=s.computed(()=>t.path?t.path:t.keyName?t.keyName:"root"),C=s.computed(()=>t.expanded.has(m.value)),k=s.computed(()=>t.keyName),v=s.computed(()=>_.value?"[":"{"),A=s.computed(()=>_.value?"]":"}"),I=s.computed(()=>{if(!t.value)return"";const x=Object.keys(t.value).length;return _.value?x>0?` ${x} items `:" ":x>0?` ${x} keys `:" "}),N=s.computed(()=>{const d=typeof t.value;return t.value===null?"json-node__value--null":d==="boolean"?"json-node__value--boolean":d==="number"?"json-node__value--number":d==="string"?h(t.value)?"json-node__value--number":"json-node__value--string":""}),M=s.computed(()=>l.value?p.value:t.value===null?"null":typeof t.value=="boolean"||typeof t.value=="number"?String(t.value):typeof t.value=="string"?h(t.value)?t.value:`"${t.value}"`:String(t.value)),z=s.computed(()=>"Click to edit, double-click to copy"),G=d=>t.level===0?d:m.value?`${m.value}.${d}`:d,$=d=>{const x=Object.keys(t.value);return x.indexOf(d)===x.length-1},F=()=>{o("toggle-expand",m.value)},K=()=>{t.level!==0&&(n.value=!0,u.value=t.keyName,s.nextTick(()=>{const d=document.querySelectorAll(".json-node__key-input"),x=d[d.length-1];x&&(x.focus(),x.select())}))},Q=()=>{f.value||(l.value=!0,typeof t.value=="string"&&h(t.value)||typeof t.value=="string"?p.value=t.value:p.value=String(t.value),s.nextTick(()=>{const d=document.querySelectorAll(".json-node__value-input"),x=d[d.length-1];x&&(x.focus(),x.select())}))},R=()=>{if(t.level===0||!n.value)return;const d=u.value.trim();if(!d){X();return}if(d===t.keyName){n.value=!1;return}n.value=!1,o("update:key",m.value,d)},H=()=>{try{let d;const x=p.value.trim();if(x==="null")d=null;else if(x==="true"||x==="false")d=x==="true";else if(!isNaN(Number(x))&&x!==""){const U=Number(x);!Number.isSafeInteger(U)||x.length>15?d=x:d=U}else d=p.value;o("update:value",m.value,d),l.value=!1}catch(d){console.error("Failed to parse value:",d),l.value=!1}},X=()=>{n.value=!1,u.value=t.keyName},L=()=>{l.value=!1,typeof t.value=="string"&&h(t.value)||typeof t.value=="string"?p.value=t.value:p.value=String(t.value)};return(d,x)=>{const U=s.resolveComponent("JsonNode",!0);return s.openBlock(),s.createElementBlock("div",pe,[f.value?(s.openBlock(),s.createElementBlock("div",ye,[s.createElementVNode("div",ge,[d.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:K,title:"Click to edit key"},' "'+s.toDisplayString(k.value)+'" ',1)):s.createCommentVNode("",!0),d.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":x[0]||(x[0]=a=>u.value=a),onKeyup:[s.withKeys(R,["enter"]),s.withKeys(X,["escape"])],onBlur:R,class:"json-node__key-input"},null,544)),[[s.vModelText,u.value]]):s.createCommentVNode("",!0),d.keyName?(s.openBlock(),s.createElementBlock("span",be,": ")):s.createCommentVNode("",!0),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:F,title:C.value?"Click to collapse":"Click to expand"},s.toDisplayString(v.value),9,me),C.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",Ee,[s.createTextVNode(s.toDisplayString(I.value)+" ",1),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:F},s.toDisplayString(A.value),1)])),!C.value&&!d.isLast?(s.openBlock(),s.createElementBlock("span",ke,",")):s.createCommentVNode("",!0)]),C.value?(s.openBlock(),s.createElementBlock("div",_e,[s.createElementVNode("div",xe,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(d.value,(a,c)=>(s.openBlock(),s.createElementBlock("div",{key:c,class:"json-node__child"},[s.createVNode(U,{value:a,"key-name":_.value?"":String(c),level:d.level+1,path:G(String(c)),expanded:d.expanded,theme:d.theme,"onUpdate:value":x[1]||(x[1]=(g,y)=>d.$emit("update:value",g,y)),onToggleExpand:x[2]||(x[2]=g=>d.$emit("toggle-expand",g)),onCopy:x[3]||(x[3]=g=>d.$emit("copy",g)),"onUpdate:key":x[4]||(x[4]=(g,y)=>d.$emit("update:key",g,y)),"is-last":$(String(c))},null,8,["value","key-name","level","path","expanded","theme","is-last"])]))),128))]),s.createElementVNode("div",Oe,[s.createElementVNode("span",Ce,s.toDisplayString(A.value),1),d.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",we,","))])])):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",Ae,[d.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:K,title:"Click to edit key"},' "'+s.toDisplayString(k.value)+'" ',1)):s.createCommentVNode("",!0),d.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":x[5]||(x[5]=a=>u.value=a),onKeyup:[s.withKeys(R,["enter"]),s.withKeys(X,["escape"])],onBlur:R,class:"json-node__key-input"},null,544)),[[s.vModelText,u.value]]):s.createCommentVNode("",!0),d.keyName?(s.openBlock(),s.createElementBlock("span",ve,": ")):s.createCommentVNode("",!0),l.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",{key:3,class:s.normalizeClass(["json-node__value",N.value]),onClick:Q,onDblclick:x[6]||(x[6]=a=>d.$emit("copy",d.value)),title:z.value},[s.createTextVNode(s.toDisplayString(M.value),1),d.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",Ne,","))],42,Se)),l.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:4,"onUpdate:modelValue":x[7]||(x[7]=a=>p.value=a),onKeyup:[s.withKeys(H,["enter"]),s.withKeys(L,["escape"])],onBlur:H,class:"json-node__value-input"},null,544)),[[s.vModelText,p.value]]):s.createCommentVNode("",!0)]))])}}}),Z=(r,e)=>{const t=r.__vccOpts||r;for(const[o,n]of e)t[o]=n;return t},Pe=Z(Be,[["__scopeId","data-v-f3f3cbc9"]]),J={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"}},Te={"github-light":J,"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 De(r="github-light"){return Te[r]||J}const je={key:0,class:"json-format__toolbar"},Ie={class:"json-format__actions"},$e=["disabled"],Re=["disabled"],Ve=["disabled"],Le=["disabled"],Ue={class:"json-format__info"},Me={key:0,class:"json-format__status json-format__status--success"},Fe={key:1,class:"json-format__status json-format__status--error"},Ke={class:"json-format__content"},He={key:0,class:"json-format__error"},Xe={key:1,class:"json-format__error"},Ge={key:2,class:"json-format__viewer"},ee=Z(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(a=>({dd679ea0:m.value.colors.border,"0543a09c":m.value.colors.background,"630352b1":m.value.colors.text,be141a92:m.value.colors.surfaceBackground,"4e0b2382":m.value.colors.buttonBorder,ee392cf8:m.value.colors.buttonBackground,"6224d203":m.value.colors.buttonText,c17e7bd0:m.value.colors.buttonBackgroundHover,"5c94496c":m.value.colors.buttonPrimary,a3b0d9a0:m.value.colors.buttonPrimaryHover,"1129928d":m.value.colors.successBackground,"24ed13ff":m.value.colors.success,"5bef9d5c":m.value.colors.errorBackground,"06cd15f8":m.value.colors.error,"4bc6db49":m.value.colors.scrollbarTrack,"4bc29bd4":m.value.colors.scrollbarThumb,aad6fc70:m.value.colors.scrollbarThumbHover}));const o=r,n=t,l=s.ref(null),u=s.ref(""),p=s.ref(new Set),h=s.ref(null),f=s.ref(""),_=s.computed(()=>u.value===""),m=s.computed(()=>De(o.theme)),C=s.computed(()=>f.value?null:h.value!==null?h.value:l.value),k=a=>{if(!a.trim()){l.value=null,u.value="",h.value=null,f.value="";return}try{let c=a;try{l.value=JSON.parse(c),u.value="",h.value=null,f.value="",s.nextTick(()=>{C.value!==null&&$()});return}catch{}const g=c.split("");let y=!1,b=!1;for(let E=0;E<g.length;E++)g[E]==="\\"&&y?b=!b:g[E]==='"'&&!b?y=!y:b=!1;y||(c=c.replace(/:\s*(\d{16,})\s*([,}\]])/g,': "$1"$2'),c=c.replace(/:\s*(\d+\.\d*?0+)\s*([,}\]])/g,': "$1"$2')),l.value=JSON.parse(c),u.value="",h.value=null,f.value="",s.nextTick(()=>{C.value!==null&&$()})}catch(c){u.value=c instanceof Error?c.message:"Unknown parsing error",l.value=null,h.value=null,f.value=""}},v=a=>{if(!a||!a.expression.trim()){A();return}if(!l.value){f.value="No valid JSON data to filter";return}try{let c;if(a.type==="jsonpath")c=O({path:a.expression,json:l.value}),c.length===1&&a.expression.includes("$[")===!1&&!a.expression.endsWith("[*]")?h.value=c[0]:h.value=c;else if(a.type==="js")c=new Function("data",`
3
3
  try {
4
4
  return ${a.expression};
5
5
  } catch (error) {
6
6
  throw new Error('JavaScript expression error: ' + error.message);
7
7
  }
8
- `)(l.value),h.value=u;else throw new Error(`Unsupported filter type: ${a.type}`);f.value="",s.nextTick(()=>{V()})}catch(u){f.value=u instanceof Error?u.message:"Filter execution error",h.value=null}},A=()=>{h.value=null,f.value=""};s.watch(()=>o.modelValue,a=>{m(a)},{immediate:!0});const I=a=>{if(!/^-?\d+(\.\d+)?$/.test(a))return!1;const u=Number(a);return!Number.isSafeInteger(u)||a.length>15},N=(a,u,g)=>JSON.stringify(a,(b,E)=>{if(typeof E=="string"&&I(E))return`__BIG_NUMBER__${E}__BIG_NUMBER__`;if(typeof E=="string"&&/^-?\d+(\.\d+)?$/.test(E)){const x=Number(E);if(Number.isSafeInteger(x)&&x.toString()===E)return x;if(!Number.isNaN(x)&&isFinite(x)&&E.includes("."))return x.toString()===E?x:`__PRESERVE_STRING__${E}__PRESERVE_STRING__`;if(!Number.isNaN(x)&&isFinite(x))return x}return u&&typeof u=="function"?u(b,E):E},g).replace(/"__BIG_NUMBER__(.+?)__BIG_NUMBER__"/g,"$1").replace(/"__PRESERVE_STRING__(.+?)__PRESERVE_STRING__"/g,"$1"),M=(a,u)=>{if(!o.readonly)try{const g=z(l.value,a,u),b=N(g,null,2);n("update:modelValue",b)}catch(g){console.error("Failed to update JSON:",g)}},z=(a,u,g)=>{if(!u||u==="root")return g;const b=u.split("."),E=L(a,b.slice(0,-1));let x=E;for(let B=0;B<b.length-1;B++){const T=b[B];T!=="root"&&(Array.isArray(x)?x=x[parseInt(T)]:x=x[T])}const S=b[b.length-1];return S==="root"?g:(Array.isArray(x)?x[parseInt(S)]=g:x[S]=g,E)},G=a=>{p.value.has(a)?p.value.delete(a):p.value.add(a)},V=()=>{const a=new Set,u=(g,b="")=>{g!==null&&typeof g=="object"&&(a.add(b||"root"),Array.isArray(g)?g.forEach((E,x)=>{const S=b?`${b}.${x}`:`${x}`;u(E,S)}):Object.keys(g).forEach(E=>{const x=b?`${b}.${E}`:E;u(g[E],x)}))};u(C.value),p.value=a,n("expand-all")},F=()=>{p.value=new Set(["root"]),n("collapse-all")},K=async()=>{if(k.value)try{const a=C.value,u=N(a,null,2);await navigator.clipboard.writeText(u),n("copy-success",u)}catch(a){console.error("Failed to copy JSON:",a),n("copy-error",a instanceof Error?a:new Error("Failed to copy JSON"))}},Q=()=>{if(k.value)try{const a=C.value,u=N(a);n("update:modelValue",u),n("compress",u)}catch(a){console.error("Failed to compress JSON:",a)}},$=async a=>{try{let u;typeof a=="string"&&I(a)?u=a:typeof a=="string"?u=`"${a}"`:u=JSON.stringify(a),await navigator.clipboard.writeText(u)}catch(u){console.error("Failed to copy value:",u)}},H=(a,u)=>{if(!o.readonly)try{const g=X(l.value,a,u),b=N(g,null,2);n("update:modelValue",b),U(a,u)}catch(g){console.error("Failed to rename key:",g)}},X=(a,u,g)=>{if(!u||u==="root")return a;const b=u.split("."),E=L(a,b.slice(0,-1));if(b.length===1){const B=b[0];return E&&typeof E=="object"&&!Array.isArray(E)?d(E,B,g):E}let x=E;for(let B=0;B<b.length-1;B++){const T=b[B];Array.isArray(x)?x=x[parseInt(T)]:x=x[T]}const S=b[b.length-1];if(!Array.isArray(x)&&x&&typeof x=="object"){const B=d(x,S,g),T=b.slice(0,-1);T.length>0&&_(E,T,B)}return E},L=(a,u)=>{if(u.length===0)return a;if(Array.isArray(a)){const g=[...a],b=u[0],E=parseInt(b);return u.length===1||(g[E]=L(a[E],u.slice(1))),g}else if(a&&typeof a=="object"){const g={...a},b=u[0];return u.length===1||(g[b]=L(a[b],u.slice(1))),g}return a},d=(a,u,g)=>{if(!a||typeof a!="object"||Array.isArray(a))return a;const b=Object.keys(a),E={};for(const x of b)x===u?E[g]=a[x]:E[x]=a[x];return E},_=(a,u,g)=>{let b=a;for(let x=0;x<u.length-1;x++){const S=u[x];Array.isArray(b)?b=b[parseInt(S)]:b=b[S]}const E=u[u.length-1];Array.isArray(b)?b[parseInt(E)]=g:b[E]=g},U=(a,u)=>{const g=new Set;p.value.forEach(b=>{if(b===a){const E=a.split(".");E[E.length-1]=u,g.add(E.join("."))}else if(b.startsWith(a+".")){const E=a.split(".");E[E.length-1]=u;const x=E.join("."),S=b.substring(a.length);g.add(x+S)}else g.add(b)}),p.value=g};return e({copyJson:K,compressSource:Q,expandAll:V,collapseAll:F,toggleExpand:G,updateValue:M,updateKey:H,filter:v,clearFilter:A,isValidJson:()=>k.value,getParsedJson:()=>l.value,getFilteredJson:()=>h.value,getExpandedNodes:()=>p.value,getParseError:()=>c.value,getFilterError:()=>f.value,parseJson:a=>m(a),copyValue:a=>$(a)}),(a,u)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["json-format",`json-format--${y.value.name}`])},[a.showToolbar?(s.openBlock(),s.createElementBlock("div",je,[s.createElementVNode("div",Ie,[s.createElementVNode("button",{class:"json-format__btn json-format__btn--primary",onClick:K,disabled:!k.value,title:"Copy JSON"}," 📋 Copy ",8,$e),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:V,disabled:!k.value,title:"Expand All"}," ⬇️ Expand All ",8,Re),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:F,disabled:!k.value,title:"Collapse All"}," ➡️ Collapse All ",8,Ve),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:Q,disabled:!k.value,title:"Compress JSON"}," 📦 Compress ",8,Le)]),s.createElementVNode("div",Ue,[k.value?(s.openBlock(),s.createElementBlock("span",Me," ✅ Valid JSON ")):(s.openBlock(),s.createElementBlock("span",Fe," ❌ Invalid JSON "))])])):s.createCommentVNode("",!0),s.createElementVNode("div",Ke,[k.value?f.value?(s.openBlock(),s.createElementBlock("div",Xe,[u[1]||(u[1]=s.createElementVNode("h4",null,"Filter Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(f.value),1)])):(s.openBlock(),s.createElementBlock("div",Ge,[s.createVNode(Pe,{value:C.value,"key-name":"",level:0,expanded:p.value,"is-last":!0,theme:y.value,"onUpdate:value":M,onToggleExpand:G,onCopy:$,"onUpdate:key":H},null,8,["value","expanded","theme"])])):(s.openBlock(),s.createElementBlock("div",He,[u[0]||(u[0]=s.createElementVNode("h4",null,"JSON Parse Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(c.value),1)]))])],2))}}),[["__scopeId","data-v-38157665"]]),Qe=[ee],Ye={install:r=>{Qe.forEach(e=>{const t=e.name||e.__name||"UnknownComponent";r.component(t,e)})}};D.JsonFormat=ee,D.default=Ye,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
8
+ `)(l.value),h.value=c;else throw new Error(`Unsupported filter type: ${a.type}`);f.value="",s.nextTick(()=>{$()})}catch(c){f.value=c instanceof Error?c.message:"Filter execution error",h.value=null}},A=()=>{h.value=null,f.value=""};s.watch(()=>o.modelValue,a=>{k(a)},{immediate:!0});const I=a=>{if(!/^-?\d+(\.\d+)?$/.test(a))return!1;const c=Number(a);return!Number.isSafeInteger(c)||a.length>15},N=(a,c,g)=>JSON.stringify(a,(y,b)=>{if(typeof b=="string"&&I(b))return`__BIG_NUMBER__${b}__BIG_NUMBER__`;if(typeof b=="string"&&/^-?\d+(\.\d+)?$/.test(b)){const E=Number(b);if(Number.isSafeInteger(E)&&E.toString()===b)return E;if(!Number.isNaN(E)&&isFinite(E)&&b.includes("."))return E.toString()===b?E:`__PRESERVE_STRING__${b}__PRESERVE_STRING__`;if(!Number.isNaN(E)&&isFinite(E))return E}return c&&typeof c=="function"?c(y,b):b},g).replace(/"__BIG_NUMBER__(.+?)__BIG_NUMBER__"/g,"$1").replace(/"__PRESERVE_STRING__(.+?)__PRESERVE_STRING__"/g,"$1"),M=(a,c)=>{if(!o.readonly)try{const g=z(l.value,a,c),y=N(g,null,2);n("update:modelValue",y)}catch(g){console.error("Failed to update JSON:",g)}},z=(a,c,g)=>{if(!c||c==="root")return g;const y=c.split("."),b=L(a,y.slice(0,-1));let E=b;for(let B=0;B<y.length-1;B++){const T=y[B];T!=="root"&&(Array.isArray(E)?E=E[parseInt(T)]:E=E[T])}const S=y[y.length-1];return S==="root"?g:(Array.isArray(E)?E[parseInt(S)]=g:E[S]=g,b)},G=a=>{p.value.has(a)?p.value.delete(a):p.value.add(a)},$=()=>{const a=new Set,c=(g,y="")=>{g!==null&&typeof g=="object"&&(a.add(y||"root"),Array.isArray(g)?g.forEach((b,E)=>{const S=y?`${y}.${E}`:`${E}`;c(b,S)}):Object.keys(g).forEach(b=>{const E=y?`${y}.${b}`:b;c(g[b],E)}))};c(C.value),p.value=a,n("expand-all")},F=()=>{p.value=new Set(["root"]),n("collapse-all")},K=async()=>{if(_.value)try{const a=C.value,c=N(a,null,2);await navigator.clipboard.writeText(c),n("copy-success",c)}catch(a){console.error("Failed to copy JSON:",a),n("copy-error",a instanceof Error?a:new Error("Failed to copy JSON"))}},Q=()=>{if(_.value)try{const a=C.value,c=N(a);n("update:modelValue",c),n("compress",c)}catch(a){console.error("Failed to compress JSON:",a)}},R=async a=>{try{let c;typeof a=="string"&&I(a)?c=a:typeof a=="string"?c=`"${a}"`:c=JSON.stringify(a),await navigator.clipboard.writeText(c)}catch(c){console.error("Failed to copy value:",c)}},H=(a,c)=>{if(!o.readonly)try{const g=X(l.value,a,c),y=N(g,null,2);n("update:modelValue",y),U(a,c)}catch(g){console.error("Failed to rename key:",g)}},X=(a,c,g)=>{if(!c||c==="root")return a;const y=c.split("."),b=L(a,y.slice(0,-1));if(y.length===1){const B=y[0];return b&&typeof b=="object"&&!Array.isArray(b)?d(b,B,g):b}let E=b;for(let B=0;B<y.length-1;B++){const T=y[B];Array.isArray(E)?E=E[parseInt(T)]:E=E[T]}const S=y[y.length-1];if(!Array.isArray(E)&&E&&typeof E=="object"){const B=d(E,S,g),T=y.slice(0,-1);T.length>0&&x(b,T,B)}return b},L=(a,c)=>{if(c.length===0)return a;if(Array.isArray(a)){const g=[...a],y=c[0],b=parseInt(y);return c.length===1||(g[b]=L(a[b],c.slice(1))),g}else if(a&&typeof a=="object"){const g={...a},y=c[0];return c.length===1||(g[y]=L(a[y],c.slice(1))),g}return a},d=(a,c,g)=>{if(!a||typeof a!="object"||Array.isArray(a))return a;const y=Object.keys(a),b={};for(const E of y)E===c?b[g]=a[E]:b[E]=a[E];return b},x=(a,c,g)=>{let y=a;for(let E=0;E<c.length-1;E++){const S=c[E];Array.isArray(y)?y=y[parseInt(S)]:y=y[S]}const b=c[c.length-1];Array.isArray(y)?y[parseInt(b)]=g:y[b]=g},U=(a,c)=>{const g=new Set;p.value.forEach(y=>{if(y===a){const b=a.split(".");b[b.length-1]=c,g.add(b.join("."))}else if(y.startsWith(a+".")){const b=a.split(".");b[b.length-1]=c;const E=b.join("."),S=y.substring(a.length);g.add(E+S)}else g.add(y)}),p.value=g};return e({copyJson:K,compressSource:Q,expandAll:$,collapseAll:F,toggleExpand:G,updateValue:M,updateKey:H,filter:v,clearFilter:A,isValidJson:()=>_.value,getParsedJson:()=>l.value,getFilteredJson:()=>h.value,getExpandedNodes:()=>p.value,getParseError:()=>u.value,getFilterError:()=>f.value,parseJson:a=>k(a),copyValue:a=>R(a)}),(a,c)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["json-format",`json-format--${m.value.name}`])},[a.showToolbar?(s.openBlock(),s.createElementBlock("div",je,[s.createElementVNode("div",Ie,[s.createElementVNode("button",{class:"json-format__btn json-format__btn--primary",onClick:K,disabled:!_.value,title:"Copy JSON"}," 📋 Copy ",8,$e),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:$,disabled:!_.value,title:"Expand All"}," ⬇️ Expand All ",8,Re),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:F,disabled:!_.value,title:"Collapse All"}," ➡️ Collapse All ",8,Ve),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:Q,disabled:!_.value,title:"Compress JSON"}," 📦 Compress ",8,Le)]),s.createElementVNode("div",Ue,[_.value?(s.openBlock(),s.createElementBlock("span",Me," ✅ Valid JSON ")):(s.openBlock(),s.createElementBlock("span",Fe," ❌ Invalid JSON "))])])):s.createCommentVNode("",!0),s.createElementVNode("div",Ke,[_.value?f.value?(s.openBlock(),s.createElementBlock("div",Xe,[c[1]||(c[1]=s.createElementVNode("h4",null,"Filter Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(f.value),1)])):(s.openBlock(),s.createElementBlock("div",Ge,[s.createVNode(Pe,{value:C.value,"key-name":"",level:0,expanded:p.value,"is-last":!0,theme:m.value,"onUpdate:value":M,onToggleExpand:G,onCopy:R,"onUpdate:key":H},null,8,["value","expanded","theme"])])):(s.openBlock(),s.createElementBlock("div",He,[c[0]||(c[0]=s.createElementVNode("h4",null,"JSON Parse Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(u.value),1)]))])],2))}}),[["__scopeId","data-v-c6bbb1e1"]]),Qe=[ee],Ye={install:r=>{Qe.forEach(e=>{const t=e.name||e.__name||"UnknownComponent";r.component(t,e)})}};D.JsonFormat=ee,D.default=Ye,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lone-format",
3
- "version": "0.1.6",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "A Vue 3 component library for formatting with tree-shaking support",
6
6
  "main": "./dist/lone-format.umd.cjs",
@@ -24,13 +24,17 @@
24
24
  "scripts": {
25
25
  "dev": "vite",
26
26
  "build": "vue-tsc -b && vite build",
27
- "build:lib": "vue-tsc -b && vite build --mode lib",
27
+ "build:lib": "vite build --mode lib",
28
+ "build:lib:full": "vue-tsc -b && vite build --mode lib",
28
29
  "preview": "vite preview",
29
30
  "docs:dev": "vitepress dev docs",
30
31
  "docs:build": "vitepress build docs",
31
32
  "docs:preview": "vitepress preview docs",
32
33
  "publish:lib": "npm publish --access public",
33
- "publish:dry": "npm publish --dry-run"
34
+ "publish:dry": "npm publish --dry-run",
35
+ "version:patch": "npm version patch --no-git-tag-version",
36
+ "version:minor": "npm version minor --no-git-tag-version",
37
+ "version:major": "npm version major --no-git-tag-version"
34
38
  },
35
39
  "dependencies": {
36
40
  "@types/json-bigint": "^1.0.4",
@@ -52,4 +56,4 @@
52
56
  "vitepress": "^1.6.3",
53
57
  "vue-tsc": "^2.2.12"
54
58
  }
55
- }
59
+ }