Warner Bros. is “freaking out” over its hit Harry Potter movie franchise’s connection to Johnny Depp after Amber Heard‘s new court documents described in painstaking detail how he allegedly beat, choked and tormented her during their relationship, sources told The Post on Friday.

Depp — who denies abusing Heard — is slated to star in “Fantastic Beasts 3,” the next installment of J.K.Rowling‘s Harry Potter movies. The script has been completed, although filming, which was due to start this summer, has been delayed to the fall of next year.

“Executives at Warner Bros. are wondering how to deal with the backlash of the Depp matter on the Harry Potter franchise,” a source said. “High-level female execs at the studio are extremely worried about working with Depp and the message it sends to the public, especially after the recent sordid departure of CEO Kevin Tsujihara,” who last month announced he was leaving amid a casting couch scandal.

ELON MUSK SUBPOENAED IN JOHNNY DEPP LAWSUIT AGAINST AMBER HEARD

“This is yet another blow to the morale of female employees at the studio,” the source said. “If Warner Bros. continues to stick by Depp, it would reveal a lot about the values the company holds.”

While reps at Warner Bros. didn’t respond to multiple requests for comment from The Post, insiders said executives are unsure how to proceed, since author J.K. Rowling came out strongly in support of Depp’s casting in a previous Potter flick in 2017 after his marriage to Heard crumbled.

“Many at Warner Bros. wish that Rowling hadn’t come out so strongly behind Depp, because having made her opinion so public boxes them into a corner,” a source said.

Rowling broke her silence on the controversy surrounding Depp’s casting as the villain Grindelwald when she wrote on her website in December 2017, “When Johnny Depp was cast as Grindelwald, I thought he’d be wonderful in the role. However, around the time of filming his cameo in the first movie, stories had appeared in the press that deeply concerned me and everyone most closely involved in the franchise.

JOHNNY DEPP SUES AMBER HEARD FOR $50 MILLION, SAYS SHE CHEATED ON HIM WITH ELON MUSK

“Harry Potter fans had legitimate questions and concerns about our choice to continue with Johnny Depp in the role. As David Yates, long-time Potter director, has already said, we naturally considered the possibility of recasting. I understand why some have been confused and angry about why that didn’t happen.”

Rowling added that while “the huge, mutually supportive community that has grown up around Harry Potter is one of the greatest joys of my life,” she found it “difficult, frustrating and at times painful” to remain silent on the Depp issue.

Referring to Depp and Heard’s divorce agreement, she added, “However, the agreements that have been put in place to protect the privacy of two people, both of whom have expressed a desire to get on with their lives, must be respected. Based on our understanding of the circumstances, the filmmakers and I are not only comfortable sticking with our original casting, but genuinely happy to have Johnny playing a major character in the movies.”

Rowling concluded, “I accept that there will be those who are not satisfied with our choice of actor in the title role. However, conscience isn’t governable by committee. Within the fictional world and outside it, we all have to do what we believe to be the right thing.”

“Fantastic Beasts: The Crimes of Grindelwald” starring Depp was released in November 2018 and grossed $653 million worldwide, making it the 10th-highest-grossing movie of that year but the lowest in the Harry Potter franchise.

Depp’s lawyer, Adam Waldman, has insisted to The Post that Heard’s allegations against Depp are “a hoax” — and that the superstar intends to prove it.

JOHNNY DEPP DROPPED FROM 'PIRATES OF THE CARIBBEAN' FRANCHISE

“Ms. Heard has a new problem besides defamation, perjury and filing and receiving a fraudulent temporary restraining order demand with the court: We are now interviewing other women who have come forward claiming they are victims of horrific acts of violence and other abuse at the hands of Amber Heard, in addition to Johnny Depp and Tasya van Rhee, the latter of whom Ms. Heard was previously arrested and incarcerated for assaulting,” Waldman said in a statement.

“We have now issued subpoenas to Amber Heard, her hoax assisting friends, Elon Musk and other witnesses to explain the avalanche of video, audio, photographic and testimonial evidence with which we intend to confront them.”

This article originally appeared on Page Six.