Cognigy.AI - Cognigy Documentation

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

Skip to main content

​ Cognigy.AI

​ 4.29.0

Released July 7, 2022

​ Improvements

​ Bug Fixes

​ 4.28.1

Released June 29, 2022

​ Bug Fixes

​ 4.28.0

Released June 23, 2022

​ Improvements

​ Bug Fixes

​ 4.27.0

Released June 7, 2022

​ Features

This release of Cognigy.AI adds a new user interface for inspecting Playbook Runs. This allows our customers to see the status of Playbooks they ran server side. Take a look at our product documentation for more information.

​ Improvements

​ Bug Fixes

​ 4.26.1

Released May 31, 2022

​ Bug Fixes

​ 4.26.0

Released May 24, 2022

​ Features

​ Create Flows from child-branches in Flows

This release of Cognigy.AI adds the ability to create entirely new Flows from child-branches of already existing Flows. This new functionality helps to reduce the overall size of big Flows into more manageable smaller fragments

​ Improvements

​ Bug Fixes

​ 4.25.0

Released May 10, 2022

​ Improvements

​ Bug Fixes

​ 4.24.1

Released May 5, 2022

​ Bug Fixes

​ 4.24.0

Released May 2, 2022

​ Features

​ Server side Playbook execution

This release of Cognigy.AI adds the ability to execute Playbooks server side. We have added new RESTful API endpoints allowing our customers to start Playbook runs and inspect their results

​ Jump to Flow Node capabilities

This release of Cognigy.AI adds the ability to inspect individual outputs within the Interaction Panel and understand which Flow Node has created a specific output. Our customers can jump to the respective Flow and Flow Node in order to further understand where an output is coming from

​ Improvements

​ Bug Fixes

​ 4.23.3

Released April 20, 2022

​ Bug Fixes

​ 4.23.2

Released April 14, 2022

​ Bug Fixes

​ 4.23.1

Released April 13, 2022

​ Bug Fixes

​ 4.23.0

Released April 12, 2022

​ Features

​ New Agent templates

This release of Cognigy.AI contains new templates for our Agent creation wizard. We have introduced a variety of new templates in order to support our customers with getting started quicker

​ Improvements

​ Bug Fixes

​ 4.22.2

Released March 31, 2022

​ Bug Fixes

​ 4.22.1

Released March 30, 2022

​ Bug Fixes

​ 4.22.0

Released March 28, 2022

​ Features

This release of Cognigy.AI gives customers the ability to override the Connections of a Snapshot with those of the Agent via an Endpoint setting

​ Improvements

​ Bug Fixes

​ 4.21.2

Released March 22, 2022

​ Bug Fixes

​ 4.21.1

Released March 22, 2022

​ Bug Fixes

​ 4.21.0

Released March 22, 2022

​ Improvements

​ Bug Fixes

​ 4.20.1

Released March 9, 2022

​ Bug Fixes

​ 4.20.0

Released March 9, 2022

​ Features

​ Merging Cognigy Packages

This release of Cognigy.AI adds the ability to merge Flow from Packages with the Flows already existing in your Agent. The functionality can also be used through our RESTful API.

​ Additional Filter for Cognigy Insights Transcript Explorer

This release of Cognigy.AI adds an additional “Flow Filter” to the Transcript Explorer in Cognigy Insights.

​ Additional Filter for Cognigy Insights Message Explorer

This release of Cognigy.AI adds an additional “Flow Filter” to the Message Explorer in Cognigy Insights.

​ Improvements

​ Bug Fixes

​ 4.19.1

Released February 25, 2022

​ Bug Fixes

​ 4.19.0

Released February 25, 2022

​ Features

​ Last activity tracking

This release of Cognigy.AI adds the functionality to track the last activity of users in the Cognigy.AI user interface. The data will be displayed to administrators of the platform in the access control tool

​ Improvements

​ Bug Fixes

​ 4.18.2

Released February 10, 2022

​ Bug Fixes

​ 4.18.1

Released February 10, 2022

​ Bug Fixes

​ 4.18.0

Released February 10, 2022

​ Improvements

​ Bug Fixes

​ 4.17.2

Released January 31, 2022

​ Bug Fixes

​ 4.17.1

Released January 20, 2022

​ Bug Fixes

​ 4.17.0

Released January 17, 2022

​ Features

​ New Handover to Agent Node

The new “Handover to Agent” Node allows users to configure different AI Agent behaviors depending on whether a Handover has been finished, a Handover has been canceled, or an error has occurred. The new Node replaces the existing “Handover” node, although the latter will continue to work.

​ Intent handling in Lookup Nodes

This release allows users to set the Intent hierarchy level in Lookup Nodes of type Intent. Only Intents of the selected hierarchy level are looked up. The current behavior that Intents are matched on the most detailed level remains the default behavior.

​ Improvements

​ Bug Fixes

​ 4.16.1

Released January 6, 2022

​ Bug Fixes

​ 4.16.0

Released January 6, 2022

​ Features

​ Flow Node Search

This release adds the ability to search through Flows in the Flow Editor. Customers can already search through a couple of properties within their nodes - more properties will be added in the future

​ Users in multiple Organizations

This release of Cognigy.AI allows users to be part of multiple Organizations. Users can specify an organisationId as part of their sign-in process which allows them to pick the Organization for which they want to perform a sign-in

​ Salesforce Service Cloud - Handover Provider

This release of Cognigy.AI adds Salesforce Service Cloud as a new Handover provider

​ Train on Default Replies

This release of Cognigy.AI adds the ability to include the data of Default Replies in Intents into the training of Intent models. This change can improve the accuracy of your Intent models

