const fs = require('fs');
const { JSDOM } = require('jsdom');
const dom = new JSDOM('<!DOCTYPE html><html lang="en"><body><div id="market-content-area"></div></body></html>');
global.window = dom.window;
global.document = dom.window.document;
global.alert = console.log;
global.confirm = () => true;
global.fetch = async () => ({ json: async () => ({ status: 'success', data: [] }) });
global.navigator = { userAgent: 'node' };
global.state = {
    adminSession: null, customerSession: null, adminToken: null, customerToken: null,
    cooperatives: [], products: [], categories: [], marketView: 'home', marketCart: [], marketSearchQuery: '', marketCategoryFilter: ''
};
const code = fs.readFileSync('/Applications/XAMPP/xamppfiles/htdocs/kopdigi/public/js/app.v2.js', 'utf8');
try {
    eval(code);
    renderMarketplace();
    console.log("Success rendering marketplace!");
} catch(e) {
    console.error("Runtime Error:", e);
}
