{"version":3,"names":["dynamic","omit","untrack","composeRefs","userRef","mergeRootProps","resolveClassStyle","useSelectItemContext","useSelectRootContext","EMPTY_STATE","SelectItemText","props","item","root","setRef","node","textRef","current","hasRegistered","selectedTextEl","selectedItemTextRef","hasNoSelectedItemText","isConnected","selectedByFocus","indexRef","userClassStyle","userProps","merged","Tag","as"],"sources":["select-item-text.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { omit, untrack } from \"solid-js\";\nimport { composeRefs, userRef } from \"../../internals/compose-refs\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport { useSelectItemContext } from \"../item/select-item-context\";\nimport { useSelectRootContext } from \"../select-root-context\";\n\n// biome-ignore lint/complexity/noBannedTypes: public empty-state for consumer type references.\nexport type SelectItemTextState = {};\n\nexport interface SelectItemTextProps\n\textends BaseUIComponentProps<\"div\", SelectItemTextState> {\n\tas?: ValidComponent;\n}\n\nconst EMPTY_STATE: SelectItemTextState = {};\n\n/**\n * `<Select.ItemText>` — a `<div>` that carries the selectable text label\n * inside a `<Select.Item>`.\n */\nexport function SelectItemText(props: SelectItemTextProps): JSX.Element {\n\tconst item = useSelectItemContext();\n\tconst root = useSelectRootContext();\n\n\tconst setRef = (node: HTMLElement | null): void =>\n\t\tuntrack(() => {\n\t\t\titem.textRef.current = node;\n\t\t\tif (!node || !item.hasRegistered()) return;\n\t\t\tconst selectedTextEl = root.selectedItemTextRef.current;\n\t\t\tconst hasNoSelectedItemText =\n\t\t\t\tselectedTextEl === null || !selectedTextEl.isConnected;\n\t\t\tif (\n\t\t\t\titem.selectedByFocus() ||\n\t\t\t\t(hasNoSelectedItemText && item.indexRef.current === 0)\n\t\t\t) {\n\t\t\t\troot.selectedItemTextRef.current = node;\n\t\t\t}\n\t\t});\n\n\tconst userClassStyle = resolveClassStyle(props, () => EMPTY_STATE);\n\tconst userProps = omit(props, \"as\", \"class\", \"style\", \"attrs\");\n\n\tconst merged = mergeRootProps(userClassStyle, userProps);\n\n\tconst Tag = dynamic(() => props.as ?? \"div\");\n\treturn <Tag {...merged} ref={composeRefs(setRef, userRef(props))} />;\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,IAAI,EAAEC,OAAO,QAAQ,UAAU;AACxC,SAASC,WAAW,EAAEC,OAAO,QAAQ,8BAA8B;AACnE,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,iBAAiB,QAAQ,qCAAqC;AAEvE,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,oBAAoB,QAAQ,wBAAwB;;AAE7D;;AAQA,MAAMC,WAAgC,GAAG,CAAC,CAAC;;AAE3C;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,KAA0B,EAAe;EACvE,MAAMC,IAAI,GAAGL,oBAAoB,CAAC,CAAC;EACnC,MAAMM,IAAI,GAAGL,oBAAoB,CAAC,CAAC;EAEnC,MAAMM,MAAM,GAAIC,IAAwB,IACvCb,OAAO,CAAC,MAAM;IACbU,IAAI,CAACI,OAAO,CAACC,OAAO,GAAGF,IAAI;IAC3B,IAAI,CAACA,IAAI,IAAI,CAACH,IAAI,CAACM,aAAa,CAAC,CAAC,EAAE;IACpC,MAAMC,cAAc,GAAGN,IAAI,CAACO,mBAAmB,CAACH,OAAO;IACvD,MAAMI,qBAAqB,GAC1BF,cAAc,KAAK,IAAI,IAAI,CAACA,cAAc,CAACG,WAAW;IACvD,IACCV,IAAI,CAACW,eAAe,CAAC,CAAC,IACrBF,qBAAqB,IAAIT,IAAI,CAACY,QAAQ,CAACP,OAAO,KAAK,CAAE,EACrD;MACDJ,IAAI,CAACO,mBAAmB,CAACH,OAAO,GAAGF,IAAI;IACxC;EACD,CAAC,CAAC;EAEH,MAAMU,cAAc,GAAGnB,iBAAiB,CAACK,KAAK,EAAE,M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