(a) If a child was removed from his or her home, a petition alleging dependency shall be filed within five days of the preliminary protective hearing.
(b) If a child was not removed from his or her home or if a child was removed from his or her home but was released from protective custody at the preliminary protective hearing, a petition alleging dependency shall be filed within 30 days of the preliminary protective hearing.
(c) Upon a showing of good cause and notice to all parties, the court may grant a requested extension of time for filing a petition alleging dependency in accordance with the best interests of the child. The court shall issue a written order reciting the facts justifying the extension.
(d) If a petition alleging dependency is not filed within the required time frame, the complaint shall be dismissed without prejudice.