// Polyfill global for browser
if (typeof globalThis !== 'undefined' && typeof global === 'undefined') {
  window.global = globalThis;
}
if (typeof globalThis !== 'undefined' && typeof Buffer === 'undefined') {
  // Buffer polyfill will be loaded by vite-plugin-node-polyfills if configured
}

// CF Workers shim for window.blocklet
// This file replaces the auto-generated __blocklet__.js from Blocklet Server
window.blocklet = window.blocklet || {};
Object.assign(window.blocklet, {
  prefix: '',
  groupPrefix: '',
  did: 'did:abt:test',
  componentId: null,
  serverVersion: '3.0.0',
  languages: [
    { code: 'en', name: 'English' },
    { code: 'zh', name: '简体中文' }
  ],
  appPid: 'payment-kit-cf',
  appId: 'payment-kit-cf',
  appName: 'Payment Kit',
  appLogo: '',
  appDescription: 'Decentralized Payment System',
  appUrl: window.location.origin,
  GA_MEASUREMENT_ID: '',
  theme: { prefer: 'light' },
  navigation: [{ title: 'Home', link: '/', icon: '' }],
  webWalletUrl: '',
  componentMountPoints: [],
  sessionPermissions: { canReadAll: true, canWriteAll: true },
  settings: {
    session: { cacheTtl: 3600 },
  },
});
