import{n as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-C21x__mS.js";import{n}from"./iframe-DaN-XFub.js";import{a as r,i}from"./utils-DUM89eIj.js";import{n as a,t as o}from"./ui.module-DoMIk8Oc.js";import{a as s,d as c,f as l}from"./usePickerTriggerController-BHBjSLtn.js";function u({emptyState:e,loadingState:t,errorState:n}){let i=n??t??e;return i==null?null:(0,d.jsx)(`div`,{className:r(a.uiPopupOption,c.status,n!==void 0&&c.statusError),"aria-disabled":!0,children:i})}var d;function f(){return(f=e((()=>{i(),o(),l(),d=n(),u.__docgenInfo={description:``,methods:[],displayName:`PickerStatus`,props:{emptyState:{required:!1,tsType:{name:`ReactNode`},description:``},loadingState:{required:!1,tsType:{name:`ReactNode`},description:``},errorState:{required:!1,tsType:{name:`ReactNode`},description:``}}}})))()}function p({open:e,query:t,defaultQuery:n,onQuery:r,resetOnClose:i,triggerMode:a}){let o=(0,m.useRef)(!1),c=t!==void 0,[l,u]=(0,m.useState)(n??``),d=c?t??``:l,f=(0,m.useEffectEvent)(()=>u(``)),p=i??(!a||s(a).resetQueryOnClose);(0,m.useEffect)(()=>{o.current&&!e&&p&&(c||f(),r?.(``)),o.current=e},[c,r,e,p]);let h=e=>{c||u(e),r?.(e)};return{query:d,setQuery:h,clearQuery:()=>h(``)}}var m;function h(){return(h=e((()=>{m=t()})))()}export{f as i,p as n,u as r,h as t};