With mass-market U.S. chocolate consumption on the wane and millennial tastes trending toward health-conscious snacks, the Hershey Co. chocolate giant faces a challenging future, analysts say.

While the central Pennsylvania company has been developing new product lines, its "category has been declining with the changing tastes of millennials," said Jack Russo, senior consumer staples analyst with Edward Jones. "Snacking is taking a different form, more protein" - energy bars, jerky, and fruits and nuts.

Adding pressure: U.S. consumption of chocolate - Hershey's core product - has fallen by about 3 percent a year since 2006, when consumption peaked, a recent UBS investment report noted. And a group of powerful global

competitors is targeting its home turf.

Now, the Hershey Co. faces a historic transition. It has received a buyout offer from Mondelez International Inc. which was rejected but is widely expected to be raised.

The Pennsylvania attorney general also has opened a new probe of the Hershey Trust, which controls the giant chocolate company. The trust also manages $12.3 billion in charitable assets to finance the 2,000-student Hershey School for impoverished children.

Hershey Co. represents the trust's biggest asset, and its stock dividends represent a major cash source for running the Hershey School, where costs per student are about $100,000 a year.

The school's primary mission is to serve Pennsylvania's needy children, including those from Philadelphia.

The attorney general investigation has focused on whether the trust board - now comprising nine people - violated a 2013 agreement with the state agency to curb board compensation and travel.

Mark Pacella, the attorney general's top nonprofit regulator, has demanded that three trust members resign. He would like the trust to limit board service to 10 years, which could lead to two more departures by the end of 2017 - or a majority of the current board.

Pacella has given the trust a deadline of July 31 to comply with his demands.

"We continue to have conversations with representatives for the trust," attorney general spokesman Jeffrey Johnson said Wednesday. "We are working to make sure the mission of Milton Hershey is fulfilled. Our goal is to achieve a long-term solution that will ensure that occurs."

Trust spokesman Kent Jarrell said: "We are still hopeful of a resolution."

He said the trust could not speculate on the prospects of the chocolate company. "We continue to review the diversification profile of the School Trust assets with the assistance of expert outside advisors," he said.

Amid the turmoil, the Hershey Co. has made modest efforts to reinvent itself. It recently introduced Cadbury-branded pouches of wrapped chocolate snacks. It has also diversified into such products as BarkThins, a chocolate snack, and Krave beef jerky.

Hershey, analysts noted, has raised prices on existing products, maintaining profits. It has cut costs by closing plants over the last decade, and opened a large new plant in Mexico.

But with the uncertainty at the trust and shifting consumer tastes, Mondelez - which itself could be a takeover target - is now making a determined run at Hershey.

On June 30, the Hershey Co. board unanimously rejected Mondelez's $107-a-share offer - worth about $23 billion. Many on Wall Street expect the Illinois company to come back with a higher offer.

"This is why Mondelez did what they did. Because [Hershey chocolate company] is weaker and there has been this controversy," Russo said.

But the $107-a-share offer wasn't high enough to merit serious consideration because of Hershey's commanding U.S. market position in chocolate.

"If they really want it, they better put a number out there and stop goofing around," Russo said. A per-share price that would catch Wall Street's attention would be $125 a share, he said.

Even then, Russo said, he did not know whether the trust that controls the company would say yes to a deal. "No one knows what motivates the trust board," Russo said. "You got to give Mondelez credit for giving this a shot."

Russo added that a deal would be complex because of the trust board decision-making process and the involvement of the attorney general. "If a deal gets done, I don't think it will be agreed upon this year."