Changeset 2319166
- Timestamp:
- 06/05/2020 07:02:12 PM (6 years ago)
- Location:
- voice-dialog-navigation
- Files:
-
- 165 added
- 8 edited
-
tags/3.0.1 (added)
-
tags/3.0.1/LICENSE.txt (added)
-
tags/3.0.1/classes (added)
-
tags/3.0.1/classes/plugin-languages (added)
-
tags/3.0.1/classes/plugin-languages/vdn_de_DE.php (added)
-
tags/3.0.1/classes/plugin-languages/vdn_en_EN.php (added)
-
tags/3.0.1/classes/plugin.php (added)
-
tags/3.0.1/classes/settings-page.php (added)
-
tags/3.0.1/composer.json (added)
-
tags/3.0.1/css (added)
-
tags/3.0.1/css/settings (added)
-
tags/3.0.1/css/settings/vdn.settings.css (added)
-
tags/3.0.1/css/settings/vdn.settings.min.css (added)
-
tags/3.0.1/css/voice-dialog-navigation.css (added)
-
tags/3.0.1/css/voice-dialog-navigation.min.css (added)
-
tags/3.0.1/custom_dialog_response (added)
-
tags/3.0.1/custom_dialog_response/.gitignore (added)
-
tags/3.0.1/generic_dialog_response (added)
-
tags/3.0.1/generic_dialog_response/.gitignore (added)
-
tags/3.0.1/images (added)
-
tags/3.0.1/images/Voice Assistant Bot Icon.png (added)
-
tags/3.0.1/images/speak2web_logo.png (added)
-
tags/3.0.1/images/speak2web_white_logo.svg (added)
-
tags/3.0.1/images/vdn-close-icon.svg (added)
-
tags/3.0.1/images/vdn-down-chevron.svg (added)
-
tags/3.0.1/images/vdn-floating-mic-icon.png (added)
-
tags/3.0.1/images/vdn-floating-robot-icon.png (added)
-
tags/3.0.1/images/vdn-mic-stop.svg (added)
-
tags/3.0.1/images/vdn-mic.svg (added)
-
tags/3.0.1/images/vdn-mute-response.svg (added)
-
tags/3.0.1/images/vdn-process-spinner.gif (added)
-
tags/3.0.1/images/vdn-up-chevron.svg (added)
-
tags/3.0.1/images/vdn-widget-mic-black.svg (added)
-
tags/3.0.1/images/vdn-widget-mic.svg (added)
-
tags/3.0.1/images/vdn-widget-robot.png (added)
-
tags/3.0.1/images/vdn-widget-search-icon.svg (added)
-
tags/3.0.1/js (added)
-
tags/3.0.1/js/recorderjs (added)
-
tags/3.0.1/js/recorderjs/vdn.audio-recorder-worker.js (added)
-
tags/3.0.1/js/recorderjs/vdn.audio-recorder-worker.min.js (added)
-
tags/3.0.1/js/recorderjs/vdn.audio-recorder.js (added)
-
tags/3.0.1/js/recorderjs/vdn.audio-recorder.min.js (added)
-
tags/3.0.1/js/settings (added)
-
tags/3.0.1/js/settings/vdn.settings.js (added)
-
tags/3.0.1/js/settings/vdn.settings.min.js (added)
-
tags/3.0.1/js/vdn.audio-input-handler.js (added)
-
tags/3.0.1/js/vdn.audio-input-handler.min.js (added)
-
tags/3.0.1/js/vdn.speech-handler.js (added)
-
tags/3.0.1/js/vdn.speech-handler.min.js (added)
-
tags/3.0.1/js/vdn.text-library.js (added)
-
tags/3.0.1/js/vdn.text-library.min.js (added)
-
tags/3.0.1/js/voice-dialog-navigation.js (added)
-
tags/3.0.1/js/voice-dialog-navigation.min.js (added)
-
tags/3.0.1/lib (added)
-
tags/3.0.1/lib/requirements-check.php (added)
-
tags/3.0.1/lib/wp-stack-plugin.php (added)
-
tags/3.0.1/readme.txt (added)
-
tags/3.0.1/short_phrases (added)
-
tags/3.0.1/short_phrases/female_de_DE (added)
-
tags/3.0.1/short_phrases/female_de_DE/general (added)
-
tags/3.0.1/short_phrases/female_de_DE/general/female_de_DE_basic.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/general/female_de_DE_default_desc.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/general/female_de_DE_disabled_intent.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/general/female_de_DE_mic_connect.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/general/female_de_DE_not_audible.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/general/female_de_DE_simon_intro.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/general/female_de_DE_unable_to_process.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/general/female_de_DE_unavailable.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_0.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_1.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_2.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_3.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_4.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_5.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_6.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_7.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_8.mp3 (added)
-
tags/3.0.1/short_phrases/female_de_DE/random/female_de_DE_random_9.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB (added)
-
tags/3.0.1/short_phrases/female_en_GB/general (added)
-
tags/3.0.1/short_phrases/female_en_GB/general/female_en_GB_basic.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/general/female_en_GB_default_desc.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/general/female_en_GB_disabled_intent.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/general/female_en_GB_mic_connect.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/general/female_en_GB_not_audible.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/general/female_en_GB_simon_intro.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/general/female_en_GB_unable_to_process.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/general/female_en_GB_unavailable.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_0.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_1.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_2.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_3.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_4.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_5.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_6.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_7.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_8.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_GB/random/female_en_GB_random_9.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US (added)
-
tags/3.0.1/short_phrases/female_en_US/general (added)
-
tags/3.0.1/short_phrases/female_en_US/general/female_en_US_basic.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/general/female_en_US_default_desc.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/general/female_en_US_disabled_intent.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/general/female_en_US_mic_connect.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/general/female_en_US_not_audible.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/general/female_en_US_simon_intro.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/general/female_en_US_unable_to_process.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/general/female_en_US_unavailable.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_0.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_1.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_2.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_3.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_4.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_5.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_6.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_7.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_8.mp3 (added)
-
tags/3.0.1/short_phrases/female_en_US/random/female_en_US_random_9.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE (added)
-
tags/3.0.1/short_phrases/male_de_DE/general (added)
-
tags/3.0.1/short_phrases/male_de_DE/general/male_de_DE_basic.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/general/male_de_DE_default_desc.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/general/male_de_DE_disabled_intent.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/general/male_de_DE_mic_connect.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/general/male_de_DE_not_audible.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/general/male_de_DE_simon_intro.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/general/male_de_DE_unable_to_process.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/general/male_de_DE_unavailable.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_0.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_1.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_2.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_3.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_4.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_5.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_6.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_7.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_8.mp3 (added)
-
tags/3.0.1/short_phrases/male_de_DE/random/male_de_DE_random_9.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US (added)
-
tags/3.0.1/short_phrases/male_en_US/general (added)
-
tags/3.0.1/short_phrases/male_en_US/general/male_en_US_basic.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/general/male_en_US_default_desc.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/general/male_en_US_disabled_intent.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/general/male_en_US_mic_connect.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/general/male_en_US_not_audible.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/general/male_en_US_simon_intro.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/general/male_en_US_unable_to_process.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/general/male_en_US_unavailable.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_0.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_1.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_2.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_3.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_4.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_5.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_6.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_7.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_8.mp3 (added)
-
tags/3.0.1/short_phrases/male_en_US/random/male_en_US_random_9.mp3 (added)
-
tags/3.0.1/short_phrases/silence.mp3 (added)
-
tags/3.0.1/voice-dialog-navigation.php (added)
-
trunk/classes/plugin.php (modified) (2 diffs)
-
trunk/composer.json (modified) (1 diff)
-
trunk/js/vdn.speech-handler.js (modified) (1 diff)
-
trunk/js/vdn.speech-handler.min.js (modified) (1 diff)
-
trunk/js/voice-dialog-navigation.js (modified) (6 diffs)
-
trunk/js/voice-dialog-navigation.min.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/voice-dialog-navigation.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
voice-dialog-navigation/trunk/classes/plugin.php
r2270015 r2319166 20 20 public static $configured_settings_from_db = array(); 21 21 public static $vdn_dialog_type = 'generic'; 22 public static $vdn_file_type = ' .min';22 public static $vdn_file_type = ''; 23 23 //public static $vdn_file_type = ''; // For debugging 24 24 … … 83 83 * Plugin version. 84 84 */ 85 const VERSION = '3.0. 0';85 const VERSION = '3.0.1'; 86 86 87 87 /** -
voice-dialog-navigation/trunk/composer.json
r2270015 r2319166 2 2 "name": "speak2web/voice-dialog-navigation", 3 3 "description": "Allows visitors to navigate the web page using their voice and ask questions.", 4 "version": "3.0. 0",4 "version": "3.0.1", 5 5 "type": "wordpress-plugin", 6 6 "license": "GPL-2.0+", -
voice-dialog-navigation/trunk/js/vdn.speech-handler.js
r2270015 r2319166 622 622 623 623 if (!(typeof(msg) != 'undefined' && msg != null && msg.trim() != '')) return; 624 625 //To support WooCommerce we need to capture the current URL we are on! 626 //Lets fetch the entire URL and provide it to Simon AI 627 let currentURL = window.location.href; 628 console.log("Will send the URL: " + currentURL + " to SimonAI as base URL"); 629 vdnMyStatus.cUrl = currentURL; 624 630 625 631 let vdnBody = { -
voice-dialog-navigation/trunk/js/vdn.speech-handler.min.js
r2270015 r2319166 1 window.addEventListener("load",function(){let e=localStorage.getItem("vdnPendingPlaybackPath");null!=e&&(localStorage.setItem("vdnPendingPlaybackPath",""),void 0!==e&&e&&(vdnIntentResponsePlayer.configure(e),vdnIntentResponsePlayer.play()));let n=localStorage.getItem("vdnCtx");null!=n&&(vdnMyContext=JSON.parse(n),localStorage.setItem("vdnCtx","{}"));let t=localStorage.getItem("vdnStat");null!=t&&(vdnMyStatus=JSON.parse(t),localStorage.setItem("vdnStat","{}"))}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var vdnRespTimeOut=!1,vdnErrcnt=0,vdnMyStatus={},vdnMyContext={},vdnWin1=-1,vdnWin2=-1,vdnIsTalking=!1,vdnIsGtmPresent=!1;let vdnGtagConfigCount=0,vdnGaConfiguredForGtag=!1,vdnGoogleAnalyticsTrackingId="undefined"!=typeof vdnGaTrackingId?vdnGaTrackingId:null;if("undefined"!=typeof vdnGaTrack&&"yes"==vdnGaTrack)try{if("function"!=typeof ga||vdnGoogleAnalyticsTrackingId||ga(function(){vdnGoogleAnalyticsTrackingId=ga.getAll()[0].get("trackingId")}),void 0!==window.dataLayer){let e=window.dataLayer.length;for(let n=0;n<e;n++){let e=window.dataLayer[n];if(void 0!==e.event&&"gtm.js"===e.event){vdnIsGtmPresent=!0;break}"object"==typeof e&&Object.values(e).forEach(function(e,n){"config"===e&&(vdnGtagConfigCount+=1),void 0!==e.indexOf&&-1!==e.indexOf("UA-")&&(vdnGaConfiguredForGtag=!0)})}}}catch(e){console.log("VDN Google Analytics support detection error: "+e.message),vdnGtagConfigCount=0,vdnGaConfiguredForGtag=!1,vdnGoogleAnalyticsTrackingId=null}var vdnIntentResponsePlayer={htmlAudioElement:document.createElement("AUDIO"),lastFilePath:null,antiMuteButtonPlaybacks:[vdnSilenceSoundPath],isAntiMutePlayback:!1,configure:function(e=null,n=null){try{let t=void 0!==e&&e?e:null;t?(this.htmlAudioElement.src=vdnPathUrl+t,this.htmlAudioElement.preload="auto",this.lastFilePath=t,-1!==this.antiMuteButtonPlaybacks.indexOf(t)?this.isAntiMutePlayback=!0:this.isAntiMutePlayback=!1):(this.htmlAudioElement.src="",this.isAntiMutePlayback=!1),this.htmlAudioElement.onplay=function(){vdnIsTalking=!0}.bind(this),this.htmlAudioElement.onended=function(){vdnIsTalking=!1,this.htmlAudioElement.src="",this.muteButton("hide"),this.isAntiMutePlayback=!1,t&&"function"==typeof n&&(n(),n=null)}.bind(this),this.htmlAudioElement.onerror=function(){vdnIsTalking=!1,this.muteButton("hide"),this.isAntiMutePlayback=!1}.bind(this),this.htmlAudioElement.onplaying=function(){vdnIsTalking=!0,this.muteButton("show")}.bind(this)}catch(e){this.clear(),this.isAntiMutePlayback=!1}},play:function(){try{this.htmlAudioElement&&this.htmlAudioElement.src&&this.htmlAudioElement.play().catch(function(e){console.log("VDN Exception: Failed to play audio.")})}catch(e){this.clear()}},stop:function(){try{this.clear()}catch(e){this.clear()}},clear:function(){try{if(this.htmlAudioElement){let e=isNaN(this.htmlAudioElement.duration)?0:this.htmlAudioElement.duration;this.htmlAudioElement.currentTime=e}this.lastFilePath=null}catch(e){this.lastFilePath=null,this.isAntiMutePlayback=!1}this.muteButton("hide")},muteButton:function(e){try{if(this.isAntiMutePlayback||void 0===vdnResponseControllerEl||!vdnResponseControllerEl||void 0===e)return!1;"show"==e?vdnResponseControllerEl.classList.remove("vdn-hide-element"):(vdnResponseControllerEl.classList.add("vdn-hide-element"),this.isPlaying()&&this.stop())}catch(e){}},isPlaying:function(){return(isNaN(this.htmlAudioElement.currentTime)?0:this.htmlAudioElement.currentTime)<(isNaN(this.htmlAudioElement.duration)?0:this.htmlAudioElement.duration)}};let vdnResponseControllers=document.querySelectorAll("span.vdn-response-controller");if(void 0!==vdnResponseControllers&&null!=vdnResponseControllers&&vdnResponseControllers.length>0){let e=vdnResponseControllers.length;for(let n=0;n<e;n++)vdnResponseControllers[n].remove()}var vdnResponseControllerEl=document.createElement("span"),vdnResponseControllerPositionClass="vdn-response-controller-middle-right",vdnMicPos=vdnSelectedMicPosition?vdnSelectedMicPosition.toLowerCase():"middle right";switch(vdnMicPos){case"middle left":vdnResponseControllerPositionClass="vdn-response-controller-middle-left";break;case"top right":vdnResponseControllerPositionClass="vdn-response-controller-top-right";break;case"top left":vdnResponseControllerPositionClass="vdn-response-controller-top-left";break;case"bottom right":vdnResponseControllerPositionClass="vdn-response-controller-bottom-right";break;case"bottom left":vdnResponseControllerPositionClass="vdn-response-controller-bottom-left";break;default:vdnResponseControllerPositionClass="vdn-response-controller-middle-right"}vdnResponseControllerEl.setAttribute("class","vdn-response-controller vdn-hide-element "+vdnResponseControllerPositionClass);let vdnAudioMuteIcon=document.createElement("button");vdnAudioMuteIcon.setAttribute("type","button"),vdnAudioMuteIcon.setAttribute("class","vdn-speaker-icon"),vdnAudioMuteIcon.setAttribute("title","Mute Simon"),vdnAudioMuteIcon.onclick=function(){vdnIntentResponsePlayer.muteButton("hide")},vdnResponseControllerEl.appendChild(vdnAudioMuteIcon),document.body.appendChild(vdnResponseControllerEl);let vdnSettingsData="undefined"!=typeof vdnConfiguredSetting?vdnConfiguredSetting:null,vdnHostName="undefined"!=typeof vdnCurrentHostName?vdnCurrentHostName:null,vdnTypeOfDialog="undefined"!=typeof vdnDialogType&&null!==vdnDialogType?vdnDialogType.trim():"generic",vdnCustomEndpoint="undefined"!=typeof vdnCustomEndpointUrl&&null!==vdnCustomEndpointUrl?vdnCustomEndpointUrl:null;null!==vdnCustomEndpoint&&vdnCustomEndpoint.constructor===Array&&1==vdnCustomEndpoint.length&&(vdnCustomEndpoint=null),vdnTypeOfSearch="undefined"!=typeof vdnTypeOfSearch&&null!==vdnTypeOfSearch?vdnTypeOfSearch:"native";let vdnMale=!1===vdnVoiceType.female;function vdnGetCookie(e=null){try{if(null==e)return"";let n=e+"=",t=decodeURIComponent(document.cookie).split(";"),o=t.length;for(let e=0;e<o;e++){let o=t[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(n))return o.substring(n.length,o.length)}}catch(e){console.log("Something went wrong while getting cookie.")}return""}function vdnIsCustomDialogOpted(){let e=!1;try{"custom"==vdnTypeOfDialog&&null!==vdnCustomEndpoint&&0!=vdnCustomEndpoint.length&&(e=!0)}catch(e){console.log("Something went wrong while checking preference of dialog type.")}return e}function vdnCheckAndGetIntentFromSettings(e,n=null,t=null){let o=null,i={description:vdnMessages.unableToProcess,url:"",enabled:!1};o=i;try{if(void 0!==n&&null!=n&&(i.description=n),void 0!==t&&null!=t&&0!=t.length&&(t=i.url=t.trim()),0==vdnIsCustomDialogOpted()&&void 0!==e&&0!=e.length&&null!=vdnSettingsData&&e in vdnSettingsData){let n=vdnSettingsData[e],t="response"in n?n.response:null,o="url"in n?n.url:"";void 0!==t&&null!=t&&0!=t.length&&(i.description=t),void 0!==o&&null!=o&&0!=o.length&&(i.url=o.trim());let l=!1;if("enabled"in n){let e=n.enabled;l=!0===(l=null!=e)&&"enabled"==e.trim()}i.enabled=l}1==vdnIsCustomDialogOpted()&&(i.enabled=!0)}catch(e){i=o,console.log("Something went wrong while checking settings:"+e.message)}return new RegExp("^([a-z]+://|//)","i").test(i.url)||(0===i.url.indexOf("www.")?i.url="http://"+i.url:(i.url="/"==i.url.charAt(0)?i.url:"/"+i.url,i.url=vdnGetCurrentHostURL()+i.url)),i.description=i.description.trim(),i}function vdnStt(e,n,t){if(0==n){let e=Math.floor(10*Math.random()),n=vdnAlternativeResponse.randomLib;0==vdnRespTimeOut&&(vdnIntentResponsePlayer.configure(n[e]),vdnIntentResponsePlayer.play(),vdnRespTimeOut=!0,setTimeout(function(){vdnRespTimeOut=!1},6e3))}let o=vdnWebSocketUrl.url+vdnWebSocketUrl.tokenQs+vdnServiceKeys.iSTT+vdnWebSocketUrl.otherQs,i=new WebSocket(o);i.onopen=function(n){i.send(JSON.stringify({action:"start","content-type":"audio/wav",interim_results:!1,max_alternatives:3,smart_formatting:!0})),i.send(e),i.send(JSON.stringify({action:"stop"})),vdnLogServiceCall()},i.onclose=function(e){},i.onmessage=function(e){!function(e){let n=JSON.parse(e.data);if(null!=n.results){let e="",o=!1;for(let t in n.results)1==n.results[t].final&&(e+=n.results[t].alternatives[0].transcript,o=!0);vdnErrcnt=0,1!=o&&0!=n.results.length||("function"==typeof t&&t(e),i.close())}}(e)},i.onerror=function(n){!function(n){if(vdnErrcnt++,i.close(),"undefined"==typeof vdnXApiKey||null===vdnXApiKey)return;vdnErrcnt<2&&vdnRefreshVoiceServicesKeys().then(function(n){vdnServiceKeys.iSTT=n,vdnStt(e,!0,t)}).catch(function(e){alert(e)})}()}}function vdnLogWithGoogleAnalytics(e,n){try{if("undefined"==typeof vdnGaTrack||null==vdnGaTrack)return;if("yes"==vdnGaTrack){let t=!1,o="Voice Dialog Navigation - Conversation Log",i="[ USER QUERY:- "+e+" ] [ SIMON RESPONSE:- "+n+" ]";if(vdnIsGtmPresent&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"VoiceDialogNavigation-QueryResponse",vdnQueryResponse:i}),t=!0),!vdnGoogleAnalyticsTrackingId||-1===vdnGoogleAnalyticsTrackingId.indexOf("UA-"))throw"Unable to send VDN conversation log to Google Analytics due to unavaibility of the Google Analytics tracking Id.";if(!t&&"function"==typeof gtag&&vdnGtagConfigCount>0&&!0===vdnGaConfiguredForGtag){let e={event_category:o};if(vdnGtagConfigCount>1){if(!vdnGoogleAnalyticsTrackingId)throw'Multiple "gtag" configurations detected but Google Analytics tracking id is missing.';e.send_to=vdnGoogleAnalyticsTrackingId}gtag("event",i,e),t=!0}if(t||"function"!=typeof ga||(ga("send","event",o,i),t=!0),!t)throw"Supported Google Analytics library not available."}}catch(e){let n="string"==typeof e?e:e.message;console.log("VDN Google Analytics Log Process Error: "+n)}}function vdnSendDialog(e,n,t=null){if("undefined"==typeof vdnXApiKey||null===vdnXApiKey)return;if(void 0===e||null==e||""==e.trim())return;let o= {msg:e,context:vdnMyContext,status:vdnMyStatus};function i(n){try{null!==t&&(t.userMsgEl.innerHTML=e,t.simonMsgEl.innerHTML=n,t.userMsgElWrapper.appendChild(t.userMsgEl),t.chatConvoEl.appendChild(t.userMsgElWrapper),t.chatConvoEl.appendChild(t.simonMsgEl),void 0!==t.chatConvoEl.scrollTop&&void 0!==t.chatConvoEl.scrollHeight&&(t.chatConvoEl.scrollTop=t.chatConvoEl.scrollHeight),t.expandCollapseHandle())}catch(e){}}let l=JSON.stringify(o,null,!0),s=new XMLHttpRequest,r=((new Date).getTime(),{userQuery:"",simonResponse:""});s.onreadystatechange=function(){if(4==this.readyState&&200==this.status){var t=JSON.parse(this.responseText);if(void 0===t||!t)return void n(vdnAlternativeResponse.unableToProcess);t.description="undefined"!=t.description?t.description:"",t.url="undefined"!=t.url?t.url:"",vdnLogWithGoogleAnalytics(e,t.description),null!=typeof t.status&&(vdnMyStatus=t.status),null!=typeof t.context&&(vdnMyContext=t.context);let l=void 0!==vdnMyStatus.intent?vdnMyStatus.intent:null,s=vdnCheckAndGetIntentFromSettings(l,t.description,t.url.toLowerCase());if(t.description=s.description,t.url=s.url,0==s.enabled){n(vdnAlternativeResponse.disabledIntentResponse,null,!0);let t=vdnMessages.traditionalSearch;return i(t),r.userQuery=e,r.simonResponse=t,void localStorage.setItem("vdnWidgetConversation",JSON.stringify(r,null,!0))}if(t.description){let s=vdnAlternativeResponse.defaultDesc;if(vdnIsCustomDialogOpted()){let e=vdnGetExistingCustomDialogResponse(vdnVoiceAndLanguage,t.description);e?(s=void 0!==e.path&&e.path?e.path:vdnAlternativeResponse.defaultDesc,o()):vdnCustomDialogTtsOnTheFly(t.description).then(function(e){e&&(s=void 0!==e.path&&e.path?e.path:vdnAlternativeResponse.defaultDesc),o()}).catch(function(e){console.log("VDN Error: Something went wrong while TTS process for custom dialog."),o()})}else{let e=vdnGetGenericDialog(vdnVoiceAndLanguage,l),n=e.dialog,t=e.generateAudio;if(n&&!0===t){let e="option_name"in n&&n.option_name?n.option_name:null,t="response"in n&&n.response?n.response:null;t&&e&&vdnGenericDialogTtsOnTheFly(t,e).then(function(e){s=void 0!==e&&void 0!==e.path?e.path:vdnAlternativeResponse.defaultDesc,o()}).catch(function(e){console.log("VDN Error: Something went wrong while TTS process for generic dialog."),o()})}else{let e=n&&void 0!==n.intent_audio_response?n.intent_audio_response:{},t="path"in e&&e.path?e.path:null;t&&(s=t),o()}}function o(){if(i(t.description),r.userQuery=e,r.simonResponse=t.description,localStorage.setItem("vdnWidgetConversation",JSON.stringify(r,null,!0)),vdnClientInfo.ios||vdnClientInfo.android&&vdnClientInfo.firefox||vdnClientInfo.safari&&!vdnClientInfo.chrome&&!vdnClientInfo.firefox||vdnClientInfo.windows&&vdnClientInfo.firefox)n(s,function(){null==t.url||""==t.url||vdnUrlPointsToCurrentPage(t.url)?localStorage.removeItem("vdnWidgetConversation"):location.assign(t.url)});else if(null!=t.url&&""!=t.url){let e=vdnUrlIsPartOfCurrentDomain(t.url.toLowerCase());if(null==e)return n(s),localStorage.removeItem("vdnWidgetConversation"),void alert(vdnMessages.pageUnavailable);if(0==e){try{-1!=vdnWin1&&vdnWin1.close()}catch(e){console.log("We had an error. Error "+e.message)}vdnWin1=window.open(t.url,t.url),n(s),localStorage.removeItem("vdnWidgetConversation")}else{t.description;!function e(t){var o=null;if(vdnUrlPointsToCurrentPage(t))return n(s),void localStorage.removeItem("vdnWidgetConversation");let i=t,l=i.indexOf("#"),r=!1;if(l>-1&&(vdnUrlPointsToCurrentPage(i=i.substring(0,l))?console.log("We need to navigate within the same page"):r=!0),-1==t.indexOf("#")||1==r){if(!0===vdnIsTalking)return void(o=setTimeout(function(){e(t),clearInterval(o)},500));localStorage.setItem("vdnPendingPlaybackPath",s),localStorage.setItem("vdnCtx",JSON.stringify(vdnMyContext,null,!0)),localStorage.setItem("vdnStat",JSON.stringify(vdnMyStatus,null,!0)),void 0!==o&&null!=o&&clearInterval(o)}else n(s),localStorage.removeItem("vdnWidgetConversation");location.assign(t)}(t.url.trim())}}else n(s),localStorage.removeItem("vdnWidgetConversation");if(null!=t.url2&&""!=t.url2){try{-1!=vdnWin2&&vdnWin2.close()}catch(e){console.log("We had an error. Error "+e.message)}vdnWin2=window.open(t.url2,t.url2),localStorage.removeItem("vdnWidgetConversation")}}}}else 4==this.readyState&&200!=this.status&&vdnLogWithGoogleAnalytics(e,vdnMessages.callFailed)};try{var a=vdnSendDialogApiUrl;vdnIsCustomDialogOpted()&&(a=vdnCustomEndpoint),s.open("POST",a,!0),s.setRequestHeader("Accept","application/json"),s.setRequestHeader("Content-type","application/json"),s.setRequestHeader("Access-Control-Allow-Origin","*"),s.setRequestHeader("x-api-key",vdnXApiKey),s.send(l)}catch(e){return console.log("We had an error. Error:"+e.message),void localStorage.removeItem("vdnWidgetConversation")}}function vdnGetCurrentHostURL(){var e=null;try{if(void 0===window.location||void 0===window.location.hostname||void 0===window.location.protocol)return vdnGetHostName();e=window.location.protocol+"//"+window.location.hostname}catch(n){e=vdnGetHostName(),console.log("Something went wrong while discovering current domain.")}return e}function vdnGetHostName(){return vdnHostName}function vdnUrlIsPartOfCurrentDomain(e){let n=!1;try{if(null==e)return null;let t="";0===e.indexOf("http://")?t="http://":0===e.indexOf("https://")&&(t="https://");let o=0==t.length?0:t.length,i=e.substring(o),l=i.indexOf("/"),s=i;-1!=l&&(s=i.substring(0,l)),0===(s=t+s).indexOf(vdnGetCurrentHostURL())&&(n=!0)}catch(e){n=null,console.log("Something went wrong while checking URL.")}return n}function vdnUrlPointsToCurrentPage(e=null){var n=!1;try{if(null==e)return!0;var t=window.location.href;e=e.trim();var o=t[t.length-1];o="/"==o?o:null,0!=e.length&&e.indexOf("/")==e.length-1&&void 0!==o&&"/"!=o&&(t+="/"),t==e&&(n=!0)}catch(e){n=!0,console.log("Something went wrong while getting current full URL.")}return n}function vdnLogServiceCall(e=0){try{let n=new XMLHttpRequest;n.onreadystatechange=function(){if(4==this.readyState&&200==this.status){let e=JSON.parse(this.responseText);vdnServiceLogs.updatedAt=e.updatedAt||vdnServiceLogs.updatedAt,vdnServiceLogs.currentValue=e.currentValue||vdnServiceLogs.currentValue,vdnServiceLogs.lastValue=e.lastValue||vdnServiceLogs.lastValue}},n.open("POST",vdnAjaxObj.ajax_url,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.send("action=vdn_log_service_call&_ajax_nonce="+vdnAjaxObj.nonce+"&updateLastValue="+e)}catch(e){}}function vdnRefreshVoiceServicesKeys(){return new Promise(function(e,n){let t=new XMLHttpRequest;t.onreadystatechange=function(){if(4==this.readyState)if(200===this.status){let t=JSON.parse(this.response),o=void 0!==t.token?t.token:null;o?e(o):n(vdnErrorLibrary.outOfService)}else n(vdnErrorLibrary.outOfService)};let o="?action=vdn_refresh_access_keys&_ajax_nonce="+vdnAjaxObj.keys_nonce;t.open("GET",vdnAjaxObj.ajax_url+o,!0),t.onerror=function(e){n(vdnErrorLibrary.outOfService)},t.send(null)})}function vdnFormatEmail(e=null){let n=e;try{if(e&&null!==e){let t=e.toLowerCase();n=t=t.replace(/dot/gi,".").replace(/at/gi,"@").replace(/underscore/gi,"_").replace(/dotcom/gi,".com").replace(/dotorg/gi,".org").replace(/dotnet/gi,".net").replace(/dotint/gi,".int").replace(/dotedu/gi,".edu").replace(/ /g,"")}}catch(t){n=e}return n}function vdnGetExistingCustomDialogResponse(e,n){let t=null;try{if("undefined"!=typeof vdnCustomResponses&&vdnCustomResponses&&void 0!==e&&e){let o=vdnCustomResponses.length;e=e.trim(),n=n.trim();for(let i=0;i<o;i++){let o=vdnCustomResponses[i],l=void 0!==o.response&&o.response?o.response.trim():null,s=void 0!==o.voice&&o.voice?o.voice.trim():null;if(l&&s&&(l===n&&e===s)){t=JSON.parse(JSON.stringify(o));break}}}}catch(e){t=null}return t}function vdnGetGenericDialog(e,n){this.existingDialog={dialog:{},generateAudio:!1};try{if(!(void 0!==vdnSettingsData&&vdnSettingsData&&void 0!==e&&e&&void 0!==n&&n))throw"VDN Error: Settings data or parameters are missing while checking generic dialog existence.";if(this.selectedVoice=e.trim(),this.intentName=n.trim(),this.dialog=this.intentName in vdnSettingsData?vdnSettingsData[this.intentName]:{},!(this.dialog&&Object.keys(this.dialog).length>0))throw"VDN Error: Dialog is missing while checking generic dialog existence.";this.existingDialog.dialog=JSON.parse(JSON.stringify(this.dialog));let t="response"in this.dialog&&this.dialog.response?this.dialog.response.trim():null,o="enabled"in this.dialog&&this.dialog.enabled?this.dialog.enabled.trim():null,i="intent_audio_response"in this.dialog&&this.dialog.intent_audio_response?this.dialog.intent_audio_response:{},l="voice"in i&&i.voice?i.voice.trim():null,s="path"in i&&i.path?i.path.trim():null;void 0===t||!t||void 0===o||!o||"enabled"!==o||void 0!==s&&s&&void 0!==l&&l&&l===this.selectedVoice||(this.existingDialog.generateAudio=!0)}catch(e){this.existingDialog={dialog:{},generateAudio:!1}}return this.existingDialog}function vdnCustomDialogTtsOnTheFly(e){return new Promise(function(n,t){if(void 0===e||!e)return void t(null);let o=new FormData;o.append("response_text",e),o.append("action","vdn_custom_dialog_text_to_speech"),o.append("_ajax_nonce",vdnAjaxObj.custom_dialog_nonce);let i=new XMLHttpRequest;i.onreadystatechange=function(){if(4==this.readyState)if(200===this.status){let e=JSON.parse(this.response),o=void 0!==e.success&&!0===e.success,i=void 0!==e.data?e.data:null;if(i&&o){let e=void 0!==i.updated_collection?i.updated_collection:null,o=void 0!==i.custom_response?i.custom_response:null;e&&o?(vdnCustomResponses=e,n(o)):t(null)}else t(null)}else t(null)},i.onerror=function(e){t(vdnErrorLibrary.outOfService)};vdnAjaxObj.custom_dialog_nonce;i.open("POST",vdnAjaxObj.ajax_url,!0),i.send(o)})}function vdnGenericDialogTtsOnTheFly(e,n){return new Promise(function(t,o){if(void 0===e||!e||void 0===n||!n)return void o(null);let i=new FormData;i.append("dialog_text",e),i.append("dialog_op_name",n),i.append("user","tts"),i.append("action","vdn_generic_dialog_tts_on_the_fly"),i.append("_ajax_nonce",vdnAjaxObj.generic_dialog_nonce);let l=new XMLHttpRequest;l.onreadystatechange=function(){if(4==this.readyState)if(200===this.status){let e=JSON.parse(this.response),n=void 0!==e.success&&!0===e.success,i=void 0!==e.data?e.data:null;if(i&&n)if(void 0!==i.path&&i.path){let e=void 0!==i.updated_generic_dialogs?i.updated_generic_dialogs:null;e&&Object.keys(e).length>0&&(vdnSettingsData=e),t(i)}else o(null);else o(null)}else o(null)},l.onerror=function(e){o(vdnErrorLibrary.outOfService)},l.open("POST",vdnAjaxObj.ajax_url,!0),l.send(i)})}1 window.addEventListener("load",function(){let e=localStorage.getItem("vdnPendingPlaybackPath");null!=e&&(localStorage.setItem("vdnPendingPlaybackPath",""),void 0!==e&&e&&(vdnIntentResponsePlayer.configure(e),vdnIntentResponsePlayer.play()));let n=localStorage.getItem("vdnCtx");null!=n&&(vdnMyContext=JSON.parse(n),localStorage.setItem("vdnCtx","{}"));let t=localStorage.getItem("vdnStat");null!=t&&(vdnMyStatus=JSON.parse(t),localStorage.setItem("vdnStat","{}"))}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var vdnRespTimeOut=!1,vdnErrcnt=0,vdnMyStatus={},vdnMyContext={},vdnWin1=-1,vdnWin2=-1,vdnIsTalking=!1,vdnIsGtmPresent=!1;let vdnGtagConfigCount=0,vdnGaConfiguredForGtag=!1,vdnGoogleAnalyticsTrackingId="undefined"!=typeof vdnGaTrackingId?vdnGaTrackingId:null;if("undefined"!=typeof vdnGaTrack&&"yes"==vdnGaTrack)try{if("function"!=typeof ga||vdnGoogleAnalyticsTrackingId||ga(function(){vdnGoogleAnalyticsTrackingId=ga.getAll()[0].get("trackingId")}),void 0!==window.dataLayer){let e=window.dataLayer.length;for(let n=0;n<e;n++){let e=window.dataLayer[n];if(void 0!==e.event&&"gtm.js"===e.event){vdnIsGtmPresent=!0;break}"object"==typeof e&&Object.values(e).forEach(function(e,n){"config"===e&&(vdnGtagConfigCount+=1),void 0!==e.indexOf&&-1!==e.indexOf("UA-")&&(vdnGaConfiguredForGtag=!0)})}}}catch(e){console.log("VDN Google Analytics support detection error: "+e.message),vdnGtagConfigCount=0,vdnGaConfiguredForGtag=!1,vdnGoogleAnalyticsTrackingId=null}var vdnIntentResponsePlayer={htmlAudioElement:document.createElement("AUDIO"),lastFilePath:null,antiMuteButtonPlaybacks:[vdnSilenceSoundPath],isAntiMutePlayback:!1,configure:function(e=null,n=null){try{let t=void 0!==e&&e?e:null;t?(this.htmlAudioElement.src=vdnPathUrl+t,this.htmlAudioElement.preload="auto",this.lastFilePath=t,-1!==this.antiMuteButtonPlaybacks.indexOf(t)?this.isAntiMutePlayback=!0:this.isAntiMutePlayback=!1):(this.htmlAudioElement.src="",this.isAntiMutePlayback=!1),this.htmlAudioElement.onplay=function(){vdnIsTalking=!0}.bind(this),this.htmlAudioElement.onended=function(){vdnIsTalking=!1,this.htmlAudioElement.src="",this.muteButton("hide"),this.isAntiMutePlayback=!1,t&&"function"==typeof n&&(n(),n=null)}.bind(this),this.htmlAudioElement.onerror=function(){vdnIsTalking=!1,this.muteButton("hide"),this.isAntiMutePlayback=!1}.bind(this),this.htmlAudioElement.onplaying=function(){vdnIsTalking=!0,this.muteButton("show")}.bind(this)}catch(e){this.clear(),this.isAntiMutePlayback=!1}},play:function(){try{this.htmlAudioElement&&this.htmlAudioElement.src&&this.htmlAudioElement.play().catch(function(e){console.log("VDN Exception: Failed to play audio.")})}catch(e){this.clear()}},stop:function(){try{this.clear()}catch(e){this.clear()}},clear:function(){try{if(this.htmlAudioElement){let e=isNaN(this.htmlAudioElement.duration)?0:this.htmlAudioElement.duration;this.htmlAudioElement.currentTime=e}this.lastFilePath=null}catch(e){this.lastFilePath=null,this.isAntiMutePlayback=!1}this.muteButton("hide")},muteButton:function(e){try{if(this.isAntiMutePlayback||void 0===vdnResponseControllerEl||!vdnResponseControllerEl||void 0===e)return!1;"show"==e?vdnResponseControllerEl.classList.remove("vdn-hide-element"):(vdnResponseControllerEl.classList.add("vdn-hide-element"),this.isPlaying()&&this.stop())}catch(e){}},isPlaying:function(){return(isNaN(this.htmlAudioElement.currentTime)?0:this.htmlAudioElement.currentTime)<(isNaN(this.htmlAudioElement.duration)?0:this.htmlAudioElement.duration)}};let vdnResponseControllers=document.querySelectorAll("span.vdn-response-controller");if(void 0!==vdnResponseControllers&&null!=vdnResponseControllers&&vdnResponseControllers.length>0){let e=vdnResponseControllers.length;for(let n=0;n<e;n++)vdnResponseControllers[n].remove()}var vdnResponseControllerEl=document.createElement("span"),vdnResponseControllerPositionClass="vdn-response-controller-middle-right",vdnMicPos=vdnSelectedMicPosition?vdnSelectedMicPosition.toLowerCase():"middle right";switch(vdnMicPos){case"middle left":vdnResponseControllerPositionClass="vdn-response-controller-middle-left";break;case"top right":vdnResponseControllerPositionClass="vdn-response-controller-top-right";break;case"top left":vdnResponseControllerPositionClass="vdn-response-controller-top-left";break;case"bottom right":vdnResponseControllerPositionClass="vdn-response-controller-bottom-right";break;case"bottom left":vdnResponseControllerPositionClass="vdn-response-controller-bottom-left";break;default:vdnResponseControllerPositionClass="vdn-response-controller-middle-right"}vdnResponseControllerEl.setAttribute("class","vdn-response-controller vdn-hide-element "+vdnResponseControllerPositionClass);let vdnAudioMuteIcon=document.createElement("button");vdnAudioMuteIcon.setAttribute("type","button"),vdnAudioMuteIcon.setAttribute("class","vdn-speaker-icon"),vdnAudioMuteIcon.setAttribute("title","Mute Simon"),vdnAudioMuteIcon.onclick=function(){vdnIntentResponsePlayer.muteButton("hide")},vdnResponseControllerEl.appendChild(vdnAudioMuteIcon),document.body.appendChild(vdnResponseControllerEl);let vdnSettingsData="undefined"!=typeof vdnConfiguredSetting?vdnConfiguredSetting:null,vdnHostName="undefined"!=typeof vdnCurrentHostName?vdnCurrentHostName:null,vdnTypeOfDialog="undefined"!=typeof vdnDialogType&&null!==vdnDialogType?vdnDialogType.trim():"generic",vdnCustomEndpoint="undefined"!=typeof vdnCustomEndpointUrl&&null!==vdnCustomEndpointUrl?vdnCustomEndpointUrl:null;null!==vdnCustomEndpoint&&vdnCustomEndpoint.constructor===Array&&1==vdnCustomEndpoint.length&&(vdnCustomEndpoint=null),vdnTypeOfSearch="undefined"!=typeof vdnTypeOfSearch&&null!==vdnTypeOfSearch?vdnTypeOfSearch:"native";let vdnMale=!1===vdnVoiceType.female;function vdnGetCookie(e=null){try{if(null==e)return"";let n=e+"=",t=decodeURIComponent(document.cookie).split(";"),o=t.length;for(let e=0;e<o;e++){let o=t[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(n))return o.substring(n.length,o.length)}}catch(e){console.log("Something went wrong while getting cookie.")}return""}function vdnIsCustomDialogOpted(){let e=!1;try{"custom"==vdnTypeOfDialog&&null!==vdnCustomEndpoint&&0!=vdnCustomEndpoint.length&&(e=!0)}catch(e){console.log("Something went wrong while checking preference of dialog type.")}return e}function vdnCheckAndGetIntentFromSettings(e,n=null,t=null){let o=null,i={description:vdnMessages.unableToProcess,url:"",enabled:!1};o=i;try{if(void 0!==n&&null!=n&&(i.description=n),void 0!==t&&null!=t&&0!=t.length&&(t=i.url=t.trim()),0==vdnIsCustomDialogOpted()&&void 0!==e&&0!=e.length&&null!=vdnSettingsData&&e in vdnSettingsData){let n=vdnSettingsData[e],t="response"in n?n.response:null,o="url"in n?n.url:"";void 0!==t&&null!=t&&0!=t.length&&(i.description=t),void 0!==o&&null!=o&&0!=o.length&&(i.url=o.trim());let l=!1;if("enabled"in n){let e=n.enabled;l=!0===(l=null!=e)&&"enabled"==e.trim()}i.enabled=l}1==vdnIsCustomDialogOpted()&&(i.enabled=!0)}catch(e){i=o,console.log("Something went wrong while checking settings:"+e.message)}return new RegExp("^([a-z]+://|//)","i").test(i.url)||(0===i.url.indexOf("www.")?i.url="http://"+i.url:(i.url="/"==i.url.charAt(0)?i.url:"/"+i.url,i.url=vdnGetCurrentHostURL()+i.url)),i.description=i.description.trim(),i}function vdnStt(e,n,t){if(0==n){let e=Math.floor(10*Math.random()),n=vdnAlternativeResponse.randomLib;0==vdnRespTimeOut&&(vdnIntentResponsePlayer.configure(n[e]),vdnIntentResponsePlayer.play(),vdnRespTimeOut=!0,setTimeout(function(){vdnRespTimeOut=!1},6e3))}let o=vdnWebSocketUrl.url+vdnWebSocketUrl.tokenQs+vdnServiceKeys.iSTT+vdnWebSocketUrl.otherQs,i=new WebSocket(o);i.onopen=function(n){i.send(JSON.stringify({action:"start","content-type":"audio/wav",interim_results:!1,max_alternatives:3,smart_formatting:!0})),i.send(e),i.send(JSON.stringify({action:"stop"})),vdnLogServiceCall()},i.onclose=function(e){},i.onmessage=function(e){!function(e){let n=JSON.parse(e.data);if(null!=n.results){let e="",o=!1;for(let t in n.results)1==n.results[t].final&&(e+=n.results[t].alternatives[0].transcript,o=!0);vdnErrcnt=0,1!=o&&0!=n.results.length||("function"==typeof t&&t(e),i.close())}}(e)},i.onerror=function(n){!function(n){if(vdnErrcnt++,i.close(),"undefined"==typeof vdnXApiKey||null===vdnXApiKey)return;vdnErrcnt<2&&vdnRefreshVoiceServicesKeys().then(function(n){vdnServiceKeys.iSTT=n,vdnStt(e,!0,t)}).catch(function(e){alert(e)})}()}}function vdnLogWithGoogleAnalytics(e,n){try{if("undefined"==typeof vdnGaTrack||null==vdnGaTrack)return;if("yes"==vdnGaTrack){let t=!1,o="Voice Dialog Navigation - Conversation Log",i="[ USER QUERY:- "+e+" ] [ SIMON RESPONSE:- "+n+" ]";if(vdnIsGtmPresent&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"VoiceDialogNavigation-QueryResponse",vdnQueryResponse:i}),t=!0),!vdnGoogleAnalyticsTrackingId||-1===vdnGoogleAnalyticsTrackingId.indexOf("UA-"))throw"Unable to send VDN conversation log to Google Analytics due to unavaibility of the Google Analytics tracking Id.";if(!t&&"function"==typeof gtag&&vdnGtagConfigCount>0&&!0===vdnGaConfiguredForGtag){let e={event_category:o};if(vdnGtagConfigCount>1){if(!vdnGoogleAnalyticsTrackingId)throw'Multiple "gtag" configurations detected but Google Analytics tracking id is missing.';e.send_to=vdnGoogleAnalyticsTrackingId}gtag("event",i,e),t=!0}if(t||"function"!=typeof ga||(ga("send","event",o,i),t=!0),!t)throw"Supported Google Analytics library not available."}}catch(e){let n="string"==typeof e?e:e.message;console.log("VDN Google Analytics Log Process Error: "+n)}}function vdnSendDialog(e,n,t=null){if("undefined"==typeof vdnXApiKey||null===vdnXApiKey)return;if(void 0===e||null==e||""==e.trim())return;let o=window.location.href;console.log("Will send the URL: "+o+" to SimonAI as base URL"),vdnMyStatus.cUrl=o;let i={msg:e,context:vdnMyContext,status:vdnMyStatus};function l(n){try{null!==t&&(t.userMsgEl.innerHTML=e,t.simonMsgEl.innerHTML=n,t.userMsgElWrapper.appendChild(t.userMsgEl),t.chatConvoEl.appendChild(t.userMsgElWrapper),t.chatConvoEl.appendChild(t.simonMsgEl),void 0!==t.chatConvoEl.scrollTop&&void 0!==t.chatConvoEl.scrollHeight&&(t.chatConvoEl.scrollTop=t.chatConvoEl.scrollHeight),t.expandCollapseHandle())}catch(e){}}let s=JSON.stringify(i,null,!0),r=new XMLHttpRequest,a=((new Date).getTime(),{userQuery:"",simonResponse:""});r.onreadystatechange=function(){if(4==this.readyState&&200==this.status){var t=JSON.parse(this.responseText);if(void 0===t||!t)return void n(vdnAlternativeResponse.unableToProcess);t.description="undefined"!=t.description?t.description:"",t.url="undefined"!=t.url?t.url:"",vdnLogWithGoogleAnalytics(e,t.description),null!=typeof t.status&&(vdnMyStatus=t.status),null!=typeof t.context&&(vdnMyContext=t.context);let i=void 0!==vdnMyStatus.intent?vdnMyStatus.intent:null,s=vdnCheckAndGetIntentFromSettings(i,t.description,t.url.toLowerCase());if(t.description=s.description,t.url=s.url,0==s.enabled){n(vdnAlternativeResponse.disabledIntentResponse,null,!0);let t=vdnMessages.traditionalSearch;return l(t),a.userQuery=e,a.simonResponse=t,void localStorage.setItem("vdnWidgetConversation",JSON.stringify(a,null,!0))}if(t.description){let s=vdnAlternativeResponse.defaultDesc;if(vdnIsCustomDialogOpted()){let e=vdnGetExistingCustomDialogResponse(vdnVoiceAndLanguage,t.description);e?(s=void 0!==e.path&&e.path?e.path:vdnAlternativeResponse.defaultDesc,o()):vdnCustomDialogTtsOnTheFly(t.description).then(function(e){e&&(s=void 0!==e.path&&e.path?e.path:vdnAlternativeResponse.defaultDesc),o()}).catch(function(e){console.log("VDN Error: Something went wrong while TTS process for custom dialog."),o()})}else{let e=vdnGetGenericDialog(vdnVoiceAndLanguage,i),n=e.dialog,t=e.generateAudio;if(n&&!0===t){let e="option_name"in n&&n.option_name?n.option_name:null,t="response"in n&&n.response?n.response:null;t&&e&&vdnGenericDialogTtsOnTheFly(t,e).then(function(e){s=void 0!==e&&void 0!==e.path?e.path:vdnAlternativeResponse.defaultDesc,o()}).catch(function(e){console.log("VDN Error: Something went wrong while TTS process for generic dialog."),o()})}else{let e=n&&void 0!==n.intent_audio_response?n.intent_audio_response:{},t="path"in e&&e.path?e.path:null;t&&(s=t),o()}}function o(){if(l(t.description),a.userQuery=e,a.simonResponse=t.description,localStorage.setItem("vdnWidgetConversation",JSON.stringify(a,null,!0)),vdnClientInfo.ios||vdnClientInfo.android&&vdnClientInfo.firefox||vdnClientInfo.safari&&!vdnClientInfo.chrome&&!vdnClientInfo.firefox||vdnClientInfo.windows&&vdnClientInfo.firefox)n(s,function(){null==t.url||""==t.url||vdnUrlPointsToCurrentPage(t.url)?localStorage.removeItem("vdnWidgetConversation"):location.assign(t.url)});else if(null!=t.url&&""!=t.url){let e=vdnUrlIsPartOfCurrentDomain(t.url.toLowerCase());if(null==e)return n(s),localStorage.removeItem("vdnWidgetConversation"),void alert(vdnMessages.pageUnavailable);if(0==e){try{-1!=vdnWin1&&vdnWin1.close()}catch(e){console.log("We had an error. Error "+e.message)}vdnWin1=window.open(t.url,t.url),n(s),localStorage.removeItem("vdnWidgetConversation")}else{t.description;!function e(t){var o=null;if(vdnUrlPointsToCurrentPage(t))return n(s),void localStorage.removeItem("vdnWidgetConversation");let i=t,l=i.indexOf("#"),r=!1;if(l>-1&&(vdnUrlPointsToCurrentPage(i=i.substring(0,l))?console.log("We need to navigate within the same page"):r=!0),-1==t.indexOf("#")||1==r){if(!0===vdnIsTalking)return void(o=setTimeout(function(){e(t),clearInterval(o)},500));localStorage.setItem("vdnPendingPlaybackPath",s),localStorage.setItem("vdnCtx",JSON.stringify(vdnMyContext,null,!0)),localStorage.setItem("vdnStat",JSON.stringify(vdnMyStatus,null,!0)),void 0!==o&&null!=o&&clearInterval(o)}else n(s),localStorage.removeItem("vdnWidgetConversation");location.assign(t)}(t.url.trim())}}else n(s),localStorage.removeItem("vdnWidgetConversation");if(null!=t.url2&&""!=t.url2){try{-1!=vdnWin2&&vdnWin2.close()}catch(e){console.log("We had an error. Error "+e.message)}vdnWin2=window.open(t.url2,t.url2),localStorage.removeItem("vdnWidgetConversation")}}}}else 4==this.readyState&&200!=this.status&&vdnLogWithGoogleAnalytics(e,vdnMessages.callFailed)};try{var d=vdnSendDialogApiUrl;vdnIsCustomDialogOpted()&&(d=vdnCustomEndpoint),r.open("POST",d,!0),r.setRequestHeader("Accept","application/json"),r.setRequestHeader("Content-type","application/json"),r.setRequestHeader("Access-Control-Allow-Origin","*"),r.setRequestHeader("x-api-key",vdnXApiKey),r.send(s)}catch(e){return console.log("We had an error. Error:"+e.message),void localStorage.removeItem("vdnWidgetConversation")}}function vdnGetCurrentHostURL(){var e=null;try{if(void 0===window.location||void 0===window.location.hostname||void 0===window.location.protocol)return vdnGetHostName();e=window.location.protocol+"//"+window.location.hostname}catch(n){e=vdnGetHostName(),console.log("Something went wrong while discovering current domain.")}return e}function vdnGetHostName(){return vdnHostName}function vdnUrlIsPartOfCurrentDomain(e){let n=!1;try{if(null==e)return null;let t="";0===e.indexOf("http://")?t="http://":0===e.indexOf("https://")&&(t="https://");let o=0==t.length?0:t.length,i=e.substring(o),l=i.indexOf("/"),s=i;-1!=l&&(s=i.substring(0,l)),0===(s=t+s).indexOf(vdnGetCurrentHostURL())&&(n=!0)}catch(e){n=null,console.log("Something went wrong while checking URL.")}return n}function vdnUrlPointsToCurrentPage(e=null){var n=!1;try{if(null==e)return!0;var t=window.location.href;e=e.trim();var o=t[t.length-1];o="/"==o?o:null,0!=e.length&&e.indexOf("/")==e.length-1&&void 0!==o&&"/"!=o&&(t+="/"),t==e&&(n=!0)}catch(e){n=!0,console.log("Something went wrong while getting current full URL.")}return n}function vdnLogServiceCall(e=0){try{let n=new XMLHttpRequest;n.onreadystatechange=function(){if(4==this.readyState&&200==this.status){let e=JSON.parse(this.responseText);vdnServiceLogs.updatedAt=e.updatedAt||vdnServiceLogs.updatedAt,vdnServiceLogs.currentValue=e.currentValue||vdnServiceLogs.currentValue,vdnServiceLogs.lastValue=e.lastValue||vdnServiceLogs.lastValue}},n.open("POST",vdnAjaxObj.ajax_url,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.send("action=vdn_log_service_call&_ajax_nonce="+vdnAjaxObj.nonce+"&updateLastValue="+e)}catch(e){}}function vdnRefreshVoiceServicesKeys(){return new Promise(function(e,n){let t=new XMLHttpRequest;t.onreadystatechange=function(){if(4==this.readyState)if(200===this.status){let t=JSON.parse(this.response),o=void 0!==t.token?t.token:null;o?e(o):n(vdnErrorLibrary.outOfService)}else n(vdnErrorLibrary.outOfService)};let o="?action=vdn_refresh_access_keys&_ajax_nonce="+vdnAjaxObj.keys_nonce;t.open("GET",vdnAjaxObj.ajax_url+o,!0),t.onerror=function(e){n(vdnErrorLibrary.outOfService)},t.send(null)})}function vdnFormatEmail(e=null){let n=e;try{if(e&&null!==e){let t=e.toLowerCase();n=t=t.replace(/dot/gi,".").replace(/at/gi,"@").replace(/underscore/gi,"_").replace(/dotcom/gi,".com").replace(/dotorg/gi,".org").replace(/dotnet/gi,".net").replace(/dotint/gi,".int").replace(/dotedu/gi,".edu").replace(/ /g,"")}}catch(t){n=e}return n}function vdnGetExistingCustomDialogResponse(e,n){let t=null;try{if("undefined"!=typeof vdnCustomResponses&&vdnCustomResponses&&void 0!==e&&e){let o=vdnCustomResponses.length;e=e.trim(),n=n.trim();for(let i=0;i<o;i++){let o=vdnCustomResponses[i],l=void 0!==o.response&&o.response?o.response.trim():null,s=void 0!==o.voice&&o.voice?o.voice.trim():null;if(l&&s&&(l===n&&e===s)){t=JSON.parse(JSON.stringify(o));break}}}}catch(e){t=null}return t}function vdnGetGenericDialog(e,n){this.existingDialog={dialog:{},generateAudio:!1};try{if(!(void 0!==vdnSettingsData&&vdnSettingsData&&void 0!==e&&e&&void 0!==n&&n))throw"VDN Error: Settings data or parameters are missing while checking generic dialog existence.";if(this.selectedVoice=e.trim(),this.intentName=n.trim(),this.dialog=this.intentName in vdnSettingsData?vdnSettingsData[this.intentName]:{},!(this.dialog&&Object.keys(this.dialog).length>0))throw"VDN Error: Dialog is missing while checking generic dialog existence.";this.existingDialog.dialog=JSON.parse(JSON.stringify(this.dialog));let t="response"in this.dialog&&this.dialog.response?this.dialog.response.trim():null,o="enabled"in this.dialog&&this.dialog.enabled?this.dialog.enabled.trim():null,i="intent_audio_response"in this.dialog&&this.dialog.intent_audio_response?this.dialog.intent_audio_response:{},l="voice"in i&&i.voice?i.voice.trim():null,s="path"in i&&i.path?i.path.trim():null;void 0===t||!t||void 0===o||!o||"enabled"!==o||void 0!==s&&s&&void 0!==l&&l&&l===this.selectedVoice||(this.existingDialog.generateAudio=!0)}catch(e){this.existingDialog={dialog:{},generateAudio:!1}}return this.existingDialog}function vdnCustomDialogTtsOnTheFly(e){return new Promise(function(n,t){if(void 0===e||!e)return void t(null);let o=new FormData;o.append("response_text",e),o.append("action","vdn_custom_dialog_text_to_speech"),o.append("_ajax_nonce",vdnAjaxObj.custom_dialog_nonce);let i=new XMLHttpRequest;i.onreadystatechange=function(){if(4==this.readyState)if(200===this.status){let e=JSON.parse(this.response),o=void 0!==e.success&&!0===e.success,i=void 0!==e.data?e.data:null;if(i&&o){let e=void 0!==i.updated_collection?i.updated_collection:null,o=void 0!==i.custom_response?i.custom_response:null;e&&o?(vdnCustomResponses=e,n(o)):t(null)}else t(null)}else t(null)},i.onerror=function(e){t(vdnErrorLibrary.outOfService)};vdnAjaxObj.custom_dialog_nonce;i.open("POST",vdnAjaxObj.ajax_url,!0),i.send(o)})}function vdnGenericDialogTtsOnTheFly(e,n){return new Promise(function(t,o){if(void 0===e||!e||void 0===n||!n)return void o(null);let i=new FormData;i.append("dialog_text",e),i.append("dialog_op_name",n),i.append("user","tts"),i.append("action","vdn_generic_dialog_tts_on_the_fly"),i.append("_ajax_nonce",vdnAjaxObj.generic_dialog_nonce);let l=new XMLHttpRequest;l.onreadystatechange=function(){if(4==this.readyState)if(200===this.status){let e=JSON.parse(this.response),n=void 0!==e.success&&!0===e.success,i=void 0!==e.data?e.data:null;if(i&&n)if(void 0!==i.path&&i.path){let e=void 0!==i.updated_generic_dialogs?i.updated_generic_dialogs:null;e&&Object.keys(e).length>0&&(vdnSettingsData=e),t(i)}else o(null);else o(null)}else o(null)},l.onerror=function(e){o(vdnErrorLibrary.outOfService)},l.open("POST",vdnAjaxObj.ajax_url,!0),l.send(i)})} -
voice-dialog-navigation/trunk/js/voice-dialog-navigation.js
r2270015 r2319166 8 8 //****************************************************************************************************** 9 9 10 10 window.onload = (event) => { 11 11 (function () { 12 12 'use strict'; … … 224 224 speechInputWrapperStyle = (havingInlineStyle) ? speechInputWrapperStyle + ';' : ''; 225 225 speechInputWrapper.setAttribute('style', speechInputWrapperStyle + 'display: block !important'); 226 speechInputWrapper.classList.add('voice-dialog-navigation-wrapper');226 //speechInputWrapper.classList.add('voice-dialog-navigation-wrapper'); 227 227 speechInputWrapper.classList.add('vdn-sanitize-form-wrapper'); 228 228 … … 231 231 let roleOfForm = speechInputWrapper.getAttribute('role') || ""; 232 232 let classesOfForm = speechInputWrapper.classList || ""; 233 let allInputElements = speechInputWrapper.querySelectorAll('input:not([type=hidden]):not([id=vdnWidgetSearch]) , button[type=submit], textarea');233 let allInputElements = speechInputWrapper.querySelectorAll('input:not([type=hidden]):not([id=vdnWidgetSearch]):not([style*="none"]), button[type=submit], textarea.note'); 234 234 235 235 if (roleOfForm.toLowerCase() === 'search' || classesOfForm.contains('searchform') … … 439 439 // Create Wrapper to wrap around input search field like a elastic band 440 440 let wrapper = document.createElement('div'); 441 wrapper.setAttribute('style', speechInputWrapperStyle + 'display: inline-block !important'); 442 441 443 let inputCurrentStyle = window.getComputedStyle(inputEl); 442 444 wrapper.setAttribute('class', 'vd-navigation-mic-band'); … … 463 465 // Place mic button/icon exact before search input field element 464 466 inputEl.insertAdjacentElement('beforebegin', micBtn); 467 inputEl.setAttribute('style', speechInputWrapperStyle + 'width: 100% !important'); 468 465 469 inputEl.classList.add('vd-navigation-mic-band'); 466 470 … … 1619 1623 } 1620 1624 })(); 1625 }; -
voice-dialog-navigation/trunk/js/voice-dialog-navigation.min.js
r2270015 r2319166 1 !function(){"use strict";let e="undefined"!=typeof vdnDisableSearchMic&&"1"==vdnDisableSearchMic,t="undefined"!=typeof vdnDisableFormsMic&&"1"==vdnDisableFormsMic;function n(){try{window.vdnMicTimeoutIdentifier&&(clearTimeout(window.vdnMicTimeoutIdentifier),window.vdnMicTimeoutIdentifier=null)}catch(e){}}function i(){try{if(!1===vdnClientInfo.ios)return!1;window.vdnIosMicTimeoutIdentifier&&(clearTimeout(window.vdnIosMicTimeoutIdentifier),window.vdnIosMicTimeoutIdentifier=null)}catch(e){}}function d(e,t,n=!1){try{let i=e.classList||null,d=t.classList||null;if(!i||!d)return!1;!0===n?(i.add("vdn-hide-element"),d.remove("vdn-hide-element")):(i.remove("vdn-hide-element"),d.add("vdn-hide-element"))}catch(e){}}n(),i(),vdnTypeOfSearch="undefined"!=typeof vdnTypeOfSearch&&null!==vdnTypeOfSearch?vdnTypeOfSearch:"native";let o=["Ask about our company","Ask for opening hours"];vdnSearchableHints="undefined"!=typeof vdnSearchableHints&&null!==vdnSearchableHints?vdnSearchableHints:o,vdnSearchableHints.constructor!==Array&&(vdnSearchableHints=[]),0==vdnSearchableHints.length&&(vdnSearchableHints=o);let l=null,s=2e4;function r(e){return e=parseInt(e,10),isNaN(e)||null==e?0:e}function a(e=null,t=null){let n=!1;try{let i=document.querySelectorAll("button.voice-dialog-navigation-button");if(null==i||null==e)return n;let d=i.length;for(let t=0;t<d;t++){let d=i[t].className,o=i[t].getAttribute("id");if(void 0!==d&&""!=d.trim()&&(-1!=d.indexOf("listening")&&e!=o)){n=!0;break}}if(0==n&&null===t){let e=document.querySelector("#vdnWidgetMic");null!==e&&-1!=e.className.indexOf("listening")&&(n=!0)}}catch(e){n=!1}return n}function c(){let e="Ask about us.";try{let t=vdnSearchableHints.length,n=Math.floor(Math.random()*t),i=vdnSearchableHints[n];void 0!==i&&""!=i.trim()&&(e=i)}catch(t){e="Ask about us."}return e}"undefined"!=typeof vdnMicListenTimeoutDuration&&null!==vdnMicListenTimeoutDuration?(l=parseInt(vdnMicListenTimeoutDuration),l=isNaN(l)?8:l):l=8,l=(l=l<8?8:l)>20?20:l,l*=1e3;let v=document.querySelector("div#search-outer form input[type=text]"),u=document.querySelector("div#mobile-menu form input[type=text]");null!==v&&v.setAttribute("data-vdn-top-search-bar","true"),null!==u&&u.setAttribute("data-vdn-mobile-search-bar","true");let p=document.querySelectorAll("form"),g=["text","email","search"],m=null,f=null;[].forEach.call(p,function(o,v){try{let p=o.getAttribute("style"),h=null!=p&&""!=p.trim();p=h?p+";":"",o.setAttribute("style",p+"display: block !important"),o.classList.add("voice-dialog-navigation-wrapper"),o.classList.add("vdn-sanitize-form-wrapper");let b=!1;var u=!1;let y=o.getAttribute("role")||"",w=o.classList||"",A=o.querySelectorAll("input:not([type=hidden]):not([id=vdnWidgetSearch]), button[type=submit], textarea");("search"===y.toLowerCase()||w.contains("searchform")||w.contains("search_form")||w.contains("search-form")||w.contains("searchForm"))&&(b=!0),b&&!m&&(m=o),[].forEach.call(A,function(m,h){let y=null,w=m.getAttribute("type")||"",A=m.className||"",I=m.getAttribute("id")||null,R=m.tagName;I&&null!==I&&(I=I.toLowerCase()),A&&null!==A&&(A=A.toLowerCase());let C=!1;-1===A.indexOf("datepicker")&&-1===A.indexOf("date")&&"datepicker"!==I&&"date"!==I||(C=!0),-1===A.indexOf("datepicker")&&"datepicker"!==I&&-1!==A.search(/validat|candidat/gi)&&(C=!1),"text"===w&&-1!==A.search(/email/gi)&&(w="email");let P="textarea"===R.toLowerCase();if(g.includes(w)&&0==C||1==P)y=m;else if(!("submit"!=w.toLowerCase()||e&&t)){if(b&&!e){let e=m.querySelectorAll("img, svg");for(let t=0;t<e.length;t++){e[t].classList.add("vdn-hide-element")}}o.addEventListener("submit",function(t){if(1==u)return t.preventDefault(),!1;if(!0===b&&!e)try{if("native"!=vdnTypeOfSearch){if(t.preventDefault(),"undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),vdnIntentResponsePlayer.play(),!1;if(!vdnClientInfo.android){vdnIntentResponsePlayer.configure(vdnAlternativeResponse.basic),vdnIntentResponsePlayer.play();let e=this.querySelector("input.vd-navigation-mic-band"),t=e?e.value:"";vdnSendDialog(t,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{o.submit()}catch(e){console.log("VDN: Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()})}}}catch(e){console.log("VDN Exception: Unable to submit the form due to: "+e.message)}},!1)}if(null===y)return!0;if(b){if(f||(f=y),e)return!1}else if(t)return!1;let L=document.createElement("button");L.setAttribute("type","button"),L.setAttribute("class","voice-dialog-navigation-button"),L.setAttribute("id","voice-dialog-navigation-button"+v+h);let M=document.createElement("img");M.setAttribute("src",vdnImagesPath+"vdn-mic.svg"),M.setAttribute("class","vdn-mic-image"),M.setAttribute("id","vdn-mic-img"+v+h),L.appendChild(M);let S=document.createElement("img");!0===vdnClientInfo.ios&&(S.setAttribute("src",vdnImagesPath+"vdn-mic-stop.svg"),S.setAttribute("class","vdn-stop-alert vdn-hide-element"),S.setAttribute("id","vdn-mic-stop"+v+h),L.appendChild(S));let T=r(y.offsetHeight),E=y.getAttribute("data-vdn-top-search-bar"),x=y.getAttribute("data-vdn-mobile-search-bar"),k=!1,H=!1;null!=E&&""!=E.trim()&&(k=!0,0==T&&(T=59)),null!=x&&""!=x.trim()&&(H=!0);let D=r(.8*T);0==r(D)&&(T=D=35);let N=r(.1*T);1!=H&&1!=k||(N+=20),!0===P&&(N=10,D=35);let W="top: "+N+"px; ";W+="height: "+D+"px !important; ",W+="width: "+D+"px !important; ",W+="z-index: 999 !important; margin-left: 3px !important; border-radius: 50% !important; border: 2px solid #ffff !important;",L.setAttribute("style",W);let O=document.createElement("div"),K=window.getComputedStyle(y);O.setAttribute("class","vd-navigation-mic-band"),O.setAttribute("onclick","return false"),O.style.width=K.width,y.insertAdjacentElement("beforebegin",O);let X=y.parentNode.nodeName;null!=X&&0!=X.length&&"form"!=(X=X.toLowerCase())&&(y.parentNode.style.zIndex=1),O.appendChild(y),y.insertAdjacentElement("beforebegin",L),y.classList.add("vd-navigation-mic-band"),o.setAttribute("style",p);let q,F="";if(1==k&&L.addEventListener("mousedown",function(e){return e.preventDefault(),!0},!1),"webkitSpeechRecognition"in window){let e=new webkitSpeechRecognition;function V(){if(u=!1,!q)if(L.classList.remove("listening"),L.style.setProperty("color","white"),!0===b){let t=Math.floor(10*Math.random()),n=vdnAlternativeResponse.randomLib;vdnIntentResponsePlayer.configure(n[t],function(){e()}),vdnIntentResponsePlayer.play()}else e();function e(){if(void 0!==F&&0!=F.length){let e=F;"email"===w&&(e=vdnFormatEmail(e));let t=e&&null!==e?e:F;!0===P?y.value+=" "+t:y.value=t,!0===b&&vdnSendDialog(F,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{o.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()})}else y.placeholder=vdnMessages.ask}}e.continuous=!0,e.interimResults=!0,e.onstart=function(){u=!0},e.onerror=function(e){L.classList.remove("listening"),u=!1,"no-speech"==e.error&&(y.placeholder=vdnMessages.unableToHear,vdnIntentResponsePlayer.configure(vdnAlternativeResponse.notAudible),vdnIntentResponsePlayer.play(),q=!0),"audio-capture"==e.error&&(y.placeholder=vdnMessages.micNotAccessible,q=!0),"not-allowed"==e.error&&(y.placeholder=vdnMessages.browserDenyMicAccess,L.style.setProperty("color","white"),q=!0)},e.onend=function(){vdnClientInfo.android&&V()},e.onresult=function(t){let n="";if(void 0===t.results)return e.onend=null,e.stop(),y.placeholder=vdnMessages.unableToHear,vdnIntentResponsePlayer.configure(vdnAlternativeResponse.micConnect),void vdnIntentResponsePlayer.play();let i=t.results.length;for(let d=t.resultIndex;d<i;++d)t.results[d].isFinal?(F=t.results[d][0].transcript,0==vdnClientInfo.android&&(V(),e.stop())):!1===P&&(n+=t.results[d][0].transcript,y.value=n)},L.addEventListener("click",function(t){if(!0!==a(L.getAttribute("id")))return"undefined"==typeof vdnXApiKey||null===vdnXApiKey?(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),void vdnIntentResponsePlayer.play()):void(u?(n(),!0===b&&(y.placeholder=c()),0==vdnClientInfo.android&&(V(),e.stop())):(!0===b&&(y.placeholder=c()),L.classList.add("listening"),t.preventDefault(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),F="",!1===P&&(y.value=""),u=!0,e.lang=vdnSelectedLang,e.start(),q=!1,n(),window.vdnMicTimeoutIdentifier=setTimeout(function(){let e=L.classList;e&&e.contains("listening")&&L.click()},"textarea"==y.tagName.toLowerCase()?s:l)))})}else L.addEventListener("click",function(e){function t(){if("undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),vdnIntentResponsePlayer.play(),!1;if(u){if(n(),!0===vdnClientInfo.ios){i(),M.classList.contains("vdn-hide-element")&&d(M,S)}return vdnAudioRecorder.stop(),vdnStopAudio(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),L.classList.remove("listening"),L.style.setProperty("color","white"),y.placeholder=vdnMessages.transcribeText,vdnAudioRecorder.getBuffers(function(e){vdnAudioRecorder.exportWAV(function(e){vdnRecIndex++,vdnStt(e,!1,function(e){if(void 0!==e&&0!=e.length){let t=e;"email"===w&&(t=vdnFormatEmail(t));let n=t&&null!==t?t:e;!0===P?y.value+=" "+n:y.value=n,!0===b&&vdnSendDialog(e,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{o.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()})}else vdnIntentResponsePlayer.configure(vdnAlternativeResponse.notAudible),vdnIntentResponsePlayer.play(),y.placeholder=vdnMessages.ask})})}),void(u=!1)}if(!0===b&&(y.placeholder=c()),L.classList.add("listening"),e.preventDefault(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),F="",!1===P&&(y.value=""),u=!0,vdnAudioRecorder.clear(),vdnAudioRecorder.record(L,y.tagName),!0===vdnClientInfo.ios){i(),M.classList.contains("vdn-hide-element")||(window.vdnIosMicTimeoutIdentifier=setTimeout(function(){d(M,S,!0)},4e3))}n(),window.vdnMicTimeoutIdentifier=setTimeout(function(){let e=L.classList;e&&e.contains("listening")&&L.click()},"textarea"==y.tagName.toLowerCase()?s:l)}(!0===vdnClientInfo.ios||vdnClientInfo.safari&&!vdnClientInfo.chrome&&!vdnClientInfo.firefox||vdnClientInfo.windows&&vdnClientInfo.firefox)&&(vdnIntentResponsePlayer.configure(vdnSilenceSoundPath),vdnIntentResponsePlayer.play()),!0!==a(L.getAttribute("id"))&&(vdnAudioRecorder&&vdnAudioContext?t():vdnInitAudio(function(e){if(!vdnAudioRecorder||!vdnAudioContext)return alert(vdnMessages.micNotAccessible),!1;t()}))},!1);L.addEventListener("mouseover",function(e){!0===b&&(L.title=c())})})}catch(e){}});let h=document.createElement("div"),b="vdn-widget-wrapper-middle-right",y="vdn-widget-chat-wrapper-middle-right",w=vdnSelectedMicPosition?vdnSelectedMicPosition.toLowerCase():"middle right",A="vdn-widget-chat-wrapper-middle-right-collapse";switch(w){case"middle left":b="vdn-widget-wrapper-middle-left",y="vdn-widget-chat-wrapper-middle-left",A="vdn-widget-chat-wrapper-middle-left-collapse";break;case"top right":b="vdn-widget-wrapper-top-right",y="vdn-widget-chat-wrapper-top-right",A="vdn-widget-chat-wrapper-top-right-collapse";break;case"top left":b="vdn-widget-wrapper-top-left",y="vdn-widget-chat-wrapper-top-left",A="vdn-widget-chat-wrapper-top-left-collapse";break;case"bottom right":b="vdn-widget-wrapper-bottom-right",y="vdn-widget-chat-wrapper-bottom-right",A="vdn-widget-chat-wrapper-bottom-right-collapse";break;case"bottom left":b="vdn-widget-wrapper-bottom-left",y="vdn-widget-chat-wrapper-bottom-left",A="vdn-widget-chat-wrapper-bottom-left-collapse";break;default:b="vdn-widget-wrapper-middle-right",y="vdn-widget-chat-wrapper-middle-right",A="vdn-widget-chat-wrapper-middle-right-collapse"}h.setAttribute("class","vdn-widget-wrapper "+b);let I=document.createElement("div");I.setAttribute("class","vdn-widget-chat-wrapper "+A);let R=document.createElement("div");R.setAttribute("class","vdn-widget-chat-header");let C=document.createElement("div"),P=vdnVoiceType.female?"Simone":"Simon";C.setAttribute("class","vdn-widget-chat-option"),C.innerHTML='<div><img class="vdn-widget-chat-option-bot-icon" src="'+vdnImagesPath+'Voice Assistant Bot Icon.png"/></div><span class="vdn-widget-agent-name">'+P+'</b></span><br><span class="vdn-widget-agent">Web Virtual Assistant</span>';let L=document.createElement("span");L.setAttribute("class","vdn-expand-window vdn-expand-collapse-handle"),L.addEventListener("click",function(){ee()},!1),C.appendChild(L),R.appendChild(C);let M=document.createElement("div");M.setAttribute("id","vdnWidgetChatConvo"),M.setAttribute("class","vdn-widget-chat-convo vdn-hide-element");let S=document.createElement("span");S.setAttribute("class","vdn-widget-chat-msg-item vdn-widget-chat-msg-item-user");let T=document.createElement("div");T.setAttribute("class","vdn-widget-chat-avatar"),T.innerHTML="<center><b>"+vdnWidgetMessages.you+"</b></center>",S.appendChild(T);let E=document.createElement("span");S.appendChild(E);let x=document.createElement("span");x.setAttribute("class","vdn-widget-chat-msg-item vdn-widget-chat-msg-item-simon");let k=document.createElement("span");k.setAttribute("class","vdn-widget-chat-msg-item vdn-widget-chat-msg-error");let H=(vdnVoiceType.female?vdnWidgetMessages.simonIntro.name+"e":vdnWidgetMessages.simonIntro.name)+vdnWidgetMessages.simonIntro.intro+"<br/><br/>",D=vdnWidgetMessages.simonGuidelines,N=document.createElement("span");N.setAttribute("class","vdn-widget-chat-msg-item vdn-widget-chat-msg-item-simon"),N.innerHTML=H+D,M.appendChild(N);let W=document.createElement("div");W.setAttribute("class","vdn-widget-field");let O=document.createElement("a");O.setAttribute("id","vdnWidgetMic"),O.setAttribute("class","vdn-widget-button");let K=document.createElement("img");K.setAttribute("id","vdn-widget-mic-img"),K.setAttribute("src",vdnImagesPath+"vdn-widget-mic-black.svg"),O.appendChild(K);let X=document.createElement("img");!0===vdnClientInfo.ios&&(X.setAttribute("src",vdnImagesPath+"vdn-mic-stop.svg"),X.setAttribute("class","vdn-stop-alert vdn-hide-element"),X.setAttribute("id","vdn-mic-stop"),O.appendChild(X));let q=document.createElement("a");q.setAttribute("id","vdnWidgetSearchBtn");let F=document.createElement("button");F.setAttribute("class","vdn-widget-form-submit-btn"),F.setAttribute("type","submit"),F.setAttribute("alt","Go"),F.setAttribute("title","Search"),q.appendChild(F);let V=document.createElement("form");V.setAttribute("class","vdn-widget-form"),null!==m?(V.action=m.action,V.method=m.method):(V.action=vdnGetCurrentHostURL()+"/",V.method="get");let B=document.createElement("input");B.setAttribute("id","vdnWidgetSearch"),B.setAttribute("class","vdn-widget-search vdn-widget-search-text"),B.setAttribute("name","vdn-widget-search"),B.setAttribute("placeholder",vdnWidgetMessages.placeholder),B.setAttribute("name","s"),V.addEventListener("submit",function(e){try{M.removeChild(S)}catch(e){}try{M.removeChild(x)}catch(e){}try{M.removeChild(k)}catch(e){}if("native"!=vdnTypeOfSearch){if(e.preventDefault(),"undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),vdnIntentResponsePlayer.play(),!1;0!=B.value.length&&(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.basic),vdnIntentResponsePlayer.play(),vdnSendDialog(B.value,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{V.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()},Z()))}},!1),V.appendChild(B),V.appendChild(q),W.appendChild(O),W.appendChild(V),I.appendChild(R),I.appendChild(M),I.appendChild(W);let j=document.createElement("a");j.setAttribute("id","vdnWidgetToggleButton"),j.setAttribute("class","vdn-widget-button vdn-blink-widget-toggle-button");let z=vdnFloatingButtonIcon&&"robotIcon"==vdnFloatingButtonIcon?"vdn-toggle-btn-robot":"vdn-toggle-btn-mic",G=document.createElement("div");G.setAttribute("class","vdn-widget-icon vdn-widget-toggle-button "+z),j.appendChild(G),h.appendChild(I),h.appendChild(j),document.body.insertAdjacentElement("afterend",h),O.addEventListener("mouseover",function(e){O.title=c()}),j.addEventListener("click",function(e){!function(){null===localStorage.getItem("vdnSimonIntroduced")?(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.simonShortIntro),vdnIntentResponsePlayer.play(),localStorage.setItem("vdnSimonIntroduced","yes")):-1!=G.className.indexOf(z)&&(N.innerHTML=D,void 0!==M.scrollTop&&void 0!==M.scrollHeight&&(M.scrollTop=M.scrollHeight));$(".vdn-widget-toggle-button",z),$(".vdn-widget-toggle-button","vdn-toggle-btn-close"),$(".vdn-widget-toggle-button","vdn-widget-active"),$(".vdn-widget-toggle-button","vdn-widget-visible"),$("#vdnWidgetToggleButton","vdn-widget-float"),$(".vdn-widget-chat-wrapper","vdn-widget-visible"),$(".vdn-widget-button","vdn-widget-visible")}()}),document.body.onload=function(){let e=localStorage.getItem("vdnWidgetConversation");if(null!==e){let t=JSON.parse(e),n=t.userQuery||null,i=t.simonResponse||null;null!==n&&null!==i&&(j.classList.remove("vdn-blink-widget-toggle-button"),E.innerHTML=n,x.innerHTML=i,M.appendChild(S),M.appendChild(x),!1===vdnClientInfo.ios&&j.click()),ee("expand")}localStorage.removeItem("vdnWidgetConversation")};let U,J="",Q=!1,_="";if("webkitSpeechRecognition"in window){let e=new webkitSpeechRecognition;function Y(){if(Q=!1,U)return;J=_,O.classList.remove("listening");let e=Math.floor(10*Math.random()),t=vdnAlternativeResponse.randomLib;vdnIntentResponsePlayer.configure(t[e],function(){void 0!==J&&0!=J.length?(E.innerHTML=J,M.appendChild(S),B.value=J,vdnSendDialog(J,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{V.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()},Z())):B.placeholder=vdnMessages.ask}),vdnIntentResponsePlayer.play()}e.continuous=!0,e.interimResults=!0,e.onstart=function(){Q=!0},e.onerror=function(e){O.classList.remove("listening"),Q=!1,"no-speech"==e.error&&(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.notAudible),vdnIntentResponsePlayer.play(),U=!0,k.innerHTML=vdnMessages.unableToHear,M.appendChild(k)),"audio-capture"==e.error&&(U=!0,k.innerHTML=vdnMessages.micNotAccessible,M.appendChild(k)),"not-allowed"==e.error&&(U=!0,k.innerHTML=vdnMessages.browserDenyMicAccess,M.appendChild(k))},e.onend=function(){vdnClientInfo.android&&Y()},e.onresult=function(t){let n="";if(void 0===t.results)return e.onend=null,e.stop(),B.placeholder=vdnMessages.unableToProcess,vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unableToProcess),void vdnIntentResponsePlayer.play();let i=t.results.length;for(let d=t.resultIndex;d<i;++d)t.results[d].isFinal?(_=t.results[d][0].transcript,0==vdnClientInfo.android&&(Y(),e.stop())):n+=t.results[d][0].transcript},O.addEventListener("click",function(t){if(!0!==a(O.getAttribute("id"),O)){if("undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),void vdnIntentResponsePlayer.play();if(Q)n(),B.placeholder=c(),0==vdnClientInfo.android&&(Y(),e.stop());else{try{M.removeChild(S)}catch(e){}try{M.removeChild(x)}catch(e){}try{M.removeChild(k)}catch(e){}B.placeholder=c(),O.classList.add("listening"),t.preventDefault(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),E.innerHTML=J="",Q=!0,e.lang=vdnSelectedLang,e.start(),U=!1,n(),window.vdnMicTimeoutIdentifier=setTimeout(function(){let e=O.classList;e&&e.contains("listening")&&O.click()},l)}}})}else O.addEventListener("click",function(e){function t(){if("undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),vdnIntentResponsePlayer.play(),!1;if(Q){if(n(),!0===vdnClientInfo.ios){i(),K.classList.contains("vdn-hide-element")&&d(K,X)}return vdnAudioRecorder.stop(),vdnStopAudio(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),O.classList.remove("listening"),B.placeholder=vdnMessages.transcribeText,vdnAudioRecorder.getBuffers(function(e){vdnAudioRecorder.exportWAV(function(e){vdnRecIndex++,vdnStt(e,!1,function(e){void 0!==e&&0!=e.length?(E.innerHTML=e,M.appendChild(S),B.value=e,vdnSendDialog(e,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{V.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()},Z())):(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.notAudible),vdnIntentResponsePlayer.play(),B.placeholder=vdnMessages.ask)})})}),void(Q=!1)}try{M.removeChild(S)}catch(e){}try{M.removeChild(x)}catch(e){}try{M.removeChild(k)}catch(e){}if(B.placeholder=c(),O.classList.add("listening"),e.preventDefault(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),J="",Q=!0,vdnAudioRecorder.clear(),vdnAudioRecorder.record(O),!0===vdnClientInfo.ios){i(),K.classList.contains("vdn-hide-element")||(window.vdnIosMicTimeoutIdentifier=setTimeout(function(){d(K,X,!0)},4e3))}n(),window.vdnMicTimeoutIdentifier=setTimeout(function(){let e=O.classList;e&&e.contains("listening")&&O.click()},l)}(!0===vdnClientInfo.ios||vdnClientInfo.safari&&!vdnClientInfo.chrome&&!vdnClientInfo.firefox||vdnClientInfo.windows&&vdnClientInfo.firefox)&&(vdnIntentResponsePlayer.configure(vdnSilenceSoundPath),vdnIntentResponsePlayer.play()),!0!==a(O.getAttribute("id"),O)&&(vdnAudioRecorder&&vdnAudioContext?t():vdnInitAudio(function(e){if(!vdnAudioRecorder||!vdnAudioContext){try{M.removeChild(k)}catch(e){}return k.innerHTML=vdnMessages.micNotAccessible,M.appendChild(k),!1}t()}))},!1);function Z(){return{chatConvoEl:M,userMsgElWrapper:S,userMsgEl:E,simonMsgEl:x,errorMsgEl:k,expandCollapseHandle:function(){ee("expand")}}}function $(e,t){if(void 0===e||null==e||0==e.length)return!1;let n=document.querySelector(e);if(n.classList)n.classList.toggle(t);else{let e=n.className.split(" "),i=e.indexOf(t);i>=0?e.splice(i,1):(e.push(t),n.className=e.join(" "))}}function ee(e=null){try{if(!M)return!1;let t=M.classList,n=L.classList,i=I.classList;"expand"==e?(t.contains("vdn-hide-element")&&t.remove("vdn-hide-element"),n.contains("vdn-expand-window")&&(n.add("vdn-collapse-window"),n.remove("vdn-expand-window")),i.contains(A)&&(i.remove(A),i.add(y))):(t.toggle("vdn-hide-element"),n.toggle("vdn-expand-window"),n.toggle("vdn-collapse-window"),i.toggle(y),i.toggle(A))}catch(e){console.log("VDN Error: something went wrong while expanding/collapsing a chat window.")}}O.addEventListener("mouseover",function(e){O.title=c()})}();1 window.onload=(e=>{!function(){"use strict";let e="undefined"!=typeof vdnDisableSearchMic&&"1"==vdnDisableSearchMic,t="undefined"!=typeof vdnDisableFormsMic&&"1"==vdnDisableFormsMic;function n(){try{window.vdnMicTimeoutIdentifier&&(clearTimeout(window.vdnMicTimeoutIdentifier),window.vdnMicTimeoutIdentifier=null)}catch(e){}}function i(){try{if(!1===vdnClientInfo.ios)return!1;window.vdnIosMicTimeoutIdentifier&&(clearTimeout(window.vdnIosMicTimeoutIdentifier),window.vdnIosMicTimeoutIdentifier=null)}catch(e){}}function o(e,t,n=!1){try{let i=e.classList||null,o=t.classList||null;if(!i||!o)return!1;!0===n?(i.add("vdn-hide-element"),o.remove("vdn-hide-element")):(i.remove("vdn-hide-element"),o.add("vdn-hide-element"))}catch(e){}}n(),i(),vdnTypeOfSearch="undefined"!=typeof vdnTypeOfSearch&&null!==vdnTypeOfSearch?vdnTypeOfSearch:"native";let d=["Ask about our company","Ask for opening hours"];vdnSearchableHints="undefined"!=typeof vdnSearchableHints&&null!==vdnSearchableHints?vdnSearchableHints:d,vdnSearchableHints.constructor!==Array&&(vdnSearchableHints=[]),0==vdnSearchableHints.length&&(vdnSearchableHints=d);let l=null,s=2e4;function r(e){return e=parseInt(e,10),isNaN(e)||null==e?0:e}function a(e=null,t=null){let n=!1;try{let i=document.querySelectorAll("button.voice-dialog-navigation-button");if(null==i||null==e)return n;let o=i.length;for(let t=0;t<o;t++){let o=i[t].className,d=i[t].getAttribute("id");if(void 0!==o&&""!=o.trim()&&(-1!=o.indexOf("listening")&&e!=d)){n=!0;break}}if(0==n&&null===t){let e=document.querySelector("#vdnWidgetMic");null!==e&&-1!=e.className.indexOf("listening")&&(n=!0)}}catch(e){n=!1}return n}function c(){let e="Ask about us.";try{let t=vdnSearchableHints.length,n=Math.floor(Math.random()*t),i=vdnSearchableHints[n];void 0!==i&&""!=i.trim()&&(e=i)}catch(t){e="Ask about us."}return e}"undefined"!=typeof vdnMicListenTimeoutDuration&&null!==vdnMicListenTimeoutDuration?(l=parseInt(vdnMicListenTimeoutDuration),l=isNaN(l)?8:l):l=8,l=(l=l<8?8:l)>20?20:l,l*=1e3;let v=document.querySelector("div#search-outer form input[type=text]"),u=document.querySelector("div#mobile-menu form input[type=text]");null!==v&&v.setAttribute("data-vdn-top-search-bar","true"),null!==u&&u.setAttribute("data-vdn-mobile-search-bar","true");let p=document.querySelectorAll("form"),g=["text","email","search"],m=null,f=null;[].forEach.call(p,function(d,v){try{let p=d.getAttribute("style"),h=null!=p&&""!=p.trim();p=h?p+";":"",d.setAttribute("style",p+"display: block !important"),d.classList.add("vdn-sanitize-form-wrapper");let b=!1;var u=!1;let y=d.getAttribute("role")||"",w=d.classList||"",A=d.querySelectorAll('input:not([type=hidden]):not([id=vdnWidgetSearch]):not([style*="none"]), button[type=submit], textarea.note');("search"===y.toLowerCase()||w.contains("searchform")||w.contains("search_form")||w.contains("search-form")||w.contains("searchForm"))&&(b=!0),b&&!m&&(m=d),[].forEach.call(A,function(m,h){let y=null,w=m.getAttribute("type")||"",A=m.className||"",I=m.getAttribute("id")||null,R=m.tagName;I&&null!==I&&(I=I.toLowerCase()),A&&null!==A&&(A=A.toLowerCase());let C=!1;-1===A.indexOf("datepicker")&&-1===A.indexOf("date")&&"datepicker"!==I&&"date"!==I||(C=!0),-1===A.indexOf("datepicker")&&"datepicker"!==I&&-1!==A.search(/validat|candidat/gi)&&(C=!1),"text"===w&&-1!==A.search(/email/gi)&&(w="email");let P="textarea"===R.toLowerCase();if(g.includes(w)&&0==C||1==P)y=m;else if(!("submit"!=w.toLowerCase()||e&&t)){if(b&&!e){let e=m.querySelectorAll("img, svg");for(let t=0;t<e.length;t++){e[t].classList.add("vdn-hide-element")}}d.addEventListener("submit",function(t){if(1==u)return t.preventDefault(),!1;if(!0===b&&!e)try{if("native"!=vdnTypeOfSearch){if(t.preventDefault(),"undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),vdnIntentResponsePlayer.play(),!1;if(!vdnClientInfo.android){vdnIntentResponsePlayer.configure(vdnAlternativeResponse.basic),vdnIntentResponsePlayer.play();let e=this.querySelector("input.vd-navigation-mic-band"),t=e?e.value:"";vdnSendDialog(t,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{d.submit()}catch(e){console.log("VDN: Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()})}}}catch(e){console.log("VDN Exception: Unable to submit the form due to: "+e.message)}},!1)}if(null===y)return!0;if(b){if(f||(f=y),e)return!1}else if(t)return!1;let L=document.createElement("button");L.setAttribute("type","button"),L.setAttribute("class","voice-dialog-navigation-button"),L.setAttribute("id","voice-dialog-navigation-button"+v+h);let M=document.createElement("img");M.setAttribute("src",vdnImagesPath+"vdn-mic.svg"),M.setAttribute("class","vdn-mic-image"),M.setAttribute("id","vdn-mic-img"+v+h),L.appendChild(M);let S=document.createElement("img");!0===vdnClientInfo.ios&&(S.setAttribute("src",vdnImagesPath+"vdn-mic-stop.svg"),S.setAttribute("class","vdn-stop-alert vdn-hide-element"),S.setAttribute("id","vdn-mic-stop"+v+h),L.appendChild(S));let T=r(y.offsetHeight),E=y.getAttribute("data-vdn-top-search-bar"),x=y.getAttribute("data-vdn-mobile-search-bar"),k=!1,H=!1;null!=E&&""!=E.trim()&&(k=!0,0==T&&(T=59)),null!=x&&""!=x.trim()&&(H=!0);let D=r(.8*T);0==r(D)&&(T=D=35);let N=r(.1*T);1!=H&&1!=k||(N+=20),!0===P&&(N=10,D=35);let W="top: "+N+"px; ";W+="height: "+D+"px !important; ",W+="width: "+D+"px !important; ",W+="z-index: 999 !important; margin-left: 3px !important; border-radius: 50% !important; border: 2px solid #ffff !important;",L.setAttribute("style",W);let O=document.createElement("div");O.setAttribute("style",p+"display: inline-block !important");let K=window.getComputedStyle(y);O.setAttribute("class","vd-navigation-mic-band"),O.setAttribute("onclick","return false"),O.style.width=K.width,y.insertAdjacentElement("beforebegin",O);let X=y.parentNode.nodeName;null!=X&&0!=X.length&&"form"!=(X=X.toLowerCase())&&(y.parentNode.style.zIndex=1),O.appendChild(y),y.insertAdjacentElement("beforebegin",L),y.setAttribute("style",p+"width: 100% !important"),y.classList.add("vd-navigation-mic-band"),d.setAttribute("style",p);let q,F="";if(1==k&&L.addEventListener("mousedown",function(e){return e.preventDefault(),!0},!1),"webkitSpeechRecognition"in window){let e=new webkitSpeechRecognition;function V(){if(u=!1,!q)if(L.classList.remove("listening"),L.style.setProperty("color","white"),!0===b){let t=Math.floor(10*Math.random()),n=vdnAlternativeResponse.randomLib;vdnIntentResponsePlayer.configure(n[t],function(){e()}),vdnIntentResponsePlayer.play()}else e();function e(){if(void 0!==F&&0!=F.length){let e=F;"email"===w&&(e=vdnFormatEmail(e));let t=e&&null!==e?e:F;!0===P?y.value+=" "+t:y.value=t,!0===b&&vdnSendDialog(F,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{d.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()})}else y.placeholder=vdnMessages.ask}}e.continuous=!0,e.interimResults=!0,e.onstart=function(){u=!0},e.onerror=function(e){L.classList.remove("listening"),u=!1,"no-speech"==e.error&&(y.placeholder=vdnMessages.unableToHear,vdnIntentResponsePlayer.configure(vdnAlternativeResponse.notAudible),vdnIntentResponsePlayer.play(),q=!0),"audio-capture"==e.error&&(y.placeholder=vdnMessages.micNotAccessible,q=!0),"not-allowed"==e.error&&(y.placeholder=vdnMessages.browserDenyMicAccess,L.style.setProperty("color","white"),q=!0)},e.onend=function(){vdnClientInfo.android&&V()},e.onresult=function(t){let n="";if(void 0===t.results)return e.onend=null,e.stop(),y.placeholder=vdnMessages.unableToHear,vdnIntentResponsePlayer.configure(vdnAlternativeResponse.micConnect),void vdnIntentResponsePlayer.play();let i=t.results.length;for(let o=t.resultIndex;o<i;++o)t.results[o].isFinal?(F=t.results[o][0].transcript,0==vdnClientInfo.android&&(V(),e.stop())):!1===P&&(n+=t.results[o][0].transcript,y.value=n)},L.addEventListener("click",function(t){if(!0!==a(L.getAttribute("id")))return"undefined"==typeof vdnXApiKey||null===vdnXApiKey?(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),void vdnIntentResponsePlayer.play()):void(u?(n(),!0===b&&(y.placeholder=c()),0==vdnClientInfo.android&&(V(),e.stop())):(!0===b&&(y.placeholder=c()),L.classList.add("listening"),t.preventDefault(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),F="",!1===P&&(y.value=""),u=!0,e.lang=vdnSelectedLang,e.start(),q=!1,n(),window.vdnMicTimeoutIdentifier=setTimeout(function(){let e=L.classList;e&&e.contains("listening")&&L.click()},"textarea"==y.tagName.toLowerCase()?s:l)))})}else L.addEventListener("click",function(e){function t(){if("undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),vdnIntentResponsePlayer.play(),!1;if(u){if(n(),!0===vdnClientInfo.ios){i(),M.classList.contains("vdn-hide-element")&&o(M,S)}return vdnAudioRecorder.stop(),vdnStopAudio(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),L.classList.remove("listening"),L.style.setProperty("color","white"),y.placeholder=vdnMessages.transcribeText,vdnAudioRecorder.getBuffers(function(e){vdnAudioRecorder.exportWAV(function(e){vdnRecIndex++,vdnStt(e,!1,function(e){if(void 0!==e&&0!=e.length){let t=e;"email"===w&&(t=vdnFormatEmail(t));let n=t&&null!==t?t:e;!0===P?y.value+=" "+n:y.value=n,!0===b&&vdnSendDialog(e,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{d.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()})}else vdnIntentResponsePlayer.configure(vdnAlternativeResponse.notAudible),vdnIntentResponsePlayer.play(),y.placeholder=vdnMessages.ask})})}),void(u=!1)}if(!0===b&&(y.placeholder=c()),L.classList.add("listening"),e.preventDefault(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),F="",!1===P&&(y.value=""),u=!0,vdnAudioRecorder.clear(),vdnAudioRecorder.record(L,y.tagName),!0===vdnClientInfo.ios){i(),M.classList.contains("vdn-hide-element")||(window.vdnIosMicTimeoutIdentifier=setTimeout(function(){o(M,S,!0)},4e3))}n(),window.vdnMicTimeoutIdentifier=setTimeout(function(){let e=L.classList;e&&e.contains("listening")&&L.click()},"textarea"==y.tagName.toLowerCase()?s:l)}(!0===vdnClientInfo.ios||vdnClientInfo.safari&&!vdnClientInfo.chrome&&!vdnClientInfo.firefox||vdnClientInfo.windows&&vdnClientInfo.firefox)&&(vdnIntentResponsePlayer.configure(vdnSilenceSoundPath),vdnIntentResponsePlayer.play()),!0!==a(L.getAttribute("id"))&&(vdnAudioRecorder&&vdnAudioContext?t():vdnInitAudio(function(e){if(!vdnAudioRecorder||!vdnAudioContext)return alert(vdnMessages.micNotAccessible),!1;t()}))},!1);L.addEventListener("mouseover",function(e){!0===b&&(L.title=c())})})}catch(e){}});let h=document.createElement("div"),b="vdn-widget-wrapper-middle-right",y="vdn-widget-chat-wrapper-middle-right",w=vdnSelectedMicPosition?vdnSelectedMicPosition.toLowerCase():"middle right",A="vdn-widget-chat-wrapper-middle-right-collapse";switch(w){case"middle left":b="vdn-widget-wrapper-middle-left",y="vdn-widget-chat-wrapper-middle-left",A="vdn-widget-chat-wrapper-middle-left-collapse";break;case"top right":b="vdn-widget-wrapper-top-right",y="vdn-widget-chat-wrapper-top-right",A="vdn-widget-chat-wrapper-top-right-collapse";break;case"top left":b="vdn-widget-wrapper-top-left",y="vdn-widget-chat-wrapper-top-left",A="vdn-widget-chat-wrapper-top-left-collapse";break;case"bottom right":b="vdn-widget-wrapper-bottom-right",y="vdn-widget-chat-wrapper-bottom-right",A="vdn-widget-chat-wrapper-bottom-right-collapse";break;case"bottom left":b="vdn-widget-wrapper-bottom-left",y="vdn-widget-chat-wrapper-bottom-left",A="vdn-widget-chat-wrapper-bottom-left-collapse";break;default:b="vdn-widget-wrapper-middle-right",y="vdn-widget-chat-wrapper-middle-right",A="vdn-widget-chat-wrapper-middle-right-collapse"}h.setAttribute("class","vdn-widget-wrapper "+b);let I=document.createElement("div");I.setAttribute("class","vdn-widget-chat-wrapper "+A);let R=document.createElement("div");R.setAttribute("class","vdn-widget-chat-header");let C=document.createElement("div"),P=vdnVoiceType.female?"Simone":"Simon";C.setAttribute("class","vdn-widget-chat-option"),C.innerHTML='<div><img class="vdn-widget-chat-option-bot-icon" src="'+vdnImagesPath+'Voice Assistant Bot Icon.png"/></div><span class="vdn-widget-agent-name">'+P+'</b></span><br><span class="vdn-widget-agent">Web Virtual Assistant</span>';let L=document.createElement("span");L.setAttribute("class","vdn-expand-window vdn-expand-collapse-handle"),L.addEventListener("click",function(){ee()},!1),C.appendChild(L),R.appendChild(C);let M=document.createElement("div");M.setAttribute("id","vdnWidgetChatConvo"),M.setAttribute("class","vdn-widget-chat-convo vdn-hide-element");let S=document.createElement("span");S.setAttribute("class","vdn-widget-chat-msg-item vdn-widget-chat-msg-item-user");let T=document.createElement("div");T.setAttribute("class","vdn-widget-chat-avatar"),T.innerHTML="<center><b>"+vdnWidgetMessages.you+"</b></center>",S.appendChild(T);let E=document.createElement("span");S.appendChild(E);let x=document.createElement("span");x.setAttribute("class","vdn-widget-chat-msg-item vdn-widget-chat-msg-item-simon");let k=document.createElement("span");k.setAttribute("class","vdn-widget-chat-msg-item vdn-widget-chat-msg-error");let H=(vdnVoiceType.female?vdnWidgetMessages.simonIntro.name+"e":vdnWidgetMessages.simonIntro.name)+vdnWidgetMessages.simonIntro.intro+"<br/><br/>",D=vdnWidgetMessages.simonGuidelines,N=document.createElement("span");N.setAttribute("class","vdn-widget-chat-msg-item vdn-widget-chat-msg-item-simon"),N.innerHTML=H+D,M.appendChild(N);let W=document.createElement("div");W.setAttribute("class","vdn-widget-field");let O=document.createElement("a");O.setAttribute("id","vdnWidgetMic"),O.setAttribute("class","vdn-widget-button");let K=document.createElement("img");K.setAttribute("id","vdn-widget-mic-img"),K.setAttribute("src",vdnImagesPath+"vdn-widget-mic-black.svg"),O.appendChild(K);let X=document.createElement("img");!0===vdnClientInfo.ios&&(X.setAttribute("src",vdnImagesPath+"vdn-mic-stop.svg"),X.setAttribute("class","vdn-stop-alert vdn-hide-element"),X.setAttribute("id","vdn-mic-stop"),O.appendChild(X));let q=document.createElement("a");q.setAttribute("id","vdnWidgetSearchBtn");let F=document.createElement("button");F.setAttribute("class","vdn-widget-form-submit-btn"),F.setAttribute("type","submit"),F.setAttribute("alt","Go"),F.setAttribute("title","Search"),q.appendChild(F);let V=document.createElement("form");V.setAttribute("class","vdn-widget-form"),null!==m?(V.action=m.action,V.method=m.method):(V.action=vdnGetCurrentHostURL()+"/",V.method="get");let B=document.createElement("input");B.setAttribute("id","vdnWidgetSearch"),B.setAttribute("class","vdn-widget-search vdn-widget-search-text"),B.setAttribute("name","vdn-widget-search"),B.setAttribute("placeholder",vdnWidgetMessages.placeholder),B.setAttribute("name","s"),V.addEventListener("submit",function(e){try{M.removeChild(S)}catch(e){}try{M.removeChild(x)}catch(e){}try{M.removeChild(k)}catch(e){}if("native"!=vdnTypeOfSearch){if(e.preventDefault(),"undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),vdnIntentResponsePlayer.play(),!1;0!=B.value.length&&(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.basic),vdnIntentResponsePlayer.play(),vdnSendDialog(B.value,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{V.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()},Z()))}},!1),V.appendChild(B),V.appendChild(q),W.appendChild(O),W.appendChild(V),I.appendChild(R),I.appendChild(M),I.appendChild(W);let j=document.createElement("a");j.setAttribute("id","vdnWidgetToggleButton"),j.setAttribute("class","vdn-widget-button vdn-blink-widget-toggle-button");let z=vdnFloatingButtonIcon&&"robotIcon"==vdnFloatingButtonIcon?"vdn-toggle-btn-robot":"vdn-toggle-btn-mic",G=document.createElement("div");G.setAttribute("class","vdn-widget-icon vdn-widget-toggle-button "+z),j.appendChild(G),h.appendChild(I),h.appendChild(j),document.body.insertAdjacentElement("afterend",h),O.addEventListener("mouseover",function(e){O.title=c()}),j.addEventListener("click",function(e){!function(){null===localStorage.getItem("vdnSimonIntroduced")?(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.simonShortIntro),vdnIntentResponsePlayer.play(),localStorage.setItem("vdnSimonIntroduced","yes")):-1!=G.className.indexOf(z)&&(N.innerHTML=D,void 0!==M.scrollTop&&void 0!==M.scrollHeight&&(M.scrollTop=M.scrollHeight));$(".vdn-widget-toggle-button",z),$(".vdn-widget-toggle-button","vdn-toggle-btn-close"),$(".vdn-widget-toggle-button","vdn-widget-active"),$(".vdn-widget-toggle-button","vdn-widget-visible"),$("#vdnWidgetToggleButton","vdn-widget-float"),$(".vdn-widget-chat-wrapper","vdn-widget-visible"),$(".vdn-widget-button","vdn-widget-visible")}()}),document.body.onload=function(){let e=localStorage.getItem("vdnWidgetConversation");if(null!==e){let t=JSON.parse(e),n=t.userQuery||null,i=t.simonResponse||null;null!==n&&null!==i&&(j.classList.remove("vdn-blink-widget-toggle-button"),E.innerHTML=n,x.innerHTML=i,M.appendChild(S),M.appendChild(x),!1===vdnClientInfo.ios&&j.click()),ee("expand")}localStorage.removeItem("vdnWidgetConversation")};let U,J="",Q=!1,_="";if("webkitSpeechRecognition"in window){let e=new webkitSpeechRecognition;function Y(){if(Q=!1,U)return;J=_,O.classList.remove("listening");let e=Math.floor(10*Math.random()),t=vdnAlternativeResponse.randomLib;vdnIntentResponsePlayer.configure(t[e],function(){void 0!==J&&0!=J.length?(E.innerHTML=J,M.appendChild(S),B.value=J,vdnSendDialog(J,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{V.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()},Z())):B.placeholder=vdnMessages.ask}),vdnIntentResponsePlayer.play()}e.continuous=!0,e.interimResults=!0,e.onstart=function(){Q=!0},e.onerror=function(e){O.classList.remove("listening"),Q=!1,"no-speech"==e.error&&(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.notAudible),vdnIntentResponsePlayer.play(),U=!0,k.innerHTML=vdnMessages.unableToHear,M.appendChild(k)),"audio-capture"==e.error&&(U=!0,k.innerHTML=vdnMessages.micNotAccessible,M.appendChild(k)),"not-allowed"==e.error&&(U=!0,k.innerHTML=vdnMessages.browserDenyMicAccess,M.appendChild(k))},e.onend=function(){vdnClientInfo.android&&Y()},e.onresult=function(t){let n="";if(void 0===t.results)return e.onend=null,e.stop(),B.placeholder=vdnMessages.unableToProcess,vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unableToProcess),void vdnIntentResponsePlayer.play();let i=t.results.length;for(let o=t.resultIndex;o<i;++o)t.results[o].isFinal?(_=t.results[o][0].transcript,0==vdnClientInfo.android&&(Y(),e.stop())):n+=t.results[o][0].transcript},O.addEventListener("click",function(t){if(!0!==a(O.getAttribute("id"),O)){if("undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),void vdnIntentResponsePlayer.play();if(Q)n(),B.placeholder=c(),0==vdnClientInfo.android&&(Y(),e.stop());else{try{M.removeChild(S)}catch(e){}try{M.removeChild(x)}catch(e){}try{M.removeChild(k)}catch(e){}B.placeholder=c(),O.classList.add("listening"),t.preventDefault(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),E.innerHTML=J="",Q=!0,e.lang=vdnSelectedLang,e.start(),U=!1,n(),window.vdnMicTimeoutIdentifier=setTimeout(function(){let e=O.classList;e&&e.contains("listening")&&O.click()},l)}}})}else O.addEventListener("click",function(e){function t(){if("undefined"==typeof vdnXApiKey||null===vdnXApiKey)return vdnIntentResponsePlayer.configure(vdnAlternativeResponse.unavailable),vdnIntentResponsePlayer.play(),!1;if(Q){if(n(),!0===vdnClientInfo.ios){i(),K.classList.contains("vdn-hide-element")&&o(K,X)}return vdnAudioRecorder.stop(),vdnStopAudio(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),O.classList.remove("listening"),B.placeholder=vdnMessages.transcribeText,vdnAudioRecorder.getBuffers(function(e){vdnAudioRecorder.exportWAV(function(e){vdnRecIndex++,vdnStt(e,!1,function(e){void 0!==e&&0!=e.length?(E.innerHTML=e,M.appendChild(S),B.value=e,vdnSendDialog(e,function(e,t=null,n=!1){"function"!=typeof t&&(t=function(){if(!0===n)try{V.submit()}catch(e){console.log("Something went wrong while submitting a form for native search.")}}),vdnIntentResponsePlayer.configure(e,t),vdnIntentResponsePlayer.play()},Z())):(vdnIntentResponsePlayer.configure(vdnAlternativeResponse.notAudible),vdnIntentResponsePlayer.play(),B.placeholder=vdnMessages.ask)})})}),void(Q=!1)}try{M.removeChild(S)}catch(e){}try{M.removeChild(x)}catch(e){}try{M.removeChild(k)}catch(e){}if(B.placeholder=c(),O.classList.add("listening"),e.preventDefault(),vdnIntentResponsePlayer.isPlaying()&&vdnIntentResponsePlayer.stop(),J="",Q=!0,vdnAudioRecorder.clear(),vdnAudioRecorder.record(O),!0===vdnClientInfo.ios){i(),K.classList.contains("vdn-hide-element")||(window.vdnIosMicTimeoutIdentifier=setTimeout(function(){o(K,X,!0)},4e3))}n(),window.vdnMicTimeoutIdentifier=setTimeout(function(){let e=O.classList;e&&e.contains("listening")&&O.click()},l)}(!0===vdnClientInfo.ios||vdnClientInfo.safari&&!vdnClientInfo.chrome&&!vdnClientInfo.firefox||vdnClientInfo.windows&&vdnClientInfo.firefox)&&(vdnIntentResponsePlayer.configure(vdnSilenceSoundPath),vdnIntentResponsePlayer.play()),!0!==a(O.getAttribute("id"),O)&&(vdnAudioRecorder&&vdnAudioContext?t():vdnInitAudio(function(e){if(!vdnAudioRecorder||!vdnAudioContext){try{M.removeChild(k)}catch(e){}return k.innerHTML=vdnMessages.micNotAccessible,M.appendChild(k),!1}t()}))},!1);function Z(){return{chatConvoEl:M,userMsgElWrapper:S,userMsgEl:E,simonMsgEl:x,errorMsgEl:k,expandCollapseHandle:function(){ee("expand")}}}function $(e,t){if(void 0===e||null==e||0==e.length)return!1;let n=document.querySelector(e);if(n.classList)n.classList.toggle(t);else{let e=n.className.split(" "),i=e.indexOf(t);i>=0?e.splice(i,1):(e.push(t),n.className=e.join(" "))}}function ee(e=null){try{if(!M)return!1;let t=M.classList,n=L.classList,i=I.classList;"expand"==e?(t.contains("vdn-hide-element")&&t.remove("vdn-hide-element"),n.contains("vdn-expand-window")&&(n.add("vdn-collapse-window"),n.remove("vdn-expand-window")),i.contains(A)&&(i.remove(A),i.add(y))):(t.toggle("vdn-hide-element"),n.toggle("vdn-expand-window"),n.toggle("vdn-collapse-window"),i.toggle(y),i.toggle(A))}catch(e){console.log("VDN Error: something went wrong while expanding/collapsing a chat window.")}}O.addEventListener("mouseover",function(e){O.title=c()})}()}); -
voice-dialog-navigation/trunk/readme.txt
r2270015 r2319166 5 5 Tested up to: 5.3.2 6 6 Requires PHP: 5.3 7 Stable tag: 3.0. 07 Stable tag: 3.0.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 310 310 = 3.0.0 = 311 311 * Improved Voice Response 312 * With this release the plugin uses a payed service to synthesize the response and stores the audio file on the server. 313 * With this change in place the spoken response will play the same high-quality voice regardless of the device or browser used 314 312 * With this release the plugin uses a payed service to synthesize the response and stores the audio file on the server. 313 * With this change in place the spoken response will play the same high-quality voice regardless of the device or browser used 314 315 = 3.0.1 = 316 * Bug Fix 317 * Fixed formatting issues with Mic in Forms Fields 318 319 -
voice-dialog-navigation/trunk/voice-dialog-navigation.php
r2270015 r2319166 3 3 * Plugin Name: Voice Dialog – Navigation 4 4 * Description: Allows visitors to engage into an intelligent dialog with the web page. Visitor can ask questions, get answers and use voice to navigate the web page, both on desktop and mobile. 5 * Version: 3.0. 05 * Version: 3.0.1 6 6 * Author: speak2web 7 7 * Author URI: https://speak2web.com/
Note: See TracChangeset
for help on using the changeset viewer.