​ Match Pattern- & Fuzze-Search Flow Nodes

This release of Cognigy.AI adds two new Flow Nodes into Cognigy Flows. One lets you match specific patterns within the input utterances of users, the other one allows you to conduct a search against an array of strings and return the one with the highest likelihood

​ Improvements

​ Bug Fixes

​ 4.15.3

Released December 8, 2021

​ Bug Fixes

​ 4.15.2

Released November 26, 2021

​ Bug Fixes

​ 4.15.1

Released November 18, 2021

​ Bug Fixes

​ 4.15.0

Released November 18, 2021

​ Features

​ Cognigy Insights: Show data for all Snapshots

This release adds a branch new filter option for Snapshots - customers will now be able to select “All” Snapshots in the global filters.

​ Cognigy Insights: Expert mode for Transcript Explorer

This release adds a so-called Expert Mode to the Transcript Explorer in Cognigy Insights. Similar to the Expert Mode in Cognigy.AI Interaction Panel, this mode shows additional information such as detected Slots and the classified Intent in addition to the actual transcript of conversations.

​ Improvements

​ Bug Fixes

​ 4.14.1

Released November 9, 2021

​ Bug Fixes

​ 4.14.0

Released November 5, 2021

​ Features

​ Timezones for Cognigy Insights

This release of Cognigy.AI introduces timezones for Cognigy Insights. Customers will be able to select their timezone in their user profile which will be used when generating reports and data.

​ Async output handling for Voice Gateway

This release of Cognigy.AI introduces asynchronous output handling for Cognigy Voice Gateway. Previously, outputs from Cognigy Flows would get buffered and send to Cognigy Voice Gateway once your Flows have been processed entirely. It was not possible to use concepts like “Sleep Nodes” or our inject- and notify-APIs. Customers can now activate asynchronous output handling in the Cognigy Voice Gateway Endpoint configuration form.

​ Improvements

​ Bug Fixes

​ 4.13.1

Released: October 28, 2021

​ Improvements

​ 4.13.0

Released: October 28, 2021

​ Features

​ Avaya CPaaS

This release of Cognigy.AI contains the new Avaya CPaaS endpoint which is an essential rewrite of the currently existing one. We have added many new capabilities and e.g. made TTS/STT language configurable.

​ Amazon Lex NLU Connector

This release of Cognigy.AI adds a new NLU Connector for Amazon Lex.

​ Improvements

​ Bug Fixes

​ 4.12.0

Released: October 11, 2021

​ Features

​ Localization for Extensions

Added option to allow extension creators to provide localized display values in Node descriptor

​ Management-UI authentication

Added support for multiple credential pairs for the Cognigy Management UI

​ Non-conversational Endpoint

This release of Cognigy.AI adds a non-conversational Endpoint. The feature needs to be enabled using an additional environment variable. It allows customers to create an Endpoint that will not process inputs using NLU engines. The Endpoint can e.g. be used if Cognigy.AI is being used as a process orchestration tool

​ Improvements

​ Bug Fixes

​ 4.11.0

Released: September 20, 2021

​ Features

​ Custom theme for Cognigy Insights

Added the ability to apply a custom theme as well as white labeling to the Cognigy Insights user interface

​ Custom configuration for WebchatWidget

Added a JSON field to Webchat Endpoint Editor to configure additional settings not available in the GUI

​ Improvements

​ Bug Fixes

​ 4.10.1

Released: September 15, 2021This release activates “Cognigy Insights” by default - Cognigy.AI 4.10.0 did not do that. An opt-out is available for customers that do not want to use Cognigy Insights right now. This opt-out will be removed with one of the next releases.

​ 4.10.0

Released: September 14, 2021

​ Features

​ Cognigy Insights

This release of Cognigy.AI makes Cognigy Insights the default tool for inbuilt analytics. Insights is a totally new way to explore usage information about our AI Agents. Take a look at our product website for Insights: https://www.cognigy.com/products/overview

​ Machine translation for enhanced agent building

This release of Cognigy.AI allows you to select an external translation provider in the settings menu.

​ Cognigy Marketplace

This release of Cognigy.AI contains the ability to configure a marketplace from which additional Cognigy Extensions can be installed on the Extensions page

​ Improvements

​ Bug Fixes

​ 4.9.1

Released: August 27, 2021

​ Bug Fixes

​ 4.9.0

Released: August 24, 2021

​ Features

​ Extension performance

This release uplifts the Extension execution performance massively. We have implemented a new caching concept that will cache Extensions in the local container file system. Extensions will be preferably loaded from this local cache instead of the remote storage location

​ Webchat embed code

This release of Cognigy.AI adds an embed code for our WebchatWidget onto the Endpoint configuration page for Webchats

​ Jump to Flow functionality

This release of Cognigy.AI adds a “Jump to Flow” button in our Endpoint editor. This allows users to quickly access Flows their Endpoints point to

​ Dynamic Fields in Flow Nodes

This release of Cognigy.AI adds new functionality that allows our customers to use a new dynamic select field as a new field type in their Extensions. The feature can be used to dynamically fetch the content of a select field through e.g. an external API call

​ Improvements

​ Bug Fixes

​ 4.8.1

Released: August 9, 2021

​ Bug Fixes

​ 4.8.0

Released: August 5, 2021

​ Features

​ Intent Trainer filters

This release of Cognigy.AI adds a set of filters to our Intent Trainer to simplify the workflow of reviewing records

​ Descriptive API-Keys

More customers than ever are using our API-key feature in the product to automate certain aspects of their day-to-day developer life. In order to make it easier to distinguish different API keys, we have added the ability to name your API-keys

​ Hotkey for expert mode

