# Derivation for average value input current in buck-boost converter

I am struggling with the derivation of average value of input current as below. The image is from the lecture here (page 26).

Here is what I got so far. How did the lecture derive the final step here?

$$\langle i_g(t)\rangle_{T_s}=\frac{1}{T_s} \int_{0}^{T_s} i_g(t) dt =\frac{1}{T_s} \int_{0}^{dT_s} \langle i(t)\rangle_{T_s} dt = d(t)\langle i(t)\rangle_{T_s}$$

$$\langle i_g(t)\rangle_{T_s}=\frac{1}{T_s} \int_{0}^{T_s} i_g(t) dt =\frac{1}{T_s} \int_{0}^{dT_s} \langle i(t)\rangle_{T_s} dt = d(t)\langle i(t)\rangle_{T_s}$$
$$\frac{dT_s}{T_s}i(t)_{Ts} - \frac{0}{T_s}i(t)_{Ts} = d(t)i(t)_{Ts}$$