"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react/jsx-runtime"),r=require("react"),s=require("../AssetSelectorChip/AssetSelectorChip.js"),n=require("../../../../Popover/Popover.js"),c=require("../utils.js"),l=require("./AssetSelectorContent.js"),o=require("./AssetSelectorSelect.scss.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=u(e);exports.AssetSelectorSelect=function(e){var u=e.type,i=e.currentAsset,p=e.parentId,d=e.parentType,v=e.onChange,A=e.testId,f=e.parentActiveWellId,j=r.useRef(null),C=r.useState(!1),S=a.default(C,2),h=S[0],y=S[1],q=r.useCallback((function(){return y((function(e){return!e}))}),[]),b=r.useCallback((function(e){q(),v(e)}),[v,q]);return t.jsxs(t.Fragment,{children:[t.jsx(s.AssetSelectorChip,{name:(null==i?void 0:i.name)||"Select ".concat(u.label),type:u.type,ref:j,onClick:q,testId:A,active:c.checkIsAssetActive(i)}),t.jsx(n.Popover,{open:h,className:o.popover,onClose:q,anchorEl:j.current,type:"menu",children:t.jsx(l.AssetSelectorContent,{type:u,onChange:b,parentId:p,parentType:d,parentActiveWellId:f})})]})};
//# sourceMappingURL=AssetSelectorSelect.js.map
