import{k as Me,j as et,t as We,h as Et,m as g,n as u,p as l,f as p,A as m,s as Fe,i as z,e as Pe,v as tt,F as At,S as j,q as H,x as Q,w as Lt,z as Nt}from"./web.Os7kOAdY.js";import{c as Qt,d as de}from"./clipboard.BNxbz_oK.js";import{g as he,t as De}from"./i18n-runtime._BAkvU05.js";function pe(t){return t.replace(/[<>&]/g,e=>({"<":"&lt;",">":"&gt;","&":"&amp;"})[e])}function Ie(t){let e=t.replace(/[^A-Za-z0-9_\-:.]/g,"_");return/^[A-Za-z_]/.test(e)||(e="_"+e),e}function te(t,e,n){const r="  ".repeat(n),o=Ie(e);if(t==null)return`${r}<${o} type="null"/>`;if(Array.isArray(t)){if(t.length===0)return`${r}<${o} type="array"/>`;const f=t.map(A=>te(A,"item",n+1)).join(`
`);return`${r}<${o} type="array">
${f}
${r}</${o}>`}if(typeof t=="number")return`${r}<${o} type="number">${pe(String(t))}</${o}>`;if(typeof t=="boolean")return`${r}<${o} type="boolean">${String(t)}</${o}>`;if(typeof t=="string")return`${r}<${o}>${pe(t)}</${o}>`;const i=Object.entries(t);if(i.length===0)return`${r}<${o} type="object"/>`;const a=i.map(([f,A])=>te(A,f,n+1)).join(`
`);return`${r}<${o}>
${a}
${r}</${o}>`}function ze(t,e="root"){return`<?xml version="1.0" encoding="UTF-8"?>
${te(t,e,0)}`}function Xe(t){const e=t.trim();if(e==="")return t;if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(/^-?\d+$/.test(e)){const n=Number(e);if(Number.isSafeInteger(n))return n}return/^-?\d+\.\d+$/.test(e)?Number(e):t}function Xt(t){const e=t.getAttribute("type");if(e==="null")return null;if(e==="array"){const i=[];for(const a of Array.from(t.children))i.push(Xt(a));return i}if(e==="object"){const i={};for(const a of Array.from(t.children))i[a.tagName]=Xt(a);return i}if(e==="number"){const i=Number((t.textContent||"").trim());return Number.isFinite(i)?i:t.textContent||""}if(e==="boolean")return(t.textContent||"").trim()==="true";if(e==="string")return t.textContent||"";const n=Array.from(t.children);if(n.length===0)return Xe(t.textContent||"");const r={};for(const i of n){const a=i.tagName;r[a]||(r[a]=[]),r[a].push(Xt(i))}const o={};for(const i of Object.keys(r))o[i]=r[i].length===1?r[i][0]:r[i];return o}function Ye(t){const e=new DOMParser().parseFromString(t,"application/xml"),n=e.querySelector("parsererror");if(n)throw new Error("XML 解析失败："+(n.textContent||"").trim().split(`
`)[0]);const r=e.documentElement;return{root:r.tagName,data:Xt(r)}}function Mt(t){return/^[A-Za-z0-9_-]+$/.test(t)?t:JSON.stringify(t)}function ee(t){return t==null?'""':typeof t=="string"?JSON.stringify(t):typeof t=="number"?Number.isFinite(t)?String(t):JSON.stringify(String(t)):typeof t=="boolean"?String(t):Array.isArray(t)?`[${t.map(ee).join(", ")}]`:typeof t=="object"?`{ ${Object.entries(t).map(([n,r])=>`${Mt(n)} = ${ee(r)}`).join(", ")} }`:JSON.stringify(t)}function Be(t){return Array.isArray(t)&&t.length>0&&t.every(e=>e!==null&&typeof e=="object"&&!Array.isArray(e))}function ne(t,e,n){const r=[],o=[];for(const[i,a]of Object.entries(t))a==null?n.push(`# ${Mt(i)} = null`):Array.isArray(a)===!1&&typeof a=="object"?r.push([i,a]):Be(a)?o.push([i,a]):n.push(`${Mt(i)} = ${ee(a)}`);for(const[i,a]of r){const f=[...e,i];n.push(""),n.push(`[${f.map(Mt).join(".")}]`),ne(a,f,n)}for(const[i,a]of o){const f=[...e,i];for(const A of a)n.push(""),n.push(`[[${f.map(Mt).join(".")}]]`),ne(A,f,n)}}function Ze(t){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("TOML 顶层必须是对象");const e=[];return ne(t,[],e),e.join(`
`).replace(/^\n+/,"")}function ae(t){if(t=t.trim(),t==="")throw new Error("空值");if(t==="true")return!0;if(t==="false")return!1;if(t.startsWith('"'))return JSON.parse(t);if(t.startsWith("'")){if(!t.endsWith("'"))throw new Error("字面量字符串未闭合");return t.slice(1,-1)}if(t.startsWith("["))return Ue(t);if(t.startsWith("{"))return He(t);if(/^[+-]?\d[\d_]*(\.\d[\d_]*)?([eE][+-]?\d+)?$/.test(t))return Number(t.replace(/_/g,""));throw new Error("无法解析值："+t)}function Ue(t){if(!t.startsWith("[")||!t.endsWith("]"))throw new Error("数组未闭合："+t);const e=t.slice(1,-1).trim();return e?Zt(e,",").map(r=>ae(r.trim())):[]}function He(t){if(!t.startsWith("{")||!t.endsWith("}"))throw new Error("行内表未闭合："+t);const e=t.slice(1,-1).trim();if(!e)return{};const n={};for(const r of Zt(e,",")){const o=Ce(r);if(o<0)throw new Error("行内表片段缺少 = ："+r);n[Bt(r.slice(0,o).trim())]=ae(r.slice(o+1).trim())}return n}function Bt(t){return t.startsWith('"')&&t.endsWith('"')?JSON.parse(t):t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function Zt(t,e){const n=[];let r="",o=0,i=null;for(let a=0;a<t.length;a++){const f=t[a];if(i){if(r+=f,f==="\\"&&a+1<t.length){r+=t[++a];continue}f===i&&(i=null);continue}if(f==='"'||f==="'"){i=f,r+=f;continue}if(f==="["||f==="{"){o++,r+=f;continue}if(f==="]"||f==="}"){o--,r+=f;continue}if(f===e&&o===0){n.push(r),r="";continue}r+=f}return(r.trim()!==""||n.length>0)&&n.push(r),n}function Ce(t){let e=null,n=0;for(let r=0;r<t.length;r++){const o=t[r];if(e){if(o==="\\"&&r+1<t.length){r++;continue}o===e&&(e=null);continue}if(o==='"'||o==="'"){e=o;continue}if(o==="["||o==="{"){n++;continue}if(o==="]"||o==="}"){n--;continue}if(o==="="&&n===0)return r}return-1}function _e(t){const e=[];let n="",r=null;for(let o=0;o<t.length;o++){const i=t[o];if(r){if(n+=i,i==="\\"&&o+1<t.length){n+=t[++o];continue}i===r&&(r=null);continue}if(i==='"'||i==="'"){r=i,n+=i;continue}if(i==="."){e.push(Bt(n.trim())),n="";continue}n+=i}return n.trim()!==""&&e.push(Bt(n.trim())),e}function Ne(t,e){let n=t;for(const r of e){n[r]===void 0&&(n[r]={});const o=n[r];if(Array.isArray(o)){const i=o[o.length-1];if(i&&typeof i=="object")n=i;else throw new Error("路径冲突："+e.join("."))}else if(o&&typeof o=="object")n=o;else throw new Error("路径与已有标量冲突："+e.join("."))}return n}function Re(t,e){if(e.length===0)throw new Error("表数组路径为空");const n=Ne(t,e.slice(0,-1)),r=e[e.length-1];n[r]===void 0&&(n[r]=[]);const o=n[r];if(!Array.isArray(o))throw new Error("表数组与已有值冲突："+e.join("."));const i={};return o.push(i),i}function Ke(t){let e=null;for(let n=0;n<t.length;n++){const r=t[n];if(e){if(r==="\\"&&n+1<t.length){n++;continue}r===e&&(e=null);continue}if(r==='"'||r==="'"){e=r;continue}if(r==="#")return t.slice(0,n)}return t}function Ge(t){const e={};let n=e;const r=t.split(/\r?\n/);for(const o of r){const i=Ke(o).trim();if(!i)continue;let a;if(a=i.match(/^\[\[(.+)\]\]$/)){n=Re(e,_e(a[1].trim()));continue}if(a=i.match(/^\[(.+)\]$/)){n=Ne(e,_e(a[1].trim()));continue}const f=Ce(i);if(f<0)throw new Error("TOML 行无法解析："+i);const A=Bt(i.slice(0,f).trim());n[A]=ae(i.slice(f+1).trim())}return e}const Ve=/^[A-Za-z_][\w\-]*$/;function Kt(t){return t==null?"null":typeof t=="boolean"?String(t):typeof t=="number"?Number.isFinite(t)?String(t):JSON.stringify(String(t)):typeof t=="string"?t===""?'""':/^(true|false|null|yes|no|on|off|~)$/i.test(t)||/^-?\d/.test(t)&&/^-?\d+(\.\d+)?$/.test(t)||/[:#\n\t&*!|>'"%@`{}\[\],]/.test(t)||/^\s|\s$/.test(t)||/^[-?]/.test(t)?JSON.stringify(t):t:JSON.stringify(t)}function re(t,e){const n="  ".repeat(e);if(t==null||typeof t!="object")return Kt(t);if(Array.isArray(t))return t.length===0?"[]":t.map(o=>{if(o!==null&&typeof o=="object"){const i=re(o,e+1);if(i==="{}"||i==="[]")return`${n}- ${i}`;const a=i.split(`
`),f=a[0].slice(n.length+2),A=a.slice(1).join(`
`);return A?`${n}- ${f}
${A}`:`${n}- ${f}`}return`${n}- ${Kt(o)}`}).join(`
`);const r=Object.entries(t);return r.length===0?"{}":r.map(([o,i])=>{const a=Ve.test(o)?o:JSON.stringify(o);return i!==null&&typeof i=="object"&&(Array.isArray(i)?i.length>0:Object.keys(i).length>0)?`${n}${a}:
${re(i,e+1)}`:`${n}${a}: ${Kt(i)}`}).join(`
`)}function Qe(t){return re(t,0)}function Ft(t){if(t=t.trim(),t===""||t==="~"||t.toLowerCase()==="null")return null;if(t==="true"||t.toLowerCase()==="yes"||t.toLowerCase()==="on")return!0;if(t==="false"||t.toLowerCase()==="no"||t.toLowerCase()==="off")return!1;if(t.startsWith('"')||t.startsWith("'")){const e=t[0];if(!t.endsWith(e))throw new Error("字符串未闭合："+t);return e==='"'?JSON.parse(t):t.slice(1,-1).replace(/''/g,"'")}if(/^-?\d+$/.test(t)){const e=Number(t);if(Number.isSafeInteger(e))return e}if(/^-?\d+\.\d+([eE][+-]?\d+)?$/.test(t))return Number(t);if(t.startsWith("[")&&t.endsWith("]")){const e=t.slice(1,-1).trim();return e?Zt(e,",").map(n=>Ft(n)):[]}if(t.startsWith("{")&&t.endsWith("}")){const e=t.slice(1,-1).trim();if(!e)return{};const n={};for(const r of Zt(e,",")){const o=r.indexOf(":");if(o<0)throw new Error("flow 表片段缺少冒号："+r);n[r.slice(0,o).trim()]=Ft(r.slice(o+1).trim())}return n}return t}function tn(t){const e=[];for(const n of t.split(/\r?\n/)){let r=n;const o=r.search(/(^|\s)#/);if(o>=0&&(r=r.slice(0,o===0?0:o)),r.trim()==="")continue;const i=r.match(/^( *)(.*)$/);e.push({indent:i[1].length,text:i[2]})}return e}function ce(t,e,n){if(e>=t.length||t[e].indent<n)return{value:null,next:e};const r=t[e];if(r.text.startsWith("- ")||r.text==="-"){const i=[];for(;e<t.length&&t[e].indent===n&&(t[e].text.startsWith("- ")||t[e].text==="-");){const a=t[e],f=a.text==="-"?"":a.text.slice(2);if(f===""){const A=ce(t,e+1,n+2);i.push(A.value),e=A.next}else if(/^\S+:( |$)/.test(f)){const c=[...[{indent:n+2,text:f}],...t.slice(e+1)],y=be(c,0,n+2);i.push(y.value),e=e+1+(y.next-1)}else i.push(Ft(f)),e++}return{value:i,next:e}}return be(t,e,n)}function be(t,e,n){const r={};for(;e<t.length&&t[e].indent===n;){const o=t[e];if(o.text.startsWith("- ")||o.text==="-")break;const i=o.text.match(/^("(?:[^"\\]|\\.)*"|'(?:[^']|'')*'|[^:]+?)\s*:(\s+(.*))?$/);if(!i)throw new Error("YAML 行无法解析为映射："+o.text);const a=(()=>{const A=i[1].trim();return A.startsWith('"')||A.startsWith("'")?Ft(A):A})(),f=i[3];if(f===void 0||f.trim()===""){const A=ce(t,e+1,n+2);r[a]=e+1<t.length&&t[e+1].indent>n?A.value:null,e=A.next}else r[a]=Ft(f.trim()),e++}return{value:r,next:e}}function en(t){const e=tn(t);if(e.length===0)return null;const n=e[0].indent;return ce(e,0,n).value}function xe(t,e){return typeof e=="number"?`${t}[${e}]`:/^[A-Za-z_$][\w$]*$/.test(e)?t===""?e:`${t}.${e}`:`${t}["${e.replace(/"/g,'\\"')}"]`}function le(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!=typeof e||typeof t!="object")return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let a=0;a<t.length;a++)if(!le(t[a],e[a]))return!1;return!0}if(Array.isArray(e))return!1;const n=t,r=e,o=Object.keys(n),i=Object.keys(r);if(o.length!==i.length)return!1;for(const a of o)if(!le(n[a],r[a]))return!1;return!0}function ie(t,e,n="",r=[]){if(le(t,e))return r.push({path:n||"$",op:"equal",left:t,right:e}),r;if(t!==null&&typeof t=="object"&&(e!==null&&typeof e=="object")&&Array.isArray(t)===Array.isArray(e)){if(Array.isArray(t)){const c=t,y=e,F=Math.max(c.length,y.length);for(let M=0;M<F;M++){const X=xe(n||"$",M);M>=c.length?r.push({path:X,op:"add",right:y[M]}):M>=y.length?r.push({path:X,op:"remove",left:c[M]}):ie(c[M],y[M],X,r)}return r}const a=t,f=e,A=Array.from(new Set([...Object.keys(a),...Object.keys(f)]));for(const c of A){const y=xe(n||"$",c);c in a?c in f?ie(a[c],f[c],y,r):r.push({path:y,op:"remove",left:a[c]}):r.push({path:y,op:"add",right:f[c]})}return r}return r.push({path:n||"$",op:"change",left:t,right:e}),r}var nn=m('<mark style="background:rgba(255,200,0,0.35);color:inherit;padding:0 1px;border-radius:2px">'),rn=m("<span class=jt-key><!$><!/><!$><!/><!$><!/>"),ln=m('<button style="background:transparent;border:none;cursor:pointer;color:var(--text-mute);font-size:12px;padding:0 4px;margin-left:4px;opacity:0.55">⧉'),on=m("<div><!$><!/><!$><!/><span class=jt-null>null</span><!$><!/>"),sn=m('<div><!$><!/><!$><!/><span class=jt-str>"<!$><!/>"</span><!$><!/>'),an=m("<div><!$><!/><!$><!/><span class=jt-num></span><!$><!/>"),cn=m("<div><!$><!/><!$><!/><span class=jt-bool></span><!$><!/>"),me=m("<div class=jt-children>"),un=m("<div><span class=jt-toggle></span> <!$><!/><!$><!/><span class=jt-null>[<!$><!/>]</span><!$><!/><!$><!/>"),$n=m("<div><span class=jt-toggle></span> <!$><!/><!$><!/><span class=jt-null>{<!$><!/>}</span><!$><!/><!$><!/>"),fn=m('<span class=tool-error style="padding:6px 10px">× <!$><!/><!$><!/>'),gn=m('<div class=tool-field><span class=tool-label></span><textarea class=tool-textarea rows=8 placeholder="{&quot;project&quot;:&quot;taitan&quot;,&quot;tags&quot;:[&quot;a&quot;,&quot;b&quot;]}"></textarea><!$><!/>'),Se=m("<label class=tool-chip><!$><!/><select style=background:transparent;border:none;color:inherit><option value=2></option><option value=4></option><option value=tab>Tab"),dn=m("<label class=tool-chip><!$><!/><select style=background:transparent;border:none;color:inherit><option value=encode></option><option value=decode>"),hn=m('<input class=tool-input placeholder="$.skills[*] / $..name / $.arr[0:3]"style=max-width:360px>'),Gt=m('<button class="tool-btn is-ghost">'),pn=m("<input class=tool-input style=max-width:240px>"),ye=m('<button class="tool-btn is-primary">'),_n=m("<button class=tool-btn>"),bn=m('<div class=tool-actions><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><button class="tool-btn is-ghost"></button><button class="tool-btn is-ghost">'),xn=m("<pre class=tool-pre>"),mn=m("<div class=tool-field><span class=tool-label><!$><!/><!$><!/></span><!$><!/>"),Sn=m("<p class=tool-hint><!$><!/> <code>// /* */</code> <!$><!/>"),yn=m('<div class=tool-field><span class=tool-label></span><div class=json-tree style="padding:12px;background:var(--surface);border:1px solid var(--border);border-radius:10px;max-height:480px;overflow:auto">'),vn=m('<p class=tool-hint><!$><!/> <code>$ / .key / ..key / .* / [n] / [*] / ["k"] / [a:b]</code><!$><!/> <code>$..skills[*]</code>.'),wn=m('<div class=tool-field><span class=tool-label></span><div style="border:1px solid var(--border);border-radius:10px;background:var(--surface);overflow:hidden"><table class=tool-table style=width:100%;border-collapse:collapse><thead><tr style=background:var(--surface-2,rgba(255,255,255,0.03))><th style="text-align:left;padding:8px 12px;width:38%"></th><th style="text-align:left;padding:8px 12px"></th></tr></thead><tbody></tbody></table></div><p class=tool-hint style=margin-top:6px>! <!$><!/> <code>?(@.x &gt; 0)</code> <!$><!/> <code>(@.length-1)</code><!$><!/>'),ve=m("<p class=tool-hint>"),kn=m('<div class=tool-actions style=flex-wrap:wrap><label class=tool-chip><!$><!/><select style=background:transparent;border:none;color:inherit></select></label><span style=opacity:0.5>→</span><label class=tool-chip><!$><!/><select style=background:transparent;border:none;color:inherit></select></label><!$><!/><button class=tool-btn>⇄ <!$><!/></button><button class="tool-btn is-primary"></button><button class=tool-btn></button><button class="tool-btn is-ghost"></button><button class="tool-btn is-ghost">'),jn=m("<pre class=tool-pre style=max-height:360px;overflow:auto>"),An=m("<div class=tool-grid-2><div class=tool-field><span class=tool-label><!$><!/> <!$><!/></span><textarea class=tool-textarea rows=12></textarea></div><div class=tool-field><span class=tool-label><!$><!/> <!$><!/></span><!$><!/>"),On=m("<p class=tool-hint><!$><!/> <code>type</code> <!$><!/> <code># key = null</code><!$><!/>"),Cn=m('<div class=tool-grid-2><div class=tool-field><span class=tool-label></span><textarea class=tool-textarea rows=10 placeholder="{&quot;a&quot;:1}"></textarea></div><div class=tool-field><span class=tool-label></span><textarea class=tool-textarea rows=10 placeholder="{&quot;a&quot;:2}">'),Nn=m('<div class=tool-actions><label class=tool-chip><input type=checkbox> <!$><!/></label><button class="tool-btn is-ghost"></button><button class="tool-btn is-ghost"></button><button class="tool-btn is-ghost"></button><button class="tool-btn is-ghost">'),Tn=m('<span class=tool-error style="padding:6px 10px">× <!$><!/>'),Jn=m("<div class=panel style=display:flex;flex-direction:column;gap:14px><div class=tool-tabs role=tablist></div><!$><!/><!$><!/><!$><!/>"),qn=m("<button>"),we=m('<pre class="tool-pre tool-error"style=padding:10px>'),Vt=m("<span class=jt-null>(<!$><!/>)"),En=m('<tr style="border-top:1px solid var(--border)"><td style="padding:8px 12px"><code></code></td><td style="padding:8px 12px;opacity:0.85">'),Ln=m("<code>JSON.parse"),Mn=m("<strong>"),ke=m("<option>"),Wn=m('<div class=tool-field><span class=tool-label><!$><!/> · <!$><!/> <!$><!/></span><div style="border:1px solid var(--border);border-radius:10px;overflow:auto;max-height:200px"><table class=tool-table style=width:100%;border-collapse:collapse><thead><tr><th style=text-align:left></th><th style=text-align:left></th><th style=text-align:left>A</th><th style=text-align:left>B</th></tr></thead><tbody>'),Fn=m('<div class=tool-grid-2><div class=tool-field><span class=tool-label></span><div class=json-tree style="padding:12px;background:var(--surface);border:1px solid var(--border);border-radius:10px;max-height:480px;overflow:auto"></div></div><div class=tool-field><span class=tool-label></span><div class=json-tree style="padding:12px;background:var(--surface);border:1px solid var(--border);border-radius:10px;max-height:480px;overflow:auto">'),Pn=m("<tr><td><code></code></td><td></td><td><code></code></td><td><code>");const oe=t=>t==="tab"?"	":parseInt(t,10);function se(t){if(Array.isArray(t))return t.map(se);if(t&&typeof t=="object"){const e={};for(const n of Object.keys(t).sort())e[n]=se(t[n]);return e}return t}function Dn(t,e){let n=e.trim();if(!n)return[t];if(n[0]!=="$")throw new Error("路径必须以 $ 开始");if(n=n.slice(1),!n)return[t];let r=[t];const o=/(\.\.([A-Za-z_$][\w$]*|\*))|\.([A-Za-z_$][\w$]*|\*)|\[(-?\d+)\]|\[\*\]|\["((?:[^"\\]|\\.)*)"\]|\['((?:[^'\\]|\\.)*)'\]|\[(-?\d*):(-?\d*)\]/g;let i=0,a;for(;(a=o.exec(n))!==null;){if(a.index!==i)throw new Error(`无法解析片段：${n.slice(i,a.index)}`);i=o.lastIndex;const f=a[2],A=a[3],c=a[4],y=a[5],F=a[6],M=a[7],X=a[8],T=[];if(f!==void 0){const b=_=>{if(Array.isArray(_))for(const L of _)b(L);else if(_&&typeof _=="object")for(const[L,D]of Object.entries(_))(f==="*"||L===f)&&T.push(D),b(D)};for(const _ of r)b(_)}else if(A!==void 0){for(const b of r)if(A==="*")Array.isArray(b)?T.push(...b):b&&typeof b=="object"&&T.push(...Object.values(b));else if(b&&typeof b=="object"&&!Array.isArray(b)){const _=b[A];_!==void 0&&T.push(_)}}else if(c!==void 0){const b=parseInt(c,10);for(const _ of r)if(Array.isArray(_)){const L=b<0?_.length+b:b;L>=0&&L<_.length&&T.push(_[L])}}else if(a[0]==="[*]")for(const b of r)Array.isArray(b)?T.push(...b):b&&typeof b=="object"&&T.push(...Object.values(b));else if(y!==void 0||F!==void 0){const b=(y??F).replace(/\\(.)/g,"$1");for(const _ of r)if(_&&typeof _=="object"&&!Array.isArray(_)){const L=_[b];L!==void 0&&T.push(L)}}else if(M!==void 0||X!==void 0){for(const b of r)if(Array.isArray(b)){const _=M===""?0:parseInt(M,10),L=X===""?b.length:parseInt(X,10);T.push(...b.slice(_,L))}}r=T}if(i!==n.length)throw new Error(`路径尾部未识别：${n.slice(i)}`);return r}function In(t,e){const n=t.match(/position\s+(\d+)/i);if(!n)return{msg:t};const r=Math.min(parseInt(n[1],10),e.length),o=e.slice(0,r),i=o.split(`
`).length,a=o.length-(o.lastIndexOf(`
`)+1)+1;return{msg:t,line:i,col:a}}function zn(t){t.charCodeAt(0)===65279&&(t=t.slice(1));let e="",n=0;const r=t.length;for(;n<r;){const o=t[n];if(o==="/"&&t[n+1]==="*"){for(n+=2;n<r&&!(t[n]==="*"&&t[n+1]==="/");)n++;n+=2;continue}if(o==="/"&&t[n+1]==="/"){for(n+=2;n<r&&t[n]!==`
`;)n++;continue}if(o==="'"){let i='"';for(n++;n<r&&t[n]!=="'";){if(t[n]==="\\"&&n+1<r){if(t[n+1]==="'"){i+="'",n+=2;continue}i+=t[n]+t[n+1],n+=2;continue}t[n]==='"'?i+='\\"':i+=t[n],n++}i+='"',n++,e+=i;continue}if(o==='"'){let i='"';for(n++;n<r&&t[n]!=='"';){if(t[n]==="\\"&&n+1<r){i+=t[n]+t[n+1],n+=2;continue}i+=t[n],n++}i+='"',n++,e+=i;continue}e+=o,n++}return e=e.replace(/([{,]\s*)([A-Za-z_$][\w$]*)(\s*):/g,'$1"$2"$3:'),e=e.replace(/,(\s*[\]}])/g,"$1"),e}function je(t,e){return typeof e=="number"?`${t}[${e}]`:/^[A-Za-z_$][\w$]*$/.test(e)?`${t}.${e}`:`${t}["${e.replace(/"/g,'\\"')}"]`}function Xn(t,...e){if(!t)return!0;const n=t.toLowerCase();return e.some(r=>r!=null&&String(r).toLowerCase().includes(n))}function It(t){const e=String(t.text);return p(j,{get when(){return H(()=>!!t.q)()&&e.toLowerCase().indexOf(t.q.toLowerCase())>=0},get fallback(){return e},get children(){return(()=>{const n=e.toLowerCase(),r=t.q.toLowerCase(),o=n.indexOf(r);return[H(()=>e.slice(0,o)),(()=>{var i=g(nn);return l(i,()=>e.slice(o,o+t.q.length)),i})(),H(()=>e.slice(o+t.q.length))]})()}})}function Yn(t,e){return!t||t==="equal"?"":t==="change"?"background:rgba(255,200,0,0.18);":t==="add"&&e==="right"?"background:rgba(64,210,140,0.20);":t==="remove"&&e==="left"?"background:rgba(240,90,90,0.20);":""}function Wt(t){const e=t.value,n=()=>t.diffMap?.get(t.path),r=()=>{const c=t.side?Yn(n(),t.side):"";return c?`${c}padding:1px 4px;border-radius:4px;`:""},o=()=>{if(!t.onlyDiff)return!0;const c=n();return c!==void 0&&c!=="equal"},i=()=>t.name===void 0?null:(()=>{var c=g(rn),y=c.firstChild,[F,M]=u(y.nextSibling),X=F.nextSibling,[T,b]=u(X.nextSibling),_=T.nextSibling,[L,D]=u(_.nextSibling);return l(c,(()=>{var R=H(()=>typeof t.name=="number");return()=>R()?t.name:'"'})(),F,M),l(c,p(j,{get when(){return typeof t.name=="string"},fallback:null,get children(){return p(It,{get text(){return t.name},get q(){return t.filter}})}}),T,b),l(c,()=>typeof t.name=="string"?'"':null,L,D),c})(),a=()=>t.name===void 0?null:": ",f=()=>(()=>{var c=g(ln);return c.$$click=y=>{y.stopPropagation(),Qt(t.path)},z(()=>Lt(c,"title",`复制路径 ${t.path}`)),tt(),c})(),A=()=>o()&&Xn(t.filter,t.name,typeof e=="object"&&e!==null?null:e);if(e===null)return p(j,{get when(){return A()},get children(){var c=g(on),y=c.firstChild,[F,M]=u(y.nextSibling),X=F.nextSibling,[T,b]=u(X.nextSibling),_=T.nextSibling,L=_.nextSibling,[D,R]=u(L.nextSibling);return l(c,i,F,M),l(c,a,T,b),l(c,f,D,R),z(nt=>Nt(c,r(),nt)),c}});if(typeof e=="string")return p(j,{get when(){return A()},get children(){var c=g(sn),y=c.firstChild,[F,M]=u(y.nextSibling),X=F.nextSibling,[T,b]=u(X.nextSibling),_=T.nextSibling,L=_.firstChild,D=L.nextSibling,[R,nt]=u(D.nextSibling);R.nextSibling;var ut=_.nextSibling,[gt,_t]=u(ut.nextSibling);return l(c,i,F,M),l(c,a,T,b),l(_,p(It,{text:e,get q(){return t.filter}}),R,nt),l(c,f,gt,_t),z(dt=>Nt(c,r(),dt)),c}});if(typeof e=="number")return p(j,{get when(){return A()},get children(){var c=g(an),y=c.firstChild,[F,M]=u(y.nextSibling),X=F.nextSibling,[T,b]=u(X.nextSibling),_=T.nextSibling,L=_.nextSibling,[D,R]=u(L.nextSibling);return l(c,i,F,M),l(c,a,T,b),l(_,p(It,{text:e,get q(){return t.filter}})),l(c,f,D,R),z(nt=>Nt(c,r(),nt)),c}});if(typeof e=="boolean")return p(j,{get when(){return A()},get children(){var c=g(cn),y=c.firstChild,[F,M]=u(y.nextSibling),X=F.nextSibling,[T,b]=u(X.nextSibling),_=T.nextSibling,L=_.nextSibling,[D,R]=u(L.nextSibling);return l(c,i,F,M),l(c,a,T,b),l(_,p(It,{get text(){return String(e)},get q(){return t.filter}})),l(c,f,D,R),z(nt=>Nt(c,r(),nt)),c}});if(Array.isArray(e))return p(j,{get when(){return o()},get children(){var c=g(un),y=c.firstChild,F=y.nextSibling,M=F.nextSibling,[X,T]=u(M.nextSibling),b=X.nextSibling,[_,L]=u(b.nextSibling),D=_.nextSibling,R=D.firstChild,nt=R.nextSibling,[ut,gt]=u(nt.nextSibling);ut.nextSibling;var _t=D.nextSibling,[dt,St]=u(_t.nextSibling),vt=dt.nextSibling,[Tt,wt]=u(vt.nextSibling);return y.$$click=()=>t.toggle(t.path,t.depth),l(y,()=>t.isOpen(t.path,t.depth)?"▾":"▸"),l(c,i,X,T),l(c,a,_,L),l(D,()=>e.length,ut,gt),l(c,f,dt,St),l(c,p(j,{get when(){return t.isOpen(t.path,t.depth)},get children(){var yt=g(me);return l(yt,p(At,{each:e,children:(ht,kt)=>p(Wt,{get name(){return kt()},value:ht,get depth(){return t.depth+1},get path(){return je(t.path,kt())},get isOpen(){return t.isOpen},get toggle(){return t.toggle},get filter(){return t.filter},get diffMap(){return t.diffMap},get side(){return t.side},get onlyDiff(){return t.onlyDiff}})})),yt}}),Tt,wt),z(yt=>Nt(c,r(),yt)),tt(),c}});if(typeof e=="object"){const c=Object.entries(e);return p(j,{get when(){return o()},get children(){var y=g($n),F=y.firstChild,M=F.nextSibling,X=M.nextSibling,[T,b]=u(X.nextSibling),_=T.nextSibling,[L,D]=u(_.nextSibling),R=L.nextSibling,nt=R.firstChild,ut=nt.nextSibling,[gt,_t]=u(ut.nextSibling);gt.nextSibling;var dt=R.nextSibling,[St,vt]=u(dt.nextSibling),Tt=St.nextSibling,[wt,yt]=u(Tt.nextSibling);return F.$$click=()=>t.toggle(t.path,t.depth),l(F,()=>t.isOpen(t.path,t.depth)?"▾":"▸"),l(y,i,T,b),l(y,a,L,D),l(R,()=>c.length,gt,_t),l(y,f,St,vt),l(y,p(j,{get when(){return t.isOpen(t.path,t.depth)},get children(){var ht=g(me);return l(ht,p(At,{each:c,children:([kt,s])=>p(Wt,{name:kt,value:s,get depth(){return t.depth+1},get path(){return je(t.path,kt)},get isOpen(){return t.isOpen},get toggle(){return t.toggle},get filter(){return t.filter},get diffMap(){return t.diffMap},get side(){return t.side},get onlyDiff(){return t.onlyDiff}})})),ht}}),wt,yt),z(ht=>Nt(y,r(),ht)),tt(),y}})}return null}function Bn(t,e){const n=e.trim();if(n)switch(t){case"json":return JSON.parse(n);case"xml":return Ye(n).data;case"toml":return Ge(n);case"yaml":return en(n)}}function Zn(t,e,n){if(e===void 0)return"";switch(t){case"json":return JSON.stringify(e,null,oe(n));case"xml":return ze(e,"root");case"toml":return Ze(e);case"yaml":return Qe(e)}}const zt=[["json","JSON"],["xml","XML"],["toml","TOML"],["yaml","YAML"]],Un={json:{ext:"json",mime:"application/json"},xml:{ext:"xml",mime:"application/xml"},toml:{ext:"toml",mime:"application/toml"},yaml:{ext:"yaml",mime:"application/x-yaml"}},Yt=`{
  "project": "taitan-tools",
  "version": "1.0.0",
  "active": true,
  "tags": ["json", "yaml", "toml", "xml"],
  "owner": {
    "name": "Tao",
    "city": "上海",
    "since": 2018
  },
  "endpoints": [
    { "name": "api", "url": "https://api.taitan.dev", "port": 443, "secure": true },
    { "name": "ws", "url": "wss://ws.taitan.dev", "port": 443, "secure": true }
  ],
  "metadata": null
}`,Ae=`{
  "name": "taitan",
  "version": "1.0.0",
  "tags": ["json", "yaml", "toml"],
  "owner": { "name": "Tao", "city": "上海" },
  "endpoints": [
    { "name": "api", "port": 443 },
    { "name": "ws", "port": 80 }
  ],
  "deprecated": null
}`,Oe=`{
  "name": "taitan",
  "version": "1.1.0",
  "tags": ["json", "yaml", "toml", "xml"],
  "owner": { "name": "Tao", "city": "杭州", "since": 2018 },
  "endpoints": [
    { "name": "api", "port": 443 },
    { "name": "ws", "port": 443 }
  ]
}`,Hn={json:Yt,xml:`<?xml version="1.0" encoding="UTF-8"?>
<root>
  <project>taitan-tools</project>
  <version>1.0.0</version>
  <active type="boolean">true</active>
  <tags type="array">
    <item>json</item>
    <item>yaml</item>
    <item>toml</item>
    <item>xml</item>
  </tags>
  <owner>
    <name>Tao</name>
    <city>上海</city>
    <since type="number">2018</since>
  </owner>
  <endpoints type="array">
    <item>
      <name>api</name>
      <url>https://api.taitan.dev</url>
      <port type="number">443</port>
      <secure type="boolean">true</secure>
    </item>
    <item>
      <name>ws</name>
      <url>wss://ws.taitan.dev</url>
      <port type="number">443</port>
      <secure type="boolean">true</secure>
    </item>
  </endpoints>
  <metadata type="null"/>
