'use strict';

/* ────────────────────────────────────────────────────────────────
   EPIC E4 — Mobile & Export
   
   PWA export, Capacitor (iOS/Android), Electron (desktop),
   Steam integration, console export, ad SDK
──────────────────────────────────────────────────────────────── */
const DEFAULT_ASSET_OPTIMIZATION = {
    compressTextures: true,
    textureFormat: 'webp',
    maxTextureSize: 2048,
    compressAudio: true,
    audioFormat: 'ogg',
    audioBitrate: 128,
    inlineSmallAssets: true,
    inlineThresholdBytes: 4096,
    generateSpriteAtlas: true,
    atlasMaxSize: 4096,
};
function generateServiceWorkerConfig(config) {
    return {
        cacheName: `${config.shortName}-v1`,
        strategy: config.cacheStrategy,
        precache: [config.startUrl, '/index.html', '/manifest.json'],
        runtimeCaching: [
            { urlPattern: /\.(?:png|jpg|jpeg|webp|svg|gif)$/i, handler: 'CacheFirst', options: { cacheName: 'images', expiration: { maxEntries: 100, maxAgeSeconds: 30 * 24 * 60 * 60 } } },
            { urlPattern: /\.(?:js|css)$/i, handler: 'StaleWhileRevalidate', options: { cacheName: 'static' } },
            { urlPattern: /\.(?:mp3|ogg|wav)$/i, handler: 'CacheFirst', options: { cacheName: 'audio', expiration: { maxEntries: 50 } } },
        ],
        offlineFallback: config.offlineSupport ? '/offline.html' : undefined,
    };
}
function createCapacitorConfig(appId, appName) {
    return {
        appId,
        appName,
        webDir: 'dist',
        plugins: {
            statusBar: { style: 'dark', backgroundColor: '#000000' },
            splashScreen: { launchShowDuration: 2000, launchAutoHide: true, backgroundColor: '#000000' },
            haptics: true,
        },
        ios: {
            scheme: appName,
            contentInset: 'automatic',
            allowsLinkPreview: false,
            deploymentTarget: '14.0',
            preferredContentMode: 'mobile',
        },
        android: {
            minSdkVersion: 23,
            targetSdkVersion: 34,
            allowMixedContent: false,
            backgroundColor: '#000000',
            buildToolsVersion: '34.0.0',
        },
    };
}
function createElectronConfig(partial) {
    return {
        width: 1280,
        height: 720,
        minWidth: 800,
        minHeight: 600,
        resizable: true,
        fullscreen: false,
        fullscreenable: true,
        frame: true,
        titleBarStyle: 'default',
        autoHideMenuBar: true,
        webPreferences: {
            nodeIntegration: false,
            contextIsolation: true,
            sandbox: true,
            webSecurity: true,
            devTools: false, // Disabled in production
        },
        singleInstance: true,
        tray: false,
        autoUpdater: true,
        ...partial,
    };
}
function createDefaultMobileLayout() {
    return {
        id: 'default-mobile',
        name: 'Default',
        controls: [
            {
                id: 'move-stick',
                type: 'joystick',
                position: { x: 0.15, y: 0.75 },
                size: 0.18,
                anchor: 'bottom-left',
                opacity: 0.6,
                hapticFeedback: true,
            },
            {
                id: 'btn-a',
                type: 'button',
                position: { x: 0.85, y: 0.75 },
                size: 0.08,
                anchor: 'bottom-right',
                opacity: 0.6,
                hapticFeedback: true,
                label: 'A',
            },
            {
                id: 'btn-b',
                type: 'button',
                position: { x: 0.78, y: 0.85 },
                size: 0.07,
                anchor: 'bottom-right',
                opacity: 0.6,
                hapticFeedback: true,
                label: 'B',
            },
        ],
        autoHide: true,
        autoHideDelay: 3000,
        customizable: true,
    };
}
const MOBILE_PERF_PROFILES = {
    low: {
        tier: 'low', maxFPS: 30, renderScale: 0.5, maxParticles: 100,
        maxAudioSources: 8, shadowQuality: 'off', postProcessing: false,
        textureQuality: 'low', physicsBroadPhaseSize: 64,
    },
    medium: {
        tier: 'medium', maxFPS: 60, renderScale: 0.75, maxParticles: 500,
        maxAudioSources: 16, shadowQuality: 'low', postProcessing: true,
        textureQuality: 'medium', physicsBroadPhaseSize: 128,
    },
    high: {
        tier: 'high', maxFPS: 60, renderScale: 1, maxParticles: 2000,
        maxAudioSources: 32, shadowQuality: 'high', postProcessing: true,
        textureQuality: 'high', physicsBroadPhaseSize: 256,
    },
};

exports.DEFAULT_ASSET_OPTIMIZATION = DEFAULT_ASSET_OPTIMIZATION;
exports.MOBILE_PERF_PROFILES = MOBILE_PERF_PROFILES;
exports.createCapacitorConfig = createCapacitorConfig;
exports.createDefaultMobileLayout = createDefaultMobileLayout;
exports.createElectronConfig = createElectronConfig;
exports.generateServiceWorkerConfig = generateServiceWorkerConfig;
//# sourceMappingURL=MobileExport.js.map