Developers can use the so-called expert mode in the Interaction Panel to get more verbose output about certain events (e.g. when an Intent has been found) when talking to their Agents. This release adds the ability to use ++ctrl+shift+f++ to toggle the expert mode without visiting the settings panel

​ Embeddable extensions

This release of Cognigy.AI adds the ability for on-premises customers to embed certain extensions into the baseline of Cognigy.AI

​ Improvements

​ Bug Fixes

​ 4.7.1

Released: July 26, 2021

​ Bug Fixes

​ 4.7.0

Released: July 22, 2021

​ Features

​ Hiding Endpoints

This release adds the possibility to hide integrated Endpoints (channel types) by defining an additional blacklist of technical Endpoint names. This can be used by our on-premises customers to hide certain Endpoints they don’t want to offer to their customers.

​ Alternative Playbook creation

This release adds the ability to create playbooks from the transcript stored in Contact Profiles.

​ Dependencies in Packages

This release adds automatic dependency recognition when you select the resources you want to include in a Package. For all the resources you selected to Export, we will show all the dependencies and allow you to choose which dependencies you still want in the Package

​ Improvements

​ Bug Fixes

​ 4.6.0

Released: July 7, 2021

​ Features

​ Platform performance

Changed caching of core object used while processing user inputs - this leads to a huge performance improvement of the platform.

​ Improvements

​ Bug Fixes

​ 4.5.1

Released: July 1, 2021

​ Bug Fixes

​ 4.5.0

Released: June 29, 2021

​ Features

​ Cognigy Packages

With Cognigy packages, we have introduced the ability to export/import individual resources in order to move them between AI Agents. With this release, we have added the ability for you to select multiple resources when exporting a package. We have also added the ability to resolve conflicts and pick resolution strategies when importing those packages once again.

​ Improvements

​ Bug Fixes

​ 4.4.0

Released: June 10, 2021

​ Features

​ Intent Trainer refresh

We have invested quite some time in refreshing the Cognigy.AI Intent Trainer in order to improve the UX and simplify handling review tasks for our customers. More specifically, we have added the following new features:

​ New Twilio Voices

We have added new Twilio Voice options to our Twilio Endpoint(s).

​ Configurable CORS for Cognigy.AI endpoint

We have added the ability to configure CORS origins for the Cognigy.AI endpoint microservice. This allows our customers to additionally protect their endpoints by only allowing certain browser clients to connect. The default behavior of allowing all origins (’*’) has not been changed.

​ Question escalation to handover

We have now added the ability to escalate questions by creating handovers to real human agents.

​ Improvements

​ Bug Fixes

​ 4.3.1

Released: May 31, 2021

​ Bug Fixes

​ 4.3.0

Released: May 18, 2021

​ Features

​ Packages

Packages allow our customers to export individual resources like Flows or Lexicons in order to share those assets with other teams. Packages automatically contain their direct dependencies and can be shared as a portable zip archive once downloaded. Customers can also upload packages and get merge resolution steps displayed.

​ Chatwoot integration

Cognigy has integrated “Chatwoot” as an additional handover provider that can be used by our customers to connect their users with real agents. Chatwoot is an open-source solution and free to use.

​ Cognigy Functions

Cognigy Functions are a big leap forward when it comes to running asynchronous code in the background. Functions allow you to schedule long-running code (e.g. 10 minutes!) in the background. Functions can be triggered and started via our RESTful API or from within your Flows. Your code in Functions will be executed in a save containment and can inject results back into your user’s conversational sessions. Check the Cognigy documentation for more info on Functions.

​ OpenID Connect

Cognigy.AI already supports SSO (Single Sign-On) through the usage of our SAML 2.0 integration. With this release, we have now added support for OpenID Connect. Customers can now select which type of strategy they want to use in order to implement their corporate SSO strategy.

​ Email notification Node

Customers can now use a “much simpler to configure” way to send email notifications. The new Flow Node will use the system-wide configured SMTP server for outgoing emails. The content of emails sent using this Node will be embedded into a template indicating the origin of the email. The template can be customized by or OEM customers.

​ Warnings for NLU issues

The product will now show warning notifications when the system detects issues in Intent-rules, Intent-Conditions as well as generic issues while executing NLU on user inputs. Warnings will only be generated and forwarded to our user interface when the Interaction Panel is used during testing.

​ Copy Agent ID

We have added the ability to copy the Agent ID to the context menu on the Index Dashboard in which you can select one of your Agents.

​ Improvements

​ Bug Fixes

​ 4.2.5

Released: May 7, 2021

​ Bug Fixes

​ 4.2.4

Released: May 7, 2021

​ Bug Fixes

​ 4.2.3

Released: May 5, 2021

​ Bug Fixes

​ 4.2.2

Released: April 29, 2021

​ Bug Fixes

​ 4.2.1

Released: April 20, 2021

​ Bug Fixes

​ 4.2.0

Released: April 14, 2021

​ Features

​ Email Node improvements

We have added the ability to select well-known SMTP providers in our “send email” Flow-Node. This helps our customers to configure their target SMTP servers more easily when using one of these well-known services for sending emails. We have also added new functionality in the form of attachments as well as the ability to put contacts on CC.

​ Think Node enhancements

We have added the ability to “think” Intents within our Think Flow-Node. This option will exist next to the already existent “text” option. It helps developers to more easily trigger an Intent directly.

​ Analytics Steps for nodes and Intents

One of our larger missions for 2021 is various analytics enhancements. Adding analytics steps is one of the first building blocks on this journey. It allows our customers to define analytics labels for nodes and Intents. All of our Question-Nodes will automatically get those analytics labels assigned. The labels can be used to understand when customers drop off within a conversation. We have also enhanced our OData interface to expose those data points.

