import { setC4 } from "@thi.ng/vectors/setc" ; import type { Color , ColorOp , ReadonlyColor } from "../api.js" ; import { D50 , D65 } from "../api/constants.js" ; import { __ensureAlpha } from "../internal/ensure.js" ; internal const transform = ( x ) => x > 0.00885645 ? Math . cbrt ( x ) : 7.787037 * x + 16 / 116 ; /**
 * Converts XYZ to Lab, using provided reference white point (default:
 *  D50 ). Also see  xyzLabD65 .
 *
 *  remarks param out param src param white export const xyzLab = ( out , src , white = D50 ) => { const x = transform ( src [ 0 ] / white [ 0 ] ) ; const y = transform ( src [ 1 ] / white [ 1 ] ) ; const z = transform ( src [ 2 ] / white [ 2 ] ) ; return setC4 ( out || src , 1.16 * y - 0.16 , 5.0 * ( x - y ) , 2.0 * ( y - z ) , __ensureAlpha ( src [ 3 ] ) ) ; } ; /**
 * Same as  xyzLab , but hard coded to use  D65 white point.
 *
 *  param out param src export const xyzLabD65 = ( out , src ) => xyzLab ( out , src , D65 ) ;