PageSourceSearch

https://yuhi-sa.github.io/devtoolbox/_next/static/chunks/2104.ba86da7d78a9bf22.js

js yuhi-sa.github.io collected 2026-10-03 10:14:12 UTC 3,927 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2104],{2104:(e,r,t)=>{t.r(r),t.d(r,{default:()=>d});var a=t(4568),n=t(6972),s=t(7620);function l(e){try{return JSON.parse(e),{valid:!0}}catch(e){return{valid:!1,error:e.message}}}function d(){let{input:e,setInput:r,output:t,indent:d,setIndent:i,error:o,handleFormat:c,handleMinify:u}=function(){let[e,r]=(0,s.useState)(""),[t,a]=(0,s.useState)(""),[n,d]=(0,s.useState)(2),[i,o]=(0,s.useState)(""),c=(0,s.useCallback)(()=>{let r=l(e);if(!r.valid){o(r.error||"Invalid JSON"),a("");return}o("");try{a(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;try{let t=JSON.parse(e);return{formatted:JSON.stringify(t,null,r),valid:!0}}catch(r){return{formatted:e,valid:!1,error:r.message}}}(e,r);if(!t.valid)throw Error(t.error);return t.formatted}(e,n))}catch(e){o(e.message)}},[e,n]),u=(0,s.useCallback)(()=>{let r=l(e);if(!r.valid){o(r.error||"Invalid JSON"),a("");return}o("");try{a(function(e){let r=function(e){try{let r=JSON.parse(e);return{formatted:JSON.stringify(r),valid:!0}}catch(r){return{formatted:e,valid:!1,error:r.message}}}(e);if(!r.valid)throw Error(r.error);return r.formatted}(e))}catch(e){o(e.message)}},[e]);return{input:e,setInput:r,output:t,indent:n,setIndent:d,error:i,handleFormat:c,handleMinify:u}}();return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex gap-2 items-center flex-wrap",children:[(0,a.jsx)("button",{onClick:c,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition",children:"Format"}),(0,a.jsx)("button",{onClick:u,className:"px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 transition",children:"Minify"}),(0,a.jsxs)("label",{className:"flex items-center gap-1 text-sm text-gray-600 dark:text-gray-400",children:["Indent:",(0,a.jsxs)("select",{value:d,onChange:e=>i(Number(e.target.value)),className:"border rounded px-2 py-1 bg-white dark:bg-gray-800 dark:border-gray-600",children:[(0,a.jsx)("option",{value:2,children:"2 spaces"}),(0,a.jsx)("option",{value:4,children:"4 spaces"}),(0,a.jsx)("option",{value:1,children:"1 tab"})]})]})]}),o&&(0,a.jsx)("div",{className:"text-red-500 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded",children:o}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Input"}),(0,a.jsx)("textarea",{value:e,onChange:e=>r(e.target.value),className:"w-full h-80 p-3 font-mono text-sm border rounded-lg bg-white dark:bg-gray-800 dark:border-gray-600 focus:ring-2 focus:ring-blue-500 focus:outline-none",placeholder:'{"key": "value"}'})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-1",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Output"}),(0,a.jsx)(n.A,{text:t})]}),(0,a.jsx)("textarea",{readOnly:!0,value:t,className:"w-full h-80 p-3 font-mono text-sm border rounded-lg bg-gray-50 dark:bg-gray-900 dark:border-gray-600"})]})]})]})}},6972:(e,r,t)=>{t.d(r,{A:()=>l});var a=t(4568),n=t(7620);async function s(e){try{return await navigator.clipboard.writeText(e),!0}catch(t){let r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();try{return document.execCommand("copy"),!0}catch(e){return!1}finally{document.body.removeChild(r)}}}function l(e){let{text:r,label:t="Copy"}=e,[l,d]=(0,n.useState)(!1),i=async()=>{await s(r)&&(d(!0),setTimeout(()=>d(!1),2e3))};return(0,a.jsx)("button",{onClick:i,disabled:!r,className:"px-3 py-1 text-sm border rounded hover:bg-gray-100 dark:hover:bg-gray-700 dark:border-gray-600 transition disabled:opacity-50",children:l?"Copied!":t})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.