{"version":3,"file":"components-CthHFayS.cjs","sources":["../../lib/vowel/web-component/VowelWebComponentRegistry.ts","../../lib/vowel/web-component/VowelWebComponentAPI.ts","../../lib/vowel/components/VowelWebComponentWrapper.tsx","../../lib/vowel/web-component/VowelFactoryRegistry.ts","../../lib/vowel/components/VowelInstructions.tsx","../../web-component.ts"],"sourcesContent":["/**\n * VowelWebComponentRegistry\n * \n * Manages per-instance state for web components\n * Allows multiple web components on the same page without conflicts\n */\n\nimport type { Vowel } from \"../core/VowelClient\";\nimport type { VowelAction, ActionHandler, VowelVoiceConfig, VowelClientConfig } from \"../types\";\n\n/**\n * Action registration entry\n */\ninterface ActionRegistration {\n  definition: VowelAction;\n  handler: ActionHandler;\n}\n\n/**\n * Per-instance state\n */\ninterface InstanceState {\n  /** Unique instance ID */\n  id: string;\n  /** Vowel client instance */\n  client: Vowel | null;\n  /** Registered actions for this instance */\n  actions: Map<string, ActionRegistration>;\n  /** Instance configuration */\n  config: {\n    instructions?: string;\n    systemInstructionOverride?: string;\n    language?: string;\n    initialGreetingPrompt?: string;\n    turnDetectionPreset?: 'aggressive' | 'balanced' | 'conservative';\n    /** @deprecated Prefer `_voiceConfig`. */\n    voiceConfig?: VowelVoiceConfig;\n    _voiceConfig?: VowelVoiceConfig;\n    floatingCursor?: VowelClientConfig['floatingCursor'];\n    _caption?: VowelClientConfig['_caption'];\n    borderGlow?: VowelClientConfig['borderGlow'];\n  };\n}\n\n/**\n * Global registry of web component instances\n */\nclass VowelWebComponentRegistry {\n  private instances: Map<string, InstanceState> = new Map();\n  private elementToInstanceId: WeakMap<HTMLElement, string> = new WeakMap();\n\n  /**\n   * Register a new web component instance\n   */\n  registerInstance(element: HTMLElement): string {\n    const instanceId = this.generateInstanceId();\n    \n    this.instances.set(instanceId, {\n      id: instanceId,\n      client: null,\n      actions: new Map(),\n      config: {},\n    });\n    \n    this.elementToInstanceId.set(element, instanceId);\n    \n    console.log(`📝 [VowelRegistry] Registered instance: ${instanceId}`);\n    return instanceId;\n  }\n\n  /**\n   * Unregister a web component instance\n   */\n  unregisterInstance(instanceIdOrElement: string | HTMLElement): void {\n    const instanceId = typeof instanceIdOrElement === 'string'\n      ? instanceIdOrElement\n      : this.elementToInstanceId.get(instanceIdOrElement);\n    \n    if (!instanceId) return;\n    \n    const instance = this.instances.get(instanceId);\n    if (instance?.client) {\n      instance.client.stopSession();\n    }\n    \n    this.instances.delete(instanceId);\n    console.log(`🗑️ [VowelRegistry] Unregistered instance: ${instanceId}`);\n  }\n\n  /**\n   * Get instance ID from element\n   */\n  getInstanceId(element: HTMLElement): string | undefined {\n    return this.elementToInstanceId.get(element);\n  }\n\n  /**\n   * Get instance state\n   */\n  getInstance(instanceIdOrElement: string | HTMLElement): InstanceState | undefined {\n    const instanceId = typeof instanceIdOrElement === 'string'\n      ? instanceIdOrElement\n      : this.elementToInstanceId.get(instanceIdOrElement);\n    \n    return instanceId ? this.instances.get(instanceId) : undefined;\n  }\n\n  /**\n   * Set Vowel client for an instance\n   */\n  setClient(instanceId: string, client: Vowel): void {\n    const instance = this.instances.get(instanceId);\n    if (instance) {\n      instance.client = client;\n      console.log(`✅ [VowelRegistry] Client set for instance: ${instanceId}`);\n    }\n  }\n\n  /**\n   * Get Vowel client for an instance\n   */\n  getClient(instanceIdOrElement: string | HTMLElement): Vowel | null {\n    const instance = this.getInstance(instanceIdOrElement);\n    return instance?.client || null;\n  }\n\n  /**\n   * Register an action for a specific instance\n   */\n  registerAction(\n    instanceIdOrElement: string | HTMLElement,\n    name: string,\n    definition: VowelAction,\n    handler: ActionHandler\n  ): void {\n    const instance = this.getInstance(instanceIdOrElement);\n    if (!instance) {\n      console.error(`❌ [VowelRegistry] Instance not found for action registration: ${name}`);\n      return;\n    }\n\n    instance.actions.set(name, { definition, handler });\n    \n    // If client exists, register the action immediately\n    if (instance.client) {\n      instance.client.registerAction(name, definition, handler);\n      console.log(`🎯 [VowelRegistry] Action registered: ${name} (instance: ${instance.id})`);\n    }\n  }\n\n  /**\n   * Get all actions for an instance\n   */\n  getActions(instanceIdOrElement: string | HTMLElement): Map<string, ActionRegistration> {\n    const instance = this.getInstance(instanceIdOrElement);\n    return instance?.actions || new Map();\n  }\n\n  /**\n   * Set configuration for an instance\n   */\n  setConfig(\n    instanceIdOrElement: string | HTMLElement,\n    config: InstanceState['config']\n  ): void {\n    const instance = this.getInstance(instanceIdOrElement);\n    if (instance) {\n      instance.config = { ...instance.config, ...config };\n    }\n  }\n\n  /**\n   * Get configuration for an instance\n   */\n  getConfig(instanceIdOrElement: string | HTMLElement): InstanceState['config'] {\n    const instance = this.getInstance(instanceIdOrElement);\n    return instance?.config || {};\n  }\n\n  /**\n   * Generate a unique instance ID\n   */\n  private generateInstanceId(): string {\n    return `vowel-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n  }\n\n  /**\n   * Get all registered instances (for debugging)\n   */\n  getAllInstances(): string[] {\n    return Array.from(this.instances.keys());\n  }\n}\n\n/**\n * Global singleton instance\n */\nexport const vowelRegistry = new VowelWebComponentRegistry();\n\n/**\n * Export for testing/debugging\n */\nif (typeof window !== 'undefined') {\n  (window as any).__VOWEL_REGISTRY__ = vowelRegistry;\n}\n","/**\n * VowelWebComponentAPI\n * \n * Extends the web component element with imperative API methods\n * Allows programmatic access to Vowel client and action registration\n */\n\nimport { vowelRegistry } from \"./VowelWebComponentRegistry\";\nimport type { Vowel } from \"../core/VowelClient\";\nimport type { VowelAction, ActionHandler, VowelVoiceConfig, VowelClientConfig } from \"../types\";\n\n/**\n * Extended interface for the vowel-voice-widget element\n * These methods will be available on the DOM element\n */\nexport interface VowelVoiceWidgetElement extends HTMLElement {\n  /**\n   * Register a custom action programmatically\n   * \n   * @example\n   * const widget = document.querySelector('vowel-voice-widget');\n   * widget.registerAction('addToCart', {\n   *   description: 'Add product to cart',\n   *   parameters: {\n   *     productId: { type: 'string', description: 'Product ID' }\n   *   }\n   * }, async (params) => {\n   *   console.log('Adding to cart:', params.productId);\n   * });\n   */\n  registerAction(name: string, definition: VowelAction, handler: ActionHandler): void;\n\n  /**\n   * Get the Vowel client instance\n   * Returns null if not yet initialized\n   * \n   * @example\n   * const widget = document.querySelector('vowel-voice-widget');\n   * const client = widget.getVowelClient();\n   * if (client) {\n   *   client.startSession();\n   * }\n   */\n  getVowelClient(): Vowel | null;\n\n  /**\n   * Start a voice session programmatically\n   */\n  startSession(): Promise<void>;\n\n  /**\n   * Stop the current voice session\n   */\n  stopSession(): void;\n\n  /**\n   * Get the current session state\n   */\n  getState(): any;\n\n  /**\n   * Set configuration options\n   * \n   * @example\n   * widget.setConfig({\n   *   systemInstructionOverride: 'You are a helpful assistant',\n   *   _voiceConfig: { voice: 'Puck' }\n   * });\n   */\n  setConfig(config: {\n    instructions?: string;\n    systemInstructionOverride?: string;\n    language?: string;\n    initialGreetingPrompt?: string;\n    turnDetectionPreset?: 'aggressive' | 'balanced' | 'conservative';\n    /** @deprecated Prefer `_voiceConfig`. */\n    voiceConfig?: VowelVoiceConfig;\n    _voiceConfig?: VowelVoiceConfig;\n    floatingCursor?: VowelClientConfig['floatingCursor'];\n    _caption?: VowelClientConfig['_caption'];\n    borderGlow?: VowelClientConfig['borderGlow'];\n  }): void;\n\n  /**\n   * Get instance ID (internal)\n   */\n  _instanceId?: string;\n}\n\n/**\n * Enhance a web component element with Vowel API methods\n */\nexport function enhanceVowelElement(element: HTMLElement, instanceId: string): void {\n  const enhanced = element as VowelVoiceWidgetElement;\n  \n  // Store instance ID\n  enhanced._instanceId = instanceId;\n  element.setAttribute('data-vowel-instance-id', instanceId);\n\n  /**\n   * Register an action\n   */\n  enhanced.registerAction = function(\n    name: string,\n    definition: VowelAction,\n    handler: ActionHandler\n  ): void {\n    if (!this._instanceId) {\n      console.error('❌ [VowelWebComponent] Cannot register action: instance ID not found');\n      return;\n    }\n\n    vowelRegistry.registerAction(this._instanceId, name, definition, handler);\n  };\n\n  /**\n   * Get Vowel client\n   */\n  enhanced.getVowelClient = function(): Vowel | null {\n    if (!this._instanceId) return null;\n    return vowelRegistry.getClient(this._instanceId);\n  };\n\n  /**\n   * Start session\n   */\n  enhanced.startSession = async function(): Promise<void> {\n    const client = this.getVowelClient();\n    if (!client) {\n      throw new Error('Vowel client not initialized yet');\n    }\n    await client.startSession();\n  };\n\n  /**\n   * Stop session\n   */\n  enhanced.stopSession = function(): void {\n    const client = this.getVowelClient();\n    if (client) {\n      client.stopSession();\n    }\n  };\n\n  /**\n   * Get state\n   */\n  enhanced.getState = function(): any {\n    const client = this.getVowelClient();\n    return client ? client.state : null;\n  };\n\n  /**\n   * Set config\n   */\n  enhanced.setConfig = function(config: any): void {\n    if (!this._instanceId) {\n      console.error('❌ [VowelWebComponent] Cannot set config: instance ID not found');\n      return;\n    }\n    vowelRegistry.setConfig(this._instanceId, config);\n  };\n\n  console.log(`✅ [VowelWebComponent] API methods attached to element (${instanceId})`);\n}\n\n/**\n * Dispatch lifecycle event\n */\nexport function dispatchVowelEvent(\n  element: HTMLElement,\n  eventName: 'ready' | 'session-start' | 'session-end' | 'error',\n  detail?: any\n): void {\n  const event = new CustomEvent(`vowel-${eventName}`, {\n    detail,\n    bubbles: true,\n    composed: true,\n  });\n  \n  element.dispatchEvent(event);\n  console.log(`📢 [VowelWebComponent] Event dispatched: vowel-${eventName}`);\n}\n\n/**\n * Wait for Vowel client to be ready\n * \n * @example\n * const widget = document.querySelector('vowel-voice-widget');\n * const client = await waitForVowelReady(widget);\n */\nexport function waitForVowelReady(element: HTMLElement): Promise<Vowel> {\n  return new Promise((resolve, reject) => {\n    const enhanced = element as VowelVoiceWidgetElement;\n    \n    // Check if already ready\n    const existingClient = enhanced.getVowelClient?.();\n    if (existingClient) {\n      resolve(existingClient);\n      return;\n    }\n\n    // Wait for ready event\n    const handleReady = (event: Event) => {\n      const customEvent = event as CustomEvent;\n      resolve(customEvent.detail.client);\n      element.removeEventListener('vowel-ready', handleReady);\n    };\n\n    element.addEventListener('vowel-ready', handleReady);\n\n    // Timeout after 30 seconds\n    setTimeout(() => {\n      element.removeEventListener('vowel-ready', handleReady);\n      reject(new Error('Vowel client initialization timeout'));\n    }, 30000);\n  });\n}\n\n/**\n * Export types for TypeScript users\n */\nexport type { VowelAction, ActionHandler } from \"../types\";\n","/**\n * VowelWebComponentWrapper - React component for web component conversion\n * Wraps VowelAgent with VowelProvider and handles adapter initialization\n * This component is converted to a web component using r2wc\n */\n\nimport { useEffect, useState, useRef, useMemo } from \"react\";\nimport { VowelProvider } from \"./VowelProviderSimple\";\nimport { VowelAgent } from \"./components\";\nimport type { VowelAgentProps } from \"./components\";\nimport { Vowel } from \"../core/VowelClient\";\nimport type { VowelClientConfig, VowelVoiceConfig } from \"../types\";\nimport type { RouterAdapter } from \"../types/types\";\n\n// Import platform adapters\nimport {\n  initializeShopifyIntegration,\n  ShopifyActionHandler,\n  // initializeNavigationListener,\n  initializeAutomationListener,\n} from \"../platforms/shopify\";\n\n// Import web component registry and API\nimport { vowelRegistry } from \"../web-component/VowelWebComponentRegistry\";\nimport {\n  enhanceVowelElement,\n  dispatchVowelEvent,\n} from \"../web-component/VowelWebComponentAPI\";\n\n// Global timer to track full initialization\nconst INIT_START_TIME = performance.now();\n\n/**\n * Supported platform adapters (DEPRECATED - use preset instead)\n * @deprecated Use preset attribute instead\n */\nexport type PlatformAdapter = \"vanilla\" | \"shopify\";\n\n/**\n * Supported presets\n */\nexport type PresetName = \"shopify\" | \"vanilla\";\n\n/**\n * Custom action definition for web component\n */\nexport interface WebComponentAction {\n  /** Action name/identifier */\n  name: string;\n  /** Action definition (description and parameters) */\n  definition: {\n    description: string;\n    parameters: Record<\n      string,\n      {\n        type: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\";\n        description: string;\n        optional?: boolean;\n        enum?: string[];\n      }\n    >;\n  };\n  /** Handler function name (must be globally accessible via window) */\n  handler: string;\n}\n\n/**\n * Configuration options for Vowel client\n */\nexport interface WebComponentConfig {\n  /** Override the system prompt/instruction */\n  instructions?: string;\n  systemInstructionOverride?: string;\n  language?: string;\n  initialGreetingPrompt?: string;\n  turnDetectionPreset?: 'aggressive' | 'balanced' | 'conservative';\n  /** @deprecated Prefer `_voiceConfig`. */\n  voiceConfig?: VowelVoiceConfig;\n  _voiceConfig?: VowelVoiceConfig;\n  floatingCursor?: VowelClientConfig['floatingCursor'];\n  _caption?: VowelClientConfig['_caption'];\n  borderGlow?: VowelClientConfig['borderGlow'];\n}\n\n/**\n * Props for VowelWebComponentWrapper\n * These will be exposed as attributes on the web component\n */\nexport interface VowelWebComponentWrapperProps {\n  /** App ID (required) */\n  appId: string;\n\n  /**\n   * Initialization mode (NEW)\n   * - \"auto\": Automatically creates Vowel client (default)\n   * - \"custom\": Waits for window.registerVowelFactory() to provide custom initialization\n   * @default \"auto\"\n   */\n  initMode?: \"auto\" | \"custom\";\n\n  /** \n   * Preset to use (NEW - recommended)\n   * @example \"shopify\", \"vanilla\"\n   */\n  preset?: PresetName;\n\n  /** \n   * Platform adapter to use (DEPRECATED - use preset instead)\n   * @deprecated Use preset attribute instead\n   */\n  adapter?: PlatformAdapter;\n\n  /** Position of floating button */\n  position?: VowelAgentProps[\"position\"];\n\n  /** Show transcript panel */\n  showTranscripts?: boolean;\n\n  /** Button color (Tailwind classes or CSS color) */\n  buttonColor?: string;\n\n  /** Store URL (for Shopify preset) */\n  storeUrl?: string;\n\n  /** Custom actions (JSON string or object) */\n  customActions?: string | WebComponentAction[];\n\n  /** Configuration overrides (JSON string or object) */\n  config?: string | WebComponentConfig;\n\n  // Voice Nag Options\n  /** Enable the voice nag wrapper */\n  enableNag?: boolean;\n\n  /** Custom title for the nag message */\n  nagTitle?: string;\n\n  /** Custom description for the nag message */\n  nagDescription?: string;\n\n  /** Custom acknowledge button text for nag */\n  nagButtonText?: string;\n\n  /** LocalStorage key prefix for nag state */\n  nagStorageKeyPrefix?: string;\n\n  // Terms & Privacy Modal Options\n  /** Enable the terms and privacy modal */\n  enableTermsModal?: boolean;\n\n  /** Modal title for terms/privacy */\n  termsModalTitle?: string;\n\n  /** Modal description for terms/privacy */\n  termsModalDescription?: string;\n\n  /** Terms of service content (HTML or text) */\n  termsContent?: string;\n\n  /** URL to external terms of service */\n  termsUrl?: string;\n\n  /** Privacy policy content (HTML or text) */\n  privacyContent?: string;\n\n  /** URL to external privacy policy */\n  privacyUrl?: string;\n\n  /** Text for the accept button in modal */\n  termsAcceptButtonText?: string;\n\n  /** Text for the decline button in modal */\n  termsDeclineButtonText?: string;\n\n  /** Whether to show a decline button in modal */\n  termsAllowDecline?: boolean;\n\n  /** LocalStorage key prefix for terms acceptance state */\n  termsStorageKeyPrefix?: string;\n}\n\n/**\n * Create a vanilla router adapter for non-platform usage\n */\nfunction createVanillaRouter(): RouterAdapter {\n  return {\n    navigate: async (path: string) => {\n      window.location.href = path;\n    },\n    getCurrentPath: () => window.location.pathname,\n    getRoutes: () => [],\n    getContext: () => ({\n      location: {\n        pathname: window.location.pathname,\n        search: window.location.search,\n        hash: window.location.hash,\n      },\n      routes: [],\n      currentPath: window.location.pathname,\n    }),\n  };\n}\n\n/**\n * Parse custom actions from JSON string or return array\n */\nfunction parseCustomActions(\n  customActions?: string | WebComponentAction[]\n): WebComponentAction[] {\n  if (!customActions) return [];\n\n  if (typeof customActions === \"string\") {\n    try {\n      return JSON.parse(customActions);\n    } catch (error) {\n      console.error(\n        \"❌ [VowelWebComponentWrapper] Failed to parse customActions:\",\n        error\n      );\n      return [];\n    }\n  }\n\n  return customActions;\n}\n\n/**\n * Parse config from JSON string or return object\n */\nfunction parseConfig(\n  config?: string | WebComponentConfig\n): WebComponentConfig {\n  if (!config) return {};\n\n  if (typeof config === \"string\") {\n    try {\n      return JSON.parse(config);\n    } catch (error) {\n      console.error(\n        \"❌ [VowelWebComponentWrapper] Failed to parse config:\",\n        error\n      );\n      return {};\n    }\n  }\n\n  return config;\n}\n\n/**\n * VowelWebComponentWrapper - React component that gets converted to web component\n * Handles full initialization with provider structure and platform adapters\n *\n * @example\n * ```html\n * <!-- Vanilla usage -->\n * <vowel-voice-widget app-id=\"your-app-id\"></vowel-voice-widget>\n *\n * <!-- Shopify usage -->\n * <vowel-voice-widget\n *   app-id=\"your-app-id\"\n *   adapter=\"shopify\"\n *   store-url=\"https://mystore.com\">\n * </vowel-voice-widget>\n *\n * <!-- With custom actions and config -->\n * <vowel-voice-widget\n *   app-id=\"your-app-id\"\n *   custom-actions='[{\"name\":\"addToCart\",\"definition\":{...},\"handler\":\"handleAddToCart\"}]'\n *   config='{\"instructions\":\"You are a helpful assistant.\"}'>\n * </vowel-voice-widget>\n * ```\n */\nexport function VowelWebComponentWrapper({\n  appId,\n  initMode = \"auto\",\n  preset,\n  adapter,\n  position = \"bottom-right\",\n  showTranscripts = false,\n  buttonColor,\n  storeUrl,\n  customActions,\n  config,\n  // Nag props\n  enableNag,\n  nagTitle,\n  nagDescription,\n  nagButtonText,\n  nagStorageKeyPrefix,\n  // Terms modal props\n  enableTermsModal,\n  termsModalTitle,\n  termsModalDescription,\n  termsContent,\n  termsUrl,\n  privacyContent,\n  privacyUrl,\n  termsAcceptButtonText,\n  termsDeclineButtonText,\n  termsAllowDecline,\n  termsStorageKeyPrefix,\n}: VowelWebComponentWrapperProps) {\n  // Determine which mode to use: preset (new) or adapter (legacy)\n  const usePreset = preset !== undefined;\n  const effectivePreset = preset || (adapter === \"shopify\" ? \"shopify\" : \"vanilla\");\n  \n  // Show deprecation warning if using adapter\n  if (adapter && !preset) {\n    console.warn('⚠️ [VowelWebComponentWrapper] The \"adapter\" attribute is deprecated. Please use \"preset\" instead.');\n    console.warn(`   💡 Replace adapter=\"${adapter}\" with preset=\"${effectivePreset}\"`);\n  }\n  \n  // Log init mode for debugging\n  if (initMode === \"custom\") {\n    console.log('🏭 [VowelWebComponentWrapper] Using custom initialization mode - waiting for factory');\n  }\n  const [vowelClient, setVowelClient] = useState<Vowel | null>(null);\n  const [isInitializing, setIsInitializing] = useState(true);\n  const [error, setError] = useState<string | null>(null);\n  const [isElementEnhanced, setIsElementEnhanced] = useState(false); // Track when element has API methods\n  const initRef = useRef(false);\n  const instanceIdRef = useRef<string | null>(null);\n  const elementRef = useRef<HTMLElement | null>(null);\n  const timersRef = useRef({\n    scriptParseComplete: INIT_START_TIME,\n    componentMount: 0,\n    registrySetup: 0,\n    clientInit: 0,\n    clientReady: 0,\n  });\n  \n  // Register instance and enhance element on mount\n  useEffect(() => {\n    const mountStart = performance.now();\n    timersRef.current.componentMount = mountStart;\n    console.log(`⏱️ [VowelWebComponentWrapper] Component mounted at +${(mountStart - INIT_START_TIME).toFixed(2)}ms`);\n    \n    // Find the host element (web component)\n    // Note: r2wc renders React components directly into the custom element (no shadow DOM by default)\n    // So we need to traverse up from the React root to find the <vowel-voice-widget> host\n    const findHostElement = (): HTMLElement | null => {\n      if (typeof window === 'undefined') return null;\n      \n      // Strategy: Query all vowel-voice-widget elements\n      // Since the React component is rendered INSIDE the web component, this should work\n      const widgets = document.querySelectorAll('vowel-voice-widget');\n      console.log(`🔍 [VowelWebComponentWrapper] Found ${widgets.length} vowel-voice-widget elements in document`);\n      console.log(`🔍 [VowelWebComponentWrapper] document.readyState: ${document.readyState}`);\n      console.log(`🔍 [VowelWebComponentWrapper] document.body children: ${document.body?.children.length}`);\n      \n      // Find the one that doesn't have an instance ID yet, or the last one\n      for (let i = widgets.length - 1; i >= 0; i--) {\n        const widget = widgets[i] as HTMLElement;\n        const hasInstanceId = widget.getAttribute('data-vowel-instance-id');\n        console.log(`🔍 [VowelWebComponentWrapper] Widget ${i}: hasInstanceId=${!!hasInstanceId}, id=${hasInstanceId}, tagName=${widget.tagName}`);\n        if (!hasInstanceId) {\n          console.log(`✅ [VowelWebComponentWrapper] Selected widget ${i} (no instance ID yet)`);\n          return widget;\n        }\n      }\n      \n      // If all have IDs, return the last one (most recently created)\n      if (widgets.length > 0) {\n        console.log(`⚠️ [VowelWebComponentWrapper] All widgets have IDs, selecting last one`);\n        return widgets[widgets.length - 1] as HTMLElement;\n      }\n      \n      console.error(`❌ [VowelWebComponentWrapper] No vowel-voice-widget elements found in document!`);\n      console.error(`❌ [VowelWebComponentWrapper] This suggests a timing issue - the web component may not be in DOM yet.`);\n      return null;\n    };\n\n    // Try to find host immediately\n    let hostElement = findHostElement();\n    \n    // If not found, retry after a short delay (timing issue with r2wc rendering)\n    if (!hostElement) {\n      console.warn(`⚠️ [VowelWebComponentWrapper] Host element not found immediately, retrying after 10ms...`);\n      const retryTimeout = setTimeout(() => {\n        hostElement = findHostElement();\n        if (hostElement) {\n          registerAndEnhance(hostElement);\n        } else {\n          console.error(`❌ [VowelWebComponentWrapper] Still could not find host element after retry!`);\n        }\n      }, 10);\n      \n      return () => {\n        clearTimeout(retryTimeout);\n        if (instanceIdRef.current) {\n          vowelRegistry.unregisterInstance(instanceIdRef.current);\n          instanceIdRef.current = null;\n        }\n      };\n    }\n    \n    // Helper function to register and enhance\n    function registerAndEnhance(hostElement: HTMLElement) {\n      const registryStart = performance.now();\n      elementRef.current = hostElement;\n      instanceIdRef.current = vowelRegistry.registerInstance(hostElement);\n      console.log(`🎤 [VowelWebComponentWrapper] Calling enhanceVowelElement with instanceId: ${instanceIdRef.current}`);\n      enhanceVowelElement(hostElement, instanceIdRef.current);\n      \n      // Verify API methods were attached\n      const enhanced = hostElement as any;\n      console.log(`🔍 [VowelWebComponentWrapper] API verification:`, {\n        hasGetVowelClient: typeof enhanced.getVowelClient === 'function',\n        hasRegisterAction: typeof enhanced.registerAction === 'function',\n        hasInstanceId: !!enhanced._instanceId,\n        instanceId: enhanced._instanceId\n      });\n      \n      // Set any config from props\n      const parsedConfig = parseConfig(config);\n      if (Object.keys(parsedConfig).length > 0) {\n        vowelRegistry.setConfig(instanceIdRef.current, parsedConfig);\n      }\n      \n      timersRef.current.registrySetup = performance.now();\n      const registryDuration = (timersRef.current.registrySetup - registryStart).toFixed(2);\n      console.log(`🎤 [VowelWebComponentWrapper] Instance registered: ${instanceIdRef.current} (+${registryDuration}ms)`);\n      console.log(`⏱️ [VowelWebComponentWrapper] Total time since script load: ${(timersRef.current.registrySetup - INIT_START_TIME).toFixed(2)}ms`);\n      \n      // Mark element as enhanced - this allows the client init effect to proceed with dispatching events\n      setIsElementEnhanced(true);\n      console.log(`✅ [VowelWebComponentWrapper] Element enhancement complete, ready for client initialization`);\n    }\n    \n    // Register immediately if found\n    if (hostElement) {\n      registerAndEnhance(hostElement);\n    }\n\n    // Cleanup on unmount\n    return () => {\n      if (instanceIdRef.current) {\n        vowelRegistry.unregisterInstance(instanceIdRef.current);\n        instanceIdRef.current = null;\n      }\n    };\n  }, []); // Empty deps - only run once on mount\n  \n  // Dispatch ready event when both element is enhanced AND client is initialized\n  useEffect(() => {\n    if (isElementEnhanced && vowelClient && elementRef.current) {\n      console.log(`✅ [VowelWebComponentWrapper] Both element enhanced and client ready, dispatching vowel-ready event`);\n      dispatchVowelEvent(elementRef.current, 'ready', { client: vowelClient });\n    }\n  }, [isElementEnhanced, vowelClient]);\n  \n  // Check if this tab is controlled by another Vowel instance\n  const isControlled = useMemo(() => {\n    if (typeof window === 'undefined') return false;\n    \n    // Check multiple sources for controlled status\n    const urlParams = new URLSearchParams(window.location.search);\n    const hasControlledParam = urlParams.get('vowel_controlled') === 'true';\n    const hasControlledSession = sessionStorage.getItem('vowel-controlled') === 'true';\n    const hasControlledWindowName = window.name && window.name.startsWith('vowel-content-');\n    \n    const controlled = hasControlledParam || hasControlledSession || hasControlledWindowName;\n    \n    if (controlled) {\n      console.log('🎯 [VowelWebComponentWrapper] Running in controlled tab - hiding mic button');\n      console.log('   🔖 Detected via query param:', hasControlledParam);\n      console.log('   💾 Detected via sessionStorage:', hasControlledSession);\n      console.log('   📛 Detected via window name:', hasControlledWindowName);\n    }\n    \n    return controlled;\n  }, []);\n  \n  // Initialize navigation and automation listeners for controlled tabs\n  useEffect(() => {\n    if (isControlled && (effectivePreset === 'shopify' || adapter === 'shopify')) {\n      const listenersStart = performance.now();\n      console.log(`⏱️ [VowelWebComponentWrapper] Starting controlled tab initialization at +${(listenersStart - INIT_START_TIME).toFixed(2)}ms`);\n      console.log('   📡 [VowelWebComponentWrapper] Initializing listeners for controlled tab...');\n      \n      // Lazy load and initialize navigation listener\n      Promise.all([\n        import('../platforms/generic/navigation-listener'),\n        import('./web-components'),\n      ]).then(([navModule, wcModule]) => {\n        const navStart = performance.now();\n        console.log(`   ⏱️ Modules loaded in ${(navStart - listenersStart).toFixed(2)}ms`);\n        \n        console.log('   📡 Setting up navigation listener...');\n        navModule.initializeNavigationListener();\n        \n        console.log('   📡 Setting up automation listener...');\n        initializeAutomationListener();  // Use default 'vowel-automation' channel\n        \n        console.log('   📡 Registering web components...');\n        wcModule.registerAllVowelWebComponents();\n        \n        const listenersDone = performance.now();\n        console.log(`   ✅ All listeners initialized in ${(listenersDone - navStart).toFixed(2)}ms`);\n        console.log(`⏱️ [VowelWebComponentWrapper] Controlled tab setup complete at +${(listenersDone - INIT_START_TIME).toFixed(2)}ms`);\n      });\n      \n      // Initialize floating cursor for controlled tab\n      console.log('   🎯 [VowelWebComponentWrapper] Initializing floating cursor for controlled tab...');\n      const initFloatingCursor = async () => {\n        try {\n          const { FloatingCursorManager } = await import('../managers/FloatingCursorManager');\n          const { getPreset } = await import('../presets');\n          const { setAutomationListenerCursorManager } = await import('../platforms/generic/automation-listener');\n          \n          const preset = getPreset(effectivePreset as 'vanilla' | 'controlled' | 'shopify'); // Includes internal presets like 'shopify'\n          \n          if (preset.floatingCursor?.enabled) {\n            const manager = new FloatingCursorManager(preset.floatingCursor);\n            console.log('   ✅ [VowelWebComponentWrapper] Floating cursor initialized for controlled tab');\n            \n            // Set the global cursor manager for the automation listener\n            setAutomationListenerCursorManager(manager);\n            \n            // Cleanup on unmount\n            return () => {\n              manager.destroy();\n              setAutomationListenerCursorManager(null);\n              console.log('   🧹 [VowelWebComponentWrapper] Floating cursor destroyed');\n            };\n          }\n        } catch (error) {\n          console.error('   ❌ [VowelWebComponentWrapper] Failed to initialize floating cursor:', error);\n        }\n      };\n      \n      initFloatingCursor();\n      \n      console.log('   🛑 Skipping VowelClient initialization - this is a controlled tab');\n    }\n  }, [isControlled, effectivePreset, adapter]);\n\n  useEffect(() => {\n    // Skip initialization if this is a controlled tab\n    if (isControlled) {\n      console.log('🛑 [VowelWebComponentWrapper] Skipping VowelClient initialization - this is a controlled tab');\n      return;\n    }\n    \n    // Wait for element enhancement to complete before initializing client\n    // This ensures instanceIdRef and elementRef are set before we try to store the client\n    if (!isElementEnhanced) {\n      console.log('⏳ [VowelWebComponentWrapper] Waiting for element enhancement before client initialization...');\n      return;\n    }\n    \n    // Prevent double initialization in strict mode\n    if (initRef.current) return;\n    initRef.current = true;\n\n    const fullInitStart = performance.now();\n    timersRef.current.clientInit = fullInitStart;\n    console.log(`⏱️ ════════════════════════════════════════════════════════════════`);\n    console.log(`⏱️ [VowelWebComponentWrapper] 🚀 STARTING FULL INITIALIZATION`);\n    console.log(`⏱️ [VowelWebComponentWrapper] Time since script load: +${(fullInitStart - INIT_START_TIME).toFixed(2)}ms`);\n    console.log(`⏱️ ════════════════════════════════════════════════════════════════`);\n    console.log(\"🎤 [VowelWebComponentWrapper] Config:\", {\n      appId,\n      adapter,\n      storeUrl,\n    });\n\n    const initializeVowel = async () => {\n      try {\n        setIsInitializing(true);\n        setError(null);\n\n        // Validate required appId\n        if (!appId || appId.trim() === \"\" || appId === \"default-app\") {\n          throw new Error(\n            \"Missing or invalid app-id attribute. Please provide a valid Vowel application ID from the Vowel platform.\"\n          );\n        }\n\n        // Parse configuration and custom actions\n        const parsedConfig = parseConfig(config);\n        const parsedActions = parseCustomActions(customActions);\n\n        console.log(\"🎤 [VowelWebComponentWrapper] Initializing...\", {\n          appId,\n          mode: usePreset ? 'preset' : 'legacy-adapter',\n          preset: effectivePreset,\n          adapter,\n          storeUrl,\n          hasCustomConfig: Object.keys(parsedConfig).length > 0,\n          customActionsCount: parsedActions.length,\n        });\n\n        let router: RouterAdapter | undefined;\n        let navigationAdapter: any | undefined;\n        let automationAdapter: any | undefined;\n        let routes: any[] = [];\n        let actionHandler: ShopifyActionHandler | null = null;\n        let floatingCursorConfig: any = undefined;\n\n        // Initialize based on preset (new) or adapter (legacy)\n        if (usePreset) {\n          // NEW: Preset-based initialization with dual adapters\n          console.log(`🎯 [VowelWebComponentWrapper] Initializing from preset: ${effectivePreset}`);\n          \n          const { initializeFromPreset } = await import('../presets');\n          const { initializeShopifyDualAdapters } = await import('../platforms/shopify');\n          \n          if (effectivePreset === 'shopify') {\n            // Use Shopify dual adapter initialization\n            const shopifySetup = await initializeShopifyDualAdapters({\n              storeUrl: storeUrl || window.location.origin,\n              useFallbackRoutes: false,\n            });\n            \n            navigationAdapter = shopifySetup.navigationAdapter;\n            automationAdapter = shopifySetup.automationAdapter;\n            routes = shopifySetup.routes;\n            actionHandler = shopifySetup.actionHandler;\n            \n            // Get floating cursor config from preset\n            const presetConfig = await initializeFromPreset(effectivePreset as 'shopify', { storeUrl });\n            floatingCursorConfig = presetConfig.floatingCursor;\n            \n            console.log(`✅ [VowelWebComponentWrapper] Shopify preset initialized with ${routes.length} routes`);\n          } else {\n            // Vanilla or other preset\n            const presetSetup = await initializeFromPreset(effectivePreset, {});\n            navigationAdapter = presetSetup.navigationAdapter;\n            automationAdapter = presetSetup.automationAdapter;\n            floatingCursorConfig = presetSetup.floatingCursor;\n            \n            console.log(`✅ [VowelWebComponentWrapper] ${effectivePreset} preset initialized`);\n          }\n        } else {\n          // LEGACY: Adapter-based initialization (deprecated)\n          console.log(`⚠️ [VowelWebComponentWrapper] Using legacy adapter mode: ${adapter}`);\n          \n          if (adapter === \"shopify\") {\n            console.log(\"🛍️ [VowelWebComponentWrapper] Initializing Shopify adapter (legacy)...\");\n\n            // Initialize Shopify integration (legacy mode)\n            const shopifyIntegration = await initializeShopifyIntegration({\n              storeUrl: storeUrl || window.location.origin,\n              useFallbackRoutes: false,\n            });\n\n            router = shopifyIntegration.router;\n            routes = shopifyIntegration.routes;\n            actionHandler = shopifyIntegration.actionHandler;\n\n            // Add legacy floating cursor config for Shopify\n            floatingCursorConfig = {\n              enabled: true,\n              appearance: {\n                cursorColor: '#2563eb',\n                cursorSize: 32,\n              },\n              animation: {\n                enableTyping: true,\n                typingSpeed: 50,\n                enableBounce: true,\n              },\n              behavior: {\n                autoHideDelay: 3000,\n                showDuringSearch: true,\n              },\n            };\n\n            console.log(\n              `✅ [VowelWebComponentWrapper] Shopify adapter initialized with ${routes.length} routes (legacy)`\n            );\n          } else {\n            // Vanilla adapter - basic navigation only\n            console.log(\"🌐 [VowelWebComponentWrapper] Using vanilla adapter (legacy)...\");\n            router = createVanillaRouter();\n            routes = [];\n          }\n        }\n\n        // Create Vowel client configuration\n        // appId comes from HTML attribute as string\n        const clientConfig: VowelClientConfig = {\n          appId: appId,\n          // Use new adapters if available, fall back to legacy router\n          ...(navigationAdapter && { navigationAdapter }),\n          ...(automationAdapter && { automationAdapter }),\n          ...(router && { router }),\n          routes,\n          // Pass configuration overrides\n          ...(parsedConfig.instructions && {\n            instructions: parsedConfig.instructions,\n          }),\n          ...(parsedConfig.systemInstructionOverride && {\n            systemInstructionOverride: parsedConfig.systemInstructionOverride,\n          }),\n          ...(parsedConfig.language && {\n            language: parsedConfig.language,\n          }),\n          ...(parsedConfig.initialGreetingPrompt && {\n            initialGreetingPrompt: parsedConfig.initialGreetingPrompt,\n          }),\n          ...(parsedConfig.turnDetectionPreset && {\n            turnDetectionPreset: parsedConfig.turnDetectionPreset,\n          }),\n          ...(parsedConfig.voiceConfig && {\n            voiceConfig: parsedConfig.voiceConfig,\n          }),\n          ...(parsedConfig._voiceConfig && {\n            _voiceConfig: parsedConfig._voiceConfig,\n          }),\n          ...(parsedConfig._caption && {\n            _caption: parsedConfig._caption,\n          }),\n          ...(parsedConfig.borderGlow && {\n            borderGlow: parsedConfig.borderGlow,\n          }),\n          // Add floating cursor config\n          ...((floatingCursorConfig || parsedConfig.floatingCursor) && {\n            floatingCursor: floatingCursorConfig ?? parsedConfig.floatingCursor,\n          }),\n        };\n\n        // Check for vowel-instructions component (wait up to 500ms)\n        let systemInstructions: string | null = null;\n        if (typeof window !== 'undefined' && window.__VOWEL_INSTRUCTIONS__) {\n          console.log('📝 [VowelWebComponentWrapper] Checking for vowel-instructions component...');\n          \n          // Try immediately first\n          systemInstructions = window.__VOWEL_INSTRUCTIONS__.getFirst();\n          \n          // If not found, wait a bit for it to register\n          if (!systemInstructions) {\n            await new Promise(resolve => setTimeout(resolve, 100));\n            systemInstructions = window.__VOWEL_INSTRUCTIONS__.getFirst();\n          }\n          \n          if (systemInstructions) {\n            console.log(`✅ [VowelWebComponentWrapper] Found vowel-instructions: ${systemInstructions.length} characters`);\n            // Override system instructions from component if found\n            parsedConfig.systemInstructionOverride = systemInstructions;\n          } else {\n            console.log('ℹ️ [VowelWebComponentWrapper] No vowel-instructions component found');\n          }\n        }\n        \n        let client: Vowel;\n        \n        // Check if we're in custom initialization mode\n        if (initMode === \"custom\") {\n          console.log('🏭 [VowelWebComponentWrapper] Custom init mode - waiting for factory...');\n          \n          // Import factory registry\n          const { vowelFactoryRegistry } = await import('../web-component/VowelFactoryRegistry');\n          \n          // Use event-based waiting with 30 second timeout\n          // This handles delayed module loading gracefully\n          let factory: any;\n          try {\n            console.log('⏳ [VowelWebComponentWrapper] Waiting for factory registration (timeout: 30s)...');\n            factory = await vowelFactoryRegistry.waitForFactory(30000);\n            console.log('✅ [VowelWebComponentWrapper] Factory registered and ready!');\n          } catch (error) {\n            throw new Error(\n              'init-mode=\"custom\" specified but no factory registered within 30 seconds. ' +\n              'Make sure to call window.registerVowelFactory() in your initialization code. ' +\n              'The factory should be registered before or shortly after the web component loads. ' +\n              'If using ES6 modules, ensure they load before the timeout.'\n            );\n          }\n          \n          // Prepare factory config\n          const factoryConfig = {\n            appId,\n            element: elementRef.current!,\n            position,\n            // Pass any other relevant config\n            preset: effectivePreset,\n            storeUrl,\n          };\n          \n          // Call factory and await result\n          client = await factory(factoryConfig);\n          \n          if (!client) {\n            throw new Error('Factory function must return a Vowel client instance');\n          }\n          \n          console.log('✅ [VowelWebComponentWrapper] Vowel client created via factory');\n        } else {\n          // AUTO mode - create client ourselves\n          console.log(\"🎤 [VowelWebComponentWrapper] Creating Vowel client with config:\", {\n            appId,\n            mode: usePreset ? 'preset' : 'legacy',\n            hasNavigationAdapter: !!navigationAdapter,\n            hasAutomationAdapter: !!automationAdapter,\n            hasRouter: !!router,\n            hasSystemInstructionOverride: !!parsedConfig.systemInstructionOverride,\n            hasInstructions: !!parsedConfig.instructions,\n            hasLegacyVoiceConfig: !!parsedConfig.voiceConfig,\n            hasVoiceConfig: !!parsedConfig._voiceConfig,\n            hasCaptionConfig: !!parsedConfig._caption,\n            hasBorderGlowConfig: !!parsedConfig.borderGlow,\n            floatingCursorEnabled: !!floatingCursorConfig?.enabled,\n          });\n          \n          // Update clientConfig with any discovered instructions\n          const finalClientConfig: VowelClientConfig = {\n            ...clientConfig,\n            ...(parsedConfig.instructions && {\n              instructions: parsedConfig.instructions,\n            }),\n            ...(parsedConfig.systemInstructionOverride && {\n              systemInstructionOverride: parsedConfig.systemInstructionOverride,\n            }),\n          };\n          \n          client = new Vowel(finalClientConfig);\n        }\n\n        // Register platform-specific actions (ONLY in legacy mode)\n        // When using dual adapters (preset mode), skip ShopifyActionHandler registration\n        // because automation adapter provides all DOM actions natively\n        if (actionHandler && !usePreset) {\n          const platformName = effectivePreset === 'shopify' ? 'Shopify' : 'platform';\n          console.log(`🎯 [VowelWebComponentWrapper] Registering ${platformName} actions (legacy mode)...`);\n          const actionDefinitions = actionHandler.getActionDefinitions();\n\n          // Register each action\n          Object.entries(actionDefinitions).forEach(([name, definition]) => {\n            const handler = (actionHandler as any)[name];\n            if (typeof handler === \"function\") {\n              client.registerAction(\n                name,\n                definition as any, // Type assertion for action definitions\n                handler.bind(actionHandler)\n              );\n              console.log(`  ✓ Registered action: ${name}`);\n            }\n          });\n\n          console.log(\n            `✅ [VowelWebComponentWrapper] Registered ${Object.keys(actionDefinitions).length} ${platformName} actions`\n          );\n        } else if (actionHandler && usePreset) {\n          console.log(`🎯 [VowelWebComponentWrapper] Skipping ShopifyActionHandler registration (using dual adapters)`);\n          console.log(`   ℹ️  Automation adapter provides all DOM actions natively`);\n        }\n\n        // Register actions from the registry (programmatically registered)\n        if (instanceIdRef.current) {\n          const registryActions = vowelRegistry.getActions(instanceIdRef.current);\n          \n          if (registryActions.size > 0) {\n            console.log(\n              `🎯 [VowelWebComponentWrapper] Registering ${registryActions.size} programmatic actions...`\n            );\n\n            for (const [name, { definition, handler }] of registryActions) {\n              client.registerAction(name, definition, handler);\n              console.log(`  ✓ Registered programmatic action: ${name}`);\n            }\n          }\n        }\n\n        // Register custom actions from web component props (JSON attributes)\n        if (parsedActions.length > 0) {\n          console.log(\n            `🎯 [VowelWebComponentWrapper] Registering ${parsedActions.length} attribute-based actions...`\n          );\n\n          for (const action of parsedActions) {\n            try {\n              // Get handler function from window object (for backwards compatibility)\n              const handlerFn = (window as any)[action.handler];\n\n              if (typeof handlerFn !== \"function\") {\n                console.error(\n                  `❌ [VowelWebComponentWrapper] Handler function \"${action.handler}\" not found on window object for action \"${action.name}\"`\n                );\n                console.log(\n                  `   💡 Tip: Define handlers globally (window.${action.handler}) or use element.registerAction() instead`\n                );\n                continue;\n              }\n\n              // Register the action with the Vowel client\n              client.registerAction(\n                action.name,\n                action.definition as any,\n                handlerFn\n              );\n\n              console.log(`  ✓ Registered attribute action: ${action.name}`);\n            } catch (error) {\n              console.error(\n                `❌ [VowelWebComponentWrapper] Failed to register action \"${action.name}\":`,\n                error\n              );\n            }\n          }\n\n          console.log(\n            `✅ [VowelWebComponentWrapper] Attribute-based actions registration complete`\n          );\n        }\n\n        // Store client in registry\n        console.log(`🔍 [VowelWebComponentWrapper] Storing client in registry:`, {\n          hasInstanceId: !!instanceIdRef.current,\n          instanceId: instanceIdRef.current,\n          hasClient: !!client\n        });\n        if (instanceIdRef.current) {\n          vowelRegistry.setClient(instanceIdRef.current, client);\n          console.log(`✅ [VowelWebComponentWrapper] Client stored in registry with ID: ${instanceIdRef.current}`);\n          \n          // Verify it was stored\n          const storedClient = vowelRegistry.getClient(instanceIdRef.current);\n          console.log(`🔍 [VowelWebComponentWrapper] Verification - client retrieval:`, {\n            hasStoredClient: !!storedClient,\n            clientMatches: storedClient === client\n          });\n        } else {\n          console.error(`❌ [VowelWebComponentWrapper] Cannot store client: instanceIdRef.current is null!`);\n        }\n\n        setVowelClient(client);\n        \n        timersRef.current.clientReady = performance.now();\n        \n        // Dispatch ready event ONLY if element has been enhanced\n        // This ensures the API methods (getVowelClient, etc.) are available before the event fires\n        if (elementRef.current && isElementEnhanced) {\n          console.log(`🎤 [VowelWebComponentWrapper] Dispatching vowel-ready event (element is enhanced)`);\n          dispatchVowelEvent(elementRef.current, 'ready', { client });\n        } else if (elementRef.current && !isElementEnhanced) {\n          console.warn(`⚠️ [VowelWebComponentWrapper] Delaying vowel-ready event until element is enhanced`);\n          // The ready event will be dispatched by a separate useEffect when isElementEnhanced becomes true\n        } else {\n          console.error(`❌ [VowelWebComponentWrapper] Cannot dispatch ready event: elementRef.current is null`);\n        }\n        \n        const totalInitTime = timersRef.current.clientReady - INIT_START_TIME;\n        const clientInitTime = timersRef.current.clientReady - fullInitStart;\n        \n        console.log(`⏱️ ════════════════════════════════════════════════════════════════`);\n        console.log(`⏱️ [VowelWebComponentWrapper] ✅ INITIALIZATION COMPLETE`);\n        console.log(`⏱️ [VowelWebComponentWrapper] Total time: ${totalInitTime.toFixed(2)}ms`);\n        console.log(`⏱️ [VowelWebComponentWrapper] Client init: ${clientInitTime.toFixed(2)}ms`);\n        console.log(`⏱️ [VowelWebComponentWrapper] Breakdown:`);\n        console.log(`⏱️   - Script parse to mount: ${(timersRef.current.componentMount - INIT_START_TIME).toFixed(2)}ms`);\n        console.log(`⏱️   - Registry setup: ${(timersRef.current.registrySetup - timersRef.current.componentMount).toFixed(2)}ms`);\n        console.log(`⏱️   - Client initialization: ${clientInitTime.toFixed(2)}ms`);\n        console.log(`⏱️ ════════════════════════════════════════════════════════════════`);\n      } catch (err) {\n        console.error(\"❌ [VowelWebComponentWrapper] Initialization failed:\", err);\n        const errorMessage = err instanceof Error ? err.message : \"Failed to initialize Vowel\";\n        setError(errorMessage);\n        \n        // Dispatch error event\n        if (elementRef.current) {\n          dispatchVowelEvent(elementRef.current, 'error', { \n            error: errorMessage,\n            originalError: err \n          });\n        }\n      } finally {\n        setIsInitializing(false);\n      }\n    };\n\n    initializeVowel();\n\n    // Cleanup\n    return () => {\n      if (vowelClient) {\n        console.log(\"🧹 [VowelWebComponentWrapper] Cleaning up...\");\n        vowelClient.stopSession();\n      }\n    };\n  }, [appId, preset, adapter, storeUrl, customActions, config, usePreset, effectivePreset, isElementEnhanced]);\n\n  // Show error state\n  if (error) {\n    return (\n      <div\n        style={{\n          position: \"fixed\",\n          bottom: \"1rem\",\n          right: \"1rem\",\n          background: \"#ef4444\",\n          color: \"white\",\n          padding: \"0.75rem 1rem\",\n          borderRadius: \"0.5rem\",\n          fontSize: \"0.875rem\",\n          maxWidth: \"300px\",\n          zIndex: 9999,\n        }}\n      >\n        <strong>Vowel Error:</strong> {error}\n      </div>\n    );\n  }\n\n  // Show loading state (optional - could be removed for cleaner experience)\n  if (isInitializing || !vowelClient) {\n    return null; // Silent loading\n  }\n\n  // Render VowelAgent wrapped in VowelProvider\n  return (\n    <VowelProvider client={vowelClient}>\n      {/* Only show agent if not in a controlled tab */}\n      {!isControlled && (\n        <VowelAgent\n          position={position}\n          showTranscripts={showTranscripts}\n          buttonColor={buttonColor}\n          // Nag props\n          enableNag={enableNag}\n          nagTitle={nagTitle}\n          nagDescription={nagDescription}\n          nagButtonText={nagButtonText}\n          nagStorageKeyPrefix={nagStorageKeyPrefix}\n          // Terms modal props\n          enableTermsModal={enableTermsModal}\n          termsModalTitle={termsModalTitle}\n          termsModalDescription={termsModalDescription}\n          termsContent={termsContent}\n          termsUrl={termsUrl}\n          privacyContent={privacyContent}\n          privacyUrl={privacyUrl}\n          termsAcceptButtonText={termsAcceptButtonText}\n          termsDeclineButtonText={termsDeclineButtonText}\n          termsAllowDecline={termsAllowDecline}\n          termsStorageKeyPrefix={termsStorageKeyPrefix}\n        />\n      )}\n    </VowelProvider>\n  );\n}\n","/**\n * @fileoverview Vowel Factory Registry - Manages custom Vowel client factory functions\n * \n * This registry allows users to provide a custom factory function that creates\n * and configures a Vowel client instance. This enables advanced use cases like:\n * - Custom provider configuration (vowel-prime, etc.)\n * - Pre-registering actions before the web component initializes\n * - Custom adapter configuration\n * - Full control over Vowel client initialization\n * \n * @module @vowel.to/client/web-component\n * @author vowel.to\n * @license Proprietary\n */\n\nimport type { Vowel } from \"../core/VowelClient\";\n\n/**\n * Configuration passed to the factory function\n */\nexport interface VowelFactoryConfig {\n  /** App ID from the web component attribute */\n  appId: string;\n  /** The web component DOM element */\n  element: HTMLElement;\n  /** Position of the floating button */\n  position?: string;\n  /** Any additional config from web component attributes */\n  [key: string]: any;\n}\n\n/**\n * Factory function that creates and returns a Vowel client instance\n * Can be async to support dynamic imports or API calls\n */\nexport type VowelFactory = (\n  config: VowelFactoryConfig\n) => Promise<Vowel> | Vowel;\n\n/**\n * Registry for storing and retrieving the Vowel client factory function\n */\nclass VowelFactoryRegistry {\n  private factory: VowelFactory | null = null;\n  private eventTarget: EventTarget = new EventTarget();\n\n  /**\n   * Register a factory function\n   * \n   * @param factory - Function that creates and returns a Vowel client\n   * \n   * @example\n   * ```typescript\n   * window.registerVowelFactory(async (config) => {\n   *   const vowel = new window.Vowel({\n   *     appId: config.appId,\n   *     _voiceConfig: {\n   *       provider: 'vowel-prime',\n   *       model: 'openai/gpt-oss-120b',\n   *     },\n   *   });\n   *   \n   *   // Register custom actions\n   *   vowel.registerAction('myAction', { ... }, handler);\n   *   \n   *   return vowel;\n   * });\n   * ```\n   */\n  registerFactory(factory: VowelFactory): void {\n    if (this.factory) {\n      console.warn(\n        \"⚠️ [VowelFactoryRegistry] Factory already registered. Overwriting existing factory.\"\n      );\n    }\n    \n    console.log(\"✅ [VowelFactoryRegistry] Factory registered\");\n    this.factory = factory;\n    \n    // Dispatch event to notify waiting components\n    this.eventTarget.dispatchEvent(new Event('factory-registered'));\n  }\n\n  /**\n   * Get the registered factory function\n   * \n   * @returns The factory function, or null if none registered\n   */\n  getFactory(): VowelFactory | null {\n    return this.factory;\n  }\n\n  /**\n   * Check if a factory has been registered\n   * \n   * @returns true if a factory is registered\n   */\n  hasFactory(): boolean {\n    return this.factory !== null;\n  }\n\n  /**\n   * Wait for factory to be registered\n   * \n   * @param timeoutMs - Maximum time to wait in milliseconds (default: 30000)\n   * @returns Promise that resolves with the factory when registered\n   */\n  async waitForFactory(timeoutMs: number = 30000): Promise<VowelFactory> {\n    // If factory already exists, return immediately\n    if (this.factory) {\n      return this.factory;\n    }\n\n    // Wait for factory registration event or timeout\n    return new Promise((resolve, reject) => {\n      const handleRegistration = () => {\n        if (this.factory) {\n          clearTimeout(timeoutHandle);\n          resolve(this.factory);\n        }\n      };\n\n      const timeoutHandle = setTimeout(() => {\n        this.eventTarget.removeEventListener('factory-registered', handleRegistration);\n        reject(new Error('Factory registration timeout'));\n      }, timeoutMs);\n\n      this.eventTarget.addEventListener('factory-registered', handleRegistration, { once: true });\n    });\n  }\n\n  /**\n   * Clear the registered factory\n   * Useful for testing or resetting state\n   */\n  clearFactory(): void {\n    console.log(\"🧹 [VowelFactoryRegistry] Factory cleared\");\n    this.factory = null;\n  }\n}\n\n/**\n * Global singleton instance of the factory registry\n */\nexport const vowelFactoryRegistry = new VowelFactoryRegistry();\n\n/**\n * Type augmentation for window object\n */\ndeclare global {\n  interface Window {\n    registerVowelFactory: (factory: VowelFactory) => void;\n  }\n}\n\n/**\n * Expose factory registration function globally\n * \n * This allows users to register their factory function before the\n * web component initializes:\n * \n * @example\n * ```html\n * <script>\n *   window.registerVowelFactory(async (config) => {\n *     const vowel = new window.Vowel({ ... });\n *     return vowel;\n *   });\n * </script>\n * \n * <vowel-voice-widget init-mode=\"custom\" app-id=\"...\"></vowel-voice-widget>\n * ```\n */\nif (typeof window !== \"undefined\") {\n  window.registerVowelFactory = (factory: VowelFactory) => {\n    vowelFactoryRegistry.registerFactory(factory);\n  };\n}\n\n\n","/**\n * @fileoverview Vowel Instructions Component - Web component for long-form system instructions\n * \n * This component provides a clean way to define system instructions (system prompts)\n * for the AI without having to use awkward HTML attributes or JavaScript strings.\n * \n * The component registers itself globally and can be discovered by vowel-voice-widget\n * components on the same page.\n * \n * @module @vowel.to/client/components\n * @author vowel.to\n * @license Proprietary\n */\n\nimport { useEffect, useRef } from \"react\";\n\n/**\n * Props for VowelInstructions component\n */\nexport interface VowelInstructionsProps {\n  /** Optional ID for targeting specific widgets */\n  id?: string;\n  /** The instructions content (can also come from children) */\n  content?: string;\n  /** React children (text content) */\n  children?: React.ReactNode;\n}\n\n/**\n * Global registry for vowel-instructions components\n */\nclass VowelInstructionsRegistry {\n  private instances: Map<string, string> = new Map();\n\n  /**\n   * Register an instructions component\n   * \n   * @param id - Unique ID for this instructions component\n   * @param content - The instructions text\n   */\n  register(id: string, content: string): void {\n    console.log(\n      `📝 [VowelInstructions] Registered instructions (${id}): ${content.length} characters`\n    );\n    this.instances.set(id, content);\n  }\n\n  /**\n   * Unregister an instructions component\n   * \n   * @param id - ID of the component to unregister\n   */\n  unregister(id: string): void {\n    console.log(`🧹 [VowelInstructions] Unregistered instructions (${id})`);\n    this.instances.delete(id);\n  }\n\n  /**\n   * Get instructions by ID\n   * \n   * @param id - ID of the instructions to retrieve\n   * @returns The instructions text, or null if not found\n   */\n  get(id: string): string | null {\n    return this.instances.get(id) || null;\n  }\n\n  /**\n   * Get the first registered instructions\n   * Useful when there's only one instructions component on the page\n   * \n   * @returns The first instructions text, or null if none registered\n   */\n  getFirst(): string | null {\n    const first = this.instances.values().next();\n    return first.done ? null : first.value;\n  }\n\n  /**\n   * Check if any instructions are registered\n   * \n   * @returns true if at least one instructions component is registered\n   */\n  hasInstructions(): boolean {\n    return this.instances.size > 0;\n  }\n\n  /**\n   * Get all registered instructions\n   * \n   * @returns Map of ID to instructions text\n   */\n  getAll(): Map<string, string> {\n    return new Map(this.instances);\n  }\n}\n\n/**\n * Global singleton instance\n */\nexport const vowelInstructionsRegistry = new VowelInstructionsRegistry();\n\n/**\n * Expose registry globally for web components to discover\n */\ndeclare global {\n  interface Window {\n    __VOWEL_INSTRUCTIONS__?: VowelInstructionsRegistry;\n  }\n}\n\nif (typeof window !== \"undefined\") {\n  window.__VOWEL_INSTRUCTIONS__ = vowelInstructionsRegistry;\n}\n\n/**\n * VowelInstructions Component\n * \n * A component that holds long-form system instructions for the AI.\n * Automatically registers itself when mounted and unregisters when unmounted.\n * \n * @example\n * ```html\n * <vowel-instructions>\n *   You are an AI assistant for an e-commerce site.\n *   \n *   Your role is to help users find products and complete purchases.\n *   \n *   Guidelines:\n *   - Be friendly and helpful\n *   - Ask clarifying questions when needed\n *   - Provide product recommendations\n * </vowel-instructions>\n * \n * <vowel-voice-widget \n *   app-id=\"your-app-id\"\n *   init-mode=\"auto\">\n * </vowel-voice-widget>\n * ```\n */\nexport function VowelInstructions({\n  id,\n  content,\n  children,\n}: VowelInstructionsProps) {\n  const elementRef = useRef<HTMLDivElement>(null);\n  const instanceId = useRef(\n    id || `vowel-instructions-${Date.now()}-${Math.random().toString(36).slice(2)}`\n  );\n\n  useEffect(() => {\n    const readContent = () => {\n      // Priority 1: Use content prop if provided\n      if (content) {\n        const trimmed = content.trim();\n        if (trimmed) {\n          console.log(`📝 [VowelInstructions] Registering instructions from 'content' prop (${instanceId.current}): ${trimmed.length} characters`);\n          vowelInstructionsRegistry.register(instanceId.current, trimmed);\n          return true;\n        }\n      }\n\n      // Priority 2: Try to find the host <vowel-instructions> element\n      // r2wc renders React inside the custom element, so we need to traverse up\n      if (elementRef.current) {\n        // Find the vowel-instructions host element\n        let hostElement: HTMLElement | null = elementRef.current;\n        while (hostElement && hostElement.tagName !== 'VOWEL-INSTRUCTIONS') {\n          hostElement = hostElement.parentElement;\n        }\n\n        if (hostElement) {\n          // Read text content from the host element (light DOM)\n          const textContent = hostElement.textContent || \"\";\n          const trimmed = textContent.trim();\n          \n          if (trimmed) {\n            console.log(`📝 [VowelInstructions] Registering instructions from DOM content (${instanceId.current}): ${trimmed.length} characters`);\n            vowelInstructionsRegistry.register(instanceId.current, trimmed);\n            return true;\n          }\n        }\n      }\n\n      // Priority 3: Try children prop\n      if (children) {\n        let instructionsText = \"\";\n        if (typeof children === \"string\") {\n          instructionsText = children;\n        } else if (Array.isArray(children)) {\n          instructionsText = children\n            .map((child) => (typeof child === \"string\" ? child : \"\"))\n            .join(\"\");\n        }\n\n        const trimmed = instructionsText.trim();\n        if (trimmed) {\n          console.log(`📝 [VowelInstructions] Registering instructions from children prop (${instanceId.current}): ${trimmed.length} characters`);\n          vowelInstructionsRegistry.register(instanceId.current, trimmed);\n          return true;\n        }\n      }\n\n      return false;\n    };\n\n    // Try reading content immediately\n    const success = readContent();\n\n    if (!success) {\n      // If failed, try again after a short delay\n      const timeoutId = setTimeout(() => {\n        const retrySuccess = readContent();\n        if (!retrySuccess) {\n          console.warn(\n            `⚠️ [VowelInstructions] No instructions content found after retry (${instanceId.current})`\n          );\n        }\n      }, 100);\n\n      // Cleanup timeout on unmount\n      return () => {\n        clearTimeout(timeoutId);\n        vowelInstructionsRegistry.unregister(instanceId.current);\n      };\n    }\n\n    // Cleanup on unmount\n    return () => {\n      vowelInstructionsRegistry.unregister(instanceId.current);\n    };\n  }, [content, children]);\n\n  // Render hidden div to capture children text content\n  // This component is not meant to be visible in the UI\n  return (\n    <div\n      ref={elementRef}\n      data-vowel-instructions-id={instanceId.current}\n      style={{ display: \"none\" }}\n      aria-hidden=\"true\"\n    >\n      {children}\n    </div>\n  );\n}\n\n/**\n * Default export for web component conversion\n */\nexport default VowelInstructions;\n\n","/**\n * Web Component Entry Point\n * Converts React VowelAgent to a framework-agnostic web component using r2wc\n * \n * @module @vowel.to/client/web-component\n * \n * @example\n * ```html\n * <!-- Load the web component script -->\n * <script src=\"https://cdn.vowel.to/vowel-voice-widget.min.js\"></script>\n * \n * <!-- Vanilla usage (REQUIRED: app-id attribute) -->\n * <vowel-voice-widget \n *   app-id=\"your-app-id\"\n *   position=\"bottom-right\">\n * </vowel-voice-widget>\n * \n * <!-- Controlled Tab preset for traditional websites (WordPress, Laravel, Shopify stores, etc.) -->\n * <vowel-voice-widget\n *   app-id=\"your-app-id\"\n *   preset=\"controlled\"\n *   position=\"bottom-right\">\n * </vowel-voice-widget>\n *\n * <!-- With custom actions and configuration override -->\n * <script>\n *   // Define custom action handlers globally\n *   window.handleAddToCart = async function(params) {\n *     console.log('Adding to cart:', params);\n *     // Your custom logic here\n *   };\n * </script>\n * <vowel-voice-widget\n *   app-id=\"your-app-id\"\n *   custom-actions='[{\"name\":\"addToCart\",\"definition\":{\"description\":\"Add item to cart\",\"parameters\":{\"productId\":{\"type\":\"string\",\"description\":\"Product ID\"}}},\"handler\":\"handleAddToCart\"}]'\n *   config='{\"systemInstructionOverride\":\"You are a helpful shopping assistant.\",\"voiceConfig\":{\"voice\":\"Puck\"}}'>\n * </vowel-voice-widget>\n * ```\n * \n * @remarks\n * The app-id attribute is REQUIRED and must be obtained from your Vowel platform account.\n * It identifies your application and connects to the correct voice agent configuration.\n * \n * Custom actions require handler functions to be defined globally on the window object.\n * The config attribute accepts a JSON object with systemInstructionOverride and voiceConfig.\n */\n\n// Import styles (will be auto-injected via JavaScript, also available as separate CSS file)\nimport './lib/vowel/styles/styles.css';\n\nimport { VowelWebComponentWrapper } from \"./lib/vowel/components/VowelWebComponentWrapper\";\n\nlet VowelVoiceWidget: CustomElementConstructor | undefined;\n\nasync function createVowelVoiceWidget(): Promise<CustomElementConstructor | undefined> {\n  if (typeof HTMLElement === \"undefined\") {\n    return undefined;\n  }\n\n  if (!VowelVoiceWidget) {\n    const { default: r2wc } = await import(\"@r2wc/react-to-web-component\");\n    VowelVoiceWidget = r2wc(VowelWebComponentWrapper, {\n      props: {\n        appId: \"string\",\n        initMode: \"string\",\n        preset: \"string\",\n        adapter: \"string\",\n        position: \"string\",\n        storeUrl: \"string\",\n        showTranscripts: \"boolean\",\n        buttonColor: \"string\",\n        customActions: \"string\",\n        config: \"string\",\n      },\n    });\n  }\n  return VowelVoiceWidget;\n}\n\nexport function registerVowelWebComponent() {\n  if (typeof window === \"undefined\" || typeof customElements === \"undefined\") {\n    console.warn(\n      \"⚠️ [VowelWebComponent] Window or customElements not available\"\n    );\n    return;\n  }\n\n  createVowelVoiceWidget().then((wc) => {\n    if (!wc) {\n      console.warn(\"⚠️ [VowelWebComponent] HTMLElement not available\");\n      return;\n    }\n\n    if (!customElements.get(\"vowel-voice-widget\")) {\n      console.log(\"🎤 [VowelWebComponent] Registering custom element...\");\n      customElements.define(\"vowel-voice-widget\", wc);\n      console.log(\"✅ [VowelWebComponent] Custom element registered\");\n    }\n  });\n}\n\nif (typeof window !== \"undefined\") {\n  registerVowelWebComponent();\n}\n\n// Export registry and API for programmatic access\nexport { vowelRegistry } from \"./lib/vowel/web-component/VowelWebComponentRegistry\";\nexport {\n  enhanceVowelElement,\n  dispatchVowelEvent,\n  waitForVowelReady,\n} from \"./lib/vowel/web-component/VowelWebComponentAPI\";\n\n// Export factory registry for custom initialization\nexport { \n  vowelFactoryRegistry,\n} from \"./lib/vowel/web-component/VowelFactoryRegistry\";\n\n// Export instructions registry\nexport {\n  vowelInstructionsRegistry,\n} from \"./lib/vowel/components/VowelInstructions\";\n\n// Export types\nexport type {\n  VowelVoiceWidgetElement,\n  VowelAction,\n  ActionHandler,\n} from \"./lib/vowel/web-component/VowelWebComponentAPI\";\n\nexport type {\n  VowelFactory,\n  VowelFactoryConfig,\n} from \"./lib/vowel/web-component/VowelFactoryRegistry\";\n"],"names":["useState","useRef","useEffect","hostElement","useMemo","initializeAutomationListener","preset","error","initializeShopifyIntegration","Vowel","jsxs","jsx","VowelProvider","VowelAgent"],"mappings":";;;;;;;;;;;AA+CA,MAAM,yBAAA,CAA0B;AAAA,EACtB,SAAA,uBAA4C,GAAA,EAAI;AAAA,EAChD,mBAAA,uBAAwD,OAAA,EAAQ;AAAA;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