{"version":3,"file":"Component-BAZRbStH.mjs","sources":["../src/components/ConversationMessage/extensions/NodeViews/DatasourceSelect/Component.tsx"],"sourcesContent":["import { type NodeViewProps, NodeViewWrapper } from '@tiptap/react';\nimport clsx from 'clsx';\nimport { useRef } from 'react';\nimport { DatasourceSelect } from '@/components/DatasourceSelect';\nimport type { DatasourceSelectRef } from '@/components/DatasourceSelect/types';\nimport styles from './styles.module.css';\n\nexport const NodeViewComponent = (props: NodeViewProps) => {\n\tconst ref = useRef<DatasourceSelectRef>(null);\n\n\tconst handleSelect = (selected: number) => {\n\t\tif (selected === props.node.attrs.dataSourceId) {\n\t\t\treturn;\n\t\t}\n\n\t\tprops.updateAttributes({ dataSourceId: selected });\n\n\t\tref.current?.toggle();\n\t};\n\n\treturn (\n\t\t<NodeViewWrapper className={clsx(styles['node-wrapper'])}>\n\t\t\t<DatasourceSelect\n\t\t\t\tref={ref}\n\t\t\t\tselected={+props.node.attrs.dataSourceId}\n\t\t\t\tonSelect={handleSelect}\n\t\t\t/>\n\t\t</NodeViewWrapper>\n\t);\n};\n"],"names":["NodeViewComponent","props","ref","useRef","handleSelect","selected","NodeViewWrapper","clsx","styles","DatasourceSelect"],"mappings":";;;;GAOaA,IAAoB,CAACC,MAAyB;AAC1D,QAAMC,IAAMC,EAA4B,IAAI,GAEtCC,IAAe,CAACC,MAAqB;AAC1C,IAAIA,MAAaJ,EAAM,KAAK,MAAM,iBAIlCA,EAAM,iBAAiB,EAAE,cAAcI,EAAA,CAAU,GAEjDH,EAAI,SAAS,OAAA;AAAA,EACd;AAEA,6CACEI,GAAA,EAAgB,WAAWC,EAAKC,EAAO,cAAc,CAAC,EAAA,GACtD,sBAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,KAAAP;AAAA,MACA,UAAU,CAACD,EAAM,KAAK,MAAM;AAAA,MAC5B,UAAUG;AAAA,IAAA;AAAA,EAAA,CAEZ;AAEF;"}