import{W as e,X as t,Zt as n,nn as r}from"./branding-B7dW-jsD.js";var i=r(n());function a(n,r,a,s=!0,c){let[l,u]=i.useState(),d=e(c?`${c}-label`:void 0),f=n??r??l;return t(()=>{let e=n||r||!s?void 0:o(a.current,d);l!==e&&u(e)}),f}function o(e,t){let n=s(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function s(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}export{a as t};