​ Contact Profile Explorer enhancements

We have added the ability to filter inactive Contact Profiles in the Contact Profile Explorer. This will help our customers to more easily search through their Contact Profiles while focusing only on the active ones.

​ Improvements

​ Bug Fixes

​ 4.1.6

Released: March 31, 2021

​ Improvements

​ Bug Fixes

​ 4.1.5

Released: March 22, 2021

​ Improvements

​ Bug Fixes

​ 4.1.4

Released: March 8, 2021

​ Improvements

​ Bug Fixes

​ 4.1.3

Released: February 18, 2021

​ Improvements

​ Bug Fixes

​ 4.1.2

Released: February 8, 2021

​ Improvements

​ Bug Fixes

​ 4.1.1

Released: January 22, 2021

​ Improvements

​ Bug Fixes

​ 4.1.0

Released: December 23, 2020

​ Features

​ Cognigy Live Agent (lite)

Cognigy Live Agent (lite) is here! The Cognigy Live Agent replaces the old Cognigy Livechat in Cognigy.AI version 4. Live Agent comes as a more de-coupled product and will be extended in the future.

​ Quick NLU training

We have introduced a quicker way for you to train your Intents. If users do not use states and conditions in their Intents, they can now use the new quick training method in order to train their Intents way faster. Users can still decide whether they want to go with the slower training approach which will take states and conditions into consideration.

​ Indian languages

These release of Cognigy.AI introduces support for the following new languages:

We are always happy to extend the capabilities of our product and would love to get feedback on the quality of the language support for these new languages.

​ WebchatWidget WCAG 2.0 Level A Compliance

We added full support for WCAG 2.0 Level A Compliance to our WebchatWidget. Release 2.24.0 of our WebchatWidget offers accessibility features we did not support, yet. We have also added the ability to specify the necessary alternative text for all sorts of rich-media elements our users can compose in the ‘default’ and ‘webchat’ Channels within our Say-Node editor.Take a look at our release-page on GitHub: https://github.com/Cognigy/WebchatWidget/releases/tag/v2.24.0

​ Additional Question Node Features

We have extended our Question-Nodes to make them more powerful. Cognigy.AI 4.1.0 adds features like extra validation, optional re-prompt validation, a configurable forget threshold as well as a new type of question for data inputs. We have also added the ability to specify an optional result location for the result of your questions.

​ Improvements

​ Bug Fixes

​ 4.0.3

Released: December 1, 2020

​ Improvements

​ Bug Fixes

​ 4.0.2

Released: November 12, 2020

​ Improvements

​ Bug Fixes

​ 4.0.1

Released: October 22, 2020

​ Improvements

​ Bug Fixes

​ 4.0.0

Released: October 2, 2020This is our latest major release. We changed a lot, fixed a lot of issues, and added many new features that make Cognigy.AI the most advanced conversational AI platform on the market. Feel free to explore our new documentation and sign up for your free product trial: https://signup.cognigy.ai/

​ Features

​ Bug Fixes

​ Documentation

Last modified onApril 21, 2026

Previous Cognigy Insights\ \ Next

Ctrl+I

ChatVoice

Click the call button to start talking.

Cognigy AssistantReady to talk

Connecting…

Powered by Cognigy.AI

Cookie Consent

We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for.

With your consent, you're helping us make our documentation better. To find out more about the cookies we use, see our Privacy Policy.

Accept

'; cachedClickBlockingCode = css + js; return cachedClickBlockingCode; }

// Helper: Inject click-blocking code into iframe function injectClickBlocking(iframeDoc) { if (!iframeDoc || !iframeDoc.head) return false;

try { const style = iframeDoc.createElement('style'); style.textContent = 'a,button,input,select,textarea,[onclick],[role="button"],input[type="button"],input[type="submit"],[href],[tabindex]:not([tabindex="-1"]){pointer-events:none!important;cursor:default!important}a:hover,button:hover{cursor:default!important;opacity:0.7!important}'; iframeDoc.head.appendChild(style);

const script = iframeDoc.createElement('script'); script.textContent = '(function(){var preventClick=function(e){e.preventDefault();e.stopPropagation();e.stopImmediatePropagation();return false;};document.addEventListener("click",preventClick,true);document.addEventListener("mousedown",preventClick,true);document.addEventListener("mouseup",preventClick,true);document.addEventListener("touchstart",preventClick,true);document.addEventListener("touchend",preventClick,true);document.addEventListener("contextmenu",preventClick,true);window.addEventListener("beforeunload",function(e){e.preventDefault();e.returnValue="";return "";},true);try{Object.defineProperty(window,"location",{value:{href:"#",replace:function(){},assign:function(){}},writable:false,configurable:false});}catch(e){}var originalPushState=history.pushState;history.pushState=function(){return false;};var originalReplaceState=history.replaceState;history.replaceState=function(){return false;};var originalOpen=window.open;window.open=function(){return null;};var allElements=document.querySelectorAll("*");for(var i=0;i 0 || replacedViewers.length > 0) { const currentUrl = window.location.href; if (!processedUrls.has(currentUrl)) { processedUrls.add(currentUrl); lastUrl = currentUrl; } return; }

const currentUrl = window.location.href; if (currentUrl === lastUrl && lastUrl !== null && processedUrls.has(currentUrl)) { return; }

// Optimized: Use cached viewer query const viewers = getUninitializedViewers();

if (viewers.length === 0) { if (periodicCheckInterval) { clearInterval(periodicCheckInterval); periodicCheckInterval = null; } return; }

// Final safety check if (viewers.length > 0) { if (currentUrl === lastUrl && lastUrl !== null && processedUrls.has(currentUrl)) { viewers.forEach(function(viewer) { viewer.setAttribute('data-initialized', 'true'); }); return; }

if (currentUrl === lastUrl && lastUrl !== null) { if (existingContainers.length > 0) { processedUrls.add(currentUrl); viewers.forEach(function(viewer) { viewer.setAttribute('data-initialized', 'true'); }); return; } } }

