"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("../../hooks/use-event.js"),t=require("../../hooks/use-iso-morphic-effect.js"),s=require("../../hooks/use-slot.js"),o=require("../../hooks/use-sync-refs.js"),i=require("../../internal/disabled.js"),u=require("../../utils/render.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(e);let a=e.createContext(null);function c(){let r=e.useContext(a);if(null===r){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,c),e}return r}a.displayName="DescriptionContext";let p=u.forwardRefWithAs((function(r,n){let l=e.useId(),a=i.useDisabled(),{id:p=`headlessui-description-${l}`,...d}=r,f=c(),h=o.useSyncRefs(n);t.useIsoMorphicEffect((()=>f.register(p)),[p,f.register]);let v=s.useSlot({...f.slot,disabled:a||!1}),m={ref:h,...f.props,id:p};return u.useRender()({ourProps:m,theirProps:d,slot:v,defaultTag:"p",name:f.name||"Description"})}));Object.assign(p,{}),exports.useDescriptions=function(){let[t,s]=e.useState([]);return[t.length>0?t.join(" "):void 0,e.useMemo((()=>function(t){let o=r.useEvent((e=>(s((r=>[...r,e])),()=>s((r=>{let t=r.slice(),s=t.indexOf(e);return-1!==s&&t.splice(s,1),t}))))),i=e.useMemo((()=>({register:o,slot:t.slot,name:t.name,props:t.props,value:t.value})),[o,t.slot,t.name,t.props,t.value]);return l.default.createElement(a.Provider,{value:i},t.children)}),[s])]};
//# sourceMappingURL=description.js.map
