import{c as e,f as t,l as n,t as r}from"./widget-shared-ysjNKbt7.js";import{a as i,i as a,r as o}from"./highlight-WLBKzBhu.js";import{l as s}from"./index-B3EFxtWE.js";var c=t(n(),1),l=e();function u({value:e,lang:t,maxHeight:n=`24rem`}){let s=(0,c.useMemo)(()=>d(e),[e]),[u,f]=(0,c.useState)(()=>i(t));if((0,c.useEffect)(()=>{if(u)return;let e=!1;return o(t).then(t=>{!e&&t&&f(!0)}),()=>{e=!0}},[t,u]),s===``)return(0,l.jsx)(r,{});let p=a(s,u?t:`plaintext`);return(0,l.jsx)(`pre`,{className:`hljs overflow-auto rounded-md border p-3 font-mono text-xs leading-relaxed`,style:{maxHeight:n},children:(0,l.jsx)(`code`,{dangerouslySetInnerHTML:{__html:p}})})}function d(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):typeof e==`bigint`?e.toString():e instanceof Date?e.toISOString():e instanceof Uint8Array?`<binary ${e.byteLength}B>`:s(e)}export{u as WidgetHighlight,u as default};