isInitializing = true; let processedAny = false;

// Optimized: Process viewers in batch viewers.forEach(function(viewer) { if (processedElements.has(viewer) || viewer.hasAttribute('data-initialized')) { return; }

if (viewer.closest('.single-page-viewer-container')) { return; }

if (!viewer.parentNode) { return; }

const isInContentArea = contentArea === document.body || contentArea.contains(viewer); if (!isInContentArea) { return; }

const src = viewer.getAttribute('data-src'); const hint = viewer.getAttribute('data-hint') || ''; const defaultZoom = parseFloat(viewer.getAttribute('data-zoom')) || DEFAULT_ZOOM; const dataHeight = viewer.getAttribute('data-height'); const height = dataHeight ? parseFloat(dataHeight) : null;

if (!src) { // Don't set isInitializing = false here - it affects all viewers in the loop return; }

processedElements.add(viewer); viewer.setAttribute('data-initialized', 'true');

let zoom = defaultZoom;

// Optimized: Use document fragment for DOM construction const fragment = document.createDocumentFragment(); const container = document.createElement('div'); container.className = 'single-page-viewer-container';

const wrapper = document.createElement('div'); wrapper.className = 'single-page-viewer-wrapper';

const controlsBar = document.createElement('div'); controlsBar.className = 'single-page-viewer-controls';

if (hint) { const hintDiv = document.createElement('div'); hintDiv.className = 'single-page-viewer-hint'; hintDiv.innerHTML = '' + hint + ''; controlsBar.appendChild(hintDiv); }

const iframeWrapper = document.createElement('div'); iframeWrapper.className = 'single-page-viewer-iframe-wrapper'; iframeWrapper._scrollHandlerAdded = false;

// Optimized: Get height without temporary DOM manipulation const baseHeightFromCSS = height || NORMAL_HEIGHT;

const scaleDiv = document.createElement('div'); scaleDiv.className = 'single-page-viewer-scale'; const initialHeight = baseHeightFromCSS; scaleDiv.style.cssText = 'transform: scale(' + zoom + '); transform-origin: top left; width: ' + (100 / zoom) + '%; height: ' + initialHeight + 'px; transition: transform 0.2s ease;';

const iframe = document.createElement('iframe'); let iframeSrc = src; if (iframeSrc && !iframeSrc.startsWith('http') && !iframeSrc.startsWith('//')) { if (!iframeSrc.startsWith('/')) { iframeSrc = '/' + iframeSrc; } }

iframe.title = 'Single Page Viewer'; iframe.className = 'single-page-viewer-iframe'; iframe.style.width = '100%'; iframe.style.height = initialHeight + 'px'; iframe.loading = 'lazy'; iframe.setAttribute('scrolling', 'no'); iframe.setAttribute('sandbox', 'allow-same-origin allow-scripts allow-forms allow-popups allow-modals');

const clickBlocker = document.createElement('div'); clickBlocker.className = 'single-page-viewer-click-blocker';

if (iframeSrc.endsWith('.html') && !iframeSrc.startsWith('http')) { fetch(iframeSrc) .then(function(response) { return response.text().then(function(htmlContent) { if (htmlContent.includes('Page Not Found') || (htmlContent.includes('__next') && htmlContent.includes('mintlify') && !htmlContent.includes('Page saved with SingleFile'))) { throw new Error('Received 404 page instead of HTML file.'); } const blockingCode = getClickBlockingCode(); if (htmlContent.includes('')) { htmlContent = htmlContent.replace('', blockingCode + ''); } else if (htmlContent.includes('')) { htmlContent = htmlContent.replace('', '' + blockingCode); } else { if (htmlContent.includes('')) { htmlContent = htmlContent.replace('', '' + blockingCode + ''); } else { htmlContent = blockingCode + htmlContent; } } iframe.srcdoc = htmlContent; }); }); } else { iframe.src = iframeSrc; }

iframe.addEventListener('load', function() { setTimeout(function() { updateIframeDimensions(iframeWrapper, scaleDiv, iframe, zoom); }, 100);

try { const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; injectClickBlocking(iframeDoc); } catch (e) { // Cross-origin iframe - cannot block clicks } }, { once: true });

iframe.addEventListener('error', function() { // Iframe failed to load - error handling is silent }, { once: true });

scaleDiv.appendChild(iframe); iframeWrapper.appendChild(scaleDiv); if (!iframeSrc.endsWith('.html') || iframeSrc.startsWith('http')) { iframeWrapper.appendChild(clickBlocker); }

if (hint) { wrapper.appendChild(controlsBar); } wrapper.appendChild(iframeWrapper); container.appendChild(wrapper); fragment.appendChild(container);

try { if (viewer.parentNode) { if (viewer === contentArea || viewer.id === 'content-area') { isInitializing = false; return; }

const viewerId = 'viewer-' + Date.now() + '-' + Math.random().toString(36).slice(2, 11); viewer.id = viewerId; viewer.setAttribute('data-viewer-id', viewerId); container.setAttribute('data-viewer-id', viewerId);

// Optimized: Single DOM insertion using fragment if (viewer.nextSibling) { viewer.parentNode.insertBefore(fragment, viewer.nextSibling); } else { viewer.parentNode.appendChild(fragment); }

// Batch style updates Object.assign(viewer.style, { display: 'none', visibility: 'hidden', position: 'absolute', width: '1px', height: '1px', overflow: 'hidden', opacity: '0', pointerEvents: 'none', margin: '0', padding: '0' });

viewer.setAttribute('data-initialized', 'true'); viewer.setAttribute('data-viewer-replaced', 'true');

processedAny = true; invalidateQueryCache();

requestAnimationFrame(function() { updateIframeDimensions(iframeWrapper, scaleDiv, iframe, zoom); }); } } catch (e) { isInitializing = false; return; } });

if (processedAny) { const currentUrl = window.location.href; processedUrls.add(currentUrl); lastUrl = currentUrl; invalidateQueryCache(); }

isInitializing = false; }

// Wait for content area to be available function waitForContentArea(callback, maxAttempts, attempt) { attempt = attempt || 0; maxAttempts = maxAttempts || 20;

const contentArea = document.querySelector('#content-area') || document.querySelector('.mdx-content');

if (contentArea && document.contains(contentArea)) { cachedContentArea = contentArea; callback(); } else if (attempt < maxAttempts) { setTimeout(function() { waitForContentArea(callback, maxAttempts, attempt + 1); }, 500); } else { cachedContentArea = document.body; callback(); } }

// Optimized: Initialize with better state management function initialize() { const currentUrl = window.location.href; if (lastUrl !== currentUrl && lastUrl !== null) { lastUrl = currentUrl; processedUrls.clear(); invalidateQueryCache(); }

if (typeof window !== 'undefined') { window.__lastFullUrl = window.location.href; }

if (lastThemeClass === null && document.documentElement) { lastThemeClass = document.documentElement.className; }

if (!themeObserver && document.documentElement) { themeObserver = new MutationObserver(function(mutations) { for (let i = 0; i < mutations.length; i++) { const mutation = mutations[i]; if (mutation.type === 'attributes' && mutation.attributeName === 'class') { const currentThemeClass = document.documentElement.className; if (lastThemeClass !== null && lastThemeClass !== currentThemeClass) { themeToggleInProgress = true;

// Optimized: Lock containers synchronously const contentArea = getContentArea(); if (contentArea) { const containers = getContainers(true); containers.forEach(function(container) { if (container.getAttribute('data-position-locked') !== 'true') { const rect = container.getBoundingClientRect(); Object.assign(container.style, { position: 'fixed', top: rect.top + 'px', left: rect.left + 'px', width: rect.width + 'px', zIndex: '9999', margin: '0' }); container.setAttribute('data-position-locked', 'true'); containerPositions.set(container, { top: rect.top, left: rect.left, width: rect.width, height: rect.height }); } }); }

let repositionAttempts = 0; const maxRepositionAttempts = 30;

const repositionInterval = setInterval(function() { repositionAttempts++; repositionContainersAfterThemeToggleCore(); // Use core function for immediate repositioning if (repositionAttempts >= maxRepositionAttempts) { clearInterval(repositionInterval); } }, 100);

setTimeout(function() { clearInterval(repositionInterval); themeToggleInProgress = false; repositionContainersAfterThemeToggleCore(); // Use core function for final repositioning unlockContainers(); }, 3000); } lastThemeClass = currentThemeClass; } } });

themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] }); }

if (typeof MutationObserver !== 'undefined') { setupObserver(); }

waitForContentArea(function() { setTimeout(function() { initSinglePageViewers(); setTimeout(function() { const remaining = getUninitializedViewers(true); if (remaining.length > 0) { initSinglePageViewers(); } }, INIT_DELAY); }, INIT_DELAY); }); }

// Optimized: Lock/unlock containers function lockContainersInPlace() { const contentArea = getContentArea(); if (!contentArea) return;

const containers = getContainers(true); containerPositions.clear();

requestAnimationFrame(function() { containers.forEach(function(container) { if (container.getAttribute('data-position-locked') !== 'true') { const rect = container.getBoundingClientRect(); Object.assign(container.style, { position: 'fixed', top: rect.top + 'px', left: rect.left + 'px', width: rect.width + 'px', zIndex: '9999', margin: '0' }); container.setAttribute('data-position-locked', 'true'); containerPositions.set(container, { top: rect.top, left: rect.left, width: rect.width, height: rect.height }); } }); }); }

function unlockContainers() { const contentArea = getContentArea(); if (!contentArea) return;

const containers = Array.from( contentArea.querySelectorAll('.single-page-viewer-container[data-position-locked="true"]') );

containers.forEach(function(container) { Object.assign(container.style, { position: '', top: '', left: '', width: '', zIndex: '', margin: '' }); container.removeAttribute('data-position-locked'); // Clean up container position from Map to prevent memory leak containerPositions.delete(container); });

containerPositions.clear(); }

// Optimized: Reposition containers with better DOM operations // Core repositioning function (not debounced for immediate use) function repositionContainersAfterThemeToggleCore() { const contentArea = getContentArea(); if (!contentArea) return;

const containers = getContainers(true);

containers.forEach(function(container) { const viewerId = container.getAttribute('data-viewer-id'); if (!viewerId) return;

let viewer = document.getElementById(viewerId);

if (!viewer) { const iframe = container.querySelector('iframe'); if (iframe && iframe.src) { const allViewers = contentArea.querySelectorAll('[data-single-page-viewer]'); for (let i = 0; i < allViewers.length; i++) { const v = allViewers[i]; if (v.getAttribute('data-src') === iframe.src) { viewer = v; viewer.id = viewerId; viewer.setAttribute('data-viewer-id', viewerId); Object.assign(viewer.style, { display: 'none', visibility: 'hidden', position: 'absolute', width: '1px', height: '1px', overflow: 'hidden', opacity: '0', pointerEvents: 'none', margin: '0', padding: '0' }); viewer.setAttribute('data-initialized', 'true'); viewer.setAttribute('data-viewer-replaced', 'true'); break; } } } }

if (viewer && viewer.parentNode) { if (container.getAttribute('data-position-locked') === 'true') { unlockContainers(); }

const viewerIndex = Array.from(viewer.parentNode.children).indexOf(viewer); const containerIndex = Array.from(viewer.parentNode.children).indexOf(container);

if (containerIndex !== viewerIndex + 1) { // CRITICAL: Check if container is actually a child before removing if (container.parentNode && container.parentNode.contains(container)) { try { container.parentNode.removeChild(container); } catch (e) { return; // Skip repositioning if removal failed } } if (viewer.nextSibling) { viewer.parentNode.insertBefore(container, viewer.nextSibling); } else { viewer.parentNode.appendChild(container); } } else if (container.parentNode !== viewer.parentNode) { // CRITICAL: Check if container is actually a child before removing if (container.parentNode && container.parentNode.contains(container)) { try { container.parentNode.removeChild(container); } catch (e) { return; // Skip repositioning if removal failed } } if (viewer.nextSibling) { viewer.parentNode.insertBefore(container, viewer.nextSibling); } else { viewer.parentNode.appendChild(container); } } } });

invalidateQueryCache(); }

// Debounced version for non-critical repositioning const repositionContainersAfterThemeToggle = debounce(repositionContainersAfterThemeToggleCore, REPOSITION_DEBOUNCE);

// Optimized: Observer setup with better filtering let observer = null; let containerPositionObserver = null; let fallbackObserver = null; // Track fallback observer for cleanup

function setupContainerPositionObserver() { if (typeof MutationObserver === 'undefined') return;

const contentArea = getContentArea(); if (!contentArea || !document.contains(contentArea)) { setTimeout(setupContainerPositionObserver, 500); return; }

if (containerPositionObserver) { containerPositionObserver.disconnect(); }

containerPositionObserver = new MutationObserver(function(mutations) { if (themeToggleInProgress) { // Use core function (not debounced) for immediate repositioning during theme toggle requestAnimationFrame(repositionContainersAfterThemeToggleCore); return; }

let needsReposition = false; for (let i = 0; i < mutations.length && !needsReposition; i++) { if (mutations[i].type === 'childList') { needsReposition = true; } }

if (needsReposition) { clearTimeout(containerPositionObserver._timeout); containerPositionObserver._timeout = setTimeout(repositionContainersAfterThemeToggle, REPOSITION_DEBOUNCE); } });

containerPositionObserver.observe(contentArea, { childList: true, subtree: true, attributes: false, characterData: false });

containerPositionObserver._timeout = null; }

// Optimized: Main observer with better early exits function setupObserver() { if (typeof MutationObserver === 'undefined') return;

const contentArea = getContentArea(); if (!contentArea || !document.contains(contentArea)) { setTimeout(setupObserver, 500); return; }

if (contentArea === document.documentElement || contentArea === document.body) { return; }

if (observer) { const currentObserved = observer._observedElement; if (currentObserved === contentArea && document.contains(contentArea)) { return; } if (currentObserved) { observer.disconnect(); } observer = null; }

observer = new MutationObserver(function(mutations) { if (themeToggleInProgress) return;

let hasNewViewer = false; for (let i = 0; i < mutations.length && !hasNewViewer; i++) { const mutation = mutations[i]; if (mutation.addedNodes && mutation.addedNodes.length > 0) { for (let j = 0; j < mutation.addedNodes.length && !hasNewViewer; j++) { const node = mutation.addedNodes[j]; if (node.nodeType === 1 && node.hasAttribute && node.hasAttribute('data-single-page-viewer') && !node.hasAttribute('data-initialized') && !node.hasAttribute('data-viewer-replaced')) { hasNewViewer = true; } } } }

if (hasNewViewer) { // Use core function for immediate repositioning when new viewer detected repositionContainersAfterThemeToggleCore(); setTimeout(repositionContainersAfterThemeToggleCore, 10); setTimeout(repositionContainersAfterThemeToggleCore, 50); setTimeout(repositionContainersAfterThemeToggleCore, 200); }

clearTimeout(observerTimeout); observerTimeout = setTimeout(function() { if (themeToggleInProgress) return;

let hasNewViewer = false; for (let i = 0; i < mutations.length && !hasNewViewer; i++) { const mutation = mutations[i];

if (mutation.target === document.documentElement || mutation.target === document.body) { continue; }

if (mutation.type === 'attributes' && mutation.attributeName === 'class' && mutation.target === document.documentElement) { continue; }

if (mutation.type === 'attributes' && mutation.attributeName === 'data-initialized') { const target = mutation.target; if (target && target.hasAttribute && target.hasAttribute('data-single-page-viewer') && !target.hasAttribute('data-initialized')) { hasNewViewer = true; } }

if (mutation.addedNodes && mutation.addedNodes.length > 0) { for (let j = 0; j < mutation.addedNodes.length && !hasNewViewer; j++) { const node = mutation.addedNodes[j]; if (node.nodeType === 1 && node.hasAttribute && node.hasAttribute('data-single-page-viewer') && !node.hasAttribute('data-initialized')) { hasNewViewer = true; } } } }

if (hasNewViewer) { invalidateQueryCache(); initSinglePageViewers(); } }, OBSERVER_DEBOUNCE); });

observer.observe(contentArea, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-initialized'], characterData: false });

observer._observedElement = contentArea; setupContainerPositionObserver(); }

function start() { setupObserver(); initialize(); }

function checkAndInitialize() { if (isInitializing) return;

const currentUrl = window.location.href; if (currentUrl === lastUrl && lastUrl !== null) { return; }

const contentArea = document.querySelector('#content-area') || document.querySelector('.mdx-content'); if (contentArea) { const viewers = getUninitializedViewers(true); if (viewers.length > 0) { cachedContentArea = contentArea; setupObserver(); initialize(); } } }

if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', start); } else { setTimeout(start, 100); }

if (typeof window !== 'undefined' && window.next) { let initialLoadAttempts = 0; const maxInitialAttempts = 4; const attemptDelays = [200, 500, 1000, 2000]; const initialUrl = window.location.href;

attemptDelays.forEach(function(delay) { setTimeout(function() { if (initialLoadAttempts < maxInitialAttempts) { initialLoadAttempts++; if (window.location.href === initialUrl) { checkAndInitialize(); } } }, delay); }); }

window.addEventListener('popstate', function(e) { const currentUrl = window.location.href; if (currentUrl !== lastUrl) { handleNavigation(); } });

if (typeof window !== 'undefined') { if (window.next && window.next.router && window.next.router.events) { window.next.router.events.on('routeChangeComplete', function(url) { lastUrl = window.location.href; isInitializing = false; pendingInitCall = false; if (navigationTimeout) { clearTimeout(navigationTimeout); navigationTimeout = null; } invalidateContentAreaCache(); invalidateQueryCache(); setTimeout(function() { setupObserver(); initialize(); }, 300); });

window.next.router.events.on('routeChangeStart', function(url) { isInitializing = false; pendingInitCall = false; }); }

if (!window.next || !window.next.router) { const originalPushState = history.pushState; const originalReplaceState = history.replaceState;

history.pushState = function() { originalPushState.apply(history, arguments); setTimeout(function() { if (window.location.href !== lastUrl) { handleNavigation(); } }, 0); };

history.replaceState = function() { originalReplaceState.apply(history, arguments); setTimeout(function() { if (window.location.href !== lastUrl) { handleNavigation(); } }, 0); }; } }

document.addEventListener('visibilitychange', function() { if (!document.hidden) { isInitializing = false; startPeriodicCheck(); if (!pendingInitCall) { pendingInitCall = true; setTimeout(function() { pendingInitCall = false; initSinglePageViewers(); }, INIT_DELAY / 2); } } });

function startPeriodicCheck() { if (periodicCheckInterval) return;

periodicCheckInterval = setInterval(function() { const uninitialized = getUninitializedViewers(true); if (uninitialized.length === 0) { clearInterval(periodicCheckInterval); periodicCheckInterval = null; } else if (!isInitializing) { initSinglePageViewers(); } }, 2000); }

setTimeout(startPeriodicCheck, INIT_DELAY * 2);

window.__singlePageViewerInit = function() { const currentUrl = window.location.href; if (currentUrl === lastUrl) { return; }

isInitializing = false; pendingInitCall = false; lastUrl = currentUrl; invalidateContentAreaCache(); invalidateQueryCache(); setupObserver(); initialize(); };

window.__singlePageViewerCheck = function() { invalidateQueryCache(); initSinglePageViewers(); }; })();

// Optimized: Second IIFE for navigation handling (function() { 'use strict';

let lastPathname = window.location.pathname; let lastInitializedPathname = window.location.pathname;

function checkAndInit() { const currentPathname = window.location.pathname; if (currentPathname === lastInitializedPathname) { return; }

lastInitializedPathname = currentPathname; if (typeof window !== 'undefined') { window.__lastFullUrl = window.location.href; }

if (window.__singlePageViewerInit) { window.__singlePageViewerInit(); } }

function runInit() { if (window.__singlePageViewerInit) { setTimeout(checkAndInit, 100); } else { let attempts = 0; const maxAttempts = 50; const checkInterval = setInterval(function() { attempts++; if (window.__singlePageViewerInit) { clearInterval(checkInterval); setTimeout(checkAndInit, 100); } else if (attempts >= maxAttempts) { clearInterval(checkInterval); } }, 100); } }

if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', runInit); } else { setTimeout(runInit, 100); }

if (typeof window !== 'undefined' && window.next && window.next.router && window.next.router.events) { window.next.router.events.on('routeChangeComplete', function(url) { lastPathname = window.location.pathname; setTimeout(checkAndInit, 300); }); }

setInterval(function() { const currentPathname = window.location.pathname; if (currentPathname !== lastPathname) { lastPathname = currentPathname; setTimeout(checkAndInit, 300); } }, 500);

if (typeof MutationObserver !== 'undefined') { let fallbackObserverTimeout = null; // Store in outer scope for cleanup tracking fallbackObserver = new MutationObserver(function(mutations) { if (fallbackObserverTimeout) { clearTimeout(fallbackObserverTimeout); } fallbackObserverTimeout = setTimeout(function() { const contentArea = document.querySelector('#content-area'); if (contentArea) { const uninitialized = contentArea.querySelectorAll( '[data-single-page-viewer]:not([data-initialized]):not(.single-page-viewer-container [data-single-page-viewer])' ); if (uninitialized.length > 0) { const currentPathname = window.location.pathname; if (currentPathname !== lastInitializedPathname) { setTimeout(checkAndInit, 200); } } } }, 500); });

if (document.body) { fallbackObserver.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', function() { if (document.body) { fallbackObserver.observe(document.body, { childList: true, subtree: true }); } }); } } })();