var e=function(e){return e.DIV=`DIV`,e.TABLE=`TABLE`,e.THEAD=`THEAD`,e.TBODY=`TBODY`,e.TR=`TR`,e.P=`P`,e.UL=`UL`,e.OL=`OL`,e.LI=`LI`,e.DL=`DL`,e.DT=`DT`,e.DD=`DD`,e.IMG=`IMG`,e.A=`A`,e.CODE=`CODE`,e.H2=`H2`,e.H3=`H3`,e.H4=`H4`,e.SPAN=`SPAN`,e.EM=`EM`,e.STRONG=`STRONG`,e.KBD=`KBD`,e.DETAILS=`DETAILS`,e.SUMMARY=`SUMMARY`,e.TEXT=`#text`,e}({}),t=function(e){return e.CODEBLOCK=`CODEBLOCK`,e.INLINECODE=`INLINECODE`,e.LISTINGBLOCK=`LISTINGBLOCK`,e.CONTENT=`CONTENT`,e.NOTE=`NOTE`,e.TIP=`TIP`,e.IMPORTANT=`IMPORTANT`,e.BUTTON=`BUTTON`,e.CAUTION=`CAUTION`,e.WARNING=`WARNING`,e.ICON=`ICON`,e.PAGELAUNCH=`PAGELAUNCH`,e.INLINEBUTTON=`INLINEBUTTON`,e.HIGHLIGHT=`HIGHLIGHT`,e}({}),n=function(e){return e.NX_IMPORT_LOAD=`NX_IMPORT_LOAD`,e.NX_IMPORT_ADD_NODE=`NX_IMPORT_ADD_NODE`,e.NX_IMPORT_PREVIEW=`NX_IMPORT_PREVIEW`,e.NX_IMPORT_RUN=`NX_IMPORT_RUN`,e.NX_EXPLORE_SEARCH=`NX_EXPLORE_SEARCH`,e.NX_TAB_NAV=`NX_TAB_NAV`,e.NX_HIGHLIGHT=`NX_HIGHLIGHT`,e.NX_HIGHLIGHT_REMOVE=`NX_HIGHLIGHT_REMOVE`,e}({});function r(e){return e.nodeType===e.COMMENT_NODE}function i(e){return e.nodeType===e.ELEMENT_NODE}function a(e){return e.nodeType===e.TEXT_NODE}function o(e){return r(e)?!0:a(e)?e.nodeValue?.trim()===``:!1}function s(e){return i(e)?[...e.classList]:[]}function c(e,t,n=!1){let r=e.attributes.getNamedItem(`src`)?.nodeValue;if(r!=null&&t!==void 0&&n)return r.startsWith(`http`)?r:`${t}/${r}`;if(e.src&&t!==void 0){let n=new URL(t),r=e.src.split(`/`),i=r[r.length-1]??``;return`${n.origin}${n.pathname}/${i}${n.search}`}}function l(r,i,a=!1){if(r.nodeName===e.IMG||r.nodeName===t.ICON)return{src:r.nodeName===e.IMG?c(r,i,a):void 0,alt:r.getAttribute(`alt`),caption:r.getAttribute(`caption`)};if(r.nodeName===e.A)return{href:r.getAttribute(`href`)};if(r.nodeName===t.CODEBLOCK)return{language:r.getAttribute(`language`),copy:r.getAttribute(`copy`)};if(r.nodeName===t.BUTTON||r.nodeName===t.PAGELAUNCH||r.nodeName===t.INLINEBUTTON){let e=r.getAttribute(`role`);return e===n.NX_IMPORT_LOAD?{role:e,endpoint:r.getAttribute(`endpoint`)}:e===n.NX_EXPLORE_SEARCH?{role:e,search:r.getAttribute(`search`)}:e===n.NX_TAB_NAV?{role:e,tab:r.getAttribute(`tab`)}:e===n.NX_IMPORT_ADD_NODE||e===n.NX_IMPORT_PREVIEW||e===n.NX_IMPORT_RUN?{role:e}:void 0}if(r.nodeName===t.HIGHLIGHT)return{tab:r.getAttribute(`tab`),element:r.getAttribute(`element`)}}function u(e,t,n=!1){return{name:e.nodeName,type:e.nodeType,value:e.nodeValue,classList:s(e),children:[...e.childNodes].filter(e=>!o(e)).map(e=>u(e,t,n)),attributes:i(e)?l(e,t,n):void 0}}export{u as n,e as t};