AUGUSTA — Lawmakers who are writing Maine’s next two-year budget have all but settled on a spending package that will be just shy of the $8 billion proposed by Democratic Gov. Janet Mills.

But lawmakers were struggling to close the deal Monday night, with top State House leaders continuing to negotiate to get the support of minority Republicans, who say the bottom line is too close to $8 billion.

According to the most recent budget documents from the Legislature’s non-partisan Office of Fiscal and Program Review, budget negotiators on the Appropriations and Financial Affairs Committee had reached agreement on a $7.99 billion spending plan, which includes some but not all of Mills’ proposals.

Lawmakers on both sides of the aisle also have agreed to about $3 million in additional spending, outside of the budget package. That includes funding for Meals on Wheels programs for the elderly and additional funding for veterans homes.

Also tentatively agreed to is another $6 million in additional spending that will be split evenly between the Republican and Democratic caucuses in the House and the Senate.

But left unfunded are about $820 million in bills that lawmakers have approved and sent to the budget writing committee. Only a small portion of those measures will get the money they need to go into effect in the next budget cycle, while the remainder will likely die for a lack of funding, although a handful of the top priorities for the caucuses could be carried over in the 2020 session in hopes that a funding source materializes.

Left without funding are bills that include everything from a $1.6 million expansion of a Department of Health and Human Services needle exchange program aimed at combating the state’s opioid drug crisis to a bill that would eliminate the state sales tax on gun safes, trigger and barrel locks – expected to reduce incoming state sales tax revenue by about $33,000 a year.

Other bills without funding so far include ones that add four new safety inspectors to the Department of Labor, that would cost about $360,000 in 2021, and one that would add staff and provide additional office space for the ombudsman’s office for child welfare services at DHHS, which carries an annual cost of about $460,000.

That measure is one of several that came in response to the deaths of Marissa Kennedy and Kendall Chick, and legislative investigations into how the two girls, who police say died at the hands of their caregivers, slipped through the cracks of the state’s child protective system.

Like most states, Maine’s Constitution requires a balanced budget to be in place in order for state government to remain open. Budget negotiators have until June 30 to get a deal that can garner two-thirds support in the Legislature in order to avoid a state government shutdown. Ideally, most of the framework of that deal needs to be in place so it can be processed into the actual budget document, by the end of this week, if lawmakers hope to avoid racing the clock, as they have in so many recent budget cycles.

Monday evening, Speaker of the House Sara Gideon, D-Freeport, Senate President Troy Jackson, D-Allagash, Republican minority leaders including Rep. Kathleen Dillingham, R-Oxford, and Rep. Trey Stewart, R-Presque Isle, and their lead committee members as well as Senate minority leaders huddled in meetings both separately and together at the State House.

“We are still talking, the blow-up hasn’t happened, but $7.993 (billion) isn’t well under $8 billion,” said Sen. Jeff Timberlake, R-Turner, the assistant Senate minority leader.

Republicans have voiced concern about the level of surplus revenue that will be directed to the state’s emergency contingency fund, also known as the “rainy day” fund. The proposed budget would leave about $218 million in the fund, down from about $275 million in the current budget.

Republicans also say the current budget leaves too small a cushion in the state’s General Fund over the two-year cycle at just over $5 million. They warned that any downturn in the economy that slows projected revenue could put the budget in the red. “You can’t even have a hiccup, you can’t have even a burp in the economy with that little in reserves,” Timberlake  said.

In February, Mills’ presented her budget proposal, which included just over $8 billion in state spending or about 11 percent growth over the current budget, promising it was sustainable.

As Gideon left a round of talks Monday, she said only that state budget negotiations always take time.

Earlier in the day, Rep. Drew Gattine, D-Westbrook, the House chairman of the Appropriations Committee, said his goal was to have a final package voted on in time for the Legislature to adjourn by the end of next week.

The committee has covered a lot of ground, partially working over the last two weekends, voting on parts of the budget line by line – often with bipartisan or unanimous committee votes.

“There is really not a lot of distance between us in terms of where we are at,” Gattine said.

Still, lawmakers are facing increasing pressure from advocates who have not seen program expansion or policy initiatives they support garner funding as the clock winds down toward June 30. Even initiatives with relatively low costs will face tight scrutiny as competition for the few dollars available heats up.

In all, less than 1 percent of the items left unfunded stand a chance of being funded.

Some Republicans have said they are also dissatisfied with a bill that would allow Medicaid patients to receive abortion services, as they fundamentally opposed what they consider taxpayer-funded abortions.

But party leaders dismissed that as a key sticking point Monday and Democrats have said the measure doesn’t require any new spending. Still, conservatives have said the bill’s fiscal note shows as much as $375,000 of taxpayer funds could go to pay for abortions in Maine.

If the sides can cobble together a final deal, it will likely involve a handful of protest votes when the final budget package comes to the House and Senate floors for debates.

Some of the measures left on the so-called “special appropriations” table may be kept alive with carryover votes with hopes of finding funding in the second half of the lawmaking session due to start in January 2020. Others, however, will not.

Budget negotiations both in public and behind closed doors were expected to continue again Tuesday. Both the House and Senate were scheduled for regular meetings starting at 10 a.m.