import { Chunk , Effect as T , Either as E , pipe } from '@effect-ts/core' ; import * as Tuple from '@effect-ts/core/Collections/Immutable/Tuple' ; import { ConsoleService } from './ConsoleService.js' ; export * from '@effect-ts/core/Effect' ; export type { _A as OutputOf } from '@effect-ts/core/Utils' ; const log_ = T . deriveLifted ( ConsoleService ) ( [ 'log' ] , [ ] , [ ] ) ; export const log = log_ . log ; export const rightOrFail = < R , E1 , EE1 , A > ( effect , __trace ? ) : T . Effect < R , E1 | EE1 , A > => T . chain_ ( effect , E . fold ( ( x ) => T . fail ( x , __trace ) , ( x ) => T . succeed ( x , __trace ) ) ) ; export const eitherMap = < A1 , A2 > ( mapRight ) => < R , E1 , EE1 > ( effect , __trace ? ) : T . Effect < R , E1 , E . Either < EE1 , A2 > > => T . map_ ( effect , E . map ( mapRight ) ) ; export const chainMergeObject = < T2 , E2 , A1 extends { } , A2 extends { } > ( effect ) => < T1 , E1 > ( self ) : T . Effect < T1 & T2 , E1 | E2 , A1 & A2 > => T . chain_ ( self , ( a1 ) => pipe ( effect ( a1 ) , T . map ( ( a2 ) => ( { ... a1 , ... a2 } ) ) ) ) ; export const forEachParDict = < A , R , E , B > ( args ) => ( as ) : T . Effect < R , E , Record < string , B > > => forEachParDict_ ( as , args ) ; export const forEachParDict_ = < A , R , E , B > ( as , { mapKey , mapValue , } ) : T . Effect < R , E , Record < string , B > > => pipe ( as , T . forEach ( ( a ) => T . tuplePar ( mapKey ( a ) , mapValue ( a ) ) ) , T . map ( Chunk . map ( Tuple . toNative ) ) , T . map ( Chunk . toArray ) , T . map ( Object . fromEntries ) ) ;