| Current Path : /proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/ |
| Current File : //proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/ConfigFieldDescription-CY0sdTp6.js |
import{G as m,K as b,ae as y,j as k,cQ as x}from"./index-BFGypnt-.js";const O=t=>{const n=[];for(const[s,e]of Object.entries(t))for(const c of e.keys)for(const[r,l]of Object.entries(c)){const o={...l,category:s,default:l.defaultdesc?.startsWith("`")?l.defaultdesc.split("`")[1]:"",key:r};n.push(o)}return n},h=(t,n,s)=>{let e=t.replaceAll("<","<").replaceAll(">",">").replaceAll(`
`,"<br>");e=e.replaceAll("```","").replaceAll("{important}","<b>Important</b>"),s&&t.match(/{(config|ref|config:option)}`[a-z-:._]+`/g)?.map(o=>{const a=o.substring(o.indexOf("`")+1,o.lastIndexOf("`"))?.split(":").pop();if(!a)return;const i=s.find(g=>g.includes(` ${a} `));if(!i)return;const p=i.split(": ")[1],u=i.split(":")[0].replace(/\s\s+/g," ").trim(),f=u.includes(" ")?u.substring(u.indexOf(" ")+1):a.replaceAll("-"," "),d=`<a href="${n}/${p}" target="_blank" rel="noopener noreferrer">${f}</a>`;e=e.replaceAll(o,d)});let c=0;const r=100;for(;e.includes("`")&&c++<r;)e=e.replace("`","<code>").replace("`","</code>");return e},A=({description:t,className:n})=>{const s=m(),{hasDocumentationObject:e}=b(),c=y({queryKey:["documentation/objects.inv.txt"],queryFn:async()=>x(e),staleTime:6e4});return t?k.jsx("span",{className:n,dangerouslySetInnerHTML:{__html:h(t,s,c.data)}}):null};export{A as C,O as t};