import type { Optic , Try , Try2 } from './standalone/optic.js' ; import type { Apply , Apply2 , HKT , HKT2 } from './hkt.js' ; import type { Simplify } from './utils.js' ; import type { Equivalence , Iso , Lens , Prism , Traversal , Getter , AffineFold , Fold , Setter , Params , OpticParams , } from './index.js' ; import * as I from './internals.js' ; function toOptic ( optic ) { if ( Object . prototype . hasOwnProperty . call ( optic , '_ref' ) ) return optic . _ref ; return optic ; } export function get < C extends 'Equivalence' | 'Iso' | 'Lens' | 'Getter' , A extends HKT , S > ( optic , source ) ; export function get < S , A > ( optic , source ) ; export function get ( optic , source ) { return I . get ( toOptic ( optic ) , source ) ; } type Preview < A extends HKT , S > = Apply < A , S > extends infer AU ? Try < AU , AU | undefined > : never ; export function preview < C extends 'Prism' | 'Traversal' | 'AffineFold' | 'Fold' , A extends HKT , S > ( optic , source ) ; export function preview < S , A > ( optic , source ) ; export function preview ( optic , source ) { return I . preview ( toOptic ( optic ) , source ) ; } type Collect < A extends HKT , S > = Apply < A , S > extends infer AU ? Try < AU , AU [ ] > : never ; export function collect < C extends 'Prism' | 'Traversal' | 'Fold' , A extends HKT , S > ( optic , source ) ; export function collect < S , A > ( optic , source ) ; export function collect ( optic , source ) { return I . collect ( toOptic ( optic ) , source ) ; } type Modify < A extends HKT , B , S , T extends HKT2 > = Apply < A , S > extends infer AU ? Apply2 < T , S , B > extends infer TU ? Try2 < AU , TU , Simplify < S , TU > > : never : never ; export function modify < C extends 'Equivalence' | 'Iso' | 'Lens' | 'Prism' | 'Traversal' , A extends HKT , B , S , T extends HKT2 > ( optic , f , source ) ; export function modify < S , T extends OpticParams , A , B > ( optic , f , source ) ; export function modify ( optic , f , source ) { return I . modify ( toOptic ( optic ) , f , source ) ; } type Set < B , S , T extends HKT2 > = Apply2 < T , S , B > extends infer TU ? Try < TU , Simplify < S , TU > > : never ; export function set < C extends 'Equivalence' | 'Iso' | 'Lens' | 'Prism' | 'Traversal' | 'Setter' , T extends HKT2 , B , S > ( optic , value , source ) ; export function set < S , T extends OpticParams , A , B > ( optic , value , source ) ; export function set ( optic , value , source ) { return I . set ( toOptic ( optic ) , value , source ) ; } export function remove < C extends 'Prism' | 'Traversal' , S > ( optic , source ) ; export function remove < S > ( optic , source ) ; export function remove ( optic , source ) { return I . remove ( toOptic ( optic ) , source ) ; }