import{o as t}from"./rolldown-runtime-iuO8RvI4.js";import{Mi as e,ki as n}from"./vendor-frame-CwiylG4Y.js";import{bn as r,vn as s,yn as a}from"./shared-5-UQAFGbWu.js";var o=t(e()),i=n();function l(t,e){return a(t)?(0,i.jsx)("span",{children:r(t).map((t,e)=>{const n=s(t.style);return n?(0,i.jsx)("span",{style:n,children:t.text},e):t.text})},e):(0,i.jsx)("span",{children:t},e)}function c({children:t}){return(0,o.useMemo)(()=>a(t),[t])?(0,i.jsx)(i.Fragment,{children:r(t).map((t,e)=>{const n=s(t.style);return n?(0,i.jsx)("span",{style:n,children:t.text},e):t.text})}):t}var h=new Set(["bash","sh","shell","shellscript","zsh"]),u=new Set(["aws","brew","bun","bunx","cargo","cd","chmod","claude","cp","curl","deno","docker","gcloud","gh","git","grep","kubectl","ls","mkdir","mv","node","npm","npx","pip","pip3","pnpm","python","python3","rg","rm","sed","ssh","tar","uv","wget","yarn"]),p=/^(?:sudo\s+)?(?:[A-Za-z_][A-Za-z0-9_]*=\S*\s+)*(\S+)/,m=/[|&;<>()`$\\]/;function d(t){if(m.test(t))return!1;const e=p.exec(t.trimStart())?.[1];return!!e&&(!!e.startsWith("./")||u.has(e))}var g=(0,o.createContext)(null);function f(){return(0,o.useContext)(g)}var x=/^((?:\u2502\s*)*)[\u251c\u2514]\u2500\u2500\s*(.*)$/,b=/^\[p=([\d.]+)\]\s*(.*)$/;function v(t){const e=t.split("\n").map(t=>t.trimEnd());let n=null,r=0;for(;r<e.length&&""===e[r].trim();)r++;r<e.length&&!x.test(e[r])&&(n=e[r].trim(),r++);const s=[],a=[];for(;r<e.length;r++){const t=e[r].match(x);if(!t)continue;const[,n,o]=t,i=(n.match(/\u2502/g)??[]).length,l=o.match(b),c=l?Number(l[1]):NaN,h={probability:Number.isFinite(c)?c:null,label:l?l[2].trim():o.trim(),children:[]};for(;a.length>0&&a[a.length-1].depth>=i;)a.pop();0===a.length?s.push(h):a[a.length-1].node.children.push(h),a.push({depth:i,node:h})}return{question:n,roots:s}}var y="search_tree",j=/<search_tree>([\s\S]*?)<\/search_tree>/g;function w(t){return t.includes("<search_tree>")?t.replace(j,(t,e)=>`\n\n\`\`\`${y}\n${e.trim()}\n\`\`\`\n\n`):t}export{f as a,c,g as i,l,v as n,h as o,w as r,d as s,y as t};