A programmable nanoreplica molding for the fabrication of nanophotonic devices