What you want here isn't a power supply, but a measurement system.
If you only want to know whether there's AC present or not, that's trivially easy to do with an optocoupler or solid-state relay:
![schematic](https://cdn.statically.io/img/i.sstatic.net/jfvzW.png)
simulate this circuit – Schematic created using CircuitLab
If you want to compare the line voltage to a fixed value, that's also fairly simple; rectify it, divide it down, and use a comparator to compare the peaks to a voltage reference. Then pass the output of that comparator through an optocoupler to your output side.
If you want to measure the voltage with a little bit of precision, you can use a linear optocoupler like the aforementioned H11AA1, but you'll have to measure the current transfer ratio and calibrate that out in software.
The current transfer ratio, or CTR, is defined as \$\frac{I_{input}}{I_{output}}\$; if you give the optocoupler an input current of say 10 mA, and if the optocoupler has a CTR of say 50%, then the output current, provided there's enough voltage available that the output transistor isn't saturated, will be 5 mA.
The CTR varies quite a lot from device to device (I've never seen an optocoupler with tighter than a 1-to-2 spread, and they're more often on the order of 1-to-10), and it varies with temperature as well. In addition, the CTR changes (usually decreasing) as the device ages, so you'll need to compensate for that too, if you don't want old devices to constantly trip the undervoltage alarm.
Here's the most basic circuit for doing that. It's not too different from the circuit I show above, but this one is non-inverting:
![schematic](https://cdn.statically.io/img/i.sstatic.net/p2Sum.png)
simulate this circuit
R1 functions to convert the AC voltage to a current (we can assume the LED forward voltage is negligible in comparison to common mains voltages; if you're measuring low voltage AC you will want to compensate for it), then the optocoupler transfers that current over the isolation barrier and applies its CTR to it, then R2 converts that current back into a voltage, which can be measured with an ADC and then used to back-calculate what the AC input was:
$$\begin{align}
V_{ADC} &= I_{output}·R2\\
V_{ADC} &= I_{input}·CTR·R2\\
V_{ADC} &= \frac{V_{AC} - V_f}{R1}·CTR·R2\\
\frac{R1}{R2}·V_{ADC} &= (V_{AC} - V_f)·CTR\\
\frac{1}{CTR}·\frac{R1}{R2}·V_{ADC} &= V_{AC} - V_f\\
\frac{1}{CTR}·\frac{R1}{R2}·V_{ADC} + V_f &= V_{AC}.
\end{align}$$
Note that, for the H11AA1 shown here, positive and negative AC voltages will give the same response; you can't determine the AC polarity with this circuit.
You can trim the CTR in the analog domain by adding a resistor from base to emitter of the optocoupler (which lowers the effective CTR depending on the resistance--lower resistance means lower CTR), or in the digital domain by adjusting the constants in that calculation.
This is not an accurate measurement. The main source of error is the CTR, which (as previously mentioned) varies significantly from device to device, changes with temperature, and slowly degrades as the device ages. If your device is frequently turned on and off, and if it's safe to assume that the measured voltage will be within the expected range when the device is turned on, you can just automatically calibrate every time it's powered up and, instead of looking for specific numbers, look for specific deviations from the number it saw on power-up.
Obviously, all measurements here will need to take into consideration the fact that AC is AC. You don't want your device deciding it's lost AC power just because you measured the voltage a few milliseconds before the AC peak. Either synchronize your measurements to happen at the same time every half-cycle, or take measurements frequently enough that you can reconstruct the whole sine wave and look at that. It's easy to synchronize measurements here, because you can use the optocoupler's output itself as a timing reference; it will go low for a handful of milliseconds at each zero crossing.
If you want to measure it accurately, you'll need to set up a measurement circuit on the high-voltage side, feed that into an ADC, and connect the output of the ADC to your MCU through a digital isolator of some kind. This is the most straightforward way, though it may be a bit involved.
Another option would be to use a current transformer, if you happen to be more interested in the AC current than its voltage (or your application allows the two to be considered interchangeable, like if you have a known resistive load on the AC). This would avoid the need for a high-side power supply, ADC, and digital isolator.
it needs to pass the safety regulations
which regulations and which class? Does your safety requirements say anything about isolation from mains? Is GND lane user-accesible? \$\endgroup\$