import{isNode as l}from"../../../../../shared/utils.js";import{isStringNode as f}from"../utils/is-sting-node.js";import{getInnerText as a,getNodeAttribute as c}from"../../../../../shared/markdoc.js";function p(t){const r=c(t,"level");if(r)return{value:a(t.children),id:c(t,"id"),depth:r}}function d(t){let r;return s(t,i=>{if(l(i)&&i.type==="heading")return r=p(i)?.value,o}),r}const o=Symbol("Exit visitor");function s(t,r){if(!t)return;const i=r(t);if(i===o)return i;for(const e of t.children){if(!e||f(e))continue;const n=s(e,r);if(n===o)return n}const u=t.slots||{};for(const e of Object.values(u)){if(!e||f(e))continue;const n=s(e,r);if(n===o)return n}}export{o as EXIT,d as extractFirstHeading,p as getHeadingData,s as visit};
