/g,">").replace(/(".*?")(?=\s*:)/g,'$1').replace(/"(\\.|[^"\\])*"/g,'$&').replace(/\b(-?\d+(?:\.\d+)?)\b/g,'$1').replace(/\b(true|false|null)\b/g,'$1').replace(/([\{\}\[\]\:,])/g,'$1')}function c(){const e=document.getElementById("mode-pretty").checked?"pretty":"minify",a=document.getElementById("sort").checked;try{let t=JSON.parse(n("input").value);a&&(t=d(t));const r=e==="pretty"?JSON.stringify(t,null,2):JSON.stringify(t);n("output").value=r,n("preview").innerHTML=s(r),window.ui?.setStatus?.("status","OK",!0)}catch{n("preview").innerHTML="",window.ui?.setStatus?.("status","Error",!1)}}document.getElementById("copy")?.addEventListener("click",()=>{window.ui?.copy?.(n("output").value);try{window.gaEvent?.("json_copy")}catch{}});document.getElementById("input")?.addEventListener("input",()=>{document.getElementById("validateLive").checked&&c()});["mode-pretty","mode-minify"].forEach(e=>document.getElementById(e)?.addEventListener("change",()=>{c();try{window.gaEvent?.("json_mode",{mode:document.getElementById("mode-pretty").checked?"pretty":"minify"})}catch{}}));document.getElementById("sort")?.addEventListener("change",()=>{c();try{window.gaEvent?.("json_sort",{on:document.getElementById("sort").checked})}catch{}});document.getElementById("validateLive")?.addEventListener("change",()=>{c();try{window.gaEvent?.("json_live_validate",{on:document.getElementById("validateLive").checked})}catch{}});n("input").value||(n("input").value=JSON.stringify({hello:"world",list:[1,2,3],nested:{a:!0,b:null}}));c();