/** * Desmos Calculator Provider * Implementation of CalculatorProvider for Desmos calculators * * Supports: Basic, Scientific, and Graphing calculators * Based on Desmos API v1.12+ * Requires: Desmos API key (obtain from https://www.desmos.com/api) * * SECURITY BEST PRACTICE: * - Development: Pass apiKey directly for local testing * - Production: Use proxyEndpoint to keep API key server-side * * Example server-side proxy (Express.js): * ``` * app.get('/api/desmos/token', requireAuth, (req, res) => { * res.json({ apiKey: process.env.DESMOS_API_KEY }); * }); * ``` */ import type { Calculator, CalculatorProvider, CalculatorProviderCapabilities, CalculatorProviderConfig, CalculatorType } from "@pie-players/pie-calculator"; declare global { interface Window { Desmos?: any; } } /** * Desmos Calculator Provider Implementation */ export declare class DesmosCalculatorProvider implements CalculatorProvider { readonly providerId = "desmos"; readonly providerName = "Desmos"; readonly supportedTypes: CalculatorType[]; readonly version = "1.12"; private initialized; private apiKey?; private proxyEndpoint?; private isDevelopment; private onTelemetry; private emitTelemetry; /** * Get the configured API key * @internal Used internally by calculator instances */ getApiKey(): string | undefined; /** * Dynamically load the Desmos calculator library * @private */ private loadDesmosScript; /** * Initialize Desmos library * @param config Configuration with API key (development) or proxy endpoint (production) */ initialize(config?: { apiKey?: string; proxyEndpoint?: string; onTelemetry?: (eventName: string, payload?: Record) => void | Promise; }): Promise; /** * Create a calculator instance */ createCalculator(type: CalculatorType, container: HTMLElement, config?: CalculatorProviderConfig): Promise; /** * Check if type is supported */ supportsType(type: CalculatorType): boolean; /** * Cleanup */ destroy(): void; /** * Get provider capabilities */ getCapabilities(): CalculatorProviderCapabilities; }