</root>`,toml:`project = "taitan-tools"
version = "1.0.0"
active = true
tags = ["json", "yaml", "toml", "xml"]
# metadata = null

[owner]
name = "Tao"
city = "上海"
since = 2018

[[endpoints]]
name = "api"
url = "https://api.taitan.dev"
port = 443
secure = true

[[endpoints]]
name = "ws"
url = "wss://ws.taitan.dev"
port = 443
secure = true`,yaml:`project: taitan-tools
version: 1.0.0
active: true
tags:
  - json
  - yaml
  - toml
  - xml
owner:
  name: Tao
  city: 上海
  since: 2018
endpoints:
  - name: api
    url: https://api.taitan.dev
    port: 443
    secure: true
  - name: ws
    url: wss://ws.taitan.dev
    port: 443
    secure: true
metadata: null`};function Vn(){const[t,e]=et(he(),{equals:!1}),[n,r]=et("format"),[o,i]=et(Yt),[a,f]=et("2"),[A,c]=et("$"),[y,F]=et(""),[M,X]=et(null),[T,b]=et({}),[_,L]=et("json"),[D,R]=et("xml"),[nt,ut]=et(Yt),[gt,_t]=et(Ae),[dt,St]=et(Oe),[vt,Tt]=et(!1),[wt,yt]=et("encode"),[ht,kt]=et(!1),s=S=>De(S,t());We(()=>{const S=v=>{const k=v.detail?.locale;k&&e(k)};window.addEventListener("taitan:locale-change",S),e(he()),Fe(()=>window.removeEventListener("taitan:locale-change",S))});const Pt=(S,v)=>{const k=T()[S];if(k!==void 0)return k;const G=M();return G!==null?G:v<2},Ut=(S,v)=>{b({...T(),[S]:!Pt(S,v)})},ue=()=>{X(!0),b({})},$e=()=>{X(!1),b({})},bt=Et(()=>{const S=o().trim();if(!S)return{ok:!0,data:void 0};try{return{ok:!0,data:JSON.parse(S)}}catch(v){const k=In(v.message,S);return{ok:!1,msg:k.msg,line:k.line,col:k.col}}}),st=Et(()=>{if(n()==="escape"){const v=o();if(!v)return{ok:!0,text:"",count:void 0};try{if(wt()==="encode")return{ok:!0,text:JSON.stringify(v),count:void 0};let k=v,G=0;const Ot=16;for(;typeof k=="string"&&G<Ot;){const xt=k.trim();if(!(xt.startsWith('"')&&xt.endsWith('"')||xt.startsWith("[")&&xt.endsWith("]")||xt.startsWith("{")&&xt.endsWith("}")))break;try{const Dt=JSON.parse(xt);if(Dt===k)break;k=Dt,G++}catch{break}}if(G===0)return{ok:!1,text:s('输入不是被转义过的 JSON 字符串字面量（应以 " 包裹或为合法 JSON 容器）'),count:void 0};const Ht=oe(a());return{ok:!0,text:typeof k=="string"?k:JSON.stringify(k,null,Ht),count:G}}catch(k){return{ok:!1,text:k.message,count:void 0}}}const S=bt();if(!S.ok){const v=S,k=v.line!==void 0?` (${s("行")} ${v.line}, ${s("列")} ${v.col})`:"";return{ok:!1,text:v.msg+k,count:void 0}}if(S.data===void 0)return{ok:!0,text:"",count:void 0};try{const v=oe(a());switch(n()){case"format":return{ok:!0,text:JSON.stringify(S.data,null,v),count:void 0};case"minify":return{ok:!0,text:JSON.stringify(S.data),count:void 0};case"sort":return{ok:!0,text:JSON.stringify(se(S.data),null,v),count:void 0};case"path":{const k=Dn(S.data,A());return k.length===0?{ok:!0,text:`(${s("未匹配")})`,count:0}:k.length===1?{ok:!0,text:JSON.stringify(k[0],null,v),count:1}:{ok:!0,text:JSON.stringify(k,null,v),count:k.length}}default:return{ok:!0,text:"",count:void 0}}}catch(v){return{ok:!1,text:v.message,count:void 0}}}),$t=Et(()=>{const S=nt().trim();if(!S)return{ok:!0,text:""};try{const v=Bn(_(),S);return{ok:!0,text:Zn(D(),v,a())}}catch(v){return{ok:!1,text:v.message}}}),Jt=Et(()=>{try{const S=gt().trim()?JSON.parse(gt()):void 0,v=dt().trim()?JSON.parse(dt()):void 0,k=ie(S,v);return{ok:!0,left:S,right:v,entries:k}}catch(S){return{ok:!1,msg:S.message}}}),fe=Et(()=>{const S=Jt(),v=new Map;if(!S.ok)return v;for(const k of S.entries)v.set(k.path,k.op);for(const k of S.entries){if(k.op==="equal")continue;let G=k.path;for(;G.length>1;){const Ot=Math.max(G.lastIndexOf("."),G.lastIndexOf("["));if(Ot<=0)break;G=G.slice(0,Ot),(!v.has(G)||v.get(G)==="equal")&&v.set(G,"change")}}return v}),Te=()=>i(Yt),Je=()=>i(zn(o())),qe=()=>{const S=_();ut(Hn[S]),D()===S&&R(S==="json"?"yaml":"json")},Ee=()=>{_t(Ae),St(Oe)};return(()=>{var S=g(Jn),v=S.firstChild,k=v.nextSibling,[G,Ot]=u(k.nextSibling),Ht=G.nextSibling,[Rt,xt]=u(Ht.nextSibling),ge=Rt.nextSibling,[Dt,Le]=u(ge.nextSibling);return l(v,p(At,{get each(){return[["format",s("格式化")],["minify",s("压缩")],["escape",s("转义")],["sort",s("排序键")],["tree","Tree"],["path","JSONPath"],["lint",s("Lint 修复")],["convert",s("格式转换")],["diff",s("JSON 对比")]]},children:([$,x])=>(()=>{var d=g(qn);return d.$$click=()=>r($),l(d,x),z(()=>Pe(d,`tool-tab ${n()===$?"is-active":""}`)),tt(),d})()})),l(S,p(j,{get when(){return H(()=>n()!=="convert")()&&n()!=="diff"},get children(){return[(()=>{var $=g(gn),x=$.firstChild,d=x.nextSibling,w=d.nextSibling,[q,E]=u(w.nextSibling);return l(x,()=>s("输入 JSON")),d.$$input=O=>i(O.currentTarget.value),l($,p(j,{get when(){return H(()=>!bt().ok)()&&n()!=="escape"},get children(){var O=g(fn),C=O.firstChild,P=C.nextSibling,[N,B]=u(P.nextSibling),W=N.nextSibling,[U,V]=u(W.nextSibling);return l(O,()=>bt().msg,N,B),l(O,p(j,{get when(){return bt().line!==void 0},get children(){return[" ","(",H(()=>s("行"))," ",H(()=>bt().line),", ",H(()=>s("列"))," ",H(()=>bt().col),")"]}}),U,V),O}}),q,E),z(()=>Q(d,"value",o())),tt(),$})(),(()=>{var $=g(bn),x=$.firstChild,[d,w]=u(x.nextSibling),q=d.nextSibling,[E,O]=u(q.nextSibling),C=E.nextSibling,[P,N]=u(C.nextSibling),B=P.nextSibling,[W,U]=u(B.nextSibling),V=W.nextSibling,[lt,it]=u(V.nextSibling),mt=lt.nextSibling,[ft,pt]=u(mt.nextSibling),at=ft.nextSibling,ot=at.nextSibling;return l($,p(j,{get when(){return n()==="format"||n()==="sort"||n()==="path"},get children(){var h=g(Se),I=h.firstChild,[Y,J]=u(I.nextSibling),K=Y.nextSibling,Z=K.firstChild,rt=Z.nextSibling;return l(h,()=>s("缩进"),Y,J),K.addEventListener("change",ct=>f(ct.currentTarget.value)),l(Z,()=>s("2 空格")),l(rt,()=>s("4 空格")),z(()=>Q(K,"value",a())),h}}),d,w),l($,p(j,{get when(){return n()==="escape"},get children(){var h=g(dn),I=h.firstChild,[Y,J]=u(I.nextSibling),K=Y.nextSibling,Z=K.firstChild,rt=Z.nextSibling;return l(h,()=>s("模式"),Y,J),K.addEventListener("change",ct=>yt(ct.currentTarget.value)),l(Z,()=>s("转义")),l(rt,()=>s("反转义（多重）")),z(()=>Q(K,"value",wt())),h}}),E,O),l($,p(j,{get when(){return n()==="path"},get children(){return[(()=>{var h=g(hn);return h.$$input=I=>c(I.currentTarget.value),z(()=>Q(h,"value",A())),tt(),h})(),(()=>{var h=g(Gt);return h.$$click=()=>kt(!ht()),l(h,(()=>{var I=H(()=>!!ht());return()=>I()?`x ${s("关闭语法")}`:`? ${s("语法帮助")}`})()),z(()=>Lt(h,"title",s("JSONPath 语法示例"))),tt(),h})()]}}),P,N),l($,p(j,{get when(){return n()==="tree"},get children(){return[(()=>{var h=g(pn);return h.$$input=I=>F(I.currentTarget.value),z(()=>Lt(h,"placeholder",s("按 key 或 value 搜索（命中高亮）"))),z(()=>Q(h,"value",y())),tt(),h})(),(()=>{var h=g(Gt);return h.$$click=ue,l(h,()=>s("全部展开")),tt(),h})(),(()=>{var h=g(Gt);return h.$$click=$e,l(h,()=>s("全部折叠")),tt(),h})()]}}),W,U),l($,p(j,{get when(){return n()==="lint"},get children(){var h=g(ye);return h.$$click=Je,l(h,()=>s("尝试修复")),tt(),h}}),lt,it),l($,p(j,{get when(){return H(()=>n()!=="tree")()&&n()!=="lint"},get children(){return[(()=>{var h=g(ye);return h.$$click=()=>Qt(st().text),l(h,()=>s("复制结果")),z(()=>Q(h,"disabled",!st().ok||!st().text)),tt(),h})(),(()=>{var h=g(_n);return h.$$click=()=>de(st().text,"data.json","application/json"),l(h,()=>s("下载 .json")),z(()=>Q(h,"disabled",!st().ok||!st().text)),tt(),h})()]}}),ft,pt),at.$$click=Te,l(at,()=>s("示例")),ot.$$click=()=>i(""),l(ot,()=>s("清空")),tt(),$})(),p(j,{get when(){return H(()=>n()!=="tree")()&&n()!=="lint"},get children(){var $=g(mn),x=$.firstChild,d=x.firstChild,[w,q]=u(d.nextSibling),E=w.nextSibling,[O,C]=u(E.nextSibling),P=x.nextSibling,[N,B]=u(P.nextSibling);return l(x,()=>s("输出"),w,q),l(x,p(j,{get when(){return st().count!==void 0},get children(){return` · ${st().count} ${s("个匹配")}`}}),O,C),l($,p(j,{get when(){return st().ok},get fallback(){return(()=>{var W=g(we);return l(W,()=>st().text),W})()},get children(){var W=g(xn);return l(W,()=>st().text||`(${s("空")})`),W}}),N,B),$}}),p(j,{get when(){return n()==="lint"},get children(){var $=g(Sn),x=$.firstChild,[d,w]=u(x.nextSibling),q=d.nextSibling,E=q.nextSibling,O=E.nextSibling,C=O.nextSibling,[P,N]=u(C.nextSibling);return l($,()=>s("点击「尝试修复」会：去 BOM、剥离"),d,w),l($,()=>s("注释、单引号 → 双引号、给未引用的对象 key 加引号、移除尾随逗号。修复结果直接写回输入框。"),P,N),$}}),p(j,{get when(){return H(()=>n()==="tree")()&&bt().ok},get children(){var $=g(yn),x=$.firstChild,d=x.nextSibling;return l(x,()=>s("Tree 视图（搜索词命中即高亮，⧉ 复制 JSONPath）")),l(d,p(j,{get when(){return bt().data!==void 0},get fallback(){return(()=>{var w=g(Vt),q=w.firstChild,E=q.nextSibling,[O,C]=u(E.nextSibling);return O.nextSibling,l(w,()=>s("空"),O,C),w})()},get children(){return p(Wt,{get value(){return bt().data},depth:0,path:"$",isOpen:Pt,toggle:Ut,get filter(){return y()}})}})),$}}),p(j,{get when(){return n()==="path"},get children(){return[(()=>{var $=g(vn),x=$.firstChild,[d,w]=u(x.nextSibling),q=d.nextSibling,E=q.nextSibling,O=E.nextSibling,[C,P]=u(O.nextSibling);return C.nextSibling,l($,()=>s("JSONPath 支持"),d,w),l($,()=>s("，多匹配以数组返回，例如"),C,P),$})(),p(j,{get when(){return ht()},get children(){var $=g(wn),x=$.firstChild,d=x.nextSibling,w=d.firstChild,q=w.firstChild,E=q.firstChild,O=E.firstChild,C=O.nextSibling,P=q.nextSibling,N=d.nextSibling,B=N.firstChild,W=B.nextSibling,[U,V]=u(W.nextSibling),lt=U.nextSibling,it=lt.nextSibling,mt=it.nextSibling,ft=mt.nextSibling,[pt,at]=u(ft.nextSibling),ot=pt.nextSibling,h=ot.nextSibling,I=h.nextSibling,[Y,J]=u(I.nextSibling);return l(x,()=>s("JSONPath 语法示例")),l(O,()=>s("语法")),l(C,()=>s("说明")),l(P,p(At,{get each(){return[["$",s("根节点（必须以 $ 开头）")],["$.owner.name",s("点号路径：访问对象字段")],['$["owner"]["name"]',s("方括号 + 引号：等价点号写法（key 含特殊字符时使用）")],["$.tags[0]",s("数组下标（支持负数 [-1] 取末尾）")],["$.tags[*]",s("通配整个数组（返回每个元素）")],["$.owner.*",s("对象通配（返回每个字段值）")],["$..name",s("递归下降：返回任意深度的 name 字段")],["$..*",s("递归通配：返回所有节点")],["$.tags[0:2]",s("切片：从 0 取到 2（不含 2）")],["$.tags[-2:]",s("切片负数：取末尾两个")],["$..endpoints[*].port",s("组合：递归到 endpoints 数组里每项的 port")]]},children:([K,Z])=>(()=>{var rt=g(En),ct=rt.firstChild,Ct=ct.firstChild,qt=ct.nextSibling;return l(Ct,K),l(qt,Z),rt})()})),l(N,()=>s("不支持过滤表达式"),U,V),l(N,()=>s("与脚本表达式"),pt,at),l(N,()=>s("；其余 RFC 9535 子集均可用。"),Y,J),$}})]}}),p(j,{get when(){return n()==="escape"},get children(){var $=g(ve);return l($,p(j,{get when(){return wt()==="encode"},get fallback(){return[H(()=>s("反转义会循环"))," ",g(Ln)," ",H(()=>s("（最多 16 层），把多重转义还原为最终字符串或对象。当前已反转义"))," ",(()=>{var x=g(Mn);return l(x,()=>st().count??0),x})()," ",H(()=>s("层。"))]},get children(){return s("转义把整段输入（不必是合法 JSON）编码为 JSON 字符串字面量，结果可直接嵌入到 JSON 字段里。")}})),$}})]}}),G,Ot),l(S,p(j,{get when(){return n()==="convert"},get children(){return[(()=>{var $=g(kn),x=$.firstChild,d=x.firstChild,[w,q]=u(d.nextSibling),E=w.nextSibling,O=x.nextSibling,C=O.nextSibling,P=C.firstChild,[N,B]=u(P.nextSibling),W=N.nextSibling,U=C.nextSibling,[V,lt]=u(U.nextSibling),it=V.nextSibling,mt=it.firstChild,ft=mt.nextSibling,[pt,at]=u(ft.nextSibling),ot=it.nextSibling,h=ot.nextSibling,I=h.nextSibling,Y=I.nextSibling;return l(x,()=>s("源格式"),w,q),E.addEventListener("change",J=>L(J.currentTarget.value)),l(E,p(At,{each:zt,children:([J,K])=>(()=>{var Z=g(ke);return Q(Z,"value",J),l(Z,K),Z})()})),l(C,()=>s("目标格式"),N,B),W.addEventListener("change",J=>R(J.currentTarget.value)),l(W,p(At,{each:zt,children:([J,K])=>(()=>{var Z=g(ke);return Q(Z,"value",J),l(Z,K),Z})()})),l($,p(j,{get when(){return D()==="json"},get children(){var J=g(Se),K=J.firstChild,[Z,rt]=u(K.nextSibling),ct=Z.nextSibling,Ct=ct.firstChild,qt=Ct.nextSibling;return l(J,()=>s("缩进"),Z,rt),ct.addEventListener("change",jt=>f(jt.currentTarget.value)),l(Ct,()=>s("2 空格")),l(qt,()=>s("4 空格")),z(()=>Q(ct,"value",a())),J}}),V,lt),it.$$click=()=>{const J=_();L(D()),R(J),ut($t().ok?$t().text:nt())},l(it,()=>s("对调"),pt,at),ot.$$click=()=>Qt($t().text),l(ot,()=>s("复制结果")),h.$$click=()=>{const J=Un[D()];de($t().text,`data.${J.ext}`,J.mime)},l(h,()=>s("下载")),I.$$click=qe,l(I,()=>s("示例")),Y.$$click=()=>ut(""),l(Y,()=>s("清空")),z(J=>{var K=s("对调源/目标，并把当前结果填回输入"),Z=!$t().ok||!$t().text,rt=!$t().ok||!$t().text;return K!==J.e&&Lt(it,"title",J.e=K),Z!==J.t&&Q(ot,"disabled",J.t=Z),rt!==J.a&&Q(h,"disabled",J.a=rt),J},{e:void 0,t:void 0,a:void 0}),z(()=>Q(E,"value",_())),z(()=>Q(W,"value",D())),tt(),$})(),(()=>{var $=g(An),x=$.firstChild,d=x.firstChild,w=d.firstChild,[q,E]=u(w.nextSibling),O=q.nextSibling,C=O.nextSibling,[P,N]=u(C.nextSibling),B=d.nextSibling,W=x.nextSibling,U=W.firstChild,V=U.firstChild,[lt,it]=u(V.nextSibling),mt=lt.nextSibling,ft=mt.nextSibling,[pt,at]=u(ft.nextSibling),ot=U.nextSibling,[h,I]=u(ot.nextSibling);return l(d,()=>zt.find(([Y])=>Y===_())?.[1],q,E),l(d,()=>s("输入"),P,N),B.$$input=Y=>ut(Y.currentTarget.value),l(U,()=>zt.find(([Y])=>Y===D())?.[1],lt,it),l(U,()=>s("输出"),pt,at),l(W,p(j,{get when(){return $t().ok},get fallback(){return(()=>{var Y=g(we);return l(Y,()=>$t().text),Y})()},get children(){var Y=g(jn);return l(Y,()=>$t().text||`(${s("空")})`),Y}}),h,I),z(()=>Lt(B,"placeholder",`${_().toUpperCase()} ${s("文本…")}`)),z(()=>Q(B,"value",nt())),tt(),$})(),(()=>{var $=g(On),x=$.firstChild,[d,w]=u(x.nextSibling),q=d.nextSibling,E=q.nextSibling,O=E.nextSibling,C=O.nextSibling,[P,N]=u(C.nextSibling),B=P.nextSibling,W=B.nextSibling,U=W.nextSibling,[V,lt]=u(U.nextSibling);return l($,()=>s("JSON ↔ XML / TOML / YAML 多向互转：XML 输出会带"),d,w),l($,()=>s("属性以保证 round-trip（数组、对象、布尔、数字、null 都可还原），从外部粘贴的普通 XML 也可解析（启发式）。TOML 无 null 类型，遇到 null 字段会输出注释行"),P,N),l($,()=>s("；不支持多行字符串与日期。YAML 仅支持块式 mapping / sequence，不支持锚点、别名、标签、流式与多文档。"),V,lt),$})()]}}),Rt,xt),l(S,p(j,{get when(){return n()==="diff"},get children(){return[(()=>{var $=g(Cn),x=$.firstChild,d=x.firstChild,w=d.nextSibling,q=x.nextSibling,E=q.firstChild,O=E.nextSibling;return l(d,()=>s("A（左）")),w.$$input=C=>_t(C.currentTarget.value),l(E,()=>s("B（右）")),O.$$input=C=>St(C.currentTarget.value),z(()=>Q(w,"value",gt())),z(()=>Q(O,"value",dt())),tt(),$})(),(()=>{var $=g(Nn),x=$.firstChild,d=x.firstChild,w=d.nextSibling,q=w.nextSibling,[E,O]=u(q.nextSibling),C=x.nextSibling,P=C.nextSibling,N=P.nextSibling,B=N.nextSibling;return d.addEventListener("change",W=>Tt(W.currentTarget.checked)),l(x,()=>s("仅看差异路径"),E,O),C.$$click=ue,l(C,()=>s("全部展开")),P.$$click=$e,l(P,()=>s("全部折叠")),N.$$click=Ee,l(N,()=>s("示例")),B.$$click=()=>{_t(""),St("")},l(B,()=>s("清空")),z(()=>Q(d,"checked",vt())),tt(),$})(),p(j,{get when(){return!Jt().ok},get children(){var $=g(Tn),x=$.firstChild,d=x.nextSibling,[w,q]=u(d.nextSibling);return l($,()=>Jt().msg,w,q),$}}),p(j,{get when(){return Jt().ok},get children(){return(()=>{const $=Jt(),x=$.entries.filter(d=>d.op!=="equal");return[(()=>{var d=g(Wn),w=d.firstChild,q=w.firstChild,[E,O]=u(q.nextSibling),C=E.nextSibling,P=C.nextSibling,[N,B]=u(P.nextSibling),W=N.nextSibling,U=W.nextSibling,[V,lt]=u(U.nextSibling),it=w.nextSibling,mt=it.firstChild,ft=mt.firstChild,pt=ft.firstChild,at=pt.firstChild,ot=at.nextSibling,h=ft.nextSibling;return l(w,()=>s("差异概览"),E,O),l(w,()=>x.length,N,B),l(w,()=>s("处不同"),V,lt),l(at,()=>s("路径")),l(ot,()=>s("操作")),l(h,p(At,{get each(){return H(()=>!!x.length)()?x:[{path:"$",op:"equal",left:$.left,right:$.right}]},children:I=>(()=>{var Y=g(Pn),J=Y.firstChild,K=J.firstChild,Z=J.nextSibling,rt=Z.nextSibling,ct=rt.firstChild,Ct=rt.nextSibling,qt=Ct.firstChild;return l(K,()=>I.path),l(Z,(()=>{var jt=H(()=>I.op==="equal");return()=>jt()?s("完全相同"):H(()=>I.op==="add")()?s("新增"):H(()=>I.op==="remove")()?s("删除"):s("变更")})()),l(ct,(()=>{var jt=H(()=>I.op==="add");return()=>jt()?"—":JSON.stringify(I.left)})()),l(qt,(()=>{var jt=H(()=>I.op==="remove");return()=>jt()?"—":JSON.stringify(I.right)})()),Y})()})),d})(),(()=>{var d=g(Fn),w=d.firstChild,q=w.firstChild,E=q.nextSibling,O=w.nextSibling,C=O.firstChild,P=C.nextSibling;return l(q,()=>s("A 树")),l(E,p(j,{get when(){return $.left!==void 0},get fallback(){return(()=>{var N=g(Vt),B=N.firstChild,W=B.nextSibling,[U,V]=u(W.nextSibling);return U.nextSibling,l(N,()=>s("空"),U,V),N})()},get children(){return p(Wt,{get value(){return $.left},depth:0,path:"$",isOpen:Pt,toggle:Ut,filter:"",get diffMap(){return fe()},side:"left",get onlyDiff(){return vt()}})}})),l(C,()=>s("B 树")),l(P,p(j,{get when(){return $.right!==void 0},get fallback(){return(()=>{var N=g(Vt),B=N.firstChild,W=B.nextSibling,[U,V]=u(W.nextSibling);return U.nextSibling,l(N,()=>s("空"),U,V),N})()},get children(){return p(Wt,{get value(){return $.right},depth:0,path:"$",isOpen:Pt,toggle:Ut,filter:"",get diffMap(){return fe()},side:"right",get onlyDiff(){return vt()}})}})),d})(),(()=>{var d=g(ve);return l(d,()=>s("绿色 = B 新增；红色 = A 中独有；黄色 = 两侧不同。「仅看差异路径」会隐藏完全一致的叶子节点（仍显示带差异的祖先路径）。")),d})()]})()}})]}}),Dt,Le),S})()}Me(["click","input"]);export{Vn